瀏覽代碼

Write more 0.10.0 docs;

bjorn 7 年之前
父節點
當前提交
b03278b944
共有 65 個文件被更改,包括 2877 次插入88 次删除
  1. 1624 73
      api/init.lua
  2. 15 0
      api/lovr/data/AudioStream/getBitDepth.lua
  3. 15 0
      api/lovr/data/AudioStream/getChannelCount.lua
  4. 12 0
      api/lovr/data/AudioStream/getDuration.lua
  5. 15 0
      api/lovr/data/AudioStream/getSampleRate.lua
  6. 11 0
      api/lovr/data/AudioStream/init.lua
  7. 15 0
      api/lovr/data/AudioStream/seek.lua
  8. 12 0
      api/lovr/data/ModelData/getAnimationCount.lua
  9. 39 0
      api/lovr/data/ModelData/getDiffuseColor.lua
  10. 23 0
      api/lovr/data/ModelData/getDiffuseTexture.lua
  11. 39 0
      api/lovr/data/ModelData/getEmissiveColor.lua
  12. 23 0
      api/lovr/data/ModelData/getEmissiveTexture.lua
  13. 74 0
      api/lovr/data/ModelData/getGlobalNodeTransform.lua
  14. 74 0
      api/lovr/data/ModelData/getLocalNodeTransform.lua
  15. 12 0
      api/lovr/data/ModelData/getMaterialCount.lua
  16. 24 0
      api/lovr/data/ModelData/getMetalness.lua
  17. 24 0
      api/lovr/data/ModelData/getMetalnessTexture.lua
  18. 35 0
      api/lovr/data/ModelData/getNodeChildren.lua
  19. 43 0
      api/lovr/data/ModelData/getNodeComponent.lua
  20. 28 0
      api/lovr/data/ModelData/getNodeComponentCount.lua
  21. 12 0
      api/lovr/data/ModelData/getNodeCount.lua
  22. 19 0
      api/lovr/data/ModelData/getNodeName.lua
  23. 22 0
      api/lovr/data/ModelData/getNodeParent.lua
  24. 22 0
      api/lovr/data/ModelData/getNormalTexture.lua
  25. 22 0
      api/lovr/data/ModelData/getOcclusionTexture.lua
  26. 24 0
      api/lovr/data/ModelData/getRoughness.lua
  27. 24 0
      api/lovr/data/ModelData/getRoughnessTexture.lua
  28. 31 0
      api/lovr/data/ModelData/getTriangle.lua
  29. 20 0
      api/lovr/data/ModelData/getTriangleCount.lua
  30. 18 0
      api/lovr/data/ModelData/getVertexData.lua
  31. 15 0
      api/lovr/data/ModelData/init.lua
  32. 15 0
      api/lovr/data/Rasterizer/getAdvance.lua
  33. 19 0
      api/lovr/data/Rasterizer/getAscent.lua
  34. 19 0
      api/lovr/data/Rasterizer/getDescent.lua
  35. 15 0
      api/lovr/data/Rasterizer/getGlyphCount.lua
  36. 15 0
      api/lovr/data/Rasterizer/getHeight.lua
  37. 19 0
      api/lovr/data/Rasterizer/getLineHeight.lua
  38. 23 0
      api/lovr/data/Rasterizer/hasGlyphs.lua
  39. 9 0
      api/lovr/data/Rasterizer/init.lua
  40. 18 0
      api/lovr/data/TextureData/encode.lua
  41. 22 0
      api/lovr/data/TextureData/getDimensions.lua
  42. 17 0
      api/lovr/data/TextureData/getHeight.lua
  43. 42 0
      api/lovr/data/TextureData/getPixel.lua
  44. 17 0
      api/lovr/data/TextureData/getWidth.lua
  45. 14 0
      api/lovr/data/TextureData/init.lua
  46. 42 0
      api/lovr/data/TextureData/setPixel.lua
  47. 35 0
      api/lovr/data/newAudioStream.lua
  48. 30 0
      api/lovr/data/newModelData.lua
  49. 35 0
      api/lovr/data/newRasterizer.lua
  50. 43 0
      api/lovr/data/newTextureData.lua
  51. 16 0
      api/lovr/graphics/Canvas/newTextureData.lua
  52. 4 0
      api/lovr/graphics/Font/getAscent.lua
  53. 3 0
      api/lovr/graphics/Font/getHeight.lua
  54. 3 0
      api/lovr/graphics/Font/getLineHeight.lua
  55. 4 1
      api/lovr/graphics/Font/setLineHeight.lua
  56. 2 2
      api/lovr/graphics/Mesh/getDrawRange.lua
  57. 1 1
      api/lovr/graphics/Mesh/getVertexMap.lua
  58. 1 1
      api/lovr/graphics/getCanvas.lua
  59. 1 1
      api/lovr/graphics/getShader.lua
  60. 1 1
      api/lovr/graphics/newFont.lua
  61. 2 4
      api/lovr/graphics/newShader.lua
  62. 1 1
      api/lovr/graphics/newTexture.lua
  63. 1 1
      api/lovr/graphics/print.lua
  64. 1 1
      api/lovr/graphics/setCanvas.lua
  65. 1 1
      api/lovr/graphics/setDepthTest.lua

