Main Page | Alphabetical List | Compound List | File List | Compound Members | File Members

THandle.h

Go to the documentation of this file.
00001 /****************************************************************************************/
00002 /*  THandle.h                                                                           */
00003 /*                                                                                      */
00004 /*  Author: George McBay (gfm@my-deja.com)                                              */
00005 /*  Description: Texture handle manager for OpenGL driver                               */
00006 /*                                                                                      */
00007 /*  The contents of this file are subject to the Genesis3D Public License               */
00008 /*  Version 1.01 (the "License"); you may not use this file except in                   */
00009 /*  compliance with the License. You may obtain a copy of the License at                */
00010 /*  http://www.genesis3d.com                                                            */
00011 /*                                                                                      */
00012 /*  Software distributed under the License is distributed on an "AS IS"                 */
00013 /*  basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.  See                */
00014 /*  the License for the specific language governing rights and limitations              */
00015 /*  under the License.                                                                  */
00016 /*                                                                                      */
00017 /*                                                                                      */
00018 /****************************************************************************************/
00019 
00020 #ifndef THANDLE_H
00021 #define THANDLE_H
00022 
00023 #include <windows.h>
00024 #include <gl/gl.h>
00025 #include <gl/glu.h>
00026 
00027 #include "DCommon.h"
00028 #include "OglMisc.h"
00029 
00030 #define MAX_TEXTURE_HANDLES                     20000
00031 #define THANDLE_MAX_MIP_LEVELS          16
00032 
00033 // THandle flags
00034 #define THANDLE_UPDATE          (1<<0)          // Force a thandle to be uploaded to the card
00035 #define THANDLE_TRANS           (1<<2)          // Texture has transparency
00036 #define THANDLE_LOCKED          (1<<3)          // THandle is currently locked (invalid for rendering etc)
00037 #define THANDLE_UPDATE_LM       (1<<4)          // THandle is a lightmap that needs updating
00038 
00039 typedef struct geRDriver_THandle
00040 {
00041         GLboolean                               Active;
00042         GLint                                   Width, Height, MipLevels;
00043         GLint                                   PaddedWidth, PaddedHeight;
00044         geRDriver_PixelFormat   PixelFormat;
00045         GLuint                                  Flags;
00046         GLint                                   TextureID;
00047         GLubyte                                 *Data[THANDLE_MAX_MIP_LEVELS];
00048         GLfloat                                 InvScale;
00049 } geRDriver_THandle;
00050 
00051 extern  geRDriver_THandle       TextureHandles[MAX_TEXTURE_HANDLES];
00052 
00053 geBoolean                                               FreeAllTextureHandles(void);
00054 geBoolean                       DRIVERCC        DrvResetAll(void);
00055 geRDriver_THandle       *DRIVERCC       THandle_Create(int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00056 geBoolean                       DRIVERCC        THandle_Destroy(geRDriver_THandle *THandle);
00057 geBoolean                       DRIVERCC        THandle_Lock(geRDriver_THandle *THandle, int32 MipLevel, void **Data);
00058 geBoolean                       DRIVERCC        THandle_UnLock(geRDriver_THandle *THandle, int32 MipLevel);
00059 geBoolean                       DRIVERCC        THandle_GetInfo(geRDriver_THandle *THandle, int32 MipLevel, geRDriver_THandleInfo *Info);
00060 void                                                    THandle_Update(geRDriver_THandle *THandle);
00061 void                                                    THandle_DownloadLightmap(DRV_LInfo *LInfo);
00062 
00063 int32 GetLog(int32 Width, int32 Height);
00064 uint32 Log2(uint32 P2);
00065 S32 SnapToPower2(S32 Width);
00066 
00067 geBoolean THandle_Startup(void);
00068 
00069 #endif

Generated on Tue Sep 30 12:36:30 2003 for GTestAndEngine by doxygen 1.3.2