Microsoft DirectX 8.1 (Visual Basic)

D3DXMesh.Optimize

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

object.Optimize( _ 
    Flags As Any, _ 
    Adjacency As Any, _ 
    OptAdj As Any, _ 
    FaceRemap As Any, _ 
    BuffVertexRemap As D3DXBuffer, _ 
    OptMesh As D3DXMesh)

Parts

object
Object expression that resolves to a D3DXMesh 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.

Adjacency
First element of an array of three Long values per face that specify the three neighbors for each face in the source mesh.
OptAdj
First element of an array, representing the 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.
FaceRemap
First element of an array, representing the destination buffer containing the new index for each face.
BuffVertexRemap
D3DXBuffer object, containing the new index for each vertex.
OptMesh
D3DXMesh object, representing the optimized mesh.

Error Codes

If the method fails, an error is raised and Err.Number can be set to E_OUTOFMEMORY.

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

Remarks

This method is very similar to the D3DXBaseMesh.CloneMesh method, except that it can perform optimization while generating the new clone of the mesh.

The output mesh inherits all of the creation parameters of the input mesh.