Browse Source

Fix getAnimationDuration;

bjorn 3 years ago
parent
commit
62ba70d92b
2 changed files with 53 additions and 432 deletions
  1. 43 432
      api/init.lua
  2. 10 0
      api/lovr/graphics/Model/getAnimationDuration.lua

+ 43 - 432
api/init.lua

@@ -6453,17 +6453,31 @@ return {
               variants = {
                 {
                   arguments = {
-                    name = {
+                    {
+                      name = "name",
                       type = "string",
                       description = "The name of the animation."
-                    },
-                    index = {
+                    }
+                  },
+                  returns = {
+                    {
+                      name = "duration",
+                      type = "number",
+                      description = "The duration of the animation, in seconds."
+                    }
+                  }
+                },
+                {
+                  arguments = {
+                    {
+                      name = "index",
                       type = "number",
                       description = "The animation index."
                     }
                   },
                   returns = {
-                    duration = {
+                    {
+                      name = "duration",
                       type = "number",
                       description = "The duration of the animation, in seconds."
                     }
@@ -16969,13 +16983,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to add to x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to add to y component.",
-                      default = "x"
+                      description = "A number to add to each component."
                     }
                   },
                   returns = {
@@ -17013,27 +17021,6 @@ return {
                       description = "The distance to `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to measure distance to."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to measure distance to."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "distance",
-                      type = "number",
-                      description = "The distance to `u`."
-                    }
-                  }
                 }
               }
             },
@@ -17070,13 +17057,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to divide x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to divide y component by.",
-                      default = "x"
+                      description = "The number to divide each component by."
                     }
                   },
                   returns = {
@@ -17095,7 +17076,7 @@ return {
               description = "Returns the dot product between this vector and another one.",
               key = "Vec2:dot",
               module = "lovr.math",
-              notes = "This is computed as:\n\n    dot = v.x * u.x + v.y * u.y\n\nThe vectors are not normalized before computing the dot product.",
+              notes = "This is computed as:\n\n    dot = v.x * u.x + v.y * u.y + v.z * u.z\n\nThe vectors are not normalized before computing the dot product.",
               variants = {
                 {
                   arguments = {
@@ -17112,27 +17093,6 @@ return {
                       description = "The dot product between `v` and `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to compute the dot product with."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to compute the dot product with."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "dot",
-                      type = "number",
-                      description = "The dot product between `v` and `u`."
-                    }
-                  }
                 }
               }
             },
@@ -17170,27 +17130,17 @@ return {
                 "Quat:slerp"
               },
               variants = {
-                {
-                  arguments = {},
-                  returns = {
-                    {
-                      name = "v",
-                      type = "Vec2",
-                      description = "The original vector, containing the new lerped values."
-                    }
-                  }
-                },
                 {
                   arguments = {
                     {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to lerp towards."
+                      name = "u",
+                      type = "Vec2",
+                      description = "The vector to lerp towards."
                     },
                     {
-                      name = "y",
+                      name = "t",
                       type = "number",
-                      description = "A value of y component to lerp towards."
+                      description = "The lerping parameter."
                     }
                   },
                   returns = {
@@ -17236,13 +17186,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to multiply x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to multiply y component by.",
-                      default = "x"
+                      description = "The number to multiply each component by."
                     }
                   },
                   returns = {
@@ -17361,13 +17305,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to subtract from x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to subtract from y component.",
-                      default = "x"
+                      description = "A number to subtract from each component."
                     }
                   },
                   returns = {
@@ -17457,19 +17395,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to add to x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to add to y component.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to add to z component.",
-                      default = "x"
+                      description = "A number to add to each component."
                     }
                   },
                   returns = {
@@ -17505,32 +17431,6 @@ return {
                       description = "The original vector, with the cross product as its values."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to compute cross product with."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to compute cross product with."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to compute cross product with."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "v",
-                      type = "Vec3",
-                      description = "The original vector, with the cross product as its values."
-                    }
-                  }
                 }
               },
               related = {
@@ -17562,32 +17462,6 @@ return {
                       description = "The distance to `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to measure distance to."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to measure distance to."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to measure distance to."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "distance",
-                      type = "number",
-                      description = "The distance to `u`."
-                    }
-                  }
                 }
               }
             },
@@ -17624,19 +17498,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to divide x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to divide y component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to divide z component by.",
-                      default = "x"
+                      description = "The number to divide each component by."
                     }
                   },
                   returns = {
@@ -17672,32 +17534,6 @@ return {
                       description = "The dot product between `v` and `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to compute the dot product with."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to compute the dot product with."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to compute the dot product with."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "dot",
-                      type = "number",
-                      description = "The dot product between `v` and `u`."
-                    }
-                  }
                 }
               },
               related = {
@@ -17758,37 +17594,6 @@ return {
                       description = "The original vector, containing the new lerped values."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to lerp towards."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to lerp towards."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to lerp towards."
-                    },
-                    {
-                      name = "t",
-                      type = "number",
-                      description = "The lerping parameter."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "v",
-                      type = "Vec3",
-                      description = "The original vector, containing the new lerped values."
-                    }
-                  }
                 }
               }
             },
