removed r_shadow_culltriangles - the only useful part of it (shadow
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 24 Dec 2009 13:09:03 +0000 (13:09 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Thu, 24 Dec 2009 13:09:03 +0000 (13:09 +0000)
caster culling on dlights when using shadow volumes) is preserved, the
nasty part (changes in lighting) are gone

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@9671 d7cf8633-e32d-0410-b094-e92efae38249

gl_rsurf.c
r_shadow.c
r_shadow.h

index 53f6941..a3d9647 100644 (file)
@@ -1177,13 +1177,12 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
        dp_model_t *model = ent->model;
        const msurface_t *surface;
        int i, k, kend, l, m, mend, endsurface, batchnumsurfaces, batchnumtriangles, batchfirstvertex, batchlastvertex, batchfirsttriangle;
-       qboolean usebufferobject, culltriangles;
+       qboolean usebufferobject;
        const int *element3i;
        static msurface_t *batchsurfacelist[RSURF_MAX_BATCHSURFACES];
        static int batchelements[BATCHSIZE*3];
        texture_t *tex;
        CHECKGLERROR
-       culltriangles = r_shadow_culltriangles.integer && !(ent->flags & RENDER_NOSELFSHADOW);
        element3i = rsurface.modelelement3i;
        // this is a double loop because non-visible surface skipping has to be
        // fast, and even if this is not the world model (and hence no visibility
@@ -1252,14 +1251,6 @@ void R_Q1BSP_DrawLight(entity_render_t *ent, int numsurfaces, const int *surface
                                                        continue;
                                                }
                                        }
-                                       else if (culltriangles)
-                                       {
-                                               if (r_shadow_frontsidecasting.integer && !PointInfrontOfTriangle(rsurface.entitylightorigin, rsurface.vertex3f + element3i[m*3+0]*3, rsurface.vertex3f + element3i[m*3+1]*3, rsurface.vertex3f + element3i[m*3+2]*3))
-                                               {
-                                                       usebufferobject = false;
-                                                       continue;
-                                               }
-                                       }
                                        if (batchnumtriangles >= BATCHSIZE)
                                        {
                                                r_refdef.stats.lights_lighttriangles += batchnumtriangles;
index 1609a42..92eaf99 100644 (file)
@@ -316,7 +316,6 @@ cvar_t r_shadow_shadowmapping_nearclip = {CVAR_SAVE, "r_shadow_shadowmapping_nea
 cvar_t r_shadow_shadowmapping_bias = {CVAR_SAVE, "r_shadow_shadowmapping_bias", "0.03", "shadowmap bias parameter (this is multiplied by nearclip * 1024 / lodsize)"};
 cvar_t r_shadow_shadowmapping_polygonfactor = {CVAR_SAVE, "r_shadow_shadowmapping_polygonfactor", "2", "slope-dependent shadowmapping bias"};
 cvar_t r_shadow_shadowmapping_polygonoffset = {CVAR_SAVE, "r_shadow_shadowmapping_polygonoffset", "0", "constant shadowmapping bias"};
-cvar_t r_shadow_culltriangles = {0, "r_shadow_culltriangles", "0", "performs more expensive tests to remove unnecessary triangles of lit surfaces (looks bad when using shadowmapping or shadowless lights)"};
 cvar_t r_shadow_polygonfactor = {0, "r_shadow_polygonfactor", "0", "how much to enlarge shadow volume polygons when rendering (should be 0!)"};
 cvar_t r_shadow_polygonoffset = {0, "r_shadow_polygonoffset", "1", "how much to push shadow volumes into the distance when rendering, to reduce chances of zfighting artifacts (should not be less than 0)"};
 cvar_t r_shadow_texture3d = {0, "r_shadow_texture3d", "1", "use 3D voxel textures for spherical attenuation rather than cylindrical (does not affect OpenGL 2.0 render path)"};
@@ -711,7 +710,6 @@ void R_Shadow_Init(void)
        Cvar_RegisterVariable(&r_shadow_shadowmapping_bias);
        Cvar_RegisterVariable(&r_shadow_shadowmapping_polygonfactor);
        Cvar_RegisterVariable(&r_shadow_shadowmapping_polygonoffset);
-       Cvar_RegisterVariable(&r_shadow_culltriangles);
        Cvar_RegisterVariable(&r_shadow_polygonfactor);
        Cvar_RegisterVariable(&r_shadow_polygonoffset);
        Cvar_RegisterVariable(&r_shadow_texture3d);
@@ -3341,8 +3339,9 @@ void R_Shadow_DrawWorldShadow_ShadowVolume(int numsurfaces, int *surfacelist, co
                }
                CHECKGLERROR
        }
-       else if (numsurfaces && r_refdef.scene.worldmodel->brush.shadowmesh && r_shadow_culltriangles.integer)
+       else if (numsurfaces && r_refdef.scene.worldmodel->brush.shadowmesh)
        {
+               // use the shadow trispvs calculated earlier by GetLightInfo to cull world triangles on this dynamic light
                R_Shadow_PrepareShadowMark(r_refdef.scene.worldmodel->brush.shadowmesh->numtriangles);
                for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
                {
index 20f1e5c..1c11ae8 100644 (file)
@@ -32,7 +32,6 @@ extern cvar_t r_shadow_realtime_world_compileshadow;
 extern cvar_t r_shadow_realtime_world_compilesvbsp;
 extern cvar_t r_shadow_realtime_world_compileportalculling;
 extern cvar_t r_shadow_scissor;
-extern cvar_t r_shadow_culltriangles;
 extern cvar_t r_shadow_polygonfactor;
 extern cvar_t r_shadow_polygonoffset;
 extern cvar_t r_shadow_singlepassvolumegeneration;