Engine
physics_entity.h
1 #include <mesh.h>
2 #include <Eigen/Core>
3 #include <vector3G.h>
4 #include <atomic>
5 #include <quaternion.h>
6 
7 #ifndef PHYSICS_ENTITY
8 #define PHYSICS_ENTITY
9 
15  public:
19  GLint GetId() const;
20 
24  Vector3Gf GetPosition();
25 
30  void SetPosition(Vector3Gf x);
31 
36  void SetNextPosition(Vector3Gf x);
37 
41  Vector3Gf GetNextPosition();
42 
46  Vector3Gf GetVelocity();
47 
52  void SetVelocity(Vector3Gf v);
53 
58  void SetNextVelocity(Vector3Gf v);
59 
63  Vector3Gf GetNextVelocity();
64 
68  GLfloat GetMass();
69 
74 
79  void SetOrientation(Quaternion q);
80 
85 
92 
96  Vector3Gf GetAngularVelocity();
97 
102  void SetAngularVelocity(Vector3Gf w);
103 
107  Vector3Gf GetNextAngularVelocity();
108 
114  void SetNextAngularVelocity(Vector3Gf w);
115 
119  void UpdateFromBuffers();
120 
121  protected:
125  GLuint m_id;
129  Vector3Gf m_position;
133  Vector3Gf m_next_position;
137  Vector3Gf m_velocity;
141  Vector3Gf m_next_velocity;
145  GLfloat m_mass;
146 
151 
156 
161 
166 
170  PhysicsEntity();
171 
180  PhysicsEntity(Vector3Gf position, Vector3Gf velocity, GLfloat mass, Quaternion orientation, Vector3Gf angular_velocity);
181 
185  virtual ~PhysicsEntity(){};
186 
187  private :
188  static std::atomic<GLint> next_id;
189 
193  virtual void OnUpdateFromBuffers() {};
194 
195 };
196 #endif
Quaternion m_orientation
Definition: physics_entity.h:150
GLint GetId() const
Definition: physics_entity.cpp:51
Vector3Gf GetNextAngularVelocity()
Definition: physics_entity.cpp:131
void SetNextAngularVelocity(Vector3Gf w)
Definition: physics_entity.cpp:136
Vector3Gf m_position
Definition: physics_entity.h:129
Vector3Gf GetNextPosition()
Definition: physics_entity.cpp:71
virtual ~PhysicsEntity()
Definition: physics_entity.h:185
void UpdateFromBuffers()
Definition: physics_entity.cpp:141
void SetOrientation(Quaternion q)
Definition: physics_entity.cpp:106
An entity subject to the laws of physics.
Definition: physics_entity.h:14
Vector3Gf m_next_angular_velocity
Definition: physics_entity.h:160
GLuint m_id
Definition: physics_entity.h:125
Vector3Gf m_velocity
Definition: physics_entity.h:137
Quaternion GetOrientation()
Definition: physics_entity.cpp:101
data structure reprenseting a Quaternion.
Definition: quaternion.h:9
Vector3Gf m_angular_velocity
Definition: physics_entity.h:165
Vector3Gf m_next_position
Definition: physics_entity.h:133
void SetVelocity(Vector3Gf v)
Definition: physics_entity.cpp:81
GLfloat m_mass
Definition: physics_entity.h:145
Vector3Gf m_next_velocity
Definition: physics_entity.h:141
void SetPosition(Vector3Gf x)
Definition: physics_entity.cpp:61
void SetNextOrientation(Quaternion q)
Definition: physics_entity.cpp:116
void SetAngularVelocity(Vector3Gf w)
Definition: physics_entity.cpp:126
Vector3Gf GetVelocity()
Definition: physics_entity.cpp:76
Quaternion GetNextOrientation()
Definition: physics_entity.cpp:111
void SetNextPosition(Vector3Gf x)
Definition: physics_entity.cpp:66
Vector3Gf GetNextVelocity()
Definition: physics_entity.cpp:91
Vector3Gf GetAngularVelocity()
Definition: physics_entity.cpp:121
void SetNextVelocity(Vector3Gf v)
Definition: physics_entity.cpp:86
GLfloat GetMass()
Definition: physics_entity.cpp:96
Vector3Gf GetPosition()
Definition: physics_entity.cpp:56
Quaternion m_next_orientation
Definition: physics_entity.h:155
PhysicsEntity()
Definition: physics_entity.cpp:5