From 3a761da3d574639aac1f7ef06b1976bf3f255ad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E8=90=8C=E5=B0=8F=E6=B1=90?= Date: Mon, 27 Mar 2023 16:52:21 +0800 Subject: update love-api --- meta/3rd/love2d/library/love/physics.lua | 14 +- meta/3rd/lovr/library/lovr/audio.lua | 42 +++- meta/3rd/lovr/library/lovr/graphics.lua | 332 +++++++++++++++++++++++++------ meta/3rd/lovr/library/lovr/math.lua | 7 +- meta/3rd/lovr/library/lovr/physics.lua | 56 ++++-- 5 files changed, 355 insertions(+), 96 deletions(-) (limited to 'meta/3rd') diff --git a/meta/3rd/love2d/library/love/physics.lua b/meta/3rd/love2d/library/love/physics.lua index 616e4791..82ea008a 100644 --- a/meta/3rd/love2d/library/love/physics.lua +++ b/meta/3rd/love2d/library/love/physics.lua @@ -3122,14 +3122,12 @@ function World:queryBoundingBox(topLeftX, topLeftY, bottomRightX, bottomRightY, --- ---[Open in Browser](https://love2d.org/wiki/World:rayCast) --- ----@param fixture love.Fixture # The fixture intersecting the ray. ----@param x number # The x position of the intersection point. ----@param y number # The y position of the intersection point. ----@param xn number # The x value of the surface normal vector of the shape edge. ----@param yn number # The y value of the surface normal vector of the shape edge. ----@param fraction number # The position of the intersection on the ray as a number from 0 to 1 (or even higher if the ray length was changed with the return value). ----@return number control # The ray can be controlled with the return value. A positive value sets a new ray length where 1 is the default value. A value of 0 terminates the ray. If the callback function returns -1, the intersection gets ignored as if it didn't happen. -function World:rayCast(fixture, x, y, xn, yn, fraction) end +---@param x1 number # The x position of the starting point of the ray. +---@param y1 number # The x position of the starting point of the ray. +---@param x2 number # The x position of the end point of the ray. +---@param y2 number # The x value of the surface normal vector of the shape edge. +---@param callback function # A function called for each fixture intersected by the ray. The function gets six arguments and should return a number as a control value. The intersection points fed into the function will be in an arbitrary order. If you wish to find the closest point of intersection, you'll need to do that yourself within the function. The easiest way to do that is by using the fraction value. +function World:rayCast(x1, y1, x2, y2, callback) end --- ---Sets functions for the collision callbacks during the world update. diff --git a/meta/3rd/lovr/library/lovr/audio.lua b/meta/3rd/lovr/library/lovr/audio.lua index c56a37d6..ebe35714 100644 --- a/meta/3rd/lovr/library/lovr/audio.lua +++ b/meta/3rd/lovr/library/lovr/audio.lua @@ -271,6 +271,7 @@ function lovr.audio.setGeometry(vertices, indices, material) end --- ---Sets the orientation of the virtual audio listener in angle/axis representation. --- +---@overload fun(orientation: lovr.Quat) ---@param angle number # The number of radians the listener should be rotated around its rotation axis. ---@param ax number # The x component of the axis of rotation. ---@param ay number # The y component of the axis of rotation. @@ -280,9 +281,14 @@ function lovr.audio.setOrientation(angle, ax, ay, az) end --- ---Sets the position and orientation of the virtual audio listener. --- ----@param x number # The x position of the listener, in meters. ----@param y number # The y position of the listener, in meters. ----@param z number # The z position of the listener, in meters. +--- +---### NOTE: +---The position of the listener doesn't use any specific units, but usually they can be thought of as meters to match the headset module. +--- +---@overload fun(position: lovr.Vec3, orientation: lovr.Quat) +---@param x number # The x position of the listener. +---@param y number # The y position of the listener. +---@param z number # The z position of the listener. ---@param angle number # The number of radians the listener is rotated around its axis of rotation. ---@param ax number # The x component of the axis of rotation. ---@param ay number # The y component of the axis of rotation. @@ -290,8 +296,11 @@ function lovr.audio.setOrientation(angle, ax, ay, az) end function lovr.audio.setPose(x, y, z, angle, ax, ay, az) end --- ----Sets the position of the virtual audio listener, in meters. +---Sets the position of the virtual audio listener. +--- +---The position doesn't have any specific units, but usually they can be thought of as meters, to match the headset module. --- +---@overload fun(position: lovr.Vec3) ---@param x number # The x position of the listener. ---@param y number # The y position of the listener. ---@param z number # The z position of the listener. @@ -612,6 +621,7 @@ function Source:setLooping(loop) end --- ---Sets the orientation of the Source in angle/axis representation. --- +---@overload fun(self: lovr.Source, orientation: lovr.Quat) ---@param angle number # The number of radians the Source should be rotated around its rotation axis. ---@param ax number # The x component of the axis of rotation. ---@param ay number # The y component of the axis of rotation. @@ -635,9 +645,14 @@ function Source:setPitch(pitch) end --- ---Sets the position and orientation of the Source. --- ----@param x number # The x position of the Source, in meters. ----@param y number # The y position of the Source, in meters. ----@param z number # The z position of the Source, in meters. +--- +---### NOTE: +---The position doesn't have any defined units, but meters are used by convention. +--- +---@overload fun(self: lovr.Source, position: lovr.Vec3, orientation: lovr.Quat) +---@param x number # The x position of the Source. +---@param y number # The y position of the Source. +---@param z number # The z position of the Source. ---@param angle number # The number of radians the Source is rotated around its axis of rotation. ---@param ax number # The x component of the axis of rotation. ---@param ay number # The y component of the axis of rotation. @@ -645,7 +660,7 @@ function Source:setPitch(pitch) end function Source:setPose(x, y, z, angle, ax, ay, az) end --- ----Sets the position of the Source, in meters. +---Sets the position of the Source. --- ---Setting the position will cause the Source to be distorted and attenuated based on its position relative to the listener. --- @@ -653,9 +668,14 @@ function Source:setPose(x, y, z, angle, ax, ay, az) end --- ---Setting the position of a stereo Source will cause an error. --- ----@param x number # The x coordinate. ----@param y number # The y coordinate. ----@param z number # The z coordinate. +--- +---### NOTE: +---The position doesn't have any defined units, but meters are used by convention. +--- +---@overload fun(self: lovr.Source, position: lovr.Vec3) +---@param x number # The x coordinate of the position. +---@param y number # The y coordinate of the position. +---@param z number # The z coordinate of the position. function Source:setPosition(x, y, z) end --- diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua index 8157bdb2..b0833fea 100644 --- a/meta/3rd/lovr/library/lovr/graphics.lua +++ b/meta/3rd/lovr/library/lovr/graphics.lua @@ -332,11 +332,22 @@ function lovr.graphics.getLimits() end ---### NOTE: ---Fun facts about render passes: --- ----- Textures must have the same dimensions, layer counts, and sample counts. ---- Textures must have been created with the `render` `TextureUsage`. +---- Textures must have the same dimensions, layer counts, and sample counts. +---- When rendering to textures with multiple layers, each draw will be broadcast to all layers. +--- Render passes have multiple "views" (cameras), and each layer uses a corresponding view, +--- allowing each layer to be rendered from a different viewpoint. +--- +---This enables fast stereo +--- rendering, but can also be used to efficiently render to cubemaps. +--- +---The `ViewIndex` variable +--- can also be used in shaders to set up any desired per-view behavior. ---- If `mipmap` is true, then any textures with mipmaps must have the `transfer` `TextureUsage`. ---- It's okay to have zero color textures, but in this case there must be a depth texture. ---- Setting `clear` to `false` for textures is usually very slow on mobile GPUs. +---- It's possible to render to a specific mipmap level of a Texture, or a subset of its layers, by +--- rendering to texture views, see `Texture:newView`. --- ---For `compute` and `transfer` passes, all of the commands in the pass act as though they run in parallel. --- @@ -1277,10 +1288,6 @@ function Model:getNodePosition(index, space) end --- ---Returns the scale of a node. --- ---- ----### NOTE: ----For best results when animating, it's recommended to keep the 3 components of the scale the same. ---- ---@overload fun(self: lovr.Model, name: string, origin?: lovr.OriginType):number, number, number ---@param index number # The index of the node. ---@param origin? lovr.OriginType # Whether the scale should be returned relative to the root node or the node's parent. @@ -1397,56 +1404,103 @@ function Model:resetNodeTransforms() end --- ---Sets or blends the orientation of a node to a new orientation. --- ----@overload fun(self: lovr.Model, name: string, orientation: lovr.rotation, blend?: number) +---This sets the local orientation of the node, relative to its parent. +--- +---@overload fun(self: lovr.Model, name: string, angle: number, ax: number, ay: number, az: number, blend?: number) +---@overload fun(self: lovr.Model, index: number, orientation: lovr.Quat, blend?: number) +---@overload fun(self: lovr.Model, name: string, orientation: lovr.Quat, blend?: number) ---@param index number # The index of the node. ----@param orientation lovr.rotation # The target orientation. +---@param angle number # The number of radians the node should be rotated around its rotation axis. +---@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 blend? number # A number from 0 to 1 indicating how much of the target orientation to blend in. A value of 0 will not change the node's orientation at all, whereas 1 will fully blend to the target orientation. -function Model:setNodeOrientation(index, orientation, blend) end +function Model:setNodeOrientation(index, angle, ax, ay, az, blend) end --- ---Sets or blends the pose (position and orientation) of a node to a new pose. --- +---This sets the local pose of the node, relative to its parent. +--- +---The scale will remain unchanged. +--- +---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, angle: number, ax: number, ay: number, az: number, blend?: number) +---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, orientation: lovr.Quat, blend?: number) ---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, orientation: lovr.Quat, blend?: number) ---@param index number # The index of the node. ----@param position lovr.Vec3 # The target position. Can also be provided as 3 numbers. ----@param orientation lovr.Quat # The target orientation. Can also be provided as 4 numbers in angle-axis form. +---@param x number # The x component of the position. +---@param y number # The y component of the position. +---@param z number # The z component of the position. +---@param angle number # The number of radians the node should be rotated around its rotation axis. +---@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 blend? number # A number from 0 to 1 indicating how much of the target pose to blend in. A value of 0 will not change the node's pose at all, whereas 1 will fully blend to the target pose. -function Model:setNodePose(index, position, orientation, blend) end +function Model:setNodePose(index, x, y, z, angle, ax, ay, az, blend) end --- ----Sets or blends the position of a node to a new position. +---Sets or blends the position of a node. --- +---This sets the local position of the node, relative to its parent. +--- +---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, blend?: number) +---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, blend?: number) ---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, blend?: number) ---@param index number # The index of the node. ----@param position lovr.Vec3 # The target position. Can also be provided as 3 numbers. ----@param blend? number # A number from 0 to 1 indicating how much of the target position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position. -function Model:setNodePosition(index, position, blend) end +---@param x number # The x coordinate of the new position. +---@param y number # The y coordinate of the new position. +---@param z number # The z coordinate of the new position. +---@param blend? number # A number from 0 to 1 indicating how much of the new position to blend in. A value of 0 will not change the node's position at all, whereas 1 will fully blend to the target position. +function Model:setNodePosition(index, x, y, z, blend) end --- ---Sets or blends the scale of a node to a new scale. --- +---This sets the local scale of the node, relative to its parent. +--- --- ---### NOTE: ----For best results when animating, it's recommended to keep the 3 components of the scale the same. +---For best results when animating, it's recommended to keep the 3 scale components the same. --- +---@overload fun(self: lovr.Model, name: string, sx: number, sy: number, sz: number, blend?: number) +---@overload fun(self: lovr.Model, index: number, scale: lovr.Vec3, blend?: number) ---@overload fun(self: lovr.Model, name: string, scale: lovr.Vec3, blend?: number) ---@param index number # The index of the node. ----@param scale lovr.Vec3 # The target scale. Can also be provided as 3 numbers. ----@param blend? number # A number from 0 to 1 indicating how much of the target scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale. -function Model:setNodeScale(index, scale, blend) end +---@param sx number # The x scale. +---@param sy number # The y scale. +---@param sz number # The z scale. +---@param blend? number # A number from 0 to 1 indicating how much of the new scale to blend in. A value of 0 will not change the node's scale at all, whereas 1 will fully blend to the target scale. +function Model:setNodeScale(index, sx, sy, sz, blend) end --- ---Sets or blends the transform of a node to a new transform. --- +---This sets the local transform of the node, relative to its parent. +--- --- ---### NOTE: ---For best results when animating, it's recommended to keep the 3 components of the scale the same. --- +---Even though the translation, scale, and rotation parameters are given in TSR order, they are applied in the normal TRS order. +--- +---@overload fun(self: lovr.Model, name: string, x: number, y: number, z: number, sx: number, sy: number, sz: number, angle: number, ax: number, ay: number, az: number, blend?: number) +---@overload fun(self: lovr.Model, index: number, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, blend?: number) +---@overload fun(self: lovr.Model, name: string, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, blend?: number) +---@overload fun(self: lovr.Model, index: number, transform: lovr.Mat4, blend?: number) ---@overload fun(self: lovr.Model, name: string, transform: lovr.Mat4, blend?: number) ---@param index number # The index of the node. ----@param transform lovr.Mat4 # The target transform. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers, with 3 scale components. +---@param x number # The x component of the position. +---@param y number # The y component of the position. +---@param z number # The z component of the position. +---@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 angle number # The number of radians the node should be rotated around its rotation axis. +---@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 blend? number # A number from 0 to 1 indicating how much of the target transform to blend in. A value of 0 will not change the node's transform at all, whereas 1 will fully blend to the target transform. -function Model:setNodeTransform(index, transform, blend) end +function Model:setNodeTransform(index, x, y, z, sx, sy, sz, angle, ax, ay, az, blend) end --- ---Pass objects are used to record commands for the GPU. @@ -1509,9 +1563,20 @@ function Pass:blit(src, dst, srcx, srcy, srcz, dstx, dsty, dstz, srcw, srch, src --- ---This is like `Pass:cube`, except it takes 3 separate values for the scale. --- ----@param transform lovr.Mat4 # The transform of the box. Can also be provided as position, 3-component scale, and rotation using a mix of `Vectors` or numbers. +---@overload fun(self: lovr.Pass, position: lovr.Vec3, size: lovr.Vec3, orientation: lovr.Quat, style?: lovr.DrawStyle) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle) +---@param x? number # The x coordinate of the center of the box. +---@param y? number # The y coordinate of the center of the box. +---@param z? number # The z coordinate of the center of the box. +---@param width? number # The width of the box. +---@param height? number # The height of the box. +---@param depth? number # The depth of the box. +---@param angle? number # The rotation of the box 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 style? lovr.DrawStyle # Whether the box should be drawn filled or outlined. -function Pass:box(transform, style) end +function Pass:box(x, y, z, width, height, depth, angle, ax, ay, az, style) end --- ---Draws a capsule. @@ -1524,10 +1589,20 @@ function Pass:box(transform, style) end --- ---The local origin of the capsule is in the center, and the local z axis points towards the end caps. --- +---@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 transform lovr.Mat4 # The transform of the capsule. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length. +---@param x? number # The x coordinate of the center of the capsule. +---@param y? number # The y coordinate of the center of the capsule. +---@param z? number # The z coordinate of the center of the capsule. +---@param radius? number # The radius of the capsule. +---@param length? number # The length of the capsule. +---@param angle? number # The rotation of the capsule 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 segments? number # The number of circular segments to render. -function Pass:capsule(transform, segments) end +function Pass:capsule(x, y, z, radius, length, angle, ax, ay, az, segments) end --- ---Draws a circle. @@ -1536,14 +1611,23 @@ function Pass:capsule(transform, segments) end ---### NOTE: ---The local origin of the circle is in its center. --- ----The local z axis is perpendicular to plane of the circle. ---- ----@param transform lovr.Mat4 # The transform of the circle. Can also be provided as position, radius, and rotation, using a mix of `Vectors` or numbers. +---The local z axis is perpendicular to the circle. +--- +---@overload fun(self: lovr.Pass, position: lovr.Vec3, radius?: number, orientation: lovr.Quat, style?: lovr.DrawStyle, angle1?: number, angle2?: number, segments?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle, angle1?: number, angle2?: number, segments?: number) +---@param x? number # The x coordinate of the center of the circle. +---@param y? number # The y coordinate of the center of the circle. +---@param z? number # The z coordinate of the center of the circle. +---@param radius? number # The radius of the circle. +---@param angle? number # The rotation of the circle 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 style? lovr.DrawStyle # Whether the circle should be filled or outlined. ---@param angle1? number # The angle of the beginning of the arc. ---@param angle2? number # angle of the end of the arc. ---@param segments? number # The number of segments to render. -function Pass:circle(transform, style, angle1, angle2, segments) end +function Pass:circle(x, y, z, radius, angle, ax, ay, az, style, angle1, angle2, segments) end --- ---Clears a Buffer or Texture. @@ -1621,9 +1705,19 @@ function Pass:compute(x, y, z) end ---### NOTE: ---The local origin is at the center of the base of the cone, and the negative z axis points towards the tip. --- ----@param transform lovr.Mat4 # The transform of the cone. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length. +---@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) +---@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. +---@param radius? number # The radius of the cone. +---@param length? number # The length of the cone. +---@param angle? number # The rotation of the cone 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 segments? number # The number of segments in the cone. -function Pass:cone(transform, segments) end +function Pass:cone(x, y, z, radius, length, angle, ax, ay, az, segments) end --- ---Copies data to or between `Buffer` and `Texture` objects. @@ -1649,9 +1743,18 @@ function Pass:copy(table, bufferdst, srcindex, dstindex, count) end ---### NOTE: ---The local origin is in the center of the cube. --- ----@param transform lovr.Mat4 # The transform of the cube. Can also be provided as position, 1-component scale, and rotation using a mix of `Vectors` or numbers. +---@overload fun(self: lovr.Pass, position: lovr.Vec3, size?: number, orientation: lovr.Quat, style?: lovr.DrawStyle) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle) +---@param x? number # The x coordinate of the center of the cube. +---@param y? number # The y coordinate of the center of the cube. +---@param z? number # The z coordinate of the center of the cube. +---@param size? number # The size of the cube. +---@param angle? number # The rotation of the cube 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 style? lovr.DrawStyle # Whether the cube should be drawn filled or outlined. -function Pass:cube(transform, style) end +function Pass:cube(x, y, z, size, angle, ax, ay, az, style) end --- ---Draws a cylinder. @@ -1660,24 +1763,45 @@ function Pass:cube(transform, style) end ---### NOTE: ---The local origin is in the center of the cylinder, and the length of the cylinder is along the z axis. --- ----@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius: number, capped?: boolean, angle1?: number, angle2?: number, segments?: number) ----@param transform lovr.Mat4 # The transform of the cylinder. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the length. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the length. +---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, capped?: boolean, angle1?: number, angle2?: number, segments?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, capped?: boolean, angle1?: number, angle2?: number, segments?: number) +---@overload fun(self: lovr.Pass, p1: lovr.Vec3, p2: lovr.Vec3, radius?: number, capped?: boolean, angle1?: number, angle2?: number, segments?: number) +---@param x? number # The x coordinate of the center of the cylinder. +---@param y? number # The y coordinate of the center of the cylinder. +---@param z? number # The z coordinate of the center of the cylinder. +---@param radius? number # The radius of the cylinder. +---@param length? number # The length of the cylinder. +---@param angle? number # The rotation of the cylinder 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 capped? boolean # Whether the tops and bottoms of the cylinder should be rendered. ---@param angle1? number # The angle of the beginning of the arc. ---@param angle2? number # angle of the end of the arc. ---@param segments? number # The number of circular segments to render. -function Pass:cylinder(transform, capped, angle1, angle2, segments) end +function Pass:cylinder(x, y, z, radius, length, angle, ax, ay, az, capped, angle1, angle2, segments) end --- ---Draws a model. --- +---@overload fun(self: lovr.Pass, model: lovr.Model, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, nodeindex?: number, children?: boolean, instances?: number) +---@overload fun(self: lovr.Pass, model: lovr.Model, transform: lovr.Mat4, nodeindex?: number, children?: boolean, instances?: number) +---@overload fun(self: lovr.Pass, model: lovr.Model, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, nodename?: string, children?: boolean, instances?: number) +---@overload fun(self: lovr.Pass, model: lovr.Model, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, nodename?: string, children?: boolean, instances?: number) ---@overload fun(self: lovr.Pass, model: lovr.Model, transform: lovr.Mat4, nodename?: string, children?: boolean, instances?: number) ---@param model lovr.Model # The model to draw. ----@param transform lovr.Mat4 # The transform of the model. Can also be provided as a position, 1-component scale, and rotation using a combination of `Vectors` and numbers. +---@param x? number # The x coordinate to draw the model at. +---@param y? number # The y coordinate to draw the model at. +---@param z? number # The z coordinate to draw the model at. +---@param scale? number # The scale of the model. +---@param angle? number # The rotation of the model 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 nodeindex? number # The index of the node to draw. If nil, the root node is drawn. ---@param children? boolean # Whether the children of the node should be drawn. ---@param instances? number # The number of instances to draw. -function Pass:draw(model, transform, nodeindex, children, instances) end +function Pass:draw(model, x, y, z, scale, angle, ax, ay, az, nodeindex, children, instances) end --- ---Draws a fullscreen triangle. @@ -1823,21 +1947,31 @@ function Pass:line(x1, y1, z1, x2, y2, z2, ...) end --- ---It can be used to reorder, reuse, or omit vertices from the mesh. --- +---When drawing without a vertex buffer, the `VertexIndex` variable can be used in shaders to compute the position of each vertex, possibly by reading data from other `Buffer` or `Texture` resources. +--- ---The active `MeshMode` controls whether the vertices are drawn as points, lines, or triangles. --- ---The active `Material` is applied to the mesh. --- +---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, position: lovr.Vec3, scales: lovr.Vec3, orientation: lovr.Quat, start?: number, count?: number, instances?: number) +---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, transform: lovr.Mat4, start?: number, count?: number, instances?: number) +---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, start?: number, count?: number, instances?: number, base?: number) +---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, position: lovr.Vec3, scales: lovr.Vec3, orientation: lovr.Quat, start?: number, count?: number, instances?: number, base?: number) ---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, transform: lovr.Mat4, start?: number, count?: number, instances?: number, base?: number) ---@overload fun(self: lovr.Pass, vertices?: lovr.Buffer, indices: lovr.Buffer, draws: lovr.Buffer, drawcount: number, offset: number, stride: number) ----@overload fun(self: lovr.Pass, vertexcount: number, transform: lovr.Mat4) ----@overload fun(self: lovr.Pass, vertexcount: number, indices: lovr.Buffer, transform: lovr.Mat4) ---@param vertices? lovr.Buffer # The buffer containing the vertices to draw. ----@param transform lovr.Mat4 # The transform to apply to the mesh. Can also be provided as a position, 1-component scale, and rotation using a combination of `Vectors` and numbers. +---@param x? number # The x coordinate of the position to draw the mesh at. +---@param y? number # The y coordinate of the position to draw the mesh at. +---@param z? number # The z coordinate of the position to draw the mesh at. +---@param scale? number # The scale of the mesh. +---@param angle? number # The number of radians the mesh is rotated around its rotational axis. +---@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 start? number # The 1-based index of the first vertex to render from the vertex buffer (or the first index, when using an index buffer). ---@param count? number # The number of vertices to render (or the number of indices, when using an index buffer). When `nil`, as many vertices or indices as possible will be drawn (based on the length of the Buffers and `start`). ---@param instances? number # The number of copies of the mesh to render. ----@param base? number # A base offset to apply to vertex indices. -function Pass:mesh(vertices, transform, start, count, instances, base) end +function Pass:mesh(vertices, x, y, z, scale, angle, ax, ay, az, start, count, instances) end --- ---Generates mipmaps for a texture. @@ -1859,11 +1993,21 @@ function Pass:origin() end --- ---Draws a plane. --- ----@param transform lovr.Mat4 # The transform of the plane. Can also be provided as a position, 2-component scale, and rotation using a combination of `Vectors`, and numbers. +---@overload fun(self: lovr.Pass, position: lovr.Vec3, size: lovr.Vec2, orientation: lovr.Quat, style?: lovr.DrawStyle, columns?: number, rows?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, style?: lovr.DrawStyle, columns?: number, rows?: number) +---@param x? number # The x coordinate of the center of the plane. +---@param y? number # The y coordinate of the center of the plane. +---@param z? number # The z coordinate of the center of the plane. +---@param width? number # The width of the plane. +---@param height? number # The height of the plane. +---@param angle? number # The rotation of the plane 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 style? lovr.DrawStyle # Whether the plane should be drawn filled or outlined. ---@param columns? number # The number of horizontal segments in the plane. ---@param rows? number # The number of vertical segments in the plane. -function Pass:plane(transform, style, columns, rows) end +function Pass:plane(x, y, z, width, height, angle, ax, ay, az, style, columns, rows) end --- ---Draws points. @@ -1930,14 +2074,21 @@ function Pass:read(buffer, index, count) end --- ---Rotates the coordinate system. --- ----@param rotation lovr.Quat # A quaternion containing the rotation to apply. Can also be provided as 4 numbers in angle-axis representation. -function Pass:rotate(rotation) end +---@overload fun(self: lovr.Pass, rotation: lovr.Quat) +---@param angle number # The amount to rotate the coordinate system by, 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. +function Pass:rotate(angle, ax, ay, az) end --- ---Scales the coordinate system. --- ----@param scale lovr.Vec3 # The scale to apply to the coordinate system. Can also be provided as 1 or 3 numbers. -function Pass:scale(scale) end +---@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. +function Pass:scale(sx, sy, sz) end --- ---Sends a value to a variable in the Pass's active `Shader`. @@ -1957,12 +2108,14 @@ function Pass:scale(scale) end ---@overload fun(self: lovr.Pass, name: string, texture: lovr.Texture) ---@overload fun(self: lovr.Pass, name: string, sampler: lovr.Sampler) ---@overload fun(self: lovr.Pass, name: string, constant: any) ----@overload fun(self: lovr.Pass, binding: number, buffer: lovr.Buffer) +---@overload fun(self: lovr.Pass, binding: number, buffer: lovr.Buffer, offset?: number, extent?: number) ---@overload fun(self: lovr.Pass, binding: number, texture: lovr.Texture) ---@overload fun(self: lovr.Pass, binding: number, sampler: lovr.Sampler) ---@param name string # The name of the Shader variable. ---@param buffer lovr.Buffer # The Buffer to assign. -function Pass:send(name, buffer) end +---@param offset? number # An offset from the start of the buffer where data will be read, in bytes. +---@param extent? number # The number of bytes that will be available for reading. If zero, as much data as possible will be bound, depending on the offset, buffer size, and the `uniformBufferRange` or `storageBufferRange` limit. +function Pass:send(name, buffer, offset, extent) end --- ---Sets whether alpha to coverage is enabled. @@ -2226,6 +2379,10 @@ function Pass:setShader(shader) end ---### NOTE: ---The stencil test is disabled by default. --- +---Setting the stencil test requires the `Pass` to have a depth texture with the `d24s8` or `d32fs8` format (the `s` means "stencil"). +--- +---The `t.graphics.stencil` and `t.headset.stencil` flags in `lovr.conf` can be used to request a stencil format for the default window and headset passes, respectively. +--- ---@overload fun(self: lovr.Pass) ---@param test lovr.CompareMode # The new stencil test to use. ---@param value number # The stencil value to compare against. @@ -2241,6 +2398,10 @@ function Pass:setStencilTest(test, value, mask) end ---### NOTE: ---By default, stencil writes are disabled. --- +---Setting the stencil test requires the `Pass` to have a depth texture with the `d24s8` or `d32fs8` format (the `s` means "stencil"). +--- +---The `t.graphics.stencil` and `t.headset.stencil` flags in `lovr.conf` can be used to request a stencil format for the default window and headset passes, respectively. +--- ---@overload fun(self: lovr.Pass, actions: table, value?: number, mask?: number) ---@overload fun(self: lovr.Pass) ---@param action lovr.StencilAction # How pixels drawn will update the stencil buffer. @@ -2259,6 +2420,7 @@ function Pass:setStencilWrite(action, value, mask) end --- ---These view poses are also available using `lovr.headset.getViewPose`. --- +---@overload fun(self: lovr.Pass, view: number, position: lovr.Vec3, orientation: lovr.Quat) ---@overload fun(self: lovr.Pass, view: number, matrix: lovr.Mat4, inverted: boolean) ---@param view number # The index of the view to update. ---@param x number # The x position of the viewer, in meters. @@ -2343,10 +2505,19 @@ function Pass:skybox(skybox) end ---### NOTE: ---The local origin of the sphere is in its center. --- ----@param transform lovr.Mat4 # The transform of the sphere. Can also be provided as a position, radius, and rotation using a mix of `Vectors and numbers.' +---@overload fun(self: lovr.Pass, position: lovr.Vec3, radius?: number, orientation: lovr.Quat, longitudes?: number, latitudes?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, longitudes?: number, latitudes?: number) +---@param x? number # The x coordinate of the center of the sphere. +---@param y? number # The y coordinate of the center of the sphere. +---@param z? number # The z coordinate of the center of the sphere. +---@param radius? number # The radius of the sphere. +---@param angle? number # The rotation of the sphere 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 longitudes? number # The number of "horizontal" segments. ---@param latitudes? number # The number of "vertical" segments. -function Pass:sphere(transform, longitudes, latitudes) end +function Pass:sphere(x, y, z, radius, angle, ax, ay, az, longitudes, latitudes) end --- ---Draws text. @@ -2373,13 +2544,24 @@ function Pass:sphere(transform, longitudes, latitudes) end --- ---This function can draw up to 16384 visible characters at a time, and will currently throw an error if the string is too long. --- +---@overload fun(self: lovr.Pass, text: string, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) +---@overload fun(self: lovr.Pass, text: string, transform: lovr.Mat4, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) +---@overload fun(self: lovr.Pass, colortext: table, x?: number, y?: number, z?: number, scale?: number, angle?: number, ax?: number, ay?: number, az?: number, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) +---@overload fun(self: lovr.Pass, colortext: table, position: lovr.Vec3, scale?: number, orientation: lovr.Quat, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) ---@overload fun(self: lovr.Pass, colortext: table, transform: lovr.Mat4, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) ---@param text string # The text to render. ----@param transform lovr.Mat4 # The transform of the text. Can also be provided as position, 1-component scale, and rotation using a mix of `Vectors` or numbers. +---@param x? number # The x coordinate of the text origin. +---@param y? number # The y coordinate of the text origin. +---@param z? number # The z coordinate of the text origin. +---@param scale? number # The scale of the text (with the default pixel density, units are meters). +---@param angle? number # The rotation of the text 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 wrap? number # The maximum width of each line in meters (before scale is applied). When zero, the text will not wrap. ----@param halign? lovr.HorizontalAlign # The horizontal alignment. ----@param valign? lovr.VerticalAlign # The vertical alignment. -function Pass:text(text, transform, wrap, halign, valign) end +---@param halign? lovr.HorizontalAlign # The horizontal alignment relative to the text origin. +---@param valign? lovr.VerticalAlign # The vertical alignment relative to the text origin. +function Pass:text(text, x, y, z, scale, angle, ax, ay, az, wrap, halign, valign) end --- ---Starts a GPU measurement. @@ -2416,16 +2598,37 @@ function Pass:tock(tally, slot) end ---### NOTE: ---The local origin is in the center of the torus, and the torus forms a circle around the local Z axis. --- ----@param transform lovr.Mat4 # The transform of the torus. Can also be provided as position, scale, and rotation using a mix of `Vectors` or numbers. When using numbers for the scale, 2 should be provided: one for the radius and one for the thickness. When using a matrix or a vector for the scale, the X and Y components are the radius and the Z component is the thickness. +---@overload fun(self: lovr.Pass, position: lovr.Vec3, scale: lovr.Vec3, orientation: lovr.Quat, tsegments?: number, psegments?: number) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4, tsegments?: number, psegments?: number) +---@param x? number # The x coordinate of the center of the torus. +---@param y? number # The y coordinate of the center of the torus. +---@param z? number # The z coordinate of the center of the torus. +---@param radius? number # The radius of the torus. +---@param thickness? number # The thickness of the torus. +---@param angle? number # The rotation of the torus 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 tsegments? number # The number of toroidal (circular) segments to render. ---@param psegments? number # The number of poloidal (tubular) segments to render. -function Pass:torus(transform, tsegments, psegments) end +function Pass:torus(x, y, z, radius, thickness, angle, ax, ay, az, tsegments, psegments) end --- ---Transforms the coordinate system. --- ----@param transform lovr.Mat4 # A matrix containing the transformation to apply to the coordinate system. Can also be provided as a position, 3-component scale, and rotation, using a mix of `Vectors` or numbers. -function Pass:transform(transform) end +---@overload fun(self: lovr.Pass, translation: lovr.Vec3, scale: lovr.Vec3, rotation: lovr.Quat) +---@overload fun(self: lovr.Pass, transform: lovr.Mat4) +---@param x number # The x component of the translation. +---@param y number # The y component of the translation. +---@param z number # The z component of the translation. +---@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 angle number # The amount to rotate the coordinate system by, 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. +function Pass:transform(x, y, z, sx, sy, sz, angle, ax, ay, az) end --- ---Translates the coordinate system. @@ -2434,8 +2637,11 @@ function Pass:transform(transform) end ---### NOTE: ---Order matters when scaling, translating, and rotating the coordinate system. --- ----@param translation lovr.Vec3 # The translation to apply to the coordinate system. Can also be provided as 3 numbers. -function Pass:translate(translation) end +---@overload fun(self: lovr.Pass, translation: lovr.Vec3) +---@param x number # The x component of the translation. +---@param y number # The y component of the translation. +---@param z number # The z component of the translation. +function Pass:translate(x, y, z) end --- ---Readbacks track the progress of an asynchronous read of a `Buffer`, `Texture`, or `Tally`. diff --git a/meta/3rd/lovr/library/lovr/math.lua b/meta/3rd/lovr/library/lovr/math.lua index 1b3a401d..e3aa426a 100644 --- a/meta/3rd/lovr/library/lovr/math.lua +++ b/meta/3rd/lovr/library/lovr/math.lua @@ -61,6 +61,7 @@ function lovr.math.mat4() end --- ---Creates a new `Curve` from a list of control points. --- +---@overload fun(v: lovr.Vec3, ...):lovr.Curve ---@overload fun(points: table):lovr.Curve ---@overload fun(n: number):lovr.Curve ---@param x number # The x coordinate of the first control point. @@ -491,8 +492,10 @@ 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, position?: lovr.Vec3, scale?: lovr.Vec3, rotation?: lovr.Quat):lovr.Mat4 ----@overload fun(self: lovr.Mat4, position?: lovr.Vec3, rotation?: lovr.Quat):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 +---@overload fun(self: lovr.Mat4, position: lovr.Vec3, rotation: lovr.Quat):lovr.Mat4 ---@overload fun(self: lovr.Mat4, ...):lovr.Mat4 ---@overload fun(self: lovr.Mat4, d: number):lovr.Mat4 ---@return lovr.Mat4 m # The input matrix. diff --git a/meta/3rd/lovr/library/lovr/physics.lua b/meta/3rd/lovr/library/lovr/physics.lua index 4563a328..6d635c2b 100644 --- a/meta/3rd/lovr/library/lovr/physics.lua +++ b/meta/3rd/lovr/library/lovr/physics.lua @@ -15,6 +15,7 @@ lovr.physics = {} --- ---It tries to keep the distance between the colliders and the anchor position the same, but does not constrain the angle between them. --- +---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, anchor: lovr.Vec3):lovr.BallJoint ---@param colliderA lovr.Collider # The first collider to attach the Joint to. ---@param colliderB lovr.Collider # The second collider to attach the Joint to. ---@param x number # The x position of the joint anchor point, in world coordinates. @@ -73,6 +74,7 @@ function lovr.physics.newCylinderShape(radius, length) end --- ---The joint allows for rotation on the anchor points. --- +---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, first: lovr.Vec3, second: lovr.Vec3):lovr.DistanceJoint ---@param colliderA lovr.Collider # The first collider to attach the Joint to. ---@param colliderB lovr.Collider # The second collider to attach the Joint to. ---@param x1 number # The x position of the first anchor point, in world coordinates. @@ -91,14 +93,15 @@ function lovr.physics.newDistanceJoint(colliderA, colliderB, x1, y1, z1, x2, y2, ---### NOTE: ---A hinge joint constrains two colliders to allow rotation only around the hinge's axis. --- +---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, anchor: lovr.Vec3, axis: lovr.Vec3):lovr.HingeJoint ---@param colliderA lovr.Collider # The first collider to attach the Joint to. ---@param colliderB lovr.Collider # The second collider to attach the Joint to. ---@param x number # The x position of the hinge anchor, in world coordinates. ---@param y number # The y position of the hinge anchor, in world coordinates. ---@param z number # The z position of the hinge anchor, in world coordinates. ----@param ax number # The x component of the hinge axis. ----@param ay number # The y component of the hinge axis. ----@param az number # The z component of the hinge axis. +---@param ax number # The x component of the hinge axis direction. +---@param ay number # The y component of the hinge axis direction. +---@param az number # The z component of the hinge axis direction. ---@return lovr.HingeJoint hinge # The new HingeJoint. function lovr.physics.newHingeJoint(colliderA, colliderB, x, y, z, ax, ay, az) end @@ -122,6 +125,7 @@ function lovr.physics.newMeshShape(vertices, indices) end ---### NOTE: ---A slider joint constrains two colliders to only allow movement along the slider's axis. --- +---@overload fun(colliderA: lovr.Collider, colliderB: lovr.Collider, axis: lovr.Vec3):lovr.SliderJoint ---@param colliderA lovr.Collider # The first collider to attach the Joint to. ---@param colliderB lovr.Collider # The second collider to attach the Joint to. ---@param ax number # The x component of the slider axis. @@ -211,6 +215,7 @@ function BallJoint:getTightness() end --- ---Sets a new anchor point for the BallJoint. --- +---@overload fun(self: lovr.BallJoint, anchor: lovr.Vec3) ---@param x number # The x coordinate of the anchor point, in world coordinates. ---@param y number # The y coordinate of the anchor point, in world coordinates. ---@param z number # The z coordinate of the anchor point, in world coordinates. @@ -308,6 +313,8 @@ function Collider:addShape(shape) end ---If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any affect. --- ---@overload fun(self: lovr.Collider, x: number, y: number, z: number, px: number, py: number, pz: number) +---@overload fun(self: lovr.Collider, force: lovr.Vec3) +---@overload fun(self: lovr.Collider, force: lovr.Vec3, position: lovr.Vec3) ---@param x number # The x component of the force to apply. ---@param y number # The y component of the force to apply. ---@param z number # The z component of the force to apply. @@ -320,6 +327,7 @@ function Collider:applyForce(x, y, z) end ---### NOTE: ---If the Collider is asleep, it will need to be woken up with `Collider:setAwake` for this function to have any effect. --- +---@overload fun(self: lovr.Collider, torque: lovr.Vec3) ---@param x number # The x component of the torque. ---@param y number # The y component of the torque. ---@param z number # The z component of the torque. @@ -414,6 +422,7 @@ function Collider:getLinearVelocity() end --- ---Returns the linear velocity of a point relative to the Collider. --- +---@overload fun(self: lovr.Collider, point: number):number, number, number ---@param x number # The x coordinate. ---@param y number # The y coordinate. ---@param z number # The z coordinate. @@ -425,6 +434,7 @@ function Collider:getLinearVelocityFromLocalPoint(x, y, z) end --- ---Returns the linear velocity of a point on the Collider specified in world space. --- +---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number ---@param x number # The x coordinate in world space. ---@param y number # The y coordinate in world space. ---@param z number # The z coordinate in world space. @@ -444,6 +454,7 @@ function Collider:getLocalCenter() end --- ---Converts a point from world coordinates into local coordinates relative to the Collider. --- +---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number ---@param wx number # The x coordinate of the world point. ---@param wy number # The y coordinate of the world point. ---@param wz number # The z coordinate of the world point. @@ -455,6 +466,7 @@ function Collider:getLocalPoint(wx, wy, wz) end --- ---Converts a direction vector from world space to local space. --- +---@overload fun(self: lovr.Collider, vector: lovr.Vec3):number, number, number ---@param wx number # The x component of the world vector. ---@param wy number # The y component of the world vector. ---@param wz number # The z component of the world vector. @@ -559,6 +571,7 @@ function Collider:getWorld() end --- ---Convert a point relative to the collider to a point in world coordinates. --- +---@overload fun(self: lovr.Collider, point: lovr.Vec3):number, number, number ---@param x number # The x position of the point. ---@param y number # The y position of the point. ---@param z number # The z position of the point. @@ -570,6 +583,7 @@ function Collider:getWorldPoint(x, y, z) end --- ---Converts a direction vector from local space to world space. --- +---@overload fun(self: lovr.Collider, vector: lovr.Vec3):number, number, number ---@param x number # The x coordinate of the local vector. ---@param y number # The y coordinate of the local vector. ---@param z number # The z coordinate of the local vector. @@ -642,6 +656,7 @@ function Collider:setAngularDamping(damping, threshold) end --- ---Sets the angular velocity of the Collider. --- +---@overload fun(self: lovr.Collider, velocity: lovr.Vec3) ---@param vx number # The x component of the angular velocity. ---@param vy number # The y component of the angular velocity. ---@param vz number # The z component of the angular velocity. @@ -703,6 +718,7 @@ function Collider:setLinearDamping(damping, threshold) end --- ---Usually it's preferred to use `Collider:applyForce` to change velocity since instantaneous velocity changes can lead to weird glitches. --- +---@overload fun(self: lovr.Collider, velocity: lovr.Vec3) ---@param vx number # The x velocity of the Collider, in meters per second. ---@param vy number # The y velocity of the Collider, in meters per second. ---@param vz number # The z velocity of the Collider, in meters per second. @@ -727,6 +743,7 @@ function Collider:setMassData(cx, cy, cz, mass, inertia) end --- ---Sets the orientation of the Collider in angle/axis representation. --- +---@overload fun(self: lovr.Collider, orientation: lovr.Quat) ---@param angle number # The number of radians the Collider is rotated around its axis of rotation. ---@param ax number # The x component of the axis of rotation. ---@param ay number # The y component of the axis of rotation. @@ -736,6 +753,7 @@ function Collider:setOrientation(angle, ax, ay, az) end --- ---Sets the position and orientation of the Collider. --- +---@overload fun(self: lovr.Collider, position: lovr.Vec3, orientation: lovr.Quat) ---@param x number # The x position of the Collider, in meters. ---@param y number # The y position of the Collider, in meters. ---@param z number # The z position of the Collider, in meters. @@ -748,6 +766,7 @@ function Collider:setPose(x, y, z, angle, ax, ay, az) end --- ---Sets the position of the Collider. --- +---@overload fun(self: lovr.Collider, position: lovr.Vec3) ---@param x number # The x position of the Collider, in meters. ---@param y number # The y position of the Collider, in meters. ---@param z number # The z position of the Collider, in meters. @@ -873,6 +892,7 @@ function DistanceJoint:getTightness() end --- ---Sets the anchor points of the DistanceJoint. --- +---@overload fun(self: lovr.DistanceJoint, first: lovr.Vec3, second: lovr.Vec3) ---@param x1 number # The x coordinate of the first anchor point, in world coordinates. ---@param y1 number # The y coordinate of the first anchor point, in world coordinates. ---@param z1 number # The z coordinate of the first anchor point, in world coordinates. @@ -966,6 +986,7 @@ function HingeJoint:getUpperLimit() end --- ---Sets a new anchor point for the HingeJoint. --- +---@overload fun(self: lovr.HingeJoint, anchor: lovr.Vec3) ---@param x number # The x coordinate of the anchor point, in world coordinates. ---@param y number # The y coordinate of the anchor point, in world coordinates. ---@param z number # The z coordinate of the anchor point, in world coordinates. @@ -974,6 +995,7 @@ function HingeJoint:setAnchor(x, y, z) end --- ---Sets the axis of the hinge. --- +---@overload fun(self: lovr.HingeJoint, axis: lovr.Vec3) ---@param x number # The x component of the axis. ---@param y number # The y component of the axis. ---@param z number # The z component of the axis. @@ -1179,6 +1201,7 @@ function Shape:setEnabled(enabled) end ---### NOTE: ---If the Shape isn't attached to a Collider, this will error. --- +---@overload fun(self: lovr.Shape, orientation: lovr.Quat) ---@param angle number # The number of radians the Shape is rotated. ---@param ax number # The x component of the rotation axis. ---@param ay number # The y component of the rotation axis. @@ -1192,6 +1215,7 @@ function Shape:setOrientation(angle, ax, ay, az) end ---### NOTE: ---If the Shape isn't attached to a Collider, this will error. --- +---@overload fun(self: lovr.Shape, position: lovr.Vec3) ---@param x number # The x offset. ---@param y number # The y offset. ---@param z number # The z offset. @@ -1257,6 +1281,7 @@ function SliderJoint:getUpperLimit() end --- ---Sets the axis of the slider. --- +---@overload fun(self: lovr.SliderJoint, axis: lovr.Vec3) ---@param x number # The x component of the axis. ---@param y number # The y component of the axis. ---@param z number # The z component of the axis. @@ -1503,6 +1528,7 @@ function World:isSleepingAllowed() end --- ---Adds a new Collider to the World with a BoxShape already attached. --- +---@overload fun(self: lovr.World, position: lovr.Vec3, size: lovr.Vec3):lovr.Collider ---@param x? number # The x coordinate of the center of the box. ---@param y? number # The y coordinate of the center of the box. ---@param z? number # The z coordinate of the center of the box. @@ -1515,9 +1541,10 @@ function World:newBoxCollider(x, y, z, width, height, depth) end --- ---Adds a new Collider to the World with a CapsuleShape already attached. --- ----@param x? number # The x coordinate of the center of the capsule. ----@param y? number # The y coordinate of the center of the capsule. ----@param z? number # The z coordinate of the center of the capsule. +---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number, length?: number):lovr.Collider +---@param x? number # The x coordinate of the center of the capsule, in meters. +---@param y? number # The y coordinate of the center of the capsule, in meters. +---@param z? number # The z coordinate of the center of the capsule, in meters. ---@param radius? number # The radius of the capsule, in meters. ---@param length? number # The length of the capsule, not including the caps, in meters. ---@return lovr.Collider collider # The new Collider. @@ -1537,6 +1564,7 @@ function World:newCapsuleCollider(x, y, z, radius, length) end ---- `World:newCylinderCollider` ---- `World:newSphereCollider` --- +---@overload fun(self: lovr.World, position: lovr.Vec3):lovr.Collider ---@param x? number # The x position of the Collider. ---@param y? number # The y position of the Collider. ---@param z? number # The z position of the Collider. @@ -1546,9 +1574,10 @@ function World:newCollider(x, y, z) end --- ---Adds a new Collider to the World with a CylinderShape already attached. --- ----@param x? number # The x coordinate of the center of the cylinder. ----@param y? number # The y coordinate of the center of the cylinder. ----@param z? number # The z coordinate of the center of the cylinder. +---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number, length?: number):lovr.Collider +---@param x? number # The x coordinate of the center of the cylinder, in meters. +---@param y? number # The y coordinate of the center of the cylinder, in meters. +---@param z? number # The z coordinate of the center of the cylinder, in meters. ---@param radius? number # The radius of the cylinder, in meters. ---@param length? number # The length of the cylinder, in meters. ---@return lovr.Collider collider # The new Collider. @@ -1566,9 +1595,10 @@ function World:newMeshCollider(vertices, indices) end --- ---Adds a new Collider to the World with a SphereShape already attached. --- ----@param x? number # The x coordinate of the center of the sphere. ----@param y? number # The y coordinate of the center of the sphere. ----@param z? number # The z coordinate of the center of the sphere. +---@overload fun(self: lovr.World, position: lovr.Vec3, radius?: number):lovr.Collider +---@param x? number # The x coordinate of the center of the sphere, in meters. +---@param y? number # The y coordinate of the center of the sphere, in meters. +---@param z? number # The z coordinate of the center of the sphere, in meters. ---@param radius? number # The radius of the sphere, in meters. ---@return lovr.Collider collider # The new Collider. function World:newSphereCollider(x, y, z, radius) end @@ -1603,6 +1633,7 @@ function World:overlaps() end ---### NOTE: ---The callback is passed the shape that was hit, the hit position (in world coordinates), and the normal vector of the hit. --- +---@overload fun(self: lovr.World, start: lovr.Vec3, end: lovr.Vec3, callback: function) ---@param x1 number # The x coordinate of the starting position of the ray. ---@param y1 number # The y coordinate of the starting position of the ray. ---@param z1 number # The z coordinate of the starting position of the ray. @@ -1628,6 +1659,7 @@ function World:setAngularDamping(damping, threshold) end --- ---Sets the gravity of the World. --- +---@overload fun(self: lovr.World, gravity: lovr.Vec3) ---@param xg number # The x component of the gravity force. ---@param yg number # The y component of the gravity force. ---@param zg number # The z component of the gravity force. -- cgit v1.2.3