Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OPC_AABBCollider.h
Go to the documentation of this file.
1 /*
3  * OPCODE - Optimized Collision Detection
4  * Copyright (C) 2001 Pierre Terdiman
5  * Homepage: http://www.codercorner.com/Opcode.htm
6  */
8 
10 
16 
19 // Include Guard
20 #ifndef __OPC_AABBCOLLIDER_H__
21 #define __OPC_AABBCOLLIDER_H__
22 
24  {
25  AABBCache() : FatCoeff(1.1f)
26  {
27  FatBox.mCenter.Zero();
28  FatBox.mExtents.Zero();
29  }
30 
31  // Cached faces signature
33  // User settings
34  float FatCoeff;
35  };
36 
38  {
39  public:
40  // Constructor / Destructor
41  AABBCollider();
42  virtual ~AABBCollider();
43 
45 
57  bool Collide(AABBCache& cache, const CollisionAABB& box, const Model& model);
59  //
60  bool Collide(AABBCache& cache, const CollisionAABB& box, const AABBTree* tree);
61  protected:
65  // Leaf description
66  Point mLeafVerts[3];
67  // Internal methods
68  void _Collide(const AABBCollisionNode* node);
69  void _Collide(const AABBNoLeafNode* node);
70  void _Collide(const AABBQuantizedNode* node);
71  void _Collide(const AABBQuantizedNoLeafNode* node);
72  void _Collide(const AABBTreeNode* node);
73  void _CollideNoPrimitiveTest(const AABBCollisionNode* node);
74  void _CollideNoPrimitiveTest(const AABBNoLeafNode* node);
75  void _CollideNoPrimitiveTest(const AABBQuantizedNode* node);
76  void _CollideNoPrimitiveTest(const AABBQuantizedNoLeafNode* node);
77  // Overlap tests
78  inline_ bool AABBContainsBox(const Point& bc, const Point& be);
79  inline_ bool AABBAABBOverlap(const Point& b, const Point& Pb);
80  inline_ bool TriBoxOverlap();
81  // Init methods
82  bool InitQuery(AABBCache& cache, const CollisionAABB& box);
83  };
84 
86  {
87  public:
88  // Constructor / Destructor
90  virtual ~HybridAABBCollider();
91 
92  bool Collide(AABBCache& cache, const CollisionAABB& box, const HybridModel& model);
93  protected:
95  };
96 
97 #endif // __OPC_AABBCOLLIDER_H__