diff options
author | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-11-06 07:56:05 +0300 |
---|---|---|
committer | Kester Maddock <Christopher.Maddock.1@uni.massey.ac.nz> | 2004-11-06 07:56:05 +0300 |
commit | b3395edd2a371de8ee56b3fbdfff4687750acccd (patch) | |
tree | df95ab798097cddea86eb6ed737f680274dd6122 | |
parent | ce4b232f8c1f0879111027c0e754dd5cd014891d (diff) |
Add new broad phase collision response to Solid: this will let us hook (and potentially reject) the detail phase.
-rw-r--r-- | extern/solid/SOLID/SOLID.h | 5 | ||||
-rwxr-xr-x | extern/solid/include/SOLID.h | 7 | ||||
-rwxr-xr-x | extern/solid/src/DT_C-api.cpp | 8 | ||||
-rwxr-xr-x | extern/solid/src/DT_Encounter.cpp | 4 |
4 files changed, 21 insertions, 3 deletions
diff --git a/extern/solid/SOLID/SOLID.h b/extern/solid/SOLID/SOLID.h index 906be729ba0..37d74340f8c 100644 --- a/extern/solid/SOLID/SOLID.h +++ b/extern/solid/SOLID/SOLID.h @@ -40,7 +40,8 @@ extern "C" { typedef unsigned int DT_ResponseClass; typedef enum DT_ResponseType { - DT_NO_RESPONSE, /* No response (obsolete) */ + DT_NO_RESPONSE, /* No response (obsolete) */ + DT_BROAD_RESPONSE, DT_SIMPLE_RESPONSE, /* No collision data */ DT_WITNESSED_RESPONSE, /* A point common to both objects is returned as collision data @@ -146,6 +147,8 @@ extern "C" { extern DECLSPEC void DT_GetBBox(DT_ObjectHandle object, DT_Vector3 min, DT_Vector3 max); + extern DECLSPEC DT_Bool DT_GetIntersect(DT_ObjectHandle object1, DT_ObjectHandle object2, + DT_Vector3 v); /* This next command returns the distance between the objects. De returned closest points are given in world coordinates. */ diff --git a/extern/solid/include/SOLID.h b/extern/solid/include/SOLID.h index 906be729ba0..96d40f1ea6b 100755 --- a/extern/solid/include/SOLID.h +++ b/extern/solid/include/SOLID.h @@ -40,7 +40,8 @@ extern "C" { typedef unsigned int DT_ResponseClass; typedef enum DT_ResponseType { - DT_NO_RESPONSE, /* No response (obsolete) */ + DT_NO_RESPONSE, /* No response (obsolete) */ + DT_BROAD_RESPONSE, /* Broad phase response is returned. */ DT_SIMPLE_RESPONSE, /* No collision data */ DT_WITNESSED_RESPONSE, /* A point common to both objects is returned as collision data @@ -145,7 +146,9 @@ extern "C" { extern DECLSPEC void DT_GetBBox(DT_ObjectHandle object, DT_Vector3 min, DT_Vector3 max); - + + extern DECLSPEC DT_Bool DT_GetIntersect(DT_ObjectHandle object1, DT_ObjectHandle object2, + DT_Vector3 v); /* This next command returns the distance between the objects. De returned closest points are given in world coordinates. */ diff --git a/extern/solid/src/DT_C-api.cpp b/extern/solid/src/DT_C-api.cpp index c07a3bb7ccc..ac16deda87d 100755 --- a/extern/solid/src/DT_C-api.cpp +++ b/extern/solid/src/DT_C-api.cpp @@ -372,6 +372,14 @@ void DT_GetBBox(DT_ObjectHandle object, DT_Vector3 min, DT_Vector3 max) bbox.getMax().getValue(max); } +DT_Bool DT_GetIntersect(DT_ObjectHandle object1, DT_ObjectHandle object2, DT_Vector3 vec) +{ + MT_Vector3 v; + DT_Bool result = intersect(*(DT_Object*)object1, *(DT_Object*)object2, v); + v.getValue(vec); + return result; +} + DT_Scalar DT_GetClosestPair(DT_ObjectHandle object1, DT_ObjectHandle object2, DT_Vector3 point1, DT_Vector3 point2) { diff --git a/extern/solid/src/DT_Encounter.cpp b/extern/solid/src/DT_Encounter.cpp index 49cc4bf3764..36de33154a3 100755 --- a/extern/solid/src/DT_Encounter.cpp +++ b/extern/solid/src/DT_Encounter.cpp @@ -32,6 +32,10 @@ DT_Bool DT_Encounter::exactTest(const DT_RespTable *respTable, int& count) const switch (responseList.getType()) { + case DT_BROAD_RESPONSE: + return (respTable->getResponseClass(m_obj_ptr1) < respTable->getResponseClass(m_obj_ptr2)) ? + responseList(m_obj_ptr1->getClientObject(), m_obj_ptr2->getClientObject(), 0) : + responseList(m_obj_ptr2->getClientObject(), m_obj_ptr1->getClientObject(), 0); case DT_SIMPLE_RESPONSE: if (intersect(*m_obj_ptr1, *m_obj_ptr2, m_sep_axis)) { |