|
|
|
ID3DXAllocateHierarchy Interface |
|
' ****************************************************************************************
' ID3DXAllocateHierarchy Interface
' ****************************************************************************************
' ****************************************************************************************
' This interface is implemented by the application to allocate or free frame and mesh
' container objects. Methods on this are called during loading and destroying frame
' hierarchies.
' Interface Information
' Stock Implementation d3d9.dll
' Custom Implementation No
' Inherits from IUnknown
' Header d3dx9anim.h
' Import library d3dx9.lib
' Minimum operating systems Windows 98
' ****************************************************************************************
' ****************************************************************************************
'DECLARE_INTERFACE(ID3DXAllocateHierarchy)
'{
' STDMETHOD(CreateFrame)(THIS_ LPCSTR Name,
' LPD3DXFRAME *ppNewFrame) PURE;
' STDMETHOD(CreateMeshContainer)(THIS_
' LPCSTR Name,
' CONST D3DXMESHDATA *pMeshData,
' CONST D3DXMATERIAL *pMaterials,
' CONST D3DXEFFECTINSTANCE *pEffectInstances,
' DWORD NumMaterials,
' CONST DWORD *pAdjacency,
' LPD3DXSKININFO pSkinInfo,
' LPD3DXMESHCONTAINER *ppNewMeshContainer) PURE;
' STDMETHOD(DestroyFrame)(THIS_ LPD3DXFRAME pFrameToFree) PURE;
' STDMETHOD(DestroyMeshContainer)(THIS_ LPD3DXMESHCONTAINER pMeshContainerToFree) PURE;
'};
' ****************************************************************************************
' ****************************************************************************************
' IUnknown virtual table
' ****************************************************************************************
TYPE ID3DXAllocateHierarchy_IUnknownVtbl
' IUnknown interface
QueryInterface AS DWORD ' Returns pointers to supported interfaces
AddRef AS DWORD ' Increments reference count
Release AS DWORD ' Decrements reference count
' ID3DXAllocateHierarchy interface
CreateFrame AS DWORD ' CreateFrame method
CreateMeshContainer AS DWORD ' CreateMeshContainer method
DestroyFrame AS DWORD ' DestroyFrame method
DestroyMeshContainer AS DWORD ' DestroyMeshContainer method
' 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 ID3DXAllocateHierarchy_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
LOCAL pVtbl AS ID3DXAllocateHierarchy_IUnknownVtbl PTR
LOCAL pUnk AS ID3DXAllocateHierarchy_IUnknownVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVTbl.QueryInterface = CODEPTR(ID3DXAllocateHierarchy_QueryInterface)
@pVTbl.AddRef = CODEPTR(ID3DXAllocateHierarchy_AddRef)
@pVTbl.Release = CODEPTR(ID3DXAllocateHierarchy_Release)
@pVTbl.CreateFrame = CODEPTR(ID3DXAllocateHierarchy_CreateFrame)
@pVTbl.CreateMeshContainer = CODEPTR(ID3DXAllocateHierarchy_CreateMeshContainer)
@pVTbl.DestroyFrame = CODEPTR(ID3DXAllocateHierarchy_DestroyFrame)
@pVTbl.DestroyMeshContainer = CODEPTR(ID3DXAllocateHierarchy_DestroyMeshContainer)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.pthis = pthis
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' UI4 AddRef()
' Increments the reference counter.
' ****************************************************************************************
FUNCTION ID3DXAllocateHierarchy_AddRef (BYVAL pthis AS ID3DXAllocateHierarchy_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 ID3DXAllocateHierarchy_QueryInterface (BYVAL pthis AS ID3DXAllocateHierarchy_IUnknownVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS DWORD
ppvObj = pthis
ID3DXAllocateHierarchy_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 ID3DXAllocateHierarchy_Release (BYVAL pthis AS ID3DXAllocateHierarchy_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
' ****************************************************************************************
' ****************************************************************************************
' CreateFrame Method
' Requests allocation of a frame object.
' Parameters
' Name
' [in] Name of the frame to be created.
' ppNewFrame
' [out, retval] Returns the created frame object.
' Return Value
' The return values of this method are implemented by an application programmer. In
' general, if no error occurs, program the method to return D3D_OK. Otherwise, program
' the method to return an appropriate error message from D3DERR or D3DXERR, as this
' will cause D3DXLoadMeshHierarchyFromX to fail also, and return the error.
' ****************************************************************************************
FUNCTION ID3DXAllocateHierarchy_CreateFrame ( _
BYVAL pthis AS DWORD PTR, _
BYVAL pName AS DWORD, _
BYREF ppNewFrame AS DWORD _
) AS DWORD
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' CreateMeshCobtainer method
' Requests allocation of a mesh container object.
' Parameters
' Name
' [in] Name of the mesh.
' pMeshData
' [in] Pointer to the mesh data structure. See D3DXMESHDATA.
' pMaterials
' [in] Array of materials used in the mesh.
' pEffectInstances
' [in] Array of effect instances used in the mesh. See D3DXEFFECTINSTANCE.
' NumMaterials
' [in] Number of materials in the materials array.
' pAdjacency
' [in] Adjacency array for the mesh.
' pSkinInfo
' [in] Pointer to the skin mesh object if skin data is found. See ID3DXSkinInfo.
' ppNewMeshContainer
' [out, retval] Returns the created mesh container. See D3DXMESHCONTAINER.
' Return Value
' The return values of this method are implemented by an application programmer. In
' general, if no error occurs, program the method to return D3D_OK. Otherwise, program
' the method to return an appropriate error message from D3DERR or D3DXERR, as this
' will cause D3DXLoadMeshHierarchyFromX to fail also, and return the error.
' ****************************************************************************************
FUNCTION ID3DXAllocateHierarchy_CreateMeshContainer ( _
BYVAL pthis AS DWORD PTR, _
BYREF pName AS DWORD, _
BYREF pMeshData AS D3DXMESHDATA, _
BYVAL pMaterials AS DWORD, _
BYVAL pEffectInstances AS DWORD, _
BYVAL NumMaterials AS DWORD, _
BYVAL pAdjacency AS DWORD, _
BYVAL pSkinInfo AS DWORD, _
BYREF ppNewMeshContainer AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' DestroyFrame method
' Requests deallocation of a frame object.
' Parameters
' pFrameToFree
' [in] Pointer to the frame to be deallocated.
' Return Value
' The return values of this method are implemented by an application programmer. In
' general, if no error occurs, program the method to return D3D_OK. Otherwise, program
' the method to return an appropriate error message from D3DERR or D3DXERR, as this
' will cause D3DXLoadMeshHierarchyFromX to fail also, and return the error.
' ****************************************************************************************
FUNCTION ID3DXAllocateHierarchy_DestroyFrame ( _
BYVAL pthis AS DWORD PTR, _
BYVAL pFrameToFree AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
' ****************************************************************************************
' DestroyMeshContainer method
' Requests deallocation of a mesh container object.
' Parameters
' pMeshContainerToFree
' [in] Pointer to the mesh container object to be deallocated.
' Return Value
' The return values of this method are implemented by an application programmer. In
' general, if no error occurs, program the method to return D3D_OK. Otherwise, program
' the method to return an appropriate error message from D3DERR or D3DXERR, as this
' will cause D3DXLoadMeshHierarchyFromX to fail also, and return the error.
' ****************************************************************************************
FUNCTION ID3DXAllocateHierarchy_DestroyMeshContainer ( _
BYVAL pthis AS DWORD PTR, _
BYVAL pMeshContainerToFree AS DWORD _
) AS LONG
' *** Put your code here ***
END FUNCTION
' ****************************************************************************************
|
Page last updated on Wednesday, 15 March 2006 02:07:30 +0100