文件差異過大導致無法顯示
+ 1624 - 73
api/init.lua


+ 15 - 0
api/lovr/data/AudioStream/getBitDepth.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the bit depth of the AudioStream.',
+  description = [[
+    Returns the number of bits per sample in the stream's sound data.  This is a rough indicator of
+    the "resolution" of the sound, and is usually 16.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'bits',
+      type = 'number',
+      description = 'The number of bits per sample.'
+    }
+  }
+}

+ 15 - 0
api/lovr/data/AudioStream/getChannelCount.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the number of channels in the AudioStream.',
+  description = [[
+    Returns the number of channels present in the stream's sound data.  Mono sounds have 1 channel
+    and stereo sounds have 2 channels.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'channels',
+      type = 'number',
+      description = 'The number of channels.'
+    }
+  }
+}

+ 12 - 0
api/lovr/data/AudioStream/getDuration.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the duration of the AudioStream.',
+  description = 'Returns the duration of the sound data in seconds.',
+  arguments = {},
+  returns = {
+    {
+      name = 'duration',
+      type = 'number',
+      description = 'The duration of the sound.'
+    }
+  }
+}

+ 15 - 0
api/lovr/data/AudioStream/getSampleRate.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the sample rate of the AudioStream.',
+  description = [[
+    Returns the number of samples per second in the stream's sound data.  This is usually a high
+    number like 44100.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'frequency',
+      type = 'number',
+      description = 'The number of samples per second in the AudioStream.'
+    }
+  }
+}

+ 11 - 0
api/lovr/data/AudioStream/init.lua

@@ -0,0 +1,11 @@
+return {
+  summary = 'An object that gradually decodes audio data.',
+  description = [[
+    An AudioStream is an object that reads and decodes compressed sound data.  All Source objects
+    are powered by AudioStreams.
+
+    Usually you can just use Sources without having to deal with AudioStreams, but sometimes you may
+    need low-level access to the audio stream.
+  ]],
+  constructor = 'lovr.data.newAudioStream'
+}

+ 15 - 0
api/lovr/data/AudioStream/seek.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Seek the stream to a new position.',
+  description = [[
+    Seeks the AudioStream to the specified position.  This will cause any Sources created from the
+    stream to also seek their playback position.
+  ]],
+  arguments = {
+    {
+      name = 'time',
+      type = 'number',
+      description = 'The time to seek to, in seconds.'
+    }
+  },
+  returns = {}
+}

+ 12 - 0
api/lovr/data/ModelData/getAnimationCount.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the number of animations in the ModelData.',
+  description = 'Returns the number of animations in the ModelData.',
+  arguments = {},
+  returns = {
+    {
+      name = 'count',
+      type = 'number',
+      description = 'The number of animations in the ModelData.'
+    }
+  }
+}

+ 39 - 0
api/lovr/data/ModelData/getDiffuseColor.lua

@@ -0,0 +1,39 @@
+return {
+  summary = 'Get the diffuse color of a material in the ModelData.',
+  description = 'Returns the diffuse color of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'r',
+      type = 'number',
+      description = 'The red channel of the diffuse color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'g',
+      type = 'number',
+      description = 'The green channel of the diffuse color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'b',
+      type = 'number',
+      description = 'The blue channel of the diffuse color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'a',
+      type = 'number',
+      description = 'The alpha channel of the diffuse color, from 0.0 to 1.0.'
+    }
+  },
+  related = {
+    'ModelData:getDiffuseTexture',
+    'ModelData:getEmissiveColor',
+    'Material:getColor',
+    'MaterialColor'
+  }
+}

+ 23 - 0
api/lovr/data/ModelData/getDiffuseTexture.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the diffuse texture of a material in the ModelData.',
+  description = 'Returns the diffuse texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The diffuse texture data.'
+    }
+  },
+  related = {
+    'ModelData:getDiffuseColor',
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 39 - 0
api/lovr/data/ModelData/getEmissiveColor.lua

@@ -0,0 +1,39 @@
+return {
+  summary = 'Get the emissive color of a material in the ModelData.',
+  description = 'Returns the emissive color of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'r',
+      type = 'number',
+      description = 'The red channel of the emissive color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'g',
+      type = 'number',
+      description = 'The green channel of the emissive color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'b',
+      type = 'number',
+      description = 'The blue channel of the emissive color, from 0.0 to 1.0.'
+    },
+    {
+      name = 'a',
+      type = 'number',
+      description = 'The alpha channel of the emissive color, from 0.0 to 1.0.'
+    }
+  },
+  related = {
+    'ModelData:getEmissiveTexture',
+    'ModelData:getDiffuseColor',
+    'Material:getColor',
+    'MaterialColor'
+  }
+}

