// $Id$
-#include <Include/compiler.h>
+#include <simgear/compiler.h>
#ifdef FG_MATH_EXCEPTION_CLASH
# include <math.h>
#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"
// Constructor
FGTileEntry::FGTileEntry ( void )
: ncount(0),
- state(Unused),
- vtlist(NULL),
- vnlist(NULL),
- tclist(NULL)
+ state(Unused)
{
nodes.clear();
}
// 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 << ")" );
// 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
// 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,