Browse Source

Update projection docs;

bjorn 2 years ago
parent
commit
aca0e5ca81
4 changed files with 1228 additions and 487 deletions
  1. 1211 478
      api/init.lua
  2. 6 6
      api/lovr/graphics/Pass/setProjection.lua
  3. 6 2
      api/lovr/math/Mat4/fov.lua
  4. 5 1
      api/lovr/math/Mat4/perspective.lua

File diff suppressed because it is too large
+ 1211 - 478
api/init.lua


+ 6 - 6
api/lovr/graphics/Pass/setProjection.lua

@@ -4,12 +4,10 @@ return {
   description = [[
   description = [[
     Sets the projection for a single view.  4 field of view angles can be used, similar to the field
     Sets the projection for a single view.  4 field of view angles can be used, similar to the field
     of view returned by `lovr.headset.getViewAngles`.  Alternatively, a projection matrix can be
     of view returned by `lovr.headset.getViewAngles`.  Alternatively, a projection matrix can be
-    used for other types of projections like orthographic, oblique, etc.  There is also a shorthand
-    string "orthographic" that can be used to configure an orthographic projection.
+    used for other types of projections like orthographic, oblique, etc.
 
 
-    Up to 6 views are supported.  When rendering to the headset, both projections are changed to
-    match the ones used by the headset.  This is also available by calling
-    `lovr.headset.getViewAngles`.
+    Up to 6 views are supported.  The Pass returned by `lovr.headset.getPass` will have its views
+    automatically configured to match the headset.
   ]],
   ]],
   arguments = {
   arguments = {
     view = {
     view = {
@@ -60,7 +58,9 @@ return {
   },
   },
   notes = [[
   notes = [[
     A far clipping plane of 0.0 can be used for an infinite far plane with reversed Z range.  This
     A far clipping plane of 0.0 can be used for an infinite far plane with reversed Z range.  This
-    is the default.
+    is the default because it improves depth precision and reduces Z fighting.  Using a non-infinite
+    far plane requires the depth buffer to be cleared to 1.0 instead of 0.0 and the default depth
+    test to be changed to `lequal` instead of `gequal`.
   ]],
   ]],
   related = {
   related = {
     'lovr.headset.getViewAngles',
     'lovr.headset.getViewAngles',

+ 6 - 2
api/lovr/math/Mat4/fov.lua

@@ -1,5 +1,5 @@
 return {
 return {
-  summary = 'Set a projection using raw FoV angles.',
+  summary = 'Set a projection using raw field of view angles.',
   description = [[
   description = [[
     Sets a projection matrix using raw projection angles and clipping planes.
     Sets a projection matrix using raw projection angles and clipping planes.
 
 
@@ -28,7 +28,11 @@ return {
     },
     },
     far = {
     far = {
       type = 'number',
       type = 'number',
-      description = 'The far plane of the projection.'
+      default = '0',
+      description = [[
+        The far plane.  Zero is a special value that will set an infinite far plane with a reversed
+        Z range, which improves depth buffer precision and is the default.
+      ]]
     }
     }
   },
   },
   returns = {
   returns = {

+ 5 - 1
api/lovr/math/Mat4/perspective.lua

@@ -21,7 +21,11 @@ return {
     },
     },
     far = {
     far = {
       type = 'number',
       type = 'number',
-      description = 'The far plane.'
+      default = '0',
+      description = [[
+        The far plane.  Zero is a special value that will set an infinite far plane with a reversed
+        Z range, which improves depth buffer precision and is the default.
+      ]]
     },
     },
   },
   },
   returns = {
   returns = {

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