add shader key q3map_noDirty, which disables the dirty pass on the surface. It's handy for lightmapped terrain models where dirty produces odd darkness on mesh splits.

This commit is contained in:
jal 2010-05-29 12:22:02 +02:00
parent 1a0d1500f7
commit 778af4dde0
3 changed files with 32 additions and 3 deletions

View File

@ -1546,6 +1546,7 @@ void DirtyRawLightmap( int rawLightmapNum )
rawLightmap_t *lm;
surfaceInfo_t *info;
trace_t trace;
qboolean noDirty;
/* bail if this number exceeds the number of raw lightmaps */
@ -1579,6 +1580,20 @@ void DirtyRawLightmap( int rawLightmapNum )
}
}
noDirty = qfalse;
for( i = 0; i < trace.numSurfaces; i++ )
{
/* get surface */
info = &surfaceInfos[ trace.surfaces[ i ] ];
/* check twosidedness */
if( info->si->noDirty )
{
noDirty = qtrue;
break;
}
}
/* gather dirt */
for( y = 0; y < lm->sh; y++ )
{
@ -1597,6 +1612,13 @@ void DirtyRawLightmap( int rawLightmapNum )
if( *cluster < 0 )
continue;
/* don't apply dirty on this surface */
if( noDirty )
{
*dirt = 1.0f;
continue;
}
/* copy to trace */
trace.cluster = *cluster;
VectorCopy( origin, trace.origin );

View File

@ -749,6 +749,7 @@ typedef struct shaderInfo_s
qb_t noFog; /* ydnar: supress fogging */
qb_t clipModel; /* ydnar: solid model hack */
qb_t noVertexLight; /* ydnar: leave vertex color alone */
qb_t noDirty; /* jal: do not apply the dirty pass to this surface */
byte styleMarker; /* ydnar: light styles hack */

View File

@ -1524,6 +1524,12 @@ static void ParseShaderFile( const char *filename )
si->floodlightDirectionScale = atof( token );
}
/* jal: q3map_nodirty : skip dirty */
else if( !Q_stricmp( token, "q3map_nodirty" ) )
{
si->noDirty = qtrue;
}
/* q3map_lightmapSampleSize <value> */
else if( !Q_stricmp( token, "q3map_lightmapSampleSize" ) )
{
@ -1668,7 +1674,7 @@ static void ParseShaderFile( const char *filename )
si->offset = atof( token );
}
/* ydnar: q3map_textureSize <width> <height> (substitute for q3map_lightimage derivation for terrain) */
/* ydnar: q3map_fur <numlayers> <offset> <fade> */
else if( !Q_stricmp( token, "q3map_fur" ) )
{
GetTokenAppend( shaderText, qfalse );