Untitled diff

创建于 差异永不过期
144 删除
404 行
410 添加
648 行
/**
/**
* @author qiao / https://github.com/qiao
* @author qiao / https://github.com/qiao
* @author mrdoob / http://mrdoob.com
* @author mrdoob / http://mrdoob.com
* @author alteredq / http://alteredqualia.com/
* @author alteredq / http://alteredqualia.com/
* @author WestLangley / http://github.com/WestLangley
* @author WestLangley / http://github.com/WestLangley
* @author erich666 / http://erichaines.com
*/
*/
/*global THREE, console */
// This set of controls performs orbiting, dollying (zooming), and panning. It maintains
// the "up" direction as +Y, unlike the TrackballControls. Touch on tablet and phones is
// supported.
//
// Orbit - left mouse / touch: one finger move
// Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
// Pan - right mouse, or arrow keys / touch: three finter swipe
//
// This is a drop-in replacement for (most) TrackballControls used in examples.
// That is, include this js file and wherever you see:
// controls = new THREE.TrackballControls( camera );
// controls.target.z = 150;
// Simple substitute "OrbitControls" and the control should work as-is.
THREE.OrbitControls = function ( object, domElement ) {
THREE.OrbitControls = function ( object, domElement ) {
this.object = object;
this.object = object;
this.domElement = ( domElement !== undefined ) ? domElement : document;
this.domElement = ( domElement !== undefined ) ? domElement : document;
// API
// API
// Set to false to disable this control
this.enabled = true;
this.enabled = true;
// "target" sets the location of focus, where the control orbits around
// and where it pans with respect to.
this.center = new THREE.Vector3();
this.target = new THREE.Vector3();
this.userZoom = true;
// center is old, deprecated; use "target" instead
this.userZoomSpeed = 1.0;
this.center = this.target;
// This option actually enables dollying in and out; left as "zoom" for
// backwards compatibility
this.userRotate = true;
this.noZoom = false;
this.userRotateSpeed = 1.0;
this.zoomSpeed = 1.0;
// Limits to how far you can dolly in and out
this.minDistance = 0;
this.maxDistance = Infinity;
// Set to true to disable this control
this.noRotate = false;
this.rotateSpeed = 1.0;
// Set to true to disable this control
this.userPan = true;
this.noPan = false;
this.userPanSpeed = 2.0;
this.keyPanSpeed = 7.0; // pixels moved per arrow key push
// Set to true to automatically rotate around the target
this.autoRotate = false;
this.autoRotate = false;
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
// How far you can orbit vertically, upper and lower limits.
// Range is 0 to Math.PI radians.
this.minPolarAngle = 0; // radians
this.minPolarAngle = 0; // radians
this.maxPolarAngle = Math.PI; // radians
this.maxPolarAngle = Math.PI; // radians
this.minDistance = 0;
// Set to true to disable use of the keys
this.maxDistance = Infinity;
this.noKeys = false;
// 65 /*A*/, 83 /*S*/, 68 /*D*/
// The four arrow keys
this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40, ROTATE: 65, ZOOM: 83, PAN: 68 };
this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
////////////
// internals
// internals
var scope = this;
var scope = this;
var EPS = 0.000001;
var EPS = 0.000001;
var PIXELS_PER_ROUND = 1800;
var rotateStart = new THREE.Vector2();
var rotateStart = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateEnd = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var rotateDelta = new THREE.Vector2();
var panStart = new THREE.Vector2();
var panEnd = new THREE.Vector2();
var panDelta = new THREE.Vector2();
var panOffset = new THREE.Vector3();
var offset = new THREE.Vector3();
var zoomStart = new THREE.Vector2();
var dollyStart = new THREE.Vector2();
var zoomEnd = new THREE.Vector2();
var dollyEnd = new THREE.Vector2();
var zoomDelta = new THREE.Vector2();
var dollyDelta = new THREE.Vector2();
var phiDelta = 0;
var phiDelta = 0;
var thetaDelta = 0;
var thetaDelta = 0;
var scale = 1;
var scale = 1;
var pan = new THREE.Vector3();