Jelajahi Sumber

Add more validation and fix issues; Rasterizer docs;

bjorn 2 tahun lalu
induk
melakukan
a62bf1abb2
58 mengubah file dengan 1272 tambahan dan 307 penghapusan
  1. 674 153
      api/init.lua
  2. 6 6
      api/lovr/audio/AudioMaterial.lua
  3. 0 1
      api/lovr/audio/Source/getOrientation.lua
  4. 0 1
      api/lovr/audio/Source/getPose.lua
  5. 0 1
      api/lovr/audio/Source/getPosition.lua
  6. 0 1
      api/lovr/audio/Source/setOrientation.lua
  7. 2 2
      api/lovr/data/Image/getPixel.lua
  8. 2 2
      api/lovr/data/Image/paste.lua
  9. 2 2
      api/lovr/data/Image/setPixel.lua
  10. 1 1
      api/lovr/data/ModelData/getMeshVertexFormat.lua
  11. 19 6
      api/lovr/data/Rasterizer/getAdvance.lua
  12. 33 0
      api/lovr/data/Rasterizer/getBearing.lua
  13. 54 0
      api/lovr/data/Rasterizer/getBoundingBox.lua
  14. 41 0
      api/lovr/data/Rasterizer/getCurves.lua
  15. 1 1
      api/lovr/data/Rasterizer/getDescent.lua
  16. 43 0
      api/lovr/data/Rasterizer/getDimensions.lua
  17. 23 0
      api/lovr/data/Rasterizer/getFontSize.lua
  18. 24 5
      api/lovr/data/Rasterizer/getHeight.lua
  19. 53 0
      api/lovr/data/Rasterizer/getKerning.lua
  20. 24 0
      api/lovr/data/Rasterizer/getLeading.lua
  21. 0 24
      api/lovr/data/Rasterizer/getLineHeight.lua
  22. 39 0
      api/lovr/data/Rasterizer/getWidth.lua
  23. 1 1
      api/lovr/data/Rasterizer/hasGlyphs.lua
  24. 43 0
      api/lovr/data/Rasterizer/newImage.lua
  25. 6 8
      api/lovr/graphics/FilterMode.lua
  26. 1 1
      api/lovr/graphics/Font/getKerning.lua
  27. 0 34
      api/lovr/graphics/Material/setTexture.lua
  28. 1 1
      api/lovr/graphics/Model/getNodeDrawCount.lua
  29. 2 2
      api/lovr/graphics/Pass/getProjection.lua
  30. 2 2
      api/lovr/graphics/Pass/getViewPose.lua
  31. 4 4
      api/lovr/graphics/Pass/origin.lua
  32. 1 1
      api/lovr/graphics/Pass/setCullMode.lua
  33. 3 3
      api/lovr/graphics/Pass/setDepthClamp.lua
  34. 2 2
      api/lovr/graphics/Pass/setDepthOffset.lua
  35. 4 4
      api/lovr/graphics/Pass/setDepthTest.lua
  36. 3 3
      api/lovr/graphics/Pass/setDepthWrite.lua
  37. 2 2
      api/lovr/graphics/Pass/setProjection.lua
  38. 1 1
      api/lovr/graphics/Pass/setScissor.lua
  39. 2 2
      api/lovr/graphics/Pass/setStencilTest.lua
  40. 2 2
      api/lovr/graphics/Pass/setStencilWrite.lua
  41. 2 2
      api/lovr/graphics/Pass/setViewPose.lua
  42. 1 1
      api/lovr/graphics/Pass/setViewport.lua
  43. 1 1
      api/lovr/graphics/Pass/setWinding.lua
  44. 3 3
      api/lovr/graphics/Pass/transform.lua
  45. 3 3
      api/lovr/graphics/Pass/translate.lua
  46. 1 1
      api/lovr/graphics/StackType.lua
  47. 9 11
      api/lovr/graphics/WrapMode.lua
  48. 3 2
      api/lovr/math/Curve/render.lua
  49. 1 1
      api/lovr/math/Mat4/fov.lua
  50. 1 1
      api/lovr/math/Mat4/identity.lua
  51. 1 1
      api/lovr/math/Mat4/orthographic.lua
  52. 1 1
      api/lovr/math/Mat4/perspective.lua
  53. 21 0
      api/lovr/system/getWindowDensity.lua
  54. 27 0
      api/lovr/system/getWindowDimensions.lua
  55. 23 0
      api/lovr/system/getWindowHeight.lua
  56. 23 0
      api/lovr/system/getWindowWidth.lua
  57. 24 0
      api/lovr/system/isWindowOpen.lua
  58. 6 0
      api/main.lua

