// -------------------------------------------------------------------------- // ========================================================================== // File: TD3DXAttributeWeights.CPP // Authors: BCB_Code_Generator v2.00, // Darren Dwyer (source code, documentation, demos, website), // Hugh Edwards (documentation, icons) // Description: This file contains the code for the TD3DXAttributeWeights // 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. // ========================================================================== // -------------------------------------------------------------------------- // #includes ... // -------------------------------------------------------------------------- #include #pragma hdrstop // -------------------------------------------------------------------------- #include "TD3DXAttributeWeights.H" // -------------------------------------------------------------------------- #pragma link "TDx_Library_Defns" #pragma link "TDx_Library_Functions" #pragma link "TDx9_3DX_Library_Defns" #pragma link "TDx9_3DX_Library_Functions" // -------------------------------------------------------------------------- // Object Registration... // -------------------------------------------------------------------------- #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ #pragma package(smart_init) #endif // -------------------------------------------------------------------------- static inline void ValidCtrCheck(TD3DXAttributeWeights*) { new TD3DXAttributeWeights(NULL); } // -------------------------------------------------------------------------- namespace Td3dxattributeweights { #if (__BORLANDC__ >= 0x0530) // BCB Version 3+ void __fastcall PACKAGE Register() #else void __fastcall Register() #endif { TComponentClass classes[1] = {__classid(TD3DXAttributeWeights)}; RegisterComponents("", classes, 0); } } // -------------------------------------------------------------------------- // Constructor: TD3DXAttributeWeights::TD3DXAttributeWeights() // Description: The default constructor for the TD3DXAttributeWeights object. // -------------------------------------------------------------------------- __fastcall TD3DXAttributeWeights::TD3DXAttributeWeights(TComponent* Owner) : TComponent(Owner) { Clear(); } // -------------------------------------------------------------------------- // Destructor: TD3DXAttributeWeights::~TD3DXAttributeWeights() // Description: The destructor for the TD3DXAttributeWeights object. // -------------------------------------------------------------------------- __fastcall TD3DXAttributeWeights::~TD3DXAttributeWeights() { } // -------------------------------------------------------------------------- // Property: Binormal // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetBinormal() { return fD3DXATTRIBUTEWEIGHTS.Binormal; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetBinormal( float pBinormal ) { fD3DXATTRIBUTEWEIGHTS.Binormal = pBinormal; } // -------------------------------------------------------------------------- // Property: Boundary // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetBoundary() { return fD3DXATTRIBUTEWEIGHTS.Boundary; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetBoundary( float pBoundary ) { fD3DXATTRIBUTEWEIGHTS.Boundary = pBoundary; } // -------------------------------------------------------------------------- // Property: Diffuse // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetDiffuse() { return fD3DXATTRIBUTEWEIGHTS.Diffuse; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetDiffuse( float pDiffuse ) { fD3DXATTRIBUTEWEIGHTS.Diffuse = pDiffuse; } // -------------------------------------------------------------------------- // Property: ErrorValue // Description: The ErrorValue property contains the last error value // returned from a call to a TD3DXAttributeWeights method or // fget/fset. eg. D3D_OK // or DDERR_SURFACELOST or TDX_ERROR // -------------------------------------------------------------------------- HRESULT __fastcall TD3DXAttributeWeights::FGetErrorValue() { return fErrorValue; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetErrorValue( HRESULT pErrorValue ) { fErrorValue = pErrorValue; } // -------------------------------------------------------------------------- // Property: Normal // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetNormal() { return fD3DXATTRIBUTEWEIGHTS.Normal; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetNormal( float pNormal ) { fD3DXATTRIBUTEWEIGHTS.Normal = pNormal; } // -------------------------------------------------------------------------- // Property: Position // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetPosition() { return fD3DXATTRIBUTEWEIGHTS.Position; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetPosition( float pPosition ) { fD3DXATTRIBUTEWEIGHTS.Position = pPosition; } // -------------------------------------------------------------------------- // Property: Size // Description: The Size property contains the size in bytes of the internal // _D3DXATTRIBUTEWEIGHTS structure. // -------------------------------------------------------------------------- dword __fastcall TD3DXAttributeWeights::FGetSize() { return fSize; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetSize( dword pSize ) { fSize = pSize; } // -------------------------------------------------------------------------- // Property: Specular // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetSpecular() { return fD3DXATTRIBUTEWEIGHTS.Specular; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetSpecular( float pSpecular ) { fD3DXATTRIBUTEWEIGHTS.Specular = pSpecular; } // -------------------------------------------------------------------------- // Property: Tangent // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetTangent() { return fD3DXATTRIBUTEWEIGHTS.Tangent; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetTangent( float pTangent ) { fD3DXATTRIBUTEWEIGHTS.Tangent = pTangent; } // -------------------------------------------------------------------------- // Property: Texcoord // Description: ... // -------------------------------------------------------------------------- float __fastcall TD3DXAttributeWeights::FGetTexcoord( dword pIndex ) { if (pIndex>=8) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TD3DXAttributeWeights::FGetTexcoord()", "TDX_ERROR", "'pIndex' parameter is out of bounds." ); return (FLOAT) NULL; } return fD3DXATTRIBUTEWEIGHTS.Texcoord[pIndex]; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetTexcoord( dword pIndex, float pTexcoord ) { fD3DXATTRIBUTEWEIGHTS.Texcoord[pIndex] = pTexcoord; } // -------------------------------------------------------------------------- // Method: Clear() // Description: The Clear() method can be used to clear the contents of the // TD3DXAttributeWeights's internal D3DXATTRIBUTEWEIGHTS // structure. // Note: if you have manually linked a structure member to a // chunk of memory, make sure you release this memory before // calling Clear(). // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::Clear() { fD3DXATTRIBUTEWEIGHTS.Binormal = 0; fD3DXATTRIBUTEWEIGHTS.Boundary = 0; fD3DXATTRIBUTEWEIGHTS.Diffuse = 0; fErrorValue = D3D_OK ; fD3DXATTRIBUTEWEIGHTS.Normal = 0; fD3DXATTRIBUTEWEIGHTS.Position = 0; fSize = sizeof(_D3DXATTRIBUTEWEIGHTS); fD3DXATTRIBUTEWEIGHTS.Specular = 0; fD3DXATTRIBUTEWEIGHTS.Tangent = 0; for (int Texcoord_index=0;Texcoord_index<8;Texcoord_index++) fD3DXATTRIBUTEWEIGHTS.Texcoord[Texcoord_index] = 0; } // -------------------------------------------------------------------------- // Internal Structure Access // -------------------------------------------------------------------------- D3DXATTRIBUTEWEIGHTS* __fastcall TD3DXAttributeWeights::FGetInternal_D3DXATTRIBUTEWEIGHTS_Ptr() { return &fD3DXATTRIBUTEWEIGHTS; } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::FSetInternal_D3DXATTRIBUTEWEIGHTS( D3DXATTRIBUTEWEIGHTS* pD3DXATTRIBUTEWEIGHTS ) { if (pD3DXATTRIBUTEWEIGHTS==NULL) { fErrorValue = TDX_ERROR; if (FOnError) FOnError(this, "TD3DXAttributeWeights::FSetInternal_D3DXATTRIBUTEWEIGHTS()", "TDX_ERROR", "The supplied D3DXATTRIBUTEWEIGHTS* was NULL" ); return; } CopyMemory( &fD3DXATTRIBUTEWEIGHTS, pD3DXATTRIBUTEWEIGHTS, sizeof(D3DXATTRIBUTEWEIGHTS) ); Internal_D3DXATTRIBUTEWEIGHTS_Update(); } // -------------------------------------------------------------------------- void __fastcall TD3DXAttributeWeights::Internal_D3DXATTRIBUTEWEIGHTS_Update() { } // --------------------------------------------------------------------------