Mirror Engine Logo
How To
Mirror Engine Logo

Function: calculateTangents()

function calculateTangents(
  positions: number[],
  normals: number[],
  uvs: number[],
  indices: number[]
): number[]

Generates tangent information from the specified positions, normals, texture coordinates and triangle indices.

Parameters

positions

number

An array of 3-dimensional vertex positions.

normals

number

An array of 3-dimensional vertex normals.

uvs

number

An array of 2-dimensional vertex texture coordinates.

indices

number

An array of triangle indices.

Returns

number

An array of 3-dimensional vertex tangents.

Example

const tangents = calculateTangents(positions, normals, uvs, indices)