Browse Source

Lots of Pass functions;

bjorn 3 years ago
parent
commit
361abcfc64

File diff suppressed because it is too large
+ 411 - 385
api/init.lua


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

@@ -5,10 +5,16 @@ return {
   arguments = {
     {
       name = 'transform',
-      type = 'transform3',
+      type = 'Transform3',
       description = 'The transform to apply to the box.'
+    },
+    {
+      name = 'style',
+      type = 'DrawStyle',
+      default = [['fill']],
+      description = 'Whether the box should be drawn filled or outlined.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

+ 23 - 5
api/lovr/graphics/Pass/circle.lua

@@ -5,16 +5,34 @@ return {
   arguments = {
     {
       name = 'transform',
-      type = 'transform',
+      type = 'Transform',
       description = 'The transform to apply to the circle.'
     },
     {
-      name = 'detail',
+      name = 'style',
+      type = 'DrawStyle',
+      default = [['fill']],
+      description = 'Whether the circle should be filled or outlined.'
+    },
+    {
+      name = 'angle1',
+      type = 'number',
+      default = '0',
+      description = 'The angle of the beginning of the arc.'
+    },
+    {
+      name = 'angle2',
+      type = 'number',
+      default = '2 * math.pi',
+      description = 'angle of the end of the arc.'
+    },
+    {
+      name = 'segments',
       type = 'number',
-      default = '4',
-      description = 'A detail value from 0 to 6.'
+      default = '64',
+      description = 'The number of segments to render.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

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

@@ -5,10 +5,16 @@ return {
   arguments = {
     {
       name = 'transform',
-      type = 'transform',
+      type = 'Transform',
       description = 'The transform to apply to the cube.'
+    },
+    {
+      name = 'style',
+      type = 'DrawStyle',
+      default = [['fill']],
+      description = 'Whether the cube should be drawn filled or outlined.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

+ 25 - 10
api/lovr/graphics/Pass/cylinder.lua

@@ -5,22 +5,37 @@ return {
   arguments = {
     {
       name = 'transform',
-      type = 'transformxy2',
-      description = 'The transform to apply to the cylinder.'
-    },
-    {
-      name = 'detail',
-      type = 'number',
-      default = '4',
-      description = 'A detail value from 0 to 6.'
+      type = 'TransformXY2',
+      description = [[
+        The transform to apply to the cylinder.  The x and y scale is the radius, the z scale is the
+        length.
+      ]]
     },
     {
       name = 'capped',
       type = 'boolean',
       default = 'true',
-      description = 'Whether the top and bottom of the tube should be rendered.'
+      description = 'Whether the tops and bottoms of the cylinder should be rendered.'
+    },
+    {
+      name = 'angle1',
+      type = 'number',
+      default = '0',
+      description = 'The angle of the beginning of the arc.'
+    },
+    {
+      name = 'angle2',
+      type = 'number',
+      default = '2 * math.pi',
+      description = 'angle of the end of the arc.'
+    },
+    {
+      name = 'segments',
+      type = 'number',
+      default = '64',
+      description = 'The number of circular segments to render.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

+ 42 - 0
api/lovr/graphics/Pass/draw.lua

@@ -0,0 +1,42 @@
+return {
+  tag = 'drawing',
+  summary = 'Draw a drawable object.',
+  description = 'TODO',
+  arguments = {
+    transform = {
+      type = 'Transform',
+      description = 'The transform of the object.'
+    },
+    model = {
+      type = 'Model',
+      description = 'The model to draw.'
+    },
+    nodeindex = {
+      type = 'number',
+      description = 'TODO'
+    },
+    nodename = {
+      type = 'string',
+      description = 'TODO'
+    },
+    children = {
+      type = 'boolean',
+      description = 'TODO'
+    },
+    instances = {
+      type = 'number',
+      description = 'TODO'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'model', 'transform', 'nodeindex', 'children', 'instances' },
+      returns = {}
+    },
+    {
+      arguments = { 'model', 'transform', 'nodename', 'children', 'instances' },
+      returns = {}
+    }
+  }
+}

+ 13 - 5
api/lovr/graphics/Pass/fill.lua

@@ -3,12 +3,20 @@ return {
   summary = 'Draw a fullscreen quad.',
   description = 'TODO',
   arguments = {
-    {
-      name = 'material',
-      type = 'Material',
-      description = 'The material to use for the fill.'
+    texture = {
+      type = 'Texture',
+      description = 'The texture to fill.'
     }
   },
   returns = {},
-  notes = 'TODO shader, attributes, depth/stencil clears'
+  variants = {
+    {
+      arguments = { 'texture' },
+      returns = {}
+    },
+    {
+      arguments = {},
+      returns = {}
+    }
+  }
 }

+ 12 - 0
api/lovr/graphics/Pass/getType.lua

@@ -0,0 +1,12 @@
+return {
+  summary = 'Get the type of the Pass.',
+  description = 'TODO',
+  arguments = {},
+  returns = {
+    {
+      name = ' type',
+      type = 'PassType',
+      description = 'The type of the Pass.'
+    }
+  }
+}

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

@@ -59,5 +59,5 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO material, mesh, attributes'
+  notes = 'TODO'
 }

+ 3 - 58
api/lovr/graphics/Pass/mesh.lua

@@ -3,24 +3,14 @@ return {
   summary = 'Draw a mesh.',
   description = 'TODO',
   arguments = {
-    material = {
-      type = 'Material',
-      description = 'The Material to apply to the mesh.'
-    },
-    mode = {
-      type = 'DrawMode',
-      description = 'Whether the vertices should be drawn as `points`, `lines`, or `triangles`.'
-    },
     vertices = {
       type = 'Buffer',
       default = 'nil',
-      description = [[
-        A Buffer containing the vertices to render, or `nil` if no vertex buffer is needed.
-      ]]
+      description = 'TODO'
     },
     indices = {
       type = 'Buffer',
-      description = 'A Buffer containing indices of vertices to render.'
+      description = 'TODO'
     },
     transform = {
       type = 'transform',
@@ -47,20 +37,6 @@ return {
       type = 'number',
       default = '1',
       description = 'The number of copies of the mesh to render.'
-    },
-    indirect = {
-      type = 'Buffer',
-      description = 'A Buffer containing parameters for the draw.'
-    },
-    indirectcount = {
-      type = 'number',
-      default = '1',
-      description = 'How many draws to read and render from the indirect buffer.'
-    },
-    indirectoffset = {
-      type = 'number',
-      default = '0',
-      description = 'A byte offset of where the draw parameters are stored in the indirect buffer.'
     }
   },
   returns = {},
@@ -72,38 +48,7 @@ return {
     {
       arguments = { 'vertices', 'indices', 'transform', 'start', 'count', 'instances' },
       returns = {}
-    },
-    {
-      arguments = { 'mode', 'vertices', 'transform', 'start', 'count', 'instances' },
-      returns = {}
-    },
-    {
-      arguments = { 'mode', 'vertices', 'indices', 'transform', 'start', 'count', 'instances' },
-      returns = {}
-    },
-    {
-      arguments = { 'vertices', 'transform', 'indirect', 'indirectcount', 'indirectoffset' },
-      returns = {}
-    },
-    {
-      arguments = { 'vertices', 'indices', 'transform', 'indirect', 'indirectcount', 'indirectoffset' },
-      returns = {}
-    },
-    {
-      arguments = { 'mode', 'vertices', 'transform', 'indirect', 'indirectcount', 'indirectoffset' },
-      returns = {}
-    },
-    {
-      arguments = { 'mode', 'vertices', 'indices', 'transform', 'indirect', 'indirectcount', 'indirectoffset' },
-      returns = {}
     }
   },
-  notes = [[
-    When `vertices` is `nil`, the mesh will still be rendered with `count` vertices and the vertex
-    shader will still run.  The vertex shader can generate the vertex positions or read data from
-    other variables to compute the final vertex position.  An index buffer can still be used too.
-
-    TODO lots
-    TODO material combinatorial explosion
-  ]]
+  notes = 'TODO'
 }

+ 42 - 0
api/lovr/graphics/Pass/multimesh.lua

@@ -0,0 +1,42 @@
+return {
+  tag = 'drawing',
+  summary = 'Use draw parameters stored in a Buffer to draw a mesh multiple times.',
+  description = 'TODO',
+  arguments = {
+    vertices = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    indices = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    draws = {
+      type = 'Buffer',
+      description = 'TODO'
+    },
+    count = {
+      type = 'number',
+      default = '1',
+      description = 'TODO'
+    },
+    offset = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    },
+    stride = {
+      type = 'number',
+      default = '0',
+      description = 'TODO'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'vertices', 'indices', 'draws', 'count', 'offset', 'stride' },
+      returns = {}
+    }
+  },
+  notes = 'TODO'
+}

+ 17 - 4
api/lovr/graphics/Pass/plane.lua

@@ -5,15 +5,28 @@ return {
   arguments = {
     {
       name = 'transform',
-      type = 'transform2',
+      type = 'Transform2',
       description = 'The transform to apply to the plane.'
     },
     {
-      name = 'detail',
+      name = 'style',
+      type = 'DrawStyle',
+      default = [['fill']],
+      description = 'Whether the plane should be drawn filled or outlined.'
+    },
+    {
+      name = 'columns',
+      type = 'number',
+      default = '1',
+      description = 'The number of horizontal segments in the plane.'
+    },
+    {
+      name = 'rows',
       type = 'number',
-      description = 'A number between 0 and 7 indicating how many times to subdivide the plane.'
+      default = 'cols',
+      description = 'The number of vertical segments in the plane.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

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

@@ -43,5 +43,5 @@ return {
       returns = {}
     }
   },
-  notes = 'TODO material, mesh, attributes'
+  notes = 'TODO'
 }

+ 62 - 0
api/lovr/graphics/Pass/send.lua

@@ -0,0 +1,62 @@
+return {
+  summary = 'Set the value of a shader variable.',
+  description = 'TODO',
+  arguments = {
+    name = {
+      type = 'string',
+      description = 'The name of the Shader variable.'
+    },
+    binding = {
+      type = 'number',
+      description = 'The binding number of the Shader variable.'
+    },
+    buffer = {
+      type = 'Buffer',
+      description = 'The Buffer to assign.'
+    },
+    texture = {
+      type = 'Texture',
+      description = 'The Texture to assign.'
+    },
+    sampler = {
+      type = 'Sampler',
+      description = 'The Sampler to assign.'
+    },
+    constant = {
+      type = '*',
+      description = 'Numbers or vectors to assign to the push constant.'
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'name', 'buffer' },
+      returns = {}
+    },
+    {
+      arguments = { 'name', 'texture' },
+      returns = {}
+    },
+    {
+      arguments = { 'name', 'sampler' },
+      returns = {}
+    },
+    {
+      arguments = { 'name', 'constant' },
+      returns = {}
+    },
+    {
+      arguments = { 'binding', 'buffer' },
+      returns = {}
+    },
+    {
+      arguments = { 'binding', 'texture' },
+      returns = {}
+    },
+    {
+      arguments = { 'binding', 'sampler' },
+      returns = {}
+    }
+  },
+  notes = 'TODO'
+}

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

@@ -1,6 +1,6 @@
 return {
   tag = 'pipeline',
-  summary = 'Enable or disable "alpha to coverage".',
+  summary = 'Enable or disable alpha to coverage.',
   description = 'TODO',
   arguments = {
     {

+ 13 - 0
api/lovr/graphics/Pass/setColor.lua

@@ -0,0 +1,13 @@
+return {
+  tag = 'pipeline',
+  summary = 'Set the color.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'color',
+      type = 'Color',
+      description = 'The new color.'
+    }
+  },
+  returns = {}
+}

+ 0 - 0
api/lovr/graphics/Pass/setColorMask.lua → api/lovr/graphics/Pass/setColorWrite.lua


+ 2 - 1
api/lovr/graphics/Pass/setDepthWrite.lua

@@ -13,6 +13,7 @@ return {
   notes = 'TODO',
   related = {
     'lovr.graphics.setDepthTest',
-    'lovr.graphics.setStencilWrite'
+    'lovr.graphics.setStencilWrite',
+    'lovr.graphics.setColorWrite'
   }
 }

+ 13 - 0
api/lovr/graphics/Pass/setMaterial.lua

@@ -0,0 +1,13 @@
+return {
+  tag = 'pipeline',
+  summary = 'Set the material.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'material',
+      type = 'Material',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 13 - 0
api/lovr/graphics/Pass/setSampler.lua

@@ -0,0 +1,13 @@
+return {
+  tag = 'pipeline',
+  summary = 'Set the sampler.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'sampler',
+      type = 'Sampler',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 13 - 0
api/lovr/graphics/Pass/setVertexMode.lua

@@ -0,0 +1,13 @@
+return {
+  tag = 'pipeline',
+  summary = 'Change whether mesh vertices are drawn as points, lines, or triangles.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'mode',
+      type = 'VertexMode',
+      description = 'TODO'
+    }
+  },
+  returns = {}
+}

+ 26 - 0
api/lovr/graphics/Pass/skybox.lua

@@ -0,0 +1,26 @@
+return {
+  tag = 'drawing',
+  summary = 'Draw a skybox.',
+  description = 'TODO',
+  arguments = {
+    skybox = {
+      type = 'Texture',
+      description = [[
+        The skybox to render.  Its `TextureType` can be `cube` to render as a cubemap, or `2d` to
+        render as an equirectangular (spherical) 2D image.
+      ]]
+    }
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'skybox' },
+      returns = {}
+    },
+    {
+      arguments = {},
+      returns = {}
+    }
+  },
+  notes = 'TODO'
+}

+ 10 - 4
api/lovr/graphics/Pass/sphere.lua

@@ -9,12 +9,18 @@ return {
       description = 'The transform to apply to the sphere.'
     },
     {
-      name = 'detail',
+      name = 'longitudes',
       type = 'number',
-      default = '4',
-      description = 'A detail value from 0 to 4.'
+      default = '48',
+      description = 'The number of "horizontal" segments.'
+    },
+    {
+      name = 'latitudes',
+      type = 'number',
+      default = 'longitudes / 2',
+      description = 'The number of "vertical" segments.'
     }
   },
   returns = {},
-  notes = 'TODO material'
+  notes = 'TODO'
 }

+ 15 - 0
api/lovr/graphics/Pass/print.lua → api/lovr/graphics/Pass/text.lua

@@ -11,6 +11,13 @@ return {
       type = 'string',
       description = 'The text to render.'
     },
+    colortext = {
+      type = 'table',
+      description = [[
+        A table of strings with colors to render, in the form `{ color1, string1, color2, string2
+      }`, where color is a `Color`.
+      ]]
+    },
     transform = {
       type = 'transform',
       description = 'The transform of the text.'
@@ -43,6 +50,14 @@ return {
     {
       arguments = { 'font', 'text', 'transform', 'wrap', 'halign', 'valign' },
       returns = {}
+    },
+    {
+      arguments = { 'colortext', 'transform', 'wrap', 'halign', 'valign' },
+      returns = {}
+    },
+    {
+      arguments = { 'font', 'colortext', 'transform', 'wrap', 'halign', 'valign' },
+      returns = {}
     }
   },
   notes = 'TODO'

+ 29 - 0
api/lovr/graphics/Pass/torus.lua

@@ -0,0 +1,29 @@
+return {
+  tag = 'drawing',
+  summary = 'Draw a donut.',
+  description = 'TODO',
+  arguments = {
+    {
+      name = 'transform',
+      type = 'TransformXY2',
+      description = [[
+        The transform to apply to the torus.  The x scale is the radius, the z scale is the
+        thickness.
+      ]]
+    },
+    {
+      name = 'tsegments',
+      type = 'number',
+      default = '64',
+      description = 'The number of toroidal (circular) segments to render.'
+    },
+    {
+      name = 'psegments',
+      type = 'number',
+      default = '32',
+      description = 'The number of poloidal (tubular) segments to render.'
+    }
+  },
+  returns = {},
+  notes = 'TODO'
+}

+ 0 - 0
api/lovr/graphics/getAnisotropy.lua → api/lovr/graphics/Sampler/getAnisotropy.lua


+ 14 - 0
api/lovr/graphics/StackType.lua

@@ -0,0 +1,14 @@
+return {
+  summary = 'Types of stacks that can be pushed and popped.',
+  description = 'TODO',
+  values = {
+    {
+      name = 'transform',
+      description = 'TODO'
+    },
+    {
+      name = 'pipeline',
+      descriptioin = 'TODO'
+    }
+  }
+}

+ 17 - 0
api/lovr/graphics/VertexMode.lua

@@ -0,0 +1,17 @@
+return {
+  summary = 'Different ways to draw mesh vertices.',
+  values = {
+    {
+      name = 'points',
+      description = 'TODO'
+    },
+    {
+      name = 'lines',
+      description = 'TODO'
+    },
+    {
+      name = 'triangles',
+      description = 'TODO'
+    }
+  }
+}

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