summaryrefslogtreecommitdiff
path: root/libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-10-01 20:59:36 -0500
committersanine <sanine.not@pm.me>2022-10-01 20:59:36 -0500
commitc5fc66ee58f2c60f2d226868bb1cf5b91badaf53 (patch)
tree277dd280daf10bf77013236b8edfa5f88708c7e0 /libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h
parent1cf9cc3408af7008451f9133fb95af66a9697d15 (diff)
add ode
Diffstat (limited to 'libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h')
-rw-r--r--libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h b/libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h
new file mode 100644
index 0000000..3f9b39f
--- /dev/null
+++ b/libs/ode-0.16.1/OPCODE/OPC_PlanesTriOverlap.h
@@ -0,0 +1,40 @@
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+/**
+ * Planes-triangle overlap test.
+ * \param in_clip_mask [in] bitmask for active planes
+ * \return TRUE if triangle overlap planes
+ * \warning THIS IS A CONSERVATIVE TEST !! Some triangles will be returned as intersecting, while they're not!
+ */
+///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+inline_ BOOL PlanesCollider::PlanesTriOverlap(udword in_clip_mask)
+{
+ // Stats
+ mNbVolumePrimTests++;
+
+ const Plane* p = mPlanes;
+ udword Mask = 1;
+
+ while(Mask<=in_clip_mask)
+ {
+ if(in_clip_mask & Mask)
+ {
+ float d0 = p->Distance(*mVP.Vertex[0]);
+ float d1 = p->Distance(*mVP.Vertex[1]);
+ float d2 = p->Distance(*mVP.Vertex[2]);
+ if(d0>0.0f && d1>0.0f && d2>0.0f) return FALSE;
+// if(!(IR(d0)&SIGN_BITMASK) && !(IR(d1)&SIGN_BITMASK) && !(IR(d2)&SIGN_BITMASK)) return FALSE;
+ }
+ Mask+=Mask;
+ p++;
+ }
+/*
+ for(udword i=0;i<6;i++)
+ {
+ float d0 = p[i].Distance(mLeafVerts[0]);
+ float d1 = p[i].Distance(mLeafVerts[1]);
+ float d2 = p[i].Distance(mLeafVerts[2]);
+ if(d0>0.0f && d1>0.0f && d2>0.0f) return false;
+ }
+*/
+ return TRUE;
+}