File diff ditekan karena terlalu besar
+ 674 - 153
api/init.lua


+ 6 - 6
api/lovr/audio/AudioMaterial.lua

@@ -24,27 +24,27 @@ return {
     },
     {
       name = 'glass',
-      descripion = 'Glass.'
+      description = 'Glass.'
     },
     {
       name = 'gravel',
-      descripion = 'Gravel.'
+      description = 'Gravel.'
     },
     {
       name = 'metal',
-      descripion = 'Metal.'
+      description = 'Metal.'
     },
     {
       name = 'plaster',
-      descripion = 'Plaster.'
+      description = 'Plaster.'
     },
     {
       name = 'rock',
-      descripion = 'Rock.'
+      description = 'Rock.'
     },
     {
       name = 'wood',
-      descripion = 'Wood.'
+      description = 'Wood.'
     }
   }
 }

+ 0 - 1
api/lovr/audio/Source/getOrientation.lua

@@ -30,7 +30,6 @@ return {
   related = {
     'Source:getPosition',
     'Source:getPose',
-    'Source:getCone',
     'lovr.audio.getOrientation'
   }
 }

+ 0 - 1
api/lovr/audio/Source/getPose.lua

@@ -42,7 +42,6 @@ return {
   related = {
     'Source:getPosition',
     'Source:getOrientation',
-    'Source:getCone',
     'lovr.audio.getPose'
   }
 }

+ 0 - 1
api/lovr/audio/Source/getPosition.lua

@@ -29,7 +29,6 @@ return {
   related = {
     'Source:getOrientation',
     'Source:getPose',
-    'Source:getCone',
     'lovr.audio.getPosition'
   }
 }

+ 0 - 1
api/lovr/audio/Source/setOrientation.lua

@@ -30,7 +30,6 @@ return {
   related = {
     'Source:setPosition',
     'Source:setPose',
-    'Source:setCone',
     'lovr.audio.setOrientation'
   }
 }

+ 2 - 2
api/lovr/data/Image/getPixel.lua

@@ -40,7 +40,7 @@ return {
   ]],
   related = {
     'Image:setPixel',
-    'Texture:replacePixels',
-    'TextureFormat'
+    'TextureFormat',
+    'Pass:copy'
   }
 }

+ 2 - 2
api/lovr/data/Image/paste.lua

@@ -52,8 +52,8 @@ return {
     The rectangle cannot go outside the dimensions of the source or destination textures.
   ]],
   related = {
-    'Texture:replacePixels',
     'Image:getPixel',
-    'Image:setPixel'
+    'Image:setPixel',
+    'Pass:copy'
   }
 }

+ 2 - 2
api/lovr/data/Image/setPixel.lua

@@ -40,7 +40,7 @@ return {
   ]],
   related = {
     'Image:getPixel',
-    'Texture:replacePixels',
-    'TextureFormat'
+    'TextureFormat',
+    'Pass:copy'
   }
 }

+ 1 - 1
api/lovr/data/ModelData/getMeshVertexFormat.lua

@@ -36,6 +36,6 @@ return {
     - The `stride` is the number of bytes between consecutive values.
   ]],
   related = {
-    'ModelData:getIndexFormat'
+    'ModelData:getMeshIndexFormat'
   }
 }

+ 19 - 6
api/lovr/data/Rasterizer/getAdvance.lua

