ID3DXMesh::OptimizeInplace method
Generates a mesh with reordered faces and vertices to optimize drawing performance. This method reorders the existing mesh.
Syntax
HRESULT OptimizeInplace(
[in] DWORD Flags,
[in] const DWORD *pAdjacencyIn,
[out] DWORD *pAdjacencyOut,
[out] DWORD *pFaceRemap,
[out] LPD3DXBUFFER *ppVertexRemap
);
Parameters
-
Flags [in]
-
Type: DWORD
Combination of one or more D3DXMESHOPT flags, specifying the type of optimization to perform.
-
pAdjacencyIn [in]
-
Type: const DWORD*
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the source mesh. If the edge has no adjacent faces, the value is 0xffffffff.
-
pAdjacencyOut [out]
-
Type: DWORD*
Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff. If the value supplied for this argument is NULL, adjacency data is not returned.
-
pFaceRemap [out]
-
Type: DWORD*
An array of DWORDs, one per face, that identifies the original mesh face that corresponds to each face in the optimized mesh. If the value supplied for this argument is NULL, face remap data is not returned.
-
ppVertexRemap [out]
-
Type: LPD3DXBUFFER*
Address of a pointer to an ID3DXBuffer interface, which contains a DWORD for each vertex that specifies how the new vertices map to the old vertices. This remap is useful if you need to alter external data based on the new vertex mapping. If the value supplied for this argument is NULL, vertex remap data is not returned.
Return value
Type: HRESULT
If the method succeeds, the return value is D3D_OK. If the method fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_CANNOTATTRSORT, E_OUTOFMEMORY.
Remarks
Before running ID3DXMesh::OptimizeInplace, an application must generate an adjacency buffer by calling ID3DXBaseMesh::GenerateAdjacency. The adjacency buffer contains adjacency data, such as a list of edges and the faces that are adjacent to each other.
Note
This method will fail if the mesh is sharing its vertex buffer with another mesh, unless the D3DXMESHOPT_IGNOREVERTS is set in Flags.
Requirements
Requirement | Value |
---|---|
Header |
|
Library |
|
See also