The lovr.math module provides math helpers commonly used for 3D applications.


Functions for generating random numbers and noise.

lovr.math.newRandomGeneratorCreate a new RandomGenerator.
lovr.math.noiseGenerate perlin noise.
lovr.math.randomGet a random number.
lovr.math.randomNormalGet a random number from a normal distribution.
lovr.math.getRandomSeedGet the random seed.
lovr.math.setRandomSeedSet the random seed.


A collection of vector objects. Check out the Vectors guide for an introduction.

lovr.math.drainDrain the temporary vector pool.
lovr.math.mat4Create a temporary Mat4.
lovr.math.newMat4Create a new Mat4.
lovr.math.newQuatCreate a new Quat.
lovr.math.newVec2Create a new Vec2.
lovr.math.newVec3Create a new Vec3.
lovr.math.newVec4Create a new Vec4.
lovr.math.quatCreate a temporary Quat.
lovr.math.vec2Create a temporary Vec2.
lovr.math.vec3Create a temporary Vec3.
lovr.math.vec4Create a temporary Vec4.


Other miscellaneous math objects/helpers.

lovr.math.gammaToLinear Convert a color from gamma space to linear space.
lovr.math.linearToGamma Convert a color from linear space to gamma space.
lovr.math.newCurveCreate a new Curve.