Browse Source

More docs;

bjorn 2 years ago
parent
commit
74cc0165f7

+ 5 - 1
api/lovr/data/AnimationProperty.lua

@@ -1,6 +1,6 @@
 return {
   summary = 'Different animated properties.',
-  description = 'This indicates the different transform properties that can be animated.',
+  description = 'This indicates the different node properties that can be animated.',
   values = {
     {
       name = 'translation',
@@ -13,6 +13,10 @@ return {
     {
       name = 'scale',
       description = 'Node scale.'
+    },
+    {
+      name = 'weights',
+      description = 'Node blend shape weights.'
     }
   }
 }

+ 3 - 1
api/lovr/data/ModelData/getAnimationProperty.lua

@@ -18,7 +18,9 @@ return {
   returns = {
     property = {
       type = 'AnimationProperty',
-      description = 'The property (translation, rotation, scale) affected by the keyframes.'
+      description = [[
+        The property (translation, rotation, scale, weights) affected by the keyframes.
+      ]]
     }
   },
   variants = {

+ 21 - 0
api/lovr/data/ModelData/getBlendShapeCount.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Get the number of blend shapes in the model.',
+  description = 'Returns the number of blend shapes in the model.',
+  arguments = {},
+  returns = {
+    count = {
+      type = 'number',
+      description = 'The number of blend shapes in the model.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'count' }
+    }
+  },
+  related = {
+    'ModelData:getBlendShapeName',
+    'Model:getBlendShapeCount'
+  }
+}

+ 27 - 0
api/lovr/data/ModelData/getBlendShapeName.lua

@@ -0,0 +1,27 @@
+return {
+  summary = 'Get the name of a blend shape in the model.',
+  description = 'Returns the name of a blend shape in the model.',
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of a blend shape.'
+    }
+  },
+  returns = {
+    name = {
+      type = 'string',
+      description = 'The name of the blend shape.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'name' }
+    }
+  },
+  notes = 'This function will throw an error if the blend shape index is invalid.',
+  related = {
+    'ModelData:getBlendShapeCount',
+    'Model:getBlendShapeName'
+  }
+}

+ 21 - 0
api/lovr/graphics/Model/getBlendShapeCount.lua

@@ -0,0 +1,21 @@
+return {
+  summary = 'Get the number of blend shapes in the model.',
+  description = 'Returns the number of blend shapes in the model.',
+  arguments = {},
+  returns = {
+    count = {
+      type = 'number',
+      description = 'The number of blend shapes in the model.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'count' }
+    }
+  },
+  related = {
+    'Model:getBlendShapeName',
+    'ModelData:getBlendShapeCount'
+  }
+}

+ 27 - 0
api/lovr/graphics/Model/getBlendShapeName.lua

@@ -0,0 +1,27 @@
+return {
+  summary = 'Get the name of a blend shape in the model.',
+  description = 'Returns the name of a blend shape in the model.',
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of a blend shape.'
+    }
+  },
+  returns = {
+    name = {
+      type = 'string',
+      description = 'The name of the blend shape.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'name' }
+    }
+  },
+  notes = 'This function will throw an error if the blend shape index is invalid.',
+  related = {
+    'Model:getBlendShapeCount',
+    'ModelData:getBlendShapeName'
+  }
+}

+ 46 - 0
api/lovr/graphics/Model/getBlendShapeWeight.lua

@@ -0,0 +1,46 @@
+return {
+  summary = 'Get the weight of a blend shape.',
+  description = [[
+    Returns the weight of a blend shape.  A blend shape contains offset values for the vertices of
+    one of the meshes in a Model.  Whenever the Model is drawn, the offsets are multiplied by the
+    weight of the blend shape, allowing for smooth blending between different meshes.  A weight of
+    zero won't apply any displacement and will skip processing of the blend shape.
+  ]],
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of a blend shape.'
+    },
+    name = {
+      type = 'string',
+      description = 'The name of a blend shape.'
+    }
+  },
+  returns = {
+    weight = {
+      type = 'number',
+      description = 'The weight of the blend shape.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'index' },
+      returns = { 'weight' }
+    },
+    {
+      arguments = { 'name' },
+      returns = { 'weight' }
+    }
+  },
+  notes = [[
+    The initial weights are declared in the model file.
+
+    Weights can be any number, but usually they're kept between 0 and 1.
+
+    This function will throw an error if the blend shape name or index doesn't exist.
+  ]],
+  related = {
+    'Model:getBlendShapeCount',
+    'Model:getBlendShapeName'
+  }
+}

