source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/src/extras/core/Gyroscope.js@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 1.5 KB
Line 
1/**
2 * @author alteredq / http://alteredqualia.com/
3 */
4
5THREE.Gyroscope = function () {
6
7 THREE.Object3D.call( this );
8
9};
10
11THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype );
12
13THREE.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
54THREE.Gyroscope.prototype.translationWorld = new THREE.Vector3();
55THREE.Gyroscope.prototype.translationObject = new THREE.Vector3();
56THREE.Gyroscope.prototype.quaternionWorld = new THREE.Quaternion();
57THREE.Gyroscope.prototype.quaternionObject = new THREE.Quaternion();
58THREE.Gyroscope.prototype.scaleWorld = new THREE.Vector3();
59THREE.Gyroscope.prototype.scaleObject = new THREE.Vector3();
60
Note: See TracBrowser for help on using the repository browser.