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: John Pollard                                                                */
00005 /*  Description: THandle manager for D3DDrv                                             */
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 /*  The Original Code is Genesis3D, released March 25, 1999.                            */
00018 /*  Genesis3D Version 1.1 released November 15, 1999                                 */
00019 /*  Copyright (C) 1999 WildTangent, Inc. All Rights Reserved           */
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                       8                       // Max lightmap size in pixels will be 128x128
00037 //#define       MAX_LMAP_LOG_SIZE                       7                       // Max lightmap size in pixels will be 64x64
00038 #define MAX_LMAP_LOG_SIZE                       6                       // Max lightmap size in pixels will be 32x32
00039 
00040 typedef struct
00041 {
00042         LPDIRECTDRAWSURFACE4    Surface;                        // The DD surface
00043         D3DCache_Type                   *CacheType;
00044         D3DCache_Slot                   *Slot;
00045         
00046         LPDIRECT3DTEXTURE2              Texture;                        // The texture interface to the surface
00047 
00048         uint8                                   Flags;
00049 } THandle_MipData;
00050 
00051 // THandle flags
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;                               // A mipdata per miplevel
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

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