Module geometry_tools::vectors
source · Expand description
Functions for computing normal, tangent, and bitangent (binormal) vectors.
Modules§
Enums§
- Errors that can occur while calculating tangents or bitangents.
Constants§
- The value returned when any component of the calculated bitangent would be
NaN
or infinite. - The value returned when any component of the calculated tangent would be
NaN
or infinite.
Functions§
- Calculates smooth per-vertex normals by by averaging over the vertices in each face.
indices
is assumed to contain triangle indices forpositions
, soindices.len()
should be a multiple of 3. If either ofpositions
orindices
is empty, the result is empty. - Calculates the tangent sign of 1.0 or -1.0, which is often stored in the W component for a 4 component tangent vector. The tangent sign is used to flip the generated bitangent to account for mirrored (overlapping) texture coordinates. Depending on the conventions of the game or application, it may be necessary to multiply the returned value by -1.0.
- Calculates smooth per-vertex tangents by averaging over the vertices in each face. The 4th component contains the tangent sign and can be used to calculate the bitangent vectors. This step will normally be done by shader code for the GPU.
- Calculates smooth per-vertex tangents and bitangents by averaging over the vertices in each face.
indices
is assumed to contain triangle indices forpositions
, soindices.len()
should be a multiple of 3. If either ofpositions
orindices
is empty, the result is empty.