Skip to content

Commit

Permalink
Cull clips/triggers/slicks out of PVS
Browse files Browse the repository at this point in the history
In addition to frustum culling, don't draw brushes that are not in current PVS.
  • Loading branch information
Aciz committed Jun 4, 2024
1 parent e1840e5 commit 637b5ef
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/client/cl_tc_vis.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}

0 comments on commit 637b5ef

Please sign in to comment.