ExperimentalGear/docs/lua_api/shadedmesh.lua

160 lines
5.2 KiB
Lua

---ShadedMesh is a lua object available that has "low-level" drawing capabilites
---that can be useful for very custom rendering goals.
---@class ShadedMesh
ShadedMesh = {
BLEND_NORM = 0,
BLEND_ADD = 1,
BLEND_MULT = 2,
PRIM_TRILIST = 0,
PRIM_TRIFAN = 1,
PRIM_TRISTRIP = 2,
PRIM_LINELIST = 3,
PRIM_LINESTRIP = 4,
PRIM_POINTLIST = 5,
}
-- Adds a texture that was loaded with `gfx.LoadSharedTexture` to the material that can be used in the shader code
---@param uniformName string
---@param textureName string
ShadedMesh.AddSharedTexture = function(uniformName, textureName) end
-- Adds a texture to the material that can be used in the shader code
---@param uniformName string
---@param path string # prepended with `skins/<skin>/textures/`
ShadedMesh.AddSkinTexture = function(uniformName, path) end
-- Adds a texture to the material that can be used in the shader code
---@param uniformName string
---@param path string
ShadedMesh.AddTexture = function(uniformName, path) end
-- Gets the translation of the mesh
---@return number x, number y, number z
ShadedMesh.GetPosition = function() end
-- Gets the rotation (in degrees) of the mesh
---@return number roll, number yaw, number pitch
ShadedMesh.GetRotation = function() end
-- Gets the scale of the mesh
---@return number x, number y, number z
ShadedMesh.GetScale = function() end
-- Sets the blending mode
---@param mode integer # options also available as fields of the object prefixed with `BLEND`
-- `Normal` = 0 (default)
-- `Additive` = 1
-- `Multiply` = 2
ShadedMesh.SetBlendMode = function(mode) end
-- Sets the geometry data
---@param data table # array of vertices in clockwise order starting from the top left e.g.
-- ```
-- {
-- { { 0, 0 }, { 0, 0 } },
-- { { 50, 0 }, { 1, 0 } },
-- { { 50, 50 }, { 1, 1 } },
-- { { 0, 50 }, { 0, 1 } },
-- }
-- ```
ShadedMesh.SetData = function(data) end
-- Sets the material is opaque or non-opaque (default)
---@param opaque boolean
ShadedMesh.SetOpaque = function(opaque) end
-- Sets the value of the specified uniform
---@param uniformName string
---@param value number # `float`
ShadedMesh.SetParam = function(uniformName, value) end
-- Sets the value of the specified 2d vector uniform
---@param uniformName string
---@param x number # `float`
---@param y number # `float`
ShadedMesh.SetParamVec2 = function(uniformName, x, y) end
-- Sets the value of the specified 3d vector uniform
---@param uniformName string
---@param x number # `float`
---@param y number # `float`
---@param z number # `float`
ShadedMesh.SetParamVec3 = function(uniformName, x, y, z) end
-- Sets the value of the specified 4d vector uniform
---@param uniformName string
---@param x number # `float`
---@param y number # `float`
---@param z number # `float`
---@param w number # `float`
ShadedMesh.SetParamVec4 = function(uniformName, x, y, z, w) end
-- Sets the translation for the mesh
-- Relative to the screen for `ShadedMesh`
-- Relative to the center of the crit line for `ShadedMeshOnTrack`
---@param x number
---@param y number
---@param z? number # Default `0`
ShadedMesh.SetPosition = function(x, y, z) end
-- Sets the format for geometry data provided by `SetData`
---@param type integer # options also available as fields of the object prefixed with `PRIM`
-- `TriangleList` = 0 (default)
-- `TriangleStrip` = 1
-- `TriangleFan` = 2
-- `LineList` = 3
-- `LineStrip` = 4
-- `PointList` = 5
ShadedMesh.SetPrimitiveType = function(type) end
-- Sets the rotation (in degrees) of the mesh
-- **WARNING:** For `ShadedMesh`, pitch and yaw may clip, rendering portions or the entire mesh invisible
---@param roll number
---@param yaw? number # Default `0`
---@param pitch? number # Default `0`
ShadedMesh.SetRotation = function(roll, yaw, pitch) end
-- Sets the scale of the mesh
---@param x number
---@param y number
---@param z? number # Default `0`
ShadedMesh.SetScale = function(x, y, z) end
-- Sets the wireframe mode of the object (does not render texture)
-- Useful for debugging models or geometry shaders
---@param useWireframe boolean
ShadedMesh.SetWireframe = function(useWireframe) end
-- Renders the `ShadedMesh` object
ShadedMesh.Draw = function() end
---ShadedMeshOnTrack is a ShadedMesh that renders with the track camera instead of the screen.
---@class ShadedMeshOnTrack : ShadedMesh
---@field BUTTON_TEXTURE_LENGTH number
---@field FXBUTTON_TEXTURE_LENGTH number
---@field TRACK_LENGTH number
ShadedMeshOnTrack = {
}
-- Gets the length of the mesh
---@return number length
ShadedMeshOnTrack.GetLength = function() end
-- Sets the y-scale of the mesh based on its length
-- Useful for creating fake buttons which may have variable length based on duration
---@param length number
ShadedMeshOnTrack.ScaleToLength = function(length) end
-- Stops meshes beyond the track from being rendered if `doClip`
---@param doClip boolean
ShadedMeshOnTrack.SetClipWithTrack = function(doClip) end
-- Sets the length (in the y-direction relative to the track) of the mesh
---@param length number # Optional constants: `BUTTON_TEXTURE_LENGTH`, `FXBUTTON_TEXTURE_LENGTH`, and `TRACK_LENGTH`
ShadedMeshOnTrack.SetLength = function(length) end
-- Uses an existing game mesh
---@param meshName string # Options: `'button'`, `'fxbutton'`, and `'track'`
ShadedMeshOnTrack.UseGameMesh = function(meshName) end