vector_math_geometry library
A library containing geometry generators (like CubeGenerator, SphereGenerator and CylinderGenerator) and filters (BarycentricFilter, ColorFilter and InvertFilter).
Classes
- BarycentricFilter
- Adds barycentric coordinates for each triangle vertex in a mesh.
- CircleGenerator
- ColorFilter
- Assigns a single color to every vertex in a mesh.
- CubeGenerator
- CylinderGenerator
- FlatShadeFilter
- Expands a mesh to triangle vertices and generates flat-shaded normals.
- GeometryFilter
- A filter that produces a transformed copy of a MeshGeometry.
- GeometryGenerator
- GeometryGeneratorFlags
- InplaceGeometryFilter
- A GeometryFilter that can apply its transformation directly to a mesh in-place.
- InvertFilter
- Reverses triangle winding and flips normals for a mesh.
- MeshGeometry
- RingGenerator
- SphereGenerator
- TransformFilter
- Applies a matrix transform to each mesh position in-place.
- VertexAttrib
Functions
-
generateNormals(
Vector3List normals, Vector3List positions, Uint16List indices) → void -
Generate vertex normals based on a list of
positionsandindices.normalsis assumed to be zeroed out, and much matchpositionsin length.indicesis 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,texCoordsandindices.tangentsis assumed to be zeroed out, and much matchpositions,normals, andtexCoordsin length.indicesis 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