Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00008
00010
00016
00017
00019
00020 #ifndef __OPC_PLANESCOLLIDER_H__
00021 #define __OPC_PLANESCOLLIDER_H__
00022
00023 struct OPCODE_API PlanesCache : VolumeCache
00024 {
00025 PlanesCache()
00026 {
00027 }
00028 };
00029
00030 class OPCODE_API PlanesCollider : public VolumeCollider
00031 {
00032 public:
00033
00034 PlanesCollider();
00035 virtual ~PlanesCollider();
00036
00037 inline void setCollisionPairInserter(hrp::CollisionPairInserterBase* collisionPairInserter) {
00038 this->collisionPairInserter = collisionPairInserter;
00039 }
00041
00055
00056 bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const Model& model, const Matrix4x4* worldm=null);
00057
00058
00059 inline_ bool Collide(PlanesCache& cache, const OBB& box, const Model& model, const Matrix4x4* worldb=null, const Matrix4x4* worldm=null)
00060 {
00061 Plane PL[6];
00062
00063 if(worldb)
00064 {
00065
00066 OBB WorldBox;
00067 box.Rotate(*worldb, WorldBox);
00068
00069 WorldBox.ComputePlanes(PL);
00070 }
00071 else
00072 {
00073
00074 box.ComputePlanes(PL);
00075 }
00076
00077
00078 return Collide(cache, PL, 6, model, worldm);
00079 }
00080
00081
00083
00087
00088 override(Collider) const char* ValidateSettings();
00089
00090 protected:
00091 hrp::CollisionPairInserterBase* collisionPairInserter;
00092
00093 udword mNbPlanes;
00094 Plane* mPlanes;
00095
00096 VertexPointers mVP;
00097
00098 void _Collide(const AABBCollisionNode* node, udword clip_mask);
00099 void _Collide(const AABBNoLeafNode* node, udword clip_mask);
00100 void _Collide(const AABBQuantizedNode* node, udword clip_mask);
00101 void _Collide(const AABBQuantizedNoLeafNode* node, udword clip_mask);
00102 void _CollideNoPrimitiveTest(const AABBCollisionNode* node, udword clip_mask);
00103 void _CollideNoPrimitiveTest(const AABBNoLeafNode* node, udword clip_mask);
00104 void _CollideNoPrimitiveTest(const AABBQuantizedNode* node, udword clip_mask);
00105 void _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node, udword clip_mask);
00106
00107 inline_ BOOL PlanesAABBOverlap(const Point& center, const Point& extents, udword& out_clip_mask, udword in_clip_mask);
00108 inline_ BOOL PlanesTriOverlap(udword in_clip_mask);
00109
00110 BOOL InitQuery(PlanesCache& cache, const Plane* planes, udword nb_planes, const Matrix4x4* worldm=null);
00111 };
00112
00113 class OPCODE_API HybridPlanesCollider : public PlanesCollider
00114 {
00115 public:
00116
00117 HybridPlanesCollider();
00118 virtual ~HybridPlanesCollider();
00119
00120 bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const HybridModel& model, const Matrix4x4* worldm=null);
00121 protected:
00122 Container mTouchedBoxes;
00123 };
00124
00125 #endif // __OPC_PLANESCOLLIDER_H__