00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
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
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