ID3DXPRTCompBuffer Interface

 

 

' ****************************************************************************************
' ID3DXPRTCompBuffer interface
' $IID_ID3DXPRTCompBuffer = GUID$("{A758D465-FE8D-45ad-9CF0-D01E56266A07}")
' ****************************************************************************************

' ****************************************************************************************
' The ID3DXPRTCompBuffer interface stores a compressed version of a ID3DXPRTBuffer buffer, for
' use with principal component analysis (PCA).
' Remarks
'    The ID3DXPRTCompBuffer interface is obtained by calling the D3DXCreatePRTCompBuffer function.
' Interface Information
'    Stock Implementation   d3d9.dll
'    Custom Implementation  No
'    Inherits from  IUnknown
'    Header     d3dx9mesh.h
'    Import library     d3dx9.lib
'    Minimum operating systems  Windows 98
' ****************************************************************************************

' ****************************************************************************************
'DECLARE_INTERFACE_(ID3DXPRTCompBuffer, IUnknown)
'{
'    // IUnknown
'  0.  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
'  1.  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
'  2.  STDMETHOD_(ULONG, Release)(THIS) PURE;

'    // ID3DPRTCompBuffer

'    // NumCoeffs and NumChannels are properties of input buffer
'  3.  STDMETHOD_(UINT, GetNumSamples)(THIS) PURE;
'  4.  STDMETHOD_(UINT, GetNumCoeffs)(THIS) PURE;
'  5.  STDMETHOD_(UINT, GetNumChannels)(THIS) PURE;

'  6.  STDMETHOD_(BOOL, IsTexture)(THIS) PURE;
'  7.  STDMETHOD_(UINT, GetWidth)(THIS) PURE;
'  8. STDMETHOD_(UINT, GetHeight)(THIS) PURE;

'    // number of clusters, and PCA vectors per-cluster
'  9. STDMETHOD_(UINT, GetNumClusters)(THIS) PURE;
' 10. STDMETHOD_(UINT, GetNumPCA)(THIS) PURE;

'    // normalizes PCA weights so that they are between [-1,1]
'    // basis vectors are modified to reflect this
' 11. STDMETHOD(NormalizeData)(THIS) PURE;

'    // copies basis vectors for cluster "Cluster" into pClusterBasis
'    // (NumPCA+1)*NumCoeffs*NumChannels floats
' 12. STDMETHOD(ExtractBasis)(THIS_ UINT Cluster, FLOAT *pClusterBasis) PURE;

'    // UINT per sample - which cluster it belongs to
' 13. STDMETHOD(ExtractClusterIDs)(THIS_ UINT *pClusterIDs) PURE;

'    // copies NumExtract PCA projection coefficients starting at StartPCA
'    // into pPCACoefficients - NumSamples*NumExtract floats copied
' 14. STDMETHOD(ExtractPCA)(THIS_ UINT StartPCA, UINT NumExtract, FLOAT *pPCACoefficients) PURE;

'    // copies NumPCA projection coefficients starting at StartPCA
'    // into pTexture - should be able to cope with signed formats
' 15. STDMETHOD(ExtractTexture)(THIS_ UINT StartPCA, UINT NumpPCA,
'                              LPDIRECT3DTEXTURE9 pTexture) PURE;

'    // copies NumPCA projection coefficients into mesh pScene
'    // Usage is D3DDECLUSAGE where coefficients are to be stored
'    // UsageIndexStart is starting index
' 16. STDMETHOD(ExtractToMesh)(THIS_ UINT NumPCA, D3DDECLUSAGE Usage, UINT UsageIndexStart,
'                             LPD3DXMESH pScene) PURE;
'};
' ****************************************************************************************

' ****************************************************************************************
' GetNumSamples method
' Retrieves the number of vertices (or texels) sampled.
' UINT GetNumSamples();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetNumSamples ALIAS "ID3DXPRTCompBuffer_GetNumSamples" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[3] USING ID3DXPRTCompBuffer_GetNumSamples(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetNumCoeffs method
' Retrieves the number of scalars per color channel used in memory to store samples.
' UINT GetNumCoeffs();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetNumCoeffs ALIAS "ID3DXPRTCompBuffer_GetNumCoeffs" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[4] USING ID3DXPRTCompBuffer_GetNumCoeffs(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetNumChannels method
' Retrieves the number of color channels used in memory to store samples.
' UINT GetNumChannels();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetNumChannels ALIAS "ID3DXPRTCompBuffer_GetNumChannels" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[5] USING ID3DXPRTCompBuffer_GetNumChannels(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IsTexture method
' Indicates whether the buffer contains a texture.
' BOOL IsTexture();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_IsTexture ALIAS "ID3DXPRTCompBuffer_IsTexture" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL LRESULT AS LONG
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[6] USING ID3DXPRTCompBuffer_IsTexture(pthis) TO LRESULT
    FUNCTION = LRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetWidth method
