]> git.tdb.fi Git - r2c2.git/commitdiff
Use GL::Renderer in TrackWrap
authorMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 13:42:02 +0000 (15:42 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 17 Jan 2013 13:42:02 +0000 (15:42 +0200)
source/designer/trackwrap.cpp
source/designer/trackwrap.h

index 1f620f3ff6be452e5c1ac617ab2e0fe06b64039a..523c9678658c0b31acc94c66f42728eb6571c85d 100644 (file)
@@ -1,5 +1,6 @@
 #include <msp/gl/matrix.h>
 #include <msp/gl/meshbuilder.h>
+#include <msp/gl/renderer.h>
 #include "3d/tracktype.h"
 #include "selection.h"
 #include "trackwrap.h"
@@ -21,15 +22,15 @@ TrackWrap::~TrackWrap()
                delete i->second;
 }
 
-void TrackWrap::render(const GL::Tag &) const
+void TrackWrap::render(GL::Renderer &renderer, const GL::Tag &) const
 {
        for(list<Wrap>::const_iterator i=wraps.begin(); i!=wraps.end(); ++i)
        {
-               GL::PushMatrix _pushm;
+               GL::MatrixStack::Push push(renderer.matrix_stack());
                const Vector &pos = i->track->get_position();
-               GL::translate(pos.x, pos.y, pos.z);
-               GL::rotate(i->track->get_rotation()*180/M_PI, 0, 0, 1);
-               i->mesh->draw();
+               renderer.matrix_stack() *= GL::Matrix::translation(pos.x, pos.y, pos.z);
+               renderer.matrix_stack() *= GL::Matrix::rotation(i->track->get_rotation(), 0, 0, 1);
+               i->mesh->draw(renderer);
        }
 }
 
index 480e7bb0f12404fbfef1004e29a0824759dea84f..070794e48c0b6a7deab175950ab3cc14dc64a9a1 100644 (file)
@@ -27,7 +27,7 @@ public:
        TrackWrap(R2C2::Layout3D &, Selection &);
        ~TrackWrap();
 
-       virtual void render(const Msp::GL::Tag &) const;
+       virtual void render(Msp::GL::Renderer &, const Msp::GL::Tag &) const;
 
 private:
        void selection_changed();