Browse Source

Updated builds.

Mr.doob 12 years ago
parent
commit
36b82b0535
2 changed files with 688 additions and 697 deletions
  1. 658 666
      build/three.js
  2. 30 31
      build/three.min.js

+ 658 - 666
build/three.js

@@ -10537,12 +10537,14 @@ THREE.JSONLoader.prototype.parse = function ( json, texturePath ) {
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
  */
  */
 
 
-THREE.LoadingManager = function ( onItemLoad ) {
+THREE.LoadingManager = function () {
 
 
 	var scope = this;
 	var scope = this;
 
 
 	var loaded = 0, total = 0;
 	var loaded = 0, total = 0;
 
 
+	this.onItemLoad = function () {};
+
 	this.itemStart = function ( url ) {
 	this.itemStart = function ( url ) {
 
 
 		total ++;
 		total ++;
@@ -10553,11 +10555,7 @@ THREE.LoadingManager = function ( onItemLoad ) {
 
 
 		loaded ++;
 		loaded ++;
 
 
-		if ( onItemLoad !== undefined ) {
-
-			onItemLoad( url, loaded, total );
-
-		}
+		scope.onItemLoad( url, loaded, total );
 
 
 	};
 	};
 
 
@@ -10742,7 +10740,7 @@ THREE.ObjectLoader.prototype = {
 
 
 		var scope = this;
 		var scope = this;
 
 
-		var loader = new THREE.XHRLoader();
+		var loader = new THREE.XHRLoader( scope.manager );
 		loader.setCrossOrigin( this.crossOrigin );
 		loader.setCrossOrigin( this.crossOrigin );
 		loader.load( url, function ( text ) {
 		loader.load( url, function ( text ) {
 
 
@@ -11030,505 +11028,499 @@ THREE.SceneLoader = function () {
 	this.callbackSync = function () {};
 	this.callbackSync = function () {};
 	this.callbackProgress = function () {};
 	this.callbackProgress = function () {};
 
 
-	this.geometryHandlerMap = {};
-	this.hierarchyHandlerMap = {};
+	this.geometryHandlers = {};
+	this.hierarchyHandlers = {};
 
 
 	this.addGeometryHandler( "ascii", THREE.JSONLoader );
 	this.addGeometryHandler( "ascii", THREE.JSONLoader );
 
 
 };
 };
 
 
-THREE.SceneLoader.prototype.constructor = THREE.SceneLoader;
-
-THREE.SceneLoader.prototype.load = function ( url, callbackFinished ) {
+THREE.SceneLoader.prototype = {
 
 
-	var scope = this;
-
-	var xhr = new XMLHttpRequest();
+	constructor: THREE.SceneLoader,
 
 
-	xhr.onreadystatechange = function () {
+	load: function ( url, onLoad, onProgress, onError ) {
 
 
-		if ( xhr.readyState === 4 ) {
+		var scope = this;
 
 
-			if ( xhr.status === 200 || xhr.status === 0 ) {
+		var loader = new THREE.XHRLoader( scope.manager );
+		loader.setCrossOrigin( this.crossOrigin );
+		loader.load( url, function ( text ) {
 
 
-				var json = JSON.parse( xhr.responseText );
-				scope.parse( json, callbackFinished, url );
+			scope.parse( JSON.parse( text ), onLoad, url );
 
 
-			} else {
+		} );
 
 
-				console.error( "THREE.SceneLoader: Couldn't load [" + url + "] [" + xhr.status + "]" );
+	},
 
 
-			}
+	setCrossOrigin: function ( value ) {
 
 
-		}
+		this.crossOrigin = value;
 
 
-	};
+	},
 
 
-	xhr.open( "GET", url, true );
-	xhr.send( null );
+	addGeometryHandler: function ( typeID, loaderClass ) {
 
 
-};
+		this.geometryHandlers[ typeID ] = { "loaderClass": loaderClass };
 
 
-THREE.SceneLoader.prototype.addGeometryHandler = function ( typeID, loaderClass ) {
+	},
 
 
-	this.geometryHandlerMap[ typeID ] = { "loaderClass": loaderClass };
+	addHierarchyHandler: function ( typeID, loaderClass ) {
 
 
-};
+		this.hierarchyHandlers[ typeID ] = { "loaderClass": loaderClass };
 
 
-THREE.SceneLoader.prototype.addHierarchyHandler = function ( typeID, loaderClass ) {
+	},
 
 
-	this.hierarchyHandlerMap[ typeID ] = { "loaderClass": loaderClass };
+	parse: function ( json, callbackFinished, url ) {
 
 
-};
+		var scope = this;
 
 
-THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
+		var urlBase = THREE.Loader.prototype.extractUrlBase( url );
 
 
-	var scope = this;
+		var geometry, material, camera, fog,
+			texture, images, color,
+			light, hex, intensity,
+			counter_models, counter_textures,
+			total_models, total_textures,
+			result;
 
 
-	var urlBase = THREE.Loader.prototype.extractUrlBase( url );
+		var target_array = [];
 
 
-	var geometry, material, camera, fog,
-		texture, images, color,
-		light, hex, intensity,
-		counter_models, counter_textures,
-		total_models, total_textures,
-		result;
+		var data = json;
 
 
-	var target_array = [];
+		// async geometry loaders
 
 
-	var data = json;
+		for ( var typeID in this.geometryHandlers ) {
 
 
-	// async geometry loaders
+			var loaderClass = this.geometryHandlers[ typeID ][ "loaderClass" ];
+			this.geometryHandlers[ typeID ][ "loaderObject" ] = new loaderClass();
 
 
-	for ( var typeID in this.geometryHandlerMap ) {
+		}
 
 
-		var loaderClass = this.geometryHandlerMap[ typeID ][ "loaderClass" ];
-		this.geometryHandlerMap[ typeID ][ "loaderObject" ] = new loaderClass();
+		// async hierachy loaders
 
 
-	}
+		for ( var typeID in this.hierarchyHandlers ) {
 
 
-	// async hierachy loaders
+			var loaderClass = this.hierarchyHandlers[ typeID ][ "loaderClass" ];
+			this.hierarchyHandlers[ typeID ][ "loaderObject" ] = new loaderClass();
 
 
-	for ( var typeID in this.hierarchyHandlerMap ) {
+		}
 
 
-		var loaderClass = this.hierarchyHandlerMap[ typeID ][ "loaderClass" ];
-		this.hierarchyHandlerMap[ typeID ][ "loaderObject" ] = new loaderClass();
+		counter_models = 0;
+		counter_textures = 0;
 
 
-	}
+		result = {
 
 
-	counter_models = 0;
-	counter_textures = 0;
+			scene: new THREE.Scene(),
+			geometries: {},
+			face_materials: {},
+			materials: {},
+			textures: {},
+			objects: {},
+			cameras: {},
+			lights: {},
+			fogs: {},
+			empties: {},
+			groups: {}
 
 
-	result = {
+		};
 
 
-		scene: new THREE.Scene(),
-		geometries: {},
-		face_materials: {},
-		materials: {},
-		textures: {},
-		objects: {},
-		cameras: {},
-		lights: {},
-		fogs: {},
-		empties: {},
-		groups: {}
+		if ( data.transform ) {
 
 
-	};
+			var position = data.transform.position,
+				rotation = data.transform.rotation,
+				scale = data.transform.scale;
 
 
-	if ( data.transform ) {
+			if ( position ) {
 
 
-		var position = data.transform.position,
-			rotation = data.transform.rotation,
-			scale = data.transform.scale;
+				result.scene.position.fromArray( position );
 
 
-		if ( position ) {
+			}
 
 
-			result.scene.position.fromArray( position );
+			if ( rotation ) {
 
 
-		}
+				result.scene.rotation.fromArray( rotation );
 
 
-		if ( rotation ) {
+			}
 
 
-			result.scene.rotation.fromArray( rotation );
+			if ( scale ) {
 
 
-		}
+				result.scene.scale.fromArray( scale );
 
 
-		if ( scale ) {
-
-			result.scene.scale.fromArray( scale );
+			}
 
 
-		}
+			if ( position || rotation || scale ) {
 
 
-		if ( position || rotation || scale ) {
+				result.scene.updateMatrix();
+				result.scene.updateMatrixWorld();
 
 
-			result.scene.updateMatrix();
-			result.scene.updateMatrixWorld();
+			}
 
 
 		}
 		}
 
 
-	}
+		function get_url( source_url, url_type ) {
 
 
-	function get_url( source_url, url_type ) {
+			if ( url_type == "relativeToHTML" ) {
 
 
-		if ( url_type == "relativeToHTML" ) {
+				return source_url;
 
 
-			return source_url;
+			} else {
 
 
-		} else {
+				return urlBase + "/" + source_url;
 
 
-			return urlBase + "/" + source_url;
+			}
 
 
-		}
+		};
 
 
-	};
+		// toplevel loader function, delegates to handle_children
 
 
-	// toplevel loader function, delegates to handle_children
+		function handle_objects() {
 
 
-	function handle_objects() {
+			handle_children( result.scene, data.objects );
 
 
-		handle_children( result.scene, data.objects );
+		}
 
 
-	}
+		// handle all the children from the loaded json and attach them to given parent
 
 
-	// handle all the children from the loaded json and attach them to given parent
+		function handle_children( parent, children ) {
 
 
-	function handle_children( parent, children ) {
+			var mat, dst, pos, rot, scl, quat;
 
 
-		var mat, dst, pos, rot, scl, quat;
+			for ( var objID in children ) {
 
 
-		for ( var objID in children ) {
+				// check by id if child has already been handled,
+				// if not, create new object
 
 
-			// check by id if child has already been handled,
-			// if not, create new object
+				var object = result.objects[ objID ];
+				var objJSON = children[ objID ];
 
 
-			var object = result.objects[ objID ];
-			var objJSON = children[ objID ];
+				if ( object === undefined ) {
 
 
-			if ( object === undefined ) {
+					// meshes
 
 
-				// meshes
+					if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) {
 
 
-				if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlerMap ) ) {
+						if ( objJSON.loading === undefined ) {
 
 
-					if ( objJSON.loading === undefined ) {
+							var reservedTypes = {
+								"type": 1, "url": 1, "material": 1,
+								"position": 1, "rotation": 1, "scale" : 1,
+								"visible": 1, "children": 1, "userData": 1,
+								"skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1
+							};
 
 
-						var reservedTypes = {
-							"type": 1, "url": 1, "material": 1,
-							"position": 1, "rotation": 1, "scale" : 1,
-							"visible": 1, "children": 1, "userData": 1,
-							"skin": 1, "morph": 1, "mirroredLoop": 1, "duration": 1
-						};
+							var loaderParameters = {};
 
 
-						var loaderParameters = {};
+							for ( var parType in objJSON ) {
 
 
-						for ( var parType in objJSON ) {
+								if ( ! ( parType in reservedTypes ) ) {
 
 
-							if ( ! ( parType in reservedTypes ) ) {
+									loaderParameters[ parType ] = objJSON[ parType ];
 
 
-								loaderParameters[ parType ] = objJSON[ parType ];
+								}
 
 
 							}
 							}
 
 
-						}
+							material = result.materials[ objJSON.material ];
 
 
-						material = result.materials[ objJSON.material ];
+							objJSON.loading = true;
 
 
-						objJSON.loading = true;
+							var loader = scope.hierarchyHandlers[ objJSON.type ][ "loaderObject" ];
 
 
-						var loader = scope.hierarchyHandlerMap[ objJSON.type ][ "loaderObject" ];
+							// ColladaLoader
 
 
-						// ColladaLoader
+							if ( loader.options ) {
 
 
-						if ( loader.options ) {
+								loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) );
 
 
-							loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) );
+							// UTF8Loader
+							// OBJLoader
 
 
-						// UTF8Loader
-						// OBJLoader
+							} else {
 
 
-						} else {
+								loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ), loaderParameters );
 
 
-							loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ), loaderParameters );
+							}
 
 
 						}
 						}
 
 
-					}
+					} else if ( objJSON.geometry !== undefined ) {
 
 
-				} else if ( objJSON.geometry !== undefined ) {
+						geometry = result.geometries[ objJSON.geometry ];
 
 
-					geometry = result.geometries[ objJSON.geometry ];
+						// geometry already loaded
 
 
-					// geometry already loaded
+						if ( geometry ) {
 
 
-					if ( geometry ) {
+							var needsTangents = false;
 
 
-						var needsTangents = false;
+							material = result.materials[ objJSON.material ];
+							needsTangents = material instanceof THREE.ShaderMaterial;
 
 
-						material = result.materials[ objJSON.material ];
-						needsTangents = material instanceof THREE.ShaderMaterial;
+							pos = objJSON.position;
+							rot = objJSON.rotation;
+							scl = objJSON.scale;
+							mat = objJSON.matrix;
+							quat = objJSON.quaternion;
 
 
-						pos = objJSON.position;
-						rot = objJSON.rotation;
-						scl = objJSON.scale;
-						mat = objJSON.matrix;
-						quat = objJSON.quaternion;
+							// use materials from the model file
+							// if there is no material specified in the object
 
 
-						// use materials from the model file
-						// if there is no material specified in the object
+							if ( ! objJSON.material ) {
 
 
-						if ( ! objJSON.material ) {
+								material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] );
 
 
-							material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] );
+							}
 
 
-						}
+							// use materials from the model file
+							// if there is just empty face material
+							// (must create new material as each model has its own face material)
 
 
-						// use materials from the model file
-						// if there is just empty face material
-						// (must create new material as each model has its own face material)
+							if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) {
 
 
-						if ( ( material instanceof THREE.MeshFaceMaterial ) && material.materials.length === 0 ) {
+								material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] );
 
 
-							material = new THREE.MeshFaceMaterial( result.face_materials[ objJSON.geometry ] );
+							}
 
 
-						}
+							if ( material instanceof THREE.MeshFaceMaterial ) {
 
 
-						if ( material instanceof THREE.MeshFaceMaterial ) {
+								for ( var i = 0; i < material.materials.length; i ++ ) {
 
 
-							for ( var i = 0; i < material.materials.length; i ++ ) {
+									needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial );
 
 
-								needsTangents = needsTangents || ( material.materials[ i ] instanceof THREE.ShaderMaterial );
+								}
 
 
 							}
 							}
 
 
-						}
+							if ( needsTangents ) {
 
 
-						if ( needsTangents ) {
+								geometry.computeTangents();
 
 
-							geometry.computeTangents();
+							}
 
 
-						}
+							if ( objJSON.skin ) {
 
 
-						if ( objJSON.skin ) {
+								object = new THREE.SkinnedMesh( geometry, material );
 
 
-							object = new THREE.SkinnedMesh( geometry, material );
+							} else if ( objJSON.morph ) {
 
 
-						} else if ( objJSON.morph ) {
+								object = new THREE.MorphAnimMesh( geometry, material );
 
 
-							object = new THREE.MorphAnimMesh( geometry, material );
+								if ( objJSON.duration !== undefined ) {
 
 
-							if ( objJSON.duration !== undefined ) {
+									object.duration = objJSON.duration;
 
 
-								object.duration = objJSON.duration;
+								}
 
 
-							}
+								if ( objJSON.time !== undefined ) {
+
+									object.time = objJSON.time;
 
 
-							if ( objJSON.time !== undefined ) {
+								}
 
 
-								object.time = objJSON.time;
+								if ( objJSON.mirroredLoop !== undefined ) {
 
 
-							}
+									object.mirroredLoop = objJSON.mirroredLoop;
 
 
-							if ( objJSON.mirroredLoop !== undefined ) {
+								}
 
 
-								object.mirroredLoop = objJSON.mirroredLoop;
+								if ( material.morphNormals ) {
 
 
-							}
+									geometry.computeMorphNormals();
 
 
-							if ( material.morphNormals ) {
+								}
+
+							} else {
 
 
-								geometry.computeMorphNormals();
+								object = new THREE.Mesh( geometry, material );
 
 
 							}
 							}
 
 
-						} else {
+							object.name = objID;
 
 
-							object = new THREE.Mesh( geometry, material );
+							if ( mat ) {
 
 
-						}
+								object.matrixAutoUpdate = false;
+								object.matrix.set(
+									mat[0],  mat[1],  mat[2],  mat[3],
+									mat[4],  mat[5],  mat[6],  mat[7],
+									mat[8],  mat[9],  mat[10], mat[11],
+									mat[12], mat[13], mat[14], mat[15]
+								);
 
 
-						object.name = objID;
+							} else {
 
 
-						if ( mat ) {
+								object.position.fromArray( pos );
 
 
-							object.matrixAutoUpdate = false;
-							object.matrix.set(
-								mat[0],  mat[1],  mat[2],  mat[3],
-								mat[4],  mat[5],  mat[6],  mat[7],
-								mat[8],  mat[9],  mat[10], mat[11],
-								mat[12], mat[13], mat[14], mat[15]
-							);
+								if ( quat ) {
 
 
-						} else {
+									object.quaternion.fromArray( quat );
+									object.useQuaternion = true;
 
 
-							object.position.fromArray( pos );
+								} else {
 
 
-							if ( quat ) {
+									object.rotation.fromArray( rot );
 
 
-								object.quaternion.fromArray( quat );
-								object.useQuaternion = true;
-
-							} else {
+								}
 
 
-								object.rotation.fromArray( rot );
+								object.scale.fromArray( scl );
 
 
 							}
 							}
 
 
-							object.scale.fromArray( scl );
+							object.visible = objJSON.visible;
+							object.castShadow = objJSON.castShadow;
+							object.receiveShadow = objJSON.receiveShadow;
 
 
-						}
+							parent.add( object );
 
 
-						object.visible = objJSON.visible;
-						object.castShadow = objJSON.castShadow;
-						object.receiveShadow = objJSON.receiveShadow;
+							result.objects[ objID ] = object;
 
 
-						parent.add( object );
-
-						result.objects[ objID ] = object;
+						}
 
 
-					}
+					// lights
 
 
-				// lights
+					} else if ( objJSON.type === "DirectionalLight" || objJSON.type === "PointLight" || objJSON.type === "AmbientLight" ) {
 
 
-				} else if ( objJSON.type === "DirectionalLight" || objJSON.type === "PointLight" || objJSON.type === "AmbientLight" ) {
+						hex = ( objJSON.color !== undefined ) ? objJSON.color : 0xffffff;
+						intensity = ( objJSON.intensity !== undefined ) ? objJSON.intensity : 1;
 
 
-					hex = ( objJSON.color !== undefined ) ? objJSON.color : 0xffffff;
-					intensity = ( objJSON.intensity !== undefined ) ? objJSON.intensity : 1;
+						if ( objJSON.type === "DirectionalLight" ) {
 
 
-					if ( objJSON.type === "DirectionalLight" ) {
+							pos = objJSON.direction;
 
 
-						pos = objJSON.direction;
+							light = new THREE.DirectionalLight( hex, intensity );
+							light.position.fromArray( pos );
 
 
-						light = new THREE.DirectionalLight( hex, intensity );
-						light.position.fromArray( pos );
+							if ( objJSON.target ) {
 
 
-						if ( objJSON.target ) {
+								target_array.push( { "object": light, "targetName" : objJSON.target } );
 
 
-							target_array.push( { "object": light, "targetName" : objJSON.target } );
+								// kill existing default target
+								// otherwise it gets added to scene when parent gets added
 
 
-							// kill existing default target
-							// otherwise it gets added to scene when parent gets added
+								light.target = null;
 
 
-							light.target = null;
+							}
 
 
-						}
+						} else if ( objJSON.type === "PointLight" ) {
 
 
-					} else if ( objJSON.type === "PointLight" ) {
+							pos = objJSON.position;
+							dst = objJSON.distance;
 
 
-						pos = objJSON.position;
-						dst = objJSON.distance;
+							light = new THREE.PointLight( hex, intensity, dst );
+							light.position.fromArray( pos );
 
 
-						light = new THREE.PointLight( hex, intensity, dst );
-						light.position.fromArray( pos );
+						} else if ( objJSON.type === "AmbientLight" ) {
 
 
-					} else if ( objJSON.type === "AmbientLight" ) {
+							light = new THREE.AmbientLight( hex );
 
 
-						light = new THREE.AmbientLight( hex );
+						}
 
 
-					}
+						parent.add( light );
 
 
-					parent.add( light );
+						light.name = objID;
+						result.lights[ objID ] = light;
+						result.objects[ objID ] = light;
 
 
-					light.name = objID;
-					result.lights[ objID ] = light;
-					result.objects[ objID ] = light;
+					// cameras
 
 
-				// cameras
+					} else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) {
 
 
-				} else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) {
+						pos = objJSON.position;
+						rot = objJSON.rotation;
+						quat = objJSON.quaternion;
 
 
-					pos = objJSON.position;
-					rot = objJSON.rotation;
-					quat = objJSON.quaternion;
+						if ( objJSON.type === "PerspectiveCamera" ) {
 
 
-					if ( objJSON.type === "PerspectiveCamera" ) {
+							camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far );
 
 
-						camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far );
+						} else if ( objJSON.type === "OrthographicCamera" ) {
 
 
-					} else if ( objJSON.type === "OrthographicCamera" ) {
+							camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far );
 
 
-						camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far );
+						}
 
 
-					}
+						camera.name = objID;
+						camera.position.fromArray( pos );
 
 
-					camera.name = objID;
-					camera.position.fromArray( pos );
+						if ( quat !== undefined ) {
 
 
-					if ( quat !== undefined ) {
+							camera.quaternion.fromArray( quat );
+							camera.useQuaternion = true;
 
 
-						camera.quaternion.fromArray( quat );
-						camera.useQuaternion = true;
+						} else if ( rot !== undefined ) {
 
 
-					} else if ( rot !== undefined ) {
+							camera.rotation.fromArray( rot );
 
 
-						camera.rotation.fromArray( rot );
+						}
 
 
-					}
+						parent.add( camera );
 
 
-					parent.add( camera );
+						result.cameras[ objID ] = camera;
+						result.objects[ objID ] = camera;
 
 
-					result.cameras[ objID ] = camera;
-					result.objects[ objID ] = camera;
+					// pure Object3D
 
 
-				// pure Object3D
+					} else {
 
 
-				} else {
+						pos = objJSON.position;
+						rot = objJSON.rotation;
+						scl = objJSON.scale;
+						quat = objJSON.quaternion;
 
 
-					pos = objJSON.position;
-					rot = objJSON.rotation;
-					scl = objJSON.scale;
-					quat = objJSON.quaternion;
+						object = new THREE.Object3D();
+						object.name = objID;
+						object.position.fromArray( pos );
 
 
-					object = new THREE.Object3D();
-					object.name = objID;
-					object.position.fromArray( pos );
+						if ( quat ) {
 
 
-					if ( quat ) {
+							object.quaternion.fromArray( quat );
+							object.useQuaternion = true;
 
 
-						object.quaternion.fromArray( quat );
-						object.useQuaternion = true;
+						} else {
 
 
-					} else {
+							object.rotation.fromArray( rot );
 
 
-						object.rotation.fromArray( rot );
+						}
 
 
-					}
+						object.scale.fromArray( scl );
+						object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false;
 
 
-					object.scale.fromArray( scl );
-					object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false;
+						parent.add( object );
 
 
-					parent.add( object );
+						result.objects[ objID ] = object;
+						result.empties[ objID ] = object;
 
 
-					result.objects[ objID ] = object;
-					result.empties[ objID ] = object;
+					}
 
 
-				}
+					if ( object ) {
 
 
-				if ( object ) {
+						if ( objJSON.userData !== undefined ) {
 
 
-					if ( objJSON.userData !== undefined ) {
+							for ( var key in objJSON.userData ) {
 
 
-						for ( var key in objJSON.userData ) {
+								var value = objJSON.userData[ key ];
+								object.userData[ key ] = value;
 
 
-							var value = objJSON.userData[ key ];
-							object.userData[ key ] = value;
+							}
 
 
 						}
 						}
 
 
-					}
+						if ( objJSON.groups !== undefined ) {
 
 
-					if ( objJSON.groups !== undefined ) {
+							for ( var i = 0; i < objJSON.groups.length; i ++ ) {
 
 
-						for ( var i = 0; i < objJSON.groups.length; i ++ ) {
+								var groupID = objJSON.groups[ i ];
 
 
-							var groupID = objJSON.groups[ i ];
+								if ( result.groups[ groupID ] === undefined ) {
 
 
-							if ( result.groups[ groupID ] === undefined ) {
+									result.groups[ groupID ] = [];
 
 
-								result.groups[ groupID ] = [];
+								}
 
 
-							}
+								result.groups[ groupID ].push( objID );
 
 
-							result.groups[ groupID ].push( objID );
+							}
 
 
 						}
 						}
 
 
@@ -11536,723 +11528,723 @@ THREE.SceneLoader.prototype.parse = function ( json, callbackFinished, url ) {
 
 
 				}
 				}
 
 
-			}
+				if ( object !== undefined && objJSON.children !== undefined ) {
 
 
-			if ( object !== undefined && objJSON.children !== undefined ) {
+					handle_children( object, objJSON.children );
 
 
-				handle_children( object, objJSON.children );
+				}
 
 
 			}
 			}
 
 
