Microsoft DirectX 8.1 (Visual Basic) |
Controls the reordering of mesh faces and vertices to optimize performance.
object.OptimizeInplace( _ Flags As Long, _ AdjacencyIn As Any, _ AdjacencyOut As Any, _ FaceRemap As Any, _ VertexRemapOut As D3DXBuffer)
Note that the D3DXMESHOPT_STRIPREORDER and D3DXMESHOPT_VERTEXCACHE optimization flags are mutually exclusive.
If the method fails, an error is raised and Err.Number can be set to one of the following values.
D3DERR_INVALIDCALL |
D3DXERR_CANNOTATTRSORT |
E_OUTOFMEMORY |
For information on trapping errors, see the Microsoft® Visual Basic® Error Handling topic.
The output mesh inherits all of the creation parameters of the input mesh.
The following code fragment shows how to use a D3DXBuffer object to pass adjacency information.
Dim Opts As Long Dim D3DXbAdjacencyIn As D3DXBuffer Dim D3DXbAdjacencyOut As Any Dim FaceRemap As Any Dim FaceRemap As D3DXBuffer ' This code fragment assumes that all arguments ' have been properly initialized. Call D3DX8.OptimizeInPlace( Opts, ByVal D3DXbAdjacencyIn.GetBufferPointer, D3DXbAdjacencyOut, _ FaceRemap, FaceRemap )
Note This method fails if the mesh is sharing its vertex buffer with another mesh, unless the D3DXMESHOPT_IGNOREVERTS flag is set in the Flags parameter.