]> git.xonotic.org Git - xonotic/netradiant.git/commitdiff
force subsampling only where REALLY needed
authorRudolf Polzer <divverent@alientrap.org>
Wed, 22 Sep 2010 06:49:43 +0000 (08:49 +0200)
committerRudolf Polzer <divverent@alientrap.org>
Wed, 22 Sep 2010 06:49:43 +0000 (08:49 +0200)
tools/quake3/q3map2/light.c
tools/quake3/q3map2/light_trace.c
tools/quake3/q3map2/light_ydnar.c
tools/quake3/q3map2/q3map2.h

index 882c7b65a9cff489d9cbfe8aadc70aa3c6a95919..2a20d6c4e3d0b4719bfa9fdaca3c15af56d2a625 100644 (file)
@@ -758,7 +758,7 @@ int LightContributionToSample( trace_t *trace )
        light = trace->light;
        
        /* clear color */
-       trace->forceSubsampling = qfalse; /* to make sure */
+       trace->forceSubsampling = 0.0f; /* to make sure */
        VectorClear( trace->color );
        VectorClear( trace->colorNoShadow );
        VectorClear( trace->directionContribution );
@@ -1091,6 +1091,7 @@ int LightContributionToSample( trace_t *trace )
                {
                        /* trace */
                        TraceLine( trace );
+                       trace->forceSubsampling *= add;
                        if( !(trace->compileFlags & C_SKY) || trace->opaque )
                        {
                                VectorClear( trace->color );
@@ -1145,6 +1146,7 @@ int LightContributionToSample( trace_t *trace )
        
        /* raytrace */
        TraceLine( trace );
+       trace->forceSubsampling *= add;
        if( trace->passSolid || trace->opaque )
        {
                VectorClear( trace->color );
index 5194962f1ba64655b84c002cf8761074cf28b28c..d52f816b5bb5670619d0c6f88e210487f0b5f247 100644 (file)
@@ -1513,7 +1513,7 @@ qboolean TraceTriangle( traceInfo_t *ti, traceTriangle_t *tt, trace_t *trace )
        }
 
        /* force subsampling because the lighting is texture dependent */
-       trace->forceSubsampling = qtrue;
+       trace->forceSubsampling = 1.0;
        
        /* try to avoid double shadows near triangle seams */
        if( u < -ASLF_EPSILON || u > (1.0f + ASLF_EPSILON) ||
index dc4c692fd3d792327e13b243fd929b5a74177eed..8ba5a9af8cf2282161dfc3e912369eb74a57b317 100644 (file)
@@ -1817,7 +1817,7 @@ static void SubsampleRawLuxel_r( rawLightmap_t *lm, trace_t *trace, vec3_t sampl
                /* sample light */
 
                LightContributionToSample( trace );
-               if(trace->forceSubsampling)
+               if(trace->forceSubsampling > 1.0f)
                {
                        /* alphashadow: we subsample as deep as we can */
                        ++lighted;
@@ -2152,7 +2152,7 @@ void IlluminateRawLightmap( int rawLightmapNum )
                                                        VectorAdd( deluxel, trace.directionContribution, deluxel );
 
                                                /* check for evilness */
-                                               if(trace.forceSubsampling && lightSamples > 1 && luxelFilterRadius == 0)
+                                               if(trace.forceSubsampling > 1.0f && lightSamples > 1 && luxelFilterRadius == 0)
                                                {
                                                        totalLighted++;
                                                        *flag |= FLAG_FORCE_SUBSAMPLING; /* force */
index 0494cd4771831d9dec79be48532214db30245a9b..078f46e214c39c0385af54d0caddbca07fbe59be 100644 (file)
@@ -1363,7 +1363,7 @@ typedef struct
        int                                     compileFlags;   /* for determining surface compile flags traced through */
        qboolean                        passSolid;
        qboolean                        opaque;
-       qboolean                        forceSubsampling; /* needs subsampling (alphashadow) */
+       vec_t                   forceSubsampling; /* needs subsampling (alphashadow), value = max color contribution possible from it */
        
        /* working data */
        int                                     numTestNodes;