add LIGHTMAP_BY_VERTEX

This commit is contained in:
Garux
2025-12-03 02:11:14 +05:00
parent 7d712c9ab8
commit 12dff40f82
6 changed files with 13 additions and 12 deletions
+1 -1
View File
@@ -142,7 +142,7 @@ struct ibspDrawSurface_t
.numIndexes = numIndexes,
.lightmapStyles { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE },
.vertexStyles { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE },
.lightmapNum { lightmapNum, -3, -3, -3 },
.lightmapNum { lightmapNum, LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX, LIGHTMAP_BY_VERTEX },
.lightmapX { lightmapX, 0, 0, 0 },
.lightmapY { lightmapY, 0, 0, 0 },
.lightmapWidth = lightmapWidth,
+1 -1
View File
@@ -746,7 +746,7 @@ int MergeBSPMain( Args& args ){
fog.brushNum += bspBrushes.size();
/* deduce max lm index, using bspLightBytes is insufficient for native external lightmaps */
int maxLmIndex = -3;
int maxLmIndex = LIGHTMAP_BY_VERTEX;
for( const auto& surf : bspDrawSurfaces )
for( auto index : surf.lightmapNum )
value_maximize( maxLmIndex, index );
+2 -2
View File
@@ -1865,7 +1865,7 @@ static void WriteBSPFileAfterLight( const char *bspFileName ){
out.lightmapStyles.fill( LS_NONE );
out.vertexStyles.fill( LS_NONE );
out.lightmapNum.fill( -3 );
out.lightmapNum.fill( LIGHTMAP_BY_VERTEX );
}
bakDrawSurfaces.insert( bakDrawSurfaces.cend(), bspDrawSurfaces.cbegin(), bspDrawSurfaces.cend() );
@@ -1896,7 +1896,7 @@ static void WriteBSPFileAfterLight( const char *bspFileName ){
for( auto& ds : bspDrawSurfaces ){
if( ds.surfaceType == MST_PLANAR ){
ds.surfaceType = MST_TRIANGLE_SOUP;
ds.lightmapNum[ 0 ] = -3;
ds.lightmapNum[ 0 ] = LIGHTMAP_BY_VERTEX;
}
}
}
+5 -5
View File
@@ -1754,7 +1754,7 @@ static void SetupOutLightmap( rawLightmap_t *lm, outLightmap_t *olm ){
}
}
else{
olm->lightmapNum = -3;
olm->lightmapNum = LIGHTMAP_BY_VERTEX;
}
/* set external lightmap number */
@@ -1791,8 +1791,8 @@ static void FindOutLightmaps( rawLightmap_t *lm, bool fastAllocate ){
int xIncrement, yIncrement;
/* set default lightmap number (-3 = LIGHTMAP_BY_VERTEX) */
lm->outLightmapNums.fill( -3 );
/* set default lightmap number */
lm->outLightmapNums.fill( LIGHTMAP_BY_VERTEX );
/* can this lightmap be approximated with vertex color? */
if ( ApproximateLightmap( lm ) ) {
@@ -3027,7 +3027,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){
/* handle vertex lit or approximated surfaces */
else if ( lm == nullptr || lm->outLightmapNums[ 0 ] < 0 ) {
ds.lightmapStyles = ds.vertexStyles;
ds.lightmapNum.fill( -3 );
ds.lightmapNum.fill( LIGHTMAP_BY_VERTEX );
}
/* handle lightmapped surfaces */
@@ -3041,7 +3041,7 @@ void StoreSurfaceLightmaps( bool fastAllocate, bool storeForReal ){
/* handle unused style */
if ( lm->styles[ lightmapNum ] == LS_NONE || lm->outLightmapNums[ lightmapNum ] < 0 ) {
ds.lightmapNum[ lightmapNum ] = -3;
ds.lightmapNum[ lightmapNum ] = LIGHTMAP_BY_VERTEX;
continue;
}
+1
View File
@@ -187,6 +187,7 @@ enum class EBrushType
#define EXTERNAL_LIGHTMAP "lm_%04d.tga"
#define MAX_LIGHTMAPS 4 /* RBSP */
#define LIGHTMAP_BY_VERTEX -3
#define MAX_SWITCHED_LIGHTS 32
#define LS_NORMAL 0x00
#define LS_UNUSED 0xFE
+3 -3
View File
@@ -2001,7 +2001,7 @@ static void EmitFlareSurface( mapDrawSurface_t& ds ){
/* RBSP */
out.lightmapStyles = { byte( ds.lightStyle ), LS_NONE, LS_NONE, LS_NONE };
out.vertexStyles = { byte( ds.lightStyle ), LS_NONE, LS_NONE, LS_NONE };
out.lightmapNum.fill( -3 );
out.lightmapNum.fill( LIGHTMAP_BY_VERTEX );
out.lightmapOrigin = ds.lightmapOrigin; /* origin */
out.lightmapVecs[ 0 ] = ds.lightmapVecs[ 0 ]; /* color */
@@ -2075,7 +2075,7 @@ static void EmitPatchSurface( const entity_t& e, mapDrawSurface_t& ds ){
/* RBSP */
out.lightmapStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE };
out.vertexStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE };
out.lightmapNum.fill( -3 );
out.lightmapNum.fill( LIGHTMAP_BY_VERTEX );
/* ydnar: gs mods: previously, the lod bounds were stored in lightmapVecs[ 0 ] and [ 1 ], moved to bounds[ 0 ] and [ 1 ] */
out.lightmapOrigin = ds.lightmapOrigin;
@@ -2376,7 +2376,7 @@ static void EmitTriangleSurface( mapDrawSurface_t& ds ){
/* RBSP */
out.lightmapStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE };
out.vertexStyles = { LS_NORMAL, LS_NONE, LS_NONE, LS_NONE };
out.lightmapNum.fill( -3 );
out.lightmapNum.fill( LIGHTMAP_BY_VERTEX );
/* lightmap vectors (lod bounds for patches) */
out.lightmapOrigin = ds.lightmapOrigin;