]> git.tdb.fi Git - r2c2.git/blob - source/3d/object.cpp
b901a7294f9f38c775621f69ecc7e0f469333ee6
[r2c2.git] / source / 3d / object.cpp
1 #include "layout.h"
2 #include "object.h"
3
4 using namespace Msp;
5
6 namespace R2C2 {
7
8 Object3D::Object3D(Layout3D &l, Object &o):
9         layout(l),
10         object(o)
11 {
12         object.signal_moved.connect(sigc::mem_fun(this, &Object3D::moved));
13
14         layout.add(*this);
15 }
16
17 Object3D::~Object3D()
18 {
19         layout.remove(*this);
20 }
21
22 void Object3D::moved()
23 {
24         matrix = GL::Matrix::translation(object.get_position());
25         matrix.rotate(object.get_rotation(), 0, 0, 1);
26         matrix.rotate(object.get_tilt(), 0, -1, 0);
27 }
28
29 } // namespace R2C2