Camera.js 736 B

12345678910111213141516171819202122232425262728293031323334
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. THREE.Camera = function (x, y, z) {
  5. this.position = new THREE.Vector3(x, y, z);
  6. this.target = { position: new THREE.Vector3(0, 0, 0) }
  7. this.matrix = new THREE.Matrix4();
  8. this.projectionMatrix = THREE.Matrix4.makePerspective(45, 1 /*SCREEN_WIDTH/SCREEN_HEIGHT*/, 0.001, 1000);
  9. this.up = new THREE.Vector3(0, 1, 0);
  10. this.roll = 0;
  11. // TODO: Need to remove this
  12. this.zoom = 3;
  13. this.focus = 500;
  14. this.autoUpdateMatrix = true;
  15. this.updateMatrix = function () {
  16. this.matrix.lookAt(this.position, this.target.position, this.up);
  17. }
  18. this.toString = function () {
  19. return 'THREE.Camera ( ' + this.position + ', ' + this.target.position + ' )';
  20. }
  21. this.updateMatrix();
  22. }