]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.cxx
Fix a small tile cache bug.
[flightgear.git] / src / Scenery / tileentry.cxx
index bd246f1e9ac990a477e07ec57400aa172ae094a0..b4847b367ed349aabbb04e261a5ce3a9915f8891 100644 (file)
@@ -64,24 +64,34 @@ FGTileEntry::~FGTileEntry ( void ) {
 void
 FGTileEntry::free_tile()
 {
-    FG_LOG( FG_TERRAIN, FG_DEBUG,
+    FG_LOG( FG_TERRAIN, FG_INFO,
            "FREEING TILE = (" << tile_bucket << ")" );
 
     // mark tile unused
     mark_unused();
 
     // delete fragment list
+    FG_LOG( FG_TERRAIN, FG_INFO,
+           "  deleting " << fragment_list.size() << " fragments" );
     for_each( begin(), end(),
              mem_fun_ref( &fgFRAGMENT::deleteDisplayList ));
     fragment_list.erase( begin(), end() );
 
     // delete the ssg used structures
+    FG_LOG( FG_TERRAIN, FG_INFO,
+           "  deleting vertex, normal, and texture coordinate arrays" );
+    FG_LOG( FG_TERRAIN, FG_INFO,
+           "    deleting vertex array" );
     if ( vtlist != NULL ) {
        delete vtlist;
     }
+    FG_LOG( FG_TERRAIN, FG_INFO,
+           "    deleting normal array" );
     if ( vnlist != NULL ) {
        delete vnlist;
     }
+    FG_LOG( FG_TERRAIN, FG_INFO,
+           "    deleting texture coordinate array" );
     if ( tclist != NULL ) {
        delete tclist;
     }
@@ -118,37 +128,24 @@ FGTileEntry::free_tile()
 }
 
 
-// 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
+// when a tile is still in the cache, but not in the immediate draw
+// list, it can still remain in the scene graph, but we use a range
 // selector to disable it from ever being drawn.
 void 
 FGTileEntry::ssg_disable() {
-    // cout << "TILE STATE = " << state << endl;
+    cout << "TILE STATE = " << state << endl;
     if ( state == Scheduled_for_use ) {
        state = Scheduled_for_cache;
+    } else if ( state == Scheduled_for_cache ) {
+       // do nothing
     } else if ( (state == Loaded) || (state == Cached) ) {
        state = Cached;
-       // cout << "DISABLING SSG NODE" << endl;
+       cout << "DISABLING SSG NODE" << endl;
        select_ptr->select(0);
-
-#if 0
-       // set a really tiny range
-       // cout << "SETTING TINY RANGE" << endl;
-       float ranges[2];
-       ranges[0] = 0.0f;
-       ranges[1] = 0.00001f;
-       range_ptr->setRanges( ranges, 2 );
-
-       // transform to a long way away
-       // cout << "MOVING FAR AWAY" << endl;
-       sgCoord sgcoord;
-       sgSetCoord( &sgcoord, 999999.0, 999999.0, 999999.0, 0.0, 0.0, 0.0 );
-       transform_ptr->setTransform( &sgcoord );
-#endif 
     } else {
        FG_LOG( FG_TERRAIN, FG_ALERT,
                "Trying to disable an unused tile!  Dying" );
        exit(-1);
     }  
-    // cout << "TILE STATE = " << state << endl;
+    cout << "TILE STATE = " << state << endl;
 }