Skip to content

Commit

Permalink
fbx import - convert lhs - rhs
Browse files Browse the repository at this point in the history
  • Loading branch information
nem0 committed Dec 6, 2024
1 parent e658b5c commit e0f022b
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/renderer/editor/fbx_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -427,10 +427,6 @@ struct FBXImporter : ModelImporter {
Matrix transform_matrix = Matrix::IDENTITY;
Matrix geometry_matrix = toLumix(mesh->getGeometricMatrix());
transform_matrix = toLumix(mesh->getGlobalTransform()) * geometry_matrix;
const bool flip_handness = doesFlipHandness(transform_matrix);
if (flip_handness) {
logError("Mesh ", mesh->name, " in ", path, " flips handness. This is not supported and the mesh will not display correctly.");
}

ofbx::Vec3Attributes normals = geom.getNormals();
ofbx::Vec3Attributes tangents = geom.getTangents();
Expand Down Expand Up @@ -469,6 +465,13 @@ struct FBXImporter : ModelImporter {

remap(unindexed_triangles, import_mesh);
import_mesh.index_size = areIndices16Bit(import_mesh) ? 2 : 4;

const bool flip_handness = doesFlipHandness(transform_matrix);
if (flip_handness) {
for (i32 i = 0, n = import_mesh.indices.size(); i < n; i += 3) {
swap(import_mesh.indices[i], import_mesh.indices[i+1]);
}
}
}
});

Expand Down

0 comments on commit e0f022b

Please sign in to comment.