ID3DXBaseMesh Interface

 

 

' ****************************************************************************************
' ID3DXBaseMesh interface
' $IID_ID3DXBaseMesh = GUID$("{7ED943DD-52E8-40b5-A8D8-76685C406330}")
' ****************************************************************************************

' ****************************************************************************************
' Applications use the methods of the ID3DXBaseMesh interface to manipulate and query mesh and
' progressive mesh objects.
' Remarks
'    A mesh is an object made up of a set of polygonal faces. A mesh defines a set of vertices
'    and a set of faces (the faces are defined in terms of the vertices and normals of the mesh).
' 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_(ID3DXBaseMesh, IUnknown)
'{
'    // IUnknown
'  0.  STDMETHOD(QueryInterface)(THIS_ REFIID iid, LPVOID *ppv) PURE;
'  1.  STDMETHOD_(ULONG, AddRef)(THIS) PURE;
'  2.  STDMETHOD_(ULONG, Release)(THIS) PURE;

'    // ID3DXBaseMesh
'  3.  STDMETHOD(DrawSubset)(THIS_ DWORD AttribId) PURE;
'  4.  STDMETHOD_(DWORD, GetNumFaces)(THIS) PURE;
'  5.  STDMETHOD_(DWORD, GetNumVertices)(THIS) PURE;
'  6.  STDMETHOD_(DWORD, GetFVF)(THIS) PURE;
'  7.  STDMETHOD(GetDeclaration)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
'  8.  STDMETHOD_(DWORD, GetNumBytesPerVertex)(THIS) PURE;
'  9.  STDMETHOD_(DWORD, GetOptions)(THIS) PURE;
' 10.  STDMETHOD(GetDevice)(THIS_ LPDIRECT3DDEVICE9* ppDevice) PURE;
' 11.  STDMETHOD(CloneMeshFVF)(THIS_ DWORD Options,
'                DWORD FVF, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
' 12.  STDMETHOD(CloneMesh)(THIS_ DWORD Options,
'                CONST D3DVERTEXELEMENT9 *pDeclaration, LPDIRECT3DDEVICE9 pD3DDevice, LPD3DXMESH* ppCloneMesh) PURE;
' 13.  STDMETHOD(GetVertexBuffer)(THIS_ LPDIRECT3DVERTEXBUFFER9* ppVB) PURE;
' 14.  STDMETHOD(GetIndexBuffer)(THIS_ LPDIRECT3DINDEXBUFFER9* ppIB) PURE;
' 15.  STDMETHOD(LockVertexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
' 16.  STDMETHOD(UnlockVertexBuffer)(THIS) PURE;
' 17.  STDMETHOD(LockIndexBuffer)(THIS_ DWORD Flags, LPVOID *ppData) PURE;
' 18.  STDMETHOD(UnlockIndexBuffer)(THIS) PURE;
' 19.  STDMETHOD(GetAttributeTable)(
'                THIS_ D3DXATTRIBUTERANGE *pAttribTable, DWORD* pAttribTableSize) PURE;

' 20.  STDMETHOD(ConvertPointRepsToAdjacency)(THIS_ CONST DWORD* pPRep, DWORD* pAdjacency) PURE;
' 21.  STDMETHOD(ConvertAdjacencyToPointReps)(THIS_ CONST DWORD* pAdjacency, DWORD* pPRep) PURE;
' 22.  STDMETHOD(GenerateAdjacency)(THIS_ FLOAT Epsilon, DWORD* pAdjacency) PURE;

' 23.  STDMETHOD(UpdateSemantics)(THIS_ D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]) PURE;
'};
' ****************************************************************************************

