mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-14 22:50:45 +00:00
Fixed recursive mesh adding in findEntities for gltf scenes
This commit is contained in:
parent
972a727f1e
commit
fd975a8f24
1 changed files with 9 additions and 4 deletions
|
@ -560,14 +560,15 @@ void ResolveEntity( gltfData* data, idMapEntity* newEntity, gltfNode* node )
|
|||
#endif
|
||||
}
|
||||
|
||||
int FindEntities( gltfData* data, idMapEntity::EntityListRef entities, gltfNode* node , idDict epairs )
|
||||
int FindEntities( gltfData* data, idMapEntity::EntityListRef entities, gltfNode* node , idDict epairs , idMapEntity* worldspawn )
|
||||
{
|
||||
int entityCount = 0;
|
||||
|
||||
const char* classname = node->extras.strPairs.GetString( "classname" );
|
||||
|
||||
// skip all nodes with "worldspawn." or "BSP" in the name
|
||||
if( idStr::Icmpn( node->name, "BSP", 3 ) != 0 && idStr::Icmpn( node->name, "worldspawn.", 11 ) != 0 )
|
||||
if( idStr::Icmpn( node->name, "BSP", 3 ) != 0
|
||||
&& idStr::Icmpn( node->name, "worldspawn.", 11 ) != 0 )
|
||||
{
|
||||
idStr classnameStr = node->extras.strPairs.GetString( "classname" );
|
||||
|
||||
|
@ -592,10 +593,14 @@ int FindEntities( gltfData* data, idMapEntity::EntityListRef entities, gltfNode*
|
|||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
AddMeshesToWorldspawn_r( worldspawn, node, mat4_identity, data );
|
||||
}
|
||||
|
||||
for( auto& child : node->children )
|
||||
{
|
||||
entityCount += FindEntities( data, entities, data->NodeList()[child], epairs );
|
||||
entityCount += FindEntities( data, entities, data->NodeList()[child], epairs , worldspawn );
|
||||
}
|
||||
|
||||
return entityCount;
|
||||
|
@ -664,7 +669,7 @@ int idMapEntity::GetEntities( gltfData* data, EntityListRef entities, int sceneI
|
|||
// add entities from all subnodes
|
||||
for( auto& child : node->children )
|
||||
{
|
||||
entityCount += FindEntities( data, entities, data->NodeList()[child] , epairs );
|
||||
entityCount += FindEntities( data, entities, data->NodeList()[child] , epairs, worldspawn );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue