38 #define SET_CONTACT(prim_index, flag) \ 41 mTouchedPrimitives->Add(prim_index); 44 #define PLANES_PRIM(prim_index, flag) \ 46 mIMesh->GetTriangle(mVP, prim_index); \ 48 if(PlanesTriOverlap(clip_mask)) \ 50 SET_CONTACT(prim_index, flag) \ 59 collisionPairInserter(NULL),
107 if(!
Setup(&model))
return false;
110 if(
InitQuery(cache, planes, nb_planes, worldm))
return true;
112 udword PlaneMask = (1<<nb_planes)-1;
126 else _Collide(Tree->GetNodes(), PlaneMask);
134 else _Collide(Tree->GetNodes(), PlaneMask);
149 else _Collide(Tree->GetNodes(), PlaneMask);
157 else _Collide(Tree->GetNodes(), PlaneMask);
260 #define TEST_CLIP_MASK \ 266 mFlags |= OPC_CONTACT; \ 281 if(!
PlanesAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents, OutClipMask, clip_mask))
return;
292 _Collide(node->GetPos(), OutClipMask);
296 _Collide(node->GetNeg(), OutClipMask);
310 if(!
PlanesAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents, OutClipMask, clip_mask))
return;
355 _Collide(node->GetPos(), OutClipMask);
359 _Collide(node->GetNeg(), OutClipMask);
407 if(!
PlanesAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents, OutClipMask, clip_mask))
return;
413 else _Collide(node->GetPos(), OutClipMask);
418 else _Collide(node->GetNeg(), OutClipMask);
431 if(!
PlanesAABBOverlap(node->mAABB.mCenter, node->mAABB.mExtents, OutClipMask, clip_mask))
return;
466 else _Collide(node->GetPos(), OutClipMask);
471 else _Collide(node->GetNeg(), OutClipMask);
533 if(!
Setup(&model))
return false;
536 if(
InitQuery(cache, planes, nb_planes, worldm))
return true;
554 mTouchedBoxes.Reset();
557 udword PlaneMask = (1<<nb_planes)-1;
615 const udword* Touched = mTouchedBoxes.GetEntries();
635 udword TriangleIndex = *T++;
646 udword TriangleIndex = BaseIndex++;
inline_ BOOL HasSingleNode() const
const MeshInterface * mIMesh
User-defined mesh interface.
inline_ const udword * GetIndices() const
virtual inline_ void InitQuery()
inline_ BOOL SkipPrimitiveTests() const
#define null
our own NULL pointer
Container TouchedPrimitives
Indices of touched primitives.
const BaseModel * mCurrentModel
Current model for collision query (owner of touched faces)
#define DELETEARRAY(x)
Deletes an array.
uword mExtents[3]
Quantized extents.
inline_ BOOL ContactFound() const
#define PLANES_PRIM(prim_index, flag)
Planes-triangle test.
inline_ BOOL TemporalCoherenceEnabled() const
inline_ udword GetNbEntries() const
Returns the current number of entries.
sword mCenter[3]
Quantized center.
inline_ const AABBOptimizedTree * GetTree() const
inline_ BOOL GetContactStatus() const
virtual const char * ValidateSettings()=0
int BOOL
Another boolean type.
#define SET_CONTACT(prim_index, flag)
unsigned int udword
sizeof(udword) must be 4
void _CollideNoPrimitiveTest(const AABBCollisionNode *node, udword clip_mask)
inline_ udword GetNbTriangles() const
inline_ BOOL IsQuantized() const
void _Collide(const AABBCollisionNode *node, udword clip_mask)
inline_ BOOL Setup(const BaseModel *model)
Final contact status after a collision query.
bool Collide(PlanesCache &cache, const Plane *planes, udword nb_planes, const HybridModel &model, const Matrix4x4 *worldm=null)
virtual ~PlanesCollider()
ICEMATHS_API void InvertPRMatrix(Matrix4x4 &dest, const Matrix4x4 &src)
inline_ void CopyMemory(void *dest, const void *src, udword size)
inline_ udword GetNbTriangles() const
virtual ~HybridPlanesCollider()
inline_ udword GetTriangleIndex() const
inline_ udword GetEntry(udword i) const
Returns ith entry.
inline_ BOOL PlanesAABBOverlap(const Point ¢er, const Point &extents, udword &out_clip_mask, udword in_clip_mask)
inline_ BOOL HasLeafNodes() const
bool Collide(PlanesCache &cache, const Plane *planes, udword nb_planes, const Model &model, const Matrix4x4 *worldm=null)
inline_ void TransformPlane(Plane &transformed, const Plane &plane, const Matrix4x4 &transform)
Container * mTouchedPrimitives
List of touched primitives.
Keep or discard primitive-bv tests in leaf nodes (volume-mesh queries)
inline_ BOOL FirstContactEnabled() const
inline_ const LeafTriangles * GetLeafTriangles() const