Przeglądaj źródła

Merge pull request #11123 from Mugen87/examples

SceneLoader: Removal
Mr.doob 8 lat temu
rodzic
commit
2a166212f3

+ 0 - 1
examples/files.js

@@ -117,7 +117,6 @@ var files = {
 		"webgl_loader_sea3d_physics",
 		"webgl_loader_sea3d_skinning",
 		"webgl_loader_sea3d_sound",
-		"webgl_loader_scene",
 		"webgl_loader_stl",
 		"webgl_loader_utf8",
 		"webgl_loader_vrml",

+ 0 - 1132
examples/js/loaders/deprecated/SceneLoader.js

@@ -1,1132 +0,0 @@
-/**
- * @author alteredq / http://alteredqualia.com/
- */
-
-THREE.SceneLoader = function ( manager ) {
-
-	this.onLoadStart = function () {};
-	this.onLoadProgress = function() {};
-	this.onLoadComplete = function () {};
-
-	this.callbackSync = function () {};
-	this.callbackProgress = function () {};
-
-	this.geometryHandlers = {};
-	this.hierarchyHandlers = {};
-
-	this.addGeometryHandler( "ascii", THREE.JSONLoader );
-
-	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
-
-};
-
-THREE.SceneLoader.prototype = {
-
-	constructor: THREE.SceneLoader,
-
-	load: function ( url, onLoad, onProgress, onError ) {
-
-		var scope = this;
-
-		var loader = new THREE.FileLoader( scope.manager );
-		loader.load( url, function ( text ) {
-
-			scope.parse( JSON.parse( text ), onLoad, url );
-
-		}, onProgress, onError );
-
-	},
-
-	addGeometryHandler: function ( typeID, loaderClass ) {
-
-		this.geometryHandlers[ typeID ] = { "loaderClass": loaderClass };
-
-	},
-
-	addHierarchyHandler: function ( typeID, loaderClass ) {
-
-		this.hierarchyHandlers[ typeID ] = { "loaderClass": loaderClass };
-
-	},
-
-	parse: function ( json, callbackFinished, url ) {
-
-		var scope = this;
-
-		var urlBase = THREE.Loader.prototype.extractUrlBase( url );
-
-		var geometry, material, camera, fog,
-			texture, images, color,
-			light, hex, intensity,
-			counter_models, counter_textures,
-			total_models, total_textures,
-			result;
-
-		var target_array = [];
-
-		var data = json;
-
-		// async geometry loaders
-
-		for ( var typeID in this.geometryHandlers ) {
-
-			var loaderClass = this.geometryHandlers[ typeID ][ "loaderClass" ];
-			this.geometryHandlers[ typeID ][ "loaderObject" ] = new loaderClass();
-
-		}
-
-		// async hierachy loaders
-
-		for ( var typeID in this.hierarchyHandlers ) {
-
-			var loaderClass = this.hierarchyHandlers[ typeID ][ "loaderClass" ];
-			this.hierarchyHandlers[ typeID ][ "loaderObject" ] = new loaderClass();
-
-		}
-
-		counter_models = 0;
-		counter_textures = 0;
-
-		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 ( position ) {
-
-				result.scene.position.fromArray( position );
-
-			}
-
-			if ( rotation ) {
-
-				result.scene.rotation.fromArray( rotation );
-
-			}
-
-			if ( scale ) {
-
-				result.scene.scale.fromArray( scale );
-
-			}
-
-			if ( position || rotation || scale ) {
-
-				result.scene.updateMatrix();
-				result.scene.updateMatrixWorld();
-
-			}
-
-		}
-
-		function get_url( source_url, url_type ) {
-
-			if ( url_type == "relativeToHTML" ) {
-
-				return source_url;
-
-			} else {
-
-				return urlBase + source_url;
-
-			}
-
-		}
-
-		// toplevel loader function, delegates to handle_children
-
-		function handle_objects() {
-
-			handle_children( result.scene, data.objects );
-
-		}
-
-		// handle all the children from the loaded json and attach them to given parent
-
-		function handle_children( parent, children ) {
-
-			var mat, dst, pos, rot, scl, quat;
-
-			for ( var objID in children ) {
-
-				// check by id if child has already been handled,
-				// if not, create new object
-
-				var object = result.objects[ objID ];
-				var objJSON = children[ objID ];
-
-				if ( object === undefined ) {
-
-					// meshes
-
-					if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) {
-
-						if ( objJSON.loading === undefined ) {
-
-							material = result.materials[ objJSON.material ];
-
-							objJSON.loading = true;
-
-							var loader = scope.hierarchyHandlers[ objJSON.type ][ "loaderObject" ];
-
-							// ColladaLoader
-
-							if ( loader.options ) {
-
-								loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) );
-
-							// UTF8Loader
-							// OBJLoader
-
-							} else {
-
-								loader.load( get_url( objJSON.url, data.urlBaseType ), create_callback_hierachy( objID, parent, material, objJSON ) );
-
-							}
-
-						}
-
-					} else if ( objJSON.geometry !== undefined ) {
-
-						geometry = result.geometries[ objJSON.geometry ];
-
-						// geometry already loaded
-
-						if ( geometry ) {
-
-							material = result.materials[ objJSON.material ];
-
-							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
-
-							if ( ! objJSON.material ) {
-
-								material = new THREE.MultiMaterial( 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)
-
-							if ( ( material instanceof THREE.MultiMaterial ) && material.materials.length === 0 ) {
-
-								material = new THREE.MultiMaterial( result.face_materials[ objJSON.geometry ] );
-
-							}
-
-							if ( objJSON.skin ) {
-
-								object = new THREE.SkinnedMesh( geometry, material );
-
-							} else if ( objJSON.morph ) {
-
-								object = new THREE.MorphAnimMesh( geometry, material );
-
-								if ( objJSON.duration !== undefined ) {
-
-									object.duration = objJSON.duration;
-
-								}
-
-								if ( objJSON.time !== undefined ) {
-
-									object.time = objJSON.time;
-
-								}
-
-								if ( objJSON.mirroredLoop !== undefined ) {
-
-									object.mirroredLoop = objJSON.mirroredLoop;
-
-								}
-
-								if ( material.morphNormals ) {
-
-									geometry.computeMorphNormals();
-
-								}
-
-							} else {
-
-								object = new THREE.Mesh( geometry, material );
-
-							}
-
-							object.name = objID;
-
-							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 ]
-								);
-
-							} else {
-
-								object.position.fromArray( pos );
-
-								if ( quat ) {
-
-									object.quaternion.fromArray( quat );
-
-								} else {
-
-									object.rotation.fromArray( rot );
-
-								}
-
-								object.scale.fromArray( scl );
-
-							}
-
-							object.visible = objJSON.visible;
-							object.castShadow = objJSON.castShadow;
-							object.receiveShadow = objJSON.receiveShadow;
-
-							parent.add( object );
-
-							result.objects[ objID ] = object;
-
-						}
-
-					// lights
-
-					} else if ( objJSON.type === "AmbientLight" || objJSON.type === "PointLight" ||
-						objJSON.type === "DirectionalLight" || objJSON.type === "SpotLight" ||
-						objJSON.type === "HemisphereLight" ) {
-
-						var color = objJSON.color;
-						var intensity = objJSON.intensity;
-						var distance = objJSON.distance;
-						var position = objJSON.position;
-						var rotation = objJSON.rotation;
-
-						switch ( objJSON.type ) {
-
-							case 'AmbientLight':
-								light = new THREE.AmbientLight( color );
-								break;
-
-							case 'PointLight':
-								light = new THREE.PointLight( color, intensity, distance );
-								light.position.fromArray( position );
-								break;
-
-							case 'DirectionalLight':
-								light = new THREE.DirectionalLight( color, intensity );
-								light.position.fromArray( objJSON.direction );
-								break;
-
-							case 'SpotLight':
-								light = new THREE.SpotLight( color, intensity, distance );
-								light.angle = objJSON.angle;
-								light.position.fromArray( position );
-								light.target.set( position[ 0 ], position[ 1 ] - distance, position[ 2 ] );
-								light.target.applyEuler( new THREE.Euler( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ], 'XYZ' ) );
-								break;
-
-							case 'HemisphereLight':
-								light = new THREE.DirectionalLight( color, intensity, distance );
-								light.target.set( position[ 0 ], position[ 1 ] - distance, position[ 2 ] );
-								light.target.applyEuler( new THREE.Euler( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ], 'XYZ' ) );
-								break;
-
-						}
-
-						parent.add( light );
-
-						light.name = objID;
-						result.lights[ objID ] = light;
-						result.objects[ objID ] = light;
-
-					// cameras
-
-					} else if ( objJSON.type === "PerspectiveCamera" || objJSON.type === "OrthographicCamera" ) {
-
-						pos = objJSON.position;
-						rot = objJSON.rotation;
-						quat = objJSON.quaternion;
-
-						if ( objJSON.type === "PerspectiveCamera" ) {
-
-							camera = new THREE.PerspectiveCamera( objJSON.fov, objJSON.aspect, objJSON.near, objJSON.far );
-
-						} else if ( objJSON.type === "OrthographicCamera" ) {
-
-							camera = new THREE.OrthographicCamera( objJSON.left, objJSON.right, objJSON.top, objJSON.bottom, objJSON.near, objJSON.far );
-
-						}
-
-						camera.name = objID;
-						camera.position.fromArray( pos );
-
-						if ( quat !== undefined ) {
-
-							camera.quaternion.fromArray( quat );
-
-						} else if ( rot !== undefined ) {
-
-							camera.rotation.fromArray( rot );
-
-						} else if ( objJSON.target ) {
-
-							camera.lookAt( new THREE.Vector3().fromArray( objJSON.target ) );
-
-						}
-
-						parent.add( camera );
-
-						result.cameras[ objID ] = camera;
-						result.objects[ objID ] = camera;
-
-					// pure Object3D
-
-					} else {
-
-						pos = objJSON.position;
-						rot = objJSON.rotation;
-						scl = objJSON.scale;
-						quat = objJSON.quaternion;
-
-						object = new THREE.Object3D();
-						object.name = objID;
-						object.position.fromArray( pos );
-
-						if ( quat ) {
-
-							object.quaternion.fromArray( quat );
-
-						} else {
-
-							object.rotation.fromArray( rot );
-
-						}
-
-						object.scale.fromArray( scl );
-						object.visible = ( objJSON.visible !== undefined ) ? objJSON.visible : false;
-
-						parent.add( object );
-
-						result.objects[ objID ] = object;
-						result.empties[ objID ] = object;
-
-					}
-
-					if ( object ) {
-
-						if ( objJSON.userData !== undefined ) {
-
-							for ( var key in objJSON.userData ) {
-
-								var value = objJSON.userData[ key ];
-								object.userData[ key ] = value;
-
-							}
-
-						}
-
-						if ( objJSON.groups !== undefined ) {
-
-							for ( var i = 0; i < objJSON.groups.length; i ++ ) {
-
-								var groupID = objJSON.groups[ i ];
-
-								if ( result.groups[ groupID ] === undefined ) {
-
-									result.groups[ groupID ] = [];
-
-								}
-
-								result.groups[ groupID ].push( objID );
-
-							}
-
-						}
-
-					}
-
-				}
-
-				if ( object !== undefined && objJSON.children !== undefined ) {
-
-					handle_children( object, objJSON.children );
-
-				}
-
-			}
-
-		}
-
-		function handle_mesh( geo, mat, id ) {
-
-			result.geometries[ id ] = geo;
-			result.face_materials[ id ] = mat;
-			handle_objects();
-
-		}
-
-		function handle_hierarchy( node, id, parent, material, obj ) {
-
-			var p = obj.position;
-			var r = obj.rotation;
-			var q = obj.quaternion;
-			var s = obj.scale;
-
-			node.position.fromArray( p );
-
-			if ( q ) {
-
-				node.quaternion.fromArray( q );
-
-			} else {
-
-				node.rotation.fromArray( r );
-
-			}
-
-			node.scale.fromArray( s );
-
-			// override children materials
-			// if object material was specified in JSON explicitly
-
-			if ( material ) {
-
-				node.traverse( function ( child ) {
-
-					child.material = material;
-
-				} );
-
-			}
-
-			// override children visibility
-			// with root node visibility as specified in JSON
-
-			var visible = ( obj.visible !== undefined ) ? obj.visible : true;
-
-			node.traverse( function ( child ) {
-
-				child.visible = visible;
-
-			} );
-
-			parent.add( node );
-
-			node.name = id;
-
-			result.objects[ id ] = node;
-			handle_objects();
-
-		}
-
-		function create_callback_geometry( id ) {
-
-			return function ( geo, mat ) {
-
-				geo.name = id;
-
-				handle_mesh( geo, mat, id );
-
-				counter_models -= 1;
-
-				scope.onLoadComplete();
-
-				async_callback_gate();
-
-			}
-
-		}
-
-		function create_callback_hierachy( id, parent, material, obj ) {
-
-			return function ( event ) {
-
-				var result;
-
-				// loaders which use EventDispatcher
-
-				if ( event.content ) {
-
-					result = event.content;
-
-				// ColladaLoader
-
-				} else if ( event.dae ) {
-
-					result = event.scene;
-
-
-				// UTF8Loader
-
-				} else {
-
-					result = event;
-
-				}
-
-				handle_hierarchy( result, id, parent, material, obj );
-
-				counter_models -= 1;
-
-				scope.onLoadComplete();
-
-				async_callback_gate();
-
-			}
-
-		}
-
-		function create_callback_embed( id ) {
-
-			return function ( geo, mat ) {
-
-				geo.name = id;
-
-				result.geometries[ id ] = geo;
-				result.face_materials[ id ] = mat;
-
-			}
-
-		}
-
-		function async_callback_gate() {
-
-			var progress = {
-
-				totalModels : total_models,
-				totalTextures : total_textures,
-				loadedModels : total_models - counter_models,
-				loadedTextures : total_textures - counter_textures
-
-			};
-
-			scope.callbackProgress( progress, result );
-
-			scope.onLoadProgress();
-
-			if ( counter_models === 0 && counter_textures === 0 ) {
-
-				finalize();
-				callbackFinished( result );
-
-			}
-
-		}
-
-		function finalize() {
-
-			// take care of targets which could be asynchronously loaded objects
-
-			for ( var i = 0; i < target_array.length; i ++ ) {
-
-				var ta = target_array[ i ];
-
-				var target = result.objects[ ta.targetName ];
-
-				if ( target ) {
-
-					ta.object.target = target;
-
-				} else {
-
-					// 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;
-
-			}
-
-		}
-
-		var callbackTexture = function ( count ) {
-
-			counter_textures -= count;
-			async_callback_gate();
-
-			scope.onLoadComplete();
-
-		};
-
-		// must use this instead of just directly calling callbackTexture
-		// because of closure in the calling context loop
-
-		var generateTextureCallback = function ( count ) {
-
-			return function () {
-
-				callbackTexture( count );
-
-			};
-
-		};
-
-		function traverse_json_hierarchy( objJSON, callback ) {
-
-			callback( objJSON );
-
-			if ( objJSON.children !== undefined ) {
-
-				for ( var objChildID in objJSON.children ) {
-
-					traverse_json_hierarchy( objJSON.children[ objChildID ], callback );
-
-				}
-
-			}
-
-		}
-
-		// first go synchronous elements
-
-		// fogs
-
-		var fogID, fogJSON;
-
-		for ( fogID in data.fogs ) {
-
-			fogJSON = data.fogs[ fogID ];
-
-			if ( fogJSON.type === "linear" ) {
-
-				fog = new THREE.Fog( 0x000000, fogJSON.near, fogJSON.far );
-
-			} else if ( fogJSON.type === "exp2" ) {
-
-				fog = new THREE.FogExp2( 0x000000, fogJSON.density );
-
-			}
-
-			color = fogJSON.color;
-			fog.color.setRGB( color[ 0 ], color[ 1 ], color[ 2 ] );
-
-			result.fogs[ fogID ] = fog;
-
-		}
-
-		// now come potentially asynchronous elements
-
-		// geometries
-
-		// count how many geometries will be loaded asynchronously
-
-		var geoID, geoJSON;
-
-		for ( geoID in data.geometries ) {
-
-			geoJSON = data.geometries[ geoID ];
-
-			if ( geoJSON.type in this.geometryHandlers ) {
-
-				counter_models += 1;
-
-				scope.onLoadStart();
-
-			}
-
-		}
-
-		// count how many hierarchies will be loaded asynchronously
-
-		for ( var objID in data.objects ) {
-
-			traverse_json_hierarchy( data.objects[ objID ], function ( objJSON ) {
-
-				if ( objJSON.type && ( objJSON.type in scope.hierarchyHandlers ) ) {
-
-					counter_models += 1;
-
-					scope.onLoadStart();
-
-				}
-
-			} );
-
-		}
-
-		total_models = counter_models;
-
-		for ( geoID in data.geometries ) {
-
-			geoJSON = data.geometries[ geoID ];
-
-			if ( geoJSON.type === "cube" ) {
-
-				geometry = new THREE.BoxGeometry( geoJSON.width, geoJSON.height, geoJSON.depth, geoJSON.widthSegments, geoJSON.heightSegments, geoJSON.depthSegments );
-				geometry.name = geoID;
-				result.geometries[ geoID ] = geometry;
-
-			} else if ( geoJSON.type === "plane" ) {
-
-				geometry = new THREE.PlaneGeometry( geoJSON.width, geoJSON.height, geoJSON.widthSegments, geoJSON.heightSegments );
-				geometry.name = geoID;
-				result.geometries[ geoID ] = geometry;
-
-			} else if ( geoJSON.type === "sphere" ) {
-
-				geometry = new THREE.SphereGeometry( geoJSON.radius, geoJSON.widthSegments, geoJSON.heightSegments );
-				geometry.name = geoID;
-				result.geometries[ geoID ] = geometry;
-
-			} 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;
-
-			} else if ( geoJSON.type === "torus" ) {
-
-				geometry = new THREE.TorusGeometry( geoJSON.radius, geoJSON.tube, geoJSON.segmentsR, geoJSON.segmentsT );
-				geometry.name = geoID;
-				result.geometries[ geoID ] = geometry;
-
-			} else if ( geoJSON.type === "icosahedron" ) {
-
-				geometry = new THREE.IcosahedronGeometry( geoJSON.radius, geoJSON.subdivisions );
-				geometry.name = geoID;
-				result.geometries[ geoID ] = geometry;
-
-			} else if ( geoJSON.type in this.geometryHandlers ) {
-
-				var loader = this.geometryHandlers[ geoJSON.type ][ "loaderObject" ];
-				loader.load( get_url( geoJSON.url, data.urlBaseType ), create_callback_geometry( geoID ) );
-
-			} else if ( geoJSON.type === "embedded" ) {
-
-				var modelJson = data.embeds[ geoJSON.id ],
-					texture_path = "";
-
-				// pass metadata along to jsonLoader so it knows the format version
-
-				modelJson.metadata = data.metadata;
-
-				if ( modelJson ) {
-
-					var jsonLoader = this.geometryHandlers[ "ascii" ][ "loaderObject" ];
-					var model = jsonLoader.parse( modelJson, texture_path );
-					create_callback_embed( geoID )( model.geometry, model.materials );
-
-				}
-
-			}
-
-		}
-
-		// textures
-
-		// count how many textures will be loaded asynchronously
-
-		var textureID, textureJSON;
-
-		for ( textureID in data.textures ) {
-
-			textureJSON = data.textures[ textureID ];
-
-			if ( Array.isArray( textureJSON.url ) ) {
-
-				counter_textures += textureJSON.url.length;
-
-				for ( var n = 0; n < textureJSON.url.length; n ++ ) {
-
-					scope.onLoadStart();
-
-				}
-
-			} else {
-
-				counter_textures += 1;
-
-				scope.onLoadStart();
-
-			}
-
-		}
-
-		total_textures = counter_textures;
-
-		for ( textureID in data.textures ) {
-
-			textureJSON = data.textures[ textureID ];
-
-			if ( textureJSON.mapping !== undefined && THREE[ textureJSON.mapping ] !== undefined ) {
-
-				textureJSON.mapping = THREE[ textureJSON.mapping ];
-
-			}
-
-			var texture;
-
-			if ( Array.isArray( textureJSON.url ) ) {
-
-				var count = textureJSON.url.length;
-				var urls = [];
-
-				for ( var i = 0; i < count; i ++ ) {
-
-					urls[ i ] = get_url( textureJSON.url[ i ], data.urlBaseType );
-
-				}
-
-				var loader = THREE.Loader.Handlers.get( urls[ 0 ] );
-
-				if ( loader !== null ) {
-
-					texture = loader.load( urls, generateTextureCallback( count ) );
-
-					if ( textureJSON.mapping !== undefined )
-						texture.mapping = textureJSON.mapping;
-
-				} else {
-
-					texture = new THREE.CubeTextureLoader().load( urls, generateTextureCallback( count ) );
-					texture.mapping = textureJSON.mapping;
-
-				}
-
-			} else {
-
-				var fullUrl = get_url( textureJSON.url, data.urlBaseType );
-				var textureCallback = generateTextureCallback( 1 );
-
-				var loader = THREE.Loader.Handlers.get( fullUrl );
-
-				if ( loader !== null ) {
-
-					texture = loader.load( fullUrl, textureCallback );
-
-				} else {
-
-					texture = new THREE.Texture();
-					loader = new THREE.ImageLoader();
-
-					( function ( texture ) {
-
-						loader.load( fullUrl, function ( image ) {
-
-							texture.image = image;
-							texture.needsUpdate = true;
-
-							textureCallback();
-
-						} );
-
-					} )( texture )
-
-
-				}
-
-				if ( textureJSON.mapping !== undefined )
-					texture.mapping = textureJSON.mapping;
-
-				if ( THREE[ textureJSON.minFilter ] !== undefined )
-					texture.minFilter = THREE[ textureJSON.minFilter ];
-
-				if ( THREE[ textureJSON.magFilter ] !== undefined )
-					texture.magFilter = THREE[ textureJSON.magFilter ];
-
-				if ( textureJSON.anisotropy ) texture.anisotropy = textureJSON.anisotropy;
-
-				if ( textureJSON.repeat ) {
-
-					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.offset ) {
-
-					texture.offset.set( textureJSON.offset[ 0 ], textureJSON.offset[ 1 ] );
-
-				}
-
-				// handle wrap after repeat so that default repeat can be overriden
-
-				if ( textureJSON.wrap ) {
-
-					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;
-
-		}
-
-		// materials
-
-		var matID, matJSON;
-		var parID;
-
-		for ( matID in data.materials ) {
-
-			matJSON = data.materials[ matID ];
-
-			for ( parID in matJSON.parameters ) {
-
-				if ( parID === "envMap" || parID === "map" || parID === "lightMap" || parID === "bumpMap" || parID === "normalMap" || parID === "alphaMap" ) {
-
-					matJSON.parameters[ parID ] = result.textures[ matJSON.parameters[ parID ] ];
-
-				} else if ( parID === "shading" ) {
-
-					matJSON.parameters[ parID ] = ( matJSON.parameters[ parID ] === "flat" ) ? THREE.FlatShading : THREE.SmoothShading;
-
-				} else if ( parID === "side" ) {
-
-					if ( matJSON.parameters[ parID ] == "double" ) {
-
-						matJSON.parameters[ parID ] = THREE.DoubleSide;
-
-					} else if ( matJSON.parameters[ parID ] == "back" ) {
-
-						matJSON.parameters[ parID ] = THREE.BackSide;
-
-					} 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" ) {
-
-					matJSON.parameters[ parID ] = matJSON.parameters[ parID ] in THREE ? THREE[ matJSON.parameters[ parID ] ] : THREE.MultiplyOperation;
-
-				} else if ( parID === "vertexColors" ) {
-
-					if ( matJSON.parameters[ parID ] == "face" ) {
-
-						matJSON.parameters[ parID ] = THREE.FaceColors;
-
-					// default to vertex colors if "vertexColors" is anything else face colors or 0 / null / false
-
-					} else if ( matJSON.parameters[ parID ] ) {
-
-						matJSON.parameters[ parID ] = THREE.VertexColors;
-
-					}
-
-				} else if ( parID === "wrapRGB" ) {
-
-					var v3 = matJSON.parameters[ parID ];
-					matJSON.parameters[ parID ] = new THREE.Vector3( v3[ 0 ], v3[ 1 ], v3[ 2 ] );
-
-				} else if ( parID === "normalScale" ) {
-
-					var v2 = matJSON.parameters[ parID ];
-					matJSON.parameters[ parID ] = new THREE.Vector2( v2[ 0 ], v2[ 1 ] );
-
-				}
-
-			}
-
-			if ( matJSON.parameters.opacity !== undefined && matJSON.parameters.opacity < 1.0 ) {
-
-				matJSON.parameters.transparent = true;
-
-			}
-
-			material = new THREE[ matJSON.type ]( matJSON.parameters );
-			material.name = matID;
-
-			result.materials[ matID ] = material;
-
-		}
-
-		// second pass through all materials to initialize MultiMaterials
-		// that could be referring to other materials out of order
-
-		for ( matID in data.materials ) {
-
-			matJSON = data.materials[ matID ];
-
-			if ( matJSON.parameters.materials ) {
-
-				var materialArray = [];
-
-				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;
-
-			}
-
-		}
-
-		// objects ( synchronous init of procedural primitives )
-
-		handle_objects();
-
-		// defaults
-
-		if ( result.cameras && data.defaults.camera ) {
-
-			result.currentCamera = result.cameras[ data.defaults.camera ];
-
-		}
-
-		if ( result.fogs && data.defaults.fog ) {
-
-			result.scene.fog = result.fogs[ data.defaults.fog ];
-
-		}
-
-		// synchronous callback
-
-		scope.callbackSync( result );
-
-		// just in case there are no async elements
-
-		async_callback_gate();
-
-	}
-
-};

