]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
rename a macro with misleading name, as TriangleOverlapsBox doesn't check for actual...
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Jun 2012 08:08:38 +0000 (08:08 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Fri, 15 Jun 2012 08:08:38 +0000 (08:08 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11829 d7cf8633-e32d-0410-b094-e92efae38249

collision.c
gl_rsurf.c
mathlib.h
portals.c
r_shadow.c

index b20e0c34f0618519846f35c9009db7043f676b61..af0758f50fb196d5c9914ba9402b43fde49c933e 100644 (file)
@@ -1036,7 +1036,7 @@ void Collision_TraceBrushTriangleMeshFloat(trace_t *trace, const colbrushf_t *th
        {
                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);
index 611320b5489a509939861d4688acc185d792a251..1075039c1de6f0cd07ad1e4b7450c5bdfdc52838 100644 (file)
@@ -894,7 +894,7 @@ static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qboo
                                                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);
                                        }
                                }
@@ -922,7 +922,7 @@ static void R_Q1BSP_RecursiveGetLightInfo_BSP(r_q1bsp_getlightinfo_t *info, qboo
                                                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;
index 3e7fa4c83c15839267e3dfdc27daad1bd8babc1c..9a9cd732f2c55164d07a15b3f3ed6e5bb50c043f 100644 (file)
--- a/mathlib.h
+++ b/mathlib.h
@@ -135,7 +135,7 @@ unsigned int CeilPowerOf2(unsigned int value);
 #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]), \
index 0900a34f8f6c9c6fb41dc12b53c77baaa03a8398..2872a8ca89c1a3faaa1fe22ef11cc8be242a1a94 100644 (file)
--- a/portals.c
+++ b/portals.c
@@ -339,7 +339,7 @@ static void Portal_RecursiveFlow (portalrecursioninfo_t *info, mleaf_t *leaf, in
                                        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;
index f403405e1ecc3fef7e8e2911a7e7735119819c62..f8c6557dbb45f4f0abbb57ae581fcdc7b3fe95e8 100644 (file)
@@ -1300,7 +1300,7 @@ void R_Shadow_MarkVolumeFromBox(int firsttriangle, int numtris, const float *inv
                                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;
                        }
                }
@@ -1312,7 +1312,7 @@ void R_Shadow_MarkVolumeFromBox(int firsttriangle, int numtris, const float *inv
                                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;
                        }
                }
@@ -1684,7 +1684,7 @@ int R_Shadow_ChooseSidesFromBox(int firsttriangle, int numtris, const float *inv
                                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);
@@ -1704,7 +1704,7 @@ int R_Shadow_ChooseSidesFromBox(int firsttriangle, int numtris, const float *inv
                        {
                                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);