' Retrieves the width of the texture, in pixels.
' UINT GetWidth();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetWidth ALIAS "ID3DXPRTCompBuffer_GetWidth" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[7] USING ID3DXPRTCompBuffer_GetWidth(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetHeight method
' Retrieves the height of the texture, in pixels.
' UINT GetHeight();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetHeight ALIAS "ID3DXPRTCompBuffer_GetHeight" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[8] USING ID3DXPRTCompBuffer_GetHeight(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetNumClusters method
' Retrieves the number of clusters to use for compression.
' UINT GetNumClusters();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetNumClusters ALIAS "ID3DXPRTCompBuffer_GetNumClusters" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[9] USING ID3DXPRTCompBuffer_GetNumClusters(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetNumPCA method
' Retrieves the number of principal component analysis (PCA) basis vectors to use in
' each cluster.
' UINT GetNumPCA();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_GetNumPCA ALIAS "ID3DXPRTCompBuffer_GetNumPCA" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[10] USING ID3DXPRTCompBuffer_GetNumPCA(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' NormalizeData method
' Normalizes all principal component analysis (PCA) weights so that they are between -1
' and 1. Basis vectors are modified to reflect this normalization.
' HRESULT NormalizeData();
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_NormalizeData ALIAS "ID3DXPRTCompBuffer_NormalizeData" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[11] USING ID3DXPRTCompBuffer_NormalizeData(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ExtractBasis method
' Extracts the mean and principal component analysis (PCA) basis vectors for a given cluster
' from an ID3DXPRTCompBuffer compressed data buffer.
' HRESULT ExtractBasis(
'   UINT Cluster,
'   FLOAT * pClusterBasis
' );
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_ExtractBasis ALIAS "ID3DXPRTCompBuffer_ExtractBasis" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Cluster AS DWORD, BYREF pClusterBasis AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[12] USING ID3DXPRTCompBuffer_ExtractBasis(pthis, Cluster, pClusterBasis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ExtractClustersIDs method
' Extracts the per-sample cluster identifiers (IDs) from an ID3DXPRTCompBuffer compressed
' data buffer.
' HRESULT ExtractClusterIDs(
'   UINT * pClusterIDs
' );
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_ExtractClustersIDs ALIAS "ID3DXPRTCompBuffer_ExtractClustersIDs" ( _
    BYVAL pthis AS DWORD PTR, BYVAL ClusterIDs AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[13] USING ID3DXPRTCompBuffer_ExtractClustersIDs(pthis, ClusterIDs) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ExtractPCA method
' Extracts the per-sample principal component analysis (PCA) projection coefficients from
' an ID3DXPRTCompBuffer compressed data buffer.
' HRESULT ExtractPCA(
'   UINT StartPCA,
'   UINT NumExtract,
'   FLOAT * pPCACoefficients
' );
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_ExtractPCA ALIAS "ID3DXPRTCompBuffer_ExtractPCA" ( _
    BYVAL pthis AS DWORD PTR, BYVAL StartPCA AS DWORD, BYVAL NumExtract AS DWORD, _
    BYREF pPCACoefficients AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[14] USING ID3DXPRTCompBuffer_ExtractPCA(pthis, StartPCA, NumExtract, pPCACoefficients) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ExtractTexture method
' Extracts the per-sample principal component analysis (PCA) projection coefficients from
' an ID3DXPRTCompBuffer compressed data buffer and adds the data to an IDirect3DTexture9
' object.
' HRESULT ExtractTexture(
'   UINT StartPCA,
'   UINT NumPCA,
'   LPDIRECT3DTEXTURE9 pTexture
' );
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_ExtractTexture ALIAS "ID3DXPRTCompBuffer_ExtractTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL StartPCA AS DWORD, BYVAL NumPCA AS DWORD, _
    BYVAL pTexture AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[15] USING ID3DXPRTCompBuffer_ExtractTexture(pthis, StartPCA, NumPCA, pTexture) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ExtractToMesh method
' Extracts the per-sample principal component analysis (PCA) projection coefficients from
' an ID3DXPRTCompBuffer compressed data buffer and adds the data to an ID3DXMesh object.
' HRESULT ExtractToMesh(
'   UINT NumPCA,
'   D3DDECLUSAGE Usage,
'   UINT UsageIndexStart,
'   LPD3DXMESH pScene
' );
' ****************************************************************************************
FUNCTION ID3DXPRTCompBuffer_ExtractToMesh ALIAS "ID3DXPRTCompBuffer_ExtractToMesh" ( _
    BYVAL pthis AS DWORD PTR, BYVAL NumPCA AS DWORD, BYVAL Usage AS DWORD, _
    BYVAL UsageIndexStart AS DWORD, BYVAL pScene AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[16] USING ID3DXPRTCompBuffer_ExtractToMesh(pthis, NumPCA, Usage, UsageIndexStart, pScene) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Tuesday, 14 March 2006 23:37:18 +0100