+ 23 - 0
api/lovr/data/ModelData/getEmissiveTexture.lua

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get the emissive texture of a material in the ModelData.',
+  description = 'Returns the emissive texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The emissive texture data.'
+    }
+  },
+  related = {
+    'ModelData:getEmissiveColor',
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 74 - 0
api/lovr/data/ModelData/getGlobalNodeTransform.lua

@@ -0,0 +1,74 @@
+return {
+  summary = 'Get the global transform of a node.',
+  description = 'Returns the transform of a node in the ModelData relative to the root.',
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of the node (1-indexed).'
+    },
+    transform = {
+      type = 'Transform',
+      description = 'The Transform object to fill with the node\'s transform.'
+    }
+  },
+  returns = {
+    transform = {
+      type = 'Transform',
+      description = 'The supplied Transform.'
+    },
+    x = {
+      type = 'number',
+      description = 'The x position of the node.'
+    },
+    y = {
+      type = 'number',
+      description = 'The y position of the node.'
+    },
+    z = {
+      type = 'number',
+      description = 'The z position of the node.'
+    },
+    sx = {
+      type = 'number',
+      description = 'The x scale of the node.'
+    },
+    sy = {
+      type = 'number',
+      description = 'The y scale of the node.'
+    },
+    sz = {
+      type = 'number',
+      description = 'The z scale of the node.'
+    },
+    angle = {
+      type = 'number',
+      description = 'The angle the node is rotated around its axis of rotation.'
+    },
+    ax = {
+      type = 'number',
+      description = 'The x component of the axis of rotation.'
+    },
+    ay = {
+      type = 'number',
+      description = 'The y component of the axis of rotation.'
+    },
+    az = {
+      type = 'number',
+      description = 'The z component of the axis of rotation.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' }
+    },
+    {
+      arguments = { 'index', 'transform' },
+      returns = { 'transform' }
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.',
+  related = {
+    'ModelData:getLocalNodeTransform'
+  }
+}

+ 74 - 0
api/lovr/data/ModelData/getLocalNodeTransform.lua

@@ -0,0 +1,74 @@
+return {
+  summary = 'Get the local transform of a node.',
+  description = 'Returns the transform of a node in the ModelData relative to its parent.',
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of the node (1-indexed).'
+    },
+    transform = {
+      type = 'Transform',
+      description = 'The Transform object to fill with the node\'s transform.'
+    }
+  },
+  returns = {
+    transform = {
+      type = 'Transform',
+      description = 'The supplied Transform.'
+    },
+    x = {
+      type = 'number',
+      description = 'The x position of the node.'
+    },
+    y = {
+      type = 'number',
+      description = 'The y position of the node.'
+    },
+    z = {
+      type = 'number',
+      description = 'The z position of the node.'
+    },
+    sx = {
+      type = 'number',
+      description = 'The x scale of the node.'
+    },
+    sy = {
+      type = 'number',
+      description = 'The y scale of the node.'
+    },
+    sz = {
+      type = 'number',
+      description = 'The z scale of the node.'
+    },
+    angle = {
+      type = 'number',
+      description = 'The angle the node is rotated around its axis of rotation.'
+    },
+    ax = {
+      type = 'number',
+      description = 'The x component of the axis of rotation.'
+    },
+    ay = {
+      type = 'number',
+      description = 'The y component of the axis of rotation.'
+    },
+    az = {
+      type = 'number',
+      description = 'The z component of the axis of rotation.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'x', 'y', 'z', 'sx', 'sy', 'sz', 'angle', 'ax', 'ay', 'az' }
+    },
+    {
+      arguments = { 'index', 'transform' },
+      returns = { 'transform' }
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.',
+  related = {
+    'ModelData:getGlobalNodeTransform'
+  }
+}

+ 12 - 0
api/lovr/data/ModelData/getMaterialCount.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the number of materials in the ModelData.',
+  description = 'Returns the number of materials in the ModelData.',
+  arguments = {},
+  returns = {
+    {
+      name = 'count',
+      type = 'number',
+      description = 'The number of materials in the ModelData.'
+    }
+  }
+}

+ 24 - 0
api/lovr/data/ModelData/getMetalness.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the metalness factor of a material in the ModelData.',
+  description = 'Returns the metalness factor of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'metalness',
+      type = 'number',
+      description = 'The metalness factor for the material, from 0.0 to 1.0.'
+    }
+  },
+  related = {
+    'ModelData:getMetalnessTexture',
+    'ModelData:getRoughness',
+    'Material:getScalar',
+    'MaterialScalar'
+  }
+}

