blob: d6a63b9fd7a14702eb6954391cdd4d1dfaf40d01 (
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
66
67
68
69
70
|
#include "bufferedLocation.h"
#include "location.h"
#include <glm/gtx/transform.hpp>
BufferedLocation::BufferedLocation(GlobalPosition3D p, Rotation3D 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;
}
GlobalPosition3D
BufferedLocation::position() const
{
return loc.pos;
}
Position3D
BufferedLocation::rotation() const
{
return loc.rot;
}
void
BufferedLocation::setPosition(GlobalPosition3D p, bool update)
{
loc.pos = p;
if (update) {
updateBuffer();
}
}
void
BufferedLocation::setRotation(Position3D r, bool update)
{
loc.rot = r;
if (update) {
updateBuffer();
}
}
void
BufferedLocation::setLocation(GlobalPosition3D p, Rotation3D r)
{
loc.pos = p;
loc.rot = r;
updateBuffer();
}
glm::mat4
BufferedLocation::getRotationTransform() const
{
return loc.getRotationTransform();
}
void
BufferedLocationUpdater::updateBuffer() const
{
onUpdate(this);
}
|