From b3a7049083bb1bc2044d4839ac5ded3e7ce5cdb8 Mon Sep 17 00:00:00 2001 From: marauder2k7 Date: Sun, 28 Jun 2026 07:52:35 +0100 Subject: [PATCH] Update assimpShapeLoader.cpp fix front sign handling Fix check for bounds in an assimp file --- Engine/source/ts/assimp/assimpShapeLoader.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Engine/source/ts/assimp/assimpShapeLoader.cpp b/Engine/source/ts/assimp/assimpShapeLoader.cpp index 50f5d3a12..d1c295a4e 100644 --- a/Engine/source/ts/assimp/assimpShapeLoader.cpp +++ b/Engine/source/ts/assimp/assimpShapeLoader.cpp @@ -277,6 +277,17 @@ void AssimpShapeLoader::enumerateScene() getRootAxisTransform(); + bool fileHasBounds = false; + for (U32 i = 0; i < mScene->mNumMeshes && !fileHasBounds; ++i) + { + if (dStricmp(mScene->mMeshes[i]->mName.C_Str(), "bounds") == 0) + fileHasBounds = true; + } + if (!fileHasBounds) + fileHasBounds = (AssimpAppNode::findChildNodeByName("bounds", mScene->mRootNode) != nullptr); + + Con::printf("[ASSIMP] Bounds pre-scan: %s", fileHasBounds ? "found in scene" : "not found - will synthesise"); + for (U32 i = 0; i < mScene->mNumTextures; ++i) { extractTexture(i, mScene->mTextures[i]); } @@ -317,7 +328,7 @@ void AssimpShapeLoader::enumerateScene() // Bounds check — every Torque shape needs a bounds node. // If the source file didn't include one, synthesise it - if (!boundsNode) + if (!fileHasBounds) { Con::printf("[ASSIMP] No 'bounds' node found - adding synthetic bounds node."); aiNode* boundsAiNode = new aiNode("bounds"); @@ -396,7 +407,7 @@ void AssimpShapeLoader::configureImportUnits() { void AssimpShapeLoader::getRootAxisTransform() { int upAxis = 1, upSign = 1; - int frontAxis = 2, frontSign = -1; + int frontAxis = 2, frontSign = 1; int coordAxis = 0, coordSign = 1; aiMetadata* meta = mScene->mMetaData; @@ -441,7 +452,7 @@ void AssimpShapeLoader::getRootAxisTransform() return v; }; - Point3F forward = axisToVector(frontAxis, -frontSign); + Point3F forward = axisToVector(frontAxis, frontSign == 1 ? -frontSign : frontSign); Point3F up = axisToVector(upAxis, upSign); Point3F right = mCross(forward, up);