]> git.mxchange.org Git - flightgear.git/blob - Scenery/tilecache.hxx
d59efa0ae23f9a0729c4f24849d67090bb76899b
[flightgear.git] / Scenery / tilecache.hxx
1 /**************************************************************************
2  * tilecache.h -- routines to handle scenery tile caching
3  *
4  * Written by Curtis Olson, started January 1998.
5  *
6  * Copyright (C) 1997  Curtis L. Olson  - curt@infoplane.com
7  *
8  * This program is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License as
10  * published by the Free Software Foundation; either version 2 of the
11  * License, or (at your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  * $Id$
23  * (Log is kept at end of this file)
24  **************************************************************************/
25
26
27 #ifndef _TILECACHE_H
28 #define _TILECACHE_H
29
30
31 #ifndef __cplusplus                                                          
32 # error This library requires C++
33 #endif                                   
34
35
36 #ifdef HAVE_CONFIG_H
37 #  include <config.h>
38 #endif
39
40 #ifdef HAVE_WINDOWS_H
41 #  include <windows.h>
42 #endif
43
44 #include <GL/glut.h>
45 #include <XGL/xgl.h>
46
47 #include <Bucket/bucketutils.h>
48 #include <Include/fg_types.h>
49
50 /* For best results ... i.e. to avoid tile load problems and blank areas
51  *
52  * FG_TILE_CACHE_SIZE >= FG_LOCAL_X_Y + 2*max(FG_LOCAL_X, FG_LOCAL_Y) + 1 */
53 #define FG_TILE_CACHE_SIZE 100
54
55
56 /* Tile cache record */
57 struct fgTILE {
58     struct fgBUCKET tile_bucket;
59     GLint display_list;
60     struct fgCartesianPoint local_ref;
61     double bounding_radius;
62     int used;
63     int priority;
64 };
65
66 /* tile cache */
67 extern struct fgTILE tile_cache[FG_TILE_CACHE_SIZE];
68
69
70 /* Initialize the tile cache subsystem */
71 void fgTileCacheInit( void );
72
73 /* Search for the specified "bucket" in the cache */
74 int fgTileCacheExists( struct fgBUCKET *p );
75
76 /* Return index of next available slot in tile cache */
77 int fgTileCacheNextAvail( void );
78
79 /* Fill in a tile cache entry with real data for the specified bucket */
80 void fgTileCacheEntryFillIn( int index, struct fgBUCKET *p );
81
82 /* Return info for a tile cache entry */
83 void fgTileCacheEntryInfo( int index, GLint *display_list, 
84                            struct fgCartesianPoint *local_ref );
85
86
87 #endif /* _TILECACHE_H */
88
89
90 /* $Log$
91 /* Revision 1.2  1998/04/24 00:51:08  curt
92 /* Wrapped "#include <config.h>" in "#ifdef HAVE_CONFIG_H"
93 /* Tweaked the scenery file extentions to be "file.obj" (uncompressed)
94 /* or "file.obz" (compressed.)
95 /*
96  * Revision 1.1  1998/04/22 13:22:47  curt
97  * C++ - ifing the code a bit.
98  *
99  * Revision 1.10  1998/04/21 17:02:45  curt
100  * Prepairing for C++ integration.
101  *
102  * Revision 1.9  1998/04/14 02:23:17  curt
103  * Code reorganizations.  Added a Lib/ directory for more general libraries.
104  *
105  * Revision 1.8  1998/04/08 23:30:08  curt
106  * Adopted Gnu automake/autoconf system.
107  *
108  * Revision 1.7  1998/04/03 22:11:38  curt
109  * Converting to Gnu autoconf system.
110  *
111  * Revision 1.6  1998/02/18 15:07:10  curt
112  * Tweaks to build with SGI OpenGL (and therefor hopefully other accelerated
113  * drivers will work.)
114  *
115  * Revision 1.5  1998/02/16 13:39:45  curt
116  * Miscellaneous weekend tweaks.  Fixed? a cache problem that caused whole
117  * tiles to occasionally be missing.
118  *
119  * Revision 1.4  1998/01/31 00:43:27  curt
120  * Added MetroWorks patches from Carmen Volpe.
121  *
122  * Revision 1.3  1998/01/29 00:51:40  curt
123  * First pass at tile cache, dynamic tile loading and tile unloading now works.
124  *
125  * Revision 1.2  1998/01/27 00:48:04  curt
126  * Incorporated Paul Bleisch's <bleisch@chromatic.com> new debug message
127  * system and commandline/config file processing code.
128  *
129  * Revision 1.1  1998/01/24 00:03:29  curt
130  * Initial revision.
131  *
132  */
133
134