X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fdesigner%2Ftrackwrap.cpp;h=47225e3904af04c39f6ae2afcd49efce68083b4a;hb=495c54e187ddbb7514c983e1829a69d82ccad5f3;hp=febeadee4412c0b64db6cdee9078aef4fbe9c9bb;hpb=897f9bae5f647bae43e9786796eb9ea18325ec17;p=r2c2.git diff --git a/source/designer/trackwrap.cpp b/source/designer/trackwrap.cpp index febeade..47225e3 100644 --- a/source/designer/trackwrap.cpp +++ b/source/designer/trackwrap.cpp @@ -1,6 +1,6 @@ /* $Id$ -This file is part of the MSP Märklin suite +This file is part of R²C² Copyright © 2010 Mikkosoft Productions, Mikko Rasa Distributed under the GPL */ @@ -8,27 +8,32 @@ Distributed under the GPL #include #include #include "3d/tracktype.h" -#include "designer.h" #include "selection.h" #include "trackwrap.h" using namespace std; using namespace Msp; -using namespace Marklin; +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)); } +TrackWrap::~TrackWrap() +{ + for(map::iterator i=meshes.begin(); i!=meshes.end(); ++i) + delete i->second; +} + void TrackWrap::render(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(); + 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(); @@ -54,16 +59,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; - Point center; - float width; - float height; + float angle = 0; + Vector center; + float width = 0; + float height = 0; for(float a=0; a