SimplificationMesh.Clone(MeshFlags,VertexElement[],Device,Int32,Int32) Method (Microsoft.DirectX.Direct3D)

How Do I...?

  • Simplify a Mesh

Clones, or copies, a SimplificationMesh object.

Definition

Visual Basic Public Function Clone( _
    ByVal options As MeshFlags, _
    ByVal declaration() As VertexElement, _
    ByVal device As Device, _
    ByRef adjacencyOut As Integer, _
    ByRef vertexRemap As Integer _
) As Mesh
C# public Mesh Clone(
    MeshFlags options,
    VertexElement[] declaration,
    Device device,
    out int adjacencyOut,
    out int vertexRemap
);
C++ public:
MeshClone(
    MeshFlags options,
    array<VertexElement>^ declaration,
    Devicedevice,
    [Out] intadjacencyOut,
    [Out] intvertexRemap
);
JScript public function Clone(
    options : MeshFlags,
    declaration : VertexElement[],
    device : Device,
    adjacencyOut : int,
    vertexRemap : int
) : Mesh;

Parameters

options Microsoft.DirectX.Direct3D.MeshFlags
Mesh creation options, indicated through one or more MeshFlags flags (excepting the Simplify* and Optimize* flags).
declaration Microsoft.DirectX.Direct3D.VertexElement[]
Vertex data, defined with an array of VertexElement structures.
device Microsoft.DirectX.Direct3D.Device
The Device object associated with the mesh.
adjacencyOut System.Int32[]
Array of three Int32Leave Site values per face that specifies the three neighbors for each face in the source mesh.
vertexRemap System.Int32[]
Array that contains the index for each vertex.

Return Value

Microsoft.DirectX.Direct3D.Mesh
Address of a pointer to a Mesh object that represents the cloned mesh.

Remarks

Exceptions

InvalidCallException

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

OutOfMemoryExceptionLeave Site

Microsoft Direct3D could not allocate sufficient memory to complete the call.

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();

See Also