Browse Source

More 0.12.0 docs;

bjorn 6 years ago
parent
commit
eddab92623
48 changed files with 880 additions and 2613 deletions
  1. 863 1388
      api/init.lua
  2. 0 12
      api/lovr/data/ModelData/getAnimationCount.lua
  3. 0 39
      api/lovr/data/ModelData/getDiffuseColor.lua
  4. 0 23
      api/lovr/data/ModelData/getDiffuseTexture.lua
  5. 0 39
      api/lovr/data/ModelData/getEmissiveColor.lua
  6. 0 23
      api/lovr/data/ModelData/getEmissiveTexture.lua
  7. 0 74
      api/lovr/data/ModelData/getGlobalNodeTransform.lua
  8. 0 74
      api/lovr/data/ModelData/getLocalNodeTransform.lua
  9. 0 12
      api/lovr/data/ModelData/getMaterialCount.lua
  10. 0 24
      api/lovr/data/ModelData/getMetalness.lua
  11. 0 24
      api/lovr/data/ModelData/getMetalnessTexture.lua
  12. 0 35
      api/lovr/data/ModelData/getNodeChildren.lua
  13. 0 43
      api/lovr/data/ModelData/getNodeComponent.lua
  14. 0 28
      api/lovr/data/ModelData/getNodeComponentCount.lua
  15. 0 12
      api/lovr/data/ModelData/getNodeCount.lua
  16. 0 19
      api/lovr/data/ModelData/getNodeName.lua
  17. 0 22
      api/lovr/data/ModelData/getNodeParent.lua
  18. 0 22
      api/lovr/data/ModelData/getNormalTexture.lua
  19. 0 22
      api/lovr/data/ModelData/getOcclusionTexture.lua
  20. 0 24
      api/lovr/data/ModelData/getRoughness.lua
  21. 0 24
      api/lovr/data/ModelData/getRoughnessTexture.lua
  22. 0 31
      api/lovr/data/ModelData/getTriangle.lua
  23. 0 20
      api/lovr/data/ModelData/getTriangleCount.lua
  24. 0 18
      api/lovr/data/ModelData/getVertexData.lua
  25. 1 1
      api/lovr/graphics/Mesh/draw.lua
  26. 1 1
      api/lovr/graphics/Model/draw.lua
  27. 1 1
      api/lovr/graphics/Shader/send.lua
  28. 4 4
      api/lovr/graphics/ShaderBlock/init.lua
  29. 2 2
      api/lovr/graphics/ShaderBlock/send.lua
  30. 1 1
      api/lovr/graphics/arc.lua
  31. 1 1
      api/lovr/graphics/box.lua
  32. 1 1
      api/lovr/graphics/circle.lua
  33. 1 1
      api/lovr/graphics/cube.lua
  34. 4 4
      api/lovr/graphics/transform.lua
  35. 0 21
      api/lovr/math/Transform/apply.lua
  36. 0 12
      api/lovr/math/Transform/clone.lua
  37. 0 74
      api/lovr/math/Transform/getMatrix.lua
  38. 0 8
      api/lovr/math/Transform/init.lua
  39. 0 18
      api/lovr/math/Transform/inverse.lua
  40. 0 41
      api/lovr/math/Transform/inverseTransformPoint.lua
  41. 0 18
      api/lovr/math/Transform/origin.lua
  42. 0 33
      api/lovr/math/Transform/rotate.lua
  43. 0 30
      api/lovr/math/Transform/scale.lua
  44. 0 86
      api/lovr/math/Transform/setMatrix.lua
  45. 0 66
      api/lovr/math/Transform/setTransformation.lua
  46. 0 41
      api/lovr/math/Transform/transformPoint.lua
  47. 0 28
      api/lovr/math/Transform/translate.lua
  48. 0 68
      api/lovr/math/newTransform.lua

File diff suppressed because it is too large
+ 863 - 1388
api/init.lua


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

@@ -1,12 +0,0 @@
-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.'
-    }
-  }
-}

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

@@ -1,39 +0,0 @@
-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'
-  }
-}

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

@@ -1,23 +0,0 @@
-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'
-  }
-}

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

@@ -1,39 +0,0 @@
-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'
-  }
-}

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

@@ -1,23 +0,0 @@
-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'
-  }
-}

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

@@ -1,74 +0,0 @@
-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'
-  }
-}

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

@@ -1,74 +0,0 @@
-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'
-  }
-}

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

@@ -1,12 +0,0 @@
-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.'
-    }
-  }
-}

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

@@ -1,24 +0,0 @@
-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'
-  }
-}

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

@@ -1,24 +0,0 @@
-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'
-  }
-}

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

@@ -1,35 +0,0 @@
-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.'
-}

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

@@ -1,43 +0,0 @@
-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'
-  }
-}

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

@@ -1,28 +0,0 @@
-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'
-  }
-}

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

@@ -1,12 +0,0 @@
-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.'
-    }
-  }
-}

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

@@ -1,19 +0,0 @@
-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.'
-}

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

@@ -1,22 +0,0 @@
-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'
-  }
-}

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

@@ -1,22 +0,0 @@
-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'
-  }
-}

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

@@ -1,22 +0,0 @@
-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'
-  }
-}

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

@@ -1,24 +0,0 @@
-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'
-  }
-}

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

@@ -1,24 +0,0 @@
-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'
-  }
-}

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

@@ -1,31 +0,0 @@
-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'
-  }
-}

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

@@ -1,20 +0,0 @@
-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'
-  }
-}

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

@@ -1,18 +0,0 @@
-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'
-  }
-}

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

