mirror of
https://github.com/id-Software/DOOM-3-BFG.git
synced 2025-03-13 06:02:13 +00:00
Fixed messed up coords in makeZooMapForModels command
This commit is contained in:
parent
af4480f35c
commit
948e248ee8
4 changed files with 28 additions and 45 deletions
|
@ -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
|
// make sure we have access to all .bimage files for that map
|
||||||
fileSystem->BeginLevelLoad( filename, NULL, 0 );
|
fileSystem->BeginLevelLoad( filename, NULL, 0 );
|
||||||
|
|
||||||
map.ConvertToValve220Format();
|
map.ConvertToValve220Format( true );
|
||||||
|
|
||||||
fileSystem->EndLevelLoad();
|
fileSystem->EndLevelLoad();
|
||||||
|
|
||||||
|
|
|
@ -3580,7 +3580,7 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
||||||
int totalModelsCount = 0;
|
int totalModelsCount = 0;
|
||||||
int totalEntitiesCount = 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" );
|
idStr mapName( "maps/zoomaps/zoo_models.map" );
|
||||||
idMapFile mapFile;
|
idMapFile mapFile;
|
||||||
|
@ -3740,9 +3740,9 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
||||||
modelName.SetFileExtension( "ase" );
|
modelName.SetFileExtension( "ase" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ext.Icmp( "bdae" ) == 0 )
|
if( ext.Icmp( "bglb" ) == 0 )
|
||||||
{
|
{
|
||||||
modelName.SetFileExtension( "dae" );
|
modelName.SetFileExtension( "glb" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ext.Icmp( "bobj" ) == 0 )
|
if( ext.Icmp( "bobj" ) == 0 )
|
||||||
|
@ -3837,18 +3837,24 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
||||||
idMapEntity* mapEnt = new( TAG_SYSTEM ) idMapEntity();
|
idMapEntity* mapEnt = new( TAG_SYSTEM ) idMapEntity();
|
||||||
mapFile.AddEntity( mapEnt );
|
mapFile.AddEntity( mapEnt );
|
||||||
|
|
||||||
// build TB compatible model name
|
|
||||||
idStrStatic< MAX_OSPATH > exportedModelFileName;
|
|
||||||
exportedModelFileName = "_tb/";
|
|
||||||
exportedModelFileName.AppendPath( modelName );
|
|
||||||
exportedModelFileName.SetFileExtension( ".obj" );
|
|
||||||
|
|
||||||
idStrStatic< MAX_OSPATH > entityName;
|
idStrStatic< MAX_OSPATH > entityName;
|
||||||
entityName.Format( "misc_model_%d", mapFile.GetNumEntities() );
|
entityName.Format( "misc_model_%d", mapFile.GetNumEntities() );
|
||||||
|
|
||||||
mapEnt->epairs.Set( "classname", "misc_model" );
|
mapEnt->epairs.Set( "classname", "misc_model" );
|
||||||
mapEnt->epairs.Set( "name", entityName );
|
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 );
|
mapEnt->epairs.Set( "model", modelName );
|
||||||
|
|
||||||
EntityInfo_t* entInfo = new( TAG_SYSTEM ) EntityInfo_t;
|
EntityInfo_t* entInfo = new( TAG_SYSTEM ) EntityInfo_t;
|
||||||
|
@ -4126,11 +4132,13 @@ void idDeclManagerLocal::MakeZooMapForModels_f( const idCmdArgs& args )
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
mapFile.ConvertToValve220Format();
|
mapFile.ConvertToValve220Format( false );
|
||||||
|
|
||||||
worldspawn->epairs.Set( "_tb_textures", "textures/common;textures/editor;textures/decals;textures/rock" );
|
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" );
|
worldspawn->epairs.Set( "_tb_def", "external:base/_tb/fgd/DOOM-3-models.fgd" );
|
||||||
|
|
||||||
|
//"_tb_mod" "mod_unittests"
|
||||||
|
|
||||||
mapFile.Write( mapName, ".map" );
|
mapFile.Write( mapName, ".map" );
|
||||||
|
|
||||||
common->Printf( "\nZoo map written to %s\n", mapName.c_str() );
|
common->Printf( "\nZoo map written to %s\n", mapName.c_str() );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
Doom 3 BFG Edition GPL Source Code
|
Doom 3 BFG Edition GPL Source Code
|
||||||
Copyright (C) 1993-2012 id Software LLC, a ZeniMax Media company.
|
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) 2020 Admer (id Tech Fox)
|
||||||
Copyright (C) 2022 Harrie van Ginneken
|
Copyright (C) 2022 Harrie van Ginneken
|
||||||
|
|
||||||
|
@ -145,33 +145,6 @@ void idMapBrushSide::ConvertToValve220Format( const idMat4& entityTransform, idS
|
||||||
return;
|
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 )
|
// from DoomEdit's void BrushPrimit_Parse( brush_t* b, bool newFormat, const idVec3 origin )
|
||||||
|
|
||||||
idVec3 origin = entityTransform.GetTranslation();
|
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].y = w[j].y + origin.y;
|
||||||
planepts[j].z = w[j].z + origin.z;
|
planepts[j].z = w[j].z + origin.z;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
idVec3 texX, texY;
|
idVec3 texX, texY;
|
||||||
|
|
||||||
|
@ -2996,7 +2968,7 @@ bool idMapFile::ConvertToPolygonMeshFormat()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool idMapFile::ConvertToValve220Format()
|
bool idMapFile::ConvertToValve220Format( bool recalcPlanePoints )
|
||||||
{
|
{
|
||||||
valve220Format = true;
|
valve220Format = true;
|
||||||
|
|
||||||
|
@ -3237,9 +3209,12 @@ bool idMapFile::ConvertToValve220Format()
|
||||||
side->ConvertToValve220Format( transform, textureCollections );
|
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
|
// 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 )
|
else if( mapPrim->GetType() == idMapPrimitive::TYPE_PATCH )
|
||||||
{
|
{
|
||||||
|
|
|
@ -504,7 +504,7 @@ public:
|
||||||
// RB begin
|
// RB begin
|
||||||
bool WriteJSON( const char* fileName, const char* ext, bool fromBasePath = true );
|
bool WriteJSON( const char* fileName, const char* ext, bool fromBasePath = true );
|
||||||
bool ConvertToPolygonMeshFormat();
|
bool ConvertToPolygonMeshFormat();
|
||||||
bool ConvertToValve220Format();
|
bool ConvertToValve220Format( bool recalcPlanePoints );
|
||||||
|
|
||||||
void ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview );
|
void ClassifyEntitiesForTrenchBroom( idDict& classTypeOverview );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue