Microsoft DirectX 8.1 (Visual Basic)

D3DX8.SimplifyMesh

Simplifies a mesh.

object.SimplifyMesh( _ 
    Mesh As D3DXMesh, _ 
    Adjacency As Any, _ 
    VertexAttributeWeights As Any, _ 
    VertexWeights As Any, _ 
    MinValue As Long, _ 
    Options As Long) As D3DXMesh

Parts

object
Object expression that resolves to a D3DX8 object.
Mesh
D3DXMesh object, representing the source mesh.
Adjacency
First element of an array of three Long values per face that specify the three neighbors for each face in the mesh to be simplified.
VertexAttributeWeights
A D3DXATTRIBUTEWEIGHTS type, containing the weight for each vertex component. If this parameter is set to ByVal 0, a default type is used. See Remarks.
VertexWeights
First element of an array of vertex weights. If this parameter is set to ByVal 0, all vertex weights are set to 1.0.
MinValue
Number of vertices or faces, depending on the which flag is set in the Options parameter, by which to simplify the source mesh.
Options
Specifies simplification options for the mesh. One of the flags defined by the CONST_D3DXMESHSIMP enumeration can be set.

Return Values

D3DXMesh object, representing the returned simplification 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

This method generates a mesh that has MinValue vertices or faces.

If the simplification process cannot reduce the mesh to MinValue, the call still succeeds, because MinValue is a desired minimum, not an absolute minimum.

If VertexAttributeWeights is set to ByVal 0, the values are assigned according to the default D3DXATTRIBUTEWEIGHTS type.

Dim AttribruteWeights As D3DXATTRIBUTEWEIGHTS
With _
.position = 1
.Boundary = 1
.Normal = 1
.diffuse = 0
.specular = 0
.Tex(7) = 0
End With

This default type is what most applications should use because it considers only geometric and normal adjustment. Only in special cases do the other member fields need to be modified.

The following code fragment shows how to use a D3DXBuffer object to pass adjacency information.

Dim Mesh As D3DXMesh
Dim D3DXbAdjacency As D3DXBuffer
Dim VAttWeights As Any
Dim VWeights As Any
Dim MinV As Long
Dim Opts As Long

' This code fragment assumes that all arguments
' have been properly initialized.
Call D3DX8.SimplifyMesh(Mesh, ByVal D3DXbAdjacency.GetBufferPointer, VAttWeights, Vweights, MinV, Opts )