]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/newcache.hxx
Make use of the ground material types
[flightgear.git] / src / Scenery / newcache.hxx
index 91b43c6baa0d47e185c035b227ab56f7df196362..50bdb8225acf96c4320886dc219aaf53f5589d17 100644 (file)
@@ -2,7 +2,7 @@
 //
 // Written by Curtis Olson, started December 2000.
 //
-// Copyright (C) 2000  Curtis L. Olson  - curt@flightgear.org
+// Copyright (C) 2000  Curtis L. Olson  - http://www.flightgear.org/~curt
 //
 // This program is free software; you can redistribute it and/or
 // modify it under the terms of the GNU General Public License as
@@ -16,7 +16,7 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 //
 // $Id$
 
 #  include <config.h>
 #endif
 
-#ifdef HAVE_WINDOWS_H
-#  include <windows.h>
-#endif
-
-#include <GL/glut.h>
-
 #include <map>
 
 #include <simgear/bucket/newbucket.hxx>
@@ -82,19 +76,31 @@ public:
     // Check if the specified "bucket" exists in the cache
     bool exists( const SGBucket& b ) const;
 
+#if 0
     // Ensure at least one entry is free in the cache
-    void make_space();
+    bool make_space();
+#endif
+
+    // Return the index of the oldest tile in the cache, return -1 if
+    // nothing available to be removed.
+    long get_oldest_tile();
+
+    // Clear the inner ring flag for all tiles in the cache so that
+    // the external tile scheduler can flag the inner ring correctly.
+    void clear_inner_ring_flags();
+
+    // Clear a cache entry, note that the cache only holds pointers
+    // and this does not free the object which is pointed to.
+    void clear_entry( long cache_entry );
 
     // Clear all completely loaded tiles (ignores partially loaded tiles)
     void clear_cache();
 
-    // Fill in a tile cache entry with real data for the specified bucket 
-    // void fill_in( const SGBucket& b );
-
     // Return a pointer to the specified tile cache entry 
-    inline FGTileEntry *get_tile( const long tile_index ) {
-       tile_map_iterator it = tile_cache.find( tile_index );
+    inline FGTileEntry *get_tile( const long tile_index ) const {
+       const_tile_map_iterator it = tile_cache.find( tile_index );
        if ( it != tile_cache.end() ) {
+           it->second->set_timestamp(globals->get_sim_time_sec());
            return it->second;
        } else {
            return NULL;
@@ -102,7 +108,7 @@ public:
     }
 
     // Return a pointer to the specified tile cache entry 
-    inline FGTileEntry *get_tile( const SGBucket& b ) {
+    inline FGTileEntry *get_tile( const SGBucket& b ) const {
        return get_tile( b.gen_index() );
     }
 
@@ -112,7 +118,7 @@ public:
     // External linear traversal of cache
     inline void reset_traversal() { current = tile_cache.begin(); }
     inline bool at_end() { return current == tile_cache.end(); }
-    inline FGTileEntry *get_current() {
+    inline FGTileEntry *get_current() const {
        // cout << "index = " << current->first << endl;
        return current->second;
     }
@@ -124,8 +130,9 @@ public:
     /**
      * Create a new tile and enqueue it for loading.
      * @param b 
+     * @return success/failure
      */
-    void insert_tile( FGTileEntry* e );
+    bool insert_tile( FGTileEntry* e );
 };