Table of Contents

Class MeshBuilder

Namespace
Microsoft.Xna.Framework.Content.Pipeline.Graphics
Assembly
MonoGame.Framework.Content.Pipeline.dll
public sealed class MeshBuilder
Inheritance
MeshBuilder
Inherited Members

Properties

MergeDuplicatePositions

Gets or sets the current value for position merging of the mesh.

public bool MergeDuplicatePositions { get; set; }

Property Value

bool

MergePositionTolerance

Gets or sets the tolerance for MergeDuplicatePositions.

public float MergePositionTolerance { get; set; }

Property Value

float

Name

Gets or sets the name of the current MeshContent object being processed.

public string Name { get; set; }

Property Value

string

SwapWindingOrder

Reverses the triangle winding order of the specified mesh.

public bool SwapWindingOrder { get; set; }

Property Value

bool

Methods

AddTriangleVertex(int)

Adds a vertex into the index collection.

public void AddTriangleVertex(int indexIntoVertexCollection)

Parameters

indexIntoVertexCollection int

Index of the inserted vertex, in the collection. This corresponds to the value returned by CreatePosition(float, float, float).

CreatePosition(Vector3)

Inserts the specified vertex position into the vertex channel at the specified index.

public int CreatePosition(Vector3 pos)

Parameters

pos Vector3

Value of the vertex being inserted.

Returns

int

Index of the vertex being inserted.

CreatePosition(float, float, float)

Inserts the specified vertex position into the vertex channel.

public int CreatePosition(float x, float y, float z)

Parameters

x float

Value of the x component of the vector.

y float

Value of the y component of the vector.

z float

Value of the z component of the vector.

Returns

int

Index of the inserted vertex.

CreateVertexChannel<T>(string)

public int CreateVertexChannel<T>(string usage)

Parameters

usage string

Returns

int

Type Parameters

T

FinishMesh()

Ends the creation of a mesh.

public MeshContent FinishMesh()

Returns

MeshContent

Resultant mesh.

SetMaterial(MaterialContent)

Sets the material for the next triangles.

public void SetMaterial(MaterialContent material)

Parameters

material MaterialContent

Material for the next triangles.

Remarks

Sets the material for the triangles being defined next. This material and the opaque data dictionary, set with SetOpaqueData(OpaqueDataDictionary) define the GeometryContent object containing the next triangles. When you set a new material or opaque data dictionary the triangles you add afterwards will belong to a new GeometryContent object.

SetOpaqueData(OpaqueDataDictionary)

Sets the opaque data for the next triangles.

public void SetOpaqueData(OpaqueDataDictionary opaqueData)

Parameters

opaqueData OpaqueDataDictionary

Opaque data dictionary for the next triangles.

Remarks

Sets the opaque data dictionary for the triangles being defined next. This dictionary and the material, set with SetMaterial(MaterialContent), define the GeometryContent object containing the next triangles. When you set a new material or opaque data dictionary the triangles you add afterwards will belong to a new GeometryContent object.

SetVertexChannelData(int, object)

Sets the specified vertex data with new data.

public void SetVertexChannelData(int vertexDataIndex, object channelData)

Parameters

vertexDataIndex int

Index of the vertex data channel being set. This should match the index returned by CreateVertexChannel.

channelData object

New data values for the vertex data. The data type being set must match the data type for the vertex channel specified by vertexDataIndex.

StartMesh(string)

Initializes the creation of a mesh.

public static MeshBuilder StartMesh(string name)

Parameters

name string

Name of the mesh.

Returns

MeshBuilder

Object used when building the mesh.