#ifndef TDx9_3DDeviceH #define TDx9_3DDeviceH // ========================================================================== // File: TDx9_3DDevice.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_3DDevice Component // // "TDx9_Graphics_Library v1.00" // (c) 2005 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx9_Graphics_Library_Defns.H" #include "TDx9_Graphics_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_3DDevice methods. class TDx9_3DSurface; class TDx9_3DSwapChain; class TDx9_3DCubeTexture; class TDx9_3DIndexBuffer; class TDx9_3DPixelShader; class TDx9_3DQuery; class TDx9_3DStateBlock; class TDx9_3DTexture; class TDx9_3DVertexBuffer; class TD3DVertexElement; class TDx9_3DVertexDeclaration; class TDx9_3DVertexShader; class TDx9_3DVolumeTexture; class TDx9_3D; class TDx9_3DBaseTexture; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_3DDevice // Description: The TDx9_3DDevice component wraps the DirectX // IDirect3DDevice9 interface which acts as the primary // interface between the hardware adapter and the application. // // Weighing in at 118 methods, this is the largest and most // important component of the TDx9_Graphics_Library. // With it you can perform a large range of device related // tasks, including: // Creation of cube, volume and standard textures, vertex and // index buffers, vertex shaders and declarations, pixel // shaders, status queries and state blocks, depth stencil, // plain offscreen and render target surfaces as well as // additional swap chains. // Beginning the scene, rendering primitives of indexed, indexed // with a user memory pointer, non indexed or non indexed with a // user memory pointer geometries, drawing rectangular or // triangular patches and then ending the scene and presenting // it for display. // Retrieve and define clipping planes and status, the texture // palette, depth stencil surface, flexibile vertex format (FVF) // settings, palette entries, gamma ramp, lighting, material, n // patches, vertex and pixel shaders and vertex and pixel shader // constants, render state and surface, sampler state, scissor // rectangle, vertex processing mode and declarations, index // data, device data stream source and frequency, texture stages // and stage state, transform matrices and the viewport // parameters. // Retrieve the cooperative level, available texture memory, // ability to render the current texture blend settings, a back // buffer surface, creation parameters or capabilities of the // device, the associated TDx9_3D, display mode, a copy of front // buffer or render target data, lighting status, number of // implicit swap chains or a swap chain pointer and the monitor // raster status. // In addition there are methods to clear or color fill // surfaces, start and stop recording device state blocks, free // higher order patches, evict all managed resources from device // memory, define cursor position or properties, toggle lighting // parameters or cursor display or dialog box mode, reset the // swap chain, multiply matrices, process vertices, copy the // same or different sized rectangles from one surface to // another and update dirty texture regions. // // TDx9_3D::CreateDevice() can be used to instantiate this // component. // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_3DDevice : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_3DDevice : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_3DDevice::Create() method after it has successfully // created the internal LPDIRECT3DDEVICE9 used within the // TDx9_3DDevice component. // // Note that since this event is only called upon successful // creation, this event is an ideal place for code that is // to be activated only once, immediately upon the // successful creation of the LPDIRECT3DDEVICE9 interface. // // For example, you could retrieve the TDx9_3DDevice // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the // TDx9_3DDevice::OnDestroy() event, you can fully automate // and insulate your code on a per-component basis. // ---------------------------------------------------------------------- __property TDx_Event OnCreate = {read=FOnCreate, write=FOnCreate, nodefault}; // ---------------------------------------------------------------------- // Event: OnDestroy() // Description: The OnDestroy() event is triggered by the // TDx9_3DDevice::Destroy() method, just before the // TDx9_3DDevice internal LPDIRECT3DDEVICE9 interface is // destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_3DDevice::OnCreate() // event. For example, assume you have already setup the // TDx9_3DDevice::OnCreate() event to retrieve the // component's capabilities, Create() a dependant component // and allocate some memory; // You can then fully automate and insulate your code on a // per-component basis by placing code in the // TDx9_3DDevice::OnDestroy() event to deallocate memory, // Destroy() the dependant components and, when required, // destroy the capabilities component. // ---------------------------------------------------------------------- __property TDx_Event OnDestroy = {read=FOnDestroy, write=FOnDestroy, nodefault}; // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TDx9_3DDevice component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPDIRECT3DDEVICE9 used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPDIRECT3DDEVICE9, call the // TDx9_3DDevice::Create() method. // ---------------------------------------------------------------------- __property bool Created = { read=FGetCreated, write=FSetCreated, default=false }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TDx9_3DDevice method or // fget/fset. eg. D3D_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=D3D_OK }; // ---------------------------------------------------------------------- // Method: BeginScene() // Description: The TDx9_3DDevice::BeginScene() method begins a scene so // the application can perform rendering calls. // // Attempts to render outside a TDx9_3DDevice::BeginScene() // and TDx9_3DDevice::EndScene() pair will fail and only one // pair should be called between TDx9_3DDevice::Present or // TDx9_3DSwapChain::Present() calls. // TDx9_3DDevice::EndScene() need not be called if this // method fails. // // Try to call TDx9_3DDevice::Present or // TDx9_3DSwapChain::Present() as long after // TDx9_3DDevice::EndScene() as possible to allow optimal // parrallelism between the CPU and the graphics // accelerator. The idea is to give rendering time to // complete before presentation, minimising waiting time. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when this method has already been // called without a matching TDx9_3DDevice::EndScene(). // ---------------------------------------------------------------------- virtual bool __fastcall BeginScene(); // ---------------------------------------------------------------------- // Method: BeginStateBlock() // Description: The TDx9_3DDevice::BeginStateBlock() method tells // Direct3D to start recording various device settings into // a state block. // // TDx9_3DDevice::ValidateDevice() can check that the // currently set states are valid before calling this // method. // // This is a list of the methods that can be recorded in a // state block between the TDx9_3DDevice::BeginStateBlock() // and TDx9_3DDevice::EndStateBlock() pair. // The state block does not record the order of these calls, // only the final values of the states they affect. // TDx9_3DDevice::LightEnable() // TDx9_3DDevice::SetClipPlane() // TDx9_3DDevice::SetCurrentTexturePalette() // TDx9_3DDevice::SetFVF() // TDx9_3DDevice::SetIndices() // TDx9_3DDevice::SetLight() // TDx9_3DDevice::SetMaterial() // TDx9_3DDevice::SetNPatchMode() // TDx9_3DDevice::SetPixelShader() // TDx9_3DDevice::SetPixelShaderConstantB() // TDx9_3DDevice::SetPixelShaderConstantF() // TDx9_3DDevice::SetPixelShaderConstantI() // TDx9_3DDevice::SetRenderState() // TDx9_3DDevice::SetSamplerState() // TDx9_3DDevice::SetScissorRect() // TDx9_3DDevice::SetStreamSource() // TDx9_3DDevice::SetStreamSourceFreq() // TDx9_3DDevice::SetTexture() // TDx9_3DDevice::SetTextureStageState() // TDx9_3DDevice::SetTransform() // TDx9_3DDevice::SetViewport() // TDx9_3DDevice::SetVertexDeclaration() // TDx9_3DDevice::SetVertexShader() // TDx9_3DDevice::SetVertexShaderConstantB() // TDx9_3DDevice::SetVertexShaderConstantF() // TDx9_3DDevice::SetVertexShaderConstantI() // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when state blocks are unavailable, at // least at the moment. // E_OUTOFMEMORY when insufficient memory could be allocated // for the call. // ---------------------------------------------------------------------- virtual bool __fastcall BeginStateBlock(); // ---------------------------------------------------------------------- // Method: Clear() // Description: The TDx9_3DDevice::Clear() method can be used to clear // sections of render target surfaces or their associated // depth or stencil buffers. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided // or you try to clear depth or stencil buffers that do not // exist. // Params: pCount - // The Count parameter specifies how many regions are // defined by the TD3DRect referenced by Rects. // // This value must be 0 if Rects is NULL and cannot be 0 // otherwise. // pRects - // The Rects parameter references a TD3DRect defining one or // more regions to clear. // // Regions use screen coordinates corresponding to points on // the render target which are clipped to the viewport // dimensions. // Define a region that matches the rendering target // dimensions to clear the whole surface. // Set NULL and Count to 0 to clear the whole viewport. // pFlags - // The Flags parameter contains settings indicating which // surfaces should be cleared, as defined by the D3DCLEAR // constant. // pColor - // The Color parameter indicates what ARGB color to set for // the cleared regions. // pZ - // The Z parameter indicates what z value to set for the // cleared depth buffer regions. // // This value can be between 0 and 1. // pStencil - // The Stencil parameter indicates what value to set for the // cleared stencil buffer regions. // // This value can be between 0 and 2^n - 1, where n = // stencil buffer bit depth. // ---------------------------------------------------------------------- virtual bool __fastcall Clear( dword pCount, D3DRECT* pRects, dword pFlags, D3DCOLOR pColor, float pZ, dword pStencil ); // ---------------------------------------------------------------------- // Method: ColorFill() // Description: The TDx9_3DDevice::ColorFill() method will fill a region // of a D3DPOOL_DEFAULT surface with a specified color. // // When using a reference or software device, fillable // formats are limited to D3DFMT_X1R5G5B5, D3DFMT_A1R5G5B5, // D3DFMT_R5G6B5, D3DFMT_X8R8G8B8, D3DFMT_A8R8G8B8, // D3DFMT_YUY2, D3DFMT_G8R8_G8B8, D3DFMT_UYVY, // D3DFMT_R8G8_B8G8, D3DFMT_R16F, D3DFMT_G16R16F, // D3DFMT_A16B16G16R16F, D3DFMT_R32F, D3DFMT_G32R32F and // D3DFMT_A32B32G32R32F. // When using DirectX 7.0 or 8.x driver, only the // D3DFMT_UYVY and D3DFMT_YUY2 YUV formats can be filled. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided // or you fill an incompatible surface. // Params: pSurface - // The Surface parameter references the TDx9_3DSurface that // is to be filled. // pRect - // The Rect parameter defines the region that is to be // filled. // // Set NULL to fill the entire surface. // pcolor - // The color parameter specifies the color to fill. // ---------------------------------------------------------------------- virtual bool __fastcall ColorFill( TDx9_3DSurface* pSurface, TRect* pRect, D3DCOLOR pcolor ); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPDIRECT3DDEVICE9 interface used in the // TDx9_3DDevice component and must be called before any // methods of the TDx9_3DDevice component will function. // Params: p3D - // The 3D parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Create( TDx9_3D* p3D ); // ---------------------------------------------------------------------- // Method: CreateAdditionalSwapChain() // Description: The TDx9_3DDevice::CreateAdditionalSwapChain() method can // be used to create an additional swap chain if you need to // render multiple views. // // There is automatically an implicit swap chain so only use // this method if you need an extra swap chain. Only one // full screen swap chain is allowed per device. // D3DFMT_UNKNOWN can be specified as the windowed mode back // buffer format in this method, TDx9_3D::CreateDevice() and // TDx9_3DDevice::Reset() calls, so you dont need to // retrieve the current desktop format before this call for // windowed mode. Full screen mode requires the back buffer // format be specified. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_NOTAVAILABLE if the specified multisample type is // unsupported. // D3DERR_DEVICELOST when the device is lost and cannot be // reset right now. // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pPresentationParameters - // The PresentationParameters parameter references a // TD3DPresent_Parameters component holding the presentation // parameters for the new swap chain. // // Some of the TD3DPresent_Parameters properties may change // as a result of this call. // Specifically, if BackBufferCount is 0 it will be set to 1 // and if BackBufferWidth or BackBufferHeight is 0 in // windowed mode, they will be set to the client area width // and height of the hwnd. // pSwapChain - // The SwapChain parameter will reference the created // TDx9_3DSwapChain when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateAdditionalSwapChain( D3DPRESENT_PARAMETERS* pPresentationParameters, TDx9_3DSwapChain* pSwapChain ); // ---------------------------------------------------------------------- // Method: CreateCubeTexture() // Description: The TDx9_3DDevice::CreateCubeTexture() method will create // a cube texture. // // Call TDx9_3DDevice::CheckDeviceFormat with // D3DUSAGE_AUTOGENMIPMAP set to find out if automatic // generation of mipmaps is supported for a specific format. // A return value of D3DOK_NOAUTOGEN indicates this creation // call would succeed but return a cube texture with only // one level. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pEdgeLength - // The EdgeLength parameter specifies the dimensions of the // top level of the cube texture. // // This is a single value used for all 3 dimensions, it is a // cube after all. // It is usually best to use a power of two for this value // as each level is half the size of the previous one, // rounded down, but with a minimum dimension of 1. // pLevels - // The Levels parameter specifies how many mipmap levels the // cube texture should have. // // Setting 0 results in levels being generated all the way // down to 1 pixel size if the hardware supports mimmaped // cube textures. // Call TDx9_3DCubeTexture::GetLevelCount() of the returned // cube texture to find out how many levels were generated. // pUsage - // The Usage parameter specifies the usage parameters for // the cube texture, as values of the D3DUSAGE constant. // // Setting 0 is allowed, otherwise its good practice for the // usage to match the settings used in the // TDx9_3D::CreateDevice() call. // pFormat - // The Format parameter specifies the format to be used for // all faces and levels of the cube texture, as a value of // the D3DFORMAT enumerated type. // pPool - // The Pool parameter indicates what class memory the cube // texture should use, as a value of the TD3DPOOL enumerated // type. // pCubeTexture - // The CubeTexture parameter will reference the created // TDx9_3DCubeTexture when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateCubeTexture( uint pEdgeLength, uint pLevels, dword pUsage, D3DFORMAT pFormat, D3DPOOL pPool, TDx9_3DCubeTexture* pCubeTexture ); // ---------------------------------------------------------------------- // Method: CreateDepthStencilSurface() // Description: The TDx9_3DDevice::CreateDepthStencilSurface() method // will create a depth stencil surface. // // Stencil depth surfaces are always D3DPOOL_DEFAULT. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_NOTAVAILABLE if the specified multisample type is // unsupported. // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pWidth - // The Width parameter specifies the width, in pixels, of // the new depth stencil surface. // pHeight - // The Height parameter specifies the height, in pixels, of // the new depth stencil surface. // pFormat - // The Format parameter specifies the format of the new // depth stencil surface, as a value of the D3DFORMAT // enumerated type. // // This value must be one of the enumerated depth stencil // formats for this device. // pMultiSample - // The MultiSample parameter specifies the multisampling // buffer type, as a value of the D3DMULTISAMPLE_TYPE // enumerated type. // // This value must be an allowed multisample type and when // passed to TDx9_3DDevice::SetDepthStencilSurface() this // type must match that set for the render target by // TDx9_3DDevice::SetRenderTarget(). // pMultisampleQuality - // The MultisampleQuality parameter specifies the // multisample quality level. // // This value must be between 0 and // TDx9_3D::CheckDeviceMultiSampleType->QualityLevels - 1. // The quality level must match for the render target, depth // stencil and multisample type. // pDiscard - // The Discard parameter indicates whether to discard the // depth stencil buffer contents whenever // TDx9_3DDevice::Present() or // TDx9_3DDevice::SetDepthStencilSurface() is called with a // different depth surface. // // Setting TRUE behaves the same way as the // D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL flag. // pSurface - // The Surface parameter will reference the TDx9_3DSurface // holding the new depth stencil surface when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateDepthStencilSurface( uint pWidth, uint pHeight, D3DFORMAT pFormat, D3DMULTISAMPLE_TYPE pMultiSample, dword pMultisampleQuality, bool pDiscard, TDx9_3DSurface* pSurface ); // ---------------------------------------------------------------------- // Method: CreateIndexBuffer() // Description: The TDx9_3DDevice::CreateIndexBuffer() method will create // an index buffer. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // D3DXERR_INVALIDDATA when the provided data is invalid. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pLength - // The Length parameter defines the size, in bytes, of the // index buffer. // pUsage - // The Usage parameter specifies the usage parameters for // the index buffer, as values of the D3DUSAGE constant. // // Setting 0 is allowed, otherwise its good practice for the // usage to match the settings used in the // TDx9_3D::CreateDevice() call. // pFormat - // The Format parameter specifies the index buffer format, // as a value of the D3DFORMAT enumerated type. // // Valid values are D3DFMT_INDEX16 for 16 bit indices and // D3DFMT_INDEX32 for 32 bit indices. // If TD3DCaps->MaxVertexIndex > 0x0000FFFF indicates 32 bit // indices will be valid for rendering. // pPool - // The Pool parameter indicates what class memory the index // buffer should use, as a value of the TD3DPOOL enumerated // type. // pIndexBuffer - // The IndexBuffer parameter will reference the created // TDx9_3DIndexBuffer when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateIndexBuffer( uint pLength, dword pUsage, D3DFORMAT pFormat, D3DPOOL pPool, TDx9_3DIndexBuffer* pIndexBuffer ); // ---------------------------------------------------------------------- // Method: CreateOffscreenPlainSurface() // Description: The TDx9_3DDevice::CreateOffscreenPlainSurface() method // will create an ordinary offscreen surface. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // Params: pWidth - // The Width parameter defines the width, in pixels, of the // new surface. // pHeight - // The Height parameter defines the height, in pixels of the // new surface. // pFormat - // The Format parameter specifies the format of the new // surface, as a value of the D3DFORMAT enumerated type. // pPool - // The Pool parameter indicates what class memory the // surface should use, as a value of the TD3DPOOL enumerated // type. // // This kind of surface is always lockable, regardless of // pool type. // D3DPOOL_SCRATCH returns a surface the same as that // produced by the DirectX 8 CreateImageSurface method . // D3DPOOL_DEFAULT is the best pool for surfaces that need // to TDx9_3DDevice::StretchRect() and // TDx9_3DDevice::ColorFill(). // D3DPOOL_MANAGED is invalid for plain offscreen surfaces. // pSurface - // The Surface parameter will reference the created // TDx9_3DSurface when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateOffscreenPlainSurface( uint pWidth, uint pHeight, D3DFORMAT pFormat, dword pPool, TDx9_3DSurface* pSurface ); // ---------------------------------------------------------------------- // Method: CreatePixelShader() // Description: The TDx9_3DDevice::CreatePixelShader() method will create // a pixel shader. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pFunction - // The Function parameter references the blending operations // for the pixel shader, as specified by the pixel shader // function token array. // // This value cannot be NULL. // pShader - // The Shader parameter will reference the new // TDx9_3DPixelShader when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreatePixelShader( dword* pFunction, TDx9_3DPixelShader* pShader ); // ---------------------------------------------------------------------- // Method: CreateQuery() // Description: The TDx9_3DDevice::CreateQuery() method will create a // device status query. // // Once created and after the relevant API calls have been // made, the synchronous or asynchronous query is initiated // with TDx9_3DQuery::Issue() the results can be retrieved // with TDx9_3DQuery::GetData(). // This method replaces the GetInfo method from earlier // DirectX versions. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_NOTAVAILABLE if the specified query is not // supported. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pType - // The Type parameter specifies the type of query to create, // as a value of the D3DQUERYTYPE enumerated type. // pQuery - // The Query parameter will reference the new TDx9_3DQuery // when the method returns. // // Set NULL to check a specified query Type is supported. // ---------------------------------------------------------------------- virtual bool __fastcall CreateQuery( D3DQUERYTYPE pType, TDx9_3DQuery* pQuery ); // ---------------------------------------------------------------------- // Method: CreateRenderTarget() // Description: The TDx9_3DDevice::CreateRenderTarget() method will // create a render target surface. // // Render target surfaces are placed in D3DPOOL_DEFAULT // memory. // Lockable, multisampled render targets are not supported. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_NOTAVAILABLE when the specified multisample type // is unsupported. // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pWidth - // The Width parameter specifies the width, in pixels, of // the new render target surface. // pHeight - // The Height parameter specifies the height, in pixels, of // the new render target surface. // pFormat - // The Format parameter defines the format of the new render // target surface, as a value of the D3DFORMAT enumerated // type. // pMultiSample - // The MultiSample parameter defines the antialiasing type // for the new render target surface, as a value of the // D3DMULTISAMPLE_TYPE enumerated type. // // When passed to TDx9_3DDevice::SetRenderTarget(), the // multisample type must match that of the depth stencil, as // set by TDx9_3DDevice::SetDepthStencilSurface(). // pMultisampleQuality - // The MultisampleQuality parameter specifies the // multisample quality level. // // This value must be between 0 and // TDx9_3D::CheckDeviceMultiSampleType->QualityLevels - 1. // The quality level must match for the render target, depth // stencil and multisample type. // pLockable - // The Lockable parameter indicates that the new render // target should be lockable. // // Set TRUE if you want to be able to lock the new render // target surface, but keep in mind that it may affect // performance on some graphics hardware. // pSurface - // The Surface parameter will reference the new render // target TDx9_3DSurface when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateRenderTarget( uint pWidth, uint pHeight, D3DFORMAT pFormat, D3DMULTISAMPLE_TYPE pMultiSample, dword pMultisampleQuality, bool pLockable, TDx9_3DSurface* pSurface ); // ---------------------------------------------------------------------- // Method: CreateStateBlock() // Description: The TDx9_3DDevice::CreateStateBlock() method will create // a state block of vertex related, pixel related or all // device state values. // // Vertex states are mainly those affecting how vertices are // processed. Pixel states are mainly those affecting how // pixel or depth buffer data is processed during // rasterization. There are some values in both groups. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pType - // The Type parameter specifies the type of state data that // should be captured, as a value of the D3DSTATEBLOCKTYPE // enumerated type. // pSB - // The SB parameter will reference the new TDx9_3DStateBlock // when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateStateBlock( D3DSTATEBLOCKTYPE pType, TDx9_3DStateBlock* pSB ); // ---------------------------------------------------------------------- // Method: CreateTexture() // Description: The TDx9_3DDevice::CreateTexture() method will create an // ordinary texture. // // Call TDx9_3DDevice::CheckDeviceFormat with // D3DUSAGE_AUTOGENMIPMAP set to find out if automatic // generation of mipmaps is supported for a specific format. // A return value of D3DOK_NOAUTOGEN indicates this creation // call would succeed but return a texture with only one // level. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pWidth - // The Width parameter specifies the width of the top level // of the texture. // // It is usually best to use a power of two for this value // as each level is half the size of the previous one, // rounded down, but with a minimum dimension of 1. // pHeight - // The Height parameter specifies the height of the top // level of the texture. // // It is usually best to use a power of two for this value // as each level is half the size of the previous one, // rounded down, but with a minimum dimension of 1. // pLevels - // The Levels parameter specifies how many mipmap levels the // texture should have. // // Setting 0 results in levels being generated all the way // down to 1 pixel size if the hardware supports mimmaped // textures. // Call TDx9_3DTexture::GetLevelCount() of the returned // texture to find out how many levels were generated. // pUsage - // The Usage parameter specifies the usage parameters for // the texture, as values of the D3DUSAGE constant. // // Setting 0 is allowed, otherwise its good practice for the // usage to match the settings used in the // TDx9_3D::CreateDevice() call. // pFormat - // The Format parameter specifies the format to be used for // all levels of the texture, as a value of the D3DFORMAT // enumerated type. // pPool - // The Pool parameter indicates what class memory the // texture should use, as a value of the TD3DPOOL enumerated // type. // pTexture - // The Texture parameter will reference the created // TDx9_3DTexture when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateTexture( uint pWidth, uint pHeight, uint pLevels, dword pUsage, D3DFORMAT pFormat, D3DPOOL pPool, TDx9_3DTexture* pTexture ); // ---------------------------------------------------------------------- // Method: CreateVertexBuffer() // Description: The TDx9_3DDevice::CreateVertexBuffer() method will // create a vertex buffer. // // A vertex buffer can only be used by the TDx9_3DDevice // that created it. // Hardware and software vertex processing can both use // vertex buffers, the type of processing is determined at // the creation time of both the device and the vertex // buffer. // For mixed mode vertex processing, // TDx9_3DDevice::SetSoftwareVertexProcessing() may need to // be called after device creation. // Vertex buffer usage should match device behaviour, so // when using a vertex buffer with a mixed mode device, set // the vertex buffer with TDx9_3DDevice::SetStreamSource() // and if neccessary, change the device behaviour to match // with TDx9_3DDevice::SetRenderState(). // Software processed vertex buffers cannot be located in // video memory. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pLength - // The Length parameter defines the size, in bytes, of the // vertex buffer. // // If FVF is not 0, this value must be at least the size of // one vertex but need not be an exact multiple of the // vertex size. // When FVF is 0, this parameter is not validated. // pUsage - // The Usage parameter specifies the usage settings for the // new vertex buffer, as values of the D3DUSAGE constant. // // Setting 0 is allowed, otherwise its good practice for the // usage to match the TDx9_3D::CreateDevice->BehaviourFlags // settings used in the call. // // If D3DCREATE_HARDWARE_VERTEXPROCESSING was set this value // should be 0. // If D3DCREATE_SOFTWARE_VERTEXPROCESSING or // D3DCREATE_MIXED_VERTEXPROCESSING was set this value can // be 0 or D3DUSAGE_SOFTWAREPROCESSING. // pFVF - // The FVF parameter specifies the FVF settings for the new // vertex buffer, as values of the D3DFVF constant. // // This value may be 0, but if a valid FVF code is set the // buffer content will be characterised by that FVF code. // For FVF vertex buffers each element needs to contain // geometry and texture coordinate information, resulting in // duplicated geometry information for each associated // texture coordinate. // For Non-FVF vertex buffers the texture and geometry data // can be interleaved during multipass rendering or // multitexture rendering in a single pass. For this, one // buffer contains geometry while the other contains texture // coordinates. Since there are usually multiple texture // coordinate elements for each geometry element, this // results in either a speed or memory advantage over a FVF // buffer. // pPool - // The Pool parameter indicates what class memory the vertex // buffer should use, as a value of the TD3DPOOL enumerated // type. // pVertexBuffer - // The VertexBuffer parameter will reference the new // TDx9_3DVertexBuffer when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateVertexBuffer( uint pLength, dword pUsage, dword pFVF, D3DPOOL pPool, TDx9_3DVertexBuffer* pVertexBuffer ); // ---------------------------------------------------------------------- // Method: CreateVertexDeclaration() // Description: The TDx9_3DDevice::CreateVertexDeclaration() method will // create a vertex shader declaration from the device // settings and vertex elements. // // Vertex streams are expressed in TD3DVertexElement's, // replacing the FVF codes used in previous DirectX // versions. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // Params: pVertexElements - // The VertexElements parameter references the // TD3DVertexElement component holding the vertex element // array. // pDecl - // The Decl parameter will reference the new // TDx9_3DVertexDeclaration when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateVertexDeclaration( TD3DVertexElement* pVertexElements, TDx9_3DVertexDeclaration* pDecl ); // ---------------------------------------------------------------------- // Method: CreateVertexShader() // Description: The TDx9_3DDevice::CreateVertexShader() method will // create a vertex shader from an array of tokens // representing the vertex shader properties. // // TDx9_3D::CreateDevice->BehaviourFlags specifies hardware, // software or both processing for vertices. Switching // between software and hardware processing on a mixed mode // device is accomplished via // TDx9_3DDevice::SetSoftwareVertexProcessing(). // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pFunction - // The Function parameter references the token array // representing the vertex shader, including embedded debug // and symbol table information. // // This array could be created in several ways, including: // Use the D3DXCompileShader function of the // TDx9_3DX_Library on a high level shader language (HLSL) // shader. // Use the D3DXAssembleShader function of the // TDx9_3DX_Library on an assembly language shader. // Use TDx9_3DX::EffectCompiler() on an effect. // pShader - // The Shader parameter will reference the new // TDx9_3DVertexShader when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateVertexShader( dword* pFunction, TDx9_3DVertexShader* pShader ); // ---------------------------------------------------------------------- // Method: CreateVolumeTexture() // Description: The TDx9_3DDevice::CreateVolumeTexture() method will // create a volume texture. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pWidth - // The Width parameter specifies the width of the top level // of the volume texture. // // TD3DCaps->MaxVolumeExtent defines the maximum supported // value. // If TD3DCaps->TextureCaps->D3DPTEXTURECAPS_VOLUMEMAP_POW2 // is set, this value must be a power of two. // Each level is half the size of the previous one, rounded // down, but with a minimum dimension of 1. // pHeight - // The Height parameter specifies the height of the top // level of the volume texture. // // TD3DCaps->MaxVolumeExtent defines the maximum supported // value. // If TD3DCaps->TextureCaps->D3DPTEXTURECAPS_VOLUMEMAP_POW2 // is set, this value must be a power of two. // Each level is half the size of the previous one, rounded // down, but with a minimum dimension of 1. // pDepth - // The Depth parameter specifies the depth, in pixels, of // the top level of the volume texture. // // TD3DCaps->MaxVolumeExtent defines the maximum supported // value. // If TD3DCaps->TextureCaps->D3DPTEXTURECAPS_VOLUMEMAP_POW2 // is set, this value must be a power of two. // Each level is half the size of the previous one, rounded // down, but with a minimum dimension of 1. // pLevels - // The Levels parameter specifies how many mipmap levels the // volume texture should have. // // Setting 0 results in levels being generated all the way // down to 1 pixel size if the hardware supports mimmaped // volume textures. // Call TDx9_3DCubeTexture::GetLevelCount() of the returned // volume texture to find out how many levels were // generated. // pUsage - // The Usage parameter specifies the usage parameters for // the volume texture, as values of the D3DUSAGE constant. // // Setting 0 is allowed, otherwise D3DUSAGE_DYNAMIC or // D3DUSAGE_SOFTWAREPROCESSING are valid values. // pFormat - // The Format parameter specifies the format to be used for // all levels of the volume texture, as a value of the // D3DFORMAT enumerated type. // pPool - // The Pool parameter indicates what class memory the volume // texture should use, as a value of the TD3DPOOL enumerated // type. // pVolumeTexture - // The VolumeTexture parameter will reference the created // TDx9_3DVolumeTexture when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall CreateVolumeTexture( uint pWidth, uint pHeight, uint pDepth, uint pLevels, dword pUsage, D3DFORMAT pFormat, D3DPOOL pPool, TDx9_3DVolumeTexture* pVolumeTexture ); // ---------------------------------------------------------------------- // Method: DeletePatch() // Description: The TDx9_3DDevice::DeletePatch() method will free a // cached higher order patch. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Handle is invalid. // Params: pHandle - // The Handle parameter indicates which cached higher order // patch to delete. // ---------------------------------------------------------------------- virtual bool __fastcall DeletePatch( uint pHandle ); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPDIRECT3DDEVICE9 interface used in the // TDx9_3DDevice component and should be called when the // internal interface is no longer required. // // Note: This method is called by the component's // destructor. // ---------------------------------------------------------------------- virtual bool __fastcall Destroy(); // ---------------------------------------------------------------------- // Method: DrawIndexedPrimitive() // Description: The TDx9_3DDevice::DrawIndexedPrimitive() method will // render the specified geometric primitive into an array of // vertices using indexing. // // The primitives drawn come from the current set of data // input streams. The MinIndex and all indices of the index // stream are relative to the BaseVertexIndex offset. // MinIndex and NumVertices specify the range of vertex // indices to use for each call of this method. This // sequential vertex range is processed prior to indexing // into that range, thus helping to optimise the operation. // Attempting to use any vertices outside the specified // range or having no index array set will cause the method // to fail. // // Add a TDx9_3DDevice::SetFVF() call before making any draw // calls if you are converting fixed function legacy code // from previous versions of DirectX. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pType - // The Type parameter specifies the type of primitive to // render, as a value of the D3DPRIMITIVETYPE enumerated // type. // // D3DPT_POINTLIST is not a valid value for this method. // pBaseVertexIndex - // The BaseVertexIndex parameter specifies the offset from // the start of the vertex buffer to the first vertex. // pMinIndex - // The MinIndex parameter defines the minumum vertex index // for vertices used during this call. // The index is zero based relative to BaseVertexIndex. // pNumVertices - // The NumVertices parameter indicates how many vertices to // use, starting from BaseVertexIndex + MinIndex. // pStartIndex - // The StartIndex parameter specifies the index of the index // to start indexing vertices from the vertex buffer. // pPrimitiveCount - // The PrimitiveCount parameter indicates how many // primitives are to be rendered. // This value and the primitive Type determine how many // vertices are needed. For example, D3DPT_TRIANGLELIST // would need 3 times PrimitiveCount vertices. // TD3DCaps->MaxPrimitiveCount denotes the maximum value // allowed for this parameter. // ---------------------------------------------------------------------- virtual bool __fastcall DrawIndexedPrimitive( D3DPRIMITIVETYPE pType, int pBaseVertexIndex, uint pMinIndex, uint pNumVertices, uint pStartIndex, uint pPrimitiveCount ); // ---------------------------------------------------------------------- // Method: DrawIndexedPrimitiveUP() // Description: The TDx9_3DDevice::DrawIndexedPrimitiveUP() method will // render the specified geometric primitive from application // defined data using indexing. // // The primitives drawn come from index and vertex data // referenced by user defined pointers. // Primarily intended for applications that are unable to // store vertex buffers, this method only supports a single // vertex stream which must be declared as stream 0. // After the call, the stream 0 settings, referenced by // TDx9_3DDevice::GetStreamSource(), and the index buffer // setting, from TDx9_3DDevice::SetIndices(), will be set to // NULL. // The vertex data used in the call can safely be released // afterwards. Direct3D completes its access to that data // prior to returning. // // Add a TDx9_3DDevice::SetFVF() call before making any draw // calls if you are converting fixed function legacy code // from previous versions of DirectX. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pPrimitiveType - // The PrimitiveType parameter specifies the type of // primitive to render, as a value of the D3DPRIMITIVETYPE // enumerated type. // pMinVertexIndex - // The MinVertexIndex parameter defines the minimum index of // the vertices used during this call. // The index is zero based. // pNumVertexIndices - // The NumVertices parameter indicates how many vertices to // use, starting from MinVertexIndex. // pPrimitiveCount - // The PrimitiveCount parameter indicates how many // primitives are to be rendered. // // This value and the primitive Type determine how many // vertices are needed. For example, D3DPT_TRIANGLELIST // would need 3 times PrimitiveCount vertices. // TD3DCaps->MaxPrimitiveCount denotes the maximum value // allowed for this parameter. // pIndexData - // The IndexData parameter references the application // defined index data. // pIndexDataFormat - // The IndexDataFormat parameter specifies the index data // format, as a value of the D3DFORMAT enumerated type. // // This value can be D3DFMT_INDEX16 or D3DFMT_INDEX32. // pVertexStreamZeroData - // The VertexStreamZeroData parameter references the // application defined vertex data. // // The referenced vertex data must be in stream 0. // pVertexStreamZeroStride - // The VertexStreamZeroStride parameter indicates the size, // in bytes, of each vertex. // // This value cannot be 0. // ---------------------------------------------------------------------- virtual bool __fastcall DrawIndexedPrimitiveUP( D3DPRIMITIVETYPE pPrimitiveType, uint pMinVertexIndex, uint pNumVertexIndices, uint pPrimitiveCount, void* pIndexData, D3DFORMAT pIndexDataFormat, void* pVertexStreamZeroData, uint pVertexStreamZeroStride ); // ---------------------------------------------------------------------- // Method: DrawPrimitive() // Description: The TDx9_3DDevice::DrawPrimitive() method will render the // specified non indexed geometric primitives into an array // of vertices. // // The primitives drawn come from the current set of data // input streams. // Add a TDx9_3DDevice::SetFVF() call before making any draw // calls if you are converting fixed function legacy code // from previous versions of DirectX. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pPrimitiveType - // The PrimitiveType parameter specifies the type of // primitive to render, as a value of the D3DPRIMITIVETYPE // enumerated type. // pStartVertex - // The StartVertex parameter defines the index of the first // vertex to be used during this call. // pPrimitiveCount - // The PrimitiveCount parameter indicates how many // primitives are to be rendered. // // This value and the PrimitiveType determine how many // vertices are needed. For example, D3DPT_TRIANGLELIST // would need 3 times PrimitiveCount vertices. // TD3DCaps->MaxPrimitiveCount denotes the maximum value // allowed for this parameter. // ---------------------------------------------------------------------- virtual bool __fastcall DrawPrimitive( D3DPRIMITIVETYPE pPrimitiveType, uint pStartVertex, uint pPrimitiveCount ); // ---------------------------------------------------------------------- // Method: DrawPrimitiveUP() // Description: The TDx9_3DDevice::DrawPrimitiveUP() method will render // the specified non indexed geometric primitives into an // array of vertices. // // The primitives drawn come from vertex data referenced by // a user defined pointer. // Primarily intended for applications that are unable to // store vertex buffers, this method only supports a single // vertex stream which must be declared as stream 0. // After the call, the stream 0 settings, referenced by // TDx9_3DDevice::GetStreamSource() will be set to NULL. // The vertex data used in the call can safely be released // afterwards. Direct3D completes its access to that data // prior to returning. // // Add a TDx9_3DDevice::SetFVF() call before making any draw // calls if you are converting fixed function legacy code // from previous versions of DirectX. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pPrimitiveType - // The PrimitiveType parameter specifies the type of // primitive to render, as a value of the D3DPRIMITIVETYPE // enumerated type. // pPrimitiveCount - // The PrimitiveCount parameter indicates how many // primitives are to be rendered. // // This value and the PrimitiveType determine how many // vertices are needed. For example, D3DPT_TRIANGLELIST // would need 3 times PrimitiveCount vertices. // TD3DCaps->MaxPrimitiveCount denotes the maximum value // allowed for this parameter. // pVertexStreamZeroData - // The VertexStreamZeroData parameter references the // application defined vertex data. // // The referenced vertex data must be in stream 0. // pVertexStreamZeroStride - // The VertexStreamZeroStride parameter indicates the size, // in bytes, of each vertex. // // This value cannot be 0. // ---------------------------------------------------------------------- virtual bool __fastcall DrawPrimitiveUP( D3DPRIMITIVETYPE pPrimitiveType, uint pPrimitiveCount, void* pVertexStreamZeroData, uint pVertexStreamZeroStride ); // ---------------------------------------------------------------------- // Method: DrawRectPatch() // Description: The TDx9_3DDevice::DrawRectPatch() method will draw a // rectangular higher order patch. // // If the patch is static, you set the vertex shader and // appropriate streams, fill the TD3DRectPatch_Info // referenced by RectPatchInfo with patch information, set a // handle and perform the call. This has the effect of // caching the patch. Then call this method again with // RectPatchInfo set to NULL to efficiently draw the patch, // changing NumSegs if needed. Cached patches ignore the // current data streams but the same vertex shader must be // set as when the patch was originally cached. // Calling this method to cache a patch with the same handle // as a previous call will invalidate the handle to the // previously cached patch. // // Dynamic patches should not be cached, so set Handle to 0. // The patch will be drawn using the current streams and // NumSegs value. RectPatchInfo cannot be NULL for dynamic // patches. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pHandle - // The Handle parameter specifies the handle of the // rectangular patch to store or draw. // pNumSegs - // The NumSegs parameter indicates how many segments each // edge of the patch should be divided into when // tessellated, as an array of 4 floating point values. // pRectPatchInfo - // The RectPatchInfo parameter references a // TD3DRectPatch_Info component describing the rectangular // patch to draw or store. // ---------------------------------------------------------------------- virtual bool __fastcall DrawRectPatch( uint pHandle, float* pNumSegs, D3DRECTPATCH_INFO* pRectPatchInfo ); // ---------------------------------------------------------------------- // Method: DrawTriPatch() // Description: The TDx9_3DDevice::DrawTriPatch() method will draw a // triangular higher order patch. // // If the patch is static, you set the vertex shader and // appropriate streams, fill the TD3DTriPatch_Info // referenced by TriPatchInfo with patch information, set a // handle and perform the call. This has the effect of // caching the patch. Then call this method again with // TriPatchInfo set to NULL to efficiently draw the patch, // changing NumSegs if needed. Cached patches ignore the // current data streams but the same vertex shader must be // set as when the patch was originally cached. // Calling this method to cache a patch with the same handle // as a previous call will invalidate the handle to the // previously cached patch. // // Dynamic patches should not be cached, so set Handle to 0. // The patch will be drawn using the current streams and // NumSegs value. TriPatchInfo cannot be NULL for dynamic // patches. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pHandle - // The Handle parameter specifies the handle of the // triangular patch to store or draw. // pNumSegs - // The NumSegs parameter indicates how many segments each // edge of the patch should be divided into when // tessellated, as an array of 3 floating point values. // pTriPatchInfo - // The TriPatchInfo parameter references a TD3DTriPatch_Info // component describing the triangular patch to draw or // store. // ---------------------------------------------------------------------- virtual bool __fastcall DrawTriPatch( uint pHandle, float* pNumSegs, D3DTRIPATCH_INFO* pTriPatchInfo ); // ---------------------------------------------------------------------- // Method: EndScene() // Description: The TDx9_3DDevice::EndScene() method ends a scene, // queuing it for rendering by the driver. // // Attempts to render outside a TDx9_3DDevice::BeginScene() // and TDx9_3DDevice::EndScene() pair will fail and only one // pair should be called between TDx9_3DDevice::Present or // TDx9_3DSwapChain::Present() calls. This call will fail if // TDx9_3DDevice::BeginScene() failed. // // When this method returns, the scene has been sent to the // driver for rendering, but rendering is not neccessarily // complete, so its a good idea to call // TDx9_3DDevice::Present or TDx9_3DSwapChain::Present() as // long after this call as possible to allow optimal // parrallelism between the CPU and the graphics // accelerator, thus giving time for rendering to complete // before presentation and minimising waiting time. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if TDx9_3DDevice::BeginScene() failed // or has not been called. // ---------------------------------------------------------------------- virtual bool __fastcall EndScene(); // ---------------------------------------------------------------------- // Method: EndStateBlock() // Description: The TDx9_3DDevice::EndStateBlock() method tells Direct3D // to cease recording various device settings and return a // TDx9_3DStateBlock pointer. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSB - // The SB parameter references a TDx9_3DStateBlock // representing the captured device state when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall EndStateBlock( TDx9_3DStateBlock* pSB ); // ---------------------------------------------------------------------- // Method: EvictManagedResources() // Description: The TDx9_3DDevice::EvictManagedResources() method will // evict all Direct3D and driver managed resources. // // Only the D3DPOOL_DEFAULT copy is evicted, the system // memory resource copy is retained. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // D3DERR_COMMAND_UNPARSED when the driver could not parse // the command. // ---------------------------------------------------------------------- virtual bool __fastcall EvictManagedResources(); // ---------------------------------------------------------------------- // Method: GetAvailableTextureMem() // Description: The TDx9_3DDevice::GetAvailableTextureMem() method will // return the estimated available texture memory. // // The estimate is rounded to the nearest MB, as alignment // and other resource consumption issues make a precise // judgement difficult. Use this method for large scale // resource decisions such as how many mimmap levels to use, // as opposed to checking to see if another resource could // possibly be squeezed into display memory. // ---------------------------------------------------------------------- virtual UINT __fastcall GetAvailableTextureMem(); // ---------------------------------------------------------------------- // Method: GetBackBuffer() // Description: The TDx9_3DDevice::GetBackBuffer() method will retrieve a // specified back buffer from the swap chain. // // This call will increase the reference count of the // returned TDx9_3DSurface, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if BackBuffer >= number of back // buffers. // Params: pSwapChain - // The SwapChain parameter indicates from which swap chain // the back buffer is to be retrieved. // pBackBuffer - // The BackBuffer parameter defines the index of the back // buffer to be retrieved. // // A value of 0 retrieves the first back buffer, not the // front buffer. TDx9_3DDevice::GetFrontBufferData() can be // used to get a copy of front buffer data. // pBackBufferSurface - // The BackBufferSurface parameter will reference the // specified TDx9_3DSurface when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetBackBuffer( uint pSwapChain, uint pBackBuffer, TDx9_3DSurface* pBackBufferSurface ); // ---------------------------------------------------------------------- // Method: GetClipPlane() // Description: The TDx9_3DDevice::GetClipPlane() method will retrieve // the coefficients of a user defined clipping plane. // // This method will not work for D3DCREATE_PUREDEVICE's. // The returned coefficients take the form of the general // plane equation. Labelling the Plane elements A, B, C and // D, the equation would be Ax + By + Cz + Dw =0. A // homogenous coordinate point (x, y, z, w) is visible if Ax // + By + Cz + Dw >= 0, othewise it is clipped from the // scene. The returned plane equation exists in world space // and will have been previously set by a // TDx9_3DDevice::SetClipPlane() call. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Index > maximum supported clipping // plane index or the Plane array is too small for four // floating point values. // Params: pIndex - // The Index parameter specifies the index of the clipping // plane to be retrieved. // pPlane - // The Plane parameter references the clipping plane // coefficients, as 4 floating point array elements, when // the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetClipPlane( dword pIndex, float* pPlane ); // ---------------------------------------------------------------------- // Method: GetClipStatus() // Description: The TDx9_3DDevice::GetClipStatus() method will retrieve // the current clip status. // // Clip status is used for software vertex processing so // this method will not work on hardware vertex processing // devices. // Since TDx9_3DDevice::DrawRectPatch() and // TDx9_3DDevice::DrawTriPatch() are hardware only methods, // clip status will not be updated by those calls. // // When vertices are being processed a clip code is computed // for each one. The clip code is a combination of D3DCS_*** // bits, the relevant bit being set when the vertex falls // outsite a particular clipping plane. The clip status is // maintained using TD3DClipStatus->ClipUnion and // TD3DClipStatus->ClipIntersection, ClipUnion is initially // 0 and is a bitwise OR of all vertex clip codes and // ClipIntersection is initially 0xFFFFFFFF being a bitwise // AND of all vertex clip codes. Both are set to 0 if // D3DRS_CLIPPING is FALSE. The TD3DClipStatus is updated // during drawing calls, so to compute a particular objects // clip status, initialize ClipUnion and ClipIntersection // and continue drawing. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if the argument is invalid. // Params: pClipStatus - // The ClipStatus parameter references the TD3DClipStatus // component describing the current clip status when the // method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetClipStatus( D3DCLIPSTATUS9* pClipStatus ); // ---------------------------------------------------------------------- // Method: GetCreationParameters() // Description: The TDx9_3DDevice::GetCreationParameters() method will // retrieve the parameters used when this device was // created. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if the argument is invalid. // Params: pParameters - // The Parameters parameter will reference the // TD3DDevice_Creation_Parameters component holding the // retrieved creation parameters when the method returns. // // TD3DDevice_Creation_Parameters->AdapterOrdinal will // contain the ordinal of the adapter represented by this // device. // ---------------------------------------------------------------------- virtual bool __fastcall GetCreationParameters( D3DDEVICE_CREATION_PARAMETERS* pParameters ); // ---------------------------------------------------------------------- // Method: GetCurrentTexturePalette() // Description: The TDx9_3DDevice::GetCurrentTexturePalette() method will // retrieve the current texture palette. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if PaletteNumber is an invalid // pointer. // Params: pPaletteNumber - // The PaletteNumber parameter will reference a value // identifying the current texture palette when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetCurrentTexturePalette( uint* pPaletteNumber ); // ---------------------------------------------------------------------- // Method: GetDepthStencilSurface() // Description: The TDx9_3DDevice::GetDepthStencilSurface() method will // retrieve the depth stencil surface for this device. // // This call increases the reference count of the returned // TDx9_3DSurface, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if ZStencilSurface is an invalid // pointer. // D3DERR_NOTFOUND when there is no depth stencil buffer for // this device. // Params: pZStencilSurface - // The ZStencilSurface parameter will reference the // TDx9_3DSurface representing the depth stencil buffer when // the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetDepthStencilSurface( TDx9_3DSurface* pZStencilSurface ); // ---------------------------------------------------------------------- // Method: GetDeviceCaps() // Description: The TDx9_3DDevice::GetDeviceCaps() method will retrieve // the capabilties of the rendering device. // // This method will retrieve the software vertex pipeline // capabilities if the device is being used in software // vertex processing mode. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Caps is an invalid pointer. // Params: pCaps - // The Caps parameter will reference a TD3DCaps component // holding the retrieved device capabilties when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetDeviceCaps( D3DCAPS9* pCaps ); // ---------------------------------------------------------------------- // Method: GetDirect3D() // Description: The TDx9_3DDevice::GetDirect3D() method will retrieve the // TDx9_3D that created this device. // // This call increases the reference count of the returned // TDx9_3D, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if D3D9 is an invalid pointer. // Params: pD3D9 - // The D3D9 parameter will reference the TDx9_3D that // created this device when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetDirect3D( TDx9_3D* pD3D9 ); // ---------------------------------------------------------------------- // Method: GetDisplayMode() // Description: The TDx9_3DDevice::GetDisplayMode() method will retrieve // the spatial and color resolutions and the refresh // frequency of the display mode set for a specified swap // chain. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Mode is an invalid pointer or // SwapChain >= number of swap chains. // Params: pSwapChain - // The SwapChain parameter specifies for which swap chain // the display mode should be retrieved. // pMode - // The Mode parameter will reference a TD3DDisplayMode // component holding the retrieved display mode of the // adapter when the method returns. // // This is the adapter display mode, not the device. The // device display mode may be inactive if not in full screen // mode. // ---------------------------------------------------------------------- virtual bool __fastcall GetDisplayMode( uint pSwapChain, D3DDISPLAYMODE* pMode ); // ---------------------------------------------------------------------- // Method: GetFVF() // Description: The TDx9_3DDevice::GetFVF() method will retrieve the // fixed vertex function declaration. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if FVF is not a valid pointer. // Params: pFVF - // The FVF parameter references the fixed vertex function // type, as values of the D3DFVF constant. // ---------------------------------------------------------------------- virtual bool __fastcall GetFVF( dword* pFVF ); // ---------------------------------------------------------------------- // Method: GetFrontBufferData() // Description: The TDx9_3DDevice::GetFrontBufferData() method will // retrieve a copy of the front buffer into an application // allocated system memory buffer. // // This is the only way an antialiased screen shot can be // captured. This method is slow by design so don't use it // in performance critical paths. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DRIVERINTERNALERROR when an internal driver error // occurs. Your application should probably shut down if // this error is recieved. // D3DERR_DEVICELOST if the device has been lost and cannot // be reset for now. // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSwapChain - // The SwapChain parameter specifies for which swap chain // the front buffer data should be retrieved. // pDestSurface - // The DestSurface parameter references an application // allocated TDx9_3DSurface for holding the retrieved front // buffer data in system memory when the method returns. // // The returned data is converted into the standard 32 bits // per pixel format D3DFMT_A8R8G8B8. // ---------------------------------------------------------------------- virtual bool __fastcall GetFrontBufferData( uint pSwapChain, TDx9_3DSurface* pDestSurface ); // ---------------------------------------------------------------------- // Method: GetGammaRamp() // Description: The TDx9_3DDevice::GetGammaRamp() method will retrieve // the gamma correction ramp for a specified swap chain. // // Params: pSwapChain - // The SwapChain parameter specifies which swap chains gamma // correction ramp should be retrieved. // pRamp - // The Ramp parameter references a TD3DGammaRamp holding the // gamma correction ramp to be retrieved for the specified // swap chain. // ---------------------------------------------------------------------- virtual void __fastcall GetGammaRamp( uint pSwapChain, D3DGAMMARAMP* pRamp ); // ---------------------------------------------------------------------- // Method: GetIndices() // Description: The TDx9_3DDevice::GetIndices() method will retrieve the // TDx9_3DIndexBuffer for this device. // // This call increases the reference count of the returned // TDx9_3DIndexBuffer, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if IndexData is not a valid pointer or // there is no index. // Params: pIndexData - // The IndexData parameter will reference a // TDx9_3DIndexBuffer representing the retrieved index data // when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetIndices( TDx9_3DIndexBuffer* pIndexData ); // ---------------------------------------------------------------------- // Method: GetLight() // Description: The TDx9_3DDevice::GetLight() method will retrieve the // lighting properties of a specified light for this device. // // This method will not work for D3DCREATE_PUREDEVICE's. // Use TDx9_3DDevice::SetLight() to create and define the // light source and then TDx9_3DDevice::LightEnable() can be // used to activate light sources in a scene. New lights are // disabled by default. // TD3DCaps->MaxActiveLights defines how many lights can be // active for this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Index >= number of lights or Light // is not a valid pointer. // Params: pIndex - // The Index parameter specifies which light source // properties are to be retrieved. // pLight - // The Light parameter references a TD3DLight for holding // the retrieved lighting properties when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetLight( dword pIndex, D3DLIGHT9* pLight ); // ---------------------------------------------------------------------- // Method: GetLightEnable() // Description: The TDx9_3DDevice::GetLightEnable() method will indicate // whether a specified light is active or not. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Index >= number of lights or Enable // is not a valid pointer. // Params: pIndex - // The Index parameter specifies which light source's status // is to be retrieved. // pEnable - // The Enable parameter will references a value indicating // the status of the specified light when the method // returns. // // A value of 0 indicates the light is disabled, otherwise // the light is active. // ---------------------------------------------------------------------- virtual bool __fastcall GetLightEnable( dword pIndex, bool* pEnable ); // ---------------------------------------------------------------------- // Method: GetMaterial() // Description: The TDx9_3DDevice::GetMaterial() method will retrieve the // current material properties for this device. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Material is not a valid pointer. // Params: pMaterial - // The Material parameter references a TD3DMaterial // component for holding the retrieved material properties // when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetMaterial( D3DMATERIAL9* pMaterial ); // ---------------------------------------------------------------------- // Method: GetNPatchMode() // Description: The TDx9_3DDevice::GetNPatchMode() method will return how // many subdivision segments are set for this device. // // A return value less than 1.0 indicates N patches are // disabled. The default value is 0.0. // ---------------------------------------------------------------------- virtual FLOAT __fastcall GetNPatchMode(); // ---------------------------------------------------------------------- // Method: GetNumberOfSwapChains() // Description: The TDx9_3DDevice::GetNumberOfSwapChains() method will // return how many implicit swap chains were created in the // TDx9_3D::CreateDevice() call that created this device. // // TDx9_3DDevice::CreateAdditionalSwapChain() can be used to // create extra swap chains. // ---------------------------------------------------------------------- virtual UINT __fastcall GetNumberOfSwapChains(); // ---------------------------------------------------------------------- // Method: GetPaletteEntries() // Description: The TDx9_3DDevice::GetPaletteEntries() method will // retrieve the elements of a specified palette. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Entries is not a valid pointer. // Params: pPaletteNumber - // The PaletteNumber parameter specifies which palette to // retrieve. // pEntries - // The Entries parameter references a TD3DPaletteEntry // component for holding the retrieved palette entries when // the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetPaletteEntries( uint pPaletteNumber, PALETTEENTRY* pEntries ); // ---------------------------------------------------------------------- // Method: GetPixelShader() // Description: The TDx9_3DDevice::GetPixelShader() method will retrieve // the TDx9_3DPixelShader currently set for this device. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Shader is not a valid pointer. // Params: pShader - // The Shader parameter will reference the current // TDx9_3DPixelShader for this device when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetPixelShader( TDx9_3DPixelShader* pShader ); // ---------------------------------------------------------------------- // Method: GetPixelShaderConstantB() // Description: The TDx9_3DDevice::GetPixelShaderConstantB() method will // retrieve boolean pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first boolean constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved boolean constants when the method // returns. // pBoolCount - // The BoolCount parameter indicates how many boolean values // are are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetPixelShaderConstantB( uint pStartRegister, bool* pConstantData, uint pBoolCount ); // ---------------------------------------------------------------------- // Method: GetPixelShaderConstantF() // Description: The TDx9_3DDevice::GetPixelShaderConstantF() method will // retrieve floating point pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first floating point constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved floating point constants when the // method returns. // pVector4fCount - // The Vector4fCount parameter indicates how many four // floating point vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetPixelShaderConstantF( uint pStartRegister, float* pConstantData, uint pVector4fCount ); // ---------------------------------------------------------------------- // Method: GetPixelShaderConstantI() // Description: The TDx9_3DDevice::GetPixelShaderConstantI() method will // retrieve integer pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first integer constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved integer constants when the method // returns. // pVector4iCount - // The Vector4fCount parameter indicates how many four // integer vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetPixelShaderConstantI( uint pStartRegister, int* pConstantData, uint pVector4iCount ); // ---------------------------------------------------------------------- // Method: GetRasterStatus() // Description: The TDx9_3DDevice::GetRasterStatus() method will retrieve // the status of the monitor being used by the specified // swap chain. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if RasterStatus is an invalid pointer // or TD3DCaps->Caps->D3DCAPS_READ_SCANLINE is not // available. // Params: pSwapChain - // The SwapChain parameter specifies for which swap chain // the raster status should be retrieved. // pRasterStatus - // The RasterStatus parameter references a TD3DRaster_Status // component for holding the retrieved raster status // information when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetRasterStatus( uint pSwapChain, D3DRASTER_STATUS* pRasterStatus ); // ---------------------------------------------------------------------- // Method: GetRenderState() // Description: The TDx9_3DDevice::GetRenderState() method will retrieve // the current value of a specified render state type. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pState - // The State parameter specifies for which render state // type, as a value of the D3DRENDERSTATE enumerated type, // the value should be retrieved. // pValue - // The Value parameter will reference the value of the // specified render state type when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetRenderState( D3DRENDERSTATETYPE pState, dword* pValue ); // ---------------------------------------------------------------------- // Method: GetRenderTarget() // Description: The TDx9_3DDevice::GetRenderTarget() method will retrieve // the specified render target TDx9_3DSurface. // // Multiple render targets are now supported, to a maximum // of TD3DCaps->NumSumultaneousRTs. // This call increases the reference count of the returned // TDx9_3DSurface, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // D3DERR_NOTFOUND if there is no render target for the // specified RenderTargetIndex. // Params: pRenderTargetIndex - // The RenderTargetIndex parameter specifies the index of // the render target to retrieve. // pRenderTarget - // The RenderTarget parameter will reference the specified // render target TDx9_3DSurface when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetRenderTarget( dword pRenderTargetIndex, TDx9_3DSurface* pRenderTarget ); // ---------------------------------------------------------------------- // Method: GetRenderTargetData() // Description: The TDx9_3DDevice::GetRenderTargetData() method will // retrieve a copy of the data from a specified render // target. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DRIVERINTERNALERROR when an internal driver error // occurs. Your application should probably shut down if // this error is recieved. // D3DERR_DEVICELOST if the device has been lost and cannot // be reset for now. // D3DERR_INVALIDCALL if the format and/or size of the // source and destination surfaces do not match or it is a // multisampled render target. // Params: pRenderTarget - // The RenderTarget parameter references the render target // TDx9_3DSurface to copy. // // This surface must be a regular render target or render // target texture level created with POOL_DEFAULT. // pDestSurface - // The DestSurface parameter references the TDx9_3DSurface // for holding the copied surface data when the method // returns. // // This surface must be an off-screen plain surface or // texture level created with D3DPOOL_SYSTEMMEM. // ---------------------------------------------------------------------- virtual bool __fastcall GetRenderTargetData( TDx9_3DSurface* pRenderTarget, TDx9_3DSurface* pDestSurface ); // ---------------------------------------------------------------------- // Method: GetSamplerState() // Description: The TDx9_3DDevice::GetSamplerState() method will retrieve // the sampler state value for a specified sampler stage. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSampler - // The Sampler parameter specifies the index of the sampler // stage to retrieve. // pType - // The Type parameter indicates the type of sampler state to // retrieve, as a value of the D3DSAMPLERSTATETYPE // enumerated type. // pValue - // The Value parameter will reference the retrieved sampler // state value when the method returns. // // The actual meaning of this value depends on the Type // setting. // ---------------------------------------------------------------------- virtual bool __fastcall GetSamplerState( dword pSampler, D3DSAMPLERSTATETYPE pType, dword* pValue ); // ---------------------------------------------------------------------- // Method: GetScissorRect() // Description: The TDx9_3DDevice::GetScissorRect() method will retrieve // the scissor rectangle used as a clipping region for this // device if scissor testing is enabled. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Rect is an invalid pointer or there // is no scissor rectangle. // Params: pRect - // The Rect parameter will reference the retrieved rectangle // when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetScissorRect( TRect* pRect ); // ---------------------------------------------------------------------- // Method: GetSoftwareVertexProcessing() // Description: The TDx9_3DDevice::GetSoftwareVertexProcessing() method // will return TRUE if software vertex processing mode is // enabled and FALSE otherwise. // // For a mixed mode device, you can switch between hardware // and software vertex processing with // TDx9_3DDevice::SetSoftwareVertexProcessing(). // ---------------------------------------------------------------------- virtual bool __fastcall GetSoftwareVertexProcessing(); // ---------------------------------------------------------------------- // Method: GetStreamSource() // Description: The TDx9_3DDevice::GetStreamSource() method will retrieve // the TDx9_3DVertexBuffer() that is bound to a specified // data stream. // // This call increases the reference count of the returned // TDx9_3DVertexBuffer, so release it when you are done. // Streams are uniform arrays of component data, with each // component consisting of one or more values representing // information such as position, normal or color. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStreamNumber - // The StreamNumber parameter specifies which stream's // vertex buffer is to be retrieved. // // This is a value between 0 and the number of streams - 1. // pStreamData - // The StreamData parameter will reference the // TDx9_3DVertexBuffer bound to the specified data stream // when the method returns. // pOffsetInBytes - // The OffsetInBytes parameter will indicate the offset, in // bytes, from the start of the stream to the first vertex // when the method returns. // pStride - // The Stride parameter will reference the stride of the // retrieved vertex buffer when the method returns. // // A flexible vertex format (FVF) vertex shader's vertex // stream Stride must match the vertex size as computed from // the FVF. If using a declaration, Stride should be >= than // the stream size computed from the declaration. // ---------------------------------------------------------------------- virtual bool __fastcall GetStreamSource( uint pStreamNumber, TDx9_3DVertexBuffer* pStreamData, uint* pOffsetInBytes, uint* pStride ); // ---------------------------------------------------------------------- // Method: GetStreamSourceFreq() // Description: The TDx9_3DDevice::GetStreamSourceFreq() method will // retrieve the value of a specified steam source's // frequency divider. // // Vertex shaders can now be invoked more than once per // vertex. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStreamNumber - // The StreamNumber parameter specifies which stream's // frequency divider number is to be retrieved. // // This is a value between 0 and the number of streams - 1. // pDivider - // The Divider parameter will reference the frequency // divider value for the specified stream when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetStreamSourceFreq( uint pStreamNumber, uint* pDivider ); // ---------------------------------------------------------------------- // Method: GetSwapChain() // Description: The TDx9_3DDevice::GetSwapChain() method will retrieve a // copy of a specified TDx9_3DSwapChain. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSwapChain - // The SwapChain parameter specifies the ordinal of the // TDx9_3DSwapChain to be copied. // pSwapChainPointer - // The SwapChainPointer parameter references the // TDx9_3DSwapChain that is to hold the copied swap chain // when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetSwapChain( uint pSwapChain, TDx9_3DSwapChain* pSwapChainPointer ); // ---------------------------------------------------------------------- // Method: GetTexture() // Description: The TDx9_3DDevice::GetTexture() method will retrieve the // TDx9_3DTexture bound to the specified texture stage. // // This call increases the reference count of the returned // TDx9_3DTexture, so release it when you are done. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStage - // The Stage parameter specifies from which texture stage // the texture is to be retrieved. // // This will be a value between 0 and the number of texture // stages - 1. As a device may have a maximum of 8 set // textures, the maximum stage identifier is 7. // pTexture - // The Texture parameter will reference the retrieved // TDx9_3DTexture when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetTexture( dword pStage, TDx9_3DBaseTexture* pTexture ); // ---------------------------------------------------------------------- // Method: GetTextureStageState() // Description: The TDx9_3DDevice::GetTextureStageState() method will // retrieve the state value for a specified texture stage. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStage - // The Stage parameter specifies from which texture stage // the state value is to be retrieved. // // This will be a value between 0 and the number of texture // stages - 1. As a device may have a maximum of 8 set // textures, the maximum value here is 7. // pType - // The Type parameter indicates the type of texture state to // retrieve, as a value of the D3DTEXTURESTAGESTATETYPE // enumerated type. // pValue - // The Value parameter will reference the retrieved texture // state value when the method returns. // // The actual meaning of this value depends on the Type // setting. // ---------------------------------------------------------------------- virtual bool __fastcall GetTextureStageState( dword pStage, D3DTEXTURESTAGESTATETYPE pType, dword* pValue ); // ---------------------------------------------------------------------- // Method: GetTransform() // Description: The TDx9_3DDevice::GetTransform() method will retrieve a // transformation state matrix. // // This method will not work for D3DCREATE_PUREDEVICE's. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pState - // The State parameter indicates the transform type to // retrieve, as a value of the D3DTRANSFORMSTATETYPE // enumerated type or the D3DTS_WORLDMATRIX macro. // pMatrix - // The Matrix parameter will reference a TD3DMatrix // component for holding the retrieved transform matrix when // the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetTransform( D3DTRANSFORMSTATETYPE pState, D3DMATRIX* pMatrix ); // ---------------------------------------------------------------------- // Method: GetVertexDeclaration() // Description: The TDx9_3DDevice::GetVertexDeclaration() method will // retrieve the vertex shader declaration for this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pDecl - // The Decl parameter will reference a // TDx9_3DVertexDeclaration component representing the // vertex shader declaration for this device when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexDeclaration( TDx9_3DVertexDeclaration* pDecl ); // ---------------------------------------------------------------------- // Method: GetVertexShader() // Description: The TDx9_3DDevice::GetVertexShader() method will retrieve // the TDx9_3DVertexShader currently set for this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Shader is not a valid pointer. // Params: pShader - // The Shader parameter will reference the current // TDx9_3DVertexShader for this device when the method // returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexShader( TDx9_3DVertexShader* pShader ); // ---------------------------------------------------------------------- // Method: GetVertexShaderConstantB() // Description: The TDx9_3DDevice::GetVertexShaderConstantB() method will // retrieve boolean vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first boolean constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved boolean constants when the method // returns. // pBoolCount - // The BoolCount parameter indicates how many boolean values // are are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexShaderConstantB( uint pStartRegister, bool* pConstantData, uint pBoolCount ); // ---------------------------------------------------------------------- // Method: GetVertexShaderConstantF() // Description: The TDx9_3DDevice::GetVertexShaderConstantF() method will // retrieve floating point vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first floating point constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved floating point constants when the // method returns. // pVector4fCount - // The Vector4fCount parameter indicates how many four // floating point vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexShaderConstantF( uint pStartRegister, float* pConstantData, uint pVector4fCount ); // ---------------------------------------------------------------------- // Method: GetVertexShaderConstantI() // Description: The TDx9_3DDevice::GetVertexShaderConstantI() method will // retrieve integer vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first integer constant to retrieve. // pConstantData - // The ConstantData parameter references an array for // holding the retrieved integer constants when the method // returns. // pVector4iCount - // The Vector4fCount parameter indicates how many four // integer vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexShaderConstantI( uint pStartRegister, int* pConstantData, uint pVector4iCount ); // ---------------------------------------------------------------------- // Method: GetViewport() // Description: The TDx9_3DDevice::GetViewport() method will retrieve the // current viewport parameters of this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Viewport is an invalid pointer. // Params: pViewport - // The Viewport parameter references a TD3DViewport // component that will hold the retrieved viewport // parameters when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetViewport( D3DVIEWPORT9* pViewport ); // ---------------------------------------------------------------------- // Method: LightEnable() // Description: The TDx9_3DDevice::LightEnable() method will enable or // disable a specified set of lighting parameters. // // When LightIndex specifies a non existent light, a new one // will be created and set to the status in Enable. // The TD3DLight properties for the new light will be as // follows: // Type: D3DLIGHT_DIRECTIONAL // Diffuse: (R:1, G:1, B:1, A:0) // Specular: (R:0, G:0, B:0, A:0) // Ambient: (R:0, G:0, B:0, A:0) // Position: (0, 0, 0) // Direction: (0, 0, 1) // Range: 0 // Falloff: 0 // Attenuation0: 0 // Attenuation1: 0 // Attenuation2: 0 // Theta: 0 // Phi: 0 // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided or // an additional light cannot be created. // Params: pLightIndex - // The LightIndex parameter specifies which lights status to // change. // pEnable - // The Enable parameter defines the specified lights enable // status. // // TRUE to enable and FALSE to disable. // ---------------------------------------------------------------------- virtual bool __fastcall LightEnable( dword pLightIndex, bool pEnable ); // ---------------------------------------------------------------------- // Method: MultiplyTransform() // Description: The TDx9_3DDevice::MultiplyTransform() method will // multiply the world, view or projection matrix by an // application defined matrix. // // The order of operation is Matrix times State. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // Params: pState - // The State parameter indicates the transform type to // multiply, as a value of the D3DTRANSFORMSTATETYPE // enumerated type or the D3DTS_WORLDMATRIX macro. // pMatrix - // The Matrix parameter references a TD3DMatrix component // holding the matrix to be used in the multiplication. // ---------------------------------------------------------------------- virtual bool __fastcall MultiplyTransform( D3DTRANSFORMSTATETYPE pState, D3DMATRIX* pMatrix ); // ---------------------------------------------------------------------- // Method: Present() // Description: The TDx9_3DDevice::Present() method will present the // contents of the next back buffer in the swap chain to the // front buffer. // // If SourceRect and DestRect are different sizes, a stretch // operation will be applied. // For those familiar with older versions of DirectX, this // operation is somewhat similar to a Flip call. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DEVICELOST if the device is lost and cannot be // reset right now. // D3DERR_DRIVERINTERNALERROR when there was an internal // driver error. Your application should probably shut down // if this error is returned. // D3DERR_INVALIDCALL if invalid parameters are provided or // the call falls between BeginScene and EndScene // (exception: render target is not the current render // target) // Params: pSourceRect - // The SourceRect parameter specifies the source rectangle // for the presentation. // // A setting of NULL indicates the entire source surface is // presented and NULL must be set unless the swap chain was // created with D3DSWAPEFFECT_COPY. // Should SourceRect exceed the size of the source surface, // it will be clipped to the size of the source surface. // pDestRect - // The DestRect parameter specifies the destination // rectangle, in window client coordinates, for the // presentation. // // A setting of NULL indicates the entire client area is // filled and NULL must be set unless the swap chain was // created with D3DSWAPEFFECT_COPY. // Should DestRect exceed the size of the destination client // area, it will be clipped to the size of the client area. // pDestWindowOverride - // The DestWindowOverride parameter references a destination // window whose client area will be the target for the // presentation. // // Set NULL to use the value of // TD3DPresent_Parameters->WndDeviceWindow as the // destination. // pDirtyRegion - // The DirtyRegion parameter specifies a set of regions // representing the minimal set of pixels that need // updating. // // This can help optimise the presentation by copying only // those pixels, but should not be relied upon to copy the // region exactly. // This value must be NULL unless the swap chain was created // with D3DSWAPEFFECT_COPY. // ---------------------------------------------------------------------- virtual bool __fastcall Present( TRect* pSourceRect, TRect* pDestRect, HWND pDestWindowOverride, RGNDATA* pDirtyRegion ); // ---------------------------------------------------------------------- // Method: ProcessVertices() // Description: The TDx9_3DDevice::ProcessVertices() method will process // the input data steams using a vertex shader and place the // resulting interleaved vertex data into the destination // vertex buffer. // // The order of operations performed is: // Vertices are transformed into projection space using the // world + view + projection matrix // Viewport settings are used to compute screen coordinates // If enabled, clipping codes are computed and put into an // internal buffer associated with the destination vertex // buffer. If a vertex is inside the viewing frustrum its // screen coordinates are calculated, otherwise it is stored // in the destination vertex buffer in projection space // coordinates. There is no user access to the internal clip // code buffer and no clipping of triangles or other // primitives is done. // // If the output texture coordinate format defines more // coordinates than are copied, transformed or generated, // Direct3D does not change those extra components. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL when invalid parameters are provided. // Params: pSrcStartIndex - // The SrcStartIndex parameter specifies which vertex to // start from in the input stream. // pDestIndex - // The DestIndex parameter specifies where to start storing // the processed vertices in the destination vertex buffer. // pVertexCount - // The VertexCount parameter indicates how many vertices are // to be processed. // pDestBuffer - // The DestBuffer parameter references the // TDx9_3DVertexBuffer that will represent the interleaved // vertex data produced by this method. // // TDx9_3DDevice::CreateVertexBuffer->FVF cannot have been // zero when this vertex buffer was created as this FVF // value dictates the vertex elements present in the // destination vertex buffer. // pVertexDecl - // The VertexDecl parameter references the // TDx9_3DVertexDeclaration representing the output vertex // data declaration. // // When using vertex shader 3.0 or above, this vertex // declaration must be present. // pFlags - // The Flags parameter can be set to 0 for default // processing or D3DPV_DONOTCOPYDATA combined with one or // more values of the D3DLOCK constant appropriate to the // destination vertex buffer. // // Setting D3DPV_DONOTCOPYDATA means that only vertices // affected by the vertex operation will be copied into the // destination vertex buffer. // ---------------------------------------------------------------------- virtual bool __fastcall ProcessVertices( uint pSrcStartIndex, uint pDestIndex, uint pVertexCount, TDx9_3DVertexBuffer* pDestBuffer, TDx9_3DVertexDeclaration* pVertexDecl, dword pFlags ); // ---------------------------------------------------------------------- // Method: Reset() // Description: The TDx9_3DDevice::Reset() method will redefine the type, // size and format of the swap chain. // // The call must be made on the same thread as created the // device. // All explicit render targets, depth stencil surfaces, // state blocks, extra swap chains and D3DPOOL_DEFAULT // resources associated with the device should be released // prior to calling this method. // This call loses all texture memory surfaces and state // information and flushes managed textures from video // memory but pixel and vertex shaders will survive and need // not be explicitly recreated. // // If the new swap chain settings indicate it is full // screen, the adapter will be placed into the display mode // matching the new size. Only one full screen swap chain is // allowed per device and full screen mode requires the back // buffer format be specified. // D3DFMT_UNKNOWN can be specified as the windowed mode back // buffer format in calls to this method, // TDx9_3D::CreateDevice() and TDx9_3DDevice::Reset(), so // you dont need to retrieve the current desktop format // before making this call for windowed mode. // // Until this call returns, avoid making any Direct3D calls // and your application can expect messages to be sent to it // during the call. // When this method fails the device is put into the "lost" // state unless its already "not reset". // TDx9_3DDevice::TestCooperativeLevel() can be used to // check for these states, returning D3DERR_DEVICELOST or // D3DERR_DEVICENOTRESET respectively. // After this method fails, only TDx9_3DDevice::Reset(), // TDx9_3DDevice::TestCooperativeLevel() and the various // Release member functions can be used. Attempting to call // any other method may generate an exception, with // potentially fatal results for your application. // // If reseting multiple adapters in a group, // PresentationParameters should reference a // TD3DPresent_Parameters component holding one set of // presentation parameters for each display in the adapter // group. For multihead devices created with // D3DCREATE_ADAPTERGROUP_DEVICE, these presentation // parameters must each specify full screen display, // windowed mode is only accessible by destroying the device // and recreating a non multihead device in windowed mode. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DEVICELOST if the device is lost and cannot be // reset right now. // D3DERR_DRIVERINTERNALERROR when there was an internal // driver error. Your application should probably shut down // if this error is returned. // D3DERR_INVALIDCALL if invalid parameters are provided. // D3DERR_OUTOFVIDEOMEMORY if not enough display memory was // available for the operation. // E_OUTOFMEMORY if not enough memory could be allocated to // complete the call. // Params: pPresentationParameters - // The PresentationParameters parameter references a // TD3DPresent_Parameters component holding the new // presentation parameters. // // TD3DPresent_Parameters->BackBufferCount = 0 results in // one back buffer. // // For multihead device's there must be several sets of new // presentation parameters in the TD3DPresent_Parameters, // one for each head, all specifying full screen mode. // // When the method returns the // TD3DPresent_Parameters->BackBufferCount, // TD3DPresent_Parameters->BackBufferWidth and // TD3DPresent_Parameters->BackBufferHeight will all be set // to 0. // TD3DPresent_Parameters->BackBufferFormat is // D3DFMT_UNKNOWN for windowed mode only. // ---------------------------------------------------------------------- virtual bool __fastcall Reset( D3DPRESENT_PARAMETERS* pPresentationParameters ); // ---------------------------------------------------------------------- // Method: SetClipPlane() // Description: The TDx9_3DDevice::SetClipPlane() method will define the // coefficients of a user defined clipping plane. // // Set the corresponding bit in the DWORD applied to the // D3DRS_CLIPPLANEENABLE render state to enable the clipping // plane being defined here. // // The set coefficients take the form of the general plane // equation. Labelling the Plane elements A, B, C and D, the // equation would be Ax + By + Cz + Dw =0. A homogenous // coordinate point (x, y, z, w) is visible if Ax + By + Cz // + Dw >= 0, othewise it is clipped from the scene. // For fixed function pipelines the plane equations are // assumed to be in world space and for programmable // pipelines they are assumed to be in clipping space, which // is the same space as the output vertices. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Index > maximum supported clipping // planes or the Plane array is too small for four floating // point values. // Params: pIndex - // The Index parameter specifies the index of the clipping // plane to be defined. // pPlane - // The Plane parameter references the clipping plane // coefficients, as 4 floating point array elements, in the // form of the general plane equation that will be set. // ---------------------------------------------------------------------- virtual bool __fastcall SetClipPlane( dword pIndex, float* pPlane ); // ---------------------------------------------------------------------- // Method: SetClipStatus() // Description: The TDx9_3DDevice::SetClipStatus() method will set the // clip status. // // Clip status is used for software vertex processing so // this method will not work on hardware vertex processing // devices. // Since TDx9_3DDevice::DrawRectPatch() and // TDx9_3DDevice::DrawTriPatch() are hardware only methods, // clip status will not be updated by those calls. // // When vertices are being processed a clip code is computed // for each one. The clip code is a combination of D3DCS_*** // bits, the relevant bit being set when the vertex falls // outsite a particular clipping plane. The clip status is // maintained using TD3DClipStatus->ClipUnion and // TD3DClipStatus->ClipIntersection, ClipUnion is initially // 0 and is a bitwise OR of all vertex clip codes and // ClipIntersection is initially 0xFFFFFFFF being a bitwise // AND of all vertex clip codes. Both are set to 0 if // D3DRS_CLIPPING is FALSE. The TD3DClipStatus is updated // during drawing calls, so to compute a particular objects // clip status, initialize ClipUnion and ClipIntersection // and continue drawing. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if ClipStatus is invalid. // Params: pClipStatus - // The ClipStatus parameter references the TD3DClipStatus // component describing the clip status that is to be set. // ---------------------------------------------------------------------- virtual HRESULT __fastcall SetClipStatus( D3DCLIPSTATUS9* pClipStatus ); // ---------------------------------------------------------------------- // Method: SetCurrentTexturePalette() // Description: The TDx9_3DDevice::SetCurrentTexturePalette() method will // define which texture palette the device should use. // // There is one logical texture palette per device that is // shared by all texture stages. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if PaletteNumber is an invalid // pointer. // Params: pPaletteNumber - // The PaletteNumber parameter indicates which texture // palette should be set as the current one for this device. // ---------------------------------------------------------------------- virtual bool __fastcall SetCurrentTexturePalette( uint pPaletteNumber ); // ---------------------------------------------------------------------- // Method: SetCursorPosition() // Description: The TDx9_3DDevice::SetCursorPosition() method will define // the current cursor position and update options. // // Full screen space coordinates are back buffer coordinates // scaled to the current display mode. Windowed screen space // coordinates are the desktop coordinates. // The cursor will be drawn at the specified position minus // the hotspot settings from // TDx9_3DDevice::SetCursorProperties() unless hidden by // TDx9_3DDevice::ShowCursor(). // Params: pX - // The X parameter defines the cursors new x axis position // in virtual desktop coordinates. // pY - // The Y parameter defines the cursors new y axis position // in virtual desktop coordinates. // pFlags - // The Flags parameter indicates when the cursor should be // updated. // // Setting no flag indicates the cursor should be updated on // the next TDx9_3DDevice::Present() call. // This usually results in better performance so unless // Present calls are widely enough spaced for users to // notice a delay in cursor update, this is usually the best // option. // Flags: // D3DCURSOR_IMMEDIATE_UPDATE - // Update the cursor at the refresh rate. // // The actual refresh rate is: rate/2 <= update >= // rate. // This flag is meaningless for windowed mode // applications and hardware color cursors. // ---------------------------------------------------------------------- virtual void __fastcall SetCursorPosition( int pX, int pY, dword pFlags ); // ---------------------------------------------------------------------- // Method: SetCursorProperties() // Description: The TDx9_3DDevice::SetCursorProperties() method can // define the image and hotspot for the cursor. // // An emulated cursor is used unless // TD3DCaps->CursorCaps->D3DCURSORCAPS_COLOR is set and the // cursor is 32x32 OR the application is in windowed mode, // in which case an operating system cursor is created and // used. // Emulated cursors are moved with // TDx9_3DDevice::SetCursorPosition(). // // Generally its best if your application traps WM_MOUSEMOVE // events and calls the DXSetCursorPosition function. // // Hardware cursor support can be determined by checking // TD3DCaps->CursorCaps. Usually hardware and system cursors // are 32x32 only, so if you provide a different image size // in this call, the image and hotspot will be scaled to // 32x32. // // Losing the device loses the cursor, so call this method // again after a TDx9_3DDevice::Reset(). // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pXHotSpot - // The XHotSpot parameter defines an X axis offset, in // pixels, marking the center of the cursor relative to the // left side of the cursor. // // The cusor image will be offset by subtracting this amount // from the position coordinate. // pYHotSpot - // The YHotSpot parameter defines an Y axis offset, in // pixels, marking the center of the cursor relative to the // top side of the cursor. // // The cusor image will be offset by subtracting this amount // from the position coordinate. // pCursorBitmap - // The CursorBitmap parameter references a TDx9_3DSurface // holding the cursor image to use. // // This must be a D3DFMT_A8R8G8B8 surface with alpa set to // 0.0 or 1.0, smaller than the display mode and with // dimensions that are powers of two, though not // neccessarily equal. // The image will be copied to an internal buffer from which // the cursor is displayed. // ---------------------------------------------------------------------- virtual bool __fastcall SetCursorProperties( uint pXHotSpot, uint pYHotSpot, TDx9_3DSurface* pCursorBitmap ); // ---------------------------------------------------------------------- // Method: SetDepthStencilSurface() // Description: The TDx9_3DDevice::SetSepthStencilSurface() method will // set the depth stencil surface for this device. // // The multisample type must match and the format be // compatible with that of the render target. The depth // stencil surface must be at least as large as the render // target. // TDx9_3D::CheckDepthStencilMatch() can help check the // formats are compatible. // It is up to the application to enforce these requirements // unless the debug runtime is being used, in which case the // restrictions will be validated when Drawing calls are // made. // // As cube textures represent a collection of surfaces, you // must retrieve individual face surfaces with // TDx9_3DCubeTexture::GetCubeMapSurface() then call this // method with the returned surface. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if NewZStencil is not NULL and // references an invalid surface. // Params: pZStencilSurface - // The ZStencilSurface parameter references the // TDx9_3DSurface that will represent the depth stencil // buffer. // // Set NULL to disable the depth stencil operation. // ---------------------------------------------------------------------- virtual bool __fastcall SetDepthStencilSurface( TDx9_3DSurface* pZStencilSurface ); // ---------------------------------------------------------------------- // Method: SetDialogBoxMode() // Description: The TDx9_3DDevice::SetDialogBoxMode() method will enable // the use of Graphics Device Interface (GDI) dialog boxes // in full screen applications. // // Create the dialog boxes from the same thread as created // the device, as child to the device window. // In windowed mode there will be no effect, but the // specified setting will be retained if the device is reset // into full screen mode, though when that occurs, the // restrictions listed below still apply. // All of the swap chains back buffers will be discarded and // need to be refreshed after this call. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL unless ALL of these conditions are // met: Not between TDx9_3DDevice::BeginScene and // TDx9_3DDevice::EndScene, GDI compatible back buffer // format (D3DFMT_X1R5G5B5, D3DFMT_R5G6B5 or // D3DFMT_X8R8G8B8), no multisampling, D3DSWAPEFFECT_DISCARD // and D3DPRESENTFLAG_LOCKABLE_BACKBUFFER are set and // D3DCREATE_ADAPTERGROUP_DEVICE is not set. // Params: pEnableDialogs - // The EnableDialogs parameter indicates whether GDI dialog // boxes should be enabled. // // Set TRUE to enable, FALSE to disable. // ---------------------------------------------------------------------- virtual bool __fastcall SetDialogBoxMode( bool pEnableDialogs ); // ---------------------------------------------------------------------- // Method: SetFVF() // Description: The TDx9_3DDevice::SetFVF() method will define the fixed // vertex function declaration. // // To set a fixed-function vertex shader, release any // defined programmable shader with a NULL call to // TDx9_3DDevice::SetVertexShader(), then call this method // with the fixed function vertex format. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if FVF is not a valid pointer. // Params: pFVF - // The FVF parameter defines the fixed vertex function type, // as values of the D3DFVF constant. // ---------------------------------------------------------------------- virtual bool __fastcall SetFVF( dword pFVF ); // ---------------------------------------------------------------------- // Method: SetGammaRamp() // Description: The TDx9_3DDevice::SetGammaRamp() method will define the // gamma correction ramp for a specified swap chain. // // The gamma ramp will affect the whole screen even in // windowed mode and take immediate effect without waiting // for a vertical sync. // No error will be returned if gamma ramps are unsupported. // Check TD3DCaps->Caps2 for the D3DCAPS2_FULLSCREENGAMMA // and D3DCAPS2_CANCALIBRATEGAMMA capabilties. // TDx9_3DSwapChain::Present() can be used for windowed // gamma correction presentation if hardware support exists // for the feature. // Params: pSwapChain - // The SwapChain parameter specifies which swap chains gamma // correction ramp should be defined. // pFlags - // The Flags parameter indicates whether calibration should // be used. // // Gamma correction can result in more consistent display // but incurs some performance penalty. Short effects should // not be calibrated but longer duration gamma changes // should be calibrated. // Flags: // D3DSGR_CALIBRATE - // Modify the ramp to account for system and monitor // response curves before sending it to the device. // If no gamma calibrator is installed the ramp gets // passed directly to the device. // D3DSGR_NO_CALIBRATION - // Send the ramp directly to the device without // calibrating. // pRamp - // The Ramp parameter references a TD3DGammaRamp holding the // gamma correction ramp to be set for the specified swap // chain. // ---------------------------------------------------------------------- virtual void __fastcall SetGammaRamp( uint pSwapChain, dword pFlags, D3DGAMMARAMP* pRamp ); // ---------------------------------------------------------------------- // Method: SetIndices() // Description: The TDx9_3DDevice::SetIndices() method will define the // current index array for this device. // // This set of indices will be used to index all steams. // When all references to the TDx9_3DIndexBuffer are // released, it is freed. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if IndexData is not a valid pointer or // there is no index. // Params: pIndexData - // The IndexData parameter references a TDx9_3DIndexBuffer // representing the index data to be set for this device. // ---------------------------------------------------------------------- virtual bool __fastcall SetIndices( TDx9_3DIndexBuffer* pIndexData ); // ---------------------------------------------------------------------- // Method: SetLight() // Description: The TDx9_3DDevice::SetLight() method will define the // lighting properties of a specified light for this device. // // Create and/or define the light source with this method // and then TDx9_3DDevice::LightEnable() can be used to // activate light sources in a scene. New lights are // disabled by default. // TD3DCaps->MaxActiveLights defines how many lights can be // simultaneously enabled for the device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pIndex - // The Index parameter specifies which light source // properties are to be defined. // // If lighting properties already exist at this index, they // will be overwritten with the new properties. // pLight - // The Light parameter references a TD3DLight holding the // lighting properties to be set for the specified light. // ---------------------------------------------------------------------- virtual bool __fastcall SetLight( dword pIndex, D3DLIGHT9* pLight ); // ---------------------------------------------------------------------- // Method: SetMaterial() // Description: The TDx9_3DDevice::SetMaterial() method will define the // material properties for this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Material is not valid. // Params: pMaterial - // The Material parameter references a TD3DMaterial // component holding the material properties to be set. // ---------------------------------------------------------------------- virtual bool __fastcall SetMaterial( D3DMATERIAL9* pMaterial ); // ---------------------------------------------------------------------- // Method: SetNPatchMode() // Description: The TDx9_3DDevice::SetNPatchMode() method will define how // many subdivision segments to set for this device. // Params: pSegments - // The Segments parameter specifies the number of // subdivision segments. // // A value less than 1.0 indicates N patches are disabled. // The default value is 0.0. // ---------------------------------------------------------------------- virtual bool __fastcall SetNPatchMode( float pSegments ); // ---------------------------------------------------------------------- // Method: SetPaletteEntries() // Description: The TDx9_3DDevice::SetPaletteEntries() method will define // the elements of a specified palette. // // There is one logical palette per device that is shared by // all stages. // If TD3DCaps->TextureCaps->3DPTEXTURECAPS_ALPHAPALETTE is // not set, every palette entry must have alpha set to 1.0, // otherwise any alpha value is allowed though the debug // runtime will warn if all palette entries have an alpha of // 0. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided // Params: pPaletteNumber - // The PaletteNumber parameter specifies which palette to // define. // pEntries - // The Entries parameter references a TD3DPaletteEntry // component holding the palette entries to be set. // // There are assumed to be 256 palette entries in the // TD3DPaletteEntry component. // ---------------------------------------------------------------------- virtual bool __fastcall SetPaletteEntries( uint pPaletteNumber, PALETTEENTRY* pEntries ); // ---------------------------------------------------------------------- // Method: SetPixelShader() // Description: The TDx9_3DDevice::SetPixelShader() method will assign a // previously defined TDx9_3DPixelShader to this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Shader is invalid. // Params: pShader - // The Shader parameter references the TDx9_3DPixelShader to // assign to the device. // ---------------------------------------------------------------------- virtual bool __fastcall SetPixelShader( TDx9_3DPixelShader* pShader ); // ---------------------------------------------------------------------- // Method: SetPixelShaderConstantB() // Description: The TDx9_3DDevice::SetPixelShaderConstantB() method will // define boolean pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first boolean constant to define. // pConstantData - // The ConstantData parameter references an array holding // the boolean constants to be defined. // pBoolCount - // The BoolCount parameter indicates how many boolean values // are are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetPixelShaderConstantB( uint pStartRegister, bool* pConstantData, uint pBoolCount ); // ---------------------------------------------------------------------- // Method: SetPixelShaderConstantF() // Description: The TDx9_3DDevice::SetPixelShaderConstantF() method will // define floating point pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first floating point constant to define. // pConstantData - // The ConstantData parameter references an array holding // the floating point constants to be defined. // pVector4fCount - // The Vector4fCount parameter indicates how many four // floating point vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetPixelShaderConstantF( uint pStartRegister, float* pConstantData, uint pVector4fCount ); // ---------------------------------------------------------------------- // Method: SetPixelShaderConstantI() // Description: The TDx9_3DDevice::SetPixelShaderConstantI() method will // define integer pixel shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first integer constant to define. // pConstantData - // The ConstantData parameter references an array holding // the integer constants to be defined. // pVector4iCount - // The Vector4fCount parameter indicates how many four // integer vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetPixelShaderConstantI( uint pStartRegister, int* pConstantData, uint pVector4iCount ); // ---------------------------------------------------------------------- // Method: SetRenderState() // Description: The TDx9_3DDevice::SetRenderState() method will define // the value of a specified render state type. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pState - // The State parameter specifies for which render state // type, as a value of the D3DRENDERSTATE enumerated type, // the value should be defined. // pValue - // The Value parameter specifies what value the specified // render state type should have. // // The meaning of this value depends on the State setting. // For example, if State was D3DRS_SHADEMODE then this // value should be a value of the D3DSHADEMODE enumerated // type. // ---------------------------------------------------------------------- virtual bool __fastcall SetRenderState( D3DRENDERSTATETYPE pState, dword pValue ); // ---------------------------------------------------------------------- // Method: SetRenderTarget() // Description: The TDx9_3DDevice::SetRenderTarget() method will define // the specified render targets TDx9_3DSurface. // // Multiple render targets are now supported, to a maximum // of TD3DCaps->NumSumultaneousRTs. // In debug builds, some hardware tests depth stencil buffer // / render target compatibility. // // The multisample type must match and the format be // compatible with that of the depth stencil surface. The // depth stencil surface must be at least as large as the // render target. // TDx9_3D::CheckDepthStencilMatch() can help check the // formats are compatible. // It is up to the application to enforce these requirements // unless the debug runtime is being used, in which case the // restrictions will be validated when Drawing calls are // made. // // As cube textures represent a collection of surfaces, you // must retrieve individual face surfaces with // TDx9_3DCubeTexture::GetCubeMapSurface() then call this // method with the returned surface. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if RenderTargetIndex is 0 and // RenderTarget is NULL or the provided TDx9_3DSurface is // invalid. // Params: pRenderTargetIndex - // The RenderTargetIndex parameter specifies the index of // the render target to define. // pRenderTarget - // The RenderTarget parameter references the TDx9_3DSurface // to be used as a render target. // // Set NULL to disable the specified RenderTargetIndex. // This TDx9_3DSurface must have at least // D3DUSAGE_RENDERTARGET set. // ---------------------------------------------------------------------- virtual bool __fastcall SetRenderTarget( dword pRenderTargetIndex, TDx9_3DSurface* pRenderTarget ); // ---------------------------------------------------------------------- // Method: SetSamplerState() // Description: The TDx9_3DDevice::SetSamplerState() method will define // the sampler state value for a specified sampler stage. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSampler - // The Sampler parameter specifies the index of the sampler // stage to define. // pType - // The Type parameter indicates the type of sampler state to // define, as a value of the D3DSAMPLERSTATETYPE enumerated // type. // pValue - // The Value parameter defines the sampler state value to be // set. // // The actual meaning of this value depends on the Type // setting. // ---------------------------------------------------------------------- virtual bool __fastcall SetSamplerState( dword pSampler, D3DSAMPLERSTATETYPE pType, dword pValue ); // ---------------------------------------------------------------------- // Method: SetScissorRect() // Description: The TDx9_3DDevice::SetScissorRect() method will define // the scissor rectangle used as a clipping region for this // device if scissor testing is enabled. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Rect is invalid. // Params: pRect - // The Rect parameter references the rectangle to set as the // scissor rectangle. // ---------------------------------------------------------------------- virtual bool __fastcall SetScissorRect( TRect* pRect ); // ---------------------------------------------------------------------- // Method: SetSoftwareVertexProcessing() // Description: The TDx9_3DDevice::SetSoftwareVertexProcessing() method // will switch between hardware and software vertex // processing on a mixed mode device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL unless the device was created with // D3DCREATE_MIXED_VERTEXPROCESSING. // Params: pSoftware - // The Software parameter indicates whether software vertex // processing should be used. // // Set TRUE to enable software vertex processing, FALSE for // hardware vertex processing. // On creation of a mixed mode device, the default is FALSE. // ---------------------------------------------------------------------- virtual bool __fastcall SetSoftwareVertexProcessing( bool pSoftware ); // ---------------------------------------------------------------------- // Method: SetStreamSource() // Description: The TDx9_3DDevice::SetStreamSource() method will bind a // TDx9_3DVertexBuffer to a specified data stream. // // When all references to the TDx9_3DVertexBuffer are // released, it is freed. // Streams are uniform arrays of component data, with each // component consisting of one or more values representing // information such as position, normal or color. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStreamNumber - // The StreamNumber parameter specifies which stream's // vertex buffer is to be set. // // This must be a value between 0 and the number of streams // - 1. // pStreamData - // The StreamData parameter references the // TDx9_3DVertexBuffer to be bound to the specified data // stream. // pOffsetInBytes - // The OffsetInBytes parameter indicates the offset, in // bytes, from the start of the stream to the first vertex. // // If TD3DCaps->DevCaps2 has D3DDEVCAPS2_STREAMOFFSET set, // stream offsets are supported. // pStride - // The Stride parameter specifies the stride of the vertex // buffer. // // A flexible vertex format (FVF) vertex shader's vertex // stream Stride must match the vertex size as computed from // the FVF. If using a declaration, Stride should be >= than // the stream size computed from the declaration. // ---------------------------------------------------------------------- virtual bool __fastcall SetStreamSource( uint pStreamNumber, TDx9_3DVertexBuffer* pStreamData, uint pOffsetInBytes, uint pStride ); // ---------------------------------------------------------------------- // Method: SetStreamSourceFreq() // Description: The TDx9_3DDevice::SetStreamSourceFreq() method will // define the value of a specified steam source's frequency // divider. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStreamNumber - // The StreamNumber parameter specifies which stream's // frequency divider number is to be defined. // // This must be a value between 0 and the number of streams // - 1. // pDivider - // The Divider parameter defines the frequency divider value // for the specified stream. // ---------------------------------------------------------------------- virtual bool __fastcall SetStreamSourceFreq( uint pStreamNumber, uint pDivider ); // ---------------------------------------------------------------------- // Method: SetTexture() // Description: The TDx9_3DDevice::SetTexture() method will bind a // TDx9_3DBaseTexture to the specified texture stage. // // D3DPOOL_SCRATCH textures cannot be used with this method // and D3DPOOL_SYSTEMMEM textures are only allowed if // TD3DCaps->DevCaps has D3DDEVCAPS_TEXTURESYSTEMMEMORY set. // // Textures are bound to samplers defining sample state such // as filtering mode and address wrapping mode. // Programmable shaders reference textures by sampler number // and the number accessible depends on the shader version. // Fixed function piplelines reference textures by texture // stage. // The maximum number of samplers is determined by the // values of TD3DCaps->MaxSimultaneousTextures and // TD3DCaps->MaxTextureBlendStages. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSampler - // The Sampler parameter specifies to which sampler the // texture is to be bound. // // This is a zero based index. // There are two special case values possible in addition to // the normal values. // D3DDDMAPSAMPLER is used for displacement mapping. // D3DVERTEXTEXTURESAMPLER is used by a programmable vertex // shader when accessing vertex textures in vs_3_0. // pTexture - // The Texture parameter references the TDx9_3DBaseTexture // to bind to the specified sampler. // ---------------------------------------------------------------------- virtual bool __fastcall SetTexture( dword pSampler, TDx9_3DBaseTexture* pTexture ); // ---------------------------------------------------------------------- // Method: SetTextureStageState() // Description: The TDx9_3DDevice::SetTextureStageState() method will // define the state value for a specified texture stage. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStage - // The Stage parameter specifies for which texture stage the // state value is to be defined. // // This will be a value between 0 and the number of texture // stages - 1. As a device may have a maximum of 8 set // textures, the maximum value here is 7. // pType - // The Type parameter indicates the type of texture state to // define, as a value of the D3DTEXTURESTAGESTATETYPE // enumerated type. // pValue - // The Value parameter defines the value to set for the // specified texture stage. // // The actual meaning of this value depends on the Type // setting. // ---------------------------------------------------------------------- virtual bool __fastcall SetTextureStageState( dword pStage, D3DTEXTURESTAGESTATETYPE pType, dword pValue ); // ---------------------------------------------------------------------- // Method: SetTransform() // Description: The TDx9_3DDevice::SetTransform() method will define the // matrix for a specified tranformation state. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pState - // The State parameter indicates the transform stage type to // define, as a value of the D3DTRANSFORMSTATETYPE // enumerated type or the D3DTS_WORLDMATRIX macro. // pMatrix - // The Matrix parameter references a TD3DMatrix component // holding the matrix to set for the specified // transformation stage type. // ---------------------------------------------------------------------- virtual bool __fastcall SetTransform( D3DTRANSFORMSTATETYPE pState, D3DMATRIX* pMatrix ); // ---------------------------------------------------------------------- // Method: SetVertexDeclaration() // Description: The TDx9_3DDevice::SetVertexDeclaration() method will // define the vertex shader declaration for this device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pDecl - // The Decl parameter references the // TDx9_3DVertexDeclaration to be set for this device. // ---------------------------------------------------------------------- virtual bool __fastcall SetVertexDeclaration( TDx9_3DVertexDeclaration* pDecl ); // ---------------------------------------------------------------------- // Method: SetVertexShader() // Description: The TDx9_3DDevice::SetVertexShader() method will define // the TDx9_3DVertexShader for this device. // // To set a fixed-function vertex shader, release any // defined programmable shader with a NULL call to this // method, then call TDx9_3DDevice::SetFVF() with the fixed // function vertex format. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pShader - // The Shader parameter references the TDx9_3DVertexShader // to set for this device. // ---------------------------------------------------------------------- virtual bool __fastcall SetVertexShader( TDx9_3DVertexShader* pShader ); // ---------------------------------------------------------------------- // Method: SetVertexShaderConstantB() // Description: The TDx9_3DDevice::SetVertexShaderConstantB() method will // define boolean vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first boolean constant to define. // pConstantData - // The ConstantData parameter references an array holding // the boolean constants to be set. // pBoolCount - // The BoolCount parameter indicates how many boolean values // are are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetVertexShaderConstantB( uint pStartRegister, bool* pConstantData, uint pBoolCount ); // ---------------------------------------------------------------------- // Method: SetVertexShaderConstantF() // Description: The TDx9_3DDevice::SetVertexShaderConstantF() method will // define floating point vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first floating point constant to define. // pConstantData - // The ConstantData parameter references an array holding // the floating point constants to set. // pVector4fCount - // The Vector4fCount parameter indicates how many four // floating point vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetVertexShaderConstantF( uint pStartRegister, float* pConstantData, uint pVector4fCount ); // ---------------------------------------------------------------------- // Method: SetVertexShaderConstantI() // Description: The TDx9_3DDevice::SetVertexShaderConstantI() method will // define integer vertex shader constants. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pStartRegister - // The StartRegister parameter specifies the register number // of the first integer constant to define. // pConstantData - // The ConstantData parameter references an array holding // the integer constants to be set. // pVector4iCount - // The Vector4fCount parameter indicates how many four // integer vectors are in the ConstantData array. // ---------------------------------------------------------------------- virtual bool __fastcall SetVertexShaderConstantI( uint pStartRegister, int* pConstantData, uint pVector4iCount ); // ---------------------------------------------------------------------- // Method: SetViewport() // Description: The TDx9_3DDevice::SetViewport() method will define the // viewport parameters for this device. // // You can use this method to draw on only part of the // screen or to draw multiple views within a scene by // calling it multiple times with different viewport // settings. // Just make sure this call is made before any geometry is // drawn so the settings will take effect. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if Viewport is invalid or defines an // impossible render target region. // Params: pViewport - // The Viewport parameter references a TD3DViewport // component holding the viewport parameters to be set for // this device. // // The default TD3DViewport property values are: // X = 0 // Y = 0 // Width = RenderTarget Width // Height = RenderTarget Height // MinZ = 0.0f // MaxZ = 1.0f // // ---------------------------------------------------------------------- virtual bool __fastcall SetViewport( D3DVIEWPORT9* pViewport ); // ---------------------------------------------------------------------- // Method: ShowCursor() // Description: The TDx9_3DDevice::ShowCursor() method will display or // hide the cursor. // // This method will return the previous cursor setting. // // Depending on hardware, Direct3D uses the Graphics Device // Interface (GDI) or software emulation for cursors. // Generally its best if your application traps WM_MOUSEMOVE // events and calls the DXSetCursorPosition function. // Params: pShow - // The Show parameter indicates whether the cursor should be // visible or not. // // Set TRUE for visible, FALSE for hidden. // ---------------------------------------------------------------------- virtual bool __fastcall ShowCursor( bool pShow ); // ---------------------------------------------------------------------- // Method: StretchRect() // Description: The TDx9_3DDevice::StretchRect() method will make a // stretched and filtered copy from a source rectangle to a // destination rectangle. // // The surface and format combinations usable with this // method depend on a lot of factors including the surface // type, driver DirectX version and whether the call // involves different source and destination rectangle // sizes. // // Both SourceSurface and DestSurface must be // D3DPOOL_DEFAULT and they must both reference different // TDx9_3DSurface's. Neither surface can be in a compressed // format if stretching or shrinking is required. // DestSurface cannot be a plain offscreen surface if // SourceSurface is not or stretching is required. // Filtering will fail unless // TD3DCaps->StretchRectFilterCaps indicates the specified // filtering is available. Specifying D3DTEXF_NONE means the // driver will choose a filtering algorithm. // Color space conversion can only be done from YUV to RGBA // if supported. TDx9_3D::CheckDeviceFormatConversion() can // check for color conversion support. There is no emulation // for color conversion. // // TDx9_3DDevice::StretchRect() calls on textures will only // work for DirectX 9 drivers that set // TD3DCaps->DevCaps2->D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES. // // TDx9_3DDevice::StretchRect() calls on depth and stencil // surfaces will only work if both SourceSurface and // DestSurface were created with // TDx9_3DDevice::CreateDepthStencilSurface(), have the same // format, are the same size and the whole surface is // copied. The call cannot fall between a // BeginScene/EndScene pair, neither surface can be a mip // level of a depth stencil texture or created as // discardable and // TD3DCaps->DevCaps2->D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES // must be set. // // When using this method to copy from one render target to // another, a multisampled SourceSurface can be downsampled // to a non multisampled DestSurface. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSourceSurface - // The SourceSurface parameter references the TDx9_3DSurface // that is to be the source of the copy operation. // pSourceRect - // The SourceRect parameter defines a rectangle on the // source surface to be copied. // // Set NULL to specify the whole surface. // pDestSurface - // The DestSurface parameter references the TDx9_3DSurface // that is to be the destination of the copy operation. // pDestRect - // The DestRect parameter defines a rectangle on the // destination surface as the copy target. // // Set NULL to specify the whole surface. // pFilter - // The Filter parameter indicates which filter type to use, // as a value of the D3DTEXTUREFILTERTYPE. // // Valid values are D3DTEXF_NONE, D3DTEXF_POINT or // D3DTEXF_LINEAR. // ---------------------------------------------------------------------- virtual bool __fastcall StretchRect( TDx9_3DSurface* pSourceSurface, TRect* pSourceRect, TDx9_3DSurface* pDestSurface, TRect* pDestRect, D3DTEXTUREFILTERTYPE pFilter ); // ---------------------------------------------------------------------- // Method: TestCooperativeLevel() // Description: The TDx9_3DDevice::TestCooperativeLevel() method will // report the device's coopertative level status. // // The call must be on the same thread that created the // device. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_DEVICELOST if the device is lost but cannot be // reset at the moment. Call this method occasionally until // D3DERR_DEVICENOTRESET is returned. // D3DERR_DEVICENOTRESET if the device is lost but can be // reset. Try TDx9_Device::Reset(), if it works, restore // resources and resume normal operation. // D3DERR_DRIVERINTERNALERROR when there was an internal // driver error. Your application should probably shut down // if this error is returned. // ---------------------------------------------------------------------- virtual bool __fastcall TestCooperativeLevel(); // ---------------------------------------------------------------------- // Method: UpdateSurface() // Description: The TDx9_3DDevice::UpdateSurface() method will copy a // specified rectangle of pixels from one surface to // another. // // SourceSurface must be D3DPOOL_SYSMEM, DestSurface must be // D3DPOOL_DEFAULT. // Neither surface can be locked, holding a DC or be a depth // stencil format. // Both surfaces must be D3DMULTISAMPLE_NONE and have the // same format. // SourceRect must fit within the source and destination // surfaces. // // A D3DPOOL_DEFAULT render target can be copied to a // D3DPOOL_SYSTEMMEM surface with // TDx9_3DDevice::GetRenderTargetData(). // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSourceSurface - // The SourceSurface parameter references the TDx9_3DSurface // that is to be the source of the copy operation. // pSourceRect - // The SourceRect parameter defines a rectangle on the // source surface as the copy source. // // Set NULL to specify the whole surface. // pDestinationSurface - // The DestSurface parameter references the TDx9_3DSurface // that is to be the destination of the copy operation. // pDestinationPoint - // The DestinationPoint parameter specifies the upper left // corner of the destination rectangle. // // Set NULL to specify the whole surface. // ---------------------------------------------------------------------- virtual bool __fastcall UpdateSurface( TDx9_3DSurface* pSourceSurface, TRect* pSourceRect, TDx9_3DSurface* pDestinationSurface, POINT* pDestinationPoint ); // ---------------------------------------------------------------------- // Method: UpdateTexture() // Description: The TDx9_3DDevice::UpdateTexture() method will update the // dirty portions of a texture. // // Texture subsections can get marked as dirty when they are // locked or TDx9_3DCubeTexture::AddDirtyRect(), // TDx9_3DTexture::AddDirtyRect(), // TDx9_3DVolumeTexture::AddDirtyBox() or // TDx9_3DDevice::UpdateSurface() is called. If // D3DLOCK_NO_DIRTY_UPDATE or D3DLOCK_READONLY is set, then // no dirty region will be added. // Only the 0 texture level dirty regions are recorded, sub // level dirty regions are scaled appropriately from that. // This method calculates the dirty regions that have // accumulated since the last TDx9_3DDevice::UpdateTexture() // call and you can choose to only update those regions to // the destination texture to minimise the neccessary data // transfer. // // The SourceTexture and DestinationTexture must be the same // type, have the same bottom level buffer size and matching // level sizes and have the same format. // SourceTexture must have at least as many levels as // DestinationTexture. Should DestinationTexture have fewer // levels, only the matching levels will be updated. // // If DestinationTexture is an autogenerated mipmap, only // the top level of SourceTexture will be updated. // DestinationTexture's sublevels will be regenerated from // the updated top level. SourceTexture can be autogenerated // or not in this case. // DestinationTexture must be autogenerated if SourceTexture // is. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_INVALIDCALL if invalid parameters are provided. // Params: pSourceTexture - // The SourceTexture parameter references the // TDx9_3DBaseTexture that is the source of the update // operation. // // This must be a D3DPOOL_SYSTEMMEM texture. // pDestinationTexture - // The DestinationTexture parameter references the // TDx9_3DBaseTexture that is the destination of the update // operation. // // This must be a D3DPOOL_DEFAULT texture. // ---------------------------------------------------------------------- virtual bool __fastcall UpdateTexture( TDx9_3DBaseTexture* pSourceTexture, TDx9_3DBaseTexture* pDestinationTexture ); // ---------------------------------------------------------------------- // Method: ValidateDevice() // Description: The TDx9_3DDevice::ValidateDevice() method will analyse // the device's capability to render the current texture // blending operations and arguments in a single pass. // // Primarily used when other ways of finding out are // deficient. Most capabilities can be determined by // checking the appropriate TD3DCaps properties. For // example, TD3DCaps->MaxTextureBlendStages and // TD3DCaps->MaxSimultaneousTextures can be used to tell if // multistage texturing is possible. // Ideally you should only use this method at initialization // time, never as part of a rendering loop. // // Since the hardware will not neccessarily implement all // possible operation/argument combinations, you can set up // your desired settings then make this call to see if will // work properly. // As this call uses the current settings, changing those // settings will invalidate the previous result. // // It is better if the texture (D3DTA_TEXTURE) is specified // as the first argument for a stage rather than the second. // // Most hardware doesn't support diffuse iterated values as // an argument or operation. For example, // D3DTA_DIFFUSED3DTOP_BLENDDIFFUSEALPHA is rarely supported // so far. In most cases the hardware can only introduce // iterated color data at the last texture operation stage. // Many cards don't support diffuse or scalar values at any // stage but the first or last stage. // Many cards have a limited blending unit associated with // the first texture that can only replicate alpha to color // channels or invert the input. For this reason you may // need to only use the second texture stage if you can. In // the case of this limitation, the first unit assumes a // default state of D3DTA_TEXTURE color argument and // D3DTOP_SELECTARG1 operation. // Output alpha operations that are intricate or // substantially different relative to the color operations // are less likely to be supported. // Sometimes the simultaneous use of D3DTA_TFACTOR and // D3DTA_DIFFUSE is not supported. // Many cards will not support simultaneous mipmapped // trilinear filtering and multi texture blending. Try // revalidating with trilinear off. Multipass rendering may // be the best solution if this is the case. // // If the method call fails, the OnError event will be // triggered with one of the following values: // D3DERR_CONFLICTINGRENDERSTATE for incompatible render // states. // D3DERR_CONFLICTINGTEXTUREFILTER for incompatible texture // filters. // D3DERR_DEVICELOST if the device is lost and cannot be // reset right now. // D3DERR_DRIVERINTERNALERROR when there was an internal // driver error. Your application should probably shut down // if this error is returned. // D3DERR_TOOMANYOPERATIONS if more texture filtering // operations are requested than are supported. // D3DERR_UNSUPPORTEDALPHAARG if the alpha channel texture // blending argument is unsupported. // D3DERR_UNSUPPORTEDALPHAOPERATION if the alpha channel // texture blending operation is unsupported. // D3DERR_UNSUPPORTEDCOLORARG when the color value texture // blending argument is unsupported. // D3DERR_UNSUPPORTEDCOLOROPERATION when the color value // texture blending operation is unsupported. // D3DERR_UNSUPPORTEDFACTORVALUE when the texture factor // value is unsupported. // D3DERR_UNSUPPORTEDTEXTUREFILTER when the texture filter // is unsupported. // D3DERR_WRONGTEXTUREFORMAT if the texture surface's pixel // format is invalid. // Params: pNumPasses - // The NumPasses parameter will reference a value indicating // how many rendering passes the current settings would take // using multipass rendering. // ---------------------------------------------------------------------- virtual bool __fastcall ValidateDevice( dword* pNumPasses ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_3DDevice(TComponent* Owner); virtual __fastcall ~TDx9_3DDevice(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_Graphics_Library and should not be used. // ---------------------------------------------------------------------- __property LPDIRECT3DDEVICE9 Internal_LPDIRECT3DDEVICE9 = { read=FGetInternal_LPDIRECT3DDEVICE9, write=FSetInternal_LPDIRECT3DDEVICE9, nodefault }; __property LPDIRECT3DDEVICE9* Internal_LPDIRECT3DDEVICE9_Ptr = { read=FGetInternal_LPDIRECT3DDEVICE9_Ptr, nodefault }; void __fastcall Internal_LPDIRECT3DDEVICE9_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- bool __fastcall FGetCreated(); void __fastcall FSetCreated( bool pCreated ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Interface Access // ---------------------------------------------------------------------- LPDIRECT3DDEVICE9 __fastcall FGetInternal_LPDIRECT3DDEVICE9(); void __fastcall FSetInternal_LPDIRECT3DDEVICE9( LPDIRECT3DDEVICE9 pLPDIRECT3DDEVICE9 ); LPDIRECT3DDEVICE9* __fastcall FGetInternal_LPDIRECT3DDEVICE9_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPDIRECT3DDEVICE9 fLPDIRECT3DDEVICE9; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------