]> git.tdb.fi Git - r2c2.git/blobdiff - source/3d/layout.h
Improve graphics quality with some shaders and effects
[r2c2.git] / source / 3d / layout.h
index c2faa46344f1869f45be94c7f4ecbda65a4824de..c5169bd6f07ae4c201ff45e25c68a4b9121b0de3 100644 (file)
@@ -1,40 +1,70 @@
-/* $Id$
+#ifndef R2C2_3D_LAYOUT_H_
+#define R2C2_3D_LAYOUT_H_
 
-This file is part of the MSP Märklin suite
-Copyright © 2006-2008 Mikkosoft Productions, Mikko Rasa
-Distributed under the GPL
-*/
+#include <sigc++/trackable.h>
+#include <msp/gl/instancescene.h>
+#include <msp/gl/light.h>
+#include <msp/gl/lighting.h>
+#include <msp/gl/simplescene.h>
+#include "libr2c2/layout.h"
+#include "catalogue.h"
+#include "typemap.h"
 
-#ifndef MARKLIN3D_LAYOUT_H_
-#define MARKLIN3D_LAYOUT_H_
+namespace R2C2 {
 
-#include "libmarklin/layout.h"
-#include "track.h"
+class Object3D;
+class Utility3D;
 
-namespace Marklin {
-
-class Layout3D
+class Layout3D: public sigc::trackable
 {
+public:
+       typedef std::map<Object *, Object3D *> ObjectMap;
+
 private:
-       Layout     &layout;
-       std::list<Track3D *> tracks;
-       unsigned   quality;
+       Layout &layout;
+       Catalogue3D catalogue;
+       ObjectMap objects;
+       std::set<Utility3D *> 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();
 
-       void set_quality(unsigned);
-       const std::list<Track3D *> &get_tracks() const { return tracks; }
-       void  render(bool =false) const;
-       Track3D &get_track(const Track &) const;
-       Track3D *pick_track(float, float, float) const;
+       Layout &get_layout() const { return layout; }
+       Catalogue3D &get_catalogue() { return catalogue; }
+       const Catalogue3D &get_catalogue() const { return catalogue; }
+
+       void add(Object3D &);
+       Object3D &get_3d(Object &) const;
+       const ObjectMap &get_all() const { return objects; }
+       void remove(Object3D &);
+
+       template<typename T>
+       typename TypeMap3D<T>::Type3D &get_3d(T &o) const
+       { return dynamic_cast<typename TypeMap3D<T>::Type3D &>(get_3d(static_cast<Object &>(o))); }
+
+       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 object_added(Object &);
+       void object_removed(Object &);
 };
 
-} // namespace Marklin
+} // namespace R2C2
 
 #endif