From 637b5ef0d5fd66718e66b767eb64af6d57e90005 Mon Sep 17 00:00:00 2001 From: Aciz Date: Tue, 4 Jun 2024 05:55:32 +0300 Subject: [PATCH] Cull clips/triggers/slicks out of PVS In addition to frustum culling, don't draw brushes that are not in current PVS. --- src/client/cl_tc_vis.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/client/cl_tc_vis.c b/src/client/cl_tc_vis.c index 7d694bee..ae6c0f08 100644 --- a/src/client/cl_tc_vis.c +++ b/src/client/cl_tc_vis.c @@ -481,12 +481,22 @@ static qboolean CullFace(const visFace_t *face) { static void draw(visBrushNode_t *brush, qhandle_t shader) { frustum = re.GetFrustum(); + vec3_t clientOrigin; + VectorCopy(cl.cgameClientLerpOrigin, clientOrigin); + while (brush) { int i; for (i = 0; i < brush->numFaces; ++i) { - if (CullFace(brush->faces + i)) continue; + if (CullFace(brush->faces + i)) { + continue; + } + + if (!re.inPVS(clientOrigin, brush->faces->mins) && !re.inPVS(clientOrigin, brush->faces->maxs)) { + continue; + } + re.AddPolyToScene(shader, brush->faces[i].numVerts, brush->faces[i].verts); } brush = brush->next; } -} \ No newline at end of file +}