فهرست منبع

Merge pull request #86 from jmiskovic/update/mat4-perspective

API changes to mat4 perspective functions
Bjorn 2 سال پیش
والد
کامیت
c62b79e350
2فایلهای تغییر یافته به همراه26 افزوده شده و 14 حذف شده
  1. 16 4
      api/lovr/math/Mat4/orthographic.lua
  2. 10 10
      api/lovr/math/Mat4/perspective.lua

+ 16 - 4
api/lovr/math/Mat4/orthographic.lua

@@ -3,7 +3,7 @@ return {
   description = [[
     Sets this matrix to represent an orthographic projection, useful for 2D/isometric rendering.
 
-    This can be used with `lovr.graphics.setProjection`, or it can be sent to a `Shader` for use in
+    This can be used with `Pass:setProjection`, or it can be sent to a `Shader` for use in
     GLSL.
   ]],
   arguments = {
@@ -15,13 +15,21 @@ return {
       type = 'number',
       description = 'The right edge of the projection.'
     },
+    bottom = {
+      type = 'number',
+      description = 'The bottom edge of the projection.'
+    },
     top = {
       type = 'number',
       description = 'The top edge of the projection.'
     },
-    bottom = {
+    width = {
       type = 'number',
-      description = 'The bottom edge of the projection.'
+      description = 'The width of the projection.'
+    },
+    height = {
+      type = 'number',
+      description = 'The height of the projection.'
     },
     near = {
       type = 'number',
@@ -40,7 +48,11 @@ return {
   },
   variants = {
     {
-      arguments = { 'left', 'right', 'top', 'bottom', 'near', 'far' },
+      arguments = { 'left', 'right', 'bottom', 'top', 'near', 'far' },
+      returns = { 'm' }
+    },
+    {
+      arguments = { 'width', 'height', 'near', 'far' },
       returns = { 'm' }
     }
   },

+ 10 - 10
api/lovr/math/Mat4/perspective.lua

@@ -3,10 +3,18 @@ return {
   description = [[
     Sets this matrix to represent a perspective projection.
 
-    This can be used with `lovr.graphics.setProjection`, or it can be sent to a `Shader` for use in
+    This can be used with `Pass:setProjection`, or it can be sent to a `Shader` for use in
     GLSL.
   ]],
   arguments = {
+    fov = {
+      type = 'number',
+      description = 'The vertical field of view (in radians).'
+    },
+    aspect = {
+      type = 'number',
+      description = 'The horizontal aspect ratio of the projection (width / height).'
+    },
     near = {
       type = 'number',
       description = 'The near plane.'
@@ -15,14 +23,6 @@ return {
       type = 'number',
       description = 'The far plane.'
     },
-    fov = {
-      type = 'number',
-      description = 'The vertical field of view (in radians).'
-    },
-    aspect = {
-      type = 'number',
-      description = 'The horizontal aspect ratio of the projection (width / height).'
-    }
   },
   returns = {
     m = {
@@ -32,7 +32,7 @@ return {
   },
   variants = {
     {
-      arguments = { 'near', 'far', 'fov', 'aspect' },
+      arguments = { 'fov', 'aspect', 'near', 'far' },
       returns = { 'm' }
     }
   },