bjorn 2 лет назад
Родитель
Сommit
0f0a89a04f
38 измененных файлов с 684 добавлено и 343 удалено
  1. 336 189
      api/init.lua
  2. 20 0
      api/lovr/graphics/DrawStyle.lua
  3. 23 0
      api/lovr/graphics/HorizontalAlign.lua
  4. 23 0
      api/lovr/graphics/OriginType.lua
  5. 4 2
      api/lovr/graphics/Pass/clear.lua
  6. 3 1
      api/lovr/graphics/Pass/origin.lua
  7. 4 1
      api/lovr/graphics/Pass/rotate.lua
  8. 4 1
      api/lovr/graphics/Pass/scale.lua
  9. 1 1
      api/lovr/graphics/Pass/setColor.lua
  10. 12 2
      api/lovr/graphics/Pass/setDepthClamp.lua
  11. 5 2
      api/lovr/graphics/Pass/setDepthOffset.lua
  12. 8 2
      api/lovr/graphics/Pass/setDepthTest.lua
  13. 10 2
      api/lovr/graphics/Pass/setMaterial.lua
  14. 4 3
      api/lovr/graphics/Pass/setMeshMode.lua
  15. 26 3
      api/lovr/graphics/Pass/setSampler.lua
  16. 7 3
      api/lovr/graphics/Pass/setScissor.lua
  17. 7 2
      api/lovr/graphics/Pass/setStencilTest.lua
  18. 5 2
      api/lovr/graphics/Pass/setStencilWrite.lua
  19. 6 3
      api/lovr/graphics/Pass/sphere.lua
  20. 22 6
      api/lovr/graphics/Pass/tick.lua
  21. 15 6
      api/lovr/graphics/Pass/tock.lua
  22. 10 5
      api/lovr/graphics/Pass/torus.lua
  23. 10 60
      api/lovr/graphics/Pass/transform.lua
  24. 10 24
      api/lovr/graphics/Pass/translate.lua
  25. 5 2
      api/lovr/graphics/Shader/clone.lua
  26. 8 4
      api/lovr/graphics/ShaderStage.lua
  27. 9 3
      api/lovr/graphics/Tally/getType.lua
  28. 9 5
      api/lovr/graphics/TallyType.lua
  29. 23 0
      api/lovr/graphics/VerticalAlign.lua
  30. 21 0
      api/lovr/graphics/Winding.lua
  31. 21 1
      api/lovr/graphics/submit.lua
  32. 2 1
      api/lovr/headset/getClipDistance.lua
  33. 5 2
      api/lovr/headset/setClipDistance.lua
  34. 1 0
      api/lovr/math/Quat/set.lua
  35. 1 0
      api/lovr/math/newQuat.lua
  36. 1 0
      api/lovr/math/quat.lua
  37. 1 3
      api/lovr/thread/Thread/start.lua
  38. 2 2
      api/main.lua

Разница между файлами не показана из-за своего большого размера
+ 336 - 189
api/init.lua


+ 20 - 0
api/lovr/graphics/DrawStyle.lua

@@ -0,0 +1,20 @@
+return {
+  summary = 'Different styles to draw shapes.',
+  description = 'Whether a shape should be drawn filled or outlined.',
+  values = {
+    {
+      name = 'fill',
+      description = 'The shape will be filled in (the default).'
+    },
+    {
+      name = 'line',
+      description = 'The shape will be outlined.'
+    }
+  },
+  related = {
+    'Pass:plane',
+    'Pass:cube',
+    'Pass:box',
+    'Pass:circle'
+  }
+}

+ 23 - 0
api/lovr/graphics/HorizontalAlign.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Different ways to horizontally align text.',
+  description = 'Different ways to horizontally align text with `Pass:text`.',
+  values = {
+    {
+      name = 'left',
+      description = 'Left-aligned text.'
+    },
+    {
+      name = 'center',
+      description = 'Centered text.'
+    },
+    {
+      name = 'right',
+      description = 'Right-aligned text.'
+    }
+  },
+  related = {
+    'VerticalAlign',
+    'Pass:text',
+    'Font:getVertices'
+  }
+}

