#ifndef TDx_3DDeviceH #define TDx_3DDeviceH // ========================================================================== // File: TDx_3DDevice.H // Authors: BCB_Code_Generator v1.70, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons), // Brian Austin (documentation) // Description: This file defines the TDx_3DDevice Component // // "TDx_3DI_Library v1.70" // (c) 2002 BCB-Tools.com Pty. Ltd., Sydney, Australia. // All Rights Reserved. // // Refer to the 'Licence.Txt' file for licencing & copyright information. // ========================================================================== // -------------------------------------------------------------------------- // #includes // -------------------------------------------------------------------------- #include #include #include #include // -------------------------------------------------------------------------- #include "TDx_Library_Defns.H" #include "TDx_Library_Functions.H" // -------------------------------------------------------------------------- #include "TDx_3DI_Library_Defns.H" #include "TDx_3DI_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by the TDx_3DDevice component. class TDDPixelFormat; class TDx_DrawSurface; // -------------------------------------------------------------------------- // external classes used by TDx_3DDevice methods. class TD3DRect; class TD3DDrawPrimitiveStridedData; class TDx_3DVertexBuffer; class TD3DDeviceDesc; class TD3DClipStatus; class TDx_3D; class TD3DLight; class TD3DMaterial; class TD3DMatrix; class TD3DViewPort; // -------------------------------------------------------------------------- // -------------------------------------------------------------------------- // Definition for the OnEnumTextureFormats callback event. typedef __fastcall void (__closure* TDx_3D_EnumTextureFormatsCallback ) ( TObject* Sender, TDDPixelFormat* DeviceDesc, void* Context, bool& Continue ); // ========================================================================== // Class: TDx_3DDevice // Description: The IDirect3DDevice3 interface provides methods enabling // applications to perform DrawPrimitive-based rendering. You // can create a Direct3DDevice object and retrieve a pointer to // this interface by calling the IDirect3D3::CreateDevice // method. // For a conceptual overview, see Direct3D Devices and The // DrawPrimitive // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx_3DDevice : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx_3DDevice : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx_3DDevice::Create() method after it has successfully // created the internal LPDIRECT3DDEVICE7 used within the // TDx_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 LPDIRECT3DDEVICE7 interface. // // For example, you could retrieve the TDx_3DDevice // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the // TDx_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 // TDx_3DDevice::Destroy() method, just before the // TDx_3DDevice internal LPDIRECT3DDEVICE7 interface is // destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx_3DDevice::OnCreate() // event. For example, assume you have already setup the // TDx_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 // TDx_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 // TDx_3DDevice component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ---------------------------------------------------------------------- // Callback: OnEnumTextureFormats() // Description: The OnEnumTextureFormats Callback is used to ... // ---------------------------------------------------------------------- __property TDx_3D_EnumTextureFormatsCallback OnEnumTextureFormats = {read=FOnEnumTextureFormats, write=FOnEnumTextureFormats, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal // LPDIRECT3DDEVICE7 used in this component has been // successfully created, otherwise Created is false. // // To create the internal LPDIRECT3DDEVICE7, call the // TDx_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 TDx_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: ApplyStateBlock() // Description: The ApplyStateBlock method is used to ...The // IDirect3DDevice7::ApplyStateBlock method applies an // existing device-state block to the rendering device. // Params: pBlockHandle - // The BlockHandle parameter ...Handle to the device state // block to be executed, as returned by a previous call to // the IDirect3DDevice7::EndStateBlock method. // ---------------------------------------------------------------------- virtual bool __fastcall ApplyStateBlock( dword pBlockHandle ); // ---------------------------------------------------------------------- // Method: BeginScene() // Description: The IDirect3DDevice3::BeginScene method begins a scene. // Applications must call this method before performing any // rendering, and must call IDirect3DDevice3::EndScene when // rendering is complete, and before calling // IDirect3DDevice::BeginScene again... // ---------------------------------------------------------------------- virtual bool __fastcall BeginScene(); // ---------------------------------------------------------------------- // Method: BeginStateBlock() // Description: The BeginStateBlock method is used to ...The // IDirect3DDevice7::BeginStateBlock method signals Direct3D // to begin recording a device state block. // ---------------------------------------------------------------------- virtual bool __fastcall BeginStateBlock(); // ---------------------------------------------------------------------- // Method: CaptureStateBlock() // Description: The CaptureStateBlock method is used to ...The // IDirect3DDevice7::CaptureStateBlock method updates the // values within an existing state block to the values // currently set for the device. // Params: pBlockHandle - // The BlockHandle parameter ...Handle to the state block // into which the current device state is captured. // ---------------------------------------------------------------------- virtual bool __fastcall CaptureStateBlock( dword pBlockHandle ); // ---------------------------------------------------------------------- // Method: Clear() // Description: The Clear method is used to ... // Params: pCount - // The Count parameter ...Number of rectangles in the array // at lpRects. If you set lpRects to NULL, this parameter // must be set to 0. // pRects - // The Rects parameter ...Array of D3DRECT structures that // describe the rectangles to be cleared. Set a rectangle to // the dimensions of the rendering target to clear the // entire surface. Each rectangle uses screen coordinates // that correspond to points on the render target surface. // Coordinates are clipped to the bounds of the viewport // rectangle. This parameter can be set to NULL to indicate // that the entire viewport rectangle is to be cleared. // pFlags - // The Flags parameter ...Flags indicating which surfaces // should be cleared. This parameter can be any combination // of the following flags, but at least one flag must be // used: // Flags: // D3DCLEAR_STENCIL - // The D3DCLEAR_STENCIL Flag is used to...Clear the // stencil buffer to the value in the dwStencil // parameter. // D3DCLEAR_TARGET - // The D3DCLEAR_TARGET Flag is used to...Clear the // rendering target to the color in the dwColor // parameter. // D3DCLEAR_ZBUFFER - // The D3DCLEAR_ZBUFFER Flag is used to...Clear the // depth buffer to the value in the dvZ parameter. // pColor - // The Color parameter ...A 32-bit RGBA color value to which // the render target surface is cleared. // pZ - // The Z parameter ...New z value that this method stores in // the depth buffer. This parameter can be in the range from // 0.0 through 1.0 (for z-based or w-based depth buffers). A // value of 0.0 represents the nearest distance to the // viewer, and 1.0 the farthest distance. // pStencil - // The Stencil parameter ...Integer value to store in each // stencil-buffer entry. This parameter can be in the range // from 0 through 2n#1, where n is the bit depth of the // stencil buffer. // ---------------------------------------------------------------------- virtual bool __fastcall Clear( dword pCount, TD3DRect* pRects, dword pFlags, dword pColor, D3DVALUE pZ, dword pStencil ); // ---------------------------------------------------------------------- // Method: ComputeSphereVisibility() // Description: The IDirect3DDevice3::ComputeSphereVisibility method // calculates the visibility (complete, partial, or no // visibility) of an array spheres within the current // viewport for this device. // Params: pCenters - // lpCenters // Array of D3DVECTOR structures describing the center point // for each sphere, in world-space coordinates... array // wrapper d3dvector.,, // pRadii - // lpRadii // Array of D3DVALUE variables that represent the radius for // each sphere. // array wrapper D3DValue... // pNumSpheres - // dwNumSpheres // Number of spheres. This value must be greater than zero. // pReturnValues - // lpdwReturnValues // Array of DWORD values. The array need not be initialized, // but it must be large enough to contain a DWORD for each // sphere being tested. When the method returns, each // element in the array contains a combination of the // following flags that describe the visibility of that // sphere within the current viewport for this device:... // ---------------------------------------------------------------------- virtual bool __fastcall ComputeSphereVisibility( D3DVECTOR* pCenters, D3DVALUE* pRadii, dword pNumSpheres, dword* pReturnValues ); // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPDIRECT3DDEVICE7 interface used in the // TDx_3DDevice component and must be called before any // methods of the TDx_3DDevice component will function. // Params: pD3D - // The D3D parameter refers to a created DirectDraw // interface, created using the TD3D::Create() method. // pRefID - // The RefID parameter ... // pRenderSurface - // The RenderSurface parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Create( TDx_3D* pD3D, REFCLSID pRefID, TDx_DrawSurface* pRenderSurface ); // ---------------------------------------------------------------------- // Method: CreateStateBlock() // Description: The CreateStateBlock method is used to ... // Params: pType - // The Type parameter ...Type of state data that the method // should capture. This parameter can be set to one of the // values defined in the D3DSTATEBLOCKTYPE enumerated type. // pBlockHandle - // The BlockHandle parameter ...Address of a variable to // contain the state block handle if the method succeeds. // ---------------------------------------------------------------------- virtual bool __fastcall CreateStateBlock( D3DSTATEBLOCKTYPE pType, dword* pBlockHandle ); // ---------------------------------------------------------------------- // Method: DeleteStateBlock() // Description: The DeleteStateBlock method is used to ...The // IDirect3DDevice7::DeleteStateBlock method deletes a // previously recorded device state block. // Params: pBlockHandle - // The BlockHandle parameter ...Handle to the device state // block to be deleted, as returned by a previous call to // the IDirect3DDevice7::EndStateBlock method. // ---------------------------------------------------------------------- virtual bool __fastcall DeleteStateBlock( dword pBlockHandle ); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPDIRECT3DDEVICE7 interface used in the // TDx_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 IDirect3DDevice3::DrawIndexedPrimitive method renders // the specified geometric primitive based on indexing into // an array of vertices. // // // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // D3DERR_INVALIDRAMPTEXTURE // D3DERR_INVALIDPRIMITIVETYPE // D3DERR_INVALIDVERTEXTYPE // DDERR_INVALIDPARAMS // DDERR_WASSTILLDRAWING // Params: pPrimitiveType - // d3dptPrimitiveType // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // Note that the D3DPT_POINTLIST member of D3DPRIMITIVETYPE // is not indexed.... // pVertexTypeDesc - // dwVertexTypeDesc // A combination of flexible vertex format flags that // describes the vertex format for this set of primitives... // pVertices - // lpvVertices // Pointer to the list of vertices to be used in the // primitive sequence... // pVertexCount - // dwVertexCount // Defines the number of vertices in the list. // Notice that this parameter is used differently from the // dwVertexCount parameter in the // IDirect3DDevice3::DrawPrimitive method. In that method, // the dwVertexCount parameter gives the number of vertices // to draw, but here it gives the total number of vertices // in the array pointed to by the lpvVertices parameter. // When you call IDirect3DDevice3::DrawIndexedPrimitive, you // specify the number of vertices to draw in the // dwIndexCount parameter... // pIndices - // lpwIndices // Pointer to a list of WORDs that are to be used to index // into the specified vertex list when creating the geometry // to render.... // pIndexCount - // dwIndexCount // Specifies the number of indices provided for creating the // geometry. The maximum number of indices allowed is 65,535 // (0xFFFF).... // pFlags - // Flags defining how the primitive is drawn. Typically set // to zero. // Flags: // D3DDP_WAIT - // D3DDP_WAIT // Causes the method to wait until the polygons have // been rendered before it returns, instead of // returning as soon as the polygons have been sent to // the card. (On scene-capture cards, the method // returns as soon as the card responds.) This flag is // typically used for debugging. Applications should // not attempt to use this flag to ensure that a scene // is up-to-date before continuing... // ---------------------------------------------------------------------- virtual bool __fastcall DrawIndexedPrimitive( D3DPRIMITIVETYPE pPrimitiveType, dword pVertexTypeDesc, void* pVertices, dword pVertexCount, word* pIndices, dword pIndexCount, dword pFlags ); // ---------------------------------------------------------------------- // Method: DrawIndexedPrimitiveStrided() // Description: The IDirect3DDevice3::DrawIndexedPrimitiveStrided method // renders a geometric primitive based on indexing into an // array of strided vertices. For more information, see // Strided Vertex Format... // // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // D3DERR_INVALIDRAMPTEXTURE // D3DERR_INVALIDPRIMITIVETYPE // D3DERR_INVALIDVERTEXTYPE // DDERR_INVALIDPARAMS // DDERR_WASSTILLDRAWING // // Params: pPrimitiveType - // d3dptPrimitiveType // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // Note that the D3DPT_POINTLIST member of D3DPRIMITIVETYPE // is not indexed.... // pVertexTypeDesc - // dwVertexTypeDesc... // A combination of flexible vertex format flags vertex // format for this primitive. // pVertexArray - // lpVertexArray // Array of D3DDRAWPRIMITIVESTRIDEDDATA structures that // contains the vertices for this primitive, in the format // specified by the flags in dwVertexTypeDesc.... // pVertexCount - // dwVertexCount // Defines the number of vertices in the list. // Notice that this parameter is used differently from the // dwVertexCount parameter in the // IDirect3DDevice3::DrawPrimitive method. In that method, // the dwVertexCount parameter gives the number of vertices // to draw, but here it gives the total number of vertices // in the array pointed to by the lpVertexArray parameter. // When you call // IDirect3DDevice3::DrawIndexedPrimitiveStrided, you // specify the number of vertices to draw in the // dwIndexCount parameter.... // pIndices - // lpwIndices // Pointer to a list of WORDs that are to be used to index // into the specified vertex list when creating the geometry // to render.... // pIndexCount - // dwIndexCount // Specifies the number of indices provided for creating the // geometry. The maximum number of indices allowed is 65,535 // (0xFFFF).... // pFlags - // dwFlags // One or more of the following flags defining how the // primitive is drawn. Most applications will use a value // of 0. // Flags: // D3DDP_WAIT - // The method will not return until rendering is // completed. // // Causes the method to wait until the polygons have // been rendered before it returns, instead of // returning as soon as the polygons have been sent to // the card. (On scene-capture cards, the method // returns as soon as the card responds.) This flag is // typically used for debugging. Applications should // not attempt to use this flag to ensure that a scene // is up-to-date before continuing.... // ---------------------------------------------------------------------- virtual bool __fastcall DrawIndexedPrimitiveStrided( D3DPRIMITIVETYPE pPrimitiveType, dword pVertexTypeDesc, TD3DDrawPrimitiveStridedData* pVertexArray, dword pVertexCount, word* pIndices, dword pIndexCount, dword pFlags ); // ---------------------------------------------------------------------- // Method: DrawIndexedPrimitiveVB() // Description: The IDirect3DDevice3::DrawIndexedPrimitiveVB method // renders a geometric primitive based on indexing into an // array of vertices within a vertex buffer. // success value DD_OK ????? // // If the method succeeds, the return value is DD_OK. // // If the method fails, the return value can be one of the // following values: // // D3DERR_INVALIDPRIMITIVETYPE // D3DERR_INVALIDVERTEXTYPE // D3DERR_VERTEXBUFFERLOCKED // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // DDERR_WASSTILLDRAWING // Params: pPrimitiveType - // d3dptPrimitiveType... // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // Note that the D3DPT_POINTLIST member of D3DPRIMITIVETYPE // is not indexed. // pD3DVertexBuffer - // lpd3dVertexBuffer... // Address of the IDirect3DVertexBuffer interface for the // vertex buffer that contains the array of vertices. // Vertices can be transformed or untransformed, optimized // or unoptimized. // pStartVertex - // The StartVertex parameter ...dwStartVertex // Index of the first vertex in the vertex buffer to be // rendered. // pNumVertices - // The NumVertices parameter ...Total number of vertices in // the vertex buffer to be rendered. // pIndices - // lpwIndices... // Address of an array of WORDs that will be used to index // into the vertices in the vertex buffer. // pIndexCount - // dwIndexCount... // The number of indices in the array at lpwIndices. The // maximum number of indices allowed is 65,535 (0xFFFF). // pFlags - // dwFlags... // One or more of the following flags defining how the // primitive is drawn: // Flags: // D3DDP_WAIT - // // Causes the method to wait until the polygons have // been rendered before it returns, instead of // returning as soon as the polygons have been sent to // the card. (On scene-capture cards, the method // returns as soon as the card responds.) This flag is // typically used for debugging. Applications should // not attempt to use this flag to ensure that a scene // is up-to-date before continuing... // ---------------------------------------------------------------------- virtual bool __fastcall DrawIndexedPrimitiveVB( D3DPRIMITIVETYPE pPrimitiveType, TDx_3DVertexBuffer* pD3DVertexBuffer, word pStartVertex, dword pNumVertices, word* pIndices, dword pIndexCount, dword pFlags ); // ---------------------------------------------------------------------- // Method: DrawPrimitive() // Description: The IDirect3DDevice3::DrawPrimitive method renders the // specified array of vertices as a sequence of geometric // primitives of the specified type.... // Params: pPrimitiveType - // dptPrimitiveType... // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // pVertexTypeDesc - // dwVertexTypeDesc... // A combination of flexible vertex format flags that // describe the vertex format used for this set of // primitives. // pVertices - // lpvVertices... // Pointer to the array of vertices to be used in the // primitive sequence. // pVertexCount - // dwVertexCount... // The number of vertices in the array. The maximum number // of vertices allowed is 65,535 (0xFFFF). // pFlags - // dwFlags... // One or more of the following flags defining how the // primitive is drawn // Flags: // D3DDP_WAIT - // D3DDP_WAIT // Causes the method to wait until the polygons have // been rendered before it returns, instead of // returning as soon as the polygons have been sent to // the card. (On scene-capture cards, the method // returns as soon as the card responds.) This flag is // typically used for debugging. Applications should // not attempt to use this flag to ensure that a scene // is up-to-date before continuing... // ---------------------------------------------------------------------- virtual bool __fastcall DrawPrimitive( D3DPRIMITIVETYPE pPrimitiveType, dword pVertexTypeDesc, void* pVertices, dword pVertexCount, dword pFlags ); // ---------------------------------------------------------------------- // Method: DrawPrimitiveStrided() // Description: The IDirect3DDevice3::DrawPrimitiveStrided method renders // the specified array of strided vertices as a sequence of // geometric primitives. For more information, see Strided // Vertex Format.... // Params: pPrimitiveType - // PrimitiveType... // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // pVertexTypeDesc - // dwVertexTypeDesc... // A combination of flexible vertex format flags that // describe the vertex format. // pVertexArray - // lpVertexArray... // Array of D3DDRAWPRIMITIVESTRIDEDDATA structures that // contains the vertices for this primitive. // pVertexCount - // dwVertexCount... // Number of vertices in the array at lpVertexArray. The // maximum number of vertices allowed is 65,535 (0xFFFF). // pFlags - // The Flags parameter is used to ..Zero to render the // primitive without waiting, or the following flag: . // Flags: // D3DDP_WAIT - // The D3DDP_WAIT Flag is used to...Causes the method // to wait until the polygons have been rendered // before it returns, instead of returning as soon as // the polygons have been sent to the card. (On // scene-capture cards, the method returns as soon as // the card responds.) This flag is typically used for // debugging. Applications should not attempt to use // this flag to ensure that a scene is up to date // before continuing. // ---------------------------------------------------------------------- virtual bool __fastcall DrawPrimitiveStrided( D3DPRIMITIVETYPE pPrimitiveType, dword pVertexTypeDesc, TD3DDrawPrimitiveStridedData* pVertexArray, dword pVertexCount, dword pFlags ); // ---------------------------------------------------------------------- // Method: DrawPrimitiveVB() // Description: The IDirect3DDevice3::DrawPrimitiveVB method renders an // array of vertices in a vertex buffer as a sequence of // geometric primitives. // Params: pPrimitiveType - // d3dptPrimitiveType... // Type of primitive to be rendered by this command. This // must be one of the members of the D3DPRIMITIVETYPE // enumerated type. // pVertexBuffer - // lpd3dVertexBuffer.. // Address of the IDirect3DVertexBuffer interface for the // vertex buffer that contains the array of vertices. // Vertices can be transformed or untransformed, optimized // or unoptimized. // pStartVertex - // dwStartVertex... // Index value of the first vertex in the primitive. The // highest possible starting index is 65,535 (0xFFFF). In // debug builds, specifying a starting index value that // exceeds this limit will cause the method to fail and // return DDERR_INVALIDPARAMS. // pNumVertices - // dwNumVertices... // Number of vertices to be rendered. The maximum number of // vertices allowed is 65,535 (0xFFFF). // pFlags - // dwFlags... // One or more of the following flags defining how the // primitive is drawn: // Flags: // D3DDP_WAIT - // D3DDP_WAIT... // Causes the method to wait until the polygons have // been rendered before it returns, instead of // returning as soon as the polygons have been sent to // the card. (On scene-capture cards, the method // returns as soon as the card responds.) This flag is // typically used for debugging. Applications should // not attempt to use this flag to ensure that a scene // is up-to-date before continuing. // ---------------------------------------------------------------------- virtual bool __fastcall DrawPrimitiveVB( D3DPRIMITIVETYPE pPrimitiveType, TDx_3DVertexBuffer* pVertexBuffer, dword pStartVertex, dword pNumVertices, dword pFlags ); // ---------------------------------------------------------------------- // Method: EndScene() // Description: The IDirect3DDevice3::EndScene method ends a scene that // was begun by calling the IDirect3DDevice3::BeginScene // method.... // ---------------------------------------------------------------------- virtual bool __fastcall EndScene(); // ---------------------------------------------------------------------- // Method: EndStateBlock() // Description: The EndStateBlock method is used to ...The // IDirect3DDevice7::EndStateBlock method signals Direct3D // to stop recording a device state block and retrieve a // handle to the state block. // Params: pBlockHandle - // The BlockHandle parameter ...Address of a variable to be // filled with the handle to the completed device state // block. This value is used with the // IDirect3DDevice7::ApplyStateBlock and // IDirect3DDevice7::DeleteStateBlock methods. // Return Values // ---------------------------------------------------------------------- virtual bool __fastcall EndStateBlock( dword* pBlockHandle ); // ---------------------------------------------------------------------- // Method: EnumTextureFormats() // Description: The IDirect3DDevice3::EnumTextureFormats method queries // the current driver for a list of supported texture // formats... // Params: pArg - // lpArg... // Address of application-defined data passed to the // callback function. // // ---------------------------------------------------------------------- virtual bool __fastcall EnumTextureFormats( void* pArg ); // ---------------------------------------------------------------------- // Method: GetCaps() // Description: The IDirect3DDevice3::GetCaps method retrieves the // capabilities of the Direct3D device. // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // // // Remarks // This method does not retrieve the capabilities of the // display device. To retrieve this information, use the // IDirectDraw7::GetCaps method. // // In previous versions of this interface, this method // simultaneously retrieved capabilities for hardware // abstraction layer (HAL) devices and hardware emulation // layer (HEL) devices by accepting pointers to the legacy // D3DDEVICEDESC structure. In the IDirect3DDevice7 // interface, this method only retrieves the capabilities of // the device on which the method is called. // Params: pD3DDevDesc - // The D3DDevDesc parameter ...lpD3DDevDesc // Address of the D3DDEVICEDESC7 structure to contain the // hardware features of the device. // ---------------------------------------------------------------------- virtual bool __fastcall GetCaps( TD3DDeviceDesc* pD3DDevDesc ); // ---------------------------------------------------------------------- // Method: GetClipPlane() // Description: The GetClipPlane method is used to ...The // IDirect3DDevice7::GetClipPlane method retrieves the // coefficients of a user-defined clipping plane for the // device. // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is // DDERR_INVALIDPARAMS. This error indicates that the value // in dwIndex exceeds the maximum clipping plane index // supported by the device or that the array at // pPlaneEquation is not large enough to contain four // floating-point values. // // Remarks // The coefficients that this method reports take the form // of the general plane equation. If the values in the array // at pPlaneEquation were labeled A, B, C, and D in the // order that they appear in the array, they would fit into // the general plane equation so that Ax + By + Cz + D = 0. // A point with homogeneous coordinates (x, y, z, w) is // visible in the half space of the plane if Ax + By + Cz + // Dw >= 0. Points that exist on or behind the clipping // plane are clipped from the scene. // // The plane equation used by this method exists in world // space and is set by a previous call to the // IDirect3DDevice7::SetClipPlane method. // // Params: pIndex - // The Index parameter ...dwIndex // Index of the clipping plane for which the plane equation // coefficients are retrieved. // pPlaneEquation - // The PlaneEquation parameter ...pPlaneEquation // Address of a four-element array of values that represent // the coefficients of the clipping plane, in the form of // the general plane equation. See remarks. // ---------------------------------------------------------------------- virtual bool __fastcall GetClipPlane( dword pIndex, D3DVALUE* pPlaneEquation ); // ---------------------------------------------------------------------- // Method: GetClipStatus() // Description: The GetClipStatus method is used to ...The // IDirect3DDevice7::GetClipStatus method gets the current // clip status. // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if one of the // arguments is invalid. // Params: pD3DClipStatus - // The D3DClipStatus parameter ...lpD3DClipStatus // Address of a D3DCLIPSTATUS structure that describes the // current clip status. // ---------------------------------------------------------------------- virtual bool __fastcall GetClipStatus( TD3DClipStatus* pD3DClipStatus ); // ---------------------------------------------------------------------- // Method: GetDirect3D() // Description: The IDirect3DDevice3::GetDirect3D method retrieves the // Direct3D object for this device. // // // Params: pD3D - // lplpD3D // Address that will contain a pointer to the Direct3D // object's IDirect3D3 interface when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetDirect3D( TDx_3D* pD3D ); // ---------------------------------------------------------------------- // Method: GetInfo() // Description: The GetInfo method is used to ...The // IDirect3DDevice7::GetInfo method retrieves information // about the rendering device. Information can pertain to // Direct3D or the underlying device driver. // // // // Return Values // If the method succeeds, the return value is D3D_OK. This // method returns S_FALSE on retail builds of DirectX. // // If the method fails, the return value can be one of the // following error values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // // // Remarks // This method makes it possible for drivers to declare // specific information types, and corresponding structures, // that are not documented in this SDK. // // This method executes synchronously and can negatively // impact your application's performance when it executes // slowly. Do not call this method during scene rendering // (between calls to IDirect3DDevice7::BeginScene and // IDirect3DDevice7::EndScene). // // This method is intended to be used for performance // tracking and debugging during product development (on the // debug version of DirectX). The method can succeed, // returning S_FALSE, without retrieving device data. This // occurs when the retail version of the DirectX runtime is // installed on the host system. // Params: pDevInfoID - // The DevInfoID parameter ..Flags indicating the type of // device information structure at pDevInfoStruct. This // parameter can be set to one of the following flags: // Flags: // D3DDEVINFOID_D3DTEXTUREMANAGER - // The D3DDEVINFOID_D3DTEXTUREMANAGER Flag is used // to...The structure at pDevInfoStruct is a // D3DDEVINFO_TEXTUREMANAGER structure that contains // information about texture management that is // performed by Direct3D. // D3DDEVINFOID_TEXTUREMANAGER - // The D3DDEVINFOID_TEXTUREMANAGER Flag is used // to...The structure at pDevInfoStruct is a // D3DDEVINFO_TEXTUREMANAGER structure that contains // information about the texture management being // performed by the driver. If the driver does not // manage textures, information about texture // management performed by Direct3D is retrieved. // D3DDEVINFOID_TEXTURING - // The D3DDEVINFOID_TEXTURING Flag is used to...The // structure at pDevInfoStruct is a // D3DDEVINFO_TEXTURING structure that contains // information about texturing activity of the // application. // pDevInfoStruct - // The DevInfoStruct parameter ....Address of a structure // that receives the specified device information if the // call succeeds. The type of structure, and how the data it // contains is to be interpreted, is determined by the flag // in dwDevInfoID. // pSize - // The Size parameter ...Size of the structure at // pDevInfoStruct, in bytes. // ---------------------------------------------------------------------- virtual bool __fastcall GetInfo( dword pDevInfoID, void* pDevInfoStruct, dword pSize ); // ---------------------------------------------------------------------- // Method: GetLight() // Description: The GetLight method is used to ...The // IDirect3DDevice7::GetLight method retrieves a set of // lighting properties that this device uses. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if the lpLight // parameter is invalid. // // Remarks // This method was introduced with the IDirect3DDevice7 // interface. // // Unlike its predecessors, the IDirect3DDevice7 interface // does not use light objects. This method, and its use of // the D3DLIGHT7 structure to describe a set of lighting // properties, replaces the lighting semantics used by // previous versions of the device interface. // Params: pLightIndex - // The LightIndex parameter ...Zero-based index of the // lighting property set to be retrieved. // pLight - // The Light parameter ...Address of a D3DLIGHT7 structure // that is filled with the retrieved lighting-parameter set. // ---------------------------------------------------------------------- virtual bool __fastcall GetLight( dword pLightIndex, TD3DLight* pLight ); // ---------------------------------------------------------------------- // Method: GetLightEnable() // Description: The GetLightEnable method is used to ...The // IDirect3DDevice7::GetLightEnable method retrieves the // activity status#enabled or disabled#for a set of lighting // parameters within a device. // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. For a // complete list of Direct3D Immediate Mode error values and // descriptions, see Return Values. // Params: pLightIndex - // The LightIndex parameter ...Zero-based index of the set // of lighting parameters that are the target of this // method. // pEnable - // The Enable parameter ...Address of a variable to be // filled with the status of the specified lighting // parameters. After the call, a nonzero value at this // address indicates that the specified lighting parameters // are enabled; a value of 0 indicates that they are // disabled. // ---------------------------------------------------------------------- virtual bool __fastcall GetLightEnable( dword pLightIndex, bool* pEnable ); // ---------------------------------------------------------------------- // Method: GetMaterial() // Description: The GetMaterial method is used to ...The // IDirect3DDevice7::GetMaterial method retrieves the // current material properties for the device. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if the lpMaterial // parameter is invalid. // // Params: pMaterial - // The Material parameter ...Address of a D3DMATERIAL7 // structure to be filled with the currently set material // properties. // ---------------------------------------------------------------------- virtual bool __fastcall GetMaterial( TD3DMaterial* pMaterial ); // ---------------------------------------------------------------------- // Method: GetRenderState() // Description: The IDirect3DDevice3::GetRenderState method gets a single // Direct3DDevice rendering state parameter. // Params: pRenderStateType - // dwRenderStateType // Device state variable that is being queried. This // parameter can be any of the members of the // D3DRENDERSTATETYPE enumerated type. // pRenderState - // lpdwRenderState // Address of a variable that will contain the // Direct3DDevice render state when the method returns. // ---------------------------------------------------------------------- virtual bool __fastcall GetRenderState( D3DRENDERSTATETYPE pRenderStateType, dword* pRenderState ); // ---------------------------------------------------------------------- // Method: GetRenderTarget() // Description: The IDirect3DDevice3::GetRenderTarget method retrieves a // pointer to the DirectDraw surface that is being used as a // render target. // Params: pRenderTarget - // lplpRenderTarget // Address that will contain a pointer to the // IDirectDrawSurface4 interface of the render target // surface for this device. // ---------------------------------------------------------------------- virtual bool __fastcall GetRenderTarget( TDx_DrawSurface* pRenderTarget ); // ---------------------------------------------------------------------- // Method: GetTexture() // Description: The IDirect3DDevice3::GetTexture method retrieves a // texture assigned to a given stage for a device... // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // Params: pStage - // dwStage // Stage identifier of the texture to be retrieved. Stage // identifiers are zero-based. Currently, devices can have // up to 8 set textures, so the maximum allowable value // allowed for dwStage is 7. // pTexture - // lplpTexture // Address of a variable to be filled with a pointer to the // specified texture's IDirectDrawSurface7 interface if the // call succeeds. // ---------------------------------------------------------------------- virtual bool __fastcall GetTexture( dword pStage, TDx_DrawSurface* pTexture ); // ---------------------------------------------------------------------- // Method: GetTextureStageState() // Description: The IDirect3DDevice3::GetTextureStageState method // retrieves a state value for a currently assigned // texture... // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // Params: pStage - // dwStage... // Stage identifier of the texture for which the state will // be retrieved. Stage identifiers are zero-based. // Currently, devices can have up to 8 set textures, so the // maximum allowable value allowed for dwStage is 7. // pState - // dwState... // Texture state to be retrieved. This parameter can be any // member of the D3DTEXTURESTAGESTATETYPE enumerated type. // pValue - // lpdwValue... // Address of a variable that will be filled with the // retrieved state value. The meaning of the retrieved value // is determined by the dwState parameter. // ---------------------------------------------------------------------- virtual bool __fastcall GetTextureStageState( dword pStage, D3DTEXTURESTAGESTATETYPE pState, dword* pValue ); // ---------------------------------------------------------------------- // Method: GetTransform() // Description: The IDirect3DDevice3::GetTransform method gets a matrix // describing a transformation state. // Params: pTransformStateType - // dtstTransformStateType... // Device state variable that is being modified. This // parameter can be any of the members of the // D3DTRANSFORMSTATETYPE enumerated type. // pD3DMatrix - // lpD3DMatrix... // Address of a D3DMATRIX structure describing the // transformation. // ---------------------------------------------------------------------- virtual bool __fastcall GetTransform( D3DTRANSFORMSTATETYPE pTransformStateType, TD3DMatrix* pD3DMatrix ); // ---------------------------------------------------------------------- // Method: GetViewPort() // Description: The IDirect3DDevice7::GetViewport method retrieves the // viewport parameters currently set for the device.... // // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if the lpViewport // parameter is invalid. // // Remarks // Params: pViewport - // The Viewport parameter ...lpViewport // Address of a D3DVIEWPORT7 structure to be filled with the // current viewport parameters if the call succeeds. // ---------------------------------------------------------------------- virtual bool __fastcall GetViewPort( TD3DViewPort* pViewport ); // ---------------------------------------------------------------------- // Method: Internal_EnumTextureFormatsCallback() // Description: The Internal_EnumTextureFormatsCallback method is used to // ... // Params: pDDPixFmt - // The DDPixFmt parameter ... // pContext - // The Context parameter ... // ---------------------------------------------------------------------- static HRESULT __stdcall Internal_EnumTextureFormatsCallback( LPDDPIXELFORMAT pDDPixFmt, LPVOID pContext ); // ---------------------------------------------------------------------- // Method: LightEnable() // Description: The LightEnable method is used to ... The // IDirect3DDevice7::LightEnable method enables or disables // a set of lighting parameters within a device. // // .If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. For a // complete list of Direct3D Immediate Mode error values and // descriptions, see Return Values. // // // Remarks // If you supply a value for dwLightIndex outside the range // of the light property sets currently assigned within the // device, the LightEnable method creates a light source // with the following properties and sets its enabled state // to the value specified in bEnable: // // Member Default // // dltType D3DLIGHT_DIRECTIONAL // dcvDiffuse (R:1, G:1, B:1, A:0) // dcvSpecular (R:0, G:0, B:0, A:0) // dcvAmbient (R:0, G:0, B:0, A:0) // dvPosition (0, 0, 0) // dvDirection (0, 0, 1) // dvRange 0 // dvFalloff 0 // dvAttenuation0 0 // dvAttenuation1 0 // dvAttenuation2 0 // dvTheta 0 // dvPhi 0 // Params: pLightIndex - // The LightIndex parameter ...dwLightIndex // Zero-based index of the set of lighting parameters that // are the target of this method // pEnable - // The Enable parameter ...bEnable // Value indicating if the set of lighting parameters are // being enabled or disabled. Set this parameter to TRUE to // enable lighting with the parameters at the specified // index, or FALSE to disable it. // ---------------------------------------------------------------------- virtual bool __fastcall LightEnable( dword pLightIndex, bool pEnable ); // ---------------------------------------------------------------------- // Method: Load() // Description: The IDirect3DDevice7::Load method loads a rectangular // area of a source texture to a specified point in a // destination texture or to faces within a cubic // environment map. // ... // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // // // Remarks // The destination texture can be used with any rendering // device, not just the one that created it. On hardware // devices, the load operation is hardware-accelerated. // // Loading textures into video memory by calling this method // is preferred over blit operations. // // This method copies all mip-levels, cubemap faces, // palettes and color keys from the source texture to the // destination texture. // // When using this method to load mipmaps, the following // special points apply: // // The destination texture surface can be a subset of the // mip-levels contained in the source texture. In this case, // only the mip-levels common to both textures are copied. // This is useful in implementing texture LOD. You can // create a video memory texture with only two mip-levels, // then use this method to copy those levels from a source // texture that comprises the entire set of mip-levels. // The source and destination surface pointers must point to // top-level surfaces. // When loading a subrectangle of a mipmap, the subrectangle // refers to the top-level surface in the mipmap chain, and // is divided by two for each lower mip-level. // Params: pDestTex - // The DestTex parameter ...Address of the // IDirectDrawSurface7 interface of the texture that // receives image data from the source texture. The // destination texture can be a cubic environment map. For // complex texture surfaces like cubic envionment maps and // mipmaps, this must point to the top-level surface. // pDestPoint - // The DestPoint parameter ...Address of a POINT structure // that describes the point at which the method loads the // image data onto the destination texture. Set this // parameter to NULL when the destination point should be // the origin of the destination texture. // pSrcTex - // The SrcTex parameter ...Address of the IDirect3DTexture7 // interface of the texture that contains the image data to // be loaded. For complex texture surfaces like cubic // envionment maps and mipmaps, this must point to the // top-level surface. // pSrcRect - // The SrcRect parameter ...Address of a RECT structure that // describes the area within the source texture that the // method loads. Set this parameter to NULL when the source // rectangle should cover the entire source texture. // pFlags - // The Flags parameter ...Value indicating, in the case of a // cubic environment map, which face of the destination // texture is to receive the image data. This can be any // combination of the following flags. // 0 // Required if the destination texture is a managed texture. // DDSCAPS2_CUBEMAP_ALLFACES // All faces should be loaded with the image data within the // source texture. // DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_NEGATIVEY, // or DDSCAPS2_CUBEMAP_NEGATIVEZ // The negative x, y, or z faces should receive the image // data. // DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, // or DDSCAPS2_CUBEMAP_POSITIVEZ // The positive x, y, or z faces should receive the image // data. // ---------------------------------------------------------------------- virtual bool __fastcall Load( TDx_DrawSurface* pDestTex, POINT* pDestPoint, TDx_DrawSurface* pSrcTex, TRect* pSrcRect, dword pFlags ); // ---------------------------------------------------------------------- // Method: MultiplyTransform() // Description: The IDirect3DDevice3::MultiplyTransform method multiplies // a device's world, view, or projection matrices by a // specified matrix. The multiplication order is lpD3DMatrix // times dtstTransformStateType... // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if one of the // arguments is invalid. // // Remarks // An application might use the MultiplyTransform method to // work with hierarchies of transformations. For example, // the geometry and transformations describing an arm might // be arranged in the following hierarchy: // // shoulder_transformation // upper_arm geometry // elbow transformation // lower_arm geometry // wrist transformation // hand geometry // An application might use the following series of calls to // render this hierarchy. (Not all the parameters are shown // in this pseudocode.) // // IDirect3DDevice7::SetTransform(D3DTRANSFORMSTATE_WORLD, // shoulder_transform) // IDirect3DDevice7::DrawPrimitive(upper_arm) // // IDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATE_WORLD, // elbow_transform) // IDirect3DDevice7::DrawPrimitive(lower_arm) // // IDirect3DDevice7::MultiplyTransform(D3DTRANSFORMSTATE_WORLD, // wrist_transform) // IDirect3DDevice7::DrawPrimitive(hand) // Params: pTransformStateType - // dtstTransformStateType... // A member of the D3DTRANSFORMSTATETYPE enumerated type // that identifies which device matrix is to be modified. // The most common setting, D3DTRANSFORMSTATE_WORLD, // modifies the world matrix, but you can specify that the // method modify the view or projection matrices if needed. // pD3DMatrix - // lpD3DMatrix... // Address of a D3DMATRIX structure that modifies the // current transformation. // ---------------------------------------------------------------------- virtual bool __fastcall MultiplyTransform( D3DTRANSFORMSTATETYPE pTransformStateType, TD3DMatrix* pD3DMatrix ); // ---------------------------------------------------------------------- // Method: PreLoad() // Description: The PreLoad method is used to ... // // The IDirect3DDevice7::Preload method instructs the // Direct3D texture manager to load a managed texture into // video memory. // // Remarks // This method forces the system to load a managed texture // into video memory. If sufficient video memory is not // available, the system removes other textures to regain // memory, then loads the texture. The texture being loaded // must be a managed texture (created with the // DDSCAPS2_TEXTUREMANAGE or DDSCAPS2_D3DTEXTUREMANAGE // flags). If not, the method fails and returns // DDERR_INVALIDPARAMS. // Params: pTexture - // The Texture parameter ...Address of the // IDirectDrawSurface7 interface for the texture surface to // be loaded into memory. // ---------------------------------------------------------------------- virtual bool __fastcall PreLoad( TDx_DrawSurface* pTexture ); // ---------------------------------------------------------------------- // Method: SetClipPlane() // Description: The IDirect3DDevice7::SetClipPlane method sets the // coefficients of a user-defined clipping plane for the // device. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is // DDERR_INVALIDPARAMS. This error indicates that the value // in dwIndex exceeds the maximum clipping plane index // supported by the device or that the array at // pPlaneEquation is not large enough to contain four // floating-point values. // // Remarks // The coefficients that this method sets take the form of // the general plane equation. If the values in the array at // pPlaneEquation were labeled A, B, C, and D in the order // that they appear in the array, they would fit into the // general plane equation so that Ax + By + Cz + D = 0. A // point with homogeneous coordinates (x, y, z, w) is // visible in the half space of the plane if Ax + By + Cz + // Dw >= 0. Points that exist on or behind the clipping // plane are clipped from the scene. // // The plane equation used by this method exists in world // space. // // This method does not enable the clipping plane equation // being set. To enable a clipping plane, set the // corresponding bit in the DWORD value applied to the // D3DRENDERSTATE_CLIPPLANEENABLE render state. // ... // Params: pIndex - // The Index parameter ...Index of the clipping plane for // which the plane equation coefficients are to be set. // pPlaneEquation - // The PlaneEquation parameter ...Address of a four-element // array of values that represent the coefficients of the // clipping plane, in the form of the general plane // equation. See remarks. // ---------------------------------------------------------------------- virtual bool __fastcall SetClipPlane( dword pIndex, D3DVALUE* pPlaneEquation ); // ---------------------------------------------------------------------- // Method: SetClipStatus() // Description: The IDirect3DDevice3::SetClipStatus method sets the // current clip status. // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if one of the // arguments is invalid. // // // // Params: pD3DClipStatus - // lpD3DClipStatus // Address of a D3DCLIPSTATUS structure that describes the // new settings for the clip status. // ---------------------------------------------------------------------- virtual bool __fastcall SetClipStatus( TD3DClipStatus* pD3DClipStatus ); // ---------------------------------------------------------------------- // Method: SetLight() // Description: The SetLight method is used to ...The // IDirect3DDevice7::SetLight method assigns a set of // lighting properties for this device. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDPARAMS // DDERR_OUTOFMEMORY // // See Also // IDirect3DDevice7::GetLight, // IDirect3DDevice7::GetLightEnable, // IDirect3DDevice7::LightEnable // Params: pLightIndex - // The LightIndex parameter ...Zero-based index of the set // of lighting properties to be set. If a set of lighting // properties already exists at this index, it is // overwritten by the new properties in lpLight. // pLight - // The Light parameter ...Address of a D3DLIGHT7 structure // that contains the lighting-parameters to be set. // ---------------------------------------------------------------------- virtual bool __fastcall SetLight( dword pLightIndex, TD3DLight* pLight ); // ---------------------------------------------------------------------- // Method: SetMaterial() // Description: The IDirect3DDevice7::SetMaterial method sets the // material properties for the device... // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if the lpMaterial // parameter is invalid. // Params: pMaterial - // The Material parameter ...Address of a D3DMATERIAL7 // structure that describes the material properties to be // set. // ---------------------------------------------------------------------- virtual bool __fastcall SetMaterial( TD3DMaterial* pMaterial ); // ---------------------------------------------------------------------- // Method: SetRenderState() // Description: The IDirect3DDevice3::SetRenderState method sets a single // Direct3DDevice rendering state parameter. // Params: pRenderStateType - // dwRenderStateType // Device state variable that is being modified. This // parameter can be any of the members of the // D3DRENDERSTATETYPE enumerated type. // pRenderState - // dwRenderState // New value for the Direct3DDevice render state. The // meaning of this parameter is dependent on the value // specified for dwRenderStateType. For example, if // dwRenderStateType were D3DRENDERSTATE_SHADEMODE, the // second parameter would be one of the members of the // D3DSHADEMODE enumerated type. // ---------------------------------------------------------------------- virtual bool __fastcall SetRenderState( D3DRENDERSTATETYPE pRenderStateType, dword pRenderState ); // ---------------------------------------------------------------------- // Method: SetRenderTarget() // Description: The IDirect3DDevice3::SetRenderTarget method permits the // application to easily route rendering output to a new // DirectDraw surface as a render target... // // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // error can be one of the following values: // // DDERR_INVALIDPARAMS // DDERR_INVALIDSURFACETYPE // // // Remarks // Do not use this method to set a new render target surface // with a depth buffer if the current render target does not // have a depth buffer. Likewise, you cannot use this method // to switch from a nondepth-buffered render target to a // depth-buffered render target. Attempts to do this fail in // debug builds and can exhibit unreliable behavior in // retail builds. Since both the new and the old render // targets use depth buffers, the depth buffer attached to // the new render target replaces the previous depth buffer // for the context. // // Unlike this method's implementation in previous // interfaces, IDirect3DDevice7::SetRenderTarget does not // invalidate the current material or viewport for the // device. // // Capabilities do not change with changes in the properties // of the render target surface. Both the Direct3D hardware // abstraction layer (HAL) and the software rasterizers have // only one opportunity to expose capabilities to the // application. The system cannot expose different sets of // capabilities, depending on the format of the destination // surface. // // If more than one depth buffer is attached to the render // target, this function fails. // Params: pNewRenderTarget - // lpNewRenderTarget... // Address of a IDirectDrawSurface4 interface for the // surface object that will be the new rendering target. // This surface must be created with the DDSCAPS_3DDEVICE // capability. // ---------------------------------------------------------------------- virtual bool __fastcall SetRenderTarget( TDx_DrawSurface* pNewRenderTarget ); // ---------------------------------------------------------------------- // Method: SetTexture() // Description: The IDirect3DDevice3::SetTexture method assigns a texture // to a given stage for a device. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // // // Remarks // This method method increments the reference count of the // texture surface being assigned. When the texture is no // longer needed, you should set the texture at the // appropriate stage to NULL. If you fail to do this, the // surface will not be released, resulting in a memory leak. // // Software devices do not support assigning a texture to // more than one texture stage at a time. // // In the legacy IDirect3DDevice3 interface, this method // accepted a pointer to an IDirect3DTexture2 interface. // Params: pStage - // dwStage // Stage identifier to which the texture will be set. Stage // identifiers are zero-based. Currently, devices can have // up to 8 set textures, so the maximum allowable value // allowed for dwStage is 7... // pTexture - // lpTexture... // Address of the IDirect3DTexture2 interface for the // texture being set. // ---------------------------------------------------------------------- virtual bool __fastcall SetTexture( dword pStage, TDx_DrawSurface* pTexture ); // ---------------------------------------------------------------------- // Method: SetTextureStageState() // Description: The IDirect3DDevice3::SetTextureStageState method sets // the state value for a currently assigned texture. // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // // // Remarks // Applications should use this method to set texture // states, rather than the legacy texture-related render // states. For more information, see About Render States. // ... // Params: pStage - // dwStage... // Stage identifier of the texture for which the state value // will be set. Stage identifiers are zero-based. Currently, // devices can have up to 8 set textures, so the maximum // allowable value allowed for dwStage is 7. // pState - // dwState... // Texture state to be set. This parameter can be any member // of the D3DTEXTURESTAGESTATETYPE enumerated type. // pValue - // dwValue... // State value to be set. The meaning of this value is // determined by the dwState parameter. // ---------------------------------------------------------------------- virtual bool __fastcall SetTextureStageState( dword pStage, D3DTEXTURESTAGESTATETYPE pState, dword pValue ); // ---------------------------------------------------------------------- // Method: SetTransform() // Description: The IDirect3DDevice3::SetTransform method sets a single // Direct3DDevice transformation-related state. // ... // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if one of the // arguments is invalid. // Params: pTransformStateType - // dtstTransformStateType... // Device state variable that is being modified. This // parameter can be any of the members of the // D3DTRANSFORMSTATETYPE enumerated type. // pD3DMatrix - // lpD3DMatrix... // Address of a D3DMATRIX structure that modifies the // current transformation. // ---------------------------------------------------------------------- virtual bool __fastcall SetTransform( D3DTRANSFORMSTATETYPE pTransformStateType, TD3DMatrix* pD3DMatrix ); // ---------------------------------------------------------------------- // Method: SetViewPort() // Description: The IDirect3DDevice7::SetViewport method sets the // viewport parameters for the device.... // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value is an error. The // method returns DDERR_INVALIDPARAMS if the lpViewport // parameter is invalid. // // Remarks // This method was introduced with the IDirect3DDevice7 // interface. // // If the viewport parameters described by the D3DVIEWPORT7 // structure describe a region that cannot exist within the // render target surface, the method fails, returning // DDERR_INVALIDPARAMS. // Params: pViewport - // The Viewport parameter ...Address of a D3DVIEWPORT7 // structure that contains the viewport parameters to be // set. // ---------------------------------------------------------------------- virtual bool __fastcall SetViewPort( TD3DViewPort* pViewport ); // ---------------------------------------------------------------------- // Method: ValidateDevice() // Description: The IDirect3DDevice3::ValidateDevice method reports the // device's ability to render the currently set texture // blending operations and arguments in a single pass... // Return Values // If the method succeeds, the return value is D3D_OK. // // If the method fails, the return value can be one of the // following values: // // DDERR_INVALIDOBJECT // DDERR_INVALIDPARAMS // D3DERR_CONFLICTINGTEXTUREFILTER // D3DERR_CONFLICTINGTEXTUREPALETTE // D3DERR_TOOMANYOPERATIONS // D3DERR_UNSUPPORTEDALPHAARG // D3DERR_UNSUPPORTEDALPHAOPERATION // D3DERR_UNSUPPORTEDCOLORARG // D3DERR_UNSUPPORTEDCOLOROPERATION // D3DERR_UNSUPPORTEDFACTORVALUE // D3DERR_UNSUPPORTEDTEXTUREFILTER // D3DERR_WRONGTEXTUREFORMAT // // // Remarks // Current hardware does not necessarily implement all // possible combinations of operations and arguments. You // can determine whether a particular blending operation can // be performed with given arguments by setting up the // desired blending operation, then calling the // ValidateDevice method. // // The ValidateDevice method uses the currently set render // states, textures, and texture-stage states to perform // validation at the time of the call. Any changes to these // factors after the call invalidate the previous result, // and the method must be called again before rendering a // scene. // // Using diffuse iterated values, either as an argument or // as an operation (D3DTA_DIFFUSE or // D3DTOP_BLENDDIFFUSEALPHA) is rarely supported on current // hardware. Most hardware can only introduce iterated color // data at the last texture operation stage. // // Try to specify the texture (D3DTA_TEXTURE) for each stage // as the first argument, rather than the second argument. // // Many cards do not support use of diffuse or scalar values // at arbitrary texture stages. Often, these are only // available at the first or last texture-blending stage. // // Many cards do not have a blending unit associated with // the first texture that is capable of more than // replicating alpha to color channels or inverting the // input. Therefore, your application might need to use only // the second texture stage, if possible. On such hardware, // the first unit is presumed to be in its default state, // which has the first color argument set to D3DTA_TEXTURE // with the D3DTOP_SELECTARG1 operation. // // Operations on the output alpha that are more intricate // than, or substantially different from, the color // operations are less likely to be supported. // // Some hardware does not support simultaneous use of both // D3DTA_TFACTOR and D3DTA_DIFFUSE. // // Many cards do not support simultaneous use of multiple // textures and mipmapped trilinear filtering. If trilinear // filtering has been requested for a texture involved in // multitexture blending operations and validation fails, // turn off trilinear filtering, and revalidate. In this // case, you might want to perform multipass rendering // instead. // Params: pPasses - // lpdwPasses // Address that will be filled with the number of rendering // passes to complete the desired effect through multipass // rendering.... // ---------------------------------------------------------------------- virtual bool __fastcall ValidateDevice( dword* pPasses ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx_3DDevice(TComponent* Owner); virtual __fastcall ~TDx_3DDevice(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx_3DI_Library and should not be used. // ---------------------------------------------------------------------- __property LPDIRECT3DDEVICE7 Internal_LPDIRECT3DDEVICE7 = { read=FGetInternal_LPDIRECT3DDEVICE7, write=FSetInternal_LPDIRECT3DDEVICE7, nodefault }; __property LPDIRECT3DDEVICE7* Internal_LPDIRECT3DDEVICE7_Ptr = { read=FGetInternal_LPDIRECT3DDEVICE7_Ptr, nodefault }; void __fastcall Internal_LPDIRECT3DDEVICE7_Update(); __property LPDIRECT3DDEVICE Internal_LPDIRECT3DDEVICE = { read=FGetInternal_LPDIRECT3DDEVICE, write=FSetInternal_LPDIRECT3DDEVICE, nodefault }; __property LPDIRECT3DDEVICE* Internal_LPDIRECT3DDEVICE_Ptr = { read=FGetInternal_LPDIRECT3DDEVICE_Ptr, nodefault }; void __fastcall Internal_LPDIRECT3DDEVICE_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 // ---------------------------------------------------------------------- LPDIRECT3DDEVICE7 __fastcall FGetInternal_LPDIRECT3DDEVICE7(); void __fastcall FSetInternal_LPDIRECT3DDEVICE7( LPDIRECT3DDEVICE7 pLPDIRECT3DDEVICE7 ); LPDIRECT3DDEVICE7* __fastcall FGetInternal_LPDIRECT3DDEVICE7_Ptr(); LPDIRECT3DDEVICE __fastcall FGetInternal_LPDIRECT3DDEVICE(); void __fastcall FSetInternal_LPDIRECT3DDEVICE( LPDIRECT3DDEVICE pLPDIRECT3DDEVICE ); LPDIRECT3DDEVICE* __fastcall FGetInternal_LPDIRECT3DDEVICE_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPDIRECT3DDEVICE7 fLPDIRECT3DDEVICE7; LPDIRECT3DDEVICE fLPDIRECT3DDEVICE; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; // ---------------------------------------------------------------------- // Callback Variables // ---------------------------------------------------------------------- TDx_3D_EnumTextureFormatsCallback FOnEnumTextureFormats; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------