X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2F3d%2Flayout.h;h=c5169bd6f07ae4c201ff45e25c68a4b9121b0de3;hb=6aa6e3a60c31d71e8f8117be1ddf547897d19bd8;hp=f09603de5b00dad0d9ad06178a7e1eef71d98aa0;hpb=f79b3fd58999a73a4a28663b46fdd96c58167a18;p=r2c2.git diff --git a/source/3d/layout.h b/source/3d/layout.h index f09603d..c5169bd 100644 --- a/source/3d/layout.h +++ b/source/3d/layout.h @@ -1,61 +1,70 @@ -/* $Id$ - -This file is part of the MSP Märklin suite -Copyright © 2006-2010 Mikkosoft Productions, Mikko Rasa -Distributed under the GPL -*/ - -#ifndef MARKLIN3D_LAYOUT_H_ -#define MARKLIN3D_LAYOUT_H_ +#ifndef R2C2_3D_LAYOUT_H_ +#define R2C2_3D_LAYOUT_H_ #include -#include -#include "libmarklin/layout.h" +#include +#include +#include +#include +#include "libr2c2/layout.h" #include "catalogue.h" +#include "typemap.h" -namespace Marklin { +namespace R2C2 { -class Track3D; -class Vehicle3D; +class Object3D; +class Utility3D; class Layout3D: public sigc::trackable { +public: + typedef std::map ObjectMap; + private: Layout &layout; Catalogue3D catalogue; - std::list tracks; - std::list vehicles; - Msp::GL::Scene scene; - Msp::GL::Scene ep_scene; - Msp::GL::Scene path_scene; + ObjectMap objects; + std::set utilities; + Msp::GL::InstanceScene scene; + Msp::GL::SimpleScene ep_scene; + Msp::GL::InstanceScene path_scene; + Msp::GL::Light sun; + Msp::GL::Lighting lighting; public: Layout3D(Layout &); ~Layout3D(); + Layout &get_layout() const { return layout; } + Catalogue3D &get_catalogue() { return catalogue; } const Catalogue3D &get_catalogue() const { return catalogue; } - void add_track(Track3D &); - void remove_track(Track3D &); - const std::list &get_tracks() const { return tracks; } - Track3D &get_track(Track &) const; - Track3D *pick_track(float, float, float) const; + void add(Object3D &); + Object3D &get_3d(Object &) const; + const ObjectMap &get_all() const { return objects; } + void remove(Object3D &); + + template + typename TypeMap3D::Type3D &get_3d(T &o) const + { return dynamic_cast::Type3D &>(get_3d(static_cast(o))); } - void add_vehicle(Vehicle3D &); - void remove_vehicle(Vehicle3D &); - Vehicle3D &get_vehicle(const Vehicle &) const; + void add(Utility3D &); + void remove(Utility3D &); Msp::GL::Scene &get_scene() { return scene; } Msp::GL::Scene &get_endpoint_scene() { return ep_scene; } Msp::GL::Scene &get_path_scene() { return path_scene; } + const Msp::GL::Light &get_sun() const { return sun; } + const Msp::GL::Lighting &get_lighting() const { return lighting; } + + void tick(); private: - void track_added(Track &); - void track_removed(Track &); - void vehicle_added(Vehicle &); + void object_added(Object &); + void object_removed(Object &); }; -} // namespace Marklin +} // namespace R2C2 #endif