SimplificationMesh.SimplificationMesh Constructor

Language:

How Do I...?

Creates a new instance of the SimplificationMesh class.

Overload List

public SimplificationMesh(ID3DXSPMesh);
public SimplificationMesh(IntPtr);
public SimplificationMesh(Mesh, GraphicsStream);
public SimplificationMesh(Mesh, GraphicsStream, AttributeWeights);
public SimplificationMesh(Mesh, GraphicsStream, AttributeWeights, GraphicsStream);
public SimplificationMesh(Mesh, GraphicsStream, GraphicsStream);
public SimplificationMesh(Mesh, GraphicsStream, float[]);
public SimplificationMesh(Mesh, int[]);
public SimplificationMesh(Mesh, int[], AttributeWeights);
public SimplificationMesh(Mesh, int[], AttributeWeights, GraphicsStream);
public SimplificationMesh(Mesh, int[], AttributeWeights, float[]);
public SimplificationMesh(Mesh, int[], GraphicsStream);
public SimplificationMesh(Mesh, int[], float[]);

Remarks

If param_AttributeWeights_vertexAttributeWeights is omitted, the following values are assigned to the default AttributeWeights structure (C# code shown).

[C#]
AttributeWeights aWeights; aWeights.Position = 1.0; aWeights.Boundary = 1.0; aWeights.Normal = 1.0; aWeights.Diffuse = 0.0; aWeights.Specular = 0.0; aWeights.Tex[8] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0};

This default structure 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.

Exceptions
InvalidCallException The method call is invalid. For example, a method's parameter might contain an invalid value.
CannotAttributeSortException Attribute sort is not supported as an optimization technique.
OutOfMemoryException Leave 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();


Send comments about this topic to Microsoft. © Microsoft Corporation. All rights reserved.

Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center