+ 24 - 0
api/lovr/data/ModelData/getMetalnessTexture.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the metalness texture of a material in the ModelData.',
+  description = 'Returns the metalness texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The metalness texture data.'
+    }
+  },
+  related = {
+    'ModelData:getMetalness',
+    'ModelData:getRoughnessTexture',
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 35 - 0
api/lovr/data/ModelData/getNodeChildren.lua

@@ -0,0 +1,35 @@
+return {
+  summary = 'Get the children of a node.',
+  description = 'Returns the children of a node in the ModelData.',
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of the node to get the children of (1-indexed).'
+    },
+    table = {
+      type = 'table',
+      description = 'A table to fill with the children.'
+    }
+  },
+  returns = {
+    children = {
+      type = 'table',
+      description = 'A table of node indices representing the children of the node.'
+    },
+    table = {
+      type = 'table',
+      description = 'The supplied table.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'children' }
+    },
+    {
+      arguments = { 'index', 'table' },
+      returns = { 'table' }
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.'
+}

+ 43 - 0
api/lovr/data/ModelData/getNodeComponent.lua

@@ -0,0 +1,43 @@
+return {
+  summary = 'Get a subcomponent of a node.',
+  description = [[
+    Returns a subcomponent of a node of the ModelData.
+
+    Each node is composed of several pieces of geometry.  These are called the components of a node.
+    A component is a range of vertices and a material.  To render a node, the appropriate material
+    is applied and the component's range of vertices is rendered with that material.
+  ]],
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the node to get the number of components of (1-indexed).'
+    },
+    {
+      name = 'subcomponent',
+      type = 'number',
+      description = 'The index of the subcomponent to retrieve.'
+    }
+  },
+  returns = {
+    {
+      name = 'start',
+      type = 'number',
+      description = 'The index of the first vertex in the subcomponent.'
+    },
+    {
+      name = 'count',
+      type = 'number',
+      description = 'The number of vertices in the subcomponent.'
+    },
+    {
+      name = 'material',
+      type = 'number',
+      description = 'The index of the subcomponent\'s material.'
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index or subcomponent index is supplied.',
+  related = {
+    'ModelData:getNodeComponentCount'
+  }
+}

+ 28 - 0
api/lovr/data/ModelData/getNodeComponentCount.lua

@@ -0,0 +1,28 @@
+return {
+  summary = 'Get the number of subcomponents that comprise a node.',
+  description = [[
+    Returns the number of subcomponents of a node in the ModelData.
+
+    Each node is composed of several pieces of geometry.  These are called the components of a node.
+    A component is a range of vertices and a material.  To render a node, the appropriate material
+    is applied and the component's range of vertices is rendered with that material.
+  ]],
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the node to get the number of components of (1-indexed).'
+    }
+  },
+  returns = {
+    {
+      name = 'count',
+      type = 'number',
+      description = 'The number of components of the node.'
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.',
+  related = {
+    'ModelData:getNodeComponent'
+  }
+}

+ 12 - 0
api/lovr/data/ModelData/getNodeCount.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the number of nodes in the ModelData.',
+  description = 'Returns the number of nodes in the ModelData.',
+  arguments = {},
+  returns = {
+    {
+      name = 'nodes',
+      type = 'number',
+      description = 'The number of nodes.'
+    }
+  }
+}

+ 19 - 0
api/lovr/data/ModelData/getNodeName.lua

@@ -0,0 +1,19 @@
+return {
+  summary = 'Get the name of a node.',
+  description = 'Returns the name of a node in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the node to get the name of (1-indexed).'
+    }
+  },
+  returns = {
+    {
+      name = 'name',
+      type = 'string',
+      description = 'The name of the node.'
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.'
+}

+ 22 - 0
api/lovr/data/ModelData/getNodeParent.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the parent of a node.',
+  description = 'Returns the parent of a node in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the node to get the parent of (1-indexed).'
+    }
+  },
+  returns = {
+    {
+      name = 'parent',
+      type = 'number',
+      description = 'The index of the node\'s parent, or nil if the node is the root node.'
+    }
+  },
+  notes = 'An error will be thrown if an invalid node index is supplied.',
+  related = {
+    'ModelData:getNodeChildren'
+  }
+}

+ 22 - 0
api/lovr/data/ModelData/getNormalTexture.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the normal texture of a material in the ModelData.',
+  description = 'Returns the normal texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The normal texture data.'
+    }
+  },
+  related = {
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 22 - 0
api/lovr/data/ModelData/getOcclusionTexture.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the occlusion texture of a material in the ModelData.',
+  description = 'Returns the occlusion texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The occlusion texture data.'
+    }
+  },
+  related = {
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 24 - 0
api/lovr/data/ModelData/getRoughness.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the roughness factor of a material in the ModelData.',
+  description = 'Returns the roughness factor of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'roughness',
+      type = 'number',
+      description = 'The roughness factor for the material, from 0.0 to 1.0.'
+    }
+  },
+  related = {
+    'ModelData:getMetalness',
+    'ModelData:getRoughnessTexture',
+    'Material:getScalar',
+    'MaterialScalar'
+  }
+}

+ 24 - 0
api/lovr/data/ModelData/getRoughnessTexture.lua

@@ -0,0 +1,24 @@
+return {
+  summary = 'Get the roughness texture of a material in the ModelData.',
+  description = 'Returns the roughness texture of a material in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the material.'
+    }
+  },
+  returns = {
+    {
+      name = 'texture',
+      type = 'TextureData',
+      description = 'The roughness texture data.'
+    }
+  },
+  related = {
+    'ModelData:getRoughness',
+    'ModelData:getMetalnessTexture',
+    'Material:getTexture',
+    'MaterialTexture'
+  }
+}

+ 31 - 0
api/lovr/data/ModelData/getTriangle.lua