+ 0 - 769
examples/scenes/test_scene.js

@@ -1,769 +0,0 @@
-{
-
-	"metadata": {
-		"formatVersion": 3.2,
-		"type" : "scene"
-	},
-
-	"urlBaseType" : "relativeToHTML",
-
-	"objects": {
-
-		"group" : {
-			"position" : [ 0, 0, 0 ],
-			"rotation" : [ 0, 0, 0 ],
-			"scale"	   : [ 1, 1, 1 ],
-			"visible"  : true,
-			"children" : {
-
-				"cube1" : {
-					"geometry" : "cubeNormals",
-					"material" : "phong_red",
-					"position" : [ 0, 0, 0 ],
-					"rotation" : [ 0, -0.3, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true,
-					"userData" : {
-						"rotating" : true,
-						"rotateX"  : true,
-						"rotateY"  : true
-					}
-				},
-
-				"cube2" : {
-					"geometry" : "cubeWire",
-					"material" : "basic_white",
-					"position" : [ 0, 0, 0 ],
-					"rotation" : [ 0, -0.3, 0 ],
-					"scale"	   : [ 2, 2, 2 ],
-					"visible"  : true
-				},
-
-				"cube3" : {
-					"geometry" : "cube",
-					"material" : "minecraft",
-					"position" : [ -30, -5, 25 ],
-					"rotation" : [ 0, 0.8, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"sphere_lambert" : {
-					"geometry" : "sphere",
-					"material" : "lambert_green",
-					"position" : [ -20, -5, 15 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"sphere_refraction" : {
-					"geometry" : "sphere",
-					"material" : "basic_refraction",
-					"position" : [ 50, 45, -50 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"icosahedron" : {
-					"geometry" : "icosahedron",
-					"material" : "faceted_white",
-					"position" : [ 20, 10, -60 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"torus" : {
-					"geometry" : "torus",
-					"material" : "phong_orange",
-					"position" : [ -20, 5, -50 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 2, 2, 2 ],
-					"visible"  : true
-				},
-
-				"cone" : {
-					"geometry" : "cone",
-					"material" : "lambert_blue",
-					"position" : [ -50, 15, -50 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"cylinder" : {
-					"geometry" : "cylinder",
-					"material" : "lambert_blue",
-					"position" : [ 50, 15, -50 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"colorcube1" : {
-					"geometry" : "colorcube",
-					"material" : "face",
-					"position" : [ -10, -5, 30 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 5, 5, 5 ],
-					"visible"  : true,
-					"children" : {
-						"colorcube2" : {
-							"geometry" : "colorcube",
-							"material" : "face",
-							"position" : [ 0, 2, 0 ],
-							"rotation" : [ 0.1, 0.1, 0.1 ],
-							"scale"	: [ 0.5, 0.5, 0.5 ],
-							"visible"  : true,
-							"children" : {
-								"colorcube3" : {
-									"geometry" : "colorcube",
-									"material" : "face",
-									"position" : [ 0, 2, 0 ],
-									"rotation" : [ 0.1, 0.1, 0.1 ],
-									"scale"	: [ 0.5, 0.5, 0.5 ],
-									"visible"  : true,
-									"children" : {
-										"colorcube4" : {
-											"geometry" : "colorcube",
-											"material" : "face",
-											"position" : [ 0, 2, 0 ],
-											"rotation" : [ 0.1, 0.1, 0.1 ],
-											"scale"	: [ 0.5, 0.5, 0.5 ],
-											"visible"  : true
-										}
-									}
-								}
-							}
-						}
-					}
-				},
-
-				"veyron" : {
-					"geometry" : "veyron",
-					"material" : "multi_veyron",
-					"position" : [ 40, -1, 0 ],
-					"rotation" : [ 0, 0.3, 0 ],
-					"scale"	   : [ 0.25, 0.25, 0.25 ],
-					"visible"  : true
-				},
-
-				"walt" : {
-					"geometry" : "WaltHead",
-					"material" : "lambert_cube",
-					"position" : [ -75, 10, -30 ],
-					"rotation" : [ 0, 0.5, 0 ],
-					"scale"	   : [ 0.5, 0.5, 0.5 ],
-					"visible"  : true
-				},
-
-				"ben" : {
-					"geometry" : "ben",
-					"material" : "phong_ben",
-					"position" : [ -45, -10, 0 ],
-					"rotation" : [ 0, 0.5, 0 ],
-					"scale"	   : [ 55, 55, 55 ],
-					"visible"  : true
-				},
-
-				"sittingBox" : {
-					"geometry" : "sittingBox",
-					"material" : "phong_morph",
-					"position" : [ -60, -10, 10 ],
-					"rotation" : [ 0, 0.5, 0 ],
-					"scale"	   : [ 23, 23, 23 ],
-					"visible"  : true,
-					"morph"	   : true,
-					"duration" : 8000,
-					"mirroredLoop" : true
-				},
-
-				"knight" : {
-					"geometry" : "knight",
-					"material" : "phong_skin",
-					"position" : [ 70, -10, 10 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 2.5, 2.5, 2.5 ],
-					"visible"  : true,
-					"skin"	   : true
-				},
-
-				"man" : {
-					"type": "obj",
-					"url" : "obj/male02/male02.obj",
-					"material" : "phong_man",
-					"position" : [ -10, -10, -25 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 0.2, 0.2, 0.2 ],
-					"visible"  : true
-				},
-
-				"man_clone_1" : {
-					"geometry" : "man",
-					"material" : "multi_1",
-					"position" : [ 2.5, -10, -25 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 0.2, 0.2, 0.2 ],
-					"visible"  : true
-				},
-
-				"man_clone_2" : {
-					"geometry" : "man",
-					"material" : "multi_2",
-					"position" : [ 15, -10, -25 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 0.2, 0.2, 0.2 ],
-					"visible"  : true
-				},
-
-				"monster" : {
-					"type": "dae",
-					"url" : "models/collada/monster/monster.dae",
-					"position" : [ -43, -10, 27 ],
-					"rotation" : [ -1.57, 0, 0 ],
-					"scale"	   : [ 0.01, 0.01, 0.01 ],
-					"visible"  : true
-				},
-
-				"hand" : {
-					"type" : "utf8",
-					"url"  : "models/utf8/hand.js",
-					"material" : "phong_hand",
-					"position" : [ -28, -1, 29 ],
-					"rotation" : [ 0, 0.5, 0 ],
-					"scale"	   : [ 12, 12, 12 ],
-					"visible"  : true,
-					"userData" : {
-						"rotating" : true,
-						"rotateY"  : true
-					}
-				},
-
-				"bunny" : {
-					"geometry" : "bunny",
-					"material" : "phong_bunny",
-					"position" : [ -25, -14, 0 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 100, 100, 100 ],
-					"visible"  : true
-				},
-
-				"disk" : {
-					"geometry" : "disk",
-					"material" : "phong_disk",
-					"position" : [ 7, -10, 30 ],
-					"rotation" : [ 1.57, 0, 0 ],
-					"scale"	   : [ 10, 10, 10 ],
-					"visible"  : true
-				},
-
-				"quad_bg" : {
-					"geometry" : "quad",
-					"material" : "textured_bg",
-					"position" : [ 0, 15, -90 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 20, 20, 20 ],
-					"visible"  : true
-				},
-
-				"quad_texture1" : {
-					"geometry" : "quad",
-					"material" : "textured_compressed_dxt3",
-					"position" : [ 15, -5, 20 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"quad_texture2" : {
-					"geometry" : "quad",
-					"material" : "textured_compressed_dxt5",
-					"position" : [ 15, -5, 25 ],
-					"rotation" : [ 0, 0, 0 ],
-					"scale"	   : [ 1, 1, 1 ],
-					"visible"  : true
-				},
-
-				"ground" : {
-					"geometry" : "plane",
-					"material" : "basic_gray",
-					"position" : [ 0, -10, 0 ],
-					"rotation" : [ -1.57, 0, 0 ],
-					"scale"	   : [ 100, 100, 100 ],
-					"visible"  : true
-				},
-
-				"light1": {
-					"type"		 : "DirectionalLight",
-					"direction"	 : [ 0, 1, 1 ],
-					"color" 	 : 16777215,
-					"intensity"	 : 1
-				},
-
-				"light2": {
-					"type"	  : "PointLight",
-					"position": [ 0, 0, 0 ],
-					"color"   : 16777215,
-					"intensity"	 : 1.25
-				},
-
-				"camera1": {
-					"type"  : "PerspectiveCamera",
-					"fov"   : 50,
-					"aspect": 1.33333,
-					"near"  : 1,
-					"far"   : 1000,
-					"position": [ 0, 0, 100 ],
-					"target"  : [ 0, 0, 0 ]
-				},
-
-				"camera2": {
-					"type"  : "OrthographicCamera",
-					"left"  : 0,
-					"right" : 1024,
-					"top"   : 0,
-					"bottom": 1024,
-					"near"  : 1,
-					"far"   : 1000,
-					"position": [ 0, 0, 0 ],
-					"target"  : [ 0, 0, 0 ]
-				}
-			}
-		}
-
-	},
-
-	"geometries": {
-
-		"cube": {
-			"type"  : "cube",
-			"width" : 10,
-			"height": 10,
-			"depth" : 10,
-			"widthSegments"  : 1,
-			"heightSegments" : 1,
-			"depthSegments"  : 1
-		},
-
-		"cubeNormals": {
-			"type"  : "cube",
-			"width" : 10,
-			"height": 10,
-			"depth" : 10,
-			"widthSegments"  : 1,
-			"heightSegments" : 1,
-			"depthSegments"  : 1
-		},
-
-		"cubeWire": {
-			"type"  : "cube",
-			"width" : 10,
-			"height": 10,
-			"depth" : 10,
-			"widthSegments"  : 1,
-			"heightSegments" : 1,
-			"depthSegments"  : 1
-		},
-
-		"plane": {
-			"type"   : "plane",
-			"width"  : 10,
-			"height" : 10,
-			"widthSegments"  : 50,
-			"heightSegments" : 50
-		},
-
-		"quad": {
-			"type"   : "plane",
-			"width"  : 10,
-			"height" : 10,
-			"widthSegments"  : 1,
-			"heightSegments" : 1
-		},
-
-		"sphere": {
-			"type"	: "sphere",
-			"radius"  : 5,
-			"widthSegments"  : 32,
-			"heightSegments" : 16
-		},
-
-		"sphere_uvs": {
-			"type"	: "sphere",
-			"radius"  : 5,
-			"widthSegments"  : 32,
-			"heightSegments" : 16
-		},
-
-		"icosahedron": {
-			"type"	: "icosahedron",
-			"radius"  : 20,
-			"subdivisions"  : 2
-		},
-
-		"torus": {
-			"type"	: "torus",
-			"radius"  : 5,
-			"tube"	  : 2,
-			"segmentsR" : 16,
-			"segmentsT" : 32
-		},
-
-		"cylinder": {
-			"type"	: "cylinder",
-			"topRad"   : 5,
-			"botRad"   : 5,
-			"height"   : 50,
-			"radSegs"  : 32,
-			"heightSegs": 1
-		},
-
-		"cone": {
-			"type"	: "cylinder",
-			"topRad"   : 0,
-			"botRad"   : 5,
-			"height"   : 50,
-			"radSegs"  : 32,
-			"heightSegs" : 1
-		},
-
-		"WaltHead": {
-			"type": "binary",
-			"url" : "obj/walt/WaltHead_bin.js"
-		},
-
-		"veyron": {
-			"type": "binary",
-			"url" : "obj/veyron/VeyronNoUv_bin.js"
-		},
-
-		"sittingBox": {
-			"type": "ascii",
-			"url" : "models/animated/sittingBox.js"
-		},
-
-		"knight": {
-			"type": "ascii",
-			"url" : "models/skinned/knight.js"
-		},
-
-		"man": {
-			"type": "binary",
-			"url" : "obj/male02/Male02_bin.js"
-		},
-
-		"ben": {
-			"type": "ctm",
-			"url" : "models/ctm/ben.ctm",
-			"useWorkers" : true
-		},
-
-		"bunny": {
-			"type": "vtk",
-			"url" : "models/vtk/bunny.vtk"
-		},
-
-		"disk": {
-			"type": "stl",
-			"url" : "models/stl/ascii/slotted_disk.stl"
-		},
-
-		"colorcube": {
-			"type": "embedded",
-			"id"  : "cube_fvc"
-		}
-
-	},
-
-	"embeds": {
-
-		"cube_fvc": {
-
-			"metadata" : {
-				"formatVersion" : 3
-			},
-
-			"scale" : 1.0,
-
-			"materials": [{
-				"DbgColor" : 15658734,
-				"DbgIndex" : 0,
-				"DbgName" : "Material",
-				"colorDiffuse" : [0.8, 0.8, 0.8],
-				"colorSpecular" : [0.5, 0.5, 0.5],
-				"specularCoef" : 50,
-				"opacity" : 1.0,
-				"vertexColors" : true
-			}],
-
-			"vertices": [1.000000,-1.000000,-1.000000,1.000000,-1.000000,1.000000,-1.000000,-1.000000,1.000000,-1.000000,-1.000000,-1.000000,1.000000,1.000000,-1.000000,0.999999,1.000000,1.000001,-1.000000,1.000000,1.000000,-1.000000,1.000000,-1.000000],
-
-			"morphTargets": [],
-
-			"normals": [],
-
-			"colors": [16777215,16769421,16769424,8454135,15195931,7299839,16586715,16711687,1056014,6029475,13762484,9044089,7962349,6772991,16774622,4144383,11973887,1966063,1056285,9081232,13696943,5002581],
-
-			"uvs": [[]],
-
-			"faces": [131,0,1,2,3,0,0,1,2,3,131,4,7,6,5,0,4,5,6,7,131,0,4,5,1,0,0,8,9,10,131,1,5,6,2,0,0,11,12,13,131,2,6,7,3,0,14,15,16,17,131,4,0,3,7,0,18,19,20,21]
-
-		}
-
-	},
-
-	"materials": {
-
-		"basic_gray": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 6710886, "wireframe": true }
-		},
-
-		"basic_white": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "wireframe": true }
-		},
-
-		"faceted_white": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 16777215, "shading": "flat" }
-		},
-
-		"phong_red": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 16711680, "specular": 16711680, "shininess": 25, "bumpMap": "texture_bump", "bumpScale": -0.75 }
-		},
-
-		"phong_ben": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 1118481, "specular": 5601245, "shininess": 12, "bumpMap": "texture_bump_repeat", "bumpScale": 0.125 }
-		},
-
-		"phong_man": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 16737894, "specular": 2236962, "shininess": 40 }
-		},
-
-		"phong_hand": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 14531481, "specular": 2236962, "shininess": 40 }
-		},
-
-		"phong_bunny": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 16777215, "specular": 1118481, "shininess": 10 }
-		},
-
-		"phong_monster": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 16777215, "specular": 1118481, "shininess": 10 }
-		},
-
-		"phong_disk": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 16733491, "specular": 1118481, "shininess": 30, "wireframe": false }
-		},
-
-		"phong_morph": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.125, "combine": "MixOperation", "shading": "flat", "side": "double", "morphTargets": true }
-		},
-
-		"phong_skin": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 0, "specular": 16777215, "shininess": 50, "envMap": "cube_reflection", "reflectivity": 0.5, "combine": "MixOperation", "skinning": true, "morphTargets": true }
-		},
-
-		"lambert_green": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 30481, "blending": "AdditiveBlending", "transparent": true }
-		},
-
-		"lambert_blue": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 21930 }
-		},
-
-		"phong_orange": {
-			"type": "MeshPhongMaterial",
-			"parameters": { "color": 0, "specular": 11162880 }
-		},
-
-		"basic_refraction": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "envMap": "cube_refraction", "refractionRatio": 0.95 }
-		},
-
-		"lambert_cube": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 16737792, "envMap": "cube_reflection", "combine": "MixOperation", "reflectivity": 0.3 }
-		},
-
-		"chrome": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 16777215, "envMap": "cube_reflection" }
-		},
-
-		"darkerchrome": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 2236962, "envMap": "cube_reflection" }
-		},
-
-		"glass": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 1052742, "envMap": "cube_reflection", "opacity": 0.25, "transparent": true }
-		},
-
-		"interior": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 328965 }
-		},
-
-		"backlights": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 16711680, "opacity": 0.5 }
-		},
-
-		"backsignals": {
-			"type": "MeshLambertMaterial",
-			"parameters": { "color": 16759552, "opacity": 0.5 }
-		},
-
-		"textured_bg": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "map": "texture_bg" }
-		},
-
-		"textured_compressed_dxt3": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "map": "texture_compressed_dxt3", "transparent": true }
-		},
-
-		"textured_compressed_dxt5": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "map": "texture_compressed_dxt5", "transparent": true, "blending": "AdditiveBlending" }
-		},
-
-		"minecraft": {
-			"type": "MeshBasicMaterial",
-			"parameters": { "color": 16777215, "map": "texture_minecraft" }
-		},
-
-		"face": {
-			"type": "MultiMaterial",
-			"parameters": {}
-		},
-
-		"multi_1": {
-			"type": "MultiMaterial",
-			"parameters": {}
-		},
-
-		"multi_2": {
-			"type": "MultiMaterial",
-			"parameters": { "materials": [ "basic_refraction", "phong_man", "phong_hand", "minecraft", "backsignals" ] }
-		},
-
-		"multi_veyron": {
-			"type": "MultiMaterial",
-			"parameters": { "materials": [ "interior", "chrome", "darkerchrome", "glass", "chrome", "chrome", "backlights", "backsignals" ] }
-		}
-
-	},
-
-	"textures": {
-
-		"cube_reflection": {
-			"url": [
-				"textures/cube/SwedishRoyalCastle/px.jpg",
-				"textures/cube/SwedishRoyalCastle/nx.jpg",
-				"textures/cube/SwedishRoyalCastle/py.jpg",
-				"textures/cube/SwedishRoyalCastle/ny.jpg",
-				"textures/cube/SwedishRoyalCastle/pz.jpg",
-				"textures/cube/SwedishRoyalCastle/nz.jpg"
-			]
-		},
-
-		"cube_refraction": {
-			"url": [
-				"textures/cube/SwedishRoyalCastle/px.jpg",
-				"textures/cube/SwedishRoyalCastle/nx.jpg",
-				"textures/cube/SwedishRoyalCastle/py.jpg",
-				"textures/cube/SwedishRoyalCastle/ny.jpg",
-				"textures/cube/SwedishRoyalCastle/nz.jpg",
-				"textures/cube/SwedishRoyalCastle/pz.jpg"
-			],
-			"mapping": "CubeRefractionMapping"
-		},
-
-		"texture_bg": {
-			"url": "textures/cube/SwedishRoyalCastle/pz.jpg",
-			"anisotropy": 4
-		},
-
-		"texture_compressed_dxt3": {
-			"url": "textures/compressed/hepatica_dxt3_mip.dds",
-			"anisotropy": 4
-		},
-
-		"texture_compressed_dxt5": {
-			"url": "textures/compressed/explosion_dxt5_mip.dds",
-			"anisotropy": 4
-		},
-
-		"texture_bump": {
-			"url": "textures/water.jpg",
-			"anisotropy": 4
-		},
-
-		"texture_bump_repeat": {
-			"url": "textures/water.jpg",
-			"repeat" : [ 20, 20 ],
-			"anisotropy": 4
-		},
-
-		"texture_bump_repeat_2": {
-			"url": "textures/water.jpg",
-			"repeat" : [ 4, 2 ],
-			"anisotropy": 4
-		},
-
-		"texture_minecraft": {
-			"url": "textures/minecraft/grass.png",
-			"magFilter": "NearestFilter",
-			"minFilter": "LinearMipMapLinearFilter"
-		}
-
-	},
-
-	"fogs":	{
-		"basic": {
-			"type": "linear",
-			"color": [1,0,0],
-			"near": 1,
-			"far": 1000
-		},
-
-		"exponential": {
-			"type": "exp2",
-			"color": [1,1,1],
-			"density": 0.005
-		},
-
-		"black": {
-			"type": "exp2",
-			"color": [0,0,0],
-			"density": 0.005
-		}
-	},
-
-	"defaults": {
-		"bgcolor": [0,0,0],
-		"bgalpha": 1,
-		"camera": "camera1",
-		"fog": "black"
-	}
-
-}

