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