@@ -1,19 +1,32 @@
 return {
-  summary = 'Get the advance of the font.',
+  summary = 'Get the advance of a glyph.',
   description = [[
-    Returns the advance metric of the font, in pixels.  The advance is how many pixels the font
-    advances horizontally after each glyph is rendered.  This does not include kerning.
+    Returns the advance metric for a glyph, in pixels.  The advance is the horizontal distance to
+    advance the cursor after rendering the glyph.
   ]],
-  arguments = {},
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
   returns = {
     advance = {
       type = 'number',
-      description = 'The advance of the font, in pixels.'
+      description = 'The advance of the glyph, in pixels.'
     }
   },
   variants = {
     {
-      arguments = {},
+      arguments = { 'character' },
+      returns = { 'advance' }
+    },
+    {
+      arguments = { 'codepoint' },
       returns = { 'advance' }
     }
   }

+ 33 - 0
api/lovr/data/Rasterizer/getBearing.lua

@@ -0,0 +1,33 @@
+return {
+  summary = 'Get the bearing of a glyph.',
+  description = [[
+    Returns the bearing metric for a glyph, in pixels.  The bearing is the horizontal distance from
+    the cursor to the edge of the glyph.
+  ]],
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
+  returns = {
+    bearing = {
+      type = 'number',
+      description = 'The bearing of the glyph, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character' },
+      returns = { 'bearing' }
+    },
+    {
+      arguments = { 'codepoint' },
+      returns = { 'bearing' }
+    }
+  }
+}

+ 54 - 0
api/lovr/data/Rasterizer/getBoundingBox.lua

@@ -0,0 +1,54 @@
+return {
+  summary = 'Get the bounding box of a glyph, or the font.',
+  description = [[
+    Returns the bounding box of a glyph, or the bounding box surrounding all glyphs.  Note that font
+    coordinates use a cartesian "y up" coordinate system.
+  ]],
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
+  returns = {
+    x1 = {
+      type = 'number',
+      description = 'The left edge of the bounding box, in pixels.'
+    },
+    y1 = {
+      type = 'number',
+      description = 'The bottom edge of the bounding box, in pixels.'
+    },
+    x2 = {
+      type = 'number',
+      description = 'The right edge of the bounding box, in pixels.'
+    },
+    y2 = {
+      type = 'number',
+      description = 'The top edge of the bounding box, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character' },
+      returns = { 'x1', 'y1', 'x2', 'y2' }
+    },
+    {
+      arguments = { 'codepoint' },
+      returns = { 'x1', 'y1', 'x2', 'y2' }
+    },
+    {
+      arguments = {},
+      returns = { 'x1', 'y1', 'x2', 'y2' }
+    }
+  },
+  related = {
+    'Rasterizer:getWidth',
+    'Rasterizer:getHeight',
+    'Rasterizer:getDimensions'
+  }
+}

+ 41 - 0
api/lovr/data/Rasterizer/getCurves.lua

@@ -0,0 +1,41 @@
+return {
+  summary = 'Get the bezier curves defining a glyph.',
+  description = 'Returns the bezier curve control points defining the shape of a glyph.',
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    },
+    three = {
+      type = 'boolean',
+      description = 'Whether the control points should be 3D or 2D.'
+    }
+  },
+  returns = {
+    curves = {
+      type = 'table',
+      description = [[
+        A table of curves.  Each curve is a table of numbers representing the control points (2 for
+        a line, 3 for a quadratic curve, etc.).
+      ]]
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character', 'three' },
+      returns = { 'curves' }
+    },
+    {
+      arguments = { 'codepoint', 'three' },
+      returns = { 'curves' }
+    }
+  },
+  related = {
+    'Curve',
+    'Rasterizer:newImage'
+  }
+}

+ 1 - 1
api/lovr/data/Rasterizer/getDescent.lua

@@ -18,7 +18,7 @@ return {
     }
   },
   related = {
-    'Rasterzer:getAscent',
+    'Rasterizer:getAscent',
     'Font:getDescent'
   }
 }

+ 43 - 0
api/lovr/data/Rasterizer/getDimensions.lua

