|
|
|
ID3DXPRTBuffer Interface |
|
' ****************************************************************************************
' ID3DXPRTBuffer interface
' $IID_ID3DXPRTBuffer = GUID$("{F1827E47-00A8-49cd-908C-9D11955F8728}")
' ****************************************************************************************
' ****************************************************************************************
' The ID3DXPRTBuffer interface is used as a data buffer to store vertex and pixel data for use
' with precomputed radiance transfer (PRT) methods and functions.
' Remarks
' The ID3DXPRTBuffer interface is obtained by calling the D3DXCreatePRTBuffer or
' D3DXCreatePRTBufferTex functions.
' 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_(ID3DXPRTBuffer, IUnknown)
'{
' // IUnknown
' 0. STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
' 1. STDMETHOD_(ULONG, AddRef)(THIS) PURE;
' 2. STDMETHOD_(ULONG, Release)(THIS) PURE;
' // ID3DXPRTBuffer
' 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;
' // changes the number of samples allocated in the buffer
' 9. STDMETHOD(Resize)(THIS_ UINT NewSize) PURE;
' // ppData will point to the memory location where sample Start begins
' // pointer is valid for at least NumSamples samples
' 10. STDMETHOD(LockBuffer)(THIS_ UINT Start, UINT NumSamples, FLOAT **ppData) PURE;
' 11. STDMETHOD(UnlockBuffer)(THIS) PURE;
' // every scalar in buffer is multiplied by Scale
' 12. STDMETHOD(ScaleBuffer)(THIS_ FLOAT Scale) PURE;
' // every scalar contains the sum of this and pBuffers values
' // pBuffer must have the same storage class/dimensions
' 13. STDMETHOD(AddBuffer)(THIS_ LPD3DXPRTBUFFER pBuffer) PURE;
' // GutterHelper (described below) will fill in the gutter
' // regions of a texture by interpolating "internal" values
' 14. STDMETHOD(AttachGH)(THIS_ LPD3DXTEXTUREGUTTERHELPER) PURE;
' 15. STDMETHOD(ReleaseGH)(THIS) PURE;
' // Evaluates attached gutter helper on the contents of this buffer
' 16. STDMETHOD(EvalGH)(THIS) PURE;
' // extracts a given channel into texture pTexture
' // NumCoefficients starting from StartCoefficient are copied
' 17. STDMETHOD(ExtractTexture)(THIS_ UINT Channel, UINT StartCoefficient,
' UINT NumCoefficients, LPDIRECT3DTEXTURE9 pTexture) PURE;
' // extracts NumCoefficients coefficients into mesh - only applicable on single channel
' // buffers, otherwise just lockbuffer and copy data. With SHPRT data NumCoefficients
' // should be Order^2
' 18. STDMETHOD(ExtractToMesh)(THIS_ UINT NumCoefficients, D3DDECLUSAGE Usage, UINT UsageIndexStart,
' LPD3DXMESH pScene) PURE;
'};
' ****************************************************************************************
' ****************************************************************************************
' GetNumSamples method
' Retrieves the number of vertices (or texels) sampled.
' UINT GetNumSamples();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_GetNumSamples ALIAS "ID3DXPRTBuffer_GetNumSamples" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[3] USING ID3DXPRTBuffer_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 ID3DXPRTBuffer_GetNumCoeffs ALIAS "ID3DXPRTBuffer_GetNumCoeffs" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[4] USING ID3DXPRTBuffer_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 ID3DXPRTBuffer_GetNumChannels ALIAS "ID3DXPRTBuffer_GetNumChannels" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[5] USING ID3DXPRTBuffer_GetNumChannels(pthis) TO DWRESULT
FUNCTION = DWRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' IsTexture method
' Indicates whether the buffer contains a texture.
' BOOL IsTexture();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_IsTexture ALIAS "ID3DXPRTBuffer_IsTexture" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG
LOCAL LRESULT AS LONG
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[6] USING ID3DXPRTBuffer_IsTexture(pthis) TO LRESULT
FUNCTION = LRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetWidth method
' Retrieves the width of the texture, in pixels.
' UINT GetWidth();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_GetWidth ALIAS "ID3DXPRTBuffer_GetWidth" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[7] USING ID3DXPRTBuffer_GetWidth(pthis) TO DWRESULT
FUNCTION = DWRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' GetHeight method
' Retrieves the height of the texture, in pixels.
' UINT GetHeight();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_GetHeight ALIAS "ID3DXPRTBuffer_GetHeight" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD
LOCAL DWRESULT AS DWORD
IF pthis = %NULL THEN EXIT FUNCTION
CALL DWORD @@pthis[8] USING ID3DXPRTBuffer_GetHeight(pthis) TO DWRESULT
FUNCTION = DWRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' Resize method
' Changes the number of samples contained in the buffer.
' HRESULT Resize(
' UINT NewSize
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_Resize ALIAS "ID3DXPRTBuffer_Resize" ( _
BYVAL pthis AS DWORD PTR, BYVAL NewSize AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[9] USING ID3DXPRTBuffer_Resize(pthis, NewSize) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' LockBuffer method
' Locks a range of vertex or texel sample data and obtains a pointer to the location in
' buffer memory.
' HRESULT LockBuffer(
' UINT Start,
' UINT NumSamples.xml,
' FLOAT ** ppData
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_LockBuffer ALIAS "ID3DXPRTBuffer_LockBuffer" ( _
BYVAL pthis AS DWORD PTR, BYVAL Start AS DWORD, BYREF ppData AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[10] USING ID3DXPRTBuffer_LockBuffer(pthis, Start, ppData) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' UnlockBuffer method
' Ends the lifespan of the ppData pointer returned by ID3DXPRTBuffer::LockBuffer.
' HRESULT UnlockBuffer();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_UnlockBuffer ALIAS "ID3DXPRTBuffer_UnlockBuffer" (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 ID3DXPRTBuffer_UnlockBuffer(pthis) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ScaleBuffer method
' Multiplies every value in the buffer by a constant value.
' HRESULT ScaleBuffer(
' FLOAT Scale
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_ScaleBuffer ALIAS "ID3DXPRTBuffer_ScaleBuffer" ( _
BYVAL pthis AS DWORD PTR, BYVAL SCALE AS SINGLE) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[12] USING ID3DXPRTBuffer_ScaleBuffer(pthis, SCALE) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' AddBuffer method
' Adds another buffer to the ID3DXPRTBuffer and stores the results in ID3DXPRTBuffer.
' HRESULT AddBuffer(
' LPD3DXPRTBUFFER pBuffer
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_AddBuffer ALIAS "ID3DXPRTBuffer_AddBuffer" ( _
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[13] USING ID3DXPRTBuffer_AddBuffer(pthis, pBuffer) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' AttachGH method
' Associates an ID3DXTextureGutterHelper object with the ID3DXPRTBuffer object.
' HRESULT AttachGH(
' LPD3DXTEXTUREGUTTERHELPER pGH
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_AttachGH ALIAS "ID3DXPRTBuffer_AttachGH" ( _
BYVAL pthis AS DWORD PTR, BYVAL pGH AS DWORD) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[14] USING ID3DXPRTBuffer_AttachGH(pthis, pGH) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ReleaseGH method
' Unassociates an attached ID3DXTextureGutterHelper object with the ID3DXPRTBuffer object.
' HRESULT ReleaseGH();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_ReleaseGH ALIAS "ID3DXPRTBuffer_ReleaseGH" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[15] USING ID3DXPRTBuffer_ReleaseGH(pthis) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' EvalGH method
' Applies stored texture gutter data to an ID3DXPRTBuffer texture buffer.
' HRESULT EvalGH();
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_EvalGH ALIAS "ID3DXPRTBuffer_EvalGH" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG
LOCAL HRESULT AS LONG
IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
CALL DWORD @@pthis[16] USING ID3DXPRTBuffer_EvalGH(pthis) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ExtractTexture method
' Extracts coefficient data from a color channel of the buffer for a specified range of
' coefficients, and adds the data to an IDirect3DTexture9 object.
' HRESULT ExtractTexture(
' UINT Channel,
' UINT StartCoefficient,
' UINT NumCoefficients,
' LPDIRECT3DTEXTURE9 pTexture
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_ExtractTexture ALIAS "ID3DXPRTBuffer_ExtractTexture" ( _
BYVAL pthis AS DWORD PTR, BYVAL Channel AS DWORD, BYVAL StartCoefficient AS DWORD, _
BYVAL NumCoefficients 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[17] USING ID3DXPRTBuffer_ExtractTexture(pthis, Channel, StartCoefficient, NumCoefficients, pTexture) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' ExtracttoMesh method
' Extracts coefficient data from a single-channel buffer and adds the data to an
' ID3DXMesh object.
' HRESULT ExtractToMesh(
' UINT NumCoefficients,
' D3DDECLUSAGE Usage,
' UINT UsageIndexStart,
' LPD3DXMESH pScene
' );
' ****************************************************************************************
FUNCTION ID3DXPRTBuffer_ExtractToMesh ALIAS "ID3DXPRTBuffer_ExtractToMesh" ( _
BYVAL pthis AS DWORD PTR, BYVAL NumCoefficients AS DWORD, BYREF 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[18] USING ID3DXPRTBuffer_ExtractToMesh(pthis, NumCoefficients, Usage, UsageIndexStart, pScene) TO HRESULT
FUNCTION = HRESULT
END FUNCTION
' ****************************************************************************************
|
Page last updated on Tuesday, 14 March 2006 23:34:06 +0100