Implements ignore filter for assimp fbx dummy nodes.

Adds gltf binary to list of supported extensions.
This commit is contained in:
OTHGMars 2019-03-24 06:25:38 -04:00
parent 4f7806fe8e
commit 90577661dc
2 changed files with 15 additions and 3 deletions

View file

@ -103,7 +103,8 @@ MODULE_BEGIN( AssimpShapeLoader )
TSShapeLoader::addFormat("3D GameStudio (3DGS)", "mdl");
TSShapeLoader::addFormat("3D GameStudio (3DGS) Terrain", "hmp");
TSShapeLoader::addFormat("Izware Nendo", "ndo");
TSShapeLoader::addFormat("gltf", "gltf");
TSShapeLoader::addFormat("gltf", "gltf");
TSShapeLoader::addFormat("gltf binary", "glb");
}
MODULE_END;
@ -146,7 +147,7 @@ void AssimpShapeLoader::enumerateScene()
Con::getBoolVariable("$Assimp::OptimizeMeshes", false) ? aiProcess_OptimizeMeshes | aiProcess_OptimizeGraph : 0 |
0;
if(Con::getBoolVariable("$Assimp::Triangulate", false))
if(Con::getBoolVariable("$Assimp::Triangulate", true))
ppsteps |= aiProcess_Triangulate;
if (Con::getBoolVariable("$Assimp::OptimizeMeshes", false))
@ -276,6 +277,15 @@ bool AssimpShapeLoader::canLoadCachedDTS(const Torque::Path& path)
return false;
}
bool AssimpShapeLoader::ignoreNode(const String& name)
{
// Do not add AssimpFbx dummy nodes to the TSShape. See: Assimp::FBX::ImportSettings::preservePivots
// https://github.com/assimp/assimp/blob/master/code/FBXImportSettings.h#L116-L135
if (name.find("_$AssimpFbx$_") != String::NPos)
return true;
return false;
}
//-----------------------------------------------------------------------------
/// This function is invoked by the resource manager based on file extension.
TSShape* assimpLoadShape(const Torque::Path &path)

View file

@ -34,7 +34,9 @@ class AssimpShapeLoader : public TSShapeLoader
protected:
const struct aiScene* mScene;
virtual bool ignoreNode(const String& name);
public:
AssimpShapeLoader();
~AssimpShapeLoader();