@@ -0,0 +1,31 @@
+return {
+  summary = 'Get a triangle in the ModelData.',
+  description = 'Returns a single triangle in the ModelData.',
+  arguments = {
+    {
+      name = 'index',
+      type = 'number',
+      description = 'The index of the triangle to get.'
+    }
+  },
+  returns = {
+    {
+      name = 'i',
+      type = 'number',
+      description = 'The index of the first vertex in the triangle.'
+    },
+    {
+      name = 'j',
+      type = 'number',
+      description = 'The index of the second vertex in the triangle.'
+    },
+    {
+      name = 'k',
+      type = 'number',
+      description = 'The index of the third vertex in the triangle.'
+    }
+  },
+  related = {
+    'ModelData:getTriangleCount'
+  }
+}

+ 20 - 0
api/lovr/data/ModelData/getTriangleCount.lua

@@ -0,0 +1,20 @@
+return {
+  summary = 'Get the number of triangles in the ModelData.',
+  description = 'Returns the number of triangles in the ModelData.',
+  arguments = {},
+  returns = {
+    {
+      name = 'triangles',
+      type = 'number',
+      description = 'The number of triangles.'
+    }
+  },
+  notes = [[
+    This is the number of unique triangles in the ModelData.  A larger or smaller number of
+    triangles may be rendered when the model is drawn because nodes and components of a model can
+    be reused.
+  ]],
+  related = {
+    'ModelData:getTriangle'
+  }
+}

+ 18 - 0
api/lovr/data/ModelData/getVertexData.lua

@@ -0,0 +1,18 @@
+return {
+  summary = 'Get the VertexData contained in the ModelData.',
+  description = 'Returns the VertexData contained in the ModelData.',
+  arguments = {},
+  returns = {
+    {
+      name = 'vertexData',
+      type = 'VertexData',
+      description = 'The VertexData.'
+    }
+  },
+  related = {
+    'VertexData',
+    'ModelData:getTriangle',
+    'ModelData:getTriangles',
+    'ModelData:getTriangleCount'
+  }
+}

+ 15 - 0
api/lovr/data/ModelData/init.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'An object that loads and stores data for 3D models.',
+  description = [[
+    A ModelData is a container object that loads and holds data contained in 3D model files.  This
+    can include a variety of things like the node structure of the asset, the `VertexData` it
+    contains, the `TextureData` and `Material` properties, and any included animations.
+
+    The current supported formats are `obj`, `fbx`, `gltf`, and collada.  glTF files do not
+    currently load animations.
+
+    Usually you can just load a `Model` directly, but using a `ModelData` can be helpful if you want
+    to load models in a thread or access more low-level information about the Model.
+  ]],
+  constructor = 'lovr.data.newModelData'
+}

+ 15 - 0
api/lovr/data/Rasterizer/getAdvance.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the advance of the font.',
+  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.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'advance',
+      type = 'number',
+      description = 'The advance of the font, in pixels.'
+    }
+  }
+}

+ 19 - 0
api/lovr/data/Rasterizer/getAscent.lua

@@ -0,0 +1,19 @@
+return {
+  summary = 'Get the ascent of the font.',
+  description = [[
+    Returns the ascent metric of the font, in pixels.  The ascent represents how far any glyph of
+    the font ascends above the baseline.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'ascent',
+      type = 'number',
+      description = 'The ascent of the font, in pixels.'
+    }
+  },
+  related = {
+    'Rasterizer:getDescent',
+    'Font:getAscent'
+  }
+}

+ 19 - 0
api/lovr/data/Rasterizer/getDescent.lua

@@ -0,0 +1,19 @@
+return {
+  summary = 'Get the descent of the font.',
+  description = [[
+    Returns the descent metric of the font, in pixels.  The descent represents how far any glyph of
+    the font descends below the baseline.
+  ]],
+  arguments = {},
+  returns = {
+    {
+      name = 'descent',
+      type = 'number',
+      description = 'The descent of the font, in pixels.'
+    }
+  },
+  related = {
+    'Rasterzer:getAscent',
+    'Font:getDescent'
+  }
+}

+ 15 - 0
api/lovr/data/Rasterizer/getGlyphCount.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the number of glyphs stored in the font file.',
+  description = 'Returns the number of glyphs stored in the font file.',
+  arguments = {},
+  returns = {
+    {
+      name = 'count',
+      type = 'number',
+      description = 'The number of glyphs stored in the font file.'
+    }
+  },
+  related = {
+    'Rasterizer:hasGlyphs'
+  }
+}

+ 15 - 0
api/lovr/data/Rasterizer/getHeight.lua

@@ -0,0 +1,15 @@
+return {
+  summary = 'Get the height of the font.',
+  description = 'Returns the height metric of the font, in pixels.',
+  arguments = {},
+  returns = {
+    {
+      name = 'height',
+      type = 'number',
+      description = 'The height of the font, in pixels.'
+    }
+  },
+  related = {
+    'Font:getHeight'
+  }
+}

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

@@ -0,0 +1,19 @@
+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 = {
+    {
+      name = 'height',
+      type = 'number',
+      description = 'The line height of the font, in pixels.'
+    }
+  },
+  related = {
+    'Rasterizer:getHeight',
+    'Font:getLineHeight',
+    'Font:setLineHeight'
+  }
+}

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

