]> git.lizzy.rs Git - dragonblocks3d.git/blob - src/local_entity.cpp
Set antialiasing to 8
[dragonblocks3d.git] / src / local_entity.cpp
1 #include "animations.hpp"
2 #include "box_vertices.hpp"
3 #include "local_entity.hpp" 
4 #include "mesh.hpp"
5
6 using namespace glm;
7 using namespace dragonblocks;
8
9 void LocalEntity::setPos(vec3 p)
10 {
11         mesh->pos = p;
12 }
13
14 vec3 LocalEntity::getPos()
15 {
16         return mesh->pos;
17 }
18
19 void LocalEntity::setSize(vec3 s)
20 {
21         mesh->minp = -(s / 2.0f);
22         mesh->maxp = +(s / 2.0f);
23         mesh->size = s;
24 }
25
26 vec3 LocalEntity::getSize()
27 {
28         return mesh->size;
29 }
30
31 void LocalEntity::setRotationAxis(vec3 r)
32 {
33         mesh->rotation_axis = r;
34 }
35
36 vec3 LocalEntity::getRotationAxis()
37 {
38         return mesh->rotation_axis;
39 }
40
41 void LocalEntity::setRotationAngle(double r)
42 {
43         mesh->rotation_angle = r;
44 }
45
46 double LocalEntity::getRotationAngle()
47 {
48         return mesh->rotation_angle;
49 }
50
51 void LocalEntity::setVisible(bool v)
52 {
53         mesh->visible = v;
54 }
55
56 bool LocalEntity::isVisible()
57 {
58         return mesh->visible;
59 }
60
61 LocalEntity::LocalEntity(Map *m, Scene *s, const TileDef &t, ShaderProgram *sh) : IEntity(m), tile_def(t)
62 {
63         mesh = new Mesh(s, sh, &box_vertices[0][0][0], 6 * 6 * 5);
64         mesh->textures = tile_def.tiles;
65         mesh->vertices_per_texture = 6;
66 }
67
68 LocalEntity::~LocalEntity()
69 {
70         mesh->die();
71 }