+ 0 - 374
examples/webgl_loader_scene.html

@@ -1,374 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<title>three.js webgl - io - scene loader</title>
-		<meta charset="utf-8">
-		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
-		<style>
-			body {
-				background:#000;
-				color:#fff;
-				padding:0;
-				margin:0;
-				overflow:hidden;
-				font-family:georgia;
-				text-align:center;
-			}
-
-			#info {
-				position: absolute;
-				top: 0px; width: 100%;
-				padding: 5px;
-				font-family: Monospace;
-				font-size: 13px;
-				text-align: center;
-				z-index:100;
-			}
-
-			#progress {
-				color:red;
-				top:7em;
-				width: 100%;
-				font-size:3em;
-				font-variant:small-caps;
-				font-weight:bold;
-				position:absolute;
-				z-index:100;
-				text-align: center;
-				text-shadow: #000 0px 0px 10px;
-				display:none;
-			}
-
-			.shadow {
-				-moz-box-shadow: 0px 0px 5px #000;
-				-webkit-box-shadow: 0px 0px 5px #000;
-				box-shadow: 0px 0px 5px #000;
-			}
-
-			#progressbar {
-				text-align: center;
-				background: white;
-				width: 250px;
-				height: 10px;
-			}
-
-			#bar {
-				background:#d00;
-				width:50px;
-				height:10px;
-			}
-
-			.enabled {
-				color: lime!important;
-				cursor:pointer;
-			}
-
-			.enabled:hover {
-				text-shadow: #0f0 0px 0px 5px !important;
-			}
-
-			.disabled {
-				background:gray;
-				cursor:default;
-			}
-
-			a { color:red }
-			canvas { pointer-events:none; z-index:10; }
-
-		</style>
-	</head>
-
-	<body>
-		<div id="info">
-			<a href="http://threejs.org">three.js</a> - scene loader test
-		</div>
-
-		<div id="progress">
-			<span id="message">Loading ...</span>
-
-			<center>
-				<div id="progressbar" class="shadow"><div id="bar" class="shadow"></div></div>
-			</center>
-		</div>
-
-		<script src="../build/three.js"></script>
-		<script src="js/MorphAnimMesh.js"></script>
-		<script src="js/loaders/collada/Animation.js"></script>
-		<script src="js/loaders/collada/AnimationHandler.js"></script>
-		<script src="js/loaders/collada/KeyFrameAnimation.js"></script>
-
-		<script src="js/loaders/DDSLoader.js"></script>
-
-		<script src="js/loaders/ctm/lzma.js"></script>
-		<script src="js/loaders/ctm/ctm.js"></script>
-		<script src="js/loaders/ctm/CTMLoader.js"></script>
-
-		<script src="js/loaders/deprecated/SceneLoader.js"></script>
-		<script src="js/loaders/BinaryLoader.js"></script>
-		<script src="js/loaders/OBJLoader.js"></script>
-		<script src="js/loaders/VTKLoader.js"></script>
-		<script src="js/loaders/STLLoader.js"></script>
-		<script src="js/loaders/ColladaLoader.js"></script>
-		<script src="js/loaders/UTF8Loader.js"></script>
-		<script src="js/loaders/MTLLoader.js"></script>
-
-		<script src="js/Detector.js"></script>
-		<script src="js/libs/stats.min.js"></script>
-
-		<script>
-
-			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
-
-			var SCREEN_WIDTH = window.innerWidth;
-			var SCREEN_HEIGHT = window.innerHeight;
-
-			var container,stats;
-
-			var camera, scene, loaded;
-			var renderer;
-
-			var mouseX = 0, mouseY = 0;
-
-			var mixers = [];
-
-			var windowHalfX = window.innerWidth / 2;
-			var windowHalfY = window.innerHeight / 2;
-
-			var rotatingObjects = [];
-
-			var clock = new THREE.Clock();
-
-			document.addEventListener( 'mousemove', onDocumentMouseMove, false );
-
-			THREE.DefaultLoadingManager.onProgress = function ( item, loaded, total ) {
-
-				console.log( item, loaded, total );
-
-			};
-
-			init();
-			animate();
-
-			function $( id ) {
-
-				return document.getElementById( id );
-
-			}
-
-			function init() {
-
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				var loadScene = createLoadScene();
-
-				camera = loadScene.camera;
-				scene = loadScene.scene;
-
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( SCREEN_WIDTH, SCREEN_HEIGHT );
-				renderer.domElement.style.position = "relative";
-				container.appendChild( renderer.domElement );
-
-				renderer.gammaInput = true;
-				renderer.gammaOutput = true;
-
-				stats = new Stats();
-				container.appendChild( stats.dom );
-
-				var callbackProgress = function( progress, result ) {
-
-					var bar = 250,
-						total = progress.totalModels + progress.totalTextures,
-						loaded = progress.loadedModels + progress.loadedTextures;
-
-					if ( total )
-						bar = Math.floor( bar * loaded / total );
-
-					$( "bar" ).style.width = bar + "px";
-
-				};
-
-				var callbackFinished = function ( result ) {
-
-					loaded = result;
-
-					$( "message" ).style.display = "none";
-					$( "progressbar" ).style.display = "none";
-
-					result.scene.traverse( function ( object ) {
-
-						if ( object.userData.rotating === true ) {
-
-							rotatingObjects.push( object );
-
-						}
-
-						if ( object instanceof THREE.Mesh ) {
-
-							if( object.geometry && object.geometry.animations && object.geometry.animations.length > 0 ) {
-
-								var mixer = new THREE.AnimationMixer( object );
-								mixer.clipAction( object.geometry.animations[0] ).play();
-								mixers.push( mixer );
-
-							}
-
-						}
-
-					} );
-
-					//
-
-					$( "progress" ).style.display = "none";
-
-					camera = loaded.currentCamera;
-					camera.aspect = window.innerWidth / window.innerHeight;
-					camera.updateProjectionMatrix();
-
-					scene = loaded.scene;
-
-				};
-
-				$( "progress" ).style.display = "block";
-
-				THREE.Loader.Handlers.add( /\.dds$/i, new THREE.DDSLoader() );
-
-				var loader = new THREE.SceneLoader();
-
-				loader.addGeometryHandler( "binary", THREE.BinaryLoader );
-				loader.addGeometryHandler( "ctm", THREE.CTMLoader );
-				loader.addGeometryHandler( "vtk", THREE.VTKLoader );
-				loader.addGeometryHandler( "stl", THREE.STLLoader );
-
-				loader.addHierarchyHandler( "obj", THREE.OBJLoader );
-				loader.addHierarchyHandler( "dae", THREE.ColladaLoader );
-				loader.addHierarchyHandler( "utf8", THREE.UTF8Loader );
-
-				loader.callbackProgress = callbackProgress;
-
-				loader.load( "scenes/test_scene.js", callbackFinished );
-
-				//
-
-				window.addEventListener( 'resize', onWindowResize, false );
-
-			}
-
-			function onWindowResize() {
-
-				windowHalfX = window.innerWidth / 2;
-				windowHalfY = window.innerHeight / 2;
-
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
-
-				renderer.setSize( window.innerWidth, window.innerHeight );
-
-			}
-
-			function onDocumentMouseMove( event ) {
-
-				mouseX = ( event.clientX - windowHalfX );
-				mouseY = ( event.clientY - windowHalfY );
-
-			}
-
-			function createLoadScene() {
-
-				var result = {
-
-					scene:  new THREE.Scene(),
-					camera: new THREE.PerspectiveCamera( 65, window.innerWidth / window.innerHeight, 1, 1000 )
-
-				};
-
-				result.camera.position.z = 100;
-				result.scene.add( result.camera );
-
-				var object, geometry, material, light, count = 500, range = 200;
-
-				material = new THREE.MeshLambertMaterial( { color:0xffffff } );
-				geometry = new THREE.BoxGeometry( 5, 5, 5 );
-
-				for( var i = 0; i < count; i++ ) {
-
-					object = new THREE.Mesh( geometry, material );
-
-					object.position.x = ( Math.random() - 0.5 ) * range;
-					object.position.y = ( Math.random() - 0.5 ) * range;
-					object.position.z = ( Math.random() - 0.5 ) * range;
-
-					object.rotation.x = Math.random() * 6;
-					object.rotation.y = Math.random() * 6;
-					object.rotation.z = Math.random() * 6;
-
-					object.matrixAutoUpdate = false;
-					object.updateMatrix();
-
-					result.scene.add( object );
-
-				}
-
-				result.scene.matrixAutoUpdate = false;
-
-				light = new THREE.PointLight( 0xffffff );
-				result.scene.add( light );
-
-				light = new THREE.DirectionalLight( 0x111111 );
-				light.position.x = 1;
-				result.scene.add( light );
-
-				return result;
-
-			}
-
-			//
-
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				stats.update();
-
-			}
-
-			function render() {
-
-				var delta = clock.getDelta();
-
-				camera.position.x += ( mouseX - camera.position.x ) * .001;
-				camera.position.y += ( - mouseY - camera.position.y ) * .001;
-
-				camera.lookAt( scene.position );
-
-				// update skinning
-
-				THREE.AnimationHandler.update( delta * 0.75 );
-
-				for ( var i = 0; i < rotatingObjects.length; i ++ ) {
-
-					var object = rotatingObjects[ i ];
-
-					if ( object.userData.rotateX ) object.rotation.x += 1 * delta;
-					if ( object.userData.rotateY ) object.rotation.y += 0.5 * delta;
-
-				}
-
-				
-				for ( var i = 0; i < mixers.length; i ++ ) {
-
-					mixers[ i ].update( delta );
-
-				}
-
-				renderer.render( scene, camera );
-
-			}
-
-		</script>
-
-	</body>
-</html>