Share via


Geometry.ComputeTangentFrame(Mesh,Int32,Int32,Int32,Int32,Int32,Int32,Int32,Int32,TangentOptions,GraphicsStream,Single,Single,Single,GraphicsStream) Method (Microsoft.DirectX.Direct3D)

Performs tangent frame computations on a mesh. Tangent, binormal, and optionally normal vectors are generated. Singularities are handled as required by grouping edges and splitting vertices.

Definition

Visual Basic Public Shared Function ComputeTangentFrame( _
    ByVal mesh As Mesh, _
    ByVal textureInSemantic As Integer, _
    ByVal textureInIndex As Integer, _
    ByVal upartialOutSemantic As Integer, _
    ByVal upartialOutIndex As Integer, _
    ByVal vpartialOutSemantic As Integer, _
    ByVal vpartialOutIndex As Integer, _
    ByVal normalOutSemantic As Integer, _
    ByVal normalOutIndex As Integer, _
    ByVal options As TangentOptions, _
    ByVal adjacency As GraphicsStream, _
    ByVal partialEdgeTreshold As Single, _
    ByVal singularPointThreshold As Single, _
    ByVal normalEdgeThreshold As Single, _
    ByRef vertexRemapping As GraphicsStream _
) As Mesh
C# public static Mesh ComputeTangentFrame(
    Mesh mesh,
    int textureInSemantic,
    int textureInIndex,
    int upartialOutSemantic,
    int upartialOutIndex,
    int vpartialOutSemantic,
    int vpartialOutIndex,
    int normalOutSemantic,
    int normalOutIndex,
    TangentOptions options,
    GraphicsStream adjacency,
    float partialEdgeTreshold,
    float singularPointThreshold,
    float normalEdgeThreshold,
    out GraphicsStream vertexRemapping
);
C++ public:
static MeshComputeTangentFrame(
    Meshmesh,
    int textureInSemantic,
    int textureInIndex,
    int upartialOutSemantic,
    int upartialOutIndex,
    int vpartialOutSemantic,
    int vpartialOutIndex,
    int normalOutSemantic,
    int normalOutIndex,
    TangentOptions options,
    GraphicsStreamadjacency,
    float partialEdgeTreshold,
    float singularPointThreshold,
    float normalEdgeThreshold,
    [Out] GraphicsStream^% vertexRemapping
);
JScript public static function ComputeTangentFrame(
    mesh : Mesh,
    textureInSemantic : int,
    textureInIndex : int,
    upartialOutSemantic : int,
    upartialOutIndex : int,
    vpartialOutSemantic : int,
    vpartialOutIndex : int,
    normalOutSemantic : int,
    normalOutIndex : int,
    options : TangentOptions,
    adjacency : GraphicsStream,
    partialEdgeTreshold : float,
    singularPointThreshold : float,
    normalEdgeThreshold : float,
    vertexRemapping : GraphicsStream
) : Mesh;

Parameters

mesh Microsoft.DirectX.Direct3D.Mesh
Input Mesh mesh object.
textureInSemantic System.Int32
Specifies the name of the semantic declaration to use for reading texture coordinates, typically TextureCoordinate.
textureInIndex System.Int32
If a mesh has multiple texture coordinates, specifies the texture coordinate to use for the tangent frame computations. If zero, the mesh has only a single texture coordinate.
upartialOutSemantic System.Int32
Specifies the DeclarationUsage type, typically BiNormal, that describes where the partial derivative with respect to the u texture coordinate will be stored.
upartialOutIndex System.Int32
Specifies the semantic index at which to store the partial derivative with respect to the u texture coordinate.
vpartialOutSemantic System.Int32
Specifies the DeclarationUsage type, typically BiNormal, that describes where the partial derivative with respect to the v texture coordinate will be stored.
vpartialOutIndex System.Int32
Specifies the semantic index at which to store the partial derivative with respect to the v texture coordinate.
normalOutSemantic System.Int32
Specifies the DeclarationUsage type, typically Normal, that describes where the normal vector at each vertex will be stored.
normalOutIndex System.Int32
Specifies the semantic index at which to store the normal vector at each vertex.
options Microsoft.DirectX.Direct3D.TangentOptions
Combination of one or more TangentOptions values that specify tangent frame computation options. If zero, the following options will be specified: & !( WeightByArea | WeightEqual | OrthogonalizeFromU | OrthogonalizeFromV | WrapUV | DontNormalizePartials | WindClockwise | CalculateNormals ).
adjacency Microsoft.DirectX.GraphicsStream
GraphicsStream object that represents an array of three Int32Leave Site values per face that specify the three neighbors for each face in the mesh.
partialEdgeTreshold System.Single
Specifies the maximum cosine of the angle at which two partial derivatives are deemed to be incompatible with each other. If the dot product of the direction of the two partial derivatives in adjacent triangles is less than or equal to this threshold, then the vertices shared between these triangles will be split.
singularPointThreshold System.Single
Specifies the maximum magnitude of a partial derivative at which a vertex will be deemed singular. As multiple triangles are incident on a point that have nearby tangent frames, but altogether cancel each other out (such as at the top of a sphere), the magnitude of the partial derivative will decrease. If the magnitude is less than or equal to this threshold, then the vertex will be split for every triangle that contains it.
normalEdgeThreshold System.Single
Similar to partialEdgeTreshold, specifies the maximum cosine of the angle between two normals that is a threshold beyond which vertices shared between triangles will be split. If the dot product of the two normals is less than the threshold, the shared vertices will be split, forming a hard edge between neighboring triangles. If the dot product is more than the threshold, neighboring triangles will have their normals interpolated.
vertexRemapping Microsoft.DirectX.GraphicsStream
Output GraphicsStream object that receives a mapping of new vertices computed by this method to the original vertices.

Return Value

Microsoft.DirectX.Direct3D.Mesh
Output Mesh mesh object that receives the computed tangent, binormal, and normal vector data.

Remarks

A simplified version of this function is available as Mesh.ComputeTangentFrame.

The computed normal vector at each vertex is always normalized to have unit length.

Exceptions

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.

See Also