@@ -0,0 +1,23 @@
+return {
+  summary = 'Get whether the Rasterizer can rasterize a set of glyphs.',
+  description = 'Check if the Rasterizer can rasterize a set of glyphs.',
+  arguments = {
+    {
+      name = '...',
+      type = '*',
+      description = 'Strings (sets of characters) or numbers (character codes) to check for.'
+    }
+  },
+  returns = {
+    {
+      name = 'hasGlyphs',
+      type = 'boolean',
+      description = [[
+        true if the Rasterizer can rasterize all of the supplied characters, false otherwise.
+      ]]
+    }
+  },
+  related = {
+    'Rasterizer:getGlyphCount'
+  }
+}

+ 9 - 0
api/lovr/data/Rasterizer/init.lua

@@ -0,0 +1,9 @@
+return {
+  summary = 'An object that rasterizes glyphs from font files.',
+  description = [[
+    A Rasterizer is an object that parses a TTF file, decoding and rendering glyphs from it.
+
+    Usually you can just use `Font` objects.
+  ]],
+  constructor = 'lovr.data.newRasterizer'
+}

+ 18 - 0
api/lovr/data/TextureData/encode.lua

@@ -0,0 +1,18 @@
+return {
+  summary = 'Encode the TextureData as png and write it to a file.',
+  description = 'Encodes the TextureData to png and writes it to the specified file.',
+  arguments = {
+    {
+      name = 'filename',
+      type = 'string',
+      description = 'The file to write the png data to.'
+    }
+  },
+  returns = {
+    {
+      name = 'success',
+      type = 'boolean',
+      description = 'Whether or not the file was successfully written to.'
+    }
+  }
+}

+ 22 - 0
api/lovr/data/TextureData/getDimensions.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the dimensions of the TextureData.',
+  description = 'Returns the dimensions of the TextureData, in pixels.',
+  arguments = {},
+  returns = {
+    {
+      name = 'width',
+      type = 'number',
+      description = 'The width of the TextureData, in pixels.'
+    },
+    {
+      name = 'height',
+      type = 'number',
+      description = 'The height of the TextureData, in pixels.'
+    }
+  },
+  related = {
+    'TextureData:getWidth',
+    'TextureData:getHeight',
+    'Texture:getDimensions'
+  }
+}

+ 17 - 0
api/lovr/data/TextureData/getHeight.lua

@@ -0,0 +1,17 @@
+return {
+  summary = 'Get the height of the TextureData.',
+  description = 'Returns the height of the TextureData, in pixels.',
+  arguments = {},
+  returns = {
+    {
+      name = 'height',
+      type = 'number',
+      description = 'The height of the TextureData, in pixels.'
+    }
+  },
+  related = {
+    'TextureData:getWidth',
+    'TextureData:getDimensions',
+    'Texture:getHeight'
+  }
+}

+ 42 - 0
api/lovr/data/TextureData/getPixel.lua

@@ -0,0 +1,42 @@
+return {
+  summary = 'Get the value of a pixel of the TextureData.',
+  description = 'Returns the value of a pixel of the TextureData.',
+  arguments = {
+    {
+      name = 'x',
+      type = 'number',
+      description = 'The x coordinate of the pixel to get (0-indexed).'
+    },
+    {
+      name = 'y',
+      type = 'number',
+      description = 'The y coordinate of the pixel to get (0-indexed).'
+    }
+  },
+  returns = {
+    {
+      name = 'r',
+      type = 'number',
+      description = 'The red component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'g',
+      type = 'number',
+      description = 'The green component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'b',
+      type = 'number',
+      description = 'The blue component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'a',
+      type = 'number',
+      description = 'The alpha component of the pixel, from 0.0 to 1.0.'
+    }
+  },
+  related = {
+    'TextureData:setPixel',
+    'Texture:replacePixels'
+  }
+}

+ 17 - 0
api/lovr/data/TextureData/getWidth.lua

@@ -0,0 +1,17 @@
+return {
+  summary = 'Get the width of the TextureData.',
+  description = 'Returns the width of the TextureData, in pixels.',
+  arguments = {},
+  returns = {
+    {
+      name = 'width',
+      type = 'number',
+      description = 'The width of the TextureData, in pixels.'
+    }
+  },
+  related = {
+    'TextureData:getHeight',
+    'TextureData:getDimensions',
+    'Texture:getWidth'
+  }
+}

+ 14 - 0
api/lovr/data/TextureData/init.lua

@@ -0,0 +1,14 @@
+return {
+  summary = 'An object that stores pixel data for Textures.',
+  description = [[
+    A TextureData stores raw pixel info for `Texture`s.  It has a width and a height.  Currently,
+    all TextureData is in the RGBA format.
+
+    Usually you can just use Textures, but TextureData can be useful if you want to manipulate
+    individual pixels or load Textures in a background thread.
+  ]],
+  constructors = {
+    'lovr.data.newTextureData',
+    'Canvas:newTextureData'
+  }
+}

