1998-05-23 14:09:20 +00:00
|
|
|
// tile.cxx -- routines to handle a scenery tile
|
|
|
|
//
|
|
|
|
// Written by Curtis Olson, started May 1998.
|
|
|
|
//
|
|
|
|
// Copyright (C) 1998 Curtis L. Olson - curt@infoplane.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
|
1999-03-02 01:02:31 +00:00
|
|
|
#include <Include/compiler.h>
|
|
|
|
|
1999-05-08 02:33:13 +00:00
|
|
|
#ifdef FG_MATH_EXCEPTION_CLASH
|
|
|
|
# include <math.h>
|
|
|
|
#endif
|
|
|
|
|
1999-02-02 20:13:29 +00:00
|
|
|
#include STL_FUNCTIONAL
|
|
|
|
#include STL_ALGORITHM
|
|
|
|
|
1998-11-09 23:40:46 +00:00
|
|
|
#include <Debug/logstream.hxx>
|
|
|
|
#include <Scenery/tile.hxx>
|
1999-03-25 19:03:24 +00:00
|
|
|
#include "Bucket/newbucket.hxx"
|
1998-07-12 03:18:27 +00:00
|
|
|
|
1998-05-23 14:09:20 +00:00
|
|
|
#include "tile.hxx"
|
|
|
|
|
1999-03-02 01:02:31 +00:00
|
|
|
FG_USING_STD(for_each);
|
|
|
|
FG_USING_STD(mem_fun_ref);
|
|
|
|
|
1998-05-23 14:09:20 +00:00
|
|
|
|
|
|
|
// Constructor
|
1998-11-09 23:40:46 +00:00
|
|
|
fgTILE::fgTILE ( void )
|
1999-05-03 18:38:48 +00:00
|
|
|
: nodes(new double[FG_MAX_NODES][3]),
|
1998-11-09 23:40:46 +00:00
|
|
|
ncount(0),
|
|
|
|
used(false)
|
1998-07-22 21:41:42 +00:00
|
|
|
{
|
1998-07-12 03:18:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
1998-05-23 14:09:20 +00:00
|
|
|
// Destructor
|
1998-11-09 23:40:46 +00:00
|
|
|
fgTILE::~fgTILE ( void ) {
|
|
|
|
// free(nodes);
|
|
|
|
delete[] nodes;
|
1998-07-22 21:41:42 +00:00
|
|
|
}
|
|
|
|
|
1998-11-09 23:40:46 +00:00
|
|
|
// Step through the fragment list, deleting the display list, then
|
|
|
|
// the fragment, until the list is empty.
|
|
|
|
void
|
|
|
|
fgTILE::release_fragments()
|
1998-07-22 21:41:42 +00:00
|
|
|
{
|
1998-11-09 23:40:46 +00:00
|
|
|
FG_LOG( FG_TERRAIN, FG_DEBUG,
|
|
|
|
"FREEING TILE = (" << tile_bucket << ")" );
|
|
|
|
for_each( begin(), end(),
|
|
|
|
mem_fun_ref( &fgFRAGMENT::deleteDisplayList ));
|
|
|
|
fragment_list.erase( begin(), end() );
|
|
|
|
used = false;
|
1998-05-23 14:09:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|