]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
now skips entire rtlight rendering process if light is too dark or does not emit...
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jan 2005 18:26:26 +0000 (18:26 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 13 Jan 2005 18:26:26 +0000 (18:26 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4932 d7cf8633-e32d-0410-b094-e92efae38249

r_shadow.c

index 780159ed8352e75d8d29f06ec559e5d4ec90aaf1..fde1b98e63aba675a626ae2804be85b61325e863 100644 (file)
@@ -2331,6 +2331,22 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes)
        shadowmesh_t *mesh;
        rmeshstate_t m;
 
+       // skip lights that don't light (corona only lights)
+       if (rtlight->ambientscale + rtlight->diffusescale + rtlight->specularscale < 0.01)
+               return;
+
+       f = (rtlight->style >= 0 ? d_lightstylevalue[rtlight->style] : 128) * (1.0f / 256.0f);
+       VectorScale(rtlight->color, f, lightcolor);
+       if (VectorLength2(lightcolor) < 0.01)
+               return;
+       /*
+       if (rtlight->selected)
+       {
+               f = 2 + sin(realtime * M_PI * 4.0);
+               VectorScale(lightcolor, f, lightcolor);
+       }
+       */
+
        // loading is done before visibility checks because loading should happen
        // all at once at the start of a level, not when it stalls gameplay.
        // (especially important to benchmarks)
@@ -2394,16 +2410,6 @@ void R_DrawRTLight(rtlight_t *rtlight, int visiblevolumes)
        if (R_Shadow_ScissorForBBox(cullmins, cullmaxs))
                return;
 
-       f = (rtlight->style >= 0 ? d_lightstylevalue[rtlight->style] : 128) * (1.0f / 256.0f);
-       VectorScale(rtlight->color, f, lightcolor);
-       /*
-       if (rtlight->selected)
-       {
-               f = 2 + sin(realtime * M_PI * 4.0);
-               VectorScale(lightcolor, f, lightcolor);
-       }
-       */
-
        shadow = rtlight->shadow && (rtlight->isstatic ? r_rtworldshadows : r_rtdlightshadows);
 
        if (shadow && (gl_stencil || visiblevolumes))