]> git.mxchange.org Git - flightgear.git/blobdiff - src/Scenery/tileentry.cxx
One more pass at a reorg.
[flightgear.git] / src / Scenery / tileentry.cxx
index 277dff4a57d99bac68994dbd890a12cf8f8f9374..fa860606ceea82c35cd9f5c0ba1fae81858d05ea 100644 (file)
@@ -21,7 +21,7 @@
 // $Id$
 
 
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
 
 #ifdef FG_MATH_EXCEPTION_CLASH
 #  include <math.h>
@@ -30,8 +30,8 @@
 #include STL_FUNCTIONAL
 #include STL_ALGORITHM
 
-#include <Debug/logstream.hxx>
-#include <Bucket/newbucket.hxx>
+#include <simgear/bucket/newbucket.hxx>
+#include <simgear/debug/logstream.hxx>
 
 #include "tileentry.hxx"
 
@@ -42,10 +42,7 @@ FG_USING_STD(mem_fun_ref);
 // Constructor
 FGTileEntry::FGTileEntry ( void )
     : ncount(0),
-      state(Unused),
-      vtlist(NULL),
-      vnlist(NULL),
-      tclist(NULL)
+      state(Unused)
 {
     nodes.clear();
 }
@@ -79,9 +76,8 @@ static void my_remove_branch( ssgBranch * branch ) {
 // Step through the fragment list, deleting the display list, then the
 // fragment, until the list is empty.  Also delete the arrays used by
 // ssg as well as the whole ssg branch
-void
-FGTileEntry::free_tile()
-{
+void FGTileEntry::free_tile() {
+    int i;
     FG_LOG( FG_TERRAIN, FG_DEBUG,
            "FREEING TILE = (" << tile_bucket << ")" );
 
@@ -98,29 +94,31 @@ FGTileEntry::free_tile()
 
     // delete the ssg structures
     FG_LOG( FG_TERRAIN, FG_DEBUG,
-           "  deleting vertex, normal, and texture coordinate arrays" );
-    FG_LOG( FG_TERRAIN, FG_DEBUG,
-           "    deleting vertex array" );
-    if ( vtlist != NULL ) {
-       delete vtlist;
-       vtlist = NULL;
-    }
-    FG_LOG( FG_TERRAIN, FG_DEBUG,
-           "    deleting normal array" );
-    if ( vnlist != NULL ) {
-       delete vnlist;
-       vnlist = NULL;
+           "  deleting (leaf data) vertex, normal, and "
+           << " texture coordinate arrays" );
+
+    for ( i = 0; i < (int)vec3_ptrs.size(); ++i ) {
+#ifdef MACOS
+       delete [] vec3_ptrs[i];
+#else
+       delete vec3_ptrs[i];
+#endif
     }
-    FG_LOG( FG_TERRAIN, FG_DEBUG,
-           "    deleting texture coordinate array" );
-    if ( tclist != NULL ) {
-       delete tclist;
-       tclist = NULL;
+    vec3_ptrs.clear();
+
+    for ( i = 0; i < (int)vec2_ptrs.size(); ++i ) {
+#ifdef MACOS
+       delete [] vec2_ptrs[i];
+#else
+       delete vec2_ptrs[i];
+#endif
     }
-    for ( int i = 0; i < (int)free_ptrs.size(); ++i ) {
-       delete free_ptrs[i];
+    vec2_ptrs.clear();
+
+    for ( i = 0; i < (int)index_ptrs.size(); ++i ) {
+       delete index_ptrs[i];
     }
-    free_ptrs.clear();
+    index_ptrs.clear();
 
     // delete the ssg branch
 
@@ -129,7 +127,7 @@ FGTileEntry::free_tile()
        // find the first parent (should only be one)
        ssgBranch *parent = select_ptr->getParent( 0 ) ;
        if( parent ) {
-           my_remove_branch( select_ptr );
+           // my_remove_branch( select_ptr );
            parent->removeKid( select_ptr );
        } else {
            FG_LOG( FG_TERRAIN, FG_ALERT,