D3DXSplitMesh function
Splits a mesh into meshes smaller than the specified size.
Syntax
void D3DXSplitMesh(
_In_ LPD3DXMESH pMeshIn,
_In_ const DWORD *pAdjacencyIn,
_In_ const DWORD MaxSize,
_In_ const DWORD Options,
_Out_ DWORD *pMeshesOut,
_Out_ LPD3DXBUFFER *ppMeshArrayOut,
_Out_ LPD3DXBUFFER *ppAdjacencyArrayOut,
_Out_ LPD3DXBUFFER *ppFaceRemapArrayOut,
_Out_ LPD3DXBUFFER *ppVertRemapArrayOut
);
Parameters
-
pMeshIn [in]
-
Type: LPD3DXMESH
Pointer to an ID3DXMesh interface, representing the source mesh.
-
pAdjacencyIn [in]
-
Type: const DWORD*
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]
-
Type: const DWORD
Maximum number of vertices in the resulting mesh.
-
Options [in]
-
Type: const DWORD
Option flags for the new meshes.
-
pMeshesOut [out]
-
Type: DWORD*
Number of meshes returned.
-
ppMeshArrayOut [out]
-
Type: LPD3DXBUFFER*
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]
-
Type: LPD3DXBUFFER*
Buffer containing an array of adjacency arrays (DWORDs) for the new meshes. See ID3DXBuffer. This parameter is optional.
-
ppFaceRemapArrayOut [out]
-
Type: LPD3DXBUFFER*
Buffer containing an array of face remap arrays (DWORDs) for the new meshes. See ID3DXBuffer. This parameter is optional.
-
ppVertRemapArrayOut [out]
-
Type: LPD3DXBUFFER*
Buffer containing an array of vertex remap arrays for the new meshes. See ID3DXBuffer. This parameter is optional.
Return value
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
Requirement | Value |
---|---|
Header |
|
Library |
|
See also