|
AGL
0
3D graphics library
|
The Entity; basically all visible objects in AGL. More...


Public Member Functions | |
| Entity (const glm::vec3 &pos=glm::vec3(0)) | |
| Create an entity centered at pos. More... | |
| Entity (const Entity &other) | |
| Create an entity from data copied from other. More... | |
| ~Entity () | |
| void | translate (const glm::vec3 &d=glm::vec3(0)) |
| Translate (move,shift) the entity. More... | |
| void | translate (float dx=0, float dy=0, float dz=0) |
| Translate (move, shift) the entity. More... | |
| void | rotate (float rad=0, glm::vec3 axis=glm::vec3(0)) |
| Rotate the entity. More... | |
| void | scale (const glm::vec3 &s=glm::vec3(1)) |
| Scale the entity. More... | |
| void | scale (float sx=1, float sy=std::nanf(""), float sz=std::nanf("")) |
| Scale the entity. More... | |
| void | transform (const glm::mat4 &m) |
| Transform the entity. More... | |
| void | applyTransform () |
| Transform the vertices permanently. More... | |
| void | add (BaseEntity &e) |
| Add an Entity or Light as a child of the entity. More... | |
| virtual void | mergeData () |
| Merge the vertices, normals and uvs into a single merged array. More... | |
| virtual void | createBuffers () |
| Create all the buffers for rendering. More... | |
| glm::mat4 | getMatM () |
| Get the model matrix. More... | |
Public Member Functions inherited from BaseEntity | |
| virtual | ~BaseEntity () |
Public Attributes | |
| GLuint | VAO = 0 |
| Vertex array. More... | |
| GLuint | VBO = 0 |
| Vertex buffer. More... | |
| GLuint | EBO = 0 |
| Index buffer. More... | |
| bool | dynamic = false |
| If true, the material is dynamic, ie. vertices might change during runtime. More... | |
| std::vector< GLfloat > | vertices |
| Vertices. More... | |
| std::vector< GLfloat > | normals |
| Normals. More... | |
| std::vector< GLfloat > | uvs |
| Texture coordinates. More... | |
| std::vector< GLfloat > | merged |
| The final combination of vertices, normals, and uvs. More... | |
| std::vector< GLuint > | indices |
| Indices. More... | |
| glm::vec3 | position |
| Position of the entity, the entity is centered here. More... | |
| glm::mat4 | model |
| The model matrix for the entity. This is the M part of the MVP matrix. This is responsible for all the transformations of this entity. More... | |
| Material | material |
| Material for shading this entity. More... | |
| std::vector< BaseEntity * > | children |
| Children of this entity. More... | |
Public Attributes inherited from BaseEntity | |
| Entity * | parent = nullptr |
| Parent of the entity, whose child this is. All transformations of the parent is also applied to the child. More... | |
The Entity; basically all visible objects in AGL.
Entity consists of anything that is visible on the scene. The entities consists of
| Entity | ( | const glm::vec3 & | pos = glm::vec3(0) | ) |
Create an entity centered at pos.
| pos | Position of the entity. |
Create an entity from data copied from other.
| other | Another entity for the copy constructor. |
| ~Entity | ( | ) |
| void add | ( | BaseEntity & | e | ) |
| void applyTransform | ( | ) |
Transform the vertices permanently.
After this operation, all the transformations will be applied to all the vertices and normals. The model matrix will reset to an identity matrix.
|
virtual |
Create all the buffers for rendering.
Reimplemented in SharedEntity.
| glm::mat4 getMatM | ( | ) |
Get the model matrix.
|
virtual |
Merge the vertices, normals and uvs into a single merged array.
Reimplemented in SharedEntity.
| void rotate | ( | float | rad = 0, |
| glm::vec3 | axis = glm::vec3(0) |
||
| ) |
Rotate the entity.
| rad | Angle to rotate by, in radians. |
| axis | Axis of rotation. |
| void scale | ( | const glm::vec3 & | s = glm::vec3(1) | ) |
Scale the entity.
| s | Vector to scale by. |
| void scale | ( | float | sx = 1, |
| float | sy = std::nanf(""), |
||
| float | sz = std::nanf("") |
||
| ) |
Scale the entity.
| sx | Amount to scale along the x-axis. |
| sy | Amount to scale along the y-axis. |
| sz | Amount to scale along the z-axis. |
If sy and sz is unspecified, they default to sx. If only sz is unspecified, it defaults to 1.
| void transform | ( | const glm::mat4 & | m | ) |
Transform the entity.
| m | Matrix to transform by. |
| void translate | ( | const glm::vec3 & | d = glm::vec3(0) | ) |
Translate (move,shift) the entity.
| d | Vector to translate by. |
| void translate | ( | float | dx = 0, |
| float | dy = 0, |
||
| float | dz = 0 |
||
| ) |
Translate (move, shift) the entity.
| dx | Amount to translate along the x-axis. |
| dy | Amount to translate along the y-axis. |
| dz | Amount to translate along the z-axis. |
| std::vector<BaseEntity*> children |
Children of this entity.
| bool dynamic = false |
If true, the material is dynamic, ie. vertices might change during runtime.
| GLuint EBO = 0 |
Index buffer.
| std::vector<GLuint> indices |
Indices.
| std::vector<GLfloat> merged |
The final combination of vertices, normals, and uvs.
| glm::mat4 model |
The model matrix for the entity. This is the M part of the MVP matrix. This is responsible for all the transformations of this entity.
| std::vector<GLfloat> normals |
Normals.
| glm::vec3 position |
Position of the entity, the entity is centered here.
| std::vector<GLfloat> uvs |
Texture coordinates.
| GLuint VAO = 0 |
Vertex array.
| GLuint VBO = 0 |
Vertex buffer.
| std::vector<GLfloat> vertices |
Vertices.