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
00037
00038 #define MAX_LMAP_LOG_SIZE 6 // Max lightmap size in pixels will be 32x32
00039
00040 typedef struct
00041 {
00042 LPDIRECTDRAWSURFACE4 Surface;
00043 D3DCache_Type *CacheType;
00044 D3DCache_Slot *Slot;
00045
00046 LPDIRECT3DTEXTURE2 Texture;
00047
00048 uint8 Flags;
00049 } THandle_MipData;
00050
00051
00052 #define THANDLE_LOCKED (1<<0)
00053 #define THANDLE_UPDATE (1<<1)
00054
00055 typedef struct geRDriver_THandle
00056 {
00057 uint8 Active;
00058 int32 Width;
00059 int32 Height;
00060 int32 Stride;
00061 uint8 NumMipLevels;
00062 uint8 Log;
00063
00064 THandle_MipData *MipData;
00065
00066 geRDriver_PixelFormat PixelFormat;
00067
00068 #ifdef USE_TPAGES
00069 TPage_Block *Block;
00070 #endif
00071
00072 } geRDriver_THandle;
00073
00074 extern geRDriver_THandle TextureHandles[];
00075
00076 extern D3DCache *TextureCache;
00077 extern D3DCache *LMapCache;
00078
00079 extern TPage_Mgr *TPageMgr;
00080
00081 extern THandle_MipData SystemToVideo[];
00082
00083 extern CacheNeedsUpdate;
00084
00085
00086
00087 void FreeAllCaches(void);
00088 geRDriver_THandle *FindTextureHandle(void);
00089 geBoolean FreeAllTextureHandles(void);
00090 geBoolean THandle_Startup(void);
00091 void THandle_Shutdown(void);
00092 geRDriver_THandle *Create3DTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00093 geRDriver_THandle *CreateLightmapTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00094 geRDriver_THandle *Create2DTHandle(geRDriver_THandle *THandle, int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00095 geRDriver_THandle *DRIVERCC THandle_Create(int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat *PixelFormat);
00096 geBoolean DRIVERCC THandle_Destroy(geRDriver_THandle *THandle);
00097 geBoolean DRIVERCC THandle_Lock(geRDriver_THandle *THandle, int32 MipLevel, void **Bits);
00098 geBoolean DRIVERCC THandle_UnLock(geRDriver_THandle *THandle, int32 MipLevel);
00099 geBoolean DRIVERCC THandle_GetInfo(geRDriver_THandle *THandle, int32 MipLevel, geRDriver_THandleInfo *Info);
00100 geBoolean CreateSystemToVideoSurfaces(void);
00101 void DestroySystemToVideoSurfaces(void);
00102 geBoolean THandle_CreateSurfaces(THandle_MipData *MipData, int32 Width, int32 Height, DDSURFACEDESC2 *SurfDesc, geBoolean ColorKey, int32 Stage);
00103 void THandle_DestroySurfaces(THandle_MipData *MipData);
00104 geBoolean THandle_CheckCache(void);
00105
00106 #endif