@@ -0,0 +1,43 @@
+return {
+  summary = 'Get the dimensions of a glyph, or the font.',
+  description = 'Returns the dimensions of a glyph, or the dimensions of any glyph.',
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
+  returns = {
+    width = {
+      type = 'number',
+      description = 'The width, in pixels.'
+    },
+    height = {
+      type = 'number',
+      description = 'The height, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character' },
+      returns = { 'width', 'height' }
+    },
+    {
+      arguments = { 'codepoint' },
+      returns = { 'width', 'height' }
+    },
+    {
+      arguments = {},
+      returns = { 'width', 'height' }
+    }
+  },
+  related = {
+    'Rasterizer:getWidth',
+    'Rasterizer:getHeight',
+    'Rasterizer:getBoundingBox'
+  }
+}

+ 23 - 0
api/lovr/data/Rasterizer/getFontSize.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the size of the font.',
+  description = [[
+    Returns the size of the font, in pixels.  This is the size the rasterizer was created with, and
+    defines the size of images it rasterizes.
+  ]],
+  arguments = {},
+  returns = {
+    size = {
+      type = 'number',
+      description = 'The font size, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'size' }
+    }
+  },
+  related = {
+    'Rasterizer:getHeight'
+  }
+}

+ 24 - 5
api/lovr/data/Rasterizer/getHeight.lua

@@ -1,20 +1,39 @@
 return {
-  summary = 'Get the height of the font.',
-  description = 'Returns the height metric of the font, in pixels.',
-  arguments = {},
+  summary = 'Get the height of a glyph, or the font.',
+  description = 'Returns the height of a glyph, or the maximum height of any glyph.',
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
   returns = {
     height = {
       type = 'number',
-      description = 'The height of the font, in pixels.'
+      description = 'The height, in pixels.'
     }
   },
   variants = {
+    {
+      arguments = { 'character' },
+      returns = { 'height' }
+    },
+    {
+      arguments = { 'codepoint' },
+      returns = { 'height' }
+    },
     {
       arguments = {},
       returns = { 'height' }
     }
   },
   related = {
-    'Font:getHeight'
+    'Rasterizer:getWidth',
+    'Rasterizer:getDimensions',
+    'Rasterizer:getBoundingBox'
   }
 }

+ 53 - 0
api/lovr/data/Rasterizer/getKerning.lua

@@ -0,0 +1,53 @@
+return {
+  summary = 'Get the kerning between two glyphs.',
+  description = [[
+    Returns the kerning between 2 glyphs, in pixels.  Kerning is a slight horizontal adjustment
+    between 2 glyphs to improve the visual appearance.  It will often be negative.
+  ]],
+  arguments = {
+    first = {
+      type = 'string',
+      description = 'The first character.'
+    },
+    firstCodepoint = {
+      type = 'number',
+      description = 'The first codepoint.'
+    },
+    second = {
+      type = 'string',
+      description = 'The second character.'
+    },
+    secondCodepoint = {
+      name = 'secondCodepoint',
+      type = 'number',
+      description = 'The second codepoint.'
+    }
+  },
+  returns = {
+    keming = {
+      type = 'number',
+      description = 'The kerning between the two glyphs.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'first', 'second' },
+      returns = { 'keming' }
+    },
+    {
+      arguments = { 'firstCodepoint', 'second' },
+      returns = { 'keming' }
+    },
+    {
+      arguments = { 'first', 'secondCodepoint' },
+      returns = { 'keming' }
+    },
+    {
+      arguments = { 'firstCodepoint', 'secondCodepoint' },
+      returns = { 'keming' }
+    }
+  },
+  related = {
+    'Font:getKerning'
+  }
+}

+ 24 - 0
api/lovr/data/Rasterizer/getLeading.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the leading of the font.',
+  description = [[
+    Returns the leading metric of the font, in pixels.  This is the full amount of space between
+    lines.
+  ]],
+  arguments = {},
+  returns = {
+    leading = {
+      type = 'number',
+      description = 'The font leading, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'leading' }
+    }
+  },
+  related = {
+    'Rasterizer:getAscent',
+    'Rasterizer:getDescent'
+  }
+}

+ 0 - 24
api/lovr/data/Rasterizer/getLineHeight.lua