+ 23 - 0
api/lovr/graphics/OriginType.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Different coordinate spaces for nodes in a Model.',
+  description = 'Different coordinate spaces for nodes in a `Model`.',
+  values = {
+    {
+      name = 'root',
+      description = 'Transforms are relative to the origin (root) of the Model.'
+    },
+    {
+      name = 'parent',
+      description = 'Transforms are relative to the parent of the node.'
+    }
+  },
+  related = {
+    'Model:getNodePosition',
+    'Model:getNodeOrientation',
+    'Model:getNodeScale',
+    'Model:getNodePose',
+    'Model:getNodeTransform',
+    'Model:getRootNode',
+    'Model:getNodeParent'
+  }
+}

+ 4 - 2
api/lovr/graphics/Pass/clear.lua

@@ -22,8 +22,10 @@ return {
       description = 'The Texture to clear.'
     },
     color = {
-      type = 'Color',
-      description = 'The color to clear to.'
+      type = 'Vec4',
+      description = [[
+        The color to clear the texture to.  Can also be a `Vec3`, table of numbers, or a hexcode.
+      ]]
     },
     layer = {
       type = 'number',

+ 3 - 1
api/lovr/graphics/Pass/origin.lua

@@ -14,6 +14,8 @@ return {
     'Pass:translate',
     'Pass:rotate',
     'Pass:scale',
-    'Pass:transform'
+    'Pass:transform',
+    'Pass:push',
+    'Pass:pop'
   }
 }

+ 4 - 1
api/lovr/graphics/Pass/rotate.lua

@@ -21,6 +21,9 @@ return {
   related = {
     'Pass:translate',
     'Pass:scale',
-    'Pass:transform'
+    'Pass:transform',
+    'Pass:origin',
+    'Pass:push',
+    'Pass:pop'
   }
 }

+ 4 - 1
api/lovr/graphics/Pass/scale.lua

@@ -20,6 +20,9 @@ return {
   related = {
     'Pass:translate',
     'Pass:rotate',
-    'Pass:transform'
+    'Pass:transform',
+    'Pass:origin',
+    'Pass:push',
+    'Pass:pop'
   }
 }

+ 1 - 1
api/lovr/graphics/Pass/setColor.lua

@@ -41,7 +41,7 @@ return {
       returns = {}
     },
     {
-      arguments = { 'hex', 'alpha' },
+      arguments = { 'hex', 'a' },
       returns = {}
     }
   }

+ 12 - 2
api/lovr/graphics/Pass/setDepthClamp.lua

