diff options
Diffstat (limited to 'meta/3rd/lovr/library/lovr.math.lua')
-rw-r--r-- | meta/3rd/lovr/library/lovr.math.lua | 86 |
1 files changed, 76 insertions, 10 deletions
diff --git a/meta/3rd/lovr/library/lovr.math.lua b/meta/3rd/lovr/library/lovr.math.lua index c53ffac2..43a6004e 100644 --- a/meta/3rd/lovr/library/lovr.math.lua +++ b/meta/3rd/lovr/library/lovr.math.lua @@ -50,6 +50,12 @@ function lovr.math.linearToGamma(lr, lg, lb) end --- ---This function takes the same arguments as `Mat4:set`. --- +---@overload fun(n: lovr.mat4):lovr.Mat4 +---@overload fun(position?: lovr.Vec3, scale?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4 +---@overload fun(position?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4 +---@overload fun(...):lovr.Mat4 +---@overload fun(d: number):lovr.Mat4 +---@return lovr.Mat4 m # The new matrix. function lovr.math.mat4() end --- @@ -69,6 +75,12 @@ function lovr.math.newCurve(x, y, z, ...) end --- ---This function takes the same arguments as `Mat4:set`. --- +---@overload fun(n: lovr.mat4):lovr.Mat4 +---@overload fun(position?: lovr.Vec3, scale?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4 +---@overload fun(position?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4 +---@overload fun(...):lovr.Mat4 +---@overload fun(d: number):lovr.Mat4 +---@return lovr.Mat4 m # The new matrix. function lovr.math.newMat4() end --- @@ -76,7 +88,18 @@ function lovr.math.newMat4() end --- ---This function takes the same arguments as `Quat:set`. --- -function lovr.math.newQuat() end +---@overload fun(r: lovr.quat):lovr.quat +---@overload fun(v: lovr.vec3):lovr.quat +---@overload fun(v: lovr.vec3, u: lovr.vec3):lovr.quat +---@overload fun(m: lovr.mat4):lovr.quat +---@overload fun():lovr.quat +---@param angle? any # An angle to use for the rotation, in radians. +---@param ax? number # The x component of the axis of rotation. +---@param ay? number # The y component of the axis of rotation. +---@param az? number # The z component of the axis of rotation. +---@param raw? boolean # Whether the components should be interpreted as raw `(x, y, z, w)` components. +---@return lovr.quat q # The new quaternion. +function lovr.math.newQuat(angle, ax, ay, az, raw) end --- ---Creates a new `RandomGenerator`, which can be used to generate random numbers. If you just want some random numbers, you can use `lovr.math.random`. Individual RandomGenerator objects are useful if you need more control over the random sequence used or need a random generator isolated from other instances. @@ -91,21 +114,37 @@ function lovr.math.newRandomGenerator() end --- ---This function takes the same arguments as `Vec2:set`. --- -function lovr.math.newVec2() end +---@overload fun(u: lovr.Vec2):lovr.Vec2 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@return lovr.Vec2 v # The new vector. +function lovr.math.newVec2(x, y) end --- ---Creates a new 3D vector. --- ---This function takes the same arguments as `Vec3:set`. --- -function lovr.math.newVec3() end +---@overload fun(u: lovr.Vec3):lovr.Vec3 +---@overload fun(m: lovr.Mat4):lovr.Vec3 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@param z? number # The z value of the vector. +---@return lovr.Vec3 v # The new vector. +function lovr.math.newVec3(x, y, z) end --- ---Creates a new 4D vector. --- ---This function takes the same arguments as `Vec4:set`. --- -function lovr.math.newVec4() end +---@overload fun(u: lovr.Vec4):lovr.Vec4 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@param z? number # The z value of the vector. +---@param w? number # The w value of the vector. +---@return lovr.Vec4 v # The new vector. +function lovr.math.newVec4(x, y, z, w) end --- ---Returns a 1D, 2D, 3D, or 4D perlin noise value. @@ -124,7 +163,18 @@ function lovr.math.noise(x) end --- ---This function takes the same arguments as `Quat:set`. --- -function lovr.math.quat() end +---@overload fun(r: lovr.quat):lovr.quat +---@overload fun(v: lovr.vec3):lovr.quat +---@overload fun(v: lovr.vec3, u: lovr.vec3):lovr.quat +---@overload fun(m: lovr.mat4):lovr.quat +---@overload fun():lovr.quat +---@param angle? any # An angle to use for the rotation, in radians. +---@param ax? number # The x component of the axis of rotation. +---@param ay? number # The y component of the axis of rotation. +---@param az? number # The z component of the axis of rotation. +---@param raw? boolean # Whether the components should be interpreted as raw `(x, y, z, w)` components. +---@return lovr.quat q # The new quaternion. +function lovr.math.quat(angle, ax, ay, az, raw) end --- ---Returns a uniformly distributed pseudo-random number. @@ -165,21 +215,37 @@ function lovr.math.setRandomSeed(seed) end --- ---This function takes the same arguments as `Vec2:set`. --- -function lovr.math.vec2() end +---@overload fun(u: lovr.Vec2):lovr.Vec2 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@return lovr.Vec2 v # The new vector. +function lovr.math.vec2(x, y) end --- ---Creates a temporary 3D vector. --- ---This function takes the same arguments as `Vec3:set`. --- -function lovr.math.vec3() end +---@overload fun(u: lovr.Vec3):lovr.Vec3 +---@overload fun(m: lovr.Mat4):lovr.Vec3 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@param z? number # The z value of the vector. +---@return lovr.Vec3 v # The new vector. +function lovr.math.vec3(x, y, z) end --- ---Creates a temporary 4D vector. --- ---This function takes the same arguments as `Vec4:set`. --- -function lovr.math.vec4() end +---@overload fun(u: lovr.Vec4):lovr.Vec4 +---@param x? number # The x value of the vector. +---@param y? number # The y value of the vector. +---@param z? number # The z value of the vector. +---@param w? number # The w value of the vector. +---@return lovr.Vec4 v # The new vector. +function lovr.math.vec4(x, y, z, w) end --- ---A Curve is an object that represents a Bézier curve in three dimensions. @@ -434,7 +500,7 @@ function Mat4:set() end --- ---Sets a model transform matrix that moves to `from` and orients model towards `to` point. --- ----This is used when rendered model should always point torwards a point of interest. The resulting Mat4 object can be used as model pose. +---This is used when rendered model should always point towards a point of interest. The resulting Mat4 object can be used as model pose. --- ---The target() function produces same result as lookAt() after matrix inversion. --- @@ -1004,7 +1070,7 @@ function Vec4:equals(u) end ---### NOTE: ---The length is equivalent to this: --- ---- math.sqrt(v.x * v.x + v.y * v.y * v.z + v.z + v.w * v.w) +--- math.sqrt(v.x * v.x + v.y * v.y + v.z * v.z + v.w * v.w) --- ---@return number length # The length of the vector. function Vec4:length() end |