Skip to content

Commit 843b556

Browse files
renyu-iofacebook-github-bot-4
authored andcommitted
Fix the perspective projection
Reviewed By: kukulski Differential Revision: D2907261 fb-gh-sync-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41 shipit-source-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41
1 parent 194092e commit 843b556

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Libraries/Utilities/MatrixMath.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,14 @@ var MatrixMath = {
6767
];
6868
},
6969

70+
/**
71+
* This create a perspective projection towards negative z
72+
* Clipping the z range of [-near, -far]
73+
*
74+
* @param fovInRadians - field of view in randians
75+
*/
7076
createPerspective: function(fovInRadians, aspect, near, far) {
71-
var h = 1 / Math.tan(fovInRadians);
77+
var h = 1 / Math.tan(fovInRadians / 2);
7278
var r_depth = 1 / (near - far);
7379
var C = (far + near) * r_depth;
7480
var D = 2 * (far * near * r_depth);

0 commit comments

Comments
 (0)