(target: Object3D, projByViewInv: Matrix4)
| 37 | } |
| 38 | |
| 39 | const updateCamera = (target: Object3D, projByViewInv: Matrix4) => { |
| 40 | |
| 41 | target.position |
| 42 | .setScalar(0) |
| 43 | .applyMatrix4(projByViewInv) |
| 44 | |
| 45 | target.up |
| 46 | .set(0, -1, 0) |
| 47 | .applyMatrix4(projByViewInv) |
| 48 | .negate() |
| 49 | .add(target.position) |
| 50 | .normalize() |
| 51 | |
| 52 | fwd |
| 53 | .set(0, 0, 1) |
| 54 | .applyMatrix4(projByViewInv) |
| 55 | |
| 56 | target.lookAt(fwd); |
| 57 | |
| 58 | } |
| 59 | |
| 60 | function calculateFar(c: number, d: number, near: number): number { |
| 61 | const numerator = d * (c - 1); |