diff --git a/neo/renderer/Model_gltf.cpp b/neo/renderer/Model_gltf.cpp index c8b0e186..4ea67006 100644 --- a/neo/renderer/Model_gltf.cpp +++ b/neo/renderer/Model_gltf.cpp @@ -367,7 +367,7 @@ void idRenderModelGLTF::InitFromFile( const char* fileName, const idImportOption auto nodes = data->NodeList(); assert( nodes.Num() ); - //determine root node + // determine root node if( !meshName[0] && data->MeshList().Num() ) { gltfMesh* firstMesh = data->MeshList()[0]; @@ -735,7 +735,7 @@ static bool GatherBoneInfo( gltfData* data, gltfAnimation* gltfAnim, idListrootID; + int targetNode = lastMeshFromFile->GetRootID(); auto skin = data->GetSkin( gltfAnim ); auto targets = data->GetAnimTargets( gltfAnim ); diff --git a/neo/renderer/Model_gltf.h b/neo/renderer/Model_gltf.h index 2b3d966b..c6c7b772 100644 --- a/neo/renderer/Model_gltf.h +++ b/neo/renderer/Model_gltf.h @@ -54,16 +54,24 @@ public: { return true; } - static idFile_Memory* GetAnimBin( const idStr& animName, const ID_TIME_T sourceTimeStamp, const idImportOptions* options ); - int rootID; + static idFile_Memory* GetAnimBin( const idStr& animName, const ID_TIME_T sourceTimeStamp, const idImportOptions* options ); + + int GetRootID() const + { + return rootID; + } + private: void ProcessNode_r( gltfNode* modelNode, const idMat4& parentTransform, const idMat4& globalTransform, gltfData* data ); void UpdateSurface( const struct renderEntity_s* ent, const idJointMat* entJoints, const idJointMat* entJointsInverted, modelSurface_t* surf, const modelSurface_t& sourceSurf ); void UpdateMd5Joints(); const idMD5Joint* FindMD5Joint( const idStr& name ) const; - gltfData* data; - gltfNode* root; + + gltfData* data; + gltfNode* root; + int rootID; + bool fileExclusive; bool hasAnimations;