D3DXSplitMesh

Splits a mesh into meshes smaller than the specified size.

void D3DXSplitMesh(
  LPD3DXMESH pMeshIn,
  CONST DWORD * pAdjacencyIn,
  CONST DWORD MaxSize,
  CONST DWORD Options,
  DWORD * pMeshesOut,
  LPD3DXBUFFER * ppMeshArrayOut,
  LPD3DXBUFFER * ppAdjacencyArrayOut,
  LPD3DXBUFFER * ppFaceRemapArrayOut,
  LPD3DXBUFFER * ppVertRemapArrayOut
);

Parameters

pMeshIn
[in] Pointer to an ID3DXMesh interface, representing the source mesh.
pAdjacencyIn
[in] Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the mesh to be simplified.
MaxSize
[in] Maximum number of vertices in the resulting mesh.
Options
[in] Option flags for the new meshes.
pMeshesOut
[out, retval] Number of meshes returned.
ppMeshArrayOut
[out, retval] Buffer containing an array of ID3DXMesh interfaces for the new meshes. For a source mesh split into n meshes, ppMeshArrayOut is an array of n ID3DXMesh pointers.
ppAdjacencyArrayOut
[out, retval] Buffer containing an array of adjacency arrays (DWORDs) for the new meshes. See ID3DXBuffer. This parameter is optional.
ppFaceRemapArrayOut
[out, retval] Buffer containing an array of face remap arrays (DWORDs) for the new meshes. See ID3DXBuffer. This parameter is optional.
ppVertRemapArrayOut
[out, retval] Buffer containing an array of vertex remap arrays for the new meshes. See ID3DXBuffer. This parameter is optional.

Return Values

If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be one of the following values: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA, E_OUTOFMEMORY.

Remarks

A common use of this function is to split a mesh with 32-bit indices (more than 65535 vertices) into more than one mesh, each of which has 16-bit indices.

The adjacency, vertex remap and face remap arrays are arrays are DWORDs where each array contains n DWORD pointers, followed by the DWORD data referenced by the pointers. For example, to obtain the face remap information for face 3 in mesh 2, the following code could be used, assuming the face remap data was returned in a variable named ppFaceRemapArrayOut.

	
const DWORD **face_remaps = 
    static_cast<DWORD **>(ppFaceRemapArrayOut->GetBufferPointer());
const DWORD remap = face_remaps[2][3];

Requirements

Header: Declared in D3dx9mesh.h.