Pārlūkot izejas kodu

Merge pull request #1558 from marauder2k9-torque/assimp-armature-fixes

Assimp just armature tests
Brian Roberts 4 nedēļas atpakaļ
vecāks
revīzija
411318c4d4

+ 20 - 0
Engine/source/ts/assimp/assimpAppNode.cpp

@@ -289,3 +289,23 @@ void AssimpAppNode::addMesh(AssimpAppMesh* child)
 {
    mMeshes.push_back(child);
 }
+
+void AssimpAppNode::buildMeshList()
+{
+   for (U32 i = 0; i < mNode->mNumMeshes; i++)
+   {
+      U32 meshIdx = mNode->mMeshes[i];
+      const aiMesh* mesh = mScene->mMeshes[meshIdx];
+      AssimpAppMesh* curMesh = new AssimpAppMesh(mesh, this);
+      mMeshes.push_back(curMesh);
+   }
+}
+
+void AssimpAppNode::buildChildList()
+{
+   for (U32 i = 0; i < mNode->mNumChildren; i++)
+   {
+      const aiNode* node = mNode->mChildren[i];
+      mChildNodes.push_back(new AssimpAppNode(mScene, node, this));
+   }
+}

+ 2 - 2
Engine/source/ts/assimp/assimpAppNode.h

@@ -61,8 +61,8 @@ class AssimpAppNode : public AppNode
    void getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq);
    Point3F interpolateVectorKey(const aiVectorKey* keys, U32 numKeys, F32 frameTime);
    QuatF interpolateQuaternionKey(const aiQuatKey* keys, U32 numKeys, F32 frameTime);
-   void buildMeshList() override {};
-   void buildChildList() override {};
+   void buildMeshList() override;
+   void buildChildList() override;
 protected:
 
    const aiScene*   mScene;

+ 2 - 19
Engine/source/ts/assimp/assimpShapeLoader.cpp

@@ -231,7 +231,7 @@ void AssimpShapeLoader::enumerateScene()
    // Read the file
    mScene = mImporter.ReadFile(shapePath.getFullPath().c_str(), ppsteps);
 
-   if (!mScene || (mScene->mFlags & AI_SCENE_FLAGS_INCOMPLETE) || !mScene->mRootNode) {
+   if (!mScene || !mScene->mRootNode) {
       Con::errorf("[ASSIMP] ERROR: Could not load file: %s", shapePath.getFullPath().c_str());
       Con::errorf("[ASSIMP] Importer error: %s", mImporter.GetErrorString());
       TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import failed");
@@ -341,24 +341,7 @@ void AssimpShapeLoader::processAssimpNode(const aiNode* node, const aiScene* sce
    else
    {
       currNode = new AssimpAppNode(scene, node, parentNode);
-
-      if (parentNode)
-      {
-         parentNode->addChild(currNode);
-      }
-
-      for (U32 i = 0; i < node->mNumMeshes; i++)
-      {
-         U32 meshIdx = node->mMeshes[i];
-         const aiMesh* mesh = scene->mMeshes[meshIdx];
-         AssimpAppMesh* curMesh = new AssimpAppMesh(mesh, currNode);
-         currNode->addMesh(curMesh);
-      }
-   }
-   // Recursively process child nodes
-   for (U32 i = 0; i < node->mNumChildren; i++)
-   {
-      processAssimpNode(node->mChildren[i], scene, currNode);
+      processNode(currNode);
    }
 }