diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2022-09-28 19:10:26 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2022-09-28 19:10:26 +0800 |
commit | b01133ed4c1b02105b2894eb596c5706fb633246 (patch) | |
tree | 2c2106238676ab8923705a4905e52c9521cd55d8 | |
parent | e9fee73b62132d7fd5554da6a8237c0adf04d75a (diff) | |
download | lua-language-server-b01133ed4c1b02105b2894eb596c5706fb633246.zip |
update submodules
m--------- | 3rd/bee.lua | 0 | ||||
m--------- | 3rd/lovr-api | 0 | ||||
m--------- | 3rd/luamake | 0 | ||||
-rw-r--r-- | meta/3rd/lovr/library/callback.lua | 5 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/graphics.lua | 261 | ||||
-rw-r--r-- | meta/3rd/lovr/library/lovr/headset.lua | 78 | ||||
-rw-r--r-- | meta/3rd/luassert/library/luassert/spy/d.lua (renamed from meta/3rd/luassert/library/luassert/spy.d.lua) | 0 |
7 files changed, 299 insertions, 45 deletions
diff --git a/3rd/bee.lua b/3rd/bee.lua -Subproject a749943aec6bdcb0a61370575f638372fec3dc4 +Subproject 986a732da91ae65407ca0508c69b55b80d0befd diff --git a/3rd/lovr-api b/3rd/lovr-api -Subproject 8df44c6049d8e31f1f4040db5d3007ebecea0c4 +Subproject eba1dc8765729f344b2b71e5fdd964840d9b207 diff --git a/3rd/luamake b/3rd/luamake -Subproject 637d16365f79f12e365fdbad6981ccd36f2b59a +Subproject 5f9396e838f5b71206aff0ea4c341e68a3ac3e6 diff --git a/meta/3rd/lovr/library/callback.lua b/meta/3rd/lovr/library/callback.lua index ee443fd1..1813f2a4 100644 --- a/meta/3rd/lovr/library/callback.lua +++ b/meta/3rd/lovr/library/callback.lua @@ -40,7 +40,10 @@ lovr.conf = nil ---Since the `lovr.graphics.submit` function always returns true, the following idiom can be used to submit graphics work manually and override the default submission: --- --- function lovr.draw(pass) ---- local passes = getPasses() +--- local passes = {} +--- +--- -- ... record multiple passes and add to passes table +--- --- return lovr.graphics.submit(passes) --- end --- diff --git a/meta/3rd/lovr/library/lovr/graphics.lua b/meta/3rd/lovr/library/lovr/graphics.lua index ef3209f5..ae32460b 100644 --- a/meta/3rd/lovr/library/lovr/graphics.lua +++ b/meta/3rd/lovr/library/lovr/graphics.lua @@ -940,7 +940,7 @@ function Font:getWidth(string) end --- ---Sets the line spacing of the Font. --- ----When spacing out lines, the height of the font is multiplied the line spacing to get the final spacing value. +---When spacing out lines, the height of the font is multiplied by the line spacing to get the final spacing value. --- ---The default is 1.0. --- @@ -948,7 +948,7 @@ function Font:getWidth(string) end function Font:setLineSpacing(spacing) end --- ----Returns the pixel density of the font. +---Sets the pixel density of the font. --- ---The density is a "pixels per world unit" factor that controls how the pixels in the font's texture are mapped to units in the coordinate space. --- @@ -2043,6 +2043,7 @@ function Pass:setFont(font) end --- ---This will apply to most drawing, except for text, skyboxes, and models, which use their own materials. --- +---@overload fun(self: lovr.Pass, texture: lovr.Texture) ---@overload fun(self: lovr.Pass) ---@param material lovr.Material # The material to use for drawing. function Pass:setMaterial(material) end @@ -2147,6 +2148,8 @@ function Pass:setScissor(x, y, w, h) end --- ---Samplers will use `linear` filtering and the `repeat` wrap mode. --- +---Changing the shader will not clear push constants set in the `Constants` block. +--- ---@overload fun(self: lovr.Pass, default: lovr.DefaultShader) ---@overload fun(self: lovr.Pass) ---@param shader lovr.Shader # The shader to use. @@ -2286,15 +2289,33 @@ function Pass:skybox(skybox) end function Pass:sphere(transform, longitudes, latitudes) end --- ----TODO +---Draws text. +--- +---The font can be changed using `Pass:setFont`. --- --- ---### NOTE: ----TODO +---Strings should be encoded as UTF-8. +--- +---Newlines will start a new line of text. +--- +---Tabs will be rendered as four spaces. +--- +---Carriage returns are ignored. +--- +---With the default font pixel density, a scale of 1.0 makes the text height 1 meter. --- ----@overload fun(self: lovr.Pass, colortext: table, transform: lovr.transform, wrap?: number, halign?: lovr.HorizontalAlign, valign?: lovr.VerticalAlign) +---The wrap value does not take into account the text's scale. +--- +---Text rendering requires a special shader, which will only be automatically used when the active shader is set to `nil`. +--- +---Blending should be enabled when rendering text (it's on by default). +--- +---This function can draw up to 16384 visible characters at a time. +--- +---@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.transform # The transform of the text. +---@param transform lovr.Mat4 # The transform of the text. ---@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. @@ -2305,7 +2326,7 @@ function Pass:text(text, transform, wrap, halign, valign) end --- ---One of the slots in a `Tally` object will be used to hold the result. Commands on the Pass will continue being measured until `Pass:tock` is called with the same tally and slot combination. --- ----Afterwards, `Pass:read` can be used to read back the tally result, or the tally can be copied to a `Buffer. +---Afterwards, `Pass:read` can be used to read back the tally result, or the tally can be copied to a `Buffer`. --- --- ---### NOTE: @@ -2322,7 +2343,7 @@ function Pass:tick(tally, slot) end --- ---`Pass:tick` must be called to start the measurement before this can be called. --- ----Afterwards, `Pass:read` can be used to read back the tally result, or the tally can be copied to a `Buffer. +---Afterwards, `Pass:read` can be used to read back the tally result, or the tally can be copied to a `Buffer`. --- ---@param tally lovr.Tally # The tally storing the measurement. ---@param slot number # The index of the slot in the tally storing the measurement. @@ -2357,7 +2378,9 @@ function Pass:transform(transform) end function Pass:translate(translation) end --- ----TODO +---Readbacks track the progress of an asynchronous read of a `Buffer`, `Texture`, or `Tally`. +--- +---Once a Readback is created in a transfer pass, and the transfer pass is submitted, the Readback can be polled for completion or the CPU can wait for it to finish using `Readback:wait`. --- ---@class lovr.Readback local Readback = {} @@ -2367,7 +2390,7 @@ local Readback = {} --- --- ---### NOTE: ----TODO what if it's an image?! +---If the Readback is reading back a Texture, returns `nil`. --- ---@return lovr.Blob blob # The Blob. function Readback:getBlob() end @@ -2377,9 +2400,15 @@ function Readback:getBlob() end --- --- ---### NOTE: ----TODO what if the readback is a buffer/texture?! +---This currently returns `nil` for readbacks of `Buffer` and `Texture` objects. +--- +---Only readbacks of `Tally` objects return valid data. +--- +---For `time` and `pixel` tallies, the table will have 1 number per slot that was read. +--- +---For `shader` tallies, there will be 4 numbers for each slot. --- ----@return table data # A table containing the values that were read back. +---@return table data # A flat table of numbers containing the values that were read back. function Readback:getData() end --- @@ -2387,7 +2416,7 @@ function Readback:getData() end --- --- ---### NOTE: ----TODO what if it's a buffer or tally?! +---If the Readback is not reading back a Texture, returns `nil`. --- ---@return lovr.Image image # The Image. function Readback:getImage() end @@ -2403,7 +2432,7 @@ function Readback:isComplete() end --- --- ---### NOTE: ----TODO what if the readback will never complete?! +---If the transfer pass that created the readback has not been submitted yet, no wait will occur and this function will return `false`. --- ---@return boolean waited # Whether the CPU had to be blocked for waiting. function Readback:wait() end @@ -2480,7 +2509,9 @@ function Sampler:getMipmapRange() end function Sampler:getWrap() end --- ----TODO +---Shaders are small GPU programs. +--- +---See the `Shaders` guide for a full introduction to Shaders. --- ---@class lovr.Shader local Shader = {} @@ -2533,7 +2564,23 @@ function Shader:hasAttribute(name) end function Shader:hasStage(stage) end --- ----TODO +---Tally objects are able to measure events on the GPU. +--- +---Tallies can measure three types of things: +--- +---- `time` - measures elapsed GPU time. +---- `pixel` - measures how many pixels were rendered, which can be used for occlusion culling. +---- `shader` - measure how many times shaders were run. +--- +---Tally objects can be created with up to 4096 slots. +--- +---Each slot can hold a single measurement value. +--- +---`Pass:tick` is used to begin a measurement, storing the result in one of the slots. +--- +---All commands recorded on the Pass will be measured until `Pass:tock` is called with the same tally and slot. +--- +---The measurement value stored in the slots can be copied to a `Buffer` using `Pass:copy`, or they can be read back to Lua using `Pass:read`. --- ---@class lovr.Tally local Tally = {} @@ -2681,6 +2728,62 @@ function Texture:isView() end function Texture:newView(parent, type, layer, layerCount, mipmap, mipmapCount) end --- +---Controls whether premultiplied alpha is enabled. +--- +--- +---### NOTE: +---The premultiplied mode should be used if pixels being drawn have already been blended, or "pre-multiplied", by the alpha channel. +--- +---This happens when rendering to a texture that contains pixels with transparent alpha values, since the stored color values have already been faded by alpha and don't need to be faded a second time with the alphamultiply blend mode. +--- +---@alias lovr.BlendAlphaMode +--- +---Color channel values are multiplied by the alpha channel during blending. +--- +---| "alphamultiply" +--- +---Color channel values are not multiplied by the alpha. +--- +---Instead, it's assumed that the colors have already been multiplied by the alpha. +--- +---This should be used if the pixels being drawn have already been blended, or "pre-multiplied". +--- +---| "premultiplied" + +--- +---Different ways pixels can blend with the pixels behind them. +--- +---@alias lovr.BlendMode +--- +---Colors will be mixed based on alpha. +--- +---| "alpha" +--- +---Colors will be added to the existing color, alpha will not be changed. +--- +---| "add" +--- +---Colors will be subtracted from the existing color, alpha will not be changed. +--- +---| "subtract" +--- +---All color channels will be multiplied together, producing a darkening effect. +--- +---| "multiply" +--- +---The maximum value of each color channel will be used. +--- +---| "lighten" +--- +---The minimum value of each color channel will be used. +--- +---| "darken" +--- +---The opposite of multiply: the pixel colors are inverted, multiplied, and inverted again, producing a lightening effect. +--- +---| "screen" + +--- ---The different ways to pack Buffer fields into memory. --- ---The default is `packed`, which is suitable for vertex buffers and index buffers. @@ -2720,6 +2823,95 @@ function Texture:newView(parent, type, layer, layerCount, mipmap, mipmapCount) e ---| "std430" --- +---The method used to compare depth and stencil values when performing the depth and stencil tests. Also used for compare modes in `Sampler`s. +--- +--- +---### NOTE: +---This type can also be specified using mathematical notation, e.g. `=`, `>`, `<=`, etc. `notequal` can be provided as `~=` or `!=`. +--- +---@alias lovr.CompareMode +--- +---The test does not take place, and acts as though it always passes. +--- +---| "none" +--- +---The test passes if the values are equal. +--- +---| "equal" +--- +---The test passes if the values are not equal. +--- +---| "notequal" +--- +---The test passes if the value is less than the existing one. +--- +---| "less" +--- +---The test passes if the value is less than or equal to the existing one. +--- +---| "lequal" +--- +---The test passes if the value is greater than the existing one. +--- +---| "greater" +--- +---The test passes if the value is greater than or equal to the existing one. +--- +---| "gequal" + +--- +---The different ways of doing triangle backface culling. +--- +---@alias lovr.CullMode +--- +---Both sides of triangles will be drawn. +--- +---| "none" +--- +---Skips rendering the back side of triangles. +--- +---| "back" +--- +---Skips rendering the front side of triangles. +--- +---| "front" + +--- +---The set of shaders built in to LÖVR. +--- +---These can be passed to `Pass:setShader` or `lovr.graphics.newShader` instead of writing GLSL code. +--- +---The shaders can be further customized by using the `flags` option to change their behavior. +--- +---If the active shader is set to `nil`, LÖVR picks one of these shaders to use. +--- +---@alias lovr.DefaultShader +--- +---Basic shader without lighting that uses colors and a texture. +--- +---| "unlit" +--- +---Shades triangles based on their normal, resulting in a cool rainbow effect. +--- +---| "normal" +--- +---Renders font glyphs. +--- +---| "font" +--- +---Renders cubemaps. +--- +---| "cubemap" +--- +---Renders spherical textures. +--- +---| "equirect" +--- +---Renders a fullscreen triangle. +--- +---| "fill" + +--- ---Whether a shape should be drawn filled or outlined. --- ---@alias lovr.DrawStyle @@ -3078,6 +3270,43 @@ function Texture:newView(parent, type, layer, layerCount, mipmap, mipmapCount) e ---| "state" --- +---Different ways of updating the stencil buffer with `Pass:setStencilWrite`. +--- +---@alias lovr.StencilAction +--- +---Stencil buffer pixels will not be changed by draws. +--- +---| "keep" +--- +---Stencil buffer pixels will be set to zero. +--- +---| "zero" +--- +---Stencil buffer pixels will be replaced with a custom value. +--- +---| "replace" +--- +---Stencil buffer pixels will be incremented each time they're rendered to. +--- +---| "increment" +--- +---Stencil buffer pixels will be decremented each time they're rendered to. +--- +---| "decrement" +--- +---Similar to increment, but will wrap around to 0 when it exceeds 255. +--- +---| "incrementwrap" +--- +---Similar to decrement, but will wrap around to 255 when it goes below 0. +--- +---| "decrementwrap" +--- +---The bits in the stencil buffer pixels will be inverted. +--- +---| "invert" + +--- ---These are the different metrics a `Tally` can measure. --- ---@alias lovr.TallyType diff --git a/meta/3rd/lovr/library/lovr/headset.lua b/meta/3rd/lovr/library/lovr/headset.lua index caa0cbe8..0c26709e 100644 --- a/meta/3rd/lovr/library/lovr/headset.lua +++ b/meta/3rd/lovr/library/lovr/headset.lua @@ -110,6 +110,14 @@ function lovr.headset.getBoundsWidth() end function lovr.headset.getClipDistance() end --- +---Returns the headset delta time, which is the difference between the current and previous predicted display times. +--- +---When the headset is active, this will be the `dt` value passed in to `lovr.update`. +--- +---@return number dt # The delta time. +function lovr.headset.getDeltaTime() end + +--- ---Returns the texture dimensions of the headset display (for one eye), in pixels. --- ---@return number width # The width of the display. @@ -160,14 +168,6 @@ function lovr.headset.getDriver() end function lovr.headset.getHands() end --- ----Returns a Texture that contains whatever is currently rendered to the headset. ---- ----Sometimes this can be `nil` if the current headset driver doesn't have a mirror texture, which can happen if the driver renders directly to the display, like with the `desktop` driver. ---- ----@return lovr.Texture mirror # The mirror texture. -function lovr.headset.getMirrorTexture() end - ---- ---Returns the name of the headset as a string. --- ---The exact string that is returned depends on the hardware and VR SDK that is currently in use. @@ -395,6 +395,20 @@ function lovr.headset.getPosition(device) end function lovr.headset.getSkeleton(device) end --- +---Returns a Texture that will be submitted to the headset display. +--- +---This will be the render target used in the headset's render pass. +--- +---The texture is not guaranteed to be the same every frame, and must be called every frame to get the current texture. +--- +--- +---### NOTE: +---This function may return `nil` if the headset is not being rendered to this frame. +--- +---@return lovr.Texture texture # The headset texture. +function lovr.headset.getTexture() end + +--- ---Returns the estimated time in the future at which the light from the pixels of the current frame will hit the eyes of the user. --- ---This can be used as a replacement for `lovr.timer.getTime` for timestamps that are used for rendering to get a smoother result that is synchronized with the display of the headset. @@ -471,6 +485,16 @@ function lovr.headset.getViewPose(view) end function lovr.headset.isDown(device, button) end --- +---Returns whether LÖVR has VR input focus. +--- +---Focus is lost when the VR system menu is shown. +--- +---The `lovr.focus` callback can be used to detect when this changes. +--- +---@return boolean focused # Whether the application is focused. +function lovr.headset.isFocused() end + +--- ---Returns whether a button on a device is currently touched. --- ---@param device lovr.Device # The device. @@ -502,26 +526,6 @@ function lovr.headset.isTracked(device) end function lovr.headset.newModel(device, options) end --- ----Renders to each eye of the headset using a function. ---- ----This function takes care of setting the appropriate graphics transformations to ensure that the scene is rendered as though it is being viewed through each eye of the player. ---- ----It also takes care of setting the correct projection for the headset lenses. ---- ----If the headset module is enabled, this function is called automatically by `lovr.run` with `lovr.draw` as the callback. ---- ---- ----### NOTE: ----At the beginning of the callback, the display is cleared to the background color. ---- ----The background color can be changed using `lovr.graphics.setBackgroundColor`. ---- ----If the callback is `nil`, an empty frame cleared to current graphics background color will be submitted to the headset. ---- ----@param callback function # The function used to render. Any functions called will render to the headset instead of to the window. -function lovr.headset.renderTo(callback) end - ---- ---Sets the near and far clipping planes used to render to the headset. --- ---Objects closer than the near clipping plane or further than the far clipping plane will be clipped out of view. @@ -546,6 +550,24 @@ function lovr.headset.setClipDistance(near, far) end function lovr.headset.setDisplayFrequency(frequency) end --- +---Starts the headset session. +--- +---This must be called after the graphics module is initialized, and can only be called once. +--- +---Normally it is called automatically by `boot.lua`. +--- +function lovr.headset.start() end + +--- +---Submits the current headset texture to the VR display. +--- +---This should be called after calling `lovr.graphics.submit` with the headset render pass. +--- +---Normally this is taken care of by `lovr.run`. +--- +function lovr.headset.submit() end + +--- ---Causes the device to vibrate with a custom strength, duration, and frequency, if possible. --- ---@param device? lovr.Device # The device to vibrate. diff --git a/meta/3rd/luassert/library/luassert/spy.d.lua b/meta/3rd/luassert/library/luassert/spy/d.lua index 2789c93e..2789c93e 100644 --- a/meta/3rd/luassert/library/luassert/spy.d.lua +++ b/meta/3rd/luassert/library/luassert/spy/d.lua |