00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef THANDLE_H
00023 #define THANDLE_H
00024
00025 #include <Windows.h>
00026
00027 #include "BaseType.h"
00028 #include "DCommon.h"
00029 #include "D3DCache.h"
00030
00031 #include "TPage.h"
00032
00033
00034
00035 #define THANDLE_MAX_MIP_LEVELS 255
00036 #define MAX_LMAP_LOG_SIZE 6 // Max lightmap size in pixels will be 32x32
00037
00038 typedef struct
00039 {
00040 LPDIRECTDRAWSURFACE4 Surface;
00041 D3DCache_Type *CacheType;
00042 D3DCache_Slot *Slot;
00043
00044 LPDIRECT3DTEXTURE2 Texture;
00045
00046 uint8 Flags;
00047 } THandle_MipData;
00048
00049
00050 #define THANDLE_LOCKED (1<<0)
00051 #define THANDLE_UPDATE (1<<1)
00052
00053 typedef struct geRDriver_THandle
00054 {
00055 uint8 Active;
00056 int32 Width;
00057 int32 Height;
00058 int32 Stride;
00059 uint8 NumMipLevels;
00060 uint8 Log;
00061
00062 THandle_MipData *MipData;
00063
00064 geRDriver_PixelFormat PixelFormat;
00065
00066
00067 } geRDriver_THandle;
00068
00069 extern geRDriver_THandle TextureHandles[];
00070
00071 extern D3DCache *TextureCache;
00072 extern D3DCache *LMapCache;
00073
00074 extern TPage_Mgr *TPageMgr;
00075
00076 extern THandle_MipData SystemToVideo[];
00077
00078 extern CacheNeedsUpdate;
00079
00080
00081
00082 void FreeAllCaches(void);
00083 geRDriver_THandle *FindTextureHandle(void);
00084 geBoolean FreeAllTextureHandles(void);
00085 geBoolean THandle_Startup(void);
00086 void THandle_Shutdown(void);
00087 geRDriver_THandle *Create3DTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00088 geRDriver_THandle *CreateLightmapTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00089 geRDriver_THandle *Create2DTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00090 geRDriver_THandle *DRIVERCC THandle_Create(int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00091 geBoolean DRIVERCC THandle_Destroy(geRDriver_THandle *THandle);
00092 geBoolean DRIVERCC THandle_Lock(geRDriver_THandle *THandle, int32 MipLevel, void **Bits);
00093 geBoolean DRIVERCC THandle_UnLock(geRDriver_THandle *THandle, int32 MipLevel);
00094 geBoolean DRIVERCC THandle_GetInfo(geRDriver_THandle *THandle, int32 MipLevel, geRDriver_THandleInfo *Info);
00095 geBoolean CreateSystemToVideoSurfaces(void);
00096 void DestroySystemToVideoSurfaces(void);
00097 geBoolean THandle_CreateSurfaces(THandle_MipData *MipData, int32 Width, int32 Height, DDSURFACEDESC2 *SurfDesc, geBoolean ColorKey, int32 Stage);
00098 void THandle_DestroySurfaces(THandle_MipData *MipData);
00099 geBoolean THandle_CheckCache(void);
00100
00101 #endif