#ifndef TD3DVertexElementH #define TD3DVertexElementH // ========================================================================== // File: TD3DVertexElement.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TD3DVertexElement 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" // -------------------------------------------------------------------------- // ========================================================================== // Class: TD3DVertexElement // Description: The TD3DVertexElement component wraps multiple DirectX // D3DVERTEXELEMENT9 stuctures which define the data layout of a // vertex. // // The D3DDECL_END macro makes the declaration terminator and // should be used to declare the last element in the // declaration. // // This component is used by the // TDx9_3DDevice::CreateVertexDeclaration() and // TDx9_3DVertexDeclaration::GetDeclaration() methods when // creating or retrieving vertex declarations. // It is also used by the D3DXGenerateOutputDecl, // D3DXDeclaratorFromFVF, D3DXGetDeclLength, // D3DXTessellateTriPatch, D3DXTessellateRectPatch, // D3DXGetDeclVertexSize, D3DXCreateSkinInfo, // D3DXConcatenateMeshes, D3DXCreatePatchMesh, D3DXCreateMesh // and D3DXFVFFromDeclarator functions of the TDx9_3DX_Library. // As well as the TDx9_3DXMesh::GetDeclaration(), // TDx9_3DXMesh::CloneMesh(), TDx9_3DXMesh::UpdateSemantics(), // TDx9_3DXBaseMesh::CloneMesh(), // TDx9_3DXBaseMesh::GetDeclaration(), // TDx9_3DXBaseMesh::UpdateSemantics(), // TDx9_3DXPatchMesh::CloneMesh(), // TDx9_3DXPatchMesh::GetDeclaration(), // TDx9_3DXPMesh::CloneMesh(), TDx9_3DXPMesh::ClonePMesh(), // TDx9_3DXPMesh::GetDeclaration(), // TDx9_3DXPMesh::UpdateSemantics(), // TDx9_3DXSPMesh::CloneMesh(), TDx9_3DXSPMesh::ClonePMesh(), // TDx9_3DXSPMesh::GetDeclaration(), // TDx9_3DXSkinInfo::GetDeclaration() and // TDx9_3DXSkinInfo::SetDeclaration() methods of the // TDx9_3DX_Library. // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TD3DVertexElement : public TComponent { // -------------------------------------------------------------------------- #else // BCB Version 1 class TD3DVertexElement : public TComponent { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnError() // Description: The OnError event is called when an error occurs in the // TD3DVertexElement component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: ArraySize // Description: The ArraySize property contains the number of internal // D3DVERTEXELEMENT9 structures wrapped inside the // TD3DVertexElement component. // By default the ArraySize is initialized to 1, meaning // that this TD3DVertexElement component wraps a single // D3DVERTEXELEMENT9 structure. To wrap multiple structures, // set the TD3DVertexElement::ArraySize to the total number // of internal structures desired. // ---------------------------------------------------------------------- __property dword ArraySize = { read=FGetArraySize, write=FSetArraySize, default=1 }; // ---------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TD3DVertexElement method or // fget/fset. eg. D3D_OK or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=D3D_OK }; // ---------------------------------------------------------------------- // Property: Method // Description: The Method property holds a member of the D3DDECLMETHOD // enumerate type specifying how the tessellator should // interpret or operate on the vertex data. // ---------------------------------------------------------------------- __property byte Method[dword pArrayIndex] = { read=FGetMethod, write=FSetMethod }; // ---------------------------------------------------------------------- // Property: Offset // Description: The Offset property defines how far the particular data // type is offset from the start of the vertex data. // ---------------------------------------------------------------------- __property byte Offset[dword pArrayIndex] = { read=FGetOffset, write=FSetOffset }; // ---------------------------------------------------------------------- // Property: Size // Description: The Size property contains the size in bytes of a single // internal D3DVERTEXELEMENT9 structure. // ---------------------------------------------------------------------- __property dword Size = { read=FGetSize, write=FSetSize, nodefault }; // ---------------------------------------------------------------------- // Property: SizeAll // Description: The SizeAll property contains the size in bytes of all // internal D3DVERTEXELEMENT9 structures. This result is the // same as multiplying TD3DVertexElement::ArraySize and // TD3DVertexElement::Size. // ---------------------------------------------------------------------- __property dword SizeAll = { read=FGetSizeAll, nodefault }; // ---------------------------------------------------------------------- // Property: Stream // Description: The Stream property defines the stream number of this // element. // ---------------------------------------------------------------------- __property byte Stream[dword pArrayIndex] = { read=FGetStream, write=FSetStream }; // ---------------------------------------------------------------------- // Property: Type // Description: The Type property holds a member of the D3DDECLTYPE // enumerated type specifying the data size/type for this // element. // Some values of the Method property have an implied type. // ---------------------------------------------------------------------- __property byte Type[dword pArrayIndex] = { read=FGetType, write=FSetType }; // ---------------------------------------------------------------------- // Property: Usage // Description: The Usage property holds member(s) of the D3DDECLUSAGE // enumerated type specifying what uses the data will be put // to. // // This property determines the interoperability between // vertex data layouts and the vertex shaders. Thus, each // usage acts to bind a declaration to a vertex shader. // The D3DDECLUSAGE_TEXCOORD setting can be used for user // defined fields which don't have an existing usage // defined. // ---------------------------------------------------------------------- __property byte Usage[dword pArrayIndex] = { read=FGetUsage, write=FSetUsage }; // ---------------------------------------------------------------------- // Property: UsageIndex // Description: The UsageIndex property modifies Usage data so multiple // usage types can be specified. // ---------------------------------------------------------------------- __property byte UsageIndex[dword pArrayIndex] = { read=FGetUsageIndex, write=FSetUsageIndex }; // ---------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of // the TD3DVertexElement's internal D3DVERTEXELEMENT9 // structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // Params: pArrayIndex - // The ArrayIndex parameter determines which internal // structure needs to be cleared. Correct values range from // 0 to TD3DVertexElement::ArraySize-1. // ---------------------------------------------------------------------- virtual void __fastcall Clear( dword pArrayIndex ); // ---------------------------------------------------------------------- // Method: ClearAll() // Description: The ClearAll() method can be used to clear the contents // of all the internal D3DVERTEXELEMENT9 structures of the // TD3DVertexElement component. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // ---------------------------------------------------------------------- virtual void __fastcall ClearAll(); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TD3DVertexElement(TComponent* Owner); virtual __fastcall ~TD3DVertexElement(); // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- __property D3DVERTEXELEMENT9* Internal_D3DVERTEXELEMENT9_Ptr = { read=FGetInternal_D3DVERTEXELEMENT9_Ptr, nodefault }; void __fastcall Internal_D3DVERTEXELEMENT9_Update(); // ========================================================================== protected: // ========================================================================== // ---------------------------------------------------------------------- // Property Access Methods // ---------------------------------------------------------------------- dword __fastcall FGetArraySize(); void __fastcall FSetArraySize( dword pArraySize ); HRESULT __fastcall FGetErrorValue(); void __fastcall FSetErrorValue( HRESULT pErrorValue ); byte __fastcall FGetMethod( dword pArrayIndex ); void __fastcall FSetMethod( dword pArrayIndex, byte pMethod ); byte __fastcall FGetOffset( dword pArrayIndex ); void __fastcall FSetOffset( dword pArrayIndex, byte pOffset ); dword __fastcall FGetSize(); void __fastcall FSetSize( dword pSize ); dword __fastcall FGetSizeAll(); byte __fastcall FGetStream( dword pArrayIndex ); void __fastcall FSetStream( dword pArrayIndex, byte pStream ); byte __fastcall FGetType( dword pArrayIndex ); void __fastcall FSetType( dword pArrayIndex, byte pType ); byte __fastcall FGetUsage( dword pArrayIndex ); void __fastcall FSetUsage( dword pArrayIndex, byte pUsage ); byte __fastcall FGetUsageIndex( dword pArrayIndex ); void __fastcall FSetUsageIndex( dword pArrayIndex, byte pUsageIndex ); // ========================================================================== private: // ========================================================================== // ---------------------------------------------------------------------- // Internal Structure Access // ---------------------------------------------------------------------- D3DVERTEXELEMENT9* __fastcall FGetInternal_D3DVERTEXELEMENT9_Ptr(); void __fastcall FSetInternal_D3DVERTEXELEMENT9( dword pArrayIndex, D3DVERTEXELEMENT9* pD3DVERTEXELEMENT9 ); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- dword fArraySize; HRESULT fErrorValue; dword fSize; dword fSizeAll; // ---------------------------------------------------------------------- // Structure Variables // ---------------------------------------------------------------------- D3DVERTEXELEMENT9* fD3DVERTEXELEMENT9; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------