@@ -1,7 +1,11 @@
 return {
   tag = 'pipeline',
   summary = 'Enable or disable depth clamp.',
-  description = 'TODO',
+  description = [[
+    Enables or disables depth clamp.  Normally, when pixels fall outside of the clipping planes,
+    they are clipped (not rendered).  Depth clamp will instead render these pixels, clamping their
+    depth on to the clipping planes.
+  ]],
   arguments = {
     enable = {
       type = 'boolean',
@@ -15,7 +19,13 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO depthClamp feature!',
+  notes = [[
+    This isn\'t supported on all GPUs.  Use the `depthClamp` feature of `lovr.graphics.getFeatures`
+    to check for support.  If depth clamp is enabled when unsupported, it will silently fall back to
+    depth clipping.
+
+    Depth clamping is not enabled by default.
+  ]],
   related = {
     'Pass:setDepthTest',
     'Pass:setDepthWrite',

+ 5 - 2
api/lovr/graphics/Pass/setDepthOffset.lua

@@ -1,7 +1,10 @@
 return {
   tag = 'pipeline',
   summary = 'Configure the depth offset.',
-  description = 'TODO',
+  description = [[
+    Set the depth offset.  This is a constant offset added to the depth value of pixels.  It can be
+    used to fix Z fighting when rendering decals or other nearly-overlapping objects.
+  ]],
   arguments = {
     offset = {
       type = 'number',
@@ -21,7 +24,7 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO',
+  notes = 'The default depth offset is zero for both values.',
   related = {
     'Pass:setDepthTest',
     'Pass:setDepthWrite'

+ 8 - 2
api/lovr/graphics/Pass/setDepthTest.lua

@@ -1,7 +1,7 @@
 return {
   tag = 'pipeline',
   summary = 'Configure the depth test.',
-  description = 'TODO',
+  description = 'Sets the depth test.',
   arguments = {
     test = {
       type = 'CompareMode',
@@ -20,7 +20,13 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO',
+  notes = [[
+    When using LÖVR's default projection (reverse Z with infinite far plane) the default depth test
+    is `gequal`, depth values of 0.0 are on the far plane and depth values of 1.0 are on the near
+    plane, closer to the camera.
+
+    A depth buffer must be present to use the depth test, but this is enabled by default.
+  ]],
   related = {
     'Pass:setDepthWrite',
     'Pass:setDepthOffset',

+ 10 - 2
api/lovr/graphics/Pass/setMaterial.lua

@@ -1,11 +1,14 @@
 return {
   tag = 'pipeline',
   summary = 'Set the material.',
-  description = 'TODO',
+  description = [[
+    Sets the material.  This will apply to most drawing, except for text, skyboxes, and models,
+    which use their own materials.
+  ]],
   arguments = {
     material = {
       type = 'Material',
-      description = 'TODO'
+      description = 'The material to use for drawing.'
     }
   },
   returns = {},
@@ -13,6 +16,11 @@ return {
     {
       arguments = { 'material' },
       returns = {}
+    },
+    {
+      description = 'Use the default material.',
+      arguments = {},
+      returns = {}
     }
   }
 }

+ 4 - 3
api/lovr/graphics/Pass/setMeshMode.lua

@@ -1,11 +1,11 @@
 return {
   tag = 'pipeline',
   summary = 'Change the way vertices are connected together.',
-  description = 'TODO',
+  description = 'Changes the way vertices are connected together when drawing using `Pass:mesh`.',
   arguments = {
     mode = {
       type = 'MeshMode',
-      description = 'TODO'
+      description = 'The mesh mode to use.'
     }
   },
   returns = {},
@@ -14,5 +14,6 @@ return {
       arguments = { 'mode' },
       returns = {}
     }
-  }
+  },
+  notes = 'The default mesh mode is `triangles`.'
 }

+ 26 - 3
api/lovr/graphics/Pass/setSampler.lua

@@ -1,18 +1,41 @@
 return {
   tag = 'pipeline',
   summary = 'Set the sampler.',
-  description = 'TODO',
+  description = [[
+    Sets the default `Sampler` to use when sampling textures.  It is also possible to send a custom
+    sampler to a shader using `Pass:send` and use that instead, which allows customizing the sampler
+    on a per-texture basis.
+  ]],
   arguments = {
     sampler = {
       type = 'Sampler',
-      description = 'TODO'
+      description = 'The default sampler shaders will use when reading from textures.'
+    },
+    filter = {
+      type = 'FilterMode',
+      default = [['linear']],
+      description = [[
+        The default filter mode to use when sampling textures (the `repeat` wrap mode will be used).
+      ]]
     }
   },
   returns = {},
   variants = {
+    {
+      arguments = { 'filter' },
+      returns = {}
+    },
     {
       arguments = { 'sampler' },
       returns = {}
     }
-  }
+  },
+  notes = 'The `getPixel` shader helper function will use this sampler.',
+  example = [[
+    function lovr.draw(pass)
+      pass:setSampler('nearest') -- activate minecraft mode
+      pass:setMaterial(rock)
+      pass:cube(x, y, z)
+    end
+  ]]
 }

+ 7 - 3
api/lovr/graphics/Pass/setScissor.lua

@@ -1,7 +1,9 @@
 return {
   tag = 'pipeline',
-  summary = 'Set the scissor.',
-  description = 'TODO',
+  summary = 'Set the scissor rectangle.',
+  description = [[
+    Sets the scissor rectangle.  Any pixels outside the scissor rectangle will not be drawn.
+  ]],
   arguments = {
     x = {
       type = 'number',
@@ -28,7 +30,9 @@ return {
     }
   },
   notes = [[
-    TODO not floating point, negative, limits, not pipeline, initial pass state
+    `x` and `y` can not be negative.
+
+    The default scissor rectangle covers the entire region of the render pass textures.
   ]],
   related = {
     'Pass:setViewport'

+ 7 - 2
api/lovr/graphics/Pass/setStencilTest.lua

@@ -1,7 +1,12 @@
 return {
   tag = 'pipeline',
   summary = 'Configure the stencil test.',
-  description = 'TODO',
+  description = [[
+    Sets the stencil test.  Any pixels that fail the stencil test won't be drawn.  For example,
+    setting the stencil test to `('equal', 1)` will only draw pixels that have a stencil value of 1.
+    The stencil buffer can be modified by drawing while stencil writes are enabled with
+    `lovr.graphics.setStencilWrite`.
+  ]],
   arguments = {
     test = {
       type = 'CompareMode',
@@ -29,7 +34,7 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO',
+  notes = 'The stencil test is disabled by default.',
   related = {
     'Pass:setStencilWrite',
     'Pass:setDepthTest'

+ 5 - 2
api/lovr/graphics/Pass/setStencilWrite.lua

@@ -1,7 +1,10 @@
 return {
   tag = 'pipeline',
   summary = 'Set whether draws write to the stencil buffer.',
-  description = 'TODO',
+  description = [[
+    Sets or disables stencil writes.  When stencil writes are enabled, any pixels drawn will update
+    the values in the stencil buffer using the `StencilAction` set.
+  ]],
   arguments = {
     action = {
       type = 'StencilAction',
@@ -41,7 +44,7 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO',
+  notes = 'By default, stencil writes are disabled.',
   related = {
     'Pass:setStencilTest',
     'Pass:setDepthTest'

+ 6 - 3
api/lovr/graphics/Pass/sphere.lua

@@ -1,11 +1,14 @@
 return {
   tag = 'drawing',
   summary = 'Draw a sphere.',
-  description = 'TODO',
+  description = 'Draws a sphere',
   arguments = {
     transform = {
-      type = 'transform',
-      description = 'The transform to apply to the sphere.'
+      type = 'Mat4',
+      description = [[
+        The transform of the sphere.  Can also be provided as a position, radius, and rotation using
+        a mix of `Vectors and numbers.'
+      ]]
     },
     longitudes = {
       type = 'number',

+ 22 - 6
api/lovr/graphics/Pass/tick.lua

@@ -1,22 +1,38 @@
 return {
   tag = 'tallies',
-  summary = 'Begin measuring GPU counters.',
-  description = 'TODO',
+  summary = 'Start a GPU measurement.',
+  description = [[
+    Starts a GPU measurement.  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.
+  ]],
   arguments = {
     tally = {
       type = 'Tally',
-      description = 'TODO'
+      description = 'The tally that will store the measurement.'
     },
-    index = {
+    slot = {
       type = 'number',
-      description = 'TODO'
+      description = 'The index of the slot in the tally to store the measurement in.'
     }
   },
   returns = {},
   variants = {
     {
-      arguments = { 'tally', 'index' },
+      arguments = { 'tally', 'slot' },
       returns = {}
     }
+  },
+  notes = [[
+    `pixel` and `shader` measurements can not be nested, but `time` measurements can be nested.
+
+    For `time` measurements, the view count of the pass (`Pass:getViewCount`) must match the view
+    count of the tally, which defaults to `2`.
+  ]],
+  related = {
+    'Pass:tock',
+    'TallyType',
+    'Pass:read'
   }
 }

+ 15 - 6
api/lovr/graphics/Pass/tock.lua

@@ -1,22 +1,31 @@
 return {
   tag = 'tallies',
-  summary = 'Stop measuring GPU counters.',
-  description = 'TODO',
+  summary = 'Stop a GPU measurement.',
+  description = [[
+    Stops a GPU measurement.  `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.
+  ]],
   arguments = {
     tally = {
       type = 'Tally',
-      description = 'TODO'
+      description = 'The tally storing the measurement.'
     },
-    index = {
+    slot = {
       type = 'number',
-      description = 'TODO'
+      description = 'The index of the slot in the tally storing the measurement.'
     }
   },
   returns = {},
   variants = {
     {
-      arguments = { 'tally', 'index' },
+      arguments = { 'tally', 'slot' },
       returns = {}
     }
+  },
+  related = {
+    'Pass:tick',
+    'TallyType',
+    'Pass:read'
   }
 }

+ 10 - 5
api/lovr/graphics/Pass/torus.lua

@@ -1,13 +1,15 @@
 return {
   tag = 'drawing',
   summary = 'Draw a donut.',
-  description = 'TODO',
+  description = 'Draws a torus.',
   arguments = {
     transform = {
-      type = 'TransformXY2',
+      type = 'Mat4',
       description = [[
-        The transform to apply to the torus.  The x scale is the radius, the z scale is the
-        thickness.
+        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.
       ]]
     },
     tsegments = {
@@ -28,5 +30,8 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO'
+  notes = [[
+    The local origin is in the center of the torus, and the torus forms a circle around the local Z
+    axis.
+  ]]
 }

+ 10 - 60
api/lovr/graphics/Pass/transform.lua

@@ -1,80 +1,30 @@
 return {
   tag = 'transform',
   summary = 'Apply a general transform to the coordinate system.',
-  description = 'TODO',
+  description = 'Transforms the coordinate system.',
   arguments = {
-    x = {
-      type = 'number',
-      default = '0',
-      description = 'The x component of the translation.'
-    },
-    y = {
-      type = 'number',
-      default = '0',
-      description = 'The y component of the translation.'
-    },
-    z = {
-      type = 'number',
-      default = '0',
-      description = 'The z component of the translation.'
-    },
-    sx = {
-      type = 'number',
-      default = '1',
-      description = 'The x scale factor.'
-    },
-    sy = {
-      type = 'number',
-      default = '1',
-      description = 'The y scale factor.'
-    },
-    sz = {
-      type = 'number',
-      default = '1',
-      description = 'The z scale factor.'
-    },
-    angle = {
-      type = 'number',
-      default = '0',
-      description = 'The number of radians to rotate around the axis of rotation.'
-    },
-    ax = {
-      type = 'number',
-      default = '0',
-      description = 'The x component of the axis of rotation.'
-    },
-    ay = {
-      type = 'number',
-      default = '1',
-      description = 'The y component of the axis of rotation.'
-    },
-    az = {
-      type = 'number',
-      default = '0',
-      description = 'The z component of the axis of rotation.'
-    },
     transform = {
       type = 'Mat4',
-      description = 'The matrix holding the transform to apply.'
+      description = [[
+        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.
+      ]]
     }
   },
   returns = {},
   variants = {
-    {
-      arguments = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' },
-      returns = {}
-    },
     {
       arguments = { 'transform' },
       returns = {}
     }
   },
-  notes = [[
-    TODO you can use combos of numbers/vectors/quats too (or use meta Transform type to explain)
-  ]],
   related = {
     'Pass:translate',
     'Pass:rotate',
-    'Pass:scale'
+    'Pass:scale',
+    'Pass:origin',
+    'Pass:push',
+    'Pass:pop'
   }
 }

+ 10 - 24
api/lovr/graphics/Pass/translate.lua

@@ -1,36 +1,19 @@
 return {
   tag = 'transform',
   summary = 'Translate the coordinate system.',
-  description = 'TODO',
+  description = 'Translates the coordinate system.',
   arguments = {
-    x = {
-      type = 'number',
-      default = '0',
-      description = 'The amount to translate on the x axis.'
-    },
-    y = {
-      type = 'number',
-      default = '0',
-      description = 'The amount to translate on the y axis.'
-    },
-    z = {
-      type = 'number',
-      default = '0',
-      description = 'The amount to translate on the z axis.'
-    },
-    v = {
+    translation = {
       type = 'Vec3',
-      description = 'A vector to translate by.'
+      description = [[
+        The translation to apply to the coordinate system.  Can also be provided as 3 numbers.
+      ]]
     }
   },
   returns = {},
   variants = {
     {
-      arguments = { 'x', 'y', 'z' },
-      returns = {}
-    },
-    {
-      arguments = { 'v' },
+      arguments = { 'translation' },
       returns = {}
     }
   },
@@ -38,6 +21,9 @@ return {
   related = {
     'Pass:rotate',
     'Pass:scale',
-    'Pass:transform'
+    'Pass:transform',
+    'Pass:origin',
+    'Pass:push',
+    'Pass:pop'
   }
 }

+ 5 - 2
api/lovr/graphics/Shader/clone.lua

@@ -1,6 +1,9 @@
 return {
   summary = 'Clone a Shader.',
-  description = 'TODO',
+  description = [[
+    Clones a shader.  This creates an inexpensive copy of it with different flags.  It can be used
+    to create several variants of a shader with different behavior.
+  ]],
   arguments = {
     source = {
       type = 'Shader',
@@ -8,7 +11,7 @@ return {
     },
     flags = {
       type = 'table',
-      description = 'TODO'
+      description = 'The flags used by the clone.'
     }
   },
   returns = {

+ 8 - 4
api/lovr/graphics/ShaderStage.lua

@@ -1,17 +1,21 @@
 return {
-  description = 'TODO',
+  summary = 'Different shader stages.',
+  description = [[
+    Different shader stages.  Graphics shaders have a `vertex` and `fragment` stage, and compute
+    shaders have a single `compute` stage.
+  ]],
   values = {
     {
       name = 'vertex',
-      description = 'TODO'
+      description = 'The vertex stage, which computes transformed vertex positions.'
     },
     {
       name = 'fragment',
-      description = 'TODO'
+      description = 'The fragment stage, which computes pixel colors.'
     },
     {
       name = 'compute',
-      description = 'TODO'
+      description = 'The compute stage, which performs arbitrary computation.'
     }
   }
 }

+ 9 - 3
api/lovr/graphics/Tally/getType.lua

@@ -1,11 +1,14 @@
 return {
-  summary = 'TODO',
-  description = 'TODO',
+  summary = 'Get the type of the Tally.',
+  description = [[
+    Returns the type of the tally, which is the thing it measures between `Pass:tick` and
+    `Pass:tock`.
+  ]],
   arguments = {},
   returns = {
     type = {
       type = 'TallyType',
-      description = 'TODO'
+      description = 'The type of measurement.'
     }
   },
   variants = {
@@ -13,5 +16,8 @@ return {
       arguments = {},
       returns = { 'type' }
     }
+  },
+  related = {
+    'lovr.graphics.newTally'
   }
 }

+ 9 - 5
api/lovr/graphics/TallyType.lua

@@ -1,18 +1,22 @@
 return {
   summary = 'Different values a Tally can measure.',
-  description = 'TODO',
+  description = 'These are the different metrics a `Tally` can measure.',
   values = {
     {
       name = 'time',
       description = 'Each slot measures elapsed time in nanoseconds.'
     },
     {
-      name = 'pixel',
-      description = 'Each slot measures the approximate number of pixels affected by rendering.'
+      name = 'shader',
+      description = [[
+        Each slot measures 4 numbers: the total number of vertices processed, the number of times
+        the vertex shader was run, the number of triangles that were visible in the view, and the
+        number of times the fragment shader was run.
+      ]]
     },
     {
-      name = 'shader',
-      description = 'Each slot measures the number of times different shader stages are invoked.'
+      name = 'pixel',
+      description = 'Each slot measures the approximate number of pixels affected by rendering.'
     }
   }
 }

+ 23 - 0
api/lovr/graphics/VerticalAlign.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Different ways to vertically align text.',
+  description = 'Different ways to vertically align text with `Pass:text`.',
+  values = {
+    {
+      name = 'top',
+      description = 'Top-aligned text.'
+    },
+    {
+      name = 'middle',
+      description = 'Centered text.'
+    },
+    {
+      name = 'bottom',
+      description = 'Bottom-aligned text.'
+    }
+  },
+  related = {
+    'HorizontalAlign',
+    'Pass:text',
+    'Font:getVertices'
+  }
+}

+ 21 - 0
api/lovr/graphics/Winding.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Different triangle windings.',
+  description = [[
+    Indicates whether the front face of a triangle uses the clockwise or counterclockwise vertex
+    order.
+  ]],
+  values = {
+    {
+      name = 'clockwise',
+      description = 'Clockwise winding.'
+    },
+    {
+      name = 'counterclockwise',
+      description = 'Counterclockwise winding.'
+    }
+  },
+  related = {
+    'Pass:setWinding',
+    'Pass:setCullMode'
+  }
+}

+ 21 - 1
api/lovr/graphics/submit.lua

@@ -1,7 +1,7 @@
 return {
   tag = 'work-submission',
   summary = 'Submit recorded graphics work to the GPU.',
-  description = 'TODO',
+  description = 'Submits work to the GPU.',
   arguments = {
     ['...'] = {
       type = 'Pass',
@@ -28,6 +28,26 @@ return {
       returns = { 'true' }
     }
   },
+  notes = [[
+    The submitted `Pass` objects will run in the order specified.  Commands within a single Pass do
+    not have any ordering guarantees.
+
+    Submitting work to the GPU is not thread safe.  No other `lovr.graphics` or `Pass` functions may
+    run at the same time as `lovr.graphics.submit`.
+
+    Calling this function will invalidate any temporary buffers or passes that were created during
+    the frame.
+
+    Submitting work to the GPU is a relatively expensive operation.  It's a good idea to batch all
+    `Pass` objects into 1 submission if possible, unless there's a good reason not to.  One such
+    reason would be that the frame has so much work that some of it needs to be submitted early to
+    prevent the GPU from running out of things to do.  Another would be for `Readback` objects.
+
+    By default, this function is called with the default pass at the end of `lovr.draw` and
+    `lovr.mirror`.
+
+    It is valid to submit zero passes.  This will send an empty batch of work to the GPU.
+  ]],
   related = {
     'lovr.graphics.wait'
   }

+ 2 - 1
api/lovr/headset/getClipDistance.lua

@@ -14,7 +14,8 @@ return {
     far = {
       type = 'number',
       description = [[
-        The distance to the far clipping plane, in meters, or 0 for an infinite far clipping plane.
+        The distance to the far clipping plane, in meters, or 0 for an infinite far clipping plane
+        with a reversed Z range.
       ]]
     }
   },

+ 5 - 2
api/lovr/headset/setClipDistance.lua

@@ -12,7 +12,10 @@ return {
     },
     far = {
       type = 'number',
-      description = 'The distance to the far clipping plane, in meters.'
+      description = [[
+        The distance to the far clipping plane, in meters, or 0 for an infinite far clipping plane
+        with a reversed Z range.
+      ]]
     }
   },
   returns = {},
@@ -22,5 +25,5 @@ return {
       returns = {}
     }
   },
-  notes = 'The default clip distances are 0.1 and 100.0.'
+  notes = 'The default clip distances are 0.01 and 0.0.'
 }

+ 1 - 0
api/lovr/math/Quat/set.lua

@@ -15,6 +15,7 @@ return {
   ]],
   arguments = {
     angle = {
+      type = 'number',
       default = '0',
       description = 'The angle to use for the rotation, in radians.'
     },

+ 1 - 0
api/lovr/math/newQuat.lua

@@ -4,6 +4,7 @@ return {
   description = 'Creates a new quaternion.  This function takes the same arguments as `Quat:set`.',
   arguments = {
     angle = {
+      type = 'number',
       default = '0',
       description = 'An angle to use for the rotation, in radians.'
     },

+ 1 - 0
api/lovr/math/quat.lua

@@ -6,6 +6,7 @@ return {
   ]],
   arguments = {
     angle = {
+      type = 'number',
       default = '0',
       description = 'An angle to use for the rotation, in radians.'
     },

+ 1 - 3
api/lovr/thread/Thread/start.lua

@@ -14,9 +14,7 @@ return {
       returns = {}
     }
   },
-  notes = [[
-    TODO what type can the arguments be?
-  ]],
+  notes = 'The arguments can be nil, booleans, numbers, strings, or LÖVR objects.',
   example = [=[
     function lovr.load()
       lovr.thread.newThread([[

+ 2 - 2
api/main.lua

@@ -116,12 +116,12 @@ local function processFunction(path, parent)
 
     for _, variant in ipairs(fn.variants) do
       for i, name in ipairs(variant.arguments) do
-        assert(fn.arguments[name], string.format('Function %q variant argument %q does not exist', fn.key, name))
+        warnIf(not fn.arguments[name], string.format('Function %q variant argument %q does not exist', fn.key, name))
         variant.arguments[i] = copy(fn.arguments[name])
       end
 
       for i, name in ipairs(variant.returns) do
-        assert(fn.returns[name], string.format('Function %q variant return %q does not exist', fn.key, name))
+        warnIf(not fn.returns[name], string.format('Function %q variant return %q does not exist', fn.key, name))
         variant.returns[i] = copy(fn.returns[name])
       end
     end

Некоторые файлы не были показаны из-за большого количества измененных файлов