+ 42 - 0
api/lovr/data/TextureData/setPixel.lua

@@ -0,0 +1,42 @@
+return {
+  summary = 'Set the value of a pixel of the TextureData.',
+  description = 'Sets the value of a pixel of the TextureData.',
+  arguments = {
+    {
+      name = 'x',
+      type = 'number',
+      description = 'The x coordinate of the pixel to get (0-indexed).'
+    },
+    {
+      name = 'y',
+      type = 'number',
+      description = 'The y coordinate of the pixel to get (0-indexed).'
+    },
+    {
+      name = 'r',
+      type = 'number',
+      description = 'The red component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'g',
+      type = 'number',
+      description = 'The green component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'b',
+      type = 'number',
+      description = 'The blue component of the pixel, from 0.0 to 1.0.'
+    },
+    {
+      name = 'a',
+      type = 'number',
+      default = '1.0',
+      description = 'The alpha component of the pixel, from 0.0 to 1.0.'
+    }
+  },
+  returns = {},
+  related = {
+    'TextureData:getPixel',
+    'Texture:replacePixels'
+  }
+}

+ 35 - 0
api/lovr/data/newAudioStream.lua

@@ -0,0 +1,35 @@
+return {
+  summary = 'Create a new AudioStream.',
+  description = 'Creates a new AudioStream from ogg data.',
+  arguments = {
+    filename = {
+      type = 'string',
+      description = 'The filename of the audio file to load.'
+    },
+    blob = {
+      type = 'Blob',
+      description = 'The Blob containing audio data to decode.'
+    },
+    bufferSize = {
+      type = 'number',
+      default = '4096',
+      description = 'The size of the stream\'s audio buffer.'
+    }
+  },
+  returns = {
+    audioStream = {
+      type = 'AudioStream',
+      description = 'The new AudioStream.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'filename', 'bufferSize' },
+      returns = { 'audioStream' }
+    },
+    {
+      arguments = { 'blob', 'bufferSize' },
+      returns = { 'audioStream' }
+    }
+  }
+}

+ 30 - 0
api/lovr/data/newModelData.lua

@@ -0,0 +1,30 @@
+return {
+  summary = 'Create a new ModelData.',
+  description = 'Creates a new ModelData from a 3D model file.',
+  arguments = {
+    filename = {
+      type = 'string',
+      description = 'The filename of the model to load.'
+    },
+    blob = {
+      type = 'Blob',
+      description = 'The Blob containing model to decode.'
+    }
+  },
+  returns = {
+    modelData = {
+      type = 'ModelData',
+      description = 'The new ModelData.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'string' },
+      returns = { 'modelData' }
+    },
+    {
+      arguments = { 'blob' },
+      returns = { 'modelData' }
+    }
+  }
+}

+ 35 - 0
api/lovr/data/newRasterizer.lua

@@ -0,0 +1,35 @@
+return {
+  summary = 'Create a new Rasterizer.',
+  description = 'Creates a new Rasterizer from a TTF file.',
+  arguments = {
+    filename = {
+      type = 'string',
+      description = 'The filename of the font file to load.'
+    },
+    blob = {
+      type = 'Blob',
+      description = 'The Blob containing font data.'
+    },
+    size = {
+      type = 'number',
+      default = '32',
+      description = 'The resolution to render the fonts at, in pixels.'
+    }
+  },
+  returns = {
+    rasterizer = {
+      type = 'Rasterizer',
+      description = 'The new Rasterizer.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'filename', 'size' },
+      returns = { 'rasterizer' }
+    },
+    {
+      arguments = { 'blob', 'size' },
+      returns = { 'rasterizer' }
+    }
+  }
+}

+ 43 - 0
api/lovr/data/newTextureData.lua

@@ -0,0 +1,43 @@
+return {
+  summary = 'Create a new TextureData',
+  description = 'Creates a new TextureData with a given width and height or from an image file.',
+  arguments = {
+    width = {
+      type = 'number',
+      description = 'The width of the texture data.'
+    },
+    height = {
+      type = 'number',
+      description = 'The height of the texture data.'
+    },
+    filename = {
+      type = 'string',
+      description = 'The filename of the image to load.'
+    },
+    blob = {
+      type = 'string',
+      description = 'The Blob containing image data to decode.'
+    }
+  },
+  returns = {
+    textureData = {
+      type = 'TextureData',
+      description = 'The new TextureData.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'filename' },
+      returns = { 'textureData' }
+    },
+    {
+      description = 'Create an empty TextureData, initializing all color components to 0.',
+      arguments = { 'width', 'height' },
+      returns = { 'textureData' }
+    },
+    {
+      arguments = { 'blob' },
+      returns = { 'textureData' }
+    }
+  }
+}

+ 16 - 0
api/lovr/graphics/Canvas/newTextureData.lua

@@ -0,0 +1,16 @@
+return {
+  summary = 'Create a new TextureData from the Canvas contents',
+  description = 'Returns a new TextureData containing the current contents of the Canvas.',
+  arguments = {},
+  returns = {
+    {
+      name = 'textureData',
+      type = 'TextureData',
+      description = 'The new TextureData.'
+    }
+  },
+  related = {
+    'lovr.data.newTextureData',
+    'TextureData'
+  }
+}