@@ -1,24 +0,0 @@
-return {
-  summary = 'Get the line height of the font.',
-  description = [[
-    Returns the line height metric of the font, in pixels.  This is how far apart lines are.
-  ]],
-  arguments = {},
-  returns = {
-    height = {
-      type = 'number',
-      description = 'The line height of the font, in pixels.'
-    }
-  },
-  variants = {
-    {
-      arguments = {},
-      returns = { 'height' }
-    }
-  },
-  related = {
-    'Rasterizer:getHeight',
-    'Font:getLineHeight',
-    'Font:setLineHeight'
-  }
-}

+ 39 - 0
api/lovr/data/Rasterizer/getWidth.lua

@@ -0,0 +1,39 @@
+return {
+  summary = 'Get the width of a glyph, or the font.',
+  description = 'Returns the width of a glyph, or the maximum width of any glyph.',
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    }
+  },
+  returns = {
+    width = {
+      type = 'number',
+      description = 'The width, in pixels.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character' },
+      returns = { 'width' }
+    },
+    {
+      arguments = { 'codepoint' },
+      returns = { 'width' }
+    },
+    {
+      arguments = {},
+      returns = { 'width' }
+    }
+  },
+  related = {
+    'Rasterizer:getHeight',
+    'Rasterizer:getDimensions',
+    'Rasterizer:getBoundingBox'
+  }
+}

+ 1 - 1
api/lovr/data/Rasterizer/hasGlyphs.lua

@@ -1,6 +1,6 @@
 return {
   summary = 'Get whether the Rasterizer can rasterize a set of glyphs.',
-  description = 'Check if the Rasterizer can rasterize a set of glyphs.',
+  description = 'Returns whether the Rasterizer can rasterize a set of glyphs.',
   arguments = {
     ['...'] = {
       type = '*',

+ 43 - 0
api/lovr/data/Rasterizer/newImage.lua

@@ -0,0 +1,43 @@
+return {
+  summary = 'Get an Image of a rasterized glyph.',
+  description = 'Returns an `Image` containing a rasterized glyph.',
+  arguments = {
+    character = {
+      type = 'string',
+      description = 'A character.'
+    },
+    codepoint = {
+      type = 'number',
+      description = 'A codepoint.'
+    },
+    spread = {
+      type = 'number',
+      default = '4.0',
+      description = 'The width of the distance field, for signed distance field rasterization.'
+    },
+    padding = {
+      type = 'number',
+      default = 'spread / 2',
+      description = 'The number of pixels of padding to add at the edges of the image.'
+    }
+  },
+  returns = {
+    image = {
+      type = 'Image',
+      description = 'The glyph image.  It will be in the `rgba32f` format.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'character', 'spread', 'padding' },
+      returns = { 'image' }
+    },
+    {
+      arguments = { 'codepoint', 'spread', 'padding' },
+      returns = { 'image' }
+    }
+  },
+  related = {
+    'Rasterizer:getCurves'
+  }
+}

+ 6 - 8
api/lovr/graphics/FilterMode.lua

@@ -3,14 +3,12 @@ return {
   description = 'Controls how `Sampler` objects smooth pixels in textures.',
   values = {
     {
-      {
-        name = 'nearest',
-        description = 'A pixelated appearance where the "nearest neighbor" pixel is used.'
-      },
-      {
-        name = 'linear',
-        description = 'A smooth appearance where neighboring pixels are averaged.'
-      }
+      name = 'nearest',
+      description = 'A pixelated appearance where the "nearest neighbor" pixel is used.'
+    },
+    {
+      name = 'linear',
+      description = 'A smooth appearance where neighboring pixels are averaged.'
     }
   },
   related = {

+ 1 - 1
api/lovr/graphics/Font/getKerning.lua

@@ -16,7 +16,7 @@ return {
     },
     second = {
       type = 'string',
-      description = 'The second letter.'
+      description = 'The second character.'
     },
     secondCodepoint = {
       name = 'secondCodepoint',

+ 0 - 34
api/lovr/graphics/Material/setTexture.lua

@@ -1,34 +0,0 @@
-return {
-  summary = 'Set a texture for the Material.',
-  description = [[
-    Sets a texture for a Material.  Several predefined `MaterialTexture`s are supported.  Any
-    texture that is `nil` will use a single white pixel as a fallback.
-  ]],
-  arguments = {
-    textureType = {
-      type = 'MaterialTexture',
-      default = [['diffuse']],
-      description = 'The type of texture to set.'
-    },
-    texture = {
-      type = 'Texture',
-      description = 'The texture to apply, or `nil` to use the default.'
-    }
-  },
-  returns = {},
-  variants = {
-    {
-      arguments = { 'textureType', 'texture' },
-      returns = {}
-    },
-    {
-      arguments = { 'texture' },
-      returns = {}
-    }
-  },
-  notes = 'Textures must have a `TextureType` of `2d` to be used with Materials.',
-  related = {
-    'MaterialTexture',
-    'lovr.graphics.newTexture'
-  }
-}

+ 1 - 1
api/lovr/graphics/Model/getNodeDrawCount.lua

@@ -30,7 +30,7 @@ return {
     }
   },
   related = {
-    'ModelData:getNodeMeshCount',
+    'ModelData:getMeshCount',
     'Model:getNodeDraw'
   }
 }

+ 2 - 2
api/lovr/graphics/Pass/getProjection.lua

@@ -47,7 +47,7 @@ return {
   related = {
     'lovr.headset.getViewAngles',
     'lovr.headset.getViewCount',
-    'lovr.graphics.getViewPose',
-    'lovr.graphics.setViewPose'
+    'Pass:getViewPose',
+    'Pass:setViewPose'
   }
 }

+ 2 - 2
api/lovr/graphics/Pass/getViewPose.lua

@@ -63,7 +63,7 @@ return {
   related = {
     'lovr.headset.getViewPose',
     'lovr.headset.getViewCount',
-    'lovr.graphics.getProjection',
-    'lovr.graphics.setProjection'
+    'Pass:getProjection',
+    'Pass:setProjection'
   }
 }

+ 4 - 4
api/lovr/graphics/Pass/origin.lua

@@ -11,9 +11,9 @@ return {
     }
   },
   related = {
-    'lovr.graphics.translate',
-    'lovr.graphics.rotate',
-    'lovr.graphics.scale',
-    'lovr.graphics.transform'
+    'Pass:translate',
+    'Pass:rotate',
+    'Pass:scale',
+    'Pass:transform'
   }
 }

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

@@ -18,6 +18,6 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setWinding'
+    'Pass:setWinding'
   }
 }

