{
for (i = 0;i < numtriangles;i++, element3i += 3)
{
- if (TriangleOverlapsBox(vertex3f + element3i[0]*3, vertex3f + element3i[1]*3, vertex3f + element3i[2]*3, segmentmins, segmentmaxs))
+ if (TriangleBBoxOverlapsBox(vertex3f + element3i[0]*3, vertex3f + element3i[1]*3, vertex3f + element3i[2]*3, segmentmins, segmentmaxs))
{
VectorCopy(vertex3f + element3i[0] * 3, points[0].v);
VectorCopy(vertex3f + element3i[1] * 3, points[1].v);
VectorCopy(v[0], v2[0]);
VectorCopy(v[1], v2[1]);
VectorCopy(v[2], v2[2]);
- if (insidebox || TriangleOverlapsBox(v2[0], v2[1], v2[2], info->lightmins, info->lightmaxs))
+ if (insidebox || TriangleBBoxOverlapsBox(v2[0], v2[1], v2[2], info->lightmins, info->lightmaxs))
SVBSP_AddPolygon(&r_svbsp, 3, v2[0], true, NULL, NULL, 0);
}
}
VectorCopy(v[0], v2[0]);
VectorCopy(v[1], v2[1]);
VectorCopy(v[2], v2[2]);
- if (!insidebox && !TriangleOverlapsBox(v2[0], v2[1], v2[2], info->lightmins, info->lightmaxs))
+ if (!insidebox && !TriangleBBoxOverlapsBox(v2[0], v2[1], v2[2], info->lightmins, info->lightmaxs))
continue;
if (svbspactive && !(SVBSP_AddPolygon(&r_svbsp, 3, v2[0], false, NULL, NULL, 0) & 2))
continue;
#define VectorReflect(a,r,b,c) do{double d;d = DotProduct((a), (b)) * -(1.0 + (r));VectorMA((a), (d), (b), (c));}while(0)
#define BoxesOverlap(a,b,c,d) ((a)[0] <= (d)[0] && (b)[0] >= (c)[0] && (a)[1] <= (d)[1] && (b)[1] >= (c)[1] && (a)[2] <= (d)[2] && (b)[2] >= (c)[2])
#define BoxInsideBox(a,b,c,d) ((a)[0] >= (c)[0] && (b)[0] <= (d)[0] && (a)[1] >= (c)[1] && (b)[1] <= (d)[1] && (a)[2] >= (c)[2] && (b)[2] <= (d)[2])
-#define TriangleOverlapsBox(a,b,c,d,e) (min((a)[0], min((b)[0], (c)[0])) < (e)[0] && max((a)[0], max((b)[0], (c)[0])) > (d)[0] && min((a)[1], min((b)[1], (c)[1])) < (e)[1] && max((a)[1], max((b)[1], (c)[1])) > (d)[1] && min((a)[2], min((b)[2], (c)[2])) < (e)[2] && max((a)[2], max((b)[2], (c)[2])) > (d)[2])
+#define TriangleBBoxOverlapsBox(a,b,c,d,e) (min((a)[0], min((b)[0], (c)[0])) < (e)[0] && max((a)[0], max((b)[0], (c)[0])) > (d)[0] && min((a)[1], min((b)[1], (c)[1])) < (e)[1] && max((a)[1], max((b)[1], (c)[1])) > (d)[1] && min((a)[2], min((b)[2], (c)[2])) < (e)[2] && max((a)[2], max((b)[2], (c)[2])) > (d)[2])
#define TriangleNormal(a,b,c,n) ( \
(n)[0] = ((a)[1] - (b)[1]) * ((c)[2] - (b)[2]) - ((a)[2] - (b)[2]) * ((c)[1] - (b)[1]), \
VectorCopy(vertex3f + elements[1] * 3, v + 3);
VectorCopy(vertex3f + elements[2] * 3, v + 6);
if (PointInfrontOfTriangle(info->eye, v + 0, v + 3, v + 6)
- && (insidebox || TriangleOverlapsBox(v, v + 3, v + 6, info->boxmins, info->boxmaxs))
+ && (insidebox || TriangleBBoxOverlapsBox(v, v + 3, v + 6, info->boxmins, info->boxmaxs))
&& (!info->exact || Portal_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, v, 3, &portaltemppoints2[0][0], 256) > 0))
{
addedtris = true;
v[2] = invertex3f + e[2] * 3;
TriangleNormal(v[0], v[1], v[2], normal);
if (r_shadow_frontsidecasting.integer == (DotProduct(normal, projectdirection) < 0)
- && TriangleOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
+ && TriangleBBoxOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
shadowmarklist[numshadowmark++] = t;
}
}
v[1] = invertex3f + e[1] * 3;
v[2] = invertex3f + e[2] * 3;
if (r_shadow_frontsidecasting.integer == PointInfrontOfTriangle(projectorigin, v[0], v[1], v[2])
- && TriangleOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
+ && TriangleBBoxOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
shadowmarklist[numshadowmark++] = t;
}
}
v[0] = invertex3f + e[0] * 3, v[1] = invertex3f + e[1] * 3, v[2] = invertex3f + e[2] * 3;
TriangleNormal(v[0], v[1], v[2], normal);
if (r_shadow_frontsidecasting.integer == (DotProduct(normal, projectdirection) < 0)
- && TriangleOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
+ && TriangleBBoxOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
{
Matrix4x4_Transform(worldtolight, v[0], p[0]), Matrix4x4_Transform(worldtolight, v[1], p[1]), Matrix4x4_Transform(worldtolight, v[2], p[2]);
mask = R_Shadow_CalcTriangleSideMask(p[0], p[1], p[2], bias);
{
v[0] = invertex3f + e[0] * 3, v[1] = invertex3f + e[1] * 3, v[2] = invertex3f + e[2] * 3;
if (r_shadow_frontsidecasting.integer == PointInfrontOfTriangle(projectorigin, v[0], v[1], v[2])
- && TriangleOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
+ && TriangleBBoxOverlapsBox(v[0], v[1], v[2], lightmins, lightmaxs))
{
Matrix4x4_Transform(worldtolight, v[0], p[0]), Matrix4x4_Transform(worldtolight, v[1], p[1]), Matrix4x4_Transform(worldtolight, v[2], p[2]);
mask = R_Shadow_CalcTriangleSideMask(p[0], p[1], p[2], bias);