Browse Source

Merge remote-tracking branch 'refs/remotes/mrdoob/dev' into dev

Kyle Larson 8 years ago
parent
commit
cf40b9b379
100 changed files with 12811 additions and 8250 deletions
  1. 126 48
      build/three.js
  2. 253 253
      build/three.min.js
  3. 125 48
      build/three.modules.js
  4. 3 19
      docs/api/extras/helpers/RectAreaLightHelper.html
  5. 4 4
      docs/api/geometries/ExtrudeGeometry.html
  6. 1 1
      docs/api/lights/SpotLight.html
  7. 25 7
      docs/api/loaders/AnimationLoader.html
  8. 15 4
      docs/api/loaders/AudioLoader.html
  9. 6 4
      docs/api/loaders/BinaryTextureLoader.html
  10. 14 6
      docs/api/loaders/BufferGeometryLoader.html
  11. 29 28
      docs/api/loaders/Cache.html
  12. 13 6
      docs/api/loaders/CompressedTextureLoader.html
  13. 34 22
      docs/api/loaders/CubeTextureLoader.html
  14. 1 1
      docs/api/loaders/DataTextureLoader.html
  15. 49 6
      docs/api/loaders/DefaultLoadingManager.html
  16. 97 16
      docs/api/loaders/FileLoader.html
  17. 19 6
      docs/api/loaders/FontLoader.html
  18. 43 11
      docs/api/loaders/ImageLoader.html
  19. 28 12
      docs/api/loaders/JSONLoader.html
  20. 87 23
      docs/api/loaders/LoadingManager.html
  21. 26 9
      docs/api/loaders/MaterialLoader.html
  22. 171 15
      docs/api/loaders/ObjectLoader.html
  23. 42 9
      docs/api/loaders/TextureLoader.html
  24. 67 22
      docs/api/materials/LineBasicMaterial.html
  25. 42 30
      docs/api/materials/LineDashedMaterial.html
  26. 132 123
      docs/api/materials/Material.html
  27. 76 69
      docs/api/materials/MeshBasicMaterial.html
  28. 62 11
      docs/api/materials/MeshDepthMaterial.html
  29. 97 80
      docs/api/materials/MeshLambertMaterial.html
  30. 24 13
      docs/api/materials/MeshNormalMaterial.html
  31. 138 127
      docs/api/materials/MeshPhongMaterial.html
  32. 36 10
      docs/api/materials/MeshPhysicalMaterial.html
  33. 160 128
      docs/api/materials/MeshStandardMaterial.html
  34. 81 0
      docs/api/materials/MeshToonMaterial.html
  35. 67 7
      docs/api/materials/MultiMaterial.html
  36. 55 23
      docs/api/materials/PointsMaterial.html
  37. 53 3
      docs/api/materials/RawShaderMaterial.html
  38. 317 130
      docs/api/materials/ShaderMaterial.html
  39. 7 0
      docs/api/materials/ShadowMaterial.html
  40. 35 12
      docs/api/materials/SpriteMaterial.html
  41. 62 0
      docs/api/math/Cylindrical.html
  42. 5 0
      docs/api/math/Vector3.html
  43. 2 0
      docs/list.js
  44. 13 13
      editor/js/Loader.js
  45. 10 7
      examples/css3d_periodictable.html
  46. 4 3
      examples/files.js
  47. 2 2
      examples/js/ShaderTerrain.js
  48. 95 137
      examples/js/controls/DragControls.js
  49. 3 16
      examples/js/controls/EditorControls.js
  50. 0 60
      examples/js/controls/MouseControls.js
  51. 83 0
      examples/js/libs/vrml.min.js
  52. 2353 0
      examples/js/loaders/AssimpLoader.js
  53. 25 28
      examples/js/loaders/ColladaLoader2.js
  54. 174 53
      examples/js/loaders/FBXLoader.js
  55. 37 218
      examples/js/loaders/GLTFLoader.js
  56. 43 5
      examples/js/loaders/KMZLoader.js
  57. 2 2
      examples/js/loaders/MMDLoader.js
  58. 9 0
      examples/js/loaders/NRRDLoader.js
  59. 38 1076
      examples/js/loaders/VRMLLoader.js
  60. 11 2
      examples/js/loaders/sea3d/SEA3D.js
  61. 85 64
      examples/js/loaders/sea3d/SEA3DLegacy.js
  62. 435 252
      examples/js/loaders/sea3d/SEA3DLoader.js
  63. 0 0
      examples/js/loaders/sea3d/o3dgc/SEA3DGC.js
  64. 405 0
      examples/js/loaders/sea3d/physics/SEA3DAmmo.js
  65. 557 0
      examples/js/loaders/sea3d/physics/SEA3DAmmoLoader.js
  66. 426 0
      examples/js/loaders/sea3d/physics/SEA3DRigidBody.js
  67. 16 11
      examples/js/nodes/NodeMaterial.js
  68. 6 0
      examples/js/nodes/TempNode.js
  69. 11 15
      examples/js/nodes/materials/PhongNode.js
  70. 87 36
      examples/js/nodes/materials/StandardNode.js
  71. 1 1
      examples/js/nodes/materials/StandardNodeMaterial.js
  72. 9 1
      examples/js/nodes/utils/RoughnessToBlinnExponentNode.js
  73. 9 9
      examples/js/postprocessing/SSAARenderPass.js
  74. 8 7
      examples/js/postprocessing/TAARenderPass.js
  75. 320 317
      examples/js/renderers/WebGLDeferredRenderer.js
  76. 16 2
      examples/js/shaders/SSAOShader.js
  77. 1 27
      examples/misc_controls_pointerlock.html
  78. BIN
      examples/models/assimp/octaminator/1.png
  79. BIN
      examples/models/assimp/octaminator/1C.png
  80. BIN
      examples/models/assimp/octaminator/Octaminator.assimp
  81. BIN
      examples/models/assimp/octaminator/Octaminator_lowpoly_final.fbx
  82. BIN
      examples/models/ply/binary/Lucy100k.ply
  83. BIN
      examples/models/sea3d/car.sea
  84. BIN
      examples/models/sea3d/car.tjs.sea
  85. 4358 4361
      examples/models/vrml/house.wrl
  86. 0 3
      examples/obj/lucy/.htaccess
  87. 9 8
      examples/webgl_geometry_spline_editor.html
  88. 5 104
      examples/webgl_interactive_draggablecubes.html
  89. 134 0
      examples/webgl_loader_assimp.html
  90. 6 2
      examples/webgl_loader_fbx.html
  91. 25 22
      examples/webgl_loader_gltf.html
  92. 3 4
      examples/webgl_loader_ply.html
  93. 2 0
      examples/webgl_loader_sea3d.html
  94. 3 1
      examples/webgl_loader_sea3d_hierarchy.html
  95. 2 0
      examples/webgl_loader_sea3d_keyframe.html
  96. 2 0
      examples/webgl_loader_sea3d_morph.html
  97. 223 0
      examples/webgl_loader_sea3d_physics.html
  98. 12 7
      examples/webgl_loader_sea3d_skinning.html
  99. 3 27
      examples/webgl_loader_sea3d_sound.html
  100. 1 1
      examples/webgl_loader_utf8.html

+ 126 - 48
build/three.js

@@ -2674,7 +2674,7 @@
 				default: throw new Error( 'index is out of range: ' + index );
 				default: throw new Error( 'index is out of range: ' + index );
 
 
 			}
 			}
-			
+
 			return this;
 			return this;
 
 
 		},
 		},
@@ -3280,6 +3280,16 @@
 
 
 		},
 		},
 
 
+		setFromCylindrical: function( c ) {
+
+			this.x = c.radius * Math.sin( c.theta );
+			this.y = c.y;
+			this.z = c.radius * Math.cos( c.theta );
+
+			return this;
+
+		},
+
 		setFromMatrixPosition: function ( m ) {
 		setFromMatrixPosition: function ( m ) {
 
 
 			return this.setFromMatrixColumn( m, 3 );
 			return this.setFromMatrixColumn( m, 3 );
@@ -10535,8 +10545,8 @@
 
 
 		this.userData = {};
 		this.userData = {};
 
 
-		this.onBeforeRender = function(){};
-		this.onAfterRender = function(){};
+		this.onBeforeRender = function () {};
+		this.onAfterRender = function () {};
 
 
 	}
 	}
 
 
@@ -10750,7 +10760,7 @@
 
 
 			}
 			}
 
 
-			if ( (object && object.isObject3D) ) {
+			if ( ( object && object.isObject3D ) ) {
 
 
 				if ( object.parent !== null ) {
 				if ( object.parent !== null ) {
 
 
@@ -11144,6 +11154,7 @@
 			this.matrixAutoUpdate = source.matrixAutoUpdate;
 			this.matrixAutoUpdate = source.matrixAutoUpdate;
 			this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
 			this.matrixWorldNeedsUpdate = source.matrixWorldNeedsUpdate;
 
 
+			this.layers.mask = source.layers.mask;
 			this.visible = source.visible;
 			this.visible = source.visible;
 
 
 			this.castShadow = source.castShadow;
 			this.castShadow = source.castShadow;
@@ -25974,7 +25985,7 @@
 	 *  bevelSize: <float>, // how far from shape outline is bevel
 	 *  bevelSize: <float>, // how far from shape outline is bevel
 	 *  bevelSegments: <int>, // number of bevel layers
 	 *  bevelSegments: <int>, // number of bevel layers
 	 *
 	 *
-	 *  extrudePath: <THREE.CurvePath> // 3d spline path to extrude shape along. (creates Frames if .frames aren't defined)
+	 *  extrudePath: <THREE.Curve> // curve to extrude shape along
 	 *  frames: <Object> // containing arrays of tangents, normals, binormals
 	 *  frames: <Object> // containing arrays of tangents, normals, binormals
 	 *
 	 *
 	 *  uvGenerator: <Object> // object that provides UV generator functions
 	 *  uvGenerator: <Object> // object that provides UV generator functions
@@ -39426,6 +39437,65 @@
 
 
 	};
 	};
 
 
+	/**
+	 * @author Mugen87 / https://github.com/Mugen87
+	 *
+	 * Ref: https://en.wikipedia.org/wiki/Cylindrical_coordinate_system
+	 *
+	 */
+
+	function Cylindrical( radius, theta, y ) {
+
+		this.radius = ( radius !== undefined ) ? radius : 1.0; // distance from the origin to a point in the x-z plane
+		this.theta = ( theta !== undefined ) ? theta : 0; // counterclockwise angle in the x-z plane measured in radians from the positive z-axis
+		this.y = ( y !== undefined ) ? y : 0; // height above the x-z plane
+
+		return this;
+
+	}
+
+	Cylindrical.prototype = {
+
+		constructor: Cylindrical,
+
+		set: function ( radius, theta, y ) {
+
+			this.radius = radius;
+			this.theta = theta;
+			this.y = y;
+
+			return this;
+
+		},
+
+		clone: function () {
+
+			return new this.constructor().copy( this );
+
+		},
+
+		copy: function ( other ) {
+
+			this.radius = other.radius;
+			this.theta = other.theta;
+			this.y = other.y;
+
+			return this;
+
+		},
+
+		setFromVector3: function( vec3 ) {
+
+			this.radius = Math.sqrt( vec3.x * vec3.x + vec3.z * vec3.z );
+			this.theta = Math.atan2( vec3.x, vec3.z );
+			this.y = vec3.y;
+
+			return this;
+
+		}
+
+	};
+
 	/**
 	/**
 	 * @author alteredq / http://alteredqualia.com/
 	 * @author alteredq / http://alteredqualia.com/
 	 */
 	 */
@@ -40179,6 +40249,7 @@
 
 
 	/**
 	/**
 	 * @author abelnation / http://github.com/abelnation
 	 * @author abelnation / http://github.com/abelnation
+	 * @author Mugen87 / http://github.com/Mugen87
 	 */
 	 */
 
 
 	function RectAreaLightHelper( light ) {
 	function RectAreaLightHelper( light ) {
@@ -40188,37 +40259,28 @@
 		this.light = light;
 		this.light = light;
 		this.light.updateMatrixWorld();
 		this.light.updateMatrixWorld();
 
 
-		this.lightMat = new MeshBasicMaterial( {
+		var materialFront = new MeshBasicMaterial( {
 			color: light.color,
 			color: light.color,
 			fog: false
 			fog: false
 		} );
 		} );
 
 
-		this.lightWireMat = new MeshBasicMaterial( {
+		var materialBack = new MeshBasicMaterial( {
 			color: light.color,
 			color: light.color,
 			fog: false,
 			fog: false,
 			wireframe: true
 			wireframe: true
 		} );
 		} );
 
 
-		var hx = this.light.width / 2.0;
-		var hy = this.light.height / 2.0;
+		var geometry = new BufferGeometry();
 
 
-		this.lightShape = new ShapeBufferGeometry( new Shape( [
-			new Vector3( - hx,   hy, 0 ),
-			new Vector3(   hx,   hy, 0 ),
-			new Vector3(   hx, - hy, 0 ),
-			new Vector3( - hx, - hy, 0 )
-		] ) );
+		geometry.addAttribute( 'position', new BufferAttribute( new Float32Array( 6 * 3 ), 3 ) );
 
 
 		// shows the "front" of the light, e.g. where light comes from
 		// shows the "front" of the light, e.g. where light comes from
 
 
-		this.lightMesh = new Mesh( this.lightShape, this.lightMat );
+		this.add( new Mesh( geometry, materialFront ) );
 
 
 		// shows the "back" of the light, which does not emit light
 		// shows the "back" of the light, which does not emit light
 
 
-		this.lightWireMesh = new Mesh( this.lightShape, this.lightWireMat );
-
-		this.add( this.lightMesh );
-		this.add( this.lightWireMesh );
+		this.add( new Mesh( geometry, materialBack ) );
 
 
 		this.update();
 		this.update();
 
 
@@ -40229,51 +40291,66 @@
 
 
 	RectAreaLightHelper.prototype.dispose = function () {
 	RectAreaLightHelper.prototype.dispose = function () {
 
 
-		this.lightMesh.geometry.dispose();
-		this.lightMesh.material.dispose();
-		this.lightWireMesh.geometry.dispose();
-		this.lightWireMesh.material.dispose();
+		this.children[ 0 ].geometry.dispose();
+		this.children[ 0 ].material.dispose();
+		this.children[ 1 ].geometry.dispose();
+		this.children[ 1 ].material.dispose();
 
 
 	};
 	};
 
 
 	RectAreaLightHelper.prototype.update = function () {
 	RectAreaLightHelper.prototype.update = function () {
 
 
-		var vector = new Vector3();
+		var vector1 = new Vector3();
 		var vector2 = new Vector3();
 		var vector2 = new Vector3();
 
 
-		// TODO (abelnation) why not just make light helpers a child of the light object?
-		if ( this.light.target ) {
+		return function update() {
 
 
-			vector.setFromMatrixPosition( this.light.matrixWorld );
-			vector2.setFromMatrixPosition( this.light.target.matrixWorld );
+			var mesh1 = this.children[ 0 ];
+			var mesh2 = this.children[ 1 ];
 
 
-			var lookVec = vector2.clone().sub( vector );
-			this.lightMesh.lookAt( lookVec );
-			this.lightWireMesh.lookAt( lookVec );
+			if ( this.light.target ) {
 
 
-		}
+				vector1.setFromMatrixPosition( this.light.matrixWorld );
+				vector2.setFromMatrixPosition( this.light.target.matrixWorld );
 
 
-		this.lightMesh.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
-		this.lightWireMesh.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
+				var lookVec = vector2.clone().sub( vector1 );
+				mesh1.lookAt( lookVec );
+				mesh2.lookAt( lookVec );
 
 
-		var oldShape = this.lightShape;
+			}
 
 
-		var hx = this.light.width / 2.0;
-		var hy = this.light.height / 2.0;
+			// update materials
 
 
-		this.lightShape = new ShapeBufferGeometry( new Shape( [
-			new Vector3( - hx,   hy, 0 ),
-			new Vector3(   hx,   hy, 0 ),
-			new Vector3(   hx, - hy, 0 ),
-			new Vector3( - hx, - hy, 0 )
-		] ) );
+			mesh1.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
+			mesh2.material.color.copy( this.light.color ).multiplyScalar( this.light.intensity );
 
 
-		this.lightMesh.geometry = this.lightShape;
-		this.lightWireMesh.geometry = this.lightShape;
+			// calculate new dimensions of the helper
 
 
-		oldShape.dispose();
+			var hx = this.light.width * 0.5;
+			var hy = this.light.height * 0.5;
 
 
-	};
+			// because the buffer attribute is shared over both geometries, we only have to update once
+
+			var position = mesh1.geometry.getAttribute( 'position' );
+			var array = position.array;
+
+			// first face
+
+			array[  0 ] =   hx; array[  1 ] = - hy; array[  2 ] = 0;
+			array[  3 ] =   hx; array[  4 ] =   hy; array[  5 ] = 0;
+			array[  6 ] = - hx; array[  7 ] =   hy; array[  8 ] = 0;
+
+			// second face
+
+			array[  9 ] = - hx; array[ 10 ] =   hy; array[ 11 ] = 0;
+			array[ 12 ] = - hx; array[ 13 ] = - hy; array[ 14 ] = 0;
+			array[ 15 ] =   hx; array[ 16 ] = - hy; array[ 17 ] = 0;
+
+			position.needsUpdate = true;
+
+		};
+
+	}();
 
 
 	/**
 	/**
 	 * @author alteredq / http://alteredqualia.com/
 	 * @author alteredq / http://alteredqualia.com/
@@ -42899,6 +42976,7 @@
 	exports.Spline = Spline;
 	exports.Spline = Spline;
 	exports.Math = _Math;
 	exports.Math = _Math;
 	exports.Spherical = Spherical;
 	exports.Spherical = Spherical;
+	exports.Cylindrical = Cylindrical;
 	exports.Plane = Plane;
 	exports.Plane = Plane;
 	exports.Frustum = Frustum;
 	exports.Frustum = Frustum;
 	exports.Sphere = Sphere;
 	exports.Sphere = Sphere;

File diff suppressed because it is too large
+ 253 - 253
build/three.min.js


File diff suppressed because it is too large
+ 125 - 48
build/three.modules.js


+ 3 - 19
docs/api/extras/helpers/RectAreaLightHelper.html

@@ -29,32 +29,16 @@ scene.add( helper );
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
-		<h3>[name]( [page:HemisphereLight light] )</h3>
-		<div>[page:HemisphereLight light] -- The light being visualized.</div>
+		<h3>[name]( [page:RectAreaLight light] )</h3>
+		<div>[page:RectAreaLight light] -- The light being visualized.</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Object3D] class for common properties.</div>
 		<div>See the base [page:Object3D] class for common properties.</div>
 
 
-		<h3>[property:HemisphereLight light]</h3>
+		<h3>[property:RectAreaLight light]</h3>
 		<div>Reference to the RectAreaLight being visualized.</div>
 		<div>Reference to the RectAreaLight being visualized.</div>
 
 
-		<h3>[property:Mesh lightMat]</h3>
-		<div>[page:MeshBasicMaterial] used to visualize the light. This be be rendered the same color as the [page:.light]</div>
-
-		<h3>[property:Mesh lightMesh]</h3>
-		<div>[page:Mesh] used to visualize the light. Used to show the front (light-emitting side) of the light.</div>
-
-		<h3>[property:Mesh lightShape]</h3>
-		<div>[page:ShapeGeometry] used to create the mesh's that visualize the light.</div>
-
-		<h3>[property:Mesh lightWireMat]</h3>
-		<div>[page:MeshBasicMaterial] used to visualize the light's outline. This be be rendered the same color as the [page:.light]</div>
-
-		<h3>[property:Mesh lightWireMesh]</h3>
-		<div>[page:Mesh] used to visualize the light's outline. Used to show the back (non light-emitting side) of the light.</div>
-
-
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 		<div>See the base [page:Object3D] class for common methods.</div>
 		<div>See the base [page:Object3D] class for common methods.</div>

+ 4 - 4
docs/api/geometries/ExtrudeGeometry.html

@@ -107,8 +107,8 @@
 				<li>bevelThickness —  float. how deep into the original shape bevel goes</li>
 				<li>bevelThickness —  float. how deep into the original shape bevel goes</li>
 				<li>bevelSize —  float. how far from shape outline is bevel</li>
 				<li>bevelSize —  float. how far from shape outline is bevel</li>
 				<li>bevelSegments —  int. number of bevel layers</li>
 				<li>bevelSegments —  int. number of bevel layers</li>
-				<li>extrudePath —  THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if (frames aren't defined)</li>
-				<li>frames —  THREE.TubeGeometry.FrenetFrames.  containing arrays of tangents, normals, binormals</li>
+				<li>extrudePath —  THREE.Curve. curve to extrude shape along</li>
+				<li>frames —  Object.  containing arrays of tangents, normals, binormals</li>
 				<li>material —  int. material index for front and back faces</li>
 				<li>material —  int. material index for front and back faces</li>
 				<li>extrudeMaterial —  int. material index for extrusion and beveled faces</li>
 				<li>extrudeMaterial —  int. material index for extrusion and beveled faces</li>
 				<li>UVGenerator —  Object. object that provides UV generator functions</li>
 				<li>UVGenerator —  Object. object that provides UV generator functions</li>
@@ -128,8 +128,8 @@
 				<li>bevelThickness —  float. how deep into the original shape bevel goes</li>
 				<li>bevelThickness —  float. how deep into the original shape bevel goes</li>
 				<li>bevelSize —  float. how far from shape outline is bevel</li>
 				<li>bevelSize —  float. how far from shape outline is bevel</li>
 				<li>bevelSegments —  int. number of bevel layers</li>
 				<li>bevelSegments —  int. number of bevel layers</li>
-				<li>extrudePath —  THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if (frames aren't defined)</li>
-				<li>frames —  THREE.TubeGeometry.FrenetFrames.  containing arrays of tangents, normals, binormals</li>
+				<li>extrudePath —  THREE.Curve. curve to extrude shape along</li>
+				<li>frames —  Object.  containing arrays of tangents, normals, binormals</li>
 				<li>material —  int. material index for front and back faces</li>
 				<li>material —  int. material index for front and back faces</li>
 				<li>extrudeMaterial —  int. material index for extrusion and beveled faces</li>
 				<li>extrudeMaterial —  int. material index for extrusion and beveled faces</li>
 				<li>UVGenerator —  Object. object that provides UV generator functions</li>
 				<li>UVGenerator —  Object. object that provides UV generator functions</li>

+ 1 - 1
docs/api/lights/SpotLight.html

@@ -55,7 +55,7 @@
 		[example:webgl_materials_bumpmap materials / bumpmap]<br/>
 		[example:webgl_materials_bumpmap materials / bumpmap]<br/>
 		[example:webgl_shading_physical shading / physical]<br/>
 		[example:webgl_shading_physical shading / physical]<br/>
 		[example:webgl_shadowmap shadowmap]<br/>
 		[example:webgl_shadowmap shadowmap]<br/>
-		[example:webgl_shadowmap_viewer shadowmap / performance]<br/>
+		[example:webgl_shadowmap_performance shadowmap / performance]<br/>
 		[example:webgl_shadowmap_viewer shadowmap / viewer]
 		[example:webgl_shadowmap_viewer shadowmap / viewer]
 		</div>
 		</div>
 
 

+ 25 - 7
docs/api/loaders/AnimationLoader.html

@@ -10,7 +10,10 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Class for loading an animation in JSON format.</div>
+		<div class="desc">
+			Class for loading an animation in JSON format.
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
@@ -41,23 +44,38 @@
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
+		Creates a new [name].
 		</div>
 		</div>
+
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		Creates a new [name].
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
-		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
+		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Animation animation].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
-		[page:Function onError] — Will be called when load errors.<br />
+		[page:Function onError] — Will be called if load errors.<br /><br />
+
+		Begin loading from url and pass the loaded animation to onLoad.
 		</div>
 		</div>
+
+		<h3>[method:null parse]( [page:JSON json], [page:Function onLoad] )</h3>
 		<div>
 		<div>
-		Begin loading from url and pass the loaded animation to onLoad.
+		[page:JSON json] — required<br />
+		[page:Function onLoad] — Will be called when parsing completes. <br /><br />
+
+		Parse the JSON object and pass the result to onLoad. Individual clips in the object will
+		be parsed with [page:AnimationClip.parse].
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 15 - 4
docs/api/loaders/AudioLoader.html

@@ -10,7 +10,11 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Class for loading an [page:String AudioBuffer].</div>
+		<div class="desc">
+			Class for loading an
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer AudioBuffer].
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
@@ -58,10 +62,16 @@
 		<h3>[name]( [page:String context], [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:String context], [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
 		[page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].<br />
 		[page:String context] — The [page:String AudioContext] for the loader to use. Default is [page:String window.AudioContext].<br />
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
+		Creates a new [name].
 		</div>
 		</div>
+
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		Creates a new [name].
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
 
 
@@ -69,7 +79,8 @@
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />

+ 6 - 4
docs/api/loaders/BinaryTextureLoader.html

@@ -11,7 +11,8 @@
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
 		<div class="desc">
 		<div class="desc">
-		Abstract base class to load generic binary textures formats (rgbe, hdr, ...).<br /><br />
+		Abstract base class to load generic binary textures formats (rgbe, hdr, ...).
+		This uses the [page:FileLoader] internally for loading files.
 		</div>
 		</div>
 
 
 		<h2>Examples</h2>
 		<h2>Examples</h2>
@@ -34,9 +35,9 @@
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
-		<h3>[property:LoadingManager loadingManager]</h3>
+		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		loadingManager — the LoadingManager supplied in the constructor, or the [page:LoadingManager THREE.DefaultLoadingManager].<br />
+		The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
 
 
@@ -44,7 +45,8 @@
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />

+ 14 - 6
docs/api/loaders/BufferGeometryLoader.html

@@ -10,10 +10,15 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A loader for loading a [page:BufferGeometry].</div>
+		<div class="desc">
+			A loader for loading a [page:BufferGeometry].
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
+		[example:webgl_geometry_colors_lookuptable WebGL / geometry / colors / lookuptable]
+
 		<code>
 		<code>
 		// instantiate a loader
 		// instantiate a loader
 		var loader = new THREE.BufferGeometryLoader();
 		var loader = new THREE.BufferGeometryLoader();
@@ -38,7 +43,7 @@
 			}
 			}
 		);
 		);
 		</code>
 		</code>
-		
+
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
@@ -52,12 +57,17 @@
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].d<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:BufferGeometry].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -68,9 +78,7 @@
 
 
 		<h3>[method:BufferGeometry parse]( [page:Object json] )</h3>
 		<h3>[method:BufferGeometry parse]( [page:Object json] )</h3>
 		<div>
 		<div>
-		[page:Object json] — The <em>JSON</em> structure to parse.
-		</div>
-		<div>
+		[page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
 		Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
 		Parse a <em>JSON</em> structure and return a [page:BufferGeometry].
 		</div>
 		</div>
 
 

+ 29 - 28
docs/api/loaders/Cache.html

@@ -10,61 +10,62 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A simple caching classe, used internaly by [page:FileLoader].</div>
-
+		<div class="desc">
+			A simple caching system, used internally by [page:FileLoader].
+		</div>
 
 
-		<h2>Constructor</h2>
+		<h2>Examples</h2>
 
 
-		<h3>[name]()</h3>
 		<div>
 		<div>
-		Creates a new [name].
+			[example:webgl_geometry_text_earcut WebGL / geometry / text / earcut]<br />
+			[example:webgl_interactive_instances_gpu WebGL / interactive / instances / gpu]<br />
+			[example:webgl_loader_ttf WebGL / loader / ttf]
 		</div>
 		</div>
 
 
+		<h2>Usage</h2>
+
+		<div>To enable caching across all loaders	that use [page:FileLoader], set</div>
+		<code>
+THREE.Cache.enabled = true.
+		</code>
+
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
 		<h3>[property:Boolean enabled]</h3>
 		<h3>[property:Boolean enabled]</h3>
-		<div>
-		Whether caching is enabled. Default is *false*.
-		</div>
+		<div>Whether caching is enabled. Default is *false*.</div>
 
 
 		<h3>[property:Object files]</h3>
 		<h3>[property:Object files]</h3>
-		<div>
-		An [page:Object object] that hold cached values.
-		</div>
+		<div>An [page:Object object] that holds cached files.</div>
 
 
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:null add]( [page:String key], value )</h3>
-		<div>
-		[page:String key] — required. A string key <br />
-		[page:Object] value — A value <br />
-		</div>
+		<h3>[method:null add]( [page:String key], file )</h3>
 		<div>
 		<div>
-		Adds a cache entry with that key to hold the value. If this key already holds a value, it is overwritten.
+		[page:String key] — the [page:String key] to reference the cached file by.<br />
+		[page:Object file] — The file to be cached.<br /><br />
+
+		Adds a cache entry with a key to reference the file. If this key already holds a file,
+		it is overwritten.
 		</div>
 		</div>
 
 
 		<h3>[method:null get]( [page:String key] )</h3>
 		<h3>[method:null get]( [page:String key] )</h3>
 		<div>
 		<div>
-		[page:String key] — required. A string key <br />
-		</div>
-		<div>
-		Get the value of key. If the key does not exist *undefined* is returned.
+		[page:String key] — A string key <br /><br />
+
+		Get the value of [page:String key]. If the key does not exist *undefined* is returned.
 		</div>
 		</div>
 
 
 		<h3>[method:null remove]( [page:String key] )</h3>
 		<h3>[method:null remove]( [page:String key] )</h3>
 		<div>
 		<div>
-		[page:String key] — required. A string key <br />
-		</div>
-		<div>
-		Remove the cached value associated with the key.
+		[page:String key] — A string key that references a cached file.<br /><br />
+
+		Remove the cached file associated with the key.
 		</div>
 		</div>
 
 
 		<h3>[method:null clear]()</h3>
 		<h3>[method:null clear]()</h3>
-		<div>
-		Remove all values from the cache.
-		</div>
+		<div>Remove all values from the cache.</div>
 
 
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 13 - 6
docs/api/loaders/CompressedTextureLoader.html

@@ -11,7 +11,8 @@
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
 		<div class="desc">
 		<div class="desc">
-		Abstract base class for block based textures loader (dds, pvr, ...).<br /><br />
+		Abstract base class for block based textures loader (dds, pvr, ...).
+		This uses the [page:FileLoader] internally for loading files.
 		</div>
 		</div>
 
 
 		<h2>Examples</h2>
 		<h2>Examples</h2>
@@ -19,7 +20,7 @@
 		<div>
 		<div>
 			See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
 			See the [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/DDSLoader.js DDSLoader]
 			and [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
 			and [link:https://github.com/mrdoob/three.js/blob/master/examples/js/loaders/PVRLoader.js PVRLoader]
-			for examples of a derived classes.
+			for examples of derived classes.
 		</div>
 		</div>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
@@ -37,15 +38,20 @@
 
 
 		<h3>[property:LoadingManager manager]</h3>
 		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		manager — the LoadingManager supplied in the constructor, or the [page:LoadingManager THREE.DefaultLoadingManager].<br />
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
+		<h3>[property:String path]</h3>
+		<div>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</div>
+
+
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded texture.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -54,9 +60,10 @@
 		Begin loading from url and pass the loaded texture to onLoad.
 		Begin loading from url and pass the loaded texture to onLoad.
 		</div>
 		</div>
 
 
-		<h3>[method:null setPath]( [page:String value] )</h3>
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
 		<div>
 		<div>
-		Set the path from which to load textures.
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many textures from the same directory.
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 34 - 22
docs/api/loaders/CubeTextureLoader.html

@@ -10,10 +10,22 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Class for loading a [page:CubeTexture CubeTexture].</div>
+		<div class="desc">
+			Class for loading a [page:CubeTexture CubeTexture].
+			This uses the [page:ImageLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
+		<div>
+			[example:webgl_materials_cubemap materials / cubemap]<br />
+			[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection]<br />
+			[example:webgl_materials_cubemap_balls_refraction materials / cubemap / balls / refraction]<br />
+			[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]<br />
+			[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2]<br />
+			[example:webgl_materials_cubemap_refraction materials / cubemap / refraction]
+		</div>
+
 		<code>
 		<code>
 var scene = new THREE.Scene();
 var scene = new THREE.Scene();
 scene.background = new THREE.CubeTextureLoader()
 scene.background = new THREE.CubeTextureLoader()
@@ -28,22 +40,12 @@ scene.background = new THREE.CubeTextureLoader()
 			] );
 			] );
 		</code>
 		</code>
 
 
-		<div>
-			[example:webgl_materials_cubemap materials / cubemap]<br />
-			[example:webgl_materials_cubemap_balls_reflection materials / cubemap / balls / reflection]<br />
-			[example:webgl_materials_cubemap_balls_refraction materials / cubemap / balls / refraction]<br />
-			[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic]<br />
-			[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2]<br />
-			[example:webgl_materials_cubemap_refraction materials / cubemap / refraction]
-		</div>
-
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
-		</div>
-		<div>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
 		Creates a new [name].
 		Creates a new [name].
 		</div>
 		</div>
 
 
@@ -52,16 +54,27 @@ scene.background = new THREE.CubeTextureLoader()
 
 
 		<h3>[property:String crossOrigin]</h3>
 		<h3>[property:String crossOrigin]</h3>
 		<div>
 		<div>
-		default — *null*.<br />
-		If set, assigns the *crossOrigin* attribute of the image to the value of *crossOrigin*, prior to starting the load.
+		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+	 attribute of the image to the value of *crossOrigin*,
+		prior to starting the load. Default is *undefined*.
 		</div>
 		</div>
 
 
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
+
+		<h3>[property:String path]</h3>
+		<div>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</div>
+
+
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
+		<h3>[method:null load]( [page:String urls], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String urls] — array of 6 urls to images, one for each side of the CubeTexture. These can also be
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URIs].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -71,13 +84,12 @@ scene.background = new THREE.CubeTextureLoader()
 		</div>
 		</div>
 
 
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
-		<div>
-		Set the crossOrigin attribute.
-		</div>
+		<div>		Set the [page:.crossOrigin] attribute.</div>
 
 
-		<h3>[method:null setPath]( [page:String value] )</h3>
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
 		<div>
 		<div>
-		Set the path from which to load textures.	
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many textures from the same directory.
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 1 - 1
docs/api/loaders/DataTextureLoader.html

@@ -10,7 +10,7 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">This is a synonym for the [page:BinaryTextureLoader BinaryTextureLoader].
+		<div class="desc">This is an alias for the [page:BinaryTextureLoader BinaryTextureLoader].
 			See that page for details.
 			See that page for details.
 		</div>
 		</div>
 
 

+ 49 - 6
docs/api/loaders/DefaultLoadingManager.html

@@ -10,20 +10,63 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">An instance of the [page:LoadingManager LoadingManager], used by most loaders
-			when no custom manager has been specified.
+		<div class="desc">A global instance of the [page:LoadingManager LoadingManager], used by most loaders
+			when no custom manager has been specified.<br /><br />
+
+		  This will be sufficient for most purposes, however there may be times when you desire seperate loading managers
+			for say, textures and models.
+		</div>
+
+		<h2>Example</h2>
+
+		<div>
+			[example:webgl_loader_scene WebGL / loader / scene]<br />
 		</div>
 		</div>
 
 
+		<div>
+			You can optionally set the [page:LoadingManager.onStart onStart], [page:LoadingManager.onLoad onLoad],
+			[page:LoadingManager.onProgress onProgress], [page:LoadingManager.onStart onError] functions for the manager.
+			These will then apply to any loaders using the DefaultLoadingManager.<br /><br />
+
+			Note that these shouldn't be confused with the similarly named functions of individual loaders,
+			as they are intended for displaying information about the overall status of loading,
+			rather than dealing with the data that has been loaded.
+		</div>
+		<code>
+THREE.DefaultLoadingManager.onStart = function ( url, itemsLoaded, itemsTotal ) {
+
+	console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
+
+};
+
+THREE.DefaultLoadingManager.onLoad = function ( ) {
+
+	console.log( 'Loading Complete!');
+
+};
+
+
+THREE.DefaultLoadingManager.onProgress = function ( url, itemsLoaded, itemsTotal ) {
+
+	console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
+
+};
+
+THREE.DefaultLoadingManager.onError = function ( url ) {
+
+	console.log( 'There was an error loading ' + url );
+
+};
+		</code>
+
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
-		See the [page:LoadingManager LoadingManager] for properties.
+		<div>See the [page:LoadingManager LoadingManager] page for details of properties.</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		See the [page:LoadingManager LoadingManager] for methods.
-
-		<h2>Example</h2>
+		<div>See the [page:LoadingManager LoadingManager] page for details of methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 97 - 16
docs/api/loaders/FileLoader.html

@@ -11,16 +11,48 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A low level class for loading resources with XmlHttpRequest, used internaly by most loaders.</div>
+		<div class="desc">
+			A low level class for loading resources with XmlHttpRequest, used internaly by most loaders.
+			It can also be used directly to load any file type that does not have a loader.
+		</div>
+
+		<h2>Example</h2>
+		<div>
+			[example:webgl_loader_msgpack WebGL / loader / msgpack]<br />
+			[example:webgl_morphtargets_human WebGL / morphtargets / human]<br />
+		</div>
+		<code>
+var loader = new THREE.FileLoader();
+
+//load a text file a output the result to the console
+loader.load(
+    // resource URL
+    'example.txt',
+
+    // Function when resource is loaded
+    function ( data ) {
+        // output the text to the console
+        console.log( data )
+    },
+
+    // Function called when download progresses
+    function ( xhr ) {
+        console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
+    },
+
+    // Function called when download errors
+    function ( xhr ) {
+        console.error( 'An error happened' );
+    }
+);
+		</code>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
-		</div>
-		<div>
-		Creates a new [name].
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use.
+		Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
 
 
@@ -28,36 +60,85 @@
 
 
 		<h3>[property:Cache cache]</h3>
 		<h3>[property:Cache cache]</h3>
 		<div>
 		<div>
-		A [page:Cache cache] instance that hold the response from each request made through this loader, so each file is requested once.
+			A reference to [page:Cache Cache] that hold the response from each request made
+			through this loader, so each file is requested once.<br /><br />
+
+			<em>Note:</em>The cache must be enabled using
+			<code>THREE.Cache.enabled = true.</code>
+			This is a global property and only needs to be set once to be used by all loaders that use FileLoader internally.
+		</div>
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
+		<h3>[property:String mimeType]</h3>
+		<div>
+			The expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType].
+			See [page:.setMimeType]. Default is *undefined*.
+		</div>
+
+		<h3>[property:String path]</h3>
+		<div>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</div>
+
 		<h3>[property:String responseType]</h3>
 		<h3>[property:String responseType]</h3>
+		<div>The expected response type. See [page:.setResponseType]. Default is *undefined*.</div>
+
+		<h3>[property:String withCredentials]</h3>
 		<div>
 		<div>
-		Can be set to change the response type.
+			Whether the XMLHttpRequest uses credentials - see [page:.setWithCredentials].
+			Default is *undefined*.
 		</div>
 		</div>
 
 
 
 
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
-		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
-		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
-		[page:Function onError] — Will be called when load errors.<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
+		[page:Function onLoad] — Will be called when loading completes. The argument will be the loaded response.<br />
+		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance,
+			that contains .[page:Integer total] and .[page:Integer loaded] bytes.<br />
+		[page:Function onError] — Will be called if an error occurs.<br /><br />
+
+		Load the URL and pass the response to the onLoad function.
+		</div>
+
+		<h3>[method:FileLoader setMimeType]( [page:String mimeType] )</h3>
+		<div>
+			Set the expected [link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types mimeType]
+			of the file being loaded. Note that in many cases this will be determined automatically, so by default it is *undefined*.
 		</div>
 		</div>
+
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
 		<div>
 		<div>
-		Begin loading from url and return the [page:String text] response that will contain the data.
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many models from the same directory.
 		</div>
 		</div>
 
 
-		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
+		<h3>[method:FileLoader setResponseType]( [page:String responseType] )</h3>
 		<div>
 		<div>
-		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
+		[page:String responseType] — Default is '' (empty string).<br /><br />
+
+		Change the response type. Valid values are:<br />
+		[page:String text], empty string (default), or any other value. Any file type, returns the unprocessed file data.<br />
+		[page:String arraybuffer] - loads the data into a [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer ArrayBuffer] and returns that.<br />
+		[page:String blob] - returns the data as a [link:https://developer.mozilla.org/en/docs/Web/API/Blob Blob].<br />
+		[page:String document] - parse the file using the [link:https://developer.mozilla.org/en-US/docs/Web/API/DOMParser DOMParser].<br />
+		[page:String json] - parse the file using [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse JSON.parse].<br />
+
 		</div>
 		</div>
 
 
-		<h3>[method:null setResponseType]( [page:String value] )</h3>
+		<h3>[method:FileLoader setWithCredentials]( [page:Boolean value] )</h3>
+		Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
+		TLS client certificates. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
+		Note that this has no effect if you are loading files locally or from the same domain.
 		<div>
 		<div>
-		[page:String value] — the empty string (default), "arraybuffer", "blob", "document", "json", or "text".
+
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 19 - 6
docs/api/loaders/FontLoader.html

@@ -12,7 +12,8 @@
 
 
 		<div class="desc">
 		<div class="desc">
 		Class for loading a font in JSON format. Returns a [page:Font Font], which is an
 		Class for loading a font in JSON format. Returns a [page:Font Font], which is an
-		array of [page:Shape Shape]s representing the font.<br /><br />
+		array of [page:Shape Shape]s representing the font.
+		This uses the [page:FileLoader] internally for loading files. <br /><br />
 
 
 		You can convert fonts online using [link:https://gero3.github.io/facetype.js/ facetype.js]
 		You can convert fonts online using [link:https://gero3.github.io/facetype.js/ facetype.js]
 		</div>
 		</div>
@@ -50,23 +51,35 @@
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+		Creates a new [name].
 		</div>
 		</div>
+
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		Creates a new [name].
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
-		[page:Function onError] — Will be called when load errors.<br />
+		[page:Function onError] — Will be called when load errors.<br /><br />
+
+		Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
 		</div>
 		</div>
+
+		<h3>[method:Font parse]( [page:Object json] )</h3>
 		<div>
 		<div>
-		Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
+		[page:Object json] — The <em>JSON</em> structure to parse.<br /><br />
+		Parse a <em>JSON</em> structure and return a [page:Font].
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 43 - 11
docs/api/loaders/ImageLoader.html

@@ -10,10 +10,20 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A loader for loading an [page:Image].</div>
+		<div class="desc">
+			A loader for loading an [page:Image].
+
+			This uses the [page:FileLoader] internally for loading files, and is used internally by the
+			[page:CubeTextureLoader], [page:ObjectLoader] and [page:TextureLoader].
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
+		<div>
+			[example:webgl_loader_obj WebGL / loader / obj]<br />
+			[example:webgl_shaders_ocean WebGL / shaders / ocean]
+		</div>
+
 		<code>
 		<code>
 		// instantiate a loader
 		// instantiate a loader
 		var loader = new THREE.ImageLoader();
 		var loader = new THREE.ImageLoader();
@@ -42,15 +52,13 @@
 		);
 		);
 		</code>
 		</code>
 
 
-		[example:webgl_shaders_ocean]
-		
+
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
-		</div>
-		<div>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
 		Creates a new [name].
 		Creates a new [name].
 		</div>
 		</div>
 
 
@@ -58,14 +66,30 @@
 
 
 		<h3>[property:String crossOrigin]</h3>
 		<h3>[property:String crossOrigin]</h3>
 		<div>
 		<div>
-		The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
+		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+	 attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *undefined*.
+		</div>
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager] the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
+
+		<h3>[property:String path]</h3>
+		<div>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</div>
+
+		<h3>[property:String withCredentials]</h3>
+		<div>
+			Whether the XMLHttpRequest uses credentials - see [page:.setWithCredentials].
+			Default is *undefined*.
 		</div>
 		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Image image].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -75,12 +99,20 @@
 		</div>
 		</div>
 
 
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
+		<div>Set the [page:.crossOrigin] attribute.</div>
+
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
 		<div>
 		<div>
-		[page:String value] — The crossOrigin string.
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many models from the same directory.
 		</div>
 		</div>
+
+		<h3>[method:FileLoader setWithCredentials]( [page:Boolean value] )</h3>
+		Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
+		TLS client certificates. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
+		Note that this has no effect if you are loading files locally or from the same domain.
 		<div>
 		<div>
-		The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
-		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 28 - 12
docs/api/loaders/JSONLoader.html

@@ -8,13 +8,20 @@
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />
 	</head>
 	</head>
 	<body>
 	<body>
-		[page:Loader] &rarr;
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A loader for loading objects in JSON format.</div>
+		<div class="desc">
+			A loader for loading objects in JSON format.
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
+		<div>
+		[example:webgl_loader_json_blender WebGL / loader / json / blender]<br />
+		[example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]
+		</div>
+
 		<code>
 		<code>
 		// instantiate a loader
 		// instantiate a loader
 		var loader = new THREE.JSONLoader();
 		var loader = new THREE.JSONLoader();
@@ -32,8 +39,6 @@
 		);
 		);
 		</code>
 		</code>
 
 
-		[example:webgl_loader_json_blender]
-
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
@@ -44,11 +49,25 @@
 		Creates a new [name].
 		Creates a new [name].
 		</div>
 		</div>
 
 
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
+
+		<h3>[property:String withCredentials]</h3>
+		<div>
+			Whether the XMLHttpRequest uses credentials.
+			Default is *false*.
+		</div>
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required.<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI]..<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded text response.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -59,18 +78,15 @@
 
 
 		<h3>[method:null setTexturePath]( [page:String texturePath] )</h3>
 		<h3>[method:null setTexturePath]( [page:String texturePath] )</h3>
 		<div>
 		<div>
-		[page:String texturePath] — Base path for textures.
-		</div>
-		<div>
-		Set the base path for textures.
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many files from the same directory.
 		</div>
 		</div>
 
 
 		<h3>[method:Object3D parse]( [page:Object json], [page:String texturePath] )</h3>
 		<h3>[method:Object3D parse]( [page:Object json], [page:String texturePath] )</h3>
 		<div>
 		<div>
 		[page:String json] — JSON object to parse.<br />
 		[page:String json] — JSON object to parse.<br />
-		[page:String texturePath] — Base path for textures.
-		</div>
-		<div>
+		[page:String texturePath] — Base path for textures.<br /><br />
+
 		Parse a <em>JSON</em> structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
 		Parse a <em>JSON</em> structure and return an [page:object] containing the parsed [page:Geometry geometry] and [page:Array materials].
 		</div>
 		</div>
 
 

+ 87 - 23
docs/api/loaders/LoadingManager.html

@@ -10,12 +10,52 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Handles and keeps track of loaded and pending data.</div>
+		<div class="desc">
+			Handles and keeps track of loaded and pending data. A default global instance of this class
+			is created and used by loaders if not supplied manually - see [page:DefaultLoadingManager].<br /><br />
+
+			In general that should be sufficient, however there are times when it can be useful to have seperate loaders -
+			for example if you want to show seperate loading bars for objects and textures.
+
+		</div>
+
+
+		<h2>Example</h2>
+
+		<div>
+			[example:webgl_loader_babylon WebGL / loader / babylon]<br />
+			[example:webgl_loader_fbx WebGL / loader / fbx]<br />
+			[example:webgl_loader_obj WebGL / loader / obj]<br />
+			[example:webgl_materials_reflectivity WebGL / materials / reflectivity]<br />
+			[example:webgl_postprocessing_outline WebGL / postprocesing / outline]<br />
+			[example:webgl_terrain_dynamic WebGL / terrain / dynamic]
+		</div>
+
+
 		<code>
 		<code>
 		var manager = new THREE.LoadingManager();
 		var manager = new THREE.LoadingManager();
-		manager.onProgress = function ( item, loaded, total ) {
+		manager.onStart = function ( url, itemsLoaded, itemsTotal ) {
+
+			console.log( 'Started loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
+
+		};
+
+		manager.onLoad = function ( ) {
+
+			console.log( 'Loading complete!');
+
+		};
+
+
+		manager.onProgress = function ( url, itemsLoaded, itemsTotal ) {
+
+			console.log( 'Loading file: ' + url + '.\nLoaded ' + itemsLoaded + ' of ' + itemsTotal + ' files.' );
+
+		};
+
+		manager.onError = function ( url ) {
 
 
-			console.log( item, loaded, total );
+			console.log( 'There was an error loading ' + url );
 
 
 		};
 		};
 
 
@@ -32,57 +72,81 @@
 
 
 		<h3>[name]( [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[name]( [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:Function onLoad] — The function that needs to be called when all loaders are done.<br />
-		[page:Function onProgress] — The function that needs to be called when an item is complete.<br />
-		[page:Function onError] — The function that needs to be called when an item is errors.
-		</div>
-		<div>
-		Creates a [name].
+		[page:Function onLoad] — (optional) this function will be called when all loaders are done.<br />
+		[page:Function onProgress] — (optional) this function will be called when an item is complete.<br />
+		[page:Function onError] — (optional) this function will be called a loader encounters errors. <br />
+
+		Creates a new [name].
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
+		<h3>[property:Function onStart]</h3>
+		<div>
+			This function will be called when loading starts.
+			The arguments are:<br />
+			[page:String url] — The url of the item just loaded.<br />
+			[page:Integer itemsLoaded] — the number  of items already loaded so far.<br />
+			[page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
+
+			By default this is undefined.
+		</div>
+
 		<h3>[property:Function onLoad]</h3>
 		<h3>[property:Function onLoad]</h3>
 		<div>
 		<div>
-		The function that needs to be called when all loaders are done.
+			This function will be called when all loading is completed. By default this is undefined,
+			unless passed in the constructor.
 		</div>
 		</div>
 
 
 		<h3>[property:Function onProgress]</h3>
 		<h3>[property:Function onProgress]</h3>
 		<div>
 		<div>
-		The function that needs to be called when an item is complete. The arguments are url(The url of the item just loaded),<br />
-		loaded(the amount of items already loaded), total( The total amount of items to be loaded.)
+		This function will be called when an item is complete.
+		The arguments are:<br />
+		[page:String url] — The url of the item just loaded.<br />
+		[page:Integer itemsLoaded] — the number  of items already loaded so far.<br />
+		[page:Iteger itemsTotal] — the total amount of items to be loaded.<br /><br />
+
+		By default this is undefined, unless passed in the constructor.
 		</div>
 		</div>
 
 
 		<h3>[property:Function onError]</h3>
 		<h3>[property:Function onError]</h3>
 		<div>
 		<div>
-		The function that needs to be called when an item errors.
+			This function will be called when any item errors, with the argument:<br />
+			[page:String url] — The url of the item that errored.<br /><br />
+
+			By default this is undefined, unless passed in the constructor.
 		</div>
 		</div>
 
 
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:null itemStart]( [page:String url] )</h3>
 		<div>
 		<div>
-		[page:String url] — the url to load
+			<em>Note: The following methods are designed to be called internally by loaders. You shouldn't call
+			them directly.</em>
 		</div>
 		</div>
+
+		<h3>[method:null itemStart]( [page:String url] )</h3>
 		<div>
 		<div>
-		This should be called by any loader used by the manager when the loader starts loading an url. These shouldn't be called outside a loader.
+		[page:String url] — the url to load<br /><br />
+
+		This should be called by any loader used by the manager when the loader starts loading an url.
 		</div>
 		</div>
 
 
 		<h3>[method:null itemEnd]( [page:String url] )</h3>
 		<h3>[method:null itemEnd]( [page:String url] )</h3>
 		<div>
 		<div>
-		[page:String url] — the loaded url
-		</div>
-		<div>
-		This should be called by any loader used by the manager when the loader ended loading an url.  These shouldn't be called outside a loader.
-		</div>
+		[page:String url] — the loaded url<br /><br />
 
 
+		This should be called by any loader used by the manager when the loader ended loading an url.
+		</div>
 
 
-		<h2>Example</h2>
 
 
-		[example:webgl_loader_obj]
+		<h3>[method:null itemError]( [page:String url] )</h3>
+		<div>
+		[page:String url] — the loaded url<br /><br />
 
 
+		This should be called by any loader used by the manager when the loader errors loading an url.
+		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 26 - 9
docs/api/loaders/MaterialLoader.html

@@ -10,7 +10,10 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A loader for loading a [page:Material] in JSON format.</div>
+		<div class="desc">
+			A loader for loading a [page:Material] in JSON format.
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
@@ -43,34 +46,48 @@
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+		Creates a new [name].
 		</div>
 		</div>
+
+		<h2>Properties</h2>
+
+		<h3>[property:LoadingManager manager]</h3>
 		<div>
 		<div>
-		Creates a new [name].
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
+		<h3>[property:Object textures]</h3>
+		<div>Object holding any textures used by the material. See [page.setTextures].</div>
+
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Material].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Material].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the progress event.<br />
-		[page:Function onError] — Will be called when load errors.<br />
-		</div>
-		<div>
+		[page:Function onError] — Will be called when load errors.<br /><br />
+
 		Begin loading from url and return the [page:Material] object that will contain the data.
 		Begin loading from url and return the [page:Material] object that will contain the data.
 		</div>
 		</div>
 
 
 		<h3>[method:Material parse]( [page:Object json] )</h3>
 		<h3>[method:Material parse]( [page:Object json] )</h3>
 		<div>
 		<div>
-		[page:Object json] — The json object containing the parameters of the Material.
+		[page:Object json] — The json object containing the parameters of the Material.<br /><br />
+
+		Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
 		</div>
 		</div>
+
+		<h3>[method:null setTextures]( [page:Object textures] )</h3>
 		<div>
 		<div>
-		Parse a <em>JSON</em> structure and create a new [page:Material] of the type [page:String json.type] with parameters defined in the json object.
+		[page:Object textures] — object containing any textures used by the material.
 		</div>
 		</div>
 
 
+
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 171 - 15
docs/api/loaders/ObjectLoader.html

@@ -10,21 +10,55 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the <em>.type</em> attributes of objects to map them to their original classes.</div>
+		<div class="desc">
+			A loader for loading a JSON resource. Unlike the [page:JSONLoader], this one make use of the
+			<em>.type</em> attributes of objects to map them to their original classes.<br /><br />
+
+			Note that this loader can't load [page:Geometries]. Use [page:JSONLoader] instead for that.<br /><br />
+
+			This uses the [page:FileLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
+		<div>
+
+			[example:webgl_animation_scene WebGL / animation / scene]<br />
+			[example:webgl_loader_json_claraio WebGL / loader / json / claraio]<br />
+			[example:webgl_loader_msgpack WebGL / loader / msgpack]
+		</div>
+
 		<code>
 		<code>
-		// instantiate a loader
-		var loader = new THREE.ObjectLoader();
+var loader = new THREE.ObjectLoader();
 
 
-		// assuming we loaded a JSON structure from elsewhere
-		var object = loader.parse( a_json_object );
+loader.load(
+    // resource URL
+    "models/json/example.json"
 
 
-		scene.add( object );
-		</code>
+    // pass the loaded data to the onLoad function.
+		//Here it is assumed to be an object
+    function ( obj ) {
+				//add the loaded object to the scene
+        scene.add( obj );
+    },
+
+    // Function called when download progresses
+    function ( xhr ) {
+        console.log( (xhr.loaded / xhr.total * 100) + '% loaded' );
+    },
+
+    // Function called when download errors
+    function ( xhr ) {
+        console.error( 'An error happened' );
+    }
+);
 
 
-		[example:webgl_loader_msgpack]
+
+// Alternatively, to parse a previously loaded JSON structure
+var object = loader.parse( a_json_object );
+
+scene.add( object );
+		</code>
 
 
 
 
 
 
@@ -32,21 +66,38 @@
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
-		</div>
-		<div>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
 		Creates a new [name].
 		Creates a new [name].
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
+		<h3>[property:String crossOrigin]</h3>
+		<div>
+		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+	 attribute of the image to the value of *crossOrigin*,
+		prior to starting the load. Default is *undefined*.
+		</div>
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
+		</div>
+
+		<h3>[property:String texturePath]</h3>
+		<div>
+			The base path or URL from which textures will be loaded. See [page:.setTexturePath].
+			Default is the empty string.
+		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Object3D object].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onError] — Will be called when load errors.<br />
 		[page:Function onError] — Will be called when load errors.<br />
@@ -56,12 +107,110 @@
 		</div>
 		</div>
 
 
 
 
-		<h3>[method:Object3D parse]( [page:Object json] )</h3>
+		<h3>[method:Object3D parse]( [page:Object json], [page:Function onLoad]  )</h3>
 		<div>
 		<div>
-		[page:Object json] — required. The JSON source to parse<br />
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+		[page:Function onLoad] — Will be called when parsed completes. The argument will be the parsed [page:Object3D object].<br />
+
+		Parse a <em>JSON</em> structure and return a threejs object.
+		This is used internally by [page:.load], but can also be used directly to parse
+		a previously loaded JSON structure.
 		</div>
 		</div>
+
+		<h3>[method:Object3D parseGeometries]( [page:Object json] )</h3>
 		<div>
 		<div>
-		Parse a <em>JSON</em> content and return a threejs object.
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any [page:Geometry geometries] or [page:BufferGeometry buffer geometries]  in the JSON structure.
+		Internally it uses [page:JSONLoader] for geometries and [page:BufferGeometryLoader] for buffer geometries.
+		</div>
+
+		<h3>[method:Object3D parseMaterials]( [page:Object json] )</h3>
+		<div>
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any materials in the JSON structure using [page:MaterialLoader].
+		</div>
+
+		<h3>[method:Object3D parseAnimations]( [page:Object json] )</h3>
+		<div>
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any animations in the JSON structure, using [page:AnimationClip.parse].
+		</div>
+
+		<h3>[method:Object3D parseImages]( [page:Object json] )</h3>
+		<div>
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any images in the JSON structure, using [page:ImageLoader].
+		</div>
+
+		<h3>[method:Object3D parseTextures]( [page:Object json] )</h3>
+		<div>
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any textures in the JSON structure.
+		</div>
+
+		<h3>[method:Object3D parseObject]( [page:Object json] )</h3>
+		<div>
+		[page:Object json] — required. The JSON source to parse.<br /><br />
+
+		This is used [page:.parse] to parse any objects in the JSON structure.
+		Objects can be of the following types:
+
+		<ul>
+			<li>
+				[page:Scene]
+			</li>
+			<li>
+				[page:PerspectiveCamera]
+			</li>
+			<li>
+				[page:OrthographicCamera]
+			</li>
+			<li>
+				[page:AmbientLight]
+			</li>
+			<li>
+				[page:DirectionalLight]
+			</li>
+			<li>
+				[page:PointLight]
+			</li>
+			<li>
+				[page:SpotLight]
+			</li>
+			<li>
+				[page:HemisphereLight]
+			</li>
+			<li>
+				[page:Mesh]
+			</li>
+			<li>
+				[page:LOD]
+			</li>
+			<li>
+				[page:Line]
+			</li>
+			<li>
+				[page:LineSegments]
+			</li>
+			<li>
+				[page:Points]
+			</li>
+			<li>
+				[page:Sprite]
+			</li>
+			<li>
+				[page:Group]
+			</li>
+			<li>
+				[page:Object3D]
+			</li>
+
+		</ul>
 		</div>
 		</div>
 
 
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
 		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
@@ -69,6 +218,13 @@
 		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
 		[page:String value] — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
 		</div>
 		</div>
 
 
+		<h3>[method:null setTexturePath]( [page:String value] )</h3>
+		<div>
+		[page:String value] — The base path or URL from which textures will be loaded.<br /><br />
+
+
+		</div>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 42 - 9
docs/api/loaders/TextureLoader.html

@@ -10,7 +10,10 @@
 	<body>
 	<body>
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Class for loading a [page:Texture texture].</div>
+		<div class="desc">
+			Class for loading a [page:Texture texture].
+			This uses the [page:ImageLoader] internally for loading files.
+		</div>
 
 
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
@@ -46,9 +49,8 @@
 
 
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<h3>[name]( [page:LoadingManager manager] )</h3>
 		<div>
 		<div>
-		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].
-		</div>
-		<div>
+		[page:LoadingManager manager] — The [page:LoadingManager loadingManager] for the loader to use. Default is [page:LoadingManager THREE.DefaultLoadingManager].<br /><br />
+
 		Creates a new [name].
 		Creates a new [name].
 		</div>
 		</div>
 
 
@@ -57,24 +59,55 @@
 
 
 		<h3>[property:String crossOrigin]</h3>
 		<h3>[property:String crossOrigin]</h3>
 		<div>
 		<div>
-		default — *null*.<br />
-		If set, assigns the *crossOrigin* attribute of the image to the value of *crossOrigin*, prior to starting the load.
+		If set, assigns the [link:https://developer.mozilla.org/en-US/docs/Web/HTML/CORS_settings_attributes crossOrigin]
+	 attribute of the image to the value of *crossOrigin*, prior to starting the load. Default is *undefined*.
+		</div>
+
+
+		<h3>[property:LoadingManager manager]</h3>
+		<div>
+			The [page:LoadingManager loadingManager]  the loader is using. Default is [page:DefaultLoadingManager].
 		</div>
 		</div>
 
 
+		<h3>[property:String path]</h3>
+		<div>The base path from which files will be loaded. See [page:.setPath]. Default is *undefined*.</div>
+
+
+		<h3>[property:String withCredentials]</h3>
+		<div>
+			Whether the XMLHttpRequest uses credentials - see [page:.setWithCredentials].
+			Default is *undefined*.
+		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<h3>[method:null load]( [page:String url], [page:Function onLoad], [page:Function onProgress], [page:Function onError] )</h3>
 		<div>
 		<div>
-		[page:String url] — required<br />
+		[page:String url] — the path or URL to the file. This can also be a
+			[link:https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs Data URI].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onLoad] — Will be called when load completes. The argument will be the loaded [page:Texture texture].<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
 		[page:Function onProgress] — Will be called while load progresses. The argument will be the XmlHttpRequest instance, that contain .[page:Integer total] and .[page:Integer loaded] bytes.<br />
-		[page:Function onError] — Will be called when load errors.<br />
+		[page:Function onError] — Will be called when load errors.<br /><br />
+
+		Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
 		</div>
 		</div>
+
+		<h3>[method:null setCrossOrigin]( [page:String value] )</h3>
+		<div>Set the [page:.crossOrigin] attribute.</div>
+
+		<h3>[method:FileLoader setPath]( [page:String path] )</h3>
 		<div>
 		<div>
-		Begin loading from url and pass the loaded [page:Texture texture] to onLoad.
+			Set the base path or URL from which to load files. This can be useful if
+			you are loading many models from the same directory.
 		</div>
 		</div>
 
 
+		<h3>[method:FileLoader setWithCredentials]( [page:Boolean value] )</h3>
+		Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or
+		TLS client certificates. See
+		[link:https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/withCredentials XMLHttpRequest.withCredentials].<br />
+		Note that this has no effect if you are loading files locally or from the same domain.
+		<div>
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 67 - 22
docs/api/materials/LineBasicMaterial.html

@@ -14,48 +14,93 @@
 
 
 		<div class="desc">A material for drawing wireframe-style geometries.</div>
 		<div class="desc">A material for drawing wireframe-style geometries.</div>
 
 
+		<h2>Examples</h2>
 
 
-		<h2>Constructor</h2>
+		<div>
+			[example:webgl_buffergeometry_drawcalls WebGL / buffergeometry / drawcalls]<br />
+			[example:webgl_buffergeometry_lines WebGL / buffergeometry / lines]<br />
+			[example:webgl_buffergeometry_lines_indexed WebGL / buffergeometry / lines / indexed]<br />
+			[example:webgl_decals WebGL / decals]<br />
+			[example:webgl_geometry_nurbs WebGL / geometry / nurbs]<br />
+			[example:webgl_geometry_shapes WebGL / geometry / shapes]<br />
+			[example:webgl_geometry_spline_editor WebGL / geometry / spline / editor]<br />
+			[example:webgl_interactive_buffergeometry WebGL / interactive / buffergeometry]<br />
+			[example:webgl_interactive_voxelpainter WebGL / interactive / voxelpainter]<br />
+			[example:webgl_lines_colors WebGL / lines / colors]<br />
+			[example:webgl_lines_cubes WebGL / lines / cubes]<br />
+			[example:webgl_lines_dashed WebGL / lines / dashed]<br />
+			[example:webgl_lines_sphere WebGL / lines / sphere]<br />
+			[example:webgl_lines_splines WebGL / lines / splines]<br />
+			[example:webgl_materials WebGL / materials]<br />
+			[example:webgl_physics_rope WebGL / phyics / rope]
+		</div>
 
 
+		<code>
+var material = new THREE.LineBasicMaterial( {
+	color: 0xffffff,
+	lineWidth: 1,
+	linecap: 'round', //ignored by WebGLRenderer
+	linejoin:  'round' //ignored by WebGLRenderer
+} );
+		</code>
+
+		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 
 
-		<div>parameters is an object with one or more properties defining the material's appearance.</div>
 		<div>
 		<div>
-		color — Line color in hexadecimal. Default is 0xffffff.<br />
-		linewidth — Line thickness. Default is 1.<br />
-		linecap — Define appearance of line ends. Default is 'round'.<br />
-		linejoin — Define appearance of line joints. Default is 'round'.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is false.
+		[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+		Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
+
+		The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+		string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Integer color]</h3>
-		<div>Sets the color of the line. Default is 0xffffff.</div>
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
+
+		<h3>[property:Boolean isLineBasicMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are line basic materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
 
 
 		<h3>[property:Float linewidth]</h3>
 		<h3>[property:Float linewidth]</h3>
-		<div>Controls line thickness. Default is 1.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, with the [page:WebGLRenderer WebGL] renderer on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<div>
+			Controls line thickness. Default is *1*.<br /><br />
+
+			Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+			with the [page:WebGLRenderer WebGL] renderer on Windows platforms linewidth will
+			always be 1 regardless of the set value.
+		</div>
 
 
 		<h3>[property:String linecap]</h3>
 		<h3>[property:String linecap]</h3>
-		<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line ends. Possible values are 'butt', 'round' and 'square'.
+			Default is 'round'.<br /><br />
+
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
 		<h3>[property:String linejoin]</h3>
 		<h3>[property:String linejoin]</h3>
-		<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line joints. Possible values are 'round', 'bevel' and 'miter'. Default is 'round'. <br /><br />
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
 
 
+		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 42 - 30
docs/api/materials/LineDashedMaterial.html

@@ -14,20 +14,32 @@
 
 
 		<div class="desc">A material for drawing wireframe-style geometries with dashed lines.</div>
 		<div class="desc">A material for drawing wireframe-style geometries with dashed lines.</div>
 
 
+		<h2>Examples</h2>
+
+		<div>
+			[example:webgl_lines_dashed WebGL / lines / dashed]<br />
+			[example:canvas_lines_dashed Canvas / lines /dashed]
+		</div>
+
+		<code>
+var material = new THREE.LineDashedMaterial( {
+	color: 0xffffff,
+	lineWidth: 1,
+	scale: 1,
+	dashSize: 3,
+	gapSize: 1,
+} );
+		</code>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
-		<div>parameters is an object with one or more properties defining the material's appearance.</div>
-		<div>
-		color — Line color in hexadecimal. Default is 0xffffff.<br />
-		linewidth — Line thickness. Default is 1.<br />
-		scale  — The scale of the dashed part of a line. Default is 1.<br />
-		dashSize  — The size of the dash. Default is 3.<br />
-		gapSize - The size of the gap. Default is 1.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is false.
+		[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+		Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
+
+		The exception is the property [page:Hexadecimal color], which can be passed i	as a hexadecimal
+		string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 
 
@@ -35,38 +47,38 @@
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
 		<h3>[property:Color color]</h3>
 		<h3>[property:Color color]</h3>
-		<div>
-		Sets the color of the line. Default is 0xffffff.
-		</div>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
 
 
-		<h3>[property:number linewidth]</h3>
-		<div>Controls line thickness. Default is 1.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<h3>[property:number dashSize]</h3>
+		<div>The size of the dash. This is both the gap with the stroke. Default is *3*.</div>
 
 
-		<h3>[property:number scale]</h3>
-		<div>
-		The scale of the dashed part of a line.
-		</div>
+		<h3>[property:number gapSize]</h3>
+		<div>The size of the gap. Default is *1*.</div>
 
 
-		<h3>[property:number dashSize]</h3>
+		<h3>[property:Boolean isLineDashedMaterial]</h3>
 		<div>
 		<div>
-		The size of the dash. This is both the gap with the stroke. Default is 3.
+			Used to check whether this or derived classes are line dashed materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
-		<h3>[property:number gapSize]</h3>
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
+
+		<h3>[property:Float linewidth]</h3>
 		<div>
 		<div>
-		The size of the gap. Default is 1.
-		</div>
+			Controls line thickness. Default is *1*.<br /><br />
 
 
-		<h3>[property:boolean vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers.</div>
+			Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+			with the [page:WebGLRenderer WebGL] renderer on Windows platforms linewidth will
+			always be 1 regardless of the set value.
+		</div>
 
 
-		<h3>[property:boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:number scale]</h3>
+		<div>The scale of the dashed part of a line. Default is *1*.</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 
 
 
 

+ 132 - 123
docs/api/materials/Material.html

@@ -11,89 +11,51 @@
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
 		<div class="desc">
 		<div class="desc">
-		<p>
+		Abstract base class for materials.<br /><br />
+
 		Materials describe the appearance of [page:Object objects].
 		Materials describe the appearance of [page:Object objects].
-		They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
-		</p>
-		<P>
-		With the exception of [page:MultiMaterial MultiMaterial], the following properties and methods are inherited by all other material types (although they may have different defaults).
-		</P>
+		They are defined in a (mostly) renderer-independent way, so you don't have to
+		rewrite materials if you decide to use a different renderer.<br /><br />
+
+		With the exception of [page:MultiMaterial MultiMaterial], the following properties
+		and methods are inherited by all other material types (although they may have different defaults).
 		</div>
 		</div>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 
 
 		<h3>[name]()</h3>
 		<h3>[name]()</h3>
-		<div>
-		This creates a generic material.
-		</div>
+		<div>This creates a generic material.</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
-		<h3>[property:Integer id]</h3>
-		<div>
-		Unique number for this material instance.
-		</div>
-
-		<h3>[property:String name]</h3>
-		<div>
-		Material name. Default is an empty string.
-		</div>
-
-		<h3>[property:String type]</h3>
-		<div>
-		Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a scene.
-		</div>
-
-		<h3>[property:Boolean fog]</h3>
-		<div>
-		Whether the material is affected by fog. Default is *true*.
-		</div>
-
-		<h3>[property:Boolean lights]</h3>
-		<div>
-		Whether the material is affected by lights. Default is *true*.
-		</div>
-
-		<h3>[property:Integer side]</h3>
+		<h3>[property:Float alphaTest]</h3>
 		<div>
 		<div>
-		Defines which side of faces will be rendered - front, back or both.
-		Default is [page:Materials THREE.FrontSide].
-		Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
+		Sets the alpha value to be used when running an alpha test.
+		The material will not be renderered if the opacity is lower than this value.
+		Default is *0*.
 		</div>
 		</div>
 
 
-		<h3>[property:Integer shading]</h3>
+		<h3>[property:Integer blendDst]</h3>
 		<div>
 		<div>
-		Defines how the material is shaded.
-		This can be either [page:Materials THREE.SmoothShading] (default)	or [page:Materials THREE.FlatShading].
+		Blending destination. Default is [page:CustomBlendingEquation OneMinusSrcAlphaFactor].
+		See the destination factors [page:CustomBlendingEquation constants] for all possible values.<br />
+		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 		</div>
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>
-		Defines whether vertex coloring is used.
-		Default is [page:Materials THREE.NoColors].
-		Other options are [page:Materials THREE.VertexColors] and [page:Materials THREE.FaceColors].
-		</div>
+		<h3>[property:Integer blendDstAlpha]</h3>
+		<div>The tranparency of the [page:.blendDst]. Default is *null*.</div>
 
 
-		<h3>[property:Float opacity]</h3>
+		<h3>[property:Integer blendEquation]</h3>
 		<div>
 		<div>
-		Float in the range of *0.0* - *1.0* indicating how transparent the material is.
-		A value of *0.0* indicates fully transparent, *1.0* is fully opaque.<br />
-		If the material's [property:Boolean transparent] property is not set to *true*, the material will remain
-		fully opaque and this value will only affect its color. <br />
-		Default is *1.0*.
+		Blending equation to use when applying blending. Default is [page:CustomBlendingEquation AddEquation].
+		See the blending equation [page:CustomBlendingEquation constants] for all possible values.<br />
+		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean transparent]</h3>
-		<div>
-		Defines whether this material is transparent. This has an effect on rendering
-		as transparent objects need special treatment and are rendered after
-		non-transparent objects. <br />
-		When set to true, the extent to which the material is transparent is
-		controlled by setting it's [property:Float opacity] property. <br />
-		Default is *false*.
-		</div>
+		<h3>[property:Integer blendEquationAlpha]</h3>
+		<div>The tranparency of the [page:.blendEquation]. Default is *null*.</div>
 
 
 		<h3>[property:Blending blending]</h3>
 		<h3>[property:Blending blending]</h3>
 		<div>
 		<div>
@@ -109,18 +71,33 @@
 		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 		</div>
 
 
-		<h3>[property:Integer blendDst]</h3>
+		<h3>[property:Integer blendSrcAlpha]</h3>
+		<div>The tranparency of the [page:.blendSrc]. Default is *null*.</div>
+
+		<h3>[property:Boolean clipIntersection]</h3>
 		<div>
 		<div>
-		Blending destination. Default is [page:CustomBlendingEquation OneMinusSrcAlphaFactor].
-		See the destination factors [page:CustomBlendingEquation constants] for all possible values.<br />
-		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
+		Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
+		Default is *false*.
 		</div>
 		</div>
 
 
-		<h3>[property:Integer blendEquation]</h3>
+		<h3>[property:Array clippingPlanes]</h3>
 		<div>
 		<div>
-		Blending equation to use when applying blending. Default is [page:CustomBlendingEquation AddEquation].
-		See the blending equation [page:CustomBlendingEquation constants] for all possible values.<br />
-		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
+		User-defined clipping planes specified as THREE.Plane objects in world space.
+		These planes apply to the objects this material is attached to.
+		Points in space whose dot product with the plane is negative are cut away.
+		See the [example:webgl_clipping_intersection WebGL / clipping /intersection] example.
+		Default is *null*.
+		</div>
+
+		<h3>[property:Boolean clipShadows]</h3>
+		<div>
+		Defines whether to clip shadows according to the clipping planes specified on this material. Default is *false*.
+		</div>
+
+		<h3>[property:Boolean colorWrite]</h3>
+		<div>
+		Whether to render the material's color.
+		This can be used in conjunction with a mesh's [property:Integer renderOrder] property to create invisible objects that occlude other objects. Default is *true*.
 		</div>
 		</div>
 
 
 		<h3>[property:Integer depthFunc]</h3>
 		<h3>[property:Integer depthFunc]</h3>
@@ -135,90 +112,122 @@
 
 
 		<h3>[property:Boolean depthWrite]</h3>
 		<h3>[property:Boolean depthWrite]</h3>
 		<div>
 		<div>
-		Whether rendering this material has any effect on the depth buffer. Default is *true*.
+		Whether rendering this material has any effect on the depth buffer. Default is *true*.<br /><br />
+
+		When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
 		</div>
 		</div>
+
+		<h3>[property:Boolean fog]</h3>
+		<div>Whether the material is affected by fog. Default is *true*.</div>
+
+		<h3>[property:Integer id]</h3>
+		<div>Unique number for this material instance.</div>
+
+		<h3>[property:Boolean isMaterial]</h3>
 		<div>
 		<div>
-		When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
+			Used to check whether this or derived classes are materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
-		<h3>[property:Array clippingPlanes]</h3>
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *true*.</div>
+
+		<h3>[property:String name]</h3>
+		<div>Optional name of the object (doesn't need to be unique). Default is an empty string.</div>
+
+		<h3>[property:Boolean needsUpdate]</h3>
 		<div>
 		<div>
-		User-defined clipping planes specified as THREE.Plane objects in world space.
-		These planes apply to the objects this material is attached to.
-		Points in space whose dot product with the plane is negative are cut away.
-		See the [example:webgl_clipping_intersection WebGL / clipping /intersection] example.
-		Default is *null*.
+		Specifies that the material needs to be updated at the WebGL level.
+		Set it to true if you made changes that need to be reflected in WebGL.<br />
+		This property is automatically set to *true* when instancing a new material.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean clipIntersection]</h3>
+		<h3>[property:Float opacity]</h3>
 		<div>
 		<div>
-		Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
-		Default is *false*.
+		Float in the range of *0.0* - *1.0* indicating how transparent the material is.
+		A value of *0.0* indicates fully transparent, *1.0* is fully opaque.<br />
+		If the material's [property:Boolean transparent] property is not set to *true*, the material will remain
+		fully opaque and this value will only affect its color. <br />
+		Default is *1.0*.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean clipShadows]</h3>
+		<h3>[property:Float overdraw]</h3>
 		<div>
 		<div>
-		Defines whether to clip shadows according to the clipping planes specified on this material. Default is *false*.
+		Amount of triangle expansion at draw time.
+		This is a workaround for cases when gaps appear between triangles when using [page:CanvasRenderer].
+		*0.5* tends to give good results across browsers. Default is *0*.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean colorWrite]</h3>
+		<h3>[property:Boolean polygonOffset]</h3>
 		<div>
 		<div>
-		Whether to render the material's color.
-		This can be used in conjunction with a mesh's [property:Integer renderOrder] property to create invisible objects that occlude other objects. Default is *true*.
+		Whether to use polygon offset. Default is *false*. This corresponds to the *GL_POLYGON_OFFSET_FILL* WebGL feature.
 		</div>
 		</div>
 
 
+		<h3>[property:Integer polygonOffsetFactor]</h3>
+		<div>Sets the polygon offset factor. Default is *0*.</div>
+
+		<h3>[property:Integer polygonOffsetUnits]</h3>
+		<div>Sets the polygon offset units. Default is *0*.</div>
+
 		<h3>[property:String precision]</h3>
 		<h3>[property:String precision]</h3>
 		<div>
 		<div>
 		Override the renderer's default precision for this material. Can be "*highp*", "*mediump*" or "*lowp*".
 		Override the renderer's default precision for this material. Can be "*highp*", "*mediump*" or "*lowp*".
-		Defaults for the WebGLRenderer is "*highp*" if supported by the device.
+		Defaults is *null*.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean polygonOffset]</h3>
+		<h3>[property:Boolean premultipliedAlpha]</h3>
 		<div>
 		<div>
-		Whether to use polygon offset. Default is *false*. This corresponds to the *GL_POLYGON_OFFSET_FILL* WebGL feature.
+		Whether to premultiply the alpha (transparency) value.
+		See [Example:webgl_materials_transparency WebGL / Materials / Transparency] for an example of the difference.
+		Default is *false*.
 		</div>
 		</div>
 
 
-		<h3>[property:Integer polygonOffsetFactor]</h3>
+		<h3>[property:Integer shading]</h3>
 		<div>
 		<div>
-		Sets the polygon offset factor. Default is *0*.
+		Defines how the material is shaded.
+		This can be either [page:Materials THREE.SmoothShading] (default)	or [page:Materials THREE.FlatShading].
 		</div>
 		</div>
 
 
-		<h3>[property:Integer polygonOffsetUnits]</h3>
+		<h3>[property:Integer side]</h3>
 		<div>
 		<div>
-		Sets the polygon offset units. Default is *0*.
+		Defines which side of faces will be rendered - front, back or both.
+		Default is [page:Materials THREE.FrontSide].
+		Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
 		</div>
 		</div>
 
 
-		<h3>[property:Float alphaTest]</h3>
+		<h3>[property:Boolean transparent]</h3>
 		<div>
 		<div>
-		Sets the alpha value to be used when running an alpha test.
-		The material will not be renderered if the opacity is lower than this value.
-		Default is *0*.
+		Defines whether this material is transparent. This has an effect on rendering
+		as transparent objects need special treatment and are rendered after
+		non-transparent objects. <br />
+		When set to true, the extent to which the material is transparent is
+		controlled by setting it's [property:Float opacity] property. <br />
+		Default is *false*.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean premultipliedAlpha]</h3>
+		<h3>[property:String type]</h3>
 		<div>
 		<div>
-		Whether to premultiply the alpha (transparency) value.
-		See [Example:webgl_materials_transparency WebGL / Materials / Transparency] for an example of the difference.
-		Default is *false*.
+		Value is the string 'Material'. This shouldn't be changed, and can be used to
+		find all objects of this type in a scene.
 		</div>
 		</div>
 
 
-		<h3>[property:Float overdraw]</h3>
+		<h3>[property:String uuid]</h3>
 		<div>
 		<div>
-		Amount of triangle expansion at draw time.
-		This is a workaround for cases when gaps appear between triangles when using [page:CanvasRenderer].
-		*0.5* tends to give good results across browsers. Default is *0*.
+		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this material instance.
+		This gets automatically assigned, so this shouldn't be edited.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean visible]</h3>
+		<h3>[property:Integer vertexColors]</h3>
 		<div>
 		<div>
-		Defines whether this material is visible. Default is *true*.
+		Defines whether vertex coloring is used.
+		Default is [page:Materials THREE.NoColors].
+		Other options are [page:Materials THREE.VertexColors] and [page:Materials THREE.FaceColors].
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean needsUpdate]</h3>
+		<h3>[property:Boolean visible]</h3>
 		<div>
 		<div>
-		Specifies that the material needs to be updated at the WebGL level.
-		Set it to true if you made changes that need to be reflected in WebGL.<br />
-		This property is automatically set to *true* when instancing a new material.
+		Defines whether this material is visible. Default is *true*.
 		</div>
 		</div>
 
 
 
 
@@ -226,6 +235,18 @@
 
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
 
+		<h3>[method:Material clone]( )</h3>
+		<div>Return a new materials with the same parameters as this material.</div>
+
+		<h3>[method:Material copy]( [page:material material] )</h3>
+		<div>Copy the parameters from the passed material into this material.</div>
+
+		<h3>[method:null dispose]()</h3>
+		<div>
+		This disposes the material. Textures of a material don't get disposed.
+		These needs to be disposed by [page:Texture Texture].
+		</div>
+
 		<h3>[method:null setValues]( [page:object values] )</h3>
 		<h3>[method:null setValues]( [page:object values] )</h3>
 		<div>
 		<div>
 		values -- a container with parameters.<br />
 		values -- a container with parameters.<br />
@@ -238,23 +259,11 @@
 		Convert the material to Three JSON format.
 		Convert the material to Three JSON format.
 		</div>
 		</div>
 
 
-		<h3>[method:Material clone]( [page:material material] )</h3>
-		<div>
-		material -- this material gets the cloned information (optional).<br />
-		This clones the material in the optional parameter and returns it.
-		</div>
-
 		<h3>[method:null update]()</h3>
 		<h3>[method:null update]()</h3>
 		<div>
 		<div>
 		Call [method:null dispatchEvent]( { type: '[page:object update]' }) on the material.
 		Call [method:null dispatchEvent]( { type: '[page:object update]' }) on the material.
 		</div>
 		</div>
 
 
-		<h3>[method:null dispose]()</h3>
-		<div>
-		This disposes the material. Textures of a material don't get disposed.
-		These needs to be disposed by [page:Texture Texture].
-		</div>
-
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 76 - 69
docs/api/materials/MeshBasicMaterial.html

@@ -12,8 +12,12 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A material for drawing geometries in a simple shaded (flat or wireframe) way.</div>
-		<div class="desc">The default will render as flat polygons. To draw the mesh as wireframe, simply set the 'wireframe' property to true.</div>
+		<div class="desc">
+			A material for drawing geometries in a simple shaded (flat or wireframe) way.<br /><br />
+
+			This material is not affected by lights.
+		</div>
+
 
 
 		<iframe id="scene" src="scenes/material-browser.html#MeshBasicMaterial"></iframe>
 		<iframe id="scene" src="scenes/material-browser.html#MeshBasicMaterial"></iframe>
 
 
@@ -36,109 +40,112 @@
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
-
-		<div>parameters is an object with one or more properties defining the material's appearance.</div>
 		<div>
 		<div>
-		color — geometry color in hexadecimal. Default is 0xffffff.<br />
-		map — Set texture map. Default is null <br />
-		lightMap — Set light map. Default is null.<br />
-		lightMapIntensity — Set light map intensity. Default is 1.<br />
-		aoMap — Set ao map. Default is null.<br />
-		aoMapIntensity — Set ao map intensity. Default is 1.<br />
-		specularMap — Set specular map. Default is null.<br />
-		alphaMap — Set alpha map. Default is null.<br />
-		envMap — Set env map. Default is null.<br />
-		combine — Set combine operation. Default is THREE.MultiplyOperation.<br />
-		reflectivity — Set reflectivity. Default is 1.<br />
-		refractionRatio — Set refraction ratio. Default is 0.98.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is true.<br />
-		shading — Define shading type. Default is THREE.SmoothShading.<br />
-		wireframe — render geometry as wireframe. Default is false.<br />
-		wireframeLinewidth — Line thickness. Default is 1.<br />
-		wireframeLinecap — Define appearance of line ends. Default is 'round'.<br />
-		wireframeLinejoin — Define appearance of line joints. Default is 'round'.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		skinning — Define whether the material uses skinning. Default is false.<br />
-		morphTargets — Define whether the material uses morphTargets. Default is false.
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
+
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Integer color]</h3>
-		<div>Sets the color of the geometry. Default is 0xffffff.</div>
-
-		<h3>[property:Texture map]</h3>
-		<div>
-		Set texture map. Default is  null.
+		<h3>[property:Texture alphaMap]</h3>
+		<div>The alpha map is a grayscale texture that controls the opacity across the surface
+			(black: fully transparent; white: fully opaque). Default is null.<br /><br />
+
+			Only the color of the texture is used, ignoring the alpha channel if one exists.
+			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
+			green channel when sampling this texture due to the extra bit of precision provided
+			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
+			luminance/alpha textures will also still work as expected.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map. Default is null. The lightMap requires a second set of UVs.</div>
-
-		<h3>[property:Float lightMapIntensity]</h3>
-		<div>Intensity of the baked light. Default is 1.</div>
-
 		<h3>[property:Texture aoMap]</h3>
 		<h3>[property:Texture aoMap]</h3>
-		<div>Set ambient occlusion map. Default is null.</div>
+		<div>The ambient occlusion map. Default is null.</div>
 
 
 		<h3>[property:Float aoMapIntensity]</h3>
 		<h3>[property:Float aoMapIntensity]</h3>
 		<div>Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.</div>
 		<div>Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.</div>
 
 
-		<h3>[property:Texture specularMap]</h3>
-		<div>Set specular map. Default is null.</div>
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
 
 
-		<h3>[property:Texture alphaMap]</h3>
-		<div>The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). Default is null.</div>
-		<div>Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.</div>
+		<h3>[property:Integer combine]</h3>
+		<div>
+			How to combine the result of the surface's color with the environment map, if any.<br /><br />
+
+			Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation],
+			[page:Materials THREE.AddOperation]. If mix is chosen, the [page:.reflectivity] is used to
+			blend between the two colors.
+		</div>
+
+		<h3>[property:Boolean isMeshBasicMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh basic materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
 
 
 		<h3>[property:TextureCube envMap]</h3>
 		<h3>[property:TextureCube envMap]</h3>
-		<div>Set env map. Default is null.</div>
+		<div>The environment map. Default is null.</div>
 
 
-		<h3>[property:Integer combine]</h3>
-		<div>How to combine the result of the surface's color with the environment map, if any.</div>
+		<h3>[property:Texture lightMap]</h3>
+		<div>The light map. Default is null. The lightMap requires a second set of UVs.</div>
+
+		<h3>[property:Float lightMapIntensity]</h3>
+		<div>Intensity of the baked light. Default is 1.</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
+
+		<h3>[property:Texture map]</h3>
+		<div>The color map. Default is  null.</div>
+
+		<h3>[property:Boolean morphTargets]</h3>
+		<div>Define whether the material uses morphTargets. Default is false.</div>
 
 
-		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
 
 
 		<h3>[property:Float reflectivity]</h3>
 		<h3>[property:Float reflectivity]</h3>
-		<div>How much the environment map affects the surface; also see "combine".</div>
+		<div>How much the environment map affects the surface; also see [page:.combine].</div>
 
 
 		<h3>[property:Float refractionRatio]</h3>
 		<h3>[property:Float refractionRatio]</h3>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:Boolean skinning]</h3>
+		<div>Define whether the material uses skinning. Default is false.</div>
 
 
-		<h3>[property:String shading]</h3>
-		<div>Define shading type. Default is THREE.SmoothShading.</div>
+		<h3>[property:Texture specularMap]</h3>
+		<div>Specular map used by the material. Default is null.</div>
 
 
 		<h3>[property:Boolean wireframe]</h3>
 		<h3>[property:Boolean wireframe]</h3>
-		<div>Render geometry as wireframe. Default is false (i.e. render as flat polygons).</div>
-
-		<h3>[property:Float wireframeLinewidth]</h3>
-		<div>Controls wireframe thickness. Default is 1.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<div>Render geometry as wireframe. Default is *false* (i.e. render as flat polygons).</div>
 
 
 		<h3>[property:String wireframeLinecap]</h3>
 		<h3>[property:String wireframeLinecap]</h3>
-		<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.<br /><br />
+
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
 		<h3>[property:String wireframeLinejoin]</h3>
 		<h3>[property:String wireframeLinejoin]</h3>
-		<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.<br /><br />
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Boolean skinning]</h3>
-		<div>Define whether the material uses skinning. Default is false.</div>
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
 
 
-		<h3>[property:Boolean morphTargets]</h3>
-		<div>Define whether the material uses morphTargets. Default is false.</div>
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
+		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 62 - 11
docs/api/materials/MeshDepthMaterial.html

@@ -36,32 +36,83 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters is an object with one or more properties defining the material's appearance.
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.
 		</div>
 		</div>
+
+		<h2>Properties</h2>
+		<div>See the base [page:Material] class for common properties.</div>
+
+		<h3>[property:Texture alphaMap]</h3>
+		<div>The alpha map is a grayscale texture that controls the opacity across the surface
+			(black: fully transparent; white: fully opaque). Default is null.<br /><br />
+
+			Only the color of the texture is used, ignoring the alpha channel if one exists.
+			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
+			green channel when sampling this texture due to the extra bit of precision provided
+			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
+			luminance/alpha textures will also still work as expected.
+		</div>
+
+		<h3>[property:Constant depthPacking]</h3>
+		<div>Encoding for depth packing. Default is [page:Textures BasicDepthPacking].</div>
+
+		<h3>[property:Texture displacementMap]</h3>
 		<div>
 		<div>
-		morphTargets -- Define whether the material uses morphTargets. Default is false.<br/>
-		wireframe -- Render geometry as wireframe. Default is false (i.e. render as smooth shaded).<br/>
-		wireframeLinewidth -- Controls wireframe thickness. Default is 1.<br/>
+			The displacement map affects the position of the mesh's vertices. Unlike other maps
+			which only affect the light and shade of the material the displaced vertices can cast shadows,
+			block other objects, and otherwise act as real geometry. The displacement texture is
+			an image where the value of each pixel (white being the highest) is mapped against,
+			and repositions, the vertices of the mesh.
 		</div>
 		</div>
 
 
+		<h3>[property:Float displacementScale]</h3>
+		<div>
+			How much the displacement map affects the mesh (where black is no displacement,
+			and white is maximum displacement). Without a displacement map set, this value is not applied.
+			 Default is 1.
+		</div>
 
 
-		<h2>Properties</h2>
-		<div>See the base [page:Material] class for common properties.</div>
+		<h3>[property:Float displacementBias]</h3>
+		<div>
+			The offset of the displacement map's values on the mesh's vertices.
+			Without a displacement map set, this value is not applied. Default is 0.
+		</div>
+
+		<h3>[property:Boolean fog]</h3>
+		<div>Whether the material is affected by fog. Default is *false*.</div>
+
+		<h3>[property:Boolean isMeshDepthMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh depth materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
+
+		<h3>[property:Texture map]</h3>
+		<div>The color map. Default is  null.</div>
 
 
 		<h3>[property:boolean morphTargets]</h3>
 		<h3>[property:boolean morphTargets]</h3>
 		<div>Define whether the material uses morphTargets. Default is false.</div>
 		<div>Define whether the material uses morphTargets. Default is false.</div>
 
 
+		<h3>[property:Boolean skinning]</h3>
+		<div>Define whether the material uses skinning. Default is false.</div>
+
 		<h3>[property:boolean wireframe]</h3>
 		<h3>[property:boolean wireframe]</h3>
 		<div>Render geometry as wireframe. Default is false (i.e. render as smooth shaded).</div>
 		<div>Render geometry as wireframe. Default is false (i.e. render as smooth shaded).</div>
 
 
-		<h3>[property:number wireframeLinewidth]</h3>
-		<div>
-			Controls wireframe thickness. Default is 1.<br/><br/>
-			Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
+
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
 		</div>
 		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
-
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 97 - 80
docs/api/materials/MeshLambertMaterial.html

@@ -12,7 +12,23 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A material for non-shiny (Lambertian) surfaces, evaluated per vertex.</div>
+		<div class="desc">
+			A material for non-shiny surfaces, without specular highlights.<br /><br />
+
+			The uses a non-physically based [link:https://en.wikipedia.org/wiki/Lambertian_reflectance Lambertian]
+			model	for calculating reflectance. This can simulate some surfaces (such as untreated wood or stone) well,
+			but cannot simulate shiny surfaces with specular highlights (such as varnished wood).<br /><br />
+
+
+
+			Shading is calculated using a [link:https://en.wikipedia.org/wiki/Gouraud_shading Gouraud] shading model.
+			This calculates shading per vertex (i.e. in the [link:https://en.wikipedia.org/wiki/Shader#Vertex_shaders vertex shader])
+			and interpolates the results over the polygon's faces.<br /><br />
+
+			Due to the simplicity of the reflectance and illumination models, performance will be greater
+			when using this material over the [page:MeshPhongMaterial],	[page:MeshStandardMaterial] or [page:MeshPhysicalMaterial],
+			at the cost of some graphical accuracy.
+		</div>
 
 
 		<iframe id="scene" src="scenes/material-browser.html#MeshLambertMaterial"></iframe>
 		<iframe id="scene" src="scenes/material-browser.html#MeshLambertMaterial"></iframe>
 
 
@@ -36,128 +52,129 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- parameters is an object with one or more properties defining the material's appearance.
-		</div>
-		<div>
-		color — Line color in hexadecimal. Default is 0xffffff.<br />
-		map — Sets the texture map. Default is null <br />
-		lightMap — Set light map. Default is null.<br />
-		lightMapIntensity — Set light map intensity. Default is 1.<br />
-		aoMap — Set ao map. Default is null.<br />
-		aoMapIntensity — Set ao map intensity. Default is 1.<br />
-		emissive - Set emissive color. Default is 0x000000.<br />
-		emissiveMap — Set emissive map. Default is null.<br />
-		emissiveIntensity — Set emissive map intensity. Default is 1.<br />
-		specularMap — Set specular map. Default is null.<br />
-		alphaMap — Set alpha map. Default is null.<br />
-		envMap — Set env map. Default is null.<br />
-		combine — Set combine operation. Default is THREE.MultiplyOperation.<br />
-		reflectivity — Set reflectivity. Default is 1.<br />
-		refractionRatio — Set refraction ratio. Default is 0.98.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is false.<br />
-		wireframe — Render geometry as wireframe. Default is false (i.e. render as smooth shaded).<br/>
-		wireframeLinewidth — Controls wireframe thickness. Default is 1.<br/>
-		wireframeLinecap — Define appearance of line ends. Default is 'round'.<br />
-		wireframeLinejoin — Define appearance of line joints. Default is 'round'.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		skinning — Define whether the material uses skinning. Default is false.<br />
-		morphTargets — Define whether the material uses morphTargets. Default is false.<br />
-		morphNormals — Define whether the material uses morphNormals. Default is false.
-		</div>
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
 
 
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
+		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Color color]</h3>
-		<div>
-		Diffuse color of the material. Default is white.<br />
+		<h3>[property:Texture alphaMap]</h3>
+		<div>The alpha map is a grayscale texture that controls the opacity across the surface
+			(black: fully transparent; white: fully opaque). Default is null.<br /><br />
+
+			Only the color of the texture is used, ignoring the alpha channel if one exists.
+			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
+			green channel when sampling this texture due to the extra bit of precision provided
+			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
+			luminance/alpha textures will also still work as expected.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture map]</h3>
-		<div>Set color texture map. Default is null.</div>
+		<h3>[property:Texture aoMap]</h3>
+		<div>The ambient occlusion map. Default is null.</div>
 
 
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map. Default is null. The lightMap requires a second set of UVs.</div>
+		<h3>[property:Float aoMapIntensity]</h3>
+		<div>Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.</div>
 
 
-		<h3>[property:Float lightMapIntensity]</h3>
-		<div>TODO</div>
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
 
 
-		<h3>[property:Texture aoMap]</h3>
-		<div>Set ambient occlusion map. Default is null. The aoMap requires a second set of UVs.</div>
+		<h3>[property:Integer combine]</h3>
+		<div>
+			How to combine the result of the surface's color with the environment map, if any.<br /><br />
 
 
-		<h3>[property:Float aoMapIntensity]</h3>
-		<div>TODO</div>
+			Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation],
+			[page:Materials THREE.AddOperation]. If mix is chosen, the [page:.reflectivity] is used to
+			blend between the two colors.
+		</div>
 
 
 		<h3>[property:Color emissive]</h3>
 		<h3>[property:Color emissive]</h3>
 		<div>
 		<div>
-		Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.<br />
+		Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
+		Default is black.
 		</div>
 		</div>
 
 
 		<h3>[property:Texture emissiveMap]</h3>
 		<h3>[property:Texture emissiveMap]</h3>
-		<div>Set emisssive (glow) map. Default is null. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black.</div>
+		<div>
+		Set emisssive (glow) map. Default is null. The emissive map color is modulated by
+		the emissive color and the emissive intensity. If you have an emissive map, be sure to
+		set the emissive color to something other than black.
+		</div>
 
 
 		<h3>[property:Float emissiveIntensity]</h3>
 		<h3>[property:Float emissiveIntensity]</h3>
 		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
 		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
 
 
-		<h3>[property:Texture specularMap]</h3>
-		<div>Since this material does not have a specular component, the specular value affects only how much of the environment map affects the surface. Default is null.</div>
+		<h3>[property:TextureCube envMap]</h3>
+		<div>The environment map. Default is null.</div>
 
 
-		<h3>[property:Texture alphaMap]</h3>
-		<div>The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). Default is null.</div>
-		<div>Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.</div>
+		<h3>[property:Boolean isMeshLambertMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh Lambert materials. Default is *true*.<br /><br />
 
 
-		<h3>[property:TextureCube envMap]</h3>
-		<div>Set env map. Default is null.</div>
+			You should not change this, as it used internally for optimisation.
+		</div>
 
 
-		<h3>[property:Integer combine]</h3>
-		<div>How to combine the result of the surface's color with the environment map, if any.</div>
+		<h3>[property:Texture lightMap]</h3>
+		<div>The light map. Default is null. The lightMap requires a second set of UVs.</div>
 
 
-		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
+		<h3>[property:Float lightMapIntensity]</h3>
+		<div>Intensity of the baked light. Default is 1.</div>
+
+		<h3>[property:Texture map]</h3>
+		<div>The color map. Default is  null.</div>
+
+		<h3>[property:boolean morphNormals]</h3>
+		<div>
+			Defines whether the material uses morphNormals. Set as true to pass morphNormal
+			attributes from the [page:Geometry]	to the shader. Default is *false*.
+		</div>
+
+		<h3>[property:Boolean morphTargets]</h3>
+		<div>Define whether the material uses morphTargets. Default is false.</div>
 
 
 		<h3>[property:Float reflectivity]</h3>
 		<h3>[property:Float reflectivity]</h3>
-		<div>How much the environment map affects the surface; also see "combine".</div>
+		<div>How much the environment map affects the surface; also see [page:.combine].</div>
 
 
 		<h3>[property:Float refractionRatio]</h3>
 		<h3>[property:Float refractionRatio]</h3>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings. Default is *true*.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:Boolean skinning]</h3>
+		<div>Define whether the material uses skinning. Default is false.</div>
 
 
-		<h3>[property:Boolean wireframe]</h3>
-		<div>Whether the triangles' edges are displayed instead of surfaces. Default is *false*.</div>
+		<h3>[property:Texture specularMap]</h3>
+		<div>Specular map used by the material. Default is null.</div>
 
 
-		<h3>[property:Float wireframeLinewidth]</h3>
-		<div>Line thickness for wireframe mode. Default is *1.0*.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<h3>[property:Boolean wireframe]</h3>
+		<div>Render geometry as wireframe. Default is *false* (i.e. render as flat polygons).</div>
 
 
 		<h3>[property:String wireframeLinecap]</h3>
 		<h3>[property:String wireframeLinecap]</h3>
-		<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.<br /><br />
 
 
-		<h3>[property:String wireframeLinejoin]</h3>
-		<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:String wireframeLinejoin]</h3>
+		<div>
+			Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.<br /><br />
 
 
-		<h3>[property:Boolean skinning]</h3>
-		<div>Define whether the material uses skinning. Default is *false*.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Boolean morphTargets]</h3>
-		<div>Define whether the material uses morphTargets. Default is *false*.</div>
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
 
 
-		<h3>[property:boolean morphNormals]</h3>
-		<div>
-			Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
-			to the shader. Default is *false*.
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
 		</div>
 		</div>
 
 
-
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 24 - 13
docs/api/materials/MeshNormalMaterial.html

@@ -36,33 +36,44 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters is an object with one or more properties defining the material's appearance.
-		</div>
-		<div>
-		wireframe -- Render geometry as wireframe. Default is false (i.e. render as smooth shaded).<br/>
-		wireframeLinewidth -- Controls wireframe thickness. Default is 1.<br/>
-		morphTargets -- Define whether the material uses morphTargets. Default is false.<br/>
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:boolean wireframe]</h3>
-		<div>
-			Render geometry as wireframe. Default is false (i.e. render as smooth shaded).
-		</div>
+		<h3>[property:Boolean fog]</h3>
+		<div>Whether the material is affected by fog. Default is *false*.</div>
 
 
-		<h3>[property:number wireframeLinewidth]</h3>
+		<h3>[property:Boolean isMeshNormalMaterial]</h3>
 		<div>
 		<div>
-			Controls wireframe thickness. Default is 1.<br/><br/>
-			Due to limitations in the ANGLE layer, on Windows platforms linewidth will always be 1 regardless of the set value.
+			Used to check whether this or derived classes are mesh normal materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
+
 		<h3>[property:boolean morphTargets]</h3>
 		<h3>[property:boolean morphTargets]</h3>
 		<div>Define whether the material uses morphTargets. Default is false.</div>
 		<div>Define whether the material uses morphTargets. Default is false.</div>
 
 
+		<h3>[property:boolean wireframe]</h3>
+		<div>
+			Render geometry as wireframe. Default is false (i.e. render as smooth shaded).
+		</div>
+
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
+
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
+		</div>
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 
 
 
 

+ 138 - 127
docs/api/materials/MeshPhongMaterial.html

@@ -12,7 +12,22 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A material for shiny surfaces, evaluated per pixel.</div>
+		<div class="desc">
+			A material for shiny surfaces with specular highlights.<br /><br />
+
+			The uses a non-physically based [link:https://en.wikipedia.org/wiki/LBlinn-Phong_shading_model Blinn-Phong]
+			model	for calculating reflectance. Unlike the Lambertian model used in the [page:MeshLambertMaterial]
+			this can simulate shiny surfaces with specular highlights (such as varnished wood).<br /><br />
+
+			Shading is calculated using a [link:https://en.wikipedia.org/wiki/Phong_shading Phong] shading model.
+			This calculates shading per pixel (i.e. in the [link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragment shader],
+			AKA pixel shader)	which gives more accurate results than the Gouraud model used by [page:MeshLambertMaterial],
+			at the cost of some performance. The [page:MeshStandardMaterial] and [page:MeshPhysicalMaterial]
+			also use this shading model.<br /><br />
+
+			Performance will generally be greater when using this material over the	[page:MeshStandardMaterial]
+			or [page:MeshPhysicalMaterial], at the cost of some graphical accuracy.
+		</div>
 
 
 		<iframe id="scene" src="scenes/material-browser.html#MeshPhongMaterial"></iframe>
 		<iframe id="scene" src="scenes/material-browser.html#MeshPhongMaterial"></iframe>
 
 
@@ -36,92 +51,32 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- an object with one or more of the material's properties defining the material's appearance.
-		</div>
-		<div>
-		color — geometry color in hexadecimal. Default is 0xffffff.<br />
-		specular — Set specular color. Default is 0x111111 .<br />
-		shininess — Set shininess Default is 30.<br />
-		map — Set texture map. Default is null.<br />
-		lightMap — Set light map. Default is null.<br />
-		lightMapIntensity — Set light map intensity. Default is 1.<br />
-		aoMap — Set ao map. Default is null.<br />
-		aoMapIntensity — Set ao map intensity. Default is 1.<br />
-		emissive - Set emissive color. Default is 0x000000.<br />
-		emissiveMap — Set emissive map. Default is null.<br />
-		emissiveIntensity — Set emissive map intensity. Default is 1.<br />
-		bumpMap — Set bump map. Default is null.<br />
-		bumpScale — Set bump map scale. Default is 1.<br />
-		normalMap — Set normal map. Default is null.<br />
-		normalScale — Set normal map scale. Default is (1, 1).<br />
-		displacementMap — Set displacement map. Default is null.<br />
-		displacementScale — Set displacement scale. Default is 1.<br />
-		displacementBias — Set displacement offset. Default is 0.<br />
-		specularMap — Set specular map. Default is null.<br />
-		alphaMap — Set alpha map. Default is null.<br />
-		envMap — Set env map. Default is null.<br />
-		combine — Set combine operation. Default is THREE.MultiplyOperation.<br />
-		reflectivity — Set reflectivity. Default is 1.<br />
-		refractionRatio — Set refraction ratio. Default is 0.98.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is true.<br />
-		shading — Define shading type. Default is THREE.SmoothShading.<br />
-		wireframe — render geometry as wireframe. Default is false.<br />
-		wireframeLinewidth — Line thickness. Default is 1.<br />
-		wireframeLinecap — Define appearance of line ends. Default is 'round'.<br />
-		wireframeLinejoin — Define appearance of line joints. Default is 'round'.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		skinning — Define whether the material uses skinning. Default is false.<br />
-		morphTargets — Define whether the material uses morphTargets. Default is false.<br />
-		morphNormals — Define whether the material uses morphNormals. Default is false.
-		</div>
-		<div>
-		Example:<br>
-		materials.push( new THREE.MeshPhongMaterial( { color: 0xdddddd, specular: 0x009900, shininess: 30, shading: THREE.FlatShading } ) );
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
 
 
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
-
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Color color]</h3>
-		<div>
-		Diffuse color of the material. Default is white.<br />
-		</div>
-
-		<h3>[property:Color specular]</h3>
-		<div>
-		Specular color of the material, i.e., how shiny the material is and the color of its shine. Setting this the same color as the diffuse value (times some intensity) makes the material more metallic-looking; setting this to some gray makes the material look more plastic. Default is dark gray.<br />
+		<h3>[property:Texture alphaMap]</h3>
+		<div>The alpha map is a grayscale texture that controls the opacity across the surface
+			(black: fully transparent; white: fully opaque). Default is null.<br /><br />
+
+			Only the color of the texture is used, ignoring the alpha channel if one exists.
+			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
+			green channel when sampling this texture due to the extra bit of precision provided
+			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
+			luminance/alpha textures will also still work as expected.
 		</div>
 		</div>
 
 
-		<h3>[property:Float shininess]</h3>
-		<div>How shiny the specular highlight is; a higher value gives a sharper highlight. Default is *30*.</div>
-
-		<h3>[property:Texture map]</h3>
-		<div>Set color texture map. Default is null. The texture map color is modulated by the diffuse color.</div>
-
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map. Default is null. The lightMap requires a second set of UVs.</div>
-
-		<h3>[property:Float lightMapIntensity]</h3>
-		<div>TODO</div>
-
 		<h3>[property:Texture aoMap]</h3>
 		<h3>[property:Texture aoMap]</h3>
-		<div>Set ambient occlusion map. Default is null. The aoMap requires a second set of UVs.</div>
+		<div>The ambient occlusion map. Default is null.</div>
 
 
 		<h3>[property:Float aoMapIntensity]</h3>
 		<h3>[property:Float aoMapIntensity]</h3>
-		<div>TODO</div>
-
-		<h3>[property:Color emissive]</h3>
-		<div>
-		Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.<br />
-		</div>
-
-		<h3>[property:Texture emissiveMap]</h3>
-		<div>Set emisssive (glow) map. Default is null. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black.</div>
-
-		<h3>[property:Float emissiveIntensity]</h3>
-		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
+		<div>Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.</div>
 
 
 		<h3>[property:Texture bumpMap]</h3>
 		<h3>[property:Texture bumpMap]</h3>
 		<div>
 		<div>
@@ -131,99 +86,155 @@
 		</div>
 		</div>
 
 
 		<h3>[property:Float bumpScale]</h3>
 		<h3>[property:Float bumpScale]</h3>
-		<div>
-			How much the bump map affects the material. Typical ranges are 0-1. Default is 1.
-		</div>
+		<div>How much the bump map affects the material. Typical ranges are 0-1. Default is 1.</div>
 
 
-		<h3>[property:Texture normalMap]</h3>
-		<div>
-			The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change
-			the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
-		</div>
 
 
-		<h3>[property:Vector2 normalScale]</h3>
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
+
+		<h3>[property:Integer combine]</h3>
 		<div>
 		<div>
-			How much the normal map affects the material. Typical ranges are 0-1. Default is (1,1).
+			How to combine the result of the surface's color with the environment map, if any.<br /><br />
+
+			Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation],
+			[page:Materials THREE.AddOperation]. If mix is chosen, the [page:.reflectivity] is used to
+			blend between the two colors.
 		</div>
 		</div>
 
 
 		<h3>[property:Texture displacementMap]</h3>
 		<h3>[property:Texture displacementMap]</h3>
 		<div>
 		<div>
-			The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry.
-			The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh.
+			The displacement map affects the position of the mesh's vertices. Unlike other maps
+			which only affect the light and shade of the material the displaced vertices can cast shadows,
+			block other objects, and otherwise act as real geometry. The displacement texture is
+			an image where the value of each pixel (white being the highest) is mapped against,
+			and repositions, the vertices of the mesh.
 		</div>
 		</div>
 
 
 		<h3>[property:Float displacementScale]</h3>
 		<h3>[property:Float displacementScale]</h3>
 		<div>
 		<div>
-			How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. Default is 1.
+			How much the displacement map affects the mesh (where black is no displacement,
+			and white is maximum displacement). Without a displacement map set, this value is not applied.
+			 Default is 1.
 		</div>
 		</div>
 
 
 		<h3>[property:Float displacementBias]</h3>
 		<h3>[property:Float displacementBias]</h3>
 		<div>
 		<div>
-			The offset of the displacement map's values on the mesh's vertices. Without a displacement map set, this value is not applied. Default is 0.
+			The offset of the displacement map's values on the mesh's vertices.
+			Without a displacement map set, this value is not applied. Default is 0.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture specularMap]</h3>
-		<div>The specular map value affects both how much the specular surface highlight contributes and how much of the environment map affects the surface. Default is null.</div>
+		<h3>[property:Color emissive]</h3>
+		<div>
+		Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
+		Default is black.
+		</div>
 
 
-		<h3>[property:Texture alphaMap]</h3>
-		<div>The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). Default is null.</div>
-		<div>Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.</div>
+		<h3>[property:Texture emissiveMap]</h3>
+		<div>
+		Set emisssive (glow) map. Default is null. The emissive map color is modulated by
+		the emissive color and the emissive intensity. If you have an emissive map, be sure to
+		set the emissive color to something other than black.
+		</div>
+
+		<h3>[property:Float emissiveIntensity]</h3>
+		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
 
 
 		<h3>[property:TextureCube envMap]</h3>
 		<h3>[property:TextureCube envMap]</h3>
-		<div>Set env map. Default is null.</div>
+		<div>The environment map. Default is null.</div>
 
 
-		<h3>[property:Integer combine]</h3>
-		<div>How to combine the result of the surface's color with the environment map, if any.</div>
+		<h3>[property:Boolean isMeshPhongMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh Phong materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+
+		<h3>[property:Texture lightMap]</h3>
+		<div>The light map. Default is null. The lightMap requires a second set of UVs.</div>
+
+		<h3>[property:Float lightMapIntensity]</h3>
+		<div>Intensity of the baked light. Default is 1.</div>
+
+		<h3>[property:Texture map]</h3>
+		<div>The color map. Default is null. The texture map color is modulated by the diffuse [page:.color].</div>
+
+		<h3>[property:boolean morphNormals]</h3>
+		<div>
+			Defines whether the material uses morphNormals. Set as true to pass morphNormal
+			attributes from the [page:Geometry]	to the shader. Default is *false*.
+		</div>
+
+		<h3>[property:Boolean morphTargets]</h3>
+		<div>Define whether the material uses morphTargets. Default is false.</div>
+
+		<h3>[property:Texture normalMap]</h3>
+		<div>
+			The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change
+			the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
+		</div>
+
+		<h3>[property:Vector2 normalScale]</h3>
+		<div>
+			How much the normal map affects the material. Typical ranges are 0-1.
+			Default is a [page:Vector2] set to (1,1).
+		</div>
 
 
-		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
 
 
 		<h3>[property:Float reflectivity]</h3>
 		<h3>[property:Float reflectivity]</h3>
-		<div>How much the environment map affects the surface; also see "combine".</div>
+		<div>How much the environment map affects the surface; also see [page:.combine].</div>
 
 
 		<h3>[property:Float refractionRatio]</h3>
 		<h3>[property:Float refractionRatio]</h3>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings. Default is *true*.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:Float shininess]</h3>
+		<div>How shiny the [page:.specular] highlight is; a higher value gives a sharper highlight. Default is *30*.</div>
 
 
-		<h3>[property:Integer shading]</h3>
-		<div>How the triangles of a curved surface are rendered: as a smooth surface, as flat separate facets, or no shading at all.</div>
 
 
-		<div>Options are [page:Materials THREE.SmoothShading] (default), [page:Materials THREE.FlatShading].</div>
+		<h3>[property:Boolean skinning]</h3>
+		<div>Define whether the material uses skinning. Default is false.</div>
 
 
-		<h3>[property:Boolean wireframe]</h3>
-		<div>Whether the triangles' edges are displayed instead of surfaces. Default is *false*.</div>
+		<h3>[property:Texture specular]</h3>
+		<div>
+			Specular color of the material. Default is a [page:Color] set to *0x111111* (very dark grey).<br /><br />
 
 
-		<h3>[property:Float wireframeLinewidth]</h3>
-		<div>Line thickness for wireframe mode. Default is *1.0*.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+			This defines how shiny the material is and the color of its shine.
+		</div>
+
+		<h3>[property:Texture specularMap]</h3>
+		<div>
+			The specular map value affects both how much the specular surface highlight
+			contributes and how much of the environment map affects the surface. Default is null.
+		</div>
+
+		<h3>[property:Boolean wireframe]</h3>
+		<div>Render geometry as wireframe. Default is *false* (i.e. render as flat polygons).</div>
 
 
 		<h3>[property:String wireframeLinecap]</h3>
 		<h3>[property:String wireframeLinecap]</h3>
-		<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.<br /><br />
 
 
-		<h3>[property:String wireframeLinejoin]</h3>
-		<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:String wireframeLinejoin]</h3>
+		<div>
+			Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.<br /><br />
 
 
-		<h3>[property:Boolean skinning]</h3>
-		<div>Define whether the material uses skinning. Default is *false*.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Boolean morphTargets]</h3>
-		<div>Define whether the material uses morphTargets. Default is *false*.</div>
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
 
 
-		<h3>[property:boolean morphNormals]</h3>
-		<div>
-			Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
-			to the shader. Default is *false*.
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
 		</div>
 		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 36 - 10
docs/api/materials/MeshPhysicalMaterial.html

@@ -12,7 +12,11 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">An extension of the [page:MeshStandardMaterial] that allows for greater control over reflectivity.</div>
+		<div class="desc">
+			An extension of the [page:MeshStandardMaterial] that allows for greater control over reflectivity.<br /><br />
+
+			Note that for best results you should always specify an [page:.envMap environment map] when using this material.
+		</div>
 
 
 		<!-- <iframe id="scene" src="scenes/material-browser.html#MeshStandardMaterial"></iframe>
 		<!-- <iframe id="scene" src="scenes/material-browser.html#MeshStandardMaterial"></iframe>
 
 
@@ -40,30 +44,52 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- see [page:MeshStandardMaterial]
+		[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+		Any property of the material (including any property inherited from [page:Material] and [page:MeshStandardMaterial]) can be passed in here.<br /><br />
+
+		The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+		string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] and [page:MeshStandardMaterial] classes for common properties.</div>
 		<div>See the base [page:Material] and [page:MeshStandardMaterial] classes for common properties.</div>
 
 
-		<h3>[property:Float reflectivity]</h3>
-		<div>
-		Degree of reflectivity, from *0.0* to *1.0*. Default is *0.5*.<br />
-			
-		This models the reflectivity of non-metallic materials. It has no effect when [page:MeshStandardMaterial.metalness metalness] is *1.0*
-		</div>
-
 		<h3>[property:Float clearCoat]</h3>
 		<h3>[property:Float clearCoat]</h3>
 		<div>
 		<div>
 		ClearCoat level, from *0.0* to *1.0*. Default is *0.0*.
 		ClearCoat level, from *0.0* to *1.0*. Default is *0.0*.
 		</div>
 		</div>
 
 
 		<h3>[property:Float clearCoatRoughness]</h3>
 		<h3>[property:Float clearCoatRoughness]</h3>
+		<div>How rough the clearCoat appears, from *0.0* to *1.0*. Default is *0.0*.</div>
+
+		<h3>[property:Boolean isMeshPhysicalMaterial]</h3>
 		<div>
 		<div>
-		How rough the clearCoat appears, from *0.0* to *1.0*. Default is *0.0*.
+			Used to check whether this or derived classes are mesh physical materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
+		<h3>[property:Object defines]</h3>
+		<div>An object of the form:
+			<code>
+				{ 'PHYSICAL': '' };
+			</code>
+
+			This is used by the [page:WebGLRenderer] for selecting shaders.
+		</div>
+
+		<h3>[property:Float reflectivity]</h3>
+		<div>
+		Degree of reflectivity, from *0.0* to *1.0*. Default is *0.5*.<br />
+
+		This models the reflectivity of non-metallic materials. It has no effect when [page:MeshStandardMaterial.metalness metalness] is *1.0*
+		</div>
+
+		<h2>Methods</h2>
+		<div>See the base [page:Material] and [page:MeshStandardMaterial] classes for common methods.</div>
+
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 160 - 128
docs/api/materials/MeshStandardMaterial.html

@@ -12,7 +12,46 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A standard physically-based material</div>
+		<div class="desc">
+			A standard physically based material.<br /><br />
+
+			Physically based rendering (PBR) has recently become the standard in many 3D applications, such as
+			[link:https://blogs.unity3d.com/2014/10/29/physically-based-shading-in-unity-5-a-primer/ Unity],
+			[link:https://docs.unrealengine.com/latest/INT/Engine/Rendering/Materials/PhysicallyBased/ Unreal] and
+			[link:http://area.autodesk.com/blogs/the-3ds-max-blog/what039s-new-for-rendering-in-3ds-max-2017 3D Studio Max].<br /><br />
+
+			This approach differs from older approaches in that instead of using approximations for the way in which
+			light	interacts with a surface, a physically correct model is used. The idea is that, instead of
+			tweaking materials to look good under specific lighting, a material can	be created that
+			will react 'correctly' under all lighting scenarios.<br /><br />
+
+			In practice this gives a more	accurate and realistic looking result than the [page:MeshLambertMaterial]
+			or [page:MeshPhongMaterial], at the cost of being somewhat more computationally expensive.<br /><br />
+
+			Shading is calculated in the same way as for the [page:MeshPhongMaterial], using a
+			[link:https://en.wikipedia.org/wiki/Phong_shading Phong] shading model.	This calculates shading
+			per pixel (i.e. in the [link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragment shader],
+			AKA pixel shader) which gives more accurate results than the Gouraud model used by
+			[page:MeshLambertMaterial], at the cost of some performance.<br /><br />
+
+			Note that for best results you should always specify an [page:.envMap environment map] when using
+			this material.<br /><br />
+
+			For a non-technical introduction to the concept of PBR and how to set up a PBR material,
+			check out these articles by the people at [link:https://www.marmoset.co marmoset]:
+			<ul>
+				<li>
+					[link:https://www.marmoset.co/posts/basic-theory-of-physically-based-rendering/ Basic Theory of Physically Based Rendering]
+				</li>
+				<li>
+					[link:https://www.marmoset.co/posts/physically-based-rendering-and-you-can-too/ Physically Based Rendering and You Can Too]
+				</li>
+			</ul>
+
+			Technical details of the approach used in Three (and most other PBR systems) can be found is this
+			[link:https://disney-animation.s3.amazonaws.com/library/s2012_pbs_disney_brdf_notes_v2.pdf paper from Disney] (pdf),
+			by Brent Burley.
+		</div>
 
 
 		<iframe id="scene" src="scenes/material-browser.html#MeshStandardMaterial"></iframe>
 		<iframe id="scene" src="scenes/material-browser.html#MeshStandardMaterial"></iframe>
 
 
@@ -36,94 +75,32 @@
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- an object with one or more of the material's properties defining the material's appearance.
-		</div>
-		<div>
-		color — geometry color in hexadecimal. Default is 0xffffff.<br />
-		roughness — Set roughness. Default is 0.5.<br />
-		metalness — Set metalness. Default is 0.5.<br />
-		map — Set texture map. Default is null.<br />
-		lightMap — Set light map. Default is null.<br />
-		lightMapIntensity — Set light map intensity. Default is 1.<br />
-		aoMap — Set ao map. Default is null.<br />
-		aoMapIntensity — Set ao map intensity. Default is 1.<br />
-		emissive - Set emissive color. Default is 0x000000.<br />
-		emissiveMap — Set emissive map. Default is null.<br />
-		emissiveIntensity — Set emissive map intensity. Default is 1.<br />
-		bumpMap — Set bump map. Default is null.<br />
-		bumpMapScale — Set bump map scale. Default is 1.<br />
-		normalMap — Set normal map. Default is null.<br />
-		normalScale — Set normal XY scale. Default is (1, 1).<br />
-		displacementMap — Set displacement map. Default is null.<br />
-		displacementScale — Set displacement scale. Default is 1.<br />
-		displacementBias — Set displacement offset. Default is 0.<br />
-		roughnessMap - Set roughness map. Default is null.<br />
-		metalnessMap - Set metalness map. Default is null.<br />
-		alphaMap — Set alpha map. Default is null.<br />
-		envMap — Set env map. Default is null.<br />
-		envMapIntensity — Set env map intensity. Default is 1.0.<br />
-		refractionRatio — Set refraction ratio. Default is 0.98.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is true.<br />
-		shading — Define shading type. Default is THREE.SmoothShading.<br />
-		wireframe — render geometry as wireframe. Default is false.<br />
-		wireframeLinewidth — Line thickness. Default is 1.<br />
-		wireframeLinecap — Define appearance of line ends. Default is 'round'.<br />
-		wireframeLinejoin — Define appearance of line joints. Default is 'round'.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		skinning — Define whether the material uses skinning. Default is false.<br />
-		morphTargets — Define whether the material uses morphTargets. Default is false.<br />
-		morphNormals — Define whether the material uses morphNormals. Default is false.
-		</div>
-		<div>
-		Example:<br>
-		materials.push( new THREE.MeshStandardMaterial( { color: 0x550000, envMap: reflectionCube, roughness: 0.1, metalness: 1.0 } ) );
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
 
 
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
-
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Color color]</h3>
-		<div>
-		Diffuse color of the material. Default is white.<br />
-		</div>
-
-		<h3>[property:Float roughness]</h3>
-		<div>
-		How rough the material appears. 0.0 means a smooth mirror reflection, 1.0 means fully diffuse.<br />
-		</div>
-
-		<h3>[property:Float metalness]</h3>
-		<div>
-		How much the material is like a metal. Non-metallic materials such as wood or stone use 0.0, metallic use 1.0, nothing in between. A value between 0.0 and 1.0 could be used for a rusty metal look.<br />
+		<h3>[property:Texture alphaMap]</h3>
+		<div>The alpha map is a grayscale texture that controls the opacity across the surface
+			(black: fully transparent; white: fully opaque). Default is null.<br /><br />
+
+			Only the color of the texture is used, ignoring the alpha channel if one exists.
+			For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the
+			green channel when sampling this texture due to the extra bit of precision provided
+			for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and
+			luminance/alpha textures will also still work as expected.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture map]</h3>
-		<div>Set color texture map. Default is null. The texture map color is modulated by the diffuse color.</div>
-
-		<h3>[property:Texture lightMap]</h3>
-		<div>Set light map, a texture that contains pre-baked diffuse lighting added to the surface. Default is null. The lightMap requires a second set of UVs.</div>
-
-		<h3>[property:Float lightMapIntensity]</h3>
-		<div>A scale factor for the light map's effect, higher being brighter.</div>
-
 		<h3>[property:Texture aoMap]</h3>
 		<h3>[property:Texture aoMap]</h3>
-		<div>Set ambient occlusion map, a texture that contains pre-baked darkening due to crevices on the surface. Default is null. The aoMap requires a second set of UVs.</div>
+		<div>The ambient occlusion map. Default is null.</div>
 
 
 		<h3>[property:Float aoMapIntensity]</h3>
 		<h3>[property:Float aoMapIntensity]</h3>
-		<div>A scale factor for the ambient occlusion map's effect, higher being darker and more pronounced.</div>
-
-		<h3>[property:Color emissive]</h3>
-		<div>
-			Emissive (light) color of the material, essentially a solid color unaffected by other lighting. Default is black.<br />
-		</div>
-
-		<h3>[property:Texture emissiveMap]</h3>
-		<div>Set emisssive (glow) map. Default is null. The emissive map color is modulated by the emissive color and the emissive intensity. If you have an emissive map, be sure to set the emissive color to something other than black.</div>
-
-		<h3>[property:Float emissiveIntensity]</h3>
-		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
+		<div>Intensity of the ambient occlusion effect. Default is 1. Zero is no occlusion effect.</div>
 
 
 		<h3>[property:Texture bumpMap]</h3>
 		<h3>[property:Texture bumpMap]</h3>
 		<div>
 		<div>
@@ -133,99 +110,154 @@
 		</div>
 		</div>
 
 
 		<h3>[property:Float bumpScale]</h3>
 		<h3>[property:Float bumpScale]</h3>
-		<div>
-			How much the bump map affects the material. Typical ranges are 0-1. Default is 1.
-		</div>
+		<div>How much the bump map affects the material. Typical ranges are 0-1. Default is 1.</div>
 
 
-		<h3>[property:Texture normalMap]</h3>
-		<div>
-			The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change
-			the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
-		</div>
 
 
-		<h3>[property:Vector2 normalScale]</h3>
-		<div>
-			How much the normal map affects the material. Typical ranges are 0-1. Default is (1, 1).
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
+
+		<h3>[property:Object defines]</h3>
+		<div>An object of the form:
+			<code>
+				{ 'STANDARD': '' };
+			</code>
+
+			This is used by the [page:WebGLRenderer] for selecting shaders.
 		</div>
 		</div>
 
 
 		<h3>[property:Texture displacementMap]</h3>
 		<h3>[property:Texture displacementMap]</h3>
 		<div>
 		<div>
-			The displacement map affects the position of the mesh's vertices. Unlike other maps which only affect the light and shade of the material the displaced vertices can cast shadows, block other objects, and otherwise act as real geometry.
-			The displacement texture is an image where the value of each pixel (white being the highest) is mapped against, and repositions, the vertices of the mesh.
+			The displacement map affects the position of the mesh's vertices. Unlike other maps
+			which only affect the light and shade of the material the displaced vertices can cast shadows,
+			block other objects, and otherwise act as real geometry. The displacement texture is
+			an image where the value of each pixel (white being the highest) is mapped against,
+			and repositions, the vertices of the mesh.
 		</div>
 		</div>
 
 
 		<h3>[property:Float displacementScale]</h3>
 		<h3>[property:Float displacementScale]</h3>
 		<div>
 		<div>
-			How much the displacement map affects the mesh (where black is no displacement, and white is maximum displacement). Without a displacement map set, this value is not applied. Default is 1.
+			How much the displacement map affects the mesh (where black is no displacement,
+			and white is maximum displacement). Without a displacement map set, this value is not applied.
+			 Default is 1.
 		</div>
 		</div>
 
 
 		<h3>[property:Float displacementBias]</h3>
 		<h3>[property:Float displacementBias]</h3>
 		<div>
 		<div>
-			The offset of the displacement map's values on the mesh's vertices. Without a displacement map set, this value is not applied. Default is 0.
+			The offset of the displacement map's values on the mesh's vertices.
+			Without a displacement map set, this value is not applied. Default is 0.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture roughnessMap]</h3>
-		<div>The red channel of this texture is used to alter the roughness of the material.
+		<h3>[property:Color emissive]</h3>
+		<div>
+		Emissive (light) color of the material, essentially a solid color unaffected by other lighting.
+		Default is black.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture metalnessMap]</h3>
-		<div>The red channel of this texture is used to alter the metalness of the material.
+		<h3>[property:Texture emissiveMap]</h3>
+		<div>
+		Set emisssive (glow) map. Default is null. The emissive map color is modulated by
+		the emissive color and the emissive intensity. If you have an emissive map, be sure to
+		set the emissive color to something other than black.
 		</div>
 		</div>
 
 
-		<h3>[property:Texture alphaMap]</h3>
-		<div>The alpha map is a grayscale texture that controls the opacity across the surface (black: fully transparent; white: fully opaque). Default is null.</div>
-		<div>Only the color of the texture is used, ignoring the alpha channel if one exists. For RGB and RGBA textures, the [page:WebGLRenderer WebGL] renderer will use the green channel when sampling this texture due to the extra bit of precision provided for green in DXT-compressed and uncompressed RGB 565 formats. Luminance-only and luminance/alpha textures will also still work as expected.</div>
+		<h3>[property:Float emissiveIntensity]</h3>
+		<div>Intensity of the emissive light. Modulates the emissive color. Default is 1.</div>
 
 
 		<h3>[property:TextureCube envMap]</h3>
 		<h3>[property:TextureCube envMap]</h3>
-		<div>Set env map. Default is null.</div>
+		<div>The environment map. Default is null.</div>
 
 
 		<h3>[property:Float envMapIntensity]</h3>
 		<h3>[property:Float envMapIntensity]</h3>
 		<div>Scales the effect of the environment map by multiplying its color.</div>
 		<div>Scales the effect of the environment map by multiplying its color.</div>
 
 
+		<h3>[property:Boolean isMeshStandardMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh standard materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+
+		<h3>[property:Texture lightMap]</h3>
+		<div>The light map. Default is null. The lightMap requires a second set of UVs.</div>
+
+		<h3>[property:Float lightMapIntensity]</h3>
+		<div>Intensity of the baked light. Default is 1.</div>
+
+		<h3>[property:Texture map]</h3>
+		<div>The color map. Default is null. The texture map color is modulated by the diffuse [page:.color].</div>
+
+		<h3>[property:Float metalness]</h3>
+		<div>
+		How much the material is like a metal. Non-metallic materials such as wood or stone use 0.0, metallic use 1.0, nothing in between. A value between 0.0 and 1.0 could be used for a rusty metal look.<br />
+		</div>
+
+		<h3>[property:Texture metalnessMap]</h3>
+		<div>The red channel of this texture is used to alter the metalness of the material.</div>
+
+		<h3>[property:boolean morphNormals]</h3>
+		<div>
+			Defines whether the material uses morphNormals. Set as true to pass morphNormal
+			attributes from the [page:Geometry]	to the shader. Default is *false*.
+		</div>
+
+		<h3>[property:Boolean morphTargets]</h3>
+		<div>Define whether the material uses morphTargets. Default is false.</div>
+
+		<h3>[property:Texture normalMap]</h3>
+		<div>
+			The texture to create a normal map. The RGB values affect the surface normal for each pixel fragment and change
+			the way the color is lit. Normal maps do not change the actual shape of the surface, only the lighting.
+		</div>
+
+		<h3>[property:Vector2 normalScale]</h3>
+		<div>
+			How much the normal map affects the material. Typical ranges are 0-1.
+			Default is a [page:Vector2] set to (1,1).
+		</div>
+
 		<h3>[property:Float refractionRatio]</h3>
 		<h3>[property:Float refractionRatio]</h3>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 		<div>The index of refraction for an environment map using [page:Textures THREE.CubeRefractionMapping]. Default is *0.98*.</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings. Default is *true*.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:Float roughness]</h3>
+		<div>
+		How rough the material appears. 0.0 means a smooth mirror reflection, 1.0 means fully diffuse.
+		</div>
 
 
-		<h3>[property:Integer shading]</h3>
-		<div>How the triangles of a curved surface are rendered: as a smooth surface, as flat separate facets, or no shading at all.</div>
+		<h3>[property:Texture roughnessMap]</h3>
+		<div>The red channel of this texture is used to alter the roughness of the material.</div>
 
 
-		<div>Options are [page:Materials THREE.SmoothShading] (default), [page:Materials THREE.FlatShading].</div>
+		<h3>[property:Boolean skinning]</h3>
+		<div>Define whether the material uses skinning. Default is false.</div>
 
 
 		<h3>[property:Boolean wireframe]</h3>
 		<h3>[property:Boolean wireframe]</h3>
-		<div>Whether the triangles' edges are displayed instead of surfaces. Default is *false*.</div>
-
-		<h3>[property:Float wireframeLinewidth]</h3>
-		<div>Line thickness for wireframe mode. Default is *1.0*.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<div>Render geometry as wireframe. Default is *false* (i.e. render as flat polygons).</div>
 
 
 		<h3>[property:String wireframeLinecap]</h3>
 		<h3>[property:String wireframeLinecap]</h3>
-		<div>Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+		<div>
+			Define appearance of line ends. Possible values are "butt", "round" and "square". Default is 'round'.<br /><br />
 
 
-		<h3>[property:String wireframeLinejoin]</h3>
-		<div>Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:WebGLRenderer WebGL] renderer, but does work with the [page:CanvasRenderer Canvas] renderer.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineCap 2D Canvas lineCap]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Integer vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
+		<h3>[property:String wireframeLinejoin]</h3>
+		<div>
+			Define appearance of line joints. Possible values are "round", "bevel" and "miter". Default is 'round'.<br /><br />
 
 
-		<h3>[property:Boolean skinning]</h3>
-		<div>Define whether the material uses skinning. Default is *false*.</div>
+			This corresponds to the [link:https://developer.mozilla.org/en/docs/Web/API/CanvasRenderingContext2D/lineJoin 2D Canvas lineJoin]
+			property and it is ignored by the [page:WebGLRenderer WebGL] renderer.
+		</div>
 
 
-		<h3>[property:Boolean morphTargets]</h3>
-		<div>Define whether the material uses morphTargets. Default is *false*.</div>
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
 
 
-		<h3>[property:boolean morphNormals]</h3>
-		<div>
-			Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
-			to the shader. Default is *false*.
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
 		</div>
 		</div>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
+
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 81 - 0
docs/api/materials/MeshToonMaterial.html

@@ -0,0 +1,81 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:Material] &rarr; [page:MeshPhongMaterial] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">An extension of the [page:MeshPhongMaterial] with toon shading.</div>
+
+		<!-- <iframe id="scene" src="scenes/material-browser.html#MeshStandardMaterial"></iframe>
+
+		<script>
+
+		// iOS iframe auto-resize workaround
+
+		if ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) {
+
+			var scene = document.getElementById( 'scene' );
+
+			scene.style.width = getComputedStyle( scene ).width;
+			scene.style.height = getComputedStyle( scene ).height;
+			scene.setAttribute( 'scrolling', 'no' );
+
+		}
+
+		</script> -->
+
+		<h2>Examples</h2>
+		[example:webgl_materials_variations_toon materials / variations / toon]<br />
+
+		<h2>Constructor</h2>
+
+		<h3>[name]( [page:Object parameters] )</h3>
+		<div>
+		[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+		Any property of the material (including any property inherited from [page:Material] and [page:MeshStandardMaterial]) can be passed in here.<br /><br />
+
+		The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+		string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
+		</div>
+
+
+		<h2>Properties</h2>
+		<div>See the base [page:Material] and [page:MeshPhongMaterial] classes for common properties.</div>
+
+		<h3>[property:Texture gradientMap]</h3>
+		<div>Gradient map for the toon shading. Default is *null*.</div>
+
+		<h3>[property:Boolean isMeshToonMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are mesh toon materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+		<h3>[property:Object defines]</h3>
+		<div>An object of the form:
+			<code>
+				{ 'TOON': '' };
+			</code>
+
+			This is used by the [page:WebGLRenderer] for selecting shaders.
+		</div>
+
+
+		<h2>Methods</h2>
+		<div>See the base [page:Material] and [page:MeshPhongMaterial] classes for common methods.</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 67 - 7
docs/api/materials/MultiMaterial.html

@@ -13,35 +13,95 @@
 		<div class="desc">
 		<div class="desc">
 		A Material to define multiple materials for the same geometry.
 		A Material to define multiple materials for the same geometry.
 		The geometry decides which material is used for which faces by the [page:Face3 faces materialindex].
 		The geometry decides which material is used for which faces by the [page:Face3 faces materialindex].
-		The materialindex corresponds with the index of the material in the materials array.
+		The material index corresponds with the index of the material in the [page:.materials] array.
 		</div>
 		</div>
 
 
+		<h2>Examples</h2>
+		<div>
+			[example:webgl_animation_skinning_morph WebGL / animation / skinning / morph]<br />
+			[example:webgl_effects_parallaxbarrier WebGL / effect / parallaxbarrier]<br />
+			[example:webgl_geometry_colors_blender WebGL / geometry / colors / blender]<br />
+			[example:webgl_geometry_text_earcut WebGL / geometry / text / earcut]<br />
+			[example:webgl_geometry_text_pnltri WebGL / geometry / text / pnltri]<br />
+			[example:webgl_geometry_text WebGL / geometry / text]<br />
+			[example:webgl_loader_ctm_materials WebGL / loader / ctm / materials]<br />
+			[example:webgl_loader_json_blender WebGL / loader / json / blender]<br />
+			[example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]<br />
+			[example:webgl_loader_mmd WebGL / loader / mmd]<br />
+			[example:webgl_materials_cars WebGL / materials / cars]<br />
+			[example:webgl_materials_lightmap  WebGL / materials / lightmap]<br />
+			[example:webgl_materials WebGL / materials /  / ]<br />
+			[example:webgl_nearestneighbour WebGL / nearestneighbour]<br />
+			[example:webgl_objects_update WebGL / objects / update]<br />
+			[example:webgl_panorama_cube WebGL / panorama / cube]<br />
+			[example:webgl_skinning_simple WebGL / skinning / simple]
+
+		</div>
+
+		<code>
+//The following will create a cube with a different material applied to each side
+var materials = [
+
+    new THREE.MeshBasicMaterial( { color: 0xff0000 ) } ), // right
+    new THREE.MeshBasicMaterial( { color: 0x0000ff ) } ), // left
+    new THREE.MeshBasicMaterial( { color: 0x00ff00 ) } ), // top
+    new THREE.MeshBasicMaterial( { color: 0xffff00 ) } ), // bottom
+    new THREE.MeshBasicMaterial( { color: 0x00ffff ) } ), // back
+    new THREE.MeshBasicMaterial( { color: 0xff00ff ) } )  // front
+
+];
+
+var cubeSidesMaterial = new THREE.MultiMaterial( materials );
+
+var cubeGeometry = new THREE.BoxBufferGeometry( 100, 100, 100, 1, 1, 1 );
+
+var cubeMesh = new THREE.Mesh( cubeGeometry, cubeSidesMaterial );
+
+scene.add( cubeMesh );
+		</code>
 
 
 		<h2>Constructor</h2>
 		<h2>Constructor</h2>
 
 
 
 
 		<h3>[name]( [page:Array materials] )</h3>
 		<h3>[name]( [page:Array materials] )</h3>
 		<div>
 		<div>
-		materials -- The materials for the geometry.
-		</div>
-		<div>
-		Creates a MultiMaterial with the correct materials.
+		[page:Array materials] -- an array of [page:Material Materials] to be used in the MultiMaterial.<br /><br />
+
+		Creates a new [name].
 		</div>
 		</div>
 
 
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 
 
+		<h3>[property:Boolean isMultiMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are multi materials. Default is *true*.<br /><br />
 
 
+			You should not change this, as it used internally for optimisation.
+		</div>
 
 
 		<h3>[property:Array materials]</h3>
 		<h3>[property:Array materials]</h3>
+		<div>An array containing the materials being used by the MultiMaterial.</div>
+
+		<h3>[property:String uuid]</h3>
 		<div>
 		<div>
-		Get or set the materials for the geometry.
+		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this material instance.
+		This gets automatically assigned, so this shouldn't be edited.
 		</div>
 		</div>
 
 
-		<h2>Methods</h2>
+		<h3>[property:Array visible]</h3>
+		<div>Whether or not [page:Mesh meshes] using this material should be rendered.</div>
 
 
+		<h2>Methods</h2>
 
 
+		<h3>[method:MultiMaterial clone]()</h3>
+		<div>Return a clone of this MultiMaterial.</div>
 
 
+		<h3>[method:null toJSON]( [page:object meta] )</h3>
+		<div>
+		meta -- object containing metadata such as textures or images for the material.<br />
+		Convert the material to Three JSON format.
+		</div>
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 55 - 23
docs/api/materials/PointsMaterial.html

@@ -14,50 +14,82 @@
 
 
 		<div class="desc">The default material used by [page:Points].</div>
 		<div class="desc">The default material used by [page:Points].</div>
 
 
+		<h2>Examples</h2>
+		<div>
+			[example:misc_controls_fly misc / controls / fly]<br />
+			[example:webgl_buffergeometry_drawcalls WebGL / BufferGeometry / drawcalls]<br />
+			[example:webgl_buffergeometry_points WebGL / BufferGeometry / points]<br />
+			[example:webgl_buffergeometry_points_interleaved WebGL / BufferGeometry / points / interleaved]<br />
+			[example:webgl_camera WebGL / camera ]<br />
+			[example:webgl_geometry_convex WebGL / geometry / convex]<br />
+			[example:webgl_geometry_shapes WebGL / geometry / shapes]<br />
+			[example:webgl_interactive_raycasting_points WebGL / interactive / raycasting / points]<br />
+			[example:webgl_multiple_elements_text WebGL / multiple / elements / text]<br />
+			[example:webgl_points_billboards WebGL / points / billboards]<br />
+			[example:webgl_points_billboards_colors WebGL / points / billboards / colors]<br />
+			[example:webgl_points_dynamic WebGL / points / dynamic]<br />
+			[example:webgl_points_random WebGL / points / random]<br />
+			[example:webgl_points_sprites WebGL / points / sprites]<br />
+			[example:webgl_trails WebGL / trails]
+		</div>
 
 
-		<h2>Constructor</h2>
+		<code>
+//This will add a starfield to the background of a scene
+var starsGeometry = new THREE.Geometry();
 
 
-		<h3>[name]( [page:Object parameters] )</h3>
+for ( var i = 0; i < 10000; i ++ ) {
+
+	var star = new THREE.Vector3();
+	star.x = THREE.Math.randFloatSpread( 2000 );
+	star.y = THREE.Math.randFloatSpread( 2000 );
+	star.z = THREE.Math.randFloatSpread( 2000 );
+
+	geometry.vertices.push( star );
 
 
-		<div>parameters is an object with one or more properties defining the material's appearance.</div>
+}
 
 
+var starsMaterial = new THREE.PointsMaterial( { color: 0x888888 } )
+
+var starField = new THREE.Points( geometry, starsMaterial );
+
+scene.add( starField );
+		</code>
+
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		color — Points color in hexadecimal. Default is 0xffffff.<br />
-		map — a [page:Texture texture].If defined, then a point has the data from texture as colors. Default is null.<br />
-		size — Define size of points. Default is 1.0.<br />
-		sizeAttenuation — Enable/disable size attenuation with distance.<br />
-		vertexColors — Define whether the material uses vertex colors, or not. Default is false.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is true.
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
+
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Number color]</h3>
+		<h3>[property:Color color]</h3>
+		<div>[page:Color] of the material, by default set to white (0xffffff).</div>
 
 
-		<div>Sets the color of the points. Default is 0xffffff.</div>
+		<h3>[property:Boolean isPointsMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are points materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
 
 
 		<h3>[property:Texture map]</h3>
 		<h3>[property:Texture map]</h3>
 
 
-		<div>Sets the color of the points using data from a texture.</div>
+		<div>Sets the color of the points using data from a [page:Texture].</div>
 
 
 		<h3>[property:Number size]</h3>
 		<h3>[property:Number size]</h3>
-
 		<div>Sets the size of the points. Default is 1.0.</div>
 		<div>Sets the size of the points. Default is 1.0.</div>
 
 
 		<h3>[property:Boolean sizeAttenuation]</h3>
 		<h3>[property:Boolean sizeAttenuation]</h3>
-
 		<div>Specify whether points' size will get smaller with the distance. Default is true.</div>
 		<div>Specify whether points' size will get smaller with the distance. Default is true.</div>
 
 
-		<h3>[property:Boolean vertexColors]</h3>
-		<div>Define how the vertices gets colored. Possible values are THREE.NoColors, THREE.FaceColors and THREE.VertexColors. Default is THREE.NoColors.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
-
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings.</div>
-		<div>This setting might not have any effect when used with certain renderers. For example, it is ignored with the [page:CanvasRenderer Canvas] renderer, but does work with the [page:WebGLRenderer WebGL] renderer.</div>
-
-
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 53 - 3
docs/api/materials/RawShaderMaterial.html

@@ -9,11 +9,61 @@
 	</head>
 	</head>
 	<body>
 	<body>
 		[page:ShaderMaterial] &rarr;
 		[page:ShaderMaterial] &rarr;
-		
+
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">This class works just like [page:ShaderMaterial], except that definitions of built-in uniforms and attributes are not automatically prepended to the GLSL shader code.</div>
-		
+		<div class="desc">
+			This class works just like [page:ShaderMaterial], except that definitions of
+			built-in uniforms and attributes are not automatically prepended to the GLSL shader code.
+		</div>
+
+		<h2>Examples</h2>
+		<div>
+			[example:webgl_buffergeometry_rawshader WebGL / buffergeometry / rawshader]<br />
+			[example:webgl_buffergeometry_instancing_billboards WebGL / buffergeometry / instancing / billboards]<br />
+			[example:webgl_buffergeometry_instancing_dynamic WebGL / buffergeometry / instancing / dynamic]<br />
+			[example:webgl_buffergeometry_instancing_interleaved_dynamic WebGL / buffergeometry / instancing / interleaved / dynamic]<br />
+			[example:webgl_buffergeometry_instancing WebGL / buffergeometry / instancing]<br />
+			[example:webgl_interactive_instances_gpu WebGL / interactive / instances /gpu]<br />
+			[example:webgl_raymarching_reflect WebGL / raymarching / reflect]
+		</div>
+
+		<code>
+var material = new THREE.RawShaderMaterial( {
+
+    uniforms: {
+        time: { value: 1.0 }
+    },
+    vertexShader: document.getElementById( 'vertexShader' ).textContent,
+    fragmentShader: document.getElementById( 'fragmentShader' ).textContent,
+
+} );
+		</code>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]( [page:Object parameters] )</h3>
+		<div>
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material] and [page:ShaderMaterial]) can be passed in here.<br /><br />
+		</div>
+
+
+		<h2>Properties</h2>
+		<div>See the base [page:Material] and [page:ShaderMaterial] classes for common methods.</div>
+
+		<h3>[property:Boolean isRawShaderMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are raw shader materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
+
+		<h2>Methods</h2>
+		<div>See the base [page:Material] and [page:ShaderMaterial] classes for common methods.</div>
+
+
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 317 - 130
docs/api/materials/ShaderMaterial.html

@@ -12,7 +12,10 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">Material rendered with custom shaders. A shader is a small program written in [link:https://www.opengl.org/documentation/glsl/ GLSL] to run on the GPU. You may want to use a custom shader if you need to:
+		<div class="desc">
+			A material rendered with custom shaders. A shader is a small program written in
+			[link:https://www.khronos.org/files/opengles_shading_language.pdf_ES GLSL] that runs on the GPU.
+			You may want to use a custom shader if you need to:
 		<ul>
 		<ul>
 			<li>implement an effect not included with any of the built-in [page:Material materials]</li>
 			<li>implement an effect not included with any of the built-in [page:Material materials]</li>
 			<li>combine many objects into a single [page:Geometry] or [page:BufferGeometry] in order to improve performance</li>
 			<li>combine many objects into a single [page:Geometry] or [page:BufferGeometry] in order to improve performance</li>
@@ -20,13 +23,64 @@
 		There are the following notes to bear in mind when using a *ShaderMaterial*:
 		There are the following notes to bear in mind when using a *ShaderMaterial*:
 
 
 		<ul>
 		<ul>
-			<li>A *ShaderMaterial* will only be rendered properly by [page:WebGLRenderer], since the GLSL code in the *vertexShader* and *fragmentShader* properties must be compiled and run on the GPU using WebGL.</li>
-			<li>As of THREE r72, directly assigning attributes in a *ShaderMaterial* is no longer supported. A [page:BufferGeometry] instance (instead of a [page:Geometry] instance) must be used instead, using [page:BufferAttribute] instances to define custom attributes.</li>
-			<li>As of THREE r77, [page:WebGLRenderTarget] or [page:WebGLRenderTargetCube] instances are no longer supposed to be used as uniforms. Their [page:Texture texture] property must be used instead.</li>
+			<li>
+				A *ShaderMaterial* will only be rendered properly by [page:WebGLRenderer],
+				since the GLSL code in the [link:https://en.wikipedia.org/wiki/Shader#Vertex_shaders vertexShader]
+				and [link:https://en.wikipedia.org/wiki/Shader#Pixel_shaders fragmentShader] properties must
+				be compiled and run on the GPU using WebGL.
+			</li>
+			<li>
+				As of THREE r72, directly assigning attributes in a ShaderMaterial is no longer supported.
+				A [page:BufferGeometry] instance (instead of a [page:Geometry] instance) must be used instead,
+				using [page:BufferAttribute] instances to define custom attributes.
+			</li>
+			<li>
+				As of THREE r77, [page:WebGLRenderTarget] or [page:WebGLRenderTargetCube] instances
+				are no longer supposed to be used as uniforms. Their [page:Texture texture] property
+				must be used instead.
+			</li>
+			<li>
+				Built in attributes an uniforms are passed to the shaders along with your code.
+				If you don't want the [page:WebGLProgram] to add anything to your shader code, you can use
+				[page:RawShaderMaterial] instead of this class.
+			</li>
 		</ul>
 		</ul>
 		</div>
 		</div>
 
 
-		<h3>Example</h3>
+		<h2>Examples</h2>
+
+		<div>
+			[example:webgl_animation_cloth webgl / animation / cloth ]<br />
+			[example:webgl_buffergeometry_custom_attributes_particles webgl / buffergeometry / custom / attributes / particles]<br />
+			[example:webgl_buffergeometry_selective_draw webgl / buffergeometry / selective / draw]<br />
+			[example:webgl_custom_attributes webgl / custom / attributes]<br />
+			[example:webgl_custom_attributes_lines webgl / custom / attributes / lines]<br />
+			[example:webgl_custom_attributes_points webgl / custom / attributes / points]<br />
+			[example:webgl_custom_attributes_points2 webgl / custom / attributes / points2]<br />
+			[example:webgl_custom_attributes_points3 webgl / custom / attributes / points3]<br />
+			[example:webgl_depth_texture webgl / depth / texture]<br />
+			[example:webgl_gpgpu_birds webgl / gpgpu / birds]<br />
+			[example:webgl_gpgpu_protoplanet webgl / gpgpu / protoplanet]<br />
+			[example:webgl_gpgpu_water webgl / gpgpu / water]<br />
+			[example:webgl_hdr webgl / hdr]<br />
+			[example:webgl_interactive_points webgl / interactive / points]<br />
+			[example:webgl_kinect webgl / kinect]<br />
+			[example:webgl_lights_hemisphere webgl / lights / hemisphere]<br />
+			[example:webgl_marchingcubes webgl / marchingcubes]<br />
+			[example:webgl_materials_bumpmap_skin webgl / materials / bumpmap / skin]<br />
+			[example:webgl_materials_envmaps webgl / materials / envmaps]<br />
+			[example:webgl_materials_lightmap webgl / materials / lightmap]<br />
+			[example:webgl_materials_parallaxmap webgl / materials / parallaxmap]<br />
+			[example:webgl_materials_shaders_fresnel webgl / materials / shaders / fresnel]<br />
+			[example:webgl_materials_skin webgl_materials / skin]<br />
+			[example:webgl_materials_texture_hdr webgl / materials / texture / hdr]<br />
+			[example:webgl_materials_wireframe webgl / materials / wireframe]<br />
+			[example:webgl_modifier_tessellation webgl / modifier / tessellation]<br />
+			[example:webgl_nearestneighbour webgl / nearestneighbour]<br />
+			[example:webgl_postprocessing_dof2 webgl / postprocessing / dof2]<br />
+			[example:webgl_postprocessing_godrays webgl / postprocessing / godrays]
+
+		</div>
 
 
 		<code>
 		<code>
 		var material = new THREE.ShaderMaterial( {
 		var material = new THREE.ShaderMaterial( {
@@ -44,118 +98,180 @@
 		} );
 		} );
 		</code>
 		</code>
 
 
-		<h3>Vertex shaders and fragment shaders</h3>
-		<p>You can specify two different types of shaders for each material:</p>
-		<ul>
-			<li>The *vertex shader* runs first; it receives *attributes*, calculates/manipulates the position of each individual vertex, and passes additional data (*varying*s) to the fragment shader.</li>
-			<li>The *fragment shader* runs second; it sets the color of each individual "fragment" (pixel) rendered to the screen.</li>
-		</ul>
-		<p>There are three types of variables in shaders: uniforms, attributes, and varyings:</p>
-		<ul>
-			<li>*Uniforms* are variables that have the same value for all vertices---lighting, fog, and shadow maps are examples of data that would be stored in uniforms. Uniforms can be accessed by both the vertex shader and the fragment shader.</li>
-			<li>*Attributes* are variables associated with each vertex---for instance, the vertex position, face normal, and vertex color are all examples of data that would be stored in attributes. Attributes can <em>only</em> be accessed within the vertex shader.</li>
-			<li>*Varyings* are variables that are passed from the vertex shader to the fragment shader. For each fragment, the value of each varying will be smoothly interpolated from the values of adjacent vertices.</li>
-		</ul>
-		<p>Note that <em>within</em> the shader itself, uniforms and attributes act like constants; you can only modify their values by passing different values to the buffers from your JavaScript code.</p>
-		<h3>Built-in attributes and uniforms</h3>
-		<p>
-		[page:WebGLRenderer] provides many attributes and uniforms to shaders by default; definitions of these variables are prepended to your *fragmentShader* and *vertexShader* code by [page:WebGLProgram] when the shader is compiled; you don't need to declare them yourself. These variables are described in [page:WebGLProgram].
-		</p>
-		<p>
-		Some of these uniforms or attributes (e.g. those pertaining lighting, fog, etc.) require properties to be set on the material in order for [page:WebGLRenderer] to copy the appropriate values to the GPU---make sure to set these flags if you want to use these features in your own shader.
-		</p>
-		<p>
-		If you don't want [page:WebGLProgram] to add anything to your shader code, you can use [page:RawShaderMaterial] instead of this class.
-		</p>
-
-		<h3>Custom attributes and uniforms</h3>
-		<p>Both custom attributes and uniforms must be declared in your GLSL shader code (within *vertexShader* and/or *fragmentShader*). Custom uniforms must be defined in <em>both</em> the *uniforms* property of your *ShaderMaterial*, whereas any custom attributes must be defined via [page:BufferAttribute] instances. Note that *varying*s only need to be declared within the shader code (not within the material).
-		</p>
-
-		<p>To declare a custom attribute, please reference the [page:BufferGeometry] page for an overview, and the [page:BufferAttribute] page for a detailed look at the *BufferAttribute* API.</p>
-		<p>When creating your attributes, each typed array that you create to hold your attribute's data must be a multiple of your data type's size. For example, if your attribute is a [page:Vector3 THREE.Vector3] type, and you have 3000 vertices in your [page:BufferGeometry], your typed array value must be created with a length of 3000 * 3, or 9000 (one value per-component). A table of each data type's size is shown below for reference:</p>
-
-		<table>
-			<caption><a id="attribute-sizes">Attribute sizes</a></caption>
-			<thead>
-				<tr>
-					<th>GLSL type</th>
-					<th>JavaScript type</th>
-					<th>Size</th>
-				</tr>
-			</thead>
-			<tbody>
-				<tr>
-					<td>float</td>
-					<td>[page:Number]</td>
-					<td>1</td>
-				</tr>
-				<tr>
-					<td>vec2</td>
-					<td>[page:Vector2 THREE.Vector2]</td>
-					<td>2</td>
-				</tr>
-				<tr>
-					<td>vec3</td>
-					<td>[page:Vector3 THREE.Vector3]</td>
-					<td>3</td>
-				</tr>
-				<tr>
-					<td>vec3</td>
-					<td>[page:Color THREE.Color]</td>
-					<td>3</td>
-				</tr>
-				<tr>
-					<td>vec4</td>
-					<td>[page:Vector4 THREE.Vector4]</td>
-					<td>4</td>
-				</tr>
-			</tbody>
-		</table>
-
-		<p>Note that attribute buffers are <em>not</em> refreshed automatically when their values change. To update custom attributes, set the *needsUpdate* flag to true on the [page:BufferAttribute] of the geometry (see [page:BufferGeometry] for further details).</p>
-
-		<p>
-		To declare a custom [page:Uniform], use the *uniforms* property:
-		<code>
-		uniforms: {
-			time: { value: 1.0 },
-			resolution: { value: new THREE.Vector2() }
-		}
-		</code>
-		</p>
+		<h2>Vertex shaders and fragment shaders</h2>
 
 
-		<h2>Constructor</h2>
+		<div>
+			<p>You can specify two different types of shaders for each material:</p>
+			<ul>
+				<li>
+					The vertex shader runs first; it receives *attributes*, calculates / manipulates
+					the position of each individual vertex, and passes additional data (*varying*s) to the fragment shader.
+				</li>
+				<li>
+					The fragment ( or pixel ) shader runs second; it sets the color of each individual "fragment"
+					(pixel) rendered to the screen.
+				</li>
+			</ul>
+			<p>There are three types of variables in shaders: uniforms, attributes, and varyings:</p>
+			<ul>
+				<li>
+					*Uniforms* are variables that have the same value for all vertices - lighting, fog,
+					and shadow maps are examples of data that would be stored in uniforms.
+					Uniforms can be accessed by both the vertex shader and the fragment shader.
+				</li>
+				<li>
+					*Attributes* are variables associated with each vertex---for instance, the vertex position,
+					face normal, and vertex color are all examples of data that would be stored in attributes.
+					Attributes can <em>only</em> be accessed within the vertex shader.
+				</li>
+				<li>
+					*Varyings* are variables that are passed from the vertex shader to the fragment shader.
+					For each fragment, the value of each varying will be smoothly interpolated from the values of adjacent vertices.
+				</li>
+			</ul>
+			<p>
+				Note that <em>within</em> the shader itself, uniforms and attributes act like constants;
+				you can only modify their values by passing different values to the buffers from your JavaScript code.
+			</p>
+		</div>
+
+
+	<h2>Built-in attributes and uniforms</h2>
+
+	<div>
+			<p>
+			The [page:WebGLRenderer] provides many attributes and uniforms to shaders by default;
+			definitions of these variables are prepended to your *fragmentShader* and *vertexShader*
+			code by the [page:WebGLProgram] when the shader is compiled; you don't need to declare them yourself.
+			See [page:WebGLProgram] for details of these variables.
+			</p>
+			<p>
+			Some of these uniforms or attributes (e.g. those pertaining lighting, fog, etc.)
+			require properties to be set on the material in order for [page:WebGLRenderer] to copy
+			the appropriate values to the GPU - make sure to set these flags if you want to use these
+			features in your own shader.
+			</p>
+			<p>
+			If you don't want [page:WebGLProgram] to add anything to your shader code, you can use
+			[page:RawShaderMaterial] instead of this class.
+			</p>
+		</div>
+
+
+		<h2>Custom attributes and uniforms</h2>
 
 
-		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- An object containing various parameters setting up shaders and their uniforms.
+			<p>
+				Both custom attributes and uniforms must be declared in your GLSL shader code
+				(within *vertexShader* and/or *fragmentShader*). Custom uniforms must be defined in <em>both</em>
+				the *uniforms* property of your *ShaderMaterial*, whereas any custom attributes must be
+				defined via [page:BufferAttribute] instances. Note that *varying*s only need to
+				be declared within the shader code (not within the material).
+			</p>
+			<p>
+				To declare a custom attribute, please reference the [page:BufferGeometry] page for an overview,
+				and the [page:BufferAttribute] page for a detailed look at the *BufferAttribute* API.
+			</p>
+			<p>
+				When creating your attributes, each typed array that you create to hold your
+				attribute's data must be a multiple of your data type's size. For example, if your
+				attribute is a [page:Vector3 THREE.Vector3] type, and you have 3000 vertices in your
+				[page:BufferGeometry], your typed array value must be created with a length of 3000 * 3,
+				or 9000 (one value per-component). A table of each data type's size is shown below for reference:
+			</p>
+
+			<table>
+				<caption><a id="attribute-sizes">Attribute sizes</a></caption>
+				<thead>
+					<tr>
+						<th>GLSL type</th>
+						<th>JavaScript type</th>
+						<th>Size</th>
+					</tr>
+				</thead>
+				<tbody>
+					<tr>
+						<td>float</td>
+						<td>[page:Number]</td>
+						<td>1</td>
+					</tr>
+					<tr>
+						<td>vec2</td>
+						<td>[page:Vector2 THREE.Vector2]</td>
+						<td>2</td>
+					</tr>
+					<tr>
+						<td>vec3</td>
+						<td>[page:Vector3 THREE.Vector3]</td>
+						<td>3</td>
+					</tr>
+					<tr>
+						<td>vec3</td>
+						<td>[page:Color THREE.Color]</td>
+						<td>3</td>
+					</tr>
+					<tr>
+						<td>vec4</td>
+						<td>[page:Vector4 THREE.Vector4]</td>
+						<td>4</td>
+					</tr>
+				</tbody>
+			</table>
+
+			<p>
+				Note that attribute buffers are <em>not</em> refreshed automatically when their values change. To update custom attributes,
+				set the *needsUpdate* flag to true on the [page:BufferAttribute] of the geometry (see [page:BufferGeometry]
+				for further details).
+			</p>
+
+			<p>
+			To declare a custom [page:Uniform], use the *uniforms* property:
+			<code>
+			uniforms: {
+				time: { value: 1.0 },
+				resolution: { value: new THREE.Vector2() }
+			}
+			</code>
+			</p>
+
 		</div>
 		</div>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		shading — Define shading type. Default is THREE.SmoothShading.<br />
-		fog — Define whether the material color is affected by global fog settings. Default is true.<br />
-		wireframe — render geometry as wireframe. Default is false.<br />
-		wireframeLinewidth — Line thickness. Default is 1.<br />
-		vertexColors — Define how the vertices gets colored. Default is THREE.NoColors.<br />
-		skinning — Define whether the material uses skinning. Default is false.<br />
-		morphTargets — Define whether the material uses morphTargets. Default is false.
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.
 		</div>
 		</div>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
-		<h3>[property:Object uniforms]</h3>
+		<h3>[property:Boolean clipping]</h3>
 		<div>
 		<div>
-		Object specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form
-		<code>
-		{ value: 1.0 }
-		</code>
-		where *value* is the value of the uniform. Names must match the name of the uniform, as defined in the GLSL code. Note that uniforms are refreshed on every frame, so updating the value of the uniform will immediately update the value available to the GLSL code.
+		Defines whether this material supports clipping; true to let the renderer pass the clippingPlanes uniform. Default is false.
+		</div>
+
+		<h3>[property:Object defaultAttributeValues]</h3>
+		<div>
+			When the rendered geometry doesn't include these attributes but the material does,
+			 these default values will be passed to the shaders. This avoids errors when buffer data is missing.
+
+			<code>
+this.defaultAttributeValues = {
+	'color': [ 1, 1, 1 ],
+	'uv': [ 0, 0 ],
+	'uv2': [ 0, 0 ]
+};
+			</code>
+
 		</div>
 		</div>
 
 
+
 		<h3>[property:Object defines]</h3>
 		<h3>[property:Object defines]</h3>
 		<div>
 		<div>
-		Defines custom constants using *#define* directives within the GLSL code for both the vertex shader and the fragment shader; each key/value pair yields another directive:
+		Defines custom constants using *#define* directives within the GLSL code for both the
+		vertex shader and the fragment shader; each key/value pair yields another directive:
 		<code>
 		<code>
 		defines: {
 		defines: {
 			FOO: 15,
 			FOO: 15,
@@ -170,78 +286,149 @@
 		in the GLSL code.
 		in the GLSL code.
 		</div>
 		</div>
 
 
-		<h3>[property:String vertexShader]</h3>
+		<h3>[property:Object extensions]</h3>
 		<div>
 		<div>
-		Vertex shader GLSL code.  This is the actual code for the shader. In the example above, the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.
+		An object with the folowing properties:
+		<code>
+this.extensions = {
+	derivatives: false, // set to use derivatives
+	fragDepth: false, // set to use fragment depth values
+	drawBuffers: false, // set to use draw buffers
+	shaderTextureLOD: false // set to use shader texture LOD
+};
+		</code>
 		</div>
 		</div>
 
 
-		<h3>[property:String fragmentShader]</h3>
+
+		<h3>[property:Boolean fog]</h3>
 		<div>
 		<div>
-		Fragment shader GLSL code.  This is the actual code for the shader. In the example above, the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed as a string directly or loaded via AJAX instead.
+			Define whether the material color is affected by global fog settings; true to pass
+			fog uniforms to the shader. Default is false.
 		</div>
 		</div>
 
 
-		<h3>[property:Number shading]</h3>
+
+		<h3>[property:String fragmentShader]</h3>
 		<div>
 		<div>
-		Define shading type, which determines whether normals are smoothed between vertices; possible values are [page:Materials THREE.SmoothShading] or [page:Materials THREE.FlatShading]. Default is THREE.SmoothShading.
+		Fragment shader GLSL code.  This is the actual code for the shader. In the example above,
+		the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed
+		as a string directly or loaded via AJAX instead.
 		</div>
 		</div>
 
 
-		<h3>[property:Number linewidth]</h3>
-		<div>Controls line thickness; only effective if the material is attached to a [page:Line]. Default is 1.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
+		<h3>[property:String index0AttributeName]</h3>
+		<div>
+			If set, this calls [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/bindAttribLocation gl.bindAttribLocation]
+			to bind a generic vertex index to an attribute variable.
+			Default is undefined.
 
 
-		<h3>[property:Boolean wireframe]</h3>
+		</div>
+
+		<h3>[property:Boolean isShaderMaterial]</h3>
 		<div>
 		<div>
-		Render geometry as wireframe (using GL_LINES instead of GL_TRIANGLES). Default is false (i.e. render as flat polygons).
+			Used to check whether this or derived classes are shader materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>
 
 
-		<h3>[property:Number wireframeLinewidth]</h3>
-		<div>Controls wireframe thickness; only effective if the material is attached to a [page:Mesh] and *wireframe* is true. Default is 1.</div>
-		<div>Due to limitations in the <a href="https://code.google.com/p/angleproject/" target="_blank">ANGLE layer</a>, on Windows platforms linewidth will always be 1 regardless of the set value.</div>
 
 
-		<h3>[property:Boolean fog]</h3>
-		<div>Define whether the material color is affected by global fog settings; true to pass fog uniforms to the shader. Default is false.</div>
+
 
 
 		<h3>[property:Boolean lights]</h3>
 		<h3>[property:Boolean lights]</h3>
 		<div>
 		<div>
 		Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader. Default is false.
 		Defines whether this material uses lighting; true to pass uniform data related to lighting to this shader. Default is false.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean clipping]</h3>
+		<h3>[property:Float linewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
+
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
+		</div>
+
+
+		<h3>[property:Boolean morphTargets]</h3>
 		<div>
 		<div>
-		Defines whether this material supports clipping; true to let the renderer pass the clippingPlanes uniform. Default is false.
+		Defines whether the material uses morphTargets; true morphTarget attributes to this shader
 		</div>
 		</div>
 
 
-		<h3>[property:Number vertexColors]</h3>
+		<h3>[property:boolean morphNormals]</h3>
 		<div>
 		<div>
-		Define how the vertices are colored, by defining how the *colors* attribute gets populated. Possible values are [page:Materials THREE.NoColors], [page:Materials THREE.FaceColors] and [page:Materials THREE.VertexColors]. Default is THREE.NoColors.
+			Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
+			to the shader. Default is *false*.
 		</div>
 		</div>
 
 
+
+		<h3>[property:WebGLProgram program]</h3>
+		<div>
+		The compiled shader program associated with this material, generated by [page:WebGLRenderer].
+		You should not need to access this property.
+		</div>
+
+		<h3>[property:Number shading]</h3>
+		<div>
+		Define shading type, which determines whether normals are smoothed between vertices;
+		possible values are [page:Materials THREE.SmoothShading] or [page:Materials THREE.FlatShading]. Default is THREE.SmoothShading.
+		</div>
+
+
 		<h3>[property:Boolean skinning]</h3>
 		<h3>[property:Boolean skinning]</h3>
 		<div>
 		<div>
 		Define whether the material uses skinning; true to pass skinning attributes to the shader. Default is false.
 		Define whether the material uses skinning; true to pass skinning attributes to the shader. Default is false.
 		</div>
 		</div>
 
 
-		<h3>[property:Boolean morphTargets]</h3>
+		<h3>[property:Object uniforms]</h3>
 		<div>
 		<div>
-		Defines whether the material uses morphTargets; true morphTarget attributes to this shader
+			An object of the form:
+			<code>
+{ "uniform1": { value: 1.0 }, "uniform2": { value: 2 } }
+			</code>
+		specifying the uniforms to be passed to the shader code; keys are uniform names, values are definitions of the form
+		<code>
+		{ value: 1.0 }
+		</code>
+		where *value* is the value of the uniform. Names must match the name of the uniform,
+		as defined in the GLSL code. Note that uniforms are refreshed on every frame,
+		so updating the value of the uniform will immediately update the value available to the GLSL code.
 		</div>
 		</div>
 
 
-		<h3>[property:boolean morphNormals]</h3>
+
+		<h3>[property:Number vertexColors]</h3>
 		<div>
 		<div>
-			Defines whether the material uses morphNormals. Set as true to pass morphNormal attributes from the [page:Geometry]
-			to the shader. Default is *false*.
+		Define how the vertices are colored, by defining how the *colors* attribute gets populated.
+		Possible values are [page:Materials THREE.NoColors], [page:Materials THREE.FaceColors] and
+		[page:Materials THREE.VertexColors]. Default is THREE.NoColors.
 		</div>
 		</div>
 
 
-		<h3>[property:WebGLProgram program]</h3>
+		<h3>[property:String vertexShader]</h3>
+		<div>
+		Vertex shader GLSL code.  This is the actual code for the shader. In the example above,
+		the *vertexShader* and *fragmentShader* code is extracted from the DOM; it could be passed
+		as a string directly or loaded via AJAX instead.
+		</div>
+
+		<h3>[property:Boolean wireframe]</h3>
 		<div>
 		<div>
-		The compiled shader program associated with this material, generated by [page:WebGLRenderer]. You should not need to access this property.
+		Render geometry as wireframe (using GL_LINES instead of GL_TRIANGLES). Default is false (i.e. render as flat polygons).
+		</div>
+
+		<h3>[property:Float wireframeLinewidth]</h3>
+		<div>Controls wireframe thickness. Default is 1.<br /><br />
+
+		Due to limitations in the [link:https://code.google.com/p/angleproject ANGLE layer],
+		on Windows platforms linewidth will always be 1 regardless of the set value.
 		</div>
 		</div>
 
 
+
+
 		<h2>Methods</h2>
 		<h2>Methods</h2>
+		<div>See the base [page:Material] class for common methods.</div>
 
 
 		<h3>[method:ShaderMaterial clone]() [page:ShaderMaterial this]</h3>
 		<h3>[method:ShaderMaterial clone]() [page:ShaderMaterial this]</h3>
 		<div>
 		<div>
-		Generates a shallow copy of this material. Note that the vertexShader and fragmentShader are copied <em>by reference</em>, as are the definitions of the *attributes*; this means that clones of the material will share the same compiled [page:WebGLProgram]. However, the *uniforms* are copied <em>by value</em>, which allows you to have different sets of uniforms for different copies of the material.
+		Generates a shallow copy of this material. Note that the vertexShader and fragmentShader
+		are copied <em>by reference</em>, as are the definitions of the *attributes*; this means
+		that clones of the material will share the same compiled [page:WebGLProgram]. However, the
+		*uniforms* are copied <em>by value</em>, which allows you to have different sets of uniforms
+		for different copies of the material.
 		</div>
 		</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 7 - 0
docs/api/materials/ShadowMaterial.html

@@ -40,6 +40,13 @@ scene.add( plane );
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<div>See the base [page:Material] and [page:ShaderMaterial] classes for common properties.</div>
 		<div>See the base [page:Material] and [page:ShaderMaterial] classes for common properties.</div>
 
 
+		<h3>[property:Boolean isShadowMaterial]</h3>
+		<div>
+			Used to check whether this or derived classes are shadow materials. Default is *true*.<br /><br />
+
+			You should not change this, as it used internally for optimisation.
+		</div>
+
 		<h3>[property:Boolean lights]</h3>
 		<h3>[property:Boolean lights]</h3>
 		<div>Whether the material is affected by lights. Default is *true*.</div>
 		<div>Whether the material is affected by lights. Default is *true*.</div>
 
 

+ 35 - 12
docs/api/materials/SpriteMaterial.html

@@ -12,21 +12,38 @@
 
 
 		<h1>[name]</h1>
 		<h1>[name]</h1>
 
 
-		<div class="desc">A material for a [page:Sprite].</div>
+		<div class="desc">A material for a use with a [page:Sprite].</div>
 
 
+		<h2>Examples</h2>
+		<div>
+			[example:webgl_sprites WebGL / sprites]<br />
+			[example:misc_ubiquity_test misc / ubiquity / test]<br />
+			[example:misc_ubiquity_test2 misc / ubiquity / test2]<br />
+			[example:software_sandbox software / sandbox]<br />
+			[example:svg_sandbox svg / sandbox]<br />
+			[example:webgl_materials_cubemap_dynamic webgl / materials / cubemap / dynamic]
+		</div>
+
+		<code>
+var spriteMap = new THREE.TextureLoader().load( 'textures/sprite.png' );
+
+var spriteMaterial = new THREE.SpriteMaterial( { map: spriteMap, color: 0xffffff } );
 
 
-		<h2>Constructor</h2>
+var sprite = new THREE.Sprite( spriteMaterial );
+sprite.scale.set(200, 200, 1)
+
+scene.add( sprite );
+
+		</code>
 
 
 
 
 		<h3>[name]( [page:Object parameters] )</h3>
 		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		<div>
-		parameters -- an object defining the the default properties
-		</div>
-		<div>
-		color - color of the sprite<br/>
-		map - the texture map<br/>
-		rotation - the rotation of the sprite<br/>
-		fog - whether or not to use the scene fog<br/>
+			[page:Object parameters] - (optional) an object with one or more properties defining the material's appearance.
+			Any property of the material (including any property inherited from [page:Material]) can be passed in here.<br /><br />
+
+			The exception is the property [page:Hexadecimal color], which can be passed in as a hexadecimal
+			string and is *0xffffff* (white) by default. [page:Color.set]( color ) is called internally.
 		</div>
 		</div>
 
 
 
 
@@ -34,7 +51,13 @@
 		<div>See the base [page:Material] class for common properties.</div>
 		<div>See the base [page:Material] class for common properties.</div>
 
 
 		<h3>[property:Color color]</h3>
 		<h3>[property:Color color]</h3>
-		<div>The texture is multiplied by this color. The default is 0xffffff</div>
+		<div>[page:Color] of the material, by default set to white (0xffffff). The [page:.map] is mutiplied by the color.</div>
+
+		<h3>[property:boolean fog]</h3>
+		<div>Whether or not this material affected by the scene's fog. Default is false</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>Whether the material is affected by lights. Default is *false*.</div>
 
 
 		<h3>[property:Texture map]</h3>
 		<h3>[property:Texture map]</h3>
 		<div>The texture map. Default is null.</div>
 		<div>The texture map. Default is null.</div>
@@ -42,8 +65,8 @@
 		<h3>[property:Radians rotation]</h3>
 		<h3>[property:Radians rotation]</h3>
 		<div>The rotation of the sprite in radians. Default is 0.</div>
 		<div>The rotation of the sprite in radians. Default is 0.</div>
 
 
-		<h3>[property:boolean fog]</h3>
-		<div>Whether or not this material affected by the scene's fog. Default is false</div>
+		<h2>Methods</h2>
+		<div>See the base [page:Material]  class for common methods.</div>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>
 
 

+ 62 - 0
docs/api/math/Cylindrical.html

@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<div class="desc">A point's cylindrical coordinates.</div>
+
+
+		<h2>Constructor</h2>
+
+
+		<h3>[name]( [page:Float radius], [page:Float theta], [page:Float y] )</h3>
+		<div>
+		radius -- [page:Float] distance from the origin to a point in the x-z plane<br />
+		theta -- [page:Float] counterclockwise angle in the x-z plane measured in radians from the positive z-axis<br />
+		y -- [page:Float] height above the x-z plane
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<h3>[property:Float radius]</h3>
+
+		<h3>[property:Float theta]</h3>
+
+		<h3>[property:Float y]</h3>
+
+
+		<h2>Methods</h2>
+
+		<h3>[method:Cylindrical set]( [page:Float radius], [page:Float theta], [page:Float y] ) [page:Cylindrical this]</h3>
+		<div>
+		Sets values of this cylindrical's component coordinates.
+		</div>
+
+		<h3>[method:Cylindrical copy]( [page:Cylindrical c] ) [page:Cylindrical this]</h3>
+		<div>
+		Copies value of *c* to this cylindrical.
+		</div>
+
+		<h3>[method:Cylindrical clone]() [page:Cylindrical this]</h3>
+		<div>
+		Clones this cylindrical.
+		</div>
+
+		<h3>[method:Cylindrical setFromVector3]( [page:Vector3 v] ) [page:Cylindrical this]</h3>
+		<div>
+		Sets this object from the vector *v*.
+		</div>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 5 - 0
docs/api/math/Vector3.html

@@ -202,6 +202,11 @@
 		Sets this vector from the spherical coordinates *s*.
 		Sets this vector from the spherical coordinates *s*.
 		</div>
 		</div>
 
 
+		<h3>[method:Vector3 setFromCylindrical]( [page:Cylindrical c] ) [page:Vector3 this]</h3>
+		<div>
+		Sets this vector from the cylindrical coordinates *c*.
+		</div>
+
 		<h3>[method:Vector3 clamp]( [page:Vector3 min], [page:Vector3 max] ) [page:Vector3 this]</h3>
 		<h3>[method:Vector3 clamp]( [page:Vector3 min], [page:Vector3 max] ) [page:Vector3 this]</h3>
 		<div>
 		<div>
 		min -- [page:Vector3] <br />
 		min -- [page:Vector3] <br />

+ 2 - 0
docs/list.js

@@ -226,6 +226,7 @@ var list = {
 			[ "MeshPhongMaterial", "api/materials/MeshPhongMaterial" ],
 			[ "MeshPhongMaterial", "api/materials/MeshPhongMaterial" ],
 			[ "MeshPhysicalMaterial", "api/materials/MeshPhysicalMaterial" ],
 			[ "MeshPhysicalMaterial", "api/materials/MeshPhysicalMaterial" ],
 			[ "MeshStandardMaterial", "api/materials/MeshStandardMaterial" ],
 			[ "MeshStandardMaterial", "api/materials/MeshStandardMaterial" ],
+			[ "MeshToonMaterial", "api/materials/MeshToonMaterial" ],
 			[ "MultiMaterial", "api/materials/MultiMaterial" ],
 			[ "MultiMaterial", "api/materials/MultiMaterial" ],
 			[ "PointsMaterial", "api/materials/PointsMaterial" ],
 			[ "PointsMaterial", "api/materials/PointsMaterial" ],
 			[ "RawShaderMaterial", "api/materials/RawShaderMaterial" ],
 			[ "RawShaderMaterial", "api/materials/RawShaderMaterial" ],
@@ -238,6 +239,7 @@ var list = {
 			[ "Box2", "api/math/Box2" ],
 			[ "Box2", "api/math/Box2" ],
 			[ "Box3", "api/math/Box3" ],
 			[ "Box3", "api/math/Box3" ],
 			[ "Color", "api/math/Color" ],
 			[ "Color", "api/math/Color" ],
+			[ "Cylindrical", "api/math/Cylindrical" ],
 			[ "Euler", "api/math/Euler" ],
 			[ "Euler", "api/math/Euler" ],
 			[ "Frustum", "api/math/Frustum" ],
 			[ "Frustum", "api/math/Frustum" ],
 			[ "Interpolant", "api/math/Interpolant" ],
 			[ "Interpolant", "api/math/Interpolant" ],

+ 13 - 13
editor/js/Loader.js

@@ -155,25 +155,25 @@ var Loader = function ( editor ) {
 
 
 				break;
 				break;
 
 
-				case 'gltf':
+			case 'gltf':
 
 
-					reader.addEventListener( 'load', function ( event ) {
+				reader.addEventListener( 'load', function ( event ) {
 
 
-						var contents = event.target.result;
-						var json = JSON.parse( contents );
+					var contents = event.target.result;
+					var json = JSON.parse( contents );
 
 
-						var loader = new THREE.GLTFLoader();
-						loader.parse( json, function ( result ) {
+					var loader = new THREE.GLTFLoader();
+					loader.parse( json, function ( result ) {
 
 
-							result.scene.name = filename;
-							editor.execute( new AddObjectCommand( result.scene ) );
+						result.scene.name = filename;
+						editor.execute( new AddObjectCommand( result.scene ) );
 
 
-						} );
+					} );
 
 
-					}, false );
-					reader.readAsText( file );
+				}, false );
+				reader.readAsText( file );
 
 
-					break;
+				break;
 
 
 			case 'js':
 			case 'js':
 			case 'json':
 			case 'json':
@@ -322,7 +322,7 @@ var Loader = function ( editor ) {
 					editor.execute( new AddObjectCommand( mesh ) );
 					editor.execute( new AddObjectCommand( mesh ) );
 
 
 				}, false );
 				}, false );
-				reader.readAsText( file );
+				reader.readAsArrayBuffer( file );
 
 
 				break;
 				break;
 
 

+ 10 - 7
examples/css3d_periodictable.html

@@ -296,6 +296,7 @@
 				// sphere
 				// sphere
 
 
 				var vector = new THREE.Vector3();
 				var vector = new THREE.Vector3();
+				var spherical = new THREE.Spherical();
 
 
 				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 
 
@@ -304,9 +305,9 @@
 
 
 					var object = new THREE.Object3D();
 					var object = new THREE.Object3D();
 
 
-					object.position.x = 800 * Math.cos( theta ) * Math.sin( phi );
-					object.position.y = 800 * Math.sin( theta ) * Math.sin( phi );
-					object.position.z = 800 * Math.cos( phi );
+					spherical.set( 800, phi, theta );
+
+					object.position.setFromSpherical( spherical );
 
 
 					vector.copy( object.position ).multiplyScalar( 2 );
 					vector.copy( object.position ).multiplyScalar( 2 );
 
 
@@ -319,16 +320,18 @@
 				// helix
 				// helix
 
 
 				var vector = new THREE.Vector3();
 				var vector = new THREE.Vector3();
+				var cylindrical = new THREE.Cylindrical();
 
 
 				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 				for ( var i = 0, l = objects.length; i < l; i ++ ) {
 
 
-					var phi = i * 0.175 + Math.PI;
+					var theta = i * 0.175 + Math.PI;
+					var y = - ( i * 8 ) + 450;
 
 
 					var object = new THREE.Object3D();
 					var object = new THREE.Object3D();
 
 
-					object.position.x = 900 * Math.sin( phi );
-					object.position.y = - ( i * 8 ) + 450;
-					object.position.z = 900 * Math.cos( phi );
+					cylindrical.set( 900, theta, y );
+
+					object.position.setFromCylindrical( cylindrical );
 
 
 					vector.x = object.position.x * 2;
 					vector.x = object.position.x * 2;
 					vector.y = object.position.y;
 					vector.y = object.position.y;

+ 4 - 3
examples/files.js

@@ -76,6 +76,7 @@ var files = {
 		"webgl_lines_splines",
 		"webgl_lines_splines",
 		"webgl_loader_3mf",
 		"webgl_loader_3mf",
 		"webgl_loader_amf",
 		"webgl_loader_amf",
+		"webgl_loader_assimp",
 		"webgl_loader_assimp2json",
 		"webgl_loader_assimp2json",
 		"webgl_loader_awd",
 		"webgl_loader_awd",
 		"webgl_loader_babylon",
 		"webgl_loader_babylon",
@@ -108,6 +109,7 @@ var files = {
 		"webgl_loader_sea3d_hierarchy",
 		"webgl_loader_sea3d_hierarchy",
 		"webgl_loader_sea3d_keyframe",
 		"webgl_loader_sea3d_keyframe",
 		"webgl_loader_sea3d_morph",
 		"webgl_loader_sea3d_morph",
+		"webgl_loader_sea3d_physics",
 		"webgl_loader_sea3d_skinning",
 		"webgl_loader_sea3d_skinning",
 		"webgl_loader_sea3d_sound",
 		"webgl_loader_sea3d_sound",
 		"webgl_loader_scene",
 		"webgl_loader_scene",
@@ -158,7 +160,6 @@ var files = {
 		"webgl_materials_variations_toon",
 		"webgl_materials_variations_toon",
 		"webgl_materials_video",
 		"webgl_materials_video",
 		"webgl_materials_wireframe",
 		"webgl_materials_wireframe",
-		"webgl_math_spherical_distribution",
 		"webgl_mirror",
 		"webgl_mirror",
 		"webgl_mirror_nodes",
 		"webgl_mirror_nodes",
 		"webgl_modifier_simplifier",
 		"webgl_modifier_simplifier",
@@ -204,8 +205,8 @@ var files = {
 		"webgl_postprocessing_glitch",
 		"webgl_postprocessing_glitch",
 		"webgl_postprocessing_godrays",
 		"webgl_postprocessing_godrays",
 		"webgl_postprocessing_masking",
 		"webgl_postprocessing_masking",
-		"webgl_postprocessing_msaa",
-		"webgl_postprocessing_msaa_unbiased",
+		"webgl_postprocessing_ssaa",
+		"webgl_postprocessing_ssaa_unbiased",
 		"webgl_postprocessing_nodes",
 		"webgl_postprocessing_nodes",
 		"webgl_postprocessing_outline",
 		"webgl_postprocessing_outline",
 		"webgl_postprocessing_procedural",
 		"webgl_postprocessing_procedural",

+ 2 - 2
examples/js/ShaderTerrain.js

@@ -237,10 +237,10 @@ THREE.ShaderTerrain = {
 
 
 				"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
 				"outgoingLight += diffuseColor.xyz * ( totalDiffuseLight + ambientLightColor + totalSpecularLight );",
 
 
-				THREE.ShaderChunk[ "fog_fragment" ],
-
 				"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 				"gl_FragColor = vec4( outgoingLight, diffuseColor.a );",	// TODO, this should be pre-multiplied to allow for bright highlights on very transparent objects
 
 
+				THREE.ShaderChunk[ "fog_fragment" ],
+
 			"}"
 			"}"
 
 
 		].join( "\n" ),
 		].join( "\n" ),

+ 95 - 137
examples/js/controls/DragControls.js

@@ -1,107 +1,52 @@
 /*
 /*
  * @author zz85 / https://github.com/zz85
  * @author zz85 / https://github.com/zz85
+ * @author mrdoob / http://mrdoob.com
  * Running this will allow you to drag three.js objects around the screen.
  * Running this will allow you to drag three.js objects around the screen.
  */
  */
-THREE.DragControls = function( _camera, _objects, _domElement ) {
 
 
-	var _raycaster = new THREE.Raycaster();
-
-	var _mouse = new THREE.Vector3(),
-		_offset = new THREE.Vector3();
-	var _selected, _hovered;
-
-	var p3subp1 = new THREE.Vector3();
-	var targetposition = new THREE.Vector3();
-	var zerovector = new THREE.Vector3();
-
-	this.enabled = false;
-
-	 /* Custom Event Handling */
-	var _listeners = {
-
-	};
-
-	var me = this;
-	this.on = function( event, handler ) {
-
-		if ( ! _listeners[ event ] ) _listeners[ event ] = [];
-
-		_listeners[ event ].push( handler );
-		return me;
-
-	};
-
-	this.off = function( event, handler ) {
-
-		var l = _listeners[ event ];
-		if ( ! l ) return me;
-
-		if ( l.indexOf( handler ) > - 1 ) {
-
-			l.splice( handler, 1 );
-
-		}
-
-		return me;
-
-	};
-
-	var notify = function( event, data, member ) {
-
-		var l = _listeners[ event ];
-		if ( ! l ) return;
-
-		if ( ! member ) {
+THREE.DragControls = function ( _objects, _camera, _domElement ) {
 
 
-			for ( var i = 0; i < l.length; i ++ ) {
+	if ( _objects instanceof THREE.Camera ) {
 
 
-				l[ i ]( data );
+		console.warn( 'THREE.DragControls: Constructor now expects ( objects, camera, domElement )' );
+		var temp = _objects; _objects = _camera; _camera = temp;
 
 
-			}
-
-		}
-
-	};
-
-	this.setObjects = function( objects ) {
-
-		if ( objects instanceof THREE.Scene ) {
-
-			_objects = objects.children;
+	}
 
 
-		} else {
+	var _plane = new THREE.Plane();
+	var _raycaster = new THREE.Raycaster();
 
 
-			_objects = objects;
+	var _mouse = new THREE.Vector2();
+	var _offset = new THREE.Vector3();
+	var _intersection = new THREE.Vector3();
 
 
-		}
+	var _selected = null, _hovered = null;
 
 
-	};
+	//
 
 
-	this.setObjects( _objects );
+	var scope = this;
 
 
-	this.activate = function() {
+	function activate() {
 
 
 		_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
 		_domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
 		_domElement.addEventListener( 'mousedown', onDocumentMouseDown, false );
 		_domElement.addEventListener( 'mousedown', onDocumentMouseDown, false );
 		_domElement.addEventListener( 'mouseup', onDocumentMouseUp, false );
 		_domElement.addEventListener( 'mouseup', onDocumentMouseUp, false );
 
 
-	};
+	}
 
 
-	this.deactivate = function() {
+	function deactivate() {
 
 
 		_domElement.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 		_domElement.removeEventListener( 'mousemove', onDocumentMouseMove, false );
 		_domElement.removeEventListener( 'mousedown', onDocumentMouseDown, false );
 		_domElement.removeEventListener( 'mousedown', onDocumentMouseDown, false );
 		_domElement.removeEventListener( 'mouseup', onDocumentMouseUp, false );
 		_domElement.removeEventListener( 'mouseup', onDocumentMouseUp, false );
 
 
-	};
-
-	this.dispose = function() {
+	}
 
 
-		me.deactivate();
+	function dispose() {
 
 
-	};
+		deactivate();
 
 
-	this.activate();
+	}
 
 
 	function onDocumentMouseMove( event ) {
 	function onDocumentMouseMove( event ) {
 
 
@@ -111,79 +56,50 @@ THREE.DragControls = function( _camera, _objects, _domElement ) {
 		_mouse.y = - ( event.clientY / _domElement.height ) * 2 + 1;
 		_mouse.y = - ( event.clientY / _domElement.height ) * 2 + 1;
 
 
 		_raycaster.setFromCamera( _mouse, _camera );
 		_raycaster.setFromCamera( _mouse, _camera );
-		var ray = _raycaster.ray;
-
 
 
-		if ( _selected && me.enabled ) {
+		if ( _selected && scope.enabled ) {
 
 
-			var normal = _selected.normal;
+			if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
 
 
-			// I found this article useful about plane-line intersections
-			// http://paulbourke.net/geometry/planeline/
-
-			var denom = normal.dot( ray.direction );
-			if ( denom == 0 ) {
-
-				// bail
-				console.log( 'no or infinite solutions' );
-				return;
+				_selected.position.copy( _intersection.sub( _offset ) );
 
 
 			}
 			}
 
 
-			var num = normal.dot( p3subp1.copy( _selected.point ).sub( ray.origin ) );
-			var u = num / denom;
+			scope.dispatchEvent( { type: 'drag', object: _selected } );
 
 
-			targetposition.copy( ray.direction ).multiplyScalar( u ).add( ray.origin ).sub( _offset );
-			// _selected.object.position.copy(targetposition);
+			return;
 
 
-			var xLock, yLock, zLock = false;
+		}
 
 
-			var moveX, moveY, moveZ;
+		_raycaster.setFromCamera( _mouse, _camera );
 
 
+		var intersects = _raycaster.intersectObjects( _objects );
 
 
-			if ( xLock ) {
+		if ( intersects.length > 0 ) {
 
 
-				moveX = true;
-				moveY = false;
-				moveZ = false;
+			var object = intersects[ 0 ].object;
 
 
-			} else if ( yLock ) {
+			_plane.setFromNormalAndCoplanarPoint( _camera.getWorldDirection( _plane.normal ), object.position );
 
 
-				moveX = false;
-				moveY = true;
-				moveZ = false;
+			if ( _hovered !== object ) {
 
 
-			} else {
+				scope.dispatchEvent( { type: 'hoveron', object: object } );
 
 
-				moveX = moveY = moveZ = true;
+				_domElement.style.cursor = 'pointer';
+				_hovered = object;
 
 
 			}
 			}
 
 
-			// Reverse Matrix?
-			if ( moveX ) _selected.object.position.x = targetposition.x;
-			if ( moveY ) _selected.object.position.y = targetposition.y;
-			if ( moveZ ) _selected.object.position.z = targetposition.z;
-
-			notify( 'drag', _selected );
-
-			return;
-
-		}
-
-		_raycaster.setFromCamera( _mouse, _camera );
-		var intersects = _raycaster.intersectObjects( _objects );
+		} else {
 
 
-		if ( intersects.length > 0 ) {
+			if ( _hovered !== null ) {
 
 
-			_domElement.style.cursor = 'pointer';
-			_hovered = intersects[ 0 ];
-			notify( 'hoveron', _hovered );
+				scope.dispatchEvent( { type: 'hoveroff', object: _hovered } );
 
 
-		} else {
+				_domElement.style.cursor = 'auto';
+				_hovered = null;
 
 
-			notify( 'hoveroff', _hovered );
-			_hovered = null;
-			_domElement.style.cursor = 'auto';
+			}
 
 
 		}
 		}
 
 
@@ -193,24 +109,23 @@ THREE.DragControls = function( _camera, _objects, _domElement ) {
 
 
 		event.preventDefault();
 		event.preventDefault();
 
 
-		_mouse.x = ( event.clientX / _domElement.width ) * 2 - 1;
-		_mouse.y = - ( event.clientY / _domElement.height ) * 2 + 1;
-
 		_raycaster.setFromCamera( _mouse, _camera );
 		_raycaster.setFromCamera( _mouse, _camera );
+
 		var intersects = _raycaster.intersectObjects( _objects );
 		var intersects = _raycaster.intersectObjects( _objects );
-		var ray = _raycaster.ray;
 
 
-		var normal = ray.direction; // normal ray to the camera position
 		if ( intersects.length > 0 ) {
 		if ( intersects.length > 0 ) {
 
 
-			_selected = intersects[ 0 ];
-			_selected.ray = ray;
-			_selected.normal = normal ;
-			_offset.copy( _selected.point ).sub( _selected.object.position );
+			_selected = intersects[ 0 ].object;
+
+			if ( _raycaster.ray.intersectPlane( _plane, _intersection ) ) {
+
+				_offset.copy( _intersection ).sub( _selected.position );
+
+			}
 
 
 			_domElement.style.cursor = 'move';
 			_domElement.style.cursor = 'move';
 
 
-			notify( 'dragstart', _selected );
+			scope.dispatchEvent( { type: 'dragstart', object: _selected } );
 
 
 		}
 		}
 
 
@@ -223,7 +138,8 @@ THREE.DragControls = function( _camera, _objects, _domElement ) {
 
 
 		if ( _selected ) {
 		if ( _selected ) {
 
 
-			notify( 'dragend', _selected );
+			scope.dispatchEvent( { type: 'dragend', object: _selected } );
+
 			_selected = null;
 			_selected = null;
 
 
 		}
 		}
@@ -232,4 +148,46 @@ THREE.DragControls = function( _camera, _objects, _domElement ) {
 
 
 	}
 	}
 
 
+	activate();
+
+	// API
+
+	this.enabled = true;
+
+	this.activate = activate;
+	this.deactivate = deactivate;
+	this.dispose = dispose;
+
+	// Backward compatibility
+
+	this.setObjects = function () {
+
+		console.error( 'THREE.DragControls: setObjects() has been removed.' );
+
+	};
+
+	this.on = function ( type, listener ) {
+
+		console.warn( 'THREE.DragControls: on() has been deprecated. Use addEventListener() instead.' );
+		scope.addEventListener( type, listener );
+
+	};
+
+	this.off = function ( type, listener ) {
+
+		console.warn( 'THREE.DragControls: off() has been deprecated. Use removeEventListener() instead.' );
+		scope.removeEventListener( type, listener );
+
+	};
+
+	this.notify = function ( type ) {
+
+		console.error( 'THREE.DragControls: notify() has been deprecated. Use dispatchEvent() instead.' );
+		scope.dispatchEvent( { type: type } );
+
+	};
+
 };
 };
+
+THREE.DragControls.prototype = Object.create( THREE.EventDispatcher.prototype );
+THREE.DragControls.prototype.constructor = THREE.DragControls;

+ 3 - 16
examples/js/controls/EditorControls.js

@@ -35,23 +35,10 @@ THREE.EditorControls = function ( object, domElement ) {
 
 
 	var changeEvent = { type: 'change' };
 	var changeEvent = { type: 'change' };
 
 
-	this.focus = function ( target, frame ) {
-
-		var scale = new THREE.Vector3();
-		target.matrixWorld.decompose( center, new THREE.Quaternion(), scale );
-
-		if ( frame && target.geometry ) {
-
-			scale = ( scale.x + scale.y + scale.z ) / 3;
-			center.add( target.geometry.boundingSphere.center.clone().multiplyScalar( scale ) );
-			var radius = target.geometry.boundingSphere.radius * ( scale );
-			var pos = object.position.clone().sub( center ).normalize().multiplyScalar( radius * 2 );
-			object.position.copy( center ).add( pos );
-
-		}
-
-		object.lookAt( center );
+	this.focus = function ( target ) {
 
 
+		var box = new THREE.Box3().setFromObject( target );
+		object.lookAt( center.copy( box.getCenter() ) );
 		scope.dispatchEvent( changeEvent );
 		scope.dispatchEvent( changeEvent );
 
 
 	};
 	};

+ 0 - 60
examples/js/controls/MouseControls.js

@@ -1,60 +0,0 @@
-/**
- * @author dmarcos / http://github.com/dmarcos
- *
- * This controls allow to change the orientation of the camera using the mouse
- */
-
-THREE.MouseControls = function ( object ) {
-
-	var scope = this;
-	var PI_2 = Math.PI / 2;
-	var mouseQuat = {
-		x: new THREE.Quaternion(),
-		y: new THREE.Quaternion()
-	};
-	var object = object;
-	var xVector = new THREE.Vector3( 1, 0, 0 );
-	var yVector = new THREE.Vector3( 0, 1, 0 );
-
-	var onMouseMove = function ( event ) {
-
-		if ( scope.enabled === false ) return;
-
-		var orientation = scope.orientation;
-
-		var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0;
-		var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0;
-
-		orientation.y += movementX * 0.0025;
-		orientation.x += movementY * 0.0025;
-
-		orientation.x = Math.max( - PI_2, Math.min( PI_2, orientation.x ) );
-
-	};
-
-	this.enabled = true;
-
-	this.orientation = {
-		x: 0,
-		y: 0
-	};
-
-	this.update = function() {
-
-		if ( this.enabled === false ) return;
-
-		mouseQuat.x.setFromAxisAngle( xVector, this.orientation.x );
-		mouseQuat.y.setFromAxisAngle( yVector, this.orientation.y );
-		object.quaternion.copy( mouseQuat.y ).multiply( mouseQuat.x );
-
-	};
-
-	this.dispose = function() {
-
-		document.removeEventListener( 'mousemove', onMouseMove, false );
-
-	};
-
-	document.addEventListener( 'mousemove', onMouseMove, false );
-
-};

+ 83 - 0
examples/js/libs/vrml.min.js

@@ -0,0 +1,83 @@
+var $jscomp={scope:{},checkStringArgs:function(a,g,e){if(null==a)throw new TypeError("The 'this' value for String.prototype."+e+" must not be null or undefined");if(g instanceof RegExp)throw new TypeError("First argument to String.prototype."+e+" must not be a regular expression");return a+""}};
+$jscomp.defineProperty="function"==typeof Object.defineProperties?Object.defineProperty:function(a,g,e){if(e.get||e.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[g]=e.value)};$jscomp.getGlobal=function(a){return"undefined"!=typeof window&&window===a?a:"undefined"!=typeof global&&null!=global?global:a};$jscomp.global=$jscomp.getGlobal(this);
+$jscomp.polyfill=function(a,g,e,l){if(g){e=$jscomp.global;a=a.split(".");for(l=0;l<a.length-1;l++){var k=a[l];k in e||(e[k]={});e=e[k]}a=a[a.length-1];l=e[a];g=g(l);g!=l&&null!=g&&$jscomp.defineProperty(e,a,{configurable:!0,writable:!0,value:g})}};
+$jscomp.polyfill("String.prototype.repeat",function(a){return a?a:function(a){var g=$jscomp.checkStringArgs(this,null,"repeat");if(0>a||1342177279<a)throw new RangeError("Invalid count value");a|=0;for(var l="";a;)if(a&1&&(l+=g),a>>>=1)g+=g;return l}},"es6-impl","es3");
+vrmlParser=function(){function a(g,e,l,k){this.message=g;this.expected=e;this.found=l;this.location=k;this.name="SyntaxError";"function"===typeof Error.captureStackTrace&&Error.captureStackTrace(this,a)}(function(a,e){function g(){this.constructor=a}g.prototype=e.prototype;a.prototype=new g})(a,Error);return{SyntaxError:a,parse:function(g){function e(b){var d=Q[b],c,a;if(!d){for(c=b-1;!Q[c];)c--;d=Q[c];for(d={line:d.line,column:d.column,seenCR:d.seenCR};c<b;)a=g.charAt(c),"\n"===a?(d.seenCR||d.line++,
+d.column=1,d.seenCR=!1):"\r"===a||"\u2028"===a||"\u2029"===a?(d.line++,d.column=1,d.seenCR=!0):(d.column++,d.seenCR=!1),c++;Q[b]=d}return d}function l(b,B){var d=e(b),c=e(B);return{start:{offset:b,line:d.line,column:d.column},end:{offset:B,line:c.line,column:c.column}}}function k(b){c<I||(c>I&&(I=c,ba=[]),ba.push(b))}function y(){var d,B,a;d=c;g.substr(c,15)===ga?(B=ga,c+=15):(B=b,0===n&&k(Qa));if(B!==b){B=[];a=A();a===b&&(a=C(),a===b&&(a=q(),a===b&&(a=z(),a===b&&(a=w()))));for(;a!==b;)B.push(a),
+a=A(),a===b&&(a=C(),a===b&&(a=q(),a===b&&(a=z(),a===b&&(a=w()))));B!==b?(x=d,B.nodeDefinitions=R,B.routes=M,d=B):(c=d,d=b)}else c=d,d=b;return d}function A(){var d,B,a,h;B=d=c;a=ha();a!==b?(a=t(),a!==b?(x=B,B=a):(c=B,B=b)):(c=B,B=b);if(B!==b)if(g.substr(c,23)===ia?(a=ia,c+=23):(a=b,0===n&&k(Ra)),a!==b)if(a=E(),a!==b){a=[];h=D();h===b&&(h=p());if(h!==b)for(;h!==b;)a.push(h),h=D(),h===b&&(h=p());else a=b;if(a!==b)if(h=ja(),h!==b){x=d;d=B;B=a;a={name:d,node:"OrientationInterpolator",isDefinition:!0};
+for(h=0;h<B.length;h++)a[B[h].name]=B[h].value;d=R[d]=a}else c=d,d=b;else c=d,d=b}else c=d,d=b;else c=d,d=b;else c=d,d=b;return d}function D(){var d,a,f,h,e,q;d=c;a=v();a===b&&(a=null);if(a!==b)if(g.substr(c,8)===ka?(a=ka,c+=8):(a=b,0===n&&k(Sa)),a!==b)if(a=J(),a!==b){f=c;h=[];a=c;e=H();e!==b?(q=S(),q!==b?(x=a,a=e):(c=a,a=b)):(c=a,a=b);for(;a!==b;)h.push(a),a=c,e=H(),e!==b?(q=S(),q!==b?(x=a,a=e):(c=a,a=b)):(c=a,a=b);h!==b?(a=H(),a!==b?(x=f,f=h,f.push(a)):(c=f,f=b)):(c=f,f=b);f!==b?(h=G(),h!==b?(x=
+d,d=a={name:"keyValue",value:f}):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b;else c=d,d=b;return d}function C(){var d,a,f,g;d=c;a=v();a!==b?(a=c,f=ha(),f!==b?(f=v(),f!==b?(f=t(),f!==b?(g=v(),g!==b?(x=a,a=f):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b),a!==b?(f=q(),f!==b?(x=d,d=a,a=f,a.name=d,a.isDefinition=!0,d=R[d]=a):(c=d,d=b)):(c=d,d=b)):(c=d,d=b);return d}function q(){var d,a,f,g;d=c;a=v();if(a!==b)if(f=t(),f!==b)if(a=E(),a!==b){a=[];g=C();g===b&&(g=w(),g===b&&(g=p(),g===b&&(g=q(),g===b&&(g=
+z()))));for(;g!==b;)a.push(g),g=C(),g===b&&(g=w(),g===b&&(g=p(),g===b&&(g=q(),g===b&&(g=z()))));if(a!==b)if(g=ja(),g!==b)for(x=d,d={node:f},f=0;f<a.length;f++)g=a[f],void 0!==g.node?"Switch"===d.node?(void 0===d.choice&&(d.choice=[]),d.choice.push(g)):(void 0===d.children&&(d.children=[]),d.children.push(g)):void 0!==g.name?(d[g.name]=g.value,void 0!==g.comment&&(void 0===d.comments&&(d.comments={}),void 0===d.comments[g.name]&&(d.comments[g.name]=[]),d.comments[g.name].push(g.comment))):void 0!==
+g.src?M.push(g):(void 0===d.nodeComments&&(d.nodeComments=[]),d.nodeComments.push(g));else c=d,d=b;else c=d,d=b}else c=d,d=b;else c=d,d=b;else c=d,d=b;return d}function p(){var d,a,f;d=c;a=v();a===b&&(a=null);a!==b?(g.substr(c,11)===la?(a=la,c+=11):(a=b,0===n&&k(Ta)),a===b&&(g.substr(c,8)===ma?(a=ma,c+=8):(a=b,0===n&&k(Ua)),a===b&&(g.substr(c,16)===na?(a=na,c+=16):(a=b,0===n&&k(Va)))),a!==b?(f=H(),f!==b?(x=d,d=a={name:a,value:f}):(c=d,d=b)):(c=d,d=b)):(c=d,d=b);if(d===b){d=c;g.substr(c,10)===oa?(a=
+oa,c+=10):(a=b,0===n&&k(Wa));if(a!==b)if(a=v(),a===b&&(a=null),a!==b)if(a=J(),a!==b)if(a=z(),a===b&&(a=null),a!==b)if(a=v(),a===b&&(a=null),a!==b){a=[];f=ca();if(f!==b)for(;f!==b;)a.push(f),f=ca();else a=b;a!==b?(f=v(),f===b&&(f=null),f!==b?(f=z(),f===b&&(f=null),f!==b?(f=G(),f!==b?(f=v(),f===b&&(f=null),f!==b?(x=d,d=a={name:"coordIndex",value:a}):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b;else c=d,d=b;else c=d,d=b;else c=d,d=b;if(d===b&&(d=m(),d===b)){var h;d=
+c;a=v();a===b&&(a=null);a!==b?(a=t(),a!==b?(f=v(),f!==b?(f=r(),f!==b?(h=v(),h!==b?(h=z(),h===b&&(h=null),h!==b?(x=d,d={name:a,value:f},null!==h&&(d.comment=h)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)}}return d}function H(){var d,a,f,h,e,q;d=c;a=v();a===b&&(a=null);if(a!==b)if(a=F(),a!==b){f=[];32===g.charCodeAt(c)?(h=K,c++):(h=b,0===n&&k(L));if(h!==b)for(;h!==b;)f.push(h),32===g.charCodeAt(c)?(h=K,c++):(h=b,0===n&&k(L));else f=b;if(f!==b)if(h=F(),h!==b){e=[];32===g.charCodeAt(c)?
+(f=K,c++):(f=b,0===n&&k(L));if(f!==b)for(;f!==b;)e.push(f),32===g.charCodeAt(c)?(f=K,c++):(f=b,0===n&&k(L));else e=b;if(e!==b)if(f=F(),f!==b){q=[];32===g.charCodeAt(c)?(e=K,c++):(e=b,0===n&&k(L));if(e!==b)for(;e!==b;)q.push(e),32===g.charCodeAt(c)?(e=K,c++):(e=b,0===n&&k(L));else q=b;q!==b?(e=F(),e!==b?(q=v(),q===b&&(q=null),q!==b?(x=d,d=a={x:a,y:h,z:f,radians:e}):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b}else c=d,d=b;else c=d,d=b}else c=d,d=b;else c=d,d=b;return d}function m(){var d,
+a,f,h;d=c;g.substr(c,5)===pa?(a=pa,c+=5):(a=b,0===n&&k(Xa));a===b&&(g.substr(c,6)===qa?(a=qa,c+=6):(a=b,0===n&&k(Ya)));if(a!==b)if(f=v(),f===b&&(f=null),f!==b)if(f=J(),f!==b)if(f=z(),f===b&&(f=null),f!==b)if(f=v(),f===b&&(f=null),f!==b){f=[];h=da();if(h!==b)for(;h!==b;)f.push(h),h=da();else f=b;f!==b?(h=z(),h===b&&(h=null),h!==b?(h=G(),h!==b?(h=v(),h===b&&(h=null),h!==b?(x=d,d=a={name:a,value:f}):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b;else c=d,d=b;else c=d,d=b;else c=
+d,d=b;return d}function t(){var d,a,f;n++;d=c;a=v();a===b&&(a=null);if(a!==b){a=[];ra.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(sa));if(f!==b)for(;f!==b;)a.push(f),ra.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(sa));else a=b;a!==b?(f=v(),f===b&&(f=null),f!==b?(x=d,d=a=a.join("")):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;n--;d===b&&0===n&&k(Za);return d}function r(){var d;n++;var a;g.substr(c,5)===ta?(d=ta,c+=5):(d=b,0===n&&k($a));d===b&&(d=c,g.substr(c,5)===ua?(a=ua,c+=5):(a=b,0===n&&k(ab)),
+a!==b&&(x=d,a=!1),d=a);if(d===b&&(d=A(),d===b&&(d=ca(),d===b&&(g.substr(c,4)===va?(d=va,c+=4):(d=b,0===n&&k(bb)),d===b&&(d=c,g.substr(c,4)===wa?(a=wa,c+=4):(a=b,0===n&&k(cb)),a!==b&&(x=d,a=null),d=a),d===b&&(g.substr(c,4)===xa?(d=xa,c+=4):(d=b,0===n&&k(db)),d===b&&(d=c,g.substr(c,4)===ya?(a=ya,c+=4):(a=b,0===n&&k(eb)),a!==b&&(x=d,a=!0),d=a),d===b&&(d=C(),d===b&&(d=q(),d===b&&(d=da(),d===b&&(d=m(),d===b&&(d=za(),d===b)))))))))){var f,h;d=c;a=v();a!==b?(a=F(),a!==b?(f=v(),f!==b?(f=F(),f!==b?(h=v(),
+h!==b?(h=z(),h===b&&(h=null),h!==b?(x=d,d=a={x:a,y:f}):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b);if(d===b&&(d=c,a=v(),a!==b?(a=c,g.substr(c,3)===Aa?(f=Aa,c+=3):(f=b,0===n&&k(fb)),f!==b&&(x=a,f=!0),f!==b?(a=v(),a!==b?(a=t(),a!==b?(x=d,d=R[a],void 0===d?(console.log(a+" not found in nodeDefinitions"),a=d):a="function"===typeof d.clone?d.clone():d,d=a):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b),d===b)){var e;n++;a=c;d=J();if(d!==b){d=[];f=z();f===b&&(f=w(),f===b&&(f=c,h=r(),h!==
+b?(e=v(),e!==b?(e=S(),e===b&&(e=null),e!==b?(x=f,f=h):(c=f,f=b)):(c=f,f=b)):(c=f,f=b)));for(;f!==b;)d.push(f),f=z(),f===b&&(f=w(),f===b&&(f=c,h=r(),h!==b?(e=v(),e!==b?(e=S(),e===b&&(e=null),e!==b?(x=f,f=h):(c=f,f=b)):(c=f,f=b)):(c=f,f=b)));if(d!==b)if(f=G(),f!==b)for(x=a,a=[],f=0;f<d.length;f++)h=d[f],void 0!==h.src?M.push(h):void 0!==h.comment?(void 0===a.comments&&(a.comments=[]),a.comments.push(h)):a.push(h);else c=a,a=b;else c=a,a=b}else c=a,a=b;n--;a===b&&0===n&&k(gb);d=a;if(d===b&&(d=F(),d===
+b&&(d=t(),d===b))){d=c;a=v();if(a!==b)if(a=J(),a!==b)if(a=v(),a!==b)if(a=T(),a!==b){a=c;f=[];U.test(g.charAt(c))?(h=g.charAt(c),c++):(h=b,0===n&&k(V));for(;h!==b;)f.push(h),U.test(g.charAt(c))?(h=g.charAt(c),c++):(h=b,0===n&&k(V));f!==b?(46===g.charCodeAt(c)?(h=ea,c++):(h=b,0===n&&k(fa)),h!==b?(g.substr(c,3)===Ba?(e=Ba,c+=3):(e=b,0===n&&k(hb)),e===b&&(g.substr(c,4)===Ca?(e=Ca,c+=4):(e=b,0===n&&k(ib)),e===b&&(g.substr(c,3)===Da?(e=Da,c+=3):(e=b,0===n&&k(jb)),e===b&&(g.substr(c,3)===Ea?(e=Ea,c+=3):
+(e=b,0===n&&k(kb))))),e!==b?(x=a,a=f+h+e):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);a!==b?(f=T(),f!==b?(f=v(),f!==b?(f=G(),f!==b?(f=v(),f!==b?(x=d,d=a):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b;else c=d,d=b;else c=d,d=b;if(d===b)if(d=c,a=v(),a!==b)if(a=T(),a!==b){a=[];U.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(V));for(;f!==b;)a.push(f),U.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(V));a!==b?(f=T(),f!==b?(f=v(),f!==b?(x=d,d=a=a.join("")):(c=d,d=b)):(c=
+d,d=b)):(c=d,d=b)}else c=d,d=b;else c=d,d=b}}}n--;d===b&&0===n&&k(lb);return d}function F(){var a,e,f,h;n++;a=c;e=N();e===b&&(e=null);if(e!==b)if(e=c,f=u(),f!==b?(h=O(),h===b&&(h=null),h!==b?e=f=[f,h]:(c=e,e=b)):(c=e,e=b),e===b&&(e=O()),e!==b){var q,l;e=c;mb.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(nb));if(f!==b)if(h=N(),h===b&&(43===g.charCodeAt(c)?(h=ob,c++):(h=b,0===n&&k(pb))),h===b&&(h=null),h!==b){q=[];l=P();if(l!==b)for(;l!==b;)q.push(l),l=P();else q=b;q!==b?e=f=[f,h,q]:(c=e,e=b)}else c=
+e,e=b;else c=e,e=b;f=e;f===b&&(f=null);f!==b?(x=a,a=e=parseFloat(g.substring(x,c))):(c=a,a=b)}else c=a,a=b;else c=a,a=b;n--;a===b&&0===n&&k(qb);return a}function O(){var a,e,f,h;a=c;46===g.charCodeAt(c)?(e=ea,c++):(e=b,0===n&&k(fa));if(e!==b){f=[];for(h=P();h!==b;)f.push(h),h=P();f!==b?a=e=[e,f]:(c=a,a=b)}else c=a,a=b;return a}function u(){var a,e,f;a=c;48===g.charCodeAt(c)?(e=rb,c++):(e=b,0===n&&k(sb));e===b&&(tb.test(g.charAt(c))?(e=g.charAt(c),c++):(e=b,0===n&&k(ub)));if(e!==b){var h,q;f=c;h=[];
+for(q=P();q!==b;)h.push(q),q=P();h!==b&&(x=f,h=h.join(""));f=h;f!==b?(x=a,a=e+f):(c=a,a=b)}else c=a,a=b;return a}function N(){var a;45===g.charCodeAt(c)?(a=vb,c++):(a=b,0===n&&k(wb));return a}function z(){var a,e,f;a=c;e=v();if(e!==b)if(35===g.charCodeAt(c)?(e=xb,c++):(e=b,0===n&&k(yb)),e!==b){e=[];Fa.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(Ga));for(;f!==b;)e.push(f),Fa.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(Ga));e!==b?(f=v(),f!==b?(x=a,a=e={comment:e.join("").trim()}):(c=
+a,a=b)):(c=a,a=b)}else c=a,a=b;else c=a,a=b;return a}function w(){var a,e,f,h;a=c;e=v();e!==b?(g.substr(c,5)===Ha?(e=Ha,c+=5):(e=b,0===n&&k(zb)),e!==b?(e=v(),e!==b?(e=W(),e!==b?(f=v(),f!==b?(g.substr(c,2)===Ia?(f=Ia,c+=2):(f=b,0===n&&k(Ab)),f!==b?(f=v(),f!==b?(f=W(),f!==b?(h=v(),h!==b?(x=a,a=e.name,e={source:e,target:f},"undefined"===typeof M[a]&&(M[a]=[]),M[a].push(e),a=e):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function W(){var a,
+e,f;a=c;e=t();e!==b?(46===g.charCodeAt(c)?(f=ea,c++):(f=b,0===n&&k(fa)),f!==b?(f=t(),f!==b?(x=a,a=e={name:e,property:f}):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function J(){var a,e,f,h;a=c;e=v();e===b&&(e=null);e!==b?(91===g.charCodeAt(c)?(f=Bb,c++):(f=b,0===n&&k(Cb)),f!==b?(h=v(),h===b&&(h=null),h!==b?a=e=[e,f,h]:(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function G(){var a,e,f,h;a=c;e=v();e===b&&(e=null);e!==b?(93===g.charCodeAt(c)?(f=Db,c++):(f=b,0===n&&k(Eb)),f!==b?(h=v(),h===b&&(h=null),h!==
+b?a=e=[e,f,h]:(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function E(){var a,e,f,h;a=c;e=v();e===b&&(e=null);e!==b?(123===g.charCodeAt(c)?(f=Fb,c++):(f=b,0===n&&k(Gb)),f!==b?(h=v(),h===b&&(h=null),h!==b?a=e=[e,f,h]:(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function ja(){var a,e,f,h;a=c;e=v();e===b&&(e=null);e!==b?(125===g.charCodeAt(c)?(f=Hb,c++):(f=b,0===n&&k(Ib)),f!==b?(h=v(),h===b&&(h=null),h!==b?a=e=[e,f,h]:(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function S(){var a,e,f,h;a=c;e=v();e===b&&(e=null);
+e!==b?(44===g.charCodeAt(c)?(f=X,c++):(f=b,0===n&&k(Y)),f!==b?(h=v(),h===b&&(h=null),h!==b?a=e=[e,f,h]:(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function v(){var a,e,f;n++;a=c;e=[];Ja.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(Ka));for(;f!==b;)e.push(f),Ja.test(g.charAt(c))?(f=g.charAt(c),c++):(f=b,0===n&&k(Ka));e!==b&&(x=a,e=e.join(""));a=e;n--;a===b&&0===n&&k(Jb);return a}function da(){var a,e,f;a=c;e=za();e!==b?(44===g.charCodeAt(c)?(f=X,c++):(f=b,0===n&&k(Y)),f===b&&(f=null),f!==b?(f=
+v(),f!==b?(f=z(),f===b&&(f=null),f!==b?(x=a,a=e):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function za(){var a,e,f,g,k;a=c;e=v();e===b&&(e=null);e!==b?(e=F(),e!==b?(f=v(),f!==b?(f=F(),f!==b?(g=v(),g!==b?(g=F(),g!==b?(k=v(),k!==b?(k=z(),k===b&&(k=null),k!==b?(x=a,a=e={x:e,y:f,z:g}):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function ha(){var a,e;a=c;e=v();e===b&&(e=null);e!==b?(g.substr(c,3)===La?(e=La,c+=3):(e=b,0===n&&k(Kb)),e!==b?(e=
+v(),e===b&&(e=null),e!==b?(x=a,a=!0):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function ca(){var a,e,f;a=c;e=[];f=Ma();if(f!==b)for(;f!==b;)e.push(f),f=Ma();else e=b;e!==b?(g.substr(c,2)===Na?(f=Na,c+=2):(f=b,0===n&&k(Lb)),f!==b?(44===g.charCodeAt(c)?(f=X,c++):(f=b,0===n&&k(Y)),f===b&&(f=null),f!==b?(f=v(),f!==b?(x=a,a=e):(c=a,a=b)):(c=a,a=b)):(c=a,a=b)):(c=a,a=b);return a}function Ma(){var a,e,f,h,q,l;a=c;e=u();if(e!==b){f=c;h=v();h!==b?(44===g.charCodeAt(c)?(q=X,c++):(q=b,0===n&&k(Y)),q!==b?(32===
+g.charCodeAt(c)?(l=K,c++):(l=b,0===n&&k(L)),l===b&&(l=null),l!==b?f=h=[h,q,l]:(c=f,f=b)):(c=f,f=b)):(c=f,f=b);if(f===b)if(f=[],32===g.charCodeAt(c)?(h=K,c++):(h=b,0===n&&k(L)),h!==b)for(;h!==b;)f.push(h),32===g.charCodeAt(c)?(h=K,c++):(h=b,0===n&&k(L));else f=b;f!==b?(x=a,a=e):(c=a,a=b)}else c=a,a=b;return a}function T(){var a;34===g.charCodeAt(c)?(a=Mb,c++):(a=b,0===n&&k(Nb));return a}function P(){var a;Ob.test(g.charAt(c))?(a=g.charAt(c),c++):(a=b,0===n&&k(Pb));return a}var Z=1<arguments.length?
+arguments[1]:{},b={},Oa={vrml:y},Pa=y,ga="#VRML V2.0 utf8",Qa={type:"literal",value:"#VRML V2.0 utf8",description:'"#VRML V2.0 utf8"'},ia="OrientationInterpolator",Ra={type:"literal",value:"OrientationInterpolator",description:'"OrientationInterpolator"'},ka="keyValue",Sa={type:"literal",value:"keyValue",description:'"keyValue"'},la="orientation",Ta={type:"literal",value:"orientation",description:'"orientation"'},ma="rotation",Ua={type:"literal",value:"rotation",description:'"rotation"'},na="scaleOrientation",
+Va={type:"literal",value:"scaleOrientation",description:'"scaleOrientation"'},K=" ",L={type:"literal",value:" ",description:'" "'},oa="coordIndex",Wa={type:"literal",value:"coordIndex",description:'"coordIndex"'},pa="point",Xa={type:"literal",value:"point",description:'"point"'},qa="vector",Ya={type:"literal",value:"vector",description:'"vector"'},Za={type:"other",description:"identifier"},ra=/^[A-Za-z0-9_]/,sa={type:"class",value:"[A-Za-z0-9_]",description:"[A-Za-z0-9_]"},gb={type:"other",description:"array"},
+lb={type:"other",description:"value"},ta="false",$a={type:"literal",value:"false",description:'"false"'},ua="FALSE",ab={type:"literal",value:"FALSE",description:'"FALSE"'},va="null",bb={type:"literal",value:"null",description:'"null"'},wa="NULL",cb={type:"literal",value:"NULL",description:'"NULL"'},xa="true",db={type:"literal",value:"true",description:'"true"'},ya="TRUE",eb={type:"literal",value:"TRUE",description:'"TRUE"'},qb={type:"other",description:"number"},ea=".",fa={type:"literal",value:".",
+description:'"."'},tb=/^[1-9]/,ub={type:"class",value:"[1-9]",description:"[1-9]"},mb=/^[eE]/,nb={type:"class",value:"[eE]",description:"[eE]"},vb="-",wb={type:"literal",value:"-",description:'"-"'},ob="+",pb={type:"literal",value:"+",description:'"+"'},rb="0",sb={type:"literal",value:"0",description:'"0"'},xb="#",yb={type:"literal",value:"#",description:'"#"'},Fa=/^[^\n]/,Ga={type:"class",value:"[^\\n]",description:"[^\\n]"},Ha="ROUTE",zb={type:"literal",value:"ROUTE",description:'"ROUTE"'},Ia="TO",
+Ab={type:"literal",value:"TO",description:'"TO"'},Bb="[",Cb={type:"literal",value:"[",description:'"["'},Db="]",Eb={type:"literal",value:"]",description:'"]"'},Fb="{",Gb={type:"literal",value:"{",description:'"{"'},Hb="}",Ib={type:"literal",value:"}",description:'"}"'},X=",",Y={type:"literal",value:",",description:'","'},Jb={type:"other",description:"whitespace"},Ja=/^[ \t\n\r]/,Ka={type:"class",value:"[ \\t\\n\\r]",description:"[ \\t\\n\\r]"},La="DEF",Kb={type:"literal",value:"DEF",description:'"DEF"'},
+Aa="USE",fb={type:"literal",value:"USE",description:'"USE"'},Na="-1",Lb={type:"literal",value:"-1",description:'"-1"'},U=/^[^"]/,V={type:"class",value:'[^"]',description:'[^"]'},Ba="jpg",hb={type:"literal",value:"jpg",description:'"jpg"'},Ca="jpeg",ib={type:"literal",value:"jpeg",description:'"jpeg"'},Da="gif",jb={type:"literal",value:"gif",description:'"gif"'},Ea="wrl",kb={type:"literal",value:"wrl",description:'"wrl"'},Mb='"',Nb={type:"literal",value:'"',description:'"\\""'},Ob=/^[0-9]/,Pb={type:"class",
+value:"[0-9]",description:"[0-9]"},c=0,x=0,Q=[{line:1,column:1,seenCR:!1}],I=0,ba=[],n=0,aa;if("startRule"in Z){if(!(Z.startRule in Oa))throw Error("Can't start parsing from rule \""+Z.startRule+'".');Pa=Oa[Z.startRule]}var R={},M={};aa=Pa();if(aa!==b&&c===g.length)return aa;aa!==b&&c<g.length&&k({type:"end",description:"end of input"});throw function(b,c,e,g){function d(a){var b=1;for(a.sort(function(a,b){return a.description<b.description?-1:a.description>b.description?1:0});b<a.length;)a[b-1]===
+a[b]?a.splice(b,1):b++}function f(a,b){function c(a){function b(a){return a.charCodeAt(0).toString(16).toUpperCase()}return a.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E\x0F]/g,function(a){return"\\x0"+b(a)}).replace(/[\x10-\x1F\x80-\xFF]/g,function(a){return"\\x"+b(a)}).replace(/[\u0100-\u0FFF]/g,function(a){return"\\u0"+b(a)}).replace(/[\u1000-\uFFFF]/g,function(a){return"\\u"+
+b(a)})}var d=Array(a.length),e;for(e=0;e<a.length;e++)d[e]=a[e].description;d=1<a.length?d.slice(0,-1).join(", ")+" or "+d[a.length-1]:d[0];e=b?'"'+c(b)+'"':"end of input";return"Expected "+d+" but "+e+" found."}null!==c&&d(c);return new a(null!==b?b:f(c,e),c,e,g)}(null,ba,I<g.length?g.charAt(I):null,I<g.length?l(I,I+1):l(I,I));}}}();var TWEEN=TWEEN||function(){var a=[];return{getAll:function(){return a},removeAll:function(){a=[]},add:function(g){a.push(g)},remove:function(g){g=a.indexOf(g);-1!==g&&a.splice(g,1)},update:function(g,e){if(0===a.length)return!1;var l=0;for(g=void 0!==g?g:TWEEN.now();l<a.length;)a[l].update(g)||e?l++:a.splice(l,1);return!0}}}();
+(function(){TWEEN.now=void 0===this.window&&void 0!==this.process?function(){var a=process.hrtime();return 1E3*a[0]+a[1]/1E3}:void 0!==this.window&&void 0!==window.performance&&void 0!==window.performance.now?window.performance.now.bind(window.performance):void 0!==Date.now?Date.now:function(){return(new Date).getTime()}})();
+TWEEN.Tween=function(a){var g={},e={},l={},k=1E3,y=0,A=!1,D=!1,C=0,q=null,p=TWEEN.Easing.Linear.None,H=TWEEN.Interpolation.Linear,m=[],t=null,r=!1,F=null,O=null,u=null,N;for(N in a)g[N]=parseFloat(a[N],10);this.to=function(a,g){void 0!==g&&(k=g);e=a;return this};this.start=function(k){TWEEN.add(this);D=!0;r=!1;q=void 0!==k?k:TWEEN.now();q+=C;for(var m in e){if(e[m]instanceof Array){if(0===e[m].length)continue;e[m]=[a[m]].concat(e[m])}void 0!==g[m]&&(g[m]=a[m],!1===g[m]instanceof Array&&(g[m]*=1),
+l[m]=g[m]||0)}return this};this.stop=function(){if(!D)return this;TWEEN.remove(this);D=!1;null!==u&&u.call(a);this.stopChainedTweens();return this};this.stopChainedTweens=function(){for(var a=0,e=m.length;a<e;a++)m[a].stop()};this.delay=function(a){C=a;return this};this.repeat=function(a){y=a;return this};this.yoyo=function(a){A=a;return this};this.easing=function(a){p=a;return this};this.interpolation=function(a){H=a;return this};this.chain=function(){m=arguments;return this};this.onStart=function(a){t=
+a;return this};this.onUpdate=function(a){F=a;return this};this.onComplete=function(a){O=a;return this};this.onStop=function(a){u=a;return this};this.update=function(u){var w,z,J;if(u<q)return!0;!1===r&&(null!==t&&t.call(a),r=!0);z=(u-q)/k;z=1<z?1:z;J=p(z);for(w in e)if(void 0!==g[w]){var G=g[w]||0,E=e[w];E instanceof Array?a[w]=H(E,J):("string"===typeof E&&(E="+"===E.charAt(0)||"-"===E.charAt(0)?G+parseFloat(E,10):parseFloat(E,10)),"number"===typeof E&&(a[w]=G+(E-G)*J))}null!==F&&F.call(a,J);if(1===
+z)if(0<y){isFinite(y)&&y--;for(w in l)"string"===typeof e[w]&&(l[w]+=parseFloat(e[w],10)),A&&(z=l[w],l[w]=e[w],e[w]=z),g[w]=l[w];q=u+C}else{null!==O&&O.call(a);u=0;for(w=m.length;u<w;u++)m[u].start(q+k);return!1}return!0}};
+TWEEN.Easing={Linear:{None:function(a){return a}},Quadratic:{In:function(a){return a*a},Out:function(a){return a*(2-a)},InOut:function(a){return 1>(a*=2)?.5*a*a:-.5*(--a*(a-2)-1)}},Cubic:{In:function(a){return a*a*a},Out:function(a){return--a*a*a+1},InOut:function(a){return 1>(a*=2)?.5*a*a*a:.5*((a-=2)*a*a+2)}},Quartic:{In:function(a){return a*a*a*a},Out:function(a){return 1- --a*a*a*a},InOut:function(a){return 1>(a*=2)?.5*a*a*a*a:-.5*((a-=2)*a*a*a-2)}},Quintic:{In:function(a){return a*a*a*a*a},Out:function(a){return--a*
+a*a*a*a+1},InOut:function(a){return 1>(a*=2)?.5*a*a*a*a*a:.5*((a-=2)*a*a*a*a+2)}},Sinusoidal:{In:function(a){return 1-Math.cos(a*Math.PI/2)},Out:function(a){return Math.sin(a*Math.PI/2)},InOut:function(a){return.5*(1-Math.cos(Math.PI*a))}},Exponential:{In:function(a){return 0===a?0:Math.pow(1024,a-1)},Out:function(a){return 1===a?1:1-Math.pow(2,-10*a)},InOut:function(a){return 0===a?0:1===a?1:1>(a*=2)?.5*Math.pow(1024,a-1):.5*(-Math.pow(2,-10*(a-1))+2)}},Circular:{In:function(a){return 1-Math.sqrt(1-
+a*a)},Out:function(a){return Math.sqrt(1- --a*a)},InOut:function(a){return 1>(a*=2)?-.5*(Math.sqrt(1-a*a)-1):.5*(Math.sqrt(1-(a-=2)*a)+1)}},Elastic:{In:function(a){return 0===a?0:1===a?1:-Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI)},Out:function(a){return 0===a?0:1===a?1:Math.pow(2,-10*a)*Math.sin(5*(a-.1)*Math.PI)+1},InOut:function(a){if(0===a)return 0;if(1===a)return 1;a*=2;return 1>a?-.5*Math.pow(2,10*(a-1))*Math.sin(5*(a-1.1)*Math.PI):.5*Math.pow(2,-10*(a-1))*Math.sin(5*(a-1.1)*Math.PI)+
+1}},Back:{In:function(a){return a*a*(2.70158*a-1.70158)},Out:function(a){return--a*a*(2.70158*a+1.70158)+1},InOut:function(a){return 1>(a*=2)?.5*a*a*(3.5949095*a-2.5949095):.5*((a-=2)*a*(3.5949095*a+2.5949095)+2)}},Bounce:{In:function(a){return 1-TWEEN.Easing.Bounce.Out(1-a)},Out:function(a){return a<1/2.75?7.5625*a*a:a<2/2.75?7.5625*(a-=1.5/2.75)*a+.75:a<2.5/2.75?7.5625*(a-=2.25/2.75)*a+.9375:7.5625*(a-=2.625/2.75)*a+.984375},InOut:function(a){return.5>a?.5*TWEEN.Easing.Bounce.In(2*a):.5*TWEEN.Easing.Bounce.Out(2*
+a-1)+.5}}};
+TWEEN.Interpolation={Linear:function(a,g){var e=a.length-1,l=e*g,k=Math.floor(l),y=TWEEN.Interpolation.Utils.Linear;return 0>g?y(a[0],a[1],l):1<g?y(a[e],a[e-1],e-l):y(a[k],a[k+1>e?e:k+1],l-k)},Bezier:function(a,g){for(var e=0,l=a.length-1,k=Math.pow,y=TWEEN.Interpolation.Utils.Bernstein,A=0;A<=l;A++)e+=k(1-g,l-A)*k(g,A)*a[A]*y(l,A);return e},CatmullRom:function(a,g){var e=a.length-1,l=e*g,k=Math.floor(l),y=TWEEN.Interpolation.Utils.CatmullRom;return a[0]===a[e]?(0>g&&(k=Math.floor(l=e*(1+g))),y(a[(k-
+1+e)%e],a[k],a[(k+1)%e],a[(k+2)%e],l-k)):0>g?a[0]-(y(a[0],a[0],a[1],a[1],-l)-a[0]):1<g?a[e]-(y(a[e],a[e],a[e-1],a[e-1],l-e)-a[e]):y(a[k?k-1:0],a[k],a[e<k+1?e:k+1],a[e<k+2?e:k+2],l-k)},Utils:{Linear:function(a,g,e){return(g-a)*e+a},Bernstein:function(a,g){var e=TWEEN.Interpolation.Utils.Factorial;return e(a)/e(g)/e(a-g)},Factorial:function(){var a=[1];return function(g){var e=1;if(a[g])return a[g];for(var l=g;1<l;l--)e*=l;return a[g]=e}}(),CatmullRom:function(a,g,e,l,k){a=.5*(e-a);l=.5*(l-g);var y=
+k*k;return(2*g-2*e+a+l)*k*y+(-3*g+3*e-2*a-l)*y+a*k+g}}};(function(a){"function"===typeof define&&define.amd?define([],function(){return TWEEN}):"undefined"!==typeof module&&"object"===typeof exports?module.exports=TWEEN:void 0!==a&&(a.TWEEN=TWEEN)})(this);/*
+ Bart McLeod 2016, [email protected]
+ @author Bart McLeod / http://spaceweb.nl/
+*/
+window.VrmlParser={};VrmlParser.Renderer={};VrmlParser.Renderer.ThreeJs=function(a){this.debug=a?!0:!1};
+VrmlParser.Renderer.ThreeJs.prototype={debug:!1,REVISION:1,constructor:VrmlParser.Renderer.ThreeJs,log:function(){console.log.apply(console,arguments)},warn:function(){console.warn.apply(console,arguments)},error:function(){console.error.apply(console,arguments)},render:function(a,g){var e=this;console.log("VrmlParser.Renderer.ThreeJsRenderer "+this.REVISION);for(var l=function(a){return{r:a.x,g:a.y,b:a.z}},k=function(a,e,g,k,t){var q,m,p;q=t?1:-1;for(var u=["a","b","c","d"],y=[],z,w,H,A=0;A<g.length;A++){var G=
+{};G.y=q*Math.cos(g[A])*e;G.x=q*Math.sin(g[A])*e;y.push(G)}for(A=0;A<a.faces.length;A++)for(g=a.faces[A],q=g instanceof THREE.Face3?3:4,G=0;G<q;G++){m=g[u[G]];m=a.vertices[m];for(var E=0;E<k.length;E++)if(w=0===E?t?e:-1*e:y[E-1].y,H=y[E],void 0!==H){if(p=t?m.y<=w&&m.y>H.y:m.y>=w&&m.y<H.y){z=k[E+1];p=k[E];w=Math.abs(m.y-w)/(w-H.y);var C=z;z=w;p=l(p);C=l(C);w=p.r-C.r;H=p.g-C.g;var C=p.b-C.b,D=new THREE.Color;D.r=p.r-z*w;D.g=p.g-z*H;D.b=p.b-z*C;p=D;g.vertexColors[G]=p}}else void 0===g.vertexColors[G]&&
+(p=t?k.length-1:0,g.vertexColors[G]=l(k[p]))}},y=function(a){return"undefined"!==typeof this[a]&&null!==this[a]},A=function(a){if(void 0===a.node)return!1;a.has=y;var p=new THREE.Object3D,q=!1;switch(a.node){case "NavigationInfo":p=!1;(new VrmlParser.Renderer.ThreeJs.VrmlNode.NavigationInfo(a,e.debug)).parse(g);break;case "Viewpoint":q=(new VrmlParser.Renderer.ThreeJs.VrmlNode.Viewpoint(a,e.debug)).parse(g);p=q.getCamera();e.viewpoints[p.name]=q;break;case "OrientationInterpolator":case "PositionInterpolator":break;
+case "Switch":p=0<=a.whichChoice&&a.whichChoice<a.choice.length?A(a.choice[a.whichChoice]):!1;break;case "Group":case "Transform":p=new THREE.Group;if(a.has("children"))if(a.children.has=y,a.children.has("node"))q=A(a.children),!1!==q&&p.add(q);else if(a.children.has("length"))for(var m=0;m<a.children.length;m++)q=a.children[m],q.has=y,q=A(q),!1!==q&&p.add(q);m={x:0,y:0,z:0};a.has("translation")&&(m=a.translation,p.position.set(m.x,m.y,m.z));var t={x:0,y:0,z:0,radians:0};a.has("rotation")&&(t=a.rotation);
+if(a.has("scale")){var r=a.scale;p.scale.set(r.x,r.y,r.z)}q=new THREE.Group;a.has("center")||(a.center={x:0,y:0,z:0});r=a.center;q.position.set(m.x+r.x,m.y+r.y,m.z+r.z);p.position.set(0-r.x,0-r.y,0-r.z);q.quaternion.setFromAxisAngle(new THREE.Vector3(t.x,t.y,t.z),t.radians);q.add(p);break;case "Shape":var F=a.has("geometry")&&"IndexedLineSet"===a.geometry.node,C=a.has("geometry")&&"PointSet"===a.geometry.node,p=F?new THREE.Line:C?new THREE.Points({size:.01}):new THREE.Mesh;a.has("geometry")&&(p.geometry=
+A(a.geometry));if(a.has("appearance")){t=a.appearance;t.has=y;if(t.has("material")){var u=t.material;u.has=y;F?(m=new THREE.LineBasicMaterial,u.has("color")&&(r=l(u.color),m.color.setRGB(r.r,r.g,r.b))):C?(u.has("diffuseColor")&&(r=l(u.diffuseColor)),u.has("emissiveColor")&&(r=l(u.emissiveColor)),m=new THREE.ShaderMaterial({vertexShader:"void main() {\n\tgl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n\n\tgl_PointSize = 3.0;\n}",fragmentShader:"void main() {\n\tgl_FragColor = vec4( "+
+r.r+", "+r.g+", "+r.b+", 1.0 );\n}"})):(m=new THREE.MeshPhongMaterial,u.has("diffuseColor")&&(r=l(u.diffuseColor),m.color.setRGB(r.r,r.g,r.b)),u.has("emissiveColor")&&(r=l(u.emissiveColor),m.emissive.setRGB(r.r,r.g,r.b)),u.has("specularColor")&&(r=l(u.specularColor),m.specular.setRGB(r.r,r.g,r.b)),u.has("transparency")&&(m.opacity=Math.abs(1-u.transparency),m.transparent=!0),t.has("texture")&&void 0!==t.texture.node&&"ImageTexture"===t.texture.node&&(t=t.texture.url[0],void 0!=t&&t&&(e.log("Loading image: "+
+t),t=(new THREE.TextureLoader).load(t,function(a){void 0!==a.image&&a.repeat.set(a.image.height/a.image.width*2,2)}),t.wrapS=THREE.ClampToEdgeWrapping,t.wrapT=THREE.ClampToEdgeWrapping,e.log(t),m.map=t)))}p.material=m;"IndexedFaceSet"===a.geometry.node&&(p.material.side=THREE.DoubleSide)}break;case "Background":p=!1;m=2E4;t=new THREE.SphereGeometry(m,20,20);r=new THREE.MeshBasicMaterial({fog:!1,side:THREE.BackSide});1<a.skyColor.length?(k(t,m,a.skyAngle,a.skyColor,!0),r.vertexColors=THREE.VertexColors):
+(m=l(a.skyColor[0]),r.color.setRGB(m.r,m.g,m.b));m=new THREE.Mesh(t,r);m.userData.originalVrmlNode=a;g.add(m);a.has("groundColor")&&(m=12E3,t=new THREE.SphereGeometry(m,20,20,0,2*Math.PI,.5*Math.PI,1.5*Math.PI),r=new THREE.MeshBasicMaterial({fog:!1,side:THREE.BackSide,vertexColors:THREE.VertexColors}),k(t,m,a.groundAngle,a.groundColor,!1),m=new THREE.Mesh(t,r),m.userData.originalVrmlNode=a,m.receiveShadow=!0,g.add(m));break;case "Box":r=a.size;p=new THREE.BoxGeometry(r.x,r.y,r.z);p.shading=THREE.SmoothShading;
+break;case "Cylinder":p=new THREE.CylinderGeometry(a.radius,a.radius,a.height);break;case "Cone":p=new THREE.CylinderGeometry(a.topRadius,a.bottomRadius,a.height);break;case "Sphere":p=new THREE.SphereGeometry(a.radius);break;case "IndexedFaceSet":p=new THREE.Geometry;p.shading=THREE.SmoothShading;var D;a.has("texCoord")&&(t=a.texCoord.point);if(a.has("coord"))for(t||(t=a.coord.point),m=0,r=a.coord.point.length;m<r;m++)u=a.coord.point[m],u=new THREE.Vector3(u.x,u.y,u.z),p.vertices.push(u);var z=0;
+if(a.has("coordIndex"))for(m=0,F=a.coordIndex.length;m<F;m++)for(u=a.coordIndex[m],D=a.has("texCoordIndex")?a.texCoordIndex[m]:u,z=0;3<=u.length&&z<u.length-2;){var w=u[0],W=u[z+(a.ccw?1:2)],r=u[z+(a.ccw?2:1)],r=new THREE.Face3(w,W,r,null);t&&D&&p.faceVertexUvs[0].push([new THREE.Vector2(t[D[0]].x,t[D[0]].y),new THREE.Vector2(t[D[z+(a.ccw?1:2)]].x,t[D[z+(a.ccw?1:2)]].y),new THREE.Vector2(t[D[z+(a.ccw?2:1)]].x,t[D[z+(a.ccw?2:1)]].y)]);z++;p.faces.push(r)}p.computeFaceNormals();p.computeBoundingSphere();
+break;case "IndexedLineSet":p=new THREE.Geometry;t=[];if(a.has("coord"))for(m=0,r=a.coord.point.length;m<r;m++)u=a.coord.point[m],u=new THREE.Vector3(u.x,u.y,u.z),t.push(u);if(a.has("coordIndex")){m=0;for(F=a.coordIndex.length;m<F;m++)for(u=a.coordIndex[m],r=0;r<u.length;r++)w=u[r],w=t[w],p.vertices.push(new THREE.Vector3(w.x,w.y,w.z));p.computeBoundingSphere()}break;case "PointSet":p=new THREE.Geometry;if(a.has("coord"))for(m=0,r=a.coord.point.length;m<r;m++)u=a.coord.point[m],u=new THREE.Vector3(u.x,
+u.y,u.z),p.vertices.push(u);p.computeBoundingSphere();break;case "TouchSensor":e.debug&&(p=new THREE.Mesh,p.geometry=new THREE.CubeGeometry(.1,.1,.1),p.material=new THREE.MeshNormalMaterial,p.material.color=new THREE.Color(.5,.5,.5));break;default:p=!1}!1!==p&&(void 0!==p.userData&&(p.userData.originalVrmlNode=a),""===p.name&&(a.has("name")?p.name=a.name:a.has("node")&&(p.name=a.node)),p.castShadow=!C,p.receiveShadow=!C);return!1!==q?(q.name="surrounding_"+p.name,q):p},D=0;D<a.length;D++){var C=A(a[D]);
+!1!==C&&g.add(C)}g.userData.routes=a.routes;console.log(g)}};VrmlParser.Renderer.ThreeJs.Animation=function(a){this.debug=a?!0:!1;this.animations={}};
+VrmlParser.Renderer.ThreeJs.Animation.prototype={update:function(a){for(var g in this.animations)if(this.animations.hasOwnProperty(g))(0,this.animations[g])(a)},addAnimation:function(a,g){this.animations[a]=g},removeAnimation:function(a){delete this.animations[a]},getRoutesForEvent:function(a){a=scene.userData.routes[a];for(var g=0;g<a.length;g++);return a},findTargetRoutes:function(a){var g=[];if("undefined"===typeof a)return g;var e=scene.userData.routes;if("undefined"===typeof e[a.target.name])return a;
+a=e[a.target.name];for(e=0;e<a.length;e++){var l=this.findTargetRoutes(a[e]);g.push(l)}return g},log:function(a){this.debug&&console.log(a)},findSensor:function(a,g){if(null===a)return this.log("Cannot find a sensor of type "+g+" in null"),!1;var e;a:{if(void 0!==a.children)for(e=0;e<a.children.length;e++){var l=a.children[e];if(void 0!==l&&"undefined"!==typeof l.userData.originalVrmlNode&&g===l.userData.originalVrmlNode.node){e=l.name;this.log(g+": "+e);break a}}e=!1}if(e)return e;this.log("No "+
+g+" found amongst the children of the following  node:");this.log(a);if("undefined"===typeof a.parent||null===a.parent)return this.log("We cannot go up the tree any further"),!1;this.log("Searching up the tree");return this.findSensor(a.parent,g)},addClickSupport:function(a,g){projector=new THREE.Projector;var e=this;g.domElement.addEventListener("mousedown",function(l){var k=void 0==l.offsetX?l.layerX:l.offsetX;l=void 0==l.offsetY?l.layerY:l.offsetY;var y=new THREE.Vector3;y.set(k/g.domElement.width*
+2-1,2*-(l/g.domElement.height)+1,.5);y.unproject(a);k=(new THREE.Raycaster(a.position,y.sub(a.position).normalize())).intersectObjects(scene.children,!0);if(k.length){var A=e.findSensor(k[0].object,"TouchSensor");if(!1!==A){k=e.getRoutesForEvent(A).slice(0);for(k=e.findTargetRoutes(k.pop());"function"===typeof k.pop;)if(k=k.pop(),"undefined"===typeof k){e.log("no target route found for "+A);return}e.log(k);l=scene.getObjectByName(k.source.name).userData.originalVrmlNode;void 0===VrmlParser.Renderer.ThreeJs.Animation[l.node]?
+e.log(l.node+" is not yet supported"):(l=new VrmlParser.Renderer.ThreeJs.Animation[l.node](l,e.debug),k=scene.getObjectByName("surrounding_"+k.target.name),k=l.getCallback(k,function(){e.removeAnimation(A)}),e.addAnimation(A,k))}}},!1)}};VrmlParser.Renderer.ThreeJs.VrmlNode=VrmlParser.Renderer.ThreeJs.VrmlNode||{};VrmlParser.Renderer.ThreeJs.Animation.OrientationInterpolator=function(a,g){this.key=a.key;this.keyValue=a.keyValue;this.debug=g?!0:!1;this.index=1;this.tweenObj=this.target=this.finish=null};
+VrmlParser.Renderer.ThreeJs.Animation.OrientationInterpolator.prototype={log:function(a){this.debug&&console.log(a)},complete:function(){this.index++;this.index>=this.keyValue.length?(this.log("finish at index "+this.index),this.finish()):this.tween()},tween:function(){var a=this,g=this.keyValue[this.index],e=g.radians;this.log("Animating from "+this.target.rotation.y+" to "+e);var l=new THREE.Quaternion,g=new THREE.Vector3(g.x,g.y,g.z);l.setFromAxisAngle(g,e);this.tweenObj=(new TWEEN.Tween(this.target.quaternion)).to(l).start(+new Date).onComplete(function(){a.complete()})},
+getCallback:function(a,g){var e=this;this.target=a;this.finish=g;this.tween();return function(a){e.tweenObj.update(+new Date)}}};VrmlParser.Renderer.ThreeJs.Animation.PositionInterpolator=function(a,g){this.key=a.key;this.keyValue=a.keyValue;this.debug=g?!0:!1};
+VrmlParser.Renderer.ThreeJs.Animation.PositionInterpolator.prototype={log:function(a){this.debug&&console.log(a)},tween:function(a,g){return(new TWEEN.Tween(a.position)).to(g).start(+new Date)},getCallback:function(a,g){var e=this,l=1,k=this.getPosition(l);this.log(k);this.log(a);var y=this.tween(a,k);y.onComplete(function(){l++;l>=e.keyValue.length?(console.log("finish"),a.position=k,g()):(k=e.getPosition(l),e.log(k),y=e.tween(a,k),y.onComplete=this)});return function(a){y.update(+new Date)}},getPosition:function(a){a=
+this.keyValue[a];return new THREE.Vector3(a.x,a.y,a.z)}};VrmlParser.Renderer.ThreeJs.VrmlNode.NavigationInfo=function(a,g){this.debug=g;this.node=a;this.node.has=function(a){return"undefined"!==typeof this[a]&&null!==this[a]};this.controls=null};
+VrmlParser.Renderer.ThreeJs.VrmlNode.NavigationInfo.prototype={log:function(a){this.debug&&console.log(a)},parse:function(a){this.log("From NavigationInfo");a=void 0!==this.node.speed?this.node.speed:1;if(void 0!==this.node.type)switch(this.node.type.toLowerCase()){case "fly":this.log("fly!"),controls=new THREE.FlyControls(camera),controls.movementSpeed=a}else this.log("fly!"),controls=new THREE.FlyControls(camera),controls.movementSpeed=a}};VrmlParser.Renderer.ThreeJs.VrmlNode.Viewpoint=function(a,g){this.debug=g;this.node=a;this.node.has=function(a){return"undefined"!==typeof this[a]&&null!==this[a]}};
+VrmlParser.Renderer.ThreeJs.VrmlNode.Viewpoint.prototype={log:function(a){this.debug&&console.log(a)},parse:function(a){var g=new THREE.PerspectiveCamera(Math.round(180/Math.PI*this.node.fieldOfView),window.innerWidth/window.innerHeight,.01,1E5);a=new THREE.Group;a.add(g);this.node.has("name")?g.name=this.node.name:g.name=this.node.description;a.getCamera=function(){return this.children[0]};g=this.node.position;a.position.set(g.x,g.y,g.z);var g=this.node.orientation,e=new THREE.Vector3(g.x,g.y,g.z);
+a.quaternion.setFromAxisAngle(e,g.radians);return a}};

+ 2353 - 0
examples/js/loaders/AssimpLoader.js

@@ -0,0 +1,2353 @@
+/**
+ * @author Virtulous / https://virtulo.us/
+ */
+
+( function () {
+
+	var Virtulous = {};
+
+	Virtulous.KeyFrame = function ( time, matrix ) {
+
+		this.time = time;
+		this.matrix = matrix.clone();
+		this.position = new THREE.Vector3();
+		this.quaternion = new THREE.Quaternion();
+		this.scale = new THREE.Vector3( 1, 1, 1 );
+		this.matrix.decompose( this.position, this.quaternion, this.scale );
+		this.clone = function () {
+
+			var n = new Virtulous.KeyFrame( this.time, this.matrix );
+			return n;
+
+		};
+		this.lerp = function ( nextKey, time ) {
+
+			time -= this.time;
+			var dist = ( nextKey.time - this.time );
+			var l = time / dist;
+			var l2 = 1 - l;
+			var keypos = this.position;
+			var keyrot = this.quaternion;
+			//      var keyscl =  key.parentspaceScl || key.scl;
+			var key2pos = nextKey.position;
+			var key2rot = nextKey.quaternion;
+				//  var key2scl =  key2.parentspaceScl || key2.scl;
+			Virtulous.KeyFrame.tempAniPos.x = keypos.x * l2 + key2pos.x * l;
+			Virtulous.KeyFrame.tempAniPos.y = keypos.y * l2 + key2pos.y * l;
+			Virtulous.KeyFrame.tempAniPos.z = keypos.z * l2 + key2pos.z * l;
+			//     tempAniScale.x = keyscl[0] * l2 + key2scl[0] * l;
+			//     tempAniScale.y = keyscl[1] * l2 + key2scl[1] * l;
+			//     tempAniScale.z = keyscl[2] * l2 + key2scl[2] * l;
+			Virtulous.KeyFrame.tempAniQuat.set( keyrot.x, keyrot.y, keyrot.z, keyrot.w );
+			Virtulous.KeyFrame.tempAniQuat.slerp( key2rot, l );
+			return Virtulous.KeyFrame.tempAniMatrix.compose( Virtulous.KeyFrame.tempAniPos, Virtulous.KeyFrame.tempAniQuat, Virtulous.KeyFrame.tempAniScale );
+
+		};
+
+	};
+
+	Virtulous.KeyFrame.tempAniPos = new THREE.Vector3();
+	Virtulous.KeyFrame.tempAniQuat = new THREE.Quaternion();
+	Virtulous.KeyFrame.tempAniScale = new THREE.Vector3( 1, 1, 1 );
+	Virtulous.KeyFrame.tempAniMatrix = new THREE.Matrix4();
+	Virtulous.KeyFrameTrack = function () {
+
+		this.keys = [];
+		this.target = null;
+		this.time = 0;
+		this.length = 0;
+		this._accelTable = {};
+		this.fps = 20;
+		this.addKey = function ( key ) {
+
+			this.keys.push( key );
+
+		};
+		this.init = function () {
+
+			this.sortKeys();
+
+			if ( this.keys.length > 0 )
+				this.length = this.keys[ this.keys.length - 1 ].time;
+			else
+				this.length = 0;
+
+			if ( ! this.fps ) return;
+
+			for ( var j = 0; j < this.length * this.fps; j ++ ) {
+
+				for ( var i = 0; i < this.keys.length; i ++ ) {
+
+					if ( this.keys[ i ].time == j ) {
+
+						this._accelTable[ j ] = i;
+						break;
+
+					} else if ( this.keys[ i ].time < j / this.fps && this.keys[ i + 1 ] && this.keys[ i + 1 ].time >= j / this.fps ) {
+
+						this._accelTable[ j ] = i;
+						break;
+
+					}
+
+				}
+
+			}
+
+		};
+
+		this.parseFromThree = function ( data ) {
+
+			var fps = data.fps;
+			this.target = data.node;
+			var track = data.hierarchy[ 0 ].keys;
+			for ( var i = 0; i < track.length; i ++ ) {
+
+				this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].targets[ 0 ].data ) );
+
+			}
+			this.init();
+
+		};
+
+		this.parseFromCollada = function ( data ) {
+
+			var track = data.keys;
+			var fps = this.fps;
+
+			for ( var i = 0; i < track.length; i ++ ) {
+
+				this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].matrix ) );
+
+			}
+
+			this.init();
+
+		};
+
+		this.sortKeys = function () {
+
+			this.keys.sort( this.keySortFunc );
+
+		};
+
+		this.keySortFunc = function ( a, b ) {
+
+			return a.time - b.time;
+
+		};
+
+		this.clone = function () {
+
+			var t = new Virtulous.KeyFrameTrack();
+			t.target = this.target;
+			t.time = this.time;
+			t.length = this.length;
+
+			for ( var i = 0; i < this.keys.length; i ++ ) {
+
+				t.addKey( this.keys[ i ].clone() );
+
+			}
+
+			t.init();
+			return t;
+
+		};
+
+		this.reTarget = function ( root, compareitor ) {
+
+			if ( ! compareitor ) compareitor = Virtulous.TrackTargetNodeNameCompare;
+			this.target = compareitor( root, this.target );
+
+		};
+
+		this.keySearchAccel = function ( time ) {
+
+			time *= this.fps;
+			time = Math.floor( time );
+			return this._accelTable[ time ] || 0;
+
+		};
+
+		this.setTime = function ( time ) {
+
+			time = Math.abs( time );
+			if ( this.length )
+				time = time % this.length + .05;
+			var key0 = null;
+			var key1 = null;
+
+			for ( var i = this.keySearchAccel( time ); i < this.keys.length; i ++ ) {
+
+				if ( this.keys[ i ].time == time ) {
+
+					key0 = this.keys[ i ];
+					key1 = this.keys[ i ];
+					break;
+
+				} else if ( this.keys[ i ].time < time && this.keys[ i + 1 ] && this.keys[ i + 1 ].time > time ) {
+
+					key0 = this.keys[ i ];
+					key1 = this.keys[ i + 1 ];
+					break;
+
+				} else if ( this.keys[ i ].time < time && i == this.keys.length - 1 ) {
+
+					key0 = this.keys[ i ];
+					key1 = this.keys[ 0 ].clone();
+					key1.time += this.length + .05;
+					break;
+
+				}
+
+			}
+
+			if ( key0 && key1 && key0 !== key1 ) {
+
+				this.target.matrixAutoUpdate = false;
+				this.target.matrix.copy( key0.lerp( key1, time ) );
+				this.target.matrixWorldNeedsUpdate = true;
+				return;
+
+			}
+
+			if ( key0 && key1 && key0 == key1 ) {
+
+				this.target.matrixAutoUpdate = false;
+				this.target.matrix.copy( key0.matrix );
+				this.target.matrixWorldNeedsUpdate = true;
+				return;
+
+			}
+
+		};
+
+	};
+
+	Virtulous.TrackTargetNodeNameCompare = function ( root, target ) {
+
+		function find( node, name ) {
+
+			if ( node.name == name )
+				return node;
+
+			for ( var i = 0; i < node.children.length; i ++ ) {
+
+				var r = find( node.children[ i ], name );
+				if ( r ) return r;
+
+			}
+
+			return null;
+
+		}
+
+		return find( root, target.name );
+
+	};
+
+	Virtulous.Animation = function () {
+
+		this.tracks = [];
+		this.length = 0;
+
+		this.addTrack = function ( track ) {
+
+			this.tracks.push( track );
+			this.length = Math.max( track.length, this.length );
+
+		};
+
+		this.setTime = function ( time ) {
+
+			this.time = time;
+
+			for ( var i = 0; i < this.tracks.length; i ++ )
+				this.tracks[ i ].setTime( time );
+
+		};
+
+		this.clone = function ( target, compareitor ) {
+
+			if ( ! compareitor ) compareitor = Virtulous.TrackTargetNodeNameCompare;
+			var n = new Virtulous.Animation();
+			n.target = target;
+			for ( var i = 0; i < this.tracks.length; i ++ ) {
+
+				var track = this.tracks[ i ].clone();
+				track.reTarget( target, compareitor );
+				n.addTrack( track );
+
+			}
+
+			return n;
+
+		};
+
+	};
+
+	var ASSBIN_CHUNK_AICAMERA = 0x1234;
+	var ASSBIN_CHUNK_AILIGHT = 0x1235;
+	var ASSBIN_CHUNK_AITEXTURE = 0x1236;
+	var ASSBIN_CHUNK_AIMESH = 0x1237;
+	var ASSBIN_CHUNK_AINODEANIM = 0x1238;
+	var ASSBIN_CHUNK_AISCENE = 0x1239;
+	var ASSBIN_CHUNK_AIBONE = 0x123a;
+	var ASSBIN_CHUNK_AIANIMATION = 0x123b;
+	var ASSBIN_CHUNK_AINODE = 0x123c;
+	var ASSBIN_CHUNK_AIMATERIAL = 0x123d;
+	var ASSBIN_CHUNK_AIMATERIALPROPERTY = 0x123e;
+	var ASSBIN_MESH_HAS_POSITIONS = 0x1;
+	var ASSBIN_MESH_HAS_NORMALS = 0x2;
+	var ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS = 0x4;
+	var ASSBIN_MESH_HAS_TEXCOORD_BASE = 0x100;
+	var ASSBIN_MESH_HAS_COLOR_BASE = 0x10000;
+	var AI_MAX_NUMBER_OF_COLOR_SETS = 1;
+	var AI_MAX_NUMBER_OF_TEXTURECOORDS = 4;
+	var aiLightSource_UNDEFINED = 0x0;
+	//! A directional light source has a well-defined direction
+	//! but is infinitely far away. That's quite a good
+	//! approximation for sun light.
+	var aiLightSource_DIRECTIONAL = 0x1;
+	//! A point light source has a well-defined position
+	//! in space but no direction - it emits light in all
+	//! directions. A normal bulb is a point light.
+	var aiLightSource_POINT = 0x2;
+	//! A spot light source emits light in a specific
+	//! angle. It has a position and a direction it is pointing to.
+	//! A good example for a spot light is a light spot in
+	//! sport arenas.
+	var aiLightSource_SPOT = 0x3;
+	//! The generic light level of the world, including the bounces
+	//! of all other lightsources.
+	//! Typically, there's at most one ambient light in a scene.
+	//! This light type doesn't have a valid position, direction, or
+	//! other properties, just a color.
+	var aiLightSource_AMBIENT = 0x4;
+	/** Flat shading. Shading is done on per-face base,
+	 *  diffuse only. Also known as 'faceted shading'.
+	 */
+	var aiShadingMode_Flat = 0x1;
+	/** Simple Gouraud shading.
+	 */
+	var aiShadingMode_Gouraud = 0x2;
+	/** Phong-Shading -
+	 */
+	var aiShadingMode_Phong = 0x3;
+	/** Phong-Blinn-Shading
+	 */
+	var aiShadingMode_Blinn = 0x4;
+	/** Toon-Shading per pixel
+	 *
+	 *  Also known as 'comic' shader.
+	 */
+	var aiShadingMode_Toon = 0x5;
+	/** OrenNayar-Shading per pixel
+	 *
+	 *  Extension to standard Lambertian shading, taking the
+	 *  roughness of the material into account
+	 */
+	var aiShadingMode_OrenNayar = 0x6;
+	/** Minnaert-Shading per pixel
+	 *
+	 *  Extension to standard Lambertian shading, taking the
+	 *  "darkness" of the material into account
+	 */
+	var aiShadingMode_Minnaert = 0x7;
+	/** CookTorrance-Shading per pixel
+	 *
+	 *  Special shader for metallic surfaces.
+	 */
+	var aiShadingMode_CookTorrance = 0x8;
+	/** No shading at all. Constant light influence of 1.0.
+	 */
+	var aiShadingMode_NoShading = 0x9;
+	/** Fresnel shading
+	 */
+	var aiShadingMode_Fresnel = 0xa;
+	var aiTextureType_NONE = 0x0;
+	/** The texture is combined with the result of the diffuse
+	 *  lighting equation.
+	 */
+	var aiTextureType_DIFFUSE = 0x1;
+	/** The texture is combined with the result of the specular
+	 *  lighting equation.
+	 */
+	var aiTextureType_SPECULAR = 0x2;
+	/** The texture is combined with the result of the ambient
+	 *  lighting equation.
+	 */
+	var aiTextureType_AMBIENT = 0x3;
+	/** The texture is added to the result of the lighting
+	 *  calculation. It isn't influenced by incoming light.
+	 */
+	var aiTextureType_EMISSIVE = 0x4;
+	/** The texture is a height map.
+	 *
+	 *  By convention, higher gray-scale values stand for
+	 *  higher elevations from the base height.
+	 */
+	var aiTextureType_HEIGHT = 0x5;
+	/** The texture is a (tangent space) normal-map.
+	 *
+	 *  Again, there are several conventions for tangent-space
+	 *  normal maps. Assimp does (intentionally) not
+	 *  distinguish here.
+	 */
+	var aiTextureType_NORMALS = 0x6;
+	/** The texture defines the glossiness of the material.
+	 *
+	 *  The glossiness is in fact the exponent of the specular
+	 *  (phong) lighting equation. Usually there is a conversion
+	 *  function defined to map the linear color values in the
+	 *  texture to a suitable exponent. Have fun.
+	 */
+	var aiTextureType_SHININESS = 0x7;
+	/** The texture defines per-pixel opacity.
+	 *
+	 *  Usually 'white' means opaque and 'black' means
+	 *  'transparency'. Or quite the opposite. Have fun.
+	 */
+	var aiTextureType_OPACITY = 0x8;
+	/** Displacement texture
+	 *
+	 *  The exact purpose and format is application-dependent.
+	 *  Higher color values stand for higher vertex displacements.
+	 */
+	var aiTextureType_DISPLACEMENT = 0x9;
+	/** Lightmap texture (aka Ambient Occlusion)
+	 *
+	 *  Both 'Lightmaps' and dedicated 'ambient occlusion maps' are
+	 *  covered by this material property. The texture contains a
+	 *  scaling value for the final color value of a pixel. Its
+	 *  intensity is not affected by incoming light.
+	 */
+	var aiTextureType_LIGHTMAP = 0xA;
+	/** Reflection texture
+	 *
+	 * Contains the color of a perfect mirror reflection.
+	 * Rarely used, almost never for real-time applications.
+	 */
+	var aiTextureType_REFLECTION = 0xB;
+	/** Unknown texture
+	 *
+	 *  A texture reference that does not match any of the definitions
+	 *  above is considered to be 'unknown'. It is still imported,
+	 *  but is excluded from any further postprocessing.
+	 */
+	var aiTextureType_UNKNOWN = 0xC;
+	var BONESPERVERT = 4;
+
+	function ASSBIN_MESH_HAS_TEXCOORD( n ) {
+
+		return ASSBIN_MESH_HAS_TEXCOORD_BASE << n;
+
+	}
+
+	function ASSBIN_MESH_HAS_COLOR( n ) {
+
+		return ASSBIN_MESH_HAS_COLOR_BASE << n;
+
+	}
+
+	function markBones( scene ) {
+
+		for ( var i in scene.mMeshes ) {
+
+			var mesh = scene.mMeshes[ i ];
+			for ( var k in mesh.mBones ) {
+
+				var boneNode = scene.findNode( mesh.mBones[ k ].mName );
+				if ( boneNode )
+					boneNode.isBone = true;
+
+			}
+
+		}
+
+	}
+	function cloneTreeToBones( root, scene ) {
+
+		var rootBone = new THREE.Bone();
+		rootBone.matrix.copy( root.matrix );
+		rootBone.matrixWorld.copy( root.matrixWorld );
+		rootBone.position.copy( root.position );
+		rootBone.quaternion.copy( root.quaternion );
+		rootBone.scale.copy( root.scale );
+		scene.nodeCount++;
+		rootBone.name = "bone_" + root.name + scene.nodeCount.toString();
+
+		if ( ! scene.nodeToBoneMap[ root.name ] )
+			scene.nodeToBoneMap[ root.name ] = [];
+		scene.nodeToBoneMap[ root.name ].push( rootBone );
+		for ( var i in root.children ) {
+
+			var child = cloneTreeToBones( root.children[ i ], scene );
+			if ( child )
+				rootBone.add( child );
+
+		}
+
+		return rootBone;
+
+	}
+
+	function aiAnimation() {
+
+		this.mName = "";
+		this.mDuration = 0;
+		this.mTicksPerSecond = 0;
+		this.mNumChannels = 0;
+		this.mChannels = [];
+
+	}
+
+	function sortWeights( indexes, weights ) {
+
+		var pairs = [];
+
+		for ( var i = 0; i < indexes.length; i ++ ) {
+
+			pairs.push( {
+				i: indexes[ i ],
+				w: weights[ i ]
+			} );
+
+		}
+
+		pairs.sort( function ( a, b ) { return b.w - a.w } );
+
+		while ( pairs.length < 4 ) {
+
+			pairs.push( {
+				i: 0,
+				w: 0
+			} );
+
+		}
+
+		if ( pairs.length > 4 )
+			pairs.length = 4;
+		var sum = 0;
+
+		for ( var i = 0; i < 4; i ++ ) {
+
+			sum += pairs[ i ].w * pairs[ i ].w;
+
+		}
+
+		sum = Math.sqrt( sum );
+
+		for ( var i = 0; i < 4; i ++ ) {
+
+			pairs[ i ].w = pairs[ i ].w / sum;
+			indexes[ i ] = pairs[ i ].i;
+			weights[ i ] = pairs[ i ].w;
+
+		}
+
+	}
+
+	function findMatchingBone( root, name ) {
+
+		if ( root.name.indexOf( "bone_" + name ) == 0 )
+			return root;
+
+		for ( var i in root.children ) {
+
+			var ret = findMatchingBone( root.children[ i ], name );
+
+			if ( ret )
+				return ret;
+
+		}
+
+		return undefined;
+
+	}
+
+	function aiMesh() {
+
+		this.mPrimitiveTypes = 0;
+		this.mNumVertices = 0;
+		this.mNumFaces = 0;
+		this.mNumBones = 0;
+		this.mMaterialIndex = 0;
+		this.mVertices = [];
+		this.mNormals = [];
+		this.mTangents = [];
+		this.mBitangents = [];
+		this.mColors = [
+			[]
+		];
+		this.mTextureCoords = [
+			[]
+		];
+		this.mFaces = [];
+		this.mBones = [];
+		this.hookupSkeletons = function ( scene, threeScene ) {
+
+			if ( this.mBones.length == 0 ) return;
+
+			var allBones = [];
+			var offsetMatrix = [];
+			var skeletonRoot = scene.findNode( this.mBones[ 0 ].mName );
+
+			while ( skeletonRoot.mParent && skeletonRoot.mParent.isBone ) {
+
+				skeletonRoot = skeletonRoot.mParent;
+
+			}
+
+			var threeSkeletonRoot = skeletonRoot.toTHREE( scene );
+			var threeSkeletonRootBone = cloneTreeToBones( threeSkeletonRoot, scene );
+			this.threeNode.add( threeSkeletonRootBone );
+
+			for ( var i = 0; i < this.mBones.length; i ++ ) {
+
+				var bone = findMatchingBone( threeSkeletonRootBone, this.mBones[ i ].mName );
+
+				if ( bone ) {
+
+					var tbone = bone;
+					allBones.push( tbone );
+					//tbone.matrixAutoUpdate = false;
+					offsetMatrix.push( this.mBones[ i ].mOffsetMatrix.toTHREE() );
+
+				} else {
+
+					var skeletonRoot = scene.findNode( this.mBones[ i ].mName );
+					if ( ! skeletonRoot ) return;
+					var threeSkeletonRoot = skeletonRoot.toTHREE( scene );
+					var threeSkeletonRootParent = threeSkeletonRoot.parent;
+					var threeSkeletonRootBone = cloneTreeToBones( threeSkeletonRoot, scene );
+					this.threeNode.add( threeSkeletonRootBone );
+					var bone = findMatchingBone( threeSkeletonRootBone, this.mBones[ i ].mName );
+					var tbone = bone;
+					allBones.push( tbone );
+					//tbone.matrixAutoUpdate = false;
+					offsetMatrix.push( this.mBones[ i ].mOffsetMatrix.toTHREE() );
+
+				}
+
+			}
+			var skeleton = new THREE.Skeleton( allBones, offsetMatrix );
+
+			this.threeNode.bind( skeleton, new THREE.Matrix4() );
+			this.threeNode.material.skinning = true;
+
+		};
+
+		this.toTHREE = function ( scene ) {
+
+			if ( this.threeNode ) return this.threeNode;
+			var geometry = new THREE.BufferGeometry();
+			var mat;
+			if ( scene.mMaterials[ this.mMaterialIndex ] )
+				mat = scene.mMaterials[ this.mMaterialIndex ].toTHREE( scene );
+			else
+				mat = new THREE.MeshLambertMaterial();
+			geometry.setIndex( new THREE.BufferAttribute( new Uint32Array( this.mIndexArray ), 1 ) );
+			geometry.addAttribute( 'position', new THREE.BufferAttribute( this.mVertexBuffer, 3 ) );
+			if ( this.mNormalBuffer && this.mNormalBuffer.length > 0 )
+				geometry.addAttribute( 'normal', new THREE.BufferAttribute( this.mNormalBuffer, 3 ) );
+			if ( this.mColorBuffer && this.mColorBuffer.length > 0 )
+				geometry.addAttribute( 'color', new THREE.BufferAttribute( this.mColorBuffer, 4 ) );
+			if ( this.mTexCoordsBuffers[ 0 ] && this.mTexCoordsBuffers[ 0 ].length > 0 )
+				geometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 0 ] ), 2 ) );
+			if ( this.mTexCoordsBuffers[ 1 ] && this.mTexCoordsBuffers[ 1 ] && this.mTextureCoords[ 1 ].length > 0 )
+				geometry.addAttribute( 'uv1', new THREE.BufferAttribute( new Float32Array( this.mTexCoordsBuffers[ 1 ] ), 2 ) );
+			if ( this.mTangentBuffer && this.mTangentBuffer.length > 0 )
+				geometry.addAttribute( 'tangents', new THREE.BufferAttribute( this.mTangentBuffer, 3 ) );
+			if ( this.mBitangentBuffer && this.mBitangentBuffer.length > 0 )
+				geometry.addAttribute( 'bitangents', new THREE.BufferAttribute( this.mBitangentBuffer, 3 ) );
+			if ( this.mBones.length > 0 ) {
+
+				var weights = [];
+				var bones = [];
+
+				for ( var i = 0; i < this.mBones.length; i ++ ) {
+
+					for ( var j = 0; j < this.mBones[ i ].mWeights.length; j ++ ) {
+
+						var weight = this.mBones[ i ].mWeights[ j ];
+						if ( weight ) {
+
+							if ( ! weights[ weight.mVertexId ] ) weights[ weight.mVertexId ] = [];
+							if ( ! bones[ weight.mVertexId ] ) bones[ weight.mVertexId ] = [];
+							weights[ weight.mVertexId ].push( weight.mWeight );
+							bones[ weight.mVertexId ].push( parseInt( i ) );
+
+						}
+
+					}
+
+				}
+
+				for ( var i in bones ) {
+
+					sortWeights( bones[ i ], weights[ i ] );
+
+				}
+
+				var _weights = [];
+				var _bones = [];
+
+				for ( var i = 0; i < weights.length; i ++ ) {
+
+					for ( var j = 0; j < 4; j ++ ) {
+
+						if ( weights[ i ] && bones[ i ] ) {
+
+							_weights.push( weights[ i ][ j ] );
+							_bones.push( bones[ i ][ j ] );
+
+						} else {
+
+							_weights.push( 0 );
+							_bones.push( 0 );
+
+						}
+
+					}
+
+				}
+
+				geometry.addAttribute( 'skinWeight', new THREE.BufferAttribute( new Float32Array( _weights ), BONESPERVERT ) );
+				geometry.addAttribute( 'skinIndex', new THREE.BufferAttribute( new Float32Array( _bones ), BONESPERVERT ) );
+
+			}
+
+			var mesh;
+
+			if ( this.mBones.length == 0 )
+				mesh = new THREE.Mesh( geometry, mat );
+
+			if ( this.mBones.length > 0 )
+				mesh = new THREE.SkinnedMesh( geometry, mat );
+
+			this.threeNode = mesh;
+			//mesh.matrixAutoUpdate = false;
+			return mesh;
+
+		};
+
+	}
+
+	function aiFace() {
+
+		this.mNumIndices = 0;
+		this.mIndices = [];
+
+	}
+
+	function aiVector3D() {
+
+		this.x = 0;
+		this.y = 0;
+		this.z = 0;
+
+		this.toTHREE = function () {
+
+			return new THREE.Vector3( this.x, this.y, this.z );
+
+		};
+
+	}
+
+	function aiVector2D() {
+
+		this.x = 0;
+		this.y = 0;
+		this.toTHREE = function () {
+
+			return new THREE.Vector2( this.x, this.y );
+
+		};
+
+	}
+
+	function aiVector4D() {
+
+		this.w = 0;
+		this.x = 0;
+		this.y = 0;
+		this.z = 0;
+		this.toTHREE = function () {
+
+			return new THREE.Vector4( this.w, this.x, this.y, this.z );
+
+		};
+
+	}
+
+	function aiColor4D() {
+
+		this.r = 0;
+		this.g = 0;
+		this.b = 0;
+		this.a = 0;
+		this.toTHREE = function () {
+
+			return new THREE.Color( this.r, this.g, this.b, this.a );
+
+		};
+
+	}
+
+	function aiColor3D() {
+
+		this.r = 0;
+		this.g = 0;
+		this.b = 0;
+		this.a = 0;
+		this.toTHREE = function () {
+
+			return new THREE.Color( this.r, this.g, this.b, 1 );
+
+		};
+
+	}
+
+	function aiQuaternion() {
+
+		this.x = 0;
+		this.y = 0;
+		this.z = 0;
+		this.w = 0;
+		this.toTHREE = function () {
+
+			return new THREE.Quaternion( this.x, this.y, this.z, this.w );
+
+		};
+
+	}
+
+	function aiVertexWeight() {
+
+		this.mVertexId = 0;
+		this.mWeight = 0;
+
+	}
+
+	function aiString() {
+
+		this.data = [];
+		this.toString = function () {
+
+			var str = '';
+			this.data.forEach( function ( i ) {
+
+				str += ( String.fromCharCode( i ) );
+
+			} );
+			return str.replace( /[^\x20-\x7E]+/g, '' );
+
+		};
+
+	}
+
+	function aiVectorKey() {
+
+		this.mTime = 0;
+		this.mValue = null;
+
+	}
+
+	function aiQuatKey() {
+
+		this.mTime = 0;
+		this.mValue = null;
+
+	}
+
+	function aiNode() {
+
+		this.mName = '';
+		this.mTransformation = [];
+		this.mNumChildren = 0;
+		this.mNumMeshes = 0;
+		this.mMeshes = [];
+		this.mChildren = [];
+		this.toTHREE = function ( scene ) {
+
+			if ( this.threeNode ) return this.threeNode;
+			var o = new THREE.Object3D();
+			o.name = this.mName;
+			o.matrix = this.mTransformation.toTHREE();
+
+			for ( var i = 0; i < this.mChildren.length; i ++ ) {
+
+				o.add( this.mChildren[ i ].toTHREE( scene ) );
+
+			}
+
+			for ( var i = 0; i < this.mMeshes.length; i ++ ) {
+
+				o.add( scene.mMeshes[ this.mMeshes[ i ] ].toTHREE( scene ) );
+
+			}
+
+			this.threeNode = o;
+			//o.matrixAutoUpdate = false;
+			o.matrix.decompose( o.position, o.quaternion, o.scale );
+			return o;
+
+		};
+
+	}
+
+	function aiBone() {
+
+		this.mName = '';
+		this.mNumWeights = 0;
+		this.mOffsetMatrix = 0;
+
+	}
+
+	function aiMaterialProperty() {
+
+		this.mKey = "";
+		this.mSemantic = 0;
+		this.mIndex = 0;
+		this.mData = [];
+		this.mDataLength = 0;
+		this.mType = 0;
+		this.dataAsColor = function () {
+
+			var array = ( new Uint8Array( this.mData ) ).buffer;
+			var reader = new DataView( array );
+			var r = reader.getFloat32( 0, true );
+			var g = reader.getFloat32( 4, true );
+			var b = reader.getFloat32( 8, true );
+			//var a = reader.getFloat32(12, true);
+			return new THREE.Color( r, g, b );
+
+		};
+
+		this.dataAsFloat = function () {
+
+			var array = ( new Uint8Array( this.mData ) ).buffer;
+			var reader = new DataView( array );
+			var r = reader.getFloat32( 0, true );
+			return r;
+
+		};
+
+		this.dataAsBool = function () {
+
+			var array = ( new Uint8Array( this.mData ) ).buffer;
+			var reader = new DataView( array );
+			var r = reader.getFloat32( 0, true );
+			return !! r;
+
+		};
+
+		this.dataAsString = function () {
+
+			var s = new aiString();
+			s.data = this.mData;
+			return s.toString();
+
+		};
+
+		this.dataAsMap = function ( scene ) {
+
+			var baseURL = scene.baseURL;
+			baseURL = baseURL.substr( 0, baseURL.lastIndexOf( "/" ) + 1 );
+			var s = new aiString();
+			s.data = this.mData;
+			var path = s.toString();
+			path = path.replace( /\\/g, '/' );
+
+			if ( path.indexOf( "/" ) != - 1 ) {
+
+				path = path.substr( path.lastIndexOf( "/" ) + 1 );
+
+			}
+
+			return THREE.ImageUtils.loadTexture( baseURL + path );
+
+		};
+
+	}
+	var namePropMapping = {
+
+		"?mat.name": "name",
+		"$mat.shadingm": "shading",
+		"$mat.twosided": "twoSided",
+		"$mat.wireframe": "wireframe",
+		"$clr.ambient": "ambient",
+		"$clr.diffuse": "color",
+		"$clr.specular": "specular",
+		"$clr.emissive": "emissive",
+		"$clr.transparent": "transparent",
+		"$clr.reflective": "reflect",
+		"$mat.shininess": "shininess",
+		"$mat.reflectivity": "reflectivity",
+		"$mat.refracti": "refraction",
+		"$tex.file": "map"
+
+	};
+
+	var nameTexMapping = {
+
+		"$tex.ambient": "ambientMap",
+		"$clr.diffuse": "map",
+		"$clr.specular": "specMap",
+		"$clr.emissive": "emissive",
+		"$clr.transparent": "alphaMap",
+		"$clr.reflective": "reflectMap",
+
+	};
+
+	var nameTypeMapping = {
+
+		"?mat.name": "string",
+		"$mat.shadingm": "bool",
+		"$mat.twosided": "bool",
+		"$mat.wireframe": "bool",
+		"$clr.ambient": "color",
+		"$clr.diffuse": "color",
+		"$clr.specular": "color",
+		"$clr.emissive": "color",
+		"$clr.transparent": "color",
+		"$clr.reflective": "color",
+		"$mat.shininess": "float",
+		"$mat.reflectivity": "float",
+		"$mat.refracti": "float",
+		"$tex.file": "map"
+
+	};
+
+	function aiMaterial() {
+
+		this.mNumAllocated = 0;
+		this.mNumProperties = 0;
+		this.mProperties = [];
+		this.toTHREE = function ( scene ) {
+
+			var name = this.mProperties[ 0 ].dataAsString();
+			var mat = new THREE.MeshPhongMaterial();
+
+			for ( var i = 0; i < this.mProperties.length; i ++ ) {
+
+				if ( nameTypeMapping[ this.mProperties[ i ].mKey ] == 'float' )
+					mat[ namePropMapping[ this.mProperties[ i ].mKey ] ] = this.mProperties[ i ].dataAsFloat();
+				if ( nameTypeMapping[ this.mProperties[ i ].mKey ] == 'color' )
+					mat[ namePropMapping[ this.mProperties[ i ].mKey ] ] = this.mProperties[ i ].dataAsColor();
+				if ( nameTypeMapping[ this.mProperties[ i ].mKey ] == 'bool' )
+					mat[ namePropMapping[ this.mProperties[ i ].mKey ] ] = this.mProperties[ i ].dataAsBool();
+				if ( nameTypeMapping[ this.mProperties[ i ].mKey ] == 'string' )
+					mat[ namePropMapping[ this.mProperties[ i ].mKey ] ] = this.mProperties[ i ].dataAsString();
+				if ( nameTypeMapping[ this.mProperties[ i ].mKey ] == 'map' ) {
+
+					var prop = this.mProperties[ i ];
+					if ( prop.mSemantic == aiTextureType_DIFFUSE )
+						mat.map = this.mProperties[ i ].dataAsMap( scene );
+					if ( prop.mSemantic == aiTextureType_NORMALS )
+						mat.normalMap = this.mProperties[ i ].dataAsMap( scene );
+					if ( prop.mSemantic == aiTextureType_LIGHTMAP )
+						mat.lightMap = this.mProperties[ i ].dataAsMap( scene );
+					if ( prop.mSemantic == aiTextureType_OPACITY )
+						mat.alphaMap = this.mProperties[ i ].dataAsMap( scene );
+
+				}
+
+			}
+
+			mat.ambient.r = .53;
+			mat.ambient.g = .53;
+			mat.ambient.b = .53;
+			mat.color.r = 1;
+			mat.color.g = 1;
+			mat.color.b = 1;
+			return mat;
+
+		};
+
+	}
+
+
+	function veclerp( v1, v2, l ) {
+
+		var v = new THREE.Vector3();
+		var lm1 = 1 - l;
+		v.x = v1.x * l + v2.x * lm1;
+		v.y = v1.y * l + v2.y * lm1;
+		v.z = v1.z * l + v2.z * lm1;
+		return v;
+
+	}
+
+	function quatlerp( q1, q2, l ) {
+
+		return q1.clone().slerp( q2, 1 - l );
+
+	}
+
+	function sampleTrack( keys, time, lne, lerp ) {
+
+		if ( keys.length == 1 ) return keys[ 0 ].mValue.toTHREE();
+
+		var dist = Infinity;
+		var key = null;
+		var nextKey = null;
+
+		for ( var i = 0; i < keys.length; i ++ ) {
+
+			var timeDist = Math.abs( keys[ i ].mTime - time );
+
+			if ( timeDist < dist && keys[ i ].mTime <= time ) {
+
+				dist = timeDist;
+				key = keys[ i ];
+				nextKey = keys[ i + 1 ];
+
+			}
+
+		}
+
+		if ( ! key ) return null;
+
+		if ( key && nextKey ) {
+
+			var dT = nextKey.mTime - key.mTime;
+			var T = key.mTime - time;
+			var l = T / dT;
+
+			return lerp( key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l );
+
+		}
+
+		nextKey = keys[ 0 ].clone();
+		nextKey.mTime += lne;
+
+		var dT = nextKey.mTime - key.mTime;
+		var T = key.mTime - time;
+		var l = T / dT;
+
+		return lerp( key.mValue.toTHREE(), nextKey.mValue.toTHREE(), l );
+
+	}
+
+	function aiNodeAnim() {
+
+		this.mNodeName = "";
+		this.mNumPositionKeys = 0;
+		this.mNumRotationKeys = 0;
+		this.mNumScalingKeys = 0;
+		this.mPositionKeys = [];
+		this.mRotationKeys = [];
+		this.mScalingKeys = [];
+		this.mPreState = "";
+		this.mPostState = "";
+		this.init = function ( tps ) {
+
+			if ( ! tps ) tps = 1;
+
+			function t( t ) {
+
+				t.mTime /= tps;
+
+			}
+
+			this.mPositionKeys.forEach( t );
+			this.mRotationKeys.forEach( t );
+			this.mScalingKeys.forEach( t );
+
+		};
+
+		this.sortKeys = function () {
+
+			function comp( a, b ) {
+
+				return a.mTime - b.mTime;
+
+			}
+
+			this.mPositionKeys.sort( comp );
+			this.mRotationKeys.sort( comp );
+			this.mScalingKeys.sort( comp );
+
+		};
+
+		this.getLength = function () {
+
+			return Math.max(
+				Math.max.apply( null, this.mPositionKeys.map( function ( a ) { return a.mTime } ) ),
+				Math.max.apply( null, this.mRotationKeys.map( function ( a ) { return a.mTime } ) ),
+				Math.max.apply( null, this.mScalingKeys.map( function ( a ) { return a.mTime } ) )
+			);
+
+		};
+
+		this.toTHREE = function ( o, tps ) {
+
+			this.sortKeys();
+			var length = this.getLength();
+			var track = new Virtulous.KeyFrameTrack();
+
+			for ( var i = 0; i < length; i += .05 ) {
+
+				var matrix = new THREE.Matrix4();
+				var time = i;
+				var pos = sampleTrack( this.mPositionKeys, time, length, veclerp );
+				var scale = sampleTrack( this.mScalingKeys, time, length, veclerp );
+				var rotation = sampleTrack( this.mRotationKeys, time, length, quatlerp );
+				matrix.compose( pos, rotation, scale );
+
+				var key = new Virtulous.KeyFrame( time, matrix );
+				track.addKey( key );
+
+			}
+
+			track.target = o.findNode( this.mNodeName ).toTHREE();
+
+			var tracks = [ track ];
+
+			if ( o.nodeToBoneMap[ this.mNodeName ] ) {
+
+				for ( var i = 0; i < o.nodeToBoneMap[ this.mNodeName ].length; i ++ ) {
+
+					var t2 = track.clone();
+					t2.target = o.nodeToBoneMap[ this.mNodeName ][ i ];
+					tracks.push( t2 );
+
+				}
+
+			}
+
+			return tracks;
+
+		};
+
+	}
+
+	function aiAnimation() {
+
+		this.mName = "";
+		this.mDuration = 0;
+		this.mTicksPerSecond = 0;
+		this.mNumChannels = 0;
+		this.mChannels = [];
+		this.toTHREE = function ( root ) {
+
+			var animationHandle = new Virtulous.Animation();
+
+			for ( var i in this.mChannels ) {
+
+				this.mChannels[ i ].init( this.mTicksPerSecond );
+
+				var tracks = this.mChannels[ i ].toTHREE( root );
+
+				for ( var j in tracks ) {
+
+					tracks[ j ].init();
+					animationHandle.addTrack( tracks[ j ] );
+
+				}
+
+			}
+
+			animationHandle.length = Math.max.apply( null, animationHandle.tracks.map( function ( e ) { return e.length } ) );
+			return animationHandle;
+
+		};
+
+	}
+
+	function aiTexture() {
+
+		this.mWidth = 0;
+		this.mHeight = 0;
+		this.texAchFormatHint = [];
+		this.pcData = [];
+
+	}
+
+	function aiLight() {
+
+		this.mName = '';
+		this.mType = 0;
+		this.mAttenuationConstant = 0;
+		this.mAttenuationLinear = 0;
+		this.mAttenuationQuadratic = 0;
+		this.mAngleInnerCone = 0;
+		this.mAngleOuterCone = 0;
+		this.mColorDiffuse = null;
+		this.mColorSpecular = null;
+		this.mColorAmbient = null;
+
+	}
+
+	function aiCamera() {
+
+		this.mName = '';
+		this.mPosition = null;
+		this.mLookAt = null;
+		this.mUp = null;
+		this.mHorizontalFOV = 0;
+		this.mClipPlaneNear = 0;
+		this.mClipPlaneFar = 0;
+		this.mAspect = 0;
+
+	}
+
+	function aiScene() {
+
+		this.mFlags = 0;
+		this.mNumMeshes = 0;
+		this.mNumMaterials = 0;
+		this.mNumAnimations = 0;
+		this.mNumTextures = 0;
+		this.mNumLights = 0;
+		this.mNumCameras = 0;
+		this.mRootNode = null;
+		this.mMeshes = [];
+		this.mMaterials = [];
+		this.mAnimations = [];
+		this.mLights = [];
+		this.mCameras = [];
+		this.nodeToBoneMap = {};
+		this.findNode = function ( name, root ) {
+
+			if ( ! root ) {
+
+				root = this.mRootNode;
+
+			}
+
+			if ( root.mName == name ) {
+
+				return root;
+
+			}
+
+			for ( var i = 0; i < root.mChildren.length; i ++ ) {
+
+				var ret = this.findNode( name, root.mChildren[ i ] );
+				if ( ret ) return ret;
+
+			}
+
+			return null;
+
+		};
+
+		this.toTHREE = function () {
+
+			this.nodeCount = 0;
+
+			markBones( this );
+
+			var o = this.mRootNode.toTHREE( this );
+
+			for ( var i in this.mMeshes )
+				this.mMeshes[ i ].hookupSkeletons( this, o );
+
+			if ( this.mAnimations.length > 0 ) {
+
+				var a = this.mAnimations[ 0 ].toTHREE( this );
+
+			}
+
+			return { object: o, animation: a };
+
+		};
+
+	}
+
+	function aiMatrix4() {
+
+		this.elements = [
+			[],
+			[],
+			[],
+			[]
+		];
+		this.toTHREE = function () {
+
+			var m = new THREE.Matrix4();
+
+			for ( var i = 0; i < 4; ++i ) {
+
+				for ( var i2 = 0; i2 < 4; ++i2 ) {
+
+					m.elements[ i * 4 + i2 ] = this.elements[ i2 ][ i ];
+
+				}
+
+			}
+
+			return m;
+
+		};
+
+	}
+
+	var littleEndian = true;
+
+	function readFloat( dataview ) {
+
+		var val = dataview.getFloat32( dataview.readOffset, littleEndian );
+		dataview.readOffset += 4;
+		return val;
+
+	}
+
+	function Read_double( dataview ) {
+
+		var val = dataview.getFloat64( dataview.readOffset, littleEndian );
+		dataview.readOffset += 8;
+		return val;
+
+	}
+
+	function Read_uint8_t( dataview ) {
+
+		var val = dataview.getUint8( dataview.readOffset );
+		dataview.readOffset += 1;
+		return val;
+
+	}
+
+	function Read_uint16_t( dataview ) {
+
+		var val = dataview.getUint16( dataview.readOffset, littleEndian );
+		dataview.readOffset += 2;
+		return val;
+
+	}
+
+	function Read_unsigned_int( dataview ) {
+
+		var val = dataview.getUint32( dataview.readOffset, littleEndian );
+		dataview.readOffset += 4;
+		return val;
+
+	}
+
+	function Read_uint32_t( dataview ) {
+
+		var val = dataview.getUint32( dataview.readOffset, littleEndian );
+		dataview.readOffset += 4;
+		return val;
+
+	}
+
+	function Read_aiVector3D( stream ) {
+
+		var v = new aiVector3D();
+		v.x = readFloat( stream );
+		v.y = readFloat( stream );
+		v.z = readFloat( stream );
+		return v;
+
+	}
+
+	function Read_aiVector2D( stream ) {
+
+		var v = new aiVector2D();
+		v.x = readFloat( stream );
+		v.y = readFloat( stream );
+		return v;
+
+	}
+
+	function Read_aiVector4D( stream ) {
+
+		var v = new aiVector4D();
+		v.w = readFloat( stream );
+		v.x = readFloat( stream );
+		v.y = readFloat( stream );
+		v.z = readFloat( stream );
+		return v;
+
+	}
+
+	function Read_aiColor3D( stream ) {
+
+		var c = new aiColor3D();
+		c.r = readFloat( stream );
+		c.g = readFloat( stream );
+		c.b = readFloat( stream );
+		return c;
+
+	}
+
+	function Read_aiColor4D( stream ) {
+
+		var c = new aiColor4D();
+		c.r = readFloat( stream );
+		c.g = readFloat( stream );
+		c.b = readFloat( stream );
+		c.a = readFloat( stream );
+		return c;
+
+	}
+
+	function Read_aiQuaternion( stream ) {
+
+		var v = new aiQuaternion();
+		v.w = readFloat( stream );
+		v.x = readFloat( stream );
+		v.y = readFloat( stream );
+		v.z = readFloat( stream );
+		return v;
+
+	}
+
+	function Read_aiString( stream ) {
+
+		var s = new aiString();
+		var stringlengthbytes = Read_unsigned_int( stream );
+		stream.ReadBytes( s.data, 1, stringlengthbytes );
+		return s.toString();
+
+	}
+
+	function Read_aiVertexWeight( stream ) {
+
+		var w = new aiVertexWeight();
+		w.mVertexId = Read_unsigned_int( stream );
+		w.mWeight = readFloat( stream );
+		return w;
+
+	}
+
+	function Read_aiMatrix4x4( stream ) {
+
+		var m = new aiMatrix4();
+
+		for ( var i = 0; i < 4; ++i ) {
+
+			for ( var i2 = 0; i2 < 4; ++i2 ) {
+
+				m.elements[ i ][ i2 ] = readFloat( stream );
+
+			}
+
+		}
+
+		return m;
+
+	}
+
+	function Read_aiVectorKey( stream ) {
+
+		var v = new aiVectorKey();
+		v.mTime = Read_double( stream );
+		v.mValue = Read_aiVector3D( stream );
+		return v;
+
+	}
+
+	function Read_aiQuatKey( stream ) {
+
+		var v = new aiQuatKey();
+		v.mTime = Read_double( stream );
+		v.mValue = Read_aiQuaternion( stream );
+		return v;
+
+	}
+
+	function ReadArray( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read( stream );
+
+	}
+
+	function ReadArray_aiVector2D( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector2D( stream );
+
+	}
+
+	function ReadArray_aiVector3D( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector3D( stream );
+
+	}
+
+	function ReadArray_aiVector4D( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVector4D( stream );
+
+	}
+
+	function ReadArray_aiVertexWeight( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVertexWeight( stream );
+
+	}
+
+	function ReadArray_aiColor4D( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiColor4D( stream );
+
+	}
+
+	function ReadArray_aiVectorKey( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiVectorKey( stream );
+
+	}
+
+	function ReadArray_aiQuatKey( stream, data, size ) {
+
+		for ( var i = 0; i < size; i ++ ) data[ i ] = Read_aiQuatKey( stream );
+
+	}
+
+	function ReadBounds( stream, T /*p*/, n ) {
+
+		// not sure what to do here, the data isn't really useful.
+		return stream.Seek( sizeof( T ) * n, aiOrigin_CUR );
+
+	}
+
+	function ai_assert( bool ) {
+
+		if ( ! bool )
+			throw ( "asset failed" );
+
+	}
+
+	function ReadBinaryNode( stream, parent, depth ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AINODE );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		var node = new aiNode();
+		node.mParent = parent;
+		node.mDepth = depth;
+		node.mName = Read_aiString( stream );
+		node.mTransformation = Read_aiMatrix4x4( stream );
+		node.mNumChildren = Read_unsigned_int( stream );
+		node.mNumMeshes = Read_unsigned_int( stream );
+
+		if ( node.mNumMeshes ) {
+
+			node.mMeshes = [];
+
+			for ( var i = 0; i < node.mNumMeshes; ++i ) {
+
+				node.mMeshes[ i ] = Read_unsigned_int( stream );
+
+			}
+
+		}
+
+		if ( node.mNumChildren ) {
+
+			node.mChildren = [];
+
+			for ( var i = 0; i < node.mNumChildren; ++i ) {
+
+				var node2 = ReadBinaryNode( stream, node, depth ++ );
+				node.mChildren[ i ] = node2;
+
+			}
+
+		}
+
+		return node;
+
+	}
+
+	// -----------------------------------------------------------------------------------
+
+	function ReadBinaryBone( stream, b ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AIBONE );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		b.mName = Read_aiString( stream );
+		b.mNumWeights = Read_unsigned_int( stream );
+		b.mOffsetMatrix = Read_aiMatrix4x4( stream );
+		// for the moment we write dumb min/max values for the bones, too.
+		// maybe I'll add a better, hash-like solution later
+		if ( shortened ) {
+
+			ReadBounds( stream, b.mWeights, b.mNumWeights );
+
+		} else {
+
+			// else write as usual
+
+			b.mWeights = [];
+			ReadArray_aiVertexWeight( stream, b.mWeights, b.mNumWeights );
+
+		}
+
+		return b;
+
+	}
+
+	function ReadBinaryMesh( stream, mesh ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AIMESH );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		mesh.mPrimitiveTypes = Read_unsigned_int( stream );
+		mesh.mNumVertices = Read_unsigned_int( stream );
+		mesh.mNumFaces = Read_unsigned_int( stream );
+		mesh.mNumBones = Read_unsigned_int( stream );
+		mesh.mMaterialIndex = Read_unsigned_int( stream );
+		mesh.mNumUVComponents = [];
+		// first of all, write bits for all existent vertex components
+		var c = Read_unsigned_int( stream );
+
+		if ( c & ASSBIN_MESH_HAS_POSITIONS ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, mesh.mVertices, mesh.mNumVertices );
+
+			} else {
+
+				// else write as usual
+
+				mesh.mVertices = [];
+				mesh.mVertexBuffer = stream.subArray32( stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4 );
+				stream.Seek( mesh.mNumVertices * 3 * 4, aiOrigin_CUR );
+
+			}
+
+		}
+
+		if ( c & ASSBIN_MESH_HAS_NORMALS ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, mesh.mNormals, mesh.mNumVertices );
+
+			} else {
+
+				// else write as usual
+
+				mesh.mNormals = [];
+				mesh.mNormalBuffer = stream.subArray32( stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4 );
+				stream.Seek( mesh.mNumVertices * 3 * 4, aiOrigin_CUR );
+
+			}
+
+		}
+
+		if ( c & ASSBIN_MESH_HAS_TANGENTS_AND_BITANGENTS ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, mesh.mTangents, mesh.mNumVertices );
+				ReadBounds( stream, mesh.mBitangents, mesh.mNumVertices );
+
+			} else {
+
+				// else write as usual
+
+				mesh.mTangents = [];
+				mesh.mTangentBuffer = stream.subArray32( stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4 );
+				stream.Seek( mesh.mNumVertices * 3 * 4, aiOrigin_CUR );
+				mesh.mBitangents = [];
+				mesh.mBitangentBuffer = stream.subArray32( stream.readOffset, stream.readOffset + mesh.mNumVertices * 3 * 4 );
+				stream.Seek( mesh.mNumVertices * 3 * 4, aiOrigin_CUR );
+
+			}
+
+		}
+
+		for ( var n = 0; n < AI_MAX_NUMBER_OF_COLOR_SETS; ++n ) {
+
+			if ( ! ( c & ASSBIN_MESH_HAS_COLOR( n ) ) ) break;
+
+			if ( shortened ) {
+
+				ReadBounds( stream, mesh.mColors[ n ], mesh.mNumVertices );
+
+			} else {
+
+				// else write as usual
+
+				mesh.mColors[ n ] = [];
+				mesh.mColorBuffer = stream.subArray32( stream.readOffset, stream.readOffset + mesh.mNumVertices * 4 * 4 );
+				stream.Seek( mesh.mNumVertices * 4 * 4, aiOrigin_CUR );
+
+			}
+
+		}
+
+		mesh.mTexCoordsBuffers = [];
+
+		for ( var n = 0; n < AI_MAX_NUMBER_OF_TEXTURECOORDS; ++n ) {
+
+			if ( ! ( c & ASSBIN_MESH_HAS_TEXCOORD( n ) ) ) break;
+
+			// write number of UV components
+			mesh.mNumUVComponents[ n ] = Read_unsigned_int( stream );
+
+			if ( shortened ) {
+
+				ReadBounds( stream, mesh.mTextureCoords[ n ], mesh.mNumVertices );
+
+			} else {
+
+			// else write as usual
+
+				mesh.mTextureCoords[ n ] = [];
+				//note that assbin always writes 3d texcoords
+				mesh.mTexCoordsBuffers[ n ] = [];
+
+				for ( var uv = 0; uv < mesh.mNumVertices; uv ++ ) {
+
+					mesh.mTexCoordsBuffers[ n ].push( readFloat( stream ) );
+					mesh.mTexCoordsBuffers[ n ].push( readFloat( stream ) );
+					readFloat( stream );
+
+				}
+
+			}
+
+		}
+		// write faces. There are no floating-point calculations involved
+		// in these, so we can write a simple hash over the face data
+		// to the dump file. We generate a single 32 Bit hash for 512 faces
+		// using Assimp's standard hashing function.
+		if ( shortened ) {
+
+			Read_unsigned_int( stream );
+
+		} else {
+
+			// else write as usual
+
+			// if there are less than 2^16 vertices, we can simply use 16 bit integers ...
+			mesh.mFaces = [];
+
+			var indexCounter = 0;
+			mesh.mIndexArray = [];
+
+			for ( var i = 0; i < mesh.mNumFaces; ++i ) {
+
+				var f = mesh.mFaces[ i ] = new aiFace();
+				// BOOST_STATIC_ASSERT(AI_MAX_FACE_INDICES <= 0xffff);
+				f.mNumIndices = Read_uint16_t( stream );
+				f.mIndices = [];
+
+				for ( var a = 0; a < f.mNumIndices; ++a ) {
+
+					if ( mesh.mNumVertices < ( 1 << 16 ) ) {
+
+						f.mIndices[ a ] = Read_uint16_t( stream );
+
+					} else {
+
+						f.mIndices[ a ] = Read_unsigned_int( stream );
+
+					}
+
+					
+
+				}
+
+				if(f.mNumIndices === 3) {
+
+					mesh.mIndexArray.push( f.mIndices[ 0 ] );
+					mesh.mIndexArray.push( f.mIndices[ 1 ] );
+					mesh.mIndexArray.push( f.mIndices[ 2 ] );
+
+				}
+				else if(f.mNumIndices === 4) {
+
+					mesh.mIndexArray.push( f.mIndices[ 0 ] );
+					mesh.mIndexArray.push( f.mIndices[ 1 ] );
+					mesh.mIndexArray.push( f.mIndices[ 2 ] );
+					mesh.mIndexArray.push( f.mIndices[ 2 ] );
+					mesh.mIndexArray.push( f.mIndices[ 3 ] );
+					mesh.mIndexArray.push( f.mIndices[ 0 ] );
+
+				} else {
+
+					throw ( new Error( "Sorry, can't currently triangulate polys. Use the triangulate preprocessor in Assimp." ))
+					
+				}
+
+
+
+			}
+
+		}
+		// write bones
+		if ( mesh.mNumBones ) {
+
+			mesh.mBones = [];
+
+			for ( var a = 0; a < mesh.mNumBones; ++a ) {
+
+				mesh.mBones[ a ] = new aiBone();
+				ReadBinaryBone( stream, mesh.mBones[ a ] );
+
+			}
+
+		}
+
+	}
+
+	function ReadBinaryMaterialProperty( stream, prop ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AIMATERIALPROPERTY );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		prop.mKey = Read_aiString( stream );
+		prop.mSemantic = Read_unsigned_int( stream );
+		prop.mIndex = Read_unsigned_int( stream );
+		prop.mDataLength = Read_unsigned_int( stream );
+		prop.mType = Read_unsigned_int( stream );
+		prop.mData = [];
+		stream.ReadBytes( prop.mData, 1, prop.mDataLength );
+
+	}
+
+	// -----------------------------------------------------------------------------------
+
+	function ReadBinaryMaterial( stream, mat ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AIMATERIAL );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		mat.mNumAllocated = mat.mNumProperties = Read_unsigned_int( stream );
+
+		if ( mat.mNumProperties ) {
+
+			if ( mat.mProperties ) {
+
+				delete mat.mProperties;
+
+			}
+
+			mat.mProperties = [];
+
+			for ( var i = 0; i < mat.mNumProperties; ++i ) {
+
+				mat.mProperties[ i ] = new aiMaterialProperty();
+				ReadBinaryMaterialProperty( stream, mat.mProperties[ i ] );
+
+			}
+
+		}
+
+	}
+	// -----------------------------------------------------------------------------------
+	function ReadBinaryNodeAnim( stream, nd ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AINODEANIM );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		nd.mNodeName = Read_aiString( stream );
+		nd.mNumPositionKeys = Read_unsigned_int( stream );
+		nd.mNumRotationKeys = Read_unsigned_int( stream );
+		nd.mNumScalingKeys = Read_unsigned_int( stream );
+		nd.mPreState = Read_unsigned_int( stream );
+		nd.mPostState = Read_unsigned_int( stream );
+
+		if ( nd.mNumPositionKeys ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, nd.mPositionKeys, nd.mNumPositionKeys );
+
+			} else {
+
+				// else write as usual
+
+				nd.mPositionKeys = [];
+				ReadArray_aiVectorKey( stream, nd.mPositionKeys, nd.mNumPositionKeys );
+
+			}
+
+		}
+
+		if ( nd.mNumRotationKeys ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, nd.mRotationKeys, nd.mNumRotationKeys );
+
+			} else {
+
+	 			// else write as usual
+
+				nd.mRotationKeys = [];
+				ReadArray_aiQuatKey( stream, nd.mRotationKeys, nd.mNumRotationKeys );
+
+			}
+
+		}
+
+		if ( nd.mNumScalingKeys ) {
+
+			if ( shortened ) {
+
+				ReadBounds( stream, nd.mScalingKeys, nd.mNumScalingKeys );
+
+			} else {
+
+ 				// else write as usual
+
+				nd.mScalingKeys = [];
+				ReadArray_aiVectorKey( stream, nd.mScalingKeys, nd.mNumScalingKeys );
+
+			}
+
+		}
+
+	}
+	// -----------------------------------------------------------------------------------
+	function ReadBinaryAnim( stream, anim ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AIANIMATION );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		anim.mName = Read_aiString( stream );
+		anim.mDuration = Read_double( stream );
+		anim.mTicksPerSecond = Read_double( stream );
+		anim.mNumChannels = Read_unsigned_int( stream );
+
+		if ( anim.mNumChannels ) {
+
+			anim.mChannels = [];
+
+			for ( var a = 0; a < anim.mNumChannels; ++a ) {
+
+				anim.mChannels[ a ] = new aiNodeAnim();
+				ReadBinaryNodeAnim( stream, anim.mChannels[ a ] );
+
+			}
+
+		}
+
+	}
+
+	function ReadBinaryTexture( stream, tex ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AITEXTURE );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		tex.mWidth = Read_unsigned_int( stream );
+		tex.mHeight = Read_unsigned_int( stream );
+		stream.ReadBytes( tex.achFormatHint, 1, 4 );
+
+		if ( ! shortened ) {
+
+			if ( ! tex.mHeight ) {
+
+				tex.pcData = [];
+				stream.ReadBytes( tex.pcData, 1, tex.mWidth );
+
+			} else {
+
+				tex.pcData = [];
+				stream.ReadBytes( tex.pcData, 1, tex.mWidth * tex.mHeight * 4 );
+
+			}
+
+		}
+
+	}
+	// -----------------------------------------------------------------------------------
+	function ReadBinaryLight( stream, l ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AILIGHT );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		l.mName = Read_aiString( stream );
+		l.mType = Read_unsigned_int( stream );
+
+		if ( l.mType != aiLightSource_DIRECTIONAL ) {
+
+			l.mAttenuationConstant = readFloat( stream );
+			l.mAttenuationLinear = readFloat( stream );
+			l.mAttenuationQuadratic = readFloat( stream );
+
+		}
+
+		l.mColorDiffuse = Read_aiColor3D( stream );
+		l.mColorSpecular = Read_aiColor3D( stream );
+		l.mColorAmbient = Read_aiColor3D( stream );
+
+		if ( l.mType == aiLightSource_SPOT ) {
+
+			l.mAngleInnerCone = readFloat( stream );
+			l.mAngleOuterCone = readFloat( stream );
+
+		}
+
+	}
+	// -----------------------------------------------------------------------------------
+	function ReadBinaryCamera( stream, cam ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AICAMERA );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		cam.mName = Read_aiString( stream );
+		cam.mPosition = Read_aiVector3D( stream );
+		cam.mLookAt = Read_aiVector3D( stream );
+		cam.mUp = Read_aiVector3D( stream );
+		cam.mHorizontalFOV = readFloat( stream );
+		cam.mClipPlaneNear = readFloat( stream );
+		cam.mClipPlaneFar = readFloat( stream );
+		cam.mAspect = readFloat( stream );
+
+	}
+
+	function ReadBinaryScene( stream, scene ) {
+
+		var chunkID = Read_uint32_t( stream );
+		ai_assert( chunkID == ASSBIN_CHUNK_AISCENE );
+		/*uint32_t size =*/
+		Read_uint32_t( stream );
+		scene.mFlags = Read_unsigned_int( stream );
+		scene.mNumMeshes = Read_unsigned_int( stream );
+		scene.mNumMaterials = Read_unsigned_int( stream );
+		scene.mNumAnimations = Read_unsigned_int( stream );
+		scene.mNumTextures = Read_unsigned_int( stream );
+		scene.mNumLights = Read_unsigned_int( stream );
+		scene.mNumCameras = Read_unsigned_int( stream );
+		// Read node graph
+		scene.mRootNode = new aiNode();
+		scene.mRootNode = ReadBinaryNode( stream, null, 0 );
+		// Read all meshes
+		if ( scene.mNumMeshes ) {
+
+			scene.mMeshes = [];
+
+			for ( var i = 0; i < scene.mNumMeshes; ++i ) {
+
+				scene.mMeshes[ i ] = new aiMesh();
+				ReadBinaryMesh( stream, scene.mMeshes[ i ] );
+
+			}
+
+		}
+		// Read materials
+		if ( scene.mNumMaterials ) {
+
+			scene.mMaterials = [];
+
+			for ( var i = 0; i < scene.mNumMaterials; ++i ) {
+
+				scene.mMaterials[ i ] = new aiMaterial();
+				ReadBinaryMaterial( stream, scene.mMaterials[ i ] );
+
+			}
+
+		}
+		// Read all animations
+		if ( scene.mNumAnimations ) {
+
+			scene.mAnimations = [];
+
+			for ( var i = 0; i < scene.mNumAnimations; ++i ) {
+
+				scene.mAnimations[ i ] = new aiAnimation();
+				ReadBinaryAnim( stream, scene.mAnimations[ i ] );
+
+			}
+
+		}
+		// Read all textures
+		if ( scene.mNumTextures ) {
+
+			scene.mTextures = [];
+
+			for ( var i = 0; i < scene.mNumTextures; ++i ) {
+
+				scene.mTextures[ i ] = new aiTexture();
+				ReadBinaryTexture( stream, scene.mTextures[ i ] );
+
+			}
+
+		}
+		// Read lights
+		if ( scene.mNumLights ) {
+
+			scene.mLights = [];
+
+			for ( var i = 0; i < scene.mNumLights; ++i ) {
+
+				scene.mLights[ i ] = new aiLight();
+				ReadBinaryLight( stream, scene.mLights[ i ] );
+
+			}
+
+		}
+		// Read cameras
+		if ( scene.mNumCameras ) {
+
+			scene.mCameras = [];
+
+			for ( var i = 0; i < scene.mNumCameras; ++i ) {
+
+				scene.mCameras[ i ] = new aiCamera();
+				ReadBinaryCamera( stream, scene.mCameras[ i ] );
+
+			}
+
+		}
+
+	}
+	var aiOrigin_CUR = 0;
+	var aiOrigin_BEG = 1;
+
+	function extendStream( stream ) {
+
+		stream.readOffset = 0;
+		stream.Seek = function ( off, ori ) {
+
+			if ( ori == aiOrigin_CUR ) {
+
+				stream.readOffset += off;
+
+			}
+			if ( ori == aiOrigin_BEG ) {
+
+				stream.readOffset = off;
+
+			}
+
+		};
+
+		stream.ReadBytes = function ( buff, size, n ) {
+
+			var bytes = size * n;
+			for ( var i = 0; i < bytes; i ++ )
+				buff[ i ] = Read_uint8_t( this );
+
+		};
+
+		stream.subArray32 = function ( start, end ) {
+
+			var buff = this.buffer;
+			var newbuff = buff.slice( start, end );
+			return new Float32Array( newbuff );
+
+		};
+
+		stream.subArrayUint16 = function ( start, end ) {
+
+			var buff = this.buffer;
+			var newbuff = buff.slice( start, end );
+			return new Uint16Array( newbuff );
+
+		};
+
+		stream.subArrayUint8 = function ( start, end ) {
+
+			var buff = this.buffer;
+			var newbuff = buff.slice( start, end );
+			return new Uint8Array( newbuff );
+
+		};
+
+		stream.subArrayUint32 = function ( start, end ) {
+
+			var buff = this.buffer;
+			var newbuff = buff.slice( start, end );
+			return new Uint32Array( newbuff );
+
+		};
+
+	}
+
+	function AssimpLoader() {
+
+		this.load = function ( url, callback ) {
+
+			var xhr = new XMLHttpRequest();
+			xhr.open( 'GET', url, true );
+			xhr.responseType = 'arraybuffer';
+			xhr.onerror = function ( e ) {
+
+				callback( e );
+
+			};
+			xhr.onload = function ( e ) {
+
+				try {
+
+					var time = performance.now();
+					// response is unsigned 8 bit integer
+					var node = InternReadFile( this.response, url );
+					console.info( "Parse in " + ( performance.now() - time ) );
+					callback( null, node );
+
+				} catch ( e ) {
+
+					callback( e );
+
+				}
+
+			};
+
+			xhr.send();
+
+		};
+
+	}
+
+	function InternReadFile( pFiledata, url ) {
+
+		var pScene = new aiScene();
+		pScene.baseURL = url;
+		var stream = new DataView( pFiledata );
+		extendStream( stream );
+		stream.Seek( 44, aiOrigin_CUR ); // signature
+		/*unsigned int versionMajor =*/
+		var versionMajor = Read_unsigned_int( stream );
+		/*unsigned int versionMinor =*/
+		var versionMinor = Read_unsigned_int( stream );
+		/*unsigned int versionRevision =*/
+		var versionRevision = Read_unsigned_int( stream );
+		/*unsigned int compileFlags =*/
+		var compileFlags = Read_unsigned_int( stream );
+		shortened = Read_uint16_t( stream ) > 0;
+		compressed = Read_uint16_t( stream ) > 0;
+		if ( shortened )
+			throw "Shortened binaries are not supported!";
+		stream.Seek( 256, aiOrigin_CUR ); // original filename
+		stream.Seek( 128, aiOrigin_CUR ); // options
+		stream.Seek( 64, aiOrigin_CUR ); // padding
+		if ( compressed ) {
+
+			var uncompressedSize = Read_uint32_t( stream );
+			var compressedSize = stream.FileSize() - stream.Tell();
+			var compressedData = [];
+			stream.Read( compressedData, 1, compressedSize );
+			var uncompressedData = [];
+			uncompress( uncompressedData, uncompressedSize, compressedData, compressedSize );
+			var buff = new ArrayBuffer( uncompressedData );
+			ReadBinaryScene( buff, pScene );
+
+		} else {
+
+			ReadBinaryScene( stream, pScene );
+			return pScene.toTHREE();
+
+		}
+
+	}
+
+	THREE.AssimpLoader = AssimpLoader;
+
+} )();

+ 25 - 28
examples/js/loaders/ColladaLoader2.js

@@ -14,20 +14,12 @@ THREE.ColladaLoader.prototype = {
 
 
 	load: function ( url, onLoad, onProgress, onError ) {
 	load: function ( url, onLoad, onProgress, onError ) {
 
 
-		function getBaseUrl( url ) {
-
-			var parts = url.split( '/' );
-			parts.pop();
-			return ( parts.length < 1 ? '.' : parts.join( '/' ) ) + '/';
-
-		}
-
 		var scope = this;
 		var scope = this;
 
 
 		var loader = new THREE.FileLoader( scope.manager );
 		var loader = new THREE.FileLoader( scope.manager );
 		loader.load( url, function ( text ) {
 		loader.load( url, function ( text ) {
 
 
-			onLoad( scope.parse( text, getBaseUrl( url ) ) );
+			onLoad( scope.parse( text ) );
 
 
 		}, onProgress, onError );
 		}, onProgress, onError );
 
 
@@ -35,7 +27,7 @@ THREE.ColladaLoader.prototype = {
 
 
 	options: {
 	options: {
 
 
-		set convertUpAxis ( value ) {
+		set convertUpAxis( value ) {
 
 
 			console.log( 'ColladaLoder.options.convertUpAxis: TODO' );
 			console.log( 'ColladaLoder.options.convertUpAxis: TODO' );
 
 
@@ -49,7 +41,7 @@ THREE.ColladaLoader.prototype = {
 
 
 	},
 	},
 
 
-	parse: function ( text, baseUrl ) {
+	parse: function ( text ) {
 
 
 		function getElementsByTagName( xml, name ) {
 		function getElementsByTagName( xml, name ) {
 
 
@@ -182,9 +174,6 @@ THREE.ColladaLoader.prototype = {
 
 
 		// image
 		// image
 
 
-		var imageLoader = new THREE.ImageLoader();
-		imageLoader.setCrossOrigin( this.crossOrigin );
-
 		function parseImage( xml ) {
 		function parseImage( xml ) {
 
 
 			var data = {
 			var data = {
@@ -199,11 +188,7 @@ THREE.ColladaLoader.prototype = {
 
 
 			if ( data.build !== undefined ) return data.build;
 			if ( data.build !== undefined ) return data.build;
 
 
-			var url = data.init_from;
-
-			if ( baseUrl !== undefined ) url = baseUrl + url;
-
-			return imageLoader.load( url );
+			return new Image();
 
 
 		}
 		}
 
 
@@ -388,6 +373,7 @@ THREE.ColladaLoader.prototype = {
 					case 'diffuse':
 					case 'diffuse':
 					case 'specular':
 					case 'specular':
 					case 'shininess':
 					case 'shininess':
+					case 'transparent':
 					case 'transparency':
 					case 'transparency':
 						data[ child.nodeName ] = parseEffectParameter( child );
 						data[ child.nodeName ] = parseEffectParameter( child );
 						break;
 						break;
@@ -626,6 +612,7 @@ THREE.ColladaLoader.prototype = {
 				var parameter = parameters[ key ];
 				var parameter = parameters[ key ];
 
 
 				switch ( key ) {
 				switch ( key ) {
+
 					case 'diffuse':
 					case 'diffuse':
 						if ( parameter.color ) material.color.fromArray( parameter.color );
 						if ( parameter.color ) material.color.fromArray( parameter.color );
 						if ( parameter.texture ) material.map = getTexture( parameter.texture );
 						if ( parameter.texture ) material.map = getTexture( parameter.texture );
@@ -642,12 +629,15 @@ THREE.ColladaLoader.prototype = {
 						if ( parameter.color && material.emissive )
 						if ( parameter.color && material.emissive )
 							material.emissive.fromArray( parameter.color );
 							material.emissive.fromArray( parameter.color );
 						break;
 						break;
+					case 'transparent':
+						// if ( parameter.texture ) material.alphaMap = getTexture( parameter.texture );
+						material.transparent = true;
+						break;
 					case 'transparency':
 					case 'transparency':
-						if ( parameter.float )
-							material.opacity = parameter.float;
-						if ( parameter.float !== 1 )
-							material.transparent = true;
+						if ( parameter.float !== undefined ) material.opacity = parameter.float;
+						material.transparent = true;
 						break;
 						break;
+
 				}
 				}
 
 
 			}
 			}
@@ -958,7 +948,7 @@ THREE.ColladaLoader.prototype = {
 						break;
 						break;
 
 
 					case 'polygons':
 					case 'polygons':
-						console.log( 'ColladaLoader: Unsupported primitive type: ', child.nodeName );
+						console.warn( 'ColladaLoader: Unsupported primitive type: ', child.nodeName );
 						break;
 						break;
 
 
 					case 'lines':
 					case 'lines':
@@ -1271,8 +1261,14 @@ THREE.ColladaLoader.prototype = {
 				switch ( child.nodeName ) {
 				switch ( child.nodeName ) {
 
 
 					case 'node':
 					case 'node':
-						parseNode( child );
-						data.nodes.push( child.getAttribute( 'id' ) );
+
+						if ( child.hasAttribute( 'id' ) ) {
+
+							data.nodes.push( child.getAttribute( 'id' ) );
+							parseNode( child );
+
+						}
+
 						break;
 						break;
 
 
 					case 'instance_camera':
 					case 'instance_camera':
@@ -1323,7 +1319,7 @@ THREE.ColladaLoader.prototype = {
 
 
 			}
 			}
 
 
-			if ( xml.getAttribute( 'id' ) !== null ) {
+			if ( xml.hasAttribute( 'id' ) ) {
 
 
 				library.nodes[ xml.getAttribute( 'id' ) ] = data;
 				library.nodes[ xml.getAttribute( 'id' ) ] = data;
 
 
@@ -1565,7 +1561,7 @@ THREE.ColladaLoader.prototype = {
 		buildLibrary( library.cameras, buildCamera );
 		buildLibrary( library.cameras, buildCamera );
 		buildLibrary( library.lights, buildLight );
 		buildLibrary( library.lights, buildLight );
 		buildLibrary( library.geometries, buildGeometry );
 		buildLibrary( library.geometries, buildGeometry );
-		buildLibrary( library.nodes, buildNode );
+		// buildLibrary( library.nodes, buildNode );
 		buildLibrary( library.visualScenes, buildVisualScene );
 		buildLibrary( library.visualScenes, buildVisualScene );
 
 
 		console.timeEnd( 'ColladaLoader: Build' );
 		console.timeEnd( 'ColladaLoader: Build' );
@@ -1589,6 +1585,7 @@ THREE.ColladaLoader.prototype = {
 		return {
 		return {
 			animations: [],
 			animations: [],
 			kinematics: { joints: [] },
 			kinematics: { joints: [] },
+			library: library,
 			scene: scene
 			scene: scene
 		};
 		};
 
 

+ 174 - 53
examples/js/loaders/FBXLoader.js

@@ -1,5 +1,6 @@
 /**
 /**
  * @author yamahigashi https://github.com/yamahigashi
  * @author yamahigashi https://github.com/yamahigashi
+ * @author Kyle-Larson https://github.com/Kyle-Larson
  *
  *
  * This loader loads FBX file in *ASCII and version 7 format*.
  * This loader loads FBX file in *ASCII and version 7 format*.
  *
  *
@@ -121,6 +122,7 @@
 		scope.weights	= ( new Weights() ).parse( nodes, scope.hierarchy );
 		scope.weights	= ( new Weights() ).parse( nodes, scope.hierarchy );
 		scope.animations = ( new Animation() ).parse( nodes, scope.hierarchy );
 		scope.animations = ( new Animation() ).parse( nodes, scope.hierarchy );
 		scope.textures = ( new Textures() ).parse( nodes, scope.hierarchy );
 		scope.textures = ( new Textures() ).parse( nodes, scope.hierarchy );
+		scope.materials = ( new Materials() ).parse( nodes, scope.hierarchy );
 		console.timeEnd( 'FBXLoader: ObjectParser' );
 		console.timeEnd( 'FBXLoader: ObjectParser' );
 
 
 		console.time( 'FBXLoader: GeometryParser' );
 		console.time( 'FBXLoader: GeometryParser' );
@@ -237,7 +239,6 @@
 		geometry.computeBoundingSphere();
 		geometry.computeBoundingSphere();
 		geometry.computeBoundingBox();
 		geometry.computeBoundingBox();
 
 
-		// TODO: texture & material support
 		var texture;
 		var texture;
 		var texs = this.textures.getById( nodes.searchConnectionParent( geo.id ) );
 		var texs = this.textures.getById( nodes.searchConnectionParent( geo.id ) );
 		if ( texs !== undefined && texs.length > 0 ) {
 		if ( texs !== undefined && texs.length > 0 ) {
@@ -251,15 +252,68 @@
 
 
 		}
 		}
 
 
+		var materials = [];
 		var material;
 		var material;
-		if ( texture !== undefined ) {
+		var mats = this.materials.getById( nodes.searchConnectionParent( geo.id ) );
+		if ( mats !== undefined && mats.length > 0) {
+			for(var i = 0; i < mats.length; ++i) {
+				var mat_data = mats[i];
+				var tmpMat;
+
+				// TODO:
+				// Cannot find a list of possible ShadingModel values.
+				// If someone finds a list, please add additional cases
+				// and map to appropriate materials.
+				switch(mat_data.type) {
+					case "phong":
+					tmpMat = new THREE.MeshPhongMaterial();
+					break;
+					case "Lambert":
+					tmpMat = new THREE.MeshLambertMaterial();
+					break;
+					default:
+					console.warn("No implementation given for material type " + mat_data.type + " in FBXLoader.js.  Defaulting to basic material")
+					tmpMat = new THREE.MeshBasicMaterial({ color: 0x3300ff });
+					break;
+				}
+				if (texture !== undefined) {
+					mat_data.parameters.map = texture;
+				}
+				tmpMat.setValues(mat_data.parameters);
+
+				materials.push(tmpMat);
+			}
+
+			if(materials.length === 1) {
+				material = materials[0];
+			} else {
+				//Set up for multi-material
+				material = new THREE.MultiMaterial(materials);
+				var material_groupings = [];
+				var last_material_group = -1;
+				var material_index_list = toInt(node.subNodes.LayerElementMaterial.subNodes.Materials.properties.a.split( ',' ));
+				for(var i = 0; i < geo.polyIndices.length; ++i) {
+					if(last_material_group !== material_index_list[geo.polyIndices[i]]) {
+						material_groupings.push({start: i * 3, count: 0, materialIndex: material_index_list[geo.polyIndices[i]]});
+						last_material_group = material_index_list[geo.polyIndices[i]];
+					}
+					material_groupings[material_groupings.length - 1].count += 3;
+				}
+				geometry.groups = material_groupings;
+			}
 
 
-			material = new THREE.MeshBasicMaterial( { map: texture } );
 
 
 		} else {
 		} else {
+			//No material found for this geometry, create default
+			if (texture !== undefined) {
+
+				material = new THREE.MeshBasicMaterial({ map: texture });
+
+			} else {
 
 
-			material = new THREE.MeshBasicMaterial( { color: 0x3300ff } );
+				material = new THREE.MeshBasicMaterial({ color: 0x3300ff });
 
 
+			}
 		}
 		}
 
 
 		geometry = new THREE.Geometry().fromBufferGeometry( geometry );
 		geometry = new THREE.Geometry().fromBufferGeometry( geometry );
@@ -480,51 +534,6 @@
 
 
 	};
 	};
 
 
-	THREE.FBXLoader.prototype.parseMaterials = function ( node ) {
-
-		// has not mat, return []
-		if ( ! ( 'Material' in node.subNodes ) ) {
-
-			return [];
-
-		}
-
-		// has many
-		var matCount = 0;
-		for ( var mat in node.subNodes.Materials ) {
-
-			if ( mat.match( /^\d+$/ ) ) {
-
-				matCount ++;
-
-			}
-
-		}
-
-		var res = [];
-		if ( matCount > 0 ) {
-
-			for ( mat in node.subNodes.Material ) {
-
-				res.push( parseMaterial( node.subNodes.Material[ mat ] ) );
-
-			}
-
-		} else {
-
-			res.push( parseMaterial( node.subNodes.Material ) );
-
-		}
-
-		return res;
-
-	};
-
-	// TODO
-	THREE.FBXLoader.prototype.parseMaterial = function ( node ) {
-
-	};
-
 
 
 	THREE.FBXLoader.prototype.loadFile = function ( url, onLoad, onProgress, onError, responseType ) {
 	THREE.FBXLoader.prototype.loadFile = function ( url, onLoad, onProgress, onError, responseType ) {
 
 
@@ -1564,8 +1573,10 @@
 
 
 		if ( this.getPolygonTopologyMax() > 3 ) {
 		if ( this.getPolygonTopologyMax() > 3 ) {
 
 
-			this.indices = this.convertPolyIndicesToTri(
+			var indexInfo = this.convertPolyIndicesToTri(
 								this.indices, this.getPolygonTopologyArray() );
 								this.indices, this.getPolygonTopologyArray() );
+			this.indices = indexInfo.res;
+			this.polyIndices = indexInfo.polyIndices;
 
 
 		}
 		}
 
 
@@ -1709,14 +1720,16 @@
 	//
 	//
 	// [( a, b, c, d ) ...........
 	// [( a, b, c, d ) ...........
 	// [( a, b, c ), (a, c, d )....
 	// [( a, b, c ), (a, c, d )....
+
+	// Also keep track of original poly index.
 	Geometry.prototype.convertPolyIndicesToTri = function ( indices, strides ) {
 	Geometry.prototype.convertPolyIndicesToTri = function ( indices, strides ) {
 
 
 		var res = [];
 		var res = [];
 
 
 		var i = 0;
 		var i = 0;
-		var tmp = [];
 		var currentPolyNum = 0;
 		var currentPolyNum = 0;
 		var currentStride = 0;
 		var currentStride = 0;
+		var polyIndices = [];
 
 
 		while ( i < indices.length ) {
 		while ( i < indices.length ) {
 
 
@@ -1729,14 +1742,14 @@
 				res.push( indices[ i + ( currentStride - 2 - j ) ] );
 				res.push( indices[ i + ( currentStride - 2 - j ) ] );
 				res.push( indices[ i + ( currentStride - 1 - j ) ] );
 				res.push( indices[ i + ( currentStride - 1 - j ) ] );
 
 
+				polyIndices.push(currentPolyNum);
 			}
 			}
 
 
 			currentPolyNum ++;
 			currentPolyNum ++;
 			i += currentStride;
 			i += currentStride;
-
 		}
 		}
 
 
-		return res;
+		return {res: res, polyIndices: polyIndices};
 
 
 	};
 	};
 
 
@@ -2503,6 +2516,114 @@
 
 
 	};
 	};
 
 
+	function Materials() {
+		this.materials = [];
+		this.perGeoMap = {};
+	}
+
+	Materials.prototype.add = function ( mat ) {
+
+		if ( this.materials === undefined ) {
+
+			this.materials = [];
+
+		}
+
+		this.materials.push( mat );
+
+		for ( var i = 0; i < mat.parentIds.length; ++ i ) {
+
+			if ( this.perGeoMap[ mat.parentIds[ i ] ] === undefined ) {
+
+				this.perGeoMap[ mat.parentIds[ i ] ] = [];
+
+			}
+
+			this.perGeoMap[ mat.parentIds[ i ] ].push( this.materials[ this.materials.length - 1 ] );
+
+		}
+
+	};
+
+	Materials.prototype.parse = function ( node, bones ) {
+
+		var rawNodes = node.Objects.subNodes.Material;
+
+		for ( var n in rawNodes ) {
+
+			var mat = ( new Material() ).parse( rawNodes[ n ], node );
+			this.add( mat );
+
+		}
+
+		return this;
+
+	};
+
+	Materials.prototype.getById = function ( id ) {
+
+		return this.perGeoMap[ id ];
+
+	};
+
+	function Material() {
+
+		this.fileName = "";
+		this.name = "";
+		this.id = null;
+		this.parentIds = [];
+
+	}
+
+	Material.prototype.parse = function ( node, nodes ) {
+
+		this.id = node.id;
+		this.name = node.attrName;
+		this.type = node.properties.ShadingModel;
+
+		this.parameters = this.getParameters( node.properties );
+
+		this.parentIds = this.searchParents( this.id, nodes );
+
+		return this;
+
+	};
+
+	Material.prototype.getParameters = function( properties ) {
+		var parameters = {};
+
+		//TODO: Missing parameters:
+		// - Ambient
+		// - AmbientColor
+		// - (Diffuse?) Using DiffuseColor, which has same value, so I dunno.
+		// - (Emissive?) Same as above)
+		// - MultiLayer
+		// - ShininessExponent (Same vals as Shininess)
+		// - Specular (Same vals as SpecularColor)
+		// - TransparencyFactor (Maybe same as Opacity?).
+
+		parameters.color = new THREE.Color().fromArray(toFloat([properties.DiffuseColor.value.x, properties.DiffuseColor.value.y, properties.DiffuseColor.value.z]));
+		parameters.specular = new THREE.Color().fromArray(toFloat([properties.SpecularColor.value.x, properties.SpecularColor.value.y, properties.SpecularColor.value.z]));
+		parameters.shininess = properties.Shininess.value;
+		parameters.emissive = new THREE.Color().fromArray(toFloat([properties.EmissiveColor.value.x, properties.EmissiveColor.value.y, properties.EmissiveColor.value.z]));
+		parameters.emissiveIntensity = properties.EmissiveFactor.value;
+		parameters.reflectivity = properties.Reflectivity.value;
+		parameters.opacity = properties.Opacity.value;
+		if(parameters.opacity < 1.0) {
+			parameters.transparent = true;
+		}
+
+		return parameters;
+	};
+
+	Material.prototype.searchParents = function ( id, nodes ) {
+
+		var p = nodes.searchConnectionParent( id );
+
+		return p;
+
+	};
+
 
 
 	/* --------------------------------------------------------------------- */
 	/* --------------------------------------------------------------------- */
 	/* --------------------------------------------------------------------- */
 	/* --------------------------------------------------------------------- */

+ 37 - 218
examples/js/loaders/GLTFLoader.js

@@ -241,234 +241,48 @@ THREE.GLTFLoader = ( function () {
 	};
 	};
 
 
 
 
-	/* GLTFANIMATION */
+	/* ANIMATION */
 
 
-	GLTFLoader.Animations = new GLTFRegistry();
+	GLTFLoader.Animations = {
 
 
-	// Construction/initialization
-	function GLTFAnimation( interps ) {
+		update: function () {
 
 
-		this.running = false;
-		this.loop = false;
-		this.duration = 0;
-		this.startTime = 0;
-		this.interps = [];
-
-		this.uuid = THREE.Math.generateUUID();
-
-		if ( interps ) {
-
-			this.createInterpolators( interps );
-
-		}
-
-	}
-
-	GLTFAnimation.prototype.createInterpolators = function ( interps ) {
-
-		for ( var i = 0, len = interps.length; i < len; i ++ ) {
-
-			var interp = new GLTFInterpolator( interps[ i ] );
-			this.interps.push( interp );
-			this.duration = Math.max( this.duration, interp.duration );
-
-		}
-
-	};
-
-	// Start/stop
-	GLTFAnimation.prototype.play = function () {
-
-		if ( this.running )
-			return;
-
-		this.startTime = Date.now();
-		this.running = true;
-		GLTFLoader.Animations.add( this.uuid, this );
-
-	};
-
-	GLTFAnimation.prototype.stop = function () {
-
-		this.running = false;
-		GLTFLoader.Animations.remove( this.uuid );
-
-	};
-
-	// Update - drive key frame evaluation
-	GLTFAnimation.prototype.update = function () {
-
-		if ( ! this.running ) return;
-
-		var now = Date.now();
-		var deltat = ( now - this.startTime ) / 1000;
-		var t = deltat % this.duration;
-		var nCycles = Math.floor( deltat / this.duration );
-		var interps = this.interps;
-
-		if ( nCycles >= 1 && ! this.loop ) {
-
-			this.running = false;
-
-			for ( var i = 0, l = interps.length; i < l; i ++ ) {
-
-				interps[ i ].interp( this.duration );
-
-			}
-
-			this.stop();
-
-		} else {
-
-			for ( var i = 0, l = interps.length; i < l; i ++ ) {
-
-				interps[ i ].interp( t );
-
-			}
+			console.warn( 'THREE.GLTFLoader.Animation has been deprecated. Use THREE.AnimationMixer instead.' );
 
 
 		}
 		}
 
 
 	};
 	};
 
 
-	/* GLTFINTERPOLATOR */
-
-	function GLTFInterpolator( param ) {
+	function createAnimation( name, interps ) {
 
 
-		this.keys = param.keys;
-		this.values = param.values;
-		this.count = param.count;
-		this.type = param.type;
-		this.path = param.path;
-		this.isRot = false;
+		var tracks = [];
 
 
-		var node = param.target;
-		node.updateMatrix();
-		node.matrixAutoUpdate = true;
-		this.targetNode = node;
-
-		switch ( param.path ) {
-
-			case "translation" :
-
-				this.target = node.position;
-				this.originalValue = node.position.clone();
-				break;
+		for ( var i = 0, len = interps.length; i < len; i ++ ) {
 
 
-			case "rotation" :
+			var interp = interps[ i ];
 
 
-				this.target = node.quaternion;
-				this.originalValue = node.quaternion.clone();
-				this.isRot = true;
-				break;
+			// KeyframeTrack.optimize() will modify given 'times' and 'values'
+			// buffers before creating a truncated copy to keep. Because buffers may
+			// be reused by other tracks, make copies here.
+			interp.times = THREE.AnimationUtils.arraySlice( interp.times, 0 );
+			interp.values = THREE.AnimationUtils.arraySlice( interp.values, 0 );
 
 
-			case "scale" :
+			interp.target.updateMatrix();
+			interp.target.matrixAutoUpdate = true;
 
 
-				this.target = node.scale;
-				this.originalValue = node.scale.clone();
-				break;
+			tracks.push( new THREE.KeyframeTrack(
+				interp.name,
+				interp.times,
+				interp.values,
+				interp.type
+			) );
 
 
 		}
 		}
 
 
-		this.duration = this.keys[ this.count - 1 ];
-
-		this.vec1 = new THREE.Vector3();
-		this.vec2 = new THREE.Vector3();
-		this.vec3 = new THREE.Vector3();
-		this.quat1 = new THREE.Quaternion();
-		this.quat2 = new THREE.Quaternion();
-		this.quat3 = new THREE.Quaternion();
+		return new THREE.AnimationClip( name, undefined, tracks );
 
 
 	}
 	}
 
 
-	//Interpolation and tweening methods
-	GLTFInterpolator.prototype.interp = function ( t ) {
-
-		if ( t == this.keys[ 0 ] ) {
-
-			if ( this.isRot ) {
-
-				this.quat3.fromArray( this.values );
-
-			} else {
-
-				this.vec3.fromArray( this.values );
-
-			}
-
-		} else if ( t < this.keys[ 0 ] ) {
-
-			if ( this.isRot ) {
-
-				this.quat1.copy( this.originalValue );
-				this.quat2.fromArray( this.values );
-				THREE.Quaternion.slerp( this.quat1, this.quat2, this.quat3, t / this.keys[ 0 ] );
-
-			} else {
-
-				this.vec3.copy( this.originalValue );
-				this.vec2.fromArray( this.values );
-				this.vec3.lerp( this.vec2, t / this.keys[ 0 ] );
-
-			}
-
-		} else if ( t >= this.keys[ this.count - 1 ] ) {
-
-			if ( this.isRot ) {
-
-				this.quat3.fromArray( this.values, ( this.count - 1 ) * 4 );
-
-			} else {
-
-				this.vec3.fromArray( this.values, ( this.count - 1 ) * 3 );
-
-			}
-
-		} else {
-
-			for ( var i = 0; i < this.count - 1; i ++ ) {
-
-				var key1 = this.keys[ i ];
-				var key2 = this.keys[ i + 1 ];
-
-				if ( t >= key1 && t <= key2 ) {
-
-					if ( this.isRot ) {
-
-						this.quat1.fromArray( this.values, i * 4 );
-						this.quat2.fromArray( this.values, ( i + 1 ) * 4 );
-						THREE.Quaternion.slerp( this.quat1, this.quat2, this.quat3, ( t - key1 ) / ( key2 - key1 ) );
-
-					} else {
-
-						this.vec3.fromArray( this.values, i * 3 );
-						this.vec2.fromArray( this.values, ( i + 1 ) * 3 );
-						this.vec3.lerp( this.vec2, ( t - key1 ) / ( key2 - key1 ) );
-
-					}
-
-				}
-
-			}
-
-		}
-
-		if ( this.target ) {
-
-			if ( this.isRot ) {
-
-				this.target.copy( this.quat3 );
-
-			} else {
-
-				this.target.copy( this.vec3 );
-
-			}
-
-		}
-
-	};
-
-
 	/*********************************/
 	/*********************************/
 	/********** INTERNALS ************/
 	/********** INTERNALS ************/
 	/*********************************/
 	/*********************************/
@@ -539,6 +353,16 @@ THREE.GLTFLoader = ( function () {
 		'MAT4': 16
 		'MAT4': 16
 	};
 	};
 
 
+	var PATH_PROPERTIES = {
+		scale: 'scale',
+		translation: 'position',
+		rotation: 'quaternion'
+	};
+
+	var INTERPOLATION = {
+		LINEAR: THREE.InterpolateLinear
+	};
+
 	/* UTILITY FUNCTIONS */
 	/* UTILITY FUNCTIONS */
 
 
 	function _each( object, callback, thisObj ) {
 	function _each( object, callback, thisObj ) {
@@ -817,8 +641,7 @@ THREE.GLTFLoader = ( function () {
 
 
 			for ( var name in dependencies.animations ) {
 			for ( var name in dependencies.animations ) {
 
 
-				var animation = dependencies.animations[ name ];
-				animations.push( animation );
+				animations.push( dependencies.animations[ name ] );
 
 
 			}
 			}
 
 
@@ -1470,12 +1293,11 @@ THREE.GLTFLoader = ( function () {
 						if ( node ) {
 						if ( node ) {
 
 
 							var interp = {
 							var interp = {
-								keys: inputAccessor.array,
+								times: inputAccessor.array,
 								values: outputAccessor.array,
 								values: outputAccessor.array,
-								count: inputAccessor.count,
 								target: node,
 								target: node,
-								path: target.path,
-								type: sampler.interpolation
+								type: INTERPOLATION[ sampler.interpolation ],
+								name: node.name + '.' + PATH_PROPERTIES[ target.path ]
 							};
 							};
 
 
 							interps.push( interp );
 							interps.push( interp );
@@ -1486,10 +1308,7 @@ THREE.GLTFLoader = ( function () {
 
 
 				}
 				}
 
 
-				var _animation = new GLTFAnimation( interps );
-				_animation.name = "animation_" + animationId;
-
-				return _animation;
+				return createAnimation( "animation_" + animationId, interps );
 
 
 			} );
 			} );
 
 

+ 43 - 5
examples/js/loaders/KMZLoader.js

@@ -32,21 +32,59 @@ THREE.KMZLoader.prototype = {
 
 
 		// console.log( zip );
 		// console.log( zip );
 
 
-		for ( var name in zip.files ) {
+		// var xml = new DOMParser().parseFromString( zip.file( 'doc.kml' ).asText(), 'application/xml' );
 
 
-			if ( name.toLowerCase().substr( - 4 ) === '.dae' ) {
+		function loadImage( image ) {
 
 
-				return new THREE.ColladaLoader().parse( zip.file( name ).asText() );
+			var path = decodeURI( image.init_from );
+
+			// Hack to support relative paths
+			path = path.replace( '../', '' );
+
+			var regex = new RegExp( path + '$' );
+			var files = zip.file( regex );
+
+			// console.log( image, files );
+
+			if ( files.length ) {
+
+				var file = files[ 0 ];
+				var blob = new Blob( [ file.asArrayBuffer() ], { type: 'application/octet-binary' } );
+				image.build.src = URL.createObjectURL( blob );
+
+			}
+
+		}
+
+		// load collada
+
+		var files = zip.file( /dae$/i );
+
+		if ( files.length ) {
+
+			var file = files[ 0 ];
+
+			var collada = new THREE.ColladaLoader().parse( file.asText() );
+
+			// fix images
+
+			var images = collada.library.images;
+
+			for ( var name in images ) {
+
+				loadImage( images[ name ] );
 
 
 			}
 			}
 
 
+			return collada;
+
 		}
 		}
 
 
-		console.error( 'KZMLoader: Couldn\'t find .dae file.' );
+		console.error( 'KMZLoader: Couldn\'t find .dae file.' );
 
 
 		return {
 		return {
 			scene: new THREE.Group()
 			scene: new THREE.Group()
-		}
+		};
 
 
 	}
 	}
 
 

+ 2 - 2
examples/js/loaders/MMDLoader.js

@@ -2215,7 +2215,7 @@ THREE.MMDHelper.prototype = {
 
 
 		var physics = new THREE.MMDPhysics( mesh, params );
 		var physics = new THREE.MMDPhysics( mesh, params );
 
 
-		if ( mesh.mixer !== null && mesh.mixer !== undefined && params.preventAnimationWarmup !== false ) {
+		if ( mesh.mixer !== null && mesh.mixer !== undefined && params.preventAnimationWarmup !== true ) {
 
 
 			this.animateOneMesh( 0, mesh );
 			this.animateOneMesh( 0, mesh );
 			physics.reset();
 			physics.reset();
@@ -2557,7 +2557,7 @@ THREE.MMDHelper.prototype = {
 
 
 		}
 		}
 
 
-		if ( physics !== null && this.doPhysics && ! this.sharedPhysics) {
+		if ( physics !== null && this.doPhysics && ! this.sharedPhysics ) {
 
 
 			physics.update( delta );
 			physics.update( delta );
 
 

+ 9 - 0
examples/js/loaders/NRRDLoader.js

@@ -298,6 +298,15 @@ Object.assign( THREE.NRRDLoader.prototype, THREE.EventDispatcher.prototype, {
 			_data = parseDataAsText( _data );
 			_data = parseDataAsText( _data );
 
 
 		}
 		}
+		else if (headerObject.encoding === 'raw')
+		{
+			//we need to copy the array to create a new array buffer, else we retrieve the original arraybuffer with the header
+			var _copy = new Uint8Array(_data.length);
+			for (var i = 0; i < _data.length; i++) {
+				_copy[i] = _data[i];
+			}
+			_data = _copy;
+		}
 		// .. let's use the underlying array buffer
 		// .. let's use the underlying array buffer
 		_data = _data.buffer;
 		_data = _data.buffer;
 
 

+ 38 - 1076
examples/js/loaders/VRMLLoader.js

@@ -1,1105 +1,67 @@
 /**
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
+ * @author Bart McLeod / http://spaceweb.nl/
  */
  */
 
 
-THREE.VRMLLoader = function ( manager ) {
+/**
+ *
+ * @param manager
+ * @param parser VRMLparser based on PEG.js grammar
+ * @param VrmlParser.Renderer.ThreeJs renderer
+ * @constructor
+ */
+THREE.VRMLLoader = function (parser, manager, debug) {
 
 
 	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
 	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
-
+	this.parser  = parser;
+	this.debug   = debug;
 };
 };
 
 
 THREE.VRMLLoader.prototype = {
 THREE.VRMLLoader.prototype = {
 
 
 	constructor: THREE.VRMLLoader,
 	constructor: THREE.VRMLLoader,
 
 
-	// for IndexedFaceSet support
-	isRecordingPoints: false,
-	isRecordingFaces: false,
-	points: [],
-	indexes : [],
-
-	// for Background support
-	isRecordingAngles: false,
-	isRecordingColors: false,
-	angles: [],
-	colors: [],
-
-	recordingFieldname: null,
-
-	load: function ( url, onLoad, onProgress, onError ) {
-
-		var scope = this;
-
-		var loader = new THREE.FileLoader( this.manager );
-		loader.load( url, function ( text ) {
-
-			onLoad( scope.parse( text ) );
-
-		}, onProgress, onError );
-
-	},
-
-	setCrossOrigin: function ( value ) {
-
-		this.crossOrigin = value;
-
+	log: function (obj) {
+		if ( this.debug ) {
+			console.log(obj);
+		}
 	},
 	},
 
 
-	parse: function ( data ) {
-
-		var texturePath = this.texturePath || '';
-
-		var textureLoader = new THREE.TextureLoader( this.manager );
-		textureLoader.setCrossOrigin( this.crossOrigin );
-
-		var parseV1 = function ( lines, scene ) {
-
-			console.warn( 'VRML V1.0 not supported yet' );
-
-		};
-
-		var parseV2 = function ( lines, scene ) {
-
-			var defines = {};
-			var float_pattern = /(\b|\-|\+)([\d\.e]+)/;
-			var float2_pattern = /([\d\.\+\-e]+)\s+([\d\.\+\-e]+)/g;
-			var float3_pattern = /([\d\.\+\-e]+)\s+([\d\.\+\-e]+)\s+([\d\.\+\-e]+)/g;
-
-			/**
-			* Interpolates colors a and b following their relative distance
-			* expressed by t.
-			*
-			* @param float a
-			* @param float b
-			* @param float t
-			* @returns {Color}
-			*/
-			var interpolateColors = function( a, b, t ) {
-
-				var deltaR = a.r - b.r;
-				var deltaG = a.g - b.g;
-				var deltaB = a.b - b.b;
-
-				var c = new THREE.Color();
-
-				c.r = a.r - t * deltaR;
-				c.g = a.g - t * deltaG;
-				c.b = a.b - t * deltaB;
-
-				return c;
-
-			};
-
-			/**
-			 * Vertically paints the faces interpolating between the
-			 * specified colors at the specified angels. This is used for the Background
-			 * node, but could be applied to other nodes with multiple faces as well.
-			 *
-			 * When used with the Background node, default is directionIsDown is true if
-			 * interpolating the skyColor down from the Zenith. When interpolationg up from
-			 * the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
-			 *
-			 * The first angle is never specified, it is the Zenith (0 rad). Angles are specified
-			 * in radians. The geometry is thought a sphere, but could be anything. The color interpolation
-			 * is linear along the Y axis in any case.
-			 *
-			 * You must specify one more color than you have angles at the beginning of the colors array.
-			 * This is the color of the Zenith (the top of the shape).
-			 *
-			 * @param geometry
-			 * @param radius
-			 * @param angles
-			 * @param colors
-			 * @param boolean directionIsDown Whether to work bottom up or top down.
-			 */
-			var paintFaces = function ( geometry, radius, angles, colors, directionIsDown ) {
-
-				var f, n, p, vertexIndex, color;
-
-				var direction = directionIsDown ? 1 : - 1;
-
-				var faceIndices = [ 'a', 'b', 'c', 'd' ];
-
-				var coord = [ ], aColor, bColor, t = 1, A = {}, B = {}, applyColor = false, colorIndex;
-
-				for ( var k = 0; k < angles.length; k ++ ) {
-
-					var vec = { };
-
-					// push the vector at which the color changes
-					vec.y = direction * ( Math.cos( angles[ k ] ) * radius );
-
-					vec.x = direction * ( Math.sin( angles[ k ] ) * radius );
-
-					coord.push( vec );
-
-				}
-
-				// painting the colors on the faces
-				for ( var i = 0; i < geometry.faces.length ; i ++ ) {
-
-					f  = geometry.faces[ i ];
-
-					n = ( f instanceof THREE.Face3 ) ? 3 : 4;
-
-					for ( var j = 0; j < n; j ++ ) {
-
-						vertexIndex = f[ faceIndices[ j ] ];
-
-						p = geometry.vertices[ vertexIndex ];
-
-						for ( var index = 0; index < colors.length; index ++ ) {
-
-							// linear interpolation between aColor and bColor, calculate proportion
-							// A is previous point (angle)
-							if ( index === 0 ) {
-
-								A.x = 0;
-								A.y = directionIsDown ? radius : - 1 * radius;
-
-							} else {
-
-								A.x = coord[ index - 1 ].x;
-								A.y = coord[ index - 1 ].y;
-
-							}
-
-							// B is current point (angle)
-							B = coord[ index ];
-
-							if ( undefined !== B ) {
-
-								// p has to be between the points A and B which we interpolate
-								applyColor = directionIsDown ? p.y <= A.y && p.y > B.y : p.y >= A.y && p.y < B.y;
-
-								if ( applyColor ) {
-
-									bColor = colors[ index + 1 ];
-
-									aColor = colors[ index ];
-
-									// below is simple linear interpolation
-									t = Math.abs( p.y - A.y ) / ( A.y - B.y );
-
-									// to make it faster, you can only calculate this if the y coord changes, the color is the same for points with the same y
-									color = interpolateColors( aColor, bColor, t );
-
-									f.vertexColors[ j ] = color;
-
-								}
-
-							} else if ( undefined === f.vertexColors[ j ] ) {
-
-								colorIndex = directionIsDown ? colors.length - 1 : 0;
-								f.vertexColors[ j ] = colors[ colorIndex ];
-
-							}
-
-						}
-
-					}
-
-				}
-
-			};
-
-			var index = [];
-
-			var parseProperty = function ( node, line ) {
-
-				var parts = [], part, property = {}, fieldName;
-
-				/**
-				 * Expression for matching relevant information, such as a name or value, but not the separators
-				 * @type {RegExp}
-				 */
-				var regex = /[^\s,\[\]]+/g;
-
-				var point, angles, colors;
-
-				while ( null != ( part = regex.exec( line ) ) ) {
-
-					parts.push( part[ 0 ] );
-
-				}
-
-				fieldName = parts[ 0 ];
-
-
-				// trigger several recorders
-				switch ( fieldName ) {
-					case 'skyAngle':
-					case 'groundAngle':
-						this.recordingFieldname = fieldName;
-						this.isRecordingAngles = true;
-						this.angles = [];
-						break;
-					case 'skyColor':
-					case 'groundColor':
-						this.recordingFieldname = fieldName;
-						this.isRecordingColors = true;
-						this.colors = [];
-						break;
-					case 'point':
-						this.recordingFieldname = fieldName;
-						this.isRecordingPoints = true;
-						this.points = [];
-						break;
-					case 'coordIndex':
-					case 'texCoordIndex':
-						this.recordingFieldname = fieldName;
-						this.isRecordingFaces = true;
-						this.indexes = [];
-				}
-
-				if ( this.isRecordingFaces ) {
-
-					// the parts hold the indexes as strings
-					if ( parts.length > 0 ) {
-
-						for ( var ind = 0; ind < parts.length; ind ++ ) {
-
-							// the part should either be positive integer or -1
-							if ( ! /(-?\d+)/.test( parts[ ind ] ) ) {
-
-								continue;
-
-							}
-
-							// end of current face
-							if ( parts[ ind ] === "-1" ) {
-
-								if ( index.length > 0 ) {
-
-									this.indexes.push( index );
-
-								}
-
-								// start new one
-								index = [];
-
-							} else {
-
-								index.push( parseInt( parts[ ind ] ) );
-
-							}
-
-						}
-
-					}
-
-					// end
-					if ( /]/.exec( line ) ) {
-
-						if ( index.length > 0 ) {
-
-							this.indexes.push( index );
-
-						}
-
-						// start new one
-						index = [];
-
-						this.isRecordingFaces = false;
-						node[this.recordingFieldname] = this.indexes;
-
-					}
-
-				} else if ( this.isRecordingPoints ) {
-
-					if ( node.nodeType == 'Coordinate' )
-
-					while ( null !== ( parts = float3_pattern.exec( line ) ) ) {
-
-						point = {
-							x: parseFloat( parts[ 1 ] ),
-							y: parseFloat( parts[ 2 ] ),
-							z: parseFloat( parts[ 3 ] )
-						};
-
-						this.points.push( point );
-
-					}
-
-					if ( node.nodeType == 'TextureCoordinate' )
-
-					while ( null !== ( parts = float2_pattern.exec( line ) ) ) {
-
-						point = {
-							x: parseFloat( parts[ 1 ] ),
-							y: parseFloat( parts[ 2 ] )
-						};
-
-						this.points.push( point );
-
-					}
-
-					// end
-					if ( /]/.exec( line ) ) {
-
-						this.isRecordingPoints = false;
-						node.points = this.points;
-
-					}
-
-				} else if ( this.isRecordingAngles ) {
-
-					// the parts hold the angles as strings
-					if ( parts.length > 0 ) {
-
-						for ( var ind = 0; ind < parts.length; ind ++ ) {
-
-							// the part should be a float
-							if ( ! float_pattern.test( parts[ ind ] ) ) {
-
-								continue;
-
-							}
-
-							this.angles.push( parseFloat( parts[ ind ] ) );
-
-						}
-
-					}
-
-					// end
-					if ( /]/.exec( line ) ) {
-
-						this.isRecordingAngles = false;
-						node[ this.recordingFieldname ] = this.angles;
-
-					}
-
-				} else if ( this.isRecordingColors ) {
-
-					while ( null !== ( parts = float3_pattern.exec( line ) ) ) {
-
-						color = {
-							r: parseFloat( parts[ 1 ] ),
-							g: parseFloat( parts[ 2 ] ),
-							b: parseFloat( parts[ 3 ] )
-						};
-
-						this.colors.push( color );
-
-					}
-
-					// end
-					if ( /]/.exec( line ) ) {
-
-						this.isRecordingColors = false;
-						node[ this.recordingFieldname ] = this.colors;
-
-					}
-
-				} else if ( parts[ parts.length - 1 ] !== 'NULL' && fieldName !== 'children' ) {
-
-					switch ( fieldName ) {
-
-						case 'diffuseColor':
-						case 'emissiveColor':
-						case 'specularColor':
-						case 'color':
-
-							if ( parts.length != 4 ) {
-
-								console.warn( 'Invalid color format detected for ' + fieldName );
-								break;
-
-							}
-
-							property = {
-								r: parseFloat( parts[ 1 ] ),
-								g: parseFloat( parts[ 2 ] ),
-								b: parseFloat( parts[ 3 ] )
-							};
-
-							break;
-							
-						case 'location':
-						case 'direction':
-						case 'translation':
-						case 'scale':
-						case 'size':
-							if ( parts.length != 4 ) {
-
-								console.warn( 'Invalid vector format detected for ' + fieldName );
-								break;
-
-							}
-
-							property = {
-								x: parseFloat( parts[ 1 ] ),
-								y: parseFloat( parts[ 2 ] ),
-								z: parseFloat( parts[ 3 ] )
-							};
-
-							break;
-
-						case 'intensity':				
-						case 'cutOffAngle':
-						case 'radius':
-						case 'topRadius':
-						case 'bottomRadius':
-						case 'height':
-						case 'transparency':
-						case 'shininess':
-						case 'ambientIntensity':
-							if ( parts.length != 2 ) {
-
-								console.warn( 'Invalid single float value specification detected for ' + fieldName );
-								break;
-
-							}
-
-							property = parseFloat( parts[ 1 ] );
-
-							break;
-
-						case 'rotation':
-							if ( parts.length != 5 ) {
-
-								console.warn( 'Invalid quaternion format detected for ' + fieldName );
-								break;
-
-							}
-
-							property = {
-								x: parseFloat( parts[ 1 ] ),
-								y: parseFloat( parts[ 2 ] ),
-								z: parseFloat( parts[ 3 ] ),
-								w: parseFloat( parts[ 4 ] )
-							};
-
-							break;
-							
-						case 'on':
-						case 'ccw':
-						case 'solid':
-						case 'colorPerVertex':
-						case 'convex':
-							if ( parts.length != 2 ) {
-
-								console.warn( 'Invalid format detected for ' + fieldName );
-								break;
-
-							}
-
-							property = parts[ 1 ] === 'TRUE' ? true : false;
-
-							break;
-					}
-
-					node[ fieldName ] = property;
-
-				}
-
-				return property;
-
-			};
-
-			var getTree = function ( lines ) {
-
-				var tree = { 'string': 'Scene', children: [] };
-				var current = tree;
-				var matches;
-				var specification;
-
-				for ( var i = 0; i < lines.length; i ++ ) {
-
-					var comment = '';
-
-					var line = lines[ i ];
-
-					// omit whitespace only lines
-					if ( null !== ( result = /^\s+?$/g.exec( line ) ) ) {
-
-						continue;
-
-					}
-
-					line = line.trim();
-
-					// skip empty lines
-					if ( line === '' ) {
-
-						continue;
-
-					}
-
-					if ( /#/.exec( line ) ) {
-
-						var parts = line.split( '#' );
-
-						// discard everything after the #, it is a comment
-						line = parts[ 0 ];
-
-						// well, let's also keep the comment
-						comment = parts[ 1 ];
-
-					}
-
-					if ( matches = /([^\s]*){1}(?:\s+)?{/.exec( line ) ) {
-
-						// first subpattern should match the Node name
-
-						var block = { 'nodeType' : matches[ 1 ], 'string': line, 'parent': current, 'children': [], 'comment' : comment };
-						current.children.push( block );
-						current = block;
-
-						if ( /}/.exec( line ) ) {
-
-							// example: geometry Box { size 1 1 1 } # all on the same line
-							specification = /{(.*)}/.exec( line )[ 1 ];
-
-							// todo: remove once new parsing is complete?
-							block.children.push( specification );
-
-							parseProperty( current, specification );
-
-							current = current.parent;
-
-						}
-
-					} else if ( /}/.exec( line ) ) {
+	parse: function (data) {
+		try {
+			var tree = this.parser.parse(data);
 
 
-						current = current.parent;
+			this.log(tree);
+			return tree;
+		} catch ( e ) {
+			this.log('Exception with message ' + e.message);
 
 
-					} else if ( line !== '' ) {
-
-						parseProperty( current, line );
-						// todo: remove once new parsing is complete? we still do not parse geometry and appearance the new way
-						current.children.push( line );
-
-					}
-
-				}
-
-				return tree;
-
-			};
-
-			var parseNode = function ( data, parent ) {
-
-				// console.log( data );
-
-				if ( typeof data === 'string' ) {
-
-					if ( /USE/.exec( data ) ) {
-
-						var defineKey = /USE\s+?([^\s]+)/.exec( data )[ 1 ];
-
-						if ( undefined == defines[ defineKey ] ) {
-
-							console.warn( defineKey + ' is not defined.' );
-
-						} else {
-
-							if ( /appearance/.exec( data ) && defineKey ) {
-
-								parent.material = defines[ defineKey ].clone();
-
-							} else if ( /geometry/.exec( data ) && defineKey ) {
-
-								parent.geometry = defines[ defineKey ].clone();
-
-								// the solid property is not cloned with clone(), is only needed for VRML loading, so we need to transfer it
-								if ( undefined !== defines[ defineKey ].solid && defines[ defineKey ].solid === false ) {
-
-									parent.geometry.solid = false;
-									parent.material.side = THREE.DoubleSide;
-
-								}
-
-							} else if ( defineKey ) {
-
-								var object = defines[ defineKey ].clone();
-								parent.add( object );
-
-							}
-
-						}
-
-					}
-
-					return;
-
-				}
-
-				var object = parent;
-
-				if(data.string.indexOf("AmbientLight")>-1 && data.nodeType=='PointLight'){
-					//wenn im Namen "AmbientLight" vorkommt und es ein PointLight ist, 
-					//diesen Typ in 'AmbientLight' ändern
-					data.nodeType='AmbientLight';	
-				}
-				
-				l_visible=data.on;
-				if(l_visible==undefined)l_visible=true;
-				l_intensity=data.intensity;
-				if(l_intensity==undefined)l_intensity=true;
-				if(data.color!=undefined)
-					l_color= new THREE.Color(data.color.r, data.color.g,data.color.b );
-					else
-					l_color= new THREE.Color(0, 0,0);
-				
-				
-				
-				if('AmbientLight' === data.nodeType){
-					object=new THREE.AmbientLight( 
-								l_color.getHex(), 
-								l_intensity
-								);
-					object.visible=l_visible;
-					
-					parent.add( object );
-					
-				}
-				else
-				if('PointLight' === data.nodeType){
-						l_distance =0;	//0="unendlich" ...1000
-						l_decay=0;		//-1.. ?
-						
-						if(data.radius!=undefined && data.radius<1000){
-							//l_radius=data.radius;
-							l_distance=data.radius;
-							l_decay=1;
-						}
-						object=new THREE.PointLight( 
-								l_color.getHex(), 
-								l_intensity, 
-								l_distance);
-						object.visible=l_visible;
-						
-						parent.add( object );
-				}
-				else
-				if('SpotLight' === data.nodeType){						
-						l_intensity=1;
-						l_distance =0;//0="unendlich"=1000
-						l_angle=Math.PI/3;
-						l_penumbra=0.0;//0..1
-						l_decay=0;//-1.. ?
-						l_visible=true;
-						
-						if(data.radius!=undefined && data.radius<1000){
-							//l_radius=data.radius;
-							l_distance=data.radius;
-							l_decay=1;
-						}
-						if(data.cutOffAngle!=undefined)l_angle=data.cutOffAngle;
-						
-						object = new THREE.SpotLight(
-									l_color.getHex(),
-									l_intensity,
-									l_distance,
-									l_angle,
-									l_penumbra,
-									l_decay
-									);
-						object.visible=l_visible;						
-						parent.add( object );
-						/*
-						var lightHelper = new THREE.SpotLightHelper( object );
-						parent.parent.add( lightHelper );
-						lightHelper.update();
-						*/
-				}
-				else				
-				
-				if ( 'Transform' === data.nodeType || 'Group' === data.nodeType ) {
-
-					object = new THREE.Object3D();
-
-					if ( /DEF/.exec( data.string ) ) {
-
-						object.name = /DEF\s+([^\s]+)/.exec( data.string )[ 1 ];
-						defines[ object.name ] = object;
-
-					}
-
-					if ( undefined !== data[ 'translation' ] ) {
-
-						var t = data.translation;
-
-						object.position.set( t.x, t.y, t.z );
-
-					}
-
-					if ( undefined !== data.rotation ) {
-
-						var r = data.rotation;
-
-						object.quaternion.setFromAxisAngle( new THREE.Vector3( r.x, r.y, r.z ), r.w );
-
-					}
-
-					if ( undefined !== data.scale ) {
-
-						var s = data.scale;
-
-						object.scale.set( s.x, s.y, s.z );
-
-					}
-
-					parent.add( object );
-
-				} else if ( 'Shape' === data.nodeType ) {
-
-					object = new THREE.Mesh();
-
-					if ( /DEF/.exec( data.string ) ) {
-
-						object.name = /DEF\s+([^\s]+)/.exec( data.string )[ 1 ];
-
-						defines[ object.name ] = object;
-
-					}
-
-					parent.add( object );
-
-				} else if ( 'Background' === data.nodeType ) {
-
-					var segments = 20;
-
-					// sky (full sphere):
-
-					var radius = 2e4;
-
-					var skyGeometry = new THREE.SphereGeometry( radius, segments, segments );
-					var skyMaterial = new THREE.MeshBasicMaterial( { fog: false, side: THREE.BackSide } );
-
-					if ( data.skyColor.length > 1 ) {
-
-						paintFaces( skyGeometry, radius, data.skyAngle, data.skyColor, true );
-
-						skyMaterial.vertexColors = THREE.VertexColors
-
-					} else {
-
-						var color = data.skyColor[ 0 ];
-						skyMaterial.color.setRGB( color.r, color.b, color.g );
-
-					}
-
-					scene.add( new THREE.Mesh( skyGeometry, skyMaterial ) );
-
-					// ground (half sphere):
-
-					if ( data.groundColor !== undefined ) {
-
-						radius = 1.2e4;
-
-						var groundGeometry = new THREE.SphereGeometry( radius, segments, segments, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
-						var groundMaterial = new THREE.MeshBasicMaterial( { fog: false, side: THREE.BackSide, vertexColors: THREE.VertexColors } );
-
-						paintFaces( groundGeometry, radius, data.groundAngle, data.groundColor, false );
-
-						scene.add( new THREE.Mesh( groundGeometry, groundMaterial ) );
-
-					}
-
-				} else if ( /geometry/.exec( data.string ) ) {
-
-					if ( 'Box' === data.nodeType ) {
-
-						var s = data.size;
-
-						parent.geometry = new THREE.BoxGeometry( s.x, s.y, s.z );
-
-					} else if ( 'Cylinder' === data.nodeType ) {
-
-						parent.geometry = new THREE.CylinderGeometry( data.radius, data.radius, data.height );
-
-					} else if ( 'Cone' === data.nodeType ) {
-
-						parent.geometry = new THREE.CylinderGeometry( data.topRadius, data.bottomRadius, data.height );
-
-					} else if ( 'Sphere' === data.nodeType ) {
-
-						parent.geometry = new THREE.SphereGeometry( data.radius );
-
-					} else if ( 'IndexedFaceSet' === data.nodeType ) {
-
-						var geometry = new THREE.Geometry();
-
-						var indexes, uvIndexes, uvs;
-
-						for ( var i = 0, j = data.children.length; i < j; i ++ ) {
-
-							var child = data.children[ i ];
-
-							var vec;
-
-							if ( 'TextureCoordinate' === child.nodeType ) {
-
-								uvs = child.points;
-
-							}
-
-
-							if ( 'Coordinate' === child.nodeType ) {
-
-								if ( child.points ) {
-
-									for ( var k = 0, l = child.points.length; k < l; k ++ ) {
-
-										var point = child.points[ k ];
-
-										vec = new THREE.Vector3( point.x, point.y, point.z );
-
-										geometry.vertices.push( vec );
-
-									}
-
-								}
-
-								if ( child.string.indexOf ( 'DEF' ) > -1 ) {
-
-									var name = /DEF\s+([^\s]+)/.exec( child.string )[ 1 ];
-
-									defines[ name ] = geometry.vertices;
-
-								}
-
-								if ( child.string.indexOf ( 'USE' ) > -1 ) {
-
-									var defineKey = /USE\s+([^\s]+)/.exec( child.string )[ 1 ];
-
-									geometry.vertices = defines[ defineKey ];
-								}
-
-							}
-
-						}
-
-						var skip = 0;
-
-						// some shapes only have vertices for use in other shapes
-						if ( data.coordIndex ) {
-
-							// read this: http://math.hws.edu/eck/cs424/notes2013/16_Threejs_Advanced.html
-							for ( var i = 0, j = data.coordIndex.length; i < j; i ++ ) {
-
-								indexes = data.coordIndex[ i ]; if ( data.texCoordIndex ) uvIndexes = data.texCoordIndex[ i ];
-
-								// vrml support multipoint indexed face sets (more then 3 vertices). You must calculate the composing triangles here
-								skip = 0;
-
-								// Face3 only works with triangles, but IndexedFaceSet allows shapes with more then three vertices, build them of triangles
-								while ( indexes.length >= 3 && skip < ( indexes.length - 2 ) ) {
-
-									var face = new THREE.Face3(
-										indexes[ 0 ],
-										indexes[ skip + (data.ccw ? 1 : 2) ],
-										indexes[ skip + (data.ccw ? 2 : 1) ],
-										null // normal, will be added later
-										// todo: pass in the color, if a color index is present
-									);
-
-									if ( uvs && uvIndexes ) {
-										geometry.faceVertexUvs [0].push( [
-											new THREE.Vector2 (
-												uvs[ uvIndexes[ 0 ] ].x ,
-												uvs[ uvIndexes[ 0 ] ].y
-											) ,
-											new THREE.Vector2 (
-												uvs[ uvIndexes[ skip + (data.ccw ? 1 : 2) ] ].x ,
-												uvs[ uvIndexes[ skip + (data.ccw ? 1 : 2) ] ].y
-											) ,
-											new THREE.Vector2 (
-												uvs[ uvIndexes[ skip + (data.ccw ? 2 : 1) ] ].x ,
-												uvs[ uvIndexes[ skip + (data.ccw ? 2 : 1) ] ].y
-											)
-										] );
-									}
-
-									skip ++;
-
-									geometry.faces.push( face );
-
-								}
-
-
-							}
-
-						} else {
-
-							// do not add dummy mesh to the scene
-							parent.parent.remove( parent );
-
-						}
-
-						if ( false === data.solid ) {
-
-							parent.material.side = THREE.DoubleSide;
-
-						}
-
-						// we need to store it on the geometry for use with defines
-						geometry.solid = data.solid;
-
-						geometry.computeFaceNormals();
-						//geometry.computeVertexNormals(); // does not show
-						geometry.computeBoundingSphere();
-
-						// see if it's a define
-						if ( /DEF/.exec( data.string ) ) {
-
-							geometry.name = /DEF ([^\s]+)/.exec( data.string )[ 1 ];
-							defines[ geometry.name ] = geometry;
-
-						}
-
-						parent.geometry = geometry;
-
-					}
-
-					return;
-
-				} else if ( /appearance/.exec( data.string ) ) {
-
-					for ( var i = 0; i < data.children.length; i ++ ) {
-
-						var child = data.children[ i ];
-
-						if ( 'Material' === child.nodeType ) {
-
-							var material = new THREE.MeshPhongMaterial();
-
-							if ( undefined !== child.diffuseColor ) {
-
-								var d = child.diffuseColor;
-
-								material.color.setRGB( d.r, d.g, d.b );
-
-							}
-
-							if ( undefined !== child.emissiveColor ) {
-
-								var e = child.emissiveColor;
-
-								material.emissive.setRGB( e.r, e.g, e.b );
-
-							}
-
-							if ( undefined !== child.specularColor ) {
-
-								var s = child.specularColor;
-
-								material.specular.setRGB( s.r, s.g, s.b );
-
-							}
-
-							if ( undefined !== child.transparency ) {
-
-								var t = child.transparency;
-
-								// transparency is opposite of opacity
-								material.opacity = Math.abs( 1 - t );
-
-								material.transparent = true;
-
-							}
-
-							if ( /DEF/.exec( data.string ) ) {
-
-								material.name = /DEF ([^\s]+)/.exec( data.string )[ 1 ];
-
-								defines[ material.name ] = material;
-
-							}
-
-							parent.material = material;
-
-						}
-
-						if ( 'ImageTexture' === child.nodeType ) {
-
-							var textureName = /"([^"]+)"/.exec(child.children[ 0 ]);
-
-							if (textureName) {
-
-								parent.material.name = textureName[ 1 ];
-
-								parent.material.map = textureLoader.load( texturePath + textureName[ 1 ] );
-
-							}
-
-						}
-
-					}
-
-					return;
-
-				}
-
-				for ( var i = 0, l = data.children.length; i < l; i ++ ) {
-
-					var child = data.children[ i ];
-
-					parseNode( data.children[ i ], object );
-
-				}
-
-			};
-
-			parseNode( getTree( lines ), scene );
-
-		};
-
-		var scene = new THREE.Scene();
-
-		var lines = data.split( '\n' );
-
-		// some lines do not have breaks
-		for (var i = lines.length -1; i > -1; i--) {
-
-			// split lines with {..{ or {..[ - some have both
-			if (/{.*[{\[]/.test (lines[i])) {
-				var parts = lines[i].split ('{').join ('{\n').split ('\n');
-				parts.unshift(1);
-				parts.unshift(i);
-				lines.splice.apply(lines, parts);
-			} else
-
-			// split lines with ]..}
-			if (/\].*}/.test (lines[i])) {
-				var parts = lines[i].split (']').join (']\n').split ('\n');
-				parts.unshift(1);
-				parts.unshift(i);
-				lines.splice.apply(lines, parts);
-			}
-
-			// split lines with }..}
-			if (/}.*}/.test (lines[i])) {
-				var parts = lines[i].split ('}').join ('}\n').split ('\n');
-				parts.unshift(1);
-				parts.unshift(i);
-				lines.splice.apply(lines, parts);
+			if ( undefined !== e.location ) {
+				this.log('Exception at location start: offset: ' + e.location.start.offset + ' line: ' + e.location.start.line + ' column: ' + e.location.start.column);
+				this.log('Exception at location end: offset: ' + e.location.end.offset + ' line: ' + e.location.end.line + ' column: ' + e.location.end.column);
 			}
 			}
 
 
-			// force the parser to create Coordinate node for empty coords
-			// coord USE something -> coord USE something Coordinate {}
-			if((lines[i].indexOf ('coord') > -1) && (lines[i].indexOf ('[') < 0) && (lines[i].indexOf ('{') < 0)) {
-				lines[i] += ' Coordinate {}';
-			}
+			return;
 		}
 		}
+	},
 
 
-		var header = lines.shift();
+	load: function (url, onLoad, onProgress, onError) {
 
 
-		if ( /V1.0/.exec( header ) ) {
+		var scope = this;
 
 
-			parseV1( lines, scene );
+		var loader = new THREE.FileLoader(this.manager);
+		loader.load(url, function (text) {
 
 
-		} else if ( /V2.0/.exec( header ) ) {
+			onLoad(scope.parse(text));
 
 
-			parseV2( lines, scene );
+		}, onProgress, onError);
 
 
-		}
+	},
 
 
-		return scene;
+	setCrossOrigin: function (value) {
 
 
-	}
+		this.crossOrigin = value;
+
+	},
 
 
 };
 };

+ 11 - 2
examples/js/loaders/sea3d/SEA3D.js

@@ -9,7 +9,7 @@ var SEA3D = { VERSION: 18100 };
 
 
 SEA3D.getVersion = function () {
 SEA3D.getVersion = function () {
 
 
-	// Max = 16777215 - VVSSBB  | V = Version | S = Subversion | B = Buildversion
+	// Max = 16777215 - VV.S.S.BB  | V = Version | S = Subversion | B = Buildversion
 	var v = SEA3D.VERSION.toString(), l = v.length;
 	var v = SEA3D.VERSION.toString(), l = v.length;
 	return v.substring( 0, l - 4 ) + "." + v.substring( l - 4, l - 3 ) + "." + v.substring( l - 3, l - 2 ) + "." + parseFloat( v.substring( l - 2, l ) ).toString();
 	return v.substring( 0, l - 4 ) + "." + v.substring( l - 4, l - 3 ) + "." + v.substring( l - 3, l - 2 ) + "." + parseFloat( v.substring( l - 2, l ) ).toString();
 
 
@@ -99,6 +99,7 @@ SEA3D.Stream.sizeOf = function ( kind ) {
 };
 };
 
 
 SEA3D.Stream.prototype = {
 SEA3D.Stream.prototype = {
+
 	constructor: SEA3D.Stream,
 	constructor: SEA3D.Stream,
 
 
 	set buffer( val ) {
 	set buffer( val ) {
@@ -278,7 +279,15 @@ SEA3D.Stream.prototype.readUTF8 = function ( len ) {
 
 
 	var buffer = this.readBytes( len );
 	var buffer = this.readBytes( len );
 
 
-	return window.TextDecoder ? new TextDecoder().decode( buffer ) : String.fromCharCode.apply( undefined, new Uint16Array( new Uint8Array( buffer ) ) );
+	if ( window.TextDecoder ) {
+
+		return new TextDecoder().decode( buffer );
+
+	} else {
+
+		return decodeURIComponent( escape( String.fromCharCode.apply( null, new Uint8Array( buffer ) ) ) );
+
+	}
 
 
 };
 };
 
 

+ 85 - 64
examples/js/loaders/sea3d/SEA3DLegacy.js

@@ -16,8 +16,8 @@ Object.assign( THREE.SEA3D.prototype, {
 	_readVertexAnimation: THREE.SEA3D.prototype.readVertexAnimation,
 	_readVertexAnimation: THREE.SEA3D.prototype.readVertexAnimation,
 	_readGeometryBuffer: THREE.SEA3D.prototype.readGeometryBuffer,
 	_readGeometryBuffer: THREE.SEA3D.prototype.readGeometryBuffer,
 	_readLine: THREE.SEA3D.prototype.readLine,
 	_readLine: THREE.SEA3D.prototype.readLine,
-	_getSkeletonAnimation: THREE.SEA3D.prototype.getSkeletonAnimation,
-	_applyDefaultAnimation: THREE.SEA3D.prototype.applyDefaultAnimation
+	_getAnimationType: THREE.SEA3D.prototype.getAnimationType,
+	_readAnimation: THREE.SEA3D.prototype.readAnimation
 
 
 } );
 } );
 
 
@@ -41,11 +41,11 @@ THREE.SEA3D.prototype.isLegacy = function ( sea ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipZVec3 = function ( v ) {
+THREE.SEA3D.prototype.flipXVec3 = function ( v ) {
 
 
 	if ( ! v ) return;
 	if ( ! v ) return;
 
 
-	var i = 2; // z
+	var i = 0; // z
 
 
 	while ( i < v.length ) {
 	while ( i < v.length ) {
 
 
@@ -133,7 +133,7 @@ THREE.SEA3D.prototype.compressJoints = function ( sea ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipZIndex = function ( v ) {
+THREE.SEA3D.prototype.flipYZIndex = function ( v ) {
 
 
 	var i = 1; // y >-< z
 	var i = 1; // y >-< z
 
 
@@ -151,21 +151,17 @@ THREE.SEA3D.prototype.flipZIndex = function ( v ) {
 
 
 };
 };
 
 
-THREE.SEA3D.prototype.flipMatrixBone = function ( mtx ) {
+THREE.SEA3D.prototype.flipMatrixBone = function () {
 
 
 	var zero = new THREE.Vector3();
 	var zero = new THREE.Vector3();
-	var buf1 = new THREE.Matrix4();
 
 
 	return function ( mtx ) {
 	return function ( mtx ) {
 
 
-		buf1.copy( mtx );
+		var pos = THREE.SEA3D.VECBUF.setFromMatrixPosition( mtx );
+		pos.x = - pos.x;
 
 
 		mtx.setPosition( zero );
 		mtx.setPosition( zero );
-		mtx.multiplyMatrices( THREE.SEA3D.MTXBUF.makeRotationZ( THREE.Math.degToRad( 180 ) ), mtx );
-		mtx.makeRotationFromQuaternion( THREE.SEA3D.QUABUF.setFromRotationMatrix( mtx ) );
-
-		var pos = THREE.SEA3D.VECBUF.setFromMatrixPosition( buf1 );
-		pos.z = - pos.z;
+		mtx.multiplyMatrices( THREE.SEA3D.MTXBUF.makeRotationX( THREE.Math.degToRad( 180 ) ), mtx );
 		mtx.setPosition( pos );
 		mtx.setPosition( pos );
 
 
 		return mtx;
 		return mtx;
@@ -174,34 +170,33 @@ THREE.SEA3D.prototype.flipMatrixBone = function ( mtx ) {
 
 
 }();
 }();
 
 
-THREE.SEA3D.prototype.flipMatrixScale = function ( local, global, parent, parentGlobal ) {
+THREE.SEA3D.prototype.flipMatrixScale = function () {
 
 
 	var pos = new THREE.Vector3();
 	var pos = new THREE.Vector3();
 	var qua = new THREE.Quaternion();
 	var qua = new THREE.Quaternion();
 	var slc = new THREE.Vector3();
 	var slc = new THREE.Vector3();
 
 
-	return function ( local, global, parent, parentGlobal ) {
+	return function ( local, rotate, parent, parentRotate ) {
 
 
 		if ( parent ) local.multiplyMatrices( parent, local );
 		if ( parent ) local.multiplyMatrices( parent, local );
 
 
 		local.decompose( pos, qua, slc );
 		local.decompose( pos, qua, slc );
 
 
-		slc.z = - slc.z;
+		slc.x = - slc.x;
 
 
-		if ( global ) {
+		local.compose( pos, qua, slc );
 
 
-			slc.y = - slc.y;
-			slc.x = - slc.x;
+		if ( rotate ) {
 
 
-		}
+			local.multiplyMatrices( local, THREE.SEA3D.MTXBUF.makeRotationX( THREE.Math.degToRad( 180 ) ) );
 
 
-		local.compose( pos, qua, slc );
+		}
 
 
 		if ( parent ) {
 		if ( parent ) {
 
 
 			parent = parent.clone();
 			parent = parent.clone();
 
 
-			this.flipMatrixScale( parent, parentGlobal );
+			this.flipMatrixScale( parent, parentRotate );
 
 
 			local.multiplyMatrices( parent.getInverse( parent ), local );
 			local.multiplyMatrices( parent.getInverse( parent ), local );
 
 
@@ -217,7 +212,7 @@ THREE.SEA3D.prototype.flipMatrixScale = function ( local, global, parent, parent
 //	Legacy
 //	Legacy
 //
 //
 
 
-THREE.SEA3D.prototype.updateAnimationSet = function ( obj3d ) {
+THREE.SEA3D.prototype.flipDefaultAnimation = function () {
 
 
 	var buf1 = new THREE.Matrix4();
 	var buf1 = new THREE.Matrix4();
 	var buf2 = new THREE.Matrix4();
 	var buf2 = new THREE.Matrix4();
@@ -230,35 +225,32 @@ THREE.SEA3D.prototype.updateAnimationSet = function ( obj3d ) {
 	var to_qua = new THREE.Quaternion();
 	var to_qua = new THREE.Quaternion();
 	var to_slc = new THREE.Vector3();
 	var to_slc = new THREE.Vector3();
 
 
-	return function ( obj3d ) {
-
-		var anmSet = obj3d.animation.animationSet;
-		var relative = obj3d.animation.relative;
-		var anms = anmSet.animations;
+	return function ( animation, obj3d, relative ) {
 
 
-		if ( anmSet.flip && ! anms.length )
-			return;
+		if ( animation.isFliped ) return;
 
 
-		var dataList = anms[ 0 ].dataList,
+		var dataList = animation.dataList,
 			t_anm = [];
 			t_anm = [];
 
 
 		for ( var i = 0; i < dataList.length; i ++ ) {
 		for ( var i = 0; i < dataList.length; i ++ ) {
 
 
-			var data = dataList[ i ];
-			var raw = dataList[ i ].data;
-			var kind = data.kind;
-			var numFrames = raw.length / data.blockLength;
+			var data = dataList[ i ],
+				raw = data.data,
+				kind = data.kind,
+				numFrames = raw.length / data.blockSize;
 
 
 			switch ( kind ) {
 			switch ( kind ) {
 
 
 				case SEA3D.Animation.POSITION:
 				case SEA3D.Animation.POSITION:
 				case SEA3D.Animation.ROTATION:
 				case SEA3D.Animation.ROTATION:
 				case SEA3D.Animation.SCALE:
 				case SEA3D.Animation.SCALE:
+
 					t_anm.push( {
 					t_anm.push( {
 						kind: kind,
 						kind: kind,
 						numFrames: numFrames,
 						numFrames: numFrames,
 						raw: raw
 						raw: raw
 					} );
 					} );
+
 					break;
 					break;
 
 
 			}
 			}
@@ -270,7 +262,7 @@ THREE.SEA3D.prototype.updateAnimationSet = function ( obj3d ) {
 			var numFrames = t_anm[ 0 ].numFrames,
 			var numFrames = t_anm[ 0 ].numFrames,
 				parent = undefined;
 				parent = undefined;
 
 
-			if ( obj3d.animation.relative ) {
+			if ( relative ) {
 
 
 				buf1.identity();
 				buf1.identity();
 				parent = this.flipMatrixScale( buf2.copy( obj3d.matrixWorld ) );
 				parent = this.flipMatrixScale( buf2.copy( obj3d.matrixWorld ) );
@@ -391,26 +383,61 @@ THREE.SEA3D.prototype.updateAnimationSet = function ( obj3d ) {
 
 
 		}
 		}
 
 
-		anmSet.flip = true;
+		animation.isFliped = true;
 
 
 	};
 	};
 
 
 }();
 }();
 
 
+THREE.SEA3D.prototype.readAnimation = function ( sea ) {
+
+	if ( ! this.isLegacy( sea ) ) {
+
+		this._readAnimation( sea );
+
+	}
+
+};
+
+THREE.SEA3D.prototype.getAnimationType = function ( req ) {
+
+	var sea = req.sea;
+
+	if ( this.isLegacy( sea ) ) {
+
+		switch ( sea.type ) {
 
 
-THREE.SEA3D.prototype.applyDefaultAnimation = function ( sea, animatorClass ) {
+			case SEA3D.SkeletonAnimation.prototype.type:
 
 
-	this._applyDefaultAnimation( sea, animatorClass );
+				this.readSkeletonAnimationLegacy( sea, req.skeleton );
 
 
-	if ( this.isLegacy( sea ) && sea.tag.animation ) {
+				return sea.tag;
 
 
-		this.updateAnimationSet( sea.tag );
+				break;
+
+			case SEA3D.Animation.prototype.type:
+
+				if ( req.scope instanceof THREE.Object3D ) {
+
+					this.flipDefaultAnimation( sea, req.scope, req.relative );
+
+				}
+
+				this._readAnimation( sea );
+
+				return sea.tag;
+
+				break;
+
+		}
 
 
 	}
 	}
 
 
+	return this._getAnimationType( req );
+
 };
 };
 
 
-THREE.SEA3D.prototype.updateTransform = function ( obj3d, sea ) {
+THREE.SEA3D.prototype.updateTransform = function () {
 
 
 	var buf1 = new THREE.Matrix4();
 	var buf1 = new THREE.Matrix4();
 	var identity = new THREE.Matrix4();
 	var identity = new THREE.Matrix4();
@@ -448,7 +475,7 @@ THREE.SEA3D.prototype.updateTransform = function ( obj3d, sea ) {
 
 
 }();
 }();
 
 
-THREE.SEA3D.prototype.readSkeleton = function ( sea ) {
+THREE.SEA3D.prototype.readSkeleton = function () {
 
 
 	var mtx_tmp_inv = new THREE.Matrix4(),
 	var mtx_tmp_inv = new THREE.Matrix4(),
 		mtx_local = new THREE.Matrix4(),
 		mtx_local = new THREE.Matrix4(),
@@ -516,14 +543,7 @@ THREE.SEA3D.prototype.readSkeleton = function ( sea ) {
 
 
 }();
 }();
 
 
-THREE.SEA3D.prototype.getSkeletonAnimation = function ( sea, skl ) {
-
-	if ( this.isLegacy( sea ) ) return this.getSkeletonAnimationLegacy( sea, skl );
-	else return this._getSkeletonAnimation( sea, skl );
-
-};
-
-THREE.SEA3D.prototype.getSkeletonAnimationLegacy = function ( sea, skl ) {
+THREE.SEA3D.prototype.readSkeletonAnimationLegacy = function () {
 
 
 	var mtx_tmp_inv = new THREE.Matrix4(),
 	var mtx_tmp_inv = new THREE.Matrix4(),
 		mtx_local = new THREE.Matrix4(),
 		mtx_local = new THREE.Matrix4(),
@@ -619,15 +639,12 @@ THREE.SEA3D.prototype.getSkeletonAnimationLegacy = function ( sea, skl ) {
 
 
 			}
 			}
 
 
-			var anm = THREE.AnimationClip.parseAnimation( animation, skl.tag );
-			anm.loop = seq.repeat;
-			anm.timeScale = 1;
-
-			animations.push( anm );
+			animations.push( THREE.SEA3D.AnimationClip.fromClip( THREE.AnimationClip.parseAnimation( animation, skl.tag ), seq.repeat ) );
 
 
 		}
 		}
 
 
-		return sea.tag = animations;
+		this.domain.clips = this.clips = this.clips || [];
+		this.clips.push( this.objects[ sea.name + '.anm' ] = sea.tag = animations );
 
 
 	};
 	};
 
 
@@ -641,8 +658,8 @@ THREE.SEA3D.prototype.readVertexAnimation = function ( sea ) {
 
 
 			var frame = sea.frame[ i ];
 			var frame = sea.frame[ i ];
 
 
-			this.flipZVec3( frame.vertex );
-			this.flipZVec3( frame.normal );
+			this.flipXVec3( frame.vertex );
+			this.flipXVec3( frame.normal );
 
 
 		}
 		}
 
 
@@ -656,10 +673,10 @@ THREE.SEA3D.prototype.readGeometryBuffer = function ( sea ) {
 
 
 	if ( this.isLegacy( sea ) ) {
 	if ( this.isLegacy( sea ) ) {
 
 
-		this.flipZVec3( sea.vertex );
-		this.flipZVec3( sea.normal );
+		this.flipXVec3( sea.vertex );
+		this.flipXVec3( sea.normal );
 
 
-		this.flipZIndex( sea.indexes );
+		this.flipYZIndex( sea.indexes );
 
 
 		if ( sea.jointPerVertex > 4 ) this.compressJoints( sea );
 		if ( sea.jointPerVertex > 4 ) this.compressJoints( sea );
 		else if ( sea.jointPerVertex < 4 ) this.expandJoints( sea );
 		else if ( sea.jointPerVertex < 4 ) this.expandJoints( sea );
@@ -674,7 +691,7 @@ THREE.SEA3D.prototype.readLines = function ( sea ) {
 
 
 	if ( this.isLegacy( sea ) ) {
 	if ( this.isLegacy( sea ) ) {
 
 
-		this.flipZVec3( sea.vertex );
+		this.flipXVec3( sea.vertex );
 
 
 	}
 	}
 
 
@@ -684,7 +701,11 @@ THREE.SEA3D.prototype.readLines = function ( sea ) {
 
 
 THREE.SEA3D.prototype.onHead = function ( args ) {
 THREE.SEA3D.prototype.onHead = function ( args ) {
 
 
-	// TODO: Ignore sign
+	if ( args.sign != "S3D" && args.sign != "TJS" ) {
+
+		throw new Error( "Sign '" + args.sign + "' unknown." );
+
+	}
 
 
 };
 };
 
 

File diff suppressed because it is too large
+ 435 - 252
examples/js/loaders/sea3d/SEA3DLoader.js


+ 0 - 0
examples/js/loaders/sea3d/SEA3DGC.js → examples/js/loaders/sea3d/o3dgc/SEA3DGC.js


+ 405 - 0
examples/js/loaders/sea3d/physics/SEA3DAmmo.js

@@ -0,0 +1,405 @@
+/**   _     _   _         _____  __   _______  ______
+*    | |___| |_| |__    /__  |  |  |     |  _  | * *
+*    | / _ \  _|    |    __\    |  |  \  |  _  |  U _
+*    |_\___/\__|_||_| _ |____/____ |__ \_|_  |_|_____|
+*
+*    @author LoTh / http://3dflashlo.wordpress.com/
+*    @author SUNAG / http://www.sunag.com.br/
+*    @author Ammo.lab / https://github.com/lo-th/Ammo.lab/
+*/
+
+'use strict';
+
+SEA3D.AMMO = {
+	world: null,
+	rigidBodies: [],
+	rigidBodiesTarget: [],
+	rigidBodiesOffset: [],
+	rigidBodiesEnabled: [],
+	constraints: [],
+	vehicles: [],
+	vehiclesWheels: [],
+
+	ACTIVE: 1,
+	ISLAND_SLEEPING: 2,
+	WANTS_DEACTIVATION: 3,
+	DISABLE_DEACTIVATION: 4,
+	DISABLE_SIMULATION: 5,
+	VERSION: 0.8,
+
+	init: function ( gravity, worldScale, broadphase ) {
+
+		gravity = gravity !== undefined ? gravity : - 90.8;
+
+		this.worldScale = worldScale == undefined ? 1 : worldScale;
+		this.broadphase = broadphase == undefined ? 'bvt' : broadphase;
+
+		this.solver = new Ammo.btSequentialImpulseConstraintSolver();
+		this.collisionConfig = new Ammo.btDefaultCollisionConfiguration();
+		this.dispatcher = new Ammo.btCollisionDispatcher( this.collisionConfig );
+
+		switch ( this.broadphase ) {
+
+			case 'bvt':
+
+				this.broadphase = new Ammo.btDbvtBroadphase();
+
+				break;
+
+			case 'sap':
+
+				this.broadphase = new Ammo.btAxisSweep3(
+					new Ammo.btVector3( - this.worldScale, - this.worldScale, - this.worldScale ),
+					new Ammo.btVector3( this.worldScale, this.worldScale, this.worldScale ),
+					4096
+				);
+
+				break;
+
+			case 'simple':
+
+				this.broadphase = new Ammo.btSimpleBroadphase();
+
+				break;
+
+		}
+
+		this.world = new Ammo.btDiscreteDynamicsWorld( this.dispatcher, this.broadphase, this.solver, this.collisionConfig );
+
+		this.setGravity( gravity );
+
+		console.log( "THREE.AMMO " + this.VERSION );
+
+	},
+
+	setGravity: function ( gravity ) {
+
+		this.gravity = gravity;
+
+		this.world.setGravity( new Ammo.btVector3( 0, gravity, 0 ) );
+
+		return this;
+
+	},
+	getGravity: function () {
+
+		return this.gravity;
+
+	},
+
+	setEnabledRigidBody: function ( rb, enabled ) {
+
+		if ( this.getEnabledRigidBody( rb ) == enabled ) return;
+
+		if ( enabled ) this.world.addRigidBody( rb );
+		else this.world.removeRigidBody( rb );
+
+		return this;
+
+	},
+	getEnabledRigidBody: function ( rb ) {
+
+		return this.rigidBodiesEnabled[ this.rigidBodies.indexOf( rb ) ] === true;
+
+	},
+	addRigidBody: function ( rb, target, offset, enabled ) {
+
+		enabled = enabled !== undefined ? enabled : true;
+
+		this.rigidBodies.push( rb );
+		this.rigidBodiesTarget.push( target );
+		this.rigidBodiesOffset.push( offset );
+		this.rigidBodiesEnabled.push( false );
+
+		this.setEnabledRigidBody( rb, enabled );
+
+		return this;
+
+	},
+	removeRigidBody: function ( rb, destroy ) {
+
+		var index = this.rigidBodies.indexOf( rb );
+
+		this.setEnabledRigidBody( rb, false );
+
+		this.rigidBodies.splice( index, 1 );
+		this.rigidBodiesTarget.splice( index, 1 );
+		this.rigidBodiesOffset.splice( index, 1 );
+		this.rigidBodiesEnabled.splice( index, 1 );
+
+		if ( destroy ) Ammo.destroy( rb );
+
+		return this;
+
+	},
+	containsRigidBody: function ( rb ) {
+
+		return this.rigidBodies.indexOf( rb ) > - 1;
+
+	},
+
+	addConstraint: function ( ctrt, disableCollisionsBetweenBodies ) {
+
+		disableCollisionsBetweenBodies = disableCollisionsBetweenBodies == undefined ? true : disableCollisionsBetweenBodies;
+
+		this.constraints.push( ctrt );
+		this.world.addConstraint( ctrt, disableCollisionsBetweenBodies );
+
+		return this;
+
+	},
+	removeConstraint: function ( ctrt, destroy ) {
+
+		this.constraints.splice( this.constraints.indexOf( ctrt ), 1 );
+		this.world.removeConstraint( ctrt );
+
+		if ( destroy ) Ammo.destroy( ctrt );
+
+		return this;
+
+	},
+	containsConstraint: function ( ctrt ) {
+
+		return this.constraints.indexOf( rb ) > - 1;
+
+	},
+
+	addVehicle: function ( vehicle, wheels ) {
+
+		this.vehicles.push( vehicle );
+		this.vehiclesWheels.push( wheels != undefined ? wheels : [] );
+
+		this.world.addAction( vehicle );
+
+		return this;
+
+	},
+	removeVehicle: function ( vehicle, destroy ) {
+
+		var index = this.vehicles.indexOf( vehicle );
+
+		this.vehicles.splice( index, 1 );
+		this.vehiclesWheels.splice( index, 1 );
+
+		this.world.removeAction( vehicle );
+
+		if ( destroy ) Ammo.destroy( vehicle );
+
+		return this;
+
+	},
+	containsVehicle: function ( vehicle ) {
+
+		return this.vehicles.indexOf( vehicle ) > - 1;
+
+	},
+
+	createTriangleMesh: function ( geometry, index, removeDuplicateVertices ) {
+
+		index = index == undefined ? - 1 : index;
+		removeDuplicateVertices = removeDuplicateVertices == undefined ? false : removeDuplicateVertices;
+
+		var mTriMesh = new Ammo.btTriangleMesh();
+
+		var v0 = new Ammo.btVector3( 0, 0, 0 );
+		var v1 = new Ammo.btVector3( 0, 0, 0 );
+		var v2 = new Ammo.btVector3( 0, 0, 0 );
+
+		var vertex = geometry.getAttribute( 'position' ).array;
+		var indexes = geometry.getIndex().array;
+
+		var group = index >= 0 ? geometry.groups[ index ] : undefined,
+			start = group ? group.start : 0,
+			count = group ? group.count : indexes.length;
+
+		var scale = 1 / this.worldScale;
+
+		for ( var idx = start; idx < count; idx += 3 ) {
+
+			var vx1 = indexes[ idx ] * 3,
+				vx2 = indexes[ idx + 1 ] * 3,
+				vx3 = indexes[ idx + 2 ] * 3;
+
+			v0.setValue( vertex[ vx1 ] * scale, vertex[ vx1 + 1 ] * scale, vertex[ vx1 + 2 ] * scale );
+			v1.setValue( vertex[ vx2 ] * scale, vertex[ vx2 + 1 ] * scale, vertex[ vx2 + 2 ] * scale );
+			v2.setValue( vertex[ vx3 ] * scale, vertex[ vx3 + 1 ] * scale, vertex[ vx3 + 2 ] * scale );
+
+			mTriMesh.addTriangle( v0, v1, v2, removeDuplicateVertices );
+
+		}
+
+		return mTriMesh;
+
+	},
+	createConvexHull: function ( geometry, index ) {
+
+		index = index == undefined ? - 1 : index;
+
+		var mConvexHull = new Ammo.btConvexHullShape();
+
+		var v0 = new Ammo.btVector3( 0, 0, 0 );
+
+		var vertex = geometry.getAttribute( 'position' ).array;
+		var indexes = geometry.getIndex().array;
+
+		var group = index >= 0 ? geometry.groups[ index ] : undefined,
+			start = group ? group.start : 0,
+			count = group ? group.count : indexes.length;
+
+		var scale = 1 / this.worldScale;
+
+		for ( var idx = start; idx < count; idx += 3 ) {
+
+			var vx1 = indexes[ idx ] * 3;
+
+			var point = new Ammo.btVector3(
+				vertex[ vx1 ] * scale, vertex[ vx1 + 1 ] * scale, vertex[ vx1 + 2 ] * scale
+			);
+
+			mConvexHull.addPoint( point );
+
+		}
+
+		return mConvexHull;
+
+	},
+
+	getTargetByRigidBody: function ( rb ) {
+
+		return this.rigidBodiesTarget[ this.rigidBodies.indexOf( rb ) ];
+
+	},
+	getRigidBodyByTarget: function ( target ) {
+
+		return this.rigidBodies[ this.rigidBodiesTarget.indexOf( target ) ];
+
+	},
+	getTransformFromMatrix: function ( mtx ) {
+
+		var transform = new Ammo.btTransform();
+
+		var pos = THREE.SEA3D.VECBUF.setFromMatrixPosition( mtx );
+		transform.setOrigin( new Ammo.btVector3( pos.x, pos.y, pos.z ) );
+
+		var scl = THREE.SEA3D.VECBUF.setFromMatrixScale( mtx );
+		mtx.scale( scl.set( 1 / scl.x, 1 / scl.y, 1 / scl.z ) );
+
+		var quat = new THREE.Quaternion().setFromRotationMatrix( mtx );
+
+		var q = new Ammo.btQuaternion();
+		q.setValue( quat.x, quat.y, quat.z, quat.w );
+		transform.setRotation( q );
+
+		Ammo.destroy( q );
+
+		return transform;
+
+	},
+	getMatrixFromTransform: function ( transform ) {
+
+		var position = new THREE.Vector3();
+		var quaternion = new THREE.Quaternion();
+		var scale = new THREE.Vector3( 1, 1, 1 );
+
+		return function ( transform, matrix ) {
+
+			matrix = matrix || new THREE.Matrix4();
+
+			var pos = transform.getOrigin(),
+				quat = transform.getRotation();
+
+			position.set( pos.x(), pos.y(), pos.z() );
+			quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
+
+			matrix.compose( position, quaternion, scale );
+
+			return matrix;
+
+		};
+
+	}(),
+
+	updateTargetTransform: function () {
+
+		var matrix = new THREE.Matrix4();
+
+		var position = new THREE.Vector3();
+		var quaternion = new THREE.Quaternion();
+		var scale = new THREE.Vector3( 1, 1, 1 );
+
+		return function ( obj3d, transform, offset ) {
+
+			var pos = transform.getOrigin(),
+				quat = transform.getRotation();
+
+			if ( offset == undefined ) {
+
+				obj3d.position.set( pos.x(), pos.y(), pos.z() );
+				obj3d.quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
+
+			} else {
+
+				position.set( pos.x(), pos.y(), pos.z() );
+				quaternion.set( quat.x(), quat.y(), quat.z(), quat.w() );
+
+				matrix.compose( position, quaternion, scale );
+
+				matrix.multiplyMatrices( matrix, offset );
+
+				obj3d.position.setFromMatrixPosition( matrix );
+				obj3d.quaternion.setFromRotationMatrix( matrix );
+
+			}
+
+			return this;
+
+		};
+
+	}(),
+	update: function ( delta, iteration, fixedDelta ) {
+
+		this.world.stepSimulation( delta, iteration || 0, fixedDelta || ( 60 / 1000 ) );
+
+		var i, j;
+
+		for ( i = 0; i < this.vehicles.length; i ++ ) {
+
+			var vehicle = this.vehicles[ i ],
+				numWheels = vehicle.getNumWheels(),
+				wheels = this.vehiclesWheels[ i ];
+
+			for ( j = 0; j < numWheels; j ++ ) {
+
+				vehicle.updateWheelTransform( j, true );
+
+				var wheelsTransform = vehicle.getWheelTransformWS( j ),
+					wheelTarget = wheels[ j ];
+
+				if ( wheelTarget ) {
+
+					this.updateTargetTransform( wheelTarget, wheelsTransform );
+
+				}
+
+			}
+
+		}
+
+		for ( i = 0; i < this.rigidBodies.length; i ++ ) {
+
+			var rb = this.rigidBodies[ i ],
+				target = this.rigidBodiesTarget[ i ],
+				offset = this.rigidBodiesOffset[ i ];
+
+			if ( target && rb.isActive() ) {
+
+				this.updateTargetTransform( target, rb.getWorldTransform(), offset );
+
+			}
+
+		}
+
+		return this;
+
+	}
+};

+ 557 - 0
examples/js/loaders/sea3d/physics/SEA3DAmmoLoader.js

@@ -0,0 +1,557 @@
+/**
+ * 	SEA3D+AMMO for Three.JS
+ * 	@author Sunag / http://www.sunag.com.br/
+ */
+
+'use strict';
+
+THREE.SEA3D.prototype.toAmmoVec3 = function ( v ) {
+
+	return new Ammo.btVector3( v.x, v.y, v.z );
+
+};
+
+//
+//	Sphere
+//
+
+THREE.SEA3D.prototype.readSphere = function ( sea ) {
+
+	var shape = new Ammo.btSphereShape( sea.radius );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Box
+//
+
+THREE.SEA3D.prototype.readBox = function ( sea ) {
+
+	var shape = new Ammo.btBoxShape( new Ammo.btVector3( sea.width * .5, sea.height * .5, sea.depth * .5 ) );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Cone
+//
+
+THREE.SEA3D.prototype.readCone = function ( sea ) {
+
+	var shape = new Ammo.btConeShape( sea.radius, sea.height );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Cylinder
+//
+
+THREE.SEA3D.prototype.readCylinder = function ( sea ) {
+
+	var shape = new Ammo.btCylinderShape( new Ammo.btVector3( sea.height, sea.radius, sea.radius ) );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Capsule
+//
+
+THREE.SEA3D.prototype.readCapsule = function ( sea ) {
+
+	var shape = new Ammo.btCapsuleShape( sea.radius, sea.height );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Convex Geometry
+//
+
+THREE.SEA3D.prototype.readConvexGeometry = function ( sea ) {
+
+	if ( this.config.convexHull ) {
+
+		var shape = SEA3D.AMMO.createConvexHull( sea.geometry.tag, sea.subGeometryIndex );
+
+	} else {
+
+		var triMesh = SEA3D.AMMO.createTriangleMesh( sea.geometry.tag, sea.subGeometryIndex );
+
+		var shape = new Ammo.btConvexTriangleMeshShape( triMesh, true );
+
+	}
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Triangle Geometry
+//
+
+THREE.SEA3D.prototype.readTriangleGeometry = function ( sea ) {
+
+	var triMesh = SEA3D.AMMO.createTriangleMesh( sea.geometry.tag, sea.subGeometryIndex );
+
+	var shape = new Ammo.btBvhTriangleMeshShape( triMesh, true, true );
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Compound
+//
+
+THREE.SEA3D.prototype.readCompound = function ( sea ) {
+
+	var shape = new Ammo.btCompoundShape();
+
+	for ( var i = 0; i < sea.compounds.length; i ++ ) {
+
+		var compound = sea.compounds[ i ];
+
+		THREE.SEA3D.MTXBUF.elements = compound.transform;
+
+		var transform = SEA3D.AMMO.getTransformFromMatrix( THREE.SEA3D.MTXBUF );
+
+		shape.addChildShape( transform, compound.shape.tag );
+
+	}
+
+	this.domain.shapes = this.shapes = this.shapes || [];
+	this.shapes.push( this.objects[ "shpe/" + sea.name ] = sea.tag = shape );
+
+};
+
+//
+//	Rigid Body Base
+//
+
+THREE.SEA3D.prototype.readRigidBodyBase = function ( sea ) {
+
+	var shape = sea.shape.tag,
+		transform;
+
+	if ( sea.target ) {
+
+		transform = SEA3D.AMMO.getTransformFromMatrix( sea.target.tag.matrix );
+
+	} else {
+
+		THREE.SEA3D.MTXBUF.elements.set( sea.transform );
+
+		transform = SEA3D.AMMO.getTransformFromMatrix( THREE.SEA3D.MTXBUF );
+
+	}
+
+	var motionState = new Ammo.btDefaultMotionState( transform );
+	var localInertia = new Ammo.btVector3( 0, 0, 0 );
+
+	shape.calculateLocalInertia( sea.mass, localInertia );
+
+	var info = new Ammo.btRigidBodyConstructionInfo( sea.mass, motionState, shape, localInertia );
+	info.set_m_friction( sea.friction );
+	info.set_m_restitution( sea.restitution );
+	info.set_m_linearDamping( sea.linearDamping );
+	info.set_m_angularDamping( sea.angularDamping );
+
+	var rb = new Ammo.btRigidBody( info );
+
+	this.domain.rigidBodies = this.rigidBodies = this.rigidBodies || [];
+	this.rigidBodies.push( this.objects[ "rb/" + sea.name ] = sea.tag = rb );
+
+	return rb;
+
+};
+
+//
+//	Rigid Body
+//
+
+THREE.SEA3D.prototype.readRigidBody = function ( sea ) {
+
+	var rb = this.readRigidBodyBase( sea );
+
+	SEA3D.AMMO.addRigidBody( rb, sea.target ? sea.target.tag : undefined, sea.offset ? new THREE.Matrix4().elements.set( sea.offset ) : undefined, this.config.enabledPhysics );
+
+};
+
+//
+//	Car Controller
+//
+
+THREE.SEA3D.prototype.readCarController = function ( sea ) {
+
+	var body = this.readRigidBodyBase( sea );
+
+	body.setActivationState( SEA3D.AMMO.DISABLE_DEACTIVATION );
+
+	// Car
+
+	var vehicleRayCaster = new Ammo.btDefaultVehicleRaycaster( SEA3D.AMMO.world );
+
+	var tuning = new Ammo.btVehicleTuning();
+
+	tuning.set_m_suspensionStiffness( sea.suspensionStiffness );
+	tuning.set_m_suspensionDamping( sea.suspensionDamping );
+	tuning.set_m_suspensionCompression( sea.suspensionCompression );
+	tuning.set_m_maxSuspensionTravelCm( sea.maxSuspensionTravelCm );
+	tuning.set_m_maxSuspensionForce( sea.maxSuspensionForce );
+	tuning.set_m_frictionSlip( sea.frictionSlip );
+
+	var vehicle = new Ammo.btRaycastVehicle( tuning, body, vehicleRayCaster ),
+		wheels = [];
+
+	vehicle.setCoordinateSystem( 0, 1, 2 );
+
+	for ( var i = 0; i < sea.wheel.length; i ++ ) {
+
+		var wheel = sea.wheel[ i ];
+
+		var wheelInfo = vehicle.addWheel(
+			this.toAmmoVec3( wheel.pos ),
+			this.toAmmoVec3( wheel.dir ),
+			this.toAmmoVec3( wheel.axle ),
+			wheel.suspensionRestLength,
+			wheel.radius,
+			tuning,
+			wheel.isFront
+		);
+
+		var target = wheels[ i ] = wheel.target ? wheel.target.tag : undefined;
+
+		if ( target ) {
+
+			if ( target.parent ) {
+
+				target.parent.remove( target );
+
+			}
+
+			if ( this.container ) {
+
+				this.container.add( target );
+
+			}
+
+		}
+
+		wheelInfo.set_m_suspensionStiffness( sea.suspensionStiffness );
+		wheelInfo.set_m_wheelsDampingRelaxation( sea.dampingRelaxation );
+		wheelInfo.set_m_wheelsDampingCompression( sea.dampingCompression );
+		wheelInfo.set_m_frictionSlip( sea.frictionSlip );
+
+	}
+
+	SEA3D.AMMO.addVehicle( vehicle, wheels );
+	SEA3D.AMMO.addRigidBody( body, sea.target ? sea.target.tag : undefined, sea.offset ? new THREE.Matrix4().elements.set( sea.offset ) : undefined, this.config.enabledPhysics );
+
+	this.domain.vehicles = this.vehicles = this.vehicles || [];
+	this.vehicles.push( this.objects[ "vhc/" + sea.name ] = sea.tag = vehicle );
+
+};
+
+//
+//	P2P Constraint
+//
+
+THREE.SEA3D.prototype.readP2PConstraint = function ( sea ) {
+
+	var ctrt;
+
+	if ( sea.targetB ) {
+
+		ctrt = new Ammo.btPoint2PointConstraint(
+			sea.targetA.tag,
+			sea.targetB.tag,
+			this.toAmmoVec3( sea.pointA ),
+			this.toAmmoVec3( sea.pointB )
+		);
+
+	} else {
+
+		ctrt = new Ammo.btPoint2PointConstraint(
+			sea.targetA.tag,
+			this.toAmmoVec3( sea.pointA )
+		);
+
+	}
+
+	SEA3D.AMMO.addConstraint( ctrt );
+
+	this.domain.constraints = this.constraints = this.constraints || [];
+	this.constraints.push( this.objects[ "ctnt/" + sea.name ] = sea.tag = ctrt );
+
+};
+
+//
+//	Hinge Constraint
+//
+
+THREE.SEA3D.prototype.readHingeConstraint = function ( sea ) {
+
+	var ctrt;
+
+	if ( sea.targetB ) {
+
+		ctrt = new Ammo.btHingeConstraint(
+			sea.targetA.tag,
+			sea.targetB.tag,
+			this.toAmmoVec3( sea.pointA ),
+			this.toAmmoVec3( sea.pointB ),
+			this.toAmmoVec3( sea.axisA ),
+			this.toAmmoVec3( sea.axisB ),
+			false
+		);
+
+	} else {
+
+		ctrt = new Ammo.btHingeConstraint(
+			sea.targetA.tag,
+			this.toAmmoVec3( sea.pointA ),
+			this.toAmmoVec3( sea.axisA ),
+			false
+		);
+
+	}
+
+	if ( sea.limit ) {
+
+		ctrt.setLimit( sea.limit.low, sea.limit.high, sea.limit.softness, sea.limit.biasFactor, sea.limit.relaxationFactor );
+
+	}
+
+	if ( sea.angularMotor ) {
+
+		ctrt.enableAngularMotor( true, sea.angularMotor.velocity, sea.angularMotor.impulse );
+
+	}
+
+	SEA3D.AMMO.addConstraint( ctrt );
+
+	this.domain.constraints = this.constraints = this.constraints || [];
+	this.constraints.push( this.objects[ "ctnt/" + sea.name ] = sea.tag = ctrt );
+
+};
+
+//
+//	Cone Twist Constraint
+//
+
+THREE.SEA3D.prototype.readConeTwistConstraint = function ( sea ) {
+
+	var ctrt;
+
+	if ( sea.targetB ) {
+
+		ctrt = new Ammo.btConeTwistConstraint(
+			sea.targetA.tag,
+			sea.targetB.tag,
+			this.toAmmoVec3( sea.pointA ),
+			this.toAmmoVec3( sea.pointB ),
+			false
+		);
+
+	} else {
+
+		ctrt = new Ammo.btConeTwistConstraint(
+			sea.targetA.tag,
+			this.toAmmoVec3( sea.pointA ),
+			false
+		);
+
+	}
+
+	SEA3D.AMMO.addConstraint( ctrt );
+
+	this.domain.constraints = this.constraints = this.constraints || [];
+	this.constraints.push( this.objects[ "ctnt/" + sea.name ] = sea.tag = ctrt );
+
+};
+
+//
+//	Domain
+//
+
+THREE.SEA3D.Domain.prototype.enabledPhysics = function ( enabled ) {
+
+	var i = this.rigidBodies ? this.rigidBodies.length : 0;
+
+	while ( i -- ) {
+
+		SEA3D.AMMO.setEnabledRigidBody( this.rigidBodies[ i ], enabled );
+
+	}
+
+};
+
+THREE.SEA3D.Domain.prototype.applyContainerTransform = function () {
+
+	this.container.updateMatrix();
+
+	var matrix = this.container.matrix.clone();
+
+	this.container.position.set( 0, 0, 0 );
+	this.container.rotation.set( 0, 0, 0 );
+	this.container.scale.set( 1, 1, 1 );
+
+	this.applyTransform( matrix );
+
+};
+
+THREE.SEA3D.Domain.prototype.applyTransform = function ( matrix ) {
+
+	var mtx = THREE.SEA3D.MTXBUF, vec = THREE.SEA3D.VECBUF;
+
+	var i = this.rigidBodies ? this.rigidBodies.length : 0,
+		childs = this.container ? this.container.children : [],
+		targets = [];
+
+	while ( i -- ) {
+
+		var rb = this.rigidBodies[ i ],
+			target = SEA3D.AMMO.getTargetByRigidBody( rb ),
+			transform = rb.getWorldTransform(),
+			transformMatrix = SEA3D.AMMO.getMatrixFromTransform( transform );
+
+		transformMatrix.multiplyMatrices( transformMatrix, matrix );
+
+		transform = SEA3D.AMMO.getTransformFromMatrix( transformMatrix );
+
+		rb.setWorldTransform( transform );
+
+		if ( target ) targets.push( target );
+
+	}
+
+	for ( i = 0; i < childs.length; i ++ ) {
+
+		var obj3d = childs[ i ];
+
+		if ( targets.indexOf( obj3d ) > - 1 ) continue;
+
+		obj3d.updateMatrix();
+
+		mtx.copy( obj3d.matrix );
+
+		mtx.multiplyMatrices( matrix, mtx );
+
+		obj3d.position.setFromMatrixPosition( mtx );
+		obj3d.scale.setFromMatrixScale( mtx );
+
+		// ignore rotation scale
+
+		mtx.scale( vec.set( 1 / obj3d.scale.x, 1 / obj3d.scale.y, 1 / obj3d.scale.z ) );
+		obj3d.rotation.setFromRotationMatrix( mtx );
+
+	}
+
+};
+
+//
+//	Extension
+//
+
+THREE.SEA3D.Domain.prototype.getShape = THREE.SEA3D.prototype.getShape = function ( name ) {
+
+	return this.objects[ "shpe/" + name ];
+
+};
+
+THREE.SEA3D.Domain.prototype.getRigidBody = THREE.SEA3D.prototype.getRigidBody = function ( name ) {
+
+	return this.objects[ "rb/" + name ];
+
+};
+
+THREE.SEA3D.Domain.prototype.getConstraint = THREE.SEA3D.prototype.getConstraint = function ( name ) {
+
+	return this.objects[ "ctnt/" + name ];
+
+};
+
+THREE.SEA3D.EXTENSIONS_LOADER.push( {
+
+	parse: function () {
+
+		delete this.shapes;
+		delete this.rigidBodies;
+		delete this.vehicles;
+		delete this.constraints;
+
+	},
+
+	setTypeRead: function () {
+
+		// CONFIG
+
+		this.config.physics = this.config.physics !== undefined ? this.config.physics : true;
+		this.config.convexHull = this.config.convexHull !== undefined ? this.config.convexHull : true;
+		this.config.enabledPhysics = this.config.enabledPhysics !== undefined ? this.config.enabledPhysics : true;
+
+		if ( this.config.physics ) {
+
+			// SHAPES
+
+			this.file.typeRead[ SEA3D.Sphere.prototype.type ] = this.readSphere;
+			this.file.typeRead[ SEA3D.Box.prototype.type ] = this.readBox;
+			this.file.typeRead[ SEA3D.Capsule.prototype.type ] = this.readCapsule;
+			this.file.typeRead[ SEA3D.Cone.prototype.type ] = this.readCone;
+			this.file.typeRead[ SEA3D.Cylinder.prototype.type ] = this.readCylinder;
+			this.file.typeRead[ SEA3D.ConvexGeometry.prototype.type ] = this.readConvexGeometry;
+			this.file.typeRead[ SEA3D.TriangleGeometry.prototype.type ] = this.readTriangleGeometry;
+			this.file.typeRead[ SEA3D.Compound.prototype.type ] = this.readCompound;
+
+			// CONSTRAINTS
+
+			this.file.typeRead[ SEA3D.P2PConstraint.prototype.type ] = this.readP2PConstraint;
+			this.file.typeRead[ SEA3D.HingeConstraint.prototype.type ] = this.readHingeConstraint;
+			this.file.typeRead[ SEA3D.ConeTwistConstraint.prototype.type ] = this.readConeTwistConstraint;
+
+			// PHYSICS
+
+			this.file.typeRead[ SEA3D.RigidBody.prototype.type ] = this.readRigidBody;
+			this.file.typeRead[ SEA3D.CarController.prototype.type ] = this.readCarController;
+
+		}
+
+	}
+} );
+
+THREE.SEA3D.EXTENSIONS_DOMAIN.push( {
+
+	dispose: function () {
+
+		var i;
+
+		i = this.rigidBodies ? this.rigidBodies.length : 0;
+		while ( i -- ) SEA3D.AMMO.removeRigidBody( this.rigidBodies[ i ], true );
+
+		i = this.vehicles ? this.vehicles.length : 0;
+		while ( i -- ) SEA3D.AMMO.removeVehicle( this.vehicles[ i ], true );
+
+		i = this.constraints ? this.constraints.length : 0;
+		while ( i -- ) SEA3D.AMMO.removeConstraint( this.constraints[ i ], true );
+
+		i = this.shapes ? this.shapes.length : 0;
+		while ( i -- ) Ammo.destroy( this.shapes[ i ] );
+
+	}
+
+} );

+ 426 - 0
examples/js/loaders/sea3d/physics/SEA3DRigidBody.js

@@ -0,0 +1,426 @@
+/**
+ * 	SEA3D - Rigid Body
+ * 	@author Sunag / http://www.sunag.com.br/
+ */
+
+'use strict';
+
+//
+//	Sphere
+//
+
+SEA3D.Sphere = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.radius = data.readFloat();
+
+};
+
+SEA3D.Sphere.prototype.type = "sph";
+
+//
+//	Box
+//
+
+SEA3D.Box = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.width = data.readFloat();
+	this.height = data.readFloat();
+	this.depth = data.readFloat();
+
+};
+
+SEA3D.Box.prototype.type = "box";
+
+//
+//	Cone
+//
+
+SEA3D.Cone = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.radius = data.readFloat();
+	this.height = data.readFloat();
+
+};
+
+SEA3D.Cone.prototype.type = "cone";
+
+//
+//	Capsule
+//
+
+SEA3D.Capsule = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.radius = data.readFloat();
+	this.height = data.readFloat();
+
+};
+
+SEA3D.Capsule.prototype.type = "cap";
+
+//
+//	Cylinder
+//
+
+SEA3D.Cylinder = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.radius = data.readFloat();
+	this.height = data.readFloat();
+
+};
+
+SEA3D.Cylinder.prototype.type = "cyl";
+
+//
+//	Convex Geometry
+//
+
+SEA3D.ConvexGeometry = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.geometry = sea3d.getObject( data.readUInt() );
+	this.subGeometryIndex = data.readUByte();
+
+};
+
+SEA3D.ConvexGeometry.prototype.type = "gs";
+
+//
+//	Triangle Geometry
+//
+
+SEA3D.TriangleGeometry = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.geometry = sea3d.getObject( data.readUInt() );
+	this.subGeometryIndex = data.readUByte();
+
+};
+
+SEA3D.TriangleGeometry.prototype.type = "sgs";
+
+//
+//	Compound
+//
+
+SEA3D.Compound = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.compounds = [];
+
+	var count = data.readUByte();
+
+	for ( var i = 0; i < count; i ++ ) {
+
+		this.compounds.push( {
+			shape: sea3d.getObject( data.readUInt() ),
+			transform: data.readMatrix()
+		} );
+
+	}
+
+};
+
+SEA3D.Compound.prototype.type = "cmps";
+
+//
+//	Physics
+//
+
+SEA3D.Physics = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.attrib = data.readUShort();
+
+	this.shape = sea3d.getObject( data.readUInt() );
+
+	if ( this.attrib & 1 ) this.target = sea3d.getObject( data.readUInt() );
+	else this.transform = data.readMatrix();
+
+};
+
+SEA3D.Physics.prototype.readTag = function ( kind, data, size ) {
+
+};
+
+//
+//	Rigidy Body Base
+//
+
+SEA3D.RigidBodyBase = function ( name, data, sea3d ) {
+
+	SEA3D.Physics.call( this, name, data, sea3d );
+
+	if ( this.attrib & 32 ) {
+
+		this.linearDamping = data.readFloat();
+		this.angularDamping = data.readFloat();
+
+	} else {
+
+		this.linearDamping = 0;
+		this.angularDamping = 0;
+
+	}
+
+	this.mass = data.readFloat();
+	this.friction = data.readFloat();
+	this.restitution = data.readFloat();
+
+};
+
+SEA3D.RigidBodyBase.prototype = Object.create( SEA3D.Physics.prototype );
+SEA3D.RigidBodyBase.prototype.constructor = SEA3D.RigidBodyBase;
+
+//
+//	Rigidy Body
+//
+
+SEA3D.RigidBody = function ( name, data, sea3d ) {
+
+	SEA3D.RigidBodyBase.call( this, name, data, sea3d );
+
+	data.readTags( this.readTag.bind( this ) );
+
+};
+
+SEA3D.RigidBody.prototype = Object.create( SEA3D.RigidBodyBase.prototype );
+SEA3D.RigidBody.prototype.constructor = SEA3D.RigidBody;
+
+SEA3D.RigidBody.prototype.type = "rb";
+
+//
+//	Car Controller
+//
+
+SEA3D.CarController = function ( name, data, sea3d ) {
+
+	SEA3D.RigidBodyBase.call( this, name, data, sea3d );
+
+	this.suspensionStiffness = data.readFloat();
+	this.suspensionCompression = data.readFloat();
+	this.suspensionDamping = data.readFloat();
+	this.maxSuspensionTravelCm = data.readFloat();
+	this.frictionSlip = data.readFloat();
+	this.maxSuspensionForce = data.readFloat();
+
+	this.dampingCompression = data.readFloat();
+	this.dampingRelaxation = data.readFloat();
+
+	var count = data.readUByte();
+
+	this.wheel = [];
+
+	for ( var i = 0; i < count; i ++ ) {
+
+		this.wheel[ i ] = new SEA3D.CarController.Wheel( data, sea3d );
+
+	}
+
+	data.readTags( this.readTag.bind( this ) );
+
+};
+
+SEA3D.CarController.Wheel = function ( data, sea3d ) {
+
+	this.data = data;
+	this.sea3d = sea3d;
+
+	var attrib = data.readUShort();
+
+	this.isFront = ( attrib & 1 ) != 0,
+
+	this.target = sea3d.getObject( data.readUInt() );
+
+	this.pos = data.readVector3();
+	this.dir = data.readVector3();
+	this.axle = data.readVector3();
+
+	this.radius = data.readFloat();
+	this.suspensionRestLength = data.readFloat();
+
+};
+
+SEA3D.CarController.prototype = Object.create( SEA3D.RigidBodyBase.prototype );
+SEA3D.CarController.prototype.constructor = SEA3D.CarController;
+
+SEA3D.CarController.prototype.type = "carc";
+
+//
+//	Constraints
+//
+
+SEA3D.Constraints = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	this.attrib = data.readUShort();
+
+	this.disableCollisionsBetweenBodies = this.attrib & 1 != 0;
+
+	this.targetA = sea3d.getObject( data.readUInt() );
+	this.pointA = data.readVector3();
+
+	if ( this.attrib & 2 ) {
+
+		this.targetB = sea3d.getObject( data.readUInt() );
+		this.pointB = data.readVector3();
+
+	}
+
+};
+
+//
+//	P2P Constraint
+//
+
+SEA3D.P2PConstraint = function ( name, data, sea3d ) {
+
+	this.name = name;
+	this.data = data;
+	this.sea3d = sea3d;
+
+	SEA3D.Constraints.call( this, name, data, sea3d );
+
+};
+
+SEA3D.P2PConstraint.prototype = Object.create( SEA3D.Constraints.prototype );
+SEA3D.P2PConstraint.prototype.constructor = SEA3D.P2PConstraint;
+
+SEA3D.P2PConstraint.prototype.type = "p2pc";
+
+//
+//	Hinge Constraint
+//
+
+SEA3D.HingeConstraint = function ( name, data, sea3d ) {
+
+	SEA3D.Constraints.call( this, name, data, sea3d );
+
+	this.axisA = data.readVector3();
+
+	if ( this.attrib & 1 ) {
+
+		this.axisB = data.readVector3();
+
+	}
+
+	if ( this.attrib & 4 ) {
+
+		this.limit = {
+			low: data.readFloat(),
+			high: data.readFloat(),
+			softness: data.readFloat(),
+			biasFactor: data.readFloat(),
+			relaxationFactor: data.readFloat()
+		};
+
+	}
+
+	if ( this.attrib & 8 ) {
+
+		this.angularMotor = {
+			velocity: data.readFloat(),
+			impulse: data.readFloat()
+		};
+
+	}
+
+};
+
+SEA3D.HingeConstraint.prototype = Object.create( SEA3D.Constraints.prototype );
+SEA3D.HingeConstraint.prototype.constructor = SEA3D.HingeConstraint;
+
+SEA3D.HingeConstraint.prototype.type = "hnec";
+
+//
+//	Cone Twist Constraint
+//
+
+SEA3D.ConeTwistConstraint = function ( name, data, sea3d ) {
+
+	SEA3D.Constraints.call( this, name, data, sea3d );
+
+	this.axisA = data.readVector3();
+
+	if ( this.attrib & 1 ) {
+
+		this.axisB = data.readVector3();
+
+	}
+
+	if ( this.attrib & 4 ) {
+
+		this.limit = {
+			swingSpan1: data.readFloat(),
+			swingSpan2: data.readFloat(),
+			twistSpan: data.readFloat(),
+			softness: data.readFloat(),
+			biasFactor: data.readFloat(),
+			relaxationFactor: data.readFloat()
+		};
+
+	}
+
+};
+
+SEA3D.ConeTwistConstraint.prototype = Object.create( SEA3D.Constraints.prototype );
+SEA3D.ConeTwistConstraint.prototype.constructor = SEA3D.ConeTwistConstraint;
+
+SEA3D.ConeTwistConstraint.prototype.type = "ctwc";
+
+//
+//	Extension
+//
+
+SEA3D.File.setExtension( function () {
+
+	// PHYSICS
+	this.addClass( SEA3D.Sphere );
+	this.addClass( SEA3D.Box );
+	this.addClass( SEA3D.Cone );
+	this.addClass( SEA3D.Capsule );
+	this.addClass( SEA3D.Cylinder );
+	this.addClass( SEA3D.ConvexGeometry );
+	this.addClass( SEA3D.TriangleGeometry );
+	this.addClass( SEA3D.Compound );
+	this.addClass( SEA3D.RigidBody );
+	this.addClass( SEA3D.P2PConstraint );
+	this.addClass( SEA3D.HingeConstraint );
+	this.addClass( SEA3D.ConeTwistConstraint );
+	this.addClass( SEA3D.CarController );
+
+} );

+ 16 - 11
examples/js/nodes/NodeMaterial.js

@@ -82,7 +82,9 @@ THREE.NodeMaterial.prototype.build = function() {
 	this.uniforms = {};
 	this.uniforms = {};
 	this.attributes = {};
 	this.attributes = {};
 
 
-	this.nodeData = {};
+	this.extensions = {};
+
+	this.nodeData = {};	
 
 
 	this.vertexUniform = [];
 	this.vertexUniform = [];
 	this.fragmentUniform = [];
 	this.fragmentUniform = [];
@@ -115,21 +117,24 @@ THREE.NodeMaterial.prototype.build = function() {
 	this.prefixCode = [
 	this.prefixCode = [
 	"#ifdef GL_EXT_shader_texture_lod",
 	"#ifdef GL_EXT_shader_texture_lod",
 
 
-		"#define texCube(a, b) textureCube(a, b)",
-		"#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)",
+	"	#define texCube(a, b) textureCube(a, b)",
+	"	#define texCubeBias(a, b, c) textureCubeLodEXT(a, b, c)",
 
 
-		"#define tex2D(a, b) texture2D(a, b)",
-		"#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)",
+	"	#define tex2D(a, b) texture2D(a, b)",
+	"	#define tex2DBias(a, b, c) texture2DLodEXT(a, b, c)",
 
 
 	"#else",
 	"#else",
 
 
-		"#define texCube(a, b) textureCube(a, b)",
-		"#define texCubeBias(a, b, c) textureCube(a, b, c)",
+	"	#define texCube(a, b) textureCube(a, b)",
+	"	#define texCubeBias(a, b, c) textureCube(a, b, c)",
+
+	"	#define tex2D(a, b) texture2D(a, b)",
+	"	#define tex2DBias(a, b, c) texture2D(a, b, c)",
+
+	"#endif",
 
 
-		"#define tex2D(a, b) texture2D(a, b)",
-		"#define tex2DBias(a, b, c) texture2D(a, b, c)",
+	"#include <packing>"
 
 
-	"#endif"
 	].join( "\n" );
 	].join( "\n" );
 
 
 	var builder = new THREE.NodeBuilder( this );
 	var builder = new THREE.NodeBuilder( this );
@@ -212,7 +217,7 @@ THREE.NodeMaterial.prototype.build = function() {
 	}
 	}
 
 
 	this.lights = this.requestAttribs.light;
 	this.lights = this.requestAttribs.light;
-	this.transparent = this.requestAttribs.transparent || this.blendMode > THREE.NormalBlending;
+	this.transparent = this.requestAttribs.transparent || this.blending > THREE.NormalBlending;
 
 
 	this.vertexShader = [
 	this.vertexShader = [
 		this.prefixCode,
 		this.prefixCode,

+ 6 - 0
examples/js/nodes/TempNode.js

@@ -49,6 +49,12 @@ THREE.TempNode.prototype.build = function( builder, output, uuid, ns ) {
 
 
 			return THREE.GLNode.prototype.build.call( this, builder, output, uuid );
 			return THREE.GLNode.prototype.build.call( this, builder, output, uuid );
 
 
+		} else if ( isUnique ) {
+
+			data.name = data.name || THREE.GLNode.prototype.build.call( this, builder, output, uuid );
+
+			return data.name;
+
 		} else if ( ! builder.optimize || data.deps == 1 ) {
 		} else if ( ! builder.optimize || data.deps == 1 ) {
 
 
 			return THREE.GLNode.prototype.build.call( this, builder, output, uuid );
 			return THREE.GLNode.prototype.build.call( this, builder, output, uuid );

+ 11 - 15
examples/js/nodes/materials/PhongNode.js

@@ -32,7 +32,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		material.mergeUniform( Object.assign( {},
 		material.mergeUniform( Object.assign( {},
 
 
 			THREE.UniformsLib[ "fog" ],
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ]
 			THREE.UniformsLib[ "lights" ]
 
 
 		) );
 		) );
@@ -93,8 +92,7 @@ THREE.PhongNode.prototype.build = function( builder ) {
 
 
 		code = output.join( "\n" );
 		code = output.join( "\n" );
 
 
-	}
-	else {
+	} else {
 
 
 		// parse all nodes to reuse generate codes
 		// parse all nodes to reuse generate codes
 
 
@@ -103,7 +101,10 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		this.shininess.parse( builder );
 		this.shininess.parse( builder );
 
 
 		if ( this.alpha ) this.alpha.parse( builder );
 		if ( this.alpha ) this.alpha.parse( builder );
-
+		
+		if ( this.normal ) this.normal.parse( builder );
+		if ( this.normalScale && this.normal ) this.normalScale.parse( builder );
+		
 		if ( this.light ) this.light.parse( builder, { cache : 'light' } );
 		if ( this.light ) this.light.parse( builder, { cache : 'light' } );
 
 
 		if ( this.ao ) this.ao.parse( builder );
 		if ( this.ao ) this.ao.parse( builder );
@@ -111,9 +112,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		if ( this.shadow ) this.shadow.parse( builder );
 		if ( this.shadow ) this.shadow.parse( builder );
 		if ( this.emissive ) this.emissive.parse( builder, { slot : 'emissive' } );
 		if ( this.emissive ) this.emissive.parse( builder, { slot : 'emissive' } );
 
 
-		if ( this.normal ) this.normal.parse( builder );
-		if ( this.normalScale && this.normal ) this.normalScale.parse( builder );
-
 		if ( this.environment ) this.environment.parse( builder, { slot : 'environment' } );
 		if ( this.environment ) this.environment.parse( builder, { slot : 'environment' } );
 		if ( this.environmentAlpha && this.environment ) this.environmentAlpha.parse( builder );
 		if ( this.environmentAlpha && this.environment ) this.environmentAlpha.parse( builder );
 
 
@@ -124,7 +122,10 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		var shininess = this.shininess.buildCode( builder, 'fv1' );
 		var shininess = this.shininess.buildCode( builder, 'fv1' );
 
 
 		var alpha = this.alpha ? this.alpha.buildCode( builder, 'fv1' ) : undefined;
 		var alpha = this.alpha ? this.alpha.buildCode( builder, 'fv1' ) : undefined;
-
+		
+		var normal = this.normal ? this.normal.buildCode( builder, 'v3' ) : undefined;
+		var normalScale = this.normalScale && this.normal ? this.normalScale.buildCode( builder, 'v2' ) : undefined;
+		
 		var light = this.light ? this.light.buildCode( builder, 'v3', { cache : 'light' } ) : undefined;
 		var light = this.light ? this.light.buildCode( builder, 'v3', { cache : 'light' } ) : undefined;
 
 
 		var ao = this.ao ? this.ao.buildCode( builder, 'fv1' ) : undefined;
 		var ao = this.ao ? this.ao.buildCode( builder, 'fv1' ) : undefined;
@@ -132,9 +133,6 @@ THREE.PhongNode.prototype.build = function( builder ) {
 		var shadow = this.shadow ? this.shadow.buildCode( builder, 'c' ) : undefined;
 		var shadow = this.shadow ? this.shadow.buildCode( builder, 'c' ) : undefined;
 		var emissive = this.emissive ? this.emissive.buildCode( builder, 'c', { slot : 'emissive' } ) : undefined;
 		var emissive = this.emissive ? this.emissive.buildCode( builder, 'c', { slot : 'emissive' } ) : undefined;
 
 
-		var normal = this.normal ? this.normal.buildCode( builder, 'v3' ) : undefined;
-		var normalScale = this.normalScale && this.normal ? this.normalScale.buildCode( builder, 'v2' ) : undefined;
-
 		var environment = this.environment ? this.environment.buildCode( builder, 'c', { slot : 'environment' } ) : undefined;
 		var environment = this.environment ? this.environment.buildCode( builder, 'c', { slot : 'environment' } ) : undefined;
 		var environmentAlpha = this.environmentAlpha && this.environment ? this.environmentAlpha.buildCode( builder, 'fv1' ) : undefined;
 		var environmentAlpha = this.environmentAlpha && this.environment ? this.environmentAlpha.buildCode( builder, 'fv1' ) : undefined;
 
 
@@ -278,8 +276,7 @@ THREE.PhongNode.prototype.build = function( builder ) {
 					"outgoingLight = mix( outgoingLight, " + environment.result + ", " + environmentAlpha.result + " );"
 					"outgoingLight = mix( outgoingLight, " + environment.result + ", " + environmentAlpha.result + " );"
 				);
 				);
 
 
-			}
-			else {
+			} else {
 
 
 				output.push( "outgoingLight = " + environment.result + ";" );
 				output.push( "outgoingLight = " + environment.result + ";" );
 
 
@@ -291,8 +288,7 @@ THREE.PhongNode.prototype.build = function( builder ) {
 
 
 			output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
 			output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
 
 
-		}
-		else {
+		} else {
 
 
 			output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
 			output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
 
 

+ 87 - 36
examples/js/nodes/materials/StandardNode.js

@@ -20,12 +20,16 @@ THREE.StandardNode.prototype.build = function( builder ) {
 	var material = builder.material;
 	var material = builder.material;
 	var code;
 	var code;
 
 
-	material.define( 'STANDARD' );
 	material.define( 'PHYSICAL' );
 	material.define( 'PHYSICAL' );
+
+	if ( !this.clearCoat && !this.clearCoatRoughness ) material.define( 'STANDARD' );
+
 	material.define( 'ALPHATEST', '0.0' );
 	material.define( 'ALPHATEST', '0.0' );
 
 
 	material.requestAttribs.light = true;
 	material.requestAttribs.light = true;
 
 
+	material.extensions.shaderTextureLOD = true;
+
 	if ( builder.isShader( 'vertex' ) ) {
 	if ( builder.isShader( 'vertex' ) ) {
 
 
 		var transform = this.transform ? this.transform.parseAndBuildCode( builder, 'v3', { cache : 'transform' } ) : undefined;
 		var transform = this.transform ? this.transform.parseAndBuildCode( builder, 'v3', { cache : 'transform' } ) : undefined;
@@ -33,7 +37,6 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		material.mergeUniform( Object.assign( {},
 		material.mergeUniform( Object.assign( {},
 
 
 			THREE.UniformsLib[ "fog" ],
 			THREE.UniformsLib[ "fog" ],
-			THREE.UniformsLib[ "ambient" ],
 			THREE.UniformsLib[ "lights" ]
 			THREE.UniformsLib[ "lights" ]
 
 
 		) );
 		) );
@@ -56,11 +59,11 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		].join( "\n" ) );
 		].join( "\n" ) );
 
 
 		var output = [
 		var output = [
-				THREE.ShaderChunk[ "beginnormal_vertex" ],
-				THREE.ShaderChunk[ "morphnormal_vertex" ],
-				THREE.ShaderChunk[ "skinbase_vertex" ],
-				THREE.ShaderChunk[ "skinnormal_vertex" ],
-				THREE.ShaderChunk[ "defaultnormal_vertex" ],
+			THREE.ShaderChunk[ "beginnormal_vertex" ],
+			THREE.ShaderChunk[ "morphnormal_vertex" ],
+			THREE.ShaderChunk[ "skinbase_vertex" ],
+			THREE.ShaderChunk[ "skinnormal_vertex" ],
+			THREE.ShaderChunk[ "defaultnormal_vertex" ],
 
 
 			"#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
 			"#ifndef FLAT_SHADED", // Normal computed with derivatives when FLAT_SHADED
 
 
@@ -68,7 +71,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
 
 
 			"#endif",
 			"#endif",
 
 
-				THREE.ShaderChunk[ "begin_vertex" ]
+			THREE.ShaderChunk[ "begin_vertex" ]
 		];
 		];
 
 
 		if ( transform ) {
 		if ( transform ) {
@@ -81,21 +84,20 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		}
 		}
 
 
 		output.push(
 		output.push(
-				THREE.ShaderChunk[ "morphtarget_vertex" ],
-				THREE.ShaderChunk[ "skinning_vertex" ],
-				THREE.ShaderChunk[ "project_vertex" ],
-				THREE.ShaderChunk[ "logdepthbuf_vertex" ],
+			THREE.ShaderChunk[ "morphtarget_vertex" ],
+			THREE.ShaderChunk[ "skinning_vertex" ],
+			THREE.ShaderChunk[ "project_vertex" ],
+			THREE.ShaderChunk[ "logdepthbuf_vertex" ],
 
 
 			"	vViewPosition = - mvPosition.xyz;",
 			"	vViewPosition = - mvPosition.xyz;",
 
 
-				THREE.ShaderChunk[ "worldpos_vertex" ],
-				THREE.ShaderChunk[ "shadowmap_vertex" ]
+			THREE.ShaderChunk[ "worldpos_vertex" ],
+			THREE.ShaderChunk[ "shadowmap_vertex" ]
 		);
 		);
 
 
 		code = output.join( "\n" );
 		code = output.join( "\n" );
 
 
-	}
-	else {
+	} else {
 
 
 		// blur textures for PBR effect
 		// blur textures for PBR effect
 
 
@@ -105,6 +107,8 @@ THREE.StandardNode.prototype.build = function( builder ) {
 			offsetV : 0
 			offsetV : 0
 		};
 		};
 
 
+		var useClearCoat = !material.isDefined( 'STANDARD' );
+		
 		// parse all nodes to reuse generate codes
 		// parse all nodes to reuse generate codes
 
 
 		this.color.parse( builder, { slot : 'color' } );
 		this.color.parse( builder, { slot : 'color' } );
@@ -112,6 +116,14 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		this.metalness.parse( builder );
 		this.metalness.parse( builder );
 
 
 		if ( this.alpha ) this.alpha.parse( builder );
 		if ( this.alpha ) this.alpha.parse( builder );
+		
+		if ( this.normal ) this.normal.parse( builder );
+		if ( this.normalScale && this.normal ) this.normalScale.parse( builder );
+		
+		if (this.clearCoat) this.clearCoat.parse( builder );
+		if (this.clearCoatRoughness) this.clearCoatRoughness.parse( builder );
+		
+		if ( this.reflectivity ) this.reflectivity.parse( builder );
 
 
 		if ( this.light ) this.light.parse( builder, { cache : 'light' } );
 		if ( this.light ) this.light.parse( builder, { cache : 'light' } );
 
 
@@ -120,9 +132,6 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		if ( this.shadow ) this.shadow.parse( builder );
 		if ( this.shadow ) this.shadow.parse( builder );
 		if ( this.emissive ) this.emissive.parse( builder, { slot : 'emissive' } );
 		if ( this.emissive ) this.emissive.parse( builder, { slot : 'emissive' } );
 
 
-		if ( this.normal ) this.normal.parse( builder );
-		if ( this.normalScale && this.normal ) this.normalScale.parse( builder );
-
 		if ( this.environment ) this.environment.parse( builder, { cache : 'env', requires : requires, slot : 'environment' } ); // isolate environment from others inputs ( see TextureNode, CubeTextureNode )
 		if ( this.environment ) this.environment.parse( builder, { cache : 'env', requires : requires, slot : 'environment' } ); // isolate environment from others inputs ( see TextureNode, CubeTextureNode )
 
 
 		// build code
 		// build code
@@ -131,9 +140,15 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		var roughness = this.roughness.buildCode( builder, 'fv1' );
 		var roughness = this.roughness.buildCode( builder, 'fv1' );
 		var metalness = this.metalness.buildCode( builder, 'fv1' );
 		var metalness = this.metalness.buildCode( builder, 'fv1' );
 
 
-		var reflectivity = this.reflectivity ? this.reflectivity.buildCode( builder, 'fv1' ) : undefined;
-
 		var alpha = this.alpha ? this.alpha.buildCode( builder, 'fv1' ) : undefined;
 		var alpha = this.alpha ? this.alpha.buildCode( builder, 'fv1' ) : undefined;
+		
+		var normal = this.normal ? this.normal.buildCode( builder, 'v3' ) : undefined;
+		var normalScale = this.normalScale && this.normal ? this.normalScale.buildCode( builder, 'v2' ) : undefined;
+		
+		var clearCoat = this.clearCoat ? this.clearCoat.buildCode( builder, 'fv1' ) : undefined;
+		var clearCoatRoughness = this.clearCoatRoughness ? this.clearCoatRoughness.buildCode( builder, 'fv1' ) : undefined;
+		
+		var reflectivity = this.reflectivity ? this.reflectivity.buildCode( builder, 'fv1' ) : undefined;
 
 
 		var light = this.light ? this.light.buildCode( builder, 'v3', { cache : 'light' } ) : undefined;
 		var light = this.light ? this.light.buildCode( builder, 'v3', { cache : 'light' } ) : undefined;
 
 
@@ -142,11 +157,10 @@ THREE.StandardNode.prototype.build = function( builder ) {
 		var shadow = this.shadow ? this.shadow.buildCode( builder, 'c' ) : undefined;
 		var shadow = this.shadow ? this.shadow.buildCode( builder, 'c' ) : undefined;
 		var emissive = this.emissive ? this.emissive.buildCode( builder, 'c', { slot : 'emissive' } ) : undefined;
 		var emissive = this.emissive ? this.emissive.buildCode( builder, 'c', { slot : 'emissive' } ) : undefined;
 
 
-		var normal = this.normal ? this.normal.buildCode( builder, 'v3' ) : undefined;
-		var normalScale = this.normalScale && this.normal ? this.normalScale.buildCode( builder, 'v2' ) : undefined;
-
 		var environment = this.environment ? this.environment.buildCode( builder, 'c', { cache : 'env', requires : requires, slot : 'environment' } ) : undefined;
 		var environment = this.environment ? this.environment.buildCode( builder, 'c', { cache : 'env', requires : requires, slot : 'environment' } ) : undefined;
 
 
+		var clearCoatEnv = useClearCoat && environment ? this.environment.buildCode( builder, 'c', { cache : 'clearCoat', requires : requires, slot : 'environment' } ) : undefined;
+
 		material.requestAttribs.transparent = alpha != undefined;
 		material.requestAttribs.transparent = alpha != undefined;
 
 
 		material.addFragmentPars( [
 		material.addFragmentPars( [
@@ -222,20 +236,46 @@ THREE.StandardNode.prototype.build = function( builder ) {
 
 
 		output.push(
 		output.push(
 			// accumulation
 			// accumulation
-			'material.specularRoughness = clamp( roughnessFactor, 0.04, 1.0 );' // disney's remapping of [ 0, 1 ] roughness to [ 0.001, 1 ]
+			'material.specularRoughness = clamp( roughnessFactor, DEFAULT_SPECULAR_COEFFICIENT, 1.0 );' // disney's remapping of [ 0, 1 ] roughness to [ 0.001, 1 ]
 		);
 		);
-
+		
+		if (clearCoat) {
+			
+			output.push(
+				clearCoat.code,
+				'material.clearCoat = saturate( ' + clearCoat.result + ' );'
+			);
+			
+		} else if (useClearCoat) {
+			
+			output.push( 'material.clearCoat = 0.0;' );
+			
+		}
+		
+		if (clearCoatRoughness) {
+			
+			output.push(
+				clearCoatRoughness.code,
+				'material.clearCoatRoughness = clamp( ' + clearCoatRoughness.result + ', DEFAULT_SPECULAR_COEFFICIENT, 1.0 );'
+			);
+			
+		} else if (useClearCoat) {
+			
+			output.push( 'material.clearCoatRoughness = 0.0;' );
+			
+		}
+		
 		if ( reflectivity ) {
 		if ( reflectivity ) {
 
 
 			output.push(
 			output.push(
-				'material.specularColor = mix( vec3( 0.16 * pow2( ' + reflectivity.builder( builder, 'fv1' ) + ' ) ), diffuseColor, metalnessFactor );'
+				reflectivity.code,
+				'material.specularColor = mix( vec3( MAXIMUM_SPECULAR_COEFFICIENT * pow2( ' + reflectivity.result + ' ) ), diffuseColor, metalnessFactor );'
 			);
 			);
 
 
-		}
-		else {
+		} else {
 
 
 			output.push(
 			output.push(
-				'material.specularColor = mix( vec3( 0.04 ), diffuseColor, metalnessFactor );'
+				'material.specularColor = mix( vec3( DEFAULT_SPECULAR_COEFFICIENT ), diffuseColor, metalnessFactor );'
 			);
 			);
 
 
 		}
 		}
@@ -303,10 +343,22 @@ THREE.StandardNode.prototype.build = function( builder ) {
 
 
 		if ( environment ) {
 		if ( environment ) {
 
 
-			output.push(
-				environment.code,
-				"RE_IndirectSpecular_Physical(" + environment.result + ", vec3( 0.0 ), geometry, material, reflectedLight );"
-			);
+			output.push( environment.code );
+
+			if (clearCoatEnv) {
+
+				output.push(
+					clearCoatEnv.code,
+					"vec3 clearCoatRadiance = " + clearCoatEnv.result + ";"
+				);
+
+			} else {
+
+				output.push("vec3 clearCoatRadiance = vec3( 0.0 );");
+
+			}
+
+			output.push( "RE_IndirectSpecular(" + environment.result + ", clearCoatRadiance, geometry, material, reflectedLight );" );
 
 
 		}
 		}
 
 
@@ -316,8 +368,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
 
 
 			output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
 			output.push( "gl_FragColor = vec4( outgoingLight, " + alpha.result + " );" );
 
 
-		}
-		else {
+		} else {
 
 
 			output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
 			output.push( "gl_FragColor = vec4( outgoingLight, 1.0 );" );
 
 

+ 1 - 1
examples/js/nodes/materials/StandardNodeMaterial.js

@@ -14,4 +14,4 @@ THREE.StandardNodeMaterial.prototype = Object.create( THREE.NodeMaterial.prototy
 THREE.StandardNodeMaterial.prototype.constructor = THREE.StandardNodeMaterial;
 THREE.StandardNodeMaterial.prototype.constructor = THREE.StandardNodeMaterial;
 
 
 THREE.NodeMaterial.addShortcuts( THREE.StandardNodeMaterial.prototype, 'node',
 THREE.NodeMaterial.addShortcuts( THREE.StandardNodeMaterial.prototype, 'node',
-[ 'color', 'alpha', 'roughness', 'metalness', 'normal', 'normalScale', 'emissive', 'ambient', 'light', 'shadow', 'ao', 'environment', 'transform' ] );
+[ 'color', 'alpha', 'roughness', 'metalness', 'reflectivity', 'clearCoat', 'clearCoatRoughness', 'normal', 'normalScale', 'emissive', 'ambient', 'light', 'shadow', 'ao', 'environment', 'transform' ] );

+ 9 - 1
examples/js/nodes/utils/RoughnessToBlinnExponentNode.js

@@ -35,7 +35,15 @@ THREE.RoughnessToBlinnExponentNode.prototype.generate = function( builder, outpu
 
 
 			builder.include( THREE.RoughnessToBlinnExponentNode.getSpecularMIPLevel );
 			builder.include( THREE.RoughnessToBlinnExponentNode.getSpecularMIPLevel );
 
 
-			return builder.format( 'getSpecularMIPLevel( Material_BlinnShininessExponent( material ), 8 )', this.type, output );
+			if ( builder.isCache( 'clearCoat' ) ) {
+
+				return builder.format( 'getSpecularMIPLevel( Material_ClearCoat_BlinnShininessExponent( material ), 8 )', this.type, output );
+
+			} else {
+				
+				return builder.format( 'getSpecularMIPLevel( Material_BlinnShininessExponent( material ), 8 )', this.type, output );
+				
+			}
 
 
 		} else {
 		} else {
 
 

+ 9 - 9
examples/js/postprocessing/ManualMSAARenderPass.js → examples/js/postprocessing/SSAARenderPass.js

@@ -1,16 +1,16 @@
 /**
 /**
 *
 *
-* Manual Multi-Sample Anti-Aliasing Render Pass
+* Supersample Anti-Aliasing Render Pass
 *
 *
 * @author bhouston / http://clara.io/
 * @author bhouston / http://clara.io/
 *
 *
-* This manual approach to MSAA re-renders the scene ones for each sample with camera jitter and accumulates the results.
+* This manual approach to SSAA re-renders the scene ones for each sample with camera jitter and accumulates the results.
 *
 *
-* References: https://en.wikipedia.org/wiki/Multisample_anti-aliasing
+* References: https://en.wikipedia.org/wiki/Supersampling
 *
 *
 */
 */
 
 
-THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
+THREE.SSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
 
 
 	THREE.Pass.call( this );
 	THREE.Pass.call( this );
 
 
@@ -24,7 +24,7 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha )
 	this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
 	this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
 	this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
 	this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
 
 
-	if ( THREE.CopyShader === undefined ) console.error( "THREE.ManualMSAARenderPass relies on THREE.CopyShader" );
+	if ( THREE.CopyShader === undefined ) console.error( "THREE.SSAARenderPass relies on THREE.CopyShader" );
 
 
 	var copyShader = THREE.CopyShader;
 	var copyShader = THREE.CopyShader;
 	this.copyUniforms = Object.assign( {}, copyShader.uniforms );
 	this.copyUniforms = Object.assign( {}, copyShader.uniforms );
@@ -47,9 +47,9 @@ THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha )
 
 
 };
 };
 
 
-THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
+THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), {
 
 
-	constructor: THREE.ManualMSAARenderPass,
+	constructor: THREE.SSAARenderPass,
 
 
 	dispose: function() {
 	dispose: function() {
 
 
@@ -77,7 +77,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
 
 
 		}
 		}
 
 
-		var jitterOffsets = THREE.ManualMSAARenderPass.JitterVectors[ Math.max( 0, Math.min( this.sampleLevel, 5 ) ) ];
+		var jitterOffsets = THREE.SSAARenderPass.JitterVectors[ Math.max( 0, Math.min( this.sampleLevel, 5 ) ) ];
 
 
 		var autoClear = renderer.autoClear;
 		var autoClear = renderer.autoClear;
 		renderer.autoClear = false;
 		renderer.autoClear = false;
@@ -135,7 +135,7 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
 // before being used, thus these integers need to be scaled by 1/16.
 // before being used, thus these integers need to be scaled by 1/16.
 //
 //
 // Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
 // Sample patterns reference: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476218%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
-THREE.ManualMSAARenderPass.JitterVectors = [
+THREE.SSAARenderPass.JitterVectors = [
 	[
 	[
 		[ 0, 0 ]
 		[ 0, 0 ]
 	],
 	],

+ 8 - 7
examples/js/postprocessing/TAARenderPass.js

@@ -14,21 +14,22 @@
 
 
 THREE.TAARenderPass = function ( scene, camera, params ) {
 THREE.TAARenderPass = function ( scene, camera, params ) {
 
 
-	if ( THREE.ManualMSAARenderPass === undefined ) {
+	if ( THREE.SSAARenderPass === undefined ) {
 
 
-		console.error( "THREE.TAARenderPass relies on THREE.ManualMSAARenderPass" );
+		console.error( "THREE.TAARenderPass relies on THREE.SSAARenderPass" );
 
 
 	}
 	}
-	THREE.ManualMSAARenderPass.call( this, scene, camera, params );
+
+	THREE.SSAARenderPass.call( this, scene, camera, params );
 
 
 	this.sampleLevel = 0;
 	this.sampleLevel = 0;
 	this.accumulate = false;
 	this.accumulate = false;
 
 
 };
 };
 
 
-THREE.TAARenderPass.JitterVectors = THREE.ManualMSAARenderPass.JitterVectors;
+THREE.TAARenderPass.JitterVectors = THREE.SSAARenderPass.JitterVectors;
 
 
-THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.ManualMSAARenderPass.prototype ), {
+THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPass.prototype ), {
 
 
 	constructor: THREE.TAARenderPass,
 	constructor: THREE.TAARenderPass,
 
 
@@ -36,7 +37,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.ManualMSAARe
 
 
 		if( ! this.accumulate ) {
 		if( ! this.accumulate ) {
 
 
-				THREE.ManualMSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
+				THREE.SSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
 
 
 				this.accumulateIndex = -1;
 				this.accumulateIndex = -1;
 				return;
 				return;
@@ -59,7 +60,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.ManualMSAARe
 
 
 		if( this.accumulate && this.accumulateIndex === -1 ) {
 		if( this.accumulate && this.accumulateIndex === -1 ) {
 
 
-				THREE.ManualMSAARenderPass.prototype.render.call( this, renderer, this.holdRenderTarget, readBuffer, delta );
+				THREE.SSAARenderPass.prototype.render.call( this, renderer, this.holdRenderTarget, readBuffer, delta );
 
 
 				this.accumulateIndex = 0;
 				this.accumulateIndex = 0;
 
 

File diff suppressed because it is too large
+ 320 - 317
examples/js/renderers/WebGLDeferredRenderer.js


+ 16 - 2
examples/js/shaders/SSAOShader.js

@@ -44,6 +44,9 @@ THREE.SSAOShader = {
 
 
 		"uniform float cameraNear;",
 		"uniform float cameraNear;",
 		"uniform float cameraFar;",
 		"uniform float cameraFar;",
+		"#ifdef USE_LOGDEPTHBUF",
+			"uniform float logDepthBufFC;",
+		"#endif",
 
 
 		"uniform bool onlyAO;",      // use only ambient occlusion pass?
 		"uniform bool onlyAO;",      // use only ambient occlusion pass?
 
 
@@ -109,8 +112,19 @@ THREE.SSAOShader = {
 			"float cameraFarMinusNear = cameraFar - cameraNear;",
 			"float cameraFarMinusNear = cameraFar - cameraNear;",
 			"float cameraCoef = 2.0 * cameraNear;",
 			"float cameraCoef = 2.0 * cameraNear;",
 
 
-			// "return ( 2.0 * cameraNear ) / ( cameraFar + cameraNear - unpackDepth( texture2D( tDepth, coord ) ) * ( cameraFar - cameraNear ) );",
-			"return cameraCoef / ( cameraFarPlusNear - unpackRGBAToDepth( texture2D( tDepth, coord ) ) * cameraFarMinusNear );",
+			"#ifdef USE_LOGDEPTHBUF",
+
+				"float logz = unpackRGBAToDepth( texture2D( tDepth, coord ) );",
+				"float w = pow(2.0, (logz / logDepthBufFC)) - 1.0;",
+				"float z = (logz / w) + 1.0;",
+
+			"#else",
+
+				"float z = unpackRGBAToDepth( texture2D( tDepth, coord ) );",
+
+			"#endif",
+
+			"return cameraCoef / ( cameraFarPlusNear - z * cameraFarMinusNear );",
 
 
 
 
 		"}",
 		"}",

+ 1 - 27
examples/misc_controls_pointerlock.html

@@ -137,33 +137,7 @@
 
 
 					// Ask the browser to lock the pointer
 					// Ask the browser to lock the pointer
 					element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
 					element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
-
-					if ( /Firefox/i.test( navigator.userAgent ) ) {
-
-						var fullscreenchange = function ( event ) {
-
-							if ( document.fullscreenElement === element || document.mozFullscreenElement === element || document.mozFullScreenElement === element ) {
-
-								document.removeEventListener( 'fullscreenchange', fullscreenchange );
-								document.removeEventListener( 'mozfullscreenchange', fullscreenchange );
-
-								element.requestPointerLock();
-							}
-
-						};
-
-						document.addEventListener( 'fullscreenchange', fullscreenchange, false );
-						document.addEventListener( 'mozfullscreenchange', fullscreenchange, false );
-
-						element.requestFullscreen = element.requestFullscreen || element.mozRequestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen;
-
-						element.requestFullscreen();
-
-					} else {
-
-						element.requestPointerLock();
-
-					}
+					element.requestPointerLock();
 
 
 				}, false );
 				}, false );
 
 

BIN
examples/models/assimp/octaminator/1.png


BIN
examples/models/assimp/octaminator/1C.png


BIN
examples/models/assimp/octaminator/Octaminator.assimp


BIN
examples/models/assimp/octaminator/Octaminator_lowpoly_final.fbx


BIN
examples/models/ply/binary/Lucy100k.ply


BIN
examples/models/sea3d/car.sea


BIN
examples/models/sea3d/car.tjs.sea


+ 4358 - 4361
examples/models/vrml/house.wrl

@@ -2,5182 +2,5179 @@
 
 
 
 
 Group {
 Group {
-children[
-DirectionalLight {
-  ambientIntensity  0 
-  color             1 1 0.9
-  direction         0.5 -1.5 -1
-  intensity         1.8 
-  on                TRUE 
-}
-
-DirectionalLight {
-  ambientIntensity  0 
-  color             1 1 0.9
-  direction         -0.5 1 0
-  intensity        1 
-  on                TRUE 
-}
-
-NavigationInfo {
-  
-  avatarSize       [ 0.2, 1.4, 0.5 ]
-
-  headlight        FALSE
- 
-  
-}
-
-
-
-
-DirectionalLight {
-  ambientIntensity  0 
-  color             0.6 0.6 0.8
-  direction         -1 0.5 2
-  intensity         1 
-  on                TRUE 
-}
-
-Background {
-  groundAngle  [ 1.5 1.6 ]
-  groundColor  [ 0.2 0.6 0.3, 0.4 0.4 0.35, 0.3 0.5 0.6  ]
-  backUrl      []
-  bottomUrl    []
-  frontUrl     []
-  leftUrl      []
-  rightUrl     []
-  topUrl       []
-  skyAngle     [ 1.5 ]
-  skyColor     [ 0.5 0.7 1,	0.7 1 0.9 ]
-  
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation     0 1 0 -0.5
-	position       -4 2 10
-
-	description    "Entry"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    0 0 1  0
-	position       3.5 1.7 13
-
-	description    "Vooraanzicht"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    0 0 1  0
-	position       2.5 1.5 -4.5
-
-	description    "Woonkamer"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    0 0 1  0
-	position       1.5 1.5 -1.7
-
-	description    "Keuken"
-}
-
-
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    0 1 0  3.1415927
-	position       2.5 2.5 -20
-
-	description    "Achteraanzicht"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  -1.5707963
-	position       2.5 20 -4.5
-
-	description    "Bovenaanzicht"
-}
-
-
-
-
-
-# beneden/beneden.wrl
+    children[
+        DirectionalLight {
+            ambientIntensity  0
+            color             1 1 0.9
+            direction         0.5 -1.5 -1
+            intensity         1.8
+            on                TRUE
+        }
 
 
+        DirectionalLight {
+            ambientIntensity  0
+            color             1 1 0.9
+            direction         -0.5 1 0
+            intensity        1
+            on                TRUE
+        }
 
 
+        NavigationInfo {
 
 
+            avatarSize       [ 0.2, 1.4, 0.5 ]
 
 
-DEF vloer Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.14	0	-0.14,
-						5.54	0	-0.14,
-						5.54	0	-8.86,
-						0.14	0	-8.86,
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	0, 1, 2, 3, -1,
-	0, 3, 2, 1, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+            headlight        FALSE
 
 
 
 
-DEF drempelvoor Transform {
-children[
-	Shape {
-		appearance 	Appearance {
-			material 	Material {
-	ambientIntensity  0.2
-	diffuseColor      0.4 0.4 0.4
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-					}	
-				}
-		geometry 	Box {
-	size	1.23 0.04 0.30
-				}
-
-	}
- ]
-translation		3.805	0.02 -0.14
-}
+        }
 
 
-DEF drempelachter Transform {
-children[
-	Shape {
-		appearance 	Appearance {
-			material 	Material {
-	ambientIntensity  0.2
-	diffuseColor      0.4 0.4 0.4
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-					}	
-				}
-		geometry 	Box {
-	size	1.05 0.04 0.30
-				}
-
-	}
- ]
-translation		1.725	0.02 -8.86
-}
+        DirectionalLight {
+            ambientIntensity  0
+            color             0.6 0.6 0.8
+            direction         -1 0.5 2
+            intensity         1
+            on                TRUE
+        }
 
 
+        Background {
+            groundAngle  [ 1.5, 1.6 ]
+            groundColor  [ 0.2 0.6 0.3, 0.4 0.4 0.35, 0.3 0.5 0.6  ]
+            backUrl      []
+            bottomUrl    []
+            frontUrl     []
+            leftUrl      []
+            rightUrl     []
+            topUrl       []
+            skyAngle     [ 1.5 ]
+            skyColor     [ 0.5 0.7 1,	0.7 1 0.9 ]
 
 
-DEF stukmuur1 Transform {
-children[
-	Shape {
-	appearance DEF wandkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-		geometry 	Box {
-	size	0.70 2.70 0.07
-				}
-
-	}
- ]
-translation		0.63	1.35 -3.395
-}
+        }
 
 
-DEF stukmuur2 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	1.41 2.70 0.07
-				}
-
-	}
- ]
-translation		2.485	1.35 -3.395
-}
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation     0 1 0 -0.5
+            position       -4 2 10
 
 
+            description    "Entry"
+        }
 
 
-DEF stukmuur3 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.43 2.70 0.07
-				}
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation    0 0 1  0
+            position       3.5 1.7 13
 
 
-	}
- ]
-translation		4.205	1.35 -3.395
-}
+            description    "Vooraanzicht"
+        }
 
 
-DEF stukmuur4 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	1.06 2.8 0.07
-				}
-
-	}
- ]
-translation		4.87	1.4 -4.395
-}
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation    0 0 1  0
+            position       2.5 1.5 -4.5
 
 
-DEF stukmuur5 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.70 2.28
-				}
-
-	}
- ]
-translation		3.155	1.35 -1.42
-}
+            description    "Woonkamer"
+        }
 
 
-DEF stukmuur6 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.8 0.07
-				}
-
-	}
- ]
-translation		4.91	1.4 -2.325
-}
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation    0 0 1  0
+            position       1.5 1.5 -1.7
 
 
-DEF stukmuur7 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.70 0.07
-				}
-
-	}
- ]
-translation		4.91	1.35 -1.515
-}
+            description    "Keuken"
+        }
 
 
 
 
-DEF stukmuur8 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.70 0.4
-				}
 
 
-	}
- ]
-translation		4.455	1.35 -0.48
-}
-
-DEF stukmuur9 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.70 0.74
-				}
-
-	}
- ]
-translation		4.7	1.35 -1.92
-}
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation    0 1 0  3.1415927
+            position       2.5 2.5 -20
 
 
+            description    "Achteraanzicht"
+        }
 
 
+        Viewpoint {
+            fieldOfView    1
+            jump           TRUE
+            orientation    1 0 0  -1.5707963
+            position       2.5 20 -4.5
 
 
-# binmuur.wrl
+            description    "Bovenaanzicht"
+        }
 
 
 
 
 
 
 
 
-Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
-						5.40	0	-0.28,
-						5.40	5.40	-0.28,
-						0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
-
-						3.19	0	-0.28, #4 voordeur
-						4.42	0	-0.28,
-						4.42	2.30	-0.28,
-						3.19	2.30	-0.28, #7 voordeur
-
-						4.84	1.60	-0.28, #toiletraam-8
-						5.04	1.60	-0.28,
-						5.04	2.30	-0.28,
-						4.84	2.30	-0.28, 
-
-						2.60	0.90	-0.28, #keukenraam-12
-						2.60	2.30	-0.28,
-						0.60	2.30	-0.28,
-						0.60	0.90	-0.28,
-
-						0.60	3.60	-0.28, #bovenraam-16
-						1.50	3.60	-0.28,
-						1.50	5.0	-0.28,
-						4.42	5.0	-0.28,
-						4.42	5.40	-0.28, 
-						0.60	5.40	-0.28,
-
-						0.28	8.55	-3.15, #linkergevel-22
-						0.28	2.70	-8.72,
-						0.28	0	-8.72,
-
-						5.40	8.55	-3.15, #rechtergevel-25
-						5.40	5.40	-6.30,
-						5.40	5.40	-8.72,
-						5.40	0	-8.72,
-
-						2.25	0	-8.72, #achtergevel-29
-						2.25	0.6	-8.72,
-						4.8	0.6	-8.72,
-						4.8	5.40	-8.72,
-						1.2	0	-8.72,
-						1.2	2.70	-8.72,
 
 
+        # beneden/beneden.wrl
+
+
+
+
+        DEF vloer Transform {
+            children [
+                Shape {
+                    appearance Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      1 0.5 0.3
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
+                                0.14	0	-0.14,
+                                5.54	0	-0.14,
+                                5.54	0	-8.86,
+                                0.14	0	-8.86,
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
+                            0, 1, 2, 3, -1,
+                            0, 3, 2, 1, -1,
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             TRUE
+                        texCoordIndex     []
+                    }
+                }
+            ]
+        }
 
 
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
 
 
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
+        DEF drempelvoor Transform {
+            children[
+                Shape {
+                    appearance 	Appearance {
+                        material 	Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.4 0.4 0.4
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }
+                    }
+                    geometry 	Box {
+                        size	1.23 0.04 0.30
+                    }
 
 
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
+                }
+            ]
+            translation		3.805	0.02 -0.14
+        }
 
 
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
+        DEF drempelachter Transform {
+            children[
+                Shape {
+                    appearance 	Appearance {
+                        material 	Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.4 0.4 0.4
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }
+                    }
+                    geometry 	Box {
+                        size	1.05 0.04 0.30
+                    }
 
 
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.70	-8.86,	#58
+                }
+            ]
+            translation		1.725	0.02 -8.86
+        }
 
 
-						0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
-						5.40	5.40	0,
-						0.28	5.40	-6.30, #61
-						0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
 
 
-						0.28	2.7	-0.28, #63 extra punten voor segmentering beneden
-						0.14	2.7	-0.14,
+        DEF stukmuur1 Transform {
+            children[
+                Shape {
+                    appearance DEF wandkleur Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      1 0.9 0.7
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry 	Box {
+                        size	0.70 2.70 0.07
+                    }
 
 
-						5.4	2.7	-0.28, #65
-						5.54	2.7	-0.14, #
+                }
+            ]
+            translation		0.63	1.35 -3.395
+        }
 
 
-						0.28	2.7	-8.72, #67
-						0.14	2.7	-8.86, #
+        DEF stukmuur2 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	1.41 2.70 0.07
+                    }
 
 
-						5.4	2.7	-8.72, #69
-						5.54	2.7	-8.86, #
+                }
+            ]
+            translation		2.485	1.35 -3.395
+        }
 
 
-						1.2	2.7	-8.72, #71
-						1.2	2.7	-8.86, #
 
 
-						4.8	2.7	-8.72, #73
-						4.8	2.7	-8.86, #
-						
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 4, 12, 15, -1,
-		0, 15, 12, 4, -1,
+        DEF stukmuur3 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.43 2.70 0.07
+                    }
 
 
-		0, 15, 14, 63, -1,
-		0, 63, 14, 15, -1,
+                }
+            ]
+            translation		4.205	1.35 -3.395
+        }
 
 
-		14, 13, 65, 63, -1,
-		
-		4, 12, 13, 7, -1,
+        DEF stukmuur4 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	1.06 2.8 0.07
+                    }
 
 
-		13, 7, 6, 65, -1,
+                }
+            ]
+            translation		4.87	1.4 -4.395
+        }
 
 
-		6, 11, 10, 65, -1,
+        DEF stukmuur5 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.07 2.70 2.28
+                    }
 
 
-		5, 8, 11, 6, -1,
+                }
+            ]
+            translation		3.155	1.35 -1.42
+        }
 
 
-		5, 8, 9, 1, -1,
+        DEF stukmuur6 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.98 2.8 0.07
+                    }
 
 
-		1, 9, 10, 65, -1,
+                }
+            ]
+            translation		4.91	1.4 -2.325
+        }
 
 
-		0, 63, 67, 24, -1,
+        DEF stukmuur7 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.98 2.70 0.07
+                    }
 
 
-		67, 24, 33, 71, -1,
+                }
+            ]
+            translation		4.91	1.35 -1.515
+        }
 
 
-		28, 29, 30, 31, -1,
 
 
-		28, 31, 73, 69, -1,
+        DEF stukmuur8 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.07 2.70 0.4
+                    }
 
 
-		28, 69, 65, 1, -1,
+                }
+            ]
+            translation		4.455	1.35 -0.48
+        }
 
 
-		63, 65, 66, 64, -1,
+        DEF stukmuur9 Transform {
+            children[
+                Shape {
+                    appearance USE wandkleur
+                    geometry 	Box {
+                        size	0.07 2.70 0.74
+                    }
 
 
-		65, 69, 70, 66, -1,
+                }
+            ]
+            translation		4.7	1.35 -1.92
+        }
 
 
-		63, 67, 68, 64, -1,
 
 
-		69, 73, 74, 70, -1,
 
 
-		67, 71, 72, 68, -1,
+        # binmuur.wrl
+
+
+
+
+        Transform {
+            children [
+                Shape {
+                    appearance Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      1 0.9 0.7
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
+                                0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
+                                5.40	0	-0.28,
+                                5.40	5.40	-0.28,
+                                0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
+
+                                3.19	0	-0.28, #4 voordeur
+                                4.42	0	-0.28,
+                                4.42	2.30	-0.28,
+                                3.19	2.30	-0.28, #7 voordeur
+
+                                4.84	1.60	-0.28, #toiletraam-8
+                                5.04	1.60	-0.28,
+                                5.04	2.30	-0.28,
+                                4.84	2.30	-0.28,
+
+                                2.60	0.90	-0.28, #keukenraam-12
+                                2.60	2.30	-0.28,
+                                0.60	2.30	-0.28,
+                                0.60	0.90	-0.28,
+
+                                0.60	3.60	-0.28, #bovenraam-16
+                                1.50	3.60	-0.28,
+                                1.50	5.0	-0.28,
+                                4.42	5.0	-0.28,
+                                4.42	5.40	-0.28,
+                                0.60	5.40	-0.28,
 
 
-		5, 6, 37, 36, -1,
+                                0.28	8.55	-3.15, #linkergevel-22
+                                0.28	2.70	-8.72,
+                                0.28	0	-8.72,
 
 
-		6, 7, 38, 37, -1,
+                                5.40	8.55	-3.15, #rechtergevel-25
+                                5.40	5.40	-6.30,
+                                5.40	5.40	-8.72,
+                                5.40	0	-8.72,
 
 
-		4, 35, 38, 7, -1,
+                                2.25	0	-8.72, #achtergevel-29
+                                2.25	0.6	-8.72,
+                                4.8	0.6	-8.72,
+                                4.8	5.40	-8.72,
+                                1.2	0	-8.72,
+                                1.2	2.70	-8.72,
 
 
-		12, 39, 40, 13, -1,
 
 
-		13, 40, 41, 14, -1, 
+                                3.19	0	-0.14, #diepte van de voordeur-35
+                                4.42	0	-0.14,
+                                4.42	2.30	-0.14,
+                                3.19	2.30	-0.14, #diepte van de voordeur-38
 
 
-		14, 41, 42, 15, -1,
+                                2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                2.60	2.30	-0.14,
+                                0.60	2.30	-0.14,
+                                0.60	0.90	-0.14,
 
 
-		15, 42, 39, 12, -1, 
+                                4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                5.04	1.60	-0.14,
+                                5.04	2.30	-0.14,
+                                4.84	2.30	-0.14,
 
 
-		8, 43, 44, 9, -1,
+                                0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                1.50	3.60	-0.14,
+                                1.50	5.0	-0.14,
+                                4.42	5.0	-0.14,
+                                4.42	5.40	-0.14,
+                                0.60	5.40	-0.14, #52
 
 
+                                2.25	0	-8.86, #diepte van de achtergevel-53
+                                2.25	0.6	-8.86,
+                                4.8	0.6	-8.86,
+                                4.8	5.40	-8.86,
+                                1.2	0	-8.86,
+                                1.2	2.70	-8.86,	#58
 
 
-		9, 44, 45, 10, -1,
+                                0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
+                                5.40	5.40	0,
+                                0.28	5.40	-6.30, #61
+                                0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
 
 
+                                0.28	2.7	-0.28, #63 extra punten voor segmentering beneden
+                                0.14	2.7	-0.14,
 
 
-		10, 45, 46, 11, -1,
+                                5.4	2.7	-0.28, #65
+                                5.54	2.7	-0.14, #
 
 
+                                0.28	2.7	-8.72, #67
+                                0.14	2.7	-8.86, #
 
 
-		11, 46, 43, 8, -1,
+                                5.4	2.7	-8.72, #69
+                                5.54	2.7	-8.86, #
 
 
+                                1.2	2.7	-8.72, #71
+                                1.2	2.7	-8.86, #
 
 
-		29, 53, 54, 30, -1,
+                                4.8	2.7	-8.72, #73
+                                4.8	2.7	-8.86, #
 
 
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
+                            0, 4, 12, 15, -1,
+                            0, 15, 12, 4, -1,
 
 
-		30, 54, 55, 31, -1, 
+                            0, 15, 14, 63, -1,
+                            0, 63, 14, 15, -1,
 
 
+                            14, 13, 65, 63, -1,
 
 
-		31, 55, 74, 73, -1,
+                            4, 12, 13, 7, -1,
 
 
+                            13, 7, 6, 65, -1,
 
 
-		33, 57, 72, 71, -1,
+                            6, 11, 10, 65, -1,
 
 
+                            5, 8, 11, 6, -1,
 
 
+                            5, 8, 9, 1, -1,
 
 
+                            1, 9, 10, 65, -1,
 
 
+                            0, 63, 67, 24, -1,
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                            67, 24, 33, 71, -1,
 
 
-#benodigde tijd tot hier 2 uur(kale buitenkant van het huis )
+                            28, 29, 30, 31, -1,
 
 
-# /binmuur.wrl
+                            28, 31, 73, 69, -1,
 
 
-# buitmuur.wrl
+                            28, 69, 65, 1, -1,
 
 
+                            63, 65, 66, 64, -1,
 
 
+                            65, 69, 70, 66, -1,
 
 
+                            63, 67, 68, 64, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF steen Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.4 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0	    0	    0, # 0 linkerbenedenhoek voorgevel
-						5.68	0	    0,
-						5.68	5.40	0, # 2
-						0	    5.40	0, # 3 linkerbovenhoek voorgevel
-
-						3.19	0	    0, #voordeur
-						4.42	0	    0,
-						4.42	2.30	0, # 6
-						3.19	2.30	0, # 7 voordeur
-
-						4.84	1.60	0, #toiletraam-8
-						5.04	1.60	0,
-						5.04	2.30	0, # 10
-						4.84	2.30	0, 
+                            69, 73, 74, 70, -1,
 
 
-						2.60	0.90	0, #keukenraam-12
-						2.60	2.30	0, # 13
-						0.60	2.30	0,
-						0.60	0.90	0,
+                            67, 71, 72, 68, -1,
 
 
-						0.60	3.60	0, #bovenraam-16
-						1.50	3.60	0,
-						1.50	5.0	    0,
-						4.42	5.0	    0,
-						4.42	5.40	0, 
-						0.60	5.40	0,
+                            5, 6, 37, 36, -1,
 
 
-						0	8.555	-3.15, #linkergevel-22
-						0	2.7	-9.0,
-						0	0	-9.0,
+                            6, 7, 38, 37, -1,
 
 
-						5.68	8.555	-3.15, #rechtergevel-25
-						5.68	5.40	-6.3,
-						5.68	5.40	-9,
-						5.68	0	-9.0,
+                            4, 35, 38, 7, -1,
 
 
-						2.25	0	-9.0, #achtergevel-29
-						2.25	0.6	-9.0,
-						4.8	0.6	-9.0,
-						4.8	5.40	-9.0,
-						1.2	0	-9.0,
-						1.2	2.7	-9,
+                            12, 39, 40, 13, -1,
 
 
+                            13, 40, 41, 14, -1,
 
 
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
+                            14, 41, 42, 15, -1,
 
 
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
+                            15, 42, 39, 12, -1,
 
 
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
+                            8, 43, 44, 9, -1,
 
 
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
 
 
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.7	-8.86,	#58
+                            9, 44, 45, 10, -1,
 
 
-						0	2.7	0, #59 extra punten voor segmentering beneden
-						0.14	2.7	-0.14,
 
 
-						5.68	2.7	0, #61
-						5.54	2.7	-0.14, #
+                            10, 45, 46, 11, -1,
 
 
-						0	2.7	-9, #63
-						0.14	2.7	-8.86, #
 
 
-						5.68	2.7	-9, #65
-						5.54	2.7	-8.86, #
+                            11, 46, 43, 8, -1,
 
 
-						1.2	2.7	-9, #67
-						1.2	2.7	-8.86, #
 
 
-						4.8	2.7	-9, #69
-						4.8	2.7	-8.86, #
+                            29, 53, 54, 30, -1,
 
 
 
 
+                            30, 54, 55, 31, -1,
 
 
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 4, 12, 15, -1,
 
 
-		0, 15, 14, 59, -1,
+                            31, 55, 74, 73, -1,
 
 
-		14, 13, 61, 59,-1,
 
 
+                            33, 57, 72, 71, -1,
 
 
-		4, 7, 13, 12, -1,
 
 
-        13, 11, 61, -1,
 
 
-		11, 10, 61, -1,
 
 
-		9, 1, 61, 10, -1, 
 
 
-		5, 1, 9, 8, -1,
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             FALSE
+                        texCoordIndex     []
+                    }
+                }
+            ]
+        }
 
 
-		5, 8, 11, 6, -1,
+        #benodigde tijd tot hier 2 uur(kale buitenkant van het huis )
+
+        # /binmuur.wrl
+
+        # buitmuur.wrl
+
+
+
+
+        Transform {
+            children [
+                Shape {
+                    appearance DEF steen Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.8 0.4 0.3
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
+                                0	    0	    0, # 0 linkerbenedenhoek voorgevel
+                                5.68	0	    0,
+                                5.68	5.40	0, # 2
+                                0	    5.40	0, # 3 linkerbovenhoek voorgevel
+
+                                3.19	0	    0, #voordeur
+                                4.42	0	    0,
+                                4.42	2.30	0, # 6
+                                3.19	2.30	0, # 7 voordeur
+
+                                4.84	1.60	0, #toiletraam-8
+                                5.04	1.60	0,
+                                5.04	2.30	0, # 10
+                                4.84	2.30	0,
 
 
+                                2.60	0.90	0, #keukenraam-12
+                                2.60	2.30	0, # 13
+                                0.60	2.30	0,
+                                0.60	0.90	0,
 
 
-		0, 59, 63, 24, -1,
+                                0.60	3.60	0, #bovenraam-16
+                                1.50	3.60	0,
+                                1.50	5.0	    0,
+                                4.42	5.0	    0,
+                                4.42	5.40	0,
+                                0.60	5.40	0,
 
 
-		1, 28, 65, 61, -1,
+                                0	8.555	-3.15, #linkergevel-22
+                                0	2.7	-9.0,
+                                0	0	-9.0,
 
 
-		28, 29, 30, 31, -1,
+                                5.68	8.555	-3.15, #rechtergevel-25
+                                5.68	5.40	-6.3,
+                                5.68	5.40	-9,
+                                5.68	0	-9.0,
 
 
-		28, 31, 69, 65, -1,
+                                2.25	0	-9.0, #achtergevel-29
+                                2.25	0.6	-9.0,
+                                4.8	0.6	-9.0,
+                                4.8	5.40	-9.0,
+                                1.2	0	-9.0,
+                                1.2	2.7	-9,
 
 
-		33, 24, 63, 67, -1,
 
 
-		5, 6, 37, 36, -1,
+                                3.19	0	-0.14, #diepte van de voordeur-35
+                                4.42	0	-0.14,
+                                4.42	2.30	-0.14,
+                                3.19	2.30	-0.14, #diepte van de voordeur-38
 
 
-		6, 7, 38, 37, -1,
+                                2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                2.60	2.30	-0.14,
+                                0.60	2.30	-0.14,
+                                0.60	0.90	-0.14,
 
 
-		4, 35, 38, 7, -1,
+                                4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                5.04	1.60	-0.14,
+                                5.04	2.30	-0.14,
+                                4.84	2.30	-0.14,
 
 
-		12, 13, 40, 39, -1,
+                                0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                1.50	3.60	-0.14,
+                                1.50	5.0	-0.14,
+                                4.42	5.0	-0.14,
+                                4.42	5.40	-0.14,
+                                0.60	5.40	-0.14, #52
 
 
-		13, 14, 41, 40, -1,
+                                2.25	0	-8.86, #diepte van de achtergevel-53
+                                2.25	0.6	-8.86,
+                                4.8	0.6	-8.86,
+                                4.8	5.40	-8.86,
+                                1.2	0	-8.86,
+                                1.2	2.7	-8.86,	#58
 
 
-		15, 42, 41, 14, -1,
+                                0	2.7	0, #59 extra punten voor segmentering beneden
+                                0.14	2.7	-0.14,
 
 
-		12, 39, 42, 15, -1
+                                5.68	2.7	0, #61
+                                5.54	2.7	-0.14, #
 
 
-		8, 9, 44, 43, -1,
+                                0	2.7	-9, #63
+                                0.14	2.7	-8.86, #
 
 
-		9, 10 , 45, 44, -1,
+                                5.68	2.7	-9, #65
+                                5.54	2.7	-8.86, #
 
 
-		10, 11, 46, 45, -1,
+                                1.2	2.7	-9, #67
+                                1.2	2.7	-8.86, #
 
 
-		11, 8, 43, 46, -1,
+                                4.8	2.7	-9, #69
+                                4.8	2.7	-8.86, #
 
 
-		29, 53, 54, 30, -1,
 
 
-		30, 54, 55, 31, -1, 
 
 
-		31, 55, 70, 69, -1,
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
+                            0, 4, 12, 15, -1,
 
 
-		33, 67, 68, 57, -1,
+                            0, 15, 14, 59, -1,
 
 
-		59, 61, 62, 60, -1,
+                            14, 13, 61, 59,-1,
 
 
-		59, 60, 64, 63, -1,
 
 
-		61, 65, 66, 62, -1,
+                            4, 7, 13, 12, -1,
 
 
-		65, 69, 70, 66, -1,
+                            13, 11, 61, -1,
 
 
-		64, 68, 67, 63, -1,
+                            11, 10, 61, -1,
 
 
+                            9, 1, 61, 10, -1,
 
 
+                            5, 1, 9, 8, -1,
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                            5, 8, 11, 6, -1,
 
 
-Transform{#schuurtje
-children [
-
-DEF schuurvloer Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.1	0	-0.1,
-						2.1	0	-0.1,
-						2.1	0	-3.1,
-						0.1	0	-3.1,
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	0, 1, 2, 3, -1,
-	
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
 
 
+                            0, 59, 63, 24, -1,
 
 
-Transform {
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	2.2	2.6	0.1	}
-}
-]
-translation 1.1 1.3 -0.05
-}
+                            1, 28, 65, 61, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	2.2	2.6	0.1	}
-}
-]
-translation	1.1	1.3	-3.15
-}
+                            28, 29, 30, 31, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	0.1	2.6	1.3	}
-}
-]
-translation		0.05	1.3	-0.75
-}
+                            28, 31, 69, 65, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	0.1	2.6	0.75	}
-}
-]
-translation		0.05	1.3	-2.725
-}
+                            33, 24, 63, 67, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	0.1	2.6	3	}
-}
-]
-translation		2.15	1.3	-1.6
-}
+                            5, 6, 37, 36, -1,
 
 
-Transform{
-children [
-Shape {
-appearance DEF blauw Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.3 0.4 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-geometry Box {	size	0.05	0.44	0.85	}
-}
-]
-translation		0.05	2.38	-1.875
-}
+                            6, 7, 38, 37, -1,
 
 
-Transform{#drempel van schuurdeur
-children [
-
-Transform{#deurpost
-children [
-
-DEF deurpost Shape {
-		appearance 	DEF grijs Appearance {
-			material 	Material {
-	ambientIntensity  0.2
-	diffuseColor      0.4 0.4 0.4
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-					}	
-				}
-		geometry 	Box {
-	size	0.05 2.56 0.05
-				}
-	}
-]
-translation 0 1.3 0.45
-}
+                            4, 35, 38, 7, -1,
 
 
-Transform{#deurpost
-children [
-
-Shape {
-		appearance USE grijs
-		geometry 	Box {
-	size	0.05 0.05 0.85
-				}
-	}
-]
-translation 0 2.135 0
-}
+                            12, 13, 40, 39, -1,
 
 
+                            13, 14, 41, 40, -1,
 
 
-Transform{#deurpost
-children [
+                            15, 42, 41, 14, -1,
 
 
-USE deurpost
-]
-translation 0 1.3 -0.45
-}
+                            12, 39, 42, 15, -1
 
 
-Shape {
-		appearance 	USE grijs
-		geometry 	Box {
-	size	0.1 0.04 0.95
-				}
+                            8, 9, 44, 43, -1,
 
 
-	}
-]
-translation		0.05	0.02	-1.875
-}
+                            9, 10 , 45, 44, -1,
 
 
+                            10, 11, 46, 45, -1,
 
 
-]
-translation 3.48	0	7.8
-}
+                            11, 8, 43, 46, -1,
 
 
-# /buitmuur.wrl
+                            29, 53, 54, 30, -1,
 
 
+                            30, 54, 55, 31, -1,
 
 
-# trapbeneden.wrl
+                            31, 55, 70, 69, -1,
 
 
+                            33, 67, 68, 57, -1,
 
 
+                            59, 61, 62, 60, -1,
 
 
+                            59, 60, 64, 63, -1,
 
 
-DEF trapbeneden Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material          Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry DEF trap IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-	-0.2	0	1, #0
-	0	0.2	1,
-	0	0.2	0,
-	-0.2	0	0, #3
-
-	0.28	0.4	1, #4
-	0.6	0.6	1,
-	0.98	0.8	1,
-	0.98	1	0.45, #7
-
-	0.98	1.2	0.25, #8
-	0.98	1.4	0, 
-	0.98	1.6	-0.25, 
-	0.98	1.8	-0.45, #11
-
-	0.98	2.0	-1, #12
-	0.6	2.2	-1,
-	0.28	2.4	-1,
-	0	2.6	-1, #15
-
-	0	0.6	0, #16
-	0	0.8	0,
-	0	1	0, #18
-	0	1.2	0, #19
-
-	0	1.4	0, #20
-	0	1.6	0,
-	0	1.8	0, #22
-	0	2	0, #23
-
-	0	2.2	0, #24
-	0	2.4	0, 
-	0	2.6	0,  
-	0	2.8	0,  #27
-
-	-0.2	0.2	1, #28
-	0	0.4	1,
-	0	0.4	0,
-	-0.2	0.2	0, #31
-
-	0.28	0.6	1, #32
-	0.6	0.8	1,
-	0.98	1	1,
-	0.98	1.2	0.45, #35
-
-	0.98	1.4	0.25, #36
-	0.98	1.6	0, 
-	0.98	1.8	-0.25, 
-	0.98	2	-0.45, #39
-
-	0.98	2.2	-1, #40
-	0.6	2.4	-1,
-	0.28	2.6	-1,
-	0	2.8	-1, #43
-
-	0	0	1,
-	0	0	0, #45
-	0	0.4	0, #46
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-
-	28, 1, 2, 31, -1, #1e_treevlak
-	29, 4, 46, -1, #2e
-	32, 5, 16, -1,
-	33, 6, 17, -1,
-	34, 7, 18, -1, 
-	35, 8, 19, -1, 
-	36, 9, 20, -1, 
-	37, 10, 21, -1,
-	38, 11, 22, -1,
-	39, 12, 23, -1,
-	40, 13, 24, -1,
-	41, 14, 25, -1,
-	42, 15, 26, -1, #13e_treevlak
-
-	0, 28, 31, 3, -1, #voor_en_zijvlakken_van_de_eerste_tree
-	0, 44, 1, 28, -1,
-	3, 31, 2, 45, -1,
-
-	2, 1, 29, 30, -1, #alle_voorvlakken
-	46, 4, 32, 16, -1,
-	16, 5, 33, 17, -1,
-	17, 6, 34, 18, -1,
-	18, 7, 35, 19, -1, 
-	19, 8, 36, 20, -1,
-	20, 9, 37, 21, -1,
-	21, 10, 38, 22, -1,
-	22, 11, 39, 23, -1,
-	23, 12, 40, 24, -1,
-	24, 13, 41, 25, -1,
-	25, 14, 42, 26, -1,
-	26, 15, 43, 27, -1,
-
-
-	
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-translation 4.42	0	-3.36
-}
+                            61, 65, 66, 62, -1,
 
 
+                            65, 69, 70, 66, -1,
 
 
+                            64, 68, 67, 63, -1,
 
 
 
 
 
 
-# /trapbeneden.wrl
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             FALSE
+                        texCoordIndex     []
+                    }
+                }
+            ]
+        }
 
 
-# deuren.wrl
+        Transform{#schuurtje
+            children [
+
+                DEF schuurvloer Transform {
+                    children [
+                        Shape {
+                            appearance Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 0.5 0.3
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        0.1	0	-0.1,
+                                        2.1	0	-0.1,
+                                        2.1	0	-3.1,
+                                        0.1	0	-3.1,
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+                                    0, 1, 2, 3, -1,
+
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             FALSE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE steen
+                            geometry Box {	size	2.2	2.6	0.1	}
+                        }
+                    ]
+                    translation 1.1 1.3 -0.05
+                }
 
 
-Transform {
-children [
-DEF deurgroep Group {#DEURKEUKENWOONKAMER
-children[
-#dwarslat boven de deur
-DEF dwarslat Transform {
-	children [
-		Shape {
-appearance DEF kozijn Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.95 0.95 0.9
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 0.05 0.05 }
-}
+                Transform{
+                    children [
+                        Shape {
+                            appearance USE steen
+                            geometry Box {	size	2.2	2.6	0.1	}
+                        }
+                    ]
+                    translation	1.1	1.3	-3.15
+                }
 
 
-]
-translation	0 2.035 0
-}
+                Transform{
+                    children [
+                        Shape {
+                            appearance USE steen
+                            geometry Box {	size	0.1	2.6	1.3	}
+                        }
+                    ]
+                    translation		0.05	1.3	-0.75
+                }
 
 
+                Transform{
+                    children [
+                        Shape {
+                            appearance USE steen
+                            geometry Box {	size	0.1	2.6	0.75	}
+                        }
+                    ]
+                    translation		0.05	1.3	-2.725
+                }
 
 
+                Transform{
+                    children [
+                        Shape {
+                            appearance USE steen
+                            geometry Box {	size	0.1	2.6	3	}
+                        }
+                    ]
+                    translation		2.15	1.3	-1.6
+                }
 
 
+                Transform{
+                    children [
+                        Shape {
+                            appearance DEF blauw Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.3 0.4 0.7
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry Box {	size	0.05	0.44	0.85	}
+                        }
+                    ]
+                    translation		0.05	2.38	-1.875
+                }
 
 
-DEF ruitje Transform {
-	children [
-		Shape {
-appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 0.64 0.01 }
-}
+                Transform{#drempel van schuurdeur
+                    children [
+
+                        Transform{#deurpost
+                            children [
+
+                                DEF deurpost Shape {
+                                    appearance 	DEF grijs Appearance {
+                                        material 	Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.4 0.4 0.4
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }
+                                    }
+                                    geometry 	Box {
+                                        size	0.05 2.56 0.05
+                                    }
+                                }
+                            ]
+                            translation 0 1.3 0.45
+                        }
+
+                        Transform{#deurpost
+                            children [
+
+                                Shape {
+                                    appearance USE grijs
+                                    geometry 	Box {
+                                        size	0.05 0.05 0.85
+                                    }
+                                }
+                            ]
+                            translation 0 2.135 0
+                        }
+
+
+                        Transform{#deurpost
+                            children [
+
+                                USE deurpost
+                            ]
+                            translation 0 1.3 -0.45
+                        }
+
+                        Shape {
+                            appearance 	USE grijs
+                            geometry 	Box {
+                                size	0.1 0.04 0.95
+                            }
+
+                        }
+                    ]
+                    translation		0.05	0.02	-1.875
+                }
 
 
-]
-translation	0 2.38 0
-}#ruit boven de deur
 
 
-#deur
-DEF deur Transform {
-center -0.4 0 0
-	children [
+            ]
+            translation 3.48	0	7.8
+        }
 
 
+        # /buitmuur.wrl
+
+
+        # trapbeneden.wrl
+
+
+
+
+        DEF trapbeneden Transform {
+            children [
+                Shape {
+                    appearance Appearance {
+                        material          Material {
+                            ambientIntensity  0.2
+                            diffuseColor      1 0.5 0.3
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry DEF trap IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
+                                -0.2	0	1, #0
+                                0	0.2	1,
+                                0	0.2	0,
+                                -0.2	0	0, #3
+
+                                0.28	0.4	1, #4
+                                0.6	0.6	1,
+                                0.98	0.8	1,
+                                0.98	1	0.45, #7
+
+                                0.98	1.2	0.25, #8
+                                0.98	1.4	0,
+                                0.98	1.6	-0.25,
+                                0.98	1.8	-0.45, #11
+
+                                0.98	2.0	-1, #12
+                                0.6	2.2	-1,
+                                0.28	2.4	-1,
+                                0	2.6	-1, #15
+
+                                0	0.6	0, #16
+                                0	0.8	0,
+                                0	1	0, #18
+                                0	1.2	0, #19
+
+                                0	1.4	0, #20
+                                0	1.6	0,
+                                0	1.8	0, #22
+                                0	2	0, #23
+
+                                0	2.2	0, #24
+                                0	2.4	0,
+                                0	2.6	0,
+                                0	2.8	0,  #27
+
+                                -0.2	0.2	1, #28
+                                0	0.4	1,
+                                0	0.4	0,
+                                -0.2	0.2	0, #31
+
+                                0.28	0.6	1, #32
+                                0.6	0.8	1,
+                                0.98	1	1,
+                                0.98	1.2	0.45, #35
+
+                                0.98	1.4	0.25, #36
+                                0.98	1.6	0,
+                                0.98	1.8	-0.25,
+                                0.98	2	-0.45, #39
+
+                                0.98	2.2	-1, #40
+                                0.6	2.4	-1,
+                                0.28	2.6	-1,
+                                0	2.8	-1, #43
+
+                                0	0	1,
+                                0	0	0, #45
+                                0	0.4	0, #46
+
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
+
+                            28, 1, 2, 31, -1, #1e_treevlak
+                            29, 4, 46, -1, #2e
+                            32, 5, 16, -1,
+                            33, 6, 17, -1,
+                            34, 7, 18, -1,
+                            35, 8, 19, -1,
+                            36, 9, 20, -1,
+                            37, 10, 21, -1,
+                            38, 11, 22, -1,
+                            39, 12, 23, -1,
+                            40, 13, 24, -1,
+                            41, 14, 25, -1,
+                            42, 15, 26, -1, #13e_treevlak
+
+                            0, 28, 31, 3, -1, #voor_en_zijvlakken_van_de_eerste_tree
+                            0, 44, 1, 28, -1,
+                            3, 31, 2, 45, -1,
+
+                            2, 1, 29, 30, -1, #alle_voorvlakken
+                            46, 4, 32, 16, -1,
+                            16, 5, 33, 17, -1,
+                            17, 6, 34, 18, -1,
+                            18, 7, 35, 19, -1,
+                            19, 8, 36, 20, -1,
+                            20, 9, 37, 21, -1,
+                            21, 10, 38, 22, -1,
+                            22, 11, 39, 23, -1,
+                            23, 12, 40, 24, -1,
+                            24, 13, 41, 25, -1,
+                            25, 14, 42, 26, -1,
+                            26, 15, 43, 27, -1,
+
+
+
+
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             FALSE
+                        texCoordIndex     []
+                    }
+                }
+            ]
+            translation 4.42	0	-3.36
+        }
 
 
 
 
-DEF klikopdeur TouchSensor {}
-  DEF TimeSource TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-  DEF Deuropen OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
 
 
 
 
 
 
-# ../boven/deurklink.wrl
+        # /trapbeneden.wrl
 
 
+        # deuren.wrl
 
 
 
 
 
 
+        Transform {
+            children [
+                DEF deurgroep Group {#DEURKEUKENWOONKAMER
+                    children[
+                        #dwarslat boven de deur
+                        DEF dwarslat Transform {
+                            children [
+                                Shape {
+                                    appearance DEF kozijn Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.95 0.95 0.9
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 0.05 0.05 }
+                                }
 
 
-DEF deurklink Transform {
-	children [
-	    DEF enehelft	Shape {
-            appearance DEF aluminium Appearance {
-                material         Material {
-                ambientIntensity  0.2
-                diffuseColor      0.4 0.4 0.5
-                emissiveColor     0 0 0
-                shininess         0.8
-                specularColor     0.4 0.4 0.5
-                }
-                texture           NULL
-                textureTransform  NULL
-            }
-		    geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {
-					point [
-                        -0.015	0.02	0, #0
-                        0.015		0.02	0,
-                        0.02		-0.02	0,
-                        -0.02		-0.02	0, #3
-
-                        -0.01		-0.015	0.06, #4
-                        0.01		-0.015	0.06,
-                        -0.01		0.015		0.03,
-                        0.01		0.015		0.03,
-
-                        0.005		0.1		0.035, #8
-                        -0.005	0.1		0.035,
-                        -0.005	0.1		0.055,
-                        0.005		0.1		0.055,
-
-
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-2, 3, 4, 5, -1,
-2, 5, 4, 3, -1,
-
-4, 5, 11, 10, -1, 
-4, 10, 11, 5, -1,
-
-0, 1, 7, 6, -1, 
-0, 6, 7, 1, -1,
-
-6, 7, 8, 9, -1, 
-6, 9, 8, 7, -1,
-
-8, 9, 10, 11, -1, 
-8, 11, 10, 9, -1,
-
-0, 6, 4, 3, -1,
-0, 3, 4, 6, -1,
-
-6, 9, 10, 4, -1, 
-6, 4, 10, 9, -1,
-
-1, 2, 5, 7, -1,
-1, 7, 5, 2, -1,
-
-7, 5, 11, 8, -1,
-7, 8, 11, 5, -1,
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				#texCoordIndex     []
-			}
-		}#enehelft
-
-	Transform {
-		children [
-
-			USE enehelft
-		]
-	rotation 0 1 0 3.1415927
-	translation	0 0 -0.07
-	}
-	Transform {
-
-		children [
-		DEF vlakdeel Shape {
-			appearance USE aluminium
-			geometry Box { size 0.18 0.07 0.01 }
-		}#shape
-		]
-	translation -0.03 0 -0.005
-	}
-
-	Transform {
-
-		children [
-		USE vlakdeel 
-		]
-	translation -0.03 0 -0.065
-	}
-
-
-
-	]
-
-translation 0.35 0 0.035
-rotation 0 0 1 1.5707963
-}#deurklink
-
-
-
-# /../boven/deurklink.wrl
-
-DEF deurvorm Shape {
-	appearance DEF deurkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.8 0.8
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 2 0.05 }
-}
+                            ]
+                            translation	0 2.035 0
+                        }
 
 
-]
-translation	0 1.005 0
-}
 
 
 
 
 
 
+                        DEF ruitje Transform {
+                            children [
+                                Shape {
+                                    appearance DEF glas Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.6 0.6 0.9
+                                            emissiveColor     0 0 0
+                                            shininess         0.8
+                                            specularColor     1 1 1
+                                            transparency      0.7
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 0.64 0.01 }
+                                }
 
 
+                            ]
+                            translation	0 2.38 0
+                        }#ruit boven de deur
 
 
-]
-}#deurgroep
+                        #deur
+                        DEF deur Transform {
+                            center -0.4 0 0
+                            children [
 
 
-]
-translation 1.38 0 -3.395
-}
-#ROUTE klikopdeur.touchTime TO TimeSource.startTime
-#ROUTE TimeSource.fraction_changed TO Deuropen.set_fraction
-#ROUTE Deuropen.value_changed TO deur.rotation
-
-
-#deur2
-Transform {
-children[ 	USE dwarslat
-		USE ruitje
-
-#deur
-DEF deurkeukengang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur2 TouchSensor {}
-  DEF TimeSource2 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen2 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 3.155 0 -2.96
-rotation 0 1 0 1.5707963
-}
 
 
-#ROUTE klikopdeur2.touchTime TO TimeSource2.startTime
-#ROUTE TimeSource2.fraction_changed TO Deuropen2.set_fraction
-#ROUTE Deuropen2.value_changed TO deurkeukengang.rotation
-
-
-#deur3
-Transform {
-children[ 	USE dwarslat
-		USE ruitje
-#deur
-DEF deurwoonkamergang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur3 TouchSensor {}
-  DEF TimeSource3 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as: deze deur draait tegengesteld aan de andere
-   DEF Deuropen3 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 1, 0 1 0 2, 0 1 0 2, 0 1 0 1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 3.59 0 -3.395
-rotation 0 1 0 0
-}#deur3
-
-#ROUTE klikopdeur3.touchTime TO TimeSource3.startTime
-#ROUTE TimeSource3.fraction_changed TO Deuropen3.set_fraction
-#ROUTE Deuropen3.value_changed TO deurwoonkamergang.rotation
-
-
-#deur4
-Transform {
-children[ DEF dwarslatafw Transform {
-	children [
-		Shape {
-appearance USE kozijn
-			geometry Box { size	0.93 0.05 0.05 }
-}
 
 
-]
-translation	0 2.035 0
-}
+                                DEF klikopdeur TouchSensor {}
+                                DEF TimeSource TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                                # Animeer het openzwaaien van de deur rond de Y as:
+                                DEF Deuropen OrientationInterpolator {
+                                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                                    keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                                }
 
 
 
 
 
 
+                                # ../boven/deurklink.wrl
 
 
-DEF ruitjeafw Transform {
-	children [
-		Shape {
-appearance USE kozijn 
-			geometry Box { size	0.93 0.64 0.01 }
-}
 
 
-]
-translation	0 2.38 0
-}#ruit boven de deur#deur
-DEF deurwoonkamertrapkast Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur4 TouchSensor {}
-  DEF TimeSource4 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen4 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-Shape { #afwijkende deurmaat
-	appearance USE deurkleur 
-			geometry Box { size	0.93 2 0.05 }
-}
-]
-translation	0 1.005 0
-}
-		
-]
-translation 4.395 0 -3.895
-rotation 0 1 0 -1.5707963
-}#deur4
 
 
-#ROUTE klikopdeur4.touchTime TO TimeSource4.startTime
-#ROUTE TimeSource4.fraction_changed TO Deuropen4.set_fraction
-#ROUTE Deuropen4.value_changed TO deurwoonkamertrapkast.rotation
 
 
 
 
+                                DEF deurklink Transform {
+                                    children [
+                                        DEF enehelft	Shape {
+                                            appearance DEF aluminium Appearance {
+                                                material         Material {
+                                                    ambientIntensity  0.2
+                                                    diffuseColor      0.4 0.4 0.5
+                                                    emissiveColor     0 0 0
+                                                    shininess         0.8
+                                                    specularColor     0.4 0.4 0.5
+                                                }
+                                                texture           NULL
+                                                textureTransform  NULL
+                                            }
+                                            geometry IndexedFaceSet {
+                                                color             NULL
+                                                coord  Coordinate {
+                                                    point [
+                                                        -0.015	0.02	0, #0
+                                                        0.015		0.02	0,
+                                                        0.02		-0.02	0,
+                                                        -0.02		-0.02	0, #3
 
 
-#deur5
-Transform {
-children[ DEF dwarslatafw2 Transform {
-	children [
-		Shape {
-appearance USE kozijn
-			geometry Box { size	0.74 0.05 0.05 }
-}
+                                                        -0.01		-0.015	0.06, #4
+                                                        0.01		-0.015	0.06,
+                                                        -0.01		0.015		0.03,
+                                                        0.01		0.015		0.03,
+
+                                                        0.005		0.1		0.035, #8
+                                                        -0.005	0.1		0.035,
+                                                        -0.005	0.1		0.055,
+                                                        0.005		0.1		0.055,
+
+
+
+                                                    ]
+                                                }
+                                                normal            NULL
+                                                texCoord          NULL
+                                                ccw               TRUE
+                                                colorIndex        []
+                                                colorPerVertex    TRUE
+                                                convex            TRUE
+                                                coordIndex  [
 
 
-]
-translation	0 2.035 0
-}
+                                                    2, 3, 4, 5, -1,
+                                                    2, 5, 4, 3, -1,
 
 
+                                                    4, 5, 11, 10, -1,
+                                                    4, 10, 11, 5, -1,
 
 
+                                                    0, 1, 7, 6, -1,
+                                                    0, 6, 7, 1, -1,
 
 
+                                                    6, 7, 8, 9, -1,
+                                                    6, 9, 8, 7, -1,
 
 
-DEF ruitjeafw2 Transform {
-	children [
-		Shape {
-appearance USE kozijn 
-			geometry Box { size	0.74 0.64 0.01 }
-}
+                                                    8, 9, 10, 11, -1,
+                                                    8, 11, 10, 9, -1,
 
 
-]
-translation	0 2.38 0
-}#ruit boven de deur#deur
-
-DEF deurgangmeterkast Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur5 TouchSensor {}
-  DEF TimeSource5 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen5 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -0.7, 0 1 0 -1.5, 0 1 0 -1.5, 0 1 0 -0.7, 0 1 0 0 ]
-  }
-DEF deurklinkafw Transform {
-	children [
-	USE enehelft
-	Transform {
-		children [
-
-			USE enehelft
-		]
-	rotation 0 1 0 3.1415927
-	translation	0 0 -0.07
-	}
-	Transform {
-
-		children [
-		DEF vlakdeel Shape {
-			appearance USE aluminium
-			geometry Box { size 0.18 0.07 0.01 }
-		}#shape
-		]
-	translation -0.03 0 -0.005
-	}
-
-	Transform {
-
-		children [
-		USE vlakdeel 
-		]
-	translation -0.03 0 -0.065
-	}
-
-
-
-	]
-
-translation 0.32 0 0.035
-rotation 0 0 1 1.5707963
-}#deurklink
-Shape { #afwijkende deurmaat
-	appearance USE deurkleur 
-			geometry Box { size	0.74 2 0.05 }
-}
-]
-translation	0 1.005 0
-}
-		
-]
-translation 4.455 0 -1.92
-rotation 0 1 0 -1.5707963
-}#deur5
-
-#ROUTE klikopdeur5.touchTime TO TimeSource5.startTime
-#ROUTE TimeSource5.fraction_changed TO Deuropen5.set_fraction
-#ROUTE Deuropen5.value_changed TO deurgangmeterkast.rotation
-
-
-#deur6
-Transform {
-children[ 	USE dwarslat
-		USE ruitje
-#deur
-DEF deurtoiletgang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur6 TouchSensor {}
-  DEF TimeSource6 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as: 
-   DEF Deuropen6 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 4.455 0 -1.08
-rotation 0 1 0 -1.5707963
-}#deur6
+                                                    0, 6, 4, 3, -1,
+                                                    0, 3, 4, 6, -1,
 
 
-#ROUTE klikopdeur6.touchTime TO TimeSource6.startTime
-#ROUTE TimeSource6.fraction_changed TO Deuropen6.set_fraction
-#ROUTE Deuropen6.value_changed TO deurtoiletgang.rotation
+                                                    6, 9, 10, 4, -1,
+                                                    6, 4, 10, 9, -1,
 
 
+                                                    1, 2, 5, 7, -1,
+                                                    1, 7, 5, 2, -1,
 
 
-# voordeur.wrl
+                                                    7, 5, 11, 8, -1,
+                                                    7, 8, 11, 5, -1,
 
 
+                                                ]     #default []
+                                                creaseAngle       0
+                                                normalIndex       []
+                                                normalPerVertex   TRUE
+                                                solid             TRUE
+                                                #texCoordIndex     []
+                                            }
+                                        }#enehelft
 
 
+                                        Transform {
+                                            children [
 
 
+                                                USE enehelft
+                                            ]
+                                            rotation 0 1 0 3.1415927
+                                            translation	0 0 -0.07
+                                        }
+                                        Transform {
 
 
-DEF voordeur Transform {
-center 1.11 0 0 
-	children [
+                                            children [
+                                                DEF vlakdeel Shape {
+                                                    appearance USE aluminium
+                                                    geometry Box { size 0.18 0.07 0.01 }
+                                                }#shape
+                                            ]
+                                            translation -0.03 0 -0.005
+                                        }
+
+                                        Transform {
+
+                                            children [
+                                                USE vlakdeel
+                                            ]
+                                            translation -0.03 0 -0.065
+                                        }
 
 
-		Shape {
-appearance DEF deurkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.8 0.8
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-
-	0	0	0.025, #0
-	1.11	0	0.025, #
-	1.11	2.19	0.025, #
-	0	2.19	0.025, #3
-				
-	0.71	0.49	0.025, #4
-	0.91	0.49	0.025, #
-	0.91	1.99	0.025, #
-	0.71	1.99	0.025, #7
-
-	0	0	-0.025, #8
-	1.11	0	-0.025, #
-	1.11	2.19	-0.025, #
-	0	2.19	-0.025, #11
-				
-	0.71	0.49	-0.025, #12
-	0.91	0.49	-0.025, #
-	0.91	1.99	-0.025, #
-	0.71	1.99	-0.025, #15
-	]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-	0, 1, 5, 4, -1, 
-
-	1, 2, 6, 5, -1,
-
-	6, 2, 3, 7, -1,
-
-	0, 4, 7, 3, -1, 
-
-
-	1, 0, 8, 9, -1,
-
-	3, 2, 10, 11, -1,
-
-	0, 3, 11, 8, -1,
-
-	2, 1, 9, 10, -1,
-
-
-	5, 6, 14, 13, -1,
-
-	4, 5, 13, 12, -1,
-
-	6, 7, 15, 14, -1,
-
-	7, 4, 12, 15, -1,
-
-	
-	9, 8, 12, 13, -1,
-	
-	10, 9, 13, 14, -1,
-
-	11, 10, 14, 15, -1, 
-
-	12, 8, 11, 15, -1,
-
-
-
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-
-DEF klikopvoordeur TouchSensor {}
-  DEF TimeSourcevoor TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-  DEF VoorDeuropen OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -0.7, 0 1 0 -1.5, 0 1 0 -1.5, 0 1 0 -0.7, 0 1 0 0 ]
-  }
-
-DEF deurgreep Transform{
-children[
-		Shape {
-	appearance DEF aluminium Appearance {
-		material         Material {
-		ambientIntensity  0.2
-		diffuseColor      0.4 0.4 0.4
-		emissiveColor     0 0 0
-		shininess         0.8
-		specularColor     0.9 0.9 0.9
-		transparency      0
-		}
-		texture           NULL
-		textureTransform  NULL
-		}
-			geometry Box { size	0.2	0.2	0.004	}
-}
 
 
-]
-translation	0.15	0.9	0.067
-}
 
 
+                                    ]
 
 
-DEF steunblokje Transform{
-children[
-		Shape {
-	appearance DEF aluminium Appearance {
-		material         Material {
-		ambientIntensity  0.2
-		diffuseColor      0.4 0.4 0.4
-		emissiveColor     0 0 0
-		shininess         0.8
-		specularColor     0.9 0.9 0.9
-		transparency      0
-		}
-		texture           NULL
-		textureTransform  NULL
-		}
-			geometry Box { size	0.14	0.14	0.04	}
-}
+                                    translation 0.35 0 0.035
+                                    rotation 0 0 1 1.5707963
+                                }#deurklink
 
 
-]
-translation	0.15	0.9	0.045
-}
 
 
-DEF ruitjeindeur Transform{
-children[
-		Shape {
-	appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.2	1.5	0.01	}
-}
 
 
-]
-translation	0.81	1.24	0
-}
+                                # /../boven/deurklink.wrl
 
 
-	]
-translation 3.25	0.05	-0.14
-}
+                                DEF deurvorm Shape {
+                                    appearance DEF deurkleur Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.8 0.8 0.8
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 2 0.05 }
+                                }
 
 
-#ROUTE klikopvoordeur.touchTime TO TimeSourcevoor.startTime
-#ROUTE TimeSourcevoor.fraction_changed TO VoorDeuropen.set_fraction
-#ROUTE VoorDeuropen.value_changed TO voordeur.rotation
+                            ]
+                            translation	0 1.005 0
+                        }
 
 
-# /voordeur.wrl
 
 
-# achterdeur.wrl
 
 
 
 
 
 
-#bevat ook schuurdeur
+                    ]
+                }#deurgroep
 
 
+            ]
+            translation 1.38 0 -3.395
+        }
+        ROUTE klikopdeur.touchTime TO TimeSource.startTime
+        ROUTE TimeSource.fraction_changed TO Deuropen.set_fraction
+        ROUTE Deuropen.value_changed TO deur.rotation
+
+
+        #deur2
+        Transform {
+            children[ 	USE dwarslat
+                USE ruitje
+
+                #deur
+                DEF deurkeukengang Transform {
+                    center -0.4 0 0
+                    children [
+
+
+
+                        DEF klikopdeur2 TouchSensor {}
+                        DEF TimeSource2 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                        # Animeer het openzwaaien van de deur rond de Y as:
+                        DEF Deuropen2 OrientationInterpolator {
+                            key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                            keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                        }
+                        USE deurklink
+                        USE deurvorm
+                    ]
+                    translation	0 1.005 0
+                }
 
 
-DEF achterdeur Transform {
-center 0 0 0 
-	children [
+            ]
+            translation 3.155 0 -2.96
+            rotation 0 1 0 1.5707963
+        }
 
 
+        ROUTE klikopdeur2.touchTime TO TimeSource2.startTime
+        ROUTE TimeSource2.fraction_changed TO Deuropen2.set_fraction
+        ROUTE Deuropen2.value_changed TO deurkeukengang.rotation
+
+
+        #deur3
+        Transform {
+            children[ 	USE dwarslat
+                USE ruitje
+                #deur
+                DEF deurwoonkamergang Transform {
+                    center -0.4 0 0
+                    children [
+
+
+
+                        DEF klikopdeur3 TouchSensor {}
+                        DEF TimeSource3 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                        # Animeer het openzwaaien van de deur rond de Y as: deze deur draait tegengesteld aan de andere
+                        DEF Deuropen3 OrientationInterpolator {
+                            key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                            keyValue [ 0 1 0 0, 0 1 0 1, 0 1 0 2, 0 1 0 2, 0 1 0 1, 0 1 0 0 ]
+                        }
+                        USE deurklink
+                        USE deurvorm
+                    ]
+                    translation	0 1.005 0
+                }
 
 
-		Shape {
-appearance DEF deurkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.8 0.8
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry DEF deurInd IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
+            ]
+            translation 3.59 0 -3.395
+            rotation 0 1 0 0
+        }#deur3
 
 
-	0.93	0	-0.025, #0
-	0	0	-0.025, #
-	0	2.09	-0.025, #
-	0.93	2.09	-0.025, #3
+        ROUTE klikopdeur3.touchTime TO TimeSource3.startTime
+        ROUTE TimeSource3.fraction_changed TO Deuropen3.set_fraction
+        ROUTE Deuropen3.value_changed TO deurwoonkamergang.rotation
 
 
-	0.765	0.6	-0.025, #4
-	0.165	0.6	-0.025, #
-	0.165	1.9	-0.025, #
-	0.765	1.9	-0.025, #7
 
 
-	0.93	0	0.025, #0
-	0	0	0.025, #
-	0	2.09	0.025, #
-	0.93	2.09	0.025, #3
+        #deur4
+        Transform {
+            children[ DEF dwarslatafw Transform {
+                    children [
+                        Shape {
+                            appearance USE kozijn
+                            geometry Box { size	0.93 0.05 0.05 }
+                        }
 
 
-	0.765	0.6	0.025, #4
-	0.165	0.6	0.025, #
-	0.165	1.9	0.025, #
-	0.765	1.9	0.025, #7
+                    ]
+                    translation	0 2.035 0
+                }
 
 
-	]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-	0, 1, 5, 4, -1, 
 
 
-	1, 2, 6, 5, -1,
 
 
-	6, 2, 3, 7, -1,
 
 
-	0, 4, 7, 3, -1, 
+                DEF ruitjeafw Transform {
+                    children [
+                        Shape {
+                            appearance USE kozijn
+                            geometry Box { size	0.93 0.64 0.01 }
+                        }
 
 
+                    ]
+                    translation	0 2.38 0
+                }#ruit boven de deur#deur
+                DEF deurwoonkamertrapkast Transform {
+                    center -0.4 0 0
+                    children [
 
 
-	1, 0, 8, 9, -1,
 
 
-	3, 2, 10, 11, -1,
 
 
-	0, 3, 11, 8, -1,
+                        DEF klikopdeur4 TouchSensor {}
+                        DEF TimeSource4 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                        # Animeer het openzwaaien van de deur rond de Y as:
+                        DEF Deuropen4 OrientationInterpolator {
+                            key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                            keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                        }
+                        USE deurklink
+                        Shape { #afwijkende deurmaat
+                            appearance USE deurkleur
+                            geometry Box { size	0.93 2 0.05 }
+                        }
+                    ]
+                    translation	0 1.005 0
+                }
 
 
-	2, 1, 9, 10, -1,
+            ]
+            translation 4.395 0 -3.895
+            rotation 0 1 0 -1.5707963
+        }#deur4
 
 
+        ROUTE klikopdeur4.touchTime TO TimeSource4.startTime
+        ROUTE TimeSource4.fraction_changed TO Deuropen4.set_fraction
+        ROUTE Deuropen4.value_changed TO deurwoonkamertrapkast.rotation
 
 
-	5, 6, 14, 13, -1,
 
 
-	4, 5, 13, 12, -1,
 
 
-	6, 7, 15, 14, -1,
+        #deur5
+        Transform {
+            children[ DEF dwarslatafw2 Transform {
+                    children [
+                        Shape {
+                            appearance USE kozijn
+                            geometry Box { size	0.74 0.05 0.05 }
+                        }
 
 
-	7, 4, 12, 15, -1,
+                    ]
+                    translation	0 2.035 0
+                }
 
 
-	
-	9, 8, 12, 13, -1,
-	
-	10, 9, 13, 14, -1,
 
 
-	11, 10, 14, 15, -1, 
 
 
-	12, 8, 11, 15, -1,
 
 
+                DEF ruitjeafw2 Transform {
+                    children [
+                        Shape {
+                            appearance USE kozijn
+                            geometry Box { size	0.74 0.64 0.01 }
+                        }
 
 
+                    ]
+                    translation	0 2.38 0
+                }#ruit boven de deur#deur
 
 
+                DEF deurgangmeterkast Transform {
+                    center -0.4 0 0
+                    children [
 
 
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
 
 
-DEF klikopachterdeur TouchSensor {}
-  DEF TimeSourceachter TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-  DEF achterDeuropen OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 0.7, 0 1 0 1.5, 0 1 0 1.5, 0 1 0 0.7, 0 1 0 0 ]
-  }
+                        DEF klikopdeur5 TouchSensor {}
+                        DEF TimeSource5 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                        # Animeer het openzwaaien van de deur rond de Y as:
+                        DEF Deuropen5 OrientationInterpolator {
+                            key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                            keyValue [ 0 1 0 0, 0 1 0 -0.7, 0 1 0 -1.5, 0 1 0 -1.5, 0 1 0 -0.7, 0 1 0 0 ]
+                        }
+                        DEF deurklinkafw Transform {
+                            children [
+                                USE enehelft
+                                Transform {
+                                    children [
 
 
+                                        USE enehelft
+                                    ]
+                                    rotation 0 1 0 3.1415927
+                                    translation	0 0 -0.07
+                                }
+                                Transform {
 
 
+                                    children [
+                                        DEF vlakdeel Shape {
+                                            appearance USE aluminium
+                                            geometry Box { size 0.18 0.07 0.01 }
+                                        }#shape
+                                    ]
+                                    translation -0.03 0 -0.005
+                                }
 
 
-Transform {
-    # ../boven/deurklink.wrl
+                                Transform {
 
 
+                                    children [
+                                        USE vlakdeel
+                                    ]
+                                    translation -0.03 0 -0.065
+                                }
 
 
 
 
 
 
+                            ]
 
 
-DEF deurklink Transform {
-	children [
-	    DEF enehelft	Shape {
-            appearance DEF aluminium Appearance {
-                material         Material {
-                ambientIntensity  0.2
-                diffuseColor      0.4 0.4 0.5
-                emissiveColor     0 0 0
-                shininess         0.8
-                specularColor     0.4 0.4 0.5
+                            translation 0.32 0 0.035
+                            rotation 0 0 1 1.5707963
+                        }#deurklink
+                        Shape { #afwijkende deurmaat
+                            appearance USE deurkleur
+                            geometry Box { size	0.74 2 0.05 }
+                        }
+                    ]
+                    translation	0 1.005 0
                 }
                 }
-                texture           NULL
-                textureTransform  NULL
-            }
-		    geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {
-					point [
-                        -0.015	0.02	0, #0
-                        0.015		0.02	0,
-                        0.02		-0.02	0,
-                        -0.02		-0.02	0, #3
-
-                        -0.01		-0.015	0.06, #4
-                        0.01		-0.015	0.06,
-                        -0.01		0.015		0.03,
-                        0.01		0.015		0.03,
-
-                        0.005		0.1		0.035, #8
-                        -0.005	0.1		0.035,
-                        -0.005	0.1		0.055,
-                        0.005		0.1		0.055,
-
-
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-2, 3, 4, 5, -1,
-2, 5, 4, 3, -1,
-
-4, 5, 11, 10, -1, 
-4, 10, 11, 5, -1,
-
-0, 1, 7, 6, -1, 
-0, 6, 7, 1, -1,
-
-6, 7, 8, 9, -1, 
-6, 9, 8, 7, -1,
-
-8, 9, 10, 11, -1, 
-8, 11, 10, 9, -1,
-
-0, 6, 4, 3, -1,
-0, 3, 4, 6, -1,
-
-6, 9, 10, 4, -1, 
-6, 4, 10, 9, -1,
-
-1, 2, 5, 7, -1,
-1, 7, 5, 2, -1,
-
-7, 5, 11, 8, -1,
-7, 8, 11, 5, -1,
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				#texCoordIndex     []
-			}
-		}#enehelft
-
-	Transform {
-		children [
-
-			USE enehelft
-		]
-	rotation 0 1 0 3.1415927
-	translation	0 0 -0.07
-	}
-	Transform {
-
-		children [
-		DEF vlakdeel Shape {
-			appearance USE aluminium
-			geometry Box { size 0.18 0.07 0.01 }
-		}#shape
-		]
-	translation -0.03 0 -0.005
-	}
-
-	Transform {
-
-		children [
-		USE vlakdeel 
-		]
-	translation -0.03 0 -0.065
-	}
-
-
-
-	]
-
-translation 0.35 0 0.035
-rotation 0 0 1 1.5707963
-}#deurklink
 
 
+            ]
+            translation 4.455 0 -1.92
+            rotation 0 1 0 -1.5707963
+        }#deur5
+
+        ROUTE klikopdeur5.touchTime TO TimeSource5.startTime
+        ROUTE TimeSource5.fraction_changed TO Deuropen5.set_fraction
+        ROUTE Deuropen5.value_changed TO deurgangmeterkast.rotation
+
+
+        #deur6
+        Transform {
+            children[ 	USE dwarslat
+                USE ruitje
+                #deur
+                DEF deurtoiletgang Transform {
+                    center -0.4 0 0
+                    children [
+
+
+
+                        DEF klikopdeur6 TouchSensor {}
+                        DEF TimeSource6 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                        # Animeer het openzwaaien van de deur rond de Y as:
+                        DEF Deuropen6 OrientationInterpolator {
+                            key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                            keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                        }
+                        USE deurklink
+                        USE deurvorm
+                    ]
+                    translation	0 1.005 0
+                }
 
 
+            ]
+            translation 4.455 0 -1.08
+            rotation 0 1 0 -1.5707963
+        }#deur6
 
 
-# /../boven/deurklink.wrl
-    translation 0.50 1 0
-}
+        ROUTE klikopdeur6.touchTime TO TimeSource6.startTime
+        ROUTE TimeSource6.fraction_changed TO Deuropen6.set_fraction
+        ROUTE Deuropen6.value_changed TO deurtoiletgang.rotation
 
 
 
 
+        # voordeur.wrl
 
 
 
 
-DEF ruitindeur Transform{
-children[
-		Shape {
-	appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.6	1.3	0.01	}
-}
 
 
-]
-translation	0.465	1.25	0
-}
 
 
-	]
-translation 1.26	0.05	-8.86
-}
+        DEF voordeur Transform {
+            center 1.11 0 0
+            children [
 
 
-#ROUTE klikopachterdeur.touchTime TO TimeSourceachter.startTime
-#ROUTE TimeSourceachter.fraction_changed TO achterDeuropen.set_fraction
-#ROUTE achterDeuropen.value_changed TO achterdeur.rotation
+                Shape {
+                    appearance DEF deurkleur Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.8 0.8 0.8
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
 
 
-#schuurdeur
-DEF schuurdeur Transform {
-children [
+                                0	0	0.025, #0
+                                1.11	0	0.025, #
+                                1.11	2.19	0.025, #
+                                0	2.19	0.025, #3
 
 
-DEF klikopschuurdeur TouchSensor {}
-  DEF TimeSourceschuur TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-  DEF schuurDeuropen OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 1.5707963, 0 1 0 2.4, 0 1 0 3.4, 0 1 0 3.4, 0 1 0 2.4, 0 1 0 1.5707963 ]
-  }
+                                0.71	0.49	0.025, #4
+                                0.91	0.49	0.025, #
+                                0.91	1.99	0.025, #
+                                0.71	1.99	0.025, #7
 
 
-Transform{
-    children[
-        Shape{
-            appearance 	USE deurkleur
-            geometry	USE deurInd
-        }
-    ]
-    scale 0.9139785	1	1   #maakt de deur op maat
-}
+                                0	0	-0.025, #8
+                                1.11	0	-0.025, #
+                                1.11	2.19	-0.025, #
+                                0	2.19	-0.025, #11
 
 
-USE ruitindeur
+                                0.71	0.49	-0.025, #12
+                                0.91	0.49	-0.025, #
+                                0.91	1.99	-0.025, #
+                                0.71	1.99	-0.025, #15
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
 
 
-Transform {
-    children USE deurklink
-    translation 0.43 1 0
-}
+                            0, 1, 5, 4, -1,
 
 
+                            1, 2, 6, 5, -1,
 
 
-]
-translation 3.53	0.05	6.35
-rotation 0 1 0 1.5707963
-}
+                            6, 2, 3, 7, -1,
 
 
-#ROUTE klikopschuurdeur.touchTime TO TimeSourceschuur.startTime
-#ROUTE TimeSourceschuur.fraction_changed TO schuurDeuropen.set_fraction
-#ROUTE schuurDeuropen.value_changed TO schuurdeur.rotation
+                            0, 4, 7, 3, -1,
 
 
-# /achterdeur.wrl
 
 
+                            1, 0, 8, 9, -1,
 
 
+                            3, 2, 10, 11, -1,
 
 
+                            0, 3, 11, 8, -1,
 
 
-# /deuren.wrl
+                            2, 1, 9, 10, -1,
 
 
-# ramen.wrl
 
 
+                            5, 6, 14, 13, -1,
 
 
+                            4, 5, 13, 12, -1,
 
 
+                            6, 7, 15, 14, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF kozijn Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.95 0.95 0.9
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.05 1.3 0.05 }
-}
+                            7, 4, 12, 15, -1,
 
 
-]
-translation	0.625 1.6 -0.14
-}
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.3 0.05 }
-}
+                            9, 8, 12, 13, -1,
 
 
-]
-translation	2.575 1.6 -0.14
-}
-
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.3 0.05 }
-}
-
-]
-translation	1.475 1.6 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.3 0.05 }
-}
+                            10, 9, 13, 14, -1,
 
 
-]
-translation	1.725 1.6 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	2 0.05 0.05 }
-}
+                            11, 10, 14, 15, -1,
 
 
-]
-translation	1.6 0.925 -0.14
-}
+                            12, 8, 11, 15, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	2 0.05 0.05 }
-}
 
 
-]
-translation	1.6 2.275 -0.14
-}
 
 
-#einde keukenraam
 
 
-#begin toiletraam
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 0.7 0.05 }
-}
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             TRUE
+                        texCoordIndex     []
+                    }
+                }
 
 
-]
-translation	4.865 1.95 -0.14
-}
+                DEF klikopvoordeur TouchSensor {}
+                DEF TimeSourcevoor TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                # Animeer het openzwaaien van de deur rond de Y as:
+                DEF VoorDeuropen OrientationInterpolator {
+                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                    keyValue [ 0 1 0 0, 0 1 0 -0.7, 0 1 0 -1.5, 0 1 0 -1.5, 0 1 0 -0.7, 0 1 0 0 ]
+                }
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 0.7 0.05 }
-}
+                DEF deurgreep Transform{
+                    children[
+                        Shape {
+                            appearance DEF aluminium Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.4 0.4 0.4
+                                    emissiveColor     0 0 0
+                                    shininess         0.8
+                                    specularColor     0.9 0.9 0.9
+                                    transparency      0
+                                }
+                                texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry Box { size	0.2	0.2	0.004	}
+                        }
+
+                    ]
+                    translation	0.15	0.9	0.067
+                }
 
 
-]
-translation	5.015 1.95 -0.14
-}
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.1 0.05 0.05 }
-}
+                DEF steunblokje Transform{
+                    children[
+                        Shape {
+                            appearance DEF aluminium Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.4 0.4 0.4
+                                    emissiveColor     0 0 0
+                                    shininess         0.8
+                                    specularColor     0.9 0.9 0.9
+                                    transparency      0
+                                }
+                                texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry Box { size	0.14	0.14	0.04	}
+                        }
+
+                    ]
+                    translation	0.15	0.9	0.045
+                }
 
 
-]
-translation	4.94 1.625 -0.14
-}
+                DEF ruitjeindeur Transform{
+                    children[
+                        Shape {
+                            appearance DEF glas Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.6 0.6 0.9
+                                    emissiveColor     0 0 0
+                                    shininess         0.8
+                                    specularColor     1 1 1
+                                    transparency      0.7
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry Box { size	0.2	1.5	0.01	}
+                        }
+
+                    ]
+                    translation	0.81	1.24	0
+                }
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.1 0.05 0.05 }
-}
+            ]
+            translation 3.25	0.05	-0.14
+        }
 
 
-]
-translation	4.94 2.275 -0.14
-}
+        ROUTE klikopvoordeur.touchTime TO TimeSourcevoor.startTime
+        ROUTE TimeSourcevoor.fraction_changed TO VoorDeuropen.set_fraction
+        ROUTE VoorDeuropen.value_changed TO voordeur.rotation
 
 
-#einde toiletraam
-#voordeur posten
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.26 0.05 }
-}
+        # /voordeur.wrl
 
 
-]
-translation	3.215 1.17 -0.14
-}
+        # achterdeur.wrl
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.26 0.05 }
-}
 
 
-]
-translation	4.395 1.17 -0.14
-}
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.13 0.05 0.05 }
-}
 
 
-]
-translation	3.805 2.275 -0.14
-}
-#einde deurposten
-#begin kozijnen achter
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.1 0.05 }
-}
+        #bevat ook schuurdeur
 
 
-]
-translation	3.215 1.65 -8.86
-}
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.1 0.05 }
-}
 
 
-]
-translation	4.775	1.65 -8.86
-}
+        DEF achterdeur Transform {
+            center 0 0 0
+            children [
 
 
-Transform {
-	children [
-		Shape {
-appearance		DEF blauw Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.3 0.4 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
 
 
-geometry	Box { size	1.51 0.5 0.05 }
-}
+                Shape {
+                    appearance DEF deurkleur Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.8 0.8 0.8
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry DEF deurInd IndexedFaceSet {
+                        color             NULL
+                        coord  Coordinate {	#default NULL
+                            point [
 
 
-]
-translation	3.995 2.45 -8.86
-}
+                                0.93	0	-0.025, #0
+                                0	0	-0.025, #
+                                0	2.09	-0.025, #
+                                0.93	2.09	-0.025, #3
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
+                                0.765	0.6	-0.025, #4
+                                0.165	0.6	-0.025, #
+                                0.165	1.9	-0.025, #
+                                0.765	1.9	-0.025, #7
 
 
-]
-translation	3.995 0.625 -8.86
-}#1
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
+                                0.93	0	0.025, #0
+                                0	0	0.025, #
+                                0	2.09	0.025, #
+                                0.93	2.09	0.025, #3
 
 
-]
-translation	3.995 2.175 -8.86
-}#2
+                                0.765	0.6	0.025, #4
+                                0.165	0.6	0.025, #
+                                0.165	1.9	0.025, #
+                                0.765	1.9	0.025, #7
 
 
+                            ]
+                        }
+                        normal            NULL
+                        texCoord          NULL
+                        ccw               TRUE
+                        colorIndex        []
+                        colorPerVertex    TRUE
+                        convex            TRUE
+                        coordIndex  [
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.94 0.05 0.05 }
-}
+                            0, 1, 5, 4, -1,
 
 
-]
-translation	2.72 0.625 -8.86
-}
+                            1, 2, 6, 5, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.99 0.05 0.05 }
-}
+                            6, 2, 3, 7, -1,
 
 
-]
-translation	2.195 2.675 -8.86
-}
+                            0, 4, 7, 3, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1 0.05 0.05 }
-}
 
 
-]
-translation	1.725 2.175 -8.86
-}
+                            1, 0, 8, 9, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.61 0.05 }
-}
+                            3, 2, 10, 11, -1,
 
 
-]
-translation	1.225 1.345 -8.86
-}
+                            0, 3, 11, 8, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.61 0.05 }
-}
+                            2, 1, 9, 10, -1,
 
 
-]
-translation	2.225 1.345 -8.86
-}
 
 
+                            5, 6, 14, 13, -1,
 
 
+                            4, 5, 13, 12, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.5 0.05 }
-}
+                            6, 7, 15, 14, -1,
 
 
-]
-translation	3.565 1.4 -8.86
-}
+                            7, 4, 12, 15, -1,
 
 
-#einde ramen achter
 
 
+                            9, 8, 12, 13, -1,
 
 
+                            10, 9, 13, 14, -1,
 
 
-# /ramen.wrl
+                            11, 10, 14, 15, -1,
 
 
-# ruiten.wrl
+                            12, 8, 11, 15, -1,
 
 
 
 
 
 
 
 
-#begin vensterglas
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.94 2 0.01 }
-}
+                        ]     #default []
+                        creaseAngle       0
+                        normalIndex       []
+                        normalPerVertex   TRUE
+                        solid             TRUE
+                        texCoordIndex     []
+                    }
+                }
 
 
-]
-translation	2.72 1.65 -8.86
-}#ruit 5 achter
+                DEF klikopachterdeur TouchSensor {}
+                DEF TimeSourceachter TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                # Animeer het openzwaaien van de deur rond de Y as:
+                DEF achterDeuropen OrientationInterpolator {
+                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                    keyValue [ 0 1 0 0, 0 1 0 0.7, 0 1 0 1.5, 0 1 0 1.5, 0 1 0 0.7, 0 1 0 0 ]
+                }
 
 
-#ruit1 keuken
-Transform {
-	children [
-		Shape {
-appearance USE glas
-geometry Box { size	0.8 1.3 0.01 }
-}
 
 
-]
-translation	1.05 1.6 -0.14
-}#ruit 1 keuken
 
 
-#ruit3 keuken
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.8 1.3 0.01 }
-}
+                Transform {
+                    # ../boven/deurklink.wrl
+
+
 
 
-]
-translation	2.15 1.6 -0.14
-}#ruit 3 keuken
 
 
-#ruit2 keuken
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.2 1.3 0.01 }
-}
 
 
-]
-translation	1.6 1.6 -0.14
-}#ruit 2 keuken
+                    DEF deurklink Transform {
+                        children [
+                            DEF enehelft	Shape {
+                                appearance DEF aluminium Appearance {
+                                    material         Material {
+                                        ambientIntensity  0.2
+                                        diffuseColor      0.4 0.4 0.5
+                                        emissiveColor     0 0 0
+                                        shininess         0.8
+                                        specularColor     0.4 0.4 0.5
+                                    }
+                                    texture           NULL
+                                    textureTransform  NULL
+                                }
+                                geometry IndexedFaceSet {
+                                    color             NULL
+                                    coord  Coordinate {
+                                        point [
+                                            -0.015	0.02	0, #0
+                                            0.015		0.02	0,
+                                            0.02		-0.02	0,
+                                            -0.02		-0.02	0, #3
 
 
+                                            -0.01		-0.015	0.06, #4
+                                            0.01		-0.015	0.06,
+                                            -0.01		0.015		0.03,
+                                            0.01		0.015		0.03,
 
 
-#toiletruit
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.1 0.6 0.01 }
-}
+                                            0.005		0.1		0.035, #8
+                                            -0.005	0.1		0.035,
+                                            -0.005	0.1		0.055,
+                                            0.005		0.1		0.055,
 
 
-]
-translation	4.94 1.95 -0.14
-}#ruit van toiletraam
 
 
-#ramen achter
 
 
+                                        ]
+                                    }
+                                    normal            NULL
+                                    texCoord          NULL
+                                    ccw               TRUE
+                                    colorIndex        []
+                                    colorPerVertex    TRUE
+                                    convex            TRUE
+                                    coordIndex  [
 
 
+                                        2, 3, 4, 5, -1,
+                                        2, 5, 4, 3, -1,
 
 
+                                        4, 5, 11, 10, -1,
+                                        4, 10, 11, 5, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	1.16 1.5 0.01 }
-}
+                                        0, 1, 7, 6, -1,
+                                        0, 6, 7, 1, -1,
 
 
-]
-translation	4.17 1.4 -8.86
-}#ruit 3 achter
+                                        6, 7, 8, 9, -1,
+                                        6, 9, 8, 7, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.3 1.5 0.01 }
-}
+                                        8, 9, 10, 11, -1,
+                                        8, 11, 10, 9, -1,
 
 
-]
-translation	3.39 1.4 -8.86
-}#ruit 4 achter
+                                        0, 6, 4, 3, -1,
+                                        0, 3, 4, 6, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.95 0.45 0.01 }
-}
+                                        6, 9, 10, 4, -1,
+                                        6, 4, 10, 9, -1,
 
 
-]
-translation	1.725 2.425 -8.86
-}#ruit 6 achter
+                                        1, 2, 5, 7, -1,
+                                        1, 7, 5, 2, -1,
 
 
-# /ruiten.wrl
+                                        7, 5, 11, 8, -1,
+                                        7, 8, 11, 5, -1,
 
 
+                                    ]     #default []
+                                    creaseAngle       0
+                                    normalIndex       []
+                                    normalPerVertex   TRUE
+                                    solid             TRUE
+                                    #texCoordIndex     []
+                                }
+                            }#enehelft
 
 
-# /beneden/beneden.wrl
+                            Transform {
+                                children [
+
+                                    USE enehelft
+                                ]
+                                rotation 0 1 0 3.1415927
+                                translation	0 0 -0.07
+                            }
+                            Transform {
+
+                                children [
+                                    DEF vlakdeel Shape {
+                                        appearance USE aluminium
+                                        geometry Box { size 0.18 0.07 0.01 }
+                                    }#shape
+                                ]
+                                translation -0.03 0 -0.005
+                            }
+
+                            Transform {
+
+                                children [
+                                    USE vlakdeel
+                                ]
+                                translation -0.03 0 -0.065
+                            }
 
 
 
 
-DEF boven Transform {
-children[
 
 
-Transform {
-children[
+                        ]
 
 
-Transform {
-children[
-	Shape {
-appearance DEF groen Appearance {
-	material         Material {
-	ambientIntensity  1
-	diffuseColor      0 1 0
-	emissiveColor     0 1 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry DEF pijl IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0 0 0,
-						0.2 0.2 0,
-						0.2 -0.2 0,
-						
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [	0,1,2,-1, 
-				]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-}#shape
-]
-rotation 0 1 0 3.1415927
-}
+                        translation 0.35 0 0.035
+                        rotation 0 0 1 1.5707963
+                    }#deurklink
 
 
-DEF schuifboven TouchSensor {}
-]
-translation 0.15 2.95 0.3
-}
 
 
-Transform {
-children[
-
-	Shape {
-appearance DEF rood Appearance {
-	material         Material {
-	ambientIntensity  1
-	diffuseColor      1 0 0
-	emissiveColor     1 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
 
 
-geometry USE pijl
-}
+                    # /../boven/deurklink.wrl
+                    translation 0.50 1 0
+                }
 
 
-DEF schuifboven2 TouchSensor {}
-]
 
 
-translation 5.48 2.95 0.3
-}
 
 
-# boven/boven.wrl
 
 
+                DEF ruitindeur Transform{
+                    children[
+                        Shape {
+                            appearance DEF glas Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.6 0.6 0.9
+                                    emissiveColor     0 0 0
+                                    shininess         0.8
+                                    specularColor     1 1 1
+                                    transparency      0.7
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry Box { size	0.6	1.3	0.01	}
+                        }
 
 
+                    ]
+                    translation	0.465	1.25	0
+                }
 
 
+            ]
+            translation 1.26	0.05	-8.86
+        }
 
 
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       2.5 3.75 -2.5
+        ROUTE klikopachterdeur.touchTime TO TimeSourceachter.startTime
+        ROUTE TimeSourceachter.fraction_changed TO achterDeuropen.set_fraction
+        ROUTE achterDeuropen.value_changed TO achterdeur.rotation
 
 
-	description    "Ouderslaapkamer"
-}
+        #schuurdeur
+        DEF schuurdeur Transform {
+            children [
 
 
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       2.5 3.75 -5
+                DEF klikopschuurdeur TouchSensor {}
+                DEF TimeSourceschuur TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                # Animeer het openzwaaien van de deur rond de Y as:
+                DEF schuurDeuropen OrientationInterpolator {
+                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                    keyValue [ 0 1 0 1.5707963, 0 1 0 2.4, 0 1 0 3.4, 0 1 0 3.4, 0 1 0 2.4, 0 1 0 1.5707963 ]
+                }
 
 
-	description    "Tweede slaapkamer"
-}
+                Transform{
+                    children[
+                        Shape{
+                            appearance 	USE deurkleur
+                            geometry	USE deurInd
+                        }
+                    ]
+                    scale 0.9139785	1	1   #maakt de deur op maat
+                }
 
 
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       4.5 3.75 -7
+                USE ruitindeur
 
 
-	description    "Kinderkamer"
-}
+                Transform {
+                    children USE deurklink
+                    translation 0.43 1 0
+                }
 
 
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       4.5 3.75 -1.5
 
 
-	description    "Badkamer"
-}
+            ]
+            translation 3.53	0.05	6.35
+            rotation 0 1 0 1.5707963
+        }
 
 
+        ROUTE klikopschuurdeur.touchTime TO TimeSourceschuur.startTime
+        ROUTE TimeSourceschuur.fraction_changed TO schuurDeuropen.set_fraction
+        ROUTE schuurDeuropen.value_changed TO schuurdeur.rotation
 
 
+        # /achterdeur.wrl
 
 
-#dak van schuur
 
 
-Transform {
-children [
-Shape {
-appearance  DEF appdak Appearance {
-	 material          Material {
-  	ambientIntensity  0
-  	diffuseColor      0.2 0.2 0.2
-  	emissiveColor     0 0 0
-  	shininess         0
-  	specularColor     0 0 0 
-  	transparency      0
-			  }
 
 
-  texture           ImageTexture {
-  			  url     [""]
-  			  repeatS TRUE
-  			  repeatT TRUE
- 			  }
-}
 
 
-geometry Box { size 2.24 0.04 3.24	}
-}
-]
-translation 4.6 2.62 6.2
-}
+        # /deuren.wrl
 
 
+        # ramen.wrl
 
 
-DEF plafond Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 1 1
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.14	2.70	-0.14,
-						5.54	2.70	-0.14,
-						5.54	2.70	-8.86,
-						0.14	2.70	-8.86,
-
-						5.54	2.70	-2.36, #-4
-						5.54	2.70	-4.36,
-						4.42	2.70	-4.36,
-						4.42	2.70	-2.36,
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 1, 4, 7, -1, 
-		0, 7, 4, 1, -1, 
-
-		0, 7, 6, 3, -1,
-		0, 3, 6, 7, -1, 
-
-		5, 2, 3, 6, -1, 
-		5, 6, 3, 2, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
 
 
 
 
 
 
-DEF vloerboven Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.14	2.80	-0.14,
-						5.54	2.80	-0.14,
-						5.54	2.80	-8.86,
-						0.14	2.80	-8.86,
-
-						5.54	2.80	-2.36, #-4
-						5.54	2.8	-4.36,
-						4.42	2.8	-4.36,
-						4.42	2.8	-2.36,
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 1, 4, 7, -1, 
-		0, 7, 4, 1, -1, 
-
-		0, 7, 6, 3, -1,
-		0, 3, 6, 7, -1, 
-
-		5, 2, 3, 6, -1, 
-		5, 6, 3, 2, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+        Transform {
+            children [
+                Shape {
+                    appearance DEF kozijn Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.95 0.95 0.9
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry Box { size	0.05 1.3 0.05 }
+                }
 
 
+            ]
+            translation	0.625 1.6 -0.14
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 1.3 0.05 }
+                }
 
 
+            ]
+            translation	2.575 1.6 -0.14
+        }
 
 
-DEF stukmuur1 Transform {
-children[
-	Shape {
-	appearance DEF wandkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-		geometry 	Box {
-	size	2.84 2.50 0.07
-				}
 
 
-	}
- ]
-translation		1.7	4.05 -4.565
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 1.3 0.05 }
+                }
 
 
-DEF stukmuur2 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 0.7
-				}
-
-	}
- ]
-translation		3.155	4.05 -4.28
-}
+            ]
+            translation	1.475 1.6 -0.14
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 1.3 0.05 }
+                }
 
 
-DEF stukmuur3 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.68 3.57
-				}
+            ]
+            translation	1.725 1.6 -0.14
+        }
 
 
-	}
- ]
-translation		3.155	4.05 -7.215
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	2 0.05 0.05 }
+                }
 
 
-DEF stukmuur4 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 2.85
-				}
-
-	}
- ]
-translation		3.155	4.05 -1.705
-}
+            ]
+            translation	1.6 0.925 -0.14
+        }
 
 
-DEF stukmuur5 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.42 2.50 0.07
-				}
-
-	}
- ]
-translation		3.4	4.05 -2.325
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	2 0.05 0.05 }
+                }
 
 
-DEF stukmuur6 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.50 0.07
-				}
-
-	}
- ]
-translation		4.91	4.05 -2.325
-}
+            ]
+            translation	1.6 2.275 -0.14
+        }
 
 
-DEF stukmuur7 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	1.34 2.50 0.07
-				}
-
-	}
- ]
-translation		4.73	4.05 -4.395
-}
+        #einde keukenraam
 
 
+        #begin toiletraam
 
 
-DEF stukmuur8 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 1.2
-				}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 0.7 0.05 }
+                }
 
 
-	}
- ]
-translation		4.025	4.05 -4.96
-}
+            ]
+            translation	4.865 1.95 -0.14
+        }
 
 
-DEF vulstukvoortrap Transform {
-	children [
-		Shape {
-appearance USE wandkleur
-
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						4.42	2.7	-2.36,
-						4.42	2.7	-3.36,
-						4.42	2.8	-3.36,
-						4.42	2.8	-2.36,
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	0, 1, 2, 3, -1,
-	0, 3, 2, 1, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 0.7 0.05 }
+                }
 
 
+            ]
+            translation	5.015 1.95 -0.14
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.1 0.05 0.05 }
+                }
 
 
-DEF paalvoortrap Transform {
-children[
-Shape {
-appearance 	USE wandkleur
-geometry	Box { size	0.07	2.50	0.07	}
-}
-]
-translation 4.385	4.05	-3.36
-}
+            ]
+            translation	4.94 1.625 -0.14
+        }
 
 
-# deuren.wrl
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.1 0.05 0.05 }
+                }
 
 
+            ]
+            translation	4.94 2.275 -0.14
+        }
 
 
+        #einde toiletraam
+        #voordeur posten
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.26 0.05 }
+                }
 
 
+            ]
+            translation	3.215 1.17 -0.14
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.26 0.05 }
+                }
 
 
-#Deuren boven
+            ]
+            translation	4.395 1.17 -0.14
+        }
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	1.13 0.05 0.05 }
+                }
 
 
-#deur7
-Transform {
-children[ 
+            ]
+            translation	3.805 2.275 -0.14
+        }
+        #einde deurposten
+        #begin kozijnen achter
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.1 0.05 }
+                }
 
 
-#dwarslat boven de deur
-DEF dwarslat Transform {
-	children [
-		Shape {
-appearance DEF kozijn Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.95 0.95 0.9
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 0.05 0.05 }
-}
+            ]
+            translation	3.215 1.65 -8.86
+        }
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.1 0.05 }
+                }
 
 
-]
-translation	0 2.035 0
-}
+            ]
+            translation	4.775	1.65 -8.86
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance		DEF blauw Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.3 0.4 0.7
+                            emissiveColor     0 0 0
+                            shininess         0.1
+                            specularColor     0 0 0
+                            transparency      0
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+
+                    geometry	Box { size	1.51 0.5 0.05 }
+                }
 
 
+            ]
+            translation	3.995 2.45 -8.86
+        }
 
 
-DEF ruitjeboven Transform {
-	children [
-		Shape {
-appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 0.44 0.01 }
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	1.51 0.05 0.05 }
+                }
 
 
-]
-translation	0 2.28 0
-}#ruit boven de deur
+            ]
+            translation	3.995 0.625 -8.86
+        }#1
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	1.51 0.05 0.05 }
+                }
 
 
-#deur
-DEF deuroudersgang Transform {
-center -0.4 0 0
-	children [
+            ]
+            translation	3.995 2.175 -8.86
+        }#2
 
 
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.94 0.05 0.05 }
+                }
 
 
-	DEF klikopdeur7 TouchSensor {}
-  DEF TimeSource7 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen7 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
+            ]
+            translation	2.72 0.625 -8.86
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	1.99 0.05 0.05 }
+                }
 
 
-DEF deurklink # deurklink.wrl
+            ]
+            translation	2.195 2.675 -8.86
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	1 0.05 0.05 }
+                }
 
 
+            ]
+            translation	1.725 2.175 -8.86
+        }
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.61 0.05 }
+                }
 
 
+            ]
+            translation	1.225 1.345 -8.86
+        }
 
 
-DEF deurklink Transform {
-	children [
-	    DEF enehelft	Shape {
-            appearance DEF aluminium Appearance {
-                material         Material {
-                ambientIntensity  0.2
-                diffuseColor      0.4 0.4 0.5
-                emissiveColor     0 0 0
-                shininess         0.8
-                specularColor     0.4 0.4 0.5
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 2.61 0.05 }
                 }
                 }
-                texture           NULL
-                textureTransform  NULL
-            }
-		    geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {
-					point [
-                        -0.015	0.02	0, #0
-                        0.015		0.02	0,
-                        0.02		-0.02	0,
-                        -0.02		-0.02	0, #3
-
-                        -0.01		-0.015	0.06, #4
-                        0.01		-0.015	0.06,
-                        -0.01		0.015		0.03,
-                        0.01		0.015		0.03,
-
-                        0.005		0.1		0.035, #8
-                        -0.005	0.1		0.035,
-                        -0.005	0.1		0.055,
-                        0.005		0.1		0.055,
-
-
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-2, 3, 4, 5, -1,
-2, 5, 4, 3, -1,
-
-4, 5, 11, 10, -1, 
-4, 10, 11, 5, -1,
-
-0, 1, 7, 6, -1, 
-0, 6, 7, 1, -1,
-
-6, 7, 8, 9, -1, 
-6, 9, 8, 7, -1,
-
-8, 9, 10, 11, -1, 
-8, 11, 10, 9, -1,
-
-0, 6, 4, 3, -1,
-0, 3, 4, 6, -1,
-
-6, 9, 10, 4, -1, 
-6, 4, 10, 9, -1,
-
-1, 2, 5, 7, -1,
-1, 7, 5, 2, -1,
-
-7, 5, 11, 8, -1,
-7, 8, 11, 5, -1,
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				#texCoordIndex     []
-			}
-		}#enehelft
-
-	Transform {
-		children [
-
-			USE enehelft
-		]
-	rotation 0 1 0 3.1415927
-	translation	0 0 -0.07
-	}
-	Transform {
-
-		children [
-		DEF vlakdeel Shape {
-			appearance USE aluminium
-			geometry Box { size 0.18 0.07 0.01 }
-		}#shape
-		]
-	translation -0.03 0 -0.005
-	}
-
-	Transform {
-
-		children [
-		USE vlakdeel 
-		]
-	translation -0.03 0 -0.065
-	}
-
-
-
-	]
-
-translation 0.35 0 0.035
-rotation 0 0 1 1.5707963
-}#deurklink
-
 
 
+            ]
+            translation	2.225 1.345 -8.86
+        }
 
 
-# /deurklink.wrl
 
 
 
 
-DEF deurvorm Shape {
-	appearance DEF deurkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.8 0.8
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry Box { size	0.8 2 0.05 }
-}]
-translation	0 1.005 0
-}
-		
-]
-translation 3.155 2.8 -3.53
-rotation 0 1 0 1.5707963
-}
-
-#ROUTE klikopdeur7.touchTime TO TimeSource7.startTime
-#ROUTE TimeSource7.fraction_changed TO Deuropen7.set_fraction
-#ROUTE Deuropen7.value_changed TO deuroudersgang.rotation
-
-#deur8
-Transform {
-children[ 	USE dwarslat
-		USE ruitjeboven 
-
-#deur
-DEF deurtweedeslaapkamergang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	DEF klikopdeur8 TouchSensor {}
-  DEF TimeSource8 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen8 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 3.155 2.8 -5.03
-rotation 0 1 0 -1.5707963
-}
+        Transform {
+            children [
+                Shape {
+                    appearance	USE kozijn
+                    geometry	Box { size	0.05 1.5 0.05 }
+                }
 
 
-#ROUTE klikopdeur8.touchTime TO TimeSource8.startTime
-#ROUTE TimeSource8.fraction_changed TO Deuropen8.set_fraction
-#ROUTE Deuropen8.value_changed TO deurtweedeslaapkamergang.rotation
+            ]
+            translation	3.565 1.4 -8.86
+        }
 
 
+        #einde ramen achter
 
 
-#deur9
-Transform {
-children[ 	USE dwarslat
-		USE ruitjeboven 
 
 
-#deur
-DEF deurkinderkamergang Transform {
-center -0.4 0 0
-	children [
 
 
+        # /ramen.wrl
 
 
+        # ruiten.wrl
 
 
-	DEF klikopdeur9 TouchSensor {}
-  DEF TimeSource9 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen9 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 3.59 2.8 -5.465
-rotation 0 1 0 3.1415927
-}
 
 
-#ROUTE klikopdeur9.touchTime TO TimeSource9.startTime
-#ROUTE TimeSource9.fraction_changed TO Deuropen9.set_fraction
-#ROUTE Deuropen9.value_changed TO deurkinderkamergang.rotation
 
 
 
 
-#deur10
-Transform {
-children[ 	USE dwarslat
-		USE ruitjeboven 
+        #begin vensterglas
 
 
-#deur
-DEF deurbadkamergang Transform {
-center -0.4 0 0
-	children [
+        Transform {
+            children [
+                Shape {
+                    appearance DEF glas Appearance {
+                        material         Material {
+                            ambientIntensity  0.2
+                            diffuseColor      0.6 0.6 0.9
+                            emissiveColor     0 0 0
+                            shininess         0.8
+                            specularColor     1 1 1
+                            transparency      0.7
+                        }	texture           NULL
+                        textureTransform  NULL
+                    }
+                    geometry Box { size	0.94 2 0.01 }
+                }
 
 
+            ]
+            translation	2.72 1.65 -8.86
+        }#ruit 5 achter
 
 
+        #ruit1 keuken
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.8 1.3 0.01 }
+                }
 
 
-	DEF klikopdeur10 TouchSensor {}
-  DEF TimeSource10 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
-  # Animeer het openzwaaien van de deur rond de Y as:
-   DEF Deuropen10 OrientationInterpolator {
-       key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
-       keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
-  }
-USE deurklink
-USE deurvorm
-]
-translation	0 1.005 0
-}
-		
-]
-translation 4.01 2.8 -2.325
-rotation 0 1 0 0
-}
+            ]
+            translation	1.05 1.6 -0.14
+        }#ruit 1 keuken
 
 
+        #ruit3 keuken
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.8 1.3 0.01 }
+                }
 
 
+            ]
+            translation	2.15 1.6 -0.14
+        }#ruit 3 keuken
 
 
-#ROUTE klikopdeur10.touchTime TO TimeSource10.startTime
-#ROUTE TimeSource10.fraction_changed TO Deuropen10.set_fraction
-#ROUTE Deuropen10.value_changed TO deurbadkamergang.rotation
+        #ruit2 keuken
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.2 1.3 0.01 }
+                }
 
 
+            ]
+            translation	1.6 1.6 -0.14
+        }#ruit 2 keuken
 
 
-# /deuren.wrl
 
 
-# trapboven.wrl
+        #toiletruit
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.1 0.6 0.01 }
+                }
 
 
+            ]
+            translation	4.94 1.95 -0.14
+        }#ruit van toiletraam
 
 
+        #ramen achter
 
 
 
 
 
 
 
 
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	1.16 1.5 0.01 }
+                }
 
 
+            ]
+            translation	4.17 1.4 -8.86
+        }#ruit 3 achter
 
 
-DEF trapboven Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material          Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry DEF trap2 IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-	-0.2	0	1, #0
-	0	0.2	1,
-	0	0.2	0,
-	-0.2	0	0, #3
-
-	0.28	0.4	1, #4
-	0.6	0.6	1,
-	0.98	0.8	1,
-	0.98	1	0.45, #7
-
-	0.98	1.2	0.25, #8
-	0.98	1.4	0, 
-	0.98	1.6	-0.25, 
-	0.98	1.8	-0.45, #11
-
-	0.98	2.0	-1, #12
-	0.6	2.2	-1,
-	0.28	2.4	-1,
-	0	2.6	-1, #15
-
-	0	0.6	0, #16
-	0	0.8	0,
-	0	1	0, #18
-	0	1.2	0, #19
-
-	0	1.4	0, #20
-	0	1.6	0,
-	0	1.8	0, #22
-	0	2	0, #23
-
-	0	2.2	0, #24
-	0	2.4	0, 
-	0	2.6	0,  
-	0	2.8	0,  #27
-
-	-0.2	0.2	1, #28
-	0	0.4	1,
-	0	0.4	0,
-	-0.2	0.2	0, #31
-
-	0.28	0.6	1, #32
-	0.6	0.8	1,
-	0.98	1	1,
-	0.98	1.2	0.45, #35
-
-	0.98	1.4	0.25, #36
-	0.98	1.6	0, 
-	0.98	1.8	-0.25, 
-	0.98	2	-0.45, #39
-
-	0.98	2.2	-1, #40
-	0.6	2.4	-1,
-	0.28	2.6	-1,
-	0	2.8	-1, #43
-
-	0	0	1,
-	0	0	0, #45
-	0	0.4	0, #46
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-
-	28, 1, 2, 31, -1, #1e_treevlak
-	29, 4, 46, -1, #2e
-	32, 5, 16, -1,
-	33, 6, 17, -1,
-	34, 7, 18, -1, 
-	35, 8, 19, -1, 
-	36, 9, 20, -1, 
-	37, 10, 21, -1,
-	38, 11, 22, -1,
-	39, 12, 23, -1,
-	40, 13, 24, -1,
-	41, 14, 25, -1,
-	42, 15, 26, -1, #13e_treevlak
-
-#	0, 28, 31, 3, -1, #voor_en_zijvlakken_van_de_eerste_tree_komt_boven_niet_voor
-#	0, 44, 1, 28, -1,
-#	3, 31, 2, 45, -1,
-
-	2, 1, 29, 30, -1, #alle_voorvlakken
-	46, 4, 32, 16, -1,
-	16, 5, 33, 17, -1,
-	17, 6, 34, 18, -1,
-	18, 7, 35, 19, -1, 
-	19, 8, 36, 20, -1,
-	20, 9, 37, 21, -1,
-	21, 10, 38, 22, -1,
-	22, 11, 39, 23, -1,
-	23, 12, 40, 24, -1,
-	24, 13, 41, 25, -1,
-	25, 14, 42, 26, -1,
-	26, 15, 43, 27, -1,
-
-
-	
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-translation 4.42	2.6	-3.36
-}
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.3 1.5 0.01 }
+                }
 
 
+            ]
+            translation	3.39 1.4 -8.86
+        }#ruit 4 achter
 
 
-# /trapboven.wrl
+        Transform {
+            children [
+                Shape {
+                    appearance USE glas
+                    geometry Box { size	0.95 0.45 0.01 }
+                }
 
 
-# buitmuur.wrl
+            ]
+            translation	1.725 2.425 -8.86
+        }#ruit 6 achter
+
+        # /ruiten.wrl
+
+
+        # /beneden/beneden.wrl
+
+
+        DEF boven Transform {
+            children[
+
+                Transform {
+                    children[
+
+                        Transform {
+                            children[
+                                Shape {
+                                    appearance DEF groen Appearance {
+                                        material         Material {
+                                            ambientIntensity  1
+                                            diffuseColor      0 1 0
+                                            emissiveColor     0 1 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry DEF pijl IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                0 0 0,
+                                                0.2 0.2 0,
+                                                0.2 -0.2 0,
+
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [	0,1,2,-1,
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             FALSE
+                                        texCoordIndex     []
+                                    }
+                                }#shape
+                            ]
+                            rotation 0 1 0 3.1415927
+                        }
+
+                        DEF schuifboven TouchSensor {}
+                    ]
+                    translation 0.15 2.95 0.3
+                }
 
 
+                Transform {
+                    children[
+
+                        Shape {
+                            appearance DEF rood Appearance {
+                                material         Material {
+                                    ambientIntensity  1
+                                    diffuseColor      1 0 0
+                                    emissiveColor     1 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+
+                            geometry USE pijl
+                        }
+
+                        DEF schuifboven2 TouchSensor {}
+                    ]
+
+                    translation 5.48 2.95 0.3
+                }
 
 
+                # boven/boven.wrl
 
 
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF steen Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.4 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0	0	0, #linkerbenedenhoek voorgevel
-						5.68	0	0,
-						5.68	5.40	0,
-						0	5.40	0, #linkerbovenhoek voorgevel
-
-						3.19	0	0, #voordeur
-						4.42	0	0,
-						4.42	2.30	0,
-						3.19	2.30	0, #voordeur
-
-						4.84	1.60	0, #toiletraam-8
-						5.04	1.60	0,
-						5.04	2.30	0,
-						4.84	2.30	0, 
-
-						2.60	0.90	0, #keukenraam-12
-						2.60	2.30	0,
-						0.60	2.30	0,
-						0.60	0.90	0,
-
-						0.60	3.60	0, #bovenraam-16
-						1.50	3.60	0,
-						1.50	5.0	0,
-						4.42	5.0	0,
-						4.42	5.40	0, 
-						0.60	5.40	0,
-
-						0	8.555	-3.15, #linkergevel-22
-						0	2.7	-9.0,
-						0	0	-9.0,
 
 
-						5.68	8.555	-3.15, #rechtergevel-25
-						5.68	5.40	-6.3,
-						5.68	5.40	-9,
-						5.68	0	-9.0,
 
 
-						2.25	0	-9.0, #achtergevel-29
-						2.25	0.6	-9.0,
-						4.8	0.6	-9.0,
-						4.8	5.40	-9.0,
-						1.2	0	-9.0,
-						1.2	2.7	-9,
+                Viewpoint {
+                    fieldOfView    1
+                    jump           TRUE
+                    orientation    1 0 0  0
+                    position       2.5 3.75 -2.5
 
 
+                    description    "Ouderslaapkamer"
+                }
 
 
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
+                Viewpoint {
+                    fieldOfView    1
+                    jump           TRUE
+                    orientation    1 0 0  0
+                    position       2.5 3.75 -5
 
 
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
+                    description    "Tweede slaapkamer"
+                }
 
 
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
+                Viewpoint {
+                    fieldOfView    1
+                    jump           TRUE
+                    orientation    1 0 0  0
+                    position       4.5 3.75 -7
 
 
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
+                    description    "Kinderkamer"
+                }
 
 
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.7	-8.86,	#58
+                Viewpoint {
+                    fieldOfView    1
+                    jump           TRUE
+                    orientation    1 0 0  0
+                    position       4.5 3.75 -1.5
 
 
-						0	2.7	0, #59 extra punten voor segmentering beneden
-						0.14	2.7	-0.14,
+                    description    "Badkamer"
+                }
 
 
-						5.68	2.7	0, #61
-						5.54	2.7	-0.14, #
 
 
-						0	2.7	-9, #63
-						0.14	2.7	-8.86, #
 
 
-						5.68	2.7	-9, #65
-						5.54	2.7	-8.86, #
+                #dak van schuur
+
+                Transform {
+                    children [
+                        Shape {
+                            appearance  DEF appdak Appearance {
+                                material          Material {
+                                    ambientIntensity  0
+                                    diffuseColor      0.2 0.2 0.2
+                                    emissiveColor     0 0 0
+                                    shininess         0
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }
+
+                                texture           ImageTexture {
+                                    url     [""]
+                                    repeatS TRUE
+                                    repeatT TRUE
+                                }
+                            }
+
+                            geometry Box { size 2.24 0.04 3.24	}
+                        }
+                    ]
+                    translation 4.6 2.62 6.2
+                }
 
 
-						1.2	2.7	-9, #67
-						1.2	2.7	-8.86, #
 
 
-						4.8	2.7	-9, #69
-						4.8	2.7	-8.86, #
+                DEF plafond Transform {
+                    children [
+                        Shape {
+                            appearance Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 1 1
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        0.14	2.70	-0.14,
+                                        5.54	2.70	-0.14,
+                                        5.54	2.70	-8.86,
+                                        0.14	2.70	-8.86,
+
+                                        5.54	2.70	-2.36, #-4
+                                        5.54	2.70	-4.36,
+                                        4.42	2.70	-4.36,
+                                        4.42	2.70	-2.36,
+
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+                                    0, 1, 4, 7, -1,
+                                    0, 7, 4, 1, -1,
+
+                                    0, 7, 6, 3, -1,
+                                    0, 3, 6, 7, -1,
+
+                                    5, 2, 3, 6, -1,
+                                    5, 6, 3, 2, -1,
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             TRUE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
-						0.14	5.4	-0.14, #71
-						5.54	5.4	-0.14, #72
-						5.54	5.4	-8.86, #73
-						0.14	2.7	-9, #74
-						0.14	5.4	-6.3, #75
-						0	5.4	-6.3, #76
 
 
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		16, 21, 3, 59, -1,
 
 
-		19, 2, 20, -1,
+                DEF vloerboven Transform {
+                    children [
+                        Shape {
+                            appearance Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 0.5 0.3
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        0.14	2.80	-0.14,
+                                        5.54	2.80	-0.14,
+                                        5.54	2.80	-8.86,
+                                        0.14	2.80	-8.86,
+
+                                        5.54	2.80	-2.36, #-4
+                                        5.54	2.8	-4.36,
+                                        4.42	2.8	-4.36,
+                                        4.42	2.8	-2.36,
+
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+                                    0, 1, 4, 7, -1,
+                                    0, 7, 4, 1, -1,
+
+                                    0, 7, 6, 3, -1,
+                                    0, 3, 6, 7, -1,
+
+                                    5, 2, 3, 6, -1,
+                                    5, 6, 3, 2, -1,
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             TRUE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
-		2, 19, 61, -1,
 
 
-		65, 27, 2, 61, -1, 
 
 
-		59, 3, 76, 23, -1,
 
 
-		17, 48, 47, 16, -1,
+                DEF stukmuur1 Transform {
+                    children[
+                        Shape {
+                            appearance DEF wandkleur Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 0.9 0.7
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry 	Box {
+                                size	2.84 2.50 0.07
+                            }
+
+                        }
+                    ]
+                    translation		1.7	4.05 -4.565
+                }
 
 
-		18, 49, 48, 17, -1,
+                DEF stukmuur2 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.07 2.50 0.7
+                            }
+
+                        }
+                    ]
+                    translation		3.155	4.05 -4.28
+                }
 
 
-		19, 50, 49, 18, -1,
 
 
-		20, 51, 50, 19, -1,
+                DEF stukmuur3 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.07 2.68 3.57
+                            }
 
 
-		16, 47, 52, 21, -1,
+                        }
+                    ]
+                    translation		3.155	4.05 -7.215
+                }
 
 
-		3, 21, 52, 71, -1, 
+                DEF stukmuur4 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.07 2.50 2.85
+                            }
+
+                        }
+                    ]
+                    translation		3.155	4.05 -1.705
+                }
 
 
-		20, 2, 72, 51, -1,
+                DEF stukmuur5 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.42 2.50 0.07
+                            }
+
+                        }
+                    ]
+                    translation		3.4	4.05 -2.325
+                }
 
 
-		2, 27, 73, 72, -1,
+                DEF stukmuur6 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.98 2.50 0.07
+                            }
+
+                        }
+                    ]
+                    translation		4.91	4.05 -2.325
+                }
 
 
-		27, 32, 56, 73, -1,
+                DEF stukmuur7 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	1.34 2.50 0.07
+                            }
+
+                        }
+                    ]
+                    translation		4.73	4.05 -4.395
+                }
 
 
-		63, 64, 75, 76, -1,
 
 
-		3, 76, 75, 71, -1,
+                DEF stukmuur8 Transform {
+                    children[
+                        Shape {
+                            appearance USE wandkleur
+                            geometry 	Box {
+                                size	0.07 2.50 1.2
+                            }
 
 
-		#27, 32, 69, 65, -1,
-		27, 65, 69, 32, -1,
+                        }
+                    ]
+                    translation		4.025	4.05 -4.96
+                }
 
 
-		32, 69, 70, 56, -1,
+                DEF vulstukvoortrap Transform {
+                    children [
+                        Shape {
+                            appearance USE wandkleur
+
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        4.42	2.7	-2.36,
+                                        4.42	2.7	-3.36,
+                                        4.42	2.8	-3.36,
+                                        4.42	2.8	-2.36,
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+                                    0, 1, 2, 3, -1,
+                                    0, 3, 2, 1, -1,
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             TRUE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
-		59, 17, 16, -1,
 
 
-		59, 61, 17, -1,
 
 
-		17, 61 , 18. -1,
+                DEF paalvoortrap Transform {
+                    children[
+                        Shape {
+                            appearance 	USE wandkleur
+                            geometry	Box { size	0.07	2.50	0.07	}
+                        }
+                    ]
+                    translation 4.385	4.05	-3.36
+                }
 
 
-		18, 61, 19, -1,
+                # deuren.wrl
 
 
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
 
 
 
 
 
 
-# /buitmuur.wrl
+                #Deuren boven
+
+                #deur7
+                Transform {
+                    children[
+
+                        #dwarslat boven de deur
+                        DEF dwarslat Transform {
+                            children [
+                                Shape {
+                                    appearance DEF kozijn Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.95 0.95 0.9
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 0.05 0.05 }
+                                }
+
+                            ]
+                            translation	0 2.035 0
+                        }
+
+
+
+                        DEF ruitjeboven Transform {
+                            children [
+                                Shape {
+                                    appearance DEF glas Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.6 0.6 0.9
+                                            emissiveColor     0 0 0
+                                            shininess         0.8
+                                            specularColor     1 1 1
+                                            transparency      0.7
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 0.44 0.01 }
+                                }
+
+                            ]
+                            translation	0 2.28 0
+                        }#ruit boven de deur
 
 
-# binmuur.wrl
+                        #deur
+                        DEF deuroudersgang Transform {
+                            center -0.4 0 0
+                            children [
 
 
 
 
 
 
+                                DEF klikopdeur7 TouchSensor {}
+                                DEF TimeSource7 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                                # Animeer het openzwaaien van de deur rond de Y as:
+                                DEF Deuropen7 OrientationInterpolator {
+                                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                                    keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                                }
+
+
+                                DEF deurklink # deurklink.wrl
+
+
+
+
+
+                                DEF deurklink Transform {
+                                    children [
+                                        DEF enehelft	Shape {
+                                            appearance DEF aluminium Appearance {
+                                                material         Material {
+                                                    ambientIntensity  0.2
+                                                    diffuseColor      0.4 0.4 0.5
+                                                    emissiveColor     0 0 0
+                                                    shininess         0.8
+                                                    specularColor     0.4 0.4 0.5
+                                                }
+                                                texture           NULL
+                                                textureTransform  NULL
+                                            }
+                                            geometry IndexedFaceSet {
+                                                color             NULL
+                                                coord  Coordinate {
+                                                    point [
+                                                        -0.015	0.02	0, #0
+                                                        0.015		0.02	0,
+                                                        0.02		-0.02	0,
+                                                        -0.02		-0.02	0, #3
 
 
-Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
-						5.40	0	-0.28,
-						5.40	5.40	-0.28,
-						0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
-
-						3.19	0	-0.28, #4 voordeur
-						4.42	0	-0.28,
-						4.42	2.30	-0.28,
-						3.19	2.30	-0.28, #7 voordeur
-
-						4.84	1.60	-0.28, #toiletraam-8
-						5.04	1.60	-0.28,
-						5.04	2.30	-0.28,
-						4.84	2.30	-0.28, 
-
-						2.60	0.90	-0.28, #keukenraam-12
-						2.60	2.30	-0.28,
-						0.60	2.30	-0.28,
-						0.60	0.90	-0.28,
-
-						0.60	3.60	-0.28, #bovenraam-16
-						1.50	3.60	-0.28,
-						1.50	5.0	-0.28,
-						4.42	5.0	-0.28,
-						4.42	5.40	-0.28, 
-						0.60	5.40	-0.28,
-
-						0.28	8.55	-3.15, #linkergevel-22
-						0.28	2.70	-8.72,
-						0.28	0	-8.72,
+                                                        -0.01		-0.015	0.06, #4
+                                                        0.01		-0.015	0.06,
+                                                        -0.01		0.015		0.03,
+                                                        0.01		0.015		0.03,
+
+                                                        0.005		0.1		0.035, #8
+                                                        -0.005	0.1		0.035,
+                                                        -0.005	0.1		0.055,
+                                                        0.005		0.1		0.055,
+
+
+
+                                                    ]
+                                                }
+                                                normal            NULL
+                                                texCoord          NULL
+                                                ccw               TRUE
+                                                colorIndex        []
+                                                colorPerVertex    TRUE
+                                                convex            TRUE
+                                                coordIndex  [
+
+                                                    2, 3, 4, 5, -1,
+                                                    2, 5, 4, 3, -1,
+
+                                                    4, 5, 11, 10, -1,
+                                                    4, 10, 11, 5, -1,
+
+                                                    0, 1, 7, 6, -1,
+                                                    0, 6, 7, 1, -1,
+
+                                                    6, 7, 8, 9, -1,
+                                                    6, 9, 8, 7, -1,
+
+                                                    8, 9, 10, 11, -1,
+                                                    8, 11, 10, 9, -1,
+
+                                                    0, 6, 4, 3, -1,
+                                                    0, 3, 4, 6, -1,
+
+                                                    6, 9, 10, 4, -1,
+                                                    6, 4, 10, 9, -1,
+
+                                                    1, 2, 5, 7, -1,
+                                                    1, 7, 5, 2, -1,
+
+                                                    7, 5, 11, 8, -1,
+                                                    7, 8, 11, 5, -1,
 
 
-						5.40	8.55	-3.15, #rechtergevel-25
-						5.40	5.40	-6.30,
-						5.40	5.40	-8.72,
-						5.40	0	-8.72,
+                                                ]     #default []
+                                                creaseAngle       0
+                                                normalIndex       []
+                                                normalPerVertex   TRUE
+                                                solid             TRUE
+                                                #texCoordIndex     []
+                                            }
+                                        }#enehelft
 
 
-						2.25	0	-8.72, #achtergevel-29
-						2.25	0.6	-8.72,
-						4.8	0.6	-8.72,
-						4.8	5.40	-8.72,
-						1.2	0	-8.72,
-						1.2	2.70	-8.72,
+                                        Transform {
+                                            children [
 
 
+                                                USE enehelft
+                                            ]
+                                            rotation 0 1 0 3.1415927
+                                            translation	0 0 -0.07
+                                        }
+                                        Transform {
 
 
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
+                                            children [
+                                                DEF vlakdeel Shape {
+                                                    appearance USE aluminium
+                                                    geometry Box { size 0.18 0.07 0.01 }
+                                                }#shape
+                                            ]
+                                            translation -0.03 0 -0.005
+                                        }
+
+                                        Transform {
+
+                                            children [
+                                                USE vlakdeel
+                                            ]
+                                            translation -0.03 0 -0.065
+                                        }
+
+
+
+                                    ]
+
+                                    translation 0.35 0 0.035
+                                    rotation 0 0 1 1.5707963
+                                }#deurklink
+
+
+
+                                # /deurklink.wrl
 
 
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
 
 
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
+                                DEF deurvorm Shape {
+                                    appearance DEF deurkleur Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.8 0.8 0.8
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry Box { size	0.8 2 0.05 }
+                                }]
+                            translation	0 1.005 0
+                        }
+
+                    ]
+                    translation 3.155 2.8 -3.53
+                    rotation 0 1 0 1.5707963
+                }
 
 
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
+                ROUTE klikopdeur7.touchTime TO TimeSource7.startTime
+                ROUTE TimeSource7.fraction_changed TO Deuropen7.set_fraction
+                ROUTE Deuropen7.value_changed TO deuroudersgang.rotation
+
+                #deur8
+                Transform {
+                    children[ 	USE dwarslat
+                        USE ruitjeboven
+
+                        #deur
+                        DEF deurtweedeslaapkamergang Transform {
+                            center -0.4 0 0
+                            children [
+
+
+
+                                DEF klikopdeur8 TouchSensor {}
+                                DEF TimeSource8 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                                # Animeer het openzwaaien van de deur rond de Y as:
+                                DEF Deuropen8 OrientationInterpolator {
+                                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                                    keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                                }
+                                USE deurklink
+                                USE deurvorm
+                            ]
+                            translation	0 1.005 0
+                        }
+
+                    ]
+                    translation 3.155 2.8 -5.03
+                    rotation 0 1 0 -1.5707963
+                }
 
 
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.70	-8.86,	#58
+                ROUTE klikopdeur8.touchTime TO TimeSource8.startTime
+                ROUTE TimeSource8.fraction_changed TO Deuropen8.set_fraction
+                ROUTE Deuropen8.value_changed TO deurtweedeslaapkamergang.rotation
 
 
-						0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
-						5.40	5.40	0,
-						0.28	5.40	-6.30, #61
-						0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
 
 
-						0.28	2.7	-0.28, #63 extra punten voor segmentering boven
-						0.14	2.7	-0.14,
+                #deur9
+                Transform {
+                    children[ 	USE dwarslat
+                        USE ruitjeboven
 
 
-						5.4	2.7	-0.28, #65
-						5.54	2.7	-0.14, #
+                        #deur
+                        DEF deurkinderkamergang Transform {
+                            center -0.4 0 0
+                            children [
 
 
-						0.28	2.7	-8.72, #67
-						0.14	2.7	-8.86, #
 
 
-						5.4	2.7	-8.72, #69
-						5.54	2.7	-8.86, #
 
 
-						1.2	2.7	-8.72, #71
-						1.2	2.7	-8.86, #
+                                DEF klikopdeur9 TouchSensor {}
+                                DEF TimeSource9 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                                # Animeer het openzwaaien van de deur rond de Y as:
+                                DEF Deuropen9 OrientationInterpolator {
+                                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                                    keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                                }
+                                USE deurklink
+                                USE deurvorm
+                            ]
+                            translation	0 1.005 0
+                        }
 
 
-						4.8	2.7	-8.72, #73
-						4.8	2.7	-8.86, #
+                    ]
+                    translation 3.59 2.8 -5.465
+                    rotation 0 1 0 3.1415927
+                }
 
 
-						0.14	5.4	-0.14, #75
-						5.54	5.4	-0.14, #76
-						5.54	5.4	-8.86, #77
-						0.14	2.7	-9, #78
-						0.14	5.4	-6.3, #79
+                ROUTE klikopdeur9.touchTime TO TimeSource9.startTime
+                ROUTE TimeSource9.fraction_changed TO Deuropen9.set_fraction
+                ROUTE Deuropen9.value_changed TO deurkinderkamergang.rotation
 
 
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
 
 
+                #deur10
+                Transform {
+                    children[ 	USE dwarslat
+                        USE ruitjeboven
 
 
+                        #deur
+                        DEF deurbadkamergang Transform {
+                            center -0.4 0 0
+                            children [
 
 
-		16, 21, 3, 63, -1,
 
 
-		19, 2, 20, -1,
 
 
-		63, 16, 17, 65, -1,
+                                DEF klikopdeur10 TouchSensor {}
+                                DEF TimeSource10 TimeSensor { cycleInterval 20.0 } # Run once for 20 sec.
+                                # Animeer het openzwaaien van de deur rond de Y as:
+                                DEF Deuropen10 OrientationInterpolator {
+                                    key      [ 0,      0.025,	0.05,	0.95,	0.975,       1.0 ]
+                                    keyValue [ 0 1 0 0, 0 1 0 -1, 0 1 0 -2, 0 1 0 -2, 0 1 0 -1, 0 1 0 0 ]
+                                }
+                                USE deurklink
+                                USE deurvorm
+                            ]
+                            translation	0 1.005 0
+                        }
 
 
-		17, 18, 19, 65, -1,
+                    ]
+                    translation 4.01 2.8 -2.325
+                    rotation 0 1 0 0
+                }
 
 
-		2, 19, 65, -1,
 
 
-		69, 27, 2, 65, -1, 
 
 
-		63, 3, 61, 62, -1,
+                ROUTE klikopdeur10.touchTime TO TimeSource10.startTime
+                ROUTE TimeSource10.fraction_changed TO Deuropen10.set_fraction
+                ROUTE Deuropen10.value_changed TO deurbadkamergang.rotation
 
 
-		16, 47, 48, 17, -1,
 
 
-		17, 48, 49, 18, -1,
+                # /deuren.wrl
 
 
-		18, 49, 50, 19, -1, 
+                # trapboven.wrl
+
+
+
+
+
+
+
+
+                DEF trapboven Transform {
+                    children [
+                        Shape {
+                            appearance Appearance {
+                                material          Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 0.5 0.3
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry DEF trap2 IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        -0.2	0	1, #0
+                                        0	0.2	1,
+                                        0	0.2	0,
+                                        -0.2	0	0, #3
+
+                                        0.28	0.4	1, #4
+                                        0.6	0.6	1,
+                                        0.98	0.8	1,
+                                        0.98	1	0.45, #7
+
+                                        0.98	1.2	0.25, #8
+                                        0.98	1.4	0,
+                                        0.98	1.6	-0.25,
+                                        0.98	1.8	-0.45, #11
+
+                                        0.98	2.0	-1, #12
+                                        0.6	2.2	-1,
+                                        0.28	2.4	-1,
+                                        0	2.6	-1, #15
+
+                                        0	0.6	0, #16
+                                        0	0.8	0,
+                                        0	1	0, #18
+                                        0	1.2	0, #19
+
+                                        0	1.4	0, #20
+                                        0	1.6	0,
+                                        0	1.8	0, #22
+                                        0	2	0, #23
+
+                                        0	2.2	0, #24
+                                        0	2.4	0,
+                                        0	2.6	0,
+                                        0	2.8	0,  #27
+
+                                        -0.2	0.2	1, #28
+                                        0	0.4	1,
+                                        0	0.4	0,
+                                        -0.2	0.2	0, #31
+
+                                        0.28	0.6	1, #32
+                                        0.6	0.8	1,
+                                        0.98	1	1,
+                                        0.98	1.2	0.45, #35
+
+                                        0.98	1.4	0.25, #36
+                                        0.98	1.6	0,
+                                        0.98	1.8	-0.25,
+                                        0.98	2	-0.45, #39
+
+                                        0.98	2.2	-1, #40
+                                        0.6	2.4	-1,
+                                        0.28	2.6	-1,
+                                        0	2.8	-1, #43
+
+                                        0	0	1,
+                                        0	0	0, #45
+                                        0	0.4	0, #46
+
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+
+                                    28, 1, 2, 31, -1, #1e_treevlak
+                                    29, 4, 46, -1, #2e
+                                    32, 5, 16, -1,
+                                    33, 6, 17, -1,
+                                    34, 7, 18, -1,
+                                    35, 8, 19, -1,
+                                    36, 9, 20, -1,
+                                    37, 10, 21, -1,
+                                    38, 11, 22, -1,
+                                    39, 12, 23, -1,
+                                    40, 13, 24, -1,
+                                    41, 14, 25, -1,
+                                    42, 15, 26, -1, #13e_treevlak
+
+                                    #	0, 28, 31, 3, -1, #voor_en_zijvlakken_van_de_eerste_tree_komt_boven_niet_voor
+                                    #	0, 44, 1, 28, -1,
+                                    #	3, 31, 2, 45, -1,
+
+                                    2, 1, 29, 30, -1, #alle_voorvlakken
+                                    46, 4, 32, 16, -1,
+                                    16, 5, 33, 17, -1,
+                                    17, 6, 34, 18, -1,
+                                    18, 7, 35, 19, -1,
+                                    19, 8, 36, 20, -1,
+                                    20, 9, 37, 21, -1,
+                                    21, 10, 38, 22, -1,
+                                    22, 11, 39, 23, -1,
+                                    23, 12, 40, 24, -1,
+                                    24, 13, 41, 25, -1,
+                                    25, 14, 42, 26, -1,
+                                    26, 15, 43, 27, -1,
+
+
+
+
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             FALSE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                    translation 4.42	2.6	-3.36
+                }
 
 
-		19, 50, 51, 20, -1, 
 
 
-		21, 52, 47, 16, -1,
+                # /trapboven.wrl
+
+                # buitmuur.wrl
+
+
+
+
+                Transform {
+                    children [
+                        Shape {
+                            appearance DEF steen Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.8 0.4 0.3
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        0	0	0, #linkerbenedenhoek voorgevel
+                                        5.68	0	0,
+                                        5.68	5.40	0,
+                                        0	5.40	0, #linkerbovenhoek voorgevel
+
+                                        3.19	0	0, #voordeur
+                                        4.42	0	0,
+                                        4.42	2.30	0,
+                                        3.19	2.30	0, #voordeur
+
+                                        4.84	1.60	0, #toiletraam-8
+                                        5.04	1.60	0,
+                                        5.04	2.30	0,
+                                        4.84	2.30	0,
+
+                                        2.60	0.90	0, #keukenraam-12
+                                        2.60	2.30	0,
+                                        0.60	2.30	0,
+                                        0.60	0.90	0,
+
+                                        0.60	3.60	0, #bovenraam-16
+                                        1.50	3.60	0,
+                                        1.50	5.0	0,
+                                        4.42	5.0	0,
+                                        4.42	5.40	0,
+                                        0.60	5.40	0,
 
 
-		73, 74, 56, 32, -1,
+                                        0	8.555	-3.15, #linkergevel-22
+                                        0	2.7	-9.0,
+                                        0	0	-9.0,
 
 
-		69, 73, 32, 27, -1,
+                                        5.68	8.555	-3.15, #rechtergevel-25
+                                        5.68	5.40	-6.3,
+                                        5.68	5.40	-9,
+                                        5.68	0	-9.0,
 
 
-		3, 21, 52, 75 -1,
+                                        2.25	0	-9.0, #achtergevel-29
+                                        2.25	0.6	-9.0,
+                                        4.8	0.6	-9.0,
+                                        4.8	5.40	-9.0,
+                                        1.2	0	-9.0,
+                                        1.2	2.7	-9,
 
 
-		20, 2, 76, 51, -1,
 
 
-		3, 61, 79, 75, -1,
+                                        3.19	0	-0.14, #diepte van de voordeur-35
+                                        4.42	0	-0.14,
+                                        4.42	2.30	-0.14,
+                                        3.19	2.30	-0.14, #diepte van de voordeur-38
 
 
-		2, 27, 77, 76, -1,
+                                        2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                        2.60	2.30	-0.14,
+                                        0.60	2.30	-0.14,
+                                        0.60	0.90	-0.14,
 
 
-		62, 61, 79, 78, -1,
+                                        4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                        5.04	1.60	-0.14,
+                                        5.04	2.30	-0.14,
+                                        4.84	2.30	-0.14,
 
 
-		27, 32, 56, 77, -1,
+                                        0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                        1.50	3.60	-0.14,
+                                        1.50	5.0	-0.14,
+                                        4.42	5.0	-0.14,
+                                        4.42	5.40	-0.14,
+                                        0.60	5.40	-0.14, #52
 
 
+                                        2.25	0	-8.86, #diepte van de achtergevel-53
+                                        2.25	0.6	-8.86,
+                                        4.8	0.6	-8.86,
+                                        4.8	5.40	-8.86,
+                                        1.2	0	-8.86,
+                                        1.2	2.7	-8.86,	#58
 
 
+                                        0	2.7	0, #59 extra punten voor segmentering beneden
+                                        0.14	2.7	-0.14,
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                                        5.68	2.7	0, #61
+                                        5.54	2.7	-0.14, #
 
 
+                                        0	2.7	-9, #63
+                                        0.14	2.7	-8.86, #
 
 
+                                        5.68	2.7	-9, #65
+                                        5.54	2.7	-8.86, #
 
 
-# /binmuur.wrl
+                                        1.2	2.7	-9, #67
+                                        1.2	2.7	-8.86, #
 
 
-# ramen.wrl
+                                        4.8	2.7	-9, #69
+                                        4.8	2.7	-8.86, #
 
 
+                                        0.14	5.4	-0.14, #71
+                                        5.54	5.4	-0.14, #72
+                                        5.54	5.4	-8.86, #73
+                                        0.14	2.7	-9, #74
+                                        0.14	5.4	-6.3, #75
+                                        0	5.4	-6.3, #76
 
 
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
+                                    16, 21, 3, 59, -1,
 
 
+                                    19, 2, 20, -1,
 
 
+                                    2, 19, 61, -1,
 
 
+                                    65, 27, 2, 61, -1,
 
 
-#begin bovenraam
+                                    59, 3, 76, 23, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF kozijn Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.95 0.95 0.9
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
+                                    17, 48, 47, 16, -1,
 
 
-geometry	Box { size	3.82 0.05 0.05 }
-}
+                                    18, 49, 48, 17, -1,
 
 
-]
-translation	2.51 5.025 -0.14
-}
+                                    19, 50, 49, 18, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	3.82 0.1 0.05 }
-}
+                                    20, 51, 50, 19, -1,
 
 
-]
-translation	2.51 5.35 -0.14
-}
+                                    16, 47, 52, 21, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.8 0.05 }
-}
+                                    3, 21, 52, 71, -1,
 
 
-]
-translation	0.625 4.5 -0.14
-}
+                                    20, 2, 72, 51, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.8 0.05 }
-}
+                                    2, 27, 73, 72, -1,
 
 
-]
-translation	1.475 4.5 -0.14
-}
+                                    27, 32, 56, 73, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 0.25 0.05 }
-}
+                                    63, 64, 75, 76, -1,
 
 
-]
-translation	4.395 5.175 -0.14
-}
+                                    3, 76, 75, 71, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF blauw Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.3 0.4 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
+                                    #27, 32, 69, 65, -1,
+                                    27, 65, 69, 32, -1,
 
 
-geometry	Box { size	0.9 0.25 0.05 }
-}
+                                    32, 69, 70, 56, -1,
 
 
-]
-translation	3.05 5.175 -0.14
-}
+                                    59, 17, 16, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.9 0.05 0.05 }
-}
+                                    59, 61, 17, -1,
 
 
-]
-translation	1.05 3.625 -0.14
-}
+                                    17, 61 , 18, -1,
 
 
-#einde bovenraam
-#begin kozijnen achter
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.4 0.05 }
-}
+                                    18, 61, 19, -1,
 
 
-]
-translation	3.215 3.9 -8.86
-}
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.4 0.05 }
-}
 
 
-]
-translation	4.775 3.9 -8.86
-}
-Transform {
-	children [
-		Shape {
-appearance	USE blauw 
-geometry	Box { size	1.61 0.3 0.05 }
-}
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             FALSE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
-]
-translation	3.995 5.25 -8.86
-}
-Transform {
-	children [
-		Shape {
-appearance	USE blauw 
-geometry	Box { size	1.51 0.8 0.05 }
-}
 
 
-]
-translation	3.995 3.1 -8.86
-}
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
+                # /buitmuur.wrl
+
+                # binmuur.wrl
+
+
+
+
+                Transform {
+                    children [
+                        Shape {
+                            appearance Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      1 0.9 0.7
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+                            geometry IndexedFaceSet {
+                                color             NULL
+                                coord  Coordinate {	#default NULL
+                                    point [
+                                        0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
+                                        5.40	0	-0.28,
+                                        5.40	5.40	-0.28,
+                                        0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
+
+                                        3.19	0	-0.28, #4 voordeur
+                                        4.42	0	-0.28,
+                                        4.42	2.30	-0.28,
+                                        3.19	2.30	-0.28, #7 voordeur
+
+                                        4.84	1.60	-0.28, #toiletraam-8
+                                        5.04	1.60	-0.28,
+                                        5.04	2.30	-0.28,
+                                        4.84	2.30	-0.28,
+
+                                        2.60	0.90	-0.28, #keukenraam-12
+                                        2.60	2.30	-0.28,
+                                        0.60	2.30	-0.28,
+                                        0.60	0.90	-0.28,
+
+                                        0.60	3.60	-0.28, #bovenraam-16
+                                        1.50	3.60	-0.28,
+                                        1.50	5.0	-0.28,
+                                        4.42	5.0	-0.28,
+                                        4.42	5.40	-0.28,
+                                        0.60	5.40	-0.28,
 
 
-]
-translation	3.995 3.525 -8.86
-}#3
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
+                                        0.28	8.55	-3.15, #linkergevel-22
+                                        0.28	2.70	-8.72,
+                                        0.28	0	-8.72,
 
 
-]
-translation	3.995 5.075 -8.86
-}#4
+                                        5.40	8.55	-3.15, #rechtergevel-25
+                                        5.40	5.40	-6.30,
+                                        5.40	5.40	-8.72,
+                                        5.40	0	-8.72,
 
 
+                                        2.25	0	-8.72, #achtergevel-29
+                                        2.25	0.6	-8.72,
+                                        4.8	0.6	-8.72,
+                                        4.8	5.40	-8.72,
+                                        1.2	0	-8.72,
+                                        1.2	2.70	-8.72,
 
 
 
 
+                                        3.19	0	-0.14, #diepte van de voordeur-35
+                                        4.42	0	-0.14,
+                                        4.42	2.30	-0.14,
+                                        3.19	2.30	-0.14, #diepte van de voordeur-38
 
 
+                                        2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                        2.60	2.30	-0.14,
+                                        0.60	2.30	-0.14,
+                                        0.60	0.90	-0.14,
 
 
+                                        4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                        5.04	1.60	-0.14,
+                                        5.04	2.30	-0.14,
+                                        4.84	2.30	-0.14,
 
 
+                                        0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                        1.50	3.60	-0.14,
+                                        1.50	5.0	-0.14,
+                                        4.42	5.0	-0.14,
+                                        4.42	5.40	-0.14,
+                                        0.60	5.40	-0.14, #52
 
 
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.5 0.05 }
-}
+                                        2.25	0	-8.86, #diepte van de achtergevel-53
+                                        2.25	0.6	-8.86,
+                                        4.8	0.6	-8.86,
+                                        4.8	5.40	-8.86,
+                                        1.2	0	-8.86,
+                                        1.2	2.70	-8.86,	#58
 
 
-]
-translation	3.565 4.3 -8.86
-}
+                                        0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
+                                        5.40	5.40	0,
+                                        0.28	5.40	-6.30, #61
+                                        0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
 
 
+                                        0.28	2.7	-0.28, #63 extra punten voor segmentering boven
+                                        0.14	2.7	-0.14,
 
 
+                                        5.4	2.7	-0.28, #65
+                                        5.54	2.7	-0.14, #
 
 
-#einde ramen achter
+                                        0.28	2.7	-8.72, #67
+                                        0.14	2.7	-8.86, #
 
 
+                                        5.4	2.7	-8.72, #69
+                                        5.54	2.7	-8.86, #
 
 
+                                        1.2	2.7	-8.72, #71
+                                        1.2	2.7	-8.86, #
 
 
-# /ramen.wrl
+                                        4.8	2.7	-8.72, #73
+                                        4.8	2.7	-8.86, #
 
 
-# ruiten.wrl
+                                        0.14	5.4	-0.14, #75
+                                        5.54	5.4	-0.14, #76
+                                        5.54	5.4	-8.86, #77
+                                        0.14	2.7	-9, #78
+                                        0.14	5.4	-6.3, #79
 
 
+                                    ]
+                                }
+                                normal            NULL
+                                texCoord          NULL
+                                ccw               TRUE
+                                colorIndex        []
+                                colorPerVertex    TRUE
+                                convex            TRUE
+                                coordIndex  [
 
 
 
 
 
 
+                                    16, 21, 3, 63, -1,
 
 
+                                    19, 2, 20, -1,
 
 
-#bovenruiten
-Transform {
-	children [
-		Shape {
-appearance DEF glas Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.6 0.6 0.9
-	emissiveColor     0 0 0
-	shininess         0.8
-	specularColor     1 1 1 
-	transparency      0.7
-}	texture           NULL
-	textureTransform  NULL
-}
+                                    63, 16, 17, 65, -1,
 
 
-			geometry Box { size	0.8 1.35 0.01 }
-}
+                                    17, 18, 19, 65, -1,
 
 
-]
-translation	1.05 4.325 -0.14
-}#ruit 1 boven
+                                    2, 19, 65, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.8 0.3 0.01 }
-}
+                                    69, 27, 2, 65, -1,
 
 
-]
-translation	1.05 5.2 -0.14
-}#ruit 2 boven
+                                    63, 3, 61, 62, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	1.1 0.3 0.01 }
-}
+                                    16, 47, 48, 17, -1,
 
 
-]
-translation	2.05 5.2 -0.14
-}#ruit 3 boven
+                                    17, 48, 49, 18, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.85 0.3 0.01 }
-}
+                                    18, 49, 50, 19, -1,
 
 
-]
-translation	3.935 5.2 -0.14
-}#ruit 4 boven
+                                    19, 50, 51, 20, -1,
 
 
+                                    21, 52, 47, 16, -1,
 
 
+                                    73, 74, 56, 32, -1,
 
 
-#ramen achter
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	1.16 1.5 0.01 }
-}
+                                    69, 73, 32, 27, -1,
 
 
-]
-translation	4.17 4.3 -8.86
-}#ruit 1 achter
+                                    3, 21, 52, 75 -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.3 1.5 0.01 }
-}
+                                    20, 2, 76, 51, -1,
 
 
-]
-translation	3.39 4.3 -8.86
-}#ruit 2 achter
+                                    3, 61, 79, 75, -1,
 
 
+                                    2, 27, 77, 76, -1,
 
 
+                                    62, 61, 79, 78, -1,
 
 
-# /ruiten.wrl
+                                    27, 32, 56, 77, -1,
 
 
-# /boven/boven.wrl
 
 
 
 
+                                ]     #default []
+                                creaseAngle       0
+                                normalIndex       []
+                                normalPerVertex   TRUE
+                                solid             FALSE
+                                texCoordIndex     []
+                            }
+                        }
+                    ]
+                }
 
 
-DEF zolder Transform {
-children[
 
 
-Transform {
-children[
 
 
-Transform{
-children[
-	Shape {
-appearance USE groen
-geometry USE pijl
-}
-]
-rotation 0 1 0 3.1415927
-}
+                # /binmuur.wrl
 
 
-DEF schuifzolder TouchSensor {}
-]
-translation 0.15 5.4 0.3
-}
+                # ramen.wrl
 
 
-Transform {
-children[
 
 
-	Shape {
-appearance USE rood
-geometry USE pijl
-}
 
 
-DEF schuifzolder2 TouchSensor {}
-]
-translation 5.48 5.4 0.3
-}
 
 
-DEF dak Transform {
-children [
-# dak/dak.wrl
 
 
 
 
+                #begin bovenraam
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance DEF kozijn Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.95 0.95 0.9
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
 
 
-Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.3 0.4 0.5
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-					0	5.4	0, #dakranden-0
-					5.68	5.4	0,
-					5.68	8.55	-3.15,
-					0	8.55	-3.15,
-					0	2.7	-9,
-					3.12	2.7	-9,
-					3.12	5.4	-6.30,
-					5.68	5.4	-6.30, #7
-
-					1.5	3.7	-8, #dakraam1-8
-					2.3	3.7	-8,
-					2.3	4.7	-7,
-					1.5	4.7	-7,
-
-					4.1	7.3	-1.9,  #dakraam2-12
-					3.5	7.3	-1.9, 
-					3.5	7.7	-2.3, 
-					4.1	7.7	-2.3, #15
-
-					0	5.44	0.04, #dikte van dakranden-16
-					5.68	5.44	0.04,
-					5.68	8.6065685	-3.15,
-					0	8.6065685	-3.15,
-					0	2.74	-9.04,
-					3.12	2.74	-9.04,
-					3.12	5.44	-6.34,
-					5.68	5.44	-6.34, #23	
-
-					1.5	3.74	-8.04, #dikte van het dakraam1-24
-					2.3	3.74	-8.04,
-					2.3	4.74	-7.04,
-					1.5	4.74	-7.04, #27	
+                            geometry	Box { size	3.82 0.05 0.05 }
+                        }
 
 
-					4.1	7.34	-1.86,  #dikte van het dakraam2-28
-					3.5	7.34	-1.86, 
-					3.5	7.74	-2.26,
-					4.1	7.74	-2.26, #31
-			
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
+                    ]
+                    translation	2.51 5.025 -0.14
+                }
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	3.82 0.1 0.05 }
+                        }
 
 
-	0, 13, 14, 3, -1,
-	0, 3, 14, 13, -1,
+                    ]
+                    translation	2.51 5.35 -0.14
+                }
 
 
-	16, 29, 30, 19, -1,
-	16, 19, 30, 29, -1,
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 1.8 0.05 }
+                        }
 
 
-	0, 1, 12, 13, -1, 
-	0, 13, 12, 1, -1,
+                    ]
+                    translation	0.625 4.5 -0.14
+                }
 
 
-	16, 17, 28, 29, -1,
-	16, 29, 28, 17, -1,
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 1.8 0.05 }
+                        }
 
 
-	1, 12, 15, 2, -1, 
-	1, 2, 15, 12, -1,
+                    ]
+                    translation	1.475 4.5 -0.14
+                }
 
 
-	17, 28, 31, 18, -1,
-	17, 18, 31, 28, -1,
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 0.25 0.05 }
+                        }
 
 
-	15, 2, 3, 14, -1, 
-	15, 14, 3, 2, -1,
+                    ]
+                    translation	4.395 5.175 -0.14
+                }
 
 
-	31, 18, 19, 30, -1,
-	31, 30, 19, 18, -1,
-	
-	4, 8, 11, 3, -1, 
-	4, 3, 11, 8, -1, 
+                Transform {
+                    children [
+                        Shape {
+                            appearance DEF blauw Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.3 0.4 0.7
+                                    emissiveColor     0 0 0
+                                    shininess         0.1
+                                    specularColor     0 0 0
+                                    transparency      0
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
+
+                            geometry	Box { size	0.9 0.25 0.05 }
+                        }
+
+                    ]
+                    translation	3.05 5.175 -0.14
+                }
 
 
-	20, 24, 27, 19, -1,
-	20, 19, 27, 24, -1,
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.9 0.05 0.05 }
+                        }
 
 
-	5, 4, 8, 9, -1, 
-	5, 9, 8, 4, -1, 
+                    ]
+                    translation	1.05 3.625 -0.14
+                }
 
 
-	21, 20, 24, 25, -1,
-	21, 25, 24, 20, -1, 
+                #einde bovenraam
+                #begin kozijnen achter
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 2.4 0.05 }
+                        }
+
+                    ]
+                    translation	3.215 3.9 -8.86
+                }
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 2.4 0.05 }
+                        }
+
+                    ]
+                    translation	4.775 3.9 -8.86
+                }
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE blauw
+                            geometry	Box { size	1.61 0.3 0.05 }
+                        }
+
+                    ]
+                    translation	3.995 5.25 -8.86
+                }
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE blauw
+                            geometry	Box { size	1.51 0.8 0.05 }
+                        }
+
+                    ]
+                    translation	3.995 3.1 -8.86
+                }
 
 
-	5, 9, 10, 6, -1,
-	5, 6, 10, 9, -1,
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	1.51 0.05 0.05 }
+                        }
 
 
-	21, 25, 26, 22, -1,
-	21, 22, 26, 25, -1,
+                    ]
+                    translation	3.995 3.525 -8.86
+                }#3
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	1.51 0.05 0.05 }
+                        }
 
 
-	7, 6, 2, -1, 
-	7, 2, 6, -1,
+                    ]
+                    translation	3.995 5.075 -8.86
+                }#4
 
 
-	23, 22, 18, -1,
-	23, 18, 22, -1,
 
 
-	6, 10, 11, 3, 2, -1,
-	6, 2, 3, 11, 10, -1,
 
 
-	22, 26, 18, -1,
-	22, 18, 26, -1,
 
 
-	26, 27, 19, -1,
-	26, 19, 27, -1, 
 
 
-	26, 19, 18, -1,
-	26, 18, 19, -1,
 
 
-	0, 1, 17, 16, -1,
-	0, 16, 17, 1, -1,
 
 
-	1, 2, 18, 17, -1,
-	1, 17, 18, 2, -1, 
+                Transform {
+                    children [
+                        Shape {
+                            appearance	USE kozijn
+                            geometry	Box { size	0.05 1.5 0.05 }
+                        }
 
 
-	3, 0, 16, 19, -1, 
-	3, 19, 16, 0, -1,
+                    ]
+                    translation	3.565 4.3 -8.86
+                }
 
 
-	2, 7, 23, 18, -1,
-	2, 18, 23, 7, -1, 
 
 
-	7, 6, 22, 23, -1, 
-	7, 23, 22, 6, -1,
 
 
-	5, 6, 22, 21, -1, 
-	5, 21, 22, 6, -1,
+                #einde ramen achter
 
 
-	5, 4, 20, 21, -1,
-	5, 21, 20, 4, -1,
 
 
-	4, 3, 19, 20, -1, 
-	4, 20, 19, 3, -1,
 
 
-	9, 8, 24, 25, -1,
-	9, 25, 24, 8, -1,
+                # /ramen.wrl
 
 
-	8, 11, 27, 24, -1,
-	8, 24, 27, 11, -1,
+                # ruiten.wrl
 
 
-	10, 11, 27, 26, -1,
-	10, 26, 27, 11, -1,
 
 
-	9, 10, 26, 25, -1, 
-	9, 25, 26, 10, -1,
 
 
-	12, 13, 29, 28, -1,
-	12, 28, 29, 13, -1,
 
 
-	12, 15, 31, 28, -1, 
-	12, 28, 31, 15, -1,
 
 
-	14, 15, 31, 30, -1, 
-	14, 30, 31, 15, -1,
 
 
-	13, 14, 30, 29, -1,
-	13, 29, 30, 14, -1,
+                #bovenruiten
+                Transform {
+                    children [
+                        Shape {
+                            appearance DEF glas Appearance {
+                                material         Material {
+                                    ambientIntensity  0.2
+                                    diffuseColor      0.6 0.6 0.9
+                                    emissiveColor     0 0 0
+                                    shininess         0.8
+                                    specularColor     1 1 1
+                                    transparency      0.7
+                                }	texture           NULL
+                                textureTransform  NULL
+                            }
 
 
+                            geometry Box { size	0.8 1.35 0.01 }
+                        }
 
 
+                    ]
+                    translation	1.05 4.325 -0.14
+                }#ruit 1 boven
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE glas
+                            geometry Box { size	0.8 0.3 0.01 }
+                        }
 
 
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                    ]
+                    translation	1.05 5.2 -0.14
+                }#ruit 2 boven
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE glas
+                            geometry Box { size	1.1 0.3 0.01 }
+                        }
 
 
-#schoorsteen
-
-Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.1 0.1 0.1
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0.3 0.3 0.3
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-		4.8	8	-2.6,
-		5.3	8	-2.6,
-		5.3	8.4	-3.0,
-		4.8	8.4	-3.0,
-
-		4.9	9.4	-2.65,
-		5.2	9.4	-2.65,
-		5.2	9.4	-2.95,	
-		4.9	9.4	-2.95, ]
-	}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 1, 5, 4, -1, 
-		0, 4, 5, 1, -1, 
-
-		1, 2, 6, 5, -1, 
-		1, 5, 6, 2, -1,
-
-		2, 3, 7, 6, -1,
-		2, 6, 7, 3, -1,
-
-		0, 3, 7, 4, -1,
-		0, 4, 7, 3, -1, 
-
-		4, 5, 6, 7, -1, 
-		4, 7, 6, 5, -1,
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                    ]
+                    translation	2.05 5.2 -0.14
+                }#ruit 3 boven
 
 
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE glas
+                            geometry Box { size	0.85 0.3 0.01 }
+                        }
 
 
+                    ]
+                    translation	3.935 5.2 -0.14
+                }#ruit 4 boven
 
 
 
 
 
 
+                #ramen achter
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE glas
+                            geometry Box { size	1.16 1.5 0.01 }
+                        }
 
 
-# /dak/dak.wrl
+                    ]
+                    translation	4.17 4.3 -8.86
+                }#ruit 1 achter
 
 
-Transform {
-children[
+                Transform {
+                    children [
+                        Shape {
+                            appearance USE glas
+                            geometry Box { size	0.3 1.5 0.01 }
+                        }
 
 
+                    ]
+                    translation	3.39 4.3 -8.86
+                }#ruit 2 achter
 
 
-Transform{
-children[
 
 
-	Shape {
-appearance USE groen
-geometry USE pijl
-}
 
 
-]
-rotation 0 1 0 3.1415927
-}
+                # /ruiten.wrl
 
 
-DEF schuifdak TouchSensor {}
+                # /boven/boven.wrl
+
+
+
+                DEF zolder Transform {
+                    children[
+
+                        Transform {
+                            children[
+
+                                Transform{
+                                    children[
+                                        Shape {
+                                            appearance USE groen
+                                            geometry USE pijl
+                                        }
+                                    ]
+                                    rotation 0 1 0 3.1415927
+                                }
+
+                                DEF schuifzolder TouchSensor {}
+                            ]
+                            translation 0.15 5.4 0.3
+                        }
+
+                        Transform {
+                            children[
+
+                                Shape {
+                                    appearance USE rood
+                                    geometry USE pijl
+                                }
+
+                                DEF schuifzolder2 TouchSensor {}
+                            ]
+                            translation 5.48 5.4 0.3
+                        }
+
+                        DEF dak Transform {
+                            children [
+                                # dak/dak.wrl
+
+
+
+
+                                Transform {
+                                    children [
+                                        Shape {
+                                            appearance Appearance {
+                                                material         Material {
+                                                    ambientIntensity  0.2
+                                                    diffuseColor      0.3 0.4 0.5
+                                                    emissiveColor     0 0 0
+                                                    shininess         0.1
+                                                    specularColor     0 0 0
+                                                    transparency      0
+                                                }	texture           NULL
+                                                textureTransform  NULL
+                                            }
+                                            geometry IndexedFaceSet {
+                                                color             NULL
+                                                coord  Coordinate {	#default NULL
+                                                    point [
+                                                        0	5.4	0, #dakranden-0
+                                                        5.68	5.4	0,
+                                                        5.68	8.55	-3.15,
+                                                        0	8.55	-3.15,
+                                                        0	2.7	-9,
+                                                        3.12	2.7	-9,
+                                                        3.12	5.4	-6.30,
+                                                        5.68	5.4	-6.30, #7
 
 
-]
-translation 0.15 6 0.3
-}
+                                                        1.5	3.7	-8, #dakraam1-8
+                                                        2.3	3.7	-8,
+                                                        2.3	4.7	-7,
+                                                        1.5	4.7	-7,
 
 
+                                                        4.1	7.3	-1.9,  #dakraam2-12
+                                                        3.5	7.3	-1.9,
+                                                        3.5	7.7	-2.3,
+                                                        4.1	7.7	-2.3, #15
 
 
-Transform {
-children[
+                                                        0	5.44	0.04, #dikte van dakranden-16
+                                                        5.68	5.44	0.04,
+                                                        5.68	8.6065685	-3.15,
+                                                        0	8.6065685	-3.15,
+                                                        0	2.74	-9.04,
+                                                        3.12	2.74	-9.04,
+                                                        3.12	5.44	-6.34,
+                                                        5.68	5.44	-6.34, #23
 
 
-	Shape {
-appearance USE rood
-geometry USE pijl
-}
+                                                        1.5	3.74	-8.04, #dikte van het dakraam1-24
+                                                        2.3	3.74	-8.04,
+                                                        2.3	4.74	-7.04,
+                                                        1.5	4.74	-7.04, #27
 
 
-DEF schuifdak2 TouchSensor {}
-]
-translation 5.48 6 0.3
-}
+                                                        4.1	7.34	-1.86,  #dikte van het dakraam2-28
+                                                        3.5	7.34	-1.86,
+                                                        3.5	7.74	-2.26,
+                                                        4.1	7.74	-2.26, #31
 
 
-DEF tijd1 TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
+                                                    ]
+                                                }
+                                                normal            NULL
+                                                texCoord          NULL
+                                                ccw               TRUE
+                                                colorIndex        []
+                                                colorPerVertex    TRUE
+                                                convex            TRUE
+                                                coordIndex  [
 
 
-DEF plaats1 PositionInterpolator {
-	key           [0, 1]
-	keyValue      [0 0 0 ,6 0 0]
-}
 
 
-DEF tijd1a TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
+                                                    0, 13, 14, 3, -1,
+                                                    0, 3, 14, 13, -1,
 
 
-DEF plaats1a PositionInterpolator {
-	key           [0, 1]
-	keyValue      [6 0 0 ,0 0 0]
-}
+                                                    16, 29, 30, 19, -1,
+                                                    16, 19, 30, 29, -1,
 
 
+                                                    0, 1, 12, 13, -1,
+                                                    0, 13, 12, 1, -1,
 
 
+                                                    16, 17, 28, 29, -1,
+                                                    16, 29, 28, 17, -1,
 
 
-]
-}#dak
+                                                    1, 12, 15, 2, -1,
+                                                    1, 2, 15, 12, -1,
 
 
-# zolder/zolder.wrl
+                                                    17, 28, 31, 18, -1,
+                                                    17, 18, 31, 28, -1,
 
 
+                                                    15, 2, 3, 14, -1,
+                                                    15, 14, 3, 2, -1,
 
 
+                                                    31, 18, 19, 30, -1,
+                                                    31, 30, 19, 18, -1,
 
 
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       2.5 7 -3.15
+                                                    4, 8, 11, 3, -1,
+                                                    4, 3, 11, 8, -1,
 
 
-	description    "op zolder"
-}
+                                                    20, 24, 27, 19, -1,
+                                                    20, 19, 27, 24, -1,
 
 
-#kleine platte dakje
-
-Transform {
-children [
-Shape {
-appearance DEF appdak Appearance {
-	 material          Material {
-  	ambientIntensity  0
-  	diffuseColor      0.2 0.2 0.2
-  	emissiveColor     0 0 0
-  	shininess         0
-  	specularColor     0 0 0 
-  	transparency      0
-			  }
-
-  texture           ImageTexture {
-  			  url     [""]
-  			  repeatS TRUE
-  			  repeatT TRUE
- 			  }
-}
-geometry Box { size 2.6 0.04 2.74	}
-}
-]
-translation 4.39 5.40 -7.67
-}
+                                                    5, 4, 8, 9, -1,
+                                                    5, 9, 8, 4, -1,
 
 
+                                                    21, 20, 24, 25, -1,
+                                                    21, 25, 24, 20, -1,
 
 
-DEF zoldervloer Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material          Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.5 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.14	5.40	0,
-						5.54	5.40	0,
-						5.54	5.40	-6.30,
-						0.14	5.40	-6.30,
-
-						5.54	5.40	-2.36, #-4
-						5.54	5.40	-4.36,
-						4.42	5.40	-4.36,
-						4.42	5.40	-2.36,
-
-
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 1, 4, 7, -1, 
-		0, 7, 4, 1, -1, 
-
-		0, 7, 6, 3, -1,
-		0, 3, 6, 7, -1, 
-
-		5, 2, 3, 6, -1, 
-		5, 6, 3, 2, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                                                    5, 9, 10, 6, -1,
+                                                    5, 6, 10, 9, -1,
 
 
-DEF plafondboven Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 1 1 
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.14	5.30	-0.14,
-						5.54	5.30	-0.14,
-						5.54	5.30	-8.86,
-						3.19	5.30	-8.86,
-
-						5.54	5.30	-2.36, #-4
-						5.54	5.30	-4.36,
-						4.42	5.30	-4.36,
-						4.42	5.30	-2.36,
-
-						3.19	5.30	-6.40,
-						0.14	5.30	-6.40,
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 1, 4, 7, -1, 
-		0, 7, 4, 1, -1, 
-
-		0, 7, 6, 8, 9, -1,
-		0, 9, 8, 6, 7, -1, 
-
-		5, 2, 3, 8, 6, -1, 
-		5, 6, 8, 3, 2, -1,
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                                                    21, 25, 26, 22, -1,
+                                                    21, 22, 26, 25, -1,
 
 
+                                                    7, 6, 2, -1,
+                                                    7, 2, 6, -1,
 
 
+                                                    23, 22, 18, -1,
+                                                    23, 18, 22, -1,
 
 
-DEF vulstukvoortrap Transform {
-	children [
-		Shape {
-appearance DEF wandkleur Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
+                                                    6, 10, 11, 3, 2, -1,
+                                                    6, 2, 3, 11, 10, -1,
 
 
+                                                    22, 26, 18, -1,
+                                                    22, 18, 26, -1,
 
 
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						4.42	5.3	-2.36, #0
-						4.42	5.3	-3.36, 
-						4.42	5.4	-3.36,
-						4.42	5.4	-2.36, #3
-
-						5.4	5.3	-2.36, #4
-						5.4	5.4	-2.36,
-
-						5.4	5.3	-4.36, #6
-						5.4	5.4	-4.36,
-						4.42	5.3	-4.36, #8
-						4.42	5.4	-4.36,
-				
-				
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	0, 1, 2, 3, -1,
-	0, 3, 2, 1, -1,
-	0, 3, 5, 4, -1,
-	9, 8, 6, 7, -1,
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-
-]
-}
+                                                    26, 27, 19, -1,
+                                                    26, 19, 27, -1,
 
 
-# ballustrade.wrl
+                                                    26, 19, 18, -1,
+                                                    26, 18, 19, -1,
 
 
+                                                    0, 1, 17, 16, -1,
+                                                    0, 16, 17, 1, -1,
 
 
+                                                    1, 2, 18, 17, -1,
+                                                    1, 17, 18, 2, -1,
 
 
-Transform {
-children[
+                                                    3, 0, 16, 19, -1,
+                                                    3, 19, 16, 0, -1,
 
 
-DEF spijlen Group {
-children [
-Transform{
-children [
-DEF spijl Shape {
-appearance DEF kozijn Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.95 0.95 0.9
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-geometry  Cylinder {
-				bottom  FALSE
-				height  0.8
-				radius  0.015
-				side    TRUE
-				top     FALSE
-			}
-}
-]
-translation -0.025	0.4	0.05
-}
+                                                    2, 7, 23, 18, -1,
+                                                    2, 18, 23, 7, -1,
 
 
-Transform{
-children USE spijl
-translation -0.025	0.4	0.15
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.25
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.35
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.45
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.55
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.65
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.75
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.85
-}
-Transform{
-children USE spijl
-translation -0.025	0.4	0.95
-}
+                                                    7, 6, 22, 23, -1,
+                                                    7, 23, 22, 6, -1,
 
 
-]
-}#spijlengroup
+                                                    5, 6, 22, 21, -1,
+                                                    5, 21, 22, 6, -1,
 
 
-Transform{
-translation 0 0 1
-rotation 0 1 0 1.5707963
-children USE spijlen
-}
+                                                    5, 4, 20, 21, -1,
+                                                    5, 21, 20, 4, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE  kozijn
-geometry  Box { size 0.05	0.03	1.05	}
-}
-]
-translation -0.025	0.815	0.525
-}
+                                                    4, 3, 19, 20, -1,
+                                                    4, 20, 19, 3, -1,
 
 
-Transform{
-children [
-Shape {
-appearance USE  kozijn
-geometry  Box { size 1	0.03	0.05	}
-}
-]
-translation 0.5	0.815	1.025
-}
+                                                    9, 8, 24, 25, -1,
+                                                    9, 25, 24, 8, -1,
 
 
+                                                    8, 11, 27, 24, -1,
+                                                    8, 24, 27, 11, -1,
 
 
-]
-translation	4.42	5.4	-3.36
-}
+                                                    10, 11, 27, 26, -1,
+                                                    10, 26, 27, 11, -1,
 
 
-# /ballustrade.wrl
+                                                    9, 10, 26, 25, -1,
+                                                    9, 25, 26, 10, -1,
 
 
-# binmuur.wrl
+                                                    12, 13, 29, 28, -1,
+                                                    12, 28, 29, 13, -1,
 
 
+                                                    12, 15, 31, 28, -1,
+                                                    12, 28, 31, 15, -1,
 
 
+                                                    14, 15, 31, 30, -1,
+                                                    14, 30, 31, 15, -1,
 
 
+                                                    13, 14, 30, 29, -1,
+                                                    13, 29, 30, 14, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      1 0.9 0.7
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
-						5.40	0	-0.28,
-						5.40	5.40	-0.28,
-						0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
-
-						3.19	0	-0.28, #4 voordeur
-						4.42	0	-0.28,
-						4.42	2.30	-0.28,
-						3.19	2.30	-0.28, #7 voordeur
-
-						4.84	1.60	-0.28, #toiletraam-8
-						5.04	1.60	-0.28,
-						5.04	2.30	-0.28,
-						4.84	2.30	-0.28, 
-
-						2.60	0.90	-0.28, #keukenraam-12
-						2.60	2.30	-0.28,
-						0.60	2.30	-0.28,
-						0.60	0.90	-0.28,
-
-						0.60	3.60	-0.28, #bovenraam-16
-						1.50	3.60	-0.28,
-						1.50	5.0	-0.28,
-						4.42	5.0	-0.28,
-						4.42	5.40	-0.28, 
-						0.60	5.40	-0.28,
-
-						0.28	8.55	-3.15, #linkergevel-22
-						0.28	2.70	-8.72,
-						0.28	0	-8.72,
-
-						5.40	8.55	-3.15, #rechtergevel-25
-						5.40	5.40	-6.30,
-						5.40	5.40	-8.72,
-						5.40	0	-8.72,
-
-						2.25	0	-8.72, #achtergevel-29
-						2.25	0.6	-8.72,
-						4.8	0.6	-8.72,
-						4.8	5.40	-8.72,
-						1.2	0	-8.72,
-						1.2	2.70	-8.72,
-
-
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
-
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
-
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
-
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
-
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.70	-8.86,	#58
-
-						0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
-						5.40	5.40	0,
-						0.28	5.40	-6.30, #61
-						0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
-
-						0.14	5.40	0,	#63 extra punten voor segmentering
-						5.54	5.40	0,
-						0.14	5.40	-6.30, 
-						5.54	5.40	-6.3,  #66
-						5.54	8.55	-3.15, #rechtergevel-67
-						0.14	8.55	-3.15, #linkergevel-68
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	
-		59, 22, 61, -1,
-		60, 25, 26, -1,
-
-		59, 63, 68, 22, -1,
-		68, 22, 61, 65, -1,
-
-		60, 64, 67, 25, -1, 
-		25, 67, 66, 26, -1,
-
-		
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
 
 
 
 
 
 
-# /binmuur.wrl
+                                                ]     #default []
+                                                creaseAngle       0
+                                                normalIndex       []
+                                                normalPerVertex   TRUE
+                                                solid             TRUE
+                                                texCoordIndex     []
+                                            }
+                                        }
+                                    ]
+                                }
 
 
-# buitmuur.wrl
 
 
+                                #schoorsteen
 
 
+                                Transform {
+                                    children [
+                                        Shape {
+                                            appearance Appearance {
+                                                material         Material {
+                                                    ambientIntensity  0.2
+                                                    diffuseColor      0.1 0.1 0.1
+                                                    emissiveColor     0 0 0
+                                                    shininess         0.1
+                                                    specularColor     0.3 0.3 0.3
+                                                    transparency      0
+                                                }	texture           NULL
+                                                textureTransform  NULL
+                                            }
+                                            geometry IndexedFaceSet {
+                                                color             NULL
+                                                coord  Coordinate {	#default NULL
+                                                    point [
+                                                        4.8	8	-2.6,
+                                                        5.3	8	-2.6,
+                                                        5.3	8.4	-3.0,
+                                                        4.8	8.4	-3.0,
 
 
+                                                        4.9	9.4	-2.65,
+                                                        5.2	9.4	-2.65,
+                                                        5.2	9.4	-2.95,
+                                                        4.9	9.4	-2.95, ]
+                                                }
+                                                normal            NULL
+                                                texCoord          NULL
+                                                ccw               TRUE
+                                                colorIndex        []
+                                                colorPerVertex    TRUE
+                                                convex            TRUE
+                                                coordIndex  [
+                                                    0, 1, 5, 4, -1,
+                                                    0, 4, 5, 1, -1,
 
 
-Transform {
-	children [
-		Shape {
-appearance DEF steen Appearance {
-	material         Material {
-	ambientIntensity  0.2
-	diffuseColor      0.8 0.4 0.3
-	emissiveColor     0 0 0
-	shininess         0.1
-	specularColor     0 0 0
-	transparency      0
-}	texture           NULL
-	textureTransform  NULL
-}
-			geometry IndexedFaceSet {
-				color             NULL
-				coord  Coordinate {	#default NULL
-					point [
-						0	0	0, #linkerbenedenhoek voorgevel
-						5.68	0	0,
-						5.68	5.40	0,
-						0	5.40	0, #linkerbovenhoek voorgevel
-
-						3.19	0	0, #voordeur
-						4.42	0	0,
-						4.42	2.30	0,
-						3.19	2.30	0, #voordeur
-
-						4.84	1.60	0, #toiletraam-8
-						5.04	1.60	0,
-						5.04	2.30	0,
-						4.84	2.30	0, 
-
-						2.60	0.90	0, #keukenraam-12
-						2.60	2.30	0,
-						0.60	2.30	0,
-						0.60	0.90	0,
-
-						0.60	3.60	0, #bovenraam-16
-						1.50	3.60	0,
-						1.50	5.0	0,
-						4.42	5.0	0,
-						4.42	5.40	0, 
-						0.60	5.40	0,
-
-						0	8.555	-3.15, #linkergevel-22
-						0	2.7	-9.0,
-						0	0	-9.0,
-
-						5.68	8.555	-3.15, #rechtergevel-25
-						5.68	5.40	-6.3,
-						5.68	5.40	-9,
-						5.68	0	-9.0,
-
-						2.25	0	-9.0, #achtergevel-29
-						2.25	0.6	-9.0,
-						4.8	0.6	-9.0,
-						4.8	5.40	-9.0,
-						1.2	0	-9.0,
-						1.2	2.7	-9,
-
-
-						3.19	0	-0.14, #diepte van de voordeur-35
-						4.42	0	-0.14,
-						4.42	2.30	-0.14,
-						3.19	2.30	-0.14, #diepte van de voordeur-38
-
-						2.60	0.90	-0.14, # diepte van het keukenraam-39
-						2.60	2.30	-0.14,
-						0.60	2.30	-0.14,
-						0.60	0.90	-0.14,
-
-						4.84	1.60	-0.14, #diepte van het toiletraam-43
-						5.04	1.60	-0.14,
-						5.04	2.30	-0.14,
-						4.84	2.30	-0.14, 
-
-						0.60	3.60	-0.14, #diepte van het bovenraam-47
-						1.50	3.60	-0.14,
-						1.50	5.0	-0.14,
-						4.42	5.0	-0.14,
-						4.42	5.40	-0.14, 
-						0.60	5.40	-0.14, #52
-
-						2.25	0	-8.86, #diepte van de achtergevel-53
-						2.25	0.6	-8.86,
-						4.8	0.6	-8.86,
-						4.8	5.40	-8.86,
-						1.2	0	-8.86,
-						1.2	2.7	-8.86,	#58
-
-						0.14	5.40	0,	#59 extra punten voor segmentering
-						5.54	5.40	0,
-						0.14	5.40	-6.30, 
-						5.54	5.40	-6.3,  #62
-						5.54	8.55	-3.15, #rechtergevel-63
-						0.14	8.55	-3.15, #linkergevel-64
-						0 	5.4	-6.3,
-					]
-				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-	3, 22, 65, -1,
-	2, 26, 25, -1,
-
-	3, 59, 64, 22, -1,
-	61, 65, 22, 64, -1,
-
-	60, 2, 25, 63, -1,
-	63, 25, 26, 62, -1,
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
+                                                    1, 2, 6, 5, -1,
+                                                    1, 5, 6, 2, -1,
 
 
+                                                    2, 3, 7, 6, -1,
+                                                    2, 6, 7, 3, -1,
 
 
+                                                    0, 3, 7, 4, -1,
+                                                    0, 4, 7, 3, -1,
 
 
-# /buitmuur.wrl
+                                                    4, 5, 6, 7, -1,
+                                                    4, 7, 6, 5, -1,
 
 
-# /zolder/zolder.wrl
 
 
-DEF tijd2 TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
+                                                ]     #default []
+                                                creaseAngle       0
+                                                normalIndex       []
+                                                normalPerVertex   TRUE
+                                                solid             TRUE
+                                                texCoordIndex     []
+                                            }
+                                        }
+                                    ]
+                                }
 
 
-DEF plaats2 PositionInterpolator {
-	key           [0, 1]
-	keyValue      [0 0 0 ,6 0 0]
-}
 
 
-DEF tijd2a TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
 
 
-DEF plaats2a PositionInterpolator {
-	key           [0, 1]
-	keyValue      [6 0 0 ,0 0 0]
-}
 
 
 
 
 
 
-]
-}#zolder
+                                # /dak/dak.wrl
 
 
-DEF tijd3 TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
+                                Transform {
+                                    children[
+
+
+                                        Transform{
+                                            children[
+
+                                                Shape {
+                                                    appearance USE groen
+                                                    geometry USE pijl
+                                                }
+
+                                            ]
+                                            rotation 0 1 0 3.1415927
+                                        }
+
+                                        DEF schuifdak TouchSensor {}
+
+                                    ]
+                                    translation 0.15 6 0.3
+                                }
+
+
+                                Transform {
+                                    children[
+
+                                        Shape {
+                                            appearance USE rood
+                                            geometry USE pijl
+                                        }
+
+                                        DEF schuifdak2 TouchSensor {}
+                                    ]
+                                    translation 5.48 6 0.3
+                                }
+
+                                DEF tijd1 TimeSensor {
+                                    cycleInterval 4
+                                    enabled       TRUE
+                                    loop          FALSE
+                                    startTime     0
+                                    stopTime      0
+                                }
+
+                                DEF plaats1 PositionInterpolator {
+                                    key           [0, 1]
+                                    keyValue      [0 0 0 ,6 0 0]
+                                }
+
+                                DEF tijd1a TimeSensor {
+                                    cycleInterval 4
+                                    enabled       TRUE
+                                    loop          FALSE
+                                    startTime     0
+                                    stopTime      0
+                                }
+
+                                DEF plaats1a PositionInterpolator {
+                                    key           [0, 1]
+                                    keyValue      [6 0 0 ,0 0 0]
+                                }
+
+
+
+                            ]
+                        }#dak
+
+                        # zolder/zolder.wrl
+
+
+
+                        Viewpoint {
+                            fieldOfView    1
+                            jump           TRUE
+                            orientation    1 0 0  0
+                            position       2.5 7 -3.15
+
+                            description    "op zolder"
+                        }
+
+                        #kleine platte dakje
+
+                        Transform {
+                            children [
+                                Shape {
+                                    appearance DEF appdak Appearance {
+                                        material          Material {
+                                            ambientIntensity  0
+                                            diffuseColor      0.2 0.2 0.2
+                                            emissiveColor     0 0 0
+                                            shininess         0
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }
+
+                                        texture           ImageTexture {
+                                            url     [""]
+                                            repeatS TRUE
+                                            repeatT TRUE
+                                        }
+                                    }
+                                    geometry Box { size 2.6 0.04 2.74	}
+                                }
+                            ]
+                            translation 4.39 5.40 -7.67
+                        }
+
+
+                        DEF zoldervloer Transform {
+                            children [
+                                Shape {
+                                    appearance Appearance {
+                                        material          Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      1 0.5 0.3
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                0.14	5.40	0,
+                                                5.54	5.40	0,
+                                                5.54	5.40	-6.30,
+                                                0.14	5.40	-6.30,
+
+                                                5.54	5.40	-2.36, #-4
+                                                5.54	5.40	-4.36,
+                                                4.42	5.40	-4.36,
+                                                4.42	5.40	-2.36,
+
+
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [
+                                            0, 1, 4, 7, -1,
+                                            0, 7, 4, 1, -1,
+
+                                            0, 7, 6, 3, -1,
+                                            0, 3, 6, 7, -1,
+
+                                            5, 2, 3, 6, -1,
+                                            5, 6, 3, 2, -1,
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             TRUE
+                                        texCoordIndex     []
+                                    }
+                                }
+                            ]
+                        }
+
+                        DEF plafondboven Transform {
+                            children [
+                                Shape {
+                                    appearance Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      1 1 1
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                0.14	5.30	-0.14,
+                                                5.54	5.30	-0.14,
+                                                5.54	5.30	-8.86,
+                                                3.19	5.30	-8.86,
+
+                                                5.54	5.30	-2.36, #-4
+                                                5.54	5.30	-4.36,
+                                                4.42	5.30	-4.36,
+                                                4.42	5.30	-2.36,
+
+                                                3.19	5.30	-6.40,
+                                                0.14	5.30	-6.40,
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [
+                                            0, 1, 4, 7, -1,
+                                            0, 7, 4, 1, -1,
+
+                                            0, 7, 6, 8, 9, -1,
+                                            0, 9, 8, 6, 7, -1,
+
+                                            5, 2, 3, 8, 6, -1,
+                                            5, 6, 8, 3, 2, -1,
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             TRUE
+                                        texCoordIndex     []
+                                    }
+                                }
+                            ]
+                        }
+
+
+
+                        DEF vulstukvoortrap Transform {
+                            children [
+                                Shape {
+                                    appearance DEF wandkleur Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      1 0.9 0.7
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+
+
+                                    geometry IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                4.42	5.3	-2.36, #0
+                                                4.42	5.3	-3.36,
+                                                4.42	5.4	-3.36,
+                                                4.42	5.4	-2.36, #3
+
+                                                5.4	5.3	-2.36, #4
+                                                5.4	5.4	-2.36,
+
+                                                5.4	5.3	-4.36, #6
+                                                5.4	5.4	-4.36,
+                                                4.42	5.3	-4.36, #8
+                                                4.42	5.4	-4.36,
+
+
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [
+                                            0, 1, 2, 3, -1,
+                                            0, 3, 2, 1, -1,
+                                            0, 3, 5, 4, -1,
+                                            9, 8, 6, 7, -1,
+
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             FALSE
+                                        texCoordIndex     []
+                                    }
+                                }
+
+                            ]
+                        }
+
+                        # ballustrade.wrl
+
+
+
+                        Transform {
+                            children[
+
+                                DEF spijlen Group {
+                                    children [
+                                        Transform{
+                                            children [
+                                                DEF spijl Shape {
+                                                    appearance DEF kozijn Appearance {
+                                                        material         Material {
+                                                            ambientIntensity  0.2
+                                                            diffuseColor      0.95 0.95 0.9
+                                                            emissiveColor     0 0 0
+                                                            shininess         0.1
+                                                            specularColor     0 0 0
+                                                            transparency      0
+                                                        }	texture           NULL
+                                                        textureTransform  NULL
+                                                    }
+                                                    geometry  Cylinder {
+                                                        bottom  FALSE
+                                                        height  0.8
+                                                        radius  0.015
+                                                        side    TRUE
+                                                        top     FALSE
+                                                    }
+                                                }
+                                            ]
+                                            translation -0.025	0.4	0.05
+                                        }
+
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.15
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.25
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.35
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.45
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.55
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.65
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.75
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.85
+                                        }
+                                        Transform{
+                                            children USE spijl
+                                            translation -0.025	0.4	0.95
+                                        }
+
+                                    ]
+                                }#spijlengroup
+
+                                Transform{
+                                    translation 0 0 1
+                                    rotation 0 1 0 1.5707963
+                                    children USE spijlen
+                                }
+
+                                Transform{
+                                    children [
+                                        Shape {
+                                            appearance USE  kozijn
+                                            geometry  Box { size 0.05	0.03	1.05	}
+                                        }
+                                    ]
+                                    translation -0.025	0.815	0.525
+                                }
+
+                                Transform{
+                                    children [
+                                        Shape {
+                                            appearance USE  kozijn
+                                            geometry  Box { size 1	0.03	0.05	}
+                                        }
+                                    ]
+                                    translation 0.5	0.815	1.025
+                                }
+
+
+                            ]
+                            translation	4.42	5.4	-3.36
+                        }
+
+                        # /ballustrade.wrl
+
+                        # binmuur.wrl
+
+
+
+
+                        Transform {
+                            children [
+                                Shape {
+                                    appearance Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      1 0.9 0.7
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                0.28	0	-0.28, #0 linkerbenedenhoek voorgevel
+                                                5.40	0	-0.28,
+                                                5.40	5.40	-0.28,
+                                                0.28	5.40	-0.28, #3 linkerbovenhoek voorgevel
+
+                                                3.19	0	-0.28, #4 voordeur
+                                                4.42	0	-0.28,
+                                                4.42	2.30	-0.28,
+                                                3.19	2.30	-0.28, #7 voordeur
+
+                                                4.84	1.60	-0.28, #toiletraam-8
+                                                5.04	1.60	-0.28,
+                                                5.04	2.30	-0.28,
+                                                4.84	2.30	-0.28,
+
+                                                2.60	0.90	-0.28, #keukenraam-12
+                                                2.60	2.30	-0.28,
+                                                0.60	2.30	-0.28,
+                                                0.60	0.90	-0.28,
+
+                                                0.60	3.60	-0.28, #bovenraam-16
+                                                1.50	3.60	-0.28,
+                                                1.50	5.0	-0.28,
+                                                4.42	5.0	-0.28,
+                                                4.42	5.40	-0.28,
+                                                0.60	5.40	-0.28,
+
+                                                0.28	8.55	-3.15, #linkergevel-22
+                                                0.28	2.70	-8.72,
+                                                0.28	0	-8.72,
+
+                                                5.40	8.55	-3.15, #rechtergevel-25
+                                                5.40	5.40	-6.30,
+                                                5.40	5.40	-8.72,
+                                                5.40	0	-8.72,
+
+                                                2.25	0	-8.72, #achtergevel-29
+                                                2.25	0.6	-8.72,
+                                                4.8	0.6	-8.72,
+                                                4.8	5.40	-8.72,
+                                                1.2	0	-8.72,
+                                                1.2	2.70	-8.72,
+
+
+                                                3.19	0	-0.14, #diepte van de voordeur-35
+                                                4.42	0	-0.14,
+                                                4.42	2.30	-0.14,
+                                                3.19	2.30	-0.14, #diepte van de voordeur-38
+
+                                                2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                                2.60	2.30	-0.14,
+                                                0.60	2.30	-0.14,
+                                                0.60	0.90	-0.14,
+
+                                                4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                                5.04	1.60	-0.14,
+                                                5.04	2.30	-0.14,
+                                                4.84	2.30	-0.14,
+
+                                                0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                                1.50	3.60	-0.14,
+                                                1.50	5.0	-0.14,
+                                                4.42	5.0	-0.14,
+                                                4.42	5.40	-0.14,
+                                                0.60	5.40	-0.14, #52
+
+                                                2.25	0	-8.86, #diepte van de achtergevel-53
+                                                2.25	0.6	-8.86,
+                                                4.8	0.6	-8.86,
+                                                4.8	5.40	-8.86,
+                                                1.2	0	-8.86,
+                                                1.2	2.70	-8.86,	#58
+
+                                                0.28	5.40	0,	#59 hoekpunt voor dakvorm zolder
+                                                5.40	5.40	0,
+                                                0.28	5.40	-6.30, #61
+                                                0.28	2.70	-9.0,  #62 hoekpunt voor dakvorm 1e verdieping
+
+                                                0.14	5.40	0,	#63 extra punten voor segmentering
+                                                5.54	5.40	0,
+                                                0.14	5.40	-6.30,
+                                                5.54	5.40	-6.3,  #66
+                                                5.54	8.55	-3.15, #rechtergevel-67
+                                                0.14	8.55	-3.15, #linkergevel-68
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [
+
+                                            59, 22, 61, -1,
+                                            60, 25, 26, -1,
+
+                                            59, 63, 68, 22, -1,
+                                            68, 22, 61, 65, -1,
+
+                                            60, 64, 67, 25, -1,
+                                            25, 67, 66, 26, -1,
+
+
+
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             FALSE
+                                        texCoordIndex     []
+                                    }
+                                }
+                            ]
+                        }
+
+
+
+                        # /binmuur.wrl
+
+                        # buitmuur.wrl
+
+
+
+
+                        Transform {
+                            children [
+                                Shape {
+                                    appearance DEF steen Appearance {
+                                        material         Material {
+                                            ambientIntensity  0.2
+                                            diffuseColor      0.8 0.4 0.3
+                                            emissiveColor     0 0 0
+                                            shininess         0.1
+                                            specularColor     0 0 0
+                                            transparency      0
+                                        }	texture           NULL
+                                        textureTransform  NULL
+                                    }
+                                    geometry IndexedFaceSet {
+                                        color             NULL
+                                        coord  Coordinate {	#default NULL
+                                            point [
+                                                0	0	0, #linkerbenedenhoek voorgevel
+                                                5.68	0	0,
+                                                5.68	5.40	0,
+                                                0	5.40	0, #linkerbovenhoek voorgevel
+
+                                                3.19	0	0, #voordeur
+                                                4.42	0	0,
+                                                4.42	2.30	0,
+                                                3.19	2.30	0, #voordeur
+
+                                                4.84	1.60	0, #toiletraam-8
+                                                5.04	1.60	0,
+                                                5.04	2.30	0,
+                                                4.84	2.30	0,
+
+                                                2.60	0.90	0, #keukenraam-12
+                                                2.60	2.30	0,
+                                                0.60	2.30	0,
+                                                0.60	0.90	0,
+
+                                                0.60	3.60	0, #bovenraam-16
+                                                1.50	3.60	0,
+                                                1.50	5.0	0,
+                                                4.42	5.0	0,
+                                                4.42	5.40	0,
+                                                0.60	5.40	0,
+
+                                                0	8.555	-3.15, #linkergevel-22
+                                                0	2.7	-9.0,
+                                                0	0	-9.0,
+
+                                                5.68	8.555	-3.15, #rechtergevel-25
+                                                5.68	5.40	-6.3,
+                                                5.68	5.40	-9,
+                                                5.68	0	-9.0,
+
+                                                2.25	0	-9.0, #achtergevel-29
+                                                2.25	0.6	-9.0,
+                                                4.8	0.6	-9.0,
+                                                4.8	5.40	-9.0,
+                                                1.2	0	-9.0,
+                                                1.2	2.7	-9,
+
+
+                                                3.19	0	-0.14, #diepte van de voordeur-35
+                                                4.42	0	-0.14,
+                                                4.42	2.30	-0.14,
+                                                3.19	2.30	-0.14, #diepte van de voordeur-38
+
+                                                2.60	0.90	-0.14, # diepte van het keukenraam-39
+                                                2.60	2.30	-0.14,
+                                                0.60	2.30	-0.14,
+                                                0.60	0.90	-0.14,
+
+                                                4.84	1.60	-0.14, #diepte van het toiletraam-43
+                                                5.04	1.60	-0.14,
+                                                5.04	2.30	-0.14,
+                                                4.84	2.30	-0.14,
+
+                                                0.60	3.60	-0.14, #diepte van het bovenraam-47
+                                                1.50	3.60	-0.14,
+                                                1.50	5.0	-0.14,
+                                                4.42	5.0	-0.14,
+                                                4.42	5.40	-0.14,
+                                                0.60	5.40	-0.14, #52
+
+                                                2.25	0	-8.86, #diepte van de achtergevel-53
+                                                2.25	0.6	-8.86,
+                                                4.8	0.6	-8.86,
+                                                4.8	5.40	-8.86,
+                                                1.2	0	-8.86,
+                                                1.2	2.7	-8.86,	#58
+
+                                                0.14	5.40	0,	#59 extra punten voor segmentering
+                                                5.54	5.40	0,
+                                                0.14	5.40	-6.30,
+                                                5.54	5.40	-6.3,  #62
+                                                5.54	8.55	-3.15, #rechtergevel-63
+                                                0.14	8.55	-3.15, #linkergevel-64
+                                                0 	5.4	-6.3,
+                                            ]
+                                        }
+                                        normal            NULL
+                                        texCoord          NULL
+                                        ccw               TRUE
+                                        colorIndex        []
+                                        colorPerVertex    TRUE
+                                        convex            TRUE
+                                        coordIndex  [
+                                            3, 22, 65, -1,
+                                            2, 26, 25, -1,
+
+                                            3, 59, 64, 22, -1,
+                                            61, 65, 22, 64, -1,
+
+                                            60, 2, 25, 63, -1,
+                                            63, 25, 26, 62, -1,
+
+
+                                        ]     #default []
+                                        creaseAngle       0
+                                        normalIndex       []
+                                        normalPerVertex   TRUE
+                                        solid             FALSE
+                                        texCoordIndex     []
+                                    }
+                                }
+                            ]
+                        }
+
+
+
+                        # /buitmuur.wrl
+
+                        # /zolder/zolder.wrl
+
+                        DEF tijd2 TimeSensor {
+                            cycleInterval 4
+                            enabled       TRUE
+                            loop          FALSE
+                            startTime     0
+                            stopTime      0
+                        }
+
+                        DEF plaats2 PositionInterpolator {
+                            key           [0, 1]
+                            keyValue      [0 0 0 ,6 0 0]
+                        }
+
+                        DEF tijd2a TimeSensor {
+                            cycleInterval 4
+                            enabled       TRUE
+                            loop          FALSE
+                            startTime     0
+                            stopTime      0
+                        }
+
+                        DEF plaats2a PositionInterpolator {
+                            key           [0, 1]
+                            keyValue      [6 0 0 ,0 0 0]
+                        }
+
+
+
+                    ]
+                }#zolder
+
+                DEF tijd3 TimeSensor {
+                    cycleInterval 4
+                    enabled       TRUE
+                    loop          FALSE
+                    startTime     0
+                    stopTime      0
+                }
 
 
-DEF plaats3 PositionInterpolator {
-	key           [0, 1]
-	keyValue      [0 0 0 ,6 0 0]
-}
+                DEF plaats3 PositionInterpolator {
+                    key           [0, 1]
+                    keyValue      [0 0 0 ,6 0 0]
+                }
 
 
-DEF tijd3a TimeSensor {
-	cycleInterval 4
-	enabled       TRUE
-	loop          FALSE
-	startTime     0
-	stopTime      0
-}
+                DEF tijd3a TimeSensor {
+                    cycleInterval 4
+                    enabled       TRUE
+                    loop          FALSE
+                    startTime     0
+                    stopTime      0
+                }
 
 
-DEF plaats3a PositionInterpolator {
-	key           [0, 1]
-	keyValue      [6 0 0 ,0 0 0]
-}
+                DEF plaats3a PositionInterpolator {
+                    key           [0, 1]
+                    keyValue      [6 0 0 ,0 0 0]
+                }
 
 
 
 
-]
-}#boven
+            ]
+        }#boven
 
 
 
 
 
 
-]
+    ]
 }
 }
 
 
-#ROUTE schuifdak.touchTime TO tijd1.startTime
-#ROUTE tijd1.fraction_changed TO plaats1.set_fraction
-#ROUTE plaats1.value_changed TO dak.translation
+ROUTE schuifdak.touchTime TO tijd1.startTime
+ROUTE tijd1.fraction_changed TO plaats1.set_fraction
+ROUTE plaats1.value_changed TO dak.translation
 
 
-#ROUTE schuifzolder.touchTime TO tijd2.startTime
-#ROUTE tijd2.fraction_changed TO plaats2.set_fraction
-#ROUTE plaats2.value_changed TO zolder.translation
+ROUTE schuifzolder.touchTime TO tijd2.startTime
+ROUTE tijd2.fraction_changed TO plaats2.set_fraction
+ROUTE plaats2.value_changed TO zolder.translation
 
 
-#ROUTE schuifboven.touchTime TO tijd3.startTime
-#ROUTE tijd3.fraction_changed TO plaats3.set_fraction
-#ROUTE plaats3.value_changed TO boven.translation
+ROUTE schuifboven.touchTime TO tijd3.startTime
+ROUTE tijd3.fraction_changed TO plaats3.set_fraction
+ROUTE plaats3.value_changed TO boven.translation
 
 
-#ROUTE schuifdak2.touchTime TO tijd1a.startTime
-#ROUTE tijd1a.fraction_changed TO plaats1a.set_fraction
-#ROUTE plaats1a.value_changed TO dak.translation
+ROUTE schuifdak2.touchTime TO tijd1a.startTime
+ROUTE tijd1a.fraction_changed TO plaats1a.set_fraction
+ROUTE plaats1a.value_changed TO dak.translation
 
 
-#ROUTE schuifzolder2.touchTime TO tijd2a.startTime
-#ROUTE tijd2a.fraction_changed TO plaats2a.set_fraction
-#ROUTE plaats2a.value_changed TO zolder.translation
+ROUTE schuifzolder2.touchTime TO tijd2a.startTime
+ROUTE tijd2a.fraction_changed TO plaats2a.set_fraction
+ROUTE plaats2a.value_changed TO zolder.translation
 
 
-#ROUTE schuifboven2.touchTime TO tijd3a.startTime
-#ROUTE tijd3a.fraction_changed TO plaats3a.set_fraction
-#ROUTE plaats3a.value_changed TO boven.translation
+ROUTE schuifboven2.touchTime TO tijd3a.startTime
+ROUTE tijd3a.fraction_changed TO plaats3a.set_fraction
+ROUTE plaats3a.value_changed TO boven.translation
 
 

+ 0 - 3
examples/obj/lucy/.htaccess

@@ -1,3 +0,0 @@
-<Files *.js>
-SetOutputFilter DEFLATE
-</Files>

+ 9 - 8
examples/webgl_geometry_spline_editor.html

@@ -16,9 +16,10 @@
 	<body>
 	<body>
 
 
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
+
+		<script src="js/controls/DragControls.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/controls/TransformControls.js"></script>
 		<script src="js/controls/TransformControls.js"></script>
-		<script src="js/controls/DragControls.js"></script>
 
 
 		<script src="js/libs/stats.min.js"></script>
 		<script src="js/libs/stats.min.js"></script>
 
 
@@ -165,18 +166,18 @@
 
 
 				} );
 				} );
 
 
-				var dragcontrols = new THREE.DragControls( camera, splineHelperObjects, renderer.domElement ); //
+				var dragcontrols = new THREE.DragControls( splineHelperObjects, camera, renderer.domElement ); //
+				dragcontrols.enabled = false;
+				dragcontrols.addEventListener( 'hoveron', function ( event ) {
 
 
-				dragcontrols.on( 'hoveron', function( e ) {
-
-					transformControl.attach( e.object );
-					cancelHideTransorm(); // *
+					transformControl.attach( event.object );
+					cancelHideTransorm();
 
 
 				} );
 				} );
 
 
-				dragcontrols.on( 'hoveroff', function( e ) {
+				dragcontrols.addEventListener( 'hoveroff', function ( event ) {
 
 
-					if ( e ) delayHideTransform();
+					delayHideTransform();
 
 
 				} );
 				} );
 
 

+ 5 - 104
examples/webgl_interactive_draggablecubes.html

@@ -17,6 +17,7 @@
 
 
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 
 
+		<script src="js/controls/DragControls.js"></script>
 		<script src="js/controls/TrackballControls.js"></script>
 		<script src="js/controls/TrackballControls.js"></script>
 
 
 		<script src="js/libs/stats.min.js"></script>
 		<script src="js/libs/stats.min.js"></script>
@@ -26,12 +27,6 @@
 			var container, stats;
 			var container, stats;
 			var camera, controls, scene, renderer;
 			var camera, controls, scene, renderer;
 			var objects = [];
 			var objects = [];
-			var plane = new THREE.Plane();
-			var raycaster = new THREE.Raycaster();
-			var mouse = new THREE.Vector2(),
-			offset = new THREE.Vector3(),
-			intersection = new THREE.Vector3(),
-			INTERSECTED, SELECTED;
 
 
 			init();
 			init();
 			animate();
 			animate();
@@ -107,6 +102,10 @@
 
 
 				container.appendChild( renderer.domElement );
 				container.appendChild( renderer.domElement );
 
 
+				var dragControls = new THREE.DragControls( objects, camera, renderer.domElement );
+				dragControls.addEventListener( 'dragstart', function ( event ) { controls.enabled = false; } );
+				dragControls.addEventListener( 'dragend', function ( event ) { controls.enabled = true; } );
+
 				var info = document.createElement( 'div' );
 				var info = document.createElement( 'div' );
 				info.style.position = 'absolute';
 				info.style.position = 'absolute';
 				info.style.top = '10px';
 				info.style.top = '10px';
@@ -118,10 +117,6 @@
 				stats = new Stats();
 				stats = new Stats();
 				container.appendChild( stats.dom );
 				container.appendChild( stats.dom );
 
 
-				renderer.domElement.addEventListener( 'mousemove', onDocumentMouseMove, false );
-				renderer.domElement.addEventListener( 'mousedown', onDocumentMouseDown, false );
-				renderer.domElement.addEventListener( 'mouseup', onDocumentMouseUp, false );
-
 				//
 				//
 
 
 				window.addEventListener( 'resize', onWindowResize, false );
 				window.addEventListener( 'resize', onWindowResize, false );
@@ -137,100 +132,6 @@
 
 
 			}
 			}
 
 
-			function onDocumentMouseMove( event ) {
-
-				event.preventDefault();
-
-				mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
-				mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
-
-				raycaster.setFromCamera( mouse, camera );
-
-				if ( SELECTED ) {
-
-					if ( raycaster.ray.intersectPlane( plane, intersection ) ) {
-
-						SELECTED.position.copy( intersection.sub( offset ) );
-
-					}
-
-					return;
-
-				}
-
-				var intersects = raycaster.intersectObjects( objects );
-
-				if ( intersects.length > 0 ) {
-
-					if ( INTERSECTED != intersects[ 0 ].object ) {
-
-						if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );
-
-						INTERSECTED = intersects[ 0 ].object;
-						INTERSECTED.currentHex = INTERSECTED.material.color.getHex();
-
-						plane.setFromNormalAndCoplanarPoint(
-							camera.getWorldDirection( plane.normal ),
-							INTERSECTED.position );
-
-					}
-
-					container.style.cursor = 'pointer';
-
-				} else {
-
-					if ( INTERSECTED ) INTERSECTED.material.color.setHex( INTERSECTED.currentHex );
-
-					INTERSECTED = null;
-
-					container.style.cursor = 'auto';
-
-				}
-
-			}
-
-			function onDocumentMouseDown( event ) {
-
-				event.preventDefault();
-
-				raycaster.setFromCamera( mouse, camera );
-
-				var intersects = raycaster.intersectObjects( objects );
-
-				if ( intersects.length > 0 ) {
-
-					controls.enabled = false;
-
-					SELECTED = intersects[ 0 ].object;
-
-					if ( raycaster.ray.intersectPlane( plane, intersection ) ) {
-
-						offset.copy( intersection ).sub( SELECTED.position );
-
-					}
-
-					container.style.cursor = 'move';
-
-				}
-
-			}
-
-			function onDocumentMouseUp( event ) {
-
-				event.preventDefault();
-
-				controls.enabled = true;
-
-				if ( INTERSECTED ) {
-
-					SELECTED = null;
-
-				}
-
-				container.style.cursor = 'auto';
-
-			}
-
 			//
 			//
 
 
 			function animate() {
 			function animate() {

+ 134 - 0
examples/webgl_loader_assimp.html

@@ -0,0 +1,134 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+		<title>three.js webgl - Assimp</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 {
+					color: #000;
+					font-family: Monospace;
+					font-size: 13px;
+					text-align: center;
+					background-color: #000;
+					margin: 0px;
+					overflow: hidden;
+			}
+
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				z-index: 100;
+				display:block;
+
+			}
+
+			a { color: skyblue }
+			.button { background:#999; color:#eee; padding:0.2em 0.5em; cursor:pointer }
+			.highlight { background:orange; color:#fff; }
+
+			span {
+				display: inline-block;
+				width: 60px;
+				float: left;
+				text-align: center;
+			}
+		</style>
+</head>
+
+<body>
+		<div id="container"></div>
+		<div id="info">
+			<a href="http://threejs.org" target="_blank">three.js</a>
+			<a href="https://github.com/Virtulous" target="_blank">Assimp File format</a>
+			<div>Assimp loader by <a href="https://virtulo.us" target="_blank">Virtulous</a></div>
+			<div>Octaminator model from <a href="http://opengameart.org/content/octaminator-engine-ready" target="_blank">Teh_Bucket and raymoohawk</a></div>
+		</div>
+		<script src="../build/three.js"></script>
+		<script src="js/loaders/AssimpLoader.js"></script>
+		<script src="js/Detector.js"></script>
+		<script src="js/libs/stats.min.js"></script>
+
+		<script src="js/controls/OrbitControls.js"></script>
+
+		<script>
+
+		if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+		var container, stats;
+		var camera, scene, renderer;
+		var animation;
+
+		init();
+
+		function init() {
+
+			container = document.getElementById( 'container' );
+			camera = new THREE.PerspectiveCamera( 25, window.innerWidth / window.innerHeight, 1, 10000 );
+			camera.position.set( 600, 1150, 5 );
+			camera.up.set( 0, 0, 1 );
+			camera.lookAt( new THREE.Vector3( -100, 0, 0 ) );
+
+			scene = new THREE.Scene();
+
+			var ambient = new THREE.HemisphereLight( 0x8888fff, 0xff8888, 0.5 );
+			ambient.position.set( 0, 1, 0 );
+			scene.add( ambient );
+
+			var light = new THREE.DirectionalLight( 0xffffff, 1 );
+			light.position.set( 0, 4, 4 ).normalize();
+			scene.add( light );
+
+			renderer = new THREE.WebGLRenderer( { antialias: true } );
+			renderer.setPixelRatio( window.devicePixelRatio );
+			renderer.setSize( window.innerWidth, window.innerHeight );
+			container.appendChild( renderer.domElement );
+
+			var controls = new THREE.OrbitControls( camera, renderer.domElement );
+
+			stats = new Stats();
+			container.appendChild( stats.dom );
+
+			var loader = new THREE.AssimpLoader();
+			loader.load( "./models/assimp/octaminator/Octaminator.assimp", function ( err, result ) {
+
+				var object = result.object;
+
+				object.position.y = - 100;
+				object.rotation.x = Math.PI / 2;
+				scene.add( object );
+
+				animation = result.animation;
+
+			} );
+
+			window.addEventListener( 'resize', onWindowResize, false );
+			animate();
+
+		}
+
+		function onWindowResize() {
+
+			camera.aspect = window.innerWidth / window.innerHeight;
+			camera.updateProjectionMatrix();
+			renderer.setSize( window.innerWidth, window.innerHeight );
+
+		}
+
+		function animate() {
+
+			requestAnimationFrame( animate, renderer.domElement );
+			renderer.render( scene, camera );
+
+			if ( animation ) animation.setTime( performance.now() / 1000 );
+
+			stats.update();
+
+		}
+		</script>
+</body>
+
+</html>

+ 6 - 2
examples/webgl_loader_fbx.html

@@ -44,7 +44,7 @@
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
 			var container, stats, controls;
 			var container, stats, controls;
-			var camera, scene, renderer;
+			var camera, scene, renderer, light;
 
 
 			var clock = new THREE.Clock();
 			var clock = new THREE.Clock();
 
 
@@ -93,7 +93,7 @@
 				};
 				};
 
 
 				var loader = new THREE.FBXLoader( manager );
 				var loader = new THREE.FBXLoader( manager );
-				loader.load( 'models/fbx/xsi_man_skinning.fbx', function( object ) {
+				loader.load( 'models/fbx/xsi_man.fbx', function( object ) {
 
 
 					object.traverse( function( child ) {
 					object.traverse( function( child ) {
 
 
@@ -138,6 +138,10 @@
 
 
 				window.addEventListener( 'resize', onWindowResize, false );
 				window.addEventListener( 'resize', onWindowResize, false );
 
 
+				light = new THREE.DirectionalLight(0xffffff, 1.0);
+				light.position.set(0, 1, 0);
+				scene.add(light);
+
 				animate();
 				animate();
 
 
 			}
 			}

+ 25 - 22
examples/webgl_loader_gltf.html

@@ -137,6 +137,8 @@
 			var cameraNames = [];
 			var cameraNames = [];
 			var defaultCamera = null;
 			var defaultCamera = null;
 			var gltf = null;
 			var gltf = null;
+			var mixer = null;
+			var clock = new THREE.Clock();
 
 
 			function onload() {
 			function onload() {
 
 
@@ -312,18 +314,25 @@
 
 
 					}
 					}
 
 
-					if (gltf.animations && gltf.animations.length) {
+					var animations = gltf.animations;
+
+					if ( animations && animations.length ) {
+
+						mixer = new THREE.AnimationMixer( object );
+
+						for ( var i = 0; i < animations.length; i ++ ) {
+
+							var animation = animations[ i ];
 
 
-						var i, len = gltf.animations.length;
-						for (i = 0; i < len; i++) {
-							var animation = gltf.animations[i];
-							animation.loop = true;
 							// There's .3333 seconds junk at the tail of the Monster animation that
 							// There's .3333 seconds junk at the tail of the Monster animation that
 							// keeps it from looping cleanly. Clip it at 3 seconds
 							// keeps it from looping cleanly. Clip it at 3 seconds
-							if (sceneInfo.animationTime)
+							if ( sceneInfo.animationTime )
 								animation.duration = sceneInfo.animationTime;
 								animation.duration = sceneInfo.animationTime;
-							animation.play();
+
+							mixer.clipAction( animation ).play();
+
 						}
 						}
+
 					}
 					}
 
 
 					scene.add( object );
 					scene.add( object );
@@ -353,7 +362,7 @@
 
 
 			function animate() {
 			function animate() {
 				requestAnimationFrame( animate );
 				requestAnimationFrame( animate );
-				THREE.GLTFLoader.Animations.update();
+				if (mixer) mixer.update(clock.getDelta());
 				THREE.GLTFLoader.Shaders.update(scene, camera);
 				THREE.GLTFLoader.Shaders.update(scene, camera);
 				if (cameraIndex == 0)
 				if (cameraIndex == 0)
 					orbitControls.update();
 					orbitControls.update();
@@ -513,16 +522,17 @@
 
 
 			function toggleAnimations() {
 			function toggleAnimations() {
 
 
-				var i, len = gltf.animations.length;
+				var i, len = gltf.clips.length;
 
 
 				for (i = 0; i < len; i++) {
 				for (i = 0; i < len; i++) {
 
 
-					var animation = gltf.animations[i];
+					var clip = gltf.clips[i];
+					var action = mixer.existingAction( clip );
 
 
-					if (animation.running) {
-						animation.stop();
+					if (action.isRunning()) {
+						action.stop();
 					} else {
 					} else {
-						animation.play();
+						action.play();
 					}
 					}
 
 
 				}
 				}
@@ -549,17 +559,10 @@
 				cameraNames = [];
 				cameraNames = [];
 				defaultCamera = null;
 				defaultCamera = null;
 
 
-				if (!loader || !gltf.animations)
+				if (!loader || !mixer)
 					return;
 					return;
 
 
-				var i, len = gltf.animations.length;
-
-				for (i = 0; i < len; i++) {
-					var animation = gltf.animations[i];
-					if (animation.running) {
-						animation.stop();
-					}
-				}
+				mixer.stopAllAction();
 
 
 			}
 			}
 
 

+ 3 - 4
examples/webgl_loader_ply.html

@@ -116,10 +116,9 @@
 					var material = new THREE.MeshStandardMaterial( { color: 0x0055ff, shading: THREE.FlatShading } );
 					var material = new THREE.MeshStandardMaterial( { color: 0x0055ff, shading: THREE.FlatShading } );
 					var mesh = new THREE.Mesh( geometry, material );
 					var mesh = new THREE.Mesh( geometry, material );
 
 
-					mesh.position.x = - 0.4;
-					mesh.position.y = - 0.14;
-					mesh.position.z = - 0.3;
-					mesh.rotation.x = - Math.PI / 2;
+					mesh.position.x = - 0.2;
+					mesh.position.y = - 0.02;
+					mesh.position.z = - 0.2;
 					mesh.scale.multiplyScalar( 0.0006 );
 					mesh.scale.multiplyScalar( 0.0006 );
 
 
 					mesh.castShadow = true;
 					mesh.castShadow = true;

+ 2 - 0
examples/webgl_loader_sea3d.html

@@ -54,6 +54,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer, composer, controls;
 			var camera, scene, renderer, composer, controls;

+ 3 - 1
examples/webgl_loader_sea3d_hierarchy.html

@@ -50,7 +50,7 @@
 		<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
 		<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
 		
 		
 		<script src="js/libs/o3dgc.js"></script>
 		<script src="js/libs/o3dgc.js"></script>
-		<script src="js/loaders/sea3d/SEA3DGC.js"></script>
+		<script src="js/loaders/sea3d/o3dgc/SEA3DGC.js"></script>
 
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Detector.js"></script>
 		<script src="js/libs/stats.min.js"></script>
 		<script src="js/libs/stats.min.js"></script>
@@ -59,6 +59,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer, composer, controls;
 			var camera, scene, renderer, composer, controls;

+ 2 - 0
examples/webgl_loader_sea3d_keyframe.html

@@ -56,6 +56,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer, composer, controls, demoAt = -1;
 			var camera, scene, renderer, composer, controls, demoAt = -1;

+ 2 - 0
examples/webgl_loader_sea3d_morph.html

@@ -56,6 +56,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer, composer, controls, teapot;
 			var camera, scene, renderer, composer, controls, teapot;

+ 223 - 0
examples/webgl_loader_sea3d_physics.html

@@ -0,0 +1,223 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - sea3d / keyframe</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 {
+				font-family: Monospace;
+				background-color: #000;
+				margin: 0px;
+				overflow: hidden;
+			}
+
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				z-index: 100;
+				display:block;
+
+			}
+
+			a { color: white }
+		</style>
+	</head>
+	<body>
+		<div id="info">
+			<a href="http://threejs.org" target="_blank">Three.JS</a> - Ammo Physics Example - Exported by <a href="https://github.com/sunag/sea3d" style="color:#FFFFFF" target="_blank">SEA3D Exporter</a> edited by <a href="https://github.com/sunag/sea3d" style="color:#FFFFFF" target="_blank">SEA3D Studio</a>
+			<br/>
+			<br/><div id="description">Right click to clone</div>
+		</div>
+
+		<script src="../build/three.js"></script>
+
+		<script src="js/controls/OrbitControls.js"></script>
+
+		<script src="js/postprocessing/EffectComposer.js"></script>
+		<script src="js/postprocessing/RenderPass.js"></script>
+		<script src="js/postprocessing/ShaderPass.js"></script>
+		<script src="js/postprocessing/MaskPass.js"></script>
+		<script src="js/shaders/CopyShader.js"></script>
+		<script src="js/shaders/ColorCorrectionShader.js"></script>
+		<script src="js/shaders/VignetteShader.js"></script>
+
+		<script src="js/loaders/sea3d/SEA3D.js"></script>
+		<script src="js/loaders/sea3d/SEA3DLZMA.js"></script>
+		<script src="js/loaders/sea3d/SEA3DLoader.js"></script>
+
+		<script src="js/libs/ammo.js"></script>
+		<script src="js/loaders/sea3d/physics/SEA3DRigidBody.js"></script>
+		<script src="js/loaders/sea3d/physics/SEA3DAmmo.js"></script>
+		<script src="js/loaders/sea3d/physics/SEA3DAmmoLoader.js"></script>
+
+		<script src="js/Detector.js"></script>
+		<script src="js/libs/stats.min.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
+			var container, stats;
+
+			var camera, scene, renderer, composer, controls, demoAt = -1;
+
+			var loader;
+
+			// Initialize Three.JS
+
+			init();
+			
+			// Initialize Physics Engine
+			
+			SEA3D.AMMO.init(); 
+
+			//
+			// SEA3D Loader
+			//
+
+			loader = new THREE.SEA3D( {
+
+				container : scene // Container to add models
+
+			} );
+
+			loader.onComplete = function( e ) {
+
+				controls = new THREE.OrbitControls( camera );
+
+				// events
+
+				window.addEventListener( 'contextmenu', function(e) { 
+
+					e.preventDefault(); 
+
+					cloneAsset(); 
+
+				} );
+
+				animate();
+
+			};
+
+			loader.load( './models/sea3d/car.tjs.sea' );
+
+			var cloneAsset = function() {
+
+				var offset = 0;
+
+				return function() {
+
+					var domain = this.loader.clone( { lights : false, runScripts : false, autoPlay: false, enabledPhysics : false } );
+
+					offset += 180;
+
+					domain.container.position.x += offset;
+					domain.applyContainerTransform();
+					domain.enabledPhysics( true );
+					domain.runScripts();
+
+					this.scene.add( domain.container );
+
+				}
+
+			}();
+
+			//
+
+			function init() {
+
+				scene = new THREE.Scene();
+
+				container = document.createElement( 'div' );
+				document.body.appendChild( container );
+
+				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 15000 );
+				camera.position.set( -300, 200, 300 );
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.setClearColor( 0x333333, 1 );
+				container.appendChild( renderer.domElement );
+
+				stats = new Stats();
+				container.appendChild( stats.dom );
+
+				// post-processing
+
+				composer = new THREE.EffectComposer( renderer );
+
+				var renderPass = new THREE.RenderPass( scene, camera );
+				var copyPass = new THREE.ShaderPass( THREE.CopyShader );
+				composer.addPass( renderPass );
+
+				var vh = 1.4, vl = 1.2;
+
+				var colorCorrectionPass = new THREE.ShaderPass( THREE.ColorCorrectionShader );
+				colorCorrectionPass.uniforms[ "powRGB" ].value = new THREE.Vector3( vh, vh, vh );
+				colorCorrectionPass.uniforms[ "mulRGB" ].value = new THREE.Vector3( vl, vl, vl );
+				composer.addPass( colorCorrectionPass );
+
+				var vignettePass = new THREE.ShaderPass( THREE.VignetteShader );
+				vignettePass.uniforms[ "darkness" ].value = 1.0;
+				composer.addPass( vignettePass );
+
+				composer.addPass( copyPass );
+				copyPass.renderToScreen = true;
+
+				// events
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				composer.setSize( window.innerWidth, window.innerHeight );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			//
+
+			var clock = new THREE.Clock();
+
+			function animate() {
+
+				var delta = clock.getDelta();
+
+				requestAnimationFrame( animate );
+
+				// Update Physics Engine
+
+				SEA3D.AMMO.update( delta );
+
+				// Update SEA3D Animations
+
+				THREE.SEA3D.AnimationHandler.update( delta );
+
+				render( delta );
+
+				stats.update();
+
+			}
+
+			function render( dlt ) {
+
+				//renderer.render( scene, camera );
+				composer.render( dlt );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 12 - 7
examples/webgl_loader_sea3d_skinning.html

@@ -58,6 +58,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, stats;
 			var container, stats;
 
 
 			var camera, scene, renderer, composer, controls, player, hat;
 			var camera, scene, renderer, composer, controls, player, hat;
@@ -95,17 +97,20 @@
 				player = loader.getMesh("Player");
 				player = loader.getMesh("Player");
 				hat = loader.getMesh("Hat");
 				hat = loader.getMesh("Hat");
 
 
-				// events
-
 				// on animation complete example
 				// on animation complete example
-				player.animationsData['pass#1'].onComplete = function() {
 
 
-					console.log("Animation completed!");
+				//player.animation['pass#1'].onComplete = function(e) { console.log("Animation completed!", e); };
+
+				// or
+
+				player.animation['pass#1'].addEventListener(THREE.SEA3D.Animation.COMPLETE, function(e) {
+
+					console.log("Animation completed!", e);
 
 
-				};
+				} );
 
 
-				window.addEventListener( 'click', onMouseClick, false );
-				window.addEventListener( 'contextmenu', onRightClick, false );
+				window.addEventListener( 'click', onMouseClick );
+				window.addEventListener( 'contextmenu', onRightClick );
 
 
 				animate();
 				animate();
 
 

+ 3 - 27
examples/webgl_loader_sea3d_sound.html

@@ -103,6 +103,8 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
+			console.log("Visit https://github.com/sunag/sea3d to all codes and builds under development.");
+
 			var container, raycaster, stats;
 			var container, raycaster, stats;
 
 
 			var camera, scene, renderer, composer, controls, velocity;
 			var camera, scene, renderer, composer, controls, velocity;
@@ -221,33 +223,7 @@
 
 
 						// Ask the browser to lock the pointer
 						// Ask the browser to lock the pointer
 						element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
 						element.requestPointerLock = element.requestPointerLock || element.mozRequestPointerLock || element.webkitRequestPointerLock;
-
-						if ( /Firefox/i.test( navigator.userAgent ) ) {
-
-							var fullscreenchange = function ( event ) {
-
-								if ( document.fullscreenElement === element || document.mozFullscreenElement === element || document.mozFullScreenElement === element ) {
-
-									document.removeEventListener( 'fullscreenchange', fullscreenchange );
-									document.removeEventListener( 'mozfullscreenchange', fullscreenchange );
-
-									element.requestPointerLock();
-								}
-
-							};
-
-							document.addEventListener( 'fullscreenchange', fullscreenchange, false );
-							document.addEventListener( 'mozfullscreenchange', fullscreenchange, false );
-
-							element.requestFullscreen = element.requestFullscreen || element.mozRequestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen;
-
-							element.requestFullscreen();
-
-						} else {
-
-							element.requestPointerLock();
-
-						}
+						element.requestPointerLock();
 
 
 					}, false );
 					}, false );
 
 

+ 1 - 1
examples/webgl_loader_utf8.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - io - UTF8 loader</title>
+		<title>three.js webgl - loader - UTF8</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>

Some files were not shown because too many files changed in this diff