My Project
Loading...
Searching...
No Matches
entity.hh
Go to the documentation of this file.
1#pragma once
2
3#include <cstdlib>
4#include <glm/glm.hpp>
5#include <iostream>
6#include "materials.hh"
7#include "mesh.hh"
8#include "models.hh"
9
10class Entity
11{
12private:
15
16 glm::vec3 _position;
17 glm::mat4 _word_position;
18
19 glm::vec3 _scale;
21 glm::vec3 _rotation_dir;
22
23public:
24 Entity(Mesh *mesh, Material *material, float position = 0.0f, float scale = 1.0f, float angle_degrees = 0.0f);
25 Entity(Model &model, float position = 0.0f, float scale = 1.0f, float angle_degrees = 0.0f);
26
27 void position(float x, float y, float z);
28 void inc_position(float x, float y, float z);
29
30 void angle(float angle);
31 void inc_angle(float angle);
32
33 void set_rotation_dir(float x, float y, float z);
34
35 void scale(float scale);
36 void scale(float scale_x, float scale_y, float scale_z);
37 void inc_scale(float scale);
38
39 glm::mat4 &get_model_position();
40
41 Mesh* get_mesh() const {return _mesh;};
43 if (_material == nullptr) {
44 std::cout << "[ERROR] Entity has no material" << std::endl;
45 }
46 return _material;
47 };
48};
Definition entity.hh:11
Mesh * _mesh
Definition entity.hh:13
void set_rotation_dir(float x, float y, float z)
Definition entity.cpp:68
void position(float x, float y, float z)
Definition entity.cpp:24
glm::vec3 _rotation_dir
Definition entity.hh:21
glm::vec3 _position
Definition entity.hh:16
glm::vec3 _scale
Definition entity.hh:19
void inc_scale(float scale)
Definition entity.cpp:32
void inc_angle(float angle)
Definition entity.cpp:56
float _angle_degrees
Definition entity.hh:20
void inc_position(float x, float y, float z)
Definition entity.cpp:16
glm::mat4 _word_position
Definition entity.hh:17
Material * _material
Definition entity.hh:14
Material * get_material() const
Definition entity.hh:42
void scale(float scale)
Definition entity.cpp:40
void angle(float angle)
Definition entity.cpp:75
Mesh * get_mesh() const
Definition entity.hh:41
glm::mat4 & get_model_position()
Definition entity.cpp:82
Definition materials.hh:7
Definition mesh.hh:5
Definition models.hh:8