TDME2  1.9.200
OrientedBoundingBox.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <array>
4 
5 #include <tdme/tdme.h>
9 #include <tdme/math/Vector3.h>
10 
11 using std::array;
12 
17 
18 /**
19  * Oriented bounding box physics primitive
20  * @author Andreas Drewke
21  */
23  : public BoundingVolume
24 {
25 private:
26  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE0_INDICES;
27  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE1_INDICES;
28  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE2_INDICES;
29  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE3_INDICES;
30  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE4_INDICES;
31  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE5_INDICES;
32  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE6_INDICES;
33  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE7_INDICES;
34  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE8_INDICES;
35  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE9_INDICES;
36  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE10_INDICES;
37  STATIC_DLL_IMPEXT static const array<int32_t, 3> FACE11_INDICES;
38  STATIC_DLL_IMPEXT static const array<array<int32_t,3>,12> facesVerticesIndexes;
39 
40  // overridden methods
41  void destroyCollisionShape() override;
42  void createCollisionShape(World* world) override;
43 
44 public:
48 
49  // forbid class copy
51 
52  /**
53  * Public constructor
54  * @param center center
55  * @param axis0 axis0
56  * @param axis1 axis1
57  * @param axis2 axis2
58  * @param halfExtension half extension
59  * @param scale scale
60  */
61  OrientedBoundingBox(const Vector3& center, const Vector3& axis0, const Vector3& axis1, const Vector3& axis2, const Vector3& halfExtension, const Vector3& scale = Vector3(1.0f, 1.0f, 1.0f));
62 
63  /**
64  * Public constructor
65  * @param bb bounding box
66  * @param scale scale
67  */
68  OrientedBoundingBox(BoundingBox* bb, const Vector3& scale = Vector3(1.0f, 1.0f, 1.0f));
69 
70  /**
71  * Public constructor
72  */
74 
75  /**
76  * Public destructor
77  */
79 
80  /**
81  * @return 3 axes
82  */
83  const array<Vector3, 3>& getAxes() const;
84 
85  /**
86  * @return half extension
87  */
88  const Vector3& getHalfExtension() const;
89 
90  /**
91  * Set up oriented bounding box from oriented bounding box
92  * @param scale bb
93  */
94 
95  // overrides
96  void setScale(const Vector3& scale) override;
97  BoundingVolume* clone() const override;
98 
99  /**
100  * @return oriented bounding box vertices
101  */
102  const array<Vector3, 8> getVertices() const;
103 
104  /**
105  * @return faces vertices indexes
106  */
107  static const array<array<int32_t,3>,12>& getFacesVerticesIndexes();
108 
109 private:
110  array<Vector3, 3> axes;
112 };
Dynamic physics world class.
Definition: World.h:38
Axis aligned bounding box used for frustum, this is not directly connectable with physics engine.
Definition: BoundingBox.h:26
Oriented bounding box physics primitive.
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE6_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE1_INDICES
static STATIC_DLL_IMPEXT const array< array< int32_t, 3 >, 12 > facesVerticesIndexes
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE10_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE5_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE2_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE11_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE7_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE9_INDICES
const array< Vector3, 8 > getVertices() const
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE4_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE3_INDICES
void destroyCollisionShape() override
Destroy collision shape.
void setScale(const Vector3 &scale) override
Set up oriented bounding box from oriented bounding box.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Y
static const array< array< int32_t, 3 >, 12 > & getFacesVerticesIndexes()
const array< Vector3, 3 > & getAxes() const
void createCollisionShape(World *world) override
Create collision shap.
BoundingVolume * clone() const override
Clones this bounding volume.
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_Z
static STATIC_DLL_IMPEXT const Vector3 AABB_AXIS_X
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE0_INDICES
static STATIC_DLL_IMPEXT const array< int32_t, 3 > FACE8_INDICES
Vector3 class representing vector3 mathematical structure and operations with x, y,...
Definition: Vector3.h:20
#define STATIC_DLL_IMPEXT
Definition: tdme.h:15
#define FORBID_CLASS_COPY(CLASS)
Definition: tdme.h:6