1 | //-----------------------------------------------------------------------------
|
---|
2 | //
|
---|
3 | // ImageLib Utility Toolkit Sources
|
---|
4 | // Copyright (C) 2000-2002 by Denton Woods
|
---|
5 | // Last modified: 06/23/2002 <--Y2K Compliant! =]
|
---|
6 | //
|
---|
7 | // Filename: IL/ilut.h
|
---|
8 | //
|
---|
9 | // Description: The main include file for ILUT
|
---|
10 | //
|
---|
11 | //-----------------------------------------------------------------------------
|
---|
12 |
|
---|
13 |
|
---|
14 | #ifndef __ilut_h_
|
---|
15 | #ifndef __ILUT_H__
|
---|
16 |
|
---|
17 | #define __ilut_h_
|
---|
18 | #define __ILUT_H__
|
---|
19 |
|
---|
20 | #include "IL/il.h"
|
---|
21 | #include "IL/ilu.h"
|
---|
22 |
|
---|
23 |
|
---|
24 | //-----------------------------------------------------------------------------
|
---|
25 | // Defines
|
---|
26 | //-----------------------------------------------------------------------------
|
---|
27 |
|
---|
28 | #define ILUT_VERSION_1_6_7 1
|
---|
29 | #define ILUT_VERSION 167
|
---|
30 |
|
---|
31 |
|
---|
32 | // Attribute Bits
|
---|
33 | #define ILUT_OPENGL_BIT 0x00000001
|
---|
34 | #define ILUT_D3D_BIT 0x00000002
|
---|
35 | #define ILUT_ALL_ATTRIB_BITS 0x000FFFFF
|
---|
36 |
|
---|
37 |
|
---|
38 | // Error Types
|
---|
39 | #define ILUT_INVALID_ENUM 0x0501
|
---|
40 | #define ILUT_OUT_OF_MEMORY 0x0502
|
---|
41 | #define ILUT_INVALID_VALUE 0x0505
|
---|
42 | #define ILUT_ILLEGAL_OPERATION 0x0506
|
---|
43 | #define ILUT_INVALID_PARAM 0x0509
|
---|
44 | #define ILUT_COULD_NOT_OPEN_FILE 0x050A
|
---|
45 | #define ILUT_STACK_OVERFLOW 0x050E
|
---|
46 | #define ILUT_STACK_UNDERFLOW 0x050F
|
---|
47 | #define ILUT_BAD_DIMENSIONS 0x0511
|
---|
48 | #define ILUT_NOT_SUPPORTED 0x0550
|
---|
49 |
|
---|
50 |
|
---|
51 | // State Definitions
|
---|
52 | #define ILUT_PALETTE_MODE 0x0600
|
---|
53 | #define ILUT_OPENGL_CONV 0x0610
|
---|
54 | #define ILUT_D3D_MIPLEVELS 0x0620
|
---|
55 | #define ILUT_MAXTEX_WIDTH 0x0630
|
---|
56 | #define ILUT_MAXTEX_HEIGHT 0x0631
|
---|
57 | #define ILUT_MAXTEX_DEPTH 0x0632
|
---|
58 | #define ILUT_GL_USE_S3TC 0x0634
|
---|
59 | #define ILUT_D3D_USE_DXTC 0x0634
|
---|
60 | #define ILUT_GL_GEN_S3TC 0x0635
|
---|
61 | #define ILUT_D3D_GEN_DXTC 0x0635
|
---|
62 | #define ILUT_S3TC_FORMAT 0x0705
|
---|
63 | #define ILUT_DXTC_FORMAT 0x0705
|
---|
64 | #define ILUT_D3D_POOL 0x0706
|
---|
65 | #define ILUT_D3D_ALPHA_KEY_COLOR 0x0707
|
---|
66 | #define ILUT_D3D_ALPHA_KEY_COLOUR 0x0707
|
---|
67 |
|
---|
68 | //This new state does automatic texture target detection
|
---|
69 | //if enabled. Currently, only cubemap detection is supported.
|
---|
70 | //if the current image is no cubemap, the 2d texture is chosen.
|
---|
71 | #define ILUT_GL_AUTODETECT_TEXTURE_TARGET 0x0807
|
---|
72 |
|
---|
73 |
|
---|
74 | // Values
|
---|
75 | #define ILUT_VERSION_NUM IL_VERSION_NUM
|
---|
76 | #define ILUT_VENDOR IL_VENDOR
|
---|
77 |
|
---|
78 | // The different rendering api's...more to be added later?
|
---|
79 | #define ILUT_OPENGL 0
|
---|
80 | #define ILUT_ALLEGRO 1
|
---|
81 | #define ILUT_WIN32 2
|
---|
82 | #define ILUT_DIRECT3D8 3
|
---|
83 | #define ILUT_DIRECT3D9 4
|
---|
84 |
|
---|
85 | /*
|
---|
86 | // Includes specific config
|
---|
87 | #ifdef DJGPP
|
---|
88 | #define ILUT_USE_ALLEGRO
|
---|
89 | #elif _WIN32_WCE
|
---|
90 | #define ILUT_USE_WIN32
|
---|
91 | #elif _WIN32
|
---|
92 | //#ifdef __GNUC__ //__CYGWIN32__ (Cygwin seems to not define this with DevIL builds)
|
---|
93 | #define ILUT_USE_WIN32
|
---|
94 | #include "IL/config.h"
|
---|
95 |
|
---|
96 | // Temporary fix for the SDL main() linker bug.
|
---|
97 | //#ifdef ILUT_USE_SDL
|
---|
98 | //#undef ILUT_USE_SDL
|
---|
99 | //#endif//ILUT_USE_SDL
|
---|
100 |
|
---|
101 | //#else
|
---|
102 | // #define ILUT_USE_WIN32
|
---|
103 | // #define ILUT_USE_OPENGL
|
---|
104 | // #define ILUT_USE_SDL
|
---|
105 | // #define ILUT_USE_DIRECTX8
|
---|
106 | //#endif
|
---|
107 | #elif BEOS // Don't know the #define
|
---|
108 | #define ILUT_USE_BEOS
|
---|
109 | #define ILUT_USE_OPENGL
|
---|
110 | #elif MACOSX
|
---|
111 | #define ILUT_USE_OPENGL
|
---|
112 | #else
|
---|
113 |
|
---|
114 | // We are surely using a *nix so the configure script
|
---|
115 | // may have written the configured config.h header
|
---|
116 | #include "IL/config.h"
|
---|
117 | #endif
|
---|
118 | */
|
---|
119 |
|
---|
120 | #ifdef _WIN32
|
---|
121 | #if (defined(IL_USE_PRAGMA_LIBS)) && (!defined(_IL_BUILD_LIBRARY))
|
---|
122 | #if defined(_MSC_VER) || defined(__BORLANDC__)
|
---|
123 | #pragma comment(lib, "DevILUT.lib")
|
---|
124 | #endif
|
---|
125 | #endif
|
---|
126 | #endif
|
---|
127 |
|
---|
128 |
|
---|
129 |
|
---|
130 |
|
---|
131 | #include "IL/config.h"
|
---|
132 |
|
---|
133 | //////////////
|
---|
134 | // Opengl
|
---|
135 | //////////////
|
---|
136 |
|
---|
137 | #ifdef ILUT_USE_OPENGL
|
---|
138 | #if defined(_MSC_VER) || defined(_WIN32)
|
---|
139 | //#define WIN32_LEAN_AND_MEAN
|
---|
140 | #include <windows.h>
|
---|
141 | #endif//_MSC_VER
|
---|
142 |
|
---|
143 | #ifdef __APPLE__
|
---|
144 | #include <OpenGL/gl.h>
|
---|
145 | #include <OpenGL/glu.h>
|
---|
146 | #else
|
---|
147 | #include <GL/gl.h>
|
---|
148 | #include <GL/glu.h>
|
---|
149 | #endif//__APPLE__
|
---|
150 | #endif
|
---|
151 |
|
---|
152 |
|
---|
153 | #ifdef ILUT_USE_WIN32
|
---|
154 | //#define WIN32_LEAN_AND_MEAN
|
---|
155 | #include <windows.h>
|
---|
156 | #endif
|
---|
157 |
|
---|
158 |
|
---|
159 | //
|
---|
160 | // If we can avoid including these in all cases thing tend to break less
|
---|
161 | // and we can keep all of them defined as available
|
---|
162 | //
|
---|
163 | // Kriss
|
---|
164 | //
|
---|
165 |
|
---|
166 | // ImageLib Utility Toolkit's Allegro Functions
|
---|
167 | #ifdef ILUT_USE_ALLEGRO
|
---|
168 | // #include <allegro.h>
|
---|
169 | #endif//ILUT_USE_ALLEGRO
|
---|
170 |
|
---|
171 | #ifdef ILUT_USE_SDL
|
---|
172 | // #include <SDL.h>
|
---|
173 | #endif
|
---|
174 |
|
---|
175 | #ifdef ILUT_USE_DIRECTX8
|
---|
176 | // #include <d3d8.h>
|
---|
177 | #endif//ILUT_USE_DIRECTX9
|
---|
178 |
|
---|
179 | #ifdef ILUT_USE_DIRECTX9
|
---|
180 | // #include <d3d9.h>
|
---|
181 | #endif//ILUT_USE_DIRECTX9
|
---|
182 |
|
---|
183 |
|
---|
184 |
|
---|
185 | //-----------------------------------------------------------------------------
|
---|
186 | // Functions
|
---|
187 | //-----------------------------------------------------------------------------
|
---|
188 |
|
---|
189 | #ifdef __cplusplus
|
---|
190 | extern "C" {
|
---|
191 | #endif
|
---|
192 |
|
---|
193 | // ImageLib Utility Toolkit Functions
|
---|
194 | ILAPI ILboolean ILAPIENTRY ilutDisable(ILenum Mode);
|
---|
195 | ILAPI ILboolean ILAPIENTRY ilutEnable(ILenum Mode);
|
---|
196 | ILAPI ILboolean ILAPIENTRY ilutGetBoolean(ILenum Mode);
|
---|
197 | ILAPI ILvoid ILAPIENTRY ilutGetBooleanv(ILenum Mode, ILboolean *Param);
|
---|
198 | ILAPI ILint ILAPIENTRY ilutGetInteger(ILenum Mode);
|
---|
199 | ILAPI ILvoid ILAPIENTRY ilutGetIntegerv(ILenum Mode, ILint *Param);
|
---|
200 | ILAPI ILstring ILAPIENTRY ilutGetString(ILenum StringName);
|
---|
201 | ILAPI ILvoid ILAPIENTRY ilutInit(ILvoid);
|
---|
202 | ILAPI ILboolean ILAPIENTRY ilutIsDisabled(ILenum Mode);
|
---|
203 | ILAPI ILboolean ILAPIENTRY ilutIsEnabled(ILenum Mode);
|
---|
204 | ILAPI ILvoid ILAPIENTRY ilutPopAttrib(ILvoid);
|
---|
205 | ILAPI ILvoid ILAPIENTRY ilutPushAttrib(ILuint Bits);
|
---|
206 | ILAPI ILvoid ILAPIENTRY ilutSetInteger(ILenum Mode, ILint Param);
|
---|
207 |
|
---|
208 | ILAPI ILboolean ILAPIENTRY ilutRenderer(ILenum Renderer);
|
---|
209 |
|
---|
210 |
|
---|
211 | // ImageLib Utility Toolkit's OpenGL Functions
|
---|
212 | #ifdef ILUT_USE_OPENGL
|
---|
213 | ILAPI GLuint ILAPIENTRY ilutGLBindTexImage();
|
---|
214 | ILAPI GLuint ILAPIENTRY ilutGLBindMipmaps(ILvoid);
|
---|
215 | ILAPI ILboolean ILAPIENTRY ilutGLBuildMipmaps(ILvoid);
|
---|
216 | ILAPI GLuint ILAPIENTRY ilutGLLoadImage(const ILstring FileName);
|
---|
217 | ILAPI ILboolean ILAPIENTRY ilutGLScreen(ILvoid);
|
---|
218 | ILAPI ILboolean ILAPIENTRY ilutGLScreenie(ILvoid);
|
---|
219 | ILAPI ILboolean ILAPIENTRY ilutGLSaveImage(const ILstring FileName, GLuint TexID);
|
---|
220 | ILAPI ILboolean ILAPIENTRY ilutGLSetTex(GLuint TexID);
|
---|
221 | ILAPI ILboolean ILAPIENTRY ilutGLTexImage(GLuint Level);
|
---|
222 | ILAPI ILboolean ILAPIENTRY ilutGLSubTex(GLuint TexID, ILuint XOff, ILuint YOff);
|
---|
223 | #endif//ILUT_USE_OPENGL
|
---|
224 |
|
---|
225 |
|
---|
226 | // ImageLib Utility Toolkit's Allegro Functions
|
---|
227 | #ifdef ILUT_USE_ALLEGRO
|
---|
228 |
|
---|
229 | #ifdef __cplusplus
|
---|
230 | }
|
---|
231 | #endif
|
---|
232 | #include <allegro.h>
|
---|
233 | #ifdef __cplusplus
|
---|
234 | extern "C" {
|
---|
235 | #endif
|
---|
236 |
|
---|
237 | ILAPI BITMAP* ILAPIENTRY ilutAllegLoadImage(const ILstring FileName);
|
---|
238 | ILAPI BITMAP* ILAPIENTRY ilutConvertToAlleg(PALETTE Pal);
|
---|
239 | #endif//ILUT_USE_ALLEGRO
|
---|
240 |
|
---|
241 |
|
---|
242 | // ImageLib Utility Toolkit's SDL Functions
|
---|
243 | #ifdef ILUT_USE_SDL
|
---|
244 | ILAPI struct SDL_Surface* ILAPIENTRY ilutConvertToSDLSurface(unsigned int flags);
|
---|
245 | ILAPI struct SDL_Surface* ILAPIENTRY ilutSDLSurfaceLoadImage(const ILstring FileName);
|
---|
246 | ILAPI ILboolean ILAPIENTRY ilutSDLSurfaceFromBitmap(struct SDL_Surface *Bitmap);
|
---|
247 | #endif//ILUT_USE_SDL
|
---|
248 |
|
---|
249 |
|
---|
250 | // ImageLib Utility Toolkit's BeOS Functions
|
---|
251 | #ifdef ILUT_USE_BEOS
|
---|
252 | ILAPI BBitmap ILAPIENTRY ilutConvertToBBitmap(ILvoid);
|
---|
253 | #endif//ILUT_USE_BEOS
|
---|
254 |
|
---|
255 |
|
---|
256 | // ImageLib Utility Toolkit's Win32 GDI Functions
|
---|
257 | #ifdef ILUT_USE_WIN32
|
---|
258 | ILAPI HBITMAP ILAPIENTRY ilutConvertToHBitmap(HDC hDC);
|
---|
259 | ILAPI HBITMAP ILAPIENTRY ilutConvertSliceToHBitmap(HDC hDC, ILuint slice);
|
---|
260 | ILAPI ILvoid ILAPIENTRY ilutFreePaddedData(ILubyte *Data);
|
---|
261 | ILAPI ILvoid ILAPIENTRY ilutGetBmpInfo(BITMAPINFO *Info);
|
---|
262 | ILAPI HPALETTE ILAPIENTRY ilutGetHPal(ILvoid);
|
---|
263 | ILAPI ILubyte* ILAPIENTRY ilutGetPaddedData(ILvoid);
|
---|
264 | ILAPI ILboolean ILAPIENTRY ilutGetWinClipboard(ILvoid);
|
---|
265 | ILAPI ILboolean ILAPIENTRY ilutLoadResource(HINSTANCE hInst, ILint ID, const ILstring ResourceType, ILenum Type);
|
---|
266 | ILAPI ILboolean ILAPIENTRY ilutSetHBitmap(HBITMAP Bitmap);
|
---|
267 | ILAPI ILboolean ILAPIENTRY ilutSetHPal(HPALETTE Pal);
|
---|
268 | ILAPI ILboolean ILAPIENTRY ilutSetWinClipboard(ILvoid);
|
---|
269 | ILAPI HBITMAP ILAPIENTRY ilutWinLoadImage(const ILstring FileName, HDC hDC);
|
---|
270 | ILAPI ILboolean ILAPIENTRY ilutWinLoadUrl(const ILstring Url);
|
---|
271 | ILAPI ILboolean ILAPIENTRY ilutWinPrint(ILuint XPos, ILuint YPos, ILuint Width, ILuint Height, HDC hDC);
|
---|
272 | ILAPI ILboolean ILAPIENTRY ilutWinSaveImage(const ILstring FileName, HBITMAP Bitmap);
|
---|
273 | #endif//ILUT_USE_WIN32
|
---|
274 |
|
---|
275 | // ImageLib Utility Toolkit's DirectX 8 Functions
|
---|
276 | #ifdef ILUT_USE_DIRECTX8
|
---|
277 | // ILAPI ILvoid ILAPIENTRY ilutD3D8MipFunc(ILuint NumLevels);
|
---|
278 | ILAPI struct IDirect3DTexture8* ILAPIENTRY ilutD3D8Texture(struct IDirect3DDevice8 *Device);
|
---|
279 | ILAPI struct IDirect3DVolumeTexture8* ILAPIENTRY ilutD3D8VolumeTexture(struct IDirect3DDevice8 *Device);
|
---|
280 | ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DTexture8 **Texture);
|
---|
281 | ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFile(struct IDirect3DDevice8 *Device, char *FileName, struct IDirect3DVolumeTexture8 **Texture);
|
---|
282 | ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileInMemory(struct IDirect3DDevice8 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DTexture8 **Texture);
|
---|
283 | ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileInMemory(struct IDirect3DDevice8 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DVolumeTexture8 **Texture);
|
---|
284 | ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DTexture8 **Texture);
|
---|
285 | ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromFileHandle(struct IDirect3DDevice8 *Device, ILHANDLE File, struct IDirect3DVolumeTexture8 **Texture);
|
---|
286 | // These two are not tested yet.
|
---|
287 | ILAPI ILboolean ILAPIENTRY ilutD3D8TexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture8 **Texture);
|
---|
288 | ILAPI ILboolean ILAPIENTRY ilutD3D8VolTexFromResource(struct IDirect3DDevice8 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture8 **Texture);
|
---|
289 | ILAPI ILboolean ILAPIENTRY ilutD3D8LoadSurface(struct IDirect3DDevice8 *Device, struct IDirect3DSurface8 *Surface);
|
---|
290 | #endif//ILUT_USE_DIRECTX8
|
---|
291 |
|
---|
292 | #ifdef ILUT_USE_DIRECTX9
|
---|
293 | // ILAPI ILvoid ILAPIENTRY ilutD3D9MipFunc(ILuint NumLevels);
|
---|
294 | ILAPI struct IDirect3DTexture9* ILAPIENTRY ilutD3D9Texture (struct IDirect3DDevice9* Device);
|
---|
295 | ILAPI struct IDirect3DVolumeTexture9* ILAPIENTRY ilutD3D9VolumeTexture (struct IDirect3DDevice9* Device);
|
---|
296 |
|
---|
297 | ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFile(struct IDirect3DDevice9 *Device, char *FileName, struct IDirect3DTexture9 **Texture);
|
---|
298 | ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFile(struct IDirect3DDevice9 *Device, char *FileName, struct IDirect3DVolumeTexture9 **Texture);
|
---|
299 | ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileInMemory(struct IDirect3DDevice9 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DTexture9 **Texture);
|
---|
300 | ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileInMemory(struct IDirect3DDevice9 *Device, ILvoid *Lump, ILuint Size, struct IDirect3DVolumeTexture9 **Texture);
|
---|
301 | ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DTexture9 **Texture);
|
---|
302 | ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromFileHandle(struct IDirect3DDevice9 *Device, ILHANDLE File, struct IDirect3DVolumeTexture9 **Texture);
|
---|
303 |
|
---|
304 | // These two are not tested yet.
|
---|
305 | ILAPI ILboolean ILAPIENTRY ilutD3D9TexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DTexture9 **Texture);
|
---|
306 | ILAPI ILboolean ILAPIENTRY ilutD3D9VolTexFromResource(struct IDirect3DDevice9 *Device, HMODULE SrcModule, char *SrcResource, struct IDirect3DVolumeTexture9 **Texture);
|
---|
307 | ILAPI ILboolean ILAPIENTRY ilutD3D9LoadSurface(struct IDirect3DDevice9 *Device, struct IDirect3DSurface9 *Surface);
|
---|
308 | #endif//ILUT_USE_DIRECTX9
|
---|
309 |
|
---|
310 | #ifdef __cplusplus
|
---|
311 | }
|
---|
312 | #endif
|
---|
313 |
|
---|
314 | #endif // __ILUT_H__
|
---|
315 | #endif // __ilut_h_
|
---|