Sdílet prostřednictvím


MeshHelper.CalculateTangentFrames Method

Compute tangent frames for the given mesh.

Namespace: Microsoft.Xna.Framework.Content.Pipeline.Graphics
Assembly: Microsoft.Xna.Framework.Content.Pipeline (in microsoft.xna.framework.content.pipeline.dll)

Syntax

public static void CalculateTangentFrames (
         MeshContent mesh,
         string textureCoordinateChannelName,
         string tangentChannelName,
         string binormalChannelName
)

Parameters

  • mesh
    The target mesh used to create the tangent frame. All geometries in this mesh must have normal vertex channels stored in Normal, and must contain Vector3 data.
  • textureCoordinateChannelName
    The texture coordinate channel used for computing the tangent frame. This channel most contain Vector2 data.
  • tangentChannelName
    Target channel name used to store calculated tangents. A tangent channel is not generated if null or an empty string is specified.
  • binormalChannelName
    Target channel name used to store calculated binormals. A tangent channel is not generated if null or an empty string is specified.

Remarks

This method computes and adds tangent and binormal vertex channels to the given mesh.

An InvalidContentException is thrown if:

  • The mesh does not contain a normal channel (stored in Normal).
  • The data specified in the normal channel is not a Vector3 type.
  • The vertex channel of the mesh does not have the name specified by textureCoordinateChannelName.
  • The data specified in the texture coordinate channel is not a Vector2 type.
  • The channel specified by tangentChannelName already exists.
  • The channel specified by binormalChannelName already exists.

See Also

Reference

MeshHelper Class
MeshHelper Members
Microsoft.Xna.Framework.Content.Pipeline.Graphics Namespace

Platforms

Windows XP SP2, Windows Vista