1 /**
  2  * @author mrdoob / http://mrdoob.com/
  3  * @author mikael emtinger / http://gomo.se/
  4  * @author alteredq / http://alteredqualia.com/
  5  */
  6 
  7 /**@constructor*/
  8 THREE.Object3D = function () {
  9 
 10 	THREE.Object3DLibrary.push( this );
 11 
 12 	this.id = THREE.Object3DIdCount ++;
 13 
 14 	this.name = '';
 15 	this.properties = {};
 16 
 17 	this.parent = undefined;
 18 	this.children = [];
 19 
 20 	this.up = new THREE.Vector3( 0, 1, 0 );
 21 
 22 	this.position = new THREE.Vector3();
 23 	this.rotation = new THREE.Vector3();
 24 	this.eulerOrder = THREE.Object3D.defaultEulerOrder;
 25 	this.scale = new THREE.Vector3( 1, 1, 1 );
 26 
 27 	this.renderDepth = null;
 28 
 29 	this.rotationAutoUpdate = true;
 30 
 31 	this.matrix = new THREE.Matrix4();
 32 	this.matrixWorld = new THREE.Matrix4();
 33 	this.matrixRotationWorld = new THREE.Matrix4();
 34 
 35 	this.matrixAutoUpdate = true;
 36 	this.matrixWorldNeedsUpdate = true;
 37 
 38 	this.quaternion = new THREE.Quaternion();
 39 	this.useQuaternion = false;
 40 
 41 	this.boundRadius = 0.0;
 42 	this.boundRadiusScale = 1.0;
 43 
 44 	this.visible = true;
 45 
 46 	this.castShadow = false;
 47 	this.receiveShadow = false;
 48 
 49 	this.frustumCulled = true;
 50 
 51 	this._vector = new THREE.Vector3();
 52 
 53 };
 54 
 55 
 56 THREE.Object3D.prototype = {
 57 
 58 	constructor: THREE.Object3D,
 59 
 60 	applyMatrix: function ( matrix ) {
 61 
 62 		this.matrix.multiply( matrix, this.matrix );
 63 
 64 		this.scale.getScaleFromMatrix( this.matrix );
 65 
 66 		var mat = new THREE.Matrix4().extractRotation( this.matrix );
 67 		this.rotation.setEulerFromRotationMatrix( mat, this.eulerOrder );
 68 
 69 		this.position.getPositionFromMatrix( this.matrix );
 70 
 71 	},
 72 
 73 	translate: function ( distance, axis ) {
 74 
 75 		this.matrix.rotateAxis( axis );
 76 		this.position.addSelf( axis.multiplyScalar( distance ) );
 77 
 78 	},
 79 
 80 	translateX: function ( distance ) {
 81 
 82 		this.translate( distance, this._vector.set( 1, 0, 0 ) );
 83 
 84 	},
 85 
 86 	translateY: function ( distance ) {
 87 
 88 		this.translate( distance, this._vector.set( 0, 1, 0 ) );
 89 
 90 	},
 91 
 92 	translateZ: function ( distance ) {
 93 
 94 		this.translate( distance, this._vector.set( 0, 0, 1 ) );
 95 
 96 	},
 97 
 98 	localToWorld: function ( vector ) {
 99 
100 		return this.matrixWorld.multiplyVector3( vector );
101 
102 	},
103 
104 	worldToLocal: function ( vector ) {
105 
106 		return THREE.Object3D.__m1.getInverse( this.matrixWorld ).multiplyVector3( vector );
107 
108 	},
109 
110 	lookAt: function ( vector ) {
111 
112 		// TODO: Add hierarchy support.
113 
114 		this.matrix.lookAt( vector, this.position, this.up );
115 
116 		if ( this.rotationAutoUpdate ) {
117 
118 			if ( this.useQuaternion === false )  {
119 
120 				this.rotation.setEulerFromRotationMatrix( this.matrix, this.eulerOrder );
121 
122 			} else {
123 
124 				this.quaternion.copy( this.matrix.decompose()[ 1 ] );
125 
126 			}
127 
128 		}
129 
130 	},
131 
132 	add: function ( object ) {
133 
134 		if ( object === this ) {
135 
136 			console.warn( 'THREE.Object3D.add: An object can\'t be added as a child of itself.' );
137 			return;
138 
139 		}
140 
141 		if ( object instanceof THREE.Object3D ) {
142 
143 			if ( object.parent !== undefined ) {
144 
145 				object.parent.remove( object );
146 
147 			}
148 
149 			object.parent = this;
150 			this.children.push( object );
151 
152 			// add to scene
153 
154 			var scene = this;
155 
156 			while ( scene.parent !== undefined ) {
157 
158 				scene = scene.parent;
159 
160 			}
161 
162 			if ( scene !== undefined && scene instanceof THREE.Scene )  {
163 
164 				scene.__addObject( object );
165 
166 			}
167 
168 		}
169 
170 	},
171 
172 	remove: function ( object ) {
173 
174 		var index = this.children.indexOf( object );
175 
176 		if ( index !== - 1 ) {
177 
178 			object.parent = undefined;
179 			this.children.splice( index, 1 );
180 
181 			// remove from scene
182 
183 			var scene = this;
184 
185 			while ( scene.parent !== undefined ) {
186 
187 				scene = scene.parent;
188 
189 			}
190 
191 			if ( scene !== undefined && scene instanceof THREE.Scene ) {
192 
193 				scene.__removeObject( object );
194 
195 			}
196 
197 		}
198 
199 	},
200 
201 	traverse: function ( callback ) {
202 
203 		callback( this );
204 
205 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
206 
207 			this.children[ i ].traverse( callback );
208 
209 		}
210 
211 	},
212 
213 	getChildByName: function ( name, recursive ) {
214 
215 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
216 
217 			var child = this.children[ i ];
218 
219 			if ( child.name === name ) {
220 
221 				return child;
222 
223 			}
224 
225 			if ( recursive === true ) {
226 
227 				child = child.getChildByName( name, recursive );
228 
229 				if ( child !== undefined ) {
230 
231 					return child;
232 
233 				}
234 
235 			}
236 
237 		}
238 
239 		return undefined;
240 
241 	},
242 
243 	getDescendants: function ( array ) {
244 
245 		if ( array === undefined ) array = [];
246 
247 		Array.prototype.push.apply( array, this.children );
248 
249 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
250 
251 			this.children[ i ].getDescendants( array );
252 
253 		}
254 
255 		return array;
256 
257 	},
258 
259 	updateMatrix: function () {
260 
261 		this.matrix.setPosition( this.position );
262 
263 		if ( this.useQuaternion === false )  {
264 
265 			this.matrix.setRotationFromEuler( this.rotation, this.eulerOrder );
266 
267 		} else {
268 
269 			this.matrix.setRotationFromQuaternion( this.quaternion );
270 
271 		}
272 
273 		if ( this.scale.x !== 1 || this.scale.y !== 1 || this.scale.z !== 1 ) {
274 
275 			this.matrix.scale( this.scale );
276 			this.boundRadiusScale = Math.max( this.scale.x, Math.max( this.scale.y, this.scale.z ) );
277 
278 		}
279 
280 		this.matrixWorldNeedsUpdate = true;
281 
282 	},
283 
284 	updateMatrixWorld: function ( force ) {
285 
286 		if ( this.matrixAutoUpdate === true ) this.updateMatrix();
287 
288 		if ( this.matrixWorldNeedsUpdate === true || force === true ) {
289 
290 			if ( this.parent === undefined ) {
291 
292 				this.matrixWorld.copy( this.matrix );
293 
294 			} else {
295 
296 				this.matrixWorld.multiply( this.parent.matrixWorld, this.matrix );
297 
298 			}
299 
300 			this.matrixWorldNeedsUpdate = false;
301 
302 			force = true;
303 
304 		}
305 
306 		// update children
307 
308 		for ( var i = 0, l = this.children.length; i < l; i ++ ) {
309 
310 			this.children[ i ].updateMatrixWorld( force );
311 
312 		}
313 
314 	},
315 
316 	clone: function ( object ) {
317 
318 		if ( object === undefined ) object = new THREE.Object3D();
319 
320 		object.name = this.name;
321 
322 		object.up.copy( this.up );
323 
324 		object.position.copy( this.position );
325 		if ( object.rotation instanceof THREE.Vector3 ) object.rotation.copy( this.rotation ); // because of Sprite madness
326 		object.eulerOrder = this.eulerOrder;
327 		object.scale.copy( this.scale );
328 
329 		object.renderDepth = this.renderDepth;
330 
331 		object.rotationAutoUpdate = this.rotationAutoUpdate;
332 
333 		object.matrix.copy( this.matrix );
334 		object.matrixWorld.copy( this.matrixWorld );
335 		object.matrixRotationWorld.copy( this.matrixRotationWorld );
336 
337 		object.matrixAutoUpdate = this.matrixAutoUpdate;
338 		object.matrixWorldNeedsUpdate = this.matrixWorldNeedsUpdate;
339 
340 		object.quaternion.copy( this.quaternion );
341 		object.useQuaternion = this.useQuaternion;
342 
343 		object.boundRadius = this.boundRadius;
344 		object.boundRadiusScale = this.boundRadiusScale;
345 
346 		object.visible = this.visible;
347 
348 		object.castShadow = this.castShadow;
349 		object.receiveShadow = this.receiveShadow;
350 
351 		object.frustumCulled = this.frustumCulled;
352 
353 		for ( var i = 0; i < this.children.length; i ++ ) {
354 
355 			var child = this.children[ i ];
356 			object.add( child.clone() );
357 
358 		}
359 
360 		return object;
361 
362 	},
363 
364 	deallocate: function () {
365 
366 		var index = THREE.Object3DLibrary.indexOf( this );
367 		if ( index !== -1 ) THREE.Object3DLibrary.splice( index, 1 );
368 
369 	}
370 
371 };
372 
373 THREE.Object3D.__m1 = new THREE.Matrix4();
374 THREE.Object3D.defaultEulerOrder = 'XYZ',
375 
376 /**@fieldOf THREE
377 @field
378 @name Object3DIdCount*/
379 THREE.Object3DIdCount = 0;
380 /**@fieldOf THREE
381 @field
382 @name Object3DLibrary*/
383 THREE.Object3DLibrary = [];
384 

nike free rn new balance hombre baratas cinturones gucci ugg rebajas cinturon gucci ray ban baratas nike cortez peuterey mujer christian louboutin madrid mbt zapatos gafas ray ban baratas mbt ofertas air max blancas mbt barcelona nike air max 90 woolrich barcelona nike mujer botas ugg gafas de sol carrera aratas air max 2016 baratas oakley baratas nike air max 2016

mbt skor nike sverige louboutin skor hollister sverige polo ralph lauren skjorta woolrich jacka dam canada goose jacka woolrich jacka ray ban rea canada goose rea michael kors rea new balance skor ralph lauren skjorta new balance rea uggs sverige lacoste rea christian louboutin skor moncler jacka nike shox barbour jacka uggs rea