+ 3 - 3
api/lovr/graphics/Pass/setDepthClamp.lua

@@ -17,8 +17,8 @@ return {
   },
   notes = 'TODO depthClamp feature!',
   related = {
-    'lovr.graphics.setDepthTest',
-    'lovr.graphics.setDepthWrite',
-    'lovr.graphics.setDepthOffset'
+    'Pass:setDepthTest',
+    'Pass:setDepthWrite',
+    'Pass:setDepthOffset'
   }
 }

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

@@ -23,7 +23,7 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setDepthTest',
-    'lovr.graphics.setDepthWrite'
+    'Pass:setDepthTest',
+    'Pass:setDepthWrite'
   }
 }

+ 4 - 4
api/lovr/graphics/Pass/setDepthTest.lua

@@ -22,9 +22,9 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setDepthWrite',
-    'lovr.graphics.setDepthOffset',
-    'lovr.graphics.setDepthClamp',
-    'lovr.graphics.setStencilTest'
+    'Pass:setDepthWrite',
+    'Pass:setDepthOffset',
+    'Pass:setDepthClamp',
+    'Pass:setStencilTest'
   }
 }

+ 3 - 3
api/lovr/graphics/Pass/setDepthWrite.lua

@@ -17,8 +17,8 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setDepthTest',
-    'lovr.graphics.setStencilWrite',
-    'lovr.graphics.setColorWrite'
+    'Pass:setDepthTest',
+    'Pass:setStencilWrite',
+    'Pass:setColorWrite'
   }
 }

+ 2 - 2
api/lovr/graphics/Pass/setProjection.lua

@@ -65,7 +65,7 @@ return {
   related = {
     'lovr.headset.getViewAngles',
     'lovr.headset.getViewCount',
-    'lovr.graphics.getViewPose',
-    'lovr.graphics.setViewPose'
+    'Pass:getViewPose',
+    'Pass:setViewPose'
   }
 }

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

