-
Notifications
You must be signed in to change notification settings - Fork 21
3. Extensions
GLM extends the core GLSL feature set with extensions. These extensions include: quaternion, transformation, spline, matrix inverse, color spaces, etc.
Here a brief list:
Fast bitfield operations on scalar and vector variables.
Conversion between linear RGB and sRGB color spaces.
Provide a list of built-in constants, such as PI
or PIf
Approximate equality comparisons for floating-point numbers, possibly with a user-defined epsilon.
Useful functions, such as gauss
Integer variants of core GLM functions.
Functions to conveniently access the individual rows or columns of a matrix.
TODO
Additional matrix inverse functions.
Matrix transformation functions that follow the OpenGL fixed-function conventions.
For example, the lookAt
function generates a transformation matrix that
projects world coordinates into eye coordinates suitable for projection matrices
(e.g. perspective
, ortho
). See the OpenGL compatibility specifications
for more information about the layout of these generated matrices.
The matrices generated by this extension use standard OpenGL fixed-function
conventions. For example, the lookAt
function generates a transform from
world space into the specific eye space that the projective matrix functions
(perspective
, ortho
, etc) are designed to expect. The OpenGL
compatibility specifications define the particular layout of this eye space.
Define 2D, 3D and 4D procedural noise functions.
glm.simplex(Vec2(x / 16f, y / 16f))
glm.simplex(Vec3(x / 16f, y / 16f, 0.5f))
glm.simplex(Vec4(x / 16f, y / 16f, 0.5f, 0.5f))
glm.perlin(Vec2(x / 16f, y / 16f))
glm.perlin(Vec3(x / 16.f, y / 16.f, 0.5f))
glm.perlin(Vec4(x / 16f, y / 16f, 0.5f, 0.5f)))
glm.perlin(Vec2(x / 16f, y / 16f), Vec2(2f))
glm.perlin(Vec3(x / 16f, y / 16f, 0.5f), Vec3(2f))
glm.perlin(Vec4(x / 16f, y / 16f, Vec2(0.5f)), vec4(2f))
Convert scalar and vector types to and from packed formats, saving space at the cost of precision. However, packing a value into a format that it was previously unpacked from is guaranteed to be lossless.
Quaternions and operations upon thereof.
Probability distributions in up to four dimensions.
Vec4(glm.linearRand(Vec2(-1), Vec2(1)), 0, 1)
Vec4(glm.circularRand(1f), 0, 1)
Vec4(glm.sphericalRand(1f), 1)
Vec4(glm.diskRand(1f), 0, 1)
Vec4(glm.ballRand(1f), 1)
Vec4(glm.gaussRand(Vec3(0), Vec3(1)), 1)