]> git.rm.cloudns.org Git - xonotic/netradiant.git/commitdiff
fix deluxemapping when using floodlight. Also, add to floodlight the same trick as...
authorjal <germangar@gmail.com>
Thu, 22 Apr 2010 10:07:00 +0000 (12:07 +0200)
committerjal <germangar@gmail.com>
Thu, 22 Apr 2010 10:07:00 +0000 (12:07 +0200)
tools/quake3/q3map2/light_ydnar.c

index 3207928b71364061914a3905801fe655e4126b39..dac94b62f03bc55263f49987caec8fcfdc853246 100644 (file)
@@ -3888,7 +3888,7 @@ float FloodLightForSample( trace_t *trace , float floodLightDistance, qboolean f
        VectorCopy( trace->normal, normal );
        
        /* check if the normal is aligned to the world-up */
-       if( normal[ 0 ] == 0.0f && normal[ 1 ] == 0.0f )
+       if( normal[ 0 ] == 0.0f && normal[ 1 ] == 0.0f && ( normal[ 2 ] == 1.0f || normal[ 2 ] == -1.0f ) )
        {
                if( normal[ 2 ] == 1.0f )               
                {
@@ -4123,7 +4123,7 @@ void FloodLightRawLightmap( int rawLightmapNum )
 
        /* global pass */
        if (floodlighty && floodlightIntensity)
-               FloodLightRawLightmapPass(lm, floodlightRGB, floodlightIntensity, floodlightDistance, floodlight_lowquality, 0);
+               FloodLightRawLightmapPass(lm, floodlightRGB, floodlightIntensity, floodlightDistance, floodlight_lowquality, 1.0f);
 
        /* custom pass */
        if (lm->floodlightIntensity)
@@ -4151,7 +4151,6 @@ void FloodlightIlluminateLightmap( rawLightmap_t *lm )
        float                           *luxel, *floodlight, *deluxel, *normal;
        int                                     *cluster;
        float                           brightness;
-       vec3_t                          lightvector;
        int                                     x, y, lightmapNum;
 
        /* walk lightmaps */
@@ -4190,11 +4189,18 @@ void FloodlightIlluminateLightmap( rawLightmap_t *lm )
                                if (luxel[3]==0) luxel[3]=1;
 
                                /* add to deluxemap */
-                               if (deluxemap && floodlight[3] > 0)
+                               if (deluxemap && floodlight[3] > 0)\r
                                {
+                                       vec3_t                          lightvector;\r
+\r
                                        normal = SUPER_NORMAL( x, y );
                                        brightness = floodlight[ 0 ] * 0.3f + floodlight[ 1 ] * 0.59f + floodlight[ 2 ] * 0.11f;
-                                       brightness *= ( 1.0f / 255.0f ) * floodlight[3];
+                                       brightness *= ( 1.0f / 255.0f ) * floodlight[3];\r
+\r
+                                       // use AT LEAST this amount of contribution from ambient for the deluxemap, fixes points that receive ZERO light\r
+                                       if(brightness < 0.00390625f)\r
+                                               brightness = 0.00390625f;\r
+\r
                                        VectorScale( normal, brightness, lightvector );
                                        VectorAdd( deluxel, lightvector, deluxel );
                                }