Share via


ProgressiveMesh.ProgressiveMesh(Mesh,GraphicsStream,GraphicsStream,Int32,MeshFlags) Constructor (Microsoft.DirectX.Direct3D)

Creates a new instance of the ProgressiveMesh class.

Definition

Visual Basic Public Sub New( _
    ByVal mesh As Mesh, _
    ByVal adjacency As GraphicsStream, _
    ByVal vertexWeights As GraphicsStream, _
    ByVal minValue As Integer, _
    ByVal options As MeshFlags _
)
C# public ProgressiveMesh(
    Mesh mesh,
    GraphicsStream adjacency,
    GraphicsStream vertexWeights,
    int minValue,
    MeshFlags options
);
C++ public:
 ProgressiveMesh(
    Meshmesh,
    GraphicsStreamadjacency,
    GraphicsStreamvertexWeights,
    int minValue,
    MeshFlags options
);
JScript public function ProgressiveMesh(
    mesh : Mesh,
    adjacency : GraphicsStream,
    vertexWeights : GraphicsStream,
    minValue : int,
    options : MeshFlags
);

Parameters

mesh Microsoft.DirectX.Direct3D.Mesh
A Mesh object that represents the source mesh.
adjacency Microsoft.DirectX.GraphicsStream
A GraphicsStream containing three Int32Leave Site values per face that specify the three neighbors for each face in the created progressive mesh.
vertexWeights Microsoft.DirectX.GraphicsStream
A GraphicsStream of vertex weights. If this parameter is omitted, all vertex weights are set to 1.0. Note that the higher the vertex weight for a given vertex, the less likely it is to be simplified out of existence.
minValue System.Int32
Number of vertices or faces (depending on which flag is set in the param_MeshFlags_options parameter) by which to simplify the source mesh.
options Microsoft.DirectX.Direct3D.MeshFlags
Simplification options for the mesh. Either SimplifyFace or SimplifyVertex can be set.

Remarks

This method generates a mesh in which the level of detail (LOD) can be adjusted from the current value to the param_Int32_minValue vertices or faces.

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

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

CannotAttributeSortException

Attribute sort (D3DXMESHOPT_ATTRSORT) is not supported as an optimization technique.

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.