Microsoft DirectX 8.1 (Visual Basic)

D3DX8.CreateSPMesh

Creates a simplification mesh.

object.CreateSPMesh( _ 
    Mesh As D3DXMesh, _ 
    Adjacency As Any, _ 
    VertexAttributeWeights As Any, _ 
    VertexWeights As Any) As D3DXSPMesh

Parts

object
Object expression that resolves to a D3DX8 object.
Mesh
D3DXMesh object, representing the mesh to simplify.
Adjacency
First element of an array of three Long values per face that specify the three neighbors for each face in the created simplification mesh.
VertexAttributeWeights
A D3DXATTRIBUTEWEIGHTS type, containing the weight for each vertex component. If this parameter is set to ByVal 0, a default type is used.
VertexWeights
First element of an array of vertex weights. Note that the higher the vertex weight for a given vertex, the less likely it is to be simplified away.

Return Values

D3DXSPMesh object, representing the created simplification mesh.

Error Codes

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

D3DXERR_CANNOTATTRSORT
D3DERR_INVALIDCALL
E_OUTOFMEMORY

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

Remarks

A simplification mesh is used to simplify a mesh to a lower number of triangles and faces.

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 will 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

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