+ id style gltf2 parser

+ initial attempt to dmap glb/gltf
[!] added blend file and glb for debugging purposes

# Conflicts:
#	neo/idlib/containers/List.h
This commit is contained in:
HarrievG 2022-06-06 00:39:04 +02:00 committed by Robert Beckebans
parent 1d62816a77
commit c1c5917cda
19 changed files with 3874 additions and 32 deletions

View file

@ -1553,6 +1553,7 @@ bool idMapFile::Parse( const char* filename, bool ignoreRegion, bool osPath )
idMapEntity* mapEnt;
int i, j, k;
idStr extension;
name = filename;
name.StripFileExtension();
name.StripFileExtension(); // RB: there might be .map.map
@ -1572,6 +1573,18 @@ bool idMapFile::Parse( const char* filename, bool ignoreRegion, bool osPath )
}
}
bool isGTLF = false;
if ( !src.IsLoaded( ) ) {
// HVG: try loading a .gltf/glb second
fullName.SetFileExtension( "glb" );
isGTLF = src.LoadFile( fullName, osPath );
if ( !isGTLF )
{
fullName.SetFileExtension( "gltf" );
isGTLF = src.LoadFile( fullName, osPath );
}
}
if( !src.IsLoaded() )
{
// now try a .map file
@ -1588,17 +1601,11 @@ bool idMapFile::Parse( const char* filename, bool ignoreRegion, bool osPath )
fileTime = src.GetFileTime();
entities.DeleteContents( true );
if( !src.ReadToken( &token ) )
if(!isGTLF && !src.ReadToken( &token ) )
{
return false;
}
// RB: TODO check for JSON in another way
//if( token == "{" )
//{
// isJSON = true;
//}
if( isJSON )
{
while( true )
@ -1661,7 +1668,11 @@ bool idMapFile::Parse( const char* filename, bool ignoreRegion, bool osPath )
}
}
}
else
else if ( isGTLF )
{
gltfParser->Load( fullName );
idMapEntity::GetEntities(gltfParser->currentAsset,entities,0);
}else
{
if( token == "Version" )
{