|
|
@@ -21,14 +21,19 @@ class ExtendView extends View {
|
|
|
this.sid = sid++
|
|
|
this.LookTransition = 'LookTransition'+this.sid
|
|
|
this.FlyTransition = 'FlyTransition'+this.sid
|
|
|
-
|
|
|
+ this.freeQuaternion = new THREE.Quaternion
|
|
|
}
|
|
|
//add------
|
|
|
applyToCamera(camera){
|
|
|
camera.position.copy(this.position);
|
|
|
- camera.rotation.copy(this.rotation)
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ if(this.rotMode == 'free'){ //不受相机旋转模式限定,可以歪着,任意角度
|
|
|
+ camera.quaternion.copy(this.freeQuaternion)
|
|
|
+ }else{
|
|
|
+ camera.rotation.copy(this.rotation)
|
|
|
+ }
|
|
|
+
|
|
|
camera.updateMatrix();
|
|
|
camera.updateMatrixWorld();
|
|
|
//camera.matrixWorldInverse.copy(camera.matrixWorld).invert();
|
|
|
@@ -52,13 +57,27 @@ class ExtendView extends View {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ setRotMode(mode){
|
|
|
+ if(mode == 'free'){
|
|
|
+ this.freeQuaternion.copy(this.quaternion)
|
|
|
+ }
|
|
|
+ this.rotMode = mode
|
|
|
+ }
|
|
|
|
|
|
get quaternion(){
|
|
|
- return new THREE.Quaternion().setFromEuler(this.rotation)
|
|
|
+ if(this.rotMode == 'free'){
|
|
|
+ return this.freeQuaternion
|
|
|
+ }else{
|
|
|
+ return new THREE.Quaternion().setFromEuler(this.rotation)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
set quaternion(q){
|
|
|
- this.rotation = new THREE.Euler().setFromQuaternion(q)
|
|
|
+ if(this.rotMode == 'free'){
|
|
|
+ this.freeQuaternion.copy(q)
|
|
|
+ }else{
|
|
|
+ this.rotation = new THREE.Euler().setFromQuaternion(q)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
copy(a){
|