summaryrefslogtreecommitdiff
path: root/gfx/gl/bufferedLocation.cpp
blob: eb3dac35a1e7c412ca628d85dc986e8916311ef8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include "bufferedLocation.h"
#include "location.h"
#include "maths.h"
#include <glm/gtx/transform.hpp>

BufferedLocation::BufferedLocation(glm::vec3 p, glm::vec3 r) : BufferedLocation {Location {p, r}} { }

BufferedLocation::BufferedLocation(const Location & l) : loc {l} { }

BufferedLocation::operator const Location &() const
{
	return loc;
}

BufferedLocation &
BufferedLocation::operator=(const Location & l)
{
	loc = l;
	updateBuffer();
	return *this;
}

glm::vec3
BufferedLocation::position() const
{
	return loc.pos;
}

glm::vec3
BufferedLocation::rotation() const
{
	return loc.rot;
}

void
BufferedLocation::setPosition(glm::vec3 p, bool update)
{
	loc.pos = p;
	if (update) {
		updateBuffer();
	}
}

void
BufferedLocation::setRotation(glm::vec3 r, bool update)
{
	loc.rot = r;
	if (update) {
		updateBuffer();
	}
}

void
BufferedLocation::setLocation(glm::vec3 p, glm::vec3 r)
{
	loc.pos = p;
	loc.rot = r;
	updateBuffer();
}

glm::mat4
BufferedLocation::getTransform() const
{
	return loc.getTransform();
}