X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Ftrackwrap.cpp;h=523c9678658c0b31acc94c66f42728eb6571c85d;hb=dec294d40194a640e7b4bccf20dd1baa4a87038c;hp=5e21ddc326b39e354c4a3ddf5e7c59e39aee3932;hpb=8883a5c80c3954fd4c2e96efb623a15d157ecb54;p=r2c2.git diff --git a/source/designer/trackwrap.cpp b/source/designer/trackwrap.cpp index 5e21ddc..523c967 100644 --- a/source/designer/trackwrap.cpp +++ b/source/designer/trackwrap.cpp @@ -1,14 +1,7 @@ -/* $Id$ - -This file is part of R²C² -Copyright © 2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - #include #include +#include #include "3d/tracktype.h" -#include "designer.h" #include "selection.h" #include "trackwrap.h" @@ -16,8 +9,8 @@ using namespace std; using namespace Msp; using namespace R2C2; -TrackWrap::TrackWrap(Designer &d, Selection &s): - designer(d), +TrackWrap::TrackWrap(Layout3D &l, Selection &s): + layout(l), selection(s) { selection.signal_changed.connect(sigc::mem_fun(this, &TrackWrap::selection_changed)); @@ -29,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::const_iterator i=wraps.begin(); i!=wraps.end(); ++i) { - GL::PushMatrix _pushm; - const Point &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(); + GL::MatrixStack::Push push(renderer.matrix_stack()); + const Vector &pos = i->track->get_position(); + 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); } } @@ -60,16 +53,16 @@ GL::Mesh &TrackWrap::get_mesh(const TrackType &type) if(j!=meshes.end()) return *j->second; - const TrackType3D &type3d = designer.get_layout_3d().get_catalogue().get_track(type); + const TrackType3D &type3d = layout.get_catalogue().get_track(type); float min_area = -1; float angle = 0; - Point center; + Vector center; float width = 0; float height = 0; for(float a=0; a