}
}
-void R_View_WorldVisibility(void)
+void R_View_WorldVisibility(qboolean forcenovis)
{
int i, j, *mark;
mleaf_t *leaf;
if (!model)
return;
+ if (r_view.usecustompvs)
+ {
+ // clear the visible surface and leaf flags arrays
+ memset(r_viewcache.world_surfacevisible, 0, model->num_surfaces);
+ memset(r_viewcache.world_leafvisible, 0, model->brush.num_leafs);
+ r_viewcache.world_novis = false;
+
+ // simply cull each marked leaf to the frustum (view pyramid)
+ for (j = 0, leaf = model->brush.data_leafs;j < model->brush.num_leafs;j++, leaf++)
+ {
+ // if leaf is in current pvs and on the screen, mark its surfaces
+ if (CHECKPVSBIT(r_viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
+ {
+ r_refdef.stats.world_leafs++;
+ r_viewcache.world_leafvisible[j] = true;
+ if (leaf->numleafsurfaces)
+ for (i = 0, mark = leaf->firstleafsurface;i < leaf->numleafsurfaces;i++, mark++)
+ r_viewcache.world_surfacevisible[*mark] = true;
+ }
+ }
+ return;
+ }
+
// if possible find the leaf the view origin is in
viewleaf = model->brush.PointInLeaf ? model->brush.PointInLeaf(model, r_view.origin) : NULL;
// if possible fetch the visible cluster bits
if (!r_lockpvs.integer && model->brush.FatPVS)
- model->brush.FatPVS(model, r_view.origin, 2, r_viewcache.world_pvsbits, sizeof(r_viewcache.world_pvsbits));
+ model->brush.FatPVS(model, r_view.origin, 2, r_viewcache.world_pvsbits, sizeof(r_viewcache.world_pvsbits), false);
if (!r_lockvisibility.integer)
{
// if floating around in the void (no pvs data available, and no
// portals available), simply use all on-screen leafs.
- if (!viewleaf || viewleaf->clusterindex < 0)
+ if (!viewleaf || viewleaf->clusterindex < 0 || forcenovis)
{
// no visibility method: (used when floating around in the void)
// simply cull each leaf to the frustum (view pyramid)
if (ent->model == NULL)
return;
if (ent == r_refdef.worldentity)
- R_DrawWorldSurfaces(true, true, false);
+ R_DrawWorldSurfaces(true, true, false, false, false);
+ else
+ R_DrawModelSurfaces(ent, true, true, false, false, false);
+}
+
+void R_Q1BSP_DrawAddWaterPlanes(entity_render_t *ent)
+{
+ model_t *model = ent->model;
+ if (model == NULL)
+ return;
+ if (ent == r_refdef.worldentity)
+ R_DrawWorldSurfaces(false, false, false, true, false);
else
- R_DrawModelSurfaces(ent, true, true, false);
+ R_DrawModelSurfaces(ent, false, false, false, true, false);
}
void R_Q1BSP_Draw(entity_render_t *ent)
if (model == NULL)
return;
if (ent == r_refdef.worldentity)
- R_DrawWorldSurfaces(false, true, false);
+ R_DrawWorldSurfaces(false, true, false, false, false);
else
- R_DrawModelSurfaces(ent, false, true, false);
+ R_DrawModelSurfaces(ent, false, true, false, false, false);
}
void R_Q1BSP_DrawDepth(entity_render_t *ent)
if (model == NULL)
return;
if (ent == r_refdef.worldentity)
- R_DrawWorldSurfaces(false, false, true);
+ R_DrawWorldSurfaces(false, false, true, false, false);
+ else
+ R_DrawModelSurfaces(ent, false, false, true, false, false);
+}
+
+void R_Q1BSP_DrawDebug(entity_render_t *ent)
+{
+ if (ent->model == NULL)
+ return;
+ if (ent == r_refdef.worldentity)
+ R_DrawWorldSurfaces(false, false, false, false, true);
else
- R_DrawModelSurfaces(ent, false, false, true);
+ R_DrawModelSurfaces(ent, false, false, false, false, true);
}
typedef struct r_q1bsp_getlightinfo_s