瀏覽代碼

Merge branch 'dev' into FixCircularReferences

Mr.doob 8 年之前
父節點
當前提交
fcfb140529
共有 100 個文件被更改,包括 9731 次插入6938 次删除
  1. 12 6
      build/three.js
  2. 137 332
      build/three.min.js
  3. 12 6
      build/three.module.js
  4. 2 2
      docs/api/animation/AnimationUtils.html
  5. 4 4
      docs/api/extras/SceneUtils.html
  6. 138 137
      docs/api/geometries/TextGeometry.html
  7. 1 1
      docs/api/helpers/ArrowHelper.html
  8. 1 1
      docs/api/helpers/AxisHelper.html
  9. 1 1
      docs/api/helpers/BoxHelper.html
  10. 2 3
      docs/api/helpers/CameraHelper.html
  11. 1 1
      docs/api/helpers/DirectionalLightHelper.html
  12. 1 1
      docs/api/helpers/FaceNormalsHelper.html
  13. 1 1
      docs/api/helpers/GridHelper.html
  14. 1 1
      docs/api/helpers/HemisphereLightHelper.html
  15. 1 1
      docs/api/helpers/PointLightHelper.html
  16. 1 1
      docs/api/helpers/PolarGridHelper.html
  17. 1 1
      docs/api/helpers/RectAreaLightHelper.html
  18. 1 1
      docs/api/helpers/SkeletonHelper.html
  19. 1 1
      docs/api/helpers/SpotLightHelper.html
  20. 1 1
      docs/api/helpers/VertexNormalsHelper.html
  21. 1 1
      docs/api/lights/RectAreaLight.html
  22. 2 2
      docs/api/objects/Line.html
  23. 2 2
      docs/api/objects/LineSegments.html
  24. 17 17
      docs/list.js
  25. 3 2
      docs/manual/introduction/Creating-text.html
  26. 5 2
      docs/scenes/js/geometry.js
  27. 3 3
      editor/js/Loader.js
  28. 3 3
      editor/js/Viewport.js
  29. 22 0
      editor/js/libs/app/index.html
  30. 47 55
      examples/js/Mirror.js
  31. 134 148
      examples/js/SkyShader.js
  32. 118 123
      examples/js/WaterShader.js
  33. 1 1
      examples/js/loaders/AssimpJSONLoader.js
  34. 1 9
      examples/js/loaders/FBXLoader.js
  35. 3860 0
      examples/js/loaders/FBXLoader2.js
  36. 301 131
      examples/js/loaders/GLTFLoader.js
  37. 1 1
      examples/js/loaders/MMDLoader.js
  38. 4 1
      examples/js/loaders/PLYLoader.js
  39. 7 1
      examples/js/pmrem/PMREMCubeUVPacker.js
  40. 17 7
      examples/js/pmrem/PMREMGenerator.js
  41. 3 0
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  42. 2 0
      examples/js/postprocessing/BloomPass.js
  43. 2 0
      examples/js/postprocessing/BokehPass.js
  44. 2 1
      examples/js/postprocessing/EffectComposer.js
  45. 7 0
      examples/js/postprocessing/OutlinePass.js
  46. 4 0
      examples/js/postprocessing/SMAAPass.js
  47. 20 9
      examples/js/postprocessing/SSAARenderPass.js
  48. 4 4
      examples/js/postprocessing/SavePass.js
  49. 25 13
      examples/js/postprocessing/TAARenderPass.js
  50. 3 0
      examples/js/postprocessing/UnrealBloomPass.js
  51. 1 1
      examples/misc_animation_authoring.html
  52. 1 1
      examples/misc_controls_transform.html
  53. 1 1
      examples/misc_sound.html
  54. 二進制
      examples/models/gltf/CesiumMan/glTF-Binary/Cesium_Man.glb
  55. 二進制
      examples/models/gltf/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb
  56. 二進制
      examples/models/gltf/duck/glTF-Binary/duck.glb
  57. 二進制
      examples/models/gltf/monster/glTF-Binary/Monster.glb
  58. 2 2
      examples/models/gltf/snowflake/line_vert.glsl
  59. 3903 5120
      examples/models/vrml/house.wrl
  60. 3 3
      examples/webgl_geometry_extrude_shapes2.html
  61. 1 1
      examples/webgl_geometry_spline_editor.html
  62. 1 1
      examples/webgl_helpers.html
  63. 1 1
      examples/webgl_loader_amf.html
  64. 1 1
      examples/webgl_loader_bvh.html
  65. 6 38
      examples/webgl_loader_fbx.html
  66. 74 94
      examples/webgl_loader_gltf.html
  67. 1 1
      examples/webgl_loader_msgpack.html
  68. 1 0
      examples/webgl_postprocessing_ssao.html
  69. 3 1
      examples/webgl_shaders_ocean.html
  70. 1 1
      examples/webgl_shaders_sky.html
  71. 1 1
      examples/webvr_vive_paint.html
  72. 1 1
      examples/webvr_vive_sculpt.html
  73. 1 1
      package.json
  74. 2 2
      src/animation/PropertyBinding.js
  75. 1 0
      src/cameras/CubeCamera.js
  76. 1 1
      src/constants.js
  77. 12 3
      src/core/BufferGeometry.js
  78. 180 9
      src/core/Geometry.js
  79. 41 72
      src/geometries/BoxGeometry.js
  80. 42 23
      src/geometries/CircleGeometry.js
  81. 56 95
      src/geometries/CylinderGeometry.js
  82. 41 26
      src/geometries/EdgesGeometry.js
  83. 26 25
      src/geometries/LatheGeometry.js
  84. 14 15
      src/geometries/ParametricGeometry.js
  85. 30 33
      src/geometries/PlaneGeometry.js
  86. 0 3
      src/geometries/PolyhedronGeometry.js
  87. 25 30
      src/geometries/RingGeometry.js
  88. 7 3
      src/geometries/ShapeGeometry.js
  89. 49 35
      src/geometries/SphereGeometry.js
  90. 1 1
      src/geometries/TextGeometry.js
  91. 22 42
      src/geometries/TorusGeometry.js
  92. 21 29
      src/geometries/TorusKnotGeometry.js
  93. 2 2
      src/geometries/TubeGeometry.js
  94. 82 85
      src/geometries/WireframeGeometry.js
  95. 11 5
      src/helpers/ArrowHelper.js
  96. 6 4
      src/helpers/GridHelper.js
  97. 3 0
      src/loaders/ObjectLoader.js
  98. 70 60
      src/math/Box3.js
  99. 39 25
      src/renderers/WebGLRenderer.js
  100. 2 1
      src/renderers/webgl/WebGLIndexedBufferRenderer.js

文件差異過大導致無法顯示
+ 12 - 6
build/three.js


文件差異過大導致無法顯示
+ 137 - 332
build/three.min.js


文件差異過大導致無法顯示
+ 12 - 6
build/three.module.js


+ 2 - 2
docs/api/animation/AnimationUtils.html

@@ -18,12 +18,12 @@
 
 
     <h3>[method:Array arraySlice]( array, from, to )</h3>
     <h3>[method:Array arraySlice]( array, from, to )</h3>
     <div>
     <div>
-    Convert an array to a specific type.
+    This is the same as  Array.prototype.slice, but also works on typed arrays.
     </div>
     </div>
 
 
     <h3>[method:Array convertArray]( array, type, forceClone )</h3>
     <h3>[method:Array convertArray]( array, type, forceClone )</h3>
     <div>
     <div>
-    This is the same as  Array.prototype.slice, but also works on typed arrays.
+    Convert an array to a specific type.
     </div>
     </div>
 
 
     <h3>[method:Boolean isTypedArray]( object )</h3>
     <h3>[method:Boolean isTypedArray]( object )</h3>

+ 4 - 4
docs/api/extras/SceneUtils.html

@@ -16,14 +16,14 @@
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
 
 
-		<h3>[method:Object3D createMultiMaterialObject]( [page:Geometry geometry], [page:Array materials] )</h3>
+		<h3>[method:Group createMultiMaterialObject]( [page:Geometry geometry], [page:Array materials] )</h3>
 		<div>
 		<div>
-		geometry -- The geometry for the Object. <br />
+		geometry -- The geometry for the set of materials. <br />
 		materials -- The materials for the object.
 		materials -- The materials for the object.
 		</div>
 		</div>
 		<div>
 		<div>
-		Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as MultiMaterial which defines multiple material for 1 mesh.<br />
-		This is mostly useful for object that need a material and a wireframe implementation.
+		Creates a new Group that contains a new mesh for each material defined in materials. Beware that this is not the same as MultiMaterial which defines multiple material for 1 mesh.<br />
+		This is mostly useful for objects that need both a material and a wireframe implementation.
 		</div>
 		</div>
 
 
 		<h3>[method:null attach]( [page:Object3D child], [page:Object3D scene], [page:Object3D parent] )</h3>
 		<h3>[method:null attach]( [page:Object3D child], [page:Object3D scene], [page:Object3D parent] )</h3>

+ 138 - 137
docs/api/geometries/TextGeometry.html

@@ -1,138 +1,139 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
+<!DOCTYPE html>
+<html lang="en">
+	<head>
 		<meta charset="utf-8" />
 		<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:ExtrudeGeometry] &rarr;
-
-		<h1>[name]</h1>
-
-		<div class="desc">This object creates a 3D object of text as a single object.</div>
-
-		<iframe id="scene" src="scenes/geometry-browser.html#TextGeometry"></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>Example</h2>
-
-		<div>
-		[example:webgl_geometry_text geometry / text ]<br/>
-		[example:webgl_geometry_text2 geometry / text2 ]
-		</div>
-
-		<h2>Constructor</h2>
-
-		<h3>[name]([page:String text], [page:Object parameters])</h3>
-		<div>
-		text — The text that needs to be shown. <br />
-		parameters — Object that can contains the following parameters.
-		<ul>
-			<li>font — THREE.Font.</li>
-			<li>size — Float. Size of the text.</li>
-			<li>height — Float. Thickness to extrude text.  Default is 50.</li>
-			<li>curveSegments — Integer. Number of points on the curves. Default is 12.</li>
-			<li>bevelEnabled — Boolean. Turn on bevel. Default is False.</li>
-			<li>bevelThickness — Float. How deep into text bevel goes. Default is 10.</li>
-			<li>bevelSize — Float. How far from text outline is bevel. Default is 8.</li>
-		</ul>
-		</div>
-
-		<h2>Available Fonts</h2>
-
-		<div>
-		TextGeometry uses <a href='http://gero3.github.io/facetype.js/' target="_top">typeface.json</a> generated fonts.
-		Some existing fonts can be found located in <b>/examples/fonts</b> and must be included in the page.
-		</div>
-		<table>
-			<tr>
-				<th>Font</th>
-				<th>Weight</th>
-				<th>Style</th>
-				<th>File Path</th>
-			</tr>
-			<tr>
-				<td>helvetiker</td>
-				<td>normal</td>
-				<td>normal</td>
-				<td>/examples/fonts/helvetiker_regular.typeface.json</td>
-			</tr>
-			<tr>
-				<td>helvetiker</td>
-				<td>bold</td>
-				<td>normal</td>
-				<td>/examples/fonts/helvetiker_bold.typeface.json</td>
-			</tr>
-			<tr>
-				<td>optimer</td>
-				<td>normal</td>
-				<td>normal</td>
-				<td>/examples/fonts/optimer_regular.typeface.json</td>
-			</tr>
-			<tr>
-				<td>optimer</td>
-				<td>bold</td>
-				<td>normal</td>
-				<td>/examples/fonts/optimer_bold.typeface.json</td>
-			</tr>
-			<tr>
-				<td>gentilis</td>
-				<td>normal</td>
-				<td>normal</td>
-				<td>/examples/fonts/gentilis_regular.typeface.json</td>
-			</tr>
-			<tr>
-				<td>gentilis</td>
-				<td>bold</td>
-				<td>normal</td>
-				<td>/examples/fonts/gentilis_bold.typeface.json</td>
-			</tr>
-			<tr>
-				<td>droid sans</td>
-				<td>normal</td>
-				<td>normal</td>
-				<td>/examples/fonts/droid/droid_sans_regular.typeface.json</td>
-			</tr>
-			<tr>
-				<td>droid sans</td>
-				<td>bold</td>
-				<td>normal</td>
-				<td>/examples/fonts/droid/droid_sans_bold.typeface.json</td>
-			</tr>
-			<tr>
-				<td>droid serif</td>
-				<td>normal</td>
-				<td>normal</td>
-				<td>/examples/fonts/droid/droid_serif_regular.typeface.json</td>
-			</tr>
-			<tr>
-				<td>droid serif</td>
-				<td>bold</td>
-				<td>normal</td>
-				<td>/examples/fonts/droid/droid_serif_bold.typeface.json</td>
-			</tr>
-		</table>
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		[page:ExtrudeGeometry] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">This object creates a 3D object of text as a single object.</div>
+
+		<iframe id="scene" src="scenes/geometry-browser.html#TextGeometry"></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>Example</h2>
+
+		<div>
+		[example:webgl_geometry_text geometry / text ]<br/>
+		[example:webgl_geometry_text2 geometry / text2 ]
+		</div>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]([page:String text], [page:Object parameters])</h3>
+		<div>
+		text — The text that needs to be shown. <br />
+		parameters — Object that can contains the following parameters.
+		<ul>
+			<li>font — THREE.Font.</li>
+			<li>size — Float. Size of the text.</li>
+			<li>height — Float. Thickness to extrude text.  Default is 50.</li>
+			<li>curveSegments — Integer. Number of points on the curves. Default is 12.</li>
+			<li>bevelEnabled — Boolean. Turn on bevel. Default is False.</li>
+			<li>bevelThickness — Float. How deep into text bevel goes. Default is 10.</li>
+			<li>bevelSize — Float. How far from text outline is bevel. Default is 8.</li>
+			<li>bevelSegments — Integer. Number of bevel segments. Default is 3.</li>
+		</ul>
+		</div>
+
+		<h2>Available Fonts</h2>
+
+		<div>
+		TextGeometry uses <a href='http://gero3.github.io/facetype.js/' target="_top">typeface.json</a> generated fonts.
+		Some existing fonts can be found located in <b>/examples/fonts</b> and must be included in the page.
+		</div>
+		<table>
+			<tr>
+				<th>Font</th>
+				<th>Weight</th>
+				<th>Style</th>
+				<th>File Path</th>
+			</tr>
+			<tr>
+				<td>helvetiker</td>
+				<td>normal</td>
+				<td>normal</td>
+				<td>/examples/fonts/helvetiker_regular.typeface.json</td>
+			</tr>
+			<tr>
+				<td>helvetiker</td>
+				<td>bold</td>
+				<td>normal</td>
+				<td>/examples/fonts/helvetiker_bold.typeface.json</td>
+			</tr>
+			<tr>
+				<td>optimer</td>
+				<td>normal</td>
+				<td>normal</td>
+				<td>/examples/fonts/optimer_regular.typeface.json</td>
+			</tr>
+			<tr>
+				<td>optimer</td>
+				<td>bold</td>
+				<td>normal</td>
+				<td>/examples/fonts/optimer_bold.typeface.json</td>
+			</tr>
+			<tr>
+				<td>gentilis</td>
+				<td>normal</td>
+				<td>normal</td>
+				<td>/examples/fonts/gentilis_regular.typeface.json</td>
+			</tr>
+			<tr>
+				<td>gentilis</td>
+				<td>bold</td>
+				<td>normal</td>
+				<td>/examples/fonts/gentilis_bold.typeface.json</td>
+			</tr>
+			<tr>
+				<td>droid sans</td>
+				<td>normal</td>
+				<td>normal</td>
+				<td>/examples/fonts/droid/droid_sans_regular.typeface.json</td>
+			</tr>
+			<tr>
+				<td>droid sans</td>
+				<td>bold</td>
+				<td>normal</td>
+				<td>/examples/fonts/droid/droid_sans_bold.typeface.json</td>
+			</tr>
+			<tr>
+				<td>droid serif</td>
+				<td>normal</td>
+				<td>normal</td>
+				<td>/examples/fonts/droid/droid_serif_regular.typeface.json</td>
+			</tr>
+			<tr>
+				<td>droid serif</td>
+				<td>bold</td>
+				<td>normal</td>
+				<td>/examples/fonts/droid/droid_serif_bold.typeface.json</td>
+			</tr>
+		</table>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 1 - 1
docs/api/extras/helpers/ArrowHelper.html → docs/api/helpers/ArrowHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/AxisHelper.html → docs/api/helpers/AxisHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/BoxHelper.html → docs/api/helpers/BoxHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 2 - 3
docs/api/extras/helpers/CameraHelper.html → docs/api/helpers/CameraHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />
@@ -24,8 +24,7 @@
 
 
 		<code>
 		<code>
 var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
 var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 0.1, 1000 );
-
-var helper = new THREE.CameraHelper( cameraPerspective );
+var helper = new THREE.CameraHelper( camera );
 scene.add( helper );
 scene.add( helper );
 		</code>
 		</code>
 
 

+ 1 - 1
docs/api/extras/helpers/DirectionalLightHelper.html → docs/api/helpers/DirectionalLightHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/FaceNormalsHelper.html → docs/api/helpers/FaceNormalsHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/GridHelper.html → docs/api/helpers/GridHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/HemisphereLightHelper.html → docs/api/helpers/HemisphereLightHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/PointLightHelper.html → docs/api/helpers/PointLightHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/PolarGridHelper.html → docs/api/helpers/PolarGridHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/RectAreaLightHelper.html → docs/api/helpers/RectAreaLightHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/SkeletonHelper.html → docs/api/helpers/SkeletonHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/SpotLightHelper.html → docs/api/helpers/SpotLightHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

+ 1 - 1
docs/api/extras/helpers/VertexNormalsHelper.html → docs/api/helpers/VertexNormalsHelper.html

@@ -2,7 +2,7 @@
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
 		<meta charset="utf-8" />
 		<meta charset="utf-8" />
-		<base href="../../../" />
+		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="list.js"></script>
 		<script src="page.js"></script>
 		<script src="page.js"></script>
 		<link type="text/css" rel="stylesheet" href="page.css" />
 		<link type="text/css" rel="stylesheet" href="page.css" />

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

@@ -96,7 +96,7 @@ scene.add(rectLight)
 
 
 		<h3>[property:Boolean isRectAreaLight]</h3>
 		<h3>[property:Boolean isRectAreaLight]</h3>
 		<div>
 		<div>
-			Used to check whether this or derived classes are spot lights. Default is *true*.<br /><br />
+			Used to check whether this or derived classes are RectAreaLights. Default is *true*.<br /><br />
 
 
 			You should not change this, as it used internally for optimisation.
 			You should not change this, as it used internally for optimisation.
 		</div>
 		</div>

+ 2 - 2
docs/api/objects/Line.html

@@ -17,8 +17,8 @@
 
 
 			This is nearly the same
 			This is nearly the same
 			as [page:LineSegments]; the only difference is that it is rendered using
 			as [page:LineSegments]; the only difference is that it is rendered using
-			[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]
-			instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP]
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP]
+			instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]
 
 
 		</div>
 		</div>
 
 

+ 2 - 2
docs/api/objects/LineSegments.html

@@ -16,8 +16,8 @@
 			A series of lines drawn between pairs of vertices.<br /><br />
 			A series of lines drawn between pairs of vertices.<br /><br />
 
 
 			This is nearly the same	as [page:Line]; the only difference is that it is rendered using
 			This is nearly the same	as [page:Line]; the only difference is that it is rendered using
-			[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP]
-			instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]
+			[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINES]
+			instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/drawElements gl.LINE_STRIP].
 		</div>
 		</div>
 
 
 
 

+ 17 - 17
docs/list.js

@@ -126,23 +126,6 @@ var list = {
 			[ "SplineCurve", "api/extras/curves/SplineCurve" ]
 			[ "SplineCurve", "api/extras/curves/SplineCurve" ]
 		],
 		],
 
 
-		"Extras / Helpers": [
-			[ "ArrowHelper", "api/extras/helpers/ArrowHelper" ],
-			[ "AxisHelper", "api/extras/helpers/AxisHelper" ],
-			[ "BoxHelper", "api/extras/helpers/BoxHelper" ],
-			[ "CameraHelper", "api/extras/helpers/CameraHelper" ],
-			[ "DirectionalLightHelper", "api/extras/helpers/DirectionalLightHelper" ],
-			[ "FaceNormalsHelper", "api/extras/helpers/FaceNormalsHelper" ],
-			[ "GridHelper", "api/extras/helpers/GridHelper" ],
-			[ "PolarGridHelper", "api/extras/helpers/PolarGridHelper"],
-			[ "HemisphereLightHelper", "api/extras/helpers/HemisphereLightHelper" ],
-			[ "PointLightHelper", "api/extras/helpers/PointLightHelper" ],
-			[ "RectAreaLightHelper", "api/extras/helpers/RectAreaLightHelper" ],
-			[ "SkeletonHelper", "api/extras/helpers/SkeletonHelper" ],
-			[ "SpotLightHelper", "api/extras/helpers/SpotLightHelper" ],
-			[ "VertexNormalsHelper", "api/extras/helpers/VertexNormalsHelper" ]
-		],
-
 		"Extras / Objects": [
 		"Extras / Objects": [
 			[ "ImmediateRenderObject", "api/extras/objects/ImmediateRenderObject" ],
 			[ "ImmediateRenderObject", "api/extras/objects/ImmediateRenderObject" ],
 			[ "MorphBlendMesh", "api/extras/objects/MorphBlendMesh" ]
 			[ "MorphBlendMesh", "api/extras/objects/MorphBlendMesh" ]
@@ -191,6 +174,23 @@ var list = {
 			[ "WireframeGeometry", "api/geometries/WireframeGeometry" ]
 			[ "WireframeGeometry", "api/geometries/WireframeGeometry" ]
 		],
 		],
 
 
+		"Helpers": [
+			[ "ArrowHelper", "api/helpers/ArrowHelper" ],
+			[ "AxisHelper", "api/helpers/AxisHelper" ],
+			[ "BoxHelper", "api/helpers/BoxHelper" ],
+			[ "CameraHelper", "api/helpers/CameraHelper" ],
+			[ "DirectionalLightHelper", "api/helpers/DirectionalLightHelper" ],
+			[ "FaceNormalsHelper", "api/helpers/FaceNormalsHelper" ],
+			[ "GridHelper", "api/helpers/GridHelper" ],
+			[ "PolarGridHelper", "api/helpers/PolarGridHelper" ],
+			[ "HemisphereLightHelper", "api/helpers/HemisphereLightHelper" ],
+			[ "PointLightHelper", "api/helpers/PointLightHelper" ],
+			[ "RectAreaLightHelper", "api/helpers/RectAreaLightHelper" ],
+			[ "SkeletonHelper", "api/helpers/SkeletonHelper" ],
+			[ "SpotLightHelper", "api/helpers/SpotLightHelper" ],
+			[ "VertexNormalsHelper", "api/helpers/VertexNormalsHelper" ]
+		],
+
 		"Lights": [
 		"Lights": [
 			[ "AmbientLight", "api/lights/AmbientLight" ],
 			[ "AmbientLight", "api/lights/AmbientLight" ],
 			[ "DirectionalLight", "api/lights/DirectionalLight" ],
 			[ "DirectionalLight", "api/lights/DirectionalLight" ],

+ 3 - 2
docs/manual/introduction/Creating-text.html

@@ -62,8 +62,9 @@
 		<div>
 		<div>
 			<p>
 			<p>
 				Use this method if you prefer to work purely in three.js or create procedural and dynamic 3d
 				Use this method if you prefer to work purely in three.js or create procedural and dynamic 3d
-				text geometries. However, font data files <a href="http://typeface.neocracy.org/fonts.html">http://typeface.neocracy.org/fonts.html</a>
-				in the typeface.js format needs to be loaded.
+				text geometries. However, font data files in THREE.js JSON format needs to be loaded
+				before this will work.
+				See the [page:TextGeometry] page for examples of JSON fonts.
 			</p>
 			</p>
 			<p>A Text Geometry can then be created with </p>
 			<p>A Text Geometry can then be created with </p>
 			<code>new THREE.TextGeometry( text, parameters );</code>
 			<code>new THREE.TextGeometry( text, parameters );</code>

+ 5 - 2
docs/scenes/js/geometry.js

@@ -924,7 +924,8 @@ var guis = {
 			weight : "regular",
 			weight : "regular",
 			bevelEnabled : false,
 			bevelEnabled : false,
 			bevelThickness : 1,
 			bevelThickness : 1,
-			bevelSize : 0.5
+			bevelSize : 0.5,
+			bevelSegments : 3
 		};
 		};
 
 
 		var fonts = [
 		var fonts = [
@@ -950,7 +951,8 @@ var guis = {
 					curveSegments: data.curveSegments,
 					curveSegments: data.curveSegments,
 					bevelEnabled: data.bevelEnabled,
 					bevelEnabled: data.bevelEnabled,
 					bevelThickness: data.bevelThickness,
 					bevelThickness: data.bevelThickness,
-					bevelSize: data.bevelSize
+					bevelSize: data.bevelSize,
+					bevelSegments: data.bevelSegments
 				} );
 				} );
 				geometry.center();
 				geometry.center();
 
 
@@ -974,6 +976,7 @@ var guis = {
 		folder.add( data, 'bevelEnabled' ).onChange( generateGeometry );
 		folder.add( data, 'bevelEnabled' ).onChange( generateGeometry );
 		folder.add( data, 'bevelThickness', 0.1, 3 ).onChange( generateGeometry );
 		folder.add( data, 'bevelThickness', 0.1, 3 ).onChange( generateGeometry );
 		folder.add( data, 'bevelSize', 0.1, 3 ).onChange( generateGeometry );
 		folder.add( data, 'bevelSize', 0.1, 3 ).onChange( generateGeometry );
+		folder.add( data, 'bevelSegments', 0, 8 ).step( 1 ).onChange( generateGeometry );
 
 
 		generateGeometry();
 		generateGeometry();
 
 

+ 3 - 3
editor/js/Loader.js

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

+ 3 - 3
editor/js/Viewport.js

@@ -36,7 +36,7 @@ var Viewport = function ( editor ) {
 
 
 	// helpers
 	// helpers
 
 
-	var grid = new THREE.GridHelper( 30, 60 );
+	var grid = new THREE.GridHelper( 60, 60 );
 	sceneHelpers.add( grid );
 	sceneHelpers.add( grid );
 
 
 	//
 	//
@@ -295,12 +295,12 @@ var Viewport = function ( editor ) {
 
 
 			case 'css/light.css':
 			case 'css/light.css':
 				sceneHelpers.remove( grid );
 				sceneHelpers.remove( grid );
-				grid = new THREE.GridHelper( 30, 60, 0x444444, 0x888888 );
+				grid = new THREE.GridHelper( 60, 60, 0x444444, 0x888888 );
 				sceneHelpers.add( grid );
 				sceneHelpers.add( grid );
 				break;
 				break;
 			case 'css/dark.css':
 			case 'css/dark.css':
 				sceneHelpers.remove( grid );
 				sceneHelpers.remove( grid );
-				grid = new THREE.GridHelper( 30, 60, 0xbbbbbb, 0x888888 );
+				grid = new THREE.GridHelper( 60, 60, 0xbbbbbb, 0x888888 );
 				sceneHelpers.add( grid );
 				sceneHelpers.add( grid );
 				break;
 				break;
 
 

+ 22 - 0
editor/js/libs/app/index.html

@@ -13,6 +13,19 @@
 				margin: 0px;
 				margin: 0px;
 				overflow: hidden;
 				overflow: hidden;
 			}
 			}
+			#edit {
+				position: absolute;
+				bottom: 20px;
+				right: 20px;
+				padding: 8px;
+				text-decoration: none;
+				background-color: #fff;
+				color: #555;
+				opacity: 0.5;
+			}
+			#edit:hover {
+				opacity: 1;
+			}
 		</style>
 		</style>
 	</head>
 	</head>
 	<body ontouchstart="">
 	<body ontouchstart="">
@@ -35,6 +48,15 @@
 					player.setSize( window.innerWidth, window.innerHeight );
 					player.setSize( window.innerWidth, window.innerHeight );
 				} );
 				} );
 
 
+				if ( location.search === '?edit' ) {
+					var button = document.createElement( 'a' );
+					button.id = 'edit';
+					button.href = 'https://threejs.org/editor/#file=' + location.href.split( '/' ).slice( 0, - 1 ).join( '/' ) + '/app.json';
+					button.target = '_blank';
+					button.textContent = 'EDIT';
+					document.body.appendChild( button );
+				}
+
 			} );
 			} );
 
 
 		</script>
 		</script>

+ 47 - 55
examples/js/Mirror.js

@@ -2,56 +2,6 @@
  * @author Slayvin / http://slayvin.net
  * @author Slayvin / http://slayvin.net
  */
  */
 
 
-THREE.ShaderLib[ 'mirror' ] = {
-
-	uniforms: {
-		"mirrorColor": { value: new THREE.Color( 0x7F7F7F ) },
-		"mirrorSampler": { value: null },
-		"textureMatrix" : { value: new THREE.Matrix4() }
-	},
-
-	vertexShader: [
-
-		"uniform mat4 textureMatrix;",
-
-		"varying vec4 mirrorCoord;",
-
-		"void main() {",
-
-			"vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );",
-			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-			"mirrorCoord = textureMatrix * worldPosition;",
-
-			"gl_Position = projectionMatrix * mvPosition;",
-
-		"}"
-
-	].join( "\n" ),
-
-	fragmentShader: [
-
-		"uniform vec3 mirrorColor;",
-		"uniform sampler2D mirrorSampler;",
-
-		"varying vec4 mirrorCoord;",
-
-		"float blendOverlay(float base, float blend) {",
-			"return( base < 0.5 ? ( 2.0 * base * blend ) : (1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );",
-		"}",
-
-		"void main() {",
-
-			"vec4 color = texture2DProj(mirrorSampler, mirrorCoord);",
-			"color = vec4(blendOverlay(mirrorColor.r, color.r), blendOverlay(mirrorColor.g, color.g), blendOverlay(mirrorColor.b, color.b), 1.0);",
-
-			"gl_FragColor = color;",
-
-		"}"
-
-	].join( "\n" )
-
-};
-
 THREE.Mirror = function ( renderer, camera, options ) {
 THREE.Mirror = function ( renderer, camera, options ) {
 
 
 	THREE.Object3D.call( this );
 	THREE.Object3D.call( this );
@@ -118,7 +68,47 @@ THREE.Mirror = function ( renderer, camera, options ) {
 	this.renderTarget = new THREE.WebGLRenderTarget( width, height, parameters );
 	this.renderTarget = new THREE.WebGLRenderTarget( width, height, parameters );
 	this.renderTarget2 = new THREE.WebGLRenderTarget( width, height, parameters );
 	this.renderTarget2 = new THREE.WebGLRenderTarget( width, height, parameters );
 
 
-	var mirrorShader = THREE.ShaderLib[ "mirror" ];
+	var mirrorShader = {
+
+		uniforms: {
+			mirrorColor: { value: new THREE.Color( 0x7F7F7F ) },
+			mirrorSampler: { value: null },
+			textureMatrix: { value: new THREE.Matrix4() }
+		},
+
+		vertexShader: [
+			'uniform mat4 textureMatrix;',
+			'varying vec4 mirrorCoord;',
+
+			'void main() {',
+
+			'	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );',
+			'	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',
+			'	mirrorCoord = textureMatrix * worldPosition;',
+
+			'	gl_Position = projectionMatrix * mvPosition;',
+
+			'}'
+		].join( '\n' ),
+
+		fragmentShader: [
+			'uniform vec3 mirrorColor;',
+			'uniform sampler2D mirrorSampler;',
+			'varying vec4 mirrorCoord;',
+
+			'float blendOverlay(float base, float blend) {',
+			'	return( base < 0.5 ? ( 2.0 * base * blend ) : (1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );',
+			'}',
+
+			'void main() {',
+			'	vec4 color = texture2DProj(mirrorSampler, mirrorCoord);',
+			'	color = vec4(blendOverlay(mirrorColor.r, color.r), blendOverlay(mirrorColor.g, color.g), blendOverlay(mirrorColor.b, color.b), 1.0);',
+			'	gl_FragColor = color;',
+			'}'
+		].join( '\n' )
+
+	};
+
 	var mirrorUniforms = THREE.UniformsUtils.clone( mirrorShader.uniforms );
 	var mirrorUniforms = THREE.UniformsUtils.clone( mirrorShader.uniforms );
 
 
 	this.material = new THREE.ShaderMaterial( {
 	this.material = new THREE.ShaderMaterial( {
@@ -215,10 +205,12 @@ THREE.Mirror.prototype.updateTextureMatrix = function () {
 	this.mirrorCamera.matrixWorldInverse.getInverse( this.mirrorCamera.matrixWorld );
 	this.mirrorCamera.matrixWorldInverse.getInverse( this.mirrorCamera.matrixWorld );
 
 
 	// Update the texture matrix
 	// Update the texture matrix
-	this.textureMatrix.set( 0.5, 0.0, 0.0, 0.5,
-							0.0, 0.5, 0.0, 0.5,
-							0.0, 0.0, 0.5, 0.5,
-							0.0, 0.0, 0.0, 1.0 );
+	this.textureMatrix.set(
+		0.5, 0.0, 0.0, 0.5,
+		0.0, 0.5, 0.0, 0.5,
+		0.0, 0.0, 0.5, 0.5,
+		0.0, 0.0, 0.0, 1.0
+	);
 	this.textureMatrix.multiply( this.mirrorCamera.projectionMatrix );
 	this.textureMatrix.multiply( this.mirrorCamera.projectionMatrix );
 	this.textureMatrix.multiply( this.mirrorCamera.matrixWorldInverse );
 	this.textureMatrix.multiply( this.mirrorCamera.matrixWorldInverse );
 
 

+ 134 - 148
examples/js/SkyShader.js

@@ -14,211 +14,197 @@
  * Three.js integration by zz85 http://twitter.com/blurspline
  * Three.js integration by zz85 http://twitter.com/blurspline
 */
 */
 
 
-THREE.ShaderLib[ 'sky' ] = {
-
-	uniforms: {
+THREE.Sky = function () {
 
 
-		luminance: { value: 1 },
-		turbidity: { value: 2 },
-		rayleigh: { value: 1 },
-		mieCoefficient: { value: 0.005 },
-		mieDirectionalG: { value: 0.8 },
-		sunPosition: { value: new THREE.Vector3() }
+	var skyShader = {
 
 
-	},
+		uniforms: {
+			luminance: { value: 1 },
+			turbidity: { value: 2 },
+			rayleigh: { value: 1 },
+			mieCoefficient: { value: 0.005 },
+			mieDirectionalG: { value: 0.8 },
+			sunPosition: { value: new THREE.Vector3() }
+		},
 
 
-	vertexShader: [
+		vertexShader: [
+			'uniform vec3 sunPosition;',
+			'uniform float rayleigh;',
+			'uniform float turbidity;',
+			'uniform float mieCoefficient;',
 
 
-		"uniform vec3 sunPosition;",
-		"uniform float rayleigh;",
-		"uniform float turbidity;",
-		"uniform float mieCoefficient;",
+			'varying vec3 vWorldPosition;',
+			'varying vec3 vSunDirection;',
+			'varying float vSunfade;',
+			'varying vec3 vBetaR;',
+			'varying vec3 vBetaM;',
+			'varying float vSunE;',
 
 
-		"varying vec3 vWorldPosition;",
-		"varying vec3 vSunDirection;",
-		"varying float vSunfade;",
-		"varying vec3 vBetaR;",
-		"varying vec3 vBetaM;",
-		"varying float vSunE;",
+			'const vec3 up = vec3( 0.0, 1.0, 0.0 );',
 
 
-		"const vec3 up = vec3( 0.0, 1.0, 0.0 );",
+			// constants for atmospheric scattering
+			'const float e = 2.71828182845904523536028747135266249775724709369995957;',
+			'const float pi = 3.141592653589793238462643383279502884197169;',
 
 
-		// constants for atmospheric scattering
-		"const float e = 2.71828182845904523536028747135266249775724709369995957;",
-		"const float pi = 3.141592653589793238462643383279502884197169;",
+			// wavelength of used primaries, according to preetham
+			'const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );',
+			// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
+			// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
+			'const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );',
 
 
-		// wavelength of used primaries, according to preetham
-		"const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );",
-		// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
-		// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
-		"const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );",
-		
-		// mie stuff
-		// K coefficient for the primaries
-		"const float v = 4.0;",
-		"const vec3 K = vec3( 0.686, 0.678, 0.666 );",
-		// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
-		"const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );",
+			// mie stuff
+			// K coefficient for the primaries
+			'const float v = 4.0;',
+			'const vec3 K = vec3( 0.686, 0.678, 0.666 );',
+			// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
+			'const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );',
 
 
-		// earth shadow hack
-		// cutoffAngle = pi / 1.95;
-		"const float cutoffAngle = 1.6110731556870734;",
-		"const float steepness = 1.5;",
-		"const float EE = 1000.0;",
+			// earth shadow hack
+			// cutoffAngle = pi / 1.95;
+			'const float cutoffAngle = 1.6110731556870734;',
+			'const float steepness = 1.5;',
+			'const float EE = 1000.0;',
 
 
-		"float sunIntensity( float zenithAngleCos )",
-		"{",
-			"zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );",
-			"return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );",
-		"}",
+			'float sunIntensity( float zenithAngleCos ) {',
+			'	zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );',
+			'	return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );',
+			'}',
 
 
-		"vec3 totalMie( float T )",
-		"{",
-			"float c = ( 0.2 * T ) * 10E-18;",
-			"return 0.434 * c * MieConst;",
-		"}",
+			'vec3 totalMie( float T ) {',
+			'	float c = ( 0.2 * T ) * 10E-18;',
+			'	return 0.434 * c * MieConst;',
+			'}',
 
 
-		"void main() {",
+			'void main() {',
 
 
-			"vec4 worldPosition = modelMatrix * vec4( position, 1.0 );",
-			"vWorldPosition = worldPosition.xyz;",
+			'	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );',
+			'	vWorldPosition = worldPosition.xyz;',
 
 
-			"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",
+			'	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
 
 
-			"vSunDirection = normalize( sunPosition );",
+			'	vSunDirection = normalize( sunPosition );',
 
 
-			"vSunE = sunIntensity( dot( vSunDirection, up ) );",
+			'	vSunE = sunIntensity( dot( vSunDirection, up ) );',
 
 
-			"vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );",
+			'	vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );',
 
 
-			"float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );",
+			'	float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );',
 
 
 			// extinction (absorbtion + out scattering)
 			// extinction (absorbtion + out scattering)
 			// rayleigh coefficients
 			// rayleigh coefficients
-			"vBetaR = totalRayleigh * rayleighCoefficient;",
+			'	vBetaR = totalRayleigh * rayleighCoefficient;',
 
 
 			// mie coefficients
 			// mie coefficients
-			"vBetaM = totalMie( turbidity ) * mieCoefficient;",
-
-		"}"
-
-	].join( "\n" ),
+			'	vBetaM = totalMie( turbidity ) * mieCoefficient;',
 
 
-	fragmentShader: [
+			'}'
+		].join( '\n' ),
 
 
-		"varying vec3 vWorldPosition;",
-		"varying vec3 vSunDirection;",
-		"varying float vSunfade;",
-		"varying vec3 vBetaR;",
-		"varying vec3 vBetaM;",
-		"varying float vSunE;",
+		fragmentShader: [
+			'varying vec3 vWorldPosition;',
+			'varying vec3 vSunDirection;',
+			'varying float vSunfade;',
+			'varying vec3 vBetaR;',
+			'varying vec3 vBetaM;',
+			'varying float vSunE;',
 
 
-		"uniform float luminance;",
-		"uniform float mieDirectionalG;",
+			'uniform float luminance;',
+			'uniform float mieDirectionalG;',
 
 
-		"const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );",
+			'const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );',
 
 
-		// constants for atmospheric scattering
-		"const float pi = 3.141592653589793238462643383279502884197169;",
+			// constants for atmospheric scattering
+			'const float pi = 3.141592653589793238462643383279502884197169;',
 
 
-		"const float n = 1.0003;", // refractive index of air
-		"const float N = 2.545E25;", // number of molecules per unit volume for air at
-									// 288.15K and 1013mb (sea level -45 celsius)
+			'const float n = 1.0003;', // refractive index of air
+			'const float N = 2.545E25;', // number of molecules per unit volume for air at
+										// 288.15K and 1013mb (sea level -45 celsius)
 
 
-		// optical length at zenith for molecules
-		"const float rayleighZenithLength = 8.4E3;",
-		"const float mieZenithLength = 1.25E3;",
-		"const vec3 up = vec3( 0.0, 1.0, 0.0 );",
-		// 66 arc seconds -> degrees, and the cosine of that
-		"const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;",
+			// optical length at zenith for molecules
+			'const float rayleighZenithLength = 8.4E3;',
+			'const float mieZenithLength = 1.25E3;',
+			'const vec3 up = vec3( 0.0, 1.0, 0.0 );',
+			// 66 arc seconds -> degrees, and the cosine of that
+			'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;',
 
 
-		// 3.0 / ( 16.0 * pi )
-		"const float THREE_OVER_SIXTEENPI = 0.05968310365946075;",
-		// 1.0 / ( 4.0 * pi )
-		"const float ONE_OVER_FOURPI = 0.07957747154594767;",
+			// 3.0 / ( 16.0 * pi )
+			'const float THREE_OVER_SIXTEENPI = 0.05968310365946075;',
+			// 1.0 / ( 4.0 * pi )
+			'const float ONE_OVER_FOURPI = 0.07957747154594767;',
 
 
-		"float rayleighPhase( float cosTheta )",
-		"{",
-			"return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );",
-		"}",
+			'float rayleighPhase( float cosTheta ) {',
+			'	return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );',
+			'}',
 
 
-		"float hgPhase( float cosTheta, float g )",
-		"{",
-			"float g2 = pow( g, 2.0 );",
-			"float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );",
-			"return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );",
-		"}",
+			'float hgPhase( float cosTheta, float g ) {',
+			'	float g2 = pow( g, 2.0 );',
+			'	float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );',
+			'	return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );',
+			'}',
 
 
-		// Filmic ToneMapping http://filmicgames.com/archives/75
-		"const float A = 0.15;",
-		"const float B = 0.50;",
-		"const float C = 0.10;",
-		"const float D = 0.20;",
-		"const float E = 0.02;",
-		"const float F = 0.30;",
+			// Filmic ToneMapping http://filmicgames.com/archives/75
+			'const float A = 0.15;',
+			'const float B = 0.50;',
+			'const float C = 0.10;',
+			'const float D = 0.20;',
+			'const float E = 0.02;',
+			'const float F = 0.30;',
 
 
-		"const float whiteScale = 1.0748724675633854;", // 1.0 / Uncharted2Tonemap(1000.0)
+			'const float whiteScale = 1.0748724675633854;', // 1.0 / Uncharted2Tonemap(1000.0)
 
 
-		"vec3 Uncharted2Tonemap( vec3 x )",
-		"{",
-			"return ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;",
-		"}",
+			'vec3 Uncharted2Tonemap( vec3 x ) {',
+			'	return ( ( x * ( A * x + C * B ) + D * E ) / ( x * ( A * x + B ) + D * F ) ) - E / F;',
+			'}',
 
 
 
 
-		"void main() ",
-		"{",
+			'void main() {',
 			// optical length
 			// optical length
 			// cutoff angle at 90 to avoid singularity in next formula.
 			// cutoff angle at 90 to avoid singularity in next formula.
-			"float zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );",
-			"float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );",
-			"float sR = rayleighZenithLength * inverse;",
-			"float sM = mieZenithLength * inverse;",
+			'	float zenithAngle = acos( max( 0.0, dot( up, normalize( vWorldPosition - cameraPos ) ) ) );',
+			'	float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );',
+			'	float sR = rayleighZenithLength * inverse;',
+			'	float sM = mieZenithLength * inverse;',
 
 
 			// combined extinction factor
 			// combined extinction factor
-			"vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );",
+			'	vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );',
 
 
 			// in scattering
 			// in scattering
-			"float cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );",
+			'	float cosTheta = dot( normalize( vWorldPosition - cameraPos ), vSunDirection );',
 
 
-			"float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );",
-			"vec3 betaRTheta = vBetaR * rPhase;",
+			'	float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );',
+			'	vec3 betaRTheta = vBetaR * rPhase;',
 
 
-			"float mPhase = hgPhase( cosTheta, mieDirectionalG );",
-			"vec3 betaMTheta = vBetaM * mPhase;",
+			'	float mPhase = hgPhase( cosTheta, mieDirectionalG );',
+			'	vec3 betaMTheta = vBetaM * mPhase;',
 
 
-			"vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );",
-			"Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );",
+			'	vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );',
+			'	Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );',
 
 
-			//nightsky
-			"vec3 direction = normalize( vWorldPosition - cameraPos );",
-			"float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]",
-			"float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]",
-			"vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );",
-			"vec3 L0 = vec3( 0.1 ) * Fex;",
+			// nightsky
+			'	vec3 direction = normalize( vWorldPosition - cameraPos );',
+			'	float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]',
+			'	float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]',
+			'	vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );',
+			'	vec3 L0 = vec3( 0.1 ) * Fex;',
 
 
 			// composition + solar disc
 			// composition + solar disc
-			"float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );",
-			"L0 += ( vSunE * 19000.0 * Fex ) * sundisk;",
+			'	float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );',
+			'	L0 += ( vSunE * 19000.0 * Fex ) * sundisk;',
 
 
-			"vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );",
+			'	vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );',
 
 
-			"vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );",
-			"vec3 color = curr * whiteScale;",
+			'	vec3 curr = Uncharted2Tonemap( ( log2( 2.0 / pow( luminance, 4.0 ) ) ) * texColor );',
+			'	vec3 color = curr * whiteScale;',
 
 
-			"vec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );",
+			'	vec3 retColor = pow( color, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );',
 
 
-			"gl_FragColor.rgb = retColor;",
+			'	gl_FragColor = vec4( retColor, 1.0 );',
 
 
-			"gl_FragColor.a = 1.0;",
-		"}"
+			'}'
+		].join( '\n' )
 
 
-	].join( "\n" )
-
-};
-
-THREE.Sky = function () {
+	};
 
 
-	var skyShader = THREE.ShaderLib[ "sky" ];
 	var skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );
 	var skyUniforms = THREE.UniformsUtils.clone( skyShader.uniforms );
 
 
 	var skyMat = new THREE.ShaderMaterial( {
 	var skyMat = new THREE.ShaderMaterial( {

+ 118 - 123
examples/js/WaterShader.js

@@ -7,121 +7,12 @@
  * @author Jonas Wagner / http://29a.ch/ && http://29a.ch/slides/2012/webglwater/ : Water shader explanations in WebGL
  * @author Jonas Wagner / http://29a.ch/ && http://29a.ch/slides/2012/webglwater/ : Water shader explanations in WebGL
  */
  */
 
 
-THREE.ShaderLib[ 'water' ] = {
-
-	uniforms: THREE.UniformsUtils.merge( [
-		THREE.UniformsLib[ "fog" ], {
-			"normalSampler":    { value: null },
-			"mirrorSampler":    { value: null },
-			"alpha":            { value: 1.0 },
-			"time":             { value: 0.0 },
-			"distortionScale":  { value: 20.0 },
-			"noiseScale":       { value: 1.0 },
-			"textureMatrix" :   { value: new THREE.Matrix4() },
-			"sunColor":         { value: new THREE.Color( 0x7F7F7F ) },
-			"sunDirection":     { value: new THREE.Vector3( 0.70707, 0.70707, 0 ) },
-			"eye":              { value: new THREE.Vector3() },
-			"waterColor":       { value: new THREE.Color( 0x555555 ) }
-		}
-	] ),
-
-	vertexShader: [
-		'uniform mat4 textureMatrix;',
-		'uniform float time;',
-
-		'varying vec4 mirrorCoord;',
-		'varying vec3 worldPosition;',
-
-		THREE.ShaderChunk[ "fog_pars_vertex"],
-
-		'void main()',
-		'{',
-		'	mirrorCoord = modelMatrix * vec4( position, 1.0 );',
-		'	worldPosition = mirrorCoord.xyz;',
-		'	mirrorCoord = textureMatrix * mirrorCoord;',
-		'	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
-
-		THREE.ShaderChunk[ "fog_vertex"],
-
-		'}'
-	].join( '\n' ),
-
-	fragmentShader: [
-		'precision highp float;',
-
-		'uniform sampler2D mirrorSampler;',
-		'uniform float alpha;',
-		'uniform float time;',
-		'uniform float distortionScale;',
-		'uniform sampler2D normalSampler;',
-		'uniform vec3 sunColor;',
-		'uniform vec3 sunDirection;',
-		'uniform vec3 eye;',
-		'uniform vec3 waterColor;',
-
-		'varying vec4 mirrorCoord;',
-		'varying vec3 worldPosition;',
-
-		'vec4 getNoise( vec2 uv )',
-		'{',
-		'	vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);',
-		'	vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );',
-		'	vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );',
-		'	vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );',
-		'	vec4 noise = texture2D( normalSampler, uv0 ) +',
-		'		texture2D( normalSampler, uv1 ) +',
-		'		texture2D( normalSampler, uv2 ) +',
-		'		texture2D( normalSampler, uv3 );',
-		'	return noise * 0.5 - 1.0;',
-		'}',
-
-		'void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor )',
-		'{',
-		'	vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );',
-		'	float direction = max( 0.0, dot( eyeDirection, reflection ) );',
-		'	specularColor += pow( direction, shiny ) * sunColor * spec;',
-		'	diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;',
-		'}',
-
-		THREE.ShaderChunk[ "common" ],
-		THREE.ShaderChunk[ "fog_pars_fragment" ],
-
-		'void main()',
-		'{',
-		'	vec4 noise = getNoise( worldPosition.xz );',
-		'	vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );',
-
-		'	vec3 diffuseLight = vec3(0.0);',
-		'	vec3 specularLight = vec3(0.0);',
-
-		'	vec3 worldToEye = eye-worldPosition;',
-		'	vec3 eyeDirection = normalize( worldToEye );',
-		'	sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );',
-
-		'	float distance = length(worldToEye);',
-
-		'	vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;',
-		'	vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.z + distortion ) );',
-
-		'	float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );',
-		'	float rf0 = 0.3;',
-		'	float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );',
-		'	vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;',
-		'	vec3 albedo = mix( sunColor * diffuseLight * 0.3 + scatter, ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance );',
-		'	vec3 outgoingLight = albedo;',
-			THREE.ShaderChunk[ "fog_fragment" ],
-		'	gl_FragColor = vec4( outgoingLight, alpha );',
-		'}'
-	].join( '\n' )
-
-};
-
 THREE.Water = function ( renderer, camera, scene, options ) {
 THREE.Water = function ( renderer, camera, scene, options ) {
 
 
 	THREE.Object3D.call( this );
 	THREE.Object3D.call( this );
 	this.name = 'water_' + this.id;
 	this.name = 'water_' + this.id;
 
 
-	function optionalParameter ( value, defaultValue ) {
+	function optionalParameter( value, defaultValue ) {
 
 
 		return value !== undefined ? value : defaultValue;
 		return value !== undefined ? value : defaultValue;
 
 
@@ -173,7 +64,115 @@ THREE.Water = function ( renderer, camera, scene, options ) {
 	this.renderTarget = new THREE.WebGLRenderTarget( width, height );
 	this.renderTarget = new THREE.WebGLRenderTarget( width, height );
 	this.renderTarget2 = new THREE.WebGLRenderTarget( width, height );
 	this.renderTarget2 = new THREE.WebGLRenderTarget( width, height );
 
 
-	var mirrorShader = THREE.ShaderLib[ "water" ];
+	var mirrorShader = {
+
+		uniforms: THREE.UniformsUtils.merge( [
+			THREE.UniformsLib[ 'fog' ],
+			{
+				normalSampler: { value: null },
+				mirrorSampler: { value: null },
+				alpha: { value: 1.0 },
+				time: { value: 0.0 },
+				distortionScale: { value: 20.0 },
+				noiseScale: { value: 1.0 },
+				textureMatrix: { value: new THREE.Matrix4() },
+				sunColor: { value: new THREE.Color( 0x7F7F7F ) },
+				sunDirection: { value: new THREE.Vector3( 0.70707, 0.70707, 0 ) },
+				eye: { value: new THREE.Vector3() },
+				waterColor: { value: new THREE.Color( 0x555555 ) }
+			}
+		] ),
+
+		vertexShader: [
+			'uniform mat4 textureMatrix;',
+			'uniform float time;',
+
+			'varying vec4 mirrorCoord;',
+			'varying vec3 worldPosition;',
+
+			THREE.ShaderChunk[ 'fog_pars_vertex' ],
+
+			'void main() {',
+			'	mirrorCoord = modelMatrix * vec4( position, 1.0 );',
+			'	worldPosition = mirrorCoord.xyz;',
+			'	mirrorCoord = textureMatrix * mirrorCoord;',
+			'	vec4 mvPosition =  modelViewMatrix * vec4( position, 1.0 );',
+			'	gl_Position = projectionMatrix * mvPosition;',
+
+			THREE.ShaderChunk[ 'fog_vertex' ],
+
+			'}'
+		].join( '\n' ),
+
+		fragmentShader: [
+			'precision highp float;',
+
+			'uniform sampler2D mirrorSampler;',
+			'uniform float alpha;',
+			'uniform float time;',
+			'uniform float distortionScale;',
+			'uniform sampler2D normalSampler;',
+			'uniform vec3 sunColor;',
+			'uniform vec3 sunDirection;',
+			'uniform vec3 eye;',
+			'uniform vec3 waterColor;',
+
+			'varying vec4 mirrorCoord;',
+			'varying vec3 worldPosition;',
+
+			'vec4 getNoise( vec2 uv ) {',
+			'	vec2 uv0 = ( uv / 103.0 ) + vec2(time / 17.0, time / 29.0);',
+			'	vec2 uv1 = uv / 107.0-vec2( time / -19.0, time / 31.0 );',
+			'	vec2 uv2 = uv / vec2( 8907.0, 9803.0 ) + vec2( time / 101.0, time / 97.0 );',
+			'	vec2 uv3 = uv / vec2( 1091.0, 1027.0 ) - vec2( time / 109.0, time / -113.0 );',
+			'	vec4 noise = texture2D( normalSampler, uv0 ) +',
+			'		texture2D( normalSampler, uv1 ) +',
+			'		texture2D( normalSampler, uv2 ) +',
+			'		texture2D( normalSampler, uv3 );',
+			'	return noise * 0.5 - 1.0;',
+			'}',
+
+			'void sunLight( const vec3 surfaceNormal, const vec3 eyeDirection, float shiny, float spec, float diffuse, inout vec3 diffuseColor, inout vec3 specularColor ) {',
+			'	vec3 reflection = normalize( reflect( -sunDirection, surfaceNormal ) );',
+			'	float direction = max( 0.0, dot( eyeDirection, reflection ) );',
+			'	specularColor += pow( direction, shiny ) * sunColor * spec;',
+			'	diffuseColor += max( dot( sunDirection, surfaceNormal ), 0.0 ) * sunColor * diffuse;',
+			'}',
+
+			THREE.ShaderChunk[ 'common' ],
+			THREE.ShaderChunk[ 'fog_pars_fragment' ],
+
+			'void main() {',
+			'	vec4 noise = getNoise( worldPosition.xz );',
+			'	vec3 surfaceNormal = normalize( noise.xzy * vec3( 1.5, 1.0, 1.5 ) );',
+
+			'	vec3 diffuseLight = vec3(0.0);',
+			'	vec3 specularLight = vec3(0.0);',
+
+			'	vec3 worldToEye = eye-worldPosition;',
+			'	vec3 eyeDirection = normalize( worldToEye );',
+			'	sunLight( surfaceNormal, eyeDirection, 100.0, 2.0, 0.5, diffuseLight, specularLight );',
+
+			'	float distance = length(worldToEye);',
+
+			'	vec2 distortion = surfaceNormal.xz * ( 0.001 + 1.0 / distance ) * distortionScale;',
+			'	vec3 reflectionSample = vec3( texture2D( mirrorSampler, mirrorCoord.xy / mirrorCoord.z + distortion ) );',
+
+			'	float theta = max( dot( eyeDirection, surfaceNormal ), 0.0 );',
+			'	float rf0 = 0.3;',
+			'	float reflectance = rf0 + ( 1.0 - rf0 ) * pow( ( 1.0 - theta ), 5.0 );',
+			'	vec3 scatter = max( 0.0, dot( surfaceNormal, eyeDirection ) ) * waterColor;',
+			'	vec3 albedo = mix( sunColor * diffuseLight * 0.3 + scatter, ( vec3( 0.1 ) + reflectionSample * 0.9 + reflectionSample * specularLight ), reflectance );',
+			'	vec3 outgoingLight = albedo;',
+			'	gl_FragColor = vec4( outgoingLight, alpha );',
+
+			THREE.ShaderChunk[ 'fog_fragment' ],
+
+			'}'
+		].join( '\n' )
+
+	};
+
 	var mirrorUniforms = THREE.UniformsUtils.clone( mirrorShader.uniforms );
 	var mirrorUniforms = THREE.UniformsUtils.clone( mirrorShader.uniforms );
 
 
 	this.material = new THREE.ShaderMaterial( {
 	this.material = new THREE.ShaderMaterial( {
@@ -217,12 +216,6 @@ THREE.Water.prototype.constructor = THREE.Water;
 
 
 THREE.Water.prototype.updateTextureMatrix = function () {
 THREE.Water.prototype.updateTextureMatrix = function () {
 
 
-	function sign( x ) {
-
-		return x ? x < 0 ? - 1 : 1 : 0;
-
-	}
-
 	this.updateMatrixWorld();
 	this.updateMatrixWorld();
 	this.camera.updateMatrixWorld();
 	this.camera.updateMatrixWorld();
 
 
@@ -262,10 +255,12 @@ THREE.Water.prototype.updateTextureMatrix = function () {
 	this.mirrorCamera.matrixWorldInverse.getInverse( this.mirrorCamera.matrixWorld );
 	this.mirrorCamera.matrixWorldInverse.getInverse( this.mirrorCamera.matrixWorld );
 
 
 	// Update the texture matrix
 	// Update the texture matrix
-	this.textureMatrix.set( 0.5, 0.0, 0.0, 0.5,
-							0.0, 0.5, 0.0, 0.5,
-							0.0, 0.0, 0.5, 0.5,
-							0.0, 0.0, 0.0, 1.0 );
+	this.textureMatrix.set(
+		0.5, 0.0, 0.0, 0.5,
+		0.0, 0.5, 0.0, 0.5,
+		0.0, 0.0, 0.5, 0.5,
+		0.0, 0.0, 0.0, 1.0
+	);
 	this.textureMatrix.multiply( this.mirrorCamera.projectionMatrix );
 	this.textureMatrix.multiply( this.mirrorCamera.projectionMatrix );
 	this.textureMatrix.multiply( this.mirrorCamera.matrixWorldInverse );
 	this.textureMatrix.multiply( this.mirrorCamera.matrixWorldInverse );
 
 
@@ -279,8 +274,8 @@ THREE.Water.prototype.updateTextureMatrix = function () {
 	var q = new THREE.Vector4();
 	var q = new THREE.Vector4();
 	var projectionMatrix = this.mirrorCamera.projectionMatrix;
 	var projectionMatrix = this.mirrorCamera.projectionMatrix;
 
 
-	q.x = ( sign( this.clipPlane.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ];
-	q.y = ( sign( this.clipPlane.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ];
+	q.x = ( Math.sign( this.clipPlane.x ) + projectionMatrix.elements[ 8 ] ) / projectionMatrix.elements[ 0 ];
+	q.y = ( Math.sign( this.clipPlane.y ) + projectionMatrix.elements[ 9 ] ) / projectionMatrix.elements[ 5 ];
 	q.z = - 1.0;
 	q.z = - 1.0;
 	q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ];
 	q.w = ( 1.0 + projectionMatrix.elements[ 10 ] ) / projectionMatrix.elements[ 14 ];
 
 

+ 1 - 1
examples/js/loaders/AssimpJSONLoader.js

@@ -125,7 +125,7 @@ THREE.AssimpJSONLoader.prototype = {
 
 
 		}
 		}
 
 
-		geometry.setIndex( new ( indices.length > 65535 ? THREE.Uint32BufferAttribute : THREE.Uint16BufferAttribute )( indices, 1 ) );
+		geometry.setIndex( indices );
 		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
 
 
 		if ( normals.length > 0 ) {
 		if ( normals.length > 0 ) {

+ 1 - 9
examples/js/loaders/FBXLoader.js

@@ -263,15 +263,7 @@
 
 
 				if ( geoNode.indices !== undefined && geoNode.indices.length > 0 ) {
 				if ( geoNode.indices !== undefined && geoNode.indices.length > 0 ) {
 
 
-					if ( geoNode.indices.length > 65535 ) {
-
-						tmpGeo.setIndex( new THREE.BufferAttribute( new Uint32Array( geoNode.indices ), 1 ) );
-
-					} else {
-
-						tmpGeo.setIndex( new THREE.BufferAttribute( new Uint16Array( geoNode.indices ), 1 ) );
-
-					}
+					tmpGeo.setIndex( geoNode.indices );
 
 
 				}
 				}
 
 

+ 3860 - 0
examples/js/loaders/FBXLoader2.js

@@ -0,0 +1,3860 @@
+/**
+ * @author Kyle-Larson https://github.com/Kyle-Larson
+ *
+ * Loader loads FBX file and generates Group representing FBX scene.
+ * Requires FBX file to be >= 7.0 and in ASCII format.
+ *
+ * Supports:
+ * 	Mesh Generation (Positional Data)
+ * 	Normal Data (Per Vertex Drawing Instance)
+ *  UV Data (Per Vertex Drawing Instance)
+ *  Skinning
+ *  Animation
+ * 	- Separated Animations based on stacks.
+ * 	- Skeletal & Non-Skeletal Animations
+ *
+ * Needs Support:
+ * 	Indexed Buffers
+ * 	PreRotation support.
+ */
+
+( function () {
+
+	/**
+	 * Generates a loader for loading FBX files from URL and parsing into
+	 * a THREE.Group.
+	 * @param {THREE.LoadingManager} manager - Loading Manager for loader to use.
+	 */
+	THREE.FBXLoader = function ( manager ) {
+
+		THREE.Loader.call( this );
+		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+		this.fileLoader = new THREE.FileLoader( this.manager );
+		this.textureLoader = new THREE.TextureLoader( this.manager );
+
+	};
+
+	Object.assign( THREE.FBXLoader.prototype, THREE.Loader.prototype );
+
+	THREE.FBXLoader.prototype.constructor = THREE.FBXLoader;
+
+	Object.assign( THREE.FBXLoader.prototype, {
+
+		/**
+		 * Loads an ASCII FBX file from URL and parses into a THREE.Group.
+		 * THREE.Group will have an animations property of AnimationClips
+		 * of the different animations exported with the FBX.
+		 * @param {string} url - URL of the FBX file.
+		 * @param {function(THREE.Group):void} onLoad - Callback for when FBX file is loaded and parsed.
+		 * @param {function(ProgressEvent):void} onProgress - Callback fired periodically when file is being retrieved from server.
+		 * @param {function(Event):void} onError - Callback fired when error occurs (Currently only with retrieving file, not with parsing errors).
+		 */
+		load: function ( url, onLoad, onProgress, onError ) {
+
+			var self = this;
+
+			var resourceDirectory = url.split( /[\\\/]/ );
+			resourceDirectory.pop();
+			resourceDirectory = resourceDirectory.join( '/' );
+
+			this.fileLoader.load( url, function ( text ) {
+
+				if ( ! isFbxFormatASCII( text ) ) {
+
+					console.error( 'FBXLoader: FBX Binary format not supported.' );
+					self.manager.itemError( url );
+					return;
+
+				}
+				if ( getFbxVersion( text ) < 7000 ) {
+
+					console.error( 'FBXLoader: FBX version not supported for file at ' + url + ', FileVersion: ' + getFbxVersion( text ) );
+					self.manager.itemError( url );
+					return;
+
+				}
+
+				var scene = self.parse( text, resourceDirectory );
+				onLoad( scene );
+
+			}, onProgress, onError );
+
+		},
+
+		/**
+		 * Parses an ASCII FBX file and returns a THREE.Group.
+		 * THREE.Group will have an animations property of AnimationClips
+		 * of the different animations within the FBX file.
+		 * @param {string} FBXText - Contents of FBX file to parse.
+		 * @param {string} resourceDirectory - Directory to load external assets (e.g. textures ) from.
+		 * @returns {THREE.Group}
+		 */
+		parse: function ( FBXText, resourceDirectory ) {
+
+			var loader = this;
+
+			var FBXTree = new TextParser().parse( FBXText );
+
+			var connections = parseConnections( FBXTree );
+
+			var textures = parseTextures( FBXTree );
+
+			var materials = parseMaterials( FBXTree, textures, connections );
+
+			var deformerMap = parseDeformers( FBXTree, connections );
+
+			var geometryMap = parseGeometries( FBXTree, connections, deformerMap );
+
+			var sceneGraph = parseScene( FBXTree, connections, deformerMap, geometryMap, materials );
+
+			return sceneGraph;
+
+
+			/**
+			 * @typedef {{value: number}} FBXValue
+			 */
+			/**
+			 * @typedef {{value: {x: string, y: string, z: string}}} FBXVector3
+			 */
+			/**
+			 * @typedef {{properties: {a: string}}} FBXArrayNode
+			 */
+			/**
+			 * @typedef {{properties: {MappingInformationType: string, ReferenceInformationType: string }, subNodes: Object<string, FBXArrayNode>}} FBXMappedArrayNode
+			 */
+			/**
+			 * @typedef {{id: number, name: string, properties: {FileName: string}}} FBXTextureNode
+			 */
+			/**
+			 * @typedef {{id: number, attrName: string, properties: {ShadingModel: string, Diffuse: FBXVector3, Specular: FBXVector3, Shininess: FBXValue, Emissive: FBXVector3, EmissiveFactor: FBXValue, Opacity: FBXValue}}} FBXMaterialNode
+			 */
+			/**
+			 * @typedef {{subNodes: {Indexes: FBXArrayNode, Weights: FBXArrayNode, Transform: FBXArrayNode, TransformLink: FBXArrayNode}, properties: { Mode: string }}} FBXSubDeformerNode
+			 */
+			/**
+			 * @typedef {{id: number, attrName: string, attrType: string, subNodes: {Vertices: FBXArrayNode, PolygonVertexIndex: FBXArrayNode, LayerElementNormal: FBXMappedArrayNode[], LayerElementMaterial: FBXMappedArrayNode[], LayerElementUV: FBXMappedArrayNode[]}}} FBXGeometryNode
+			 */
+			/**
+			 * @typedef {{id: number, attrName: string, attrType: string, properties: {Lcl_Translation: FBXValue, Lcl_Rotation: FBXValue, Lcl_Scaling: FBXValue}}} FBXModelNode
+			 */
+
+
+
+
+
+
+
+
+			/**
+			 * Parses map of relationships between objects.
+			 * @param {{Connections: { properties: { connections: [number, number, string][]}}}} FBXTree
+			 * @returns {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>}
+			 */
+			function parseConnections( FBXTree ) {
+
+				/**
+				 * @type {Map<number, { parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>}
+				 */
+				var connectionMap = new Map();
+
+				if ( 'Connections' in FBXTree ) {
+
+					/**
+					 * @type {[number, number, string][]}
+					 */
+					var connectionArray = FBXTree.Connections.properties.connections;
+					connectionArray.forEach( function ( connection ) {
+
+						if ( ! connectionMap.has( connection[ 0 ] ) ) {
+
+							connectionMap.set( connection[ 0 ], {
+								parents: [],
+								children: []
+							} );
+
+						}
+
+						var parentRelationship = { ID: connection[ 1 ], relationship: connection[ 2 ] };
+						connectionMap.get( connection[ 0 ] ).parents.push( parentRelationship );
+
+						if ( ! connectionMap.has( connection[ 1 ] ) ) {
+
+							connectionMap.set( connection[ 1 ], {
+								parents: [],
+								children: []
+							} );
+
+						}
+
+						var childRelationship = { ID: connection[ 0 ], relationship: connection[ 2 ] };
+						connectionMap.get( connection[ 1 ] ).children.push( childRelationship );
+
+					} );
+
+				}
+
+				return connectionMap;
+
+			}
+
+			/**
+			 * Parses map of textures referenced in FBXTree.
+			 * @param {{Objects: {subNodes: {Texture: Object.<string, FBXTextureNode>}}}} FBXTree
+			 * @returns {Map<number, THREE.Texture>}
+			 */
+			function parseTextures( FBXTree ) {
+
+				/**
+				 * @type {Map<number, THREE.Texture>}
+				 */
+				var textureMap = new Map();
+
+				if ( 'Texture' in FBXTree.Objects.subNodes ) {
+
+					var textureNodes = FBXTree.Objects.subNodes.Texture;
+					for ( var nodeID in textureNodes ) {
+
+						var texture = parseTexture( textureNodes[ nodeID ] );
+						textureMap.set( parseInt( nodeID ), texture );
+
+					}
+
+				}
+
+				return textureMap;
+
+				/**
+				 * @param {textureNode} textureNode - Node to get texture information from.
+				 * @returns {THREE.Texture}
+				 */
+				function parseTexture( textureNode ) {
+
+					var FBX_ID = textureNode.id;
+					var name = textureNode.name;
+					var filePath = textureNode.properties.FileName;
+					var split = filePath.split( /[\\\/]/ );
+					if ( split.length > 0 ) {
+
+						var fileName = split[ split.length - 1 ];
+
+					} else {
+
+						var fileName = filePath;
+
+					}
+					/**
+					 * @type {THREE.Texture}
+					 */
+					var texture = loader.textureLoader.load( resourceDirectory + '/' + fileName );
+					texture.name = name;
+					texture.FBX_ID = FBX_ID;
+
+					return texture;
+
+				}
+
+			}
+
+			/**
+			 * Parses map of Material information.
+			 * @param {{Objects: {subNodes: {Material: Object.<number, FBXMaterialNode>}}}} FBXTree
+			 * @param {Map<number, THREE.Texture>} textureMap
+			 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+			 * @returns {Map<number, THREE.Material>}
+			 */
+			function parseMaterials( FBXTree, textureMap, connections ) {
+
+				var materialMap = new Map();
+
+				if ( 'Material' in FBXTree.Objects.subNodes ) {
+
+					var materialNodes = FBXTree.Objects.subNodes.Material;
+					for ( var nodeID in materialNodes ) {
+
+						var material = parseMaterial( materialNodes[ nodeID ], textureMap, connections );
+						materialMap.set( parseInt( nodeID ), material );
+
+					}
+
+				}
+
+				return materialMap;
+
+				/**
+				 * Takes information from Material node and returns a generated THREE.Material
+				 * @param {FBXMaterialNode} materialNode
+				 * @param {Map<number, THREE.Texture>} textureMap
+				 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+				 * @returns {THREE.Material}
+				 */
+				function parseMaterial( materialNode, textureMap, connections ) {
+
+					var FBX_ID = materialNode.id;
+					var name = materialNode.attrName;
+					var type = materialNode.properties.ShadingModel;
+
+					var children = connections.get( FBX_ID ).children;
+
+					var parameters = parseParameters( materialNode.properties, textureMap, children );
+
+					var material;
+					switch ( type ) {
+
+						case 'phong':
+							material = new THREE.MeshPhongMaterial();
+							break;
+						case 'lambert':
+							material = new THREE.MeshLambertMaterial();
+							break;
+						default:
+							console.warn( 'No implementation given for material type ' + type + ' in FBXLoader.js.  Defaulting to basic material' );
+							material = new THREE.MeshBasicMaterial( { color: 0x3300ff } );
+							break;
+
+					}
+
+					material.setValues( parameters );
+					material.name = name;
+
+					return material;
+
+					/**
+					 * @typedef {{Diffuse: FBXVector3, Specular: FBXVector3, Shininess: FBXValue, Emissive: FBXVector3, EmissiveFactor: FBXValue, Opacity: FBXValue}} FBXMaterialProperties
+					 */
+					/**
+					 * @typedef {{color: THREE.Color=, specular: THREE.Color=, shininess: number=, emissive: THREE.Color=, emissiveIntensity: number=, opacity: number=, transparent: boolean=, map: THREE.Texture=}} THREEMaterialParameterPack
+					 */
+					/**
+					 * @param {FBXMaterialProperties} properties
+					 * @param {Map<number, THREE.Texture>} textureMap
+					 * @param {{ID: number, relationship: string}[]} childrenRelationships
+					 * @returns {THREEMaterialParameterPack}
+					 */
+					function parseParameters( properties, textureMap, childrenRelationships ) {
+
+						var parameters = {};
+
+						if ( properties.Diffuse ) {
+
+							parameters.color = parseColor( properties.Diffuse );
+
+						}
+						if ( properties.Specular ) {
+
+							parameters.specular = parseColor( properties.Specular );
+
+						}
+						if ( properties.Shininess ) {
+
+							parameters.shininess = properties.Shininess.value;
+
+						}
+						if ( properties.Emissive ) {
+
+							parameters.emissive = parseColor( properties.Emissive );
+
+						}
+						if ( properties.EmissiveFactor ) {
+
+							parameters.emissiveIntensity = properties.EmissiveFactor.value;
+
+						}
+						if ( properties.Opacity ) {
+
+							parameters.opacity = properties.Opacity.value;
+
+						}
+						if ( parameters.opacity < 1.0 ) {
+
+							parameters.transparent = true;
+
+						}
+
+						childrenRelationships.forEach( function ( relationship ) {
+
+							var type = relationship.relationship;
+							switch ( type ) {
+
+								case " \"AmbientColor":
+									//TODO: Support AmbientColor textures
+									break;
+
+								case " \"DiffuseColor":
+									parameters.map = textureMap.get( relationship.ID );
+									break;
+
+								default:
+									console.warn( 'Unknown texture application of type ' + type + ', skipping texture' );
+									break;
+
+							}
+
+						} );
+
+						return parameters;
+
+					}
+
+				}
+
+			}
+
+			/**
+			 * Generates map of Skeleton-like objects for use later when generating and binding skeletons.
+			 * @param {{Objects: {subNodes: {Deformer: Object.<number, FBXSubDeformerNode>}}}} FBXTree
+			 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+			 * @returns {Map<number, {map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[], skeleton: THREE.Skeleton|null}>}
+			 */
+			function parseDeformers( FBXTree, connections ) {
+
+				var skeletonMap = new Map();
+
+				if ( 'Deformer' in FBXTree.Objects.subNodes ) {
+
+					var DeformerNodes = FBXTree.Objects.subNodes.Deformer;
+					for ( var nodeID in DeformerNodes ) {
+
+						var deformerNode = DeformerNodes[ nodeID ];
+						if ( deformerNode.attrType === 'Skin' ) {
+
+							var conns = connections.get( parseInt( nodeID ) );
+							var skeleton = parseSkeleton( conns, DeformerNodes );
+							skeleton.FBX_ID = parseInt( nodeID );
+							skeletonMap.set( parseInt( nodeID ), skeleton );
+
+						}
+
+					}
+
+				}
+
+				return skeletonMap;
+
+				/**
+				 * Generates a "Skeleton Representation" of FBX nodes based on an FBX Skin Deformer's connections and an object containing SubDeformer nodes.
+				 * @param {{parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}} connections
+				 * @param {Object.<number, FBXSubDeformerNode>} DeformerNodes
+				 * @returns {{map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[], skeleton: THREE.Skeleton|null}}
+				 */
+				function parseSkeleton( connections, DeformerNodes ) {
+
+					var subDeformers = new Map();
+					var subDeformerArray = [];
+					connections.children.forEach( function ( child ) {
+
+						var subDeformerNode = DeformerNodes[ child.ID ];
+						var subDeformer = {
+							FBX_ID: child.ID,
+							indices: parseIntArray( subDeformerNode.subNodes.Indexes.properties.a ),
+							weights: parseFloatArray( subDeformerNode.subNodes.Weights.properties.a ),
+							transform: parseMatrixArray( subDeformerNode.subNodes.Transform.properties.a ),
+							transformLink: parseMatrixArray( subDeformerNode.subNodes.TransformLink.properties.a ),
+							linkMode: subDeformerNode.properties.Mode
+						};
+						subDeformers.set( child.ID, subDeformer );
+						subDeformerArray.push( subDeformer );
+
+					} );
+
+					return {
+						map: subDeformers,
+						array: subDeformerArray,
+						bones: []
+					};
+
+				}
+
+			}
+
+			/**
+			 * Generates Buffer geometries from geometry information in FBXTree, and generates map of THREE.BufferGeometries
+			 * @param {{Objects: {subNodes: {Geometry: Object.<number, FBXGeometryNode}}}} FBXTree
+			 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+			 * @param {Map<number, {map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[], skeleton: THREE.Skeleton|null}>} deformerMap
+			 * @returns {Map<number, THREE.BufferGeometry>}
+			 */
+			function parseGeometries( FBXTree, connections, deformerMap ) {
+
+				var geometryMap = new Map();
+
+				if ( 'Geometry' in FBXTree.Objects.subNodes ) {
+
+					var geometryNodes = FBXTree.Objects.subNodes.Geometry;
+					for ( var nodeID in geometryNodes ) {
+
+						var relationships = connections.get( parseInt( nodeID ) );
+						var geo = parseGeometry( geometryNodes[ nodeID ], relationships, deformerMap );
+						geometryMap.set( parseInt( nodeID ), geo );
+
+					}
+
+				}
+
+				return geometryMap;
+
+				/**
+				 * Generates BufferGeometry from FBXGeometryNode.
+				 * @param {FBXGeometryNode} geometryNode
+				 * @param {{parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}} relationships
+				 * @param {Map<number, {map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[]}>} deformerMap
+				 * @returns {THREE.BufferGeometry}
+				 */
+				function parseGeometry( geometryNode, relationships, deformerMap ) {
+
+					switch ( geometryNode.attrType ) {
+
+						case 'Mesh':
+							return parseMeshGeometry( geometryNode, relationships, deformerMap );
+							break;
+
+						case 'NurbsCurve':
+							return parseNurbsGeometry( geometryNode, relationships, deformerMap );
+							break;
+
+					}
+
+					/**
+					 * Specialty function for parsing Mesh based Geometry Nodes.
+					 * @param {FBXGeometryNode} geometryNode
+					 * @param {{parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}} relationships - Object representing relationships between specific geometry node and other nodes.
+					 * @param {Map<number, {map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[]}>} deformerMap - Map object of deformers and subDeformers by ID.
+					 * @returns {THREE.BufferGeometry}
+					 */
+					function parseMeshGeometry( geometryNode, relationships, deformerMap ) {
+
+						var FBX_ID = geometryNode.id;
+						var name = geometryNode.attrName;
+						for ( var i = 0; i < relationships.children.length; ++ i ) {
+
+							if ( deformerMap.has( relationships.children[ i ].ID ) ) {
+
+								var deformer = deformerMap.get( relationships.children[ i ].ID );
+								break;
+
+							}
+
+						}
+
+						var geometry = genGeometry( geometryNode, deformer );
+
+						return geometry;
+
+						/**
+						 * @param {{map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[]}} deformer - Skeleton representation for geometry instance.
+						 * @returns {THREE.BufferGeometry}
+						 */
+						function genGeometry( geometryNode, deformer ) {
+
+							var geometry = new Geometry();
+
+							//First, each index is going to be its own vertex.
+							var vertexBuffer = parseFloatArray( geometryNode.subNodes.Vertices.properties.a );
+							var indexBuffer = parseIntArray( geometryNode.subNodes.PolygonVertexIndex.properties.a );
+
+							if ( 'LayerElementNormal' in geometryNode.subNodes ) {
+
+								var normalInfo = getNormals( geometryNode );
+
+							}
+
+							if ( 'LayerElementUV' in geometryNode.subNodes ) {
+
+								var uvInfo = getUVs( geometryNode );
+
+							}
+
+							if ( 'LayerElementMaterial' in geometryNode.subNodes ) {
+
+								var materialInfo = getMaterials( geometryNode );
+
+							}
+
+							var faceVertexBuffer = [];
+							var polygonIndex = 0;
+							for ( var polygonVertexIndex = 0; polygonVertexIndex < indexBuffer.length; ++ polygonVertexIndex ) {
+
+								var endOfFace;
+								var vertexIndex = indexBuffer[ polygonVertexIndex ];
+								if ( indexBuffer[ polygonVertexIndex ] < 0 ) {
+
+									vertexIndex = vertexIndex ^ - 1;
+									indexBuffer[ polygonVertexIndex ] = vertexIndex;
+									endOfFace = true;
+
+								}
+								var vertex = new Vertex();
+								var weightIndices = [];
+								var weights = [];
+								vertex.position.fromArray( vertexBuffer, vertexIndex * 3 );
+
+								// If we have a deformer for this geometry, get the skinIndex and skinWeights for this object.
+								// They are stored as vertex indices on each deformer, and we need them as deformer indices
+								// for each vertex.
+								if ( deformer ) {
+
+									for ( var j = 0; j < deformer.array.length; ++ j ) {
+
+										var index = deformer.array[ j ].indices.findIndex( function ( index ) {
+
+											return index === indexBuffer[ polygonVertexIndex ];
+
+										} );
+
+										if ( index !== - 1 ) {
+
+											weights.push( deformer.array[ j ].weights[ index ] );
+											weightIndices.push( j );
+
+										}
+
+									}
+
+									if ( weights.length > 4 ) {
+
+										console.warn( 'FBXLoader: Vertex has more than 4 skinning weights assigned to vertex.  Deleting additional weights.' );
+
+										var WIndex = [ 0, 0, 0, 0 ];
+										var Weight = [ 0, 0, 0, 0 ];
+
+										for ( var polygonVertexIndex = 0; polygonVertexIndex < weights.length; ++ polygonVertexIndex ) {
+
+											var currentWeight = weights[ polygonVertexIndex ];
+											var currentIndex = weightIndices[ polygonVertexIndex ];
+											for ( var j = 0; j < Weight.length; ++ j ) {
+
+												if ( currentWeight > Weight[ j ] ) {
+
+													var tmp = Weight[ j ];
+													Weight[ j ] = currentWeight;
+													currentWeight = tmp;
+
+													tmp = WIndex[ j ];
+													WIndex[ j ] = currentIndex;
+													currentIndex = tmp;
+
+												}
+
+											}
+
+										}
+
+										weightIndices = WIndex;
+										weights = Weight;
+
+									}
+
+									for ( var i = weights.length; i < 4; i ++ ) {
+
+										weights[ i ] = 0;
+										weightIndices[ i ] = 0;
+
+									}
+
+									vertex.skinWeights.fromArray( weights );
+									vertex.skinIndices.fromArray( weightIndices );
+
+									//vertex.skinWeights.normalize();
+
+								}
+
+								if ( normalInfo ) {
+
+									vertex.normal.fromArray( getData( polygonVertexIndex, polygonIndex, vertexIndex, normalInfo ) );
+
+								}
+
+								if ( uvInfo ) {
+
+									vertex.uv.fromArray( getData( polygonVertexIndex, polygonIndex, vertexIndex, uvInfo ) );
+
+								}
+
+
+
+								//Add vertex to face buffer.
+								faceVertexBuffer.push( vertex );
+
+								// If index was negative to start with, we have finished this individual face
+								// and can generate the face data to the geometry.
+								if ( endOfFace ) {
+
+									var face = new Face();
+									var materials = getData( polygonVertexIndex, polygonIndex, vertexIndex, materialInfo );
+									face.genTrianglesFromVertices( faceVertexBuffer );
+									face.materialIndex = materials[ 0 ];
+									geometry.faces.push( face );
+									faceVertexBuffer = [];
+									polygonIndex ++;
+									endOfFace = false;
+
+								}
+
+							}
+
+							/**
+							 * @type {{vertexBuffer: number[], normalBuffer: number[], uvBuffer: number[], skinIndexBuffer: number[], skinWeightBuffer: number[], materialIndexBuffer: number[]}}
+							 */
+							var bufferInfo = geometry.flattenToBuffers();
+
+							var geo = new THREE.BufferGeometry();
+							geo.name = geometryNode.name;
+							geo.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( bufferInfo.vertexBuffer ), 3 ) );
+
+							if ( bufferInfo.normalBuffer.length > 0 ) {
+
+								geo.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( bufferInfo.normalBuffer ), 3 ) );
+
+							}
+							if ( bufferInfo.uvBuffer.length > 0 ) {
+
+								geo.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( bufferInfo.uvBuffer ), 2 ) );
+
+							}
+
+							if ( deformer ) {
+
+								geo.addAttribute( 'skinIndex', new THREE.BufferAttribute( new Float32Array( bufferInfo.skinIndexBuffer ), 4 ) );
+
+								geo.addAttribute( 'skinWeight', new THREE.BufferAttribute( new Float32Array( bufferInfo.skinWeightBuffer ), 4 ) );
+
+								geo.FBX_Deformer = deformer;
+
+							}
+
+							// Convert the material indices of each vertex into rendering groups on the geometry.
+							var prevMaterialIndex = bufferInfo.materialIndexBuffer[ 0 ];
+							var startIndex = 0;
+							for ( var materialBufferIndex = 0; materialBufferIndex < bufferInfo.materialIndexBuffer.length; ++ materialBufferIndex ) {
+
+								if ( bufferInfo.materialIndexBuffer[ materialBufferIndex ] !== prevMaterialIndex ) {
+
+									geo.addGroup( startIndex, materialBufferIndex - startIndex, prevMaterialIndex );
+									startIndex = materialBufferIndex;
+									prevMaterialIndex = bufferInfo.materialIndexBuffer[ materialBufferIndex ];
+
+								}
+
+							}
+
+							return geo;
+
+							/**
+							 * Parses normal information for geometry.
+							 * @param {FBXGeometryNode} geometryNode
+							 * @returns {{dataSize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}}
+							 */
+							function getNormals( geometryNode ) {
+
+								var NormalNode = geometryNode.subNodes.LayerElementNormal[ 0 ];
+
+								var mappingType = NormalNode.properties.MappingInformationType;
+								var referenceType = NormalNode.properties.ReferenceInformationType;
+								var buffer = parseFloatArray( NormalNode.subNodes.Normals.properties.a );
+								var indexBuffer = [];
+								if ( referenceType === 'IndexToDirect' ) {
+
+									indexBuffer = parseIntArray( NormalNode.subNodes.NormalIndex.properties.a );
+
+								}
+
+								return {
+									dataSize: 3,
+									buffer: buffer,
+									indices: indexBuffer,
+									mappingType: mappingType,
+									referenceType: referenceType
+								};
+
+							}
+
+							/**
+							 * Parses UV information for geometry.
+							 * @param {FBXGeometryNode} geometryNode
+							 * @returns {{dataSize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}}
+							 */
+							function getUVs( geometryNode ) {
+
+								var UVNode = geometryNode.subNodes.LayerElementUV[ 0 ];
+
+								var mappingType = UVNode.properties.MappingInformationType;
+								var referenceType = UVNode.properties.ReferenceInformationType;
+								var buffer = parseFloatArray( UVNode.subNodes.UV.properties.a );
+								var indexBuffer = [];
+								if ( referenceType === 'IndexToDirect' ) {
+
+									indexBuffer = parseIntArray( UVNode.subNodes.UVIndex.properties.a );
+
+								}
+
+								return {
+									dataSize: 2,
+									buffer: buffer,
+									indices: indexBuffer,
+									mappingType: mappingType,
+									referenceType: referenceType
+								};
+
+							}
+
+							/**
+							 * Parses material application information for geometry.
+							 * @param {FBXGeometryNode}
+							 * @returns {{dataSize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}}
+							 */
+							function getMaterials( geometryNode ) {
+
+								var MaterialNode = geometryNode.subNodes.LayerElementMaterial[ 0 ];
+								var mappingType = MaterialNode.properties.MappingInformationType;
+								var referenceType = MaterialNode.properties.ReferenceInformationType;
+								var materialIndexBuffer = parseIntArray( MaterialNode.subNodes.Materials.properties.a );
+
+								// Since materials are stored as indices, there's a bit of a mismatch between FBX and what
+								// we expect.  So we create an intermediate buffer that points to the index in the buffer,
+								// for conforming with the other functions we've written for other data.
+								var materialIndices = [];
+								materialIndexBuffer.forEach( function ( materialIndex, index ) {
+
+									materialIndices.push( index );
+
+								} );
+
+								return {
+									dataSize: 1,
+									buffer: materialIndexBuffer,
+									indices: materialIndices,
+									mappingType: mappingType,
+									referenceType: referenceType
+								};
+
+							}
+
+							/**
+							 * Function uses the infoObject and given indices to return value array of object.
+							 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+							 * @param {number} polygonIndex - Index of polygon in geometry.
+							 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+							 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+							 * @returns {number[]}
+							 */
+							function getData( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+								var GetData = {
+
+									ByPolygonVertex: {
+
+										/**
+										 * Function uses the infoObject and given indices to return value array of object.
+										 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+										 * @param {number} polygonIndex - Index of polygon in geometry.
+										 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+										 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+										 * @returns {number[]}
+										 */
+										Direct: function ( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+											return infoObject.buffer.slice( ( polygonVertexIndex * infoObject.dataSize ), ( polygonVertexIndex * infoObject.dataSize ) + infoObject.dataSize );
+
+										},
+
+										/**
+										 * Function uses the infoObject and given indices to return value array of object.
+										 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+										 * @param {number} polygonIndex - Index of polygon in geometry.
+										 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+										 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+										 * @returns {number[]}
+										 */
+										IndexToDirect: function ( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+											var index = infoObject.indices[ polygonVertexIndex ];
+											return infoObject.buffer.slice( ( index * infoObject.dataSize ), ( index * infoObject.dataSize ) + infoObject.dataSize );
+
+										}
+
+									},
+
+									ByPolygon: {
+
+										/**
+										 * Function uses the infoObject and given indices to return value array of object.
+										 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+										 * @param {number} polygonIndex - Index of polygon in geometry.
+										 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+										 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+										 * @returns {number[]}
+										 */
+										Direct: function ( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+											return infoObject.buffer.slice( polygonIndex * infoObject.dataSize, polygonIndex * infoObject.dataSize + infoObject.dataSize );
+
+										},
+
+										/**
+										 * Function uses the infoObject and given indices to return value array of object.
+										 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+										 * @param {number} polygonIndex - Index of polygon in geometry.
+										 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+										 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+										 * @returns {number[]}
+										 */
+										IndexToDirect: function ( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+											var index = infoObject.indices[ polygonIndex ];
+											return infoObject.buffer.slice( index * infoObject.dataSize, index * infoObject.dataSize + infoObject.dataSize );
+
+										}
+
+									},
+
+									AllSame: {
+
+										/**
+										 * Function uses the infoObject and given indices to return value array of object.
+										 * @param {number} polygonVertexIndex - Index of vertex in draw order (which index of the index buffer refers to this vertex).
+										 * @param {number} polygonIndex - Index of polygon in geometry.
+										 * @param {number} vertexIndex - Index of vertex inside vertex buffer (used because some data refers to old index buffer that we don't use anymore).
+										 * @param {{datasize: number, buffer: number[], indices: number[], mappingType: string, referenceType: string}} infoObject - Object containing data and how to access data.
+										 * @returns {number[]}
+										 */
+										IndexToDirect: function ( polygonVertexIndex, polygonIndex, vertexIndex, infoObject ) {
+
+											return infoObject.buffer.slice( infoObject.indices[ 0 ] * infoObject.dataSize, infoObject.indices[ 0 ] * infoObject.dataSize + infoObject.dataSize );
+
+										}
+
+									}
+
+								};
+
+								return GetData[ infoObject.mappingType ][ infoObject.referenceType ]( polygonVertexIndex, polygonIndex, vertexIndex, infoObject );
+
+							}
+
+						}
+
+					}
+
+					/**
+					 * Specialty function for parsing NurbsCurve based Geometry Nodes.
+					 * @param {FBXGeometryNode} geometryNode
+					 * @param {{parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}} relationships
+					 * @returns {THREE.BufferGeometry}
+					 */
+					function parseNurbsGeometry( geometryNode, relationships ) {
+
+						if ( THREE.NURBSCurve === undefined ) {
+
+							console.error( "THREE.FBXLoader relies on THREE.NURBSCurve for any nurbs present in the model.  Nurbs will show up as empty geometry." );
+							return new THREE.BufferGeometry();
+
+						}
+
+						var order = parseInt( geometryNode.properties.Order );
+
+						if ( isNaN( order ) ) {
+
+							console.error( "FBXLoader: Invalid Order " + geometryNode.properties.Order + " given for geometry ID: " + geometryNode.id );
+							return new THREE.BufferGeometry();
+
+						}
+
+						var knots = parseFloatArray( geometryNode.subNodes.KnotVector.properties.a );
+						var controlPoints = [];
+						var pointsValues = parseFloatArray( geometryNode.subNodes.Points.properties.a );
+
+						for ( var i = 0; i < pointsValues.length; i += 4 ) {
+
+							controlPoints.push( new THREE.Vector4( pointsValues[ i ], pointsValues[ i + 1 ], pointsValues[ i + 2 ], pointsValues[ i + 3 ] ) );
+
+						}
+
+						if ( geometryNode.properties.Form === 'Closed' ) {
+
+							controlPoints.push( controlPoints[ 0 ] );
+
+						}
+
+						var curve = new THREE.NURBSCurve( order - 1, knots, controlPoints );
+						var vertices = curve.getPoints( controlPoints.length * 1.5 );
+
+						var vertexBuffer = [];
+						vertices.forEach( function ( position ) {
+
+							var array = position.toArray();
+							vertexBuffer = vertexBuffer.concat( array );
+
+						} );
+
+						var geometry = new THREE.BufferGeometry();
+						geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertexBuffer ), 3 ) );
+
+						return geometry;
+
+					}
+
+				}
+
+			}
+
+			/**
+			 * Finally generates Scene graph and Scene graph Objects.
+			 * @param {{Objects: {subNodes: {Model: Object.<number, FBXModelNode>}}}} FBXTree
+			 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+			 * @param {Map<number, {map: Map<number, {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}>, array: {FBX_ID: number, indices: number[], weights: number[], transform: number[], transformLink: number[], linkMode: string}[], skeleton: THREE.Skeleton|null}>} deformerMap
+			 * @param {Map<number, THREE.BufferGeometry>} geometryMap
+			 * @param {Map<number, THREE.Material>} materialMap
+			 * @returns {THREE.Group}
+			 */
+			function parseScene( FBXTree, connections, deformerMap, geometryMap, materialMap ) {
+
+				var sceneGraph = new THREE.Group();
+
+				var ModelNode = FBXTree.Objects.subNodes.Model;
+
+				/**
+				 * @type {Array.<THREE.Object3D>}
+				 */
+				var modelArray = [];
+
+				/**
+				 * @type {Map.<number, THREE.Object3D>}
+				 */
+				var modelMap = new Map();
+
+				for ( var nodeID in ModelNode ) {
+
+					var id = parseInt( nodeID );
+					var node = ModelNode[ nodeID ];
+					var conns = connections.get( id );
+					var model = null;
+					for ( var i = 0; i < conns.parents.length; ++ i ) {
+
+						deformerMap.forEach( function ( deformer ) {
+
+							if ( deformer.map.has( conns.parents[ i ].ID ) ) {
+
+								model = new THREE.Bone();
+								var index = deformer.array.findIndex( function ( subDeformer ) {
+
+									return subDeformer.FBX_ID === conns.parents[ i ].ID;
+
+								} );
+								deformer.bones[ index ] = model;
+
+							}
+
+						} );
+
+					}
+					if ( ! model ) {
+
+						switch ( node.attrType ) {
+
+							case "Mesh":
+								/**
+								 * @type {?THREE.BufferGeometry}
+								 */
+								var geometry = null;
+
+								/**
+								 * @type {THREE.MultiMaterial|THREE.Material}
+								 */
+								var material = null;
+
+								/**
+								 * @type {Array.<THREE.Material>}
+								 */
+								var materials = [];
+
+								conns.children.forEach( function ( child ) {
+
+									if ( geometryMap.has( child.ID ) ) {
+
+										geometry = geometryMap.get( child.ID );
+
+									}
+
+									if ( materialMap.has( child.ID ) ) {
+
+										materials.push( materialMap.get( child.ID ) );
+
+									}
+
+								} );
+								if ( materials.length > 1 ) {
+
+									material = new THREE.MultiMaterial( materials );
+
+								} else if ( materials.length > 0 ) {
+
+									material = materials[ 0 ];
+
+								} else {
+
+									material = new THREE.MeshBasicMaterial( { color: 0x3300ff } );
+
+								}
+								if ( geometry.FBX_Deformer ) {
+
+									materials.forEach( function ( material ) {
+
+										material.skinning = true;
+
+									} );
+									material.skinning = true;
+									model = new THREE.SkinnedMesh( geometry, material );
+
+								} else {
+
+									model = new THREE.Mesh( geometry, material );
+
+								}
+								break;
+
+							case "NurbsCurve":
+								var geometry = null;
+
+								conns.children.forEach( function ( child ) {
+
+									if ( geometryMap.has( child.ID ) ) {
+
+										geometry = geometryMap.get( child.ID );
+
+									}
+
+								} );
+
+								// FBX does not list materials for Nurbs lines, so we'll just put our own in here.
+								material = new THREE.LineBasicMaterial( { color: 0x3300ff, linewidth: 5 } );
+								model = new THREE.Line( geometry, material );
+								break;
+
+							default:
+								model = new THREE.Object3D();
+								break;
+
+						}
+
+					}
+
+					model.name = node.attrName.replace( /:/, '' ).replace( /_/, '' ).replace( /-/, '' );
+					model.FBX_ID = id;
+
+					modelArray.push( model );
+					modelMap.set( id, model );
+
+				}
+
+				modelArray.forEach( function ( model ) {
+
+					var node = ModelNode[ model.FBX_ID ];
+
+					if ( 'Lcl_Translation' in node.properties ) {
+
+						model.position.fromArray( parseFloatArray( node.properties.Lcl_Translation.value ) );
+
+					}
+
+					if ( 'Lcl_Rotation' in node.properties ) {
+
+						var rotation = parseFloatArray( node.properties.Lcl_Rotation.value ).map( function ( value ) {
+
+							return value * Math.PI / 180;
+
+						} );
+						rotation.push( 'ZYX' );
+						model.rotation.fromArray( rotation );
+
+					}
+
+					if ( 'Lcl_Scaling' in node.properties ) {
+
+						model.scale.fromArray( parseFloatArray( node.properties.Lcl_Scaling.value ) );
+
+					}
+
+					var conns = connections.get( model.FBX_ID );
+					for ( var parentIndex = 0; parentIndex < conns.parents.length; parentIndex ++ ) {
+
+						var pIndex = modelArray.findIndex( function ( mod ) {
+
+							return mod.FBX_ID === conns.parents[ parentIndex ].ID;
+
+						} );
+						if ( pIndex > - 1 ) {
+
+							modelArray[ pIndex ].add( model );
+							break;
+
+						}
+
+					}
+					if ( model.parent === null ) {
+
+						sceneGraph.add( model );
+
+					}
+
+				} );
+
+
+				// Now with the bones created, we can update the skeletons and bind them to the skinned meshes.
+				sceneGraph.updateMatrixWorld( true );
+
+				// Put skeleton into bind pose.
+				var BindPoseNode = FBXTree.Objects.subNodes.Pose;
+				for ( var nodeID in BindPoseNode ) {
+
+					if ( BindPoseNode[ nodeID ].attrType === 'BindPose' ) {
+
+						BindPoseNode = BindPoseNode[ nodeID ];
+						break;
+
+					}
+
+				}
+				if ( BindPoseNode ) {
+
+					var PoseNode = BindPoseNode.subNodes.PoseNode;
+					var worldMatrices = new Map();
+
+					PoseNode.forEach( function ( node ) {
+
+						var rawMatWrd = parseMatrixArray( node.subNodes.Matrix.properties.a );
+
+						worldMatrices.set( parseInt( node.id ), rawMatWrd );
+
+					} );
+
+				}
+
+				deformerMap.forEach( function ( deformer, FBX_ID ) {
+
+					deformer.array.forEach( function ( subDeformer, subDeformerIndex ) {
+
+						/**
+						 * @type {THREE.Bone}
+						 */
+						var bone = deformer.bones[ subDeformerIndex ];
+						if ( ! worldMatrices.has( bone.FBX_ID ) ) {
+
+							return;
+
+						}
+						var mat = worldMatrices.get( bone.FBX_ID );
+						bone.matrixWorld.copy( mat );
+
+					} );
+
+					// Now that skeleton is in bind pose, bind to model.
+					deformer.skeleton = new THREE.Skeleton( deformer.bones );
+					var conns = connections.get( FBX_ID );
+					conns.parents.forEach( function ( parent ) {
+
+						if ( geometryMap.has( parent.ID ) ) {
+
+							var geoID = parent.ID;
+							var geoConns = connections.get( geoID );
+							for ( var i = 0; i < geoConns.parents.length; ++ i ) {
+
+								if ( modelMap.has( geoConns.parents[ i ].ID ) ) {
+
+									var model = modelMap.get( geoConns.parents[ i ].ID );
+									//ASSERT model typeof SkinnedMesh
+									model.bind( deformer.skeleton, model.matrixWorld );
+									break;
+
+								}
+
+							}
+
+						}
+
+					} );
+
+				} );
+
+				// Skeleton is now bound, we are now free to set up the
+				// scene graph.
+				modelArray.forEach( function ( model ) {
+
+					var node = ModelNode[ model.FBX_ID ];
+
+					if ( 'Lcl_Translation' in node.properties ) {
+
+						model.position.fromArray( parseFloatArray( node.properties.Lcl_Translation.value ) );
+
+					}
+
+					if ( 'Lcl_Rotation' in node.properties ) {
+
+						var rotation = parseFloatArray( node.properties.Lcl_Rotation.value ).map( function ( value ) {
+
+							return value * Math.PI / 180;
+
+						} );
+						rotation.push( 'ZYX' );
+						model.rotation.fromArray( rotation );
+
+					}
+
+					if ( 'Lcl_Scaling' in node.properties ) {
+
+						model.scale.fromArray( parseFloatArray( node.properties.Lcl_Scaling.value ) );
+
+					}
+
+				} );
+
+				// Silly hack with the animation parsing.  We're gonna pretend the scene graph has a skeleton
+				// to attach animations to, since FBXs treat animations as animations for the entire scene,
+				// not just for individual objects.
+				sceneGraph.skeleton = {
+					bones: modelArray
+				};
+
+				var animations = parseAnimations( FBXTree, connections, sceneGraph );
+
+				addAnimations( sceneGraph, animations );
+
+				return sceneGraph;
+
+			}
+
+			/**
+			 * Parses animation information from FBXTree and generates an AnimationInfoObject.
+			 * @param {{Objects: {subNodes: {AnimationCurveNode: any, AnimationCurve: any, AnimationLayer: any, AnimationStack: any}}}} FBXTree
+			 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+			 */
+			function parseAnimations( FBXTree, connections, sceneGraph ) {
+
+				var rawNodes = FBXTree.Objects.subNodes.AnimationCurveNode;
+				var rawCurves = FBXTree.Objects.subNodes.AnimationCurve;
+				var rawLayers = FBXTree.Objects.subNodes.AnimationLayer;
+				var rawStacks = FBXTree.Objects.subNodes.AnimationStack;
+
+				/**
+				 * @type {{
+				     curves: Map<number, {
+						 T: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						},
+						 R: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						},
+						 S: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						}
+					 }>,
+					 layers: Map<number, {
+					 	T: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						},
+						R: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						},
+						S: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						}
+						}[]>,
+					 stacks: Map<number, {
+						 name: string,
+						 layers: {
+							T: {
+								id: number;
+								attr: string;
+								internalID: number;
+								attrX: boolean;
+								attrY: boolean;
+								attrZ: boolean;
+								containerBoneID: number;
+								containerID: number;
+								curves: {
+									x: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									y: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									z: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+								};
+							};
+							R: {
+								id: number;
+								attr: string;
+								internalID: number;
+								attrX: boolean;
+								attrY: boolean;
+								attrZ: boolean;
+								containerBoneID: number;
+								containerID: number;
+								curves: {
+									x: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									y: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									z: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+								};
+							};
+							S: {
+								id: number;
+								attr: string;
+								internalID: number;
+								attrX: boolean;
+								attrY: boolean;
+								attrZ: boolean;
+								containerBoneID: number;
+								containerID: number;
+								curves: {
+									x: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									y: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+									z: {
+										version: any;
+										id: number;
+										internalID: number;
+										times: number[];
+										values: number[];
+										attrFlag: number[];
+										attrData: number[];
+									};
+								};
+							};
+						}[][],
+					 length: number,
+					 frames: number }>,
+					 length: number,
+					 fps: number,
+					 frames: number
+				 }}
+				 */
+				var returnObject = {
+					curves: new Map(),
+					layers: new Map(),
+					stacks: new Map(),
+					length: 0,
+					fps: 30,
+					frames: 0
+				};
+
+				/**
+				 * @type {Array.<{
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+					}>}
+				 */
+				var animationCurveNodes = [];
+				for ( var nodeID in rawNodes ) {
+
+					if ( nodeID.match( /\d+/ ) ) {
+
+						var animationNode = parseAnimationNode( FBXTree, rawNodes[ nodeID ], connections, sceneGraph );
+						animationCurveNodes.push( animationNode );
+
+					}
+
+				}
+
+				/**
+				 * @type {Map.<number, {
+						id: number,
+						attr: string,
+						internalID: number,
+						attrX: boolean,
+						attrY: boolean,
+						attrZ: boolean,
+						containerBoneID: number,
+						containerID: number,
+						curves: {
+							x: {
+								version: any,
+								id: number,
+								internalID: number,
+								times: number[],
+								values: number[],
+								attrFlag: number[],
+								attrData: number[],
+							},
+							y: {
+								version: any,
+								id: number,
+								internalID: number,
+								times: number[],
+								values: number[],
+								attrFlag: number[],
+								attrData: number[],
+							},
+							z: {
+								version: any,
+								id: number,
+								internalID: number,
+								times: number[],
+								values: number[],
+								attrFlag: number[],
+								attrData: number[],
+							}
+						}
+					}>}
+				 */
+				var tmpMap = new Map();
+				for ( var animationCurveNodeIndex = 0; animationCurveNodeIndex < animationCurveNodes.length; ++ animationCurveNodeIndex ) {
+
+					if ( animationCurveNodes[ animationCurveNodeIndex ] === null ) {
+
+						continue;
+
+					}
+					tmpMap.set( animationCurveNodes[ animationCurveNodeIndex ].id, animationCurveNodes[ animationCurveNodeIndex ] );
+
+				}
+
+
+				/**
+				 * @type {{
+						version: any,
+						id: number,
+						internalID: number,
+						times: number[],
+						values: number[],
+						attrFlag: number[],
+						attrData: number[],
+					}[]}
+				 */
+				var animationCurves = [];
+				for ( nodeID in rawCurves ) {
+
+					if ( nodeID.match( /\d+/ ) ) {
+
+						var animationCurve = parseAnimationCurve( rawCurves[ nodeID ] );
+						animationCurves.push( animationCurve );
+
+						var firstParentConn = connections.get( animationCurve.id ).parents[ 0 ];
+						var firstParentID = firstParentConn.ID;
+						var firstParentRelationship = firstParentConn.relationship;
+						var axis = '';
+
+						if ( firstParentRelationship.match( /X/ ) ) {
+
+							axis = 'x';
+
+						} else if ( firstParentRelationship.match( /Y/ ) ) {
+
+							axis = 'y';
+
+						} else if ( firstParentRelationship.match( /Z/ ) ) {
+
+							axis = 'z';
+
+						} else {
+
+							continue;
+
+						}
+
+						tmpMap.get( firstParentID ).curves[ axis ] = animationCurve;
+
+					}
+
+				}
+
+				tmpMap.forEach( function ( curveNode ) {
+
+					var id = curveNode.containerBoneID;
+					if ( ! returnObject.curves.has( id ) ) {
+
+						returnObject.curves.set( id, { T: null, R: null, S: null } );
+
+					}
+					returnObject.curves.get( id )[ curveNode.attr ] = curveNode;
+
+				} );
+
+				for ( var nodeID in rawLayers ) {
+
+					/**
+					 * @type {{
+					 	T: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						},
+						R: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						},
+						S: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							},
+						}
+						}[]}
+					 */
+					var layer = [];
+					var children = connections.get( parseInt( nodeID ) ).children;
+					for ( var childIndex = 0; childIndex < children.length; childIndex ++ ) {
+
+						// Skip lockInfluenceWeights
+						if ( tmpMap.has( children[ childIndex ].ID ) ) {
+
+							var curveNode = tmpMap.get( children[ childIndex ].ID );
+							var boneID = curveNode.containerBoneID;
+							if ( layer[ boneID ] === undefined ) {
+
+								layer[ boneID ] = {
+									T: null,
+									R: null,
+									S: null
+								};
+
+							}
+
+							layer[ boneID ][ curveNode.attr ] = curveNode;
+
+						}
+
+					}
+
+					returnObject.layers.set( parseInt( nodeID ), layer );
+
+				}
+
+				for ( var nodeID in rawStacks ) {
+
+					var layers = [];
+					var children = connections.get( parseInt( nodeID ) ).children;
+					var maxTimeStamp = 0;
+					var minTimeStamp = Number.MAX_VALUE;
+					for ( var childIndex = 0; childIndex < children.length; ++ childIndex ) {
+
+						if ( returnObject.layers.has( children[ childIndex ].ID ) ) {
+
+							var currentLayer = returnObject.layers.get( children[ childIndex ].ID );
+							layers.push( currentLayer );
+
+							currentLayer.forEach( function ( layer ) {
+
+								if ( layer ) {
+
+									getCurveNodeMaxMinTimeStamps( layer );
+
+								}
+
+								/**
+								 * Sets the maxTimeStamp and minTimeStamp variables if it has timeStamps that are either larger or smaller
+								 * than the max or min respectively.
+								 * @param {{
+											T: {
+													id: number,
+													attr: string,
+													internalID: number,
+													attrX: boolean,
+													attrY: boolean,
+													attrZ: boolean,
+													containerBoneID: number,
+													containerID: number,
+													curves: {
+															x: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															y: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															z: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+													},
+											},
+											R: {
+													id: number,
+													attr: string,
+													internalID: number,
+													attrX: boolean,
+													attrY: boolean,
+													attrZ: boolean,
+													containerBoneID: number,
+													containerID: number,
+													curves: {
+															x: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															y: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															z: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+													},
+											},
+											S: {
+													id: number,
+													attr: string,
+													internalID: number,
+													attrX: boolean,
+													attrY: boolean,
+													attrZ: boolean,
+													containerBoneID: number,
+													containerID: number,
+													curves: {
+															x: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															y: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+															z: {
+																	version: any,
+																	id: number,
+																	internalID: number,
+																	times: number[],
+																	values: number[],
+																	attrFlag: number[],
+																	attrData: number[],
+															},
+													},
+											},
+									}} layer
+								 */
+								function getCurveNodeMaxMinTimeStamps( layer ) {
+
+									/**
+									 * Sets the maxTimeStamp and minTimeStamp if one of the curve's time stamps
+									 * exceeds the maximum or minimum.
+									 * @param {{
+												x: {
+														version: any,
+														id: number,
+														internalID: number,
+														times: number[],
+														values: number[],
+														attrFlag: number[],
+														attrData: number[],
+												},
+												y: {
+														version: any,
+														id: number,
+														internalID: number,
+														times: number[],
+														values: number[],
+														attrFlag: number[],
+														attrData: number[],
+												},
+												z: {
+														version: any,
+														id: number,
+														internalID: number,
+														times: number[],
+														values: number[],
+														attrFlag: number[],
+														attrData: number[],
+												}
+										}} curve
+									 */
+									function getCurveMaxMinTimeStamp( curve ) {
+
+										/**
+										 * Sets the maxTimeStamp and minTimeStamp if one of its timestamps exceeds the maximum or minimum.
+										 * @param {{times: number[]}} axis
+										 */
+										function getCurveAxisMaxMinTimeStamps( axis ) {
+
+											maxTimeStamp = axis.times[ axis.times.length - 1 ] > maxTimeStamp ? axis.times[ axis.times.length - 1 ] : maxTimeStamp;
+											minTimeStamp = axis.times[ 0 ] < minTimeStamp ? axis.times[ 0 ] : minTimeStamp;
+
+										}
+
+										if ( curve.x ) {
+
+											getCurveAxisMaxMinTimeStamps( curve.x );
+
+										}
+										if ( curve.y ) {
+
+											getCurveAxisMaxMinTimeStamps( curve.y );
+
+										}
+										if ( curve.z ) {
+
+											getCurveAxisMaxMinTimeStamps( curve.z );
+
+										}
+
+									}
+
+									if ( layer.R ) {
+
+										getCurveMaxMinTimeStamp( layer.R.curves );
+
+									}
+									if ( layer.S ) {
+
+										getCurveMaxMinTimeStamp( layer.S.curves );
+
+									}
+									if ( layer.T ) {
+
+										getCurveMaxMinTimeStamp( layer.T.curves );
+
+									}
+
+								}
+
+							} );
+
+						}
+
+					}
+
+					// Do we have an animation clip with actual length?
+					if ( maxTimeStamp > minTimeStamp ) {
+
+						returnObject.stacks.set( parseInt( nodeID ), {
+							name: rawStacks[ nodeID ].attrName,
+							layers: layers,
+							length: maxTimeStamp - minTimeStamp,
+							frames: ( maxTimeStamp - minTimeStamp ) * 30
+						} );
+
+					}
+
+				}
+
+				return returnObject;
+
+				/**
+				 * @param {Object} FBXTree
+				 * @param {{id: number, attrName: string, properties: Object<string, any>}} animationCurveNode
+				 * @param {Map<number, {parents: {ID: number, relationship: string}[], children: {ID: number, relationship: string}[]}>} connections
+				 * @param {{skeleton: {bones: {FBX_ID: number}[]}}} sceneGraph
+				 */
+				function parseAnimationNode( FBXTree, animationCurveNode, connections, sceneGraph ) {
+
+					var returnObject = {
+						/**
+						 * @type {number}
+						 */
+						id: animationCurveNode.id,
+
+						/**
+						 * @type {string}
+						 */
+						attr: animationCurveNode.attrName,
+
+						/**
+						 * @type {number}
+						 */
+						internalID: animationCurveNode.id,
+
+						/**
+						 * @type {boolean}
+						 */
+						attrX: false,
+
+						/**
+						 * @type {boolean}
+						 */
+						attrY: false,
+
+						/**
+						 * @type {boolean}
+						 */
+						attrZ: false,
+
+						/**
+						 * @type {number}
+						 */
+						containerBoneID: - 1,
+
+						/**
+						 * @type {number}
+						 */
+						containerID: - 1,
+
+						curves: {
+							x: null,
+							y: null,
+							z: null
+						}
+					};
+
+					if ( returnObject.attr.match( /S|R|T/ ) ) {
+
+						for ( var attributeKey in animationCurveNode.properties ) {
+
+							if ( attributeKey.match( /X/ ) ) {
+
+								returnObject.attrX = true;
+
+							}
+							if ( attributeKey.match( /Y/ ) ) {
+
+								returnObject.attrY = true;
+
+							}
+							if ( attributeKey.match( /Z/ ) ) {
+
+								returnObject.attrZ = true;
+
+							}
+
+						}
+
+					} else {
+
+						return null;
+
+					}
+
+					var conns = connections.get( returnObject.id );
+					var containerIndices = conns.parents;
+
+					for ( var containerIndicesIndex = containerIndices.length - 1; containerIndicesIndex >= 0; -- containerIndicesIndex ) {
+
+						var boneID = sceneGraph.skeleton.bones.findIndex( function ( bone ) {
+
+							return bone.FBX_ID === containerIndices[ containerIndicesIndex ].ID;
+
+						} );
+						if ( boneID > - 1 ) {
+
+							returnObject.containerBoneID = boneID;
+							returnObject.containerID = containerIndices[ containerIndicesIndex ].ID;
+							break;
+
+						}
+
+					}
+
+					return returnObject;
+
+				}
+
+				/**
+				 * @param {{id: number, subNodes: {KeyTime: {properties: {a: string}}, KeyValueFloat: {properties: {a: string}}, KeyAttrFlags: {properties: {a: string}}, KeyAttrDataFloat: {properties: {a: string}}}}} animationCurve
+				 */
+				function parseAnimationCurve( animationCurve ) {
+
+					return {
+						version: null,
+						id: animationCurve.id,
+						internalID: animationCurve.id,
+						times: parseFloatArray( animationCurve.subNodes.KeyTime.properties.a ).map( function ( time ) {
+
+							return ConvertFBXTimeToSeconds( time );
+
+						} ),
+						values: parseFloatArray( animationCurve.subNodes.KeyValueFloat.properties.a ),
+
+						attrFlag: parseIntArray( animationCurve.subNodes.KeyAttrFlags.properties.a ),
+						attrData: parseFloatArray( animationCurve.subNodes.KeyAttrDataFloat.properties.a )
+					};
+
+				}
+
+			}
+
+			/**
+			 * @param {{
+				curves: Map<number, {
+					T: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+					R: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+					S: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+				}>;
+				layers: Map<number, {
+					T: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+					R: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+					S: {
+						id: number;
+						attr: string;
+						internalID: number;
+						attrX: boolean;
+						attrY: boolean;
+						attrZ: boolean;
+						containerBoneID: number;
+						containerID: number;
+						curves: {
+							x: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							y: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+							z: {
+								version: any;
+								id: number;
+								internalID: number;
+								times: number[];
+								values: number[];
+								attrFlag: number[];
+								attrData: number[];
+							};
+						};
+					};
+				}[]>;
+				stacks: Map<number, {
+					name: string;
+					layers: {
+						T: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						};
+						R: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						};
+						S: {
+							id: number;
+							attr: string;
+							internalID: number;
+							attrX: boolean;
+							attrY: boolean;
+							attrZ: boolean;
+							containerBoneID: number;
+							containerID: number;
+							curves: {
+								x: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								y: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+								z: {
+									version: any;
+									id: number;
+									internalID: number;
+									times: number[];
+									values: number[];
+									attrFlag: number[];
+									attrData: number[];
+								};
+							};
+						};
+					}[][];
+					length: number;
+					frames: number;
+				}>;
+				length: number;
+				fps: number;
+				frames: number;
+			}} animations,
+			 * @param {{skeleton: { bones: THREE.Bone[]}}} group
+			 */
+			function addAnimations( group, animations ) {
+
+				if ( group.animations === undefined ) {
+
+					group.animations = [];
+
+				}
+
+				animations.stacks.forEach( function ( stack ) {
+
+					var animationData = {
+						name: stack.name,
+						fps: 30,
+						length: stack.length,
+						hierarchy: []
+					};
+
+					var bones = group.skeleton.bones;
+
+					bones.forEach( function ( bone ) {
+
+						var name = bone.name.replace( /.*:/, '' );
+						var parentIndex = bones.findIndex( function ( parentBone ) {
+
+							return bone.parent === parentBone;
+
+						} );
+						animationData.hierarchy.push( { parent: parentIndex, name: name, keys: [] } );
+
+					} );
+
+					for ( var frame = 0; frame < stack.frames; frame ++ ) {
+
+						bones.forEach( function ( bone, boneIndex ) {
+
+							var animationNode = stack.layers[ 0 ][ boneIndex ];
+
+							animationData.hierarchy.forEach( function ( node ) {
+
+								if ( node.name === bone.name ) {
+
+									node.keys.push( generateKey( animationNode, bone, frame ) );
+
+								}
+
+							} );
+
+						} );
+
+					}
+
+					group.animations.push( THREE.AnimationClip.parseAnimation( animationData, bones ) );
+
+
+					/**
+					 * @param {THREE.Bone} bone
+					 */
+					function generateKey( animationNode, bone, frame ) {
+
+						var key = {
+							time: frame / animations.fps,
+							pos: bone.position.toArray(),
+							rot: bone.quaternion.toArray(),
+							scl: bone.scale.toArray()
+						};
+
+						if ( animationNode === undefined ) {
+
+							return key;
+
+						}
+
+						try {
+
+							if ( hasCurve( animationNode, 'T' ) && hasKeyOnFrame( animationNode.T, frame ) ) {
+
+								key.pos = [ animationNode.T.curves.x.values[ frame ], animationNode.T.curves.y.values[ frame ], animationNode.T.curves.z.values[ frame ] ];
+
+							}
+
+							if ( hasCurve( animationNode, 'R' ) && hasKeyOnFrame( animationNode.R, frame ) ) {
+
+								var rotationX = degreeToRadian( animationNode.R.curves.x.values[ frame ] );
+								var rotationY = degreeToRadian( animationNode.R.curves.y.values[ frame ] );
+								var rotationZ = degreeToRadian( animationNode.R.curves.z.values[ frame ] );
+								var euler = new THREE.Euler( rotationX, rotationY, rotationZ, 'ZYX' );
+								key.rot = new THREE.Quaternion().setFromEuler( euler ).toArray();
+
+							}
+
+							if ( hasCurve( animationNode, 'S' ) && hasKeyOnFrame( animationNode.S, frame ) ) {
+
+								key.scl = [ animationNode.S.curves.x.values[ frame ], animationNode.S.curves.y.values[ frame ], animationNode.S.curves.z.values[ frame ] ];
+
+							}
+
+						} catch ( error ) {
+
+							// Curve is not fully plotted.
+							console.log( bone );
+							console.log( error );
+
+						}
+
+						return key;
+
+						function hasCurve( animationNode, attribute ) {
+
+							if ( animationNode === undefined ) {
+
+								return false;
+
+							}
+
+							var attributeNode = animationNode[ attribute ];
+							if ( ! attributeNode ) {
+
+								return false;
+
+							}
+
+							return [ 'x', 'y', 'z' ].every( function ( key ) {
+
+								return attributeNode.curves[ key ] !== undefined;
+
+							} );
+
+						}
+
+						function hasKeyOnFrame( attributeNode, frame ) {
+
+							return [ 'x', 'y', 'z' ].every( function ( key ) {
+
+								return isKeyExistOnFrame( attributeNode.curves[ key ], frame );
+
+								function isKeyExistOnFrame( curve, frame ) {
+
+									return curve.values[ frame ] !== undefined;
+
+								}
+
+							} );
+
+						}
+
+					}
+
+				} );
+
+			}
+
+
+
+			// UTILS
+			/**
+			 * Parses Vector3 property from FBXTree.  Property is given as .value.x, .value.y, etc.
+			 * @param {FBXVector3} property - Property to parse as Vector3.
+			 * @returns {THREE.Vector3}
+			 */
+			function parseVector3( property ) {
+
+				return new THREE.Vector3( parseFloat( property.value.x ), parseFloat( property.value.y ), parseFloat( property.value.z ) );
+
+			}
+
+			/**
+			 * Parses Color property from FBXTree.  Property is given as .value.x, .value.y, etc.
+			 * @param {FBXVector3} property - Property to parse as Color.
+			 * @returns {THREE.Color}
+			 */
+			function parseColor( property ) {
+
+				return new THREE.Color().fromArray( parseVector3( property ).toArray() );
+
+			}
+
+		}
+
+	} );
+
+	/**
+	 * An instance of a Vertex with data for drawing vertices to the screen.
+	 * @constructor
+	 */
+	function Vertex() {
+
+		/**
+		 * Position of the vertex.
+		 * @type {THREE.Vector3}
+		 */
+		this.position = new THREE.Vector3( );
+
+		/**
+		 * Normal of the vertex
+		 * @type {THREE.Vector3}
+		 */
+		this.normal = new THREE.Vector3( );
+
+		/**
+		 * UV coordinates of the vertex.
+		 * @type {THREE.Vector2}
+		 */
+		this.uv = new THREE.Vector2( );
+
+		/**
+		 * Indices of the bones vertex is influenced by.
+		 * @type {THREE.Vector4}
+		 */
+		this.skinIndices = new THREE.Vector4( 0, 0, 0, 0 );
+
+		/**
+		 * Weights that each bone influences the vertex.
+		 * @type {THREE.Vector4}
+		 */
+		this.skinWeights = new THREE.Vector4( 0, 0, 0, 0 );
+
+	}
+
+	Object.assign( Vertex.prototype, {
+
+		copy: function ( target ) {
+
+			var returnVar = target || new Vertex();
+
+			returnVar.position.copy( this.position );
+			returnVar.normal.copy( this.normal );
+			returnVar.uv.copy( this.uv );
+			returnVar.skinIndices.copy( this.skinIndices );
+			returnVar.skinWeights.copy( this.skinWeights );
+
+			return returnVar;
+
+		},
+
+		flattenToBuffers: function () {
+
+			var vertexBuffer = this.position.toArray();
+			var normalBuffer = this.normal.toArray();
+			var uvBuffer = this.uv.toArray();
+			var skinIndexBuffer = this.skinIndices.toArray();
+			var skinWeightBuffer = this.skinWeights.toArray();
+
+			return {
+				vertexBuffer: vertexBuffer,
+				normalBuffer: normalBuffer,
+				uvBuffer: uvBuffer,
+				skinIndexBuffer: skinIndexBuffer,
+				skinWeightBuffer: skinWeightBuffer,
+			};
+
+		}
+
+	} );
+
+	/**
+	 * @constructor
+	 */
+	function Triangle() {
+
+		/**
+		 * @type {{position: THREE.Vector3, normal: THREE.Vector3, uv: THREE.Vector2, skinIndices: THREE.Vector4, skinWeights: THREE.Vector4}[]}
+		 */
+		this.vertices = [ ];
+
+	}
+
+	Object.assign( Triangle.prototype, {
+
+		copy: function ( target ) {
+
+			var returnVar = target || new Triangle();
+
+			for ( var i = 0; i < this.vertices.length; ++ i ) {
+
+				 this.vertices[ i ].copy( returnVar.vertices[ i ] );
+
+			}
+
+			return returnVar;
+
+		},
+
+		flattenToBuffers: function () {
+
+			var vertexBuffer = [];
+			var normalBuffer = [];
+			var uvBuffer = [];
+			var skinIndexBuffer = [];
+			var skinWeightBuffer = [];
+
+			this.vertices.forEach( function ( vertex ) {
+
+				var flatVertex = vertex.flattenToBuffers();
+				vertexBuffer = vertexBuffer.concat( flatVertex.vertexBuffer );
+				normalBuffer = normalBuffer.concat( flatVertex.normalBuffer );
+				uvBuffer = uvBuffer.concat( flatVertex.uvBuffer );
+				skinIndexBuffer = skinIndexBuffer.concat( flatVertex.skinIndexBuffer );
+				skinWeightBuffer = skinWeightBuffer.concat( flatVertex.skinWeightBuffer );
+
+			} );
+
+			return {
+				vertexBuffer: vertexBuffer,
+				normalBuffer: normalBuffer,
+				uvBuffer: uvBuffer,
+				skinIndexBuffer: skinIndexBuffer,
+				skinWeightBuffer: skinWeightBuffer,
+			};
+
+		}
+
+	} );
+
+	/**
+	 * @constructor
+	 */
+	function Face() {
+
+		/**
+		 * @type {{vertices: {position: THREE.Vector3, normal: THREE.Vector3, uv: THREE.Vector2, skinIndices: THREE.Vector4, skinWeights: THREE.Vector4}[]}[]}
+		 */
+		this.triangles = [ ];
+		this.materialIndex = 0;
+
+	}
+
+	Object.assign( Face.prototype, {
+
+		copy: function ( target ) {
+
+			var returnVar = target || new Face();
+
+			for ( var i = 0; i < this.triangles.length; ++ i ) {
+
+				this.triangles[ i ].copy( returnVar.triangles[ i ] );
+
+			}
+
+			returnVar.materialIndex = this.materialIndex;
+
+			return returnVar;
+
+		},
+
+		genTrianglesFromVertices: function ( vertexArray ) {
+
+			for ( var i = 2; i < vertexArray.length; ++ i ) {
+
+				var triangle = new Triangle();
+				triangle.vertices[ 0 ] = vertexArray[ 0 ];
+				triangle.vertices[ 1 ] = vertexArray[ i - 1 ];
+				triangle.vertices[ 2 ] = vertexArray[ i ];
+				this.triangles.push( triangle );
+
+			}
+
+		},
+
+		flattenToBuffers: function () {
+
+			var vertexBuffer = [];
+			var normalBuffer = [];
+			var uvBuffer = [];
+			var skinIndexBuffer = [];
+			var skinWeightBuffer = [];
+
+			var materialIndexBuffer = [];
+
+			var materialIndex = this.materialIndex;
+
+			this.triangles.forEach( function ( triangle ) {
+
+				var flatTriangle = triangle.flattenToBuffers();
+				vertexBuffer = vertexBuffer.concat( flatTriangle.vertexBuffer );
+				normalBuffer = normalBuffer.concat( flatTriangle.normalBuffer );
+				uvBuffer = uvBuffer.concat( flatTriangle.uvBuffer );
+				skinIndexBuffer = skinIndexBuffer.concat( flatTriangle.skinIndexBuffer );
+				skinWeightBuffer = skinWeightBuffer.concat( flatTriangle.skinWeightBuffer );
+				materialIndexBuffer = materialIndexBuffer.concat( [ materialIndex, materialIndex, materialIndex ] );
+
+			} );
+
+			return {
+				vertexBuffer: vertexBuffer,
+				normalBuffer: normalBuffer,
+				uvBuffer: uvBuffer,
+				skinIndexBuffer: skinIndexBuffer,
+				skinWeightBuffer: skinWeightBuffer,
+				materialIndexBuffer: materialIndexBuffer
+			};
+
+		}
+
+	} );
+
+	/**
+	 * @constructor
+	 */
+	function Geometry() {
+
+		/**
+		 * @type {{triangles: {vertices: {position: THREE.Vector3, normal: THREE.Vector3, uv: THREE.Vector2, skinIndices: THREE.Vector4, skinWeights: THREE.Vector4}[]}[], materialIndex: number}[]}
+		 */
+		this.faces = [ ];
+
+		/**
+		 * @type {{}|THREE.Skeleton}
+		 */
+		this.skeleton = null;
+
+	}
+
+	Object.assign( Geometry.prototype, {
+
+		/**
+		 * @returns	{{vertexBuffer: number[], normalBuffer: number[], uvBuffer: number[], skinIndexBuffer: number[], skinWeightBuffer: number[], materialIndexBuffer: number[]}}
+		 */
+		flattenToBuffers: function () {
+
+			var vertexBuffer = [];
+			var normalBuffer = [];
+			var uvBuffer = [];
+			var skinIndexBuffer = [];
+			var skinWeightBuffer = [];
+
+			var materialIndexBuffer = [];
+
+			this.faces.forEach( function ( face ) {
+
+				var flatFace = face.flattenToBuffers();
+				vertexBuffer = vertexBuffer.concat( flatFace.vertexBuffer );
+				normalBuffer = normalBuffer.concat( flatFace.normalBuffer );
+				uvBuffer = uvBuffer.concat( flatFace.uvBuffer );
+				skinIndexBuffer = skinIndexBuffer.concat( flatFace.skinIndexBuffer );
+				skinWeightBuffer = skinWeightBuffer.concat( flatFace.skinWeightBuffer );
+				materialIndexBuffer = materialIndexBuffer.concat( flatFace.materialIndexBuffer );
+
+			} );
+
+			return {
+				vertexBuffer: vertexBuffer,
+				normalBuffer: normalBuffer,
+				uvBuffer: uvBuffer,
+				skinIndexBuffer: skinIndexBuffer,
+				skinWeightBuffer: skinWeightBuffer,
+				materialIndexBuffer: materialIndexBuffer
+			};
+
+		}
+
+	} );
+
+	function TextParser() {}
+
+	Object.assign( TextParser.prototype, {
+
+		getPrevNode: function () {
+
+			return this.nodeStack[ this.currentIndent - 2 ];
+
+		},
+
+		getCurrentNode: function () {
+
+			return this.nodeStack[ this.currentIndent - 1 ];
+
+		},
+
+		getCurrentProp: function () {
+
+			return this.currentProp;
+
+		},
+
+		pushStack: function ( node ) {
+
+			this.nodeStack.push( node );
+			this.currentIndent += 1;
+
+		},
+
+		popStack: function () {
+
+			this.nodeStack.pop();
+			this.currentIndent -= 1;
+
+		},
+
+		setCurrentProp: function ( val, name ) {
+
+			this.currentProp = val;
+			this.currentPropName = name;
+
+		},
+
+		// ----------parse ---------------------------------------------------
+		parse: function ( text ) {
+
+			this.currentIndent = 0;
+			this.allNodes = new FBXTree();
+			this.nodeStack = [];
+			this.currentProp = [];
+			this.currentPropName = '';
+
+			var split = text.split( "\n" );
+			for ( var line in split ) {
+
+				var l = split[ line ];
+
+				// short cut
+				if ( l.match( /^[\s\t]*;/ ) ) {
+
+					continue;
+
+				} // skip comment line
+				if ( l.match( /^[\s\t]*$/ ) ) {
+
+					continue;
+
+				} // skip empty line
+
+				// beginning of node
+				var beginningOfNodeExp = new RegExp( "^\\t{" + this.currentIndent + "}(\\w+):(.*){", '' );
+				var match = l.match( beginningOfNodeExp );
+				if ( match ) {
+
+					var nodeName = match[ 1 ].trim().replace( /^"/, '' ).replace( /"$/, "" );
+					var nodeAttrs = match[ 2 ].split( ',' ).map( function ( element ) {
+
+						return element.trim().replace( /^"/, '' ).replace( /"$/, '' );
+
+					} );
+
+					this.parseNodeBegin( l, nodeName, nodeAttrs || null );
+					continue;
+
+				}
+
+				// node's property
+				var propExp = new RegExp( "^\\t{" + ( this.currentIndent ) + "}(\\w+):[\\s\\t\\r\\n](.*)" );
+				var match = l.match( propExp );
+				if ( match ) {
+
+					var propName = match[ 1 ].replace( /^"/, '' ).replace( /"$/, "" ).trim();
+					var propValue = match[ 2 ].replace( /^"/, '' ).replace( /"$/, "" ).trim();
+
+					this.parseNodeProperty( l, propName, propValue );
+					continue;
+
+				}
+
+				// end of node
+				var endOfNodeExp = new RegExp( "^\\t{" + ( this.currentIndent - 1 ) + "}}" );
+				if ( l.match( endOfNodeExp ) ) {
+
+					this.nodeEnd();
+					continue;
+
+				}
+
+				// for special case,
+				//
+				//	  Vertices: *8670 {
+				//		  a: 0.0356229953467846,13.9599733352661,-0.399196773.....(snip)
+				// -0.0612030513584614,13.960485458374,-0.409748703241348,-0.10.....
+				// 0.12490539252758,13.7450733184814,-0.454119384288788,0.09272.....
+				// 0.0836158767342567,13.5432004928589,-0.435397416353226,0.028.....
+				//
+				// these case the lines must contiue with previous line
+				if ( l.match( /^[^\s\t}]/ ) ) {
+
+					this.parseNodePropertyContinued( l );
+
+				}
+
+			}
+
+			return this.allNodes;
+
+		},
+
+		parseNodeBegin: function ( line, nodeName, nodeAttrs ) {
+
+			// var nodeName = match[1];
+			var node = { 'name': nodeName, properties: {}, 'subNodes': {} };
+			var attrs = this.parseNodeAttr( nodeAttrs );
+			var currentNode = this.getCurrentNode();
+
+			// a top node
+			if ( this.currentIndent === 0 ) {
+
+				this.allNodes.add( nodeName, node );
+
+			} else {
+
+				// a subnode
+
+				// already exists subnode, then append it
+				if ( nodeName in currentNode.subNodes ) {
+
+					var tmp = currentNode.subNodes[ nodeName ];
+
+					// console.log( "duped entry found\nkey: " + nodeName + "\nvalue: " + propValue );
+					if ( this.isFlattenNode( currentNode.subNodes[ nodeName ] ) ) {
+
+
+						if ( attrs.id === '' ) {
+
+							currentNode.subNodes[ nodeName ] = [];
+							currentNode.subNodes[ nodeName ].push( tmp );
+
+						} else {
+
+							currentNode.subNodes[ nodeName ] = {};
+							currentNode.subNodes[ nodeName ][ tmp.id ] = tmp;
+
+						}
+
+					}
+
+					if ( attrs.id === '' ) {
+
+						currentNode.subNodes[ nodeName ].push( node );
+
+					} else {
+
+						currentNode.subNodes[ nodeName ][ attrs.id ] = node;
+
+					}
+
+				} else if ( typeof attrs.id === 'number' || attrs.id.match( /^\d+$/ ) ) {
+
+					currentNode.subNodes[ nodeName ] = {};
+					currentNode.subNodes[ nodeName ][ attrs.id ] = node;
+
+				} else {
+
+					currentNode.subNodes[ nodeName ] = node;
+
+				}
+
+			}
+
+			// for this		  ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
+			// NodeAttribute: 1001463072, "NodeAttribute::", "LimbNode" {
+			if ( nodeAttrs ) {
+
+				node.id = attrs.id;
+				node.attrName = attrs.name;
+				node.attrType = attrs.type;
+
+			}
+
+			this.pushStack( node );
+
+		},
+
+		parseNodeAttr: function ( attrs ) {
+
+			var id = attrs[ 0 ];
+
+			if ( attrs[ 0 ] !== "" ) {
+
+				id = parseInt( attrs[ 0 ] );
+
+				if ( isNaN( id ) ) {
+
+					// PolygonVertexIndex: *16380 {
+					id = attrs[ 0 ];
+
+				}
+
+			}
+
+			var name;
+			var type;
+			if ( attrs.length > 1 ) {
+
+				name = attrs[ 1 ].replace( /^(\w+)::/, '' );
+				type = attrs[ 2 ];
+
+			}
+
+			return { id: id, name: name || '', type: type || '' };
+
+		},
+
+		parseNodeProperty: function ( line, propName, propValue ) {
+
+			var currentNode = this.getCurrentNode();
+			var parentName = currentNode.name;
+
+			// special case parent node's is like "Properties70"
+			// these chilren nodes must treat with careful
+			if ( parentName !== undefined ) {
+
+				var propMatch = parentName.match( /Properties(\d)+/ );
+				if ( propMatch ) {
+
+					this.parseNodeSpecialProperty( line, propName, propValue );
+					return;
+
+				}
+
+			}
+
+			// special case Connections
+			if ( propName == 'C' ) {
+
+				var connProps = propValue.split( ',' ).slice( 1 );
+				var from = parseInt( connProps[ 0 ] );
+				var to = parseInt( connProps[ 1 ] );
+
+				var rest = propValue.split( ',' ).slice( 3 );
+
+				propName = 'connections';
+				propValue = [ from, to ];
+				propValue = propValue.concat( rest );
+
+				if ( currentNode.properties[ propName ] === undefined ) {
+
+					currentNode.properties[ propName ] = [];
+
+				}
+
+			}
+
+			// special case Connections
+			if ( propName == 'Node' ) {
+
+				var id = parseInt( propValue );
+				currentNode.properties.id = id;
+				currentNode.id = id;
+
+			}
+
+			// already exists in properties, then append this
+			if ( propName in currentNode.properties ) {
+
+				// console.log( "duped entry found\nkey: " + propName + "\nvalue: " + propValue );
+				if ( Array.isArray( currentNode.properties[ propName ] ) ) {
+
+					currentNode.properties[ propName ].push( propValue );
+
+				} else {
+
+					currentNode.properties[ propName ] += propValue;
+
+				}
+
+			} else {
+
+				// console.log( propName + ":  " + propValue );
+				if ( Array.isArray( currentNode.properties[ propName ] ) ) {
+
+					currentNode.properties[ propName ].push( propValue );
+
+				} else {
+
+					currentNode.properties[ propName ] = propValue;
+
+				}
+
+			}
+
+			this.setCurrentProp( currentNode.properties, propName );
+
+		},
+
+		// TODO:
+		parseNodePropertyContinued: function ( line ) {
+
+			this.currentProp[ this.currentPropName ] += line;
+
+		},
+
+		parseNodeSpecialProperty: function ( line, propName, propValue ) {
+
+			// split this
+			// P: "Lcl Scaling", "Lcl Scaling", "", "A",1,1,1
+			// into array like below
+			// ["Lcl Scaling", "Lcl Scaling", "", "A", "1,1,1" ]
+			var props = propValue.split( '",' ).map( function ( element ) {
+
+				return element.trim().replace( /^\"/, '' ).replace( /\s/, '_' );
+
+			} );
+
+			var innerPropName = props[ 0 ];
+			var innerPropType1 = props[ 1 ];
+			var innerPropType2 = props[ 2 ];
+			var innerPropFlag = props[ 3 ];
+			var innerPropValue = props[ 4 ];
+
+			/*
+			if ( innerPropValue === undefined ) {
+				innerPropValue = props[3];
+			}
+			*/
+
+			// cast value in its type
+			switch ( innerPropType1 ) {
+
+				case "int":
+					innerPropValue = parseInt( innerPropValue );
+					break;
+
+				case "double":
+					innerPropValue = parseFloat( innerPropValue );
+					break;
+
+				case "ColorRGB":
+				case "Vector3D":
+					var tmp = innerPropValue.split( ',' );
+					innerPropValue = new THREE.Vector3( tmp[ 0 ], tmp[ 1 ], tmp[ 2 ] );
+					break;
+
+			}
+
+			// CAUTION: these props must append to parent's parent
+			this.getPrevNode().properties[ innerPropName ] = {
+
+				'type': innerPropType1,
+				'type2': innerPropType2,
+				'flag': innerPropFlag,
+				'value': innerPropValue
+
+			};
+
+			this.setCurrentProp( this.getPrevNode().properties, innerPropName );
+
+		},
+
+		nodeEnd: function () {
+
+			this.popStack();
+
+		},
+
+		/* ---------------------------------------------------------------- */
+		/*		util													  */
+		isFlattenNode: function ( node ) {
+
+			return ( 'subNodes' in node && 'properties' in node ) ? true : false;
+
+		}
+
+	} );
+
+	function FBXTree() {}
+
+	Object.assign( FBXTree.prototype, {
+
+		add: function ( key, val ) {
+
+			this[ key ] = val;
+
+		},
+
+		searchConnectionParent: function ( id ) {
+
+			if ( this.__cache_search_connection_parent === undefined ) {
+
+				this.__cache_search_connection_parent = [];
+
+			}
+
+			if ( this.__cache_search_connection_parent[ id ] !== undefined ) {
+
+				return this.__cache_search_connection_parent[ id ];
+
+			} else {
+
+				this.__cache_search_connection_parent[ id ] = [];
+
+			}
+
+			var conns = this.Connections.properties.connections;
+
+			var results = [];
+			for ( var i = 0; i < conns.length; ++ i ) {
+
+				if ( conns[ i ][ 0 ] == id ) {
+
+					// 0 means scene root
+					var res = conns[ i ][ 1 ] === 0 ? - 1 : conns[ i ][ 1 ];
+					results.push( res );
+
+				}
+
+			}
+
+			if ( results.length > 0 ) {
+
+				this.__cache_search_connection_parent[ id ] = this.__cache_search_connection_parent[ id ].concat( results );
+				return results;
+
+			} else {
+
+				this.__cache_search_connection_parent[ id ] = [ - 1 ];
+				return [ - 1 ];
+
+			}
+
+		},
+
+		searchConnectionChildren: function ( id ) {
+
+			if ( this.__cache_search_connection_children === undefined ) {
+
+				this.__cache_search_connection_children = [];
+
+			}
+
+			if ( this.__cache_search_connection_children[ id ] !== undefined ) {
+
+				return this.__cache_search_connection_children[ id ];
+
+			} else {
+
+				this.__cache_search_connection_children[ id ] = [];
+
+			}
+
+			var conns = this.Connections.properties.connections;
+
+			var res = [];
+			for ( var i = 0; i < conns.length; ++ i ) {
+
+				if ( conns[ i ][ 1 ] == id ) {
+
+					// 0 means scene root
+					res.push( conns[ i ][ 0 ] === 0 ? - 1 : conns[ i ][ 0 ] );
+					// there may more than one kid, then search to the end
+
+				}
+
+			}
+
+			if ( res.length > 0 ) {
+
+				this.__cache_search_connection_children[ id ] = this.__cache_search_connection_children[ id ].concat( res );
+				return res;
+
+			} else {
+
+				this.__cache_search_connection_children[ id ] = [ ];
+				return [ ];
+
+			}
+
+		},
+
+		searchConnectionType: function ( id, to ) {
+
+			var key = id + ',' + to; // TODO: to hash
+			if ( this.__cache_search_connection_type === undefined ) {
+
+				this.__cache_search_connection_type = {};
+
+			}
+
+			if ( this.__cache_search_connection_type[ key ] !== undefined ) {
+
+				return this.__cache_search_connection_type[ key ];
+
+			} else {
+
+				this.__cache_search_connection_type[ key ] = '';
+
+			}
+
+			var conns = this.Connections.properties.connections;
+
+			for ( var i = 0; i < conns.length; ++ i ) {
+
+				if ( conns[ i ][ 0 ] == id && conns[ i ][ 1 ] == to ) {
+
+					// 0 means scene root
+					this.__cache_search_connection_type[ key ] = conns[ i ][ 2 ];
+					return conns[ i ][ 2 ];
+
+				}
+
+			}
+
+			this.__cache_search_connection_type[ id ] = null;
+			return null;
+
+		}
+
+	} );
+
+	/**
+	 * @returns {boolean}
+	 */
+	function isFbxFormatASCII( text ) {
+
+		var CORRECT = [ 'K', 'a', 'y', 'd', 'a', 'r', 'a', '\\', 'F', 'B', 'X', '\\', 'B', 'i', 'n', 'a', 'r', 'y', '\\', '\\' ];
+
+		var cursor = 0;
+		var read = function ( offset ) {
+
+			var result = text[ offset - 1 ];
+			text = text.slice( cursor + offset );
+			cursor ++;
+			return result;
+
+		};
+
+		for ( var i = 0; i < CORRECT.length; ++ i ) {
+
+			var num = read( 1 );
+			if ( num == CORRECT[ i ] ) {
+
+				return false;
+
+			}
+
+		}
+
+		return true;
+
+	}
+
+	/**
+	 * @returns {number}
+	 */
+	function getFbxVersion( text ) {
+
+		var versionRegExp = /FBXVersion: (\d+)/;
+		var match = text.match( versionRegExp );
+		if ( match ) {
+
+			var version = parseInt( match[ 1 ] );
+			return version;
+
+		}
+		throw new Error( 'FBXLoader: Cannot find the version number for the file given.' );
+
+	}
+
+	/**
+	 * Converts FBX ticks into real time seconds.
+	 * @param {number} time - FBX tick timestamp to convert.
+	 * @returns {number} - FBX tick in real world time.
+	 */
+	function ConvertFBXTimeToSeconds( time ) {
+
+		// Constant is FBX ticks per second.
+		return time / 46186158000;
+
+	}
+
+	/**
+	 * Parses comma separated list of float numbers and returns them in an array.
+	 * @example
+	 * // Returns [ 5.6, 9.4, 2.5, 1.4 ]
+	 * parseFloatArray( "5.6,9.4,2.5,1.4" )
+	 * @returns {number[]}
+	 */
+	function parseFloatArray( floatString ) {
+
+		return floatString.split( ',' ).map( function ( stringValue ) {
+
+			return parseFloat( stringValue );
+
+		} );
+
+	}
+
+	/**
+	 * Parses comma separated list of int numbers and returns them in an array.
+	 * @example
+	 * // Returns [ 5, 8, 2, 3 ]
+	 * parseFloatArray( "5,8,2,3" )
+	 * @returns {number[]}
+	 */
+	function parseIntArray( intString ) {
+
+		return intString.split( ',' ).map( function ( stringValue ) {
+
+			return parseInt( stringValue );
+
+		} );
+
+	}
+
+	function parseMatrixArray( floatString ) {
+
+		return new THREE.Matrix4().fromArray( parseFloatArray( floatString ) );
+
+	}
+
+	/**
+	 * Converts number from degrees into radians.
+	 * @param {number} value
+	 * @returns {number}
+	 */
+	function degreeToRadian( value ) {
+
+		return value * Math.PI / 180;
+
+	}
+
+} )();

+ 301 - 131
examples/js/loaders/GLTFLoader.js

@@ -24,9 +24,12 @@ THREE.GLTFLoader = ( function () {
 			var path = this.path && ( typeof this.path === "string" ) ? this.path : THREE.Loader.prototype.extractUrlBase( url );
 			var path = this.path && ( typeof this.path === "string" ) ? this.path : THREE.Loader.prototype.extractUrlBase( url );
 
 
 			var loader = new THREE.FileLoader( scope.manager );
 			var loader = new THREE.FileLoader( scope.manager );
-			loader.load( url, function ( text ) {
 
 
-				scope.parse( JSON.parse( text ), onLoad, path );
+			loader.setResponseType( 'arraybuffer' );
+
+			loader.load( url, function ( data ) {
+
+				scope.parse( data, onLoad, path );
 
 
 			}, onProgress, onError );
 			}, onProgress, onError );
 
 
@@ -44,11 +47,35 @@ THREE.GLTFLoader = ( function () {
 
 
 		},
 		},
 
 
-		parse: function ( json, callback, path ) {
+		parse: function ( data, callback, path ) {
+
+			var content;
+			var extensions = {};
+
+			var magic = convertUint8ArrayToString( new Uint8Array( data, 0, 4 ) );
+
+			if ( magic === BINARY_EXTENSION_HEADER_DEFAULTS.magic ) {
+
+				extensions[ EXTENSIONS.KHR_BINARY_GLTF ] = new GLTFBinaryExtension( data );
+				content = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].content;
+
+			} else {
+
+				content = convertUint8ArrayToString( new Uint8Array( data ) );
+
+			}
+
+			var json = JSON.parse( content );
+
+			if ( json.extensionsUsed && json.extensionsUsed.indexOf( EXTENSIONS.KHR_MATERIALS_COMMON ) >= 0 ) {
+
+				extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ] = new GLTFMaterialsCommonExtension( json );
+
+			}
 
 
 			console.time( 'GLTFLoader' );
 			console.time( 'GLTFLoader' );
 
 
-			var parser = new GLTFParser( json, {
+			var parser = new GLTFParser( json, extensions, {
 
 
 				path: path || this.path,
 				path: path || this.path,
 				crossOrigin: this.crossOrigin
 				crossOrigin: this.crossOrigin
@@ -255,6 +282,126 @@ THREE.GLTFLoader = ( function () {
 
 
 	};
 	};
 
 
+	/*********************************/
+	/********** EXTENSIONS ***********/
+	/*********************************/
+
+	var EXTENSIONS = {
+		KHR_BINARY_GLTF: 'KHR_binary_glTF',
+		KHR_MATERIALS_COMMON: 'KHR_materials_common'
+	};
+
+	/* MATERIALS COMMON EXTENSION */
+
+	function GLTFMaterialsCommonExtension( json ) {
+
+		this.name = EXTENSIONS.KHR_MATERIALS_COMMON;
+
+		this.lights = {};
+
+		var lights = json.extensions && json.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ].lights;
+
+		for ( var lightId in lights ) {
+
+			var light = lights[ lightId ];
+			var lightNode;
+
+			var lightParams = light[ light.type ];
+			var color = new THREE.Color().fromArray( lightParams.color );
+
+			switch ( light.type ) {
+
+				case "directional":
+					lightNode = new THREE.DirectionalLight( color );
+					lightNode.position.set( 0, 0, 1 );
+					break;
+
+				case "point":
+					lightNode = new THREE.PointLight( color );
+					break;
+
+				case "spot":
+					lightNode = new THREE.SpotLight( color );
+					lightNode.position.set( 0, 0, 1 );
+					break;
+
+				case "ambient":
+					lightNode = new THREE.AmbientLight( color );
+					break;
+
+			}
+
+			if ( lightNode ) {
+
+				this.lights[ lightId ] = lightNode;
+
+			}
+
+		}
+
+	}
+
+	/* BINARY EXTENSION */
+
+	var BINARY_EXTENSION_BUFFER_NAME = 'binary_glTF';
+
+	var BINARY_EXTENSION_HEADER_DEFAULTS = { magic: 'glTF', version: 1, contentFormat: 0 };
+
+	var BINARY_EXTENSION_HEADER_LENGTH = 20;
+
+	function GLTFBinaryExtension( data ) {
+
+		this.name = EXTENSIONS.KHR_BINARY_GLTF;
+
+		var headerView = new DataView( data, 0, BINARY_EXTENSION_HEADER_LENGTH );
+
+		var header = {
+			magic: convertUint8ArrayToString( new Uint8Array( data.slice( 0, 4 ) ) ),
+			version: headerView.getUint32( 4, true ),
+			length: headerView.getUint32( 8, true ),
+			contentLength: headerView.getUint32( 12, true ),
+			contentFormat: headerView.getUint32( 16, true )
+		};
+
+		for ( var key in BINARY_EXTENSION_HEADER_DEFAULTS ) {
+
+			var value = BINARY_EXTENSION_HEADER_DEFAULTS[ key ];
+
+			if ( header[ key ] !== value ) {
+
+				throw new Error( 'Unsupported glTF-Binary header: Expected "%s" to be "%s".', key, value );
+
+			}
+
+		}
+
+		var contentArray = new Uint8Array( data, BINARY_EXTENSION_HEADER_LENGTH, header.contentLength );
+
+		this.header = header;
+		this.content = convertUint8ArrayToString( contentArray );
+		this.body = data.slice( BINARY_EXTENSION_HEADER_LENGTH + header.contentLength, header.length );
+
+	}
+
+	GLTFBinaryExtension.prototype.loadShader = function ( shader, bufferViews ) {
+
+		var bufferView = bufferViews[ shader.extensions[ EXTENSIONS.KHR_BINARY_GLTF ].bufferView ];
+		var array = new Uint8Array( bufferView );
+
+		return convertUint8ArrayToString( array );
+
+	};
+
+	GLTFBinaryExtension.prototype.loadTextureSourceUri = function ( source, bufferViews ) {
+
+		var metadata = source.extensions[ EXTENSIONS.KHR_BINARY_GLTF ];
+		var bufferView = bufferViews[ metadata.bufferView ];
+		var stringData = convertUint8ArrayToString( new Uint8Array( bufferView ) );
+
+		return 'data:' + metadata.mimeType + ';base64,' + btoa( stringData );
+
+	};
+
 	/*********************************/
 	/*********************************/
 	/********** INTERNALS ************/
 	/********** INTERNALS ************/
 	/*********************************/
 	/*********************************/
@@ -316,6 +463,21 @@ THREE.GLTFLoader = ( function () {
 		10497: THREE.RepeatWrapping
 		10497: THREE.RepeatWrapping
 	};
 	};
 
 
+	var WEBGL_TEXTURE_FORMATS = {
+		6406: THREE.AlphaFormat,
+		6407: THREE.RGBFormat,
+		6408: THREE.RGBAFormat,
+		6409: THREE.LuminanceFormat,
+		6410: THREE.LuminanceAlphaFormat
+	};
+
+	var WEBGL_TEXTURE_DATATYPES = {
+		5121: THREE.UnsignedByteType,
+		32819: THREE.UnsignedShort4444Type,
+		32820: THREE.UnsignedShort5551Type,
+		33635: THREE.UnsignedShort565Type
+	};
+
 	var WEBGL_SIDES = {
 	var WEBGL_SIDES = {
 		1028: THREE.BackSide,  // Culling front
 		1028: THREE.BackSide,  // Culling front
 		1029: THREE.FrontSide  // Culling back
 		1029: THREE.FrontSide  // Culling back
@@ -471,6 +633,22 @@ THREE.GLTFLoader = ( function () {
 
 
 	}
 	}
 
 
+	// Avoid the String.fromCharCode.apply(null, array) shortcut, which
+	// throws a "maximum call stack size exceeded" error for large arrays.
+	function convertUint8ArrayToString( array ) {
+
+		var s = '';
+
+		for ( var i = 0; i < array.length; i ++ ) {
+
+			s += String.fromCharCode( array[ i ] );
+
+		}
+
+		return s;
+
+	}
+
 	// Three.js seems too dependent on attribute names so globally
 	// Three.js seems too dependent on attribute names so globally
 	// replace those in the shader code
 	// replace those in the shader code
 	function replaceTHREEShaderAttributes( shaderText, technique ) {
 	function replaceTHREEShaderAttributes( shaderText, technique ) {
@@ -575,7 +753,7 @@ THREE.GLTFLoader = ( function () {
 			side: THREE.FrontSide
 			side: THREE.FrontSide
 		} );
 		} );
 
 
-	};
+	}
 
 
 	// Deferred constructor for RawShaderMaterial types
 	// Deferred constructor for RawShaderMaterial types
 	function DeferredShaderMaterial( params ) {
 	function DeferredShaderMaterial( params ) {
@@ -614,9 +792,10 @@ THREE.GLTFLoader = ( function () {
 
 
 	/* GLTF PARSER */
 	/* GLTF PARSER */
 
 
-	function GLTFParser( json, options ) {
+	function GLTFParser( json, extensions, options ) {
 
 
 		this.json = json || {};
 		this.json = json || {};
+		this.extensions = extensions || {};
 		this.options = options || {};
 		this.options = options || {};
 
 
 		// loader object cache
 		// loader object cache
@@ -710,17 +889,32 @@ THREE.GLTFLoader = ( function () {
 	GLTFParser.prototype.loadShaders = function () {
 	GLTFParser.prototype.loadShaders = function () {
 
 
 		var json = this.json;
 		var json = this.json;
+		var extensions = this.extensions;
 		var options = this.options;
 		var options = this.options;
 
 
-		return _each( json.shaders, function ( shader ) {
+		return this._withDependencies( [
+
+			"bufferViews"
+
+		] ).then( function ( dependencies ) {
+
+			return _each( json.shaders, function ( shader ) {
+
+				if ( shader.extensions && shader.extensions[ EXTENSIONS.KHR_BINARY_GLTF ] ) {
+
+					return extensions[ EXTENSIONS.KHR_BINARY_GLTF ].loadShader( shader, dependencies.bufferViews );
 
 
-			return new Promise( function ( resolve ) {
+				}
 
 
-				var loader = new THREE.FileLoader();
-				loader.setResponseType( 'text' );
-				loader.load( resolveURL( shader.uri, options.path ), function ( shaderText ) {
+				return new Promise( function ( resolve ) {
 
 
-					resolve( shaderText );
+					var loader = new THREE.FileLoader();
+					loader.setResponseType( 'text' );
+					loader.load( resolveURL( shader.uri, options.path ), function ( shaderText ) {
+
+						resolve( shaderText );
+
+					} );
 
 
 				} );
 				} );
 
 
@@ -733,9 +927,16 @@ THREE.GLTFLoader = ( function () {
 	GLTFParser.prototype.loadBuffers = function () {
 	GLTFParser.prototype.loadBuffers = function () {
 
 
 		var json = this.json;
 		var json = this.json;
+		var extensions = this.extensions;
 		var options = this.options;
 		var options = this.options;
 
 
-		return _each( json.buffers, function ( buffer ) {
+		return _each( json.buffers, function ( buffer, name ) {
+
+			if ( name === BINARY_EXTENSION_BUFFER_NAME ) {
+
+				return extensions[ EXTENSIONS.KHR_BINARY_GLTF ].body;
+
+			}
 
 
 			if ( buffer.type === 'arraybuffer' || buffer.type === undefined ) {
 			if ( buffer.type === 'arraybuffer' || buffer.type === undefined ) {
 
 
@@ -775,7 +976,9 @@ THREE.GLTFLoader = ( function () {
 
 
 				var arraybuffer = dependencies.buffers[ bufferView.buffer ];
 				var arraybuffer = dependencies.buffers[ bufferView.buffer ];
 
 
-				return arraybuffer.slice( bufferView.byteOffset, bufferView.byteOffset + bufferView.byteLength );
+				var byteLength = bufferView.byteLength !== undefined ? bufferView.byteLength : 0;
+
+				return arraybuffer.slice( bufferView.byteOffset, bufferView.byteOffset + byteLength );
 
 
 			} );
 			} );
 
 
@@ -831,52 +1034,81 @@ THREE.GLTFLoader = ( function () {
 	GLTFParser.prototype.loadTextures = function () {
 	GLTFParser.prototype.loadTextures = function () {
 
 
 		var json = this.json;
 		var json = this.json;
+		var extensions = this.extensions;
 		var options = this.options;
 		var options = this.options;
 
 
-		return _each( json.textures, function ( texture ) {
-
-			if ( texture.source ) {
+		return this._withDependencies( [
 
 
-				return new Promise( function ( resolve ) {
+			"bufferViews"
 
 
-					var source = json.images[ texture.source ];
+		] ).then( function ( dependencies ) {
 
 
-					var textureLoader = THREE.Loader.Handlers.get( source.uri );
+			return _each( json.textures, function ( texture ) {
 
 
-					if ( textureLoader === null ) {
+				if ( texture.source ) {
 
 
-						textureLoader = new THREE.TextureLoader();
+					return new Promise( function ( resolve ) {
 
 
-					}
+						var source = json.images[ texture.source ];
+						var sourceUri = source.uri;
 
 
-					textureLoader.setCrossOrigin( options.crossOrigin );
+						if ( source.extensions && source.extensions[ EXTENSIONS.KHR_BINARY_GLTF ] ) {
 
 
-					textureLoader.load( resolveURL( source.uri, options.path ), function ( _texture ) {
+							sourceUri = extensions[ EXTENSIONS.KHR_BINARY_GLTF ].loadTextureSourceUri( source, dependencies.bufferViews );
 
 
-						_texture.flipY = false;
+						}
 
 
-						if ( texture.sampler ) {
+						var textureLoader = THREE.Loader.Handlers.get( sourceUri );
 
 
-							var sampler = json.samplers[ texture.sampler ];
+						if ( textureLoader === null ) {
 
 
-							_texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ];
-							_texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ];
-							_texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ];
-							_texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ];
+							textureLoader = new THREE.TextureLoader();
 
 
 						}
 						}
 
 
-						resolve( _texture );
+						textureLoader.setCrossOrigin( options.crossOrigin );
+
+						textureLoader.load( resolveURL( sourceUri, options.path ), function ( _texture ) {
+
+							_texture.flipY = false;
+
+							if ( texture.name !== undefined ) _texture.name = texture.name;
+
+							_texture.format = texture.format !== undefined ? WEBGL_TEXTURE_FORMATS[ texture.format ] : THREE.RGBAFormat;
+
+							if ( texture.internalFormat !== undefined && _texture.format !== WEBGL_TEXTURE_FORMATS[ texture.internalFormat ] ) {
+
+								console.warn( 'THREE.GLTFLoader: Three.js doesn\'t support texture internalFormat which is different from texture format. ' +
+								              'internalFormat will be forced to be the same value as format.' );
+
+							}
 
 
-					}, undefined, function () {
+							_texture.type = texture.type !== undefined ? WEBGL_TEXTURE_DATATYPES[ texture.type ] : THREE.UnsignedByteType;
 
 
-						resolve();
+							if ( texture.sampler ) {
+
+								var sampler = json.samplers[ texture.sampler ];
+
+								_texture.magFilter = WEBGL_FILTERS[ sampler.magFilter ];
+								_texture.minFilter = WEBGL_FILTERS[ sampler.minFilter ];
+								_texture.wrapS = WEBGL_WRAPPINGS[ sampler.wrapS ];
+								_texture.wrapT = WEBGL_WRAPPINGS[ sampler.wrapT ];
+
+							}
+
+							resolve( _texture );
+
+						}, undefined, function () {
+
+							resolve();
+
+						} );
 
 
 					} );
 					} );
 
 
-				} );
+				}
 
 
-			}
+			} );
 
 
 		} );
 		} );
 
 
@@ -901,13 +1133,9 @@ THREE.GLTFLoader = ( function () {
 
 
 				var khr_material;
 				var khr_material;
 
 
-				if ( material.extensions && material.extensions.KHR_materials_common ) {
-
-					khr_material = material.extensions.KHR_materials_common;
-
-				} else if ( json.extensions && json.extensions.KHR_materials_common ) {
+				if ( material.extensions && material.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ] ) {
 
 
-					khr_material = json.extensions.KHR_materials_common;
+					khr_material = material.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ];
 
 
 				}
 				}
 
 
@@ -1140,7 +1368,7 @@ THREE.GLTFLoader = ( function () {
 
 
 							var enable = enables[ i ];
 							var enable = enables[ i ];
 
 
-							switch( STATES_ENABLES[ enable ] ) {
+							switch ( STATES_ENABLES[ enable ] ) {
 
 
 								case 'CULL_FACE':
 								case 'CULL_FACE':
 
 
@@ -1323,7 +1551,7 @@ THREE.GLTFLoader = ( function () {
 
 
 				if ( mesh.extras ) group.userData = mesh.extras;
 				if ( mesh.extras ) group.userData = mesh.extras;
 
 
-				var primitives = mesh.primitives;
+				var primitives = mesh.primitives || [];
 
 
 				for ( var name in primitives ) {
 				for ( var name in primitives ) {
 
 
@@ -1413,7 +1641,7 @@ THREE.GLTFLoader = ( function () {
 								case 'POSITION':
 								case 'POSITION':
 									geometry.addAttribute( 'position', bufferAttribute );
 									geometry.addAttribute( 'position', bufferAttribute );
 									break;
 									break;
-				
+
 								case 'COLOR_0':
 								case 'COLOR_0':
 								case 'COLOR0':
 								case 'COLOR0':
 								case 'COLOR':
 								case 'COLOR':
@@ -1421,7 +1649,8 @@ THREE.GLTFLoader = ( function () {
 									break;
 									break;
 
 
 							}
 							}
-						};
+
+						}
 
 
 						var material = dependencies.materials[ primitive.material ];
 						var material = dependencies.materials[ primitive.material ];
 
 
@@ -1470,18 +1699,13 @@ THREE.GLTFLoader = ( function () {
 			if ( camera.type == "perspective" && camera.perspective ) {
 			if ( camera.type == "perspective" && camera.perspective ) {
 
 
 				var yfov = camera.perspective.yfov;
 				var yfov = camera.perspective.yfov;
-				var xfov = camera.perspective.xfov;
-				var aspect_ratio = camera.perspective.aspect_ratio || 1;
+				var aspectRatio = camera.perspective.aspectRatio !== undefined ? camera.perspective.aspectRatio : 1;
 
 
 				// According to COLLADA spec...
 				// According to COLLADA spec...
-				// aspect_ratio = xfov / yfov
-				xfov = ( xfov === undefined && yfov ) ? yfov * aspect_ratio : xfov;
+				// aspectRatio = xfov / yfov
+				var xfov = yfov * aspectRatio;
 
 
-				// According to COLLADA spec...
-				// aspect_ratio = xfov / yfov
-				// yfov = ( yfov === undefined && xfov ) ? xfov / aspect_ratio : yfov;
-
-				var _camera = new THREE.PerspectiveCamera( THREE.Math.radToDeg( xfov ), aspect_ratio, camera.perspective.znear || 1, camera.perspective.zfar || 2e6 );
+				var _camera = new THREE.PerspectiveCamera( THREE.Math.radToDeg( xfov ), aspectRatio, camera.perspective.znear || 1, camera.perspective.zfar || 2e6 );
 				if ( camera.name !== undefined ) _camera.name = camera.name;
 				if ( camera.name !== undefined ) _camera.name = camera.name;
 
 
 				if ( camera.extras ) _camera.userData = camera.extras;
 				if ( camera.extras ) _camera.userData = camera.extras;
@@ -1515,8 +1739,12 @@ THREE.GLTFLoader = ( function () {
 
 
 			return _each( json.skins, function ( skin ) {
 			return _each( json.skins, function ( skin ) {
 
 
+				var bindShapeMatrix = new THREE.Matrix4();
+
+				if ( skin.bindShapeMatrix !== undefined ) bindShapeMatrix.fromArray( skin.bindShapeMatrix );
+
 				var _skin = {
 				var _skin = {
-					bindShapeMatrix: new THREE.Matrix4().fromArray( skin.bindShapeMatrix ),
+					bindShapeMatrix: bindShapeMatrix,
 					jointNames: skin.jointNames,
 					jointNames: skin.jointNames,
 					inverseBindMatrices: dependencies.accessors[ skin.inverseBindMatrices ]
 					inverseBindMatrices: dependencies.accessors[ skin.inverseBindMatrices ]
 				};
 				};
@@ -1571,6 +1799,7 @@ THREE.GLTFLoader = ( function () {
 								: THREE.VectorKeyframeTrack;
 								: THREE.VectorKeyframeTrack;
 
 
 							var targetName = node.name ? node.name : node.uuid;
 							var targetName = node.name ? node.name : node.uuid;
+							var interpolation = sampler.interpolation !== undefined ? INTERPOLATION[ sampler.interpolation ] : THREE.InterpolateLinear;
 
 
 							// KeyframeTrack.optimize() will modify given 'times' and 'values'
 							// KeyframeTrack.optimize() will modify given 'times' and 'values'
 							// buffers before creating a truncated copy to keep. Because buffers may
 							// buffers before creating a truncated copy to keep. Because buffers may
@@ -1579,7 +1808,7 @@ THREE.GLTFLoader = ( function () {
 								targetName + '.' + PATH_PROPERTIES[ target.path ],
 								targetName + '.' + PATH_PROPERTIES[ target.path ],
 								THREE.AnimationUtils.arraySlice( inputAccessor.array, 0 ),
 								THREE.AnimationUtils.arraySlice( inputAccessor.array, 0 ),
 								THREE.AnimationUtils.arraySlice( outputAccessor.array, 0 ),
 								THREE.AnimationUtils.arraySlice( outputAccessor.array, 0 ),
-								INTERPOLATION[ sampler.interpolation ]
+								interpolation
 							) );
 							) );
 
 
 						}
 						}
@@ -1588,7 +1817,9 @@ THREE.GLTFLoader = ( function () {
 
 
 				}
 				}
 
 
-				return new THREE.AnimationClip( "animation_" + animationId, undefined, tracks );
+				var name = animation.name !== undefined ? animation.name : "animation_" + animationId;
+
+				return new THREE.AnimationClip( name, undefined, tracks );
 
 
 			} );
 			} );
 
 
@@ -1599,6 +1830,7 @@ THREE.GLTFLoader = ( function () {
 	GLTFParser.prototype.loadNodes = function () {
 	GLTFParser.prototype.loadNodes = function () {
 
 
 		var json = this.json;
 		var json = this.json;
+		var extensions = this.extensions;
 		var scope = this;
 		var scope = this;
 
 
 		return _each( json.nodes, function ( node ) {
 		return _each( json.nodes, function ( node ) {
@@ -1657,8 +1889,7 @@ THREE.GLTFLoader = ( function () {
 
 
 				"meshes",
 				"meshes",
 				"skins",
 				"skins",
-				"cameras",
-				"extensions"
+				"cameras"
 
 
 			] ).then( function ( dependencies ) {
 			] ).then( function ( dependencies ) {
 
 
@@ -1747,7 +1978,7 @@ THREE.GLTFLoader = ( function () {
 
 
 										return null;
 										return null;
 
 
-									}
+									};
 
 
 									var geometry = originalGeometry;
 									var geometry = originalGeometry;
 									var material = originalMaterial;
 									var material = originalMaterial;
@@ -1805,7 +2036,7 @@ THREE.GLTFLoader = ( function () {
 
 
 										}
 										}
 
 
-									}
+									};
 
 
 									buildBoneGraph( node, child, 'skeletons' );
 									buildBoneGraph( node, child, 'skeletons' );
 
 
@@ -1827,9 +2058,12 @@ THREE.GLTFLoader = ( function () {
 
 
 					}
 					}
 
 
-					if ( node.extensions && node.extensions.KHR_materials_common && node.extensions.KHR_materials_common.light ) {
+					if ( node.extensions
+							 && node.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ]
+							 && node.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ].light ) {
 
 
-						var light = dependencies.extensions.KHR_materials_common.lights[ node.extensions.KHR_materials_common.light ];
+						var extensionLights = extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ].lights;
+						var light = extensionLights[ node.extensions[ EXTENSIONS.KHR_MATERIALS_COMMON ].light ];
 
 
 						_node.add( light );
 						_node.add( light );
 
 
@@ -1845,70 +2079,6 @@ THREE.GLTFLoader = ( function () {
 
 
 	};
 	};
 
 
-	GLTFParser.prototype.loadExtensions = function () {
-
-		var json = this.json;
-
-		return _each( json.extensions, function ( extension, extensionId ) {
-
-			switch ( extensionId ) {
-
-				case "KHR_materials_common":
-
-					var extensionNode = {
-						lights: {}
-					};
-
-					var lights = extension.lights;
-
-					for ( var lightId in lights ) {
-
-						var light = lights[ lightId ];
-						var lightNode;
-
-						var lightParams = light[ light.type ];
-						var color = new THREE.Color().fromArray( lightParams.color );
-
-						switch ( light.type ) {
-
-							case "directional":
-								lightNode = new THREE.DirectionalLight( color );
-								lightNode.position.set( 0, 0, 1 );
-								break;
-
-							case "point":
-								lightNode = new THREE.PointLight( color );
-								break;
-
-							case "spot":
-								lightNode = new THREE.SpotLight( color );
-								lightNode.position.set( 0, 0, 1 );
-								break;
-
-							case "ambient":
-								lightNode = new THREE.AmbientLight( color );
-								break;
-
-						}
-
-						if ( lightNode ) {
-
-							extensionNode.lights[ lightId ] = lightNode;
-
-						}
-
-					}
-
-					return extensionNode;
-
-					break;
-
-			}
-
-		} );
-
-	};
-
 	GLTFParser.prototype.loadScenes = function () {
 	GLTFParser.prototype.loadScenes = function () {
 
 
 		var json = this.json;
 		var json = this.json;
@@ -1950,7 +2120,7 @@ THREE.GLTFLoader = ( function () {
 
 
 				if ( scene.extras ) _scene.userData = scene.extras;
 				if ( scene.extras ) _scene.userData = scene.extras;
 
 
-				var nodes = scene.nodes;
+				var nodes = scene.nodes || [];
 
 
 				for ( var i = 0, l = nodes.length; i < l; i ++ ) {
 				for ( var i = 0, l = nodes.length; i < l; i ++ ) {
 
 
@@ -1981,4 +2151,4 @@ THREE.GLTFLoader = ( function () {
 
 
 	return GLTFLoader;
 	return GLTFLoader;
 
 
-} )();
+} )();

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

@@ -1477,7 +1477,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 
 	var initGeometry = function () {
 	var initGeometry = function () {
 
 
-		geometry.setIndex( new ( buffer.indices.length > 65535 ? THREE.Uint32BufferAttribute : THREE.Uint16BufferAttribute )( buffer.indices, 1 ) );
+		geometry.setIndex( buffer.indices );
 		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
 		geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
 		geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( buffer.normals, 3 ) );
 		geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( buffer.normals, 3 ) );
 		geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.uvs, 2 ) );
 		geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( buffer.uvs, 2 ) );

+ 4 - 1
examples/js/loaders/PLYLoader.js

@@ -313,8 +313,11 @@ THREE.PLYLoader.prototype = {
 			// mandatory buffer data
 			// mandatory buffer data
 
 
 			if ( buffer.indices.length > 0 ) {
 			if ( buffer.indices.length > 0 ) {
-				geometry.setIndex( new ( buffer.indices.length > 65535 ? THREE.Uint32BufferAttribute : THREE.Uint16BufferAttribute )( buffer.indices, 1 ) );
+
+				geometry.setIndex( buffer.indices );
+
 			}
 			}
+
 			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
 			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( buffer.vertices, 3 ) );
 
 
 			// optional buffer data
 			// optional buffer data

+ 7 - 1
examples/js/pmrem/PMREMCubeUVPacker.js

@@ -31,7 +31,13 @@ THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
 		encoding: sourceTexture.encoding
 		encoding: sourceTexture.encoding
 	};
 	};
 
 
+	if( sourceTexture.encoding === THREE.RGBM16Encoding ) {
+		params.magFilter = THREE.LinearFilter;
+		params.minFilter = THREE.LinearFilter;
+	}
+
 	this.CubeUVRenderTarget = new THREE.WebGLRenderTarget( size, size, params );
 	this.CubeUVRenderTarget = new THREE.WebGLRenderTarget( size, size, params );
+	this.CubeUVRenderTarget.texture.name = "PMREMCubeUVPacker.cubeUv";
 	this.CubeUVRenderTarget.texture.mapping = THREE.CubeUVReflectionMapping;
 	this.CubeUVRenderTarget.texture.mapping = THREE.CubeUVReflectionMapping;
 	this.camera = new THREE.OrthographicCamera( - size * 0.5, size * 0.5, - size * 0.5, size * 0.5, 0.0, 1000 );
 	this.camera = new THREE.OrthographicCamera( - size * 0.5, size * 0.5, - size * 0.5, size * 0.5, 0.0, 1000 );
 
 
@@ -53,7 +59,7 @@ THREE.PMREMCubeUVPacker = function( cubeTextureLods, numLods ) {
 
 
 	var offset2 = 0;
 	var offset2 = 0;
 	var c = 4.0;
 	var c = 4.0;
-	this.numLods = Math.log2( cubeTextureLods[ 0 ].width ) - 2;
+	this.numLods = Math.log( cubeTextureLods[ 0 ].width ) / Math.log( 2 ) - 2; // IE11 doesn't support Math.log2
 	for ( var i = 0; i < this.numLods; i ++ ) {
 	for ( var i = 0; i < this.numLods; i ++ ) {
 
 
 		var offset1 = ( textureResolution - textureResolution / c ) * 0.5;
 		var offset1 = ( textureResolution - textureResolution / c ) * 0.5;

+ 17 - 7
examples/js/pmrem/PMREMGenerator.js

@@ -11,10 +11,11 @@
  *	by this class.
  *	by this class.
  */
  */
 
 
-THREE.PMREMGenerator = function( sourceTexture ) {
+THREE.PMREMGenerator = function( sourceTexture, samplesPerLevel, resolution ) {
 
 
 	this.sourceTexture = sourceTexture;
 	this.sourceTexture = sourceTexture;
-	this.resolution = 256; // NODE: 256 is currently hard coded in the glsl code for performance reasons
+	this.resolution = ( resolution !== undefined ) ? resolution : 256; // NODE: 256 is currently hard coded in the glsl code for performance reasons
+	this.samplesPerLevel = ( samplesPerLevel !== undefined ) ? samplesPerLevel : 16;
 
 
 	var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
 	var monotonicEncoding = ( sourceTexture.encoding === THREE.LinearEncoding ) ||
 		( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );
 		( sourceTexture.encoding === THREE.GammaEncoding ) || ( sourceTexture.encoding === THREE.sRGBEncoding );
@@ -37,11 +38,12 @@ THREE.PMREMGenerator = function( sourceTexture ) {
 	 };
 	 };
 
 
 	// how many LODs fit in the given CubeUV Texture.
 	// how many LODs fit in the given CubeUV Texture.
-	this.numLods = Math.log2( size ) - 2;
+	this.numLods = Math.log( size ) / Math.log( 2 ) - 2;  // IE11 doesn't support Math.log2
 
 
 	for ( var i = 0; i < this.numLods; i ++ ) {
 	for ( var i = 0; i < this.numLods; i ++ ) {
 
 
 		var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );
 		var renderTarget = new THREE.WebGLRenderTargetCube( size, size, params );
+		renderTarget.texture.name = "PMREMGenerator.cube" + i;
 		this.cubeLods.push( renderTarget );
 		this.cubeLods.push( renderTarget );
 		size = Math.max( 16, size / 2 );
 		size = Math.max( 16, size / 2 );
 
 
@@ -50,6 +52,7 @@ THREE.PMREMGenerator = function( sourceTexture ) {
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0.0, 1000 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0.0, 1000 );
 
 
 	this.shader = this.getShader();
 	this.shader = this.getShader();
+	this.shader.defines['SAMPLES_PER_LEVEL'] = this.samplesPerLevel;
 	this.planeMesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2, 0 ), this.shader );
 	this.planeMesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2, 0 ), this.shader );
 	this.planeMesh.material.side = THREE.DoubleSide;
 	this.planeMesh.material.side = THREE.DoubleSide;
 	this.scene = new THREE.Scene();
 	this.scene = new THREE.Scene();
@@ -97,6 +100,7 @@ THREE.PMREMGenerator.prototype = {
 
 
 			var r = i / ( this.numLods - 1 );
 			var r = i / ( this.numLods - 1 );
 			this.shader.uniforms[ 'roughness' ].value = r * 0.9; // see comment above, pragmatic choice
 			this.shader.uniforms[ 'roughness' ].value = r * 0.9; // see comment above, pragmatic choice
+			this.shader.uniforms[ 'queryScale' ].value.x = ( i == 0 ) ? -1 : 1;
 			var size = this.cubeLods[ i ].width;
 			var size = this.cubeLods[ i ].width;
 			this.shader.uniforms[ 'mapSize' ].value = size;
 			this.shader.uniforms[ 'mapSize' ].value = size;
 			this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] );
 			this.renderToCubeMapTarget( renderer, this.cubeLods[ i ] );
@@ -134,12 +138,17 @@ THREE.PMREMGenerator.prototype = {
 
 
 		return new THREE.ShaderMaterial( {
 		return new THREE.ShaderMaterial( {
 
 
+			defines: {
+				"SAMPLES_PER_LEVEL": 20,
+			},
+
 			uniforms: {
 			uniforms: {
 				"faceIndex": { value: 0 },
 				"faceIndex": { value: 0 },
 				"roughness": { value: 0.5 },
 				"roughness": { value: 0.5 },
 				"mapSize": { value: 0.5 },
 				"mapSize": { value: 0.5 },
 				"envMap": { value: null },
 				"envMap": { value: null },
-				"testColor": { value: new THREE.Vector3( 1, 1, 1 ) }
+				"queryScale": { value: new THREE.Vector3( 1, 1, 1 ) },
+				"testColor": { value: new THREE.Vector3( 1, 1, 1 ) },
 			},
 			},
 
 
 			vertexShader:
 			vertexShader:
@@ -157,6 +166,7 @@ THREE.PMREMGenerator.prototype = {
 				uniform samplerCube envMap;\n\
 				uniform samplerCube envMap;\n\
 				uniform float mapSize;\n\
 				uniform float mapSize;\n\
 				uniform vec3 testColor;\n\
 				uniform vec3 testColor;\n\
+				uniform vec3 queryScale;\n\
 				\n\
 				\n\
 				float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\
 				float GGXRoughnessToBlinnExponent( const in float ggxRoughness ) {\n\
 					float a = ggxRoughness + 0.0001;\n\
 					float a = ggxRoughness + 0.0001;\n\
@@ -227,12 +237,12 @@ THREE.PMREMGenerator.prototype = {
 					} else {\n\
 					} else {\n\
 						sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n\
 						sampleDirection = vec3(-uv.x, -uv.y, -1.0);\n\
 					}\n\
 					}\n\
-					mat3 vecSpace = matrixFromVector(normalize(sampleDirection));\n\
+					mat3 vecSpace = matrixFromVector(normalize(sampleDirection * queryScale));\n\
 					vec3 rgbColor = vec3(0.0);\n\
 					vec3 rgbColor = vec3(0.0);\n\
-					const int NumSamples = 1024;\n\
+					const int NumSamples = SAMPLES_PER_LEVEL;\n\
 					vec3 vect;\n\
 					vec3 vect;\n\
 					float weight = 0.0;\n\
 					float weight = 0.0;\n\
-					for(int i=0; i<NumSamples; i++) {\n\
+					for( int i = 0; i < NumSamples; i ++ ) {\n\
 						float sini = sin(float(i));\n\
 						float sini = sin(float(i));\n\
 						float cosi = cos(float(i));\n\
 						float cosi = cos(float(i));\n\
 						float r = rand(vec2(sini, cosi));\n\
 						float r = rand(vec2(sini, cosi));\n\

+ 3 - 0
examples/js/postprocessing/AdaptiveToneMappingPass.js

@@ -191,14 +191,17 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 		var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat }; // was RGB format. changed to RGBA format. see discussion in #8415 / #8450
 		var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat }; // was RGB format. changed to RGBA format. see discussion in #8415 / #8450
 
 
 		this.luminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
 		this.luminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
+		this.luminanceRT.texture.name = "AdaptiveToneMappingPass.l";
 		this.luminanceRT.texture.generateMipmaps = false;
 		this.luminanceRT.texture.generateMipmaps = false;
 
 
 		this.previousLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
 		this.previousLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
+		this.previousLuminanceRT.texture.name = "AdaptiveToneMappingPass.pl";
 		this.previousLuminanceRT.texture.generateMipmaps = false;
 		this.previousLuminanceRT.texture.generateMipmaps = false;
 
 
 		// We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader
 		// We only need mipmapping for the current luminosity because we want a down-sampled version to sample in our adaptive shader
 		pars.minFilter = THREE.LinearMipMapLinearFilter;
 		pars.minFilter = THREE.LinearMipMapLinearFilter;
 		this.currentLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
 		this.currentLuminanceRT = new THREE.WebGLRenderTarget( this.resolution, this.resolution, pars );
+		this.currentLuminanceRT.texture.name = "AdaptiveToneMappingPass.cl";
 
 
 		if ( this.adaptive ) {
 		if ( this.adaptive ) {
 
 

+ 2 - 0
examples/js/postprocessing/BloomPass.js

@@ -16,7 +16,9 @@ THREE.BloomPass = function ( strength, kernelSize, sigma, resolution ) {
 	var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
 	var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat };
 
 
 	this.renderTargetX = new THREE.WebGLRenderTarget( resolution, resolution, pars );
 	this.renderTargetX = new THREE.WebGLRenderTarget( resolution, resolution, pars );
+	this.renderTargetX.texture.name = "BloomPass.x";
 	this.renderTargetY = new THREE.WebGLRenderTarget( resolution, resolution, pars );
 	this.renderTargetY = new THREE.WebGLRenderTarget( resolution, resolution, pars );
+	this.renderTargetY.texture.name = "BloomPass.y";
 
 
 	// copy material
 	// copy material
 
 

+ 2 - 0
examples/js/postprocessing/BokehPass.js

@@ -25,8 +25,10 @@ THREE.BokehPass = function ( scene, camera, params ) {
 		magFilter: THREE.LinearFilter,
 		magFilter: THREE.LinearFilter,
 		format: THREE.RGBFormat
 		format: THREE.RGBFormat
 	} );
 	} );
+	this.renderTargetColor.texture.name = "BokehPass.color";
 
 
 	this.renderTargetDepth = this.renderTargetColor.clone();
 	this.renderTargetDepth = this.renderTargetColor.clone();
+	this.renderTargetDepth.texture.name = "BokehPass.depth";
 
 
 	// depth material
 	// depth material
 
 

+ 2 - 1
examples/js/postprocessing/EffectComposer.js

@@ -16,11 +16,12 @@ THREE.EffectComposer = function ( renderer, renderTarget ) {
 		};
 		};
 		var size = renderer.getSize();
 		var size = renderer.getSize();
 		renderTarget = new THREE.WebGLRenderTarget( size.width, size.height, parameters );
 		renderTarget = new THREE.WebGLRenderTarget( size.width, size.height, parameters );
-
+		renderTarget.texture.name = "EffectComposer.rt1";
 	}
 	}
 
 
 	this.renderTarget1 = renderTarget;
 	this.renderTarget1 = renderTarget;
 	this.renderTarget2 = renderTarget.clone();
 	this.renderTarget2 = renderTarget.clone();
+	this.renderTarget2.texture.name = "EffectComposer.rt2";
 
 
 	this.writeBuffer = this.renderTarget1;
 	this.writeBuffer = this.renderTarget1;
 	this.readBuffer = this.renderTarget2;
 	this.readBuffer = this.renderTarget2;

+ 7 - 0
examples/js/postprocessing/OutlinePass.js

@@ -28,6 +28,7 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
 	this.maskBufferMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff } );
 	this.maskBufferMaterial = new THREE.MeshBasicMaterial( { color: 0xffffff } );
 	this.maskBufferMaterial.side = THREE.DoubleSide;
 	this.maskBufferMaterial.side = THREE.DoubleSide;
 	this.renderTargetMaskBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
 	this.renderTargetMaskBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
+	this.renderTargetMaskBuffer.texture.name = "OutlinePass.mask";
 	this.renderTargetMaskBuffer.texture.generateMipmaps = false;
 	this.renderTargetMaskBuffer.texture.generateMipmaps = false;
 
 
 	this.depthMaterial = new THREE.MeshDepthMaterial();
 	this.depthMaterial = new THREE.MeshDepthMaterial();
@@ -39,20 +40,26 @@ THREE.OutlinePass = function ( resolution, scene, camera, selectedObjects ) {
 	this.prepareMaskMaterial.side = THREE.DoubleSide;
 	this.prepareMaskMaterial.side = THREE.DoubleSide;
 
 
 	this.renderTargetDepthBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
 	this.renderTargetDepthBuffer = new THREE.WebGLRenderTarget( this.resolution.x, this.resolution.y, pars );
+	this.renderTargetDepthBuffer.texture.name = "OutlinePass.depth";
 	this.renderTargetDepthBuffer.texture.generateMipmaps = false;
 	this.renderTargetDepthBuffer.texture.generateMipmaps = false;
 
 
 	this.renderTargetMaskDownSampleBuffer = new THREE.WebGLRenderTarget( resx, resy, pars );
 	this.renderTargetMaskDownSampleBuffer = new THREE.WebGLRenderTarget( resx, resy, pars );
+	this.renderTargetMaskDownSampleBuffer.texture.name = "OutlinePass.depthDownSample";
 	this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false;
 	this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps = false;
 
 
 	this.renderTargetBlurBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
 	this.renderTargetBlurBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
+	this.renderTargetBlurBuffer1.texture.name = "OutlinePass.blur1";
 	this.renderTargetBlurBuffer1.texture.generateMipmaps = false;
 	this.renderTargetBlurBuffer1.texture.generateMipmaps = false;
 	this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
 	this.renderTargetBlurBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
+	this.renderTargetBlurBuffer2.texture.name = "OutlinePass.blur2";
 	this.renderTargetBlurBuffer2.texture.generateMipmaps = false;
 	this.renderTargetBlurBuffer2.texture.generateMipmaps = false;
 
 
 	this.edgeDetectionMaterial = this.getEdgeDetectionMaterial();
 	this.edgeDetectionMaterial = this.getEdgeDetectionMaterial();
 	this.renderTargetEdgeBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
 	this.renderTargetEdgeBuffer1 = new THREE.WebGLRenderTarget( resx, resy, pars );
+	this.renderTargetEdgeBuffer1.texture.name = "OutlinePass.edge1";
 	this.renderTargetEdgeBuffer1.texture.generateMipmaps = false;
 	this.renderTargetEdgeBuffer1.texture.generateMipmaps = false;
 	this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
 	this.renderTargetEdgeBuffer2 = new THREE.WebGLRenderTarget( Math.round( resx / 2 ), Math.round( resy / 2 ), pars );
+	this.renderTargetEdgeBuffer2.texture.name = "OutlinePass.edge2";
 	this.renderTargetEdgeBuffer2.texture.generateMipmaps = false;
 	this.renderTargetEdgeBuffer2.texture.generateMipmaps = false;
 
 
 	var MAX_EDGE_THICKNESS = 4;
 	var MAX_EDGE_THICKNESS = 4;

+ 4 - 0
examples/js/postprocessing/SMAAPass.js

@@ -15,6 +15,7 @@ THREE.SMAAPass = function ( width, height ) {
 		minFilter: THREE.LinearFilter,
 		minFilter: THREE.LinearFilter,
 		format: THREE.RGBFormat
 		format: THREE.RGBFormat
 	} );
 	} );
+	this.edgesRT.texture.name = "SMAAPass.edges";
 
 
 	this.weightsRT = new THREE.WebGLRenderTarget( width, height, {
 	this.weightsRT = new THREE.WebGLRenderTarget( width, height, {
 		depthBuffer: false,
 		depthBuffer: false,
@@ -23,6 +24,7 @@ THREE.SMAAPass = function ( width, height ) {
 		minFilter: THREE.LinearFilter,
 		minFilter: THREE.LinearFilter,
 		format: THREE.RGBAFormat
 		format: THREE.RGBAFormat
 	} );
 	} );
+	this.weightsRT.texture.name = "SMAAPass.weights";
 
 
 	// textures
 	// textures
 
 
@@ -30,6 +32,7 @@ THREE.SMAAPass = function ( width, height ) {
 	areaTextureImage.src = this.getAreaTexture();
 	areaTextureImage.src = this.getAreaTexture();
 
 
 	this.areaTexture = new THREE.Texture();
 	this.areaTexture = new THREE.Texture();
+	this.areaTexture.name = "SMAAPass.area";
 	this.areaTexture.image = areaTextureImage;
 	this.areaTexture.image = areaTextureImage;
 	this.areaTexture.format = THREE.RGBFormat;
 	this.areaTexture.format = THREE.RGBFormat;
 	this.areaTexture.minFilter = THREE.LinearFilter;
 	this.areaTexture.minFilter = THREE.LinearFilter;
@@ -41,6 +44,7 @@ THREE.SMAAPass = function ( width, height ) {
 	searchTextureImage.src = this.getSearchTexture();
 	searchTextureImage.src = this.getSearchTexture();
 
 
 	this.searchTexture = new THREE.Texture();
 	this.searchTexture = new THREE.Texture();
+	this.searchTexture.name = "SMAAPass.search";
 	this.searchTexture.image = searchTextureImage;
 	this.searchTexture.image = searchTextureImage;
 	this.searchTexture.magFilter = THREE.NearestFilter;
 	this.searchTexture.magFilter = THREE.NearestFilter;
 	this.searchTexture.minFilter = THREE.NearestFilter;
 	this.searchTexture.minFilter = THREE.NearestFilter;

+ 20 - 9
examples/js/postprocessing/SSAARenderPass.js

@@ -52,7 +52,7 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
 
 
 	constructor: THREE.SSAARenderPass,
 	constructor: THREE.SSAARenderPass,
 
 
-	dispose: function() {
+	dispose: function () {
 
 
 		if ( this.sampleRenderTarget ) {
 		if ( this.sampleRenderTarget ) {
 
 
@@ -69,12 +69,12 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
 
 
 	},
 	},
 
 
-	render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
+	render: function ( renderer, writeBuffer, readBuffer ) {
 
 
 		if ( ! this.sampleRenderTarget ) {
 		if ( ! this.sampleRenderTarget ) {
 
 
-			this.sampleRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height,
-				{ minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat } );
+			this.sampleRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBAFormat } );
+			this.sampleRenderTarget.texture.name = "SSAARenderPass.sample";
 
 
 		}
 		}
 
 
@@ -95,29 +95,40 @@ THREE.SSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.protot
 		// render the scene multiple times, each slightly jitter offset from the last and accumulate the results.
 		// render the scene multiple times, each slightly jitter offset from the last and accumulate the results.
 		for ( var i = 0; i < jitterOffsets.length; i ++ ) {
 		for ( var i = 0; i < jitterOffsets.length; i ++ ) {
 
 
-			var jitterOffset = jitterOffsets[i];
+			var jitterOffset = jitterOffsets[ i ];
+
 			if ( this.camera.setViewOffset ) {
 			if ( this.camera.setViewOffset ) {
+
 				this.camera.setViewOffset( width, height,
 				this.camera.setViewOffset( width, height,
 					jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
 					jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
 					width, height );
 					width, height );
+
 			}
 			}
 
 
 			var sampleWeight = baseSampleWeight;
 			var sampleWeight = baseSampleWeight;
-			if( this.unbiased ) {
+
+			if ( this.unbiased ) {
+
 				// the theory is that equal weights for each sample lead to an accumulation of rounding errors.
 				// the theory is that equal weights for each sample lead to an accumulation of rounding errors.
 				// The following equation varies the sampleWeight per sample so that it is uniformly distributed
 				// The following equation varies the sampleWeight per sample so that it is uniformly distributed
 				// across a range of values whose rounding errors cancel each other out.
 				// across a range of values whose rounding errors cancel each other out.
-				var uniformCenteredDistribution = ( -0.5 + ( i + 0.5 ) / jitterOffsets.length );
+
+				var uniformCenteredDistribution = ( - 0.5 + ( i + 0.5 ) / jitterOffsets.length );
 				sampleWeight += roundingRange * uniformCenteredDistribution;
 				sampleWeight += roundingRange * uniformCenteredDistribution;
+
 			}
 			}
 
 
 			this.copyUniforms[ "opacity" ].value = sampleWeight;
 			this.copyUniforms[ "opacity" ].value = sampleWeight;
 			renderer.setClearColor( this.clearColor, this.clearAlpha );
 			renderer.setClearColor( this.clearColor, this.clearAlpha );
 			renderer.render( this.scene, this.camera, this.sampleRenderTarget, true );
 			renderer.render( this.scene, this.camera, this.sampleRenderTarget, true );
-			if (i === 0) {
+
+			if ( i === 0 ) {
+
 				renderer.setClearColor( 0x000000, 0.0 );
 				renderer.setClearColor( 0x000000, 0.0 );
+
 			}
 			}
-			renderer.render( this.scene2, this.camera2, this.renderToScreen ? null : writeBuffer, (i === 0) );
+
+			renderer.render( this.scene2, this.camera2, this.renderToScreen ? null : writeBuffer, ( i === 0 ) );
 
 
 		}
 		}
 
 

+ 4 - 4
examples/js/postprocessing/SavePass.js

@@ -27,15 +27,15 @@ THREE.SavePass = function ( renderTarget ) {
 
 
 	if ( this.renderTarget === undefined ) {
 	if ( this.renderTarget === undefined ) {
 
 
-		this.renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false };
-		this.renderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, this.renderTargetParameters );
+		this.renderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false } );
+		this.renderTarget.texture.name = "SavePass.rt";
 
 
 	}
 	}
 
 
 	this.needsSwap = false;
 	this.needsSwap = false;
 
 
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 	this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	this.scene  = new THREE.Scene();
+	this.scene = new THREE.Scene();
 
 
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null );
 	this.quad.frustumCulled = false; // Avoid getting clipped
 	this.quad.frustumCulled = false; // Avoid getting clipped
@@ -47,7 +47,7 @@ THREE.SavePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ),
 
 
 	constructor: THREE.SavePass,
 	constructor: THREE.SavePass,
 
 
-	render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) {
+	render: function ( renderer, writeBuffer, readBuffer ) {
 
 
 		if ( this.uniforms[ this.textureID ] ) {
 		if ( this.uniforms[ this.textureID ] ) {
 
 

+ 25 - 13
examples/js/postprocessing/TAARenderPass.js

@@ -35,12 +35,12 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 
 
 	render: function ( renderer, writeBuffer, readBuffer, delta ) {
 	render: function ( renderer, writeBuffer, readBuffer, delta ) {
 
 
-		if( ! this.accumulate ) {
+		if ( ! this.accumulate ) {
 
 
-				THREE.SSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
+			THREE.SSAARenderPass.prototype.render.call( this, renderer, writeBuffer, readBuffer, delta );
 
 
-				this.accumulateIndex = -1;
-				return;
+			this.accumulateIndex = - 1;
+			return;
 
 
 		}
 		}
 
 
@@ -49,20 +49,22 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 		if ( ! this.sampleRenderTarget ) {
 		if ( ! this.sampleRenderTarget ) {
 
 
 			this.sampleRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
 			this.sampleRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
+			this.sampleRenderTarget.texture.name = "TAARenderPass.sample";
 
 
 		}
 		}
 
 
 		if ( ! this.holdRenderTarget ) {
 		if ( ! this.holdRenderTarget ) {
 
 
 			this.holdRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
 			this.holdRenderTarget = new THREE.WebGLRenderTarget( readBuffer.width, readBuffer.height, this.params );
+			this.holdRenderTarget.texture.name = "TAARenderPass.hold";
 
 
 		}
 		}
 
 
-		if( this.accumulate && this.accumulateIndex === -1 ) {
+		if ( this.accumulate && this.accumulateIndex === - 1 ) {
 
 
-				THREE.SSAARenderPass.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;
 
 
 		}
 		}
 
 
@@ -71,7 +73,7 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 
 
 		var sampleWeight = 1.0 / ( jitterOffsets.length );
 		var sampleWeight = 1.0 / ( jitterOffsets.length );
 
 
-		if( this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length ) {
+		if ( this.accumulateIndex >= 0 && this.accumulateIndex < jitterOffsets.length ) {
 
 
 			this.copyUniforms[ "opacity" ].value = sampleWeight;
 			this.copyUniforms[ "opacity" ].value = sampleWeight;
 			this.copyUniforms[ "tDiffuse" ].value = writeBuffer.texture;
 			this.copyUniforms[ "tDiffuse" ].value = writeBuffer.texture;
@@ -81,18 +83,23 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 			for ( var i = 0; i < numSamplesPerFrame; i ++ ) {
 			for ( var i = 0; i < numSamplesPerFrame; i ++ ) {
 
 
 				var j = this.accumulateIndex;
 				var j = this.accumulateIndex;
-				var jitterOffset = jitterOffsets[j];
+				var jitterOffset = jitterOffsets[ j ];
+
 				if ( this.camera.setViewOffset ) {
 				if ( this.camera.setViewOffset ) {
+
 					this.camera.setViewOffset( readBuffer.width, readBuffer.height,
 					this.camera.setViewOffset( readBuffer.width, readBuffer.height,
 						jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
 						jitterOffset[ 0 ] * 0.0625, jitterOffset[ 1 ] * 0.0625,   // 0.0625 = 1 / 16
 						readBuffer.width, readBuffer.height );
 						readBuffer.width, readBuffer.height );
+
 				}
 				}
 
 
 				renderer.render( this.scene, this.camera, writeBuffer, true );
 				renderer.render( this.scene, this.camera, writeBuffer, true );
 				renderer.render( this.scene2, this.camera2, this.sampleRenderTarget, ( this.accumulateIndex === 0 ) );
 				renderer.render( this.scene2, this.camera2, this.sampleRenderTarget, ( this.accumulateIndex === 0 ) );
 
 
 				this.accumulateIndex ++;
 				this.accumulateIndex ++;
-				if( this.accumulateIndex >= jitterOffsets.length ) break;
+
+				if ( this.accumulateIndex >= jitterOffsets.length ) break;
+
 			}
 			}
 
 
 			if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
 			if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
@@ -101,19 +108,24 @@ THREE.TAARenderPass.prototype = Object.assign( Object.create( THREE.SSAARenderPa
 
 
 		var accumulationWeight = this.accumulateIndex * sampleWeight;
 		var accumulationWeight = this.accumulateIndex * sampleWeight;
 
 
-		if( accumulationWeight > 0 ) {
+		if ( accumulationWeight > 0 ) {
+
 			this.copyUniforms[ "opacity" ].value = 1.0;
 			this.copyUniforms[ "opacity" ].value = 1.0;
 			this.copyUniforms[ "tDiffuse" ].value = this.sampleRenderTarget.texture;
 			this.copyUniforms[ "tDiffuse" ].value = this.sampleRenderTarget.texture;
 			renderer.render( this.scene2, this.camera2, writeBuffer, true );
 			renderer.render( this.scene2, this.camera2, writeBuffer, true );
+
 		}
 		}
-		if( accumulationWeight < 1.0 ) {
+
+		if ( accumulationWeight < 1.0 ) {
+
 			this.copyUniforms[ "opacity" ].value = 1.0 - accumulationWeight;
 			this.copyUniforms[ "opacity" ].value = 1.0 - accumulationWeight;
 			this.copyUniforms[ "tDiffuse" ].value = this.holdRenderTarget.texture;
 			this.copyUniforms[ "tDiffuse" ].value = this.holdRenderTarget.texture;
 			renderer.render( this.scene2, this.camera2, writeBuffer, ( accumulationWeight === 0 ) );
 			renderer.render( this.scene2, this.camera2, writeBuffer, ( accumulationWeight === 0 ) );
+
 		}
 		}
 
 
 		renderer.autoClear = autoClear;
 		renderer.autoClear = autoClear;
 
 
 	}
 	}
 
 
-});
+} );

+ 3 - 0
examples/js/postprocessing/UnrealBloomPass.js

@@ -22,18 +22,21 @@ THREE.UnrealBloomPass = function ( resolution, strength, radius, threshold ) {
 	var resy = Math.round(this.resolution.y/2);
 	var resy = Math.round(this.resolution.y/2);
 
 
 	this.renderTargetBright = new THREE.WebGLRenderTarget( resx, resy, pars );
 	this.renderTargetBright = new THREE.WebGLRenderTarget( resx, resy, pars );
+	this.renderTargetBright.texture.name = "UnrealBloomPass.bright";
 	this.renderTargetBright.texture.generateMipmaps = false;
 	this.renderTargetBright.texture.generateMipmaps = false;
 
 
 	for( var i=0; i<this.nMips; i++) {
 	for( var i=0; i<this.nMips; i++) {
 
 
 		var renderTarget = new THREE.WebGLRenderTarget( resx, resy, pars );
 		var renderTarget = new THREE.WebGLRenderTarget( resx, resy, pars );
 
 
+		renderTarget.texture.name = "UnrealBloomPass.h" + i;
 		renderTarget.texture.generateMipmaps = false;
 		renderTarget.texture.generateMipmaps = false;
 
 
 		this.renderTargetsHorizontal.push(renderTarget);
 		this.renderTargetsHorizontal.push(renderTarget);
 
 
 		var renderTarget = new THREE.WebGLRenderTarget( resx, resy, pars );
 		var renderTarget = new THREE.WebGLRenderTarget( resx, resy, pars );
 
 
+		renderTarget.texture.name = "UnrealBloomPass.v" + i;
 		renderTarget.texture.generateMipmaps = false;
 		renderTarget.texture.generateMipmaps = false;
 
 
 		this.renderTargetsVertical.push(renderTarget);
 		this.renderTargetsVertical.push(renderTarget);

+ 1 - 1
examples/misc_animation_authoring.html

@@ -57,7 +57,7 @@
 				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
 				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
-				scene.add( new THREE.GridHelper( 500, 10 ) );
+				scene.add( new THREE.GridHelper( 1000, 10 ) );
 
 
 				var light = new THREE.DirectionalLight( 0xffffff, 2 );
 				var light = new THREE.DirectionalLight( 0xffffff, 2 );
 				light.position.set( 1, 1, 1 );
 				light.position.set( 1, 1, 1 );

+ 1 - 1
examples/misc_controls_transform.html

@@ -55,7 +55,7 @@
 				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
 				camera.lookAt( new THREE.Vector3( 0, 200, 0 ) );
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
-				scene.add( new THREE.GridHelper( 500, 10 ) );
+				scene.add( new THREE.GridHelper( 1000, 10 ) );
 
 
 				var light = new THREE.DirectionalLight( 0xffffff, 2 );
 				var light = new THREE.DirectionalLight( 0xffffff, 2 );
 				light.position.set( 1, 1, 1 );
 				light.position.set( 1, 1, 1 );

+ 1 - 1
examples/misc_sound.html

@@ -156,7 +156,7 @@
 
 
 				// ground
 				// ground
 
 
-				var helper = new THREE.GridHelper( 500, 10, 0x444444, 0x444444 );
+				var helper = new THREE.GridHelper( 1000, 10, 0x444444, 0x444444 );
 				helper.position.y = 0.1;
 				helper.position.y = 0.1;
 				scene.add( helper );
 				scene.add( helper );
 
 

二進制
examples/models/gltf/CesiumMan/glTF-Binary/Cesium_Man.glb


二進制
examples/models/gltf/CesiumMilkTruck/glTF-Binary/CesiumMilkTruck.glb


二進制
examples/models/gltf/duck/glTF-Binary/duck.glb


二進制
examples/models/gltf/monster/glTF-Binary/Monster.glb


+ 2 - 2
examples/models/gltf/snowflake/line_vert.glsl

@@ -9,7 +9,7 @@ uniform mat4 u_modelViewMatrix;
 uniform mat4 u_projectionMatrix;
 uniform mat4 u_projectionMatrix;
 
 
 void main(void) {
 void main(void) {
-	vec4 pos = u_modelViewMatrix * vec4(position,1.0);
+	vec4 pos = u_modelViewMatrix * vec4(a_position,1.0);
 	v_color = a_color;
 	v_color = a_color;
 	gl_Position = u_projectionMatrix * pos;
 	gl_Position = u_projectionMatrix * pos;
-}
+}

+ 3903 - 5120
examples/models/vrml/house.wrl

@@ -1,5183 +1,3966 @@
 #VRML V2.0 utf8
 #VRML V2.0 utf8
-
-
 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
-
-
-
-
-DEF vloer Transform {
 	children [
 	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,
+		DirectionalLight {
+			ambientIntensity 0
+			color 1 1 .9,
+			direction .5 -1.5 -1,
+			intensity 1.8
+			on TRUE
+		}
+		DirectionalLight {
+			ambientIntensity 0
+			color 1 1 .9,
+			direction -.5 1 0,
+			intensity 1
+			on TRUE
+		}
+		NavigationInfo {
+			avatarSize [
+				.2 1.4 .5
+			]
+			headlight FALSE
+		}
+		DirectionalLight {
+			ambientIntensity 0
+			color .6 .6 .8,
+			direction -1 .5 2,
+			intensity 1
+			on TRUE
+		}
+		Background {
+			groundAngle [
+				1.5 1.6
+			]
+			groundColor [
+				.2 .6 .3 .4 .4 .35 .3 .5 .6
+			]
+			backUrl [
+			]
+			bottomUrl [
+			]
+			frontUrl [
+			]
+			leftUrl [
+			]
+			rightUrl [
+			]
+			topUrl [
+			]
+			skyAngle [
+				1.5
+			]
+			skyColor [
+				.5 .7 1 .7 1 .9
+			]
+		}
+		Viewpoint {
+			fieldOfView 1
+			jump TRUE
+			orientation 0 1 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.141592
+			position 2.5 2.5 -20
+			description "Achteraanzicht"
+		}
+		Viewpoint {
+			fieldOfView 1
+			jump TRUE
+			orientation 1 0 0 -1.570796
+			position 2.5 20 -4.5
+			description "Bovenaanzicht"
+		}
+		# beneden/beneden.wrl
+		DEF vloer Transform {
+			children [
+				Shape {
+					appearance Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor 1 .5 .3
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry IndexedFaceSet {
+						color NULL
+						coord Coordinate {
+							#default NULL
+							point [
+								.14 0 -.14, 5.54 0 -.14, 5.54 0 -8.86, .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 [
+						]
+					}
+				}
+			]
+		}
+		DEF drempelvoor Transform {
+			children [
+				Shape {
+					appearance Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .4 .4 .4
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+					}
+					geometry Box {
+						size 1.23 .04 .3
+					}
+				}
+			]
+			translation 3.805 .02 -.14
+		}
+		DEF drempelachter Transform {
+			children [
+				Shape {
+					appearance Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .4 .4 .4
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+					}
+					geometry Box {
+						size 1.05 .04 .3
+					}
+				}
+			]
+			translation 1.725 .02 -8.86
+		}
+		DEF stukmuur1 Transform {
+			children [
+				Shape {
+					appearance DEF wandkleur Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor 1 .9 .7
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry Box {
+						size .7 2.7 .07
+					}
+				}
+			]
+			translation .63 1.35 -3.395
+		}
+		DEF stukmuur2 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size 1.41 2.7 .07
+					}
+				}
+			]
+			translation 2.485 1.35 -3.395
+		}
+		DEF stukmuur3 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .43 2.7 .07
+					}
+				}
+			]
+			translation 4.205 1.35 -3.395
+		}
+		DEF stukmuur4 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size 1.06 2.8 .07
+					}
+				}
+			]
+			translation 4.87 1.4 -4.395
+		}
+		DEF stukmuur5 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .07 2.7 2.28
+					}
+				}
+			]
+			translation 3.155 1.35 -1.42
+		}
+		DEF stukmuur6 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .98 2.8 .07
+					}
+				}
+			]
+			translation 4.91 1.4 -2.325
+		}
+		DEF stukmuur7 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .98 2.7 .07
+					}
+				}
+			]
+			translation 4.91 1.35 -1.515
+		}
+		DEF stukmuur8 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .07 2.7 .4
+					}
+				}
+			]
+			translation 4.455 1.35 -.48
+		}
+		DEF stukmuur9 Transform {
+			children [
+				Shape {
+					appearance USE wandkleur
+					geometry Box {
+						size .07 2.7 .74
+					}
+				}
+			]
+			translation 4.7 1.35 -1.92
+		}
+		# binmuur.wrl
+		Transform {
+			children [
+				Shape {
+					appearance Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor 1 .9 .7
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry IndexedFaceSet {
+						color NULL
+						coord Coordinate {
+							#default NULL
+							point [
+								.28 0 -.28, #0 linkerbenedenhoek voorgevel
+								5.4 0 -.28, 5.4 5.4 -.28, .28 5.4 -.28, #3 linkerbovenhoek voorgevel
+								3.19 0 -.28, #4 voordeur
+								4.42 0 -.28, 4.42 2.3 -.28, 3.19 2.3 -.28, #7 voordeur
+								4.84 1.6 -.28, #toiletraam-8
+								5.04 1.6 -.28, 5.04 2.3 -.28, 4.84 2.3 -.28, 2.6 .9 -.28,
+								#keukenraam-12
+								2.6 2.3 -.28, .6 2.3 -.28, .6 .9 -.28, .6 3.6 -.28, #bovenraam-16
+								1.5 3.6 -.28, 1.5 5 -.28, 4.42 5 -.28, 4.42 5.4 -.28, .6 5.4 -.28,
+								.28 8.55 -3.15, #linkergevel-22
+								.28 2.7 -8.72, .28 0 -8.72, 5.4 8.55 -3.15, #rechtergevel-25
+								5.4 5.4 -6.3, 5.4 5.4 -8.72, 5.4 0 -8.72, 2.25 0 -8.72, #achtergevel-29
+								2.25 .6 -8.72, 4.8 .6 -8.72, 4.8 5.4 -8.72, 1.2 0 -8.72, 1.2 2.7 -8.72,
+								3.19 0 -.14, #diepte van de voordeur-35
+								4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+								2.6 .9 -.14, # diepte van het keukenraam-39
+								2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+								5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+								#diepte van het bovenraam-47
+								1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+								#52
+								2.25 0 -8.86, #diepte van de achtergevel-53
+								2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+								#58
+								.28 5.4 0, #59 hoekpunt voor dakvorm zolder
+								5.4 5.4 0, .28 5.4 -6.3, #61
+								.28 2.7 -9, #62 hoekpunt voor dakvorm 1e verdieping
+								.28 2.7 -.28, #63 extra punten voor segmentering beneden
+								.14 2.7 -.14, 5.4 2.7 -.28, #65
+								5.54 2.7 -.14, #
+								.28 2.7 -8.72, #67
+								.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, #
+								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, 0 15 14 63 -1, 0 63 14 15 -1, 14 13 65 63 -1,
+							4 12 13 7 -1, 13 7 6 65 -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, 67 24 33 71 -1, 28 29 30 31 -1, 28 31 73 69 -1, 28 69
+							65 1 -1, 63 65 66 64 -1, 65 69 70 66 -1, 63 67 68 64 -1, 69 73 74 70 -1, 67
+							71 72 68 -1, 5 6 37 36 -1, 6 7 38 37 -1, 4 35 38 7 -1, 12 39 40 13 -1, 13
+							40 41 14 -1, 14 41 42 15 -1, 15 42 39 12 -1, 8 43 44 9 -1, 9 44 45 10 -1,
+							10 45 46 11 -1, 11 46 43 8 -1, 29 53 54 30 -1, 30 54 55 31 -1, 31 55 74 73
+							-1, 33 57 72 71 -1,
+						]
+						#default []
+						creaseAngle 0
+						normalIndex [
+						]
+						normalPerVertex TRUE
+						solid FALSE
+						texCoordIndex [
+						]
+					}
+				}
+			]
+		}
+		#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 .2
+							diffuseColor .8 .4 .3
+							emissiveColor 0 0 0
+							shininess .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.4 0, # 2
+								0 5.4 0, # 3 linkerbovenhoek voorgevel
+								3.19 0 0, #voordeur
+								4.42 0 0, 4.42 2.3 0, # 6
+								3.19 2.3 0, # 7 voordeur
+								4.84 1.6 0, #toiletraam-8
+								5.04 1.6 0, 5.04 2.3 0, # 10
+								4.84 2.3 0, 2.6 .9 0, #keukenraam-12
+								2.6 2.3 0, # 13
+								.6 2.3 0, .6 .9 0, .6 3.6 0, #bovenraam-16
+								1.5 3.6 0, 1.5 5 0, 4.42 5 0, 4.42 5.4 0, .6 5.4 0, 0 8.555 -3.15,
+								#linkergevel-22
+								0 2.7 -9, 0 0 -9, 5.68 8.555 -3.15, #rechtergevel-25
+								5.68 5.4 -6.3, 5.68 5.4 -9, 5.68 0 -9, 2.25 0 -9, #achtergevel-29
+								2.25 .6 -9, 4.8 .6 -9, 4.8 5.4 -9, 1.2 0 -9, 1.2 2.7 -9, 3.19 0 -.14,
+								#diepte van de voordeur-35
+								4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+								2.6 .9 -.14, # diepte van het keukenraam-39
+								2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+								5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+								#diepte van het bovenraam-47
+								1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+								#52
+								2.25 0 -8.86, #diepte van de achtergevel-53
+								2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+								#58
+								0 2.7 0, #59 extra punten voor segmentering beneden
+								.14 2.7 -.14, 5.68 2.7 0, #61
+								5.54 2.7 -.14, #
+								0 2.7 -9, #63
+								.14 2.7 -8.86, #
+								5.68 2.7 -9, #65
+								5.54 2.7 -8.86, #
+								1.2 2.7 -9, #67
+								1.2 2.7 -8.86, #
+								4.8 2.7 -9, #69
+								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 14 59 -1, 14 13 61 59 -1, 4 7 13 12 -1, 13 11 61 -1, 11
+							10 61 -1, 9 1 61 10 -1, 5 1 9 8 -1, 5 8 11 6 -1, 0 59 63 24 -1, 1 28 65 61
+							-1, 28 29 30 31 -1, 28 31 69 65 -1, 33 24 63 67 -1, 5 6 37 36 -1, 6 7 38 37
+							-1, 4 35 38 7 -1, 12 13 40 39 -1, 13 14 41 40 -1, 15 42 41 14 -1, 12 39 42
+							15 -1, 8 9 44 43 -1, 9 10 45 44 -1, 10 11 46 45 -1, 11 8 43 46 -1, 29 53 54
+							30 -1, 30 54 55 31 -1, 31 55 70 69 -1, 33 67 68 57 -1, 59 61 62 60 -1, 59
+							60 64 63 -1, 61 65 66 62 -1, 65 69 70 66 -1, 64 68 67 63 -1,
+						]
+						#default []
+						creaseAngle 0
+						normalIndex [
+						]
+						normalPerVertex TRUE
+						solid FALSE
+						texCoordIndex [
+						]
+					}
+				}
+			]
+		}
+		Transform {
+			#schuurtje
+			children [
+				DEF schuurvloer Transform {
+					children [
+						Shape {
+							appearance Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor 1 .5 .3
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry IndexedFaceSet {
+								color NULL
+								coord Coordinate {
+									#default NULL
+									point [
+										.1 0 -.1, 2.1 0 -.1, 2.1 0 -3.1, .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 .1
+							}
+						}
+					]
+					translation 1.1 1.3 -.05
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE steen
+							geometry Box {
+								size 2.2 2.6 .1
+							}
+						}
+					]
+					translation 1.1 1.3 -3.15
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE steen
+							geometry Box {
+								size .1 2.6 1.3
+							}
+						}
+					]
+					translation .05 1.3 -.75
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE steen
+							geometry Box {
+								size .1 2.6 .75
+							}
+						}
+					]
+					translation .05 1.3 -2.725
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE steen
+							geometry Box {
+								size .1 2.6 3
+							}
+						}
 					]
 					]
+					translation 2.15 1.3 -1.6
 				}
 				}
-				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 DEF blauw Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .3 .4 .7
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .05 .44 .85
+							}
+						}
+					]
+					translation .05 2.38 -1.875
+				}
+				Transform {
+					#drempel van schuurdeur
+					children [
+						Transform {
+							#deurpost
+							children [
+								DEF deurpost Shape {
+									appearance DEF grijs Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .4 .4 .4
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+									}
+									geometry Box {
+										size .05 2.56 .05
+									}
+								}
+							]
+							translation 0 1.3 .45
+						}
+						Transform {
+							#deurpost
+							children [
+								Shape {
+									appearance USE grijs
+									geometry Box {
+										size .05 .05 .85
+									}
+								}
+							]
+							translation 0 2.135 0
+						}
+						Transform {
+							#deurpost
+							children [
+								USE deurpost
+							]
+							translation 0 1.3 -.45
+						}
+						Shape {
+							appearance USE grijs
+							geometry Box {
+								size .1 .04 .95
+							}
+						}
+					]
+					translation .05 .02 -1.875
+				}
+			]
+			translation 3.48 0 7.8
 		}
 		}
-	]
-}
-
-
-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
-}
-
-
-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
+		# /buitmuur.wrl
+		# trapbeneden.wrl
+		DEF trapbeneden Transform {
+			children [
+				Shape {
+					appearance Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor 1 .5 .3
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry DEF trap IndexedFaceSet {
+						color NULL
+						coord Coordinate {
+							#default NULL
+							point [
+								-.2 0 1, #0
+								0 .2 1, 0 .2 0, -.2 0 0, #3
+								.28 .4 1, #4
+								.6 .6 1, .98 .8 1, .98 1 .45, #7
+								.98 1.2 .25, #8
+								.98 1.4 0, .98 1.6 -.25, .98 1.8 -.45, #11
+								.98 2 -1, #12
+								.6 2.2 -1, .28 2.4 -1, 0 2.6 -1, #15
+								0 .6 0, #16
+								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
+								-.2 .2 1, #28
+								0 .4 1, 0 .4 0, -.2 .2 0, #31
+								.28 .6 1, #32
+								.6 .8 1, .98 1 1, .98 1.2 .45, #35
+								.98 1.4 .25, #36
+								.98 1.6 0, .98 1.8 -.25, .98 2 -.45, #39
+								.98 2.2 -1, #40
+								.6 2.4 -1, .28 2.6 -1, 0 2.8 -1, #43
+								0 0 1, 0 0 0, #45
+								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		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
-}
-
-
-DEF stukmuur3 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.43 2.70 0.07
-				}
-
-	}
- ]
-translation		4.205	1.35 -3.395
-}
-
-DEF stukmuur4 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	1.06 2.8 0.07
-				}
-
-	}
- ]
-translation		4.87	1.4 -4.395
-}
-
-DEF stukmuur5 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.70 2.28
-				}
-
-	}
- ]
-translation		3.155	1.35 -1.42
-}
-
-DEF stukmuur6 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.8 0.07
-				}
-
-	}
- ]
-translation		4.91	1.4 -2.325
-}
-
-DEF stukmuur7 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.70 0.07
-				}
-
-	}
- ]
-translation		4.91	1.35 -1.515
-}
-
-
-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
-}
-
-
-
-# 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.28	2.7	-0.28, #63 extra punten voor segmentering beneden
-						0.14	2.7	-0.14,
-
-						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, #
-
-						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, #
-
-						4.8	2.7	-8.72, #73
-						4.8	2.7	-8.86, #
-						
+			]
+			translation 4.42 0 -3.36
+		}
+		# /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 .2
+											diffuseColor .95 .95 .9
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 .05 .05
+									}
+								}
+							]
+							translation 0 2.035 0
+						}
+						DEF ruitje Transform {
+							children [
+								Shape {
+									appearance DEF glas Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .6 .6 .9
+											emissiveColor 0 0 0
+											shininess .8
+											specularColor 1 1 1
+											transparency .7
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 .64 .01
+									}
+								}
+							]
+							translation 0 2.38 0
+						}
+						#ruit boven de deur
+						#deur
+						DEF deur Transform {
+							center -.4 0 0
+							children [
+								DEF klikopdeur TouchSensor {
+								}
+								DEF TimeSource TimeSensor {
+									cycleInterval 20
+								}
+								# Run once for 20 sec.
+								# Animeer het openzwaaien van de deur rond de Y as:
+								DEF Deuropen OrientationInterpolator {
+									key [
+										0 .025 .05 .95 .975 1
+									]
+									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 deurklink Transform {
+									children [
+										DEF enehelft Shape {
+											appearance DEF aluminium Appearance {
+												material Material {
+													ambientIntensity .2
+													diffuseColor .4 .4 .5
+													emissiveColor 0 0 0
+													shininess .8
+													specularColor .4 .4 .5
+												}
+												texture NULL
+												textureTransform NULL
+											}
+											geometry IndexedFaceSet {
+												color NULL
+												coord Coordinate {
+													point [
+														-.015 .02 0, #0
+														.015 .02 0, .02 -.02 0, -.02 -.02 0, #3
+														-.01 -.015 .06, #4
+														.01 -.015 .06, -.01 .015 .03, .01 .015 .03, .005 .1 .035,
+														#8
+														-.005 .1 .035, -.005 .1 .055, .005 .1 .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.141592
+											translation 0 0 -.07
+										}
+										Transform {
+											children [
+												DEF vlakdeel Shape {
+													appearance USE aluminium
+													geometry Box {
+														size .18 .07 .01
+													}
+												}
+												#shape
+											]
+											translation -.03 0 -.005
+										}
+										Transform {
+											children [
+												USE vlakdeel
+											]
+											translation -.03 0 -.065
+										}
+									]
+									translation .35 0 .035
+									rotation 0 0 1 1.570796
+								}
+								#deurklink
+								# /../boven/deurklink.wrl
+								DEF deurvorm Shape {
+									appearance DEF deurkleur Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .8 .8 .8
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 2 .05
+									}
+								}
+							]
+							translation 0 1.005 0
+						}
 					]
 					]
 				}
 				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 4, 12, 15, -1,
-		0, 15, 12, 4, -1,
-
-		0, 15, 14, 63, -1,
-		0, 63, 14, 15, -1,
-
-		14, 13, 65, 63, -1,
-		
-		4, 12, 13, 7, -1,
-
-		13, 7, 6, 65, -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,
-
-		67, 24, 33, 71, -1,
-
-		28, 29, 30, 31, -1,
-
-		28, 31, 73, 69, -1,
-
-		28, 69, 65, 1, -1,
-
-		63, 65, 66, 64, -1,
-
-		65, 69, 70, 66, -1,
-
-		63, 67, 68, 64, -1,
-
-		69, 73, 74, 70, -1,
-
-		67, 71, 72, 68, -1,
-
-		5, 6, 37, 36, -1,
-
-		6, 7, 38, 37, -1,
-
-		4, 35, 38, 7, -1,
-
-		12, 39, 40, 13, -1,
-
-		13, 40, 41, 14, -1, 
-
-		14, 41, 42, 15, -1,
-
-		15, 42, 39, 12, -1, 
-
-		8, 43, 44, 9, -1,
-
-
-		9, 44, 45, 10, -1,
-
-
-		10, 45, 46, 11, -1,
-
-
-		11, 46, 43, 8, -1,
-
-
-		29, 53, 54, 30, -1,
-
-
-		30, 54, 55, 31, -1, 
-
-
-		31, 55, 74, 73, -1,
-
-
-		33, 57, 72, 71, -1,
-
-
-
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
+				#deurgroep
+			]
+			translation 1.38 0 -3.395
 		}
 		}
-	]
-}
-
-#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.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	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, #
-
-						0	2.7	-9, #63
-						0.14	2.7	-8.86, #
-
-						5.68	2.7	-9, #65
-						5.54	2.7	-8.86, #
-
-						1.2	2.7	-9, #67
-						1.2	2.7	-8.86, #
-
-						4.8	2.7	-9, #69
-						4.8	2.7	-8.86, #
-
-
-
+		#moved to end
+		#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 -.4 0 0
+					children [
+						DEF klikopdeur2 TouchSensor {
+						}
+						DEF TimeSource2 TimeSensor {
+							cycleInterval 20
+						}
+						# Run once for 20 sec.
+						# Animeer het openzwaaien van de deur rond de Y as:
+						DEF Deuropen2 OrientationInterpolator {
+							key [
+								0 .025 .05 .95 .975 1
+							]
+							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
 				}
 				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-		0, 4, 12, 15, -1,
-
-		0, 15, 14, 59, -1,
-
-		14, 13, 61, 59,-1,
-
-
-		4, 7, 13, 12, -1,
-
-        13, 11, 61, -1,
-
-		11, 10, 61, -1,
-
-		9, 1, 61, 10, -1, 
-
-		5, 1, 9, 8, -1,
-
-		5, 8, 11, 6, -1,
-
-
-		0, 59, 63, 24, -1,
-
-		1, 28, 65, 61, -1,
-
-		28, 29, 30, 31, -1,
-
-		28, 31, 69, 65, -1,
-
-		33, 24, 63, 67, -1,
-
-		5, 6, 37, 36, -1,
-
-		6, 7, 38, 37, -1,
-
-		4, 35, 38, 7, -1,
-
-		12, 13, 40, 39, -1,
-
-		13, 14, 41, 40, -1,
-
-		15, 42, 41, 14, -1,
-
-		12, 39, 42, 15, -1
-
-		8, 9, 44, 43, -1,
-
-		9, 10 , 45, 44, -1,
-
-		10, 11, 46, 45, -1,
-
-		11, 8, 43, 46, -1,
-
-		29, 53, 54, 30, -1,
-
-		30, 54, 55, 31, -1, 
-
-		31, 55, 70, 69, -1,
-
-		33, 67, 68, 57, -1,
-
-		59, 61, 62, 60, -1,
-
-		59, 60, 64, 63, -1,
-
-		61, 65, 66, 62, -1,
-
-		65, 69, 70, 66, -1,
-
-		64, 68, 67, 63, -1,
-
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
+			]
+			translation 3.155 0 -2.96
+			rotation 0 1 0 1.570796
 		}
 		}
-	]
-}
-
-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,
+		#moved to end
+		#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 -.4 0 0
+					children [
+						DEF klikopdeur3 TouchSensor {
+						}
+						DEF TimeSource3 TimeSensor {
+							cycleInterval 20
+						}
+						# 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 .025 .05 .95 .975 1
+							]
+							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
 				}
 				}
-				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     []
-			}
+			]
+			translation 3.59 0 -3.395
+			rotation 0 1 0 0
 		}
 		}
-	]
-}
-
-
-Transform {
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	2.2	2.6	0.1	}
-}
-]
-translation 1.1 1.3 -0.05
-}
-
-Transform{
-children [
-Shape {
-appearance USE steen
-geometry Box {	size	2.2	2.6	0.1	}
-}
-]
-translation	1.1	1.3	-3.15
-}
-
-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
-}
-
-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 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
-
+		#deur3
+		#moved to end
+		#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 .93 .05 .05
+							}
+						}
+					]
+					translation 0 2.035 0
+				}
+				DEF ruitjeafw Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .93 .64 .01
+							}
+						}
+					]
+					translation 0 2.38 0
+				}
+				#ruit boven de deur#deur
+				DEF deurwoonkamertrapkast Transform {
+					center -.4 0 0
+					children [
+						DEF klikopdeur4 TouchSensor {
+						}
+						DEF TimeSource4 TimeSensor {
+							cycleInterval 20
+						}
+						# Run once for 20 sec.
+						# Animeer het openzwaaien van de deur rond de Y as:
+						DEF Deuropen4 OrientationInterpolator {
+							key [
+								0 .025 .05 .95 .975 1
+							]
+							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 .93 2 .05
+							}
+						}
 					]
 					]
+					translation 0 1.005 0
 				}
 				}
-				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.395 0 -3.895
+			rotation 0 1 0 -1.570796
 		}
 		}
-	]
-translation 4.42	0	-3.36
-}
-
-
-
-
-
-# /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 }
-}
-
-]
-translation	0 2.035 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
-
-#deur
-DEF deur Transform {
-center -0.4 0 0
-	children [
-
-
-
-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 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,
-
-
-
+		#deur4
+		#moved to end
+		#ROUTE klikopdeur4.touchTime TO TimeSource4.startTime
+		#ROUTE TimeSource4.fraction_changed TO Deuropen4.set_fraction
+		#ROUTE Deuropen4.value_changed TO deurwoonkamertrapkast.rotation
+		#deur5
+		Transform {
+			children [
+				DEF dwarslatafw2 Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .74 .05 .05
+							}
+						}
 					]
 					]
+					translation 0 2.035 0
 				}
 				}
-				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 1.005 0
-}
-
-
-
-
-
-]
-}#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
-}
-		
-]
-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 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
-
-
-
-#deur5
-Transform {
-children[ DEF dwarslatafw2 Transform {
-	children [
-		Shape {
-appearance USE kozijn
-			geometry Box { size	0.74 0.05 0.05 }
-}
-
-]
-translation	0 2.035 0
-}
-
-
-
-
-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 [
-
-
-
-	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
-
-#ROUTE klikopdeur6.touchTime TO TimeSource6.startTime
-#ROUTE TimeSource6.fraction_changed TO Deuropen6.set_fraction
-#ROUTE Deuropen6.value_changed TO deurtoiletgang.rotation
-
-
-# voordeur.wrl
-
-
-
-
-DEF voordeur Transform {
-center 1.11 0 0 
-	children [
-
-		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
-	]
+				DEF ruitjeafw2 Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .74 .64 .01
+							}
+						}
+					]
+					translation 0 2.38 0
+				}
+				#ruit boven de deur#deur
+				DEF deurgangmeterkast Transform {
+					center -.4 0 0
+					children [
+						DEF klikopdeur5 TouchSensor {
+						}
+						DEF TimeSource5 TimeSensor {
+							cycleInterval 20
+						}
+						# Run once for 20 sec.
+						# Animeer het openzwaaien van de deur rond de Y as:
+						DEF Deuropen5 OrientationInterpolator {
+							key [
+								0 .025 .05 .95 .975 1
+							]
+							keyValue [
+								0 1 0 0 0 1 0 -.7 0 1 0 -1.5 0 1 0 -1.5 0 1 0 -.7 0 1 0 0
+							]
+						}
+						DEF deurklinkafw Transform {
+							children [
+								USE enehelft
+								Transform {
+									children [
+										USE enehelft
+									]
+									rotation 0 1 0 3.141592
+									translation 0 0 -.07
+								}
+								Transform {
+									children [
+										DEF vlakdeel Shape {
+											appearance USE aluminium
+											geometry Box {
+												size .18 .07 .01
+											}
+										}
+										#shape
+									]
+									translation -.03 0 -.005
+								}
+								Transform {
+									children [
+										USE vlakdeel
+									]
+									translation -.03 0 -.065
+								}
+							]
+							translation .32 0 .035
+							rotation 0 0 1 1.570796
+						}
+						#deurklink
+						Shape {
+							#afwijkende deurmaat
+							appearance USE deurkleur
+							geometry Box {
+								size .74 2 .05
+							}
+						}
+					]
+					translation 0 1.005 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, 
-
-
-	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     []
-			}
+			]
+			translation 4.455 0 -1.92
+			rotation 0 1 0 -1.570796
 		}
 		}
-
-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
+		#deur5
+		#moved to end
+		#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 -.4 0 0
+					children [
+						DEF klikopdeur6 TouchSensor {
+						}
+						DEF TimeSource6 TimeSensor {
+							cycleInterval 20
+						}
+						# Run once for 20 sec.
+						# Animeer het openzwaaien van de deur rond de Y as: 
+						DEF Deuropen6 OrientationInterpolator {
+							key [
+								0 .025 .05 .95 .975 1
+							]
+							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.570796
+		}
+		#deur6
+		#moved to end
+		#ROUTE klikopdeur6.touchTime TO TimeSource6.startTime
+		#ROUTE TimeSource6.fraction_changed TO Deuropen6.set_fraction
+		#ROUTE Deuropen6.value_changed TO deurtoiletgang.rotation
+		# voordeur.wrl
+		DEF voordeur Transform {
+			center 1.11 0 0
+			children [
+				Shape {
+					appearance DEF deurkleur Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .8 .8 .8
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry IndexedFaceSet {
+						color NULL
+						coord Coordinate {
+							#default NULL
+							point [
+								0 0 .025, #0
+								1.11 0 .025, #
+								1.11 2.19 .025, #
+								0 2.19 .025, #3
+								.71 .49 .025, #4
+								.91 .49 .025, #
+								.91 1.99 .025, #
+								.71 1.99 .025, #7
+								0 0 -.025, #8
+								1.11 0 -.025, #
+								1.11 2.19 -.025, #
+								0 2.19 -.025, #11
+								.71 .49 -.025, #12
+								.91 .49 -.025, #
+								.91 1.99 -.025, #
+								.71 1.99 -.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
+				}
+				# Run once for 20 sec.
+				# Animeer het openzwaaien van de deur rond de Y as:
+				DEF VoorDeuropen OrientationInterpolator {
+					key [
+						0 .025 .05 .95 .975 1
+					]
+					keyValue [
+						0 1 0 0 0 1 0 -.7 0 1 0 -1.5 0 1 0 -1.5 0 1 0 -.7 0 1 0 0
+					]
+				}
+				DEF deurgreep Transform {
+					children [
+						Shape {
+							appearance DEF aluminium Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .4 .4 .4
+									emissiveColor 0 0 0
+									shininess .8
+									specularColor .9 .9 .9
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .2 .2 .004
+							}
+						}
+					]
+					translation .15 .9 .067
+				}
+				DEF steunblokje Transform {
+					children [
+						Shape {
+							appearance DEF aluminium Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .4 .4 .4
+									emissiveColor 0 0 0
+									shininess .8
+									specularColor .9 .9 .9
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .14 .14 .04
+							}
+						}
+					]
+					translation .15 .9 .045
+				}
+				DEF ruitjeindeur Transform {
+					children [
+						Shape {
+							appearance DEF glas Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .6 .6 .9
+									emissiveColor 0 0 0
+									shininess .8
+									specularColor 1 1 1
+									transparency .7
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .2 1.5 .01
+							}
+						}
+					]
+					translation .81 1.24 0
+				}
+			]
+			translation 3.25 .05 -.14
 		}
 		}
-		texture           NULL
-		textureTransform  NULL
+		#moved to end
+		#ROUTE klikopvoordeur.touchTime TO TimeSourcevoor.startTime
+		#ROUTE TimeSourcevoor.fraction_changed TO VoorDeuropen.set_fraction
+		#ROUTE VoorDeuropen.value_changed TO voordeur.rotation
+		# /voordeur.wrl
+		# achterdeur.wrl
+		#bevat ook schuurdeur
+		DEF achterdeur Transform {
+			center 0 0 0
+			children [
+				Shape {
+					appearance DEF deurkleur Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .8 .8 .8
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry DEF deurInd IndexedFaceSet {
+						color NULL
+						coord Coordinate {
+							#default NULL
+							point [
+								.93 0 -.025, #0
+								0 0 -.025, #
+								0 2.09 -.025, #
+								.93 2.09 -.025, #3
+								.765 .6 -.025, #4
+								.165 .6 -.025, #
+								.165 1.9 -.025, #
+								.765 1.9 -.025, #7
+								.93 0 .025, #0
+								0 0 .025, #
+								0 2.09 .025, #
+								.93 2.09 .025, #3
+								.765 .6 .025, #4
+								.165 .6 .025, #
+								.165 1.9 .025, #
+								.765 1.9 .025, #7
+							]
+						}
+						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 klikopachterdeur TouchSensor {
+				}
+				DEF TimeSourceachter TimeSensor {
+					cycleInterval 20
+				}
+				# Run once for 20 sec.
+				# Animeer het openzwaaien van de deur rond de Y as:
+				DEF achterDeuropen OrientationInterpolator {
+					key [
+						0 .025 .05 .95 .975 1
+					]
+					keyValue [
+						0 1 0 0 0 1 0 .7 0 1 0 1.5 0 1 0 1.5 0 1 0 .7 0 1 0 0
+					]
+				}
+				Transform {
+					# ../boven/deurklink.wrl
+					children [
+						DEF deurklink Transform {
+							children [
+								DEF enehelft Shape {
+									appearance DEF aluminium Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .4 .4 .5
+											emissiveColor 0 0 0
+											shininess .8
+											specularColor .4 .4 .5
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry IndexedFaceSet {
+										color NULL
+										coord Coordinate {
+											point [
+												-.015 .02 0, #0
+												.015 .02 0, .02 -.02 0, -.02 -.02 0, #3
+												-.01 -.015 .06, #4
+												.01 -.015 .06, -.01 .015 .03, .01 .015 .03, .005 .1 .035,
+												#8
+												-.005 .1 .035, -.005 .1 .055, .005 .1 .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.141592
+									translation 0 0 -.07
+								}
+								Transform {
+									children [
+										DEF vlakdeel Shape {
+											appearance USE aluminium
+											geometry Box {
+												size .18 .07 .01
+											}
+										}
+										#shape
+									]
+									translation -.03 0 -.005
+								}
+								Transform {
+									children [
+										USE vlakdeel
+									]
+									translation -.03 0 -.065
+								}
+							]
+							translation .35 0 .035
+							rotation 0 0 1 1.570796
+						}
+						#deurklink
+					]
+					# /../boven/deurklink.wrl
+					translation .5 1 0
+				}
+				DEF ruitindeur Transform {
+					children [
+						Shape {
+							appearance DEF glas Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .6 .6 .9
+									emissiveColor 0 0 0
+									shininess .8
+									specularColor 1 1 1
+									transparency .7
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .6 1.3 .01
+							}
+						}
+					]
+					translation .465 1.25 0
+				}
+			]
+			translation 1.26 .05 -8.86
 		}
 		}
-			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
+		#moved to end
+		#ROUTE klikopachterdeur.touchTime TO TimeSourceachter.startTime
+		#ROUTE TimeSourceachter.fraction_changed TO achterDeuropen.set_fraction
+		#ROUTE achterDeuropen.value_changed TO achterdeur.rotation
+		#schuurdeur
+		DEF schuurdeur Transform {
+			children [
+				DEF klikopschuurdeur TouchSensor {
+				}
+				DEF TimeSourceschuur TimeSensor {
+					cycleInterval 20
+				}
+				# Run once for 20 sec.
+				# Animeer het openzwaaien van de deur rond de Y as:
+				DEF schuurDeuropen OrientationInterpolator {
+					key [
+						0 .025 .05 .95 .975 1
+					]
+					keyValue [
+						0 1 0 1.570796 0 1 0 2.4 0 1 0 3.4 0 1 0 3.4 0 1 0 2.4 0 1 0 1.570796
+					]
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE deurkleur
+							geometry USE deurInd
+						}
+					]
+					scale .913978 1 1 #maakt de deur op maat
+				}
+				USE ruitindeur
+				Transform {
+					children USE deurklink
+					translation .43 1 0
+				}
+			]
+			translation 3.53 .05 6.35
+			rotation 0 1 0 1.570796
 		}
 		}
-		texture           NULL
-		textureTransform  NULL
+		#moved to end
+		#ROUTE klikopschuurdeur.touchTime TO TimeSourceschuur.startTime
+		#ROUTE TimeSourceschuur.fraction_changed TO schuurDeuropen.set_fraction
+		#ROUTE schuurDeuropen.value_changed TO schuurdeur.rotation
+		# /achterdeur.wrl
+		# /deuren.wrl
+		# ramen.wrl
+		Transform {
+			children [
+				Shape {
+					appearance DEF kozijn Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .95 .95 .9
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry Box {
+						size .05 1.3 .05
+					}
+				}
+			]
+			translation .625 1.6 -.14
 		}
 		}
-			geometry Box { size	0.14	0.14	0.04	}
-}
-
-]
-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
-}
-
-	]
-translation 3.25	0.05	-0.14
-}
-
-#ROUTE klikopvoordeur.touchTime TO TimeSourcevoor.startTime
-#ROUTE TimeSourcevoor.fraction_changed TO VoorDeuropen.set_fraction
-#ROUTE VoorDeuropen.value_changed TO voordeur.rotation
-
-# /voordeur.wrl
-
-# achterdeur.wrl
-
-
-
-#bevat ook schuurdeur
-
-
-DEF achterdeur Transform {
-center 0 0 0 
-	children [
-
-
-		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 [
-
-	0.93	0	-0.025, #0
-	0	0	-0.025, #
-	0	2.09	-0.025, #
-	0.93	2.09	-0.025, #3
-
-	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
-
-	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
-
-	]
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 1.3 .05
+					}
 				}
 				}
-				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     []
-			}
+			]
+			translation 2.575 1.6 -.14
 		}
 		}
-
-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 ]
-  }
-
-
-
-Transform {
-    # ../boven/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
-
-                        -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,
-
-
-
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 1.3 .05
+					}
+				}
+			]
+			translation 1.475 1.6 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 1.3 .05
+					}
+				}
+			]
+			translation 1.725 1.6 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 2 .05 .05
+					}
+				}
+			]
+			translation 1.6 .925 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 2 .05 .05
+					}
+				}
+			]
+			translation 1.6 2.275 -.14
+		}
+		#einde keukenraam
+		#begin toiletraam
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 .7 .05
+					}
+				}
+			]
+			translation 4.865 1.95 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 .7 .05
+					}
+				}
+			]
+			translation 5.015 1.95 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .1 .05 .05
+					}
+				}
+			]
+			translation 4.94 1.625 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .1 .05 .05
+					}
+				}
+			]
+			translation 4.94 2.275 -.14
+		}
+		#einde toiletraam
+		#voordeur posten
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.26 .05
+					}
+				}
+			]
+			translation 3.215 1.17 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.26 .05
+					}
+				}
+			]
+			translation 4.395 1.17 -.14
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 1.13 .05 .05
+					}
+				}
+			]
+			translation 3.805 2.275 -.14
+		}
+		#einde deurposten
+		#begin kozijnen achter
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.1 .05
+					}
+				}
+			]
+			translation 3.215 1.65 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.1 .05
+					}
+				}
+			]
+			translation 4.775 1.65 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance DEF blauw Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .3 .4 .7
+							emissiveColor 0 0 0
+							shininess .1
+							specularColor 0 0 0
+							transparency 0
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry Box {
+						size 1.51 .5 .05
+					}
+				}
+			]
+			translation 3.995 2.45 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 1.51 .05 .05
+					}
+				}
+			]
+			translation 3.995 .625 -8.86
+		}
+		#1
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 1.51 .05 .05
+					}
+				}
+			]
+			translation 3.995 2.175 -8.86
+		}
+		#2
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .94 .05 .05
+					}
+				}
+			]
+			translation 2.72 .625 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 1.99 .05 .05
+					}
+				}
+			]
+			translation 2.195 2.675 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size 1 .05 .05
+					}
+				}
+			]
+			translation 1.725 2.175 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.61 .05
+					}
+				}
+			]
+			translation 1.225 1.345 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 2.61 .05
+					}
+				}
+			]
+			translation 2.225 1.345 -8.86
+		}
+		Transform {
+			children [
+				Shape {
+					appearance USE kozijn
+					geometry Box {
+						size .05 1.5 .05
+					}
+				}
+			]
+			translation 3.565 1.4 -8.86
+		}
+		#einde ramen achter
+		# /ramen.wrl
+		# ruiten.wrl
+		#begin vensterglas
+		Transform {
+			children [
+				Shape {
+					appearance DEF glas Appearance {
+						material Material {
+							ambientIntensity .2
+							diffuseColor .6 .6 .9
+							emissiveColor 0 0 0
+							shininess .8
+							specularColor 1 1 1
+							transparency .7
+						}
+						texture NULL
+						textureTransform NULL
+					}
+					geometry Box {
+						size .94 2 .01
+					}
+				}
+			]
+			translation 2.72 1.65 -8.86
+		}
+		#ruit 5 achter
+		#ruit1 keuken
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .8 1.3 .01
+					}
+				}
+			]
+			translation 1.05 1.6 -.14
+		}
+		#ruit 1 keuken
+		#ruit3 keuken
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .8 1.3 .01
+					}
+				}
+			]
+			translation 2.15 1.6 -.14
+		}
+		#ruit 3 keuken
+		#ruit2 keuken
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .2 1.3 .01
+					}
+				}
+			]
+			translation 1.6 1.6 -.14
+		}
+		#ruit 2 keuken
+		#toiletruit
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .1 .6 .01
+					}
+				}
+			]
+			translation 4.94 1.95 -.14
+		}
+		#ruit van toiletraam
+		#ramen achter
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size 1.16 1.5 .01
+					}
+				}
+			]
+			translation 4.17 1.4 -8.86
+		}
+		#ruit 3 achter
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .3 1.5 .01
+					}
+				}
+			]
+			translation 3.39 1.4 -8.86
+		}
+		#ruit 4 achter
+		Transform {
+			children [
+				Shape {
+					appearance USE glas
+					geometry Box {
+						size .95 .45 .01
+					}
+				}
+			]
+			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 .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, .2 .2 0, .2 -.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.141592
+						}
+						DEF schuifboven TouchSensor {
+						}
 					]
 					]
+					translation .15 2.95 .3
 				}
 				}
-				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
-    translation 0.50 1 0
-}
-
-
-
-
-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
-}
-
-#ROUTE klikopachterdeur.touchTime TO TimeSourceachter.startTime
-#ROUTE TimeSourceachter.fraction_changed TO achterDeuropen.set_fraction
-#ROUTE achterDeuropen.value_changed TO achterdeur.rotation
-
-#schuurdeur
-DEF schuurdeur Transform {
-children [
-
-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 ]
-  }
-
-Transform{
-    children[
-        Shape{
-            appearance 	USE deurkleur
-            geometry	USE deurInd
-        }
-    ]
-    scale 0.9139785	1	1   #maakt de deur op maat
-}
-
-USE ruitindeur
-
-Transform {
-    children USE deurklink
-    translation 0.43 1 0
-}
-
-
-]
-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
-
-
-
-
-# /deuren.wrl
-
-# ramen.wrl
-
-
-
-
-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
-}
-
-
-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 }
-}
-
-]
-translation	1.725 1.6 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	2 0.05 0.05 }
-}
-
-]
-translation	1.6 0.925 -0.14
-}
-
-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 }
-}
-
-]
-translation	4.865 1.95 -0.14
-}
-
-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 }
-}
-
-]
-translation	4.94 1.625 -0.14
-}
-
-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 }
-}
-
-]
-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 }
-}
-
-]
-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
-}
-
-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
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
-
-]
-translation	3.995 0.625 -8.86
-}#1
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
-
-]
-translation	3.995 2.175 -8.86
-}#2
-
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.94 0.05 0.05 }
-}
-
-]
-translation	2.72 0.625 -8.86
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.99 0.05 0.05 }
-}
-
-]
-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
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 2.61 0.05 }
-}
-
-]
-translation	2.225 1.345 -8.86
-}
-
-
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.5 0.05 }
-}
-
-]
-translation	3.565 1.4 -8.86
-}
-
-#einde ramen achter
-
-
-
-# /ramen.wrl
-
-# ruiten.wrl
-
-
-
-
-#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 }
-}
-
-]
-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 }
-}
-
-]
-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
-
-#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
-
-
-#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
-
-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
-
-Transform {
-	children [
-		Shape {
-appearance USE glas
-			geometry Box { size	0.95 0.45 0.01 }
-}
-
-]
-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,
-						
+				Transform {
+					children [
+						Shape {
+							appearance DEF rood Appearance {
+								material Material {
+									ambientIntensity 1
+									diffuseColor 1 0 0
+									emissiveColor 1 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry USE pijl
+						}
+						DEF schuifboven2 TouchSensor {
+						}
+					]
+					translation 5.48 2.95 .3
+				}
+				# boven/boven.wrl
+				Viewpoint {
+					fieldOfView 1
+					jump TRUE
+					orientation 1 0 0 0
+					position 2.5 3.75 -2.5
+					description "Ouderslaapkamer"
+				}
+				Viewpoint {
+					fieldOfView 1
+					jump TRUE
+					orientation 1 0 0 0
+					position 2.5 3.75 -5
+					description "Tweede slaapkamer"
+				}
+				Viewpoint {
+					fieldOfView 1
+					jump TRUE
+					orientation 1 0 0 0
+					position 4.5 3.75 -7
+					description "Kinderkamer"
+				}
+				Viewpoint {
+					fieldOfView 1
+					jump TRUE
+					orientation 1 0 0 0
+					position 4.5 3.75 -1.5
+					description "Badkamer"
+				}
+				#dak van schuur
+				Transform {
+					children [
+						Shape {
+							appearance DEF appdak Appearance {
+								material Material {
+									ambientIntensity 0
+									diffuseColor .2 .2 .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 .04 3.24
+							}
+						}
+					]
+					translation 4.6 2.62 6.2
+				}
+				DEF plafond Transform {
+					children [
+						Shape {
+							appearance Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor 1 1 1
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry IndexedFaceSet {
+								color NULL
+								coord Coordinate {
+									#default NULL
+									point [
+										.14 2.7 -.14, 5.54 2.7 -.14, 5.54 2.7 -8.86, .14 2.7 -8.86,
+										5.54 2.7 -2.36, #-4
+										5.54 2.7 -4.36, 4.42 2.7 -4.36, 4.42 2.7 -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 .2
+									diffuseColor 1 .5 .3
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry IndexedFaceSet {
+								color NULL
+								coord Coordinate {
+									#default NULL
+									point [
+										.14 2.8 -.14, 5.54 2.8 -.14, 5.54 2.8 -8.86, .14 2.8 -8.86,
+										5.54 2.8 -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 [
+								]
+							}
+						}
+					]
+				}
+				DEF stukmuur1 Transform {
+					children [
+						Shape {
+							appearance DEF wandkleur Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor 1 .9 .7
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size 2.84 2.5 .07
+							}
+						}
+					]
+					translation 1.7 4.05 -4.565
+				}
+				DEF stukmuur2 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .07 2.5 .7
+							}
+						}
+					]
+					translation 3.155 4.05 -4.28
+				}
+				DEF stukmuur3 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .07 2.68 3.57
+							}
+						}
 					]
 					]
+					translation 3.155 4.05 -7.215
 				}
 				}
-				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
-
-
-
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       2.5 3.75 -2.5
-
-	description    "Ouderslaapkamer"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       2.5 3.75 -5
-
-	description    "Tweede slaapkamer"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       4.5 3.75 -7
-
-	description    "Kinderkamer"
-}
-
-Viewpoint {
-	fieldOfView    1
-	jump           TRUE
-	orientation    1 0 0  0
-	position       4.5 3.75 -1.5
-
-	description    "Badkamer"
-}
-
-
-
-#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
-}
-
-
-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,
-
+				DEF stukmuur4 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .07 2.5 2.85
+							}
+						}
 					]
 					]
+					translation 3.155 4.05 -1.705
 				}
 				}
-				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,
-
+				DEF stukmuur5 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .42 2.5 .07
+							}
+						}
 					]
 					]
+					translation 3.4 4.05 -2.325
 				}
 				}
-				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 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
+				DEF stukmuur6 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .98 2.5 .07
+							}
+						}
+					]
+					translation 4.91 4.05 -2.325
 				}
 				}
-
-	}
- ]
-translation		1.7	4.05 -4.565
-}
-
-DEF stukmuur2 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 0.7
-				}
-
-	}
- ]
-translation		3.155	4.05 -4.28
-}
-
-
-DEF stukmuur3 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.68 3.57
-				}
-
-	}
- ]
-translation		3.155	4.05 -7.215
-}
-
-DEF stukmuur4 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 2.85
-				}
-
-	}
- ]
-translation		3.155	4.05 -1.705
-}
-
-DEF stukmuur5 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.42 2.50 0.07
-				}
-
-	}
- ]
-translation		3.4	4.05 -2.325
-}
-
-DEF stukmuur6 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.98 2.50 0.07
-				}
-
-	}
- ]
-translation		4.91	4.05 -2.325
-}
-
-DEF stukmuur7 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	1.34 2.50 0.07
-				}
-
-	}
- ]
-translation		4.73	4.05 -4.395
-}
-
-
-DEF stukmuur8 Transform {
-children[
-	Shape {
-	appearance USE wandkleur
-		geometry 	Box {
-	size	0.07 2.50 1.2
-				}
-
-	}
- ]
-translation		4.025	4.05 -4.96
-}
-
-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,
+				DEF stukmuur7 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size 1.34 2.5 .07
+							}
+						}
 					]
 					]
+					translation 4.73 4.05 -4.395
 				}
 				}
-				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     []
-			}
-		}
-	]
-}
-
-
-
-DEF paalvoortrap Transform {
-children[
-Shape {
-appearance 	USE wandkleur
-geometry	Box { size	0.07	2.50	0.07	}
-}
-]
-translation 4.385	4.05	-3.36
-}
-
-# deuren.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
-
-#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
-
-                        -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,
-
-
-
+				DEF stukmuur8 Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .07 2.5 1.2
+							}
+						}
 					]
 					]
+					translation 4.025 4.05 -4.96
 				}
 				}
-				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
-
-
-
-# /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
-}
-
-#ROUTE klikopdeur8.touchTime TO TimeSource8.startTime
-#ROUTE TimeSource8.fraction_changed TO Deuropen8.set_fraction
-#ROUTE Deuropen8.value_changed TO deurtweedeslaapkamergang.rotation
-
-
-#deur9
-Transform {
-children[ 	USE dwarslat
-		USE ruitjeboven 
-
-#deur
-DEF deurkinderkamergang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	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 
-
-#deur
-DEF deurbadkamergang Transform {
-center -0.4 0 0
-	children [
-
-
-
-	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
-}
-
-
-
-#ROUTE klikopdeur10.touchTime TO TimeSource10.startTime
-#ROUTE TimeSource10.fraction_changed TO Deuropen10.set_fraction
-#ROUTE Deuropen10.value_changed TO deurbadkamergang.rotation
-
-
-# /deuren.wrl
-
-# 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
-
+				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 [
+								]
+							}
+						}
 					]
 					]
 				}
 				}
-				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
-}
-
-
-# /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,
-
-						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	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, #
-
-						0	2.7	-9, #63
-						0.14	2.7	-8.86, #
-
-						5.68	2.7	-9, #65
-						5.54	2.7	-8.86, #
-
-						1.2	2.7	-9, #67
-						1.2	2.7	-8.86, #
-
-						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
-
+				DEF paalvoortrap Transform {
+					children [
+						Shape {
+							appearance USE wandkleur
+							geometry Box {
+								size .07 2.5 .07
+							}
+						}
 					]
 					]
+					translation 4.385 4.05 -3.36
 				}
 				}
-				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, 
-
-		59, 3, 76, 23, -1,
-
-		17, 48, 47, 16, -1,
-
-		18, 49, 48, 17, -1,
-
-		19, 50, 49, 18, -1,
-
-		20, 51, 50, 19, -1,
-
-		16, 47, 52, 21, -1,
-
-		3, 21, 52, 71, -1, 
-
-		20, 2, 72, 51, -1,
-
-		2, 27, 73, 72, -1,
-
-		27, 32, 56, 73, -1,
-
-		63, 64, 75, 76, -1,
-
-		3, 76, 75, 71, -1,
-
-		#27, 32, 69, 65, -1,
-		27, 65, 69, 32, -1,
-
-		32, 69, 70, 56, -1,
-
-		59, 17, 16, -1,
-
-		59, 61, 17, -1,
-
-		17, 61 , 18. -1,
-
-		18, 61, 19, -1,
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
-
-
-
-# /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,
-
-						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.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, #
-
-						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, #
-
-						4.8	2.7	-8.72, #73
-						4.8	2.7	-8.86, #
-
-						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
-
+				# deuren.wrl
+				#Deuren boven
+				#deur7
+				Transform {
+					children [
+						#dwarslat boven de deur
+						DEF dwarslat Transform {
+							children [
+								Shape {
+									appearance DEF kozijn Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .95 .95 .9
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 .05 .05
+									}
+								}
+							]
+							translation 0 2.035 0
+						}
+						DEF ruitjeboven Transform {
+							children [
+								Shape {
+									appearance DEF glas Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .6 .6 .9
+											emissiveColor 0 0 0
+											shininess .8
+											specularColor 1 1 1
+											transparency .7
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 .44 .01
+									}
+								}
+							]
+							translation 0 2.28 0
+						}
+						#ruit boven de deur
+						#deur
+						DEF deuroudersgang Transform {
+							center -.4 0 0
+							children [
+								DEF klikopdeur7 TouchSensor {
+								}
+								DEF TimeSource7 TimeSensor {
+									cycleInterval 20
+								}
+								# Run once for 20 sec.
+								# Animeer het openzwaaien van de deur rond de Y as:
+								DEF Deuropen7 OrientationInterpolator {
+									key [
+										0 .025 .05 .95 .975 1
+									]
+									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 Transform {
+									children [
+										DEF enehelft Shape {
+											appearance DEF aluminium Appearance {
+												material Material {
+													ambientIntensity .2
+													diffuseColor .4 .4 .5
+													emissiveColor 0 0 0
+													shininess .8
+													specularColor .4 .4 .5
+												}
+												texture NULL
+												textureTransform NULL
+											}
+											geometry IndexedFaceSet {
+												color NULL
+												coord Coordinate {
+													point [
+														-.015 .02 0, #0
+														.015 .02 0, .02 -.02 0, -.02 -.02 0, #3
+														-.01 -.015 .06, #4
+														.01 -.015 .06, -.01 .015 .03, .01 .015 .03, .005 .1 .035,
+														#8
+														-.005 .1 .035, -.005 .1 .055, .005 .1 .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.141592
+											translation 0 0 -.07
+										}
+										Transform {
+											children [
+												DEF vlakdeel Shape {
+													appearance USE aluminium
+													geometry Box {
+														size .18 .07 .01
+													}
+												}
+												#shape
+											]
+											translation -.03 0 -.005
+										}
+										Transform {
+											children [
+												USE vlakdeel
+											]
+											translation -.03 0 -.065
+										}
+									]
+									translation .35 0 .035
+									rotation 0 0 1 1.570796
+								}
+								#deurklink
+								# /deurklink.wrl
+								DEF deurvorm Shape {
+									appearance DEF deurkleur Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor .8 .8 .8
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry Box {
+										size .8 2 .05
+									}
+								}
+							]
+							translation 0 1.005 0
+						}
 					]
 					]
+					translation 3.155 2.8 -3.53
+					rotation 0 1 0 1.570796
 				}
 				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-
-
-
-		16, 21, 3, 63, -1,
-
-		19, 2, 20, -1,
-
-		63, 16, 17, 65, -1,
-
-		17, 18, 19, 65, -1,
-
-		2, 19, 65, -1,
-
-		69, 27, 2, 65, -1, 
-
-		63, 3, 61, 62, -1,
-
-		16, 47, 48, 17, -1,
-
-		17, 48, 49, 18, -1,
-
-		18, 49, 50, 19, -1, 
-
-		19, 50, 51, 20, -1, 
-
-		21, 52, 47, 16, -1,
-
-		73, 74, 56, 32, -1,
-
-		69, 73, 32, 27, -1,
-
-		3, 21, 52, 75 -1,
-
-		20, 2, 76, 51, -1,
-
-		3, 61, 79, 75, -1,
-
-		2, 27, 77, 76, -1,
-
-		62, 61, 79, 78, -1,
-
-		27, 32, 56, 77, -1,
-
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             FALSE
-				texCoordIndex     []
-			}
-		}
-	]
-}
-
-
-
-# /binmuur.wrl
-
-# ramen.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
-}
-
-geometry	Box { size	3.82 0.05 0.05 }
-}
-
-]
-translation	2.51 5.025 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	3.82 0.1 0.05 }
-}
-
-]
-translation	2.51 5.35 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.8 0.05 }
-}
-
-]
-translation	0.625 4.5 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.8 0.05 }
-}
-
-]
-translation	1.475 4.5 -0.14
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 0.25 0.05 }
-}
-
-]
-translation	4.395 5.175 -0.14
-}
-
-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
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.9 0.05 0.05 }
-}
-
-]
-translation	1.05 3.625 -0.14
-}
-
-#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
-}
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
-
-]
-translation	3.995 3.525 -8.86
-}#3
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	1.51 0.05 0.05 }
-}
-
-]
-translation	3.995 5.075 -8.86
-}#4
-
-
-
-
-
-
-
-Transform {
-	children [
-		Shape {
-appearance	USE kozijn 
-geometry	Box { size	0.05 1.5 0.05 }
-}
-
-]
-translation	3.565 4.3 -8.86
-}
-
-
-
-#einde ramen achter
-
-
-
-# /ramen.wrl
-
-# ruiten.wrl
-
-
-
-
-
-
-#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 }
-}
-
-]
-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 }
-}
-
-]
-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 }
-}
-
-]
-translation	4.17 4.3 -8.86
-}#ruit 1 achter
-
-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
-
-
-
-# /ruiten.wrl
-
-# /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
-
-					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	
-
-					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
-			
+				#moved to end
+				#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 -.4 0 0
+							children [
+								DEF klikopdeur8 TouchSensor {
+								}
+								DEF TimeSource8 TimeSensor {
+									cycleInterval 20
+								}
+								# Run once for 20 sec.
+								# Animeer het openzwaaien van de deur rond de Y as:
+								DEF Deuropen8 OrientationInterpolator {
+									key [
+										0 .025 .05 .95 .975 1
+									]
+									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.570796
 				}
 				}
-				normal            NULL
-				texCoord          NULL
-				ccw               TRUE
-				colorIndex        []
-				colorPerVertex    TRUE
-				convex            TRUE
-				coordIndex  [
-
-
-	0, 13, 14, 3, -1,
-	0, 3, 14, 13, -1,
-
-	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,
-
-	1, 12, 15, 2, -1, 
-	1, 2, 15, 12, -1,
-
-	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,
-	
-	4, 8, 11, 3, -1, 
-	4, 3, 11, 8, -1, 
-
-	20, 24, 27, 19, -1,
-	20, 19, 27, 24, -1,
-
-	5, 4, 8, 9, -1, 
-	5, 9, 8, 4, -1, 
-
-	21, 20, 24, 25, -1,
-	21, 25, 24, 20, -1, 
-
-	5, 9, 10, 6, -1,
-	5, 6, 10, 9, -1,
-
-	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,
-
-	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, 
-
-	3, 0, 16, 19, -1, 
-	3, 19, 16, 0, -1,
-
-	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,
-
-	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,
-
-	8, 11, 27, 24, -1,
-	8, 24, 27, 11, -1,
-
-	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,
-
-
-
-
-]     #default []
-				creaseAngle       0
-				normalIndex       []
-				normalPerVertex   TRUE
-				solid             TRUE
-				texCoordIndex     []
-			}
-		}
-	]
-}
-
-
-#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     []
-			}
-		}
-	]
-}
-
-
-
-
-
-
-# /dak/dak.wrl
-
-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,
-
-
+				#moved to end
+				#ROUTE klikopdeur8.touchTime TO TimeSource8.startTime
+				#ROUTE TimeSource8.fraction_changed TO Deuropen8.set_fraction
+				#ROUTE Deuropen8.value_changed TO deurtweedeslaapkamergang.rotation
+				#deur9
+				Transform {
+					children [
+						USE dwarslat
+						USE ruitjeboven
+						#deur
+						DEF deurkinderkamergang Transform {
+							center -.4 0 0
+							children [
+								DEF klikopdeur9 TouchSensor {
+								}
+								DEF TimeSource9 TimeSensor {
+									cycleInterval 20
+								}
+								# Run once for 20 sec.
+								# Animeer het openzwaaien van de deur rond de Y as:
+								DEF Deuropen9 OrientationInterpolator {
+									key [
+										0 .025 .05 .95 .975 1
+									]
+									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.141592
 				}
 				}
-				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,
+				#moved to end
+				#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
+						#deur
+						DEF deurbadkamergang Transform {
+							center -.4 0 0
+							children [
+								DEF klikopdeur10 TouchSensor {
+								}
+								DEF TimeSource10 TimeSensor {
+									cycleInterval 20
+								}
+								# Run once for 20 sec.
+								# Animeer het openzwaaien van de deur rond de Y as:
+								DEF Deuropen10 OrientationInterpolator {
+									key [
+										0 .025 .05 .95 .975 1
+									]
+									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
 				}
 				}
-				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,
-				
-				
+				#moved to end
+				#ROUTE klikopdeur10.touchTime TO TimeSource10.startTime
+				#ROUTE TimeSource10.fraction_changed TO Deuropen10.set_fraction
+				#ROUTE Deuropen10.value_changed TO deurbadkamergang.rotation
+				# /deuren.wrl
+				# trapboven.wrl
+				DEF trapboven Transform {
+					children [
+						Shape {
+							appearance Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor 1 .5 .3
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry DEF trap2 IndexedFaceSet {
+								color NULL
+								coord Coordinate {
+									#default NULL
+									point [
+										-.2 0 1, #0
+										0 .2 1, 0 .2 0, -.2 0 0, #3
+										.28 .4 1, #4
+										.6 .6 1, .98 .8 1, .98 1 .45, #7
+										.98 1.2 .25, #8
+										.98 1.4 0, .98 1.6 -.25, .98 1.8 -.45, #11
+										.98 2 -1, #12
+										.6 2.2 -1, .28 2.4 -1, 0 2.6 -1, #15
+										0 .6 0, #16
+										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
+										-.2 .2 1, #28
+										0 .4 1, 0 .4 0, -.2 .2 0, #31
+										.28 .6 1, #32
+										.6 .8 1, .98 1 1, .98 1.2 .45, #35
+										.98 1.4 .25, #36
+										.98 1.6 0, .98 1.8 -.25, .98 2 -.45, #39
+										.98 2.2 -1, #40
+										.6 2.4 -1, .28 2.6 -1, 0 2.8 -1, #43
+										0 0 1, 0 0 0, #45
+										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
 				}
 				}
-				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
+				# /trapboven.wrl
+				# buitmuur.wrl
+				Transform {
+					children [
+						Shape {
+							appearance DEF steen Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .8 .4 .3
+									emissiveColor 0 0 0
+									shininess .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.4 0, 0 5.4 0, #linkerbovenhoek voorgevel
+										3.19 0 0, #voordeur
+										4.42 0 0, 4.42 2.3 0, 3.19 2.3 0, #voordeur
+										4.84 1.6 0, #toiletraam-8
+										5.04 1.6 0, 5.04 2.3 0, 4.84 2.3 0, 2.6 .9 0, #keukenraam-12
+										2.6 2.3 0, .6 2.3 0, .6 .9 0, .6 3.6 0, #bovenraam-16
+										1.5 3.6 0, 1.5 5 0, 4.42 5 0, 4.42 5.4 0, .6 5.4 0, 0 8.555 -3.15,
+										#linkergevel-22
+										0 2.7 -9, 0 0 -9, 5.68 8.555 -3.15, #rechtergevel-25
+										5.68 5.4 -6.3, 5.68 5.4 -9, 5.68 0 -9, 2.25 0 -9, #achtergevel-29
+										2.25 .6 -9, 4.8 .6 -9, 4.8 5.4 -9, 1.2 0 -9, 1.2 2.7 -9, 3.19 0 -.14,
+										#diepte van de voordeur-35
+										4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+										2.6 .9 -.14, # diepte van het keukenraam-39
+										2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+										5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+										#diepte van het bovenraam-47
+										1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+										#52
+										2.25 0 -8.86, #diepte van de achtergevel-53
+										2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+										#58
+										0 2.7 0, #59 extra punten voor segmentering beneden
+										.14 2.7 -.14, 5.68 2.7 0, #61
+										5.54 2.7 -.14, #
+										0 2.7 -9, #63
+										.14 2.7 -8.86, #
+										5.68 2.7 -9, #65
+										5.54 2.7 -8.86, #
+										1.2 2.7 -9, #67
+										1.2 2.7 -8.86, #
+										4.8 2.7 -9, #69
+										4.8 2.7 -8.86, #
+										.14 5.4 -.14, #71
+										5.54 5.4 -.14, #72
+										5.54 5.4 -8.86, #73
+										.14 2.7 -9, #74
+										.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, 59 3 76 23 -1, 17 48
+									47 16 -1, 18 49 48 17 -1, 19 50 49 18 -1, 20 51 50 19 -1, 16 47 52 21 -1,
+									3 21 52 71 -1, 20 2 72 51 -1, 2 27 73 72 -1, 27 32 56 73 -1, 63 64 75 76 -1,
+									3 76 75 71 -1, #27, 32, 69, 65, -1,
+									27 65 69 32 -1, 32 69 70 56 -1, 59 17 16 -1, 59 61 17 -1, 17 61 18 -1, 18
+									61 19 -1,
+								]
+								#default []
+								creaseAngle 0
+								normalIndex [
+								]
+								normalPerVertex TRUE
+								solid FALSE
+								texCoordIndex [
+								]
+							}
+						}
 					]
 					]
 				}
 				}
-				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,
+				# /buitmuur.wrl
+				# binmuur.wrl
+				Transform {
+					children [
+						Shape {
+							appearance Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor 1 .9 .7
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry IndexedFaceSet {
+								color NULL
+								coord Coordinate {
+									#default NULL
+									point [
+										.28 0 -.28, #0 linkerbenedenhoek voorgevel
+										5.4 0 -.28, 5.4 5.4 -.28, .28 5.4 -.28, #3 linkerbovenhoek voorgevel
+										3.19 0 -.28, #4 voordeur
+										4.42 0 -.28, 4.42 2.3 -.28, 3.19 2.3 -.28, #7 voordeur
+										4.84 1.6 -.28, #toiletraam-8
+										5.04 1.6 -.28, 5.04 2.3 -.28, 4.84 2.3 -.28, 2.6 .9 -.28,
+										#keukenraam-12
+										2.6 2.3 -.28, .6 2.3 -.28, .6 .9 -.28, .6 3.6 -.28, #bovenraam-16
+										1.5 3.6 -.28, 1.5 5 -.28, 4.42 5 -.28, 4.42 5.4 -.28, .6 5.4 -.28,
+										.28 8.55 -3.15, #linkergevel-22
+										.28 2.7 -8.72, .28 0 -8.72, 5.4 8.55 -3.15, #rechtergevel-25
+										5.4 5.4 -6.3, 5.4 5.4 -8.72, 5.4 0 -8.72, 2.25 0 -8.72, #achtergevel-29
+										2.25 .6 -8.72, 4.8 .6 -8.72, 4.8 5.4 -8.72, 1.2 0 -8.72, 1.2 2.7 -8.72,
+										3.19 0 -.14, #diepte van de voordeur-35
+										4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+										2.6 .9 -.14, # diepte van het keukenraam-39
+										2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+										5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+										#diepte van het bovenraam-47
+										1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+										#52
+										2.25 0 -8.86, #diepte van de achtergevel-53
+										2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+										#58
+										.28 5.4 0, #59 hoekpunt voor dakvorm zolder
+										5.4 5.4 0, .28 5.4 -6.3, #61
+										.28 2.7 -9, #62 hoekpunt voor dakvorm 1e verdieping
+										.28 2.7 -.28, #63 extra punten voor segmentering boven
+										.14 2.7 -.14, 5.4 2.7 -.28, #65
+										5.54 2.7 -.14, #
+										.28 2.7 -8.72, #67
+										.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, #
+										4.8 2.7 -8.72, #73
+										4.8 2.7 -8.86, #
+										.14 5.4 -.14, #75
+										5.54 5.4 -.14, #76
+										5.54 5.4 -8.86, #77
+										.14 2.7 -9, #78
+										.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, 63 16 17 65 -1, 17 18 19 65 -1, 2 19 65 -1, 69
+									27 2 65 -1, 63 3 61 62 -1, 16 47 48 17 -1, 17 48 49 18 -1, 18 49 50 19 -1,
+									19 50 51 20 -1, 21 52 47 16 -1, 73 74 56 32 -1, 69 73 32 27 -1, 3 21 52 75
+									-1, 20 2 76 51 -1, 3 61 79 75 -1, 2 27 77 76 -1, 62 61 79 78 -1, 27 32 56
+									77 -1,
+								]
+								#default []
+								creaseAngle 0
+								normalIndex [
+								]
+								normalPerVertex TRUE
+								solid FALSE
+								texCoordIndex [
+								]
+							}
+						}
+					]
+				}
+				# /binmuur.wrl
+				# ramen.wrl
+				#begin bovenraam
+				Transform {
+					children [
+						Shape {
+							appearance DEF kozijn Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .95 .95 .9
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size 3.82 .05 .05
+							}
+						}
+					]
+					translation 2.51 5.025 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size 3.82 .1 .05
+							}
+						}
+					]
+					translation 2.51 5.35 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 1.8 .05
+							}
+						}
+					]
+					translation .625 4.5 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 1.8 .05
+							}
+						}
+					]
+					translation 1.475 4.5 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 .25 .05
+							}
+						}
+					]
+					translation 4.395 5.175 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance DEF blauw Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .3 .4 .7
+									emissiveColor 0 0 0
+									shininess .1
+									specularColor 0 0 0
+									transparency 0
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .9 .25 .05
+							}
+						}
+					]
+					translation 3.05 5.175 -.14
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .9 .05 .05
+							}
+						}
+					]
+					translation 1.05 3.625 -.14
+				}
+				#einde bovenraam
+				#begin kozijnen achter
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 2.4 .05
+							}
+						}
+					]
+					translation 3.215 3.9 -8.86
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 2.4 .05
+							}
+						}
+					]
+					translation 4.775 3.9 -8.86
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE blauw
+							geometry Box {
+								size 1.61 .3 .05
+							}
+						}
+					]
+					translation 3.995 5.25 -8.86
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE blauw
+							geometry Box {
+								size 1.51 .8 .05
+							}
+						}
+					]
+					translation 3.995 3.1 -8.86
+				}
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size 1.51 .05 .05
+							}
+						}
+					]
+					translation 3.995 3.525 -8.86
+				}
+				#3
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size 1.51 .05 .05
+							}
+						}
+					]
+					translation 3.995 5.075 -8.86
+				}
+				#4
+				Transform {
+					children [
+						Shape {
+							appearance USE kozijn
+							geometry Box {
+								size .05 1.5 .05
+							}
+						}
+					]
+					translation 3.565 4.3 -8.86
+				}
+				#einde ramen achter
+				# /ramen.wrl
+				# ruiten.wrl
+				#bovenruiten
+				Transform {
+					children [
+						Shape {
+							appearance DEF glas Appearance {
+								material Material {
+									ambientIntensity .2
+									diffuseColor .6 .6 .9
+									emissiveColor 0 0 0
+									shininess .8
+									specularColor 1 1 1
+									transparency .7
+								}
+								texture NULL
+								textureTransform NULL
+							}
+							geometry Box {
+								size .8 1.35 .01
+							}
+						}
+					]
+					translation 1.05 4.325 -.14
+				}
+				#ruit 1 boven
+				Transform {
+					children [
+						Shape {
+							appearance USE glas
+							geometry Box {
+								size .8 .3 .01
+							}
+						}
+					]
+					translation 1.05 5.2 -.14
+				}
+				#ruit 2 boven
+				Transform {
+					children [
+						Shape {
+							appearance USE glas
+							geometry Box {
+								size 1.1 .3 .01
+							}
+						}
+					]
+					translation 2.05 5.2 -.14
+				}
+				#ruit 3 boven
+				Transform {
+					children [
+						Shape {
+							appearance USE glas
+							geometry Box {
+								size .85 .3 .01
+							}
+						}
+					]
+					translation 3.935 5.2 -.14
+				}
+				#ruit 4 boven
+				#ramen achter
+				Transform {
+					children [
+						Shape {
+							appearance USE glas
+							geometry Box {
+								size 1.16 1.5 .01
+							}
+						}
+					]
+					translation 4.17 4.3 -8.86
+				}
+				#ruit 1 achter
+				Transform {
+					children [
+						Shape {
+							appearance USE glas
+							geometry Box {
+								size .3 1.5 .01
+							}
+						}
+					]
+					translation 3.39 4.3 -8.86
+				}
+				#ruit 2 achter
+				# /ruiten.wrl
+				# /boven/boven.wrl
+				DEF zolder Transform {
+					children [
+						Transform {
+							children [
+								Transform {
+									children [
+										Shape {
+											appearance USE groen
+											geometry USE pijl
+										}
+									]
+									rotation 0 1 0 3.141592
+								}
+								DEF schuifzolder TouchSensor {
+								}
+							]
+							translation .15 5.4 .3
+						}
+						Transform {
+							children [
+								Shape {
+									appearance USE rood
+									geometry USE pijl
+								}
+								DEF schuifzolder2 TouchSensor {
+								}
+							]
+							translation 5.48 5.4 .3
+						}
+						DEF dak Transform {
+							children [
+								# dak/dak.wrl
+								Transform {
+									children [
+										Shape {
+											appearance Appearance {
+												material Material {
+													ambientIntensity .2
+													diffuseColor .3 .4 .5
+													emissiveColor 0 0 0
+													shininess .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.3, 5.68 5.4 -6.3, #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 .04, #dikte van dakranden-16
+														5.68 5.44 .04, 5.68 8.606568 -3.15, 0 8.606568 -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 
+														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 [
+													0 13 14 3 -1, 0 3 14 13 -1, 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, 1 12 15 2 -1, 1 2 15 12 -1,
+													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, 4 8 11 3 -1, 4 3 11 8 -1, 20 24 27 19 -1, 20 19 27 24 -1,
+													5 4 8 9 -1, 5 9 8 4 -1, 21 20 24 25 -1, 21 25 24 20 -1, 5 9 10 6 -1, 5 6 10
+													9 -1, 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, 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, 3 0 16 19 -1, 3 19 16 0 -1, 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, 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,
+													8 11 27 24 -1, 8 24 27 11 -1, 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,
+												]
+												#default []
+												creaseAngle 0
+												normalIndex [
+												]
+												normalPerVertex TRUE
+												solid TRUE
+												texCoordIndex [
+												]
+											}
+										}
+									]
+								}
+								#schoorsteen
+								Transform {
+									children [
+										Shape {
+											appearance Appearance {
+												material Material {
+													ambientIntensity .2
+													diffuseColor .1 .1 .1
+													emissiveColor 0 0 0
+													shininess .1
+													specularColor .3 .3 .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, 4.8 8.4 -3, 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 [
+												]
+											}
+										}
+									]
+								}
+								# /dak/dak.wrl
+								Transform {
+									children [
+										Transform {
+											children [
+												Shape {
+													appearance USE groen
+													geometry USE pijl
+												}
+											]
+											rotation 0 1 0 3.141592
+										}
+										DEF schuifdak TouchSensor {
+										}
+									]
+									translation .15 6 .3
+								}
+								Transform {
+									children [
+										Shape {
+											appearance USE rood
+											geometry USE pijl
+										}
+										DEF schuifdak2 TouchSensor {
+										}
+									]
+									translation 5.48 6 .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 .2 .2 .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 .04 2.74
+									}
+								}
+							]
+							translation 4.39 5.4 -7.67
+						}
+						DEF zoldervloer Transform {
+							children [
+								Shape {
+									appearance Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor 1 .5 .3
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry IndexedFaceSet {
+										color NULL
+										coord Coordinate {
+											#default NULL
+											point [
+												.14 5.4 0, 5.54 5.4 0, 5.54 5.4 -6.3, .14 5.4 -6.3, 5.54 5.4 -2.36,
+												#-4
+												5.54 5.4 -4.36, 4.42 5.4 -4.36, 4.42 5.4 -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 .2
+											diffuseColor 1 1 1
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry IndexedFaceSet {
+										color NULL
+										coord Coordinate {
+											#default NULL
+											point [
+												.14 5.3 -.14, 5.54 5.3 -.14, 5.54 5.3 -8.86, 3.19 5.3 -8.86,
+												5.54 5.3 -2.36, #-4
+												5.54 5.3 -4.36, 4.42 5.3 -4.36, 4.42 5.3 -2.36, 3.19 5.3 -6.4,
+												.14 5.3 -6.4,
+											]
+										}
+										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 .2
+											diffuseColor 1 .9 .7
+											emissiveColor 0 0 0
+											shininess .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 .2
+															diffuseColor .95 .95 .9
+															emissiveColor 0 0 0
+															shininess .1
+															specularColor 0 0 0
+															transparency 0
+														}
+														texture NULL
+														textureTransform NULL
+													}
+													geometry Cylinder {
+														bottom FALSE
+														height .8
+														radius .015
+														side TRUE
+														top FALSE
+													}
+												}
+											]
+											translation -.025 .4 .05
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .15
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .25
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .35
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .45
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .55
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .65
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .75
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .85
+										}
+										Transform {
+											children USE spijl
+											translation -.025 .4 .95
+										}
+									]
+								}
+								#spijlengroup
+								Transform {
+									translation 0 0 1
+									rotation 0 1 0 1.570796
+									children USE spijlen
+								}
+								Transform {
+									children [
+										Shape {
+											appearance USE kozijn
+											geometry Box {
+												size .05 .03 1.05
+											}
+										}
+									]
+									translation -.025 .815 .525
+								}
+								Transform {
+									children [
+										Shape {
+											appearance USE kozijn
+											geometry Box {
+												size 1 .03 .05
+											}
+										}
+									]
+									translation .5 .815 1.025
+								}
+							]
+							translation 4.42 5.4 -3.36
+						}
+						# /ballustrade.wrl
+						# binmuur.wrl
+						Transform {
+							children [
+								Shape {
+									appearance Appearance {
+										material Material {
+											ambientIntensity .2
+											diffuseColor 1 .9 .7
+											emissiveColor 0 0 0
+											shininess .1
+											specularColor 0 0 0
+											transparency 0
+										}
+										texture NULL
+										textureTransform NULL
+									}
+									geometry IndexedFaceSet {
+										color NULL
+										coord Coordinate {
+											#default NULL
+											point [
+												.28 0 -.28, #0 linkerbenedenhoek voorgevel
+												5.4 0 -.28, 5.4 5.4 -.28, .28 5.4 -.28, #3 linkerbovenhoek voorgevel
+												3.19 0 -.28, #4 voordeur
+												4.42 0 -.28, 4.42 2.3 -.28, 3.19 2.3 -.28, #7 voordeur
+												4.84 1.6 -.28, #toiletraam-8
+												5.04 1.6 -.28, 5.04 2.3 -.28, 4.84 2.3 -.28, 2.6 .9 -.28,
+												#keukenraam-12
+												2.6 2.3 -.28, .6 2.3 -.28, .6 .9 -.28, .6 3.6 -.28, #bovenraam-16
+												1.5 3.6 -.28, 1.5 5 -.28, 4.42 5 -.28, 4.42 5.4 -.28, .6 5.4 -.28,
+												.28 8.55 -3.15, #linkergevel-22
+												.28 2.7 -8.72, .28 0 -8.72, 5.4 8.55 -3.15, #rechtergevel-25
+												5.4 5.4 -6.3, 5.4 5.4 -8.72, 5.4 0 -8.72, 2.25 0 -8.72, #achtergevel-29
+												2.25 .6 -8.72, 4.8 .6 -8.72, 4.8 5.4 -8.72, 1.2 0 -8.72, 1.2 2.7 -8.72,
+												3.19 0 -.14, #diepte van de voordeur-35
+												4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+												2.6 .9 -.14, # diepte van het keukenraam-39
+												2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+												5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+												#diepte van het bovenraam-47
+												1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+												#52
+												2.25 0 -8.86, #diepte van de achtergevel-53
+												2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+												#58
+												.28 5.4 0, #59 hoekpunt voor dakvorm zolder
+												5.4 5.4 0, .28 5.4 -6.3, #61
+												.28 2.7 -9, #62 hoekpunt voor dakvorm 1e verdieping
+												.14 5.4 0, #63 extra punten voor segmentering
+												5.54 5.4 0, .14 5.4 -6.3, 5.54 5.4 -6.3, #66
+												5.54 8.55 -3.15, #rechtergevel-67
+												.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 .2
+											diffuseColor .8 .4 .3
+											emissiveColor 0 0 0
+											shininess .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.4 0, 0 5.4 0, #linkerbovenhoek voorgevel
+												3.19 0 0, #voordeur
+												4.42 0 0, 4.42 2.3 0, 3.19 2.3 0, #voordeur
+												4.84 1.6 0, #toiletraam-8
+												5.04 1.6 0, 5.04 2.3 0, 4.84 2.3 0, 2.6 .9 0, #keukenraam-12
+												2.6 2.3 0, .6 2.3 0, .6 .9 0, .6 3.6 0, #bovenraam-16
+												1.5 3.6 0, 1.5 5 0, 4.42 5 0, 4.42 5.4 0, .6 5.4 0, 0 8.555 -3.15,
+												#linkergevel-22
+												0 2.7 -9, 0 0 -9, 5.68 8.555 -3.15, #rechtergevel-25
+												5.68 5.4 -6.3, 5.68 5.4 -9, 5.68 0 -9, 2.25 0 -9, #achtergevel-29
+												2.25 .6 -9, 4.8 .6 -9, 4.8 5.4 -9, 1.2 0 -9, 1.2 2.7 -9, 3.19 0 -.14,
+												#diepte van de voordeur-35
+												4.42 0 -.14, 4.42 2.3 -.14, 3.19 2.3 -.14, #diepte van de voordeur-38
+												2.6 .9 -.14, # diepte van het keukenraam-39
+												2.6 2.3 -.14, .6 2.3 -.14, .6 .9 -.14, 4.84 1.6 -.14, #diepte van het toiletraam-43
+												5.04 1.6 -.14, 5.04 2.3 -.14, 4.84 2.3 -.14, .6 3.6 -.14,
+												#diepte van het bovenraam-47
+												1.5 3.6 -.14, 1.5 5 -.14, 4.42 5 -.14, 4.42 5.4 -.14, .6 5.4 -.14,
+												#52
+												2.25 0 -8.86, #diepte van de achtergevel-53
+												2.25 .6 -8.86, 4.8 .6 -8.86, 4.8 5.4 -8.86, 1.2 0 -8.86, 1.2 2.7 -8.86,
+												#58
+												.14 5.4 0, #59 extra punten voor segmentering
+												5.54 5.4 0, .14 5.4 -6.3, 5.54 5.4 -6.3, #62
+												5.54 8.55 -3.15, #rechtergevel-63
+												.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 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
 					]
 					]
 				}
 				}
-				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     []
-			}
+			]
 		}
 		}
+		#boven
 	]
 	]
 }
 }
-
-
-
-# /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 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]
-}
-
-
-]
-}#boven
-
-
-
-]
-}
-
-#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 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 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
-
+#moved from above
+ROUTE klikopdeur.touchTime TO TimeSource.startTime
+ROUTE TimeSource.fraction_changed TO Deuropen.set_fraction
+ROUTE Deuropen.value_changed TO deur.rotation
+ROUTE klikopdeur2.touchTime TO TimeSource2.startTime
+ROUTE TimeSource2.fraction_changed TO Deuropen2.set_fraction
+ROUTE Deuropen2.value_changed TO deurkeukengang.rotation
+ROUTE klikopdeur3.touchTime TO TimeSource3.startTime
+ROUTE TimeSource3.fraction_changed TO Deuropen3.set_fraction
+ROUTE Deuropen3.value_changed TO deurwoonkamergang.rotation
+ROUTE klikopdeur4.touchTime TO TimeSource4.startTime
+ROUTE TimeSource4.fraction_changed TO Deuropen4.set_fraction
+ROUTE Deuropen4.value_changed TO deurwoonkamertrapkast.rotation
+ROUTE klikopdeur5.touchTime TO TimeSource5.startTime
+ROUTE TimeSource5.fraction_changed TO Deuropen5.set_fraction
+ROUTE Deuropen5.value_changed TO deurgangmeterkast.rotation
+ROUTE klikopdeur6.touchTime TO TimeSource6.startTime
+ROUTE TimeSource6.fraction_changed TO Deuropen6.set_fraction
+ROUTE Deuropen6.value_changed TO deurtoiletgang.rotation
+ROUTE klikopvoordeur.touchTime TO TimeSourcevoor.startTime
+ROUTE TimeSourcevoor.fraction_changed TO VoorDeuropen.set_fraction
+ROUTE VoorDeuropen.value_changed TO voordeur.rotation
+ROUTE klikopachterdeur.touchTime TO TimeSourceachter.startTime
+ROUTE TimeSourceachter.fraction_changed TO achterDeuropen.set_fraction
+ROUTE achterDeuropen.value_changed TO achterdeur.rotation
+ROUTE klikopschuurdeur.touchTime TO TimeSourceschuur.startTime
+ROUTE TimeSourceschuur.fraction_changed TO schuurDeuropen.set_fraction
+ROUTE schuurDeuropen.value_changed TO schuurdeur.rotation
+ROUTE klikopdeur7.touchTime TO TimeSource7.startTime
+ROUTE TimeSource7.fraction_changed TO Deuropen7.set_fraction
+ROUTE Deuropen7.value_changed TO deuroudersgang.rotation
+ROUTE klikopdeur8.touchTime TO TimeSource8.startTime
+ROUTE TimeSource8.fraction_changed TO Deuropen8.set_fraction
+ROUTE Deuropen8.value_changed TO deurtweedeslaapkamergang.rotation
+ROUTE klikopdeur9.touchTime TO TimeSource9.startTime
+ROUTE TimeSource9.fraction_changed TO Deuropen9.set_fraction
+ROUTE Deuropen9.value_changed TO deurkinderkamergang.rotation
+ROUTE klikopdeur10.touchTime TO TimeSource10.startTime
+ROUTE TimeSource10.fraction_changed TO Deuropen10.set_fraction
+ROUTE Deuropen10.value_changed TO deurbadkamergang.rotation
+#uncommented
+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 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 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

+ 3 - 3
examples/webgl_geometry_extrude_shapes2.html

@@ -289,7 +289,7 @@ var addGeoObject = function( group, svgObject ) {
 	len = thePaths.length;
 	len = thePaths.length;
 	for (i = 0; i < len; ++i) {
 	for (i = 0; i < len; ++i) {
 		path = $d3g.transformSVGPath( thePaths[i] );
 		path = $d3g.transformSVGPath( thePaths[i] );
-		color = new THREE.Color( theColors[i] ); 
+		color = new THREE.Color( theColors[i] );
 		material = new THREE.MeshLambertMaterial({
 		material = new THREE.MeshLambertMaterial({
 			color: color,
 			color: color,
 			emissive: color
 			emissive: color
@@ -342,7 +342,7 @@ var init3d = function(){
 	scene.add( ambientLight );
 	scene.add( ambientLight );
 
 
 	/// backgroup grids
 	/// backgroup grids
-	var helper = new THREE.GridHelper( 80, 10 );
+	var helper = new THREE.GridHelper( 160, 10 );
 	helper.rotation.x = Math.PI / 2;
 	helper.rotation.x = Math.PI / 2;
 	group.add( helper );
 	group.add( helper );
 
 
@@ -371,7 +371,7 @@ var initSVGObject = function() {
 		"L350.9772,115.1221 L354.5759,112.5371 L354.5667,110.6949 L357.4098,105.7489 L362.3963,101.8443 " +
 		"L350.9772,115.1221 L354.5759,112.5371 L354.5667,110.6949 L357.4098,105.7489 L362.3963,101.8443 " +
 		"L364.4415,101.0819 L364.5314,101.0828 L364.6209,101.1230 L364.7698,101.2029 L368.1221,101.5115 " +
 		"L364.4415,101.0819 L364.5314,101.0828 L364.6209,101.1230 L364.7698,101.2029 L368.1221,101.5115 " +
 		"L371.7216,104.1338 L372.2958,106.7261 L375.5949,109.6971 L377.0415,108.8875 L377.0737,108.6526 " +
 		"L371.7216,104.1338 L372.2958,106.7261 L375.5949,109.6971 L377.0415,108.8875 L377.0737,108.6526 " +
-		"L377.4037,108.6165 L376.8840,109.7091 L376.7323,109.9037 L377.9416,112.0705 L371.7970,114.8736 " + 
+		"L377.4037,108.6165 L376.8840,109.7091 L376.7323,109.9037 L377.9416,112.0705 L371.7970,114.8736 " +
 		"L374.0935,119.4031 L380.7848,122.7963 L382.6529,121.9897 L381.5792,117.8256 L385.0339,117.3069 " +
 		"L374.0935,119.4031 L380.7848,122.7963 L382.6529,121.9897 L381.5792,117.8256 L385.0339,117.3069 " +
 		"L385.4082,115.6247 L388.7014,116.3969 L389.8697,116.6024 L390.0206,116.4860 L391.0396,116.6118 " +
 		"L385.4082,115.6247 L388.7014,116.3969 L389.8697,116.6024 L390.0206,116.4860 L391.0396,116.6118 " +
 		"L394.6665,116.9929 L394.4694,119.2255 L394.3172,119.4987 L395.3792,121.8977 L395.2728,124.0526 " +
 		"L394.6665,116.9929 L394.4694,119.2255 L394.3172,119.4987 L395.3792,121.8977 L395.2728,124.0526 " +

+ 1 - 1
examples/webgl_geometry_spline_editor.html

@@ -89,7 +89,7 @@
 				plane.receiveShadow = true;
 				plane.receiveShadow = true;
 				scene.add( plane );
 				scene.add( plane );
 
 
-				var helper = new THREE.GridHelper( 1000, 100 );
+				var helper = new THREE.GridHelper( 2000, 100 );
 				helper.position.y = - 199;
 				helper.position.y = - 199;
 				helper.material.opacity = 0.25;
 				helper.material.opacity = 0.25;
 				helper.material.transparent = true;
 				helper.material.transparent = true;

+ 1 - 1
examples/webgl_helpers.html

@@ -45,7 +45,7 @@
 
 
 				scene.add( new THREE.PointLightHelper( light, 5 ) );
 				scene.add( new THREE.PointLightHelper( light, 5 ) );
 
 
-				var gridHelper = new THREE.GridHelper( 200, 40, 0x0000ff, 0x808080 );
+				var gridHelper = new THREE.GridHelper( 400, 40, 0x0000ff, 0x808080 );
 				gridHelper.position.y = - 150;
 				gridHelper.position.y = - 150;
 				gridHelper.position.x = - 150;
 				gridHelper.position.x = - 150;
 				scene.add( gridHelper );
 				scene.add( gridHelper );

+ 1 - 1
examples/webgl_loader_amf.html

@@ -74,7 +74,7 @@
 
 
 				scene.add( camera );
 				scene.add( camera );
 
 
-				var grid = new THREE.GridHelper( 25, 50, 0xffffff, 0x555555 );
+				var grid = new THREE.GridHelper( 50, 50, 0xffffff, 0x555555 );
 				grid.rotateOnAxis( new THREE.Vector3( 1, 0, 0 ), 90 * ( Math.PI/180 ) );
 				grid.rotateOnAxis( new THREE.Vector3( 1, 0, 0 ), 90 * ( Math.PI/180 ) );
 				scene.add( grid );
 				scene.add( grid );
 
 

+ 1 - 1
examples/webgl_loader_bvh.html

@@ -71,7 +71,7 @@
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 
-				scene.add( new THREE.GridHelper( 200, 10 ) );
+				scene.add( new THREE.GridHelper( 400, 10 ) );
 
 
 				// renderer
 				// renderer
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer = new THREE.WebGLRenderer( { antialias: true } );

+ 6 - 38
examples/webgl_loader_fbx.html

@@ -36,7 +36,7 @@
 
 
 		<script src="js/curves/NURBSCurve.js"></script>
 		<script src="js/curves/NURBSCurve.js"></script>
 		<script src="js/curves/NURBSUtils.js"></script>
 		<script src="js/curves/NURBSUtils.js"></script>
-		<script src="js/loaders/FBXLoader.js"></script>
+		<script src="js/loaders/FBXLoader2.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>
@@ -64,7 +64,7 @@
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 
 				// grid
 				// grid
-				var gridHelper = new THREE.GridHelper( 14, 28, 0x303030, 0x303030 );
+				var gridHelper = new THREE.GridHelper( 28, 28, 0x303030, 0x303030 );
 				gridHelper.position.set( 0, - 0.04, 0 );
 				gridHelper.position.set( 0, - 0.04, 0 );
 				scene.add( gridHelper );
 				scene.add( gridHelper );
 
 
@@ -97,29 +97,11 @@
 				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_skinning.fbx', function( object ) {
 
 
-					object.traverse( function( child ) {
+					object.mixer = new THREE.AnimationMixer( object );
+					mixers.push( object.mixer );
 
 
-						if ( child instanceof THREE.Mesh ) {
-
-							// pass
-
-						}
-
-						if ( child instanceof THREE.SkinnedMesh ) {
-
-							if ( child.geometry.animations !== undefined || child.geometry.morphAnimations !== undefined ) {
-
-								child.mixer = new THREE.AnimationMixer( child );
-								mixers.push( child.mixer );
-
-								var action = child.mixer.clipAction( child.geometry.animations[ 0 ] );
-								action.play();
-
-							}
-
-						}
-
-					} );
+					var action = object.mixer.clipAction( object.animations[ 0 ] );
+					action.play();
 
 
 					scene.add( object );
 					scene.add( object );
 
 
@@ -128,20 +110,6 @@
 
 
 				loader.load( 'models/fbx/nurbs.fbx', function( object ) {
 				loader.load( 'models/fbx/nurbs.fbx', function( object ) {
 
 
-					object.traverse( function( child ) {
-
-						if ( child instanceof THREE.Line ) {
-
-							child.material = new THREE.LineBasicMaterial( { color: 0xffffff, linewidth: 5 } );
-							// Generate a more detailed geometry
-							var nurbsGeometry = new THREE.Geometry();
-							nurbsGeometry.vertices = child.userData.curve.getPoints( 100 );
-							child.geometry = nurbsGeometry;
-
-						}
-
-					} );
-
 					scene.add( object );
 					scene.add( object );
 
 
 				}, onProgress, onError );
 				}, onProgress, onError );

+ 74 - 94
examples/webgl_loader_gltf.html

@@ -31,98 +31,67 @@
 			}
 			}
 
 
 			#controls {
 			#controls {
-				position:absolute;
-				width:250px;
-				bottom:0%;
-				right:0%;
-				height:132px;
-				background-color:White;
-				opacity:.9;
-				font: 13px/1.231 "Lucida Grande", Lucida, Verdana, sans-serif;
-			}
-
-			#status {
-				position:absolute;
-				width:25%;
-				left:2%;
-				top:95%;
-				height:5%;
-				opacity:.9;
-				font: 13px/1.231 "Lucida Grande", Lucida, Verdana, sans-serif;
-			}
-
-			.control {
-				position:absolute;
-				margin-left:12px;
-				width:100%;
-				font-weight:bold;
-			}
-
-			.controlValue {
-				position:absolute;
-				left:36%;
-				top:0%;
-			}
-
-			#scenes_control {
-				position:absolute;
-				top:8px;
+				position: absolute;
+				width: 200px;
+				bottom: 0px;
+				left: 0px;
+				padding: 10px;
+				background-color: White;
+				font: 13px "Lucida Grande", Lucida, Verdana, sans-serif;
 			}
 			}
 
 
-			#cameras_control {
-				position:absolute;
-				top:40px;
+			#controls > div {
+				margin-bottom: 8px;
 			}
 			}
 
 
-			#animations_control {
-				position:absolute;
-				top:72px;
+			#controls hr {
+				border: 0px;
+				height: 1px;
+				margin-bottom: 10px;
+				background-color: #bbb;
 			}
 			}
 
 
-			#materials_extension_control {
-				position:absolute;
-				top:104px;
+			#info a, .button {
+				color: #f00;
+				font-weight: bold;
+				text-decoration: underline;
+				cursor: pointer
 			}
 			}
-
-			#info a, .button { color: #f00; font-weight: bold; text-decoration: underline; cursor: pointer }
 		</style>
 		</style>
 	</head>
 	</head>
 
 
 	<body>
 	<body>
 		<div id="info">
 		<div id="info">
 		<a href="http://threejs.org" target="_blank">three.js</a> -
 		<a href="http://threejs.org" target="_blank">three.js</a> -
-		<a href="https://github.com/KhronosGroup/glTF" target="_blank">glTF</a> loader -
+		<a href="https://github.com/KhronosGroup/glTF" target="_blank">glTF</a> loader
 		<br>
 		<br>
-		monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a> -
-		COLLADA duck by Sony - Cesium models courtesy <a href="http://cesiumjs.org/" target="_blank">Cesium</a>
+		monster by <a href="http://www.3drt.com/downloads.htm" target="_blank">3drt</a> - COLLADA duck by Sony -
+		Cesium models by <a href="http://cesiumjs.org/" target="_blank">Cesium</a>
 		</div>
 		</div>
-	<div id="container">
-	</div>
-	<div id="status">
-	</div>
+	<div id="container"></div>
 	<div id="controls">
 	<div id="controls">
-		<div class="control" id="scenes_control">
-		Model
-		<select class="controlValue" id="scenes_list" size="1" onchange="selectScene();" ondblclick="selectScene();">
-		</select>
+		<div id="status">Loading...</div>
+		<hr />
+		<div>
+			Model
+			<select id="scenes_list" size="1" onchange="selectScene();" ondblclick="selectScene();"></select>
 		</div>
 		</div>
-
-		<div class="control" id="cameras_control">
-		Camera
-		<select class="controlValue" id="cameras_list" size="1" onchange="selectCamera();" ondblclick="selectCamera();">
-		</select>
+		<div>
+			Camera
+			<select id="cameras_list" size="1" onchange="selectCamera();" ondblclick="selectCamera();"></select>
 		</div>
 		</div>
-		<div class="control" id="animations_control">
-		Animations
-		<div class="controlValue"><input type="checkbox" checked onclick="toggleAnimations();">Play</input></div>
+		<div>
+			Animations
+			<input type="checkbox" checked onclick="toggleAnimations();">Play</input>
 		</div>
 		</div>
-		<div class="control" id="materials_extension_control">
-			Shaders
-			<div class="controlValue">
-			<input type="checkbox" id="materials_extension_checkbox" checked onclick="toggleMaterialsExtension();">Use built-in</input>
-			</div>
+		<div>
+			Extension
+			<select id="extensions_list" onchange="selectExtension();">
+				<option value="glTF">None</option>
+				<option value="glTF-MaterialsCommon">Built-in shaders</option>
+				<option value="glTF-Binary">Binary</option>
+			</select>
 		</div>
 		</div>
-
 	</div>
 	</div>
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
@@ -235,28 +204,34 @@
 
 
 				THREE.GLTFLoader.Shaders.removeAll(); // remove all previous shaders
 				THREE.GLTFLoader.Shaders.removeAll(); // remove all previous shaders
 				loader = new THREE.GLTFLoader;
 				loader = new THREE.GLTFLoader;
-				var loadStartTime = Date.now();
-				var status = document.getElementById("status");
-				status.innerHTML = "Loading...";
+
+				for (var i = 0; i < extensionSelect.children.length; i++) {
+					var child = extensionSelect.children[i];
+					child.disabled = sceneInfo.extensions.indexOf(child.value) === -1;
+					if (child.disabled && child.selected) {
+						extensionSelect.value = extension = 'glTF';
+					}
+				}
+
 				var url = sceneInfo.url;
 				var url = sceneInfo.url;
 				var r = eval("/" + '\%s' + "/g");
 				var r = eval("/" + '\%s' + "/g");
-				var dir = useMaterialsExtension ? 'glTF-MaterialsCommon' :  'glTF';
-				url = url.replace(r, dir);
+				url = url.replace(r, extension);
+
+				if (extension === 'glTF-Binary') {
+					url = url.replace('.gltf', '.glb');
+				}
 
 
-				var loadStartTime = Date.now();
+				var loadStartTime = performance.now();
 				var status = document.getElementById("status");
 				var status = document.getElementById("status");
 				status.innerHTML = "Loading...";
 				status.innerHTML = "Loading...";
+
 				loader.load( url, function(data) {
 				loader.load( url, function(data) {
 
 
 					gltf = data;
 					gltf = data;
 
 
 					var object = gltf.scene !== undefined ? gltf.scene : gltf.scenes[ 0 ];
 					var object = gltf.scene !== undefined ? gltf.scene : gltf.scenes[ 0 ];
 
 
-					var loadEndTime = Date.now();
-
-					var loadTime = (loadEndTime - loadStartTime) / 1000;
-
-					status.innerHTML = "Load time: " + loadTime.toFixed(2) + " seconds.";
+					status.innerHTML = "Load time: " + ( performance.now() - loadStartTime ).toFixed( 2 ) + " ms.";
 
 
 					if (sceneInfo.cameraPos)
 					if (sceneInfo.cameraPos)
 						defaultCamera.position.copy(sceneInfo.cameraPos);
 						defaultCamera.position.copy(sceneInfo.cameraPos);
@@ -405,14 +380,16 @@
 					animationTime: 3,
 					animationTime: 3,
 					addLights:true,
 					addLights:true,
 					shadows:true,
 					shadows:true,
-					addGround:true
+					addGround:true,
+					extensions: ["glTF", "glTF-MaterialsCommon", "glTF-Binary"]
 				},
 				},
 				{
 				{
 					name : "Duck", url : "./models/gltf/duck/%s/duck.gltf",
 					name : "Duck", url : "./models/gltf/duck/%s/duck.gltf",
 					cameraPos: new THREE.Vector3(0, 3, 5),
 					cameraPos: new THREE.Vector3(0, 3, 5),
 					addLights:true,
 					addLights:true,
 					addGround:true,
 					addGround:true,
-					shadows:true
+					shadows:true,
+					extensions: ["glTF", "glTF-MaterialsCommon", "glTF-Binary"]
 				},
 				},
 				{
 				{
 					name : "Cesium Man", url : "./models/gltf/CesiumMan/%s/Cesium_Man.gltf",
 					name : "Cesium Man", url : "./models/gltf/CesiumMan/%s/Cesium_Man.gltf",
@@ -420,7 +397,8 @@
 					 objectRotation: new THREE.Euler(0, 0, 0),
 					 objectRotation: new THREE.Euler(0, 0, 0),
 					 addLights:true,
 					 addLights:true,
 					 addGround:true,
 					 addGround:true,
-					 shadows:true
+					 shadows:true,
+					 extensions: ["glTF", "glTF-MaterialsCommon", "glTF-Binary"]
 				},
 				},
 				{
 				{
 					name : "Cesium Milk Truck",
 					name : "Cesium Milk Truck",
@@ -428,7 +406,8 @@
 					cameraPos: new THREE.Vector3(0, 3, 10),
 					cameraPos: new THREE.Vector3(0, 3, 10),
 					addLights:true,
 					addLights:true,
 					addGround:true,
 					addGround:true,
-					shadows:true
+					shadows:true,
+					extensions: ["glTF", "glTF-MaterialsCommon", "glTF-Binary"]
 				},
 				},
 				{
 				{
 					name : "Snowflake",
 					name : "Snowflake",
@@ -438,7 +417,8 @@
 					objectPosition: new THREE.Vector3(0, 0, 0),
 					objectPosition: new THREE.Vector3(0, 0, 0),
 					addLights:false,
 					addLights:false,
 					addGround:false,
 					addGround:false,
-					shadows:false
+					shadows:false,
+					extensions: ["glTF"]
 				},
 				},
 				{
 				{
 					name : "Snowflakes",
 					name : "Snowflakes",
@@ -447,7 +427,8 @@
 					objectPosition: new THREE.Vector3(-1200, -1200, 0),
 					objectPosition: new THREE.Vector3(-1200, -1200, 0),
 					addLights:false,
 					addLights:false,
 					addGround:false,
 					addGround:false,
-					shadows:false
+					shadows:false,
+					extensions: ["glTF"]
 				}
 				}
 			];
 			];
 
 
@@ -558,15 +539,14 @@
 
 
 			}
 			}
 
 
-			var useextmaterials = document.getElementById("materials_extension_checkbox");
-			var useMaterialsExtension = useextmaterials.hasAttribute("checked");
-			function toggleMaterialsExtension()
+			var extensionSelect = document.getElementById("extensions_list");
+			var extension = extensionSelect.value;
+			function selectExtension()
 			{
 			{
-				useMaterialsExtension = !useMaterialsExtension;
+				extension = extensionSelect.value;
 				selectScene();
 				selectScene();
 			}
 			}
 
 
-
 			function cleanup() {
 			function cleanup() {
 
 
 				if (container && renderer) {
 				if (container && renderer) {

+ 1 - 1
examples/webgl_loader_msgpack.html

@@ -86,7 +86,7 @@ https://github.com/creationix/msgpack-js-browser
 			function setupScene( result ) {
 			function setupScene( result ) {
 
 
 				scene = result;
 				scene = result;
-				scene.add( new THREE.GridHelper( 10, 8 ) );
+				scene.add( new THREE.GridHelper( 20, 8 ) );
 
 
 				threePointLight();
 				threePointLight();
 
 

+ 1 - 0
examples/webgl_postprocessing_ssao.html

@@ -180,6 +180,7 @@ Spiral sampling http://web.archive.org/web/20120421191837/http://www.cgafaq.info
 
 
 				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
 				var pars = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter };
 				depthRenderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
 				depthRenderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, pars );
+				depthRenderTarget.texture.name = "SSAOShader.rt";
 
 
 				// Setup SSAO pass
 				// Setup SSAO pass
 				ssaoPass = new THREE.ShaderPass( THREE.SSAOShader );
 				ssaoPass = new THREE.ShaderPass( THREE.SSAOShader );

+ 3 - 1
examples/webgl_shaders_ocean.html

@@ -79,6 +79,7 @@
 				container.appendChild( renderer.domElement );
 				container.appendChild( renderer.domElement );
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
+				scene.fog = new THREE.FogExp2(0xaabbbb, 0.0001);
 
 
 				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 0.5, 3000000 );
 				camera = new THREE.PerspectiveCamera( 55, window.innerWidth / window.innerHeight, 0.5, 3000000 );
 				camera.position.set( 2000, 750, 2000 );
 				camera.position.set( 2000, 750, 2000 );
@@ -108,7 +109,8 @@
 					sunDirection: light.position.clone().normalize(),
 					sunDirection: light.position.clone().normalize(),
 					sunColor: 0xffffff,
 					sunColor: 0xffffff,
 					waterColor: 0x001e0f,
 					waterColor: 0x001e0f,
-					distortionScale: 50.0
+					distortionScale: 50.0,
+					fog: scene.fog != undefined
 				} );
 				} );
 
 
 
 

+ 1 - 1
examples/webgl_shaders_sky.html

@@ -141,7 +141,7 @@
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 
 
-				var helper = new THREE.GridHelper( 5000, 2, 0xffffff, 0xffffff );
+				var helper = new THREE.GridHelper( 10000, 2, 0xffffff, 0xffffff );
 				scene.add( helper );
 				scene.add( helper );
 
 
 				renderer = new THREE.WebGLRenderer();
 				renderer = new THREE.WebGLRenderer();

+ 1 - 1
examples/webvr_vive_paint.html

@@ -114,7 +114,7 @@
 				floor.receiveShadow = true;
 				floor.receiveShadow = true;
 				scene.add( floor );
 				scene.add( floor );
 
 
-				scene.add( new THREE.GridHelper( 10, 40, 0x111111, 0x111111 ) );
+				scene.add( new THREE.GridHelper( 20, 40, 0x111111, 0x111111 ) );
 
 
 				scene.add( new THREE.HemisphereLight( 0x888877, 0x777788 ) );
 				scene.add( new THREE.HemisphereLight( 0x888877, 0x777788 ) );
 
 

+ 1 - 1
examples/webvr_vive_sculpt.html

@@ -95,7 +95,7 @@
 				floor.receiveShadow = true;
 				floor.receiveShadow = true;
 				scene.add( floor );
 				scene.add( floor );
 
 
-				scene.add( new THREE.GridHelper( 10, 40, 0x111111, 0x111111 ) );
+				scene.add( new THREE.GridHelper( 20, 40, 0x111111, 0x111111 ) );
 
 
 				scene.add( new THREE.HemisphereLight( 0x888877, 0x777788 ) );
 				scene.add( new THREE.HemisphereLight( 0x888877, 0x777788 ) );
 
 

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
 {
   "name": "three",
   "name": "three",
-  "version": "0.83.0",
+  "version": "0.84.0",
   "description": "JavaScript 3D library",
   "description": "JavaScript 3D library",
   "main": "build/three.js",
   "main": "build/three.js",
   "repository": "mrdoob/three.js",
   "repository": "mrdoob/three.js",

+ 2 - 2
src/animation/PropertyBinding.js

@@ -616,8 +616,8 @@ Object.assign( PropertyBinding.prototype, { // prototype, continued
 
 
 			this.resolvedProperty = nodeProperty;
 			this.resolvedProperty = nodeProperty;
 
 
-		} else if ( nodeProperty.length !== undefined ) {
-
+		} else if ( Array.isArray( nodeProperty ) ) {
+      
 			bindingType = this.BindingType.EntireArray;
 			bindingType = this.BindingType.EntireArray;
 
 
 			this.resolvedProperty = nodeProperty;
 			this.resolvedProperty = nodeProperty;

+ 1 - 0
src/cameras/CubeCamera.js

@@ -52,6 +52,7 @@ function CubeCamera( near, far, cubeResolution ) {
 	var options = { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter };
 	var options = { format: RGBFormat, magFilter: LinearFilter, minFilter: LinearFilter };
 
 
 	this.renderTarget = new WebGLRenderTargetCube( cubeResolution, cubeResolution, options );
 	this.renderTarget = new WebGLRenderTargetCube( cubeResolution, cubeResolution, options );
+	this.renderTarget.texture.name = "CubeCamera";
 
 
 	this.updateCubeMap = function ( renderer, scene ) {
 	this.updateCubeMap = function ( renderer, scene ) {
 
 

+ 1 - 1
src/constants.js

@@ -1,4 +1,4 @@
-export var REVISION = '84dev';
+export var REVISION = '85dev';
 export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
 export var MOUSE = { LEFT: 0, MIDDLE: 1, RIGHT: 2 };
 export var CullFaceNone = 0;
 export var CullFaceNone = 0;
 export var CullFaceBack = 1;
 export var CullFaceBack = 1;

+ 12 - 3
src/core/BufferGeometry.js

@@ -1,13 +1,14 @@
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 import { Box3 } from '../math/Box3';
 import { Box3 } from '../math/Box3';
 import { EventDispatcher } from './EventDispatcher';
 import { EventDispatcher } from './EventDispatcher';
-import { BufferAttribute, Float32BufferAttribute } from './BufferAttribute';
+import { BufferAttribute, Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from './BufferAttribute';
 import { Sphere } from '../math/Sphere';
 import { Sphere } from '../math/Sphere';
 import { DirectGeometry } from './DirectGeometry';
 import { DirectGeometry } from './DirectGeometry';
 import { Object3D } from './Object3D';
 import { Object3D } from './Object3D';
 import { Matrix4 } from '../math/Matrix4';
 import { Matrix4 } from '../math/Matrix4';
 import { Matrix3 } from '../math/Matrix3';
 import { Matrix3 } from '../math/Matrix3';
 import { _Math } from '../math/Math';
 import { _Math } from '../math/Math';
+import { arrayMax } from '../utils';
 import { GeometryIdCount } from './Geometry';
 import { GeometryIdCount } from './Geometry';
 
 
 /**
 /**
@@ -54,7 +55,15 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 
 	setIndex: function ( index ) {
 	setIndex: function ( index ) {
 
 
-		this.index = index;
+		if ( Array.isArray( index ) ) {
+
+			this.index = new ( arrayMax( index ) > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( index, 1 );
+
+		} else {
+
+			this.index = index;
+
+		}
 
 
 	},
 	},
 
 
@@ -498,7 +507,7 @@ Object.assign( BufferGeometry.prototype, EventDispatcher.prototype, {
 
 
 		if ( geometry.indices.length > 0 ) {
 		if ( geometry.indices.length > 0 ) {
 
 
-			var TypeArray = geometry.vertices.length > 65535 ? Uint32Array : Uint16Array;
+			var TypeArray = arrayMax( geometry.indices ) > 65535 ? Uint32Array : Uint16Array;
 			var indices = new TypeArray( geometry.indices.length * 3 );
 			var indices = new TypeArray( geometry.indices.length * 3 );
 			this.setIndex( new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
 			this.setIndex( new BufferAttribute( indices, 1 ).copyIndicesArray( geometry.indices ) );
 
 

+ 180 - 9
src/core/Geometry.js

@@ -20,7 +20,7 @@ import { _Math } from '../math/Math';
  */
  */
 
 
 var count = 0;
 var count = 0;
-function GeometryIdCount() { return count++; };
+function GeometryIdCount() { return count++; }
 
 
 function Geometry() {
 function Geometry() {
 
 
@@ -1188,36 +1188,59 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
 
 
 	copy: function ( source ) {
 	copy: function ( source ) {
 
 
+		var i, il, j, jl, k, kl;
+
+		// reset
+
 		this.vertices = [];
 		this.vertices = [];
-		this.faces = [];
-		this.faceVertexUvs = [ [] ];
 		this.colors = [];
 		this.colors = [];
+		this.faces = [];
+		this.faceVertexUvs = [[]];
+		this.morphTargets = [];
+		this.morphNormals = [];
+		this.skinWeights = [];
+		this.skinIndices = [];
+		this.lineDistances = [];
+		this.boundingBox = null;
+		this.boundingSphere = null;
+
+		// name
+
+		this.name = source.name;
+
+		// vertices
 
 
 		var vertices = source.vertices;
 		var vertices = source.vertices;
 
 
-		for ( var i = 0, il = vertices.length; i < il; i ++ ) {
+		for ( i = 0, il = vertices.length; i < il; i ++ ) {
 
 
 			this.vertices.push( vertices[ i ].clone() );
 			this.vertices.push( vertices[ i ].clone() );
 
 
 		}
 		}
 
 
+		// colors
+
 		var colors = source.colors;
 		var colors = source.colors;
 
 
-		for ( var i = 0, il = colors.length; i < il; i ++ ) {
+		for ( i = 0, il = colors.length; i < il; i ++ ) {
 
 
 			this.colors.push( colors[ i ].clone() );
 			this.colors.push( colors[ i ].clone() );
 
 
 		}
 		}
 
 
+		// faces
+
 		var faces = source.faces;
 		var faces = source.faces;
 
 
-		for ( var i = 0, il = faces.length; i < il; i ++ ) {
+		for ( i = 0, il = faces.length; i < il; i ++ ) {
 
 
 			this.faces.push( faces[ i ].clone() );
 			this.faces.push( faces[ i ].clone() );
 
 
 		}
 		}
 
 
-		for ( var i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) {
+		// face vertex uvs
+
+		for ( i = 0, il = source.faceVertexUvs.length; i < il; i ++ ) {
 
 
 			var faceVertexUvs = source.faceVertexUvs[ i ];
 			var faceVertexUvs = source.faceVertexUvs[ i ];
 
 
@@ -1227,11 +1250,11 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
 
 
 			}
 			}
 
 
-			for ( var j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) {
+			for ( j = 0, jl = faceVertexUvs.length; j < jl; j ++ ) {
 
 
 				var uvs = faceVertexUvs[ j ], uvsCopy = [];
 				var uvs = faceVertexUvs[ j ], uvsCopy = [];
 
 
-				for ( var k = 0, kl = uvs.length; k < kl; k ++ ) {
+				for ( k = 0, kl = uvs.length; k < kl; k ++ ) {
 
 
 					var uv = uvs[ k ];
 					var uv = uvs[ k ];
 
 
@@ -1245,6 +1268,154 @@ Object.assign( Geometry.prototype, EventDispatcher.prototype, {
 
 
 		}
 		}
 
 
+		// morph targets
+
+		var morphTargets = source.morphTargets;
+
+		for ( i = 0, il = morphTargets.length; i < il; i ++ ) {
+
+			var morphTarget = {};
+			morphTarget.name = morphTargets[ i ].name;
+
+			// vertices
+
+			if ( morphTargets[ i ].vertices !== undefined ) {
+
+				morphTarget.vertices = [];
+
+				for ( j = 0, jl = morphTargets[ i ].vertices.length; j < jl; j ++ ) {
+
+					morphTarget.vertices.push( morphTargets[ i ].vertices[ j ].clone() );
+
+				}
+
+			}
+
+			// normals
+
+			if ( morphTargets[ i ].normals !== undefined ) {
+
+				morphTarget.normals = [];
+
+				for ( j = 0, jl = morphTargets[ i ].normals.length; j < jl; j ++ ) {
+
+					morphTarget.normals.push( morphTargets[ i ].normals[ j ].clone() );
+
+				}
+
+			}
+
+			this.morphTargets.push( morphTarget );
+
+		}
+
+		// morph normals
+
+		var morphNormals = source.morphNormals;
+
+		for ( i = 0, il = morphNormals.length; i < il; i ++ ) {
+
+			var morphNormal = {};
+
+			// vertex normals
+
+			if ( morphNormals[ i ].vertexNormals !== undefined ) {
+
+				morphNormal.vertexNormals = [];
+
+				for ( j = 0, jl = morphNormals[ i ].vertexNormals.length; j < jl; j ++ ) {
+
+					var srcVertexNormal = morphNormals[ i ].vertexNormals[ j ];
+					var destVertexNormal = {};
+
+					destVertexNormal.a = srcVertexNormal.a.clone();
+					destVertexNormal.b = srcVertexNormal.b.clone();
+					destVertexNormal.c = srcVertexNormal.c.clone();
+
+					morphNormal.vertexNormals.push( destVertexNormal );
+
+				}
+
+			}
+
+			// face normals
+
+			if ( morphNormals[ i ].faceNormals !== undefined ) {
+
+				morphNormal.faceNormals = [];
+
+				for ( j = 0, jl = morphNormals[ i ].faceNormals.length; j < jl; j ++ ) {
+
+					morphNormal.faceNormals.push( morphNormals[ i ].faceNormals[ j ].clone() );
+
+				}
+
+			}
+
+			this.morphNormals.push( morphNormal );
+
+		}
+
+		// skin weights
+
+		var skinWeights = source.skinWeights;
+
+		for ( i = 0, il = skinWeights.length; i < il; i ++ ) {
+
+			this.skinWeights.push( skinWeights[ i ].clone() );
+
+		}
+
+		// skin indices
+
+		var skinIndices = source.skinIndices;
+
+		for ( i = 0, il = skinIndices.length; i < il; i ++ ) {
+
+			this.skinIndices.push( skinIndices[ i ].clone() );
+
+		}
+
+		// line distances
+
+		var lineDistances = source.lineDistances;
+
+		for ( i = 0, il = lineDistances.length; i < il; i ++ ) {
+
+			this.lineDistances.push( lineDistances[ i ] );
+
+		}
+
+		// bounding box
+
+		var boundingBox = source.boundingBox;
+
+		if ( boundingBox !== null ) {
+
+			this.boundingBox = boundingBox.clone();
+
+		}
+
+		// bounding sphere
+
+		var boundingSphere = source.boundingSphere;
+
+		if ( boundingSphere !== null ) {
+
+			this.boundingSphere = boundingSphere.clone();
+
+		}
+
+		// update flags
+
+		this.elementsNeedUpdate = source.elementsNeedUpdate;
+		this.verticesNeedUpdate = source.verticesNeedUpdate;
+		this.uvsNeedUpdate = source.uvsNeedUpdate;
+		this.normalsNeedUpdate = source.normalsNeedUpdate;
+		this.colorsNeedUpdate = source.colorsNeedUpdate;
+		this.lineDistancesNeedUpdate = source.lineDistancesNeedUpdate;
+		this.groupsNeedUpdate = source.groupsNeedUpdate;
+
 		return this;
 		return this;
 
 
 	},
 	},

+ 41 - 72
src/geometries/BoxGeometry.js

@@ -32,7 +32,7 @@ BoxGeometry.prototype.constructor = BoxGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 
 
@@ -54,30 +54,25 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
 	var scope = this;
 	var scope = this;
 
 
 	// segments
 	// segments
+
 	widthSegments = Math.floor( widthSegments ) || 1;
 	widthSegments = Math.floor( widthSegments ) || 1;
 	heightSegments = Math.floor( heightSegments ) || 1;
 	heightSegments = Math.floor( heightSegments ) || 1;
 	depthSegments = Math.floor( depthSegments ) || 1;
 	depthSegments = Math.floor( depthSegments ) || 1;
 
 
-	// these are used to calculate buffer length
-	var vertexCount = calculateVertexCount( widthSegments, heightSegments, depthSegments );
-	var indexCount = calculateIndexCount( widthSegments, heightSegments, depthSegments );
-
 	// buffers
 	// buffers
-	var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount );
-	var vertices = new Float32Array( vertexCount * 3 );
-	var normals = new Float32Array( vertexCount * 3 );
-	var uvs = new Float32Array( vertexCount * 2 );
-
-	// offset variables
-	var vertexBufferOffset = 0;
-	var uvBufferOffset = 0;
-	var indexBufferOffset = 0;
-	var numberOfVertices = 0;
 
 
-	// group variables
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
+
+	// helper variables
+
+	var numberOfVertices = 0;
 	var groupStart = 0;
 	var groupStart = 0;
 
 
 	// build each side of the box geometry
 	// build each side of the box geometry
+
 	buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height,   width,  depthSegments, heightSegments, 0 ); // px
 	buildPlane( 'z', 'y', 'x', - 1, - 1, depth, height,   width,  depthSegments, heightSegments, 0 ); // px
 	buildPlane( 'z', 'y', 'x',   1, - 1, depth, height, - width,  depthSegments, heightSegments, 1 ); // nx
 	buildPlane( 'z', 'y', 'x',   1, - 1, depth, height, - width,  depthSegments, heightSegments, 1 ); // nx
 	buildPlane( 'x', 'z', 'y',   1,   1, width, depth,    height, widthSegments, depthSegments,  2 ); // py
 	buildPlane( 'x', 'z', 'y',   1,   1, width, depth,    height, widthSegments, depthSegments,  2 ); // py
@@ -86,42 +81,15 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
 	buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth,  widthSegments, heightSegments, 5 ); // nz
 	buildPlane( 'x', 'y', 'z', - 1, - 1, width, height, - depth,  widthSegments, heightSegments, 5 ); // nz
 
 
 	// build geometry
 	// build geometry
-	this.setIndex( new BufferAttribute( indices, 1 ) );
-	this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
-
-	// helper functions
-
-	function calculateVertexCount( w, h, d ) {
-
-		var vertices = 0;
-
-		// calculate the amount of vertices for each side (plane)
-		vertices += (w + 1) * (h + 1) * 2; // xy
-		vertices += (w + 1) * (d + 1) * 2; // xz
-		vertices += (d + 1) * (h + 1) * 2; // zy
-
-		return vertices;
-
-	}
-
-	function calculateIndexCount( w, h, d ) {
-
-		var index = 0;
 
 
-		// calculate the amount of squares for each side
-		index += w * h * 2; // xy
-		index += w * d * 2; // xz
-		index += d * h * 2; // zy
-
-		return index * 6; // two triangles per square => six vertices per square
-
-	}
+	this.setIndex( indices );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 	function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {
 	function buildPlane( u, v, w, udir, vdir, width, height, depth, gridX, gridY, materialIndex ) {
 
 
-		var segmentWidth	= width / gridX;
+		var segmentWidth = width / gridX;
 		var segmentHeight = height / gridY;
 		var segmentHeight = height / gridY;
 
 
 		var widthHalf = width / 2;
 		var widthHalf = width / 2;
@@ -134,51 +102,55 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
 		var vertexCounter = 0;
 		var vertexCounter = 0;
 		var groupCount = 0;
 		var groupCount = 0;
 
 
+		var ix, iy;
+
 		var vector = new Vector3();
 		var vector = new Vector3();
 
 
 		// generate vertices, normals and uvs
 		// generate vertices, normals and uvs
 
 
-		for ( var iy = 0; iy < gridY1; iy ++ ) {
+		for ( iy = 0; iy < gridY1; iy ++ ) {
 
 
 			var y = iy * segmentHeight - heightHalf;
 			var y = iy * segmentHeight - heightHalf;
 
 
-			for ( var ix = 0; ix < gridX1; ix ++ ) {
+			for ( ix = 0; ix < gridX1; ix ++ ) {
 
 
 				var x = ix * segmentWidth - widthHalf;
 				var x = ix * segmentWidth - widthHalf;
 
 
 				// set values to correct vector component
 				// set values to correct vector component
+
 				vector[ u ] = x * udir;
 				vector[ u ] = x * udir;
 				vector[ v ] = y * vdir;
 				vector[ v ] = y * vdir;
 				vector[ w ] = depthHalf;
 				vector[ w ] = depthHalf;
 
 
 				// now apply vector to vertex buffer
 				// now apply vector to vertex buffer
-				vertices[ vertexBufferOffset ] = vector.x;
-				vertices[ vertexBufferOffset + 1 ] = vector.y;
-				vertices[ vertexBufferOffset + 2 ] = vector.z;
+
+				vertices.push( vector.x, vector.y, vector.z );
 
 
 				// set values to correct vector component
 				// set values to correct vector component
+
 				vector[ u ] = 0;
 				vector[ u ] = 0;
 				vector[ v ] = 0;
 				vector[ v ] = 0;
 				vector[ w ] = depth > 0 ? 1 : - 1;
 				vector[ w ] = depth > 0 ? 1 : - 1;
 
 
 				// now apply vector to normal buffer
 				// now apply vector to normal buffer
-				normals[ vertexBufferOffset ] = vector.x;
-				normals[ vertexBufferOffset + 1 ] = vector.y;
-				normals[ vertexBufferOffset + 2 ] = vector.z;
+
+				normals.push( vector.x, vector.y, vector.z );
 
 
 				// uvs
 				// uvs
-				uvs[ uvBufferOffset ] = ix / gridX;
-				uvs[ uvBufferOffset + 1 ] = 1 - ( iy / gridY );
 
 
-				// update offsets and counters
-				vertexBufferOffset += 3;
-				uvBufferOffset += 2;
+				uvs.push( ix / gridX );
+				uvs.push( 1 - ( iy / gridY ) );
+
+				// counters
+
 				vertexCounter += 1;
 				vertexCounter += 1;
 
 
 			}
 			}
 
 
 		}
 		}
 
 
+		// indices
+
 		// 1. you need three indices to draw a single face
 		// 1. you need three indices to draw a single face
 		// 2. a single segment consists of two faces
 		// 2. a single segment consists of two faces
 		// 3. so we need to generate six (2*3) indices per segment
 		// 3. so we need to generate six (2*3) indices per segment
@@ -187,24 +159,18 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
 
 
 			for ( ix = 0; ix < gridX; ix ++ ) {
 			for ( ix = 0; ix < gridX; ix ++ ) {
 
 
-				// indices
 				var a = numberOfVertices + ix + gridX1 * iy;
 				var a = numberOfVertices + ix + gridX1 * iy;
 				var b = numberOfVertices + ix + gridX1 * ( iy + 1 );
 				var b = numberOfVertices + ix + gridX1 * ( iy + 1 );
 				var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var c = numberOfVertices + ( ix + 1 ) + gridX1 * ( iy + 1 );
 				var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
 				var d = numberOfVertices + ( ix + 1 ) + gridX1 * iy;
 
 
-				// face one
-				indices[ indexBufferOffset ] = a;
-				indices[ indexBufferOffset + 1 ] = b;
-				indices[ indexBufferOffset + 2 ] = d;
+				// faces
+
+				indices.push( a, b, d );
+				indices.push( b, c, d );
 
 
-				// face two
-				indices[ indexBufferOffset + 3 ] = b;
-				indices[ indexBufferOffset + 4 ] = c;
-				indices[ indexBufferOffset + 5 ] = d;
+				// increase counter
 
 
-				// update offsets and counters
-				indexBufferOffset += 6;
 				groupCount += 6;
 				groupCount += 6;
 
 
 			}
 			}
@@ -212,12 +178,15 @@ function BoxBufferGeometry( width, height, depth, widthSegments, heightSegments,
 		}
 		}
 
 
 		// add a group to the geometry. this will ensure multi material support
 		// add a group to the geometry. this will ensure multi material support
+
 		scope.addGroup( groupStart, groupCount, materialIndex );
 		scope.addGroup( groupStart, groupCount, materialIndex );
 
 
 		// calculate new start value for groups
 		// calculate new start value for groups
+
 		groupStart += groupCount;
 		groupStart += groupCount;
 
 
 		// update total number of vertices
 		// update total number of vertices
+
 		numberOfVertices += vertexCounter;
 		numberOfVertices += vertexCounter;
 
 
 	}
 	}

+ 42 - 23
src/geometries/CircleGeometry.js

@@ -26,12 +26,13 @@ CircleGeometry.prototype.constructor = CircleGeometry;
 
 
 /**
 /**
  * @author benaadams / https://twitter.com/ben_a_adams
  * @author benaadams / https://twitter.com/ben_a_adams
+ * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
-import { Sphere } from '../math/Sphere';
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Vector2 } from '../math/Vector2';
 
 
 function CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) {
 function CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) {
 
 
@@ -52,45 +53,63 @@ function CircleBufferGeometry( radius, segments, thetaStart, thetaLength ) {
 	thetaStart = thetaStart !== undefined ? thetaStart : 0;
 	thetaStart = thetaStart !== undefined ? thetaStart : 0;
 	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 	thetaLength = thetaLength !== undefined ? thetaLength : Math.PI * 2;
 
 
-	var vertices = segments + 2;
+	// buffers
 
 
-	var positions = new Float32Array( vertices * 3 );
-	var normals = new Float32Array( vertices * 3 );
-	var uvs = new Float32Array( vertices * 2 );
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
+
+	// helper variables
+
+	var i, s;
+	var vertex = new Vector3();
+	var uv = new Vector2();
 
 
-	// center data is already zero, but need to set a few extras
-	normals[ 2 ] = 1.0;
-	uvs[ 0 ] = 0.5;
-	uvs[ 1 ] = 0.5;
+	// center point
 
 
-	for ( var s = 0, i = 3, ii = 2 ; s <= segments; s ++, i += 3, ii += 2 ) {
+	vertices.push( 0, 0, 0 );
+	normals.push( 0, 0, 1 );
+	uvs.push( 0.5, 0.5 );
+
+	for ( s = 0, i = 3; s <= segments; s ++, i += 3 ) {
 
 
 		var segment = thetaStart + s / segments * thetaLength;
 		var segment = thetaStart + s / segments * thetaLength;
 
 
-		positions[ i ] = radius * Math.cos( segment );
-		positions[ i + 1 ] = radius * Math.sin( segment );
+		// vertex
+
+		vertex.x = radius * Math.cos( segment );
+		vertex.y = radius * Math.sin( segment );
 
 
-		normals[ i + 2 ] = 1; // normal z
+		vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-		uvs[ ii ] = ( positions[ i ] / radius + 1 ) / 2;
-		uvs[ ii + 1 ] = ( positions[ i + 1 ] / radius + 1 ) / 2;
+		// normal
+
+		normals.push( 0, 0, 1 );
+
+		// uvs
+
+		uv.x = ( vertices[ i ] / radius + 1 ) / 2;
+		uv.y = ( vertices[ i + 1 ] / radius + 1 ) / 2;
+
+		uvs.push( uv.x, uv.y );
 
 
 	}
 	}
 
 
-	var indices = [];
+	// indices
 
 
-	for ( var i = 1; i <= segments; i ++ ) {
+	for ( i = 1; i <= segments; i ++ ) {
 
 
 		indices.push( i, i + 1, 0 );
 		indices.push( i, i + 1, 0 );
 
 
 	}
 	}
 
 
-	this.setIndex( new BufferAttribute( new Uint16Array( indices ), 1 ) );
-	this.addAttribute( 'position', new BufferAttribute( positions, 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
+	// build geometry
 
 
-	this.boundingSphere = new Sphere( new Vector3(), radius );
+	this.setIndex( indices );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 }
 }
 
 

+ 56 - 95
src/geometries/CylinderGeometry.js

@@ -33,10 +33,10 @@ CylinderGeometry.prototype.constructor = CylinderGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
-import { BufferAttribute } from '../core/BufferAttribute';
 
 
 function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
 function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments, heightSegments, openEnded, thetaStart, thetaLength ) {
 
 
@@ -68,35 +68,19 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 	thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
 	thetaStart = thetaStart !== undefined ? thetaStart : 0.0;
 	thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI;
 	thetaLength = thetaLength !== undefined ? thetaLength : 2.0 * Math.PI;
 
 
-	// used to calculate buffer length
-
-	var nbCap = 0;
-
-	if ( openEnded === false ) {
-
-		if ( radiusTop > 0 ) nbCap ++;
-		if ( radiusBottom > 0 ) nbCap ++;
-
-	}
-
-	var vertexCount = calculateVertexCount();
-	var indexCount = calculateIndexCount();
-
 	// buffers
 	// buffers
 
 
-	var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ), 1 );
-	var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
 
 
 	// helper variables
 	// helper variables
 
 
-	var index = 0,
-	    indexOffset = 0,
-	    indexArray = [],
-	    halfHeight = height / 2;
-
-	// group variables
+	var index = 0;
+	var indexOffset = 0;
+	var indexArray = [];
+	var halfHeight = height / 2;
 	var groupStart = 0;
 	var groupStart = 0;
 
 
 	// generate geometry
 	// generate geometry
@@ -113,39 +97,9 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 	// build geometry
 	// build geometry
 
 
 	this.setIndex( indices );
 	this.setIndex( indices );
-	this.addAttribute( 'position', vertices );
-	this.addAttribute( 'normal', normals );
-	this.addAttribute( 'uv', uvs );
-
-	// helper functions
-
-	function calculateVertexCount() {
-
-		var count = ( radialSegments + 1 ) * ( heightSegments + 1 );
-
-		if ( openEnded === false ) {
-
-			count += ( ( radialSegments + 1 ) * nbCap ) + ( radialSegments * nbCap );
-
-		}
-
-		return count;
-
-	}
-
-	function calculateIndexCount() {
-
-		var count = radialSegments * heightSegments * 2 * 3;
-
-		if ( openEnded === false ) {
-
-			count += radialSegments * nbCap * 3;
-
-		}
-
-		return count;
-
-	}
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 	function generateTorso() {
 	function generateTorso() {
 
 
@@ -167,6 +121,7 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 			var v = y / heightSegments;
 			var v = y / heightSegments;
 
 
 			// calculate the radius of the current row
 			// calculate the radius of the current row
+
 			var radius = v * ( radiusBottom - radiusTop ) + radiusTop;
 			var radius = v * ( radiusBottom - radiusTop ) + radiusTop;
 
 
 			for ( x = 0; x <= radialSegments; x ++ ) {
 			for ( x = 0; x <= radialSegments; x ++ ) {
@@ -179,27 +134,29 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 				var cosTheta = Math.cos( theta );
 				var cosTheta = Math.cos( theta );
 
 
 				// vertex
 				// vertex
+
 				vertex.x = radius * sinTheta;
 				vertex.x = radius * sinTheta;
 				vertex.y = - v * height + halfHeight;
 				vertex.y = - v * height + halfHeight;
 				vertex.z = radius * cosTheta;
 				vertex.z = radius * cosTheta;
-				vertices.setXYZ( index, vertex.x, vertex.y, vertex.z );
+				vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 				// normal
 				// normal
+
 				normal.set( sinTheta, slope, cosTheta ).normalize();
 				normal.set( sinTheta, slope, cosTheta ).normalize();
-				normals.setXYZ( index, normal.x, normal.y, normal.z );
+				normals.push( normal.x, normal.y, normal.z );
 
 
 				// uv
 				// uv
-				uvs.setXY( index, u, 1 - v );
+
+				uvs.push( u, 1 - v );
 
 
 				// save index of vertex in respective row
 				// save index of vertex in respective row
-				indexRow.push( index );
 
 
-				// increase index
-				index ++;
+				indexRow.push( index ++ );
 
 
 			}
 			}
 
 
 			// now save vertices of the row in our index array
 			// now save vertices of the row in our index array
+
 			indexArray.push( indexRow );
 			indexArray.push( indexRow );
 
 
 		}
 		}
@@ -211,22 +168,19 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 			for ( y = 0; y < heightSegments; y ++ ) {
 			for ( y = 0; y < heightSegments; y ++ ) {
 
 
 				// we use the index array to access the correct indices
 				// we use the index array to access the correct indices
-				var i1 = indexArray[ y ][ x ];
-				var i2 = indexArray[ y + 1 ][ x ];
-				var i3 = indexArray[ y + 1 ][ x + 1 ];
-				var i4 = indexArray[ y ][ x + 1 ];
-
-				// face one
-				indices.setX( indexOffset, i1 ); indexOffset ++;
-				indices.setX( indexOffset, i2 ); indexOffset ++;
-				indices.setX( indexOffset, i4 ); indexOffset ++;
-
-				// face two
-				indices.setX( indexOffset, i2 ); indexOffset ++;
-				indices.setX( indexOffset, i3 ); indexOffset ++;
-				indices.setX( indexOffset, i4 ); indexOffset ++;
-
-				// update counters
+
+				var a = indexArray[ y ][ x ];
+				var b = indexArray[ y + 1 ][ x ];
+				var c = indexArray[ y + 1 ][ x + 1 ];
+				var d = indexArray[ y ][ x + 1 ];
+
+				// faces
+
+				indices.push( a, b, d );
+				indices.push( b, c, d );
+
+				// update group counter
+
 				groupCount += 6;
 				groupCount += 6;
 
 
 			}
 			}
@@ -234,9 +188,11 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 		}
 		}
 
 
 		// add a group to the geometry. this will ensure multi material support
 		// add a group to the geometry. this will ensure multi material support
+
 		scope.addGroup( groupStart, groupCount, 0 );
 		scope.addGroup( groupStart, groupCount, 0 );
 
 
 		// calculate new start value for groups
 		// calculate new start value for groups
+
 		groupStart += groupCount;
 		groupStart += groupCount;
 
 
 	}
 	}
@@ -263,23 +219,25 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 		for ( x = 1; x <= radialSegments; x ++ ) {
 		for ( x = 1; x <= radialSegments; x ++ ) {
 
 
 			// vertex
 			// vertex
-			vertices.setXYZ( index, 0, halfHeight * sign, 0 );
+
+			vertices.push( 0, halfHeight * sign, 0 );
 
 
 			// normal
 			// normal
-			normals.setXYZ( index, 0, sign, 0 );
+
+			normals.push( 0, sign, 0 );
 
 
 			// uv
 			// uv
-			uv.x = 0.5;
-			uv.y = 0.5;
 
 
-			uvs.setXY( index, uv.x, uv.y );
+			uvs.push( 0.5, 0.5 );
 
 
 			// increase index
 			// increase index
+
 			index ++;
 			index ++;
 
 
 		}
 		}
 
 
 		// save the index of the last center vertex
 		// save the index of the last center vertex
+
 		centerIndexEnd = index;
 		centerIndexEnd = index;
 
 
 		// now we generate the surrounding vertices, normals and uvs
 		// now we generate the surrounding vertices, normals and uvs
@@ -293,20 +251,24 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 			var sinTheta = Math.sin( theta );
 			var sinTheta = Math.sin( theta );
 
 
 			// vertex
 			// vertex
+
 			vertex.x = radius * sinTheta;
 			vertex.x = radius * sinTheta;
 			vertex.y = halfHeight * sign;
 			vertex.y = halfHeight * sign;
 			vertex.z = radius * cosTheta;
 			vertex.z = radius * cosTheta;
-			vertices.setXYZ( index, vertex.x, vertex.y, vertex.z );
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 			// normal
 			// normal
-			normals.setXYZ( index, 0, sign, 0 );
+
+			normals.push( 0, sign, 0 );
 
 
 			// uv
 			// uv
+
 			uv.x = ( cosTheta * 0.5 ) + 0.5;
 			uv.x = ( cosTheta * 0.5 ) + 0.5;
 			uv.y = ( sinTheta * 0.5 * sign ) + 0.5;
 			uv.y = ( sinTheta * 0.5 * sign ) + 0.5;
-			uvs.setXY( index, uv.x, uv.y );
+			uvs.push( uv.x, uv.y );
 
 
 			// increase index
 			// increase index
+
 			index ++;
 			index ++;
 
 
 		}
 		}
@@ -321,28 +283,27 @@ function CylinderBufferGeometry( radiusTop, radiusBottom, height, radialSegments
 			if ( top === true ) {
 			if ( top === true ) {
 
 
 				// face top
 				// face top
-				indices.setX( indexOffset, i ); indexOffset ++;
-				indices.setX( indexOffset, i + 1 ); indexOffset ++;
-				indices.setX( indexOffset, c ); indexOffset ++;
+
+				indices.push( i, i + 1, c );
 
 
 			} else {
 			} else {
 
 
 				// face bottom
 				// face bottom
-				indices.setX( indexOffset, i + 1 ); indexOffset ++;
-				indices.setX( indexOffset, i ); indexOffset ++;
-				indices.setX( indexOffset, c ); indexOffset ++;
+
+				indices.push( i + 1, i, c );
 
 
 			}
 			}
 
 
-			// update counters
 			groupCount += 3;
 			groupCount += 3;
 
 
 		}
 		}
 
 
 		// add a group to the geometry. this will ensure multi material support
 		// add a group to the geometry. this will ensure multi material support
+
 		scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );
 		scope.addGroup( groupStart, groupCount, top === true ? 1 : 2 );
 
 
 		// calculate new start value for groups
 		// calculate new start value for groups
+
 		groupStart += groupCount;
 		groupStart += groupCount;
 
 
 	}
 	}

+ 41 - 26
src/geometries/EdgesGeometry.js

@@ -5,25 +5,32 @@ import { _Math } from '../math/Math';
 
 
 /**
 /**
  * @author WestLangley / http://github.com/WestLangley
  * @author WestLangley / http://github.com/WestLangley
+ * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
 function EdgesGeometry( geometry, thresholdAngle ) {
 function EdgesGeometry( geometry, thresholdAngle ) {
 
 
 	BufferGeometry.call( this );
 	BufferGeometry.call( this );
 
 
-	thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;
+	this.type = 'EdgesGeometry';
 
 
-	var thresholdDot = Math.cos( _Math.DEG2RAD * thresholdAngle );
+	this.parameters = {
+		thresholdAngle: thresholdAngle
+	};
 
 
-	var edge = [ 0, 0 ], hash = {};
+	thresholdAngle = ( thresholdAngle !== undefined ) ? thresholdAngle : 1;
 
 
-	function sortFunction( a, b ) {
+	// buffer
 
 
-		return a - b;
+	var vertices = [];
 
 
-	}
+	// helper variables
+
+	var thresholdDot = Math.cos( _Math.DEG2RAD * thresholdAngle );
+	var edge = [ 0, 0 ], edges = {};
+	var key, keys = [ 'a', 'b', 'c' ];
 
 
-	var keys = [ 'a', 'b', 'c' ];
+	// prepare source geometry
 
 
 	var geometry2;
 	var geometry2;
 
 
@@ -41,9 +48,11 @@ function EdgesGeometry( geometry, thresholdAngle ) {
 	geometry2.mergeVertices();
 	geometry2.mergeVertices();
 	geometry2.computeFaceNormals();
 	geometry2.computeFaceNormals();
 
 
-	var vertices = geometry2.vertices;
+	var sourceVertices = geometry2.vertices;
 	var faces = geometry2.faces;
 	var faces = geometry2.faces;
 
 
+	// now create a data structure where each entry represents an edge with its adjoining faces
+
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {
 	for ( var i = 0, l = faces.length; i < l; i ++ ) {
 
 
 		var face = faces[ i ];
 		var face = faces[ i ];
@@ -54,15 +63,15 @@ function EdgesGeometry( geometry, thresholdAngle ) {
 			edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
 			edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
 			edge.sort( sortFunction );
 			edge.sort( sortFunction );
 
 
-			var key = edge.toString();
+			key = edge.toString();
 
 
-			if ( hash[ key ] === undefined ) {
+			if ( edges[ key ] === undefined ) {
 
 
-				hash[ key ] = { vert1: edge[ 0 ], vert2: edge[ 1 ], face1: i, face2: undefined };
+				edges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ], face1: i, face2: undefined };
 
 
 			} else {
 			} else {
 
 
-				hash[ key ].face2 = i;
+				edges[ key ].face2 = i;
 
 
 			}
 			}
 
 
@@ -70,31 +79,37 @@ function EdgesGeometry( geometry, thresholdAngle ) {
 
 
 	}
 	}
 
 
-	var coords = [];
+	// generate vertices
 
 
-	for ( var key in hash ) {
+	for ( key in edges ) {
 
 
-		var h = hash[ key ];
+		var e = edges[ key ];
 
 
-		// An edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
+		// an edge is only rendered if the angle (in degrees) between the face normals of the adjoining faces exceeds this value. default = 1 degree.
 
 
-		if ( h.face2 === undefined || faces[ h.face1 ].normal.dot( faces[ h.face2 ].normal ) <= thresholdDot ) {
+		if ( e.face2 === undefined || faces[ e.face1 ].normal.dot( faces[ e.face2 ].normal ) <= thresholdDot ) {
 
 
-			var vertex = vertices[ h.vert1 ];
-			coords.push( vertex.x );
-			coords.push( vertex.y );
-			coords.push( vertex.z );
+			var vertex = sourceVertices[ e.index1 ];
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-			vertex = vertices[ h.vert2 ];
-			coords.push( vertex.x );
-			coords.push( vertex.y );
-			coords.push( vertex.z );
+			vertex = sourceVertices[ e.index2 ];
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	this.addAttribute( 'position', new Float32BufferAttribute( coords, 3 ) );
+	// build geometry
+
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+
+	// custom array sort function
+
+	function sortFunction( a, b ) {
+
+		return a - b;
+
+	}
 
 
 }
 }
 
 

+ 26 - 25
src/geometries/LatheGeometry.js

@@ -34,10 +34,10 @@ function LatheGeometry( points, segments, phiStart, phiLength ) {
 LatheGeometry.prototype = Object.create( Geometry.prototype );
 LatheGeometry.prototype = Object.create( Geometry.prototype );
 LatheGeometry.prototype.constructor = LatheGeometry;
 LatheGeometry.prototype.constructor = LatheGeometry;
 
 
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
-import { BufferAttribute } from '../core/BufferAttribute';
 import { _Math } from '../math/Math';
 import { _Math } from '../math/Math';
 
 
 /**
 /**
@@ -62,19 +62,19 @@ function LatheBufferGeometry( points, segments, phiStart, phiLength ) {
 	phiLength = phiLength || Math.PI * 2;
 	phiLength = phiLength || Math.PI * 2;
 
 
 	// clamp phiLength so it's in range of [ 0, 2PI ]
 	// clamp phiLength so it's in range of [ 0, 2PI ]
+
 	phiLength = _Math.clamp( phiLength, 0, Math.PI * 2 );
 	phiLength = _Math.clamp( phiLength, 0, Math.PI * 2 );
 
 
-	// these are used to calculate buffer length
-	var vertexCount = ( segments + 1 ) * points.length;
-	var indexCount = segments * points.length * 2 * 3;
 
 
 	// buffers
 	// buffers
-	var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ) , 1 );
-	var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );
+
+	var indices = [];
+	var vertices = [];
+	var uvs = [];
 
 
 	// helper variables
 	// helper variables
-	var index = 0, indexOffset = 0, base;
+
+	var base;
 	var inverseSegments = 1.0 / segments;
 	var inverseSegments = 1.0 / segments;
 	var vertex = new Vector3();
 	var vertex = new Vector3();
 	var uv = new Vector2();
 	var uv = new Vector2();
@@ -92,24 +92,26 @@ function LatheBufferGeometry( points, segments, phiStart, phiLength ) {
 		for ( j = 0; j <= ( points.length - 1 ); j ++ ) {
 		for ( j = 0; j <= ( points.length - 1 ); j ++ ) {
 
 
 			// vertex
 			// vertex
+
 			vertex.x = points[ j ].x * sin;
 			vertex.x = points[ j ].x * sin;
 			vertex.y = points[ j ].y;
 			vertex.y = points[ j ].y;
 			vertex.z = points[ j ].x * cos;
 			vertex.z = points[ j ].x * cos;
-			vertices.setXYZ( index, vertex.x, vertex.y, vertex.z );
+
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 			// uv
 			// uv
+
 			uv.x = i / segments;
 			uv.x = i / segments;
 			uv.y = j / ( points.length - 1 );
 			uv.y = j / ( points.length - 1 );
-			uvs.setXY( index, uv.x, uv.y );
 
 
-			// increase index
-			index ++;
+			uvs.push( uv.x, uv.y );
+
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	// generate indices
+	// indices
 
 
 	for ( i = 0; i < segments; i ++ ) {
 	for ( i = 0; i < segments; i ++ ) {
 
 
@@ -117,21 +119,15 @@ function LatheBufferGeometry( points, segments, phiStart, phiLength ) {
 
 
 			base = j + i * points.length;
 			base = j + i * points.length;
 
 
-			// indices
 			var a = base;
 			var a = base;
 			var b = base + points.length;
 			var b = base + points.length;
 			var c = base + points.length + 1;
 			var c = base + points.length + 1;
 			var d = base + 1;
 			var d = base + 1;
 
 
-			// face one
-			indices.setX( indexOffset, a ); indexOffset ++;
-			indices.setX( indexOffset, b ); indexOffset ++;
-			indices.setX( indexOffset, d ); indexOffset ++;
+			// faces
 
 
-			// face two
-			indices.setX( indexOffset, b ); indexOffset ++;
-			indices.setX( indexOffset, c ); indexOffset ++;
-			indices.setX( indexOffset, d ); indexOffset ++;
+			indices.push( a, b, d );
+			indices.push( b, c, d );
 
 
 		}
 		}
 
 
@@ -140,8 +136,8 @@ function LatheBufferGeometry( points, segments, phiStart, phiLength ) {
 	// build geometry
 	// build geometry
 
 
 	this.setIndex( indices );
 	this.setIndex( indices );
-	this.addAttribute( 'position', vertices );
-	this.addAttribute( 'uv', uvs );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 	// generate normals
 	// generate normals
 
 
@@ -158,29 +154,34 @@ function LatheBufferGeometry( points, segments, phiStart, phiLength ) {
 		var n = new Vector3();
 		var n = new Vector3();
 
 
 		// this is the buffer offset for the last line of vertices
 		// this is the buffer offset for the last line of vertices
+
 		base = segments * points.length * 3;
 		base = segments * points.length * 3;
 
 
 		for ( i = 0, j = 0; i < points.length; i ++, j += 3 ) {
 		for ( i = 0, j = 0; i < points.length; i ++, j += 3 ) {
 
 
 			// select the normal of the vertex in the first line
 			// select the normal of the vertex in the first line
+
 			n1.x = normals[ j + 0 ];
 			n1.x = normals[ j + 0 ];
 			n1.y = normals[ j + 1 ];
 			n1.y = normals[ j + 1 ];
 			n1.z = normals[ j + 2 ];
 			n1.z = normals[ j + 2 ];
 
 
 			// select the normal of the vertex in the last line
 			// select the normal of the vertex in the last line
+
 			n2.x = normals[ base + j + 0 ];
 			n2.x = normals[ base + j + 0 ];
 			n2.y = normals[ base + j + 1 ];
 			n2.y = normals[ base + j + 1 ];
 			n2.z = normals[ base + j + 2 ];
 			n2.z = normals[ base + j + 2 ];
 
 
 			// average normals
 			// average normals
+
 			n.addVectors( n1, n2 ).normalize();
 			n.addVectors( n1, n2 ).normalize();
 
 
 			// assign the new values to both normals
 			// assign the new values to both normals
+
 			normals[ j + 0 ] = normals[ base + j + 0 ] = n.x;
 			normals[ j + 0 ] = normals[ base + j + 0 ] = n.x;
 			normals[ j + 1 ] = normals[ base + j + 1 ] = n.y;
 			normals[ j + 1 ] = normals[ base + j + 1 ] = n.y;
 			normals[ j + 2 ] = normals[ base + j + 2 ] = n.z;
 			normals[ j + 2 ] = normals[ base + j + 2 ] = n.z;
 
 
-		} // next row
+		}
 
 
 	}
 	}
 
 

+ 14 - 15
src/geometries/ParametricGeometry.js

@@ -35,7 +35,7 @@ ParametricGeometry.prototype.constructor = ParametricGeometry;
  */
  */
 
 
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
-import { Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 
 
 function ParametricBufferGeometry( func, slices, stacks ) {
 function ParametricBufferGeometry( func, slices, stacks ) {
 
 
@@ -49,25 +49,27 @@ function ParametricBufferGeometry( func, slices, stacks ) {
 		stacks: stacks
 		stacks: stacks
 	};
 	};
 
 
-	// generate vertices and uvs
+	// buffers
 
 
+	var indices = [];
 	var vertices = [];
 	var vertices = [];
 	var uvs = [];
 	var uvs = [];
 
 
-	var i, j, p;
-	var u, v;
+	var i, j;
+
+	// generate vertices and uvs
 
 
 	var sliceCount = slices + 1;
 	var sliceCount = slices + 1;
 
 
 	for ( i = 0; i <= stacks; i ++ ) {
 	for ( i = 0; i <= stacks; i ++ ) {
 
 
-		v = i / stacks;
+		var v = i / stacks;
 
 
 		for ( j = 0; j <= slices; j ++ ) {
 		for ( j = 0; j <= slices; j ++ ) {
 
 
-			u = j / slices;
+			var u = j / slices;
 
 
-			p = func( u, v );
+			var p = func( u, v );
 			vertices.push( p.x, p.y, p.z );
 			vertices.push( p.x, p.y, p.z );
 
 
 			uvs.push( u, v );
 			uvs.push( u, v );
@@ -78,17 +80,14 @@ function ParametricBufferGeometry( func, slices, stacks ) {
 
 
 	// generate indices
 	// generate indices
 
 
-	var indices = [];
-	var a, b, c, d;
-
 	for ( i = 0; i < stacks; i ++ ) {
 	for ( i = 0; i < stacks; i ++ ) {
 
 
 		for ( j = 0; j < slices; j ++ ) {
 		for ( j = 0; j < slices; j ++ ) {
 
 
-			a = i * sliceCount + j;
-			b = i * sliceCount + j + 1;
-			c = ( i + 1 ) * sliceCount + j + 1;
-			d = ( i + 1 ) * sliceCount + j;
+			var a = i * sliceCount + j;
+			var b = i * sliceCount + j + 1;
+			var c = ( i + 1 ) * sliceCount + j + 1;
+			var d = ( i + 1 ) * sliceCount + j;
 
 
 			// faces one and two
 			// faces one and two
 
 
@@ -101,7 +100,7 @@ function ParametricBufferGeometry( func, slices, stacks ) {
 
 
 	// build geometry
 	// build geometry
 
 
-	this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) );
+	this.setIndex( indices );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 

+ 30 - 33
src/geometries/PlaneGeometry.js

@@ -27,10 +27,12 @@ PlaneGeometry.prototype.constructor = PlaneGeometry;
 
 
 /**
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
+ * @author Mugen87 / https://github.com/Mugen87
+ *
  * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
  * based on http://papervision3d.googlecode.com/svn/trunk/as3/trunk/src/org/papervision3d/objects/primitives/Plane.as
  */
  */
 
 
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 
 
 function PlaneBufferGeometry( width, height, widthSegments, heightSegments ) {
 function PlaneBufferGeometry( width, height, widthSegments, heightSegments ) {
@@ -58,67 +60,62 @@ function PlaneBufferGeometry( width, height, widthSegments, heightSegments ) {
 	var segment_width = width / gridX;
 	var segment_width = width / gridX;
 	var segment_height = height / gridY;
 	var segment_height = height / gridY;
 
 
-	var vertices = new Float32Array( gridX1 * gridY1 * 3 );
-	var normals = new Float32Array( gridX1 * gridY1 * 3 );
-	var uvs = new Float32Array( gridX1 * gridY1 * 2 );
+	var ix, iy;
 
 
-	var offset = 0;
-	var offset2 = 0;
+	// buffers
 
 
-	for ( var iy = 0; iy < gridY1; iy ++ ) {
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
+
+	// generate vertices, normals and uvs
+
+	for ( iy = 0; iy < gridY1; iy ++ ) {
 
 
 		var y = iy * segment_height - height_half;
 		var y = iy * segment_height - height_half;
 
 
-		for ( var ix = 0; ix < gridX1; ix ++ ) {
+		for ( ix = 0; ix < gridX1; ix ++ ) {
 
 
 			var x = ix * segment_width - width_half;
 			var x = ix * segment_width - width_half;
 
 
-			vertices[ offset ] = x;
-			vertices[ offset + 1 ] = - y;
-
-			normals[ offset + 2 ] = 1;
+			vertices.push( x, - y, 0 );
 
 
-			uvs[ offset2 ] = ix / gridX;
-			uvs[ offset2 + 1 ] = 1 - ( iy / gridY );
+			normals.push( 0, 0, 1 );
 
 
-			offset += 3;
-			offset2 += 2;
+			uvs.push( ix / gridX );
+			uvs.push( 1 - ( iy / gridY ) );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	offset = 0;
+	// indices
 
 
-	var indices = new ( ( vertices.length / 3 ) > 65535 ? Uint32Array : Uint16Array )( gridX * gridY * 6 );
+	for ( iy = 0; iy < gridY; iy ++ ) {
 
 
-	for ( var iy = 0; iy < gridY; iy ++ ) {
-
-		for ( var ix = 0; ix < gridX; ix ++ ) {
+		for ( ix = 0; ix < gridX; ix ++ ) {
 
 
 			var a = ix + gridX1 * iy;
 			var a = ix + gridX1 * iy;
 			var b = ix + gridX1 * ( iy + 1 );
 			var b = ix + gridX1 * ( iy + 1 );
 			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 			var c = ( ix + 1 ) + gridX1 * ( iy + 1 );
 			var d = ( ix + 1 ) + gridX1 * iy;
 			var d = ( ix + 1 ) + gridX1 * iy;
 
 
-			indices[ offset ] = a;
-			indices[ offset + 1 ] = b;
-			indices[ offset + 2 ] = d;
-
-			indices[ offset + 3 ] = b;
-			indices[ offset + 4 ] = c;
-			indices[ offset + 5 ] = d;
+			// faces
 
 
-			offset += 6;
+			indices.push( a, b, d );
+			indices.push( b, c, d );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	this.setIndex( new BufferAttribute( indices, 1 ) );
-	this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
+	// build geometry
+
+	this.setIndex( indices );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 }
 }
 
 

+ 0 - 3
src/geometries/PolyhedronGeometry.js

@@ -35,7 +35,6 @@ import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
-import { Sphere } from '../math/Sphere';
 
 
 function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 
 
@@ -77,8 +76,6 @@ function PolyhedronBufferGeometry( vertices, indices, radius, detail ) {
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvBuffer, 2 ) );
 	this.normalizeNormals();
 	this.normalizeNormals();
 
 
-	this.boundingSphere = new Sphere( new Vector3(), radius );
-
 	// helper functions
 	// helper functions
 
 
 	function subdivide( detail ) {
 	function subdivide( detail ) {

+ 25 - 30
src/geometries/RingGeometry.js

@@ -30,10 +30,10 @@ RingGeometry.prototype.constructor = RingGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
-import { BufferAttribute } from '../core/BufferAttribute';
 
 
 function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {
 function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegments, thetaStart, thetaLength ) {
 
 
@@ -59,18 +59,16 @@ function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegment
 	thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;
 	thetaSegments = thetaSegments !== undefined ? Math.max( 3, thetaSegments ) : 8;
 	phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1;
 	phiSegments = phiSegments !== undefined ? Math.max( 1, phiSegments ) : 1;
 
 
-	// these are used to calculate buffer length
-	var vertexCount = ( thetaSegments + 1 ) * ( phiSegments + 1 );
-	var indexCount = thetaSegments * phiSegments * 2 * 3;
-
 	// buffers
 	// buffers
-	var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ), 1 );
-	var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );
+
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
 
 
 	// some helper variables
 	// some helper variables
-	var index = 0, indexOffset = 0, segment;
+
+	var segment;
 	var radius = innerRadius;
 	var radius = innerRadius;
 	var radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );
 	var radiusStep = ( ( outerRadius - innerRadius ) / phiSegments );
 	var vertex = new Vector3();
 	var vertex = new Vector3();
@@ -79,38 +77,41 @@ function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegment
 
 
 	// generate vertices, normals and uvs
 	// generate vertices, normals and uvs
 
 
-	// values are generate from the inside of the ring to the outside
-
 	for ( j = 0; j <= phiSegments; j ++ ) {
 	for ( j = 0; j <= phiSegments; j ++ ) {
 
 
 		for ( i = 0; i <= thetaSegments; i ++ ) {
 		for ( i = 0; i <= thetaSegments; i ++ ) {
 
 
+			// values are generate from the inside of the ring to the outside
+
 			segment = thetaStart + i / thetaSegments * thetaLength;
 			segment = thetaStart + i / thetaSegments * thetaLength;
 
 
 			// vertex
 			// vertex
+
 			vertex.x = radius * Math.cos( segment );
 			vertex.x = radius * Math.cos( segment );
 			vertex.y = radius * Math.sin( segment );
 			vertex.y = radius * Math.sin( segment );
-			vertices.setXYZ( index, vertex.x, vertex.y, vertex.z );
+
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 			// normal
 			// normal
-			normals.setXYZ( index, 0, 0, 1 );
+
+			normals.push( 0, 0, 1 );
 
 
 			// uv
 			// uv
+
 			uv.x = ( vertex.x / outerRadius + 1 ) / 2;
 			uv.x = ( vertex.x / outerRadius + 1 ) / 2;
 			uv.y = ( vertex.y / outerRadius + 1 ) / 2;
 			uv.y = ( vertex.y / outerRadius + 1 ) / 2;
-			uvs.setXY( index, uv.x, uv.y );
 
 
-			// increase index
-			index ++;
+			uvs.push( uv.x, uv.y );
 
 
 		}
 		}
 
 
 		// increase the radius for next row of vertices
 		// increase the radius for next row of vertices
+
 		radius += radiusStep;
 		radius += radiusStep;
 
 
 	}
 	}
 
 
-	// generate indices
+	// indices
 
 
 	for ( j = 0; j < phiSegments; j ++ ) {
 	for ( j = 0; j < phiSegments; j ++ ) {
 
 
@@ -120,21 +121,15 @@ function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegment
 
 
 			segment = i + thetaSegmentLevel;
 			segment = i + thetaSegmentLevel;
 
 
-			// indices
 			var a = segment;
 			var a = segment;
 			var b = segment + thetaSegments + 1;
 			var b = segment + thetaSegments + 1;
 			var c = segment + thetaSegments + 2;
 			var c = segment + thetaSegments + 2;
 			var d = segment + 1;
 			var d = segment + 1;
 
 
-			// face one
-			indices.setX( indexOffset, a ); indexOffset ++;
-			indices.setX( indexOffset, b ); indexOffset ++;
-			indices.setX( indexOffset, c ); indexOffset ++;
+			// faces
 
 
-			// face two
-			indices.setX( indexOffset, a ); indexOffset ++;
-			indices.setX( indexOffset, c ); indexOffset ++;
-			indices.setX( indexOffset, d ); indexOffset ++;
+			indices.push( a, b, d );
+			indices.push( b, c, d );
 
 
 		}
 		}
 
 
@@ -143,9 +138,9 @@ function RingBufferGeometry( innerRadius, outerRadius, thetaSegments, phiSegment
 	// build geometry
 	// build geometry
 
 
 	this.setIndex( indices );
 	this.setIndex( indices );
-	this.addAttribute( 'position', vertices );
-	this.addAttribute( 'normal', normals );
-	this.addAttribute( 'uv', uvs );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 }
 }
 
 

+ 7 - 3
src/geometries/ShapeGeometry.js

@@ -35,7 +35,7 @@ ShapeGeometry.prototype.constructor = ShapeGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
-import { Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { ShapeUtils } from '../extras/ShapeUtils';
 import { ShapeUtils } from '../extras/ShapeUtils';
 
 
@@ -52,10 +52,14 @@ function ShapeBufferGeometry( shapes, curveSegments ) {
 
 
 	curveSegments = curveSegments || 12;
 	curveSegments = curveSegments || 12;
 
 
+	// buffers
+
+	var indices = [];
 	var vertices = [];
 	var vertices = [];
 	var normals = [];
 	var normals = [];
 	var uvs = [];
 	var uvs = [];
-	var indices = [];
+
+	// helper variables
 
 
 	var groupStart = 0;
 	var groupStart = 0;
 	var groupCount = 0;
 	var groupCount = 0;
@@ -83,7 +87,7 @@ function ShapeBufferGeometry( shapes, curveSegments ) {
 
 
 	// build geometry
 	// build geometry
 
 
-	this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) );
+	this.setIndex( indices );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );

+ 49 - 35
src/geometries/SphereGeometry.js

@@ -29,12 +29,12 @@ SphereGeometry.prototype.constructor = SphereGeometry;
 
 
 /**
 /**
  * @author benaadams / https://twitter.com/ben_a_adams
  * @author benaadams / https://twitter.com/ben_a_adams
+ * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
-import { Uint16BufferAttribute, Uint32BufferAttribute, BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
-import { Sphere } from '../math/Sphere';
 
 
 function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {
 function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart, phiLength, thetaStart, thetaLength ) {
 
 
@@ -65,68 +65,82 @@ function SphereBufferGeometry( radius, widthSegments, heightSegments, phiStart,
 
 
 	var thetaEnd = thetaStart + thetaLength;
 	var thetaEnd = thetaStart + thetaLength;
 
 
-	var vertexCount = ( ( widthSegments + 1 ) * ( heightSegments + 1 ) );
+	var ix, iy;
 
 
-	var positions = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );
+	var index = 0;
+	var grid = [];
 
 
-	var index = 0, vertices = [], normal = new Vector3();
+	var vertex = new Vector3();
+	var normal = new Vector3();
 
 
-	for ( var y = 0; y <= heightSegments; y ++ ) {
+	// buffers
+
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
+
+	// generate vertices, normals and uvs
+
+	for ( iy = 0; iy <= heightSegments; iy ++ ) {
 
 
 		var verticesRow = [];
 		var verticesRow = [];
 
 
-		var v = y / heightSegments;
+		var v = iy / heightSegments;
 
 
-		for ( var x = 0; x <= widthSegments; x ++ ) {
+		for ( ix = 0; ix <= widthSegments; ix ++ ) {
 
 
-			var u = x / widthSegments;
+			var u = ix / widthSegments;
 
 
-			var px = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
-			var py = radius * Math.cos( thetaStart + v * thetaLength );
-			var pz = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+			// vertex
 
 
-			normal.set( px, py, pz ).normalize();
+			vertex.x = - radius * Math.cos( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
+			vertex.y = radius * Math.cos( thetaStart + v * thetaLength );
+			vertex.z = radius * Math.sin( phiStart + u * phiLength ) * Math.sin( thetaStart + v * thetaLength );
 
 
-			positions.setXYZ( index, px, py, pz );
-			normals.setXYZ( index, normal.x, normal.y, normal.z );
-			uvs.setXY( index, u, 1 - v );
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-			verticesRow.push( index );
+			// normal
 
 
-			index ++;
+			normal.set( vertex.x, vertex.y, vertex.z ).normalize();
+			normals.push( normal.x, normal.y, normal.z );
+
+			// uv
+
+			uvs.push( u, 1 - v );
+
+			verticesRow.push( index ++ );
 
 
 		}
 		}
 
 
-		vertices.push( verticesRow );
+		grid.push( verticesRow );
 
 
 	}
 	}
 
 
-	var indices = [];
+	// indices
 
 
-	for ( var y = 0; y < heightSegments; y ++ ) {
+	for ( iy = 0; iy < heightSegments; iy ++ ) {
 
 
-		for ( var x = 0; x < widthSegments; x ++ ) {
+		for ( ix = 0; ix < widthSegments; ix ++ ) {
 
 
-			var v1 = vertices[ y ][ x + 1 ];
-			var v2 = vertices[ y ][ x ];
-			var v3 = vertices[ y + 1 ][ x ];
-			var v4 = vertices[ y + 1 ][ x + 1 ];
+			var a = grid[ iy ][ ix + 1 ];
+			var b = grid[ iy ][ ix ];
+			var c = grid[ iy + 1 ][ ix ];
+			var d = grid[ iy + 1 ][ ix + 1 ];
 
 
-			if ( y !== 0 || thetaStart > 0 ) indices.push( v1, v2, v4 );
-			if ( y !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( v2, v3, v4 );
+			if ( iy !== 0 || thetaStart > 0 ) indices.push( a, b, d );
+			if ( iy !== heightSegments - 1 || thetaEnd < Math.PI ) indices.push( b, c, d );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
-	this.setIndex( new ( positions.count > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) );
-	this.addAttribute( 'position', positions );
-	this.addAttribute( 'normal', normals );
-	this.addAttribute( 'uv', uvs );
+	// build geometry
 
 
-	this.boundingSphere = new Sphere( new Vector3(), radius );
+	this.setIndex( indices );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 }
 }
 
 

+ 1 - 1
src/geometries/TextGeometry.js

@@ -26,7 +26,7 @@ function TextGeometry( text, parameters ) {
 
 
 	var font = parameters.font;
 	var font = parameters.font;
 
 
-	if ( (font && font.isFont) === false ) {
+	if ( ( font && font.isFont ) === false ) {
 
 
 		console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' );
 		console.error( 'THREE.TextGeometry: font parameter is not an instance of THREE.Font.' );
 		return new Geometry();
 		return new Geometry();

+ 22 - 42
src/geometries/TorusGeometry.js

@@ -31,7 +31,7 @@ TorusGeometry.prototype.constructor = TorusGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 
 
@@ -55,22 +55,15 @@ function TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc
 	tubularSegments = Math.floor( tubularSegments ) || 6;
 	tubularSegments = Math.floor( tubularSegments ) || 6;
 	arc = arc || Math.PI * 2;
 	arc = arc || Math.PI * 2;
 
 
-	// used to calculate buffer length
-	var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) );
-	var indexCount = radialSegments * tubularSegments * 2 * 3;
-
 	// buffers
 	// buffers
-	var indices = new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount );
-	var vertices = new Float32Array( vertexCount * 3 );
-	var normals = new Float32Array( vertexCount * 3 );
-	var uvs = new Float32Array( vertexCount * 2 );
 
 
-	// offset variables
-	var vertexBufferOffset = 0;
-	var uvBufferOffset = 0;
-	var indexBufferOffset = 0;
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
 
 
 	// helper variables
 	// helper variables
+
 	var center = new Vector3();
 	var center = new Vector3();
 	var vertex = new Vector3();
 	var vertex = new Vector3();
 	var normal = new Vector3();
 	var normal = new Vector3();
@@ -87,32 +80,25 @@ function TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc
 			var v = j / radialSegments * Math.PI * 2;
 			var v = j / radialSegments * Math.PI * 2;
 
 
 			// vertex
 			// vertex
+
 			vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );
 			vertex.x = ( radius + tube * Math.cos( v ) ) * Math.cos( u );
 			vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );
 			vertex.y = ( radius + tube * Math.cos( v ) ) * Math.sin( u );
 			vertex.z = tube * Math.sin( v );
 			vertex.z = tube * Math.sin( v );
 
 
-			vertices[ vertexBufferOffset ] = vertex.x;
-			vertices[ vertexBufferOffset + 1 ] = vertex.y;
-			vertices[ vertexBufferOffset + 2 ] = vertex.z;
+			vertices.push( vertex.x, vertex.y, vertex.z );
+
+			// normal
 
 
-			// this vector is used to calculate the normal
 			center.x = radius * Math.cos( u );
 			center.x = radius * Math.cos( u );
 			center.y = radius * Math.sin( u );
 			center.y = radius * Math.sin( u );
-
-			// normal
 			normal.subVectors( vertex, center ).normalize();
 			normal.subVectors( vertex, center ).normalize();
 
 
-			normals[ vertexBufferOffset ] = normal.x;
-			normals[ vertexBufferOffset + 1 ] = normal.y;
-			normals[ vertexBufferOffset + 2 ] = normal.z;
+			normals.push( normal.x, normal.y, normal.z );
 
 
 			// uv
 			// uv
-			uvs[ uvBufferOffset ] = i / tubularSegments;
-			uvs[ uvBufferOffset + 1 ] = j / radialSegments;
 
 
-			// update offsets
-			vertexBufferOffset += 3;
-			uvBufferOffset += 2;
+			uvs.push( i / tubularSegments );
+			uvs.push( j / radialSegments );
 
 
 		}
 		}
 
 
@@ -125,33 +111,27 @@ function TorusBufferGeometry( radius, tube, radialSegments, tubularSegments, arc
 		for ( i = 1; i <= tubularSegments; i ++ ) {
 		for ( i = 1; i <= tubularSegments; i ++ ) {
 
 
 			// indices
 			// indices
+
 			var a = ( tubularSegments + 1 ) * j + i - 1;
 			var a = ( tubularSegments + 1 ) * j + i - 1;
 			var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;
 			var b = ( tubularSegments + 1 ) * ( j - 1 ) + i - 1;
 			var c = ( tubularSegments + 1 ) * ( j - 1 ) + i;
 			var c = ( tubularSegments + 1 ) * ( j - 1 ) + i;
 			var d = ( tubularSegments + 1 ) * j + i;
 			var d = ( tubularSegments + 1 ) * j + i;
 
 
-			// face one
-			indices[ indexBufferOffset ] = a;
-			indices[ indexBufferOffset + 1 ] = b;
-			indices[ indexBufferOffset + 2 ] = d;
+			// faces
 
 
-			// face two
-			indices[ indexBufferOffset + 3 ] = b;
-			indices[ indexBufferOffset + 4 ] = c;
-			indices[ indexBufferOffset + 5 ] = d;
-
-			// update offset
-			indexBufferOffset += 6;
+			indices.push( a, b, d );
+			indices.push( b, c, d );
 
 
 		}
 		}
 
 
 	}
 	}
 
 
 	// build geometry
 	// build geometry
-	this.setIndex( new BufferAttribute( indices, 1 ) );
-	this.addAttribute( 'position', new BufferAttribute( vertices, 3 ) );
-	this.addAttribute( 'normal', new BufferAttribute( normals, 3 ) );
-	this.addAttribute( 'uv', new BufferAttribute( uvs, 2 ) );
+
+	this.setIndex( indices );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 }
 }
 
 

+ 21 - 29
src/geometries/TorusKnotGeometry.js

@@ -34,7 +34,7 @@ TorusKnotGeometry.prototype.constructor = TorusKnotGeometry;
  * see: http://www.blackpawn.com/texts/pqtorus/
  * see: http://www.blackpawn.com/texts/pqtorus/
  */
  */
 
 
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
@@ -61,18 +61,16 @@ function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments,
 	p = p || 2;
 	p = p || 2;
 	q = q || 3;
 	q = q || 3;
 
 
-	// used to calculate buffer length
-	var vertexCount = ( ( radialSegments + 1 ) * ( tubularSegments + 1 ) );
-	var indexCount = radialSegments * tubularSegments * 2 * 3;
-
 	// buffers
 	// buffers
-	var indices = new BufferAttribute( new ( indexCount > 65535 ? Uint32Array : Uint16Array )( indexCount ), 1 );
-	var vertices = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var normals = new BufferAttribute( new Float32Array( vertexCount * 3 ), 3 );
-	var uvs = new BufferAttribute( new Float32Array( vertexCount * 2 ), 2 );
+
+	var indices = [];
+	var vertices = [];
+	var normals = [];
+	var uvs = [];
 
 
 	// helper variables
 	// helper variables
-	var i, j, index = 0, indexOffset = 0;
+
+	var i, j;
 
 
 	var vertex = new Vector3();
 	var vertex = new Vector3();
 	var normal = new Vector3();
 	var normal = new Vector3();
@@ -127,20 +125,18 @@ function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments,
 			vertex.y = P1.y + ( cx * N.y + cy * B.y );
 			vertex.y = P1.y + ( cx * N.y + cy * B.y );
 			vertex.z = P1.z + ( cx * N.z + cy * B.z );
 			vertex.z = P1.z + ( cx * N.z + cy * B.z );
 
 
-			// vertex
-			vertices.setXYZ( index, vertex.x, vertex.y, vertex.z );
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 			// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)
 			// normal (P1 is always the center/origin of the extrusion, thus we can use it to calculate the normal)
+
 			normal.subVectors( vertex, P1 ).normalize();
 			normal.subVectors( vertex, P1 ).normalize();
-			normals.setXYZ( index, normal.x, normal.y, normal.z );
+
+			normals.push( normal.x, normal.y, normal.z );
 
 
 			// uv
 			// uv
-			uv.x = i / tubularSegments;
-			uv.y = j / radialSegments;
-			uvs.setXY( index, uv.x, uv.y );
 
 
-			// increase index
-			index ++;
+			uvs.push( i / tubularSegments );
+			uvs.push( j / radialSegments );
 
 
 		}
 		}
 
 
@@ -153,20 +149,16 @@ function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments,
 		for ( i = 1; i <= radialSegments; i ++ ) {
 		for ( i = 1; i <= radialSegments; i ++ ) {
 
 
 			// indices
 			// indices
+
 			var a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );
 			var a = ( radialSegments + 1 ) * ( j - 1 ) + ( i - 1 );
 			var b = ( radialSegments + 1 ) * j + ( i - 1 );
 			var b = ( radialSegments + 1 ) * j + ( i - 1 );
 			var c = ( radialSegments + 1 ) * j + i;
 			var c = ( radialSegments + 1 ) * j + i;
 			var d = ( radialSegments + 1 ) * ( j - 1 ) + i;
 			var d = ( radialSegments + 1 ) * ( j - 1 ) + i;
 
 
-			// face one
-			indices.setX( indexOffset, a ); indexOffset ++;
-			indices.setX( indexOffset, b ); indexOffset ++;
-			indices.setX( indexOffset, d ); indexOffset ++;
+			// faces
 
 
-			// face two
-			indices.setX( indexOffset, b ); indexOffset ++;
-			indices.setX( indexOffset, c ); indexOffset ++;
-			indices.setX( indexOffset, d ); indexOffset ++;
+			indices.push( a, b, d );
+			indices.push( b, c, d );
 
 
 		}
 		}
 
 
@@ -175,9 +167,9 @@ function TorusKnotBufferGeometry( radius, tube, tubularSegments, radialSegments,
 	// build geometry
 	// build geometry
 
 
 	this.setIndex( indices );
 	this.setIndex( indices );
-	this.addAttribute( 'position', vertices );
-	this.addAttribute( 'normal', normals );
-	this.addAttribute( 'uv', uvs );
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
+	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 
 
 	// this function calculates the current position on the torus curve
 	// this function calculates the current position on the torus curve
 
 

+ 2 - 2
src/geometries/TubeGeometry.js

@@ -48,7 +48,7 @@ TubeGeometry.prototype.constructor = TubeGeometry;
  * @author Mugen87 / https://github.com/Mugen87
  * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
-import { Float32BufferAttribute, Uint16BufferAttribute, Uint32BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
 import { Vector2 } from '../math/Vector2';
 import { Vector2 } from '../math/Vector2';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
@@ -101,7 +101,7 @@ function TubeBufferGeometry( path, tubularSegments, radius, radialSegments, clos
 
 
 	// build geometry
 	// build geometry
 
 
-	this.setIndex( new ( indices.length > 65535 ? Uint32BufferAttribute : Uint16BufferAttribute )( indices, 1 ) );
+	this.setIndex( indices );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
 	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 	this.addAttribute( 'normal', new Float32BufferAttribute( normals, 3 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );
 	this.addAttribute( 'uv', new Float32BufferAttribute( uvs, 2 ) );

+ 82 - 85
src/geometries/WireframeGeometry.js

@@ -1,51 +1,52 @@
 import { BufferGeometry } from '../core/BufferGeometry';
 import { BufferGeometry } from '../core/BufferGeometry';
-import { BufferAttribute } from '../core/BufferAttribute';
+import { Float32BufferAttribute } from '../core/BufferAttribute';
+import { Vector3 } from '../math/Vector3';
 
 
 /**
 /**
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
+ * @author Mugen87 / https://github.com/Mugen87
  */
  */
 
 
 function WireframeGeometry( geometry ) {
 function WireframeGeometry( geometry ) {
 
 
 	BufferGeometry.call( this );
 	BufferGeometry.call( this );
 
 
-	var edge = [ 0, 0 ], hash = {};
+	this.type = 'WireframeGeometry';
 
 
-	function sortFunction( a, b ) {
+	// buffer
 
 
-		return a - b;
+	var vertices = [];
 
 
-	}
+	// helper variables
+
+	var i, j, l, o, ol;
+	var edge = [ 0, 0 ], edges = {}, e;
+	var key, keys = [ 'a', 'b', 'c' ];
+	var vertex;
 
 
-	var keys = [ 'a', 'b', 'c' ];
+	// different logic for Geometry and BufferGeometry
 
 
 	if ( geometry && geometry.isGeometry ) {
 	if ( geometry && geometry.isGeometry ) {
 
 
-		var vertices = geometry.vertices;
-		var faces = geometry.faces;
-		var numEdges = 0;
+		// create a data structure that contains all edges without duplicates
 
 
-		// allocate maximal size
-		var edges = new Uint32Array( 6 * faces.length );
+		var faces = geometry.faces;
 
 
-		for ( var i = 0, l = faces.length; i < l; i ++ ) {
+		for ( i = 0, l = faces.length; i < l; i ++ ) {
 
 
 			var face = faces[ i ];
 			var face = faces[ i ];
 
 
-			for ( var j = 0; j < 3; j ++ ) {
+			for ( j = 0; j < 3; j ++ ) {
 
 
 				edge[ 0 ] = face[ keys[ j ] ];
 				edge[ 0 ] = face[ keys[ j ] ];
 				edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
 				edge[ 1 ] = face[ keys[ ( j + 1 ) % 3 ] ];
-				edge.sort( sortFunction );
+				edge.sort( sortFunction ); // sorting prevents duplicates
 
 
-				var key = edge.toString();
+				key = edge.toString();
 
 
-				if ( hash[ key ] === undefined ) {
+				if ( edges[ key ] === undefined ) {
 
 
-					edges[ 2 * numEdges ] = edge[ 0 ];
-					edges[ 2 * numEdges + 1 ] = edge[ 1 ];
-					hash[ key ] = true;
-					numEdges ++;
+					edges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ] };
 
 
 				}
 				}
 
 
@@ -53,68 +54,64 @@ function WireframeGeometry( geometry ) {
 
 
 		}
 		}
 
 
-		var coords = new Float32Array( numEdges * 2 * 3 );
+		// generate vertices
 
 
-		for ( var i = 0, l = numEdges; i < l; i ++ ) {
+		for ( key in edges ) {
 
 
-			for ( var j = 0; j < 2; j ++ ) {
+			e = edges[ key ];
 
 
-				var vertex = vertices[ edges [ 2 * i + j ] ];
+			vertex = geometry.vertices[ e.index1 ];
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-				var index = 6 * i + 3 * j;
-				coords[ index + 0 ] = vertex.x;
-				coords[ index + 1 ] = vertex.y;
-				coords[ index + 2 ] = vertex.z;
-
-			}
+			vertex = geometry.vertices[ e.index2 ];
+			vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 		}
 		}
 
 
-		this.addAttribute( 'position', new BufferAttribute( coords, 3 ) );
-
 	} else if ( geometry && geometry.isBufferGeometry ) {
 	} else if ( geometry && geometry.isBufferGeometry ) {
 
 
+		var position, indices, groups;
+		var group, start, count;
+		var index1, index2;
+
+		vertex = new Vector3();
+
 		if ( geometry.index !== null ) {
 		if ( geometry.index !== null ) {
 
 
-			// Indexed BufferGeometry
+			// indexed BufferGeometry
 
 
-			var indices = geometry.index.array;
-			var vertices = geometry.attributes.position;
-			var groups = geometry.groups;
-			var numEdges = 0;
+			position = geometry.attributes.position;
+			indices = geometry.index;
+			groups = geometry.groups;
 
 
 			if ( groups.length === 0 ) {
 			if ( groups.length === 0 ) {
 
 
-				geometry.addGroup( 0, indices.length );
+				geometry.addGroup( 0, indices.count );
 
 
 			}
 			}
 
 
-			// allocate maximal size
-			var edges = new Uint32Array( 2 * indices.length );
+			// create a data structure that contains all eges without duplicates
 
 
-			for ( var o = 0, ol = groups.length; o < ol; ++ o ) {
+			for ( o = 0, ol = groups.length; o < ol; ++ o ) {
 
 
-				var group = groups[ o ];
+				group = groups[ o ];
 
 
-				var start = group.start;
-				var count = group.count;
+				start = group.start;
+				count = group.count;
 
 
-				for ( var i = start, il = start + count; i < il; i += 3 ) {
+				for ( i = start, l = ( start + count ); i < l; i += 3 ) {
 
 
-					for ( var j = 0; j < 3; j ++ ) {
+					for ( j = 0; j < 3; j ++ ) {
 
 
-						edge[ 0 ] = indices[ i + j ];
-						edge[ 1 ] = indices[ i + ( j + 1 ) % 3 ];
-						edge.sort( sortFunction );
+						edge[ 0 ] = indices.getX( i + j );
+						edge[ 1 ] = indices.getX( i + ( j + 1 ) % 3 );
+						edge.sort( sortFunction ); // sorting prevents duplicates
 
 
-						var key = edge.toString();
+						key = edge.toString();
 
 
-						if ( hash[ key ] === undefined ) {
+						if ( edges[ key ] === undefined ) {
 
 
-							edges[ 2 * numEdges ] = edge[ 0 ];
-							edges[ 2 * numEdges + 1 ] = edge[ 1 ];
-							hash[ key ] = true;
-							numEdges ++;
+							edges[ key ] = { index1: edge[ 0 ], index2: edge[ 1 ] };
 
 
 						}
 						}
 
 
@@ -124,61 +121,61 @@ function WireframeGeometry( geometry ) {
 
 
 			}
 			}
 
 
-			var coords = new Float32Array( numEdges * 2 * 3 );
-
-			for ( var i = 0, l = numEdges; i < l; i ++ ) {
+			// generate vertices
 
 
-				for ( var j = 0; j < 2; j ++ ) {
+			for ( key in edges ) {
 
 
-					var index = 6 * i + 3 * j;
-					var index2 = edges[ 2 * i + j ];
+				e = edges[ key ];
 
 
-					coords[ index + 0 ] = vertices.getX( index2 );
-					coords[ index + 1 ] = vertices.getY( index2 );
-					coords[ index + 2 ] = vertices.getZ( index2 );
+				vertex.fromBufferAttribute( position, e.index1 );
+				vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-				}
+				vertex.fromBufferAttribute( position, e.index2 );
+				vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 			}
 			}
 
 
-			this.addAttribute( 'position', new BufferAttribute( coords, 3 ) );
-
 		} else {
 		} else {
 
 
 			// non-indexed BufferGeometry
 			// non-indexed BufferGeometry
 
 
-			var vertices = geometry.attributes.position.array;
-			var numEdges = vertices.length / 3;
-			var numTris = numEdges / 3;
-
-			var coords = new Float32Array( numEdges * 2 * 3 );
+			position = geometry.attributes.position;
 
 
-			for ( var i = 0, l = numTris; i < l; i ++ ) {
+			for ( i = 0, l = ( position.count / 3 ); i < l; i ++ ) {
 
 
-				for ( var j = 0; j < 3; j ++ ) {
+				for ( j = 0; j < 3; j ++ ) {
 
 
-					var index = 18 * i + 6 * j;
+					// three edges per triangle, an edge is represented as (index1, index2)
+					// e.g. the first triangle has the following edges: (0,1),(1,2),(2,0)
 
 
-					var index1 = 9 * i + 3 * j;
-					coords[ index + 0 ] = vertices[ index1 ];
-					coords[ index + 1 ] = vertices[ index1 + 1 ];
-					coords[ index + 2 ] = vertices[ index1 + 2 ];
+					index1 = 3 * i + j;
+					vertex.fromBufferAttribute( position, index1 );
+					vertices.push( vertex.x, vertex.y, vertex.z );
 
 
-					var index2 = 9 * i + 3 * ( ( j + 1 ) % 3 );
-					coords[ index + 3 ] = vertices[ index2 ];
-					coords[ index + 4 ] = vertices[ index2 + 1 ];
-					coords[ index + 5 ] = vertices[ index2 + 2 ];
+					index2 = 3 * i + ( ( j + 1 ) % 3 );
+					vertex.fromBufferAttribute( position, index2 );
+					vertices.push( vertex.x, vertex.y, vertex.z );
 
 
 				}
 				}
 
 
 			}
 			}
 
 
-			this.addAttribute( 'position', new BufferAttribute( coords, 3 ) );
-
 		}
 		}
 
 
 	}
 	}
 
 
+	// build geometry
+
+	this.addAttribute( 'position', new Float32BufferAttribute( vertices, 3 ) );
+
+	// custom array sort function
+
+	function sortFunction( a, b ) {
+
+		return a - b;
+
+	}
+
 }
 }
 
 
 WireframeGeometry.prototype = Object.create( BufferGeometry.prototype );
 WireframeGeometry.prototype = Object.create( BufferGeometry.prototype );

+ 11 - 5
src/helpers/ArrowHelper.js

@@ -24,11 +24,7 @@ import { Mesh } from '../objects/Mesh';
 import { Line } from '../objects/Line';
 import { Line } from '../objects/Line';
 import { Vector3 } from '../math/Vector3';
 import { Vector3 } from '../math/Vector3';
 
 
-var lineGeometry = new BufferGeometry();
-lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
-
-var coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
-coneGeometry.translate( 0, - 0.5, 0 );
+var lineGeometry, coneGeometry;
 
 
 function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
 function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
 
 
@@ -41,6 +37,16 @@ function ArrowHelper( dir, origin, length, color, headLength, headWidth ) {
 	if ( headLength === undefined ) headLength = 0.2 * length;
 	if ( headLength === undefined ) headLength = 0.2 * length;
 	if ( headWidth === undefined ) headWidth = 0.2 * headLength;
 	if ( headWidth === undefined ) headWidth = 0.2 * headLength;
 
 
+	if ( lineGeometry === undefined ) {
+
+		lineGeometry = new BufferGeometry();
+		lineGeometry.addAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0, 0, 1, 0 ], 3 ) );
+
+		coneGeometry = new CylinderBufferGeometry( 0, 0.5, 1, 5, 1 );
+		coneGeometry.translate( 0, - 0.5, 0 );
+
+	}
+
 	this.position.copy( origin );
 	this.position.copy( origin );
 
 
 	this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );
 	this.line = new Line( lineGeometry, new LineBasicMaterial( { color: color } ) );

+ 6 - 4
src/helpers/GridHelper.js

@@ -17,13 +17,15 @@ function GridHelper( size, divisions, color1, color2 ) {
 	color2 = new Color( color2 !== undefined ? color2 : 0x888888 );
 	color2 = new Color( color2 !== undefined ? color2 : 0x888888 );
 
 
 	var center = divisions / 2;
 	var center = divisions / 2;
-	var step = ( size * 2 ) / divisions;
+	var step = size / divisions;
+	var halfSize = size / 2;
+
 	var vertices = [], colors = [];
 	var vertices = [], colors = [];
 
 
-	for ( var i = 0, j = 0, k = - size; i <= divisions; i ++, k += step ) {
+	for ( var i = 0, j = 0, k = - halfSize; i <= divisions; i ++, k += step ) {
 
 
-		vertices.push( - size, 0, k, size, 0, k );
-		vertices.push( k, 0, - size, k, 0, size );
+		vertices.push( - halfSize, 0, k, halfSize, 0, k );
+		vertices.push( k, 0, - halfSize, k, 0, halfSize );
 
 
 		var color = i === center ? color1 : color2;
 		var color = i === center ? color1 : color2;
 
 

+ 3 - 0
src/loaders/ObjectLoader.js

@@ -84,7 +84,10 @@ Object.assign( ObjectLoader.prototype, {
 
 
 			} catch ( error ) {
 			} catch ( error ) {
 
 
+				if ( onError !== undefined ) onError( error );
+
 				console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message );
 				console.error( 'THREE:ObjectLoader: Can\'t parse ' + url + '.', error.message );
+
 				return;
 				return;
 
 
 			}
 			}

+ 70 - 60
src/math/Box3.js

@@ -57,6 +57,8 @@ Object.assign( Box3.prototype, {
 		this.min.set( minX, minY, minZ );
 		this.min.set( minX, minY, minZ );
 		this.max.set( maxX, maxY, maxZ );
 		this.max.set( maxX, maxY, maxZ );
 
 
+		return this;
+
 	},
 	},
 
 
 	setFromBufferAttribute: function ( attribute ) {
 	setFromBufferAttribute: function ( attribute ) {
@@ -88,6 +90,8 @@ Object.assign( Box3.prototype, {
 		this.min.set( minX, minY, minZ );
 		this.min.set( minX, minY, minZ );
 		this.max.set( maxX, maxY, maxZ );
 		this.max.set( maxX, maxY, maxZ );
 
 
+		return this;
+
 	},
 	},
 
 
 	setFromPoints: function ( points ) {
 	setFromPoints: function ( points ) {
@@ -121,69 +125,13 @@ Object.assign( Box3.prototype, {
 
 
 	}(),
 	}(),
 
 
-	setFromObject: function () {
-
-		// Computes the world-axis-aligned bounding box of an object (including its children),
-		// accounting for both the object's, and children's, world transforms
-
-		var v1 = new Vector3();
-
-		return function setFromObject( object ) {
-
-			var scope = this;
-
-			object.updateMatrixWorld( true );
-
-			this.makeEmpty();
-
-			object.traverse( function ( node ) {
-
-				var i, l;
-
-				var geometry = node.geometry;
-
-				if ( geometry !== undefined ) {
-
-					if ( geometry.isGeometry ) {
-
-						var vertices = geometry.vertices;
-
-						for ( i = 0, l = vertices.length; i < l; i ++ ) {
-
-							v1.copy( vertices[ i ] );
-							v1.applyMatrix4( node.matrixWorld );
-
-							scope.expandByPoint( v1 );
-
-						}
-
-					} else if ( geometry.isBufferGeometry ) {
-
-						var attribute = geometry.attributes.position;
-
-						if ( attribute !== undefined ) {
-
-							for ( i = 0, l = attribute.count; i < l; i ++ ) {
-
-								v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
+	setFromObject: function ( object ) {
 
 
-								scope.expandByPoint( v1 );
-
-							}
-
-						}
-
-					}
-
-				}
-
-			} );
-
-			return this;
+		this.makeEmpty();
 
 
-		};
+		return this.expandByObject( object );
 
 
-	}(),
+	},
 
 
 	clone: function () {
 	clone: function () {
 
 
@@ -258,6 +206,68 @@ Object.assign( Box3.prototype, {
 
 
 	},
 	},
 
 
+	expandByObject: function () {
+
+		// Computes the world-axis-aligned bounding box of an object (including its children),
+		// accounting for both the object's, and children's, world transforms
+
+		var v1 = new Vector3();
+
+		return function expandByObject( object ) {
+
+			var scope = this;
+
+			object.updateMatrixWorld( true );
+
+			object.traverse( function ( node ) {
+
+				var i, l;
+
+				var geometry = node.geometry;
+
+				if ( geometry !== undefined ) {
+
+					if ( geometry.isGeometry ) {
+
+						var vertices = geometry.vertices;
+
+						for ( i = 0, l = vertices.length; i < l; i ++ ) {
+
+							v1.copy( vertices[ i ] );
+							v1.applyMatrix4( node.matrixWorld );
+
+							scope.expandByPoint( v1 );
+
+						}
+
+					} else if ( geometry.isBufferGeometry ) {
+
+						var attribute = geometry.attributes.position;
+
+						if ( attribute !== undefined ) {
+
+							for ( i = 0, l = attribute.count; i < l; i ++ ) {
+
+								v1.fromBufferAttribute( attribute, i ).applyMatrix4( node.matrixWorld );
+
+								scope.expandByPoint( v1 );
+
+							}
+
+						}
+
+					}
+
+				}
+
+			} );
+
+			return this;
+
+		};
+
+	}(),
+
 	containsPoint: function ( point ) {
 	containsPoint: function ( point ) {
 
 
 		return point.x < this.min.x || point.x > this.max.x ||
 		return point.x < this.min.x || point.x > this.max.x ||

+ 39 - 25
src/renderers/WebGLRenderer.js

@@ -297,25 +297,8 @@ function WebGLRenderer( parameters ) {
 
 
 	//
 	//
 
 
-	var backgroundCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	var backgroundCamera2 = new PerspectiveCamera();
-	var backgroundPlaneMesh = new Mesh(
-		new PlaneBufferGeometry( 2, 2 ),
-		new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
-	);
-	var backgroundBoxShader = ShaderLib[ 'cube' ];
-	var backgroundBoxMesh = new Mesh(
-		new BoxBufferGeometry( 5, 5, 5 ),
-		new ShaderMaterial( {
-			uniforms: backgroundBoxShader.uniforms,
-			vertexShader: backgroundBoxShader.vertexShader,
-			fragmentShader: backgroundBoxShader.fragmentShader,
-			side: BackSide,
-			depthTest: false,
-			depthWrite: false,
-			fog: false
-		} )
-	);
+	var backgroundPlaneCamera, backgroundPlaneMesh;
+	var backgroundBoxCamera, backgroundBoxMesh;
 
 
 	//
 	//
 
 
@@ -1186,25 +1169,56 @@ function WebGLRenderer( parameters ) {
 
 
 		if ( background && background.isCubeTexture ) {
 		if ( background && background.isCubeTexture ) {
 
 
-			backgroundCamera2.projectionMatrix.copy( camera.projectionMatrix );
+			if ( backgroundBoxCamera === undefined ) {
+
+				backgroundBoxCamera = new PerspectiveCamera();
+
+				backgroundBoxMesh = new Mesh(
+					new BoxBufferGeometry( 5, 5, 5 ),
+					new ShaderMaterial( {
+						uniforms: ShaderLib.cube.uniforms,
+						vertexShader: ShaderLib.cube.vertexShader,
+						fragmentShader: ShaderLib.cube.fragmentShader,
+						side: BackSide,
+						depthTest: false,
+						depthWrite: false,
+						fog: false
+					} )
+				);
+
+			}
+
+			backgroundBoxCamera.projectionMatrix.copy( camera.projectionMatrix );
+
+			backgroundBoxCamera.matrixWorld.extractRotation( camera.matrixWorld );
+			backgroundBoxCamera.matrixWorldInverse.getInverse( backgroundBoxCamera.matrixWorld );
 
 
-			backgroundCamera2.matrixWorld.extractRotation( camera.matrixWorld );
-			backgroundCamera2.matrixWorldInverse.getInverse( backgroundCamera2.matrixWorld );
 
 
 			backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
 			backgroundBoxMesh.material.uniforms[ "tCube" ].value = background;
-			backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundCamera2.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
+			backgroundBoxMesh.modelViewMatrix.multiplyMatrices( backgroundBoxCamera.matrixWorldInverse, backgroundBoxMesh.matrixWorld );
 
 
 			objects.update( backgroundBoxMesh );
 			objects.update( backgroundBoxMesh );
 
 
-			_this.renderBufferDirect( backgroundCamera2, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
+			_this.renderBufferDirect( backgroundBoxCamera, null, backgroundBoxMesh.geometry, backgroundBoxMesh.material, backgroundBoxMesh, null );
 
 
 		} else if ( background && background.isTexture ) {
 		} else if ( background && background.isTexture ) {
 
 
+			if ( backgroundPlaneCamera === undefined ) {
+
+				backgroundPlaneCamera = new OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
+
+				backgroundPlaneMesh = new Mesh(
+					new PlaneBufferGeometry( 2, 2 ),
+					new MeshBasicMaterial( { depthTest: false, depthWrite: false, fog: false } )
+				);
+
+			}
+
 			backgroundPlaneMesh.material.map = background;
 			backgroundPlaneMesh.material.map = background;
 
 
 			objects.update( backgroundPlaneMesh );
 			objects.update( backgroundPlaneMesh );
 
 
-			_this.renderBufferDirect( backgroundCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
+			_this.renderBufferDirect( backgroundPlaneCamera, null, backgroundPlaneMesh.geometry, backgroundPlaneMesh.material, backgroundPlaneMesh, null );
 
 
 		}
 		}
 
 

+ 2 - 1
src/renderers/webgl/WebGLIndexedBufferRenderer.js

@@ -27,9 +27,10 @@ function WebGLIndexedBufferRenderer( gl, extensions, infoRender ) {
 			size = 2;
 			size = 2;
 
 
 		} else {
 		} else {
-			
+
 			type = gl.UNSIGNED_BYTE;
 			type = gl.UNSIGNED_BYTE;
 			size = 1;
 			size = 1;
+
 		}
 		}
 
 
 	}
 	}

部分文件因文件數量過多而無法顯示