Pass
EditPass objects record work for the GPU. They contain a list of things to draw and a list of compute shaders to run.
Methods like Pass:sphere will "record" a draw on the Pass, which adds it to the list. Other methods like Pass:setBlendMode or Pass:setShader will change the way the next draws are processed.
Once all of the work has been recorded to a Pass, it can be sent to the GPU using lovr.graphics.submit, which will start processing all of the compute work and draws (in that order).
A Pass can have a canvas, which is a set of textures that the draws will render to.
Pass:reset is used to clear all of the computes and draws, putting the Pass in a fresh state.
lovr.draw is called every frame with a Pass that is configured to render to either the headset or the window. The Pass will automatically get submitted afterwards.
Constructors
| lovr.graphics.newPass | Create a new Pass. |
| lovr.graphics.getWindowPass | Get the window pass. |
| lovr.headset.getPass | Get a Pass that renders to the headset. |
Drawing
Draw objects and shapes.
| Pass:box | Draw a box. |
| Pass:capsule | Draw a capsule. |
| Pass:circle | Draw a circle. |
| Pass:cone | Draw a cone. |
| Pass:cube | Draw a cube. |
| Pass:cylinder | Draw a cylinder. |
| Pass:draw | Draw a Model, Mesh, or Texture. |
| Pass:drawPart | Draw a part of a Model. |
| Pass:fill | Draw a fullscreen triangle. |
| Pass:line | Draw a line. |
| Pass:mesh | Draw a mesh. |
| Pass:plane | Draw a plane. |
| Pass:points | Draw points. |
| Pass:polygon | Draw a polygon. |
| Pass:roundrect | Draw a rounded rectangle. |
| Pass:skybox | Draw a skybox. |
| Pass:sphere | Draw a sphere. |
| Pass:text | Draw text. |
| Pass:torus | Draw a donut. |
Coordinate System
Manipulate the 3D coordinate system.
| Pass:origin | Reset the transform to the origin. |
| Pass:pop | Pop one of the stacks. |
| Pass:push | Push state onto a stack. |
| Pass:rotate | Rotate the coordinate system. |
| Pass:scale | Scale the coordinate system. |
| Pass:transform | Apply a general transform to the coordinate system. |
| Pass:translate | Translate the coordinate system. |
Render States
Set render states that change the way draws appear. Render states can be saved and restored using Pass:push and Pass:pop.
| Pass:setAlphaToCoverage | Enable or disable alpha to coverage. |
| Pass:setBlendMode | Set the blend mode. |
| Pass:setBlendState | Set the blend state. |
| Pass:setColor | Set the color. |
| Pass:setColorWrite | Change the color channels affected by drawing. |
| Pass:setCullMode | Control triangle face culling. |
| Pass:setDepthClamp | Enable or disable depth clamp. |
| Pass:setDepthOffset | Configure the depth offset. |
| Pass:setDepthTest | Configure the depth test. |
| Pass:setDepthWrite | Set whether draws write to the depth buffer. |
| Pass:setFaceCull | Control triangle face culling. |
| Pass:setFont | Set the font. |
| Pass:setMaterial | Set the material. |
| Pass:setMeshMode | Change the way vertices are connected together. |
| Pass:setSampler | Set the sampler. |
| Pass:setStencilTest | Configure the stencil test. |
| Pass:setStencilWrite | Set whether draws write to the stencil buffer. |
| Pass:setViewCull | Enable or disable view frustum culling. |
| Pass:setWinding | Set the winding direction of triangle vertices. |
| Pass:setWireframe | Enable or disable wireframe rendering. |
Shaders
Change the shader used for draws or computes, and set variables in the active shader.
| Pass:send | Set the value of a shader variable. |
| Pass:setShader | Set the active Shader. |
Compute
| Pass:barrier | Synchronize compute work. |
| Pass:compute | Run a compute shader. |
Tally
Tallies count the number of pixels that were visible for a draw.
| Pass:beginTally | Begin a tally. |
| Pass:finishTally | Finish a tally. |
| Pass:getTallyBuffer | Get the Buffer that tally results will be written to. |
| Pass:setTallyBuffer | Set the Buffer that tally results will be written to. |
Camera
| Pass:getProjection | Get the field of view. |
| Pass:getViewCount | Returns the view count of a render pass. |
| Pass:getViewPose | Get the camera pose. |
| Pass:getViewRay | Get a world space ray for a pixel in the Pass's canvas. |
| Pass:setProjection | Set the camera projection. |
| Pass:setScissor | Set the scissor rectangle. |
| Pass:setViewPose | Set the camera pose. |
| Pass:setViewport | Set the viewport. |
Canvas
| Pass:getCanvas | Get the Pass's canvas. |
| Pass:getClear | Return the clear values of the Pass. |
| Pass:getDimensions | Get the dimensions of the Pass's canvas. |
| Pass:getHeight | Get the height of the Pass's canvas. |
| Pass:getWidth | Get the width of the Pass's canvas. |
| Pass:setCanvas | Set the Pass's canvas. |
| Pass:setClear | Set the clear values of the Pass. |
Miscellaneous
| Pass:getLabel | Get the debug label of the Pass. |
| Pass:getStats | Get statistics for the Pass. |
| Pass:reset | Reset the Pass. |