|
|
|
ID3DXEffectStateManager Interface |
|
' ****************************************************************************************
' ID3DXEffectStateManager
' $IID_ID3DXEffectStateManager = GUID$("{79AAB587-6DBC-4fa7-82DE-37FA1781C5CE}")
' ****************************************************************************************
' ****************************************************************************************
' This is a user-implemented interface that allows a user to set the device state from an
' effect. Each of the methods in this interface must be implemented by the user and will
' then be used as callbacks to the application when either of the following occur:
'
' * An effect calls ID3DXEffect::BeginPass.
' * Effect state is dynamically updated by calling the appropriate state change
' application programming interface (API). See individual method pages for details.
'
' When an application uses the state manager to implement custom callbacks, an effect no
' longer automatically saves and restores state when calling ID3DXEffect::BeginPass and
' ID3DXEffect::EndPass.
' Because the application has implemented a custom save and restore behavior in the
' callbacks, this automatic behavior is bypassed.
'
' ID3DXEffectStateManager Members
'
' LightEnable A callback function that must be implemented by a user to enable/disable a light.
' SetFVF A callback function that must be implemented by a user to set a flexible vertex format (FVF) code.
' SetLight A callback function that must be implemented by a user to set a light.
' SetMaterial A callback function that must be implemented by a user to set material state.
' SetNPatchMode A callback function that must be implemented by a user to set the number of subdivision segments for N-patches.
' SetPixelShader A callback function that must be implemented by a user to set a pixel shader.
' SetPixelShaderConstantB A callback function that must be implemented by a user to set an array of vertex shader Boolean constants.
' SetPixelShaderConstantF A callback function that must be implemented by a user to set an array of vertex shader floating-point constants.
' SetPixelShaderConstantI A callback function that must be implemented by a user to set an array of vertex shader integer constants.
' SetRenderState A callback function that must be implemented by a user to set render state.
' SetSamplerState A callback function that must be implemented by a user to set a sampler.
' SetTexture A callback function that must be implemented by a user to set a texture.
' SetTextureStageState A callback function that must be implemented by a user to set the texture stage state.
' SetTransform A callback function that must be implemented by a user to set a transform.
' SetVertexShader A callback function that must be implemented by a user to set a vertex shader.
' SetVertexShaderConstantB A callback function that must be implemented by a user to set an array of vertex shader Boolean constants.
' SetVertexShaderConstantF A callback function that must be implemented by a user to set an array of vertex shader floating-point constants.
' SetVertexShaderConstantI A callback function that must be implemented by a user to set an array of vertex shader integer constants.
'
' Remarks
'
' A user creates an ID3DXEffectStateManager interface by implementing a class that
' derives from this interface, and implementing all the interface methods. Once the
' interface is created, you can get or set the state manager within an effect using
' ID3DXEffect::GetStateManager and ID3DXEffect::SetStateManager.
'
' Interface Information
'
' Stock Implementation d3d9.dll
' Custom Implementation No
' Inherits from IUnknown
' Header d3dx9effect.h
' Import library d3dx9.lib
' Minimum operating systems Windows 98
' ****************************************************************************************
' ****************************************************************************************
' IUnknown virtual table
' ****************************************************************************************
TYPE ID3DXEffectStateManager_IUnknownVtbl
' IUnknown interface
QueryInterface AS DWORD ' Returns pointers to supported interfaces
AddRef AS DWORD ' Increments reference count
Release AS DWORD ' Decrements reference count
' ID3DXInclude interface
' The following methods are called by the Effect when it wants to make
' the corresponding device call. Note that:
' 1. Users manage the state and are therefore responsible for making the
' the corresponding device calls themselves inside their callbacks.
' 2. Effects pay attention to the return values of the callbacks, and so
' users must pay attention to what they return in their callbacks.
SetTransform AS DWORD
SetMaterial AS DWORD
SetLight AS DWORD
LightEnable AS DWORD
SetRenderState AS DWORD
SetTexture AS DWORD
SetTextureStageState AS DWORD
SetSamplerState AS DWORD
SetNPatchMode AS DWORD
SetFVF AS DWORD
SetVertexShader AS DWORD
SetVertexShaderConstantF AS DWORD
SetVertexShaderConstantI AS DWORD
SetVertexShaderConstantB AS DWORD
SetPixelShader AS DWORD
SetPixelShaderConstantF AS DWORD
SetPixelShaderConstantI AS DWORD
SetPixelShaderConstantB AS DWORD
' Custom data
pVtblAddr AS DWORD ' Address of the virtual table
cRef AS DWORD ' Reference counter
pthis AS DWORD ' IUnknown of the control that fires the events
END TYPE
' ****************************************************************************************
' ****************************************************************************************
' Builds the IUnknown Virtual Table
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
LOCAL pVtbl AS ID3DXEffectStateManager_IUnknownVtbl PTR
LOCAL pUnk AS ID3DXEffectStateManager_IUnknownVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVTbl.QueryInterface = CODEPTR(ID3DXEffectStateManager_QueryInterface)
@pVTbl.AddRef = CODEPTR(ID3DXEffectStateManager_AddRef)
@pVTbl.Release = CODEPTR(ID3DXEffectStateManager_Release)
@pVTbl.SetTransform = CODEPTR(ID3DXEffectStateManager_SetTransform)
@pVTbl.SetMaterial = CODEPTR(ID3DXEffectStateManager_SetMaterial)
@pVTbl.SetLight = CODEPTR(ID3DXEffectStateManager_SetLight)
@pVTbl.LightEnable = CODEPTR(ID3DXEffectStateManager_LightEnable)
@pVTbl.SetRenderState = CODEPTR(ID3DXEffectStateManager_SetRenderState)
@pVTbl.SetTexture = CODEPTR(ID3DXEffectStateManager_SetTexture)
@pVTbl.SetTextureStageState = CODEPTR(ID3DXEffectStateManager_SetTextureStageState)
@pVTbl.SetSamplerState = CODEPTR(ID3DXEffectStateManager_SetSamplerState)
@pVTbl.SetNPatchMode = CODEPTR(ID3DXEffectStateManager_SetNPatchMode)
@pVTbl.SetFVF = CODEPTR(ID3DXEffectStateManager_SetFVF)
@pVTbl.SetVertexShader = CODEPTR(ID3DXEffectStateManager_SetVertexShader)
@pVTbl.SetVertexShaderConstantF = CODEPTR(ID3DXEffectStateManager_SetVertexShaderConstantF)
@pVTbl.SetVertexShaderConstantI = CODEPTR(ID3DXEffectStateManager_SetVertexShaderConstantI)
@pVTbl.SetVertexShaderConstantB = CODEPTR(ID3DXEffectStateManager_SetVertexShaderConstantB)
@pVTbl.SetPixelShader = CODEPTR(ID3DXEffectStateManager_SetPixelShader)
@pVTbl.SetPixelShaderConstantF = CODEPTR(ID3DXEffectStateManager_SetPixelShaderConstantF)
@pVTbl.SetPixelShaderConstantI = CODEPTR(ID3DXEffectStateManager_SetPixelShaderConstantI)
@pVTbl.SetPixelShaderConstantB = CODEPTR(ID3DXEffectStateManager_SetPixelShaderConstantB)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.pthis = pthis
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' UI4 AddRef()
' Increments the reference counter.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_AddRef (BYVAL pthis AS ID3DXEffectStateManager_IUnknownVtbl PTR) AS DWORD
INCR @@pthis.cRef
FUNCTION = @@pthis.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_QueryInterface (BYVAL pthis AS ID3DXEffectStateManager_IUnknownVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS DWORD
ppvObj = pthis
ID3DXEffectStateManager_AddRef pthis
FUNCTION = %D3D_OK
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' UI4 Release()
' Releases our class if there is only a reference to him and decrements the reference
' counter.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_Release (BYVAL pthis AS ID3DXEffectStateManager_IUnknownVtbl PTR) AS DWORD
LOCAL pVtblAddr AS DWORD
IF @@pCookie.cRef = 1 THEN
pVtblAddr = @@pCookie.pVtblAddr
IF ISTRUE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
FUNCTION = 0
EXIT FUNCTION
ELSE
FUNCTION = @@pCookie.cRef
EXIT FUNCTION
END IF
END IF
DECR @@pCookie.cRef
FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetTransform method
' A callback function that must be implemented by a user to set a transform.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetTransform ( _
BYVAL pthis AS DWORD PTR, _
BYVAL dwState AS DWORD, _
BYREF pMatrix AS D3DMATRIX _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetMaterial method
' A callback function that must be implemented by a user to set material state.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetMaterial ( _
BYVAL pthis AS DWORD PTR, _
BYREF pMaterial AS D3DMATERIAL9 _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetLight method
' A callback function that must be implemented by a user to set a light.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetLight ( _
BYVAL pthis AS DWORD PTR, _
BYREF pLight AS D3DLIGHT9 _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' LightEnable method
' A callback function that must be implemented by a user to enable/disable a light.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_LightEnable ( _
BYVAL pthis AS DWORD PTR, _
BYVAL Index AS DWORD, _
BYVAL fEnable AS LONG _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetRenderState method
' A callback function that must be implemented by a user to set render state.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetRenderState ( _
BYVAL pthis AS DWORD PTR, _
BYVAL dwState AS DWORD, _
BYVAL Value AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetTexture method
' A callback function that must be implemented by a user to set a texture.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetTexture ( _
BYVAL pthis AS DWORD PTR, _
BYVAL Stage AS DWORD, _
BYVAL pTexture AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetTextureStageState method
' A callback function that must be implemented by a user to set the texture stage state.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetTextureStageState ( _
BYVAL pthis AS DWORD PTR, _
BYVAL Stage AS DWORD, _
BYVAL dwType AS DWORD, _
BYVAL Value AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetSamplerState method
' A callback function that must be implemented by a user to set a sampler.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetSamplerState ( _
BYVAL pthis AS DWORD PTR, _
BYVAL Sampler AS DWORD, _
BYVAL dwType AS DWORD, _
BYVAL Value AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetNPatchMode method
' A callback function that must be implemented by a user to set the number of subdivision
' segments for N-patches.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetNPatchMode ( _
BYVAL pthis AS DWORD PTR, _
BYVAL nSegments AS SINGLE _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetFVF method
' A callback function that must be implemented by a user to set a flexible vertex format
' (FVF) code.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetFVF ( _
BYVAL pthis AS DWORD PTR, _
BYVAL FVF AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetVertexShader method
' A callback function that must be implemented by a user to set a vertex shader.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetVertexShader ( _
BYVAL pthis AS DWORD PTR, _
BYVAL pShader AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetVertexShaderConstantF method
' A callback function that must be implemented by a user to set an array of vertex shader
' floating-point constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetVertexShaderConstantF ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetVertexShaderConstantI method
' A callback function that must be implemented by a user to set an array of vertex shader
' integer constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetVertexShaderConstantI ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetVertexShaderConstantB method
' A callback function that must be implemented by a user to set an array of vertex shader
' Boolean constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetVertexShaderConstantB ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetPixelShader method
' A callback function that must be implemented by a user to set a pixel shader.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetPixelShader ( _
BYVAL pthis AS DWORD PTR, _
BYVAL pShader AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetPixelShaderConstantF method
' A callback function that must be implemented by a user to set an array of vertex shader
' floating-point constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetPixelShaderConstantF ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetPixelShaderConstantI method
' A callback function that must be implemented by a user to set an array of vertex shader
' integer constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetPixelShaderConstantI ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' SetPixelShaderConstantB method
' A callback function that must be implemented by a user to set an array of vertex shader
' Boolean constants.
' ****************************************************************************************
FUNCTION ID3DXEffectStateManager_SetPixelShaderConstantB ( _
BYVAL pthis AS DWORD PTR, _
BYREF StartRegister AS DWORD, _
BYREF pConstantData AS DWORD, _
BYREF RegisterCount AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
|
Page last updated on Wednesday, 15 March 2006 02:15:18 +0100