# class TangentCalculator

TangentCalculator calculates tangent vectors for geometry data objects. One corner field of texture coordinates must exist, as well as normals. The tangents are placed into two corner fields called "Tangents" and "Bitangents". If any of these fields already exists, it is replaced by the new field.

# Properties

Property Description
InvertV Inverts the V component of the texcoords used for tangent calculation. This essentially switches between right- and lefthanded, i.e. TangentCalculatorType = OrthonormalRightHanded and InvertV = true generates equivalent tangents to TangentCalculatorType = OrthonormalLeftHanded.
TangentCalculatorType Sets/Gets the tangent calculator type, types listed in TangentSpaceMethod.
TexCoordsSetId The TexCoords field id to use for the tangent calculation. If set to -1, all texture coordinates will get corresponding tangent fields.

# Methods

Method Description
CalculateTangents Calculates the tangents of a geometry data object.
CalculateTangentsForNodeHierarchy Calculates the tangents of a tree of scene nodes (only the geometry nodes of course).
GetClass Get the name of the TangentCalculator class.
IsA Returns true if TangentCalculator is a or is a descendant of the class named as the type parameter.
IsNull Returns true if the TangentCalculator object is invalid.

# Static methods

Method Description
IsClassA Returns true if the class is a or is a descendant of the class named as the type parameter.
SafeCast SafeCast makes sure the input object is of a class that can be cast into spTangentCalculator, and if this is the case, returns the object cast into spTangentCalculator.

# Properties details

# InvertV

Inverts the V component of the texcoords used for tangent calculation. This essentially switches between right- and lefthanded, i.e. TangentCalculatorType = OrthonormalRightHanded and InvertV = true generates equivalent tangents to TangentCalculatorType = OrthonormalLeftHanded.

# Syntax

// Setter
void SetInvertV( bool value );

// Getter
bool GetInvertV();

# SetInvertV parameters

Type Name Min Max Description
bool value The desired value of InvertV.

# GetInvertV return value

Type: bool

Default: false

# TangentCalculatorType

Sets/Gets the tangent calculator type, types listed in TangentSpaceMethod.

# Syntax

// Setter
void SetTangentCalculatorType( Simplygon::ETangentSpaceMethod type );

// Getter
Simplygon::ETangentSpaceMethod GetTangentCalculatorType();

# SetTangentCalculatorType parameters

Type Name Min Max Description
ETangentSpaceMethod type The desired tangent calculator type.

# GetTangentCalculatorType return value

Type: ETangentSpaceMethod

Default: OrthonormalRightHanded

Key Value Comment
OrthonormalRightHanded 0 Standard method, creates an orthonormal tangent space (right-handed)
Autodesk3dsMax 1 3dsMax compatible method, creates tangent space that is compatible with the 3dsMax renderer
OrthonormalLeftHanded 2 Creates an orthonormal tangent space (left-handed, D3D compatible)
MikkTSpace 3 Creates a tangent space using the MikkTSpace tangent space generation algorithm.

# TexCoordsSetId

The TexCoords field id to use for the tangent calculation. If set to -1, all texture coordinates will get corresponding tangent fields.

# Syntax

// Setter
void SetTexCoordsSetId( rid value );

// Getter
rid GetTexCoordsSetId();

# SetTexCoordsSetId parameters

Type Name Min Max Description
rid value The desired texcoordset id.

# GetTexCoordsSetId return value

Type: rid

Default: 0

# Methods details

# CalculateTangents

Calculates the tangents of a geometry data object.

# Syntax

void CalculateTangents( spGeometryData geom );

# Parameters

Type Name Min Max Description
GeometryData geom The geometry object receives new fields, as described in the class description.

# CalculateTangentsForNodeHierarchy

Calculates the tangents of a tree of scene nodes (only the geometry nodes of course).

# Syntax

void CalculateTangentsForNodeHierarchy( spSceneNode node );

# Parameters

Type Name Min Max Description
SceneNode node Is the scene node that will have itselfs and its childrens tangents calculated.

# GetClass

Get the name of the TangentCalculator class.

# Syntax

spString GetClass();

# Parameters

GetClass takes no parameters.

# Return value

Type: spString

# IsA

Returns true if TangentCalculator is a or is a descendant of the class named as the type parameter.

# Syntax

bool IsA( const char * type );

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if TangentCalculator is, or is a descendant of.

# Return value

Type: bool

# IsNull

Returns true if the TangentCalculator object is invalid.

# Syntax

bool IsNull();

# Parameters

IsNull takes no parameters.

# Return value

Type: bool

# Static methods details

# IsClassA

Returns true if the class is a or is a descendant of the class named as the type parameter.

# Syntax

static bool IsClassA( const char * type );

# Parameters

Type Name Min Max Description
const char * type Name of the class to check if the class is, or is a descendant of.

# Return value

Type: bool

# SafeCast

SafeCast makes sure the input object is of a class that can be cast into spTangentCalculator, and if this is the case, returns the object cast into spTangentCalculator.

# Syntax

static spTangentCalculator SafeCast( spObject object );

# Parameters

Type Name Min Max Description
Object object Object to cast.

# Return value

Type: TangentCalculator