Microsoft DirectX 8.1 (Visual Basic)

D3DXPMesh.Optimize

Controls the reordering of mesh faces and vertices to optimize performance, generating an output mesh.

object.Optimize( _ 
    Flags As Long, _ 
    AdjacencyOut As Any, _ 
    FaceRemap As Any, _ 
    VertexRemapOut As D3DXBuffer) As D3DXMesh

Parts

object
Object expression that resolves to a D3DXPMesh object.
Flags
A combination of one or more flags defined by the CONST_D3DXMESHOPT enumeration, specifying the type of optimization to perform.

Note that the D3DXMESHOPT_STRIPREORDER and D3DXMESHOPT_VERTEXCACHE optimization flags are mutually exclusive.

AdjacencyOut
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. The size of this array is the maximum number of faces multiplied by 3.
FaceRemap
Destination buffer containing the new index for each face.
VertexRemapOut
D3DXBuffer object; containing the new index for each vertex.

Return Values

D3DXMesh object, representing the optimized mesh.

Error Codes

If the method fails, an error is raised and Err.Number can be set to one of the following values.

D3DERR_INVALIDCALL
E_OUTOFMEMORY

For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.

Remarks

ClonePMeshFVF can be used to convert a progressive mesh from one FVF to another.

See Also

D3DX8.FVFFromDeclarator, D3DXBaseMesh.GetFVF