X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=src%2FScenery%2Ftileentry.hxx;h=3ccd50f819e0d9fc3cf190faa5f8271cba3609be;hb=7a16ec4fb4e1663902f5022812291f01d7e37ee3;hp=719536110b167e19f8dd4334b991b9c39e5f23a2;hpb=858f17b323a3c553dfa70195449fae594bff3e53;p=flightgear.git diff --git a/src/Scenery/tileentry.hxx b/src/Scenery/tileentry.hxx index 719536110..3ccd50f81 100644 --- a/src/Scenery/tileentry.hxx +++ b/src/Scenery/tileentry.hxx @@ -38,21 +38,21 @@ #endif #include -#include +#include -#include +#include #include #include STL_STRING -#include // plib includes +#include // plib includes + +#include +#include -#include -#include -#include #include -#ifdef FG_HAVE_NATIVE_SGI_COMPILERS +#if defined( sgi ) #include #endif @@ -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: @@ -83,6 +85,10 @@ public: typedef container::iterator FragmentIterator; typedef container::const_iterator FragmentConstIterator; + typedef vector < sgVec3 * > free_vec3_list; + typedef vector < sgVec2 * > free_vec2_list; + typedef vector < unsigned short * > free_index_list; + public: // node list (the per fragment face lists reference this node list) point_list nodes; @@ -105,12 +111,36 @@ public: container fragment_list; // ssg related structures - sgVec3 *vtlist; - sgVec3 *vnlist; - sgVec2 *tclist; - - // pointer to ssg branch; - ssgTransform *branch_ptr; + // sgVec3 *vtlist; + // sgVec3 *vnlist; + // sgVec2 *tclist; + + // list of pointers to memory chunks that need to be freed when + // tile entry goes away + free_vec3_list vec3_ptrs; + free_vec2_list vec2_ptrs; + free_index_list index_ptrs; + + // 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: @@ -136,13 +166,14 @@ 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) + void SetOffset( const Point3D& p) { - offset = center - off; + offset = center - p; } // Return this tile's offset @@ -174,11 +205,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(); };