@@ -31,6 +31,6 @@ return {
     TODO not floating point, negative, limits, not pipeline, initial pass state
   ]],
   related = {
-    'lovr.graphics.setViewport'
+    'Pass:setViewport'
   }
 }

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

@@ -31,7 +31,7 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setStencilWrite',
-    'lovr.graphics.setDepthTest'
+    'Pass:setStencilWrite',
+    'Pass:setDepthTest'
   }
 }

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

@@ -43,7 +43,7 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setStencilTest',
-    'lovr.graphics.setDepthTest'
+    'Pass:setStencilTest',
+    'Pass:setDepthTest'
   }
 }

+ 2 - 2
api/lovr/graphics/Pass/setViewPose.lua

@@ -64,8 +64,8 @@ return {
   related = {
     'lovr.headset.getViewPose',
     'lovr.headset.getViewCount',
-    'lovr.graphics.getProjection',
-    'lovr.graphics.setProjection'
+    'Pass:getProjection',
+    'Pass:setProjection'
   }
 }
 

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

@@ -42,6 +42,6 @@ return {
     what the hell is depth range
   ]],
   related = {
-    'lovr.graphics.setScissor'
+    'Pass:setScissor'
   }
 }

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

@@ -17,6 +17,6 @@ return {
   },
   notes = 'TODO',
   related = {
-    'lovr.graphics.setCullMode'
+    'Pass:setCullMode'
   }
 }

+ 3 - 3
api/lovr/graphics/Pass/transform.lua

@@ -73,8 +73,8 @@ return {
     TODO you can use combos of numbers/vectors/quats too (or use meta Transform type to explain)
   ]],
   related = {
-    'lovr.graphics.translate',
-    'lovr.graphics.rotate',
-    'lovr.graphics.scale'
+    'Pass:translate',
+    'Pass:rotate',
+    'Pass:scale'
   }
 }

+ 3 - 3
api/lovr/graphics/Pass/translate.lua

@@ -36,8 +36,8 @@ return {
   },
   notes = 'Order matters when scaling, translating, and rotating the coordinate system.',
   related = {
-    'lovr.graphics.rotate',
-    'lovr.graphics.scale',
-    'lovr.graphics.transform'
+    'Pass:rotate',
+    'Pass:scale',
+    'Pass:transform'
   }
 }

+ 1 - 1
api/lovr/graphics/StackType.lua

@@ -8,7 +8,7 @@ return {
     },
     {
       name = 'state',
-      descriptioin = 'TODO'
+      description = 'TODO'
     }
   }
 }

+ 9 - 11
api/lovr/graphics/WrapMode.lua

@@ -3,17 +3,15 @@ return {
   description = 'Controls how `Sampler` objects wrap textures.',
   values = {
     {
-      {
-        name = 'clamp',
-        description = [[
-          Pixels will be clamped to the edge, with pixels outside the 0-1 uv range using colors from
-          the nearest edge.
-        ]]
-      },
-      {
-        name = 'repeat',
-        description = 'Tiles the texture.'
-      }
+      name = 'clamp',
+      description = [[
+        Pixels will be clamped to the edge, with pixels outside the 0-1 uv range using colors from
+        the nearest edge.
+      ]]
+    },
+    {
+      name = 'repeat',
+      description = 'Tiles the texture.'
     }
   }
 }

+ 3 - 2
api/lovr/math/Curve/render.lua

@@ -39,7 +39,8 @@ return {
   related = {
     'Curve:evaluate',
     'Curve:slice',
-    'lovr.graphics.points',
-    'lovr.graphics.line'
+    'Pass:points',
+    'Pass:line',
+    'Pass:mesh'
   }
 }

+ 1 - 1
api/lovr/math/Mat4/fov.lua

@@ -46,6 +46,6 @@ return {
   related = {
     'Mat4:orthographic',
     'Mat4:perspective',
-    'lovr.graphics.setProjection'
+    'Pass:setProjection'
   }
 }

+ 1 - 1
api/lovr/math/Mat4/identity.lua

@@ -18,6 +18,6 @@ return {
     }
   },
   related = {
-    'lovr.graphics.origin'
+    'Pass:origin'
   }
 }

