MeshHelper

class MeshHelper : System.Object
public void CalculateNormals(MeshContent mesh, bool overwriteExistingNormals)

Generates vertex normals by accumulation of triangle face normals.

Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) – The mesh which will recieve the normals.
  • overwriteExistingNormals (bool) – Overwrite or skip over geometry with existing normals.
public void CalculateNormals(GeometryContent geom, bool overwriteExistingNormals)

Generates vertex normals by accumulation of triangle face normals.

Parameters:
  • geom (Microsoft.Xna.Framework.Content.Pipeline.Graphics.GeometryContent) – The geometry which will recieve the normals.
  • overwriteExistingNormals (bool) – Overwrite or skip over geometry with existing normals.
public void CalculateTangentFrames(MeshContent mesh, string textureCoordinateChannelName, string tangentChannelName, string binormalChannelName)

Generate the tangents and binormals (tangent frames) for each vertex in the mesh.

Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) – The mesh which will have add tangent and binormal channels added.
  • textureCoordinateChannelName (string) – The Vector2 texture coordinate channel used to generate tangent frames.
  • tangentChannelName (string) –
  • binormalChannelName (string) –
public void CalculateTangentFrames(GeometryContent geom, string textureCoordinateChannelName, string tangentChannelName, string binormalChannelName)
Parameters:
  • geom (Microsoft.Xna.Framework.Content.Pipeline.Graphics.GeometryContent) –
  • textureCoordinateChannelName (string) –
  • tangentChannelName (string) –
  • binormalChannelName (string) –
public void CalculateTangentFrames(System.Collections.Generic.IList<Vector3> positions, System.Collections.Generic.IList<Int32> indices, System.Collections.Generic.IList<Vector3> normals, System.Collections.Generic.IList<Vector2> textureCoords, ref Microsoft.Xna.Framework.Vector3[] tangents, ref Microsoft.Xna.Framework.Vector3[] bitangents)
Parameters:
  • positions (System.Collections.Generic.IList<Vector3>) –
  • indices (System.Collections.Generic.IList<Int32>) –
  • normals (System.Collections.Generic.IList<Vector3>) –
  • textureCoords (System.Collections.Generic.IList<Vector2>) –
  • (ref) tangents (Microsoft.Xna.Framework.Vector3[]) –
  • (ref) bitangents (Microsoft.Xna.Framework.Vector3[]) –
public BoneContent FindSkeleton(NodeContent node)

Search for the root bone of the skeletion.

Parameters:
  • node (Microsoft.Xna.Framework.Content.Pipeline.Graphics.NodeContent) – The node from which to begin the search for the skeleton.
Returns:

The root bone of the skeletion or null if none is found.

public System.Collections.Generic.IList<BoneContent> FlattenSkeleton(BoneContent skeleton)

Traverses a skeleton depth-first and builds a list of its bones.

Parameters:
  • skeleton (Microsoft.Xna.Framework.Content.Pipeline.Graphics.BoneContent) –
public void MergeDuplicatePositions(MeshContent mesh, float tolerance)

Merge any positions in the T:Microsoft.Xna.Framework.Content.Pipeline.Graphics.PositionCollection of the specified mesh that are at a distance less than the specified tolerance from each other.

Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) – Mesh to be processed.
  • tolerance (float) –
    Tolerance value that determines how close
    positions must be to each other to be merged.
public void MergeDuplicateVertices(GeometryContent geometry)

Merge vertices with the same P:Microsoft.Xna.Framework.Content.Pipeline.Graphics.VertexContent.PositionIndices and T:Microsoft.Xna.Framework.Content.Pipeline.Graphics.VertexChannel data within the specified T:Microsoft.Xna.Framework.Content.Pipeline.Graphics.GeometryContent.

Parameters:
  • geometry (Microsoft.Xna.Framework.Content.Pipeline.Graphics.GeometryContent) – Geometry to be processed.
public void MergeDuplicateVertices(MeshContent mesh)

Merge vertices with the same P:Microsoft.Xna.Framework.Content.Pipeline.Graphics.VertexContent.PositionIndices and T:Microsoft.Xna.Framework.Content.Pipeline.Graphics.VertexChannel data within the P:Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent.Geometry of this mesh. If you want to merge positions too, call M:Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshHelper.MergeDuplicatePositions(Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent,System.Single) on your mesh before this function.

Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) – Mesh to be processed
public void OptimizeForCache(MeshContent mesh)
Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) –
public void SwapWindingOrder(MeshContent mesh)

Reverses the triangle winding order of the mesh.

Parameters:
  • mesh (Microsoft.Xna.Framework.Content.Pipeline.Graphics.MeshContent) – The mesh which will be modified.
public void TransformScene(NodeContent scene, Matrix transform)

Transforms the contents of a node and its descendants.

Parameters:
  • scene (Microsoft.Xna.Framework.Content.Pipeline.Graphics.NodeContent) – The root node of the scene to transform.
  • transform (Microsoft.Xna.Framework.Matrix) – The transform matrix to apply to the scene.
bool IsLeftHanded(ref Matrix xform)
Parameters:
  • (ref) xform (Microsoft.Xna.Framework.Matrix) –