diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ode-0.9/OPCODE/OPC_PlanesCollider.h | 121 |
1 files changed, 0 insertions, 121 deletions
diff --git a/libraries/ode-0.9/OPCODE/OPC_PlanesCollider.h b/libraries/ode-0.9/OPCODE/OPC_PlanesCollider.h deleted file mode 100644 index 35de28a..0000000 --- a/libraries/ode-0.9/OPCODE/OPC_PlanesCollider.h +++ /dev/null | |||
@@ -1,121 +0,0 @@ | |||
1 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
2 | /* | ||
3 | * OPCODE - Optimized Collision Detection | ||
4 | * Copyright (C) 2001 Pierre Terdiman | ||
5 | * Homepage: http://www.codercorner.com/Opcode.htm | ||
6 | */ | ||
7 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
8 | |||
9 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
10 | /** | ||
11 | * Contains code for a planes collider. | ||
12 | * \file OPC_PlanesCollider.h | ||
13 | * \author Pierre Terdiman | ||
14 | * \date January, 1st, 2002 | ||
15 | */ | ||
16 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
17 | |||
18 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
19 | // Include Guard | ||
20 | #ifndef __OPC_PLANESCOLLIDER_H__ | ||
21 | #define __OPC_PLANESCOLLIDER_H__ | ||
22 | |||
23 | struct OPCODE_API PlanesCache : VolumeCache | ||
24 | { | ||
25 | PlanesCache() | ||
26 | { | ||
27 | } | ||
28 | }; | ||
29 | |||
30 | class OPCODE_API PlanesCollider : public VolumeCollider | ||
31 | { | ||
32 | public: | ||
33 | // Constructor / Destructor | ||
34 | PlanesCollider(); | ||
35 | virtual ~PlanesCollider(); | ||
36 | |||
37 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
38 | /** | ||
39 | * Generic collision query for generic OPCODE models. After the call, access the results: | ||
40 | * - with GetContactStatus() | ||
41 | * - with GetNbTouchedPrimitives() | ||
42 | * - with GetTouchedPrimitives() | ||
43 | * | ||
44 | * \param cache [in/out] a planes cache | ||
45 | * \param planes [in] list of planes in world space | ||
46 | * \param nb_planes [in] number of planes | ||
47 | * \param model [in] Opcode model to collide with | ||
48 | * \param worldm [in] model's world matrix, or null | ||
49 | * \return true if success | ||
50 | * \warning SCALE NOT SUPPORTED. The matrices must contain rotation & translation parts only. | ||
51 | */ | ||
52 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
53 | bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const Model& model, const Matrix4x4* worldm=null); | ||
54 | |||
55 | // Mutant box-with-planes collision queries | ||
56 | inline_ bool Collide(PlanesCache& cache, const OBB& box, const Model& model, const Matrix4x4* worldb=null, const Matrix4x4* worldm=null) | ||
57 | { | ||
58 | Plane PL[6]; | ||
59 | |||
60 | if(worldb) | ||
61 | { | ||
62 | // Create a new OBB in world space | ||
63 | OBB WorldBox; | ||
64 | box.Rotate(*worldb, WorldBox); | ||
65 | // Compute planes from the sides of the box | ||
66 | WorldBox.ComputePlanes(PL); | ||
67 | } | ||
68 | else | ||
69 | { | ||
70 | // Compute planes from the sides of the box | ||
71 | box.ComputePlanes(PL); | ||
72 | } | ||
73 | |||
74 | // Collide with box planes | ||
75 | return Collide(cache, PL, 6, model, worldm); | ||
76 | } | ||
77 | // Settings | ||
78 | |||
79 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
80 | /** | ||
81 | * Validates current settings. You should call this method after all the settings and callbacks have been defined for a collider. | ||
82 | * \return null if everything is ok, else a string describing the problem | ||
83 | */ | ||
84 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
85 | override(Collider) const char* ValidateSettings(); | ||
86 | |||
87 | protected: | ||
88 | // Planes in model space | ||
89 | udword mNbPlanes; | ||
90 | Plane* mPlanes; | ||
91 | // Leaf description | ||
92 | VertexPointers mVP; | ||
93 | // Internal methods | ||
94 | void _Collide(const AABBCollisionNode* node, udword clip_mask); | ||
95 | void _Collide(const AABBNoLeafNode* node, udword clip_mask); | ||
96 | void _Collide(const AABBQuantizedNode* node, udword clip_mask); | ||
97 | void _Collide(const AABBQuantizedNoLeafNode* node, udword clip_mask); | ||
98 | void _CollideNoPrimitiveTest(const AABBCollisionNode* node, udword clip_mask); | ||
99 | void _CollideNoPrimitiveTest(const AABBNoLeafNode* node, udword clip_mask); | ||
100 | void _CollideNoPrimitiveTest(const AABBQuantizedNode* node, udword clip_mask); | ||
101 | void _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node, udword clip_mask); | ||
102 | // Overlap tests | ||
103 | inline_ BOOL PlanesAABBOverlap(const Point& center, const Point& extents, udword& out_clip_mask, udword in_clip_mask); | ||
104 | inline_ BOOL PlanesTriOverlap(udword in_clip_mask); | ||
105 | // Init methods | ||
106 | BOOL InitQuery(PlanesCache& cache, const Plane* planes, udword nb_planes, const Matrix4x4* worldm=null); | ||
107 | }; | ||
108 | |||
109 | class OPCODE_API HybridPlanesCollider : public PlanesCollider | ||
110 | { | ||
111 | public: | ||
112 | // Constructor / Destructor | ||
113 | HybridPlanesCollider(); | ||
114 | virtual ~HybridPlanesCollider(); | ||
115 | |||
116 | bool Collide(PlanesCache& cache, const Plane* planes, udword nb_planes, const HybridModel& model, const Matrix4x4* worldm=null); | ||
117 | protected: | ||
118 | Container mTouchedBoxes; | ||
119 | }; | ||
120 | |||
121 | #endif // __OPC_PLANESCOLLIDER_H__ | ||