]> git.mxchange.org Git - flightgear.git/blob - Scenery/tile.hxx
Added automatic mipmap generation.
[flightgear.git] / Scenery / tile.hxx
1 // tile.hxx -- routines to handle a scenery tile
2 //
3 // Written by Curtis Olson, started May 1998.
4 //
5 // Copyright (C) 1998  Curtis L. Olson  - curt@infoplane.com
6 //
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.
11 //
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.
16 //
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.
20 //
21 // $Id$
22 // (Log is kept at end of this file)
23
24
25 #ifndef _TILE_HXX
26 #define _TILE_HXX
27
28
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32
33 #ifdef HAVE_CONFIG_H
34 #  include <config.h>
35 #endif
36
37 #ifdef HAVE_WINDOWS_H
38 #  include <windows.h>
39 #endif
40
41 #include <GL/glut.h>
42 #include <XGL/xgl.h>
43
44 #ifdef __sun__
45 extern "C" void *memmove(void *, const void *, size_t);
46 extern "C" void *memset(void *, int, size_t);
47 #endif
48
49 #include <list>         // STL list
50
51 #include <Bucket/bucketutils.h>
52 #include <Include/fg_types.h>
53
54
55 // Object fragment data class
56 class fgFRAGMENT {
57
58 public:
59     // culling data for this object fragment (fine grain culling)
60     fgCartesianPoint3d center;
61     double bounding_radius;
62
63     // variable offset data for this object fragment for this frame
64     // fgCartesianPoint3d tile_offset;
65
66     // saved transformation matrix for this fragment (used by renderer)
67     // GLfloat matrix[16];
68     
69     // tile_ptr & material_ptr are set so that when we traverse the
70     // list of fragments we can quickly reference back the tile or
71     // material property this fragment is assigned to.
72
73     // material property pointer
74     void *material_ptr;
75
76     // tile pointer
77     void *tile_ptr;
78
79     // OpenGL display list for fragment data
80     GLint display_list;
81
82     // Constructor
83     fgFRAGMENT ( void );
84
85     // Destructor
86     ~fgFRAGMENT ( void );
87 };
88
89
90 // Scenery tile class
91 class fgTILE {
92
93 public:
94
95     // culling data for whole tile (course grain culling)
96     fgCartesianPoint3d center;
97     double bounding_radius;
98     fgCartesianPoint3d offset;
99     GLdouble model_view[16];
100
101     // this tile's official location in the world
102     fgBUCKET tile_bucket;
103
104     // the tile cache will mark here if the tile is being used
105     int used;
106
107     list < fgFRAGMENT > fragment_list;
108
109     // Constructor
110     fgTILE ( void );
111
112     // Destructor
113     ~fgTILE ( void );
114 };
115
116
117 #endif // _TILE_HXX 
118
119
120 // $Log$
121 // Revision 1.8  1998/07/04 00:54:30  curt
122 // Added automatic mipmap generation.
123 //
124 // When rendering fragments, use saved model view matrix from associated tile
125 // rather than recalculating it with push() translate() pop().
126 //
127 // Revision 1.7  1998/06/12 00:58:05  curt
128 // Build only static libraries.
129 // Declare memmove/memset for Sloaris.
130 //
131 // Revision 1.6  1998/06/08 17:57:54  curt
132 // Working first pass at material proporty sorting.
133 //
134 // Revision 1.5  1998/06/06 01:09:32  curt
135 // I goofed on the log message in the last commit ... now fixed.
136 //
137 // Revision 1.4  1998/06/06 01:07:18  curt
138 // Increased per material fragment list size from 100 to 400.
139 // Now correctly draw viewable fragments in per material order.
140 //
141 // Revision 1.3  1998/06/05 22:39:54  curt
142 // Working on sorting by, and rendering by material properties.
143 //
144 // Revision 1.2  1998/06/03 00:47:50  curt
145 // No .h for STL includes.
146 // Minor view culling optimizations.
147 //
148 // Revision 1.1  1998/05/23 14:09:21  curt
149 // Added tile.cxx and tile.hxx.
150 // Working on rewriting the tile management system so a tile is just a list
151 // fragments, and the fragment record contains the display list for that fragment.
152 //