- if (node->contents < 0)
- {
- if (node->contents != CONTENTS_SOLID && R_NotCulledBox(node->mins, node->maxs))
- {
- // mark surfaces as being visible for processing by code later
- pleaf = (mleaf_t *)node;
-
- c_leafs++;
-
- pleaf->visframe = r_framecount;
-
- if (pleaf->nummarksurfaces)
- {
- mark = pleaf->firstmarksurface;
- endmark = mark + pleaf->nummarksurfaces;
- do
- (*mark++)->visframe = r_framecount;
- while (mark < endmark);
- }
-
- // deal with model fragments in this leaf
-// if (pleaf->efrags)
-// R_StoreEfrags (&pleaf->efrags);
- }
-
-culled:
- if (nstack <= nodestack)
- break;
- nstack--;
- node = nstack->node;
- side = nstack->side;
- clip = nstack->clip;
- goto loc0;
- }
- else if (clip)
- {
- // for easier reading, the values are:
- // 1 = not culled at all (very uncommon in large nodes, uncommon in medium nodes, common in small nodes)
- // 2 = completely culled (uncommon in large nodes, common in medium nodes, uncommon in small nodes)
- // 3 = partially culled (common in large nodes, common in medium nodes, uncommon in small nodes)
- if ((c = frustum[0].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[0])) == 3) goto cull1;else if (c == 2) goto culled;// else 1
- if ((c = frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1])) == 3) goto cull2;else if (c == 2) goto culled;// else 1
- if ((c = frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2])) == 3) goto cull3;else if (c == 2) goto culled;// else 1
- if ((c = frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3])) == 3) goto cull4;else if (c == 2) goto culled;// else 1
- // completely onscreen, no need to cull children
- clip = false;
- goto cull4;
- // partially clipped node
-cull1: if (frustum[1].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[1]) == 2) goto culled;// else 1 or 3
-cull2: if (frustum[2].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[2]) == 2) goto culled;// else 1 or 3
-cull3: if (frustum[3].BoxOnPlaneSideFunc(node->mins, node->maxs, &frustum[3]) == 2) goto culled;// else 1 or 3
-cull4: ;
- }
-
- c_nodes++;