ID3DXTextureGutterHelper Interface

 

 

' ****************************************************************************************
' ID3DXTextureGutterHelper interface
' $IID_ID3DXTextureGutterHelper = GUID$("{06F57E0A-BD95-43f1-A3DA-791CF6CA297B}")
' ****************************************************************************************

' ****************************************************************************************
' The ID3DXTextureGutterHelper interface is used to build and manage gutter regions in a
' texture. Gutter regions separate textures and allow for bilinear interpolation to avoid
' rendering artifacts at texture boundaries.
' The Get... methods provide access to the data structures used by the Apply... methods.
' Remarks
'    Note  When used with precomputed radiance transfer (PRT), this interface requires a unique
'    parameterization of the model. Every texel must correspond to a single point on the surface
'    of the model and vice-versa. If the model includes multiple textures, it must be split into
'    separate pieces that each contain one gutter helper object per texture.
'    This interface can be used to generate a map in texture space in which each texel is in
'    one of four classes.
'    Texel Class    Texel Location
'    -----------  -----------------------------------------------------
'     0              Invalid point; texel will not be used.
'     1              Inside triangle.
'     2              Inside gutter.
'     4              Inside gutter; texel will be evaluated as a full sample in the ApplyGuttersFloat,
'                 ApplyGuttersTex, or ApplyGuttersPRT methods.
'    For classes 1 and 2, a texel is stored with the face it belongs to, along with barycentric
'    coordinates of the first two vertices of that face. Gutter vertices are assigned to the
'    closest edge in texture space.
'    There is no texel class 3.
'    The ID3DXTextureGutterHelper interface is obtained by calling the
'    D3DXCreateTextureGutterHelper 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_(ID3DXTextureGutterHelper, IUnknown)
'{
'    // IUnknown
'  0.  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
'  1.  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
'  2.  STDMETHOD_(ULONG, Release)(THIS) PURE;

'    // ID3DXTextureGutterHelper

'    // dimensions of texture this is bound too
'  3.  STDMETHOD_(UINT, GetWidth)(THIS) PURE;
'  4.  STDMETHOD_(UINT, GetHeight)(THIS) PURE;


'    // Applying gutters recomputes all of the gutter texels of class "2"
'    // based on texels of class "1" or "4"

'    // Applies gutters to a raw float buffer - each texel is NumCoeffs floats
'    // Width and Height must match GutterHelper
'  5.  STDMETHOD(ApplyGuttersFloat)(THIS_ FLOAT *pDataIn, UINT NumCoeffs, UINT Width, UINT Height);

'    // Applies gutters to pTexture
'    // Dimensions must match GutterHelper
'  6.  STDMETHOD(ApplyGuttersTex)(THIS_ LPDIRECT3DTEXTURE9 pTexture);

'    // Applies gutters to a D3DXPRTBuffer
'    // Dimensions must match GutterHelper
'  7.  STDMETHOD(ApplyGuttersPRT)(THIS_ LPD3DXPRTBUFFER pBuffer);

'    // the routines below provide access to the data structures
'    // used by the Apply functions

'    // face map is a UINT per texel that represents the
'    // face of the mesh that texel belongs too -
'    // only valid if same texel is valid in pGutterData
'    // pFaceData must be allocated by the user
'  8.  STDMETHOD(GetFaceMap)(THIS_ UINT *pFaceData) PURE;

'    // BaryMap is a D3DXVECTOR2 per texel
'    // the 1st two barycentric coordinates for the corresponding
'    // face (3rd weight is always 1-sum of first two)
'    // only valid if same texel is valid in pGutterData
'    // pBaryData must be allocated by the user
'  9.  STDMETHOD(GetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE;

'    // TexelMap is a D3DXVECTOR2 per texel that
'    // stores the location in pixel coordinates where the
'    // corresponding texel is mapped
'    // pTexelData must be allocated by the user
' 10.  STDMETHOD(GetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE;

'    // GutterMap is a BYTE per texel
'    // 0/1/2 for Invalid/Internal/Gutter texels
'    // 4 represents a gutter texel that will be computed
'    // during PRT
'    // pGutterData must be allocated by the user
' 11.  STDMETHOD(GetGutterMap)(THIS_ BYTE *pGutterData) PURE;

'    // face map is a UINT per texel that represents the
'    // face of the mesh that texel belongs too -
'    // only valid if same texel is valid in pGutterData
' 12.  STDMETHOD(SetFaceMap)(THIS_ UINT *pFaceData) PURE;

'    // BaryMap is a D3DXVECTOR2 per texel
'    // the 1st two barycentric coordinates for the corresponding
'    // face (3rd weight is always 1-sum of first two)
'    // only valid if same texel is valid in pGutterData
' 13.  STDMETHOD(SetBaryMap)(THIS_ D3DXVECTOR2 *pBaryData) PURE;