+ 1 - 1
api/lovr/math/Mat4/orthographic.lua

@@ -47,6 +47,6 @@ return {
   related = {
     'Mat4:perspective',
     'Mat4:fov',
-    'lovr.graphics.setProjection'
+    'Pass:setProjection'
   }
 }

+ 1 - 1
api/lovr/math/Mat4/perspective.lua

@@ -39,6 +39,6 @@ return {
   related = {
     'Mat4:orthographic',
     'Mat4:fov',
-    'lovr.graphics.setProjection'
+    'Pass:setProjection'
   }
 }

+ 21 - 0
api/lovr/system/getWindowDensity.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Get the window pixel density.',
+  description = [[
+    Returns the window pixel density.  High DPI windows will usually return 2.0 to indicate that
+    there are 2 pixels for every window coordinate in each axis.  On a normal display, 1.0 is
+    returned, indicating that window coordinates match up with pixels 1:1.
+  ]],
+  arguments = {},
+  returns = {
+    density = {
+      type = 'number',
+      description = 'The pixel density of the window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'density' }
+    }
+  }
+}

+ 27 - 0
api/lovr/system/getWindowDimensions.lua

@@ -0,0 +1,27 @@
+return {
+  summary = 'Get the dimensions of the window.',
+  description = 'Returns the dimensions of the desktop window.',
+  arguments = {},
+  returns = {
+    width = {
+      type = 'number',
+      description = 'The width of the desktop window.'
+    },
+    height = {
+      type = 'number',
+      description = 'The height of the desktop window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'width', 'height' }
+    }
+  },
+  notes = 'If the window is not open, this will return zeros.',
+  related = {
+    'lovr.system.getWindowWidth',
+    'lovr.system.getWindowHeight',
+    'lovr.system.isWindowOpen'
+  }
+}

+ 23 - 0
api/lovr/system/getWindowHeight.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the height of the window.',
+  description = 'Returns the height of the desktop window.',
+  arguments = {},
+  returns = {
+    width = {
+      type = 'number',
+      description = 'The height of the desktop window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'width' }
+    }
+  },
+  notes = 'If the window is not open, this will return zero.',
+  related = {
+    'lovr.system.getWindowWidth',
+    'lovr.system.getWindowDimensions',
+    'lovr.system.isWindowOpen'
+  }
+}

+ 23 - 0
api/lovr/system/getWindowWidth.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the width of the window.',
+  description = 'Returns the width of the desktop window.',
+  arguments = {},
+  returns = {
+    width = {
+      type = 'number',
+      description = 'The width of the desktop window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'width' }
+    }
+  },
+  notes = 'If the window is not open, this will return zero.',
+  related = {
+    'lovr.system.getWindowHeight',
+    'lovr.system.getWindowDimensions',
+    'lovr.system.isWindowOpen'
+  }
+}

+ 24 - 0
api/lovr/system/isWindowOpen.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Check if the desktop window is open.',
+  description = [[
+    Returns whether the desktop window is open.  `t.window` can be set to `nil` in `lovr.conf` to
+    disable automatic opening of the window.  In this case, the window can be opened manually using
+    `lovr.system.openWindow`.
+  ]],
+  arguments = {},
+  returns = {
+    open = {
+      type = 'boolean',
+      description = 'Whether the desktop window is open.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'open' }
+    }
+  },
+  related = {
+    'lovr.system.openWindow'
+  }
+}

+ 6 - 0
api/main.lua

@@ -247,10 +247,16 @@ end
 local function validateRelated(item)
   for _, key in ipairs(item.related or {}) do
     warnIf(not lookup[key], 'Related item for %s not found: %s', item.key, key)
+    warnIf(key == item.key, 'Item %s should not be related to itself', key)
   end
 end
 
 local function validateEnum(enum)
+  for i, value in ipairs(enum.values) do
+    warnIf(not value.name, 'Enum %s value #%d is missing name', enum.name, i)
+    warnIf(not value.description, 'Enum %s value #%d is missing description', enum.name, i)
+  end
+
   validateRelated(enum)
 end
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini