for (portal = model->brush.data_leafs[leafnum].portals;portal;portal = portal->next)
{
if (portal->numpoints <= POLYGONELEMENTS_MAXPOINTS)
- if (!R_CullBox(portal->mins, portal->maxs))
+ if (!R_CullFrustum(portal->mins, portal->maxs))
{
VectorClear(center);
for (i = 0;i < portal->numpoints;i++)
{
if (surfacevisible[surfaceindex])
{
- if (R_CullBox(surfaces[surfaceindex].mins, surfaces[surfaceindex].maxs)
+ if (R_CullFrustum(surfaces[surfaceindex].mins, surfaces[surfaceindex].maxs)
|| (r_vis_trace_surfaces.integer && !R_CanSeeBox(r_vis_trace_samples.integer, r_vis_trace_eyejitter.value, r_vis_trace_enlarge.value, r_vis_trace_expand.value, r_vis_trace_pad.value, r_refdef.view.origin, surfaces[surfaceindex].mins, surfaces[surfaceindex].maxs)))
surfacevisible[surfaceindex] = 0;
}
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_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
+ if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullFrustum(leaf->mins, leaf->maxs))
{
r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
if (leaf->clusterindex < 0)
continue;
// if leaf is in current pvs and on the screen, mark its surfaces
- if (!R_CullBox(leaf->mins, leaf->maxs))
+ if (!R_CullFrustum(leaf->mins, leaf->maxs))
{
r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
if (leaf->clusterindex < 0)
continue;
// if leaf is in current pvs and on the screen, mark its surfaces
- if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullBox(leaf->mins, leaf->maxs))
+ if (CHECKPVSBIT(r_refdef.viewcache.world_pvsbits, leaf->clusterindex) && !R_CullFrustum(leaf->mins, leaf->maxs))
{
r_refdef.stats[r_stat_world_leafs]++;
r_refdef.viewcache.world_leafvisible[j] = true;
cullmaxs[0] = p->maxs[0] + cullbias;
cullmaxs[1] = p->maxs[1] + cullbias;
cullmaxs[2] = p->maxs[2] + cullbias;
- if (R_CullBox(cullmins, cullmaxs))
+ if (R_CullFrustum(cullmins, cullmaxs))
continue;
if (r_vis_trace.integer)
{
continue;
#endif
#if 0
- if (!r_shadow_compilingrtlight && R_CullBoxCustomPlanes(node->mins, node->maxs, rtlight->cached_numfrustumplanes, rtlight->cached_frustumplanes))
+ if (!r_shadow_compilingrtlight && R_CullBox(node->mins, node->maxs, rtlight->cached_numfrustumplanes, rtlight->cached_frustumplanes))
continue;
#endif
// axial planes can be processed much more quickly
continue;
#endif
#if 1
- if (!r_shadow_compilingrtlight && R_CullBoxCustomPlanes(leaf->mins, leaf->maxs, info->numfrustumplanes, info->frustumplanes))
+ if (!r_shadow_compilingrtlight && R_CullBox(leaf->mins, leaf->maxs, info->numfrustumplanes, info->frustumplanes))
continue;
#endif
continue;
#endif
#if 1
- if (!r_shadow_compilingrtlight && R_CullBoxCustomPlanes(leaf->mins, leaf->maxs, info->numfrustumplanes, info->frustumplanes))
+ if (!r_shadow_compilingrtlight && R_CullBox(leaf->mins, leaf->maxs, info->numfrustumplanes, info->frustumplanes))
continue;
#endif
surfaceindex = leaf->surfaceindex;
continue;
#endif
#if 0
- if (!r_shadow_compilingrtlight && R_CullBoxCustomPlanes(node->mins, node->maxs, rtlight->cached_numfrustumplanes, rtlight->cached_frustumplanes))
+ if (!r_shadow_compilingrtlight && R_CullBox(node->mins, node->maxs, rtlight->cached_numfrustumplanes, rtlight->cached_frustumplanes))
continue;
#endif
if (info->lightmins[axis] <= node->backmax)
// exceeding the number of triangles in a single mesh) we have to make sure
// that we make only a single mesh - so over-estimate the size of the mesh
// to match the model.
- r_shadow_compilingrtlight->static_meshchain_shadow_shadowmap = Mod_ShadowMesh_Begin(r_main_mempool, model->surfmesh.num_vertices, model->surfmesh.num_triangles);
+ // bones_was_here: +128 works around BUG https://github.com/DarkPlacesEngine/darkplaces/issues/119
+ // +64 was enough to start the map without triggering ASan, +96 was enough to also edit the light.
+ // See also: warning in Mod_ShadowMesh_AddMesh
+ r_shadow_compilingrtlight->static_meshchain_shadow_shadowmap = Mod_ShadowMesh_Begin(r_main_mempool, model->surfmesh.num_vertices, model->surfmesh.num_triangles + 128);
R_Shadow_PrepareShadowSides(model->surfmesh.num_triangles);
for (surfacelistindex = 0;surfacelistindex < numsurfaces;surfacelistindex++)
{