Blackcomb  prealpha
Engine-ish
BaseEntity.h
1 #ifndef BLACKCOMB_ENTITY_H
2 #define BLACKCOMB_ENTITY_H
3 
4 
5 #include <glm/glm.hpp>
6 
7 namespace blackcomb::entity {
12  class BaseEntity {
13  public:
14  BaseEntity();
15  void setPos(glm::vec3 position);
16  void setPos(float x, float y, float z);
17  glm::vec3 getPos();
18  void setX(float x);
19  void setY(float y);
20  void setZ(float z);
21  void setRotation(glm::vec3 rotation);
22  void setRotation(float x, float y, float z);
23  void setHpr(glm::vec3 hpr);
24  void setHpr(float h, float p, float r);
25  void setH(float h);
26  void setP(float p);
27  void setR(float r);
28  void setScale(glm::vec3 scale);
29  void setScale(float sx, float sy, float sz);
30  void setScale(float scale);
31  void setSx(float sx);
32  void setSy(float sy);
33  void setSz(float sz);
34  virtual void update();
35  protected:
36  void updateTransMat();
37  glm::vec3 pos = glm::vec3(0.0f, 0.0f, 0.0f);
38  glm::vec3 rotation = glm::vec3(0.0f, 0.0f, 0.0f);
39  glm::vec3 scale = glm::vec3(1.0f, 1.0f, 1.0f);
40  glm::mat4 transform = glm::mat4(1.0f);
41  };
42 }
43 
44 #endif //BLACKCOMB_ENTITY_H
void setY(float y)
Set the Y position of the entity.
Definition: BaseEntity.cpp:36
void setZ(float z)
Set the Z position of the entity.
Definition: BaseEntity.cpp:43
glm::mat4 transform
The transformation matrix for the entity.
Definition: BaseEntity.h:40
void updateTransMat()
Updates the translation matrix for the entity.
Definition: BaseEntity.cpp:142
A generic entity class.
Definition: BaseEntity.h:12
void setSz(float sz)
Set the scaling of the entity in the Z direction.
Definition: BaseEntity.cpp:135
void setH(float h)
Sets the H/Y axis rotation of the entity.
Definition: BaseEntity.cpp:81
glm::vec3 pos
The position of the entity in 3D space.
Definition: BaseEntity.h:37
glm::vec3 rotation
The rotation of the entity on the XYZ axes, in degrees.
Definition: BaseEntity.h:38
glm::vec3 scale
The scale of the entity.
Definition: BaseEntity.h:39
void setR(float r)
Sets the R/Z axis rotation of the entity.
Definition: BaseEntity.cpp:95
void setRotation(glm::vec3 rotation)
Set the rotation of the entity.
Definition: BaseEntity.cpp:51
void setSy(float sy)
Set the scaling of the entity in the Y direction.
Definition: BaseEntity.cpp:128
void setX(float x)
Set the X position of the entity.
Definition: BaseEntity.cpp:29
virtual void update()
Function that allows code to be run every game tick.
Definition: BaseEntity.cpp:155
void setHpr(glm::vec3 hpr)
Set the rotation of the entity on the HPR axes (which map to YXZ).
Definition: BaseEntity.cpp:67
void setP(float p)
Sets the P/X axis rotation of the entity.
Definition: BaseEntity.cpp:88
void setPos(glm::vec3 position)
Set the position of the entity.
Definition: BaseEntity.cpp:13
void setSx(float sx)
Set the scaling of the entity in the X direction.
Definition: BaseEntity.cpp:121
void setScale(glm::vec3 scale)
Sets the scale of the entity.
Definition: BaseEntity.cpp:102
Definition: BaseEntity.h:7