@@ -43,7 +43,7 @@ return {
       description = 'The z component of the axis of rotation.'
       description = 'The z component of the axis of rotation.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The transform to apply before drawing.'
       description = 'The transform to apply before drawing.'
     },
     },
     instances = {
     instances = {

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

@@ -43,7 +43,7 @@ return {
       description = 'The z component of the axis of rotation.'
       description = 'The z component of the axis of rotation.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The transform to apply before drawing.'
       description = 'The transform to apply before drawing.'
     },
     },
     instances = {
     instances = {

+ 1 - 1
api/lovr/graphics/Shader/send.lua

@@ -18,7 +18,7 @@ return {
     The shader does not need to be active to update its uniforms.  However, the types must match up.
     The shader does not need to be active to update its uniforms.  However, the types must match up.
     Uniform variables declared as `float`s must be sent a single number, whereas uniforms declared
     Uniform variables declared as `float`s must be sent a single number, whereas uniforms declared
     as `vec4`s must be sent a table containing 4 numbers, etc.  Note that uniforms declared as mat4s
     as `vec4`s must be sent a table containing 4 numbers, etc.  Note that uniforms declared as mat4s
-    can be sent a `Transform` object.
+    can be sent a `mat4` object.
 
 
     An error is thrown if the uniform does not exist or is not used in the shader.
     An error is thrown if the uniform does not exist or is not used in the shader.
 
 

+ 4 - 4
api/lovr/graphics/ShaderBlock/init.lua

@@ -24,14 +24,14 @@ return {
   example = [=[
   example = [=[
     function lovr.load()
     function lovr.load()
       -- Create a ShaderBlock to store positions for 1000 models
       -- Create a ShaderBlock to store positions for 1000 models
-      block = lovr.graphics.newShaderBlock({
+      block = lovr.graphics.newShaderBlock('uniform', {
         modelPositions = { 'mat4', 1000 }
         modelPositions = { 'mat4', 1000 }
-      }, { writable = false, usage = 'static' })
+      }, { usage = 'static' })
 
 
       -- Write some random transforms to the block
       -- Write some random transforms to the block
       local transforms = {}
       local transforms = {}
       for i = 1, 1000 do
       for i = 1, 1000 do
-        transforms[i] = lovr.math.newTransform()
+        transforms[i] = lovr.math.mat4()
         local random, randomNormal = lovr.math.random, lovr.math.randomNormal
         local random, randomNormal = lovr.math.random, lovr.math.randomNormal
         transforms[i]:translate(randomNormal(8), randomNormal(8), randomNormal(8))
         transforms[i]:translate(randomNormal(8), randomNormal(8), randomNormal(8))
         transforms[i]:rotate(random(2 * math.pi), random(), random(), random())
         transforms[i]:rotate(random(2 * math.pi), random(), random(), random())
@@ -54,7 +54,7 @@ return {
     -- Draw the model 1000 times, using positions from the shader block
     -- Draw the model 1000 times, using positions from the shader block
     function lovr.draw()
     function lovr.draw()
       lovr.graphics.setShader(shader)
       lovr.graphics.setShader(shader)
-      model:drawInstanced(1000)
+      model:draw(lovr.math.mat4(), 1000)
       lovr.graphics.setShader()
       lovr.graphics.setShader()
     end
     end
   ]=]
   ]=]

+ 2 - 2
api/lovr/graphics/ShaderBlock/send.lua

@@ -32,9 +32,9 @@ return {
     }
     }
   },
   },
   notes = [[
   notes = [[
-    For scalar or vector types, use tables of numbers for each vector.
+    For scalar or vector types, use tables of numbers or `vec3`s for each vector.
 
 
-    For matrix types, use tables of numbers or `Transform` objects.
+    For matrix types, use tables of numbers or `mat4` objects.
 
 
     `Blob`s can also be used to pass arbitrary binary data to individual variables.
     `Blob`s can also be used to pass arbitrary binary data to individual variables.
   ]],
   ]],

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

@@ -17,7 +17,7 @@ return {
       description = 'The Material to apply to the arc.'
       description = 'The Material to apply to the arc.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The arc\'s transform.'
       description = 'The arc\'s transform.'
     },
     },
     x = {
     x = {

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

@@ -15,7 +15,7 @@ return {
       description = 'How to draw the box.'
       description = 'How to draw the box.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The transform of the box.'
       description = 'The transform of the box.'
     },
     },
     x = {
     x = {

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

@@ -12,7 +12,7 @@ return {
       description = 'The Material to apply to the circle.'
       description = 'The Material to apply to the circle.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The circle\'s transform.'
       description = 'The circle\'s transform.'
     },
     },
     x = {
     x = {

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

@@ -12,7 +12,7 @@ return {
       description = 'How to draw the cube.'
       description = 'How to draw the cube.'
     },
     },
     transform = {
     transform = {
-      type = 'Transform',
+      type = 'mat4',
       description = 'The cube\'s transform.'
       description = 'The cube\'s transform.'
     },
     },
     x = {
     x = {

+ 4 - 4
api/lovr/graphics/transform.lua

@@ -3,15 +3,15 @@ return {
   summary = 'Apply a general transform to the coordinate system.',
   summary = 'Apply a general transform to the coordinate system.',
   description = [[
   description = [[
     Apply a transform to the coordinate system, changing its translation, rotation, and scale using
     Apply a transform to the coordinate system, changing its translation, rotation, and scale using
-    a single function.  A Transform object can also be used.
+    a single function.  A `mat4` can also be used.
 
 
     The transformation will last until `lovr.draw` returns or the transformation is popped off the
     The transformation will last until `lovr.draw` returns or the transformation is popped off the
     transformation stack.
     transformation stack.
   ]],
   ]],
   arguments = {
   arguments = {
     transform = {
     transform = {
-      type = 'Transform',
-      description = 'The Transform to apply to the coordinate system.'
+      type = 'mat4',
+      description = 'The mat4 to apply to the coordinate system.'
     },
     },
     x = {
     x = {
       type = 'number',
       type = 'number',
@@ -71,7 +71,7 @@ return {
       returns = {}
       returns = {}
     },
     },
     {
     {
-      description = 'Modify the coordinate system using a Transform object.',
+      description = 'Modify the coordinate system using a mat4 object.',
       arguments = { 'transform' },
       arguments = { 'transform' },
       returns = {}
       returns = {}
     }
     }

+ 0 - 21
api/lovr/math/Transform/apply.lua

@@ -1,21 +0,0 @@
-return {
-  summary = 'Combine two Transforms.',
-  description = 'Applies a Transform onto this Transform.',
-  arguments = {
-    {
-      name = 'other',
-      type = 'Transform',
-      description = [[
-        Combine two Transforms together.  Order matters, so applying Transforms in different orders
-        will yield different results.
-      ]]
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  }
-}

+ 0 - 12
api/lovr/math/Transform/clone.lua

@@ -1,12 +0,0 @@
-return {
-  summary = 'Clone the Transform.',
-  description = 'Returns a copy of the Transform.',
-  arguments = {},
-  returns = {
-    {
-      name = 'copy',
-      type = 'Transform',
-      description = 'The copy of the original.'
-    }
-  }
-}

+ 0 - 74
api/lovr/math/Transform/getMatrix.lua

@@ -1,74 +0,0 @@
-return {
-  summary = 'Get the Transform\'s matrix.',
-  description = 'Returns the individual matrix components of a Transform, in column-major order.',
-  arguments = {
-    t = {
-      type = 'table',
-      description = 'A table to fill with values.'
-    }
-  },
-  returns = {
-    m11 = {
-      type = 'number'
-    },
-    m21 = {
-      type = 'number'
-    },
-    m31 = {
-      type = 'number'
-    },
-    m41 = {
-      type = 'number'
-    },
-    m12 = {
-      type = 'number'
-    },
-    m22 = {
-      type = 'number'
-    },
-    m32 = {
-      type = 'number'
-    },
-    m42 = {
-      type = 'number'
-    },
-    m13 = {
-      type = 'number'
-    },
-    m23 = {
-      type = 'number'
-    },
-    m33 = {
-      type = 'number'
-    },
-    m43 = {
-      type = 'number'
-    },
-    m14 = {
-      type = 'number'
-    },
-    m24 = {
-      type = 'number'
-    },
-    m34 = {
-      type = 'number'
-    },
-    m44 = {
-      type = 'number'
-    },
-    matrix = {
-      type = 'table',
-      description = 'The original table.'
-    }
-  },
-  variants = {
-    {
-      arguments = {},
-      returns = { 'm11', 'm21', 'm31', 'm41', 'm12', 'm22', 'm32', 'm42', 'm13', 'm23', 'm33', 'm43', 'm14', 'm24', 'm34', 'm44' }
-    },
-    {
-      arguments = { 't' },
-      returns = { 'matrix' }
-    }
-  }
-}

+ 0 - 8
api/lovr/math/Transform/init.lua

@@ -1,8 +0,0 @@
-return {
-  summary = 'A 3D transform.',
-  description = [[
-    A Transform represents a translation, rotation, and scale in 3D space.  They're commonly used to
-    describe how entities are arranged in a scene or how a camera is positioned.
-  ]],
-  constructor = 'lovr.math.newTransform'
-}

+ 0 - 18
api/lovr/math/Transform/inverse.lua

@@ -1,18 +0,0 @@
-return {
-  summary = 'Get the inverse of the Transform.',
-  description = [[
-    Returns a new Transform representing the inverse of the original.  The inverse "cancels out" the
-    effects of the original, so applying one onto the other will result in the origin.
-  ]],
-  arguments = {},
-  returns = {
-    {
-      name = 'inverse',
-      type = 'Transform',
-      description = 'The inverse transform.'
-    }
-  },
-  related = {
-    'Transform:inverseTransformPoint'
-  }
-}

+ 0 - 41
api/lovr/math/Transform/inverseTransformPoint.lua

@@ -1,41 +0,0 @@
-return {
-  summary = 'Apply the inverse of the Transform to a point.',
-  description = 'Applies the inverse of the Transform to a point, returning the transformed point.',
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The x coordinate of the point.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      description = 'The y coordinate of the point.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      description = 'The z coordinate of the point.'
-    }
-  },
-  returns = {
-    {
-      name = 'x2',
-      type = 'number',
-      description = 'The x coordinate of the transformed point.'
-    },
-    {
-      name = 'y2',
-      type = 'number',
-      description = 'The y coordinate of the transformed point.'
-    },
-    {
-      name = 'z2',
-      type = 'number',
-      description = 'The z coordinate of the transformed point.'
-    }
-  },
-  related = {
-    'Transform:transformPoint'
-  }
-}

+ 0 - 18
api/lovr/math/Transform/origin.lua

@@ -1,18 +0,0 @@
-return {
-  summary = 'Reset the Transform.',
-  description = 'Resets the Transform to the origin.',
-  arguments = {},
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  },
-  example = [[
-    transform = lovr.math.newTransform(3, 4, 5)
-    print(transform:transformPoint(1, 2, 2)) -- Prints 4, 6, 7
-    transform:origin()
-    print(transform:transformPoint(1, 2, 3)) -- Prints 1, 2, 3
-  ]]
-}

+ 0 - 33
api/lovr/math/Transform/rotate.lua

@@ -1,33 +0,0 @@
-return {
-  summary = 'Rotate the Transform.',
-  description = 'Rotates the Transform using an angle/axis rotation.',
-  arguments = {
-    {
-      name = 'angle',
-      type = 'number',
-      description = 'The number of radians to rotate around the axis of rotation.'
-    },
-    {
-      name = 'ax',
-      type = 'number',
-      description = 'The x component of the axis of rotation.'
-    },
-    {
-      name = 'ay',
-      type = 'number',
-      description = 'The y component of the axis of rotation.'
-    },
-    {
-      name = 'az',
-      type = 'number',
-      description = 'The z component of the axis of rotation.'
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  }
-}

+ 0 - 30
api/lovr/math/Transform/scale.lua

@@ -1,30 +0,0 @@
-return {
-  summary = 'Scale the Transform.',
-  description = 'Scales the Transform.',
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The scale factor for the x axis.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      default = 'x',
-      description = 'The scale factor for the y axis.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      default = 'x',
-      description = 'The scale factor for the z axis.'
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  }
-}

+ 0 - 86
api/lovr/math/Transform/setMatrix.lua

@@ -1,86 +0,0 @@
-return {
-  summary = 'Set the Transform\'s matrix.',
-  description = 'Sets the individual matrix components of a Transform, in column-major order.',
-  arguments = {
-    m11 = {
-      type = 'number'
-    },
-    m21 = {
-      type = 'number'
-    },
-    m31 = {
-      type = 'number'
-    },
-    m41 = {
-      type = 'number'
-    },
-    m12 = {
-      type = 'number'
-    },
-    m22 = {
-      type = 'number'
-    },
-    m32 = {
-      type = 'number'
-    },
-    m42 = {
-      type = 'number'
-    },
-    m13 = {
-      type = 'number'
-    },
-    m23 = {
-      type = 'number'
-    },
-    m33 = {
-      type = 'number'
-    },
-    m43 = {
-      type = 'number'
-    },
-    m14 = {
-      type = 'number'
-    },
-    m24 = {
-      type = 'number'
-    },
-    m34 = {
-      type = 'number'
-    },
-    m44 = {
-      type = 'number'
-    },
-    m = {
-      type = 'table',
-      description = 'A table containing the matrix values, as above.'
-    }
-  },
-  returns = {},
-  variants = {
-    {
-      arguments = {
-        'm11',
-        'm21',
-        'm31',
-        'm41',
-        'm12',
-        'm22',
-        'm32',
-        'm42',
-        'm13',
-        'm23',
-        'm33',
-        'm43',
-        'm14',
-        'm24',
-        'm34',
-        'm44'
-      },
-      returns = {}
-    },
-    {
-      arguments = { 'm' },
-      returns = {}
-    }
-  }
-}

+ 0 - 66
api/lovr/math/Transform/setTransformation.lua

@@ -1,66 +0,0 @@
-return {
-  summary = 'Set the position, rotation, and scale of the Transform.',
-  description = [[
-    Sets the translation, rotation, and scale of the Transform.  This will override the current
-    values in the Transform.
-  ]],
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'sx',
-      type = 'number',
-      description = 'The x scale of the Transform.'
-    },
-    {
-      name = 'sy',
-      type = 'number',
-      description = 'The y scale of the Transform.'
-    },
-    {
-      name = 'sz',
-      type = 'number',
-      description = 'The z scale of the Transform.'
-    },
-    {
-      name = 'angle',
-      type = 'number',
-      description = 'The number of radians the Transform is rotated around its axis of rotation.'
-    },
-    {
-      name = 'ax',
-      type = 'number',
-      description = 'The x component of the axis of rotation.'
-    },
-    {
-      name = 'ay',
-      type = 'number',
-      description = 'The y component of the axis of rotation.'
-    },
-    {
-      name = 'az',
-      type = 'number',
-      description = 'The z component of the axis of rotation.'
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  }
-}

+ 0 - 41
api/lovr/math/Transform/transformPoint.lua

@@ -1,41 +0,0 @@
-return {
-  summary = 'Apply the Transform to a point.',
-  description = 'Applies the Transform to a point, returning the new position.',
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The x coordinate of the point.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      description = 'The y coordinate of the point.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      description = 'The z coordinate of the point.'
-    }
-  },
-  returns = {
-    {
-      name = 'x2',
-      type = 'number',
-      description = 'The x coordinate of the transformed point.'
-    },
-    {
-      name = 'y2',
-      type = 'number',
-      description = 'The y coordinate of the transformed point.'
-    },
-    {
-      name = 'z2',
-      type = 'number',
-      description = 'The z coordinate of the transformed point.'
-    }
-  },
-  related = {
-    'Transform:inverseTransformPoint'
-  }
-}

+ 0 - 28
api/lovr/math/Transform/translate.lua

@@ -1,28 +0,0 @@
-return {
-  summary = 'Translate the Transform.',
-  description = 'Translates the Transform.',
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The x component of the translation.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      description = 'The y component of the translation.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      description = 'The z component of the translation.'
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The original Transform.'
-    }
-  }
-}

+ 0 - 68
api/lovr/math/newTransform.lua

@@ -1,68 +0,0 @@
-return {
-  summary = 'Create a new Transform.',
-  description = [[
-    A transform is a 4x4, column major matrix that can be used to represent the 3D transform of an
-    object.  Most graphics primitives accept a Transform instead of the usual coordinate arguments.
-    Transforms provide a convenient way to represent translation, rotation, and scale in a single
-    object.
-  ]],
-  arguments = {
-    {
-      name = 'x',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'y',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'z',
-      type = 'number',
-      description = 'The x position of the Transform.'
-    },
-    {
-      name = 'sx',
-      type = 'number',
-      description = 'The x scale of the Transform.'
-    },
-    {
-      name = 'sy',
-      type = 'number',
-      description = 'The y scale of the Transform.'
-    },
-    {
-      name = 'sz',
-      type = 'number',
-      description = 'The z scale of the Transform.'
-    },
-    {
-      name = 'angle',
-      type = 'number',
-      description = 'The number of radians the Transform is rotated around its axis of rotation.'
-    },
-    {
-      name = 'ax',
-      type = 'number',
-      description = 'The x component of the axis of rotation.'
-    },
-    {
-      name = 'ay',
-      type = 'number',
-      description = 'The y component of the axis of rotation.'
-    },
-    {
-      name = 'az',
-      type = 'number',
-      description = 'The z component of the axis of rotation.'
-    }
-  },
-  returns = {
-    {
-      name = 'transform',
-      type = 'Transform',
-      description = 'The new Transform.'
-    }
-  }
-}

Some files were not shown because too many files changed in this diff