?/TD>
Microsoft DirectX 9.0

ID3DXPMesh::CloneMesh Method


Clones a mesh using a declarator.

Syntax

HRESULT CloneMesh(      

    DWORD Options,     CONST LPD3DVERTEXELEMENT9 pDeclaration,     LPDIRECT3DDEVICE9 pDevice,     LPD3DXMESH *ppCloneMesh );

Parameters

Options
[in] A combination of one or more D3DXMESH flags specifying creation options for the mesh.
pDeclaration
[in] An array of D3DVERTEXELEMENT9 elements, which specify the vertex format for the vertices in the output mesh.
pDevice
[in] Pointer to an IDirect3DDevice9 interface, representing the device object associated with the mesh.
ppCloneMesh
[out, retval] Address of a pointer to an ID3DXMesh interface, representing the cloned mesh.

Return Value

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be one of the following values.

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
E_OUTOFMEMORYMicrosoft?Direct3D?could not allocate sufficient memory to complete the call.


Remarks

ID3DXBaseMesh::CloneMesh is used to reformat and change the vertex data layout. This is done by creating a new mesh object. For example, use it to to add space for normals, texture coordinates, colors, weights, etc. that were not present before.

ID3DXBaseMesh::UpdateSemantics updates the vertex declaration with different semantic information without changing the layout of the vertex buffer. This method does not modify the contents of the vertex buffer. For example, use it to relabel a 3-D texture coordinate as a binormal or tangent or vice versa.

See Also

ID3DXBaseMesh::CloneMeshFVF, ID3DXBaseMesh::GetDeclaration, ID3DXMesh::GetDeclaration, ID3DXPMesh::GetDeclaration, D3DXDeclaratorFromFVF


© 2002 Microsoft Corporation. All rights reserved.