MeshPrimitiveType PrimitiveType { get; set; }

book_4_sparkGenerated
code_blocksInput

Description

The PrimitiveType property of the Mesh class specifies the type of primitive that the mesh represents. This property is of type MeshPrimitiveType, which defines the geometric shape of the mesh, such as triangles, lines, or points. Setting this property determines how the mesh's vertices and indices are interpreted when rendering.

Usage

To set the PrimitiveType property, assign it a value from the MeshPrimitiveType enumeration. This will define the basic geometric shape that the mesh will represent. For example, if you want the mesh to be rendered as a series of triangles, you would set this property to MeshPrimitiveType.Triangles.

Example

// Example of setting the PrimitiveType property
Mesh myMesh = new Mesh();
myMesh.PrimitiveType = MeshPrimitiveType.Triangles; // Set the mesh to use triangles as its primitive type