PhysicsShape.hpp
Go to the documentation of this file.
1 
6 #pragma once
7 
8 #include <etk/types.hpp>
9 #include <etk/math/Vector4D.hpp>
10 #include <etk/math/Vector3D.hpp>
11 #include <ememory/memory.hpp>
12 
13 
14 namespace ege {
15  class PhysicsBox;
16  class PhysicsCylinder;
17  class PhysicsCapsule;
18  class PhysicsCone;
19  class PhysicsConvexHull;
20  class PhysicsSphere;
21 
22  class PhysicsShape {
23  public:
24  static ememory::SharedPtr<ege::PhysicsShape> create(const std::string& _name);
25  public:
26  enum type {
27  unknow,
28  box,
29  capsule,
30  cone,
31  convexHull,
32  cylinder,
33  sphere
34  };
35  public:
36  PhysicsShape() :
37  m_quaternion(1,0,0,0),
38  m_origin(0,0,0) {
39 
40  };
41  virtual ~PhysicsShape() {
42 
43  };
44  public:
45  virtual enum ege::PhysicsShape::type getType() const {
46  return ege::PhysicsShape::unknow;
47  };
48 
49  public:
50  virtual bool parse(const char* _line);
51  virtual void display() {
52 
53  };
54  private:
55  vec4 m_quaternion;
56  public:
57  const vec4& getQuaternion() const {
58  return m_quaternion;
59  };
60  private:
61  vec3 m_origin;
62  public:
63  const vec3& getOrigin() const {
64  return m_origin;
65  };
66  public:
67  bool isBox() {
68  return getType() == ege::PhysicsShape::box;
69  };
70  bool isCylinder() {
71  return getType() == ege::PhysicsShape::cylinder;
72  };
73  bool isCapsule() {
74  return getType() == ege::PhysicsShape::capsule;
75  };
76  bool isCone() {
77  return getType() == ege::PhysicsShape::cone;
78  };
79  bool isConvexHull() {
80  return getType() == ege::PhysicsShape::convexHull;
81  };
82  bool isSphere() {
83  return getType() == ege::PhysicsShape::sphere;
84  };
85 
86  virtual const ege::PhysicsBox* toBox() const {
87  return nullptr;
88  };
89  virtual ege::PhysicsBox* toBox() {
90  return nullptr;
91  };
92 
93  virtual const ege::PhysicsCylinder* toCylinder() const {
94  return nullptr;
95  };
96  virtual ege::PhysicsCylinder* toCylinder() {
97  return nullptr;
98  };
99 
100  virtual const ege::PhysicsCapsule* toCapsule() const {
101  return nullptr;
102  };
103  virtual ege::PhysicsCapsule* toCapsule() {
104  return nullptr;
105  };
106 
107  virtual const ege::PhysicsCone* toCone() const {
108  return nullptr;
109  };
110  virtual ege::PhysicsCone* toCone() {
111  return nullptr;
112  };
113 
114  virtual const ege::PhysicsConvexHull* toConvexHull() const {
115  return nullptr;
116  };
117  virtual ege::PhysicsConvexHull* toConvexHull() {
118  return nullptr;
119  };
120 
121  virtual const ege::PhysicsSphere* toSphere() const {
122  return nullptr;
123  };
124  virtual ege::PhysicsSphere* toSphere() {
125  return nullptr;
126  };
127  };
128 }
129 
Definition: PhysicsConvexHull.hpp:12
Definition: AudioElement.hpp:8
Definition: PhysicsCylinder.hpp:14
Definition: PhysicsCapsule.hpp:14
Definition: PhysicsSphere.hpp:14
Definition: PhysicsBox.hpp:13
Definition: PhysicsCone.hpp:12
Definition: PhysicsShape.hpp:22