+ 45 - 0
api/lovr/graphics/Model/setBlendShapeWeight.lua

@@ -0,0 +1,45 @@
+return {
+  summary = 'Set the weight of a blend shape.',
+  description = [[
+    Sets the weight of a blend shape.  A blend shape contains offset values for the vertices of one
+    of the meshes in a Model.  Whenever the Model is drawn, the offsets are multiplied by the weight
+    of the blend shape, allowing for smooth blending between different meshes.  A weight of zero
+    won't apply any displacement and will skip processing of the blend shape.
+  ]],
+  arguments = {
+    index = {
+      type = 'number',
+      description = 'The index of a blend shape.'
+    },
+    name = {
+      type = 'string',
+      description = 'The name of a blend shape.'
+    },
+    weight = {
+      type = 'number',
+      description = 'The new weight for the blend shape.'
+    },
+  },
+  returns = {},
+  variants = {
+    {
+      arguments = { 'index', 'weight' },
+      returns = {}
+    },
+    {
+      arguments = { 'name', 'weight' },
+      returns = {}
+    }
+  },
+  notes = [[
+    The initial weights are declared in the model file.
+
+    Weights can be any number, but usually they're kept between 0 and 1.
+
+    This function will throw an error if the blend shape name or index doesn't exist.
+  ]],
+  related = {
+    'Model:getBlendShapeCount',
+    'Model:getBlendShapeName'
+  }
+}

+ 26 - 0
api/lovr/system/getMousePosition.lua

@@ -0,0 +1,26 @@
+return {
+  summary = 'Get the position of the mouse.',
+  description = 'Returns the position of the mouse.',
+  arguments = {},
+  returns = {
+    x = {
+      type = 'number',
+      description = 'The x position of the mouse, relative to the top-left of the window.'
+    },
+    y = {
+      type = 'number',
+      description = 'The y position of the mouse, relative to the top-left of the window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'x', 'y' }
+    }
+  },
+  related = {
+    'lovr.system.getMouseX',
+    'lovr.system.getMouseY',
+    'lovr.mousemoved'
+  }
+}

+ 22 - 0
api/lovr/system/getMouseX.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the x position of the mouse.',
+  description = 'Returns the x position of the mouse.',
+  arguments = {},
+  returns = {
+    x = {
+      type = 'number',
+      description = 'The x position of the mouse, relative to the top-left of the window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'x' }
+    }
+  },
+  related = {
+    'lovr.system.getMouseY',
+    'lovr.system.getMousePosition',
+    'lovr.mousemoved'
+  }
+}

+ 22 - 0
api/lovr/system/getMouseY.lua

@@ -0,0 +1,22 @@
+return {
+  summary = 'Get the y position of the mouse.',
+  description = 'Returns the y position of the mouse.',
+  arguments = {},
+  returns = {
+    y = {
+      type = 'number',
+      description = 'The y position of the mouse, relative to the top-left of the window.'
+    }
+  },
+  variants = {
+    {
+      arguments = {},
+      returns = { 'y' }
+    }
+  },
+  related = {
+    'lovr.system.getMouseX',
+    'lovr.system.getMousePosition',
+    'lovr.mousemoved'
+  }
+}

+ 32 - 0
api/lovr/system/isMouseDown.lua

@@ -0,0 +1,32 @@
+return {
+  summary = 'Check if a mouse button is pressed.',
+  description = 'Returns whether a mouse button is currently pressed.',
+  arguments = {
+    button = {
+      type = 'number',
+      description = [[
+        The index of a button to check.  Use 1 for the primary mouse button, 2 for the secondary
+        button, and 3 for the middle button.  Other indices can be used, but are hardware-specific.
+      ]]
+    }
+  },
+  returns = {
+    down = {
+      type = 'boolean',
+      description = 'Whether the mouse button is currently down.'
+    }
+  },
+  variants = {
+    {
+      arguments = { 'button' },
+      returns = { 'down' }
+    }
+  },
+  related = {
+    'lovr.mousepressed',
+    'lovr.mousereleased',
+    'lovr.system.getMouseX',
+    'lovr.system.getMouseY',
+    'lovr.system.getMousePosition'
+  }
+}