fix ds->lightmapAxis after MergeMetaTriangles

This commit is contained in:
Garux 2024-02-26 17:39:13 +06:00
parent d3532111cf
commit 6abeb431e3
2 changed files with 6 additions and 2 deletions

View File

@ -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 );
}
@ -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
*/

View File

@ -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++;