Apply floodlight to vertex lighting (there seems to remain some problem with
authorjal <germangar@gmail.com>
Sat, 12 Jun 2010 11:36:06 +0000 (13:36 +0200)
committerjal <germangar@gmail.com>
Sat, 12 Jun 2010 11:36:06 +0000 (13:36 +0200)
vertexlighting not receiving enough bounced light)

tools/quake3/q3map2/light_ydnar.c

index 6a54389e066386255d48fedb541d5312fd3f8115..70c728d0835e574665c23a58a650aa8e98a84f3f 100644 (file)
@@ -2584,6 +2584,8 @@ void IlluminateVertexes( int num )
        rawLightmap_t           *lm;
        bspDrawVert_t           *verts;
        trace_t                         trace;
+       float                           floodLightAmount;\r
+       vec3_t                          floodColor;
        
        
        /* get surface, info, and raw lightmap */
@@ -2661,11 +2663,20 @@ void IlluminateVertexes( int num )
                                        VectorCopy( verts[ i ].normal, trace.normal );
                                        
                                        /* r7 dirt */
-                                       if( dirty )
+                                       if( dirty && !bouncing )
                                                dirt = DirtForSample( &trace );
                                        else
                                                dirt = 1.0f;
 
+                                       /* jal: floodlight */
+                                       floodLightAmount = 0.0f;\r
+                                       VectorClear( floodColor );\r
+                                       if( floodlighty && !bouncing )\r
+                                       {\r
+                                               floodLightAmount = floodlightIntensity * FloodLightForSample( &trace, floodlightDistance, floodlight_lowquality );\r
+                                               VectorScale( floodlightRGB, floodLightAmount, floodColor );\r
+                                       }
+
                                        /* trace */
                                        LightingAtSample( &trace, ds->vertexStyles, colors );
                                        
@@ -2674,6 +2685,9 @@ void IlluminateVertexes( int num )
                                        {
                                                /* r7 dirt */
                                                VectorScale( colors[ lightmapNum ], dirt, colors[ lightmapNum ] );
+
+                                               /* jal: floodlight */
+                                               VectorAdd( colors[ lightmapNum ], floodColor, colors[ lightmapNum ] ); 
                                                
                                                /* store */
                                                radVertLuxel = RAD_VERTEX_LUXEL( lightmapNum, ds->firstVert + i );
@@ -2720,6 +2734,9 @@ void IlluminateVertexes( int num )
                                                                {
                                                                        /* r7 dirt */
                                                                        VectorScale( colors[ lightmapNum ], dirt, colors[ lightmapNum ] );
+
+                                                                       /* jal: floodlight */
+                                                                       VectorAdd( colors[ lightmapNum ], floodColor, colors[ lightmapNum ] ); 
                                                                        
                                                                        /* store */
                                                                        radVertLuxel = RAD_VERTEX_LUXEL( lightmapNum, ds->firstVert + i );