]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.hxx
Updates for Mac compilers.
[flightgear.git] / src / Scenery / tileentry.hxx
index 37000bf7142f55111302e87a74ff8cb0c4333f6e..aaa9088a8c65509ada0f546b65138b056a2c5afe 100644 (file)
@@ -45,7 +45,7 @@
 #include <vector>
 #include STL_STRING
 
-#include <plib/sg.h>
+#include <ssg.h>               // plib includes
 
 #include <Bucket/newbucket.hxx>
 #include <Math/mat3.h>
@@ -73,8 +73,10 @@ private:
     // Tile state
     enum tile_state {
        Unused = 0,
-       Scheduled = 1,
-       Loaded = 2
+       Scheduled_for_use = 1,
+       Scheduled_for_cache = 2,
+       Loaded = 3,
+       Cached = 4
     };
 
 public:
@@ -99,11 +101,37 @@ public:
     // this tile's official location in the world
     FGBucket tile_bucket;
 
-    // the tile cache will mark here if the tile is being used
+    // the tile cache will keep track here if the tile is being used
     tile_state state;
 
     container fragment_list;
 
+    // ssg related structures
+    sgVec3 *vtlist;
+    sgVec3 *vnlist;
+    sgVec2 *tclist;
+
+    // ssg tree structure for this tile is as follows:
+    // ssgRoot(scene)
+    //     - ssgBranch(terrain)
+    //      - ssgSelector(tile)
+    //        - ssgTransform(tile)
+    //           - ssgRangeSelector(tile)
+    //              - ssgEntity(tile)
+    //                 - kid1(fan)
+    //                 - kid2(fan)
+    //                   ...
+    //                 - kidn(fan)
+
+    // selector (turn tile on/off)
+    ssgSelector *select_ptr;
+
+    // pointer to ssg transform for this tile
+    ssgTransform *transform_ptr;
+
+    // pointer to ssg range selector for this tile
+    ssgRangeSelector *range_ptr;
+
 public:
 
     // Constructor
@@ -128,8 +156,9 @@ public:
     }
 
     // Step through the fragment list, deleting the display list, then
-    // the fragment, until the list is empty.
-    void release_fragments();
+    // the fragment, until the list is empty.  Also delete the arrays
+    // used by ssg as well as the whole ssg branch
+    void free_tile();
 
     // Calculate this tile's offset
     void SetOffset( const Point3D& off)
@@ -166,11 +195,25 @@ public:
     }
 
     inline bool is_unused() const { return state == Unused; }
+    inline bool is_scheduled_for_use() const { 
+       return state == Scheduled_for_use;
+    }
+    inline bool is_scheduled_for_cache() const {
+       return state == Scheduled_for_cache;
+    }
     inline bool is_loaded() const { return state == Loaded; }
+    inline bool is_cached() const { return state == Cached; }
 
     inline void mark_unused() { state = Unused; }
-    inline void mark_scheduled() { state = Scheduled; }
+    inline void mark_scheduled_for_use() { state = Scheduled_for_use; }
+    inline void mark_scheduled_for_cache() { state = Scheduled_for_use; }
     inline void mark_loaded() { state = Loaded; }
+
+
+    // when a tile is still in the cache, but not in the immediate
+    // draw l ist, it can still remain in the scene graph, but we use
+    // a range selector to disable it from ever being drawn.
+    void ssg_disable();
 };