#ifndef TDx9_3DXPMeshH #define TDx9_3DXPMeshH // ========================================================================== // File: TDx9_3DXPMesh.H // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file defines the TDx9_3DXPMesh Component // // "TDx9_3DX_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_3DX_Library_Defns.H" #include "TDx9_3DX_Library_Functions.H" // -------------------------------------------------------------------------- // external classes used by TDx9_3DXPMesh methods. class TDx9_3DDevice; class TDx9_3DXPMesh; class TDx9_3DIndexBuffer; class TDx9_3DVertexBuffer; // -------------------------------------------------------------------------- // ========================================================================== // Class: TDx9_3DXPMesh // Description: The TDx9_3DXPMesh object is used to ... // ========================================================================== #if (__BORLANDC__ >= 0x0530) // BCB Version 3 + class PACKAGE TDx9_3DXPMesh : public TDx9_3DXBaseMesh { // -------------------------------------------------------------------------- #else // BCB Version 1 class TDx9_3DXPMesh : public TDx9_3DXBaseMesh { #endif // ========================================================================== __published: // ========================================================================== // ---------------------------------------------------------------------- // Event: OnCreate() // Description: The OnCreate() event is triggered by the // TDx9_3DXPMesh::Create() method after it has successfully // created the internal LPD3DXPMESH used within the // TDx9_3DXPMesh 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 LPD3DXPMESH interface. // // For example, you could retrieve the TDx9_3DXPMesh // component's capabilities, Create() dependant components, // allocate memory, etc. // // When used in conjunction with the // TDx9_3DXPMesh::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_3DXPMesh::Destroy() method, just before the // TDx9_3DXPMesh internal LPD3DXPMESH interface is // destroyed. // // Note: This event is an ideal place to place code that // reverses the results of the TDx9_3DXPMesh::OnCreate() // event. For example, assume you have already setup the // TDx9_3DXPMesh::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_3DXPMesh::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_3DXPMesh component. // ---------------------------------------------------------------------- __property TDx_Error OnError = {read=FOnError, write=FOnError, nodefault}; // ========================================================================== public: // ========================================================================== // ---------------------------------------------------------------------- // Property: Created // Description: The Created property is true if the internal LPD3DXPMESH // used in this component has been successfully created, // otherwise Created is false. // // To create the internal LPD3DXPMESH, call the // TDx9_3DXPMesh::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_3DXPMesh method or // fget/fset. eg. D3D_OK // or DDERR_SURFACELOST or TDX_ERROR // ---------------------------------------------------------------------- __property HRESULT ErrorValue = { read=FGetErrorValue, write=FSetErrorValue, default=D3D_OK }; // ---------------------------------------------------------------------- // Method: CloneMesh() // Description: The CloneMesh method is used to ... // Params: pOptions - // The Options parameter ... // pLPD3DVERTEXELEMENT9 - // The LPD3DVERTEXELEMENT9 parameter ... // pDeclaration - // The Declaration parameter ... // pDevice - // The Device parameter ... // pCloneMesh - // The CloneMesh parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: CloneMeshFVF() // Description: The CloneMeshFVF method is used to ... // Params: pOptions - // The Options parameter ... // pFVF - // The FVF parameter ... // pDevice - // The Device parameter ... // pCloneMesh - // The CloneMesh parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall CloneMeshFVF( dword pOptions, dword pFVF, TDx9_3DDevice* pDevice, LPD3DXMESH* pCloneMesh ); // ---------------------------------------------------------------------- // Method: ClonePMesh() // Description: The ClonePMesh method is used to ... // Params: pOptions - // The Options parameter ... // pLPD3DVERTEXELEMENT9 - // The LPD3DVERTEXELEMENT9 parameter ... // pDeclaration - // The Declaration parameter ... // pDevice - // The Device parameter ... // pCloneMesh - // The CloneMesh parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: ClonePMeshFVF() // Description: The ClonePMeshFVF method is used to ... // Params: pOptions - // The Options parameter ... // pFVF - // The FVF parameter ... // pDevice - // The Device parameter ... // pCloneMesh - // The CloneMesh parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall ClonePMeshFVF( dword pOptions, dword pFVF, TDx9_3DDevice* pDevice, TDx9_3DXPMesh* pCloneMesh ); // ---------------------------------------------------------------------- // Method: ConvertAdjacencyToPointReps() // Description: The ConvertAdjacencyToPointReps method is used to ... // Params: pDWORD* - // The DWORD* parameter ... // pAdjacency - // The Adjacency parameter ... // pPRep - // The PRep parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: ConvertPointRepsToAdjacency() // Description: The ConvertPointRepsToAdjacency method is used to ... // Params: pDWORD* - // The DWORD* parameter ... // pPRep - // The PRep parameter ... // pAdjacency - // The Adjacency parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: Create() // Description: The Create() method is used to automatically create the // internal LPD3DXPMESH interface used in the TDx9_3DXPMesh // component and must be called before any methods of the // TDx9_3DXPMesh component will function. // ---------------------------------------------------------------------- virtual bool __fastcall Create(); // ---------------------------------------------------------------------- // Method: Destroy() // Description: The Destroy() method is used to automatically destroy the // internal LPD3DXPMESH interface used in the TDx9_3DXPMesh // 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: DrawSubset() // Description: The DrawSubset method is used to ... // Params: pAttribId - // The AttribId parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall DrawSubset( dword pAttribId ); // ---------------------------------------------------------------------- // Method: GenerateAdjacency() // Description: The GenerateAdjacency method is used to ... // Params: pEpsilon - // The Epsilon parameter ... // pAdjacency - // The Adjacency parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GenerateAdjacency( float pEpsilon, dword* pAdjacency ); // ---------------------------------------------------------------------- // Method: GenerateVertexHistory() // Description: The GenerateVertexHistory method is used to ... // Params: pVertexHistory - // The VertexHistory parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GenerateVertexHistory( dword* pVertexHistory ); // ---------------------------------------------------------------------- // Method: GetAdjacency() // Description: The GetAdjacency method is used to ... // Params: pAdjacency - // The Adjacency parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetAdjacency( dword* pAdjacency ); // ---------------------------------------------------------------------- // Method: GetAttributeTable() // Description: The GetAttributeTable method is used to ... // Params: pAttribTable - // The AttribTable parameter ... // pAttribTableSize - // The AttribTableSize parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetAttributeTable( D3DXATTRIBUTERANGE* pAttribTable, dword* pAttribTableSize ); // ---------------------------------------------------------------------- // Method: GetDeclaration() // Description: The GetDeclaration method is used to ... // Params: pDeclaration[MAX_FVF_DECL_SIZE] - // The Declaration[MAX_FVF_DECL_SIZE] parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetDeclaration( D3DVERTEXELEMENT9 pDeclaration[MAX_FVF_DECL_SIZE] ); // ---------------------------------------------------------------------- // Method: GetDevice() // Description: The GetDevice method is used to ... // Params: pDevice - // The Device parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetDevice( TDx9_3DDevice* pDevice ); // ---------------------------------------------------------------------- // Method: GetFVF() // Description: The GetFVF method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetFVF(); // ---------------------------------------------------------------------- // Method: GetIndexBuffer() // Description: The GetIndexBuffer method is used to ... // Params: pIB - // The IB parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetIndexBuffer( TDx9_3DIndexBuffer* pIB ); // ---------------------------------------------------------------------- // Method: GetMaxFaces() // Description: The GetMaxFaces method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetMaxFaces(); // ---------------------------------------------------------------------- // Method: GetMaxVertices() // Description: The GetMaxVertices method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetMaxVertices(); // ---------------------------------------------------------------------- // Method: GetMinFaces() // Description: The GetMinFaces method is used to ... // ---------------------------------------------------------------------- virtual DWORD __fastcall GetMinFaces(); // ---------------------------------------------------------------------- // Method: GetMinVertices() // Description: The GetMinVertices method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetMinVertices(); // ---------------------------------------------------------------------- // Method: GetNumBytesPerVertex() // Description: The GetNumBytesPerVertex method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetNumBytesPerVertex(); // ---------------------------------------------------------------------- // Method: GetNumFaces() // Description: The GetNumFaces method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetNumFaces(); // ---------------------------------------------------------------------- // Method: GetNumVertices() // Description: The GetNumVertices method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetNumVertices(); // ---------------------------------------------------------------------- // Method: GetOptions() // Description: The GetOptions method is used to ... // ---------------------------------------------------------------------- virtual dword __fastcall GetOptions(); // ---------------------------------------------------------------------- // Method: GetVertexBuffer() // Description: The GetVertexBuffer method is used to ... // Params: pVB - // The VB parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall GetVertexBuffer( TDx9_3DVertexBuffer* pVB ); // ---------------------------------------------------------------------- // Method: LockIndexBuffer() // Description: The LockIndexBuffer method is used to ... // Params: pFlags - // The Flags parameter ... // pData - // The Data parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall LockIndexBuffer( dword pFlags, void** pData ); // ---------------------------------------------------------------------- // Method: LockVertexBuffer() // Description: The LockVertexBuffer method is used to ... // Params: pFlags - // The Flags parameter ... // pData - // The Data parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall LockVertexBuffer( dword pFlags, void** pData ); // ---------------------------------------------------------------------- // Method: Optimize() // Description: The Optimize method is used to ... // Params: pFlags - // The Flags parameter ... // pAdjacencyOut - // The AdjacencyOut parameter ... // pFaceRemap - // The FaceRemap parameter ... // pVertexRemap - // The VertexRemap parameter ... // pOptMesh - // The OptMesh parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall Optimize( dword pFlags, dword* pAdjacencyOut, dword* pFaceRemap, LPD3DXBUFFER* pVertexRemap, LPD3DXMESH* pOptMesh ); // ---------------------------------------------------------------------- // Method: OptimizeBaseLOD() // Description: The OptimizeBaseLOD method is used to ... // Params: pFlags - // The Flags parameter ... // pFaceMap - // The FaceMap parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall OptimizeBaseLOD( dword pFlags, dword* pFaceMap ); // ---------------------------------------------------------------------- // Method: Save() // Description: The Save method is used to ... // Params: pStream - // The Stream parameter ... // pD3DXMATERIAL - // The D3DXMATERIAL parameter ... // pD3DXEFFECTINSTANCE* - // The D3DXEFFECTINSTANCE* parameter ... // pEffectInstances - // The EffectInstances parameter ... // pNumMaterials - // The NumMaterials parameter ... // ---------------------------------------------------------------------- // ---------------------------------------------------------------------- // Method: SetNumFaces() // Description: The SetNumFaces method is used to ... // Params: pFaces - // The Faces parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetNumFaces( dword pFaces ); // ---------------------------------------------------------------------- // Method: SetNumVertices() // Description: The SetNumVertices method is used to ... // Params: pVertices - // The Vertices parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall SetNumVertices( dword pVertices ); // ---------------------------------------------------------------------- // Method: TrimByFaces() // Description: The TrimByFaces method is used to ... // Params: pNewFacesMin - // The NewFacesMin parameter ... // pNewFacesMax - // The NewFacesMax parameter ... // pFaceRemap - // The FaceRemap parameter ... // pVertRemap - // The VertRemap parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall TrimByFaces( dword pNewFacesMin, dword pNewFacesMax, dword* pFaceRemap, dword* pVertRemap ); // ---------------------------------------------------------------------- // Method: TrimByVertices() // Description: The TrimByVertices method is used to ... // Params: pNewVerticesMin - // The NewVerticesMin parameter ... // pNewVerticessMax - // The NewVerticessMax parameter ... // pFaceRemap - // The FaceRemap parameter ... // pVertRemap - // The VertRemap parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall TrimByVertices( dword pNewVerticesMin, dword pNewVerticessMax, dword* pFaceRemap, dword* pVertRemap ); // ---------------------------------------------------------------------- // Method: UnlockIndexBuffer() // Description: The UnlockIndexBuffer method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall UnlockIndexBuffer(); // ---------------------------------------------------------------------- // Method: UnlockVertexBuffer() // Description: The UnlockVertexBuffer method is used to ... // ---------------------------------------------------------------------- virtual bool __fastcall UnlockVertexBuffer(); // ---------------------------------------------------------------------- // Method: UpdateSemantics() // Description: The UpdateSemantics method is used to ... // Params: pDeclaration[MAX_FVF_DECL_SIZE] - // The Declaration[MAX_FVF_DECL_SIZE] parameter ... // ---------------------------------------------------------------------- virtual bool __fastcall UpdateSemantics( D3DVERTEXELEMENT9 pDeclaration[MAX_FVF_DECL_SIZE] ); // ---------------------------------------------------------------------- // Constructor() and Destructor() // ---------------------------------------------------------------------- __fastcall TDx9_3DXPMesh(TComponent* Owner); virtual __fastcall ~TDx9_3DXPMesh(); // ---------------------------------------------------------------------- // The following properties and methods are used internally by // TDx9_3DX_Library and should not be used. // ---------------------------------------------------------------------- __property LPD3DXPMESH Internal_LPD3DXPMESH = { read=FGetInternal_LPD3DXPMESH, write=FSetInternal_LPD3DXPMESH, nodefault }; __property LPD3DXPMESH* Internal_LPD3DXPMESH_Ptr = { read=FGetInternal_LPD3DXPMESH_Ptr, nodefault }; void __fastcall Internal_LPD3DXPMESH_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 // ---------------------------------------------------------------------- LPD3DXPMESH __fastcall FGetInternal_LPD3DXPMESH(); void __fastcall FSetInternal_LPD3DXPMESH( LPD3DXPMESH pLPD3DXPMESH ); LPD3DXPMESH* __fastcall FGetInternal_LPD3DXPMESH_Ptr(); // ---------------------------------------------------------------------- // Property Variables // ---------------------------------------------------------------------- bool fCreated; HRESULT fErrorValue; // ---------------------------------------------------------------------- // Interface Variables // ---------------------------------------------------------------------- LPD3DXPMESH fLPD3DXPMESH; // ---------------------------------------------------------------------- // Event Variables // ---------------------------------------------------------------------- TDx_Event FOnCreate; TDx_Event FOnDestroy; TDx_Error FOnError; }; // -------------------------------------------------------------------------- #endif // --------------------------------------------------------------------------