]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
made particle PVS culling only take the origin into account; that way, it actually...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 Jan 2009 14:03:51 +0000 (14:03 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 2 Jan 2009 14:03:51 +0000 (14:03 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@8620 d7cf8633-e32d-0410-b094-e92efae38249

cl_particles.c

index 48b26a9b798aebe697a7180adb85ba169d5d020e..5c7e4460b39f00c214cda73b06e058e51135172b 100644 (file)
@@ -192,7 +192,7 @@ cvar_t cl_particles_smoke_alpha = {CVAR_SAVE, "cl_particles_smoke_alpha", "0.5",
 cvar_t cl_particles_smoke_alphafade = {CVAR_SAVE, "cl_particles_smoke_alphafade", "0.55", "brightness fade per second"};
 cvar_t cl_particles_sparks = {CVAR_SAVE, "cl_particles_sparks", "1", "enables sparks (used by multiple effects)"};
 cvar_t cl_particles_bubbles = {CVAR_SAVE, "cl_particles_bubbles", "1", "enables bubbles (used by multiple effects)"};
-cvar_t cl_particles_novis = {CVAR_SAVE, "cl_particles_novis", "1", "when disabled, particles use vis data too (sometimes causes bad quality or missing effects)"};
+cvar_t cl_particles_novis = {CVAR_SAVE, "cl_particles_novis", "0", "turn off PVS culling of particles"};
 cvar_t cl_decals = {CVAR_SAVE, "cl_decals", "1", "enables decals (bullet holes, blood, etc)"};
 cvar_t cl_decals_time = {CVAR_SAVE, "cl_decals_time", "20", "how long before decals start to fade away"};
 cvar_t cl_decals_fadetime = {CVAR_SAVE, "cl_decals_fadetime", "1", "how long decals take to fade away"};
@@ -2065,14 +2065,12 @@ void R_DrawDecals (void)
                {
                        if(!cl_particles_novis.integer)
                                if (!r_refdef.viewcache.world_novis)
-                                       if(r_refdef.scene.worldmodel->brush.BoxTouchingPVS)
+                                       if(r_refdef.scene.worldmodel->brush.PointInLeaf)
                                        {
-                                               vec3_t mins, maxs, unit;
-                                               VectorSet(unit, 1, 1, 1);
-                                               VectorMA(decal->org, -decal->size, unit, mins);
-                                               VectorMA(decal->org, +decal->size, unit, maxs);
-                                               if(!r_refdef.scene.worldmodel->brush.BoxTouchingPVS(r_refdef.scene.worldmodel, r_refdef.viewcache.world_pvsbits, mins, maxs))
-                                                       continue;
+                                               mleaf_t *leaf = r_refdef.scene.worldmodel->brush.PointInLeaf(r_refdef.scene.worldmodel, decal->org);
+                                               if(leaf)
+                                                       if(!CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex))
+                                                               continue;
                                        }
                        R_MeshQueue_AddTransparent(decal->org, R_DrawDecal_TransparentCallback, NULL, i, NULL);
                }
@@ -2468,14 +2466,12 @@ void R_DrawParticles (void)
                default:
                        if(!cl_particles_novis.integer)
                                if (!r_refdef.viewcache.world_novis)
-                                       if(r_refdef.scene.worldmodel->brush.BoxTouchingPVS)
+                                       if(r_refdef.scene.worldmodel->brush.PointInLeaf)
                                        {
-                                               vec3_t mins, maxs, unit;
-                                               VectorSet(unit, 1, 1, 1);
-                                               VectorMA(p->org, -p->size, unit, mins);
-                                               VectorMA(p->org, +p->size, unit, maxs);
-                                               if(!r_refdef.scene.worldmodel->brush.BoxTouchingPVS(r_refdef.scene.worldmodel, r_refdef.viewcache.world_pvsbits, mins, maxs))
-                                                       continue;
+                                               mleaf_t *leaf = r_refdef.scene.worldmodel->brush.PointInLeaf(r_refdef.scene.worldmodel, p->org);
+                                               if(leaf)
+                                                       if(!CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex))
+                                                               continue;
                                        }
                        // anything else just has to be in front of the viewer and visible at this distance
                        if (DotProduct(p->org, r_refdef.view.forward) >= minparticledist && VectorDistance2(p->org, r_refdef.view.origin) < drawdist2 * (p->size * p->size))