SimplificationMesh.ReduceVertices(Int32) Method (Microsoft.DirectX.Direct3D)

How Do I...?

  • Simplify a Mesh

Reduces the number of vertices in a simplification mesh.

Definition

Visual Basic Public Sub ReduceVertices( _
    ByVal vertices As Integer _
)
C# public void ReduceVertices(
    int vertices
);
C++ public:
void ReduceVertices(
    int vertices
);
JScript public function ReduceVertices(
    vertices : int
);

Parameters

vertices System.Int32
Number of vertices by which to reduce the primitive count.

Remarks

This method performs edge collapses to reduce the number of primitives to the value specified in param_Int32_vertices. Note that, due to certain restrictions, it is not always possible to reduce a mesh to the requested value.

Exceptions

InvalidCallException

The method call is invalid. For example, a method's parameter might contain an invalid value.

How Do I...?

Simplify a Mesh

This example demonstrates how to simplify a mesh.

The mesh is simplified by 25 vertices.

In the following C# code example, mesh is assumed to be a Mesh instance that has been properly loaded and cleaned, adjacency is a GraphicsStream instance that contains the mesh adjacency data, and device is the rendering Device.

              [C#]
              

SimplificationMesh simplifiedMesh = new SimplificationMesh(mesh, adjacency);

simplifiedMesh.ReduceVertices(mesh.NumberVertices - 25);

mesh.Dispose();
mesh = simplifiedMesh.Clone(simplifiedMesh.Options.Value, 
                            simplifiedMesh.VertexFormat, device);
simplifiedMesh.Dispose();