' ****************************************************************************************
' DrawSubset method
' Draws a subset of a mesh.
' HRESULT DrawSubset(
'   DWORD AttribId
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_DrawSubset ALIAS "ID3DXBaseMesh_DrawSubset" ( _
    BYVAL pthis AS DWORD PTR, BYVAL AttribId AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetNumFaces method
' Retrieves the number of faces in the mesh.
' DWORD GetNumFaces();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetNumFaces ALIAS "ID3DXBaseMesh_GetNumFaces" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

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

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

' ****************************************************************************************
' GetNumVertices method
' Retrieves the number of vertices in the mesh.
' DWORD GetNumVertices();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetNumVertices ALIAS "ID3DXBaseMesh_GetNumVertices" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

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

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

' ****************************************************************************************
' GetFVF method
' Retrieves the flexible vertex format of the vertices in the mesh.
' DWORD GetFVF();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetFVF ALIAS "ID3DXBaseMesh_GetFVF" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

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

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

' ****************************************************************************************
' GetDeclaration method
' Retrieves a declaration describing the vertices in the mesh.
' HRESULT GetDeclaration(
'   D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetDeclaration ALIAS "ID3DXBaseMesh_GetDeclaration" ( _
    BYVAL pthis AS DWORD PTR, BYREF pDeclaration AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetNumBytesPerVertex method
' Gets the number of bytes per vertex.
' DWORD GetNumBytesPerVertex();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetNumBytesPerVertex ALIAS "ID3DXBaseMesh_GetNumBytesPerVertex" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

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

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

' ****************************************************************************************
' GetOptions method
' Retrieves the mesh options enabled for this mesh at creation time.
' DWORD GetOptions();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetOptions ALIAS "ID3DXBaseMesh_GetOptions" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

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

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

' ****************************************************************************************
' GetDevice method
' Retrieves the device associated with the mesh.
' Remarks
' Calling this method will increase the internal reference count on the IDirect3DDevice9
' interface. Be sure to call IUnknown::Release when you are done using this IDirect3DDevice9
' interface or you will have a memory leak.
' HRESULT GetDevice(
'   LPDIRECT3DDEVICE9 * ppDevice
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetDevice ALIAS "ID3DXBaseMesh_GetDevice" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppDevice AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' CloneMeshFVF method
' Clones a mesh using a flexible vertex format (FVF) code.
' HRESULT CloneMeshFVF(
'   DWORD Options,
'   DWORD FVF,
'   LPDIRECT3DDEVICE9 pDevice,
'   LPD3DXMESH * ppCloneMesh
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_CloneMeshFVF ALIAS "ID3DXBaseMesh_CloneMeshFVF" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Options AS DWORD, BYVAL FVF AS DWORD, _
    BYVAL pDevice AS DWORD, BYREF ppCloneMesh AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[11] USING ID3DXBaseMesh_CloneMeshFVF(pthis, Options, FVF, pDevice, ppCloneMesh) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' CloneMesh method
' Clones a mesh using a declarator.
' HRESULT CloneMesh(
'   DWORD Options,
'   CONST D3DVERTEXELEMENT9 * pDeclaration,
'   LPDIRECT3DDEVICE9 pDevice,
'   LPD3DXMESH * ppCloneMesh
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_CloneMesh ALIAS "ID3DXBaseMesh_CloneMesh" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Options AS DWORD, BYVAL pDeclaration AS DWORD, _
    BYVAL pDevice AS DWORD, BYREF ppCloneMesh AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[12] USING ID3DXBaseMesh_CloneMesh(pthis, Options, pDeclaration, pDevice, ppCloneMesh) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' GetVertexBuffer method
' Retrieves the data in a vertex buffer.
' HRESULT GetVertexBuffer(
'   LPDIRECT3DVERTEXBUFFER9 * ppVB
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetVertexBuffer ALIAS "ID3DXBaseMesh_GetVertexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppVB AS DWORD ) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetIndexBuffer method
' Retrieves the data in an index buffer.
' HRESULT GetIndexBuffer(
'   LPDIRECT3DINDEXBUFFER9 * ppIB
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetIndexBuffer ALIAS "ID3DXBaseMesh_GetIndexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppIB AS DWORD) EXPORT AS LONG

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

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

' ****************************************************************************************
' LockVertexBuffer method
' Locks a vertex buffer and obtains a pointer to the vertex buffer memory.
' HRESULT LockVertexBuffer(
'   DWORD Flags,
'   LPVOID * ppData
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_LockVertexBuffer ALIAS "ID3DXBaseMesh_LockVertexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Flags 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[15] USING ID3DXBaseMesh_LockVertexBuffer(pthis, Flags, ppData) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' UnlockVertexBuffer method
' Unlocks a vertex buffer.
' HRESULT UnlockVertexBuffer();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_UnlockVertexBuffer ALIAS "ID3DXBaseMesh_UnlockVertexBuffer" (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 ID3DXBaseMesh_UnlockVertexBuffer(pthis) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' LockIndexBuffer method
' Locks an index buffer and obtains a pointer to the index buffer memory.
' HRESULT LockIndexBuffer(
'   DWORD Flags,
'   LPVOID * ppData
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_LockIndexBuffer ALIAS "ID3DXBaseMesh_LockIndexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Flags 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[17] USING ID3DXBaseMesh_LockIndexBuffer(pthis, Flags, ppData) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' UnlockIndexBuffer method
' Unlocks an index buffer.
' HRESULT UnlockIndexBuffer();
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_UnlockIndexBuffer ALIAS "ID3DXBaseMesh_UnlockIndexBuffer" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

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

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

' ****************************************************************************************
' GetAttributeTable method
' Retrieves either an attribute table for a mesh, or the number of entries stored in an
' attribute table for a mesh.
' HRESULT GetAttributeTable(
'   D3DXATTRIBUTERANGE * pAttribTable,
'   DWORD * pAttribTableSize
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GetAttributeTable ALIAS "ID3DXBaseMesh_GetAttributeTable" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pAttribEntry AS DWORD, BYREF pAttribTabSize AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[19] USING ID3DXBaseMesh_GetAttributeTable(pthis, pAttribEntry, pAttribTabSize) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' ConvertPointRepsToAdjacency method
' Converts point representative data to mesh adjacency information.
' HRESULT ConvertPointRepsToAdjacency(
'   CONST DWORD* pPRep,
'   DWORD* pAdjacency
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_ConvertPointRepsToAdjacency ALIAS "ID3DXBaseMesh_ConvertPointRepsToAdjacency" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pPRep AS DWORD, BYREF pAdjacency AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[20] USING ID3DXBaseMesh_ConvertPointRepsToAdjacency(pthis, pPRep, pAdjacency) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' ConvertAdjacencyToPointReps method
' Converts mesh adjacency information to an array of point representatives.
' HRESULT ConvertAdjacencyToPointReps(
'   CONST DWORD* pAdjacency,
'   DWORD* pPRep
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_ConvertAdjacencyToPointReps ALIAS "ID3DXBaseMesh_ConvertAdjacencyToPointReps" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pAdjacency AS DWORD, BYREF pPRep AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[21] USING ID3DXBaseMesh_ConvertAdjacencyToPointReps(pthis, pAdjacency, pPRep) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' GenerateAdjacency method
' Generates adjacency information based on mesh indices.
' HRESULT GenerateAdjacency(
'   FLOAT Epsilon,
'   DWORD * pAdjacency
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_GenerateAdjacency ALIAS "ID3DXBaseMesh_GenerateAdjacency" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Epsilon AS SINGLE, BYVAL pAdjacency AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[22] USING ID3DXBaseMesh_GenerateAdjacency(pthis, Epsilon, pAdjacency) TO HRESULT
    FUNCTION = HRESULT

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

' ****************************************************************************************
' UpdateSemantics method
' This method allows the user to change the mesh declaration without changing the data
' layout of the vertex buffer. The call is valid only if the old and new declaration
' formats have the same vertex size.
' HRESULT UpdateSemantics(
'   D3DVERTEXELEMENT9 Declaration[MAX_FVF_DECL_SIZE]
' );
' ****************************************************************************************
FUNCTION ID3DXBaseMesh_UpdateSemantics ALIAS "ID3DXBaseMesh_UpdateSemantics" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pDeclaration AS DWORD) EXPORT AS LONG

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

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

 

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