@@ -17825,19 +17630,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to multiply x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to multiply y component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to multiply z component by.",
-                      default = "x"
+                      description = "The number to multiply each component by."
                     }
                   },
                   returns = {
@@ -17978,19 +17771,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to subtract from x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to subtract from y component.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to subtract from z component.",
-                      default = "x"
+                      description = "A number to subtract from each component."
                     }
                   },
                   returns = {
@@ -18085,25 +17866,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to add to x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to add to y component.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to add to z component.",
-                      default = "x"
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value to add to w component.",
-                      default = "x"
+                      description = "A number to add to each component."
                     }
                   },
                   returns = {
@@ -18141,37 +17904,6 @@ return {
                       description = "The distance to `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to measure distance to."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to measure distance to."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to measure distance to."
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value of w component to measure distance to."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "distance",
-                      type = "number",
-                      description = "The distance to `u`."
-                    }
-                  }
                 }
               }
             },
@@ -18208,25 +17940,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to divide x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to divide y component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to divide z component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value to divide w component by.",
-                      default = "x"
+                      description = "The number to divide each component by."
                     }
                   },
                   returns = {
@@ -18262,37 +17976,6 @@ return {
                       description = "The dot product between `v` and `u`."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to compute the dot product with."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to compute the dot product with."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to compute the dot product with."
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value of w component to compute the dot product with."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "dot",
-                      type = "number",
-                      description = "The dot product between `v` and `u`."
-                    }
-                  }
                 }
               }
             },
@@ -18350,42 +18033,6 @@ return {
                       description = "The original vector, containing the new lerped values."
                     }
                   }
-                },
-                {
-                  arguments = {
-                    {
-                      name = "x",
-                      type = "number",
-                      description = "A value of x component to lerp towards."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value of y component to lerp towards."
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value of z component to lerp towards."
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value of w component to lerp towards."
-                    },
-                    {
-                      name = "t",
-                      type = "number",
-                      description = "The lerping parameter."
-                    }
-                  },
-                  returns = {
-                    {
-                      name = "v",
-                      type = "Vec4",
-                      description = "The original vector, containing the new lerped values."
-                    }
-                  }
                 }
               }
             },
@@ -18422,25 +18069,7 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to multiply x component by."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to multiply y component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to multiply z component by.",
-                      default = "x"
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value to multiply w component by.",
-                      default = "x"
+                      description = "The number to multiply each component by."
                     }
                   },
                   returns = {
@@ -18545,23 +18174,23 @@ return {
               key = "Vec4:sub",
               module = "lovr.math",
               related = {
-                "Vec4:add",
-                "Vec4:mul",
-                "Vec4:div"
+                "Vec2:add",
+                "Vec2:mul",
+                "Vec2:div"
               },
               variants = {
                 {
                   arguments = {
                     {
                       name = "u",
-                      type = "Vec4",
+                      type = "Vec2",
                       description = "The other vector."
                     }
                   },
                   returns = {
                     {
                       name = "v",
-                      type = "Vec4",
+                      type = "Vec2",
                       description = "The original vector."
                     }
                   }
@@ -18571,31 +18200,13 @@ return {
                     {
                       name = "x",
                       type = "number",
-                      description = "A value to subtract from x component."
-                    },
-                    {
-                      name = "y",
-                      type = "number",
-                      description = "A value to subtract from y component.",
-                      default = "x"
-                    },
-                    {
-                      name = "z",
-                      type = "number",
-                      description = "A value to subtract from z component.",
-                      default = "x"
-                    },
-                    {
-                      name = "w",
-                      type = "number",
-                      description = "A value to subtract from w component.",
-                      default = "x"
+                      description = "A number to subtract from each component."
                     }
                   },
                   returns = {
                     {
                       name = "v",
-                      type = "Vec4",
+                      type = "Vec2",
                       description = "The original vector."
                     }
                   }
@@ -25613,7 +25224,7 @@ return {
               description = "The id of the key (ignores keyboard layout, may vary between keyboards)."
             },
             {
-              name = "repeating",
+              name = "repeat",
               type = "boolean",
               description = "Whether the event is the result of a key repeat instead of an actual press."
             }

+ 10 - 0
api/lovr/graphics/Model/getAnimationDuration.lua

@@ -17,6 +17,16 @@ return {
       description = 'The duration of the animation, in seconds.'
     }
   },
+  variants = {
+    {
+      arguments = { 'name' },
+      returns = { 'duration' }
+    },
+    {
+      arguments = { 'index' },
+      returns = { 'duration' }
+    }
+  },
   related = {
     'Model:getAnimationCount',
     'Model:getAnimationName',