1 // tilemgr.hxx -- routines to handle dynamic management of scenery tiles
3 // Written by Curtis Olson, started January 1998.
5 // Copyright (C) 1997 Curtis L. Olson - curt@infoplane.com
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
29 # error This library requires C++
32 #include <Include/compiler.h>
36 #include <Bucket/newbucket.hxx>
42 #define FG_LOCAL_X_Y 81 // max(o->tile_diameter) ** 2
44 #define FG_SQUARE( X ) ( (X) * (X) )
46 #if defined(USE_MEM) || defined(WIN32)
47 # define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
49 # define FG_MEM_COPY(to,from,n) bcopy(from, to, n)
78 // pending tile load queue
79 list < FGLoadRec > load_queue;
81 // schedule a tile for loading
82 int sched_tile( const FGBucket& b );
85 void load_tile( const FGBucket& b, int cache_index );
88 sgdVec3 hit_pts [ MAX_HITS ] ;
98 // Initialize the Tile Manager subsystem
101 // given the current lon/lat, fill in the array of local chunks.
102 // If the chunk isn't already in the cache, then read it from
106 // Determine scenery altitude. Normally this just happens when we
107 // render the scene, but we'd also like to be able to do this
108 // explicitely. lat & lon are in radians. abs_view_pos in
109 // meters. Returns result in meters.
110 double current_elev( double lon, double lat, const Point3D& abs_view_pos );
111 void my_ssg_los( string s, ssgBranch *branch, sgdMat4 m,
112 const sgdVec3 p, const sgdVec3 dir );
113 double current_elev_ssg( const Point3D& abs_view_pos,
114 const Point3D& view_pos );
115 double current_elev_new( const FGBucket& p );
117 // Prepare the ssg nodes ... for each tile, set it's proper
118 // transform and update it's range selector based on current
120 void prep_ssg_nodes( void );
125 extern FGTileMgr global_tile_mgr;
128 #endif // _TILEMGR_HXX