* Generates a perspective projection matrix with the given bounds * * @param {mat4} out mat4 frustum matrix will be written into * @param {number} fovy Vertical field of view in radians * @param {number} aspect Aspect ratio. typically viewport width/height * @param {number} near Near bound of t
(out, fovy, aspect, near, far)
| 16413 | * @returns {mat4} out |
| 16414 | */ |
| 16415 | function perspective(out, fovy, aspect, near, far) { |
| 16416 | var f = 1.0 / Math.tan(fovy / 2), |
| 16417 | nf = 1 / (near - far); |
| 16418 | out[0] = f / aspect; |
| 16419 | out[1] = 0; |
| 16420 | out[2] = 0; |
| 16421 | out[3] = 0; |
| 16422 | out[4] = 0; |
| 16423 | out[5] = f; |
| 16424 | out[6] = 0; |
| 16425 | out[7] = 0; |
| 16426 | out[8] = 0; |
| 16427 | out[9] = 0; |
| 16428 | out[10] = (far + near) * nf; |
| 16429 | out[11] = -1; |
| 16430 | out[12] = 0; |
| 16431 | out[13] = 0; |
| 16432 | out[14] = (2 * far * near) * nf; |
| 16433 | out[15] = 0; |
| 16434 | return out; |
| 16435 | }; |
| 16436 | |
| 16437 | /***/ }), |
| 16438 |
no outgoing calls
no test coverage detected
searching dependent graphs…