Microsoft DirectX 9.0

ID3DXMesh::OptimizeInplace Method

Controls the reordering of mesh faces and vertices to optimize performance.


HRESULT OptimizeInplace(      

    DWORD Flags,     CONST DWORD *pAdjacencyIn,     DWORD *pAdjacencyOut,     DWORD *pFaceRemap,     LPD3DXBUFFER *ppVertexRemap );


[in] Combination of one or more D3DXMESHOPT flags, specifying the type of optimization to perform.
[in] Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the source mesh. If the edge has no adjacent faces, the value is 0xffffffff.
[out] Pointer to a destination buffer for the face adjacency array of the optimized mesh. The face adjacency is stored as an array of arrays. The innermost array is three indices of adjacent triangles, and the outer array is one set of face adjacency per triangle in the mesh. If the value supplied for this argument is NULL, adjacency data is not returned.
[out] Pointer to a destination buffer containing the new index for each face. If the value supplied for this argument is NULL, face remap data is not returned.
[out] Address of a pointer to an ID3DXBuffer interface containing the new index for each vertex. If the value supplied for this argument is NULL, vertex remap data is not returned.

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.
D3DXERR_CANNOTATTRSORTAttribute sort (D3DXMESHOPT_ATTRSORT) is not supported as an optimization technique.
E_OUTOFMEMORYMicrosoft?Direct3D?could not allocate sufficient memory to complete the call.


Note  This method will fail if the mesh is sharing its vertex buffer with another mesh, unless the D3DXMESHOPT_IGNOREVERTS flag is set in the Flags parameter.

© 2002 Microsoft Corporation. All rights reserved.