-		}
+		};
 
 
-	};
+		function handle_mesh( geo, mat, id ) {
 
 
-	function handle_mesh( geo, mat, id ) {
+			result.geometries[ id ] = geo;
+			result.face_materials[ id ] = mat;
+			handle_objects();
 
 
-		result.geometries[ id ] = geo;
-		result.face_materials[ id ] = mat;
-		handle_objects();
+		};
 
 
-	};
+		function handle_hierarchy( node, id, parent, material, obj ) {
 
 
-	function handle_hierarchy( node, id, parent, material, obj ) {
+			var p = obj.position;
+			var r = obj.rotation;
+			var q = obj.quaternion;
+			var s = obj.scale;
 
 
-		var p = obj.position;
-		var r = obj.rotation;
-		var q = obj.quaternion;
-		var s = obj.scale;
+			node.position.fromArray( p );
 
 
-		node.position.fromArray( p );
+			if ( q ) {
 
 
-		if ( q ) {
+				node.quaternion.fromArray( q );
+				node.useQuaternion = true;
 
 
-			node.quaternion.fromArray( q );
-			node.useQuaternion = true;
+			} else {
 
 
-		} else {
+				node.rotation.fromArray( r );
 
 
-			node.rotation.fromArray( r );
+			}
 
 
-		}
+			node.scale.fromArray( s );
 
 
-		node.scale.fromArray( s );
+			// override children materials
+			// if object material was specified in JSON explicitly
 
 
-		// override children materials
-		// if object material was specified in JSON explicitly
+			if ( material ) {
 
 
-		if ( material ) {
+				node.traverse( function ( child ) {
 
 
-			node.traverse( function ( child ) {
+					child.material = material;
 
 
-				child.material = material;
+				} );
 
 
-			} );
+			}
 
 
-		}
+			// override children visibility
+			// with root node visibility as specified in JSON
 
 
-		// override children visibility
-		// with root node visibility as specified in JSON
+			var visible = ( obj.visible !== undefined ) ? obj.visible : true;
 
 
-		var visible = ( obj.visible !== undefined ) ? obj.visible : true;
+			node.traverse( function ( child ) {
 
 
-		node.traverse( function ( child ) {
+				child.visible = visible;
 
 
-			child.visible = visible;
+			} );
 
 
-		} );
+			parent.add( node );
 
 
-		parent.add( node );
+			node.name = id;
 
 
-		node.name = id;
+			result.objects[ id ] = node;
+			handle_objects();
 
 
-		result.objects[ id ] = node;
-		handle_objects();
+		};
 
 
-	};
+		function create_callback_geometry( id ) {
 
 
-	function create_callback_geometry( id ) {
+			return function ( geo, mat ) {
 
 
-		return function ( geo, mat ) {
+				geo.name = id;
 
 
-			geo.name = id;
+				handle_mesh( geo, mat, id );
 
 
-			handle_mesh( geo, mat, id );
+				counter_models -= 1;
 
 
-			counter_models -= 1;
+				scope.onLoadComplete();
 
 
-			scope.onLoadComplete();
+				async_callback_gate();
 
 
-			async_callback_gate();
+			}
 
 
-		}
+		};
 
 
-	};
+		function create_callback_hierachy( id, parent, material, obj ) {
 
 
-	function create_callback_hierachy( id, parent, material, obj ) {
+			return function ( event ) {
 
 
-		return function ( event ) {
+				var result;
 
 
-			var result;
+				// loaders which use EventDispatcher
 
 
-			// loaders which use EventDispatcher
+				if ( event.content ) {
 
 
-			if ( event.content ) {
+					result = event.content;
 
 
-				result = event.content;
+				// ColladaLoader
 
 
-			// ColladaLoader
+				} else if ( event.dae ) {
 
 
-			} else if ( event.dae ) {
+					result = event.scene;
 
 
-				result = event.scene;
 
 
+				// UTF8Loader
 
 
-			// UTF8Loader
+				} else {
 
 
-			} else {
+					result = event;
 
 
-				result = event;
+				}
 
 
-			}
+				handle_hierarchy( result, id, parent, material, obj );
 
 
-			handle_hierarchy( result, id, parent, material, obj );
+				counter_models -= 1;
 
 
-			counter_models -= 1;
+				scope.onLoadComplete();
 
 
-			scope.onLoadComplete();
+				async_callback_gate();
 
 
-			async_callback_gate();
+			}
 
 
-		}
+		};
 
 
-	};
+		function create_callback_embed( id ) {
 
 
-	function create_callback_embed( id ) {
+			return function ( geo, mat ) {
 
 
-		return function ( geo, mat ) {
+				geo.name = id;
 
 
-			geo.name = id;
+				result.geometries[ id ] = geo;
+				result.face_materials[ id ] = mat;
 
 
-			result.geometries[ id ] = geo;
-			result.face_materials[ id ] = mat;
+			}
 
 
-		}
+		};
 
 
-	};
+		function async_callback_gate() {
+
+			var progress = {
 
 
-	function async_callback_gate() {
+				totalModels : total_models,
+				totalTextures : total_textures,
+				loadedModels : total_models - counter_models,
+				loadedTextures : total_textures - counter_textures
 
 
-		var progress = {
+			};
 
 
-			totalModels : total_models,
-			totalTextures : total_textures,
-			loadedModels : total_models - counter_models,
-			loadedTextures : total_textures - counter_textures
+			scope.callbackProgress( progress, result );
 
 
-		};
+			scope.onLoadProgress();
 
 
-		scope.callbackProgress( progress, result );
+			if ( counter_models === 0 && counter_textures === 0 ) {
 
 
-		scope.onLoadProgress();
+				finalize();
+				callbackFinished( result );
 
 
-		if ( counter_models === 0 && counter_textures === 0 ) {
+			}
 
 
-			finalize();
-			callbackFinished( result );
+		};
 
 
-		}
+		function finalize() {
 
 
-	};
+			// take care of targets which could be asynchronously loaded objects
 
 
-	function finalize() {
+			for ( var i = 0; i < target_array.length; i ++ ) {
 
 
-		// take care of targets which could be asynchronously loaded objects
+				var ta = target_array[ i ];
 
 
-		for ( var i = 0; i < target_array.length; i ++ ) {
+				var target = result.objects[ ta.targetName ];
 
 
-			var ta = target_array[ i ];
+				if ( target ) {
 
 
-			var target = result.objects[ ta.targetName ];
+					ta.object.target = target;
 
 
-			if ( target ) {
+				} else {
 
 
-				ta.object.target = target;
+					// if there was error and target of specified name doesn't exist in the scene file
+					// create instead dummy target
+					// (target must be added to scene explicitly as parent is already added)
 
 
-			} else {
+					ta.object.target = new THREE.Object3D();
+					result.scene.add( ta.object.target );
 
 
-				// if there was error and target of specified name doesn't exist in the scene file
-				// create instead dummy target
-				// (target must be added to scene explicitly as parent is already added)
+				}
 
 
-				ta.object.target = new THREE.Object3D();
-				result.scene.add( ta.object.target );
+				ta.object.target.userData.targetInverse = ta.object;
 
 
 			}
 			}
 
 
-			ta.object.target.userData.targetInverse = ta.object;
-
-		}
+		};
 
 
-	};
+		var callbackTexture = function ( count ) {
 
 
-	var callbackTexture = function ( count ) {
+			counter_textures -= count;
+			async_callback_gate();
 
 
-		counter_textures -= count;
-		async_callback_gate();
+			scope.onLoadComplete();
 
 
-		scope.onLoadComplete();
+		};
 
 
-	};
+		// must use this instead of just directly calling callbackTexture
+		// because of closure in the calling context loop
 
 
-	// must use this instead of just directly calling callbackTexture
-	// because of closure in the calling context loop
+		var generateTextureCallback = function ( count ) {
 
 
-	var generateTextureCallback = function ( count ) {
+			return function () {
 
 
-		return function () {
+				callbackTexture( count );
 
 
-			callbackTexture( count );
+			};
 
 
 		};
 		};
 
 
-	};
+		function traverse_json_hierarchy( objJSON, callback ) {
 
 
-	function traverse_json_hierarchy( objJSON, callback ) {
+			callback( objJSON );
 
 
-		callback( objJSON );
+			if ( objJSON.children !== undefined ) {
 
 
-		if ( objJSON.children !== undefined ) {
+				for ( var objChildID in objJSON.children ) {
 
 
-			for ( var objChildID in objJSON.children ) {
+					traverse_json_hierarchy( objJSON.children[ objChildID ], callback );
 
 
-				traverse_json_hierarchy( objJSON.children[ objChildID ], callback );
+				}
 
 
 			}
 			}
 
 
-		}
+		};
 
 
-	};
+		// first go synchronous elements
 
 
-	// first go synchronous elements
+		// fogs
 
 
-	// fogs
+		var fogID, fogJSON;
 
 
-	var fogID, fogJSON;
+		for ( fogID in data.fogs ) {
 
 
-	for ( fogID in data.fogs ) {
+			fogJSON = data.fogs[ fogID ];
 
 
-		fogJSON = data.fogs[ fogID ];
+			if ( fogJSON.type === "linear" ) {
 
 
-		if ( fogJSON.type === "linear" ) {
+				fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far );
 
 
-			fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far );
+			} else if ( fogJSON.type === "exp2" ) {
 
 
-		} else if ( fogJSON.type === "exp2" ) {
+				fog = new THREE.FogExp2( 0x000000, fogJSON.density );
 
 
-			fog = new THREE.FogExp2( 0x000000, fogJSON.density );
+			}
 
 
-		}
+			color = fogJSON.color;
+			fog.color.setRGB( color[0], color[1], color[2] );
 
 
-		color = fogJSON.color;
-		fog.color.setRGB( color[0], color[1], color[2] );
+			result.fogs[ fogID ] = fog;
 
 
-		result.fogs[ fogID ] = fog;
+		}
 
 
-	}
+		// now come potentially asynchronous elements
 
 
-	// now come potentially asynchronous elements
+		// geometries
 
 
-	// geometries
+		// count how many geometries will be loaded asynchronously
 
 
-	// count how many geometries will be loaded asynchronously
+		var geoID, geoJSON;
 
 
-	var geoID, geoJSON;
+		for ( geoID in data.geometries ) {
 
 
-	for ( geoID in data.geometries ) {
+			geoJSON = data.geometries[ geoID ];
 
 
-		geoJSON = data.geometries[ geoID ];
+			if ( geoJSON.type in this.geometryHandlers ) {
 
 
-		if ( geoJSON.type in this.geometryHandlerMap ) {
+				counter_models += 1;
 
 
-			counter_models += 1;
+				scope.onLoadStart();
 
 
-			scope.onLoadStart();
+			}
 
 
 		}
 		}
 
 
-	}
+		// count how many hierarchies will be loaded asynchronously
 
 
-	// count how many hierarchies will be loaded asynchronously
+		for ( var objID in data.objects ) {
 
 
-	for ( var objID in data.objects ) {
+			traverse_json_hierarchy( data.objects[ objID ], function ( objJSON ) {
 
 
-		traverse_json_hierarchy( data.objects[ objID ], function ( objJSON ) {
+				if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) {
 
 
-			if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlerMap ) ) {
+					counter_models += 1;
 
 
-				counter_models += 1;
+					scope.onLoadStart();
 
 
-				scope.onLoadStart();
+				}
 
 
-			}
+			});
 
 
-		});
+		}
 
 
-	}
+		total_models = counter_models;
 
 
-	total_models = counter_models;
+		for ( geoID in data.geometries ) {
 
 
-	for ( geoID in data.geometries ) {
+			geoJSON = data.geometries[ geoID ];
 
 
-		geoJSON = data.geometries[ geoID ];
+			if ( geoJSON.type === "cube" ) {
 
 
-		if ( geoJSON.type === "cube" ) {
+				geometry = new THREE.CubeGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.CubeGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type === "plane" ) {
 
 
-		} else if ( geoJSON.type === "plane" ) {
+				geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type === "sphere" ) {
 
 
-		} else if ( geoJSON.type === "sphere" ) {
+				geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type === "cylinder" ) {
 
 
-		} else if ( geoJSON.type === "cylinder" ) {
+				geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.CylinderGeometry( geoJSON.topRad, geoJSON.botRad, geoJSON.height, geoJSON.radSegs, geoJSON.heightSegs );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type === "torus" ) {
 
 
-		} else if ( geoJSON.type === "torus" ) {
+				geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type === "icosahedron" ) {
 
 
-		} else if ( geoJSON.type === "icosahedron" ) {
+				geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions );
+				geometry.name = geoID;
+				result.geometries[ geoID ] = geometry;
 
 
-			geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions );
-			geometry.name = geoID;
-			result.geometries[ geoID ] = geometry;
+			} else if ( geoJSON.type in this.geometryHandlers ) {
 
 
-		} else if ( geoJSON.type in this.geometryHandlerMap ) {
+				var loaderParameters = {};
 
 
-			var loaderParameters = {};
+				for ( var parType in geoJSON ) {
 
 
-			for ( var parType in geoJSON ) {
+					if ( parType !== "type" && parType !== "url" ) {
 
 
-				if ( parType !== "type" && parType !== "url" ) {
+						loaderParameters[ parType ] = geoJSON[ parType ];
 
 
-					loaderParameters[ parType ] = geoJSON[ parType ];
+					}
 
 
 				}
 				}
 
 
-			}
+				var loader = this.geometryHandlers[ geoJSON.type ][ "loaderObject" ];
+				loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ), loaderParameters );
 
 
-			var loader = this.geometryHandlerMap[ geoJSON.type ][ "loaderObject" ];
-			loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ), loaderParameters );
+			} else if ( geoJSON.type === "embedded" ) {
 
 
-		} else if ( geoJSON.type === "embedded" ) {
+				var modelJson = data.embeds[ geoJSON.id ],
+					texture_path = "";
 
 
-			var modelJson = data.embeds[ geoJSON.id ],
-				texture_path = "";
+				// pass metadata along to jsonLoader so it knows the format version
 
 
-			// pass metadata along to jsonLoader so it knows the format version
+				modelJson.metadata = data.metadata;
 
 
-			modelJson.metadata = data.metadata;
+				if ( modelJson ) {
 
 
-			if ( modelJson ) {
+					var jsonLoader = this.geometryHandlers[ "ascii" ][ "loaderObject" ];
+					var model = jsonLoader.parse( modelJson, texture_path );
+					create_callback_embed( geoID )( model.geometry, model.materials );
 
 
-				var jsonLoader = this.geometryHandlerMap[ "ascii" ][ "loaderObject" ];
-				var model = jsonLoader.parse( modelJson, texture_path );
-				create_callback_embed( geoID )( model.geometry, model.materials );
+				}
 
 
 			}
 			}
 
 
 		}
 		}
 
 
