Skip to content

Commit

Permalink
fix ds->lightmapAxis after MergeMetaTriangles
Browse files Browse the repository at this point in the history
  • Loading branch information
Garux committed Feb 26, 2024
1 parent d353211 commit 6abeb43
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tools/quake3/q3map2/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ void ClassifySurfaces( int numSurfs, mapDrawSurface_t *ds ){
{
ds->planeNum = -1;
ds->lightmapVecs[ 2 ].set( 0 );
//% if( ds->type == SURF_META || ds->type == SURF_FACE )
//% if( ds->type == ESurfaceType::Meta || ds->type == ESurfaceType::Face )
//% Sys_Warning( "Non-planar face (%d): %s\n", ds->planeNum, ds->shaderInfo->shader );
}

Expand Down Expand Up @@ -703,7 +703,7 @@ static shaderInfo_t *GetIndexedShader( const shaderInfo_t *parent, const indexMa

/*
DrawSurfaceForSide()
creates a SURF_FACE drawsurface from a given brush side and winding
creates a ESurfaceType::Face drawsurface from a given brush side and winding
stores references to given brush and side
*/

Expand Down
4 changes: 4 additions & 0 deletions tools/quake3/q3map2/surface_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1663,6 +1663,10 @@ static void MetaTrianglesToSurface( int *fOld, int *numAdded ){
/* classify the surface */
ClassifySurfaces( 1, ds );
//% Sys_Warning( "numV: %d numIdx: %d\n", ds->numVerts, ds->numIndexes );
/* ClassifySurfaces() sets axis from vertex normals
method is very questionable and axis actually happens to be wrong after normals passed through SmoothMetaTriangles()
use metaTriangle_t::lightmapAxis which is guaranteedly set and used as main factor for triangles merge */
ds->lightmapAxis = seed.lightmapAxis;

/* add to count */
numMergedSurfaces++;
Expand Down

0 comments on commit 6abeb43

Please sign in to comment.