vector_math_geometry library

A library containing geometry generators (like CubeGenerator, SphereGenerator and CylinderGenerator) and filters (BarycentricFilter, ColorFilter and InvertFilter).

Functions

generateNormals(Vector3List normals, Vector3List positions, Uint16List indices) → void
Generate vertex normals based on a list of positions and indices. normals is assumed to be zeroed out, and much match positions in length. indices is assumed to represent a triangle list.
generateTangents(Vector4List tangents, Vector3List positions, Vector3List normals, Vector2List texCoords, Uint16List indices) → void
Generate vertex tangents based on a list of positions, normals, texCoords and indices. tangents is assumed to be zeroed out, and much match positions, normals, and texCoords in length. indices is assumed to represent a triangle list. Tangents are returned as Vector4s. The X, Y, and Z component represent the tangent and the W component represents the direction of the bitangent which can be generated as: vec4 bitangent = cross(normal, tangent.xyz) * tangent.w; Derived from the granddaddy of all tangent generation functions: http://www.terathon.com/code/tangent.html