1 | /**
|
---|
2 | * @author alteredq / http://alteredqualia.com/
|
---|
3 | */
|
---|
4 |
|
---|
5 | THREE.Gyroscope = function () {
|
---|
6 |
|
---|
7 | THREE.Object3D.call( this );
|
---|
8 |
|
---|
9 | };
|
---|
10 |
|
---|
11 | THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
|
---|
12 |
|
---|
13 | THREE.Gyroscope.prototype.updateMatrixWorld = function ( force ) {
|
---|
14 |
|
---|
15 | this.matrixAutoUpdate && this.updateMatrix();
|
---|
16 |
|
---|
17 | // update matrixWorld
|
---|
18 |
|
---|
19 | if ( this.matrixWorldNeedsUpdate || force ) {
|
---|
20 |
|
---|
21 | if ( this.parent ) {
|
---|
22 |
|
---|
23 | this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix );
|
---|
24 |
|
---|
25 | this.matrixWorld.decompose( this.translationWorld, this.quaternionWorld, this.scaleWorld );
|
---|
26 | this.matrix.decompose( this.translationObject, this.quaternionObject, this.scaleObject );
|
---|
27 |
|
---|
28 | this.matrixWorld.compose( this.translationWorld, this.quaternionObject, this.scaleWorld );
|
---|
29 |
|
---|
30 |
|
---|
31 | } else {
|
---|
32 |
|
---|
33 | this.matrixWorld.copy( this.matrix );
|
---|
34 |
|
---|
35 | }
|
---|
36 |
|
---|
37 |
|
---|
38 | this.matrixWorldNeedsUpdate = false;
|
---|
39 |
|
---|
40 | force = true;
|
---|
41 |
|
---|
42 | }
|
---|
43 |
|
---|
44 | // update children
|
---|
45 |
|
---|
46 | for ( var i = 0, l = this.children.length; i < l; i ++ ) {
|
---|
47 |
|
---|
48 | this.children[ i ].updateMatrixWorld( force );
|
---|
49 |
|
---|
50 | }
|
---|
51 |
|
---|
52 | };
|
---|
53 |
|
---|
54 | THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3();
|
---|
55 | THREE.Gyroscope.prototype.translationObject = new THREE.Vector3();
|
---|
56 | THREE.Gyroscope.prototype.quaternionWorld = new THREE.Quaternion();
|
---|
57 | THREE.Gyroscope.prototype.quaternionObject = new THREE.Quaternion();
|
---|
58 | THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3();
|
---|
59 | THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3();
|
---|
60 |
|
---|