'    // TexelMap is a D3DXVECTOR2 per texel that
'    // stores the location in pixel coordinates where the
'    // corresponding texel is mapped
' 14.  STDMETHOD(SetTexelMap)(THIS_ D3DXVECTOR2 *pTexelData) PURE;

'    // GutterMap is a BYTE per texel
'    // 0/1/2 for Invalid/Internal/Gutter texels
'    // 4 represents a gutter texel that will be computed
'    // during PRT
' 15.  STDMETHOD(SetGutterMap)(THIS_ BYTE *pGutterData) PURE;
'};
' ****************************************************************************************

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

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

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

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

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

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

' ****************************************************************************************
' ApplyGuttersFloat method
' Applies gutters to a FLOAT texture buffer.
' HRESULT ApplyGuttersFloat(
'   FLOAT * pDataIn,
'   UINT * NumCoeffs,
'   UINT * Width,
'   UINT * Height
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_ApplyGuttersFloat ALIAS "ID3DXTextureGutterHelper_ApplyGuttersFloat" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pDataIn AS DWORD, BYVAL NumCoeffs AS DWORD, _
    BYVAL nWidth AS DWORD, BYVAL nHeight AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[5] USING ID3DXTextureGutterHelper_ApplyGuttersFloat(pthis, pDataIn, NumCoeffs, nWidth, nHeight) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' ApplyGuttersTex method
' Applies gutters to an IDirect3DTexture9 texture object.
' HRESULT ApplyGuttersTex(
'   LPDIRECT3DTEXTURE9 pTexture
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_ApplyGuttersTex ALIAS "ID3DXTextureGutterHelper_ApplyGuttersTex" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pTexture AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' ApplyGuttersPRT method
' Applies gutters to an ID3DXPRTBuffer buffer object.
' HRESULT ApplyGuttersPRT(
'   LPD3DXPRTBUFFER pBuffer
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_ApplyGuttersPRT ALIAS "ID3DXTextureGutterHelper_ApplyGuttersPRT" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pBuffer AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetFaceMap method
' Retrieves the index of the mesh face to which each texel belongs.
' HRESULT GetFaceMap(
'   UINT * pFaceData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_GetFaceMap ALIAS "ID3DXTextureGutterHelper_GetFaceMap" ( _
    BYVAL pthis AS DWORD PTR, BYREF pFaceData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetBaryMap method
' Retrieves texel barycentric coordinates.
' HRESULT GetBaryMap(
'   D3DXVECTOR2 * pBaryData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_GetBaryMap ALIAS "ID3DXTextureGutterHelper_GetBaryMap" ( _
    BYVAL pthis AS DWORD PTR, BYREF pBaryData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetTexelMap method
' Retrieves the (u, v) texture coordinates of each texel.
' HRESULT GetTexelMap(
'   D3DXVECTOR2 * pTexelData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_GetTexelMap ALIAS "ID3DXTextureGutterHelper_GetTexelMap" ( _
    BYVAL pthis AS DWORD PTR, BYREF pTexelData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetGutterMap method
' Receives a texel class value that indicates texel class according to each texel's
' location.
' HRESULT GetGutterMap(
'   BYTE * pGutterData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_GetGutterMap ALIAS "ID3DXTextureGutterHelper_GetGutterMap" ( _
    BYVAL pthis AS DWORD PTR, BYREF pGutterData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' SetFaceMap method
' Sets the index of the mesh face to which each texel belongs.
' HRESULT SetFaceMap(
'   UINT * pFaceData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_SetFaceMap ALIAS "ID3DXTextureGutterHelper_SetFaceMap" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pFaceData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' SetBaryMap method
' Sets texel barycentric coordinates.
' HRESULT SetBaryMap(
'   D3DXVECTOR2 * pBaryData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_SetBaryMap ALIAS "ID3DXTextureGutterHelper_SetBaryMap" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pFaceData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' SetTexelMap method
' Sets texel barycentric coordinates.
' HRESULT SetTexelMap(
'   D3DXVECTOR2 * pTexelData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_SetTexelMap ALIAS "ID3DXTextureGutterHelper_SetTexelMap" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pTexelData AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' SetGutterMap method
' Receives a texel class value that indicates texel class according to each texel's
' location.
' HRESULT SetGutterMap(
'   BYTE * pGutterData
' );
' ****************************************************************************************
FUNCTION ID3DXTextureGutterHelper_SetGutterMap ALIAS "ID3DXTextureGutterHelper_SetGutterMap" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pGutterData AS DWORD) EXPORT AS LONG

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

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

 

Page last updated on Tuesday, 14 March 2006 23:40:36 +0100