]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/object.cpp
Use event-based matrix updates for objects
[r2c2.git] / source / 3d / object.cpp
diff --git a/source/3d/object.cpp b/source/3d/object.cpp
new file mode 100644 (file)
index 0000000..fcbf213
--- /dev/null
@@ -0,0 +1,20 @@
+#include "object.h"
+
+using namespace Msp;
+
+namespace R2C2 {
+
+Object3D::Object3D(Object &o):
+       object(o)
+{
+       object.signal_moved.connect(sigc::mem_fun(this, &Object3D::moved));
+}
+
+void Object3D::moved()
+{
+       matrix = GL::Matrix::translation(object.get_position());
+       matrix.rotate(object.get_rotation(), 0, 0, 1);
+       matrix.rotate(object.get_tilt(), 0, -1, 0);
+}
+
+} // namespace R2C2