|
@@ -1,48 +1,28 @@
|
1
|
|
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
|
2
|
|
-/*==========================================================================
|
|
1
|
+/*!
|
|
2
|
+ * \file include/Texture.h
|
|
3
|
+ * \brief Texture registry
|
3
|
4
|
*
|
4
|
|
- * Project : MTK, Freyja, OpenRaider
|
5
|
|
- * Author : Terry 'Mongoose' Hendrix II
|
6
|
|
- * Website : http://www.westga.edu/~stu7440
|
7
|
|
- * Email : stu7440@westga.edu
|
8
|
|
- * Object : MtkTexture
|
9
|
|
- * Comments: This is the Texture registery
|
10
|
|
- *
|
11
|
|
- * See file COPYING for license details.
|
12
|
|
- *
|
13
|
|
- *
|
14
|
|
- *-- History ----------------------------------------------------------
|
15
|
|
- *
|
16
|
|
- * 2003.06.30,
|
17
|
|
- * Mongoose - API update, SDL_TTF support moved here, misc features
|
18
|
|
- * SDL_TTF support based on Sam Lantinga's public domain
|
19
|
|
- * SDL_TTF demo functions and algorithms
|
20
|
|
- *
|
21
|
|
- * 2001.05.29:
|
22
|
|
- * Mongoose - Removed legacy code and done clean up
|
23
|
|
- *
|
24
|
|
- * 2001.02.19:
|
25
|
|
- * Mongoose - Moved from GooseEgg to mtk
|
26
|
|
- *
|
27
|
|
- * 2000.04.29:
|
28
|
|
- * Mongoose - Created from old PPM/PCX codebases I have done before
|
29
|
|
- ==========================================================================*/
|
30
|
|
-
|
|
5
|
+ * \author Mongoose
|
|
6
|
+ */
|
31
|
7
|
|
32
|
8
|
#ifndef _TEXTURE_H
|
33
|
9
|
#define _TEXTURE_H
|
34
|
10
|
|
35
|
11
|
#include <stdio.h>
|
36
|
12
|
|
37
|
|
-typedef struct
|
38
|
|
-{
|
39
|
|
- int x, y, w, h;
|
40
|
|
- int minx; int maxx; int miny; int maxy; int advance;
|
41
|
|
-
|
|
13
|
+typedef struct {
|
|
14
|
+ int x;
|
|
15
|
+ int y;
|
|
16
|
+ int w;
|
|
17
|
+ int h;
|
|
18
|
+ int minx;
|
|
19
|
+ int maxx;
|
|
20
|
+ int miny;
|
|
21
|
+ int maxy;
|
|
22
|
+ int advance;
|
42
|
23
|
} ttf_glyph_t;
|
43
|
24
|
|
44
|
|
-typedef struct
|
45
|
|
-{
|
|
25
|
+typedef struct {
|
46
|
26
|
unsigned int utf8Offset;
|
47
|
27
|
unsigned int count;
|
48
|
28
|
|
|
@@ -53,458 +33,244 @@ typedef struct
|
53
|
33
|
0x303f -> 0x3093 Japanese hiragana kana,
|
54
|
34
|
0x301a -> 0x30f6 Japanese katakana kana */
|
55
|
35
|
|
56
|
|
- unsigned int width; /* Width and height of RGBA texture */
|
57
|
|
- unsigned char *texture; /* RGBA texture data */
|
58
|
|
-
|
59
|
|
- ttf_glyph_t *glyphs; /* For typesetting and rendering use */
|
|
36
|
+ unsigned int width; //!< Width and height of RGBA texture
|
|
37
|
+ unsigned char *texture; //!< RGBA texture data
|
|
38
|
+ ttf_glyph_t *glyphs; //!< For typesetting and rendering use
|
60
|
39
|
int fontHeight;
|
61
|
40
|
int fontAscent;
|
62
|
41
|
int fontDescent;
|
63
|
42
|
int fontSpacing;
|
64
|
|
-
|
65
|
43
|
} ttf_texture_t;
|
66
|
44
|
|
67
|
|
-
|
68
|
|
-typedef struct
|
69
|
|
-{
|
|
45
|
+typedef struct {
|
70
|
46
|
unsigned int utf8Offset;
|
71
|
47
|
unsigned int count;
|
72
|
48
|
int textureId;
|
73
|
49
|
int drawListBase;
|
74
|
|
-
|
75
|
50
|
} gl_font_t;
|
76
|
51
|
|
|
52
|
+/*!
|
|
53
|
+ * \brief Texture registry
|
|
54
|
+ */
|
|
55
|
+class Texture {
|
|
56
|
+public:
|
77
|
57
|
|
78
|
|
-
|
79
|
|
-class Texture
|
80
|
|
-{
|
81
|
|
- public:
|
82
|
|
-
|
83
|
|
- enum ColorMode
|
84
|
|
- {
|
|
58
|
+ enum ColorMode {
|
85
|
59
|
GREYSCALE = 1,
|
86
|
60
|
RGB,
|
87
|
61
|
RGBA,
|
88
|
62
|
ARGB
|
89
|
63
|
};
|
90
|
64
|
|
91
|
|
- enum TextureFlag
|
92
|
|
- {
|
93
|
|
- fUseMipmaps = (1 << 0),
|
94
|
|
- fUseMultiTexture = (1 << 1),
|
95
|
|
- fUseSDL_TTF = (1 << 2)
|
|
65
|
+ enum TextureFlag {
|
|
66
|
+ fUseMipmaps = (1 << 0),
|
|
67
|
+ fUseMultiTexture = (1 << 1),
|
|
68
|
+ fUseSDL_TTF = (1 << 2)
|
96
|
69
|
};
|
97
|
70
|
|
98
|
|
-
|
99
|
|
- ////////////////////////////////////////////////////////////
|
100
|
|
- // Constructors
|
101
|
|
- ////////////////////////////////////////////////////////////
|
102
|
|
-
|
103
|
|
- Texture();
|
104
|
|
- /*------------------------------------------------------
|
105
|
|
- * Pre :
|
106
|
|
- * Post : Constructs an object of Texture
|
107
|
|
- *
|
108
|
|
- *-- History ------------------------------------------
|
109
|
|
- *
|
110
|
|
- * 2001.05.29:
|
111
|
|
- * Mongoose - Big code clean up, documentation
|
112
|
|
- *
|
113
|
|
- * 2000.10.05:
|
114
|
|
- * Mongoose - Created
|
115
|
|
- ------------------------------------------------------*/
|
116
|
|
-
|
117
|
|
- ~Texture();
|
118
|
|
- /*------------------------------------------------------
|
119
|
|
- * Pre : This object exists
|
120
|
|
- * Post : Deconstructs an object of Texture
|
121
|
|
- *
|
122
|
|
- *-- History ------------------------------------------
|
123
|
|
- *
|
124
|
|
- * 2001.05.29:
|
125
|
|
- * Mongoose - Big code clean up, documentation
|
126
|
|
- *
|
127
|
|
- * 2000.10.05:
|
128
|
|
- * Mongoose - Created
|
129
|
|
- ------------------------------------------------------*/
|
130
|
|
-
|
131
|
|
-
|
132
|
|
- ////////////////////////////////////////////////////////////
|
133
|
|
- // Public Accessors
|
134
|
|
- ////////////////////////////////////////////////////////////
|
135
|
|
-
|
|
71
|
+ /*!
|
|
72
|
+ * \brief Constructs an object of Texture
|
|
73
|
+ */
|
|
74
|
+ Texture();
|
|
75
|
+
|
|
76
|
+ /*!
|
|
77
|
+ * \brief Deconstructs an object of Texture
|
|
78
|
+ */
|
|
79
|
+ ~Texture();
|
|
80
|
+
|
|
81
|
+ /*!
|
|
82
|
+ * \brief Generates a texture buffer with (width * height * 4) bytes.
|
|
83
|
+ * \param rgba 32bpp RGBA color to fill into buffer
|
|
84
|
+ * \param width width of newly allocated buffer, power of 2, pref same as height
|
|
85
|
+ * \param height height of newly allocated buffer, power of 2, pref same as width
|
|
86
|
+ * \returns newly allocated texture buffer filled with specified color
|
|
87
|
+ */
|
136
|
88
|
static unsigned char *generateColorTexture(unsigned char rgba[4],
|
137
|
|
- unsigned int width,
|
138
|
|
- unsigned int height);
|
139
|
|
- /*------------------------------------------------------
|
140
|
|
- * Pre : <Rgba> is 32bpp RGBA color
|
141
|
|
- * <Width> and <Height> are powers of two, pref
|
142
|
|
- * the same number
|
143
|
|
- * Post :
|
144
|
|
- *
|
145
|
|
- *-- History ------------------------------------------
|
146
|
|
- *
|
147
|
|
- * 2003.06.30:
|
148
|
|
- * Mongoose - Created
|
149
|
|
- ------------------------------------------------------*/
|
|
89
|
+ unsigned int width,
|
|
90
|
+ unsigned int height);
|
150
|
91
|
|
151
|
92
|
gl_font_t *generateFont(ttf_texture_t *texture);
|
152
|
|
- /*------------------------------------------------------
|
153
|
|
- * Pre :
|
154
|
|
- * Post :
|
155
|
|
- *
|
156
|
|
- *-- History ------------------------------------------
|
157
|
|
- *
|
158
|
|
- * 2003.06.30:
|
159
|
|
- * Mongoose - Created
|
160
|
|
- ------------------------------------------------------*/
|
161
|
93
|
|
|
94
|
+ /*!
|
|
95
|
+ * \brief Generates a font texture with typeset info from TTF.
|
|
96
|
+ *
|
|
97
|
+ * Does not load the texture itself! Call loadFont() on returned ttf_texture_t
|
|
98
|
+ * \param filename filename of TTF font
|
|
99
|
+ * \param pointSize Point Size to generate
|
|
100
|
+ * \param textureWidth width of texture, height will match it
|
|
101
|
+ * \param color RGB 24bit color
|
|
102
|
+ * \param utf8Offset Offset into fonts encoding chart
|
|
103
|
+ * \param cound number of glyphs to read from offset start
|
|
104
|
+ * \param verboxe dumps debug info to stdout
|
|
105
|
+ * \returns font texture. Load it with loadFont()!
|
|
106
|
+ */
|
162
|
107
|
ttf_texture_t *generateFontTexture(const char *filename, int pointSize,
|
163
|
|
- unsigned int textureWidth,
|
164
|
|
- unsigned char color[3],
|
165
|
|
- unsigned int utf8Offset,
|
166
|
|
- unsigned int count,
|
167
|
|
- char verbose);
|
168
|
|
- /*------------------------------------------------------
|
169
|
|
- * Pre : <Filename> of TTF font
|
170
|
|
- * <PointSize> to generate
|
171
|
|
- * <TextureWidth> is width of texture, height will match it
|
172
|
|
- * <Color> is RGB 24bit color
|
173
|
|
- * <Utf8Offset> is offset into font's encoding chart
|
174
|
|
- * <Count> is number of glyphs to read from offset start
|
175
|
|
- * <Verbose> dumps debug info to stdout
|
176
|
|
- *
|
177
|
|
- * Post : Generates a font texture with typeset info from TTF
|
178
|
|
- *
|
179
|
|
- * DOES NOT load the texture itself, call loadFont()
|
180
|
|
- * on returned ttf_texture_t
|
181
|
|
- *
|
182
|
|
- *
|
183
|
|
- *-- History ------------------------------------------
|
184
|
|
- *
|
185
|
|
- * 2003.06.03:
|
186
|
|
- * Mongoose - Created
|
187
|
|
- ------------------------------------------------------*/
|
188
|
|
-
|
189
|
|
- int getTextureCount();
|
190
|
|
- /*------------------------------------------------------
|
191
|
|
- * Pre :
|
192
|
|
- * Post : Returns number of textures in use, or -1 for
|
193
|
|
- * error ( Not initalized )
|
194
|
|
- *
|
195
|
|
- *-- History ------------------------------------------
|
196
|
|
- *
|
197
|
|
- * 2001.05.29:
|
198
|
|
- * Mongoose - Big code clean up, documentation
|
199
|
|
- *
|
200
|
|
- * 2000.10.05:
|
201
|
|
- * Mongoose - Created
|
202
|
|
- ------------------------------------------------------*/
|
203
|
|
-
|
|
108
|
+ unsigned int textureWidth,
|
|
109
|
+ unsigned char color[3],
|
|
110
|
+ unsigned int utf8Offset,
|
|
111
|
+ unsigned int count,
|
|
112
|
+ char verbose);
|
|
113
|
+
|
|
114
|
+ /*!
|
|
115
|
+ * \brief Get number of textures in use
|
|
116
|
+ * \returns used texture count, or -1 on error (uninitialized)
|
|
117
|
+ */
|
|
118
|
+ int getTextureCount();
|
|
119
|
+
|
|
120
|
+ /*!
|
|
121
|
+ * \brief Dumps a screenshot to disk.
|
|
122
|
+ *
|
|
123
|
+ * Avoids overwriting files with same base name.
|
|
124
|
+ * \param base base filename
|
|
125
|
+ * \param width viewport width
|
|
126
|
+ * \param height viewport height
|
|
127
|
+ */
|
204
|
128
|
void glScreenShot(char *base, unsigned int width, unsigned int height);
|
205
|
|
- /*------------------------------------------------------
|
206
|
|
- * Pre : <Base> is base filename,
|
207
|
|
- * <Width> and <Height> are viewport dim
|
208
|
|
- *
|
209
|
|
- * Post : Dumps a screenshot to disk,
|
210
|
|
- * avoids overwriting files with same base name
|
211
|
|
- *
|
212
|
|
- *-- History ------------------------------------------
|
213
|
|
- *
|
214
|
|
- * 2002.06.16:
|
215
|
|
- * Mongoose - Created
|
216
|
|
- ------------------------------------------------------*/
|
217
|
|
-
|
218
|
|
-
|
219
|
|
- ////////////////////////////////////////////////////////////
|
220
|
|
- // Public Mutators
|
221
|
|
- ////////////////////////////////////////////////////////////
|
222
|
129
|
|
|
130
|
+ /*!
|
|
131
|
+ * \brief Sets up multitexture rendering with passed ids
|
|
132
|
+ * \param texture0 first texture for multitexture
|
|
133
|
+ * \param texture1 second texture for multitexture
|
|
134
|
+ */
|
223
|
135
|
void bindMultiTexture(int texture0, int texture1);
|
224
|
|
- /*------------------------------------------------------
|
225
|
|
- * Pre :
|
226
|
|
- * Post : Sets up multitexture rendering with passed texture ids
|
227
|
|
- *
|
228
|
|
- *-- History ------------------------------------------
|
229
|
|
- *
|
230
|
|
- * 2002.12.24:
|
231
|
|
- * Mongoose - Created
|
232
|
|
- ------------------------------------------------------*/
|
233
|
|
-
|
234
|
|
- void bindTextureId(unsigned int n);
|
235
|
|
- /*------------------------------------------------------
|
236
|
|
- * Pre : n is valid texture index
|
237
|
|
- * Post : Binds the texture for use in GL
|
238
|
|
- *
|
239
|
|
- *-- History ------------------------------------------
|
240
|
|
- *
|
241
|
|
- * 2001.05.29:
|
242
|
|
- * Mongoose - Big code clean up, documentation
|
243
|
|
- *
|
244
|
|
- * 2000.10.05:
|
245
|
|
- * Mongoose - Created
|
246
|
|
- ------------------------------------------------------*/
|
247
|
136
|
|
|
137
|
+ /*!
|
|
138
|
+ * \brief Binds the texture for use in GL
|
|
139
|
+ * \param n valid texture index
|
|
140
|
+ */
|
|
141
|
+ void bindTextureId(unsigned int n);
|
|
142
|
+
|
|
143
|
+ /*!
|
|
144
|
+ * \brief Clears an option flag
|
|
145
|
+ * \param flag flag to clear
|
|
146
|
+ */
|
248
|
147
|
void clearFlag(TextureFlag flag);
|
249
|
|
- /*------------------------------------------------------
|
250
|
|
- * Pre :
|
251
|
|
- * Post : CLears a option flag
|
252
|
|
- *
|
253
|
|
- *-- History ------------------------------------------
|
254
|
|
- *
|
255
|
|
- * 2003.01.05:
|
256
|
|
- * Mongoose - Created
|
257
|
|
- ------------------------------------------------------*/
|
258
|
148
|
|
259
|
149
|
void disableMultiTexture();
|
260
|
|
- /*------------------------------------------------------
|
261
|
|
- * Pre :
|
262
|
|
- * Post :
|
263
|
|
- *
|
264
|
|
- *-- History ------------------------------------------
|
265
|
|
- *
|
266
|
|
- * 2002.12.24:
|
267
|
|
- * Mongoose - Created
|
268
|
|
- ------------------------------------------------------*/
|
269
|
150
|
|
|
151
|
+ /*!
|
|
152
|
+ * \brief Loads SDL_TTF
|
|
153
|
+ */
|
270
|
154
|
void initSDL_TTF();
|
271
|
|
- /*------------------------------------------------------
|
272
|
|
- * Pre :
|
273
|
|
- * Post : Loads SDL_TTF if avalible
|
274
|
|
- *
|
275
|
|
- *-- History ------------------------------------------
|
276
|
|
- *
|
277
|
|
- * 2003.06.03:
|
278
|
|
- * Mongoose - Created
|
279
|
|
- ------------------------------------------------------*/
|
280
|
155
|
|
281
|
|
- int loadBuffer(unsigned char *image,
|
|
156
|
+ /*!
|
|
157
|
+ * \brief Loads Buffer as texture
|
|
158
|
+ * \param image pixmap matching other params
|
|
159
|
+ * \param width width of image
|
|
160
|
+ * \param height height of image
|
|
161
|
+ * \param mode mode of image
|
|
162
|
+ * \param bpp bits per pixel of image
|
|
163
|
+ * \returns texture ID or < 0 on error
|
|
164
|
+ */
|
|
165
|
+ int loadBuffer(unsigned char *image,
|
|
166
|
+ unsigned int width, unsigned int height,
|
|
167
|
+ ColorMode mode, unsigned int bpp);
|
|
168
|
+
|
|
169
|
+ /*!
|
|
170
|
+ * \brief Loads Buffer as texture
|
|
171
|
+ * \param image pixmap matching other params
|
|
172
|
+ * \param width width of image
|
|
173
|
+ * \param height height of image
|
|
174
|
+ * \param mode mode of image
|
|
175
|
+ * \param bpp bits per pixel of image
|
|
176
|
+ * \param slot slot (ID) of image
|
|
177
|
+ * \returns texture ID or < 0 on error
|
|
178
|
+ */
|
|
179
|
+ int loadBufferSlot(unsigned char *image,
|
282
|
180
|
unsigned int width, unsigned int height,
|
283
|
|
- ColorMode mode, unsigned int bpp);
|
284
|
|
- /*------------------------------------------------------
|
285
|
|
- * Pre : image must be a valid pixmap that agrees
|
286
|
|
- * with mode, width, and height
|
287
|
|
- *
|
288
|
|
- * Post : Returns texture id or < 0 error flag
|
289
|
|
- *
|
290
|
|
- *-- History ------------------------------------------
|
291
|
|
- *
|
292
|
|
- * 2001.05.29:
|
293
|
|
- * Mongoose - Big code clean up, documentation
|
294
|
|
- *
|
295
|
|
- * 2000.10.05:
|
296
|
|
- * Mongoose - Created
|
297
|
|
- ------------------------------------------------------*/
|
298
|
|
-
|
299
|
|
- int loadBufferSlot(unsigned char *image,
|
300
|
|
- unsigned int width, unsigned int height,
|
301
|
|
- ColorMode mode, unsigned int bpp,
|
302
|
|
- unsigned int slot);
|
303
|
|
- /*------------------------------------------------------
|
304
|
|
- * Pre : image must be a valid pixmap that agrees
|
305
|
|
- * with mode, width, and height, slot ( ID )
|
306
|
|
- *
|
307
|
|
- * Post : Returns texture id or < 0 error flag
|
308
|
|
- *
|
309
|
|
- *-- History ------------------------------------------
|
310
|
|
- *
|
311
|
|
- * 2002.09.05:
|
312
|
|
- * Mongoose - Created
|
313
|
|
- ------------------------------------------------------*/
|
314
|
|
-
|
|
181
|
+ ColorMode mode, unsigned int bpp,
|
|
182
|
+ unsigned int slot);
|
|
183
|
+
|
|
184
|
+ /*!
|
|
185
|
+ * \brief Generates and loads a solid color texture.
|
|
186
|
+ * \param rgba color for new texture
|
|
187
|
+ * \param width width of new texture
|
|
188
|
+ * \param height height of new texture
|
|
189
|
+ * \returns texture ID or -1 on error
|
|
190
|
+ */
|
315
|
191
|
int loadColorTexture(unsigned char rgba[4],
|
316
|
|
- unsigned int width, unsigned int height);
|
317
|
|
- /*------------------------------------------------------
|
318
|
|
- * Pre :
|
319
|
|
- * Post : Generates and loads a solid color texture,
|
320
|
|
- * returns texture Id or -1 if failed
|
321
|
|
- *
|
322
|
|
- *-- History ------------------------------------------
|
323
|
|
- *
|
324
|
|
- * 2003.06.30:
|
325
|
|
- * Mongoose - Created
|
326
|
|
- ------------------------------------------------------*/
|
327
|
|
-
|
|
192
|
+ unsigned int width, unsigned int height);
|
|
193
|
+
|
|
194
|
+ /*!
|
|
195
|
+ * \brief Loads a TTF, generates texture image, glyph list and drawlist
|
|
196
|
+ * \param filename Filename of TTF font
|
|
197
|
+ * \param utf8Offset Offset into Unicode table
|
|
198
|
+ * \param cound number of glyphs to load
|
|
199
|
+ * \returns font id if successful, or < 0 on error
|
|
200
|
+ */
|
328
|
201
|
int loadFontTTF(const char *filename,
|
329
|
|
- unsigned int utf8Offset, unsigned int count);
|
330
|
|
- /*------------------------------------------------------
|
331
|
|
- * Pre : <Filename> of TTF font
|
332
|
|
- * <Utf8Offset> is offset into UNICODE table
|
333
|
|
- * <Count> is number of glyphs to load
|
334
|
|
- *
|
335
|
|
- * Post : Loads a TTF,
|
336
|
|
- * Generates: texture image, glyph list, and drawlist
|
337
|
|
- *
|
338
|
|
- * Returns font id if sucessful, or < 0 if error
|
339
|
|
- *
|
340
|
|
- *-- History ------------------------------------------
|
341
|
|
- *
|
342
|
|
- * 2003.07.05:
|
343
|
|
- * Mongoose - Created
|
344
|
|
- ------------------------------------------------------*/
|
345
|
|
-
|
346
|
|
- int loadPNG(const char *filename);
|
347
|
|
- /*------------------------------------------------------
|
348
|
|
- * Pre : Texture is init and filename/file is valid
|
349
|
|
- * Post : Loads PNG as texture and returns ID or -1 error
|
350
|
|
- *
|
351
|
|
- *-- History ------------------------------------------
|
352
|
|
- *
|
353
|
|
- * 2002.06.16:
|
354
|
|
- * Mongoose - Created, from Freyja
|
355
|
|
- ------------------------------------------------------*/
|
|
202
|
+ unsigned int utf8Offset, unsigned int count);
|
356
|
203
|
|
|
204
|
+ /*!
|
|
205
|
+ * \brief Loads TGA file as texture
|
|
206
|
+ * \param filename Existing TGA file
|
|
207
|
+ * \returns ID of new texture or -1 on error
|
|
208
|
+ */
|
357
|
209
|
int loadTGA(const char *filename);
|
358
|
|
- /*------------------------------------------------------
|
359
|
|
- * Pre : Texture is init and filename/file is valid
|
360
|
|
- * Post : Loads TGA as texture and returns ID or -1 error
|
361
|
|
- *
|
362
|
|
- *-- History ------------------------------------------
|
363
|
|
- *
|
364
|
|
- * 2002.06.16:
|
365
|
|
- * Mongoose - Created
|
366
|
|
- ------------------------------------------------------*/
|
367
|
|
-
|
368
|
|
- void reset();
|
369
|
|
- /*------------------------------------------------------
|
370
|
|
- * Pre :
|
371
|
|
- * Post : Resets all texture data
|
372
|
|
- *
|
373
|
|
- *-- History ------------------------------------------
|
374
|
|
- *
|
375
|
|
- * 2001.05.29:
|
376
|
|
- * Mongoose - Big code clean up, documentation
|
377
|
|
- *
|
378
|
|
- * 2000.10.05:
|
379
|
|
- * Mongoose - Created
|
380
|
|
- ------------------------------------------------------*/
|
381
|
210
|
|
|
211
|
+ /*!
|
|
212
|
+ * \brief Resets all texture data
|
|
213
|
+ */
|
|
214
|
+ void reset();
|
|
215
|
+
|
|
216
|
+ /*!
|
|
217
|
+ * \brief Sets an option flag
|
|
218
|
+ * \param flag flag to set
|
|
219
|
+ */
|
382
|
220
|
void setFlag(TextureFlag flag);
|
383
|
|
- /*------------------------------------------------------
|
384
|
|
- * Pre :
|
385
|
|
- * Post : Sets a option flag
|
386
|
|
- *
|
387
|
|
- *-- History ------------------------------------------
|
388
|
|
- *
|
389
|
|
- * 2003.01.05:
|
390
|
|
- * Mongoose - Created
|
391
|
|
- ------------------------------------------------------*/
|
392
|
221
|
|
393
|
|
- void setMaxTextureCount(unsigned int n);
|
394
|
|
- /*------------------------------------------------------
|
395
|
|
- * Pre : n is max number of textures you wish to allow
|
396
|
|
- * Post : Sets up GL texturing, and must be called
|
397
|
|
- * as the first setup step
|
398
|
|
- *
|
399
|
|
- *-- History ------------------------------------------
|
400
|
|
- *
|
401
|
|
- * 2001.05.29:
|
402
|
|
- * Mongoose - Big code clean up, documentation
|
|
222
|
+ /*!
|
|
223
|
+ * \brief Sets up GL texturing.
|
403
|
224
|
*
|
404
|
|
- * 2000.10.05:
|
405
|
|
- * Mongoose - Created
|
406
|
|
- ------------------------------------------------------*/
|
|
225
|
+ * Must be called as first setup step!
|
|
226
|
+ * \param n maximum number of textures you wish to allow
|
|
227
|
+ */
|
|
228
|
+ void setMaxTextureCount(unsigned int n);
|
407
|
229
|
|
408
|
230
|
void useMultiTexture(float u, float v);
|
409
|
|
- /*------------------------------------------------------
|
410
|
|
- * Pre :
|
411
|
|
- * Post :
|
412
|
|
- *
|
413
|
|
- *-- History ------------------------------------------
|
414
|
|
- *
|
415
|
|
- * 2002.12.24:
|
416
|
|
- * Mongoose - Created
|
417
|
|
- ------------------------------------------------------*/
|
418
|
231
|
|
419
|
232
|
void useMultiTexture(float aU, float aV, float bU, float bV);
|
420
|
|
- /*------------------------------------------------------
|
421
|
|
- * Pre :
|
422
|
|
- * Post :
|
423
|
|
- *
|
424
|
|
- *-- History ------------------------------------------
|
425
|
|
- *
|
426
|
|
- * 2002.12.24:
|
427
|
|
- * Mongoose - Created
|
428
|
|
- ------------------------------------------------------*/
|
429
|
|
-
|
430
|
|
-
|
431
|
|
- private:
|
432
|
233
|
|
433
|
|
- ////////////////////////////////////////////////////////////
|
434
|
|
- // Private Accessors
|
435
|
|
- ////////////////////////////////////////////////////////////
|
|
234
|
+private:
|
436
|
235
|
|
437
|
236
|
int nextPower(int seed);
|
438
|
|
- /*------------------------------------------------------
|
439
|
|
- * Pre :
|
440
|
|
- * Post :
|
441
|
|
- *
|
442
|
|
- *-- History ------------------------------------------
|
443
|
|
- *
|
444
|
|
- * 2002.06.16:
|
445
|
|
- * Mongoose - Created
|
446
|
|
- ------------------------------------------------------*/
|
447
|
237
|
|
448
|
238
|
unsigned char *scaleBuffer(unsigned char *image, int width, int height,
|
449
|
|
- int components);
|
450
|
|
- /*------------------------------------------------------
|
451
|
|
- * Pre :
|
452
|
|
- * Post :
|
453
|
|
- *
|
454
|
|
- *-- History ------------------------------------------
|
455
|
|
- *
|
456
|
|
- * 2002.06.16:
|
457
|
|
- * Mongoose - Created
|
458
|
|
- ------------------------------------------------------*/
|
459
|
|
-
|
460
|
|
-
|
461
|
|
- ////////////////////////////////////////////////////////////
|
462
|
|
- // Private Mutators
|
463
|
|
- ////////////////////////////////////////////////////////////
|
464
|
|
-
|
465
|
|
- unsigned int *mTextureIds; /* GL texture list */
|
466
|
|
-
|
467
|
|
- unsigned int mTextureCount; /* Texture counter */
|
468
|
|
-
|
469
|
|
- unsigned int mTextureLimit; /* The texture limit */
|
470
|
|
-
|
471
|
|
- unsigned int mFlags; /* Class options */
|
472
|
|
-
|
473
|
|
- int mTextureId; /* Currently bound texture id */
|
474
|
|
-
|
475
|
|
- int mTextureId2; /* Multitexture Texture Id */
|
|
239
|
+ int components);
|
|
240
|
+
|
|
241
|
+ unsigned int *mTextureIds; //!< GL texture list
|
|
242
|
+ unsigned int mTextureCount; //!< Texture counter
|
|
243
|
+ unsigned int mTextureLimit; //!< The texture limit
|
|
244
|
+ unsigned int mFlags; //!< Class options
|
|
245
|
+ int mTextureId; //!< Currently bound texture id
|
|
246
|
+ int mTextureId2; //!< Multitexture Texture Id
|
476
|
247
|
};
|
477
|
248
|
|
478
|
249
|
|
479
|
|
-/* Experimental testing */
|
|
250
|
+// Experimental testing
|
|
251
|
+
|
480
|
252
|
void bufferedPrintf(char *string, unsigned int len, char *s, ...);
|
481
|
253
|
|
482
|
254
|
void glPrint3d(float x, float y, float z,
|
483
|
|
- float pitch, float yaw, float roll,
|
484
|
|
- float scale,
|
485
|
|
- char *string);
|
|
255
|
+ float pitch, float yaw, float roll,
|
|
256
|
+ float scale, char *string);
|
486
|
257
|
|
487
|
258
|
void glPrint2d(float x, float y, float scale, char *string);
|
488
|
259
|
|
489
|
|
- void glEnterMode2d(unsigned int width, unsigned int height);
|
490
|
|
- /*------------------------------------------------------
|
491
|
|
- * Pre :
|
492
|
|
- * Post : OpenGL ortho projection
|
493
|
|
- *
|
494
|
|
- *-- History ------------------------------------------
|
495
|
|
- *
|
496
|
|
- * 2003.06.03:
|
497
|
|
- * Mongoose - Created
|
498
|
|
- ------------------------------------------------------*/
|
499
|
|
-
|
500
|
|
- void glExitMode2d();
|
501
|
|
- /*------------------------------------------------------
|
502
|
|
- * Pre :
|
503
|
|
- * Post : OpenGL model matrix projection
|
504
|
|
- *
|
505
|
|
- *-- History ------------------------------------------
|
506
|
|
- *
|
507
|
|
- * 2003.06.03:
|
508
|
|
- * Mongoose - Created
|
509
|
|
- ------------------------------------------------------*/
|
|
260
|
+/*!
|
|
261
|
+ * \brief OpenGL ortho projection.
|
|
262
|
+ *
|
|
263
|
+ * Call before using glPrint2d()
|
|
264
|
+ * \param width window width
|
|
265
|
+ * \param height window height
|
|
266
|
+ */
|
|
267
|
+void glEnterMode2d(unsigned int width, unsigned int height);
|
|
268
|
+
|
|
269
|
+/*!
|
|
270
|
+ * \brief OpenGL model matrix projection.
|
|
271
|
+ *
|
|
272
|
+ * Call after using glPrint2d()
|
|
273
|
+ */
|
|
274
|
+void glExitMode2d();
|
|
275
|
+
|
510
|
276
|
#endif
|