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                       6                       // Max lightmap size in pixels will be 32x32
00037 
00038 typedef struct
00039 {
00040         LPDIRECTDRAWSURFACE4    Surface;                        // The DD surface
00041         D3DCache_Type                   *CacheType;
00042         D3DCache_Slot                   *Slot;
00043         
00044         LPDIRECT3DTEXTURE2              Texture;                        // The texture interface to the surface
00045 
00046         uint8                                   Flags;
00047 } THandle_MipData;
00048 
00049 // THandle flags
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;                               // A mipdata per miplevel
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

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