]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.hxx
Boris Koenig:
[flightgear.git] / src / Scenery / tileentry.hxx
index 18e3b429e30e2a6a0b59f03a81719c4a405dd4b6..de188cd90ee51bdfa3170423658c0995c938d996 100644 (file)
@@ -38,8 +38,6 @@
 #include <vector>
 #include STL_STRING
 
-#include <plib/ssg.h>          // plib includes
-
 #include <simgear/bucket/newbucket.hxx>
 #include <simgear/math/point3d.hxx>
 #include <simgear/misc/sg_path.hxx>
@@ -56,6 +54,13 @@ typedef vector < Point3D > point_list;
 typedef point_list::iterator point_list_iterator;
 typedef point_list::const_iterator const_point_list_iterator;
 
+
+class ssgLeaf;
+class ssgBranch;
+class ssgTransform;
+class ssgSelector;
+class ssgRangeSelector;
+class ssgVertexArray;
 class FGTileEntry;
 
 
@@ -70,21 +75,25 @@ private:
     string texture_path;
     FGTileEntry *tile;
     ssgTransform *obj_trans;
+    SGBucket bucket;
+
 
 public:
 
     inline FGDeferredModel() { }
-    inline FGDeferredModel( const string mp, const string tp,
+    inline FGDeferredModel( const string mp, const string tp, SGBucket b,
                     FGTileEntry *t, ssgTransform *ot )
     {
        model_path = mp;
        texture_path = tp;
+        bucket = b;
        tile = t;
        obj_trans = ot;
     }
     inline ~FGDeferredModel() { }
     inline string get_model_path() const { return model_path; }
     inline string get_texture_path() const { return texture_path; }
+    inline SGBucket get_bucket() const { return bucket; }
     inline FGTileEntry *get_tile() const { return tile; }
     inline ssgTransform *get_obj_trans() const { return obj_trans; }
 };
@@ -120,6 +129,7 @@ private:
 
     // pointer to ssg transform for this tile
     ssgTransform *terra_transform;
+    ssgTransform *vasi_lights_transform;
     ssgTransform *rwy_lights_transform;
     ssgTransform *taxi_lights_transform;
     ssgTransform *gnd_lights_transform;
@@ -132,6 +142,14 @@ private:
     // want based on lighting conditions.
     ssgSelector *gnd_lights_brightness;
 
+    // we need to be able to turn runway lights on or off (doing this
+    // via a call back would be nifty, but then the call back needs to
+    // know about the higher level application's global state which is
+    // a problem if we move the code into simgear.)
+    ssgSelector *vasi_lights_selector;
+    ssgSelector *rwy_lights_selector;
+    ssgSelector *taxi_lights_selector;
+
     /**
      * Indicates this tile has been loaded from a file and connected
      * into the scene graph.  Note that this may be set asynchronously
@@ -146,27 +164,41 @@ private:
      */
     volatile int pending_models;
 
-    bool obj_load( const std::string& path,
-                        ssgBranch* geometry,
-                        ssgBranch* rwy_lights,
-                        ssgBranch* taxi_lights,
-                        ssgVertexArray* gound_lights,
-                        bool is_base );
+    bool obj_load( const string& path,
+                   ssgBranch* geometry,
+                   ssgBranch* vasi_lights,
+                   ssgBranch* rwy_lights,
+                   ssgBranch* taxi_lights,
+                   ssgVertexArray* gound_lights,
+                   bool is_base );
 
-    ssgLeaf* gen_lights( ssgVertexArray *lights, int inc, float bright );
+    ssgLeaf* gen_lights( SGMaterialLib *matlib, ssgVertexArray *lights,
+                         int inc, float bright );
 
     double timestamp;
 
+    /**
+     * this value is used by the tile scheduler/loader to mark which
+     * tiles are in the primary ring (i.e. the current tile or the
+     * surrounding eight.)  Other routines then can use this as an
+     * optimization and not do some operation to tiles outside of this
+     * inner ring.  (For instance vasi color updating)
+     */
+    bool is_inner_ring;
 
-    // this variable tracks the status of the incremental memory freeing.
+    /**
+     * this variable tracks the status of the incremental memory
+     * freeing.
+     */
     enum {
         NODES = 0x01,
         VEC_PTRS = 0x02,
         TERRA_NODE = 0x04,
         GROUND_LIGHTS = 0x08,
-        RWY_LIGHTS = 0x10,
-        TAXI_LIGHTS = 0x20,
-        LIGHTMAPS = 0x40
+        VASI_LIGHTS = 0x10,
+        RWY_LIGHTS = 0x20,
+        TAXI_LIGHTS = 0x40,
+        LIGHTMAPS = 0x80
     };
     int free_tracker;
 
@@ -204,7 +236,7 @@ public:
      * @param base name of directory containing tile data file.
      * @param is_base is this a base terrain object for which we should generate
      *        random ground light points */
-    void load( const SGPath& base, bool is_base );
+    void load( const string_list &base_path, bool is_base );
 
     /**
      * Return true if the tile entry is loaded, otherwise return false
@@ -227,13 +259,19 @@ public:
      */
     inline SGBucket get_tile_bucket() const { return tile_bucket; }
 
+    /**
+     * Apply ssgLeaf::makeDList to all leaf of a branch
+     */
+    void makeDList( ssgBranch *b );
+
     /**
      * Add terrain mesh and ground lighting to scene graph.
      */
-    void add_ssg_nodes( ssgBranch* terrain_branch,
-                       ssgBranch* gnd_lights_branch,
-                       ssgBranch* rwy_lights_branch,
-                       ssgBranch* taxi_lights_branch );
+    void add_ssg_nodes( ssgBranch *terrain_branch,
+                       ssgBranch *gnd_lights_branch,
+                        ssgBranch *vasi_lights_branch,
+                       ssgBranch *rwy_lights_branch,
+                       ssgBranch *taxi_lights_branch );
 
     /**
      * disconnect terrain mesh and ground lighting nodes from scene
@@ -247,10 +285,11 @@ public:
      */
     inline ssgTransform *get_terra_transform() { return terra_transform; }
 
-    void set_timestamp(double time_ms) { timestamp = time_ms; }
-
     inline double get_timestamp() const { return timestamp; }
+    inline void set_timestamp( double time_ms ) { timestamp = time_ms; }
 
+    inline bool get_inner_ring() const { return is_inner_ring; }
+    inline void set_inner_ring( bool val ) { is_inner_ring = val; }
 };