X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Ftracktype.cpp;h=1e20c5d8aa82f966a904970f972d79e92b0feb5b;hb=1ff06c5bc46a677fa389ef86c6b26664368f1653;hp=12a1bb92a15df585e426e381cc30ab5331877b3f;hpb=90790c9a28793d31b9ea38eea2f55652a0e9297b;p=r2c2.git diff --git a/source/3d/tracktype.cpp b/source/3d/tracktype.cpp index 12a1bb9..1e20c5d 100644 --- a/source/3d/tracktype.cpp +++ b/source/3d/tracktype.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 */ @@ -16,7 +16,7 @@ using namespace Msp; namespace { -bool compare_z(const Marklin::Point &p1, const Marklin::Point &p2) +bool compare_z(const R2C2::Point &p1, const R2C2::Point &p2) { return p1.zxx==lowest.x && i->y>lowest.y)) lowest = *i; @@ -69,7 +69,7 @@ Iter graham_scan(Iter begin, Iter end) } -namespace Marklin { +namespace R2C2 { TrackType3D::TrackType3D(const Catalogue3D &cat3d, const TrackType &tt): catalogue(cat3d), @@ -135,6 +135,12 @@ TrackType3D::TrackType3D(const Catalogue3D &cat3d, const TrackType &tt): border.erase(graham_scan(border.begin(), border.end()), border.end()); } +TrackType3D::~TrackType3D() +{ + for(vector::iterator i=path_meshes.begin(); i!=path_meshes.end(); ++i) + delete *i; +} + void TrackType3D::get_bounds(float angle, Point &minp, Point &maxp) const { float c = cos(-angle); @@ -177,7 +183,7 @@ void TrackType3D::render(const GL::Tag &tag) const void TrackType3D::build_part(const TrackPart &part, const Profile &profile, const Point &offset, GL::MeshBuilder &bld, unsigned &base_index) { float plen = part.get_length(); - unsigned nsegs = (part.is_curved() ? static_cast(plen*16)+1 : 1); + unsigned nsegs = (part.is_curved() ? static_cast(plen*32)+1 : 1); unsigned n_points = profile.get_n_points(); for(unsigned i=0; i<=nsegs; ++i) @@ -224,4 +230,4 @@ void TrackType3D::build_part(const TrackPart &part, const Profile &profile, cons base_index += (nsegs+1)*(n_points-1)*2; } -} // namespace Marklin +} // namespace R2C2