mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-13 15:44:36 +00:00
Assimp just armature tests
Remove the check for incomplete scene Move child recursion to assimpAppNode in BuildChildList same for meshes
This commit is contained in:
parent
e3e5fc3d0f
commit
2606b6366b
3 changed files with 24 additions and 21 deletions
|
|
@ -289,3 +289,23 @@ void AssimpAppNode::addMesh(AssimpAppMesh* child)
|
||||||
{
|
{
|
||||||
mMeshes.push_back(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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -61,8 +61,8 @@ class AssimpAppNode : public AppNode
|
||||||
void getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq);
|
void getAnimatedTransform(MatrixF& mat, F32 t, aiAnimation* animSeq);
|
||||||
Point3F interpolateVectorKey(const aiVectorKey* keys, U32 numKeys, F32 frameTime);
|
Point3F interpolateVectorKey(const aiVectorKey* keys, U32 numKeys, F32 frameTime);
|
||||||
QuatF interpolateQuaternionKey(const aiQuatKey* keys, U32 numKeys, F32 frameTime);
|
QuatF interpolateQuaternionKey(const aiQuatKey* keys, U32 numKeys, F32 frameTime);
|
||||||
void buildMeshList() override {};
|
void buildMeshList() override;
|
||||||
void buildChildList() override {};
|
void buildChildList() override;
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
const aiScene* mScene;
|
const aiScene* mScene;
|
||||||
|
|
|
||||||
|
|
@ -231,7 +231,7 @@ void AssimpShapeLoader::enumerateScene()
|
||||||
// Read the file
|
// Read the file
|
||||||
mScene = mImporter.ReadFile(shapePath.getFullPath().c_str(), ppsteps);
|
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] ERROR: Could not load file: %s", shapePath.getFullPath().c_str());
|
||||||
Con::errorf("[ASSIMP] Importer error: %s", mImporter.GetErrorString());
|
Con::errorf("[ASSIMP] Importer error: %s", mImporter.GetErrorString());
|
||||||
TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import failed");
|
TSShapeLoader::updateProgress(TSShapeLoader::Load_Complete, "Import failed");
|
||||||
|
|
@ -341,24 +341,7 @@ void AssimpShapeLoader::processAssimpNode(const aiNode* node, const aiScene* sce
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
currNode = new AssimpAppNode(scene, node, parentNode);
|
currNode = new AssimpAppNode(scene, node, parentNode);
|
||||||
|
processNode(currNode);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue