diff --git a/neo/framework/Common_mapconvert.cpp b/neo/framework/Common_mapconvert.cpp index ab7eaf67..492f2d2e 100644 --- a/neo/framework/Common_mapconvert.cpp +++ b/neo/framework/Common_mapconvert.cpp @@ -718,7 +718,7 @@ CONSOLE_COMMAND_SHIP( convertMapToValve220, "Convert .map file to the Valve 220 // make sure we have access to all .bimage files for that map fileSystem->BeginLevelLoad( filename, NULL, 0 ); - map.ConvertToValve220Format(); + map.ConvertToValve220Format( true ); fileSystem->EndLevelLoad(); diff --git a/neo/framework/DeclManager.cpp b/neo/framework/DeclManager.cpp index a194b105..3eb49f99 100644 --- a/neo/framework/DeclManager.cpp +++ b/neo/framework/DeclManager.cpp @@ -3580,7 +3580,7 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args ) int totalModelsCount = 0; int totalEntitiesCount = 0; - idFileList* files = fileSystem->ListFilesTree( "generated", ".blwo|.base|.bdae|.bobj|.bmd5mesh", true, true ); + idFileList* files = fileSystem->ListFilesTree( "generated", ".blwo|.base|.bglb|.bobj|.bmd5mesh", true, true ); idStr mapName( "maps/zoomaps/zoo_models.map" ); idMapFile mapFile; @@ -3740,9 +3740,9 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args ) modelName.SetFileExtension( "ase" ); } - if( ext.Icmp( "bdae" ) == 0 ) + if( ext.Icmp( "bglb" ) == 0 ) { - modelName.SetFileExtension( "dae" ); + modelName.SetFileExtension( "glb" ); } if( ext.Icmp( "bobj" ) == 0 ) @@ -3837,18 +3837,24 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args ) idMapEntity* mapEnt = new( TAG_SYSTEM ) idMapEntity(); mapFile.AddEntity( mapEnt ); - // build TB compatible model name - idStrStatic< MAX_OSPATH > exportedModelFileName; - exportedModelFileName = "_tb/"; - exportedModelFileName.AppendPath( modelName ); - exportedModelFileName.SetFileExtension( ".obj" ); - idStrStatic< MAX_OSPATH > entityName; entityName.Format( "misc_model_%d", mapFile.GetNumEntities() ); mapEnt->epairs.Set( "classname", "misc_model" ); mapEnt->epairs.Set( "name", entityName ); - mapEnt->epairs.Set( "proxymodel", exportedModelFileName ); + + // .glb models are the fastest to load into TrenchBroom so skip proxymodel + if( ext.Icmp( "bglb" ) != 0 ) + { + // build TB compatible model name + idStrStatic< MAX_OSPATH > exportedModelFileName; + exportedModelFileName = "_tb/"; + exportedModelFileName.AppendPath( modelName ); + exportedModelFileName.SetFileExtension( ".obj" ); + + mapEnt->epairs.Set( "proxymodel", exportedModelFileName ); + } + mapEnt->epairs.Set( "model", modelName ); EntityInfo_t* entInfo = new( TAG_SYSTEM ) EntityInfo_t; @@ -4126,11 +4132,13 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args ) #endif } - mapFile.ConvertToValve220Format(); + mapFile.ConvertToValve220Format( false ); worldspawn->epairs.Set( "_tb_textures", "textures/common;textures/editor;textures/decals;textures/rock" ); worldspawn->epairs.Set( "_tb_def", "external:base/_tb/fgd/DOOM-3-models.fgd" ); + //"_tb_mod" "mod_unittests" + mapFile.Write( mapName, ".map" ); common->Printf( "\nZoo map written to %s\n", mapName.c_str() ); diff --git a/neo/idlib/MapFile.cpp b/neo/idlib/MapFile.cpp index 7bcb4573..92057267 100644 --- a/neo/idlib/MapFile.cpp +++ b/neo/idlib/MapFile.cpp @@ -3,7 +3,7 @@ Doom 3 BFG Edition GPL Source Code Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company. -Copyright (C) 2015-2023 Robert Beckebans +Copyright (C) 2015-2025 Robert Beckebans Copyright (C) 2020 Admer (id Tech Fox) Copyright (C) 2022 Harrie van Ginneken @@ -145,33 +145,6 @@ void idMapBrushSide::ConvertToValve220Format( const idMat4& entityTransform, idS return; } -#if 0 - // create p1, p2, p3 - idVec3 forward = plane.Normal(); - idVec3 p1 = forward * plane.Dist(); - - // create tangents right,up similar as in Quake's MakeNormalVectors - idVec3 right = forward; - right[1] = -forward[0]; - right[2] = forward[1]; - right[0] = forward[2]; - - float d = right * forward; - right = right + ( -d * forward ); - right.Normalize(); - - idVec3 up = right.Cross( forward ); - - // offset p1 by tangents to have 3 points in a plane - idVec3 p2 = p1 + right; - idVec3 p3 = p1 + up; - - // move planepts from entity space to world space because TrenchBroom can only handle brushes in world space - planepts[0] = entityTransform * p1; - planepts[1] = entityTransform * p2; - planepts[2] = entityTransform * p3; - -#else // from DoomEdit's void BrushPrimit_Parse( brush_t* b, bool newFormat, const idVec3 origin ) idVec3 origin = entityTransform.GetTranslation(); @@ -188,7 +161,6 @@ void idMapBrushSide::ConvertToValve220Format( const idMat4& entityTransform, idS planepts[j].y = w[j].y + origin.y; planepts[j].z = w[j].z + origin.z; } -#endif idVec3 texX, texY; @@ -2996,7 +2968,7 @@ bool idMapFile::ConvertToPolygonMeshFormat() return true; } -bool idMapFile::ConvertToValve220Format() +bool idMapFile::ConvertToValve220Format( bool recalcPlanePoints ) { valve220Format = true; @@ -3237,9 +3209,12 @@ bool idMapFile::ConvertToValve220Format() side->ConvertToValve220Format( transform, textureCollections ); } - // RB: this is not necessary but the initial plane definitions are at the border of the max world size + // RB: this shouldn't necessary but the initial plane definitions are at the border of the max world size // so with this function we get sane values that are within the brush boundaries - brushPrim->SetPlanePointsFromWindings( transform.GetTranslation(), j, i ); + if( recalcPlanePoints ) + { + brushPrim->SetPlanePointsFromWindings( transform.GetTranslation(), j, i ); + } } else if( mapPrim->GetType() == idMapPrimitive::TYPE_PATCH ) { diff --git a/neo/idlib/MapFile.h b/neo/idlib/MapFile.h index db90bfcc..04320ad9 100644 --- a/neo/idlib/MapFile.h +++ b/neo/idlib/MapFile.h @@ -504,7 +504,7 @@ public: // RB begin bool WriteJSON( const char* fileName, const char* ext, bool fromBasePath = true ); bool ConvertToPolygonMeshFormat(); - bool ConvertToValve220Format(); + bool ConvertToValve220Format( bool recalcPlanePoints ); void ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview );