add shader key q3map_noDirty, which disables the dirty pass on the surface. It's...
authorjal <germangar@gmail.com>
Sat, 29 May 2010 10:22:02 +0000 (12:22 +0200)
committerjal <germangar@gmail.com>
Sat, 29 May 2010 10:22:02 +0000 (12:22 +0200)
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/q3map2.h
tools/quake3/q3map2/shaders.c

index d26b05e57e667195c658d9d98d1f5431a89c73d5..6a54389e066386255d48fedb541d5312fd3f8115 100644 (file)
@@ -1546,7 +1546,8 @@ 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 */
        if( rawLightmapNum >= numRawLightmaps )
@@ -1578,6 +1579,20 @@ void DirtyRawLightmap( int rawLightmapNum )
                        break;
                }
        }
+
+       noDirty = qfalse;\r
+       for( i = 0; i < trace.numSurfaces; i++ )\r
+       {\r
+               /* get surface */\r
+               info = &surfaceInfos[ trace.surfaces[ i ] ];\r
+\r
+               /* check twosidedness */\r
+               if( info->si->noDirty )\r
+               {\r
+                       noDirty = qtrue;\r
+                       break;\r
+               }\r
+       }
        
        /* gather dirt */
        for( y = 0; y < lm->sh; y++ )
@@ -1596,6 +1611,13 @@ void DirtyRawLightmap( int rawLightmapNum )
                        /* only look at mapped luxels */
                        if( *cluster < 0 )
                                continue;
+
+                       /* don't apply dirty on this surface */\r
+                       if( noDirty )\r
+                       {\r
+                               *dirt = 1.0f;\r
+                               continue;\r
+                       }
                        
                        /* copy to trace */
                        trace.cluster = *cluster;
index 1b86f124c639b4ad56e2b35feba64379aacb891b..c88b4ed2440a941d003c00890a445e85ab0d831e 100644 (file)
@@ -749,7 +749,8 @@ 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 */
        
        float                           vertexScale;                                    /* vertex light scale */
index 74f5e59cd58c162741de9985d9468fb99074826a..3bf6cbe1ea4d1eb401954dfe9bf61d99eece5ce3 100644 (file)
@@ -1523,6 +1523,12 @@ static void ParseShaderFile( const char *filename )
                                        GetTokenAppend( shaderText, qfalse );
                                        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 );