Fix the perspective projection
Reviewed By: kukulski Differential Revision: D2907261 fb-gh-sync-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41 shipit-source-id: 3954b015ece9c4339a674c4fcc2c2c7187b6da41
This commit is contained in:
parent
194092e729
commit
843b556769
|
@ -67,8 +67,14 @@ var MatrixMath = {
|
|||
];
|
||||
},
|
||||
|
||||
/**
|
||||
* This create a perspective projection towards negative z
|
||||
* Clipping the z range of [-near, -far]
|
||||
*
|
||||
* @param fovInRadians - field of view in randians
|
||||
*/
|
||||
createPerspective: function(fovInRadians, aspect, near, far) {
|
||||
var h = 1 / Math.tan(fovInRadians);
|
||||
var h = 1 / Math.tan(fovInRadians / 2);
|
||||
var r_depth = 1 / (near - far);
|
||||
var C = (far + near) * r_depth;
|
||||
var D = 2 * (far * near * r_depth);
|
||||
|
|
Loading…
Reference in New Issue