diff --git a/Libraries/Utilities/MatrixMath.js b/Libraries/Utilities/MatrixMath.js index c6a26ea82..6103e1d1e 100755 --- a/Libraries/Utilities/MatrixMath.js +++ b/Libraries/Utilities/MatrixMath.js @@ -31,6 +31,24 @@ var MatrixMath = { ]; }, + createFrustum: function(left, right, bottom, top, near, far) { + var r_width = 1 / (right - left); + var r_height = 1 / (top - bottom); + var r_depth = 1 / (near - far); + var x = 2 * (near * r_width); + var y = 2 * (near * r_height); + var A = (right + left) * r_width; + var B = (top + bottom) * r_height; + var C = (far + near) * r_depth; + var D = 2 * (far * near * r_depth); + return [ + x, 0, 0, 0, + 0, y, 0, 0, + A, B, C,-1, + 0, 0, D, 0, + ]; + }, + createTranslate2d: function(x, y) { var mat = MatrixMath.createIdentityMatrix(); MatrixMath.reuseTranslate2dCommand(mat, x, y);