+ 4 - 0
api/lovr/graphics/Font/getAscent.lua

@@ -11,5 +11,9 @@ return {
       type = 'number',
       description = 'The ascent of the Font.'
     }
+  },
+  related = {
+    'Font:getDescent',
+    'Rasterizer:getAscent'
   }
 }

+ 3 - 0
api/lovr/graphics/Font/getHeight.lua

@@ -11,5 +11,8 @@ return {
       type = 'number',
       description = 'The height of a rendered line of text.'
     }
+  },
+  related = {
+    'Rasterizer:getHeight'
   }
 }

+ 3 - 0
api/lovr/graphics/Font/getLineHeight.lua

@@ -8,5 +8,8 @@ return {
       type = 'number',
       description = 'The line height.'
     }
+  },
+  related = {
+    'Rasterizer:getLineHeight'
   }
 }

+ 4 - 1
api/lovr/graphics/Font/setLineHeight.lua

@@ -11,5 +11,8 @@ return {
       description = 'The new line height.'
     }
   },
-  returns = {}
+  returns = {},
+  related = {
+    'Rasterizer:getLineHeight'
+  }
 }

+ 2 - 2
api/lovr/graphics/Mesh/getDrawRange.lua

@@ -10,14 +10,14 @@ return {
       name = 'start',
       type = 'number',
       description = [[
-        The index of the first vertex that will be drawn, or `nil` if no draw range is set.
+        The index of the first vertex that will be drawn, or nil if no draw range is set.
       ]]
     },
     {
       name = 'count',
       type = 'number',
       description = [[
-        The number of vertices that will be drawn, or `nil` if no draw range is set.
+        The number of vertices that will be drawn, or nil if no draw range is set.
       ]]
     }
   }

+ 1 - 1
api/lovr/graphics/Mesh/getVertexMap.lua

@@ -9,7 +9,7 @@ return {
     {
       name = 'map',
       type = 'table',
-      description = 'The list of indices in the vertex map, or `nil` if no vertex map is set.'
+      description = 'The list of indices in the vertex map, or nil if no vertex map is set.'
     }
   }
 }

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

@@ -11,7 +11,7 @@ return {
     {
       name = '...',
       type = 'Canvas',
-      description = 'The set of active Canvas objects, or `nil` if none are set.'
+      description = 'The set of active Canvas objects, or nil if none are set.'
     }
   },
   notes = 'Up to 4 Canvases can be active at a time.',

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

@@ -7,7 +7,7 @@ return {
     {
       name = 'shader',
       type = 'Shader',
-      description = 'The active shader object, or `nil` if none is active.'
+      description = 'The active shader object, or nil if none is active.'
     }
   }
 }

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

@@ -42,5 +42,5 @@ return {
       returns = { 'font' }
     }
   },
-  notes = 'Larger font sizes will lead to sharper text at the cost of performance.'
+  notes = 'Larger font sizes will lead to more detailed curves at the cost of performance.'
 }

+ 2 - 4
api/lovr/graphics/newShader.lua

@@ -7,16 +7,14 @@ return {
       name = 'vertex',
       type = 'string',
       description = [[
-        The code or filename of the vertex shader.  If `nil`, the default vertex shader
-        is used.
+        The code or filename of the vertex shader.  If nil, the default vertex shader is used.
       ]]
     },
     {
       name = 'fragment',
       type = 'string',
       description = [[
-        The code or filename of the fragment shader.  If `nil`, the default fragment shader
-        is used.
+        The code or filename of the fragment shader.  If nil, the default fragment shader is used.
       ]]
     }
   },

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

@@ -42,7 +42,7 @@ return {
           type = 'TextureType',
           default = 'nil',
           description = [[
-            The type of Texture to load the images into.  If `nil`, the type will be `2d` for a
+            The type of Texture to load the images into.  If nil, the type will be `2d` for a
             single image, `array` for a table of images with numeric keys, or `cube` for a table
             of images with string keys.
           ]]

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

@@ -61,7 +61,7 @@ return {
       type = 'number',
       default = '0',
       description = [[
-        The maximum width of each line, in meters (affected by `scale`).  Set to 0 or `nil` for no
+        The maximum width of each line, in meters (affected by `scale`).  Set to 0 or nil for no
         wrapping.
       ]]
     },

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

@@ -10,7 +10,7 @@ return {
       name = '...',
       type = 'Canvas',
       description = [[
-        The new set of active Canvas objects, or `nil` to just render to the screen/headset.
+        The new set of active Canvas objects, or nil to just render to the screen/headset.
       ]]
     }
   },

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

@@ -9,7 +9,7 @@ return {
       name = 'compareMode',
       type = 'CompareMode',
       default = 'nil',
-      description = 'The new depth test.  Use `nil` to disable the depth test.'
+      description = 'The new depth test.  Use nil to disable the depth test.'
     },
     {
       name = 'write',

部分文件因文件數量過多而無法顯示