![]()
DCommon
Description: Header file for all driver modules
Source file: ...\genesis3d\OpenSource\Source\Engine\Drivers\dcommon.h
Types:
U8, U16, U32, C8, S8, S16, S32, geRDriver_THandle, geRDriver_PixelFormat, geRDriver_THandleInfo, DRV_Debug, DRV_CacheInfo, DRV_Window, DRV_RGB, DRV_Palette, DRV_Bitmap, DRV_LInfo, DRV_TexInfo, DRV_TLVertex, DRV_DriverHook, GInfo, DRV_EngineSettings, BEGIN_MESHES, BEGIN_MODELS, BEGIN_SCENE, BEGIN_WORLD, CREATE_TEXTURE, DESTROY_TEXTURE, DRAW_DECAL, DRV_Driver, DRV_RENDER_MODE , DRV_ENUM_MODES, DRV_ENUM_DRIVER, DRV_ENUM_PFORMAT, DRV_ENUM_MODES_CB, DRV_ENUM_DRV_CB, DRV_ENUM_PFORMAT_CB, DRV_Hook, DRV_INIT, DRV_RESET, DRV_SET_ACTIVE, DRV_SET_FOG_ENABLE, DRV_SHUTDOWN, DRV_UPDATE_WINDOW, END_MESHES, END_MODELS, END_SCENE, END_WORLD, GET_ALPHA, GET_GAMMA, GET_PALETTE, LOCK_THANDLE, RENDER_G_POLY, RENDER_MT_POLY, RENDER_W_POLY, SCREEN_SHOT, SET_ALPHA, SET_GAMMA, SETUP_LIGHTMAP_CB, SET_PALETTE, THANDLE_GET_INFO, UNLOCK_THANDLE DRV_RENDER_POLY_NO_FOGConstants:
here
![]()
Types:
#ifndef WINVER //If not using windows version, then must define some "Windows" types
#endif // WINVER
typedef uint8 U8; //only if: #ifndef US_TYPEDEFS
typedef uint16 U16; //only if: #ifndef US_TYPEDEFS
typedef uint32 U32; //only if: #ifndef US_TYPEDEFS
typedef char C8; //only if: #ifndef US_TYPEDEFS
typedef int8 S8; //only if: #ifndef US_TYPEDEFS
typedef int16 S16; //only if: #ifndef US_TYPEDEFS
typedef int32 S32; //only if: #ifndef US_TYPEDEFS
typedef struct geRDriver_THandle geRDriver_THandle;
typedef DRV_RGB DRV_Palette[DRV_PALETTE_ENTRIES];
// Bitmap hook DRV_Bitmap; into the drivers (engine uses these explicitly as is)
// Lightmap hook into the drivers (Engine uses these exlicitly as is...)
// Lightmap info
typedef struct {
float x,y,z; // float 3d z value
float u,v; // float texture coords
float r,g,b,a; // Color of point, and Alpha
} DRV_TLVertex;
![]()
Enumeration defines
typedef geBoolean DRV_ENUM_MODES_CB(S32 Mode, char * ModeName, S32 Width, S32 Height, void * Context);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_ENUM_MODES(S32 Driver, char * DriverName, DRV_ENUM_MODES_CB* Cb, void * Context);
Return to Contents
![]()
typedef geBoolean DRV_ENUM_DRV_CB(S32 Driver, char * DriverName, void * Context);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_ENUM_DRIVER(DRV_ENUM_DRV_CB* Cb, void * Context);
Note: if #ifdef _BCB, then a third parameter, void * e, is added. This must to passed with BasetypesIndexed.htm - NULLNULL... it is a dummy parameter
Return to Contents
![]()
typedef geBoolean DRV_ENUM_PFORMAT_CB(geRDriver_PixelFormat* Format, void * Context);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_ENUM_PFORMAT(DRV_ENUM_PFORMAT_CB* Cb, void * Context);
Return to Contents
![]()
Create/Destroy/Etc Driver function types
![]()
typedef geBoolean DRIVERCC DRV_INIT(DRV_DriverHook* Hook);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_SHUTDOWN(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_RESET(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_UPDATE_WINDOW(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_SET_ACTIVE(geBoolean active);
Return to Contents
![]()
Texture surface function types
typedef geRDriver_THandle* DRIVERCC CREATE_TEXTURE(int32 Width, int32 Height, int32 NumMipLevels, const geRDriver_PixelFormat* PixelFormat);
Return to Contents
![]()
typedef geBoolean DRIVERCC DESTROY_TEXTURE(geRDriver_THandle* THandle);
Return to Contents
![]()
typedef geBoolean DRIVERCC LOCK_THANDLE(geRDriver_THandle* THandle, int32 MipLevel, void ** Data);
Return to Contents
![]()
typedef geBoolean DRIVERCC UNLOCK_THANDLE(geRDriver_THandle* THandle, int32 MipLevel);
Return to Contents
![]()
typedef geBoolean DRIVERCC SET_PALETTE(geRDriver_THandle* THandle, geRDriver_THandle* PalHandle);
Return to Contents
![]()
typedef geRDriver_THandle* DRIVERCC GET_PALETTE(geRDriver_THandle* THandle);
Return to Contents
![]()
typedef geBoolean DRIVERCC SET_ALPHA(geRDriver_THandle* THandle, geRDriver_THandle* PalHandle);
Return to Contents
![]()
typedef geRDriver_THandle* DRIVERCC GET_ALPHA(geRDriver_THandle* THandle);
Return to Contents
![]()
typedef geBoolean DRIVERCC THANDLE_GET_INFO(geRDriver_THandle* THandle, int32 MipLevel, geRDriver_THandleInfo* Info);
Return to Contents
![]()
Scene management function types
typedef geBoolean DRIVERCC BEGIN_SCENE(geBoolean Clear, geBoolean ClearZ, RECT* WorldRect);
Return to Contents
![]()
typedef geBoolean DRIVERCC END_SCENE(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC BEGIN_WORLD(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC END_WORLD(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC BEGIN_MESHES(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC END_MESHES(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC BEGIN_MODELS(void);
Return to Contents
![]()
typedef geBoolean DRIVERCC END_MODELS(void);
Return to Contents
![]()
Render function types
typedef geBoolean DRIVERCC RENDER_G_POLY(DRV_TLVertex* Pnts, S32 NumPoints, U32 Flags);
Use THESE for Flags
Return to Contents
![]()
typedef geBoolean DRIVERCC RENDER_W_POLY(DRV_TLVertex* Pnts, S32 NumPoints, geRDriver_THandle* THandle, DRV_TexInfo* TexInfo, DRV_LInfo* LInfo, U32 Flags);
Use THESE for Flags
Return to Contents
![]()
typedef geBoolean DRIVERCC RENDER_MT_POLY(DRV_TLVertex* Pnts, S32 NumPoints, geRDriver_THandle* THandle, U32 Flags);
Use THESE for Flags
Return to Contents
![]()
typedef geBoolean DRIVERCC DRAW_DECAL(geRDriver_THandle* THandle, RECT* SRect, int32 x, int32 y);
Return to Contents
![]()
typedef geBoolean DRIVERCC SCREEN_SHOT(const char * Name);
Return to Contents
![]()
typedef geBoolean DRIVERCC SET_GAMMA(float Gamma);
Return to Contents
![]()
typedef geBoolean DRIVERCC GET_GAMMA(float * Gamma);
Return to Contents
![]()
typedef geBoolean DRIVERCC DRV_SET_FOG_ENABLE(geBoolean Enable, float r, float g, float b, float Start, float End);
Return to Contents
![]()
typedef void SETUP_LIGHTMAP_CB(DRV_LInfo* LInfo, geBoolean* Dynamic);
Return to Contents
![]()
typedef geBoolean DRV_Hook(DRV_Driver** Hook);
Return to Contents
![]()
#define DRIVERCC _fastcall // (or __fastcall #ifdef _BCB)
#ifndef __cplusplus
#define DllImport __declspec( dllimport )
#define DllExport __declspec( dllexport )
#else
#define DllImport extern "C" __declspec( dllimport )
#define DllExport extern "C" __declspec( dllexport )
#endif
#define DRV_PALETTE_ENTRIES 256
// Render Flags for ALL render functions
#define DRV_RENDER_ALPHA (1<<0) // Render function should expect alpha set in vertices
#define DRV_RENDER_FLUSH (1<<1) // Render function should gaurentee that this render happens NOW
#define DRV_RENDER_NO_ZMASK (1<<2) // No zbuffering should be performed
#define DRV_RENDER_NO_ZWRITE (1<<3) // No z writing will be performed
#define DRV_RENDER_CLAMP_UV (1<<4) // Clamp UV in both directions
//The following added for Genesis3D 1.6
#define DRV_RENDER_POLY_NO_FOG (1<<5) // Don't render this poly with fog
#define LMAP_TYPE_LIGHT 0
#define LMAP_TYPE_FOG 1
// PolyMode flags (A method to override how polys are drawn for debugging purposes...)
// Put these in the poly flags!!! They are currently not used right now...
#define DRV_POLYMODE_NORMAL 1 // Draw as is
#define DRV_POLYMODE_GOURAUD 2 // Gouraud only
#define DRV_POLYMODE_LINES 3 // Outlines only
#define DRV_VERSION_MAJOR 100 // Genesis 1.0
#define DRV_VERSION_MINOR 3 // >= 3.0 added fog
#define DRV_VMAJS "100"
#define DRV_VMINS "3"
#define RDRIVER_THANDLE_HAS_COLORKEY (1<<0) // The thandle is using color keying
#define RDRIVER_PF_2D_SHIFT (0) // Supports being used as a 2d decal surface
#define RDRIVER_PF_3D_SHIFT (1) // Supports being used as a 3d poly surface
#define RDRIVER_PF_LIGHTMAP_SHIFT (2) // Surface is a lightmap surface
#define RDRIVER_PF_PALETTE_SHIFT (3) // Surface is a palette
#define RDRIVER_PF_ALPHA_SHIFT (4) // Surface is an alpha map
#define RDRIVER_PF_OPTIONAL_SHIFT (16)
#define RDRIVER_PF_HAS_ALPHA_SHIFT (RDRIVER_PF_OPTIONAL_SHIFT + 0) // Surface can take an alpha map
#define RDRIVER_PF_CAN_DO_COLORKEY_SHIFT (RDRIVER_PF_OPTIONAL_SHIFT + 1) // Surface supports colorkeying
#define RDRIVER_PF_COMBINE_LIGHTMAP_SHIFT (RDRIVER_PF_OPTIONAL_SHIFT + 2) // Supports being rendered with a lightmap (3d will be set as well)
#define RDRIVER_PF_2D (1<<RDRIVER_PF_2D_SHIFT)
#define RDRIVER_PF_3D (1<<RDRIVER_PF_3D_SHIFT)
#define RDRIVER_PF_LIGHTMAP (1<<RDRIVER_PF_LIGHTMAP_SHIFT)
#define RDRIVER_PF_COMBINE_LIGHTMAP (1<<RDRIVER_PF_COMBINE_LIGHTMAP_SHIFT)
#define RDRIVER_PF_PALETTE (1<<RDRIVER_PF_PALETTE_SHIFT)
#define RDRIVER_PF_ALPHA (1<<RDRIVER_PF_ALPHA_SHIFT)
#define RDRIVER_PF_CAN_DO_COLORKEY (1<<RDRIVER_PF_CAN_DO_COLORKEY_SHIFT)
#define RDRIVER_PF_HAS_ALPHA (1<<RDRIVER_PF_HAS_ALPHA_SHIFT)
#define RDRIVER_PF_MAJOR_MASK ((1<<RDRIVER_PF_OPTIONAL_SHIFT)-1)
// What the driver can support as far as texture mapping is concerned
#define DRV_SUPPORT_ALPHA (1<<0) // Driver can do alpha blending
#define DRV_SUPPORT_COLORKEY (1<<1) // Driver can do pixel masking
#define DRV_SUPPORT_GAMMA (1<<2) // Gamma function works with the driver
// A hint to the engine as far as what to turn on and off...
#define DRV_PREFERENCE_NO_MIRRORS (1<<0) // Engine should NOT render mirrors
#define DRV_PREFERENCE_SORT_WORLD_FB (1<<1) // Sort world Front to Back
#define DRV_PREFERENCE_SORT_WORLD_BF (1<<2) // Sort world Back to Front
#define DRV_PREFERENCE_DRAW_WALPHA_IN_BSP (1<<3) // Draw world alphas in BSP sort
// Error defines set by the driver. These will be in the LastError member of DRV_Driver
// structure. LastErrorStr will contain a NULL terminated detail error string set by the driver
#define DRV_ERROR_NONE 0 // No error has occured
#define DRV_ERROR_INVALID_PARMS 1 // invalid parameters passed
#define DRV_ERROR_NULL_WINDOW 2 // Null window supplied
#define DRV_ERROR_INIT_ERROR 3 // Error intitializing
#define DRV_ERROR_INVALID_REGISTER_MODE 4 // Invalid register mode
#define DRV_ERROR_NO_MEMORY 5 // Not enough ram
#define DRV_ERROR_MAX_TEXTURES 6 // Max texture capacity has been exceeded...
#define DRV_ERROR_GENERIC 7 // Generic error
#define DRV_ERROR_UNDEFINED 8 // An undefined error has occured
#define DRV_ERROR_INVALID_WINDOW_MODE 9 // Requested window/full not supported