-	}
+		// textures
 
 
-	// textures
+		// count how many textures will be loaded asynchronously
 
 
-	// count how many textures will be loaded asynchronously
+		var textureID, textureJSON;
 
 
-	var textureID, textureJSON;
+		for ( textureID in data.textures ) {
 
 
-	for ( textureID in data.textures ) {
+			textureJSON = data.textures[ textureID ];
 
 
-		textureJSON = data.textures[ textureID ];
+			if ( textureJSON.url instanceof Array ) {
 
 
-		if ( textureJSON.url instanceof Array ) {
+				counter_textures += textureJSON.url.length;
 
 
-			counter_textures += textureJSON.url.length;
+				for( var n = 0; n < textureJSON.url.length; n ++ ) {
 
 
-			for( var n = 0; n < textureJSON.url.length; n ++ ) {
+					scope.onLoadStart();
 
 
-				scope.onLoadStart();
+				}
 
 
-			}
+			} else {
 
 
-		} else {
+				counter_textures += 1;
 
 
-			counter_textures += 1;
+				scope.onLoadStart();
 
 
-			scope.onLoadStart();
+			}
 
 
 		}
 		}
 
 
-	}
+		total_textures = counter_textures;
 
 
-	total_textures = counter_textures;
+		for ( textureID in data.textures ) {
 
 
-	for ( textureID in data.textures ) {
+			textureJSON = data.textures[ textureID ];
 
 
-		textureJSON = data.textures[ textureID ];
+			if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) {
 
 
-		if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) {
+				textureJSON.mapping = new THREE[ textureJSON.mapping ]();
 
 
-			textureJSON.mapping = new THREE[ textureJSON.mapping ]();
+			}
 
 
-		}
+			if ( textureJSON.url instanceof Array ) {
 
 
-		if ( textureJSON.url instanceof Array ) {
+				var count = textureJSON.url.length;
+				var url_array = [];
 
 
-			var count = textureJSON.url.length;
-			var url_array = [];
+				for( var i = 0; i < count; i ++ ) {
 
 
-			for( var i = 0; i < count; i ++ ) {
+					url_array[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType );
 
 
-				url_array[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType );
+				}
 
 
-			}
+				var isCompressed = /\.dds$/i.test( url_array[ 0 ] );
 
 
-			var isCompressed = /\.dds$/i.test( url_array[ 0 ] );
+				if ( isCompressed ) {
 
 
-			if ( isCompressed ) {
+					texture = THREE.ImageUtils.loadCompressedTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) );
 
 
-				texture = THREE.ImageUtils.loadCompressedTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) );
+				} else {
 
 
-			} else {
+					texture = THREE.ImageUtils.loadTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) );
 
 
-				texture = THREE.ImageUtils.loadTextureCube( url_array, textureJSON.mapping, generateTextureCallback( count ) );
+				}
 
 
-			}
+			} else {
 
 
-		} else {
+				var isCompressed = /\.dds$/i.test( textureJSON.url );
+				var fullUrl = get_url( textureJSON.url, data.urlBaseType );
+				var textureCallback = generateTextureCallback( 1 );
 
 
-			var isCompressed = /\.dds$/i.test( textureJSON.url );
-			var fullUrl = get_url( textureJSON.url, data.urlBaseType );
-			var textureCallback = generateTextureCallback( 1 );
+				if ( isCompressed ) {
 
 
-			if ( isCompressed ) {
+					texture = THREE.ImageUtils.loadCompressedTexture( fullUrl, textureJSON.mapping, textureCallback );
 
 
-				texture = THREE.ImageUtils.loadCompressedTexture( fullUrl, textureJSON.mapping, textureCallback );
+				} else {
 
 
-			} else {
+					texture = THREE.ImageUtils.loadTexture( fullUrl, textureJSON.mapping, textureCallback );
 
 
-				texture = THREE.ImageUtils.loadTexture( fullUrl, textureJSON.mapping, textureCallback );
+				}
 
 
-			}
+				if ( THREE[ textureJSON.minFilter ] !== undefined )
+					texture.minFilter = THREE[ textureJSON.minFilter ];
 
 
-			if ( THREE[ textureJSON.minFilter ] !== undefined )
-				texture.minFilter = THREE[ textureJSON.minFilter ];
+				if ( THREE[ textureJSON.magFilter ] !== undefined )
+					texture.magFilter = THREE[ textureJSON.magFilter ];
 
 
-			if ( THREE[ textureJSON.magFilter ] !== undefined )
-				texture.magFilter = THREE[ textureJSON.magFilter ];
+				if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy;
 
 
-			if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy;
+				if ( textureJSON.repeat ) {
 
 
-			if ( textureJSON.repeat ) {
+					texture.repeat.set( textureJSON.repeat[ 0 ], textureJSON.repeat[ 1 ] );
 
 
-				texture.repeat.set( textureJSON.repeat[ 0 ], textureJSON.repeat[ 1 ] );
+					if ( textureJSON.repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping;
+					if ( textureJSON.repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping;
 
 
-				if ( textureJSON.repeat[ 0 ] !== 1 ) texture.wrapS = THREE.RepeatWrapping;
-				if ( textureJSON.repeat[ 1 ] !== 1 ) texture.wrapT = THREE.RepeatWrapping;
+				}
 
 
-			}
+				if ( textureJSON.offset ) {
 
 
-			if ( textureJSON.offset ) {
+					texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] );
 
 
-				texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] );
+				}
 
 
-			}
+				// handle wrap after repeat so that default repeat can be overriden
+
+				if ( textureJSON.wrap ) {
 
 
-			// handle wrap after repeat so that default repeat can be overriden
+					var wrapMap = {
+						"repeat": THREE.RepeatWrapping,
+						"mirror": THREE.MirroredRepeatWrapping
+					}
 
 
-			if ( textureJSON.wrap ) {
+					if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ];
+					if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ];
 
 
-				var wrapMap = {
-					"repeat": THREE.RepeatWrapping,
-					"mirror": THREE.MirroredRepeatWrapping
 				}
 				}
 
 
-				if ( wrapMap[ textureJSON.wrap[ 0 ] ] !== undefined ) texture.wrapS = wrapMap[ textureJSON.wrap[ 0 ] ];
-				if ( wrapMap[ textureJSON.wrap[ 1 ] ] !== undefined ) texture.wrapT = wrapMap[ textureJSON.wrap[ 1 ] ];
-
 			}
 			}
 
 
+			result.textures[ textureID ] = texture;
+
 		}
 		}
 
 
-		result.textures[ textureID ] = texture;
+		// materials
 
 
-	}
+		var matID, matJSON;
+		var parID;
 
 
-	// materials
+		for ( matID in data.materials ) {
 
 
-	var matID, matJSON;
-	var parID;
+			matJSON = data.materials[ matID ];
 
 
-	for ( matID in data.materials ) {
+			for ( parID in matJSON.parameters ) {
 
 
-		matJSON = data.materials[ matID ];
+				if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" ) {
 
 
-		for ( parID in matJSON.parameters ) {
+					matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ];
 
 
-			if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" ) {
+				} else if ( parID === "shading" ) {
 
 
-				matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ];
+					matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
 
 
-			} else if ( parID === "shading" ) {
+				} else if ( parID === "side" ) {
 
 
-				matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
+					if ( matJSON.parameters[ parID ] == "double" ) {
 
 
-			} else if ( parID === "side" ) {
+						matJSON.parameters[ parID ] = THREE.DoubleSide;
 
 
-				if ( matJSON.parameters[ parID ] == "double" ) {
+					} else if ( matJSON.parameters[ parID ] == "back" ) {
 
 
-					matJSON.parameters[ parID ] = THREE.DoubleSide;
+						matJSON.parameters[ parID ] = THREE.BackSide;
 
 
-				} else if ( matJSON.parameters[ parID ] == "back" ) {
+					} else {
 
 
-					matJSON.parameters[ parID ] = THREE.BackSide;
+						matJSON.parameters[ parID ] = THREE.FrontSide;
 
 
-				} else {
+					}
 
 
-					matJSON.parameters[ parID ] = THREE.FrontSide;
+				} else if ( parID === "blending" ) {
 
 
-				}
+					matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.NormalBlending;
+
+				} else if ( parID === "combine" ) {
 
 
-			} else if ( parID === "blending" ) {
+					matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation;
 
 
-				matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.NormalBlending;
+				} else if ( parID === "vertexColors" ) {
 
 
-			} else if ( parID === "combine" ) {
+					if ( matJSON.parameters[ parID ] == "face" ) {
 
 
-				matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation;
+						matJSON.parameters[ parID ] = THREE.FaceColors;
 
 
-			} else if ( parID === "vertexColors" ) {
+					// default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false
 
 
-				if ( matJSON.parameters[ parID ] == "face" ) {
+					} else if ( matJSON.parameters[ parID ] ) {
 
 
-					matJSON.parameters[ parID ] = THREE.FaceColors;
+						matJSON.parameters[ parID ] = THREE.VertexColors;
 
 
-				// default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false
+					}
 
 
-				} else if ( matJSON.parameters[ parID ] ) {
+				} else if ( parID === "wrapRGB" ) {
 
 
-					matJSON.parameters[ parID ] = THREE.VertexColors;
+					var v3 = matJSON.parameters[ parID ];
+					matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] );
 
 
 				}
 				}
 
 
-			} else if ( parID === "wrapRGB" ) {
+			}
+
+			if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) {
 
 
-				var v3 = matJSON.parameters[ parID ];
-				matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] );
+				matJSON.parameters.transparent = true;
 
 
 			}
 			}
 
 
-		}
+			if ( matJSON.parameters.normalMap ) {
 
 
-		if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) {
+				var shader = THREE.ShaderLib[ "normalmap" ];
+				var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
 
 
-			matJSON.parameters.transparent = true;
+				var diffuse = matJSON.parameters.color;
+				var specular = matJSON.parameters.specular;
+				var ambient = matJSON.parameters.ambient;
+				var shininess = matJSON.parameters.shininess;
 
 
-		}
+				uniforms[ "tNormal" ].value = result.textures[ matJSON.parameters.normalMap ];
 
 
-		if ( matJSON.parameters.normalMap ) {
+				if ( matJSON.parameters.normalScale ) {
 
 
-			var shader = THREE.ShaderLib[ "normalmap" ];
-			var uniforms = THREE.UniformsUtils.clone( shader.uniforms );
+					uniforms[ "uNormalScale" ].value.set( matJSON.parameters.normalScale[ 0 ], matJSON.parameters.normalScale[ 1 ] );
 
 
-			var diffuse = matJSON.parameters.color;
-			var specular = matJSON.parameters.specular;
-			var ambient = matJSON.parameters.ambient;
-			var shininess = matJSON.parameters.shininess;
-
-			uniforms[ "tNormal" ].value = result.textures[ matJSON.parameters.normalMap ];
+				}
 
 
-			if ( matJSON.parameters.normalScale ) {
+				if ( matJSON.parameters.map ) {
 
 
-				uniforms[ "uNormalScale" ].value.set( matJSON.parameters.normalScale[ 0 ], matJSON.parameters.normalScale[ 1 ] );
+					uniforms[ "tDiffuse" ].value = matJSON.parameters.map;
+					uniforms[ "enableDiffuse" ].value = true;
 
 
-			}
+				}
 
 
-			if ( matJSON.parameters.map ) {
+				if ( matJSON.parameters.envMap ) {
 
 
-				uniforms[ "tDiffuse" ].value = matJSON.parameters.map;
-				uniforms[ "enableDiffuse" ].value = true;
+					uniforms[ "tCube" ].value = matJSON.parameters.envMap;
+					uniforms[ "enableReflection" ].value = true;
+					uniforms[ "uReflectivity" ].value = matJSON.parameters.reflectivity;
 
 
-			}
+				}
 
 
-			if ( matJSON.parameters.envMap ) {
+				if ( matJSON.parameters.lightMap ) {
 
 
-				uniforms[ "tCube" ].value = matJSON.parameters.envMap;
-				uniforms[ "enableReflection" ].value = true;
-				uniforms[ "uReflectivity" ].value = matJSON.parameters.reflectivity;
+					uniforms[ "tAO" ].value = matJSON.parameters.lightMap;
+					uniforms[ "enableAO" ].value = true;
 
 
-			}
+				}
 
 
-			if ( matJSON.parameters.lightMap ) {
+				if ( matJSON.parameters.specularMap ) {
 
 
-				uniforms[ "tAO" ].value = matJSON.parameters.lightMap;
-				uniforms[ "enableAO" ].value = true;
+					uniforms[ "tSpecular" ].value = result.textures[ matJSON.parameters.specularMap ];
+					uniforms[ "enableSpecular" ].value = true;
 
 
-			}
+				}
 
 
-			if ( matJSON.parameters.specularMap ) {
+				if ( matJSON.parameters.displacementMap ) {
 
 
-				uniforms[ "tSpecular" ].value = result.textures[ matJSON.parameters.specularMap ];
-				uniforms[ "enableSpecular" ].value = true;
+					uniforms[ "tDisplacement" ].value = result.textures[ matJSON.parameters.displacementMap ];
+					uniforms[ "enableDisplacement" ].value = true;
 
 
-			}
+					uniforms[ "uDisplacementBias" ].value = matJSON.parameters.displacementBias;
+					uniforms[ "uDisplacementScale" ].value = matJSON.parameters.displacementScale;
 
 
-			if ( matJSON.parameters.displacementMap ) {
+				}
 
 
-				uniforms[ "tDisplacement" ].value = result.textures[ matJSON.parameters.displacementMap ];
-				uniforms[ "enableDisplacement" ].value = true;
+				uniforms[ "uDiffuseColor" ].value.setHex( diffuse );
+				uniforms[ "uSpecularColor" ].value.setHex( specular );
+				uniforms[ "uAmbientColor" ].value.setHex( ambient );
 
 
-				uniforms[ "uDisplacementBias" ].value = matJSON.parameters.displacementBias;
-				uniforms[ "uDisplacementScale" ].value = matJSON.parameters.displacementScale;
+				uniforms[ "uShininess" ].value = shininess;
 
 
-			}
+				if ( matJSON.parameters.opacity ) {
 
 
-			uniforms[ "uDiffuseColor" ].value.setHex( diffuse );
-			uniforms[ "uSpecularColor" ].value.setHex( specular );
-			uniforms[ "uAmbientColor" ].value.setHex( ambient );
+					uniforms[ "uOpacity" ].value = matJSON.parameters.opacity;
 
 
-			uniforms[ "uShininess" ].value = shininess;
+				}
 
 
-			if ( matJSON.parameters.opacity ) {
+				var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true };
 
 
-				uniforms[ "uOpacity" ].value = matJSON.parameters.opacity;
+				material = new THREE.ShaderMaterial( parameters );
 
 
-			}
+			} else {
 
 
-			var parameters = { fragmentShader: shader.fragmentShader, vertexShader: shader.vertexShader, uniforms: uniforms, lights: true, fog: true };
+				material = new THREE[ matJSON.type ]( matJSON.parameters );
 
 
-			material = new THREE.ShaderMaterial( parameters );
+			}
 
 
-		} else {
+			material.name = matID;
 
 
-			material = new THREE[ matJSON.type ]( matJSON.parameters );
+			result.materials[ matID ] = material;
 
 
 		}
 		}
 
 
-		material.name = matID;
+		// second pass through all materials to initialize MeshFaceMaterials
+		// that could be referring to other materials out of order
 
 
-		result.materials[ matID ] = material;
-
-	}
+		for ( matID in data.materials ) {
 
 
-	// second pass through all materials to initialize MeshFaceMaterials
-	// that could be referring to other materials out of order
+			matJSON = data.materials[ matID ];
 
 
-	for ( matID in data.materials ) {
+			if ( matJSON.parameters.materials ) {
 
 
-		matJSON = data.materials[ matID ];
+				var materialArray = [];
 
 
-		if ( matJSON.parameters.materials ) {
+				for ( var i = 0; i < matJSON.parameters.materials.length; i ++ ) {
 
 
-			var materialArray = [];
+					var label = matJSON.parameters.materials[ i ];
+					materialArray.push( result.materials[ label ] );
 
 
-			for ( var i = 0; i < matJSON.parameters.materials.length; i ++ ) {
+				}
 
 
-				var label = matJSON.parameters.materials[ i ];
-				materialArray.push( result.materials[ label ] );
+				result.materials[ matID ].materials = materialArray;
 
 
 			}
 			}
 
 
-			result.materials[ matID ].materials = materialArray;
-
 		}
 		}
 
 
-	}
+		// objects ( synchronous init of procedural primitives )
 
 
-	// objects ( synchronous init of procedural primitives )
+		handle_objects();
 
 
-	handle_objects();
+		// defaults
 
 
-	// defaults
+		if ( result.cameras && data.defaults.camera ) {
 
 
-	if ( result.cameras && data.defaults.camera ) {
+			result.currentCamera = result.cameras[ data.defaults.camera ];
 
 
-		result.currentCamera = result.cameras[ data.defaults.camera ];
+		}
 
 
-	}
+		if ( result.fogs && data.defaults.fog ) {
 
 
-	if ( result.fogs && data.defaults.fog ) {
+			result.scene.fog = result.fogs[ data.defaults.fog ];
 
 
-		result.scene.fog = result.fogs[ data.defaults.fog ];
+		}
 
 
-	}
+		// synchronous callback
 
 
-	// synchronous callback
+		scope.callbackSync( result );
 
 
-	scope.callbackSync( result );
+		// just in case there are no async elements
 
 
-	// just in case there are no async elements
+		async_callback_gate();
 
 
-	async_callback_gate();
+	}
 
 
-};
+}
 
 
 /**
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/

+ 30 - 31
build/three.min.js

@@ -213,40 +213,39 @@ THREE.JSONLoader.prototype.parse=function(a,b){var c=new THREE.Geometry,d=void 0
 z[h++],p.b=z[h++],p.c=z[h++],p.d=z[h++],j=4):(p=new THREE.Face3,p.a=z[h++],p.b=z[h++],p.c=z[h++],j=3);g&&(g=z[h++],p.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<H;e++)r=a.uvs[e],m=z[h++],v=r[2*m],m=r[2*m+1],c.faceUvs[e][g]=new THREE.Vector2(v,m);if(f)for(e=0;e<H;e++){r=a.uvs[e];s=[];for(f=0;f<j;f++)m=z[h++],v=r[2*m],m=r[2*m+1],s[f]=new THREE.Vector2(v,m);c.faceVertexUvs[e][g]=s}n&&(n=3*z[h++],f=new THREE.Vector3,f.x=G[n++],f.y=G[n++],f.z=G[n],p.normal=f);if(l)for(e=0;e<j;e++)n=3*z[h++],f=new THREE.Vector3,
 z[h++],p.b=z[h++],p.c=z[h++],p.d=z[h++],j=4):(p=new THREE.Face3,p.a=z[h++],p.b=z[h++],p.c=z[h++],j=3);g&&(g=z[h++],p.materialIndex=g);g=c.faces.length;if(e)for(e=0;e<H;e++)r=a.uvs[e],m=z[h++],v=r[2*m],m=r[2*m+1],c.faceUvs[e][g]=new THREE.Vector2(v,m);if(f)for(e=0;e<H;e++){r=a.uvs[e];s=[];for(f=0;f<j;f++)m=z[h++],v=r[2*m],m=r[2*m+1],s[f]=new THREE.Vector2(v,m);c.faceVertexUvs[e][g]=s}n&&(n=3*z[h++],f=new THREE.Vector3,f.x=G[n++],f.y=G[n++],f.z=G[n],p.normal=f);if(l)for(e=0;e<j;e++)n=3*z[h++],f=new THREE.Vector3,
 f.x=G[n++],f.y=G[n++],f.z=G[n],p.vertexNormals.push(f);t&&(l=z[h++],l=new THREE.Color(C[l]),p.color=l);if(q)for(e=0;e<j;e++)l=z[h++],l=new THREE.Color(C[l]),p.vertexColors.push(l);c.faces.push(p)}if(a.skinWeights){h=0;for(i=a.skinWeights.length;h<i;h+=2)z=a.skinWeights[h],G=a.skinWeights[h+1],c.skinWeights.push(new THREE.Vector4(z,G,0,0))}if(a.skinIndices){h=0;for(i=a.skinIndices.length;h<i;h+=2)z=a.skinIndices[h],G=a.skinIndices[h+1],c.skinIndices.push(new THREE.Vector4(z,G,0,0))}c.bones=a.bones;
 f.x=G[n++],f.y=G[n++],f.z=G[n],p.vertexNormals.push(f);t&&(l=z[h++],l=new THREE.Color(C[l]),p.color=l);if(q)for(e=0;e<j;e++)l=z[h++],l=new THREE.Color(C[l]),p.vertexColors.push(l);c.faces.push(p)}if(a.skinWeights){h=0;for(i=a.skinWeights.length;h<i;h+=2)z=a.skinWeights[h],G=a.skinWeights[h+1],c.skinWeights.push(new THREE.Vector4(z,G,0,0))}if(a.skinIndices){h=0;for(i=a.skinIndices.length;h<i;h+=2)z=a.skinIndices[h],G=a.skinIndices[h+1],c.skinIndices.push(new THREE.Vector4(z,G,0,0))}c.bones=a.bones;
 c.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(i=a.morphTargets.length;h<i;h++){c.morphTargets[h]={};c.morphTargets[h].name=a.morphTargets[h].name;c.morphTargets[h].vertices=[];C=c.morphTargets[h].vertices;H=a.morphTargets[h].vertices;z=0;for(G=H.length;z<G;z+=3)q=new THREE.Vector3,q.x=H[z]*d,q.y=H[z+1]*d,q.z=H[z+2]*d,C.push(q)}}if(void 0!==a.morphColors){h=0;for(i=a.morphColors.length;h<i;h++){c.morphColors[h]={};c.morphColors[h].name=a.morphColors[h].name;c.morphColors[h].colors=[];
 c.animation=a.animation;if(void 0!==a.morphTargets){h=0;for(i=a.morphTargets.length;h<i;h++){c.morphTargets[h]={};c.morphTargets[h].name=a.morphTargets[h].name;c.morphTargets[h].vertices=[];C=c.morphTargets[h].vertices;H=a.morphTargets[h].vertices;z=0;for(G=H.length;z<G;z+=3)q=new THREE.Vector3,q.x=H[z]*d,q.y=H[z+1]*d,q.z=H[z+2]*d,C.push(q)}}if(void 0!==a.morphColors){h=0;for(i=a.morphColors.length;h<i;h++){c.morphColors[h]={};c.morphColors[h].name=a.morphColors[h].name;c.morphColors[h].colors=[];
-G=c.morphColors[h].colors;C=a.morphColors[h].colors;d=0;for(z=C.length;d<z;d+=3)H=new THREE.Color(16755200),H.setRGB(C[d],C[d+1],C[d+2]),G.push(H)}}c.computeCentroids();c.computeFaceNormals();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(a){var b=0,c=0;this.itemStart=function(){c++};this.itemEnd=function(d){b++;void 0!==a&&a(d,b,c)}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
+G=c.morphColors[h].colors;C=a.morphColors[h].colors;d=0;for(z=C.length;d<z;d+=3)H=new THREE.Color(16755200),H.setRGB(C[d],C[d+1],C[d+2]),G.push(H)}}c.computeCentroids();c.computeFaceNormals();if(void 0===a.materials)return{geometry:c};d=this.initMaterials(a.materials,b);this.needsTangents(d)&&c.computeTangents();return{geometry:c,materials:d}};THREE.LoadingManager=function(){var a=this,b=0,c=0;this.onItemLoad=function(){};this.itemStart=function(){c++};this.itemEnd=function(d){b++;a.onItemLoad(d,b,c)}};THREE.DefaultLoadingManager=new THREE.LoadingManager;THREE.GeometryLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.GeometryLoader.prototype={constructor:THREE.GeometryLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(){}};THREE.MaterialLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
 THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b;switch(a.type){case "MeshBasicMaterial":b=new THREE.MeshBasicMaterial({color:a.color,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshLambertMaterial":b=new THREE.MeshLambertMaterial({color:a.color,
 THREE.MaterialLoader.prototype={constructor:THREE.MaterialLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b;switch(a.type){case "MeshBasicMaterial":b=new THREE.MeshBasicMaterial({color:a.color,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshLambertMaterial":b=new THREE.MeshLambertMaterial({color:a.color,
 ambient:a.ambient,emissive:a.emissive,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshPhongMaterial":b=new THREE.MeshPhongMaterial({color:a.color,ambient:a.ambient,emissive:a.emissive,specular:a.specular,shininess:a.shininess,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshNormalMaterial":b=new THREE.MeshNormalMaterial({opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshDepthMaterial":b=new THREE.MeshDepthMaterial({opacity:a.opacity,
 ambient:a.ambient,emissive:a.emissive,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshPhongMaterial":b=new THREE.MeshPhongMaterial({color:a.color,ambient:a.ambient,emissive:a.emissive,specular:a.specular,shininess:a.shininess,opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshNormalMaterial":b=new THREE.MeshNormalMaterial({opacity:a.opacity,transparent:a.transparent,wireframe:a.wireframe});break;case "MeshDepthMaterial":b=new THREE.MeshDepthMaterial({opacity:a.opacity,
 transparent:a.transparent,wireframe:a.wireframe})}return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
 transparent:a.transparent,wireframe:a.wireframe})}return b}};THREE.ObjectLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};
-THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader;d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=this.parseGeometries(a.geometries),c=this.parseMaterials(a.materials);return this.parseObject(a.object,b,c)},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=0,e=a.length;d<e;d++){var f,g=a[d];switch(g.type){case "PlaneGeometry":f=
-new THREE.PlaneGeometry(g.width,g.height,g.widthSegments,g.heightSegments);break;case "CubeGeometry":f=new THREE.CubeGeometry(g.width,g.height,g.depth,g.widthSegments,g.heightSegments,g.depthSegments);break;case "CylinderGeometry":f=new THREE.CylinderGeometry(g.radiusTop,g.radiusBottom,g.height,g.radiusSegments,g.heightSegments,g.openEnded);break;case "SphereGeometry":f=new THREE.SphereGeometry(g.radius,g.widthSegments,g.heightSegments,g.phiStart,g.phiLength,g.thetaStart,g.thetaLength);break;case "IcosahedronGeometry":f=
-new THREE.IcosahedronGeometry(g.radius,g.detail);break;case "TorusGeometry":f=new THREE.TorusGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.arc);break;case "TorusKnotGeometry":f=new THREE.TorusKnotGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.p,g.q,g.heightScale);break;case "Geometry":f=c.parse(g.data).geometry}void 0!==g.id&&(f.id=g.id);void 0!==g.name&&(f.name=g.name);b[g.id]=f}return b},parseMaterials:function(a){var b={};if(void 0!==a)for(var c=new THREE.MaterialLoader,
-d=0,e=a.length;d<e;d++){var f=a[d],g=c.parse(f);void 0!==f.id&&(g.id=f.id);void 0!==f.name&&(g.name=f.name);b[f.id]=g}return b},parseObject:function(a,b,c){var d;switch(a.type){case "Scene":d=new THREE.Scene;break;case "PerspectiveCamera":d=new THREE.PerspectiveCamera(a.fov,a.aspect,a.near,a.far);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);break;case "OrthographicCamera":d=new THREE.OrthographicCamera(a.left,a.right,a.top,a.bottom,a.near,a.far);d.position.fromArray(a.position);
-d.rotation.fromArray(a.rotation);break;case "AmbientLight":d=new THREE.AmbientLight(a.color);break;case "DirectionalLight":d=new THREE.DirectionalLight(a.color,a.intensity);d.position.fromArray(a.position);break;case "PointLight":d=new THREE.PointLight(a.color,a.intensity,a.distance);d.position.fromArray(a.position);break;case "SpotLight":d=new THREE.SpotLight(a.color,a.intensity,a.distance,a.angle,a.exponent);d.position.fromArray(a.position);break;case "HemisphereLight":d=new THREE.HemisphereLight(a.color,
-a.groundColor,a.intensity);d.position.fromArray(a.position);break;case "Mesh":d=new THREE.Mesh(b[a.geometry],c[a.material]);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);d.scale.fromArray(a.scale);break;default:d=new THREE.Object3D,d.position.fromArray(a.position),d.rotation.fromArray(a.rotation),d.scale.fromArray(a.scale)}void 0!==a.id&&(d.id=a.id);void 0!==a.name&&(d.name=a.name);void 0!==a.visible&&(d.visible=a.visible);void 0!==a.userData&&(d.userData=a.userData);if(void 0!==
-a.children)for(var e in a.children)d.add(this.parseObject(a.children[e],b,c));return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlerMap={};this.hierarchyHandlerMap={};this.addGeometryHandler("ascii",THREE.JSONLoader)};THREE.SceneLoader.prototype.constructor=THREE.SceneLoader;
-THREE.SceneLoader.prototype.load=function(a,b){var c=this,d=new XMLHttpRequest;d.onreadystatechange=function(){if(4===d.readyState)if(200===d.status||0===d.status){var e=JSON.parse(d.responseText);c.parse(e,b,a)}else console.error("THREE.SceneLoader: Couldn't load ["+a+"] ["+d.status+"]")};d.open("GET",a,!0);d.send(null)};THREE.SceneLoader.prototype.addGeometryHandler=function(a,b){this.geometryHandlerMap[a]={loaderClass:b}};
-THREE.SceneLoader.prototype.addHierarchyHandler=function(a,b){this.hierarchyHandlerMap[a]={loaderClass:b}};
-THREE.SceneLoader.prototype.parse=function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(A.scene,B.objects)}function f(a,b){var c,e,g,i,j,l,m;for(m in b){var r=A.objects[m],s=b[m];if(void 0===r){if(s.type&&s.type in n.hierarchyHandlerMap){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var y in s)y in e||(g[y]=s[y]);t=A.materials[s.material];s.loading=!0;e=
-n.hierarchyHandlerMap[s.type].loaderObject;e.options?e.load(d(s.url,B.urlBaseType),h(m,a,t,s)):e.load(d(s.url,B.urlBaseType),h(m,a,t,s),g)}}else if(void 0!==s.geometry){if(q=A.geometries[s.geometry]){r=!1;t=A.materials[s.material];r=t instanceof THREE.ShaderMaterial;g=s.position;i=s.rotation;j=s.scale;c=s.matrix;l=s.quaternion;s.material||(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));
-if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)r=r||t.materials[e]instanceof THREE.ShaderMaterial;r&&q.computeTangents();s.skin?r=new THREE.SkinnedMesh(q,t):s.morph?(r=new THREE.MorphAnimMesh(q,t),void 0!==s.duration&&(r.duration=s.duration),void 0!==s.time&&(r.time=s.time),void 0!==s.mirroredLoop&&(r.mirroredLoop=s.mirroredLoop),t.morphNormals&&q.computeMorphNormals()):r=new THREE.Mesh(q,t);r.name=m;c?(r.matrixAutoUpdate=!1,r.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],
-c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.fromArray(g),l?(r.quaternion.fromArray(l),r.useQuaternion=!0):r.rotation.fromArray(i),r.scale.fromArray(j));r.visible=s.visible;r.castShadow=s.castShadow;r.receiveShadow=s.receiveShadow;a.add(r);A.objects[m]=r}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(z=void 0!==s.color?s.color:16777215,G=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(g=s.direction,v=new THREE.DirectionalLight(z,
-G),v.position.fromArray(g),s.target&&(K.push({object:v,targetName:s.target}),v.target=null)):"PointLight"===s.type?(g=s.position,e=s.distance,v=new THREE.PointLight(z,G,e),v.position.fromArray(g)):"AmbientLight"===s.type&&(v=new THREE.AmbientLight(z)),a.add(v),v.name=m,A.lights[m]=v,A.objects[m]=v):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(g=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?p=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===
-s.type&&(p=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),p.name=m,p.position.fromArray(g),void 0!==l?(p.quaternion.fromArray(l),p.useQuaternion=!0):void 0!==i&&p.rotation.fromArray(i),a.add(p),A.cameras[m]=p,A.objects[m]=p):(g=s.position,i=s.rotation,j=s.scale,l=s.quaternion,r=new THREE.Object3D,r.name=m,r.position.fromArray(g),l?(r.quaternion.fromArray(l),r.useQuaternion=!0):r.rotation.fromArray(i),r.scale.fromArray(j),r.visible=void 0!==s.visible?s.visible:!1,a.add(r),
-A.objects[m]=r,A.empties[m]=r);if(r){if(void 0!==s.userData)for(var C in s.userData)r.userData[C]=s.userData[C];if(void 0!==s.groups)for(e=0;e<s.groups.length;e++)g=s.groups[e],void 0===A.groups[g]&&(A.groups[g]=[]),A.groups[g].push(m)}}void 0!==r&&void 0!==s.children&&f(r,s.children)}}function g(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c;e();C-=1;n.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.rotation,h=d.quaternion,
-i=d.scale;f.position.fromArray(d.position);h?(f.quaternion.fromArray(h),f.useQuaternion=!0):f.rotation.fromArray(g);f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;A.objects[a]=f;e();C-=1;n.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c}}function j(){n.callbackProgress({totalModels:I,totalTextures:F,loadedModels:I-C,loadedTextures:F-
-H},A);n.onLoadProgress();if(0===C&&0===H){for(var a=0;a<K.length;a++){var c=K[a],d=A.objects[c.targetName];d?c.object.target=d:(c.object.target=new THREE.Object3D,A.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(A)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var n=this,m=THREE.Loader.prototype.extractUrlBase(c),q,t,p,r,s,v,z,G,C,H,I,F,A,K=[],B=a,J;for(J in this.geometryHandlerMap)a=this.geometryHandlerMap[J].loaderClass,this.geometryHandlerMap[J].loaderObject=
-new a;for(J in this.hierarchyHandlerMap)a=this.hierarchyHandlerMap[J].loaderClass,this.hierarchyHandlerMap[J].loaderObject=new a;H=C=0;A={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(B.transform&&(J=B.transform.position,a=B.transform.rotation,c=B.transform.scale,J&&A.scene.position.fromArray(J),a&&A.scene.rotation.fromArray(a),c&&A.scene.scale.fromArray(c),J||a||c))A.scene.updateMatrix(),A.scene.updateMatrixWorld();
-J=function(a){return function(){H-=a;j();n.onLoadComplete()}};for(var N in B.fogs)a=B.fogs[N],"linear"===a.type?r=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(r=new THREE.FogExp2(0,a.density)),a=a.color,r.color.setRGB(a[0],a[1],a[2]),A.fogs[N]=r;for(var y in B.geometries)r=B.geometries[y],r.type in this.geometryHandlerMap&&(C+=1,n.onLoadStart());for(var M in B.objects)l(B.objects[M],function(a){a.type&&a.type in n.hierarchyHandlerMap&&(C+=1,n.onLoadStart())});I=C;for(y in B.geometries)if(r=B.geometries[y],
-"cube"===r.type)q=new THREE.CubeGeometry(r.width,r.height,r.depth,r.widthSegments,r.heightSegments,r.depthSegments),q.name=y,A.geometries[y]=q;else if("plane"===r.type)q=new THREE.PlaneGeometry(r.width,r.height,r.widthSegments,r.heightSegments),q.name=y,A.geometries[y]=q;else if("sphere"===r.type)q=new THREE.SphereGeometry(r.radius,r.widthSegments,r.heightSegments),q.name=y,A.geometries[y]=q;else if("cylinder"===r.type)q=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),
-q.name=y,A.geometries[y]=q;else if("torus"===r.type)q=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),q.name=y,A.geometries[y]=q;else if("icosahedron"===r.type)q=new THREE.IcosahedronGeometry(r.radius,r.subdivisions),q.name=y,A.geometries[y]=q;else if(r.type in this.geometryHandlerMap){M={};for(s in r)"type"!==s&&"url"!==s&&(M[s]=r[s]);this.geometryHandlerMap[r.type].loaderObject.load(d(r.url,B.urlBaseType),g(y),M)}else"embedded"===r.type&&(M=B.embeds[r.id],M.metadata=B.metadata,
-M&&(M=this.geometryHandlerMap.ascii.loaderObject.parse(M,""),i(y)(M.geometry,M.materials)));for(var w in B.textures)if(y=B.textures[w],y.url instanceof Array){H+=y.url.length;for(s=0;s<y.url.length;s++)n.onLoadStart()}else H+=1,n.onLoadStart();F=H;for(w in B.textures){y=B.textures[w];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){M=y.url.length;r=[];for(s=0;s<M;s++)r[s]=d(y.url[s],B.urlBaseType);s=(s=/\.dds$/i.test(r[0]))?THREE.ImageUtils.loadCompressedTextureCube(r,
-y.mapping,J(M)):THREE.ImageUtils.loadTextureCube(r,y.mapping,J(M))}else s=/\.dds$/i.test(y.url),M=d(y.url,B.urlBaseType),r=J(1),s=s?THREE.ImageUtils.loadCompressedTexture(M,y.mapping,r):THREE.ImageUtils.loadTexture(M,y.mapping,r),void 0!==THREE[y.minFilter]&&(s.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(s.magFilter=THREE[y.magFilter]),y.anisotropy&&(s.anisotropy=y.anisotropy),y.repeat&&(s.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(s.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&
-(s.wrapT=THREE.RepeatWrapping)),y.offset&&s.offset.set(y.offset[0],y.offset[1]),y.wrap&&(M={repeat:THREE.RepeatWrapping,mirror:THREE.MirroredRepeatWrapping},void 0!==M[y.wrap[0]]&&(s.wrapS=M[y.wrap[0]]),void 0!==M[y.wrap[1]]&&(s.wrapT=M[y.wrap[1]]));A.textures[w]=s}var Z,L;for(Z in B.materials){w=B.materials[Z];for(L in w.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?w.parameters[L]=A.textures[w.parameters[L]]:"shading"===L?w.parameters[L]="flat"===w.parameters[L]?THREE.FlatShading:
-THREE.SmoothShading:"side"===L?w.parameters[L]="double"==w.parameters[L]?THREE.DoubleSide:"back"==w.parameters[L]?THREE.BackSide:THREE.FrontSide:"blending"===L?w.parameters[L]=w.parameters[L]in THREE?THREE[w.parameters[L]]:THREE.NormalBlending:"combine"===L?w.parameters[L]=w.parameters[L]in THREE?THREE[w.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==w.parameters[L]?w.parameters[L]=THREE.FaceColors:w.parameters[L]&&(w.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(J=w.parameters[L],
-w.parameters[L]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==w.parameters.opacity&&1>w.parameters.opacity&&(w.parameters.transparent=!0);w.parameters.normalMap?(J=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(J.uniforms),s=w.parameters.color,M=w.parameters.specular,r=w.parameters.ambient,N=w.parameters.shininess,y.tNormal.value=A.textures[w.parameters.normalMap],w.parameters.normalScale&&y.uNormalScale.value.set(w.parameters.normalScale[0],w.parameters.normalScale[1]),w.parameters.map&&(y.tDiffuse.value=
-w.parameters.map,y.enableDiffuse.value=!0),w.parameters.envMap&&(y.tCube.value=w.parameters.envMap,y.enableReflection.value=!0,y.uReflectivity.value=w.parameters.reflectivity),w.parameters.lightMap&&(y.tAO.value=w.parameters.lightMap,y.enableAO.value=!0),w.parameters.specularMap&&(y.tSpecular.value=A.textures[w.parameters.specularMap],y.enableSpecular.value=!0),w.parameters.displacementMap&&(y.tDisplacement.value=A.textures[w.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=
-w.parameters.displacementBias,y.uDisplacementScale.value=w.parameters.displacementScale),y.uDiffuseColor.value.setHex(s),y.uSpecularColor.value.setHex(M),y.uAmbientColor.value.setHex(r),y.uShininess.value=N,w.parameters.opacity&&(y.uOpacity.value=w.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:y,lights:!0,fog:!0})):t=new THREE[w.type](w.parameters);t.name=Z;A.materials[Z]=t}for(Z in B.materials)if(w=B.materials[Z],w.parameters.materials){L=
-[];for(s=0;s<w.parameters.materials.length;s++)L.push(A.materials[w.parameters.materials[s]]);A.materials[Z].materials=L}e();A.cameras&&B.defaults.camera&&(A.currentCamera=A.cameras[B.defaults.camera]);A.fogs&&B.defaults.fog&&(A.scene.fog=A.fogs[B.defaults.fog]);n.callbackSync(A);j()};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
+THREE.ObjectLoader.prototype={constructor:THREE.ObjectLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(a){b(c.parse(JSON.parse(a)))})},setCrossOrigin:function(a){this.crossOrigin=a},parse:function(a){var b=this.parseGeometries(a.geometries),c=this.parseMaterials(a.materials);return this.parseObject(a.object,b,c)},parseGeometries:function(a){var b={};if(void 0!==a)for(var c=new THREE.JSONLoader,d=0,e=a.length;d<e;d++){var f,
+g=a[d];switch(g.type){case "PlaneGeometry":f=new THREE.PlaneGeometry(g.width,g.height,g.widthSegments,g.heightSegments);break;case "CubeGeometry":f=new THREE.CubeGeometry(g.width,g.height,g.depth,g.widthSegments,g.heightSegments,g.depthSegments);break;case "CylinderGeometry":f=new THREE.CylinderGeometry(g.radiusTop,g.radiusBottom,g.height,g.radiusSegments,g.heightSegments,g.openEnded);break;case "SphereGeometry":f=new THREE.SphereGeometry(g.radius,g.widthSegments,g.heightSegments,g.phiStart,g.phiLength,
+g.thetaStart,g.thetaLength);break;case "IcosahedronGeometry":f=new THREE.IcosahedronGeometry(g.radius,g.detail);break;case "TorusGeometry":f=new THREE.TorusGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.arc);break;case "TorusKnotGeometry":f=new THREE.TorusKnotGeometry(g.radius,g.tube,g.radialSegments,g.tubularSegments,g.p,g.q,g.heightScale);break;case "Geometry":f=c.parse(g.data).geometry}void 0!==g.id&&(f.id=g.id);void 0!==g.name&&(f.name=g.name);b[g.id]=f}return b},parseMaterials:function(a){var b=
+{};if(void 0!==a)for(var c=new THREE.MaterialLoader,d=0,e=a.length;d<e;d++){var f=a[d],g=c.parse(f);void 0!==f.id&&(g.id=f.id);void 0!==f.name&&(g.name=f.name);b[f.id]=g}return b},parseObject:function(a,b,c){var d;switch(a.type){case "Scene":d=new THREE.Scene;break;case "PerspectiveCamera":d=new THREE.PerspectiveCamera(a.fov,a.aspect,a.near,a.far);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);break;case "OrthographicCamera":d=new THREE.OrthographicCamera(a.left,a.right,a.top,a.bottom,
+a.near,a.far);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);break;case "AmbientLight":d=new THREE.AmbientLight(a.color);break;case "DirectionalLight":d=new THREE.DirectionalLight(a.color,a.intensity);d.position.fromArray(a.position);break;case "PointLight":d=new THREE.PointLight(a.color,a.intensity,a.distance);d.position.fromArray(a.position);break;case "SpotLight":d=new THREE.SpotLight(a.color,a.intensity,a.distance,a.angle,a.exponent);d.position.fromArray(a.position);break;case "HemisphereLight":d=
+new THREE.HemisphereLight(a.color,a.groundColor,a.intensity);d.position.fromArray(a.position);break;case "Mesh":d=new THREE.Mesh(b[a.geometry],c[a.material]);d.position.fromArray(a.position);d.rotation.fromArray(a.rotation);d.scale.fromArray(a.scale);break;default:d=new THREE.Object3D,d.position.fromArray(a.position),d.rotation.fromArray(a.rotation),d.scale.fromArray(a.scale)}void 0!==a.id&&(d.id=a.id);void 0!==a.name&&(d.name=a.name);void 0!==a.visible&&(d.visible=a.visible);void 0!==a.userData&&
+(d.userData=a.userData);if(void 0!==a.children)for(var e in a.children)d.add(this.parseObject(a.children[e],b,c));return d}};THREE.SceneLoader=function(){this.onLoadStart=function(){};this.onLoadProgress=function(){};this.onLoadComplete=function(){};this.callbackSync=function(){};this.callbackProgress=function(){};this.geometryHandlers={};this.hierarchyHandlers={};this.addGeometryHandler("ascii",THREE.JSONLoader)};
+THREE.SceneLoader.prototype={constructor:THREE.SceneLoader,load:function(a,b){var c=this,d=new THREE.XHRLoader(c.manager);d.setCrossOrigin(this.crossOrigin);d.load(a,function(d){c.parse(JSON.parse(d),b,a)})},setCrossOrigin:function(a){this.crossOrigin=a},addGeometryHandler:function(a,b){this.geometryHandlers[a]={loaderClass:b}},addHierarchyHandler:function(a,b){this.hierarchyHandlers[a]={loaderClass:b}},parse:function(a,b,c){function d(a,b){return"relativeToHTML"==b?a:m+"/"+a}function e(){f(A.scene,
+B.objects)}function f(a,b){var c,e,g,i,j,l,m;for(m in b){var r=A.objects[m],s=b[m];if(void 0===r){if(s.type&&s.type in n.hierarchyHandlers){if(void 0===s.loading){e={type:1,url:1,material:1,position:1,rotation:1,scale:1,visible:1,children:1,userData:1,skin:1,morph:1,mirroredLoop:1,duration:1};g={};for(var y in s)y in e||(g[y]=s[y]);t=A.materials[s.material];s.loading=!0;e=n.hierarchyHandlers[s.type].loaderObject;e.options?e.load(d(s.url,B.urlBaseType),h(m,a,t,s)):e.load(d(s.url,B.urlBaseType),h(m,
+a,t,s),g)}}else if(void 0!==s.geometry){if(q=A.geometries[s.geometry]){r=!1;t=A.materials[s.material];r=t instanceof THREE.ShaderMaterial;g=s.position;i=s.rotation;j=s.scale;c=s.matrix;l=s.quaternion;s.material||(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));t instanceof THREE.MeshFaceMaterial&&0===t.materials.length&&(t=new THREE.MeshFaceMaterial(A.face_materials[s.geometry]));if(t instanceof THREE.MeshFaceMaterial)for(e=0;e<t.materials.length;e++)r=r||t.materials[e]instanceof THREE.ShaderMaterial;
+r&&q.computeTangents();s.skin?r=new THREE.SkinnedMesh(q,t):s.morph?(r=new THREE.MorphAnimMesh(q,t),void 0!==s.duration&&(r.duration=s.duration),void 0!==s.time&&(r.time=s.time),void 0!==s.mirroredLoop&&(r.mirroredLoop=s.mirroredLoop),t.morphNormals&&q.computeMorphNormals()):r=new THREE.Mesh(q,t);r.name=m;c?(r.matrixAutoUpdate=!1,r.matrix.set(c[0],c[1],c[2],c[3],c[4],c[5],c[6],c[7],c[8],c[9],c[10],c[11],c[12],c[13],c[14],c[15])):(r.position.fromArray(g),l?(r.quaternion.fromArray(l),r.useQuaternion=
+!0):r.rotation.fromArray(i),r.scale.fromArray(j));r.visible=s.visible;r.castShadow=s.castShadow;r.receiveShadow=s.receiveShadow;a.add(r);A.objects[m]=r}}else"DirectionalLight"===s.type||"PointLight"===s.type||"AmbientLight"===s.type?(z=void 0!==s.color?s.color:16777215,G=void 0!==s.intensity?s.intensity:1,"DirectionalLight"===s.type?(g=s.direction,v=new THREE.DirectionalLight(z,G),v.position.fromArray(g),s.target&&(K.push({object:v,targetName:s.target}),v.target=null)):"PointLight"===s.type?(g=s.position,
+e=s.distance,v=new THREE.PointLight(z,G,e),v.position.fromArray(g)):"AmbientLight"===s.type&&(v=new THREE.AmbientLight(z)),a.add(v),v.name=m,A.lights[m]=v,A.objects[m]=v):"PerspectiveCamera"===s.type||"OrthographicCamera"===s.type?(g=s.position,i=s.rotation,l=s.quaternion,"PerspectiveCamera"===s.type?p=new THREE.PerspectiveCamera(s.fov,s.aspect,s.near,s.far):"OrthographicCamera"===s.type&&(p=new THREE.OrthographicCamera(s.left,s.right,s.top,s.bottom,s.near,s.far)),p.name=m,p.position.fromArray(g),
+void 0!==l?(p.quaternion.fromArray(l),p.useQuaternion=!0):void 0!==i&&p.rotation.fromArray(i),a.add(p),A.cameras[m]=p,A.objects[m]=p):(g=s.position,i=s.rotation,j=s.scale,l=s.quaternion,r=new THREE.Object3D,r.name=m,r.position.fromArray(g),l?(r.quaternion.fromArray(l),r.useQuaternion=!0):r.rotation.fromArray(i),r.scale.fromArray(j),r.visible=void 0!==s.visible?s.visible:!1,a.add(r),A.objects[m]=r,A.empties[m]=r);if(r){if(void 0!==s.userData)for(var C in s.userData)r.userData[C]=s.userData[C];if(void 0!==
+s.groups)for(e=0;e<s.groups.length;e++)g=s.groups[e],void 0===A.groups[g]&&(A.groups[g]=[]),A.groups[g].push(m)}}void 0!==r&&void 0!==s.children&&f(r,s.children)}}function g(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c;e();C-=1;n.onLoadComplete();j()}}function h(a,b,c,d){return function(f){var f=f.content?f.content:f.dae?f.scene:f,g=d.rotation,h=d.quaternion,i=d.scale;f.position.fromArray(d.position);h?(f.quaternion.fromArray(h),f.useQuaternion=!0):f.rotation.fromArray(g);
+f.scale.fromArray(i);c&&f.traverse(function(a){a.material=c});var l=void 0!==d.visible?d.visible:!0;f.traverse(function(a){a.visible=l});b.add(f);f.name=a;A.objects[a]=f;e();C-=1;n.onLoadComplete();j()}}function i(a){return function(b,c){b.name=a;A.geometries[a]=b;A.face_materials[a]=c}}function j(){n.callbackProgress({totalModels:I,totalTextures:F,loadedModels:I-C,loadedTextures:F-H},A);n.onLoadProgress();if(0===C&&0===H){for(var a=0;a<K.length;a++){var c=K[a],d=A.objects[c.targetName];d?c.object.target=
+d:(c.object.target=new THREE.Object3D,A.scene.add(c.object.target));c.object.target.userData.targetInverse=c.object}b(A)}}function l(a,b){b(a);if(void 0!==a.children)for(var c in a.children)l(a.children[c],b)}var n=this,m=THREE.Loader.prototype.extractUrlBase(c),q,t,p,r,s,v,z,G,C,H,I,F,A,K=[],B=a,J;for(J in this.geometryHandlers)a=this.geometryHandlers[J].loaderClass,this.geometryHandlers[J].loaderObject=new a;for(J in this.hierarchyHandlers)a=this.hierarchyHandlers[J].loaderClass,this.hierarchyHandlers[J].loaderObject=
+new a;H=C=0;A={scene:new THREE.Scene,geometries:{},face_materials:{},materials:{},textures:{},objects:{},cameras:{},lights:{},fogs:{},empties:{},groups:{}};if(B.transform&&(J=B.transform.position,a=B.transform.rotation,c=B.transform.scale,J&&A.scene.position.fromArray(J),a&&A.scene.rotation.fromArray(a),c&&A.scene.scale.fromArray(c),J||a||c))A.scene.updateMatrix(),A.scene.updateMatrixWorld();J=function(a){return function(){H-=a;j();n.onLoadComplete()}};for(var N in B.fogs)a=B.fogs[N],"linear"===a.type?
+r=new THREE.Fog(0,a.near,a.far):"exp2"===a.type&&(r=new THREE.FogExp2(0,a.density)),a=a.color,r.color.setRGB(a[0],a[1],a[2]),A.fogs[N]=r;for(var y in B.geometries)r=B.geometries[y],r.type in this.geometryHandlers&&(C+=1,n.onLoadStart());for(var M in B.objects)l(B.objects[M],function(a){a.type&&a.type in n.hierarchyHandlers&&(C+=1,n.onLoadStart())});I=C;for(y in B.geometries)if(r=B.geometries[y],"cube"===r.type)q=new THREE.CubeGeometry(r.width,r.height,r.depth,r.widthSegments,r.heightSegments,r.depthSegments),
+q.name=y,A.geometries[y]=q;else if("plane"===r.type)q=new THREE.PlaneGeometry(r.width,r.height,r.widthSegments,r.heightSegments),q.name=y,A.geometries[y]=q;else if("sphere"===r.type)q=new THREE.SphereGeometry(r.radius,r.widthSegments,r.heightSegments),q.name=y,A.geometries[y]=q;else if("cylinder"===r.type)q=new THREE.CylinderGeometry(r.topRad,r.botRad,r.height,r.radSegs,r.heightSegs),q.name=y,A.geometries[y]=q;else if("torus"===r.type)q=new THREE.TorusGeometry(r.radius,r.tube,r.segmentsR,r.segmentsT),
+q.name=y,A.geometries[y]=q;else if("icosahedron"===r.type)q=new THREE.IcosahedronGeometry(r.radius,r.subdivisions),q.name=y,A.geometries[y]=q;else if(r.type in this.geometryHandlers){M={};for(s in r)"type"!==s&&"url"!==s&&(M[s]=r[s]);this.geometryHandlers[r.type].loaderObject.load(d(r.url,B.urlBaseType),g(y),M)}else"embedded"===r.type&&(M=B.embeds[r.id],M.metadata=B.metadata,M&&(M=this.geometryHandlers.ascii.loaderObject.parse(M,""),i(y)(M.geometry,M.materials)));for(var w in B.textures)if(y=B.textures[w],
+y.url instanceof Array){H+=y.url.length;for(s=0;s<y.url.length;s++)n.onLoadStart()}else H+=1,n.onLoadStart();F=H;for(w in B.textures){y=B.textures[w];void 0!==y.mapping&&void 0!==THREE[y.mapping]&&(y.mapping=new THREE[y.mapping]);if(y.url instanceof Array){M=y.url.length;r=[];for(s=0;s<M;s++)r[s]=d(y.url[s],B.urlBaseType);s=(s=/\.dds$/i.test(r[0]))?THREE.ImageUtils.loadCompressedTextureCube(r,y.mapping,J(M)):THREE.ImageUtils.loadTextureCube(r,y.mapping,J(M))}else s=/\.dds$/i.test(y.url),M=d(y.url,
+B.urlBaseType),r=J(1),s=s?THREE.ImageUtils.loadCompressedTexture(M,y.mapping,r):THREE.ImageUtils.loadTexture(M,y.mapping,r),void 0!==THREE[y.minFilter]&&(s.minFilter=THREE[y.minFilter]),void 0!==THREE[y.magFilter]&&(s.magFilter=THREE[y.magFilter]),y.anisotropy&&(s.anisotropy=y.anisotropy),y.repeat&&(s.repeat.set(y.repeat[0],y.repeat[1]),1!==y.repeat[0]&&(s.wrapS=THREE.RepeatWrapping),1!==y.repeat[1]&&(s.wrapT=THREE.RepeatWrapping)),y.offset&&s.offset.set(y.offset[0],y.offset[1]),y.wrap&&(M={repeat:THREE.RepeatWrapping,
+mirror:THREE.MirroredRepeatWrapping},void 0!==M[y.wrap[0]]&&(s.wrapS=M[y.wrap[0]]),void 0!==M[y.wrap[1]]&&(s.wrapT=M[y.wrap[1]]));A.textures[w]=s}var Z,L;for(Z in B.materials){w=B.materials[Z];for(L in w.parameters)"envMap"===L||"map"===L||"lightMap"===L||"bumpMap"===L?w.parameters[L]=A.textures[w.parameters[L]]:"shading"===L?w.parameters[L]="flat"===w.parameters[L]?THREE.FlatShading:THREE.SmoothShading:"side"===L?w.parameters[L]="double"==w.parameters[L]?THREE.DoubleSide:"back"==w.parameters[L]?
+THREE.BackSide:THREE.FrontSide:"blending"===L?w.parameters[L]=w.parameters[L]in THREE?THREE[w.parameters[L]]:THREE.NormalBlending:"combine"===L?w.parameters[L]=w.parameters[L]in THREE?THREE[w.parameters[L]]:THREE.MultiplyOperation:"vertexColors"===L?"face"==w.parameters[L]?w.parameters[L]=THREE.FaceColors:w.parameters[L]&&(w.parameters[L]=THREE.VertexColors):"wrapRGB"===L&&(J=w.parameters[L],w.parameters[L]=new THREE.Vector3(J[0],J[1],J[2]));void 0!==w.parameters.opacity&&1>w.parameters.opacity&&
+(w.parameters.transparent=!0);w.parameters.normalMap?(J=THREE.ShaderLib.normalmap,y=THREE.UniformsUtils.clone(J.uniforms),s=w.parameters.color,M=w.parameters.specular,r=w.parameters.ambient,N=w.parameters.shininess,y.tNormal.value=A.textures[w.parameters.normalMap],w.parameters.normalScale&&y.uNormalScale.value.set(w.parameters.normalScale[0],w.parameters.normalScale[1]),w.parameters.map&&(y.tDiffuse.value=w.parameters.map,y.enableDiffuse.value=!0),w.parameters.envMap&&(y.tCube.value=w.parameters.envMap,
+y.enableReflection.value=!0,y.uReflectivity.value=w.parameters.reflectivity),w.parameters.lightMap&&(y.tAO.value=w.parameters.lightMap,y.enableAO.value=!0),w.parameters.specularMap&&(y.tSpecular.value=A.textures[w.parameters.specularMap],y.enableSpecular.value=!0),w.parameters.displacementMap&&(y.tDisplacement.value=A.textures[w.parameters.displacementMap],y.enableDisplacement.value=!0,y.uDisplacementBias.value=w.parameters.displacementBias,y.uDisplacementScale.value=w.parameters.displacementScale),
+y.uDiffuseColor.value.setHex(s),y.uSpecularColor.value.setHex(M),y.uAmbientColor.value.setHex(r),y.uShininess.value=N,w.parameters.opacity&&(y.uOpacity.value=w.parameters.opacity),t=new THREE.ShaderMaterial({fragmentShader:J.fragmentShader,vertexShader:J.vertexShader,uniforms:y,lights:!0,fog:!0})):t=new THREE[w.type](w.parameters);t.name=Z;A.materials[Z]=t}for(Z in B.materials)if(w=B.materials[Z],w.parameters.materials){L=[];for(s=0;s<w.parameters.materials.length;s++)L.push(A.materials[w.parameters.materials[s]]);
+A.materials[Z].materials=L}e();A.cameras&&B.defaults.camera&&(A.currentCamera=A.cameras[B.defaults.camera]);A.fogs&&B.defaults.fog&&(A.scene.fog=A.fogs[B.defaults.fog]);n.callbackSync(A);j()}};THREE.TextureLoader=function(a){this.manager=void 0!==a?a:THREE.DefaultLoadingManager};THREE.TextureLoader.prototype={constructor:THREE.TextureLoader,load:function(a,b){var c=new THREE.ImageLoader(this.manager);c.setCrossOrigin(this.crossOrigin);c.load(a,function(a){a=new THREE.Texture(a);a.needsUpdate=!0;void 0!==b&&b(a)})},setCrossOrigin:function(a){this.crossOrigin=a}};THREE.Material=function(){this.id=THREE.Math.generateUUID();this.name="";this.side=THREE.FrontSide;this.opacity=1;this.transparent=!1;this.blending=THREE.NormalBlending;this.blendSrc=THREE.SrcAlphaFactor;this.blendDst=THREE.OneMinusSrcAlphaFactor;this.blendEquation=THREE.AddEquation;this.depthWrite=this.depthTest=!0;this.polygonOffset=!1;this.overdraw=this.alphaTest=this.polygonOffsetUnits=this.polygonOffsetFactor=0;this.needsUpdate=this.visible=!0};
 THREE.Material.prototype={constructor:THREE.Material,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof
 THREE.Material.prototype={constructor:THREE.Material,addEventListener:THREE.EventDispatcher.prototype.addEventListener,hasEventListener:THREE.EventDispatcher.prototype.hasEventListener,removeEventListener:THREE.EventDispatcher.prototype.removeEventListener,dispatchEvent:THREE.EventDispatcher.prototype.dispatchEvent,setValues:function(a){if(void 0!==a)for(var b in a){var c=a[b];if(void 0===c)console.warn("THREE.Material: '"+b+"' parameter is undefined.");else if(b in this){var d=this[b];d instanceof
 THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;
 THREE.Color?d.set(c):d instanceof THREE.Vector3&&c instanceof THREE.Vector3?d.copy(c):this[b]="overdraw"==b?Number(c):c}}},clone:function(a){void 0===a&&(a=new THREE.Material);a.name=this.name;a.side=this.side;a.opacity=this.opacity;a.transparent=this.transparent;a.blending=this.blending;a.blendSrc=this.blendSrc;a.blendDst=this.blendDst;a.blendEquation=this.blendEquation;a.depthTest=this.depthTest;a.depthWrite=this.depthWrite;a.polygonOffset=this.polygonOffset;a.polygonOffsetFactor=this.polygonOffsetFactor;
 a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);
 a.polygonOffsetUnits=this.polygonOffsetUnits;a.alphaTest=this.alphaTest;a.overdraw=this.overdraw;a.visible=this.visible;return a},dispose:function(){this.dispatchEvent({type:"dispose"})}};THREE.LineBasicMaterial=function(a){THREE.Material.call(this);this.color=new THREE.Color(16777215);this.linewidth=1;this.linejoin=this.linecap="round";this.vertexColors=!1;this.fog=!0;this.setValues(a)};THREE.LineBasicMaterial.prototype=Object.create(THREE.Material.prototype);