Camera.js 676 B

123456789101112131415161718192021222324252627282930
  1. /**
  2. * @author mr.doob / http://mrdoob.com/
  3. */
  4. THREE.Camera = function ( fov, aspect, near, far ) {
  5. this.fov = fov;
  6. this.aspect = aspect;
  7. this.position = new THREE.Vector3( 0, 0, 0 );
  8. this.target = { position: new THREE.Vector3( 0, 0, 0 ) };
  9. this.projectionMatrix = THREE.Matrix4.makePerspective( fov, aspect, near, far );
  10. this.up = new THREE.Vector3( 0, 1, 0 );
  11. this.matrix = new THREE.Matrix4();
  12. this.autoUpdateMatrix = true;
  13. this.updateMatrix = function () {
  14. this.matrix.lookAt( this.position, this.target.position, this.up );
  15. };
  16. this.toString = function () {
  17. return 'THREE.Camera ( ' + this.position + ', ' + this.target.position + ' )';
  18. };
  19. };