diff options
Diffstat (limited to 'meta/3rd')
-rw-r--r-- | meta/3rd/love2d/library/love/graphics.lua | 1 | ||||
-rw-r--r-- | meta/3rd/lovr/library/callback.lua | 18 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/data.lua | 29 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/graphics.lua | 94 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/headset.lua | 45 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/math.lua | 154 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/physics.lua | 40 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/system.lua | 26 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/thread.lua | 4 |
9 files changed, 324 insertions, 87 deletions
diff --git a/meta/3rd/love2d/library/love/graphics.lua b/meta/3rd/love2d/library/love/graphics.lua index 87ad4a8f..02647e0b 100644 --- a/meta/3rd/love2d/library/love/graphics.lua +++ b/meta/3rd/love2d/library/love/graphics.lua @@ -794,6 +794,7 @@ function love.graphics.newParticleSystem(image, buffer) end --- ---[Open in Browser](https://love2d.org/wiki/love.graphics.newQuad) --- +---@overload fun(x: number, y: number, width: number, height: number, texture: love.Texture):love.Quad ---@param x number # The top-left position in the Image along the x-axis. ---@param y number # The top-left position in the Image along the y-axis. ---@param width number # The width of the Quad in the Image. (Must be greater than 0.) diff --git a/meta/3rd/lovr/library/callback.lua b/meta/3rd/lovr/library/callback.lua index 76a536db..903a3e8e 100644 --- a/meta/3rd/lovr/library/callback.lua +++ b/meta/3rd/lovr/library/callback.lua @@ -133,6 +133,24 @@ lovr.log = nil lovr.mirror = nil --- +---This callback is called when the mouse is moved. +--- +---@type fun(x: number, y: number, dx: number, dy: number) +lovr.mousemoved = nil + +--- +---This callback is called when a mouse button is pressed. +--- +---@type fun(x: number, y: number, button: number) +lovr.mousepressed = nil + +--- +---This callback is called when a mouse button is released. +--- +---@type fun(x: number, y: number, button: number) +lovr.mousereleased = nil + +--- ---This callback contains a permission response previously requested with `lovr.system.requestPermission`. --- ---The callback contains information on whether permission was granted or denied. diff --git a/meta/3rd/lovr/library/lovr/data.lua b/meta/3rd/lovr/library/lovr/data.lua index dd47aa14..8c841962 100644 --- a/meta/3rd/lovr/library/lovr/data.lua +++ b/meta/3rd/lovr/library/lovr/data.lua @@ -150,8 +150,10 @@ function Blob:getSize() end --- ---Returns a binary string containing the Blob's data. --- +---@param offset? number # A byte offset into the Blob where the string will start. +---@param size? number # The number of bytes the string will contain. If nil, the rest of the data in the Blob will be used, based on the `offset` parameter. ---@return string data # The Blob's data. -function Blob:getString() end +function Blob:getString(offset, size) end --- ---An Image stores raw 2D pixel info for `Texture`s. @@ -341,7 +343,7 @@ function ModelData:getAnimationNode(index, channel) end ---@overload fun(self: lovr.ModelData, name: string, channel: number):lovr.AnimationProperty ---@param index number # The index of an animation. ---@param channel number # The index of a channel in the animation. ----@return lovr.AnimationProperty property # The property (translation, rotation, scale) affected by the keyframes. +---@return lovr.AnimationProperty property # The property (translation, rotation, scale, weights) affected by the keyframes. function ModelData:getAnimationProperty(index, channel) end --- @@ -354,6 +356,23 @@ function ModelData:getAnimationProperty(index, channel) end function ModelData:getAnimationSmoothMode(index, channel) end --- +---Returns the number of blend shapes in the model. +--- +---@return number count # The number of blend shapes in the model. +function ModelData:getBlendShapeCount() end + +--- +---Returns the name of a blend shape in the model. +--- +--- +---### NOTE: +---This function will throw an error if the blend shape index is invalid. +--- +---@param index number # The index of a blend shape. +---@return string name # The name of the blend shape. +function ModelData:getBlendShapeName(index) end + +--- ---Returns one of the Blobs in the model, by index. --- ---@param index number # The index of the Blob to get. @@ -1112,7 +1131,7 @@ function Sound:isStream() end function Sound:setFrames(t, count, dstOffset, srcOffset) end --- ----This indicates the different transform properties that can be animated. +---This indicates the different node properties that can be animated. --- ---@alias lovr.AnimationProperty --- @@ -1127,6 +1146,10 @@ function Sound:setFrames(t, count, dstOffset, srcOffset) end ---Node scale. --- ---| "scale" +--- +---Node blend shape weights. +--- +---| "weights" --- ---These are the data types that can be used by vertex data in meshes. diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua index b0833fea..956d91ae 100644 --- a/meta/3rd/lovr/library/lovr/graphics.lua +++ b/meta/3rd/lovr/library/lovr/graphics.lua @@ -149,7 +149,7 @@ function lovr.graphics.getDevice() end --- ---Returns a table indicating which features are supported by the GPU. --- ----@return {textureBC: boolean, textureASTC: boolean, wireframe: boolean, depthClamp: boolean, indirectDrawFirstInstance: boolean, float64: boolean, int64: boolean, int16: boolean} features # +---@return {textureBC: boolean, textureASTC: boolean, wireframe: boolean, depthClamp: boolean, depthResolve: boolean, indirectDrawFirstInstance: boolean, float64: boolean, int64: boolean, int16: boolean} features # function lovr.graphics.getFeatures() end --- @@ -471,7 +471,6 @@ function lovr.graphics.newMaterial(properties) end ---### NOTE: ---Currently, the following features are not supported by the model importer: --- ----- glTF: Morph targets are not supported. ---- glTF: Only the default scene is loaded. ---- glTF: Currently, each skin in a Model can have up to 256 joints. ---- glTF: Meshes can't appear multiple times in the node hierarchy with different skins, they need @@ -482,6 +481,10 @@ function lovr.graphics.newMaterial(properties) end --- ---Diffuse and emissive textures will be loaded using sRGB encoding, all other textures will be loaded as linear. --- +---Loading a model file will fail if the asset references textures or other files using absolute paths. +--- +---Relative paths should be used instead, and will be relative to the model file within the virtual filesystem. +--- ---@overload fun(blob: lovr.Blob, options?: table):lovr.Model ---@overload fun(modelData: lovr.ModelData, options?: table):lovr.Model ---@param filename string # The path to model file. @@ -1099,6 +1102,45 @@ function Model:getAnimationDuration(index) end function Model:getAnimationName(index) end --- +---Returns the number of blend shapes in the model. +--- +---@return number count # The number of blend shapes in the model. +function Model:getBlendShapeCount() end + +--- +---Returns the name of a blend shape in the model. +--- +--- +---### NOTE: +---This function will throw an error if the blend shape index is invalid. +--- +---@param index number # The index of a blend shape. +---@return string name # The name of the blend shape. +function Model:getBlendShapeName(index) end + +--- +---Returns the weight of a blend shape. +--- +---A blend shape contains offset values for the vertices of one of the meshes in a Model. +--- +---Whenever the Model is drawn, the offsets are multiplied by the weight of the blend shape, allowing for smooth blending between different meshes. +--- +---A weight of zero won't apply any displacement and will skip processing of the blend shape. +--- +--- +---### NOTE: +---The initial weights are declared in the model file. +--- +---Weights can be any number, but usually they're kept between 0 and 1. +--- +---This function will throw an error if the blend shape name or index doesn't exist. +--- +---@overload fun(self: lovr.Model, name: string):number +---@param index number # The index of a blend shape. +---@return number weight # The weight of the blend shape. +function Model:getBlendShapeWeight(index) end + +--- ---Returns the 6 values of the Model's axis-aligned bounding box. --- ---@return number minx # The minimum x coordinate of the vertices in the Model. @@ -1402,6 +1444,28 @@ function Model:hasJoints() end function Model:resetNodeTransforms() end --- +---Sets the weight of a blend shape. +--- +---A blend shape contains offset values for the vertices of one of the meshes in a Model. +--- +---Whenever the Model is drawn, the offsets are multiplied by the weight of the blend shape, allowing for smooth blending between different meshes. +--- +---A weight of zero won't apply any displacement and will skip processing of the blend shape. +--- +--- +---### NOTE: +---The initial weights are declared in the model file. +--- +---Weights can be any number, but usually they're kept between 0 and 1. +--- +---This function will throw an error if the blend shape name or index doesn't exist. +--- +---@overload fun(self: lovr.Model, name: string, weight: number) +---@param index number # The index of a blend shape. +---@param weight number # The new weight for the blend shape. +function Model:setBlendShapeWeight(index, weight) end + +--- ---Sets or blends the orientation of a node to a new orientation. --- ---This sets the local orientation of the node, relative to its parent. @@ -1707,6 +1771,7 @@ function Pass:compute(x, y, z) end --- ---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, segments?: number) ---@overload fun(self: lovr.Pass, transform: lovr.Mat4, segments?: number) +---@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius?: number, segments?: number) ---@param x? number # The x coordinate of the center of the base of the cone. ---@param y? number # The y coordinate of the center of the base of the cone. ---@param z? number # The z coordinate of the center of the base of the cone. @@ -2082,18 +2147,37 @@ function Pass:read(buffer, index, count) end function Pass:rotate(angle, ax, ay, az) end --- +---Draws a rounded rectangle. +--- +---@overload fun(self: lovr.Pass, position: lovr.Vec3, size: lovr.Vec3, orientation: lovr.Quat, radius?: number, segments?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, radius?: number, segments?: number) +---@param x? number # The x coordinate of the center of the rectangle. +---@param y? number # The y coordinate of the center of the rectangle. +---@param z? number # The z coordinate of the center of the rectangle. +---@param width? number # The width of the rectangle. +---@param height? number # The height of the rectangle. +---@param thickness? number # The thickness of the rectangle. +---@param angle? number # The rotation of the rectangle around its rotation axis, 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 radius? number # The radius of the rectangle corners. If the radius is zero or negative, the rectangle will have sharp corners. +---@param segments? number # The number of circular segments to use for each corner. This increases the smoothness, but increases the number of vertices in the mesh. +function Pass:roundrect(x, y, z, width, height, thickness, angle, ax, ay, az, radius, segments) end + +--- ---Scales the coordinate system. --- ---@overload fun(self: lovr.Pass, scale: lovr.Vec3) ---@param sx number # The x component of the scale. ----@param sy number # The y component of the scale. ----@param sz number # The z component of the scale. +---@param sy? number # The y component of the scale. +---@param sz? number # The z component of the scale. function Pass:scale(sx, sy, sz) end --- ---Sends a value to a variable in the Pass's active `Shader`. --- ----The active shader is changed using using `Pass:setShader`. +---The active shader is changed using `Pass:setShader`. --- --- ---### NOTE: diff --git a/meta/3rd/lovr/library/lovr/headset.lua b/meta/3rd/lovr/library/lovr/headset.lua index 8a7372c2..82c0e6c4 100644 --- a/meta/3rd/lovr/library/lovr/headset.lua +++ b/meta/3rd/lovr/library/lovr/headset.lua @@ -33,6 +33,10 @@ function lovr.headset.animate(device, model) end --- ---Returns the current angular velocity of a device. --- +--- +---### NOTE: +---If the device isn't tracked, all zeroes will be returned. +--- ---@param device? lovr.Device # The device to get the velocity of. ---@return number x # The x component of the angular velocity. ---@return number y # The y component of the angular velocity. @@ -61,20 +65,12 @@ function lovr.headset.getAxis(device, axis) end --- ---Returns the depth of the play area, in meters. --- ---- ----### NOTE: ----This currently returns 0 on the Quest. ---- ---@return number depth # The depth of the play area, in meters. function lovr.headset.getBoundsDepth() end --- ---Returns the size of the play area, in meters. --- ---- ----### NOTE: ----This currently returns 0 on the Quest. ---- ---@return number width # The width of the play area, in meters. ---@return number depth # The depth of the play area, in meters. function lovr.headset.getBoundsDimensions() end @@ -89,10 +85,6 @@ function lovr.headset.getBoundsGeometry(t) end --- ---Returns the width of the play area, in meters. --- ---- ----### NOTE: ----This currently returns 0 on the Quest. ---- ---@return number width # The width of the play area, in meters. function lovr.headset.getBoundsWidth() end @@ -423,6 +415,10 @@ function lovr.headset.getTime() end --- ---Returns the current linear velocity of a device, in meters per second. --- +--- +---### NOTE: +---If the device isn't tracked, all zeroes will be returned. +--- ---@param device? lovr.Device # The device to get the velocity of. ---@return number vx # The x component of the linear velocity. ---@return number vy # The y component of the linear velocity. @@ -495,6 +491,18 @@ function lovr.headset.isDown(device, button) end function lovr.headset.isFocused() end --- +---Returns whether passthrough is active. +--- +---When passthrough is active, the real world will be rendered behind any content rendered by LÖVR, using the alpha channel to blend between the two. +--- +--- +---### NOTE: +---This feature is currently only supported on Oculus Quest devices. +--- +---@return boolean active # Whether passthrough is active. +function lovr.headset.isPassthroughEnabled() end + +--- ---Returns whether a button on a device is currently touched. --- ---@param device lovr.Device # The device. @@ -550,6 +558,19 @@ function lovr.headset.setClipDistance(near, far) end function lovr.headset.setDisplayFrequency(frequency) end --- +---Sets whether passthrough is active. +--- +---When passthrough is active, the real world will be rendered behind any content rendered by LÖVR, using the alpha channel to blend between the two. +--- +--- +---### NOTE: +---This feature is currently only supported on Oculus Quest devices. +--- +---@param enable boolean # Whether passthrough should be enabled. +---@return boolean success # Whether the passthrough state was set successfully. +function lovr.headset.setPassthroughEnabled(enable) end + +--- ---Starts the headset session. --- ---This must be called after the graphics module is initialized, and can only be called once. diff --git a/meta/3rd/lovr/library/lovr/math.lua b/meta/3rd/lovr/library/lovr/math.lua index e3aa426a..163e5954 100644 --- a/meta/3rd/lovr/library/lovr/math.lua +++ b/meta/3rd/lovr/library/lovr/math.lua @@ -50,7 +50,7 @@ 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(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 @@ -76,7 +76,7 @@ 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(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 @@ -89,17 +89,17 @@ function lovr.math.newMat4() end --- ---This function takes the same arguments as `Quat:set`. --- ----@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 +---@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? number # 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. +---@return lovr.Quat q # The new quaternion. function lovr.math.newQuat(angle, ax, ay, az, raw) end --- @@ -164,17 +164,17 @@ function lovr.math.noise(x) end --- ---This function takes the same arguments as `Quat:set`. --- ----@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 +---@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? number # 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. +---@return lovr.Quat q # The new quaternion. function lovr.math.quat(angle, ax, ay, az, raw) end --- @@ -400,19 +400,19 @@ function Mat4:equals(n) end ---@param down number # The bottom half-angle of the projection, in radians. ---@param near number # The near plane of the projection. ---@param far? number # The far plane. Zero is a special value that will set an infinite far plane with a reversed Z range, which improves depth buffer precision and is the default. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:fov(left, right, up, down, near, far) end --- ---Resets the matrix to the identity, effectively setting its translation to zero, its scale to 1, and clearing any rotation. --- ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:identity() end --- ---Inverts the matrix, causing it to represent the opposite of its old transform. --- ----@return lovr.Mat4 m # The original matrix, with its values inverted. +---@return lovr.Mat4 self # The inverted matrix. function Mat4:invert() end --- @@ -425,7 +425,7 @@ function Mat4:invert() end ---@param from lovr.Vec3 # The position of the viewer. ---@param to lovr.Vec3 # The position of the target. ---@param up? lovr.Vec3 # The up vector of the viewer. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:lookAt(from, to, up) end --- @@ -442,7 +442,7 @@ function Mat4:lookAt(from, to, up) end ---@overload fun(self: lovr.Mat4, v3: lovr.Vec3):lovr.Vec3 ---@overload fun(self: lovr.Mat4, v4: lovr.Vec4):lovr.Vec4 ---@param n lovr.Mat4 # The matrix. ----@return lovr.Mat4 m # The original matrix, containing the result. +---@return lovr.Mat4 self # The modified matrix. function Mat4:mul(n) end --- @@ -457,7 +457,7 @@ function Mat4:mul(n) end ---@param top number # The top edge of the projection. ---@param near number # The position of the near clipping plane. ---@param far number # The position of the far clipping plane. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:orthographic(left, right, bottom, top, near, far) end --- @@ -469,15 +469,23 @@ function Mat4:orthographic(left, right, bottom, top, near, far) end ---@param aspect number # The horizontal aspect ratio of the projection (width / height). ---@param near number # The near plane. ---@param far? number # The far plane. Zero is a special value that will set an infinite far plane with a reversed Z range, which improves depth buffer precision and is the default. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:perspective(fov, aspect, near, far) end --- +---Turns the matrix into a reflection matrix that transforms values as though they were reflected across a plane. +--- +---@param position lovr.Vec3 # The position of the plane. +---@param normal lovr.Vec3 # The normal vector of the plane. +---@return lovr.Mat4 self # The reflected matrix. +function Mat4:reflect(position, normal) end + +--- ---Rotates the matrix using a quaternion or an angle/axis rotation. --- ---@overload fun(self: lovr.Mat4, angle: number, ax?: number, ay?: number, az?: number):lovr.Mat4 ---@param q lovr.Quat # The rotation to apply to the matrix. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The rotated matrix. function Mat4:rotate(q) end --- @@ -485,13 +493,13 @@ function Mat4:rotate(q) end --- ---@overload fun(self: lovr.Mat4, sx: number, sy?: number, sz?: number):lovr.Mat4 ---@param scale lovr.Vec3 # The 3D scale to apply. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:scale(scale) end --- ---Sets the components of the matrix from separate position, rotation, and scale arguments or an existing matrix. --- ----@overload fun(self: lovr.Mat4, n: lovr.mat4):lovr.Mat4 +---@overload fun(self: lovr.Mat4, n: lovr.Mat4):lovr.Mat4 ---@overload fun(self: lovr.Mat4, x: number, y: number, z: number, sx: number, sy: number, sz: number, angle: number, ax: number, ay: number, az: number):lovr.Mat4 ---@overload fun(self: lovr.Mat4, x: number, y: number, z: number, angle: number, ax: number, ay: number, az: number):lovr.Mat4 ---@overload fun(self: lovr.Mat4, position: lovr.Vec3, scale: lovr.Vec3, rotation: lovr.Quat):lovr.Mat4 @@ -511,7 +519,7 @@ function Mat4:set() end ---@param from lovr.Vec3 # The position of the viewer. ---@param to lovr.Vec3 # The position of the target. ---@param up? lovr.Vec3 # The up vector of the viewer. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The modified matrix. function Mat4:target(from, to, up) end --- @@ -519,13 +527,13 @@ function Mat4:target(from, to, up) end --- ---@overload fun(self: lovr.Mat4, x: number, y: number, z: number):lovr.Mat4 ---@param v lovr.Vec3 # The translation vector. ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The translated matrix. function Mat4:translate(v) end --- ---Transposes the matrix, mirroring its values along the diagonal. --- ----@return lovr.Mat4 m # The original matrix. +---@return lovr.Mat4 self # The transposed matrix. function Mat4:transpose() end --- @@ -547,7 +555,7 @@ local Quat = {} --- ---It negates the (x, y, z) components of the quaternion. --- ----@return lovr.Quat q # The original quaternion. +---@return lovr.Quat self # The inverted quaternion. function Quat:conjugate() end --- @@ -576,9 +584,9 @@ function Quat:length() end --- ---If the value is a vector, then the input vector is rotated by the quaternion and returned. --- ----@overload fun(self: lovr.Quat, v3: lovr.vec3):lovr.vec3 ----@param r lovr.quat # A quaternion to combine with the original. ----@return lovr.quat q # The original quaternion. +---@overload fun(self: lovr.Quat, v3: lovr.Vec3):lovr.Vec3 +---@param r lovr.Quat # A quaternion to combine with the original. +---@return lovr.Quat self # The modified quaternion. function Quat:mul(r) end --- @@ -590,7 +598,7 @@ function Quat:mul(r) end --- ---Try normalizing a quaternion if some of the calculations aren't working quite right! --- ----@return lovr.Quat q # The original quaternion. +---@return lovr.Quat self # The normalized quaternion. function Quat:normalize() end --- @@ -607,17 +615,17 @@ function Quat:normalize() end --- two vectors. ---- A matrix can be passed in to extract the rotation of the matrix into a quaternion. --- ----@overload fun(self: lovr.Quat, r: lovr.quat):lovr.quat ----@overload fun(self: lovr.Quat, v: lovr.vec3):lovr.quat ----@overload fun(self: lovr.Quat, v: lovr.vec3, u: lovr.vec3):lovr.quat ----@overload fun(self: lovr.Quat, m: lovr.mat4):lovr.quat ----@overload fun(self: lovr.Quat):lovr.quat +---@overload fun(self: lovr.Quat, r: lovr.Quat):lovr.Quat +---@overload fun(self: lovr.Quat, v: lovr.Vec3):lovr.Quat +---@overload fun(self: lovr.Quat, v: lovr.Vec3, u: lovr.Vec3):lovr.Quat +---@overload fun(self: lovr.Quat, m: lovr.Mat4):lovr.Quat +---@overload fun(self: lovr.Quat):lovr.Quat ---@param angle? number # The 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 original quaternion. +---@return lovr.Quat self # The modified quaternion. function Quat:set(angle, ax, ay, az, raw) end --- @@ -631,7 +639,7 @@ function Quat:set(angle, ax, ay, az, raw) end --- ---@param r lovr.Quat # The quaternion to slerp towards. ---@param t number # The lerping parameter. ----@return lovr.Quat q # The original quaternion, containing the new lerped values. +---@return lovr.Quat self # The modified quaternion, containing the new lerped values. function Quat:slerp(r, t) end --- @@ -725,7 +733,7 @@ local Vec2 = {} --- ---@overload fun(self: lovr.Vec2, x: number, y?: number):lovr.Vec2 ---@param u lovr.Vec2 # The other vector. ----@return lovr.Vec2 v # The original vector. +---@return lovr.Vec2 self # The modified vector. function Vec2:add(u) end --- @@ -755,7 +763,7 @@ function Vec2:distance(u) end --- ---@overload fun(self: lovr.Vec2, x: number, y?: number):lovr.Vec2 ---@param u lovr.Vec2 # The other vector to divide the components by. ----@return lovr.Vec2 v # The original vector. +---@return lovr.Vec2 self # The modified vector. function Vec2:div(u) end --- @@ -806,7 +814,7 @@ function Vec2:length() end ---@overload fun(self: lovr.Vec2, x: number, y: number, t: number):lovr.Vec2 ---@param u lovr.Vec2 # The vector to lerp towards. ---@param t number # The lerping parameter. ----@return lovr.Vec2 v # The original vector, containing the new lerped values. +---@return lovr.Vec2 self # The interpolated vector. function Vec2:lerp(u, t) end --- @@ -814,13 +822,13 @@ function Vec2:lerp(u, t) end --- ---@overload fun(self: lovr.Vec2, x: number, y?: number):lovr.Vec2 ---@param u lovr.Vec2 # The other vector to multiply the components by. ----@return lovr.Vec2 v # The original vector. +---@return lovr.Vec2 self # The modified vector. function Vec2:mul(u) end --- ---Adjusts the values in the vector so that its direction stays the same but its length becomes 1. --- ----@return lovr.Vec2 v # The original vector. +---@return lovr.Vec2 self # The normalized vector. function Vec2:normalize() end --- @@ -837,7 +845,7 @@ function Vec2:set(x, y) end --- ---@overload fun(self: lovr.Vec2, x: number, y?: number):lovr.Vec2 ---@param u lovr.Vec2 # The other vector. ----@return lovr.Vec2 v # The original vector. +---@return lovr.Vec2 self # The modified vector. function Vec2:sub(u) end --- @@ -858,7 +866,7 @@ local Vec3 = {} --- ---@overload fun(self: lovr.Vec3, x: number, y?: number, z?: number):lovr.Vec3 ---@param u lovr.Vec3 # The other vector. ----@return lovr.Vec3 v # The original vector. +---@return lovr.Vec3 self # The modified vector. function Vec3:add(u) end --- @@ -886,7 +894,7 @@ function Vec3:angle(u) end --- ---@overload fun(self: lovr.Vec3, x: number, y: number, z: number):lovr.Vec3 ---@param u lovr.Vec3 # The vector to compute the cross product with. ----@return lovr.Vec3 v # The original vector, with the cross product as its values. +---@return lovr.Vec3 self # The modified vector. function Vec3:cross(u) end --- @@ -902,7 +910,7 @@ function Vec3:distance(u) end --- ---@overload fun(self: lovr.Vec3, x: number, y?: number, z?: number):lovr.Vec3 ---@param u lovr.Vec3 # The other vector to divide the components by. ----@return lovr.Vec3 v # The original vector. +---@return lovr.Vec3 self # The modified vector. function Vec3:div(u) end --- @@ -953,7 +961,7 @@ function Vec3:length() end ---@overload fun(self: lovr.Vec3, x: number, y: number, z: number, t: number):lovr.Vec3 ---@param u lovr.Vec3 # The vector to lerp towards. ---@param t number # The lerping parameter. ----@return lovr.Vec3 v # The original vector, containing the new lerped values. +---@return lovr.Vec3 self # The interpolated vector. function Vec3:lerp(u, t) end --- @@ -961,19 +969,20 @@ function Vec3:lerp(u, t) end --- ---@overload fun(self: lovr.Vec3, x: number, y?: number, z?: number):lovr.Vec3 ---@param u lovr.Vec3 # The other vector to multiply the components by. ----@return lovr.Vec3 v # The original vector. +---@return lovr.Vec3 self # The modified vector. function Vec3:mul(u) end --- ---Adjusts the values in the vector so that its direction stays the same but its length becomes 1. --- ----@return lovr.Vec3 v # The original vector. +---@return lovr.Vec3 self # The normalized vector. function Vec3:normalize() end --- ---Sets the components of the vector, either from numbers or an existing vector. --- ---@overload fun(self: lovr.Vec3, u: lovr.Vec3):lovr.Vec3 +---@overload fun(self: lovr.Vec3, q: lovr.Quat):lovr.Vec3 ---@overload fun(self: lovr.Vec3, m: lovr.Mat4):lovr.Vec3 ---@param x? number # The new x value of the vector. ---@param y? number # The new y value of the vector. @@ -986,7 +995,7 @@ function Vec3:set(x, y, z) end --- ---@overload fun(self: lovr.Vec3, x: number, y?: number, z?: number):lovr.Vec3 ---@param u lovr.Vec3 # The other vector. ----@return lovr.Vec3 v # The original vector. +---@return lovr.Vec3 self # The modified vector. function Vec3:sub(u) end --- @@ -1008,7 +1017,7 @@ local Vec4 = {} --- ---@overload fun(self: lovr.Vec4, x: number, y?: number, z?: number, w?: number):lovr.Vec4 ---@param u lovr.Vec4 # The other vector. ----@return lovr.Vec4 v # The original vector. +---@return lovr.Vec4 self # The modified vector. function Vec4:add(u) end --- @@ -1038,7 +1047,7 @@ function Vec4:distance(u) end --- ---@overload fun(self: lovr.Vec4, x: number, y?: number, z?: number, w?: number):lovr.Vec4 ---@param u lovr.Vec4 # The other vector to divide the components by. ----@return lovr.Vec4 v # The original vector. +---@return lovr.Vec4 self # The modified vector. function Vec4:div(u) end --- @@ -1089,7 +1098,7 @@ function Vec4:length() end ---@overload fun(self: lovr.Vec4, x: number, y: number, z: number, w: number, t: number):lovr.Vec4 ---@param u lovr.Vec4 # The vector to lerp towards. ---@param t number # The lerping parameter. ----@return lovr.Vec4 v # The original vector, containing the new lerped values. +---@return lovr.Vec4 self # The interpolated vector. function Vec4:lerp(u, t) end --- @@ -1097,13 +1106,13 @@ function Vec4:lerp(u, t) end --- ---@overload fun(self: lovr.Vec4, x: number, y?: number, z?: number, w?: number):lovr.Vec4 ---@param u lovr.Vec4 # The other vector to multiply the components by. ----@return lovr.Vec4 v # The original vector. +---@return lovr.Vec4 self # The modified vector. function Vec4:mul(u) end --- ---Adjusts the values in the vector so that its direction stays the same but its length becomes 1. --- ----@return lovr.Vec4 v # The original vector. +---@return lovr.Vec4 self # The normalized vector. function Vec4:normalize() end --- @@ -1122,7 +1131,7 @@ function Vec4:set(x, y, z, w) end --- ---@overload fun(self: lovr.Vec4, x: number, y?: number, z?: number, w?: number):lovr.Vec4 ---@param u lovr.Vec4 # The other vector. ----@return lovr.Vec4 v # The original vector. +---@return lovr.Vec4 self # The modified vector. function Vec4:sub(u) end --- @@ -1168,11 +1177,14 @@ function Vec4:unpack() end --- --- local position = lovr.math.vec3(x, y, z) --- ----As a further shorthand, these vector constructors are placed on the global scope. +---As a shortcut, vector constructors are placed on the global scope. --- ----If you prefer to keep the global scope clean, this can be configured using the `t.math.globals` flag in `lovr.conf`. +---The uppercase name of the vector is a function that will create a permanent vector, and the lowercase name will create a temporary vector. +--- +---This can be disabled using the `t.math.globals` option in `lovr.conf`. --- --- local position = vec3(x1, y1, z1) + vec3(x2, y2, z2) +--- local transform = Mat4() --- ---Temporary vectors, with all their speed, come with an important restriction: they can only be used during the frame in which they were created. --- @@ -1181,7 +1193,7 @@ function Vec4:unpack() end --- local position = vec3(1, 2, 3) --- --- function lovr.update(dt) ---- -- Reusing a temporary vector across frames will error: +--- -- Reusing the temporary 'position' vector across frames will error: --- position:add(vec3(dt)) --- end --- @@ -1232,5 +1244,25 @@ function Vec4:unpack() end --- ---Similarly, matrices support raw unpacking as well as decomposition into translation/scale/rotation values. --- +---### Vector Constants +--- +---The following vector constants are available. +--- +---They return new temporary vectors each time they are used: +--- +---- `vec2.zero` (0, 0) +---- `vec2.one` (1, 1) +---- `vec3.zero` (0, 0, 0) +---- `vec3.one` (1, 1, 1) +---- `vec3.left` (-1, 0, 0) +---- `vec3.right` (1, 0, 0) +---- `vec3.up` (0, 1, 0) +---- `vec3.down` (0, -1, 0) +---- `vec3.back` (0, 0, 1) +---- `vec3.forward` (0, 0, -1) +---- `vec4.zero` (0, 0, 0, 0) +---- `vec4.one` (1, 1, 1, 1) +---- `quat.identity` (0, 0, 0, 1) +--- ---@class lovr.Vectors local Vectors = {} diff --git a/meta/3rd/lovr/library/lovr/physics.lua b/meta/3rd/lovr/library/lovr/physics.lua index 6d635c2b..b699fc81 100644 --- a/meta/3rd/lovr/library/lovr/physics.lua +++ b/meta/3rd/lovr/library/lovr/physics.lua @@ -1224,7 +1224,7 @@ function Shape:setPosition(x, y, z) end --- ---Sets whether this Shape is a sensor. --- ----Sensors do not trigger any collision response, but they still report collisions in `World:collide`. +---When a Shape is a sensor, it will not generate any collision response when it collides with things, but collisions can still be detected with `World:collide` and `World:getContacts`. --- ---@param sensor boolean # Whether the Shape should be a sensor. function Shape:setSensor(sensor) end @@ -1343,11 +1343,15 @@ local World = {} --- ---Attempt to collide two shapes. --- ----Internally this uses joints and forces to ensure the colliders attached to the shapes do not pass through each other. +---Internally this sets up constraint forces to move the shapes' colliders apart if they are touching. +--- +---The colliders won't actually move until `World:update` is called again to advance the physics simulation. +--- +---Collision responses can be customized using friction and restitution (bounciness) parameters, and default to using a mix between the parameters of the two colliders. --- ----Collisions can be customized using friction and restitution (bounciness) parameters, and default to using a mix of the colliders' friction and restitution parameters. +---Usually this is called internally by `World:update`, or in a custom collision resolver passed to `World:update`. --- ----Usually this is called automatically by `World:update`. +---If you want to detect if objects are touching without colliding them, use `World:getContacts` or make one or both of the shapes sensors using `Shape:setSensor`. --- --- ---### NOTE: @@ -1369,6 +1373,10 @@ function World:collide(shapeA, shapeB, friction, restitution) end --- ---After calling this function, the `World:overlaps` iterator can be used to iterate over the overlaps, and `World:collide` can be used to resolve a collision for the shapes (if any). Usually this is called automatically by `World:update`. --- +--- +---### NOTE: +---This performs the "broad phase" culling of objects in the World, usually using a spatial hash or other acceleration structure like a quad tree or octree. +--- function World:computeOverlaps() end --- @@ -1427,6 +1435,24 @@ function World:getAngularDamping() end function World:getColliders() end --- +---Computes collision information between two shapes and returns a list of contacts where the shapes intersect. +--- +---Each contact point consists of a position, a normal vector, and a penetration depth. +--- +--- +---### NOTE: +---This only detects collision information, it does not cause the shapes to collide with each other. +--- +---Use `World:collide` for that. +--- +---This function ignores collision tags. +--- +---@param shapeA lovr.Shape # The first shape. +---@param shapeB lovr.Shape # The second shape. +---@return table contacts # A list of contacts. Each contact consists of 7 numbers: the contact position, the normal vector, and a depth value indicating how far the shapes intersect each other at the contact point (`{ x, y, z, nx, ny, nz, depth }`). +function World:getContacts(shapeA, shapeB) end + +--- ---Returns the gravity of the World. --- ---@return number xg # The x component of the gravity force. @@ -1478,6 +1504,12 @@ function World:getResponseTime() end function World:getStepCount() end --- +---Returns the list of collision tags used when creating the World. +--- +---@return table tags # A table of collision tags (strings). +function World:getTags() end + +--- ---Returns the tightness of joints in the World. --- ---The tightness controls how much force is applied to colliders connected by joints. diff --git a/meta/3rd/lovr/library/lovr/system.lua b/meta/3rd/lovr/library/lovr/system.lua index de11766b..c0a5b739 100644 --- a/meta/3rd/lovr/library/lovr/system.lua +++ b/meta/3rd/lovr/library/lovr/system.lua @@ -13,6 +13,25 @@ lovr.system = {} function lovr.system.getCoreCount() end --- +---Returns the position of the mouse. +--- +---@return number x # The x position of the mouse, relative to the top-left of the window. +---@return number y # The y position of the mouse, relative to the top-left of the window. +function lovr.system.getMousePosition() end + +--- +---Returns the x position of the mouse. +--- +---@return number x # The x position of the mouse, relative to the top-left of the window. +function lovr.system.getMouseX() end + +--- +---Returns the y position of the mouse. +--- +---@return number y # The y position of the mouse, relative to the top-left of the window. +function lovr.system.getMouseY() end + +--- ---Returns the current operating system. --- ---@return string os # Either "Windows", "macOS", "Linux", "Android" or "Web". @@ -67,6 +86,13 @@ function lovr.system.getWindowWidth() end function lovr.system.isKeyDown(key) end --- +---Returns whether a mouse button is currently pressed. +--- +---@param button number # The index of a button to check. Use 1 for the primary mouse button, 2 for the secondary button, and 3 for the middle button. Other indices can be used, but are hardware-specific. +---@return boolean down # Whether the mouse button is currently down. +function lovr.system.isMouseDown(button) end + +--- ---Returns whether the desktop window is open. --- ---`t.window` can be set to `nil` in `lovr.conf` to disable automatic opening of the window. diff --git a/meta/3rd/lovr/library/lovr/thread.lua b/meta/3rd/lovr/library/lovr/thread.lua index f281edcb..5b22c9c3 100644 --- a/meta/3rd/lovr/library/lovr/thread.lua +++ b/meta/3rd/lovr/library/lovr/thread.lua @@ -116,9 +116,9 @@ function Channel:pop(wait) end --- ---Pushes a message onto the Channel. --- ----The following types of data can be pushed: nil, boolean, number, string, and userdata. +---The following types of data can be pushed: nil, boolean, number, string, lightuserdata, vectors, and userdata (LÖVR objects). --- ----Tables should be serialized to strings. +---Notably, tables are not currently supported and should be serialized to strings. --- --- ---### NOTE: |