Browse Source

Merge branch 'dev' of git://github.com/mrdoob/three.js into dev_unflip_pmrem_tiles

WestLangley 5 years ago
parent
commit
35dcce1cfb
100 changed files with 4951 additions and 3524 deletions
  1. 1 1
      .github/ISSUE_TEMPLATE.md
  2. 1 1
      README.md
  3. 1437 1407
      build/three.js
  4. 501 500
      build/three.min.js
  5. 1437 1407
      build/three.module.js
  6. 1 1
      docs/api/en/audio/AudioContext.html
  7. 2 2
      docs/api/en/core/InstancedBufferGeometry.html
  8. 2 0
      docs/api/en/extras/curves/CatmullRomCurve3.html
  9. 1 4
      docs/api/en/math/Matrix4.html
  10. 1 1
      docs/api/zh/audio/AudioContext.html
  11. 2 2
      docs/api/zh/core/InstancedBufferGeometry.html
  12. 2 0
      docs/api/zh/extras/curves/CatmullRomCurve3.html
  13. 0 2
      docs/api/zh/math/Matrix4.html
  14. 1 1
      docs/examples/en/loaders/PDBLoader.html
  15. 1 1
      docs/examples/zh/loaders/PDBLoader.html
  16. 1 1
      docs/manual/en/introduction/Animation-system.html
  17. 1 1
      docs/manual/en/introduction/How-to-use-post-processing.html
  18. 1 1
      docs/manual/en/introduction/Useful-links.html
  19. 1 1
      editor/js/Config.js
  20. 3 1
      editor/sw.js
  21. 2 2
      examples/css3d_molecules.html
  22. 107 0
      examples/files.js
  23. 1 0
      examples/index.html
  24. 0 2
      examples/js/animation/MMDAnimationHelper.js
  25. 2 0
      examples/js/controls/DragControls.js
  26. 11 1
      examples/js/controls/TransformControls.js
  27. 3 0
      examples/js/curves/NURBSUtils.js
  28. 1 0
      examples/js/effects/AsciiEffect.js
  29. 1 0
      examples/js/effects/PeppersGhostEffect.js
  30. 2 2
      examples/js/exporters/ColladaExporter.js
  31. 1 1
      examples/js/exporters/DRACOExporter.js
  32. 1 1
      examples/js/exporters/GLTFExporter.js
  33. 1 0
      examples/js/geometries/TeapotBufferGeometry.js
  34. 1 0
      examples/js/loaders/3MFLoader.js
  35. 1 0
      examples/js/loaders/AMFLoader.js
  36. 19 4
      examples/js/loaders/AssimpLoader.js
  37. 1 0
      examples/js/loaders/BVHLoader.js
  38. 20 7
      examples/js/loaders/ColladaLoader.js
  39. 1 0
      examples/js/loaders/DDSLoader.js
  40. 70 17
      examples/js/loaders/EXRLoader.js
  41. 5 0
      examples/js/loaders/FBXLoader.js
  42. 5 0
      examples/js/loaders/KTXLoader.js
  43. 13 1
      examples/js/loaders/LDrawLoader.js
  44. 1 0
      examples/js/loaders/LWOLoader.js
  45. 18 0
      examples/js/loaders/NRRDLoader.js
  46. 80 21
      examples/js/loaders/OBJLoader.js
  47. 1 0
      examples/js/loaders/PCDLoader.js
  48. 23 16
      examples/js/loaders/PDBLoader.js
  49. 8 0
      examples/js/loaders/RGBELoader.js
  50. 23 2
      examples/js/loaders/SVGLoader.js
  51. 4 0
      examples/js/loaders/TGALoader.js
  52. 638 7
      examples/js/loaders/VRMLLoader.js
  53. 3 0
      examples/js/loaders/VTKLoader.js
  54. 73 0
      examples/js/loaders/XLoader.js
  55. 19 1
      examples/js/math/SimplexNoise.js
  56. 2 0
      examples/js/misc/ConvexObjectBreaker.js
  57. 3 0
      examples/js/misc/GPUComputationRenderer.js
  58. 5 0
      examples/js/misc/Ocean.js
  59. 2 0
      examples/js/misc/Volume.js
  60. 1 0
      examples/js/misc/VolumeSlice.js
  61. 7 0
      examples/js/objects/Fire.js
  62. 10 0
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  63. 1 1
      examples/js/renderers/CSS3DRenderer.js
  64. 4 4
      examples/js/shaders/ACESFilmicToneMappingShader.js
  65. 2 2
      examples/js/utils/BufferGeometryUtils.js
  66. 0 2
      examples/jsm/animation/MMDAnimationHelper.js
  67. 2 0
      examples/jsm/controls/DragControls.js
  68. 11 1
      examples/jsm/controls/TransformControls.js
  69. 2 0
      examples/jsm/csm/CSM.js
  70. 1 0
      examples/jsm/csm/Frustum.js
  71. 3 0
      examples/jsm/curves/NURBSUtils.js
  72. 1 0
      examples/jsm/effects/AsciiEffect.js
  73. 1 0
      examples/jsm/effects/PeppersGhostEffect.js
  74. 2 2
      examples/jsm/exporters/ColladaExporter.js
  75. 1 1
      examples/jsm/exporters/DRACOExporter.js
  76. 1 1
      examples/jsm/exporters/GLTFExporter.js
  77. 1 0
      examples/jsm/geometries/TeapotBufferGeometry.js
  78. 19 0
      examples/jsm/libs/opentype.module.min.js
  79. 15 15
      examples/jsm/libs/stats.module.d.ts
  80. 3 3
      examples/jsm/libs/stats.module.js
  81. 1 2
      examples/jsm/lines/LineMaterial.d.ts
  82. 1 0
      examples/jsm/loaders/3MFLoader.js
  83. 1 0
      examples/jsm/loaders/AMFLoader.js
  84. 19 4
      examples/jsm/loaders/AssimpLoader.js
  85. 1 0
      examples/jsm/loaders/BVHLoader.js
  86. 20 7
      examples/jsm/loaders/ColladaLoader.js
  87. 1 0
      examples/jsm/loaders/DDSLoader.js
  88. 70 17
      examples/jsm/loaders/EXRLoader.js
  89. 5 0
      examples/jsm/loaders/FBXLoader.js
  90. 5 0
      examples/jsm/loaders/KTXLoader.js
  91. 13 1
      examples/jsm/loaders/LDrawLoader.js
  92. 1 0
      examples/jsm/loaders/LWOLoader.js
  93. 18 0
      examples/jsm/loaders/NRRDLoader.js
  94. 82 22
      examples/jsm/loaders/OBJLoader.js
  95. 12 0
      examples/jsm/loaders/OBJLoader2.js
  96. 11 1
      examples/jsm/loaders/OBJLoader2Parallel.js
  97. 1 0
      examples/jsm/loaders/PCDLoader.js
  98. 1 2
      examples/jsm/loaders/PDBLoader.d.ts
  99. 23 16
      examples/jsm/loaders/PDBLoader.js
  100. 8 0
      examples/jsm/loaders/RGBELoader.js

+ 1 - 1
.github/ISSUE_TEMPLATE.md

@@ -17,7 +17,7 @@ Please also include a live example if possible. You can start from these templat
 ##### Three.js version
 ##### Three.js version
 
 
 - [ ] Dev
 - [ ] Dev
-- [ ] r115
+- [ ] r116
 - [ ] ...
 - [ ] ...
 
 
 ##### Browser
 ##### Browser

+ 1 - 1
README.md

@@ -64,7 +64,7 @@ function animate() {
 }
 }
 ```
 ```
 
 
-If everything went well you should see [this](https://jsfiddle.net/8kubjpL5/).
+If everything went well, you should see [this](https://jsfiddle.net/8kubjpL5/).
 
 
 ### Change log ###
 ### Change log ###
 
 

File diff suppressed because it is too large
+ 1437 - 1407
build/three.js


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


File diff suppressed because it is too large
+ 1437 - 1407
build/three.module.js


+ 1 - 1
docs/api/en/audio/AudioContext.html

@@ -29,7 +29,7 @@
 		otherwise set it to a new [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].
 		otherwise set it to a new [link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].
 		</p>
 		</p>
 
 
-		<h3>[method:AudioContext setContext]( [param:AudioConetxt value] )</h3>
+		<h3>[method:AudioContext setContext]( [param:AudioContext value] )</h3>
 		<p>
 		<p>
 		 Set the variable *context* in the outer scope to *value*.
 		 Set the variable *context* in the outer scope to *value*.
 		</p>
 		</p>

+ 2 - 2
docs/api/en/core/InstancedBufferGeometry.html

@@ -24,9 +24,9 @@
 		<h2>Properties</h2>
 		<h2>Properties</h2>
 		<p>See [page:BufferGeometry] for inherited properties.</p>
 		<p>See [page:BufferGeometry] for inherited properties.</p>
 
 
-		<h3>[property:Number maxInstancedCount]</h3>
+		<h3>[property:Number instanceCount]</h3>
 		<p>
 		<p>
-			Default is *undefined*.
+			Default is *Infinity*.
 		</p>
 		</p>
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>

+ 2 - 0
docs/api/en/extras/curves/CatmullRomCurve3.html

@@ -72,6 +72,8 @@
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 		<p>See the base [page:Curve] class for common methods.</p>
 		<p>See the base [page:Curve] class for common methods.</p>
 
 
+		<h2>Source</h2>
+
 		<p>
 		<p>
 			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>

+ 1 - 4
docs/api/en/math/Matrix4.html

@@ -125,10 +125,7 @@ m.elements = [ 11, 21, 31, 41,
 		<h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
 		<h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
 		<p>
 		<p>
 		Sets this matrix to the transformation composed of [page:Vector3 position],
 		Sets this matrix to the transformation composed of [page:Vector3 position],
-		[page:Quaternion quaternion] and [page:Vector3 scale]. Internally this calls
-		[page:.makeRotationFromQuaternion makeRotationFromQuaternion]( [page:Quaternion quaternion] )
-		followed by [page:.scale scale]( [page:Vector3 scale] ), then finally
-		[page:.setPosition setPosition]( [page:Vector3 position] ).
+		[page:Quaternion quaternion] and [page:Vector3 scale].
 		</p>
 		</p>
 
 
 		<h3>[method:this copy]( [param:Matrix4 m] )</h3>
 		<h3>[method:this copy]( [param:Matrix4 m] )</h3>

+ 1 - 1
docs/api/zh/audio/AudioContext.html

@@ -29,7 +29,7 @@
 		否则创建一个新的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].
 		否则创建一个新的[link:https://developer.mozilla.org/en-US/docs/Web/API/AudioContext AudioContext].
 		</p>
 		</p>
 
 
-		<h3>[method:AudioContext setContext]( [param:AudioConetxt value] )</h3>
+		<h3>[method:AudioContext setContext]( [param:AudioContext value] )</h3>
 		<p>
 		<p>
 		 外部用来设置 *context* 的值.
 		 外部用来设置 *context* 的值.
 		</p>
 		</p>

+ 2 - 2
docs/api/zh/core/InstancedBufferGeometry.html

@@ -24,9 +24,9 @@
 		<h2>属性</h2>
 		<h2>属性</h2>
 		<p>继承属性详见 [page:BufferGeometry]。</p>
 		<p>继承属性详见 [page:BufferGeometry]。</p>
 
 
-		<h3>[property:Number maxInstancedCount]</h3>
+		<h3>[property:Number instanceCount]</h3>
 		<p>
 		<p>
-			默认值是 *undefined*。
+			默认值是 *Infinity*。
 		</p>
 		</p>
 
 
 		<h2>方法</h2>
 		<h2>方法</h2>

+ 2 - 0
docs/api/zh/extras/curves/CatmullRomCurve3.html

@@ -73,6 +73,8 @@
 		<h2>方法</h2>
 		<h2>方法</h2>
 		<p>共有方法请参见其基类[page:Curve]。</p>
 		<p>共有方法请参见其基类[page:Curve]。</p>
 
 
+		<h2>源代码</h2>
+
 		<p>
 		<p>
 			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 			[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
 		</p>
 		</p>

+ 0 - 2
docs/api/zh/math/Matrix4.html

@@ -117,8 +117,6 @@ m.elements = [ 11, 21, 31, 41,
 		<h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
 		<h3>[method:this compose]( [param:Vector3 position], [param:Quaternion quaternion], [param:Vector3 scale] )</h3>
 		<p>
 		<p>
 		设置将该对象由位置[page:Vector3 position],四元数[page:Quaternion quaternion] 和 缩放[page:Vector3 scale]
 		设置将该对象由位置[page:Vector3 position],四元数[page:Quaternion quaternion] 和 缩放[page:Vector3 scale]
-		组合变换的矩阵。内部先调用[page:.makeRotationFromQuaternion makeRotationFromQuaternion]( [page:Quaternion quaternion] )
-		再调用缩放[page:.scale scale]( [page:Vector3 scale] )最后是平移[page:.setPosition setPosition]( [page:Vector3 position] )。
 		</p>
 		</p>
 
 
 		<h3>[method:this copy]( [param:Matrix4 m] )</h3>
 		<h3>[method:this copy]( [param:Matrix4 m] )</h3>

+ 1 - 1
docs/examples/en/loaders/PDBLoader.html

@@ -25,7 +25,7 @@
 		// load a PDB resource
 		// load a PDB resource
 		loader.load(
 		loader.load(
 			// resource URL
 			// resource URL
-			'models/molecules/caffeine.pdb',
+			'models/pdb/caffeine.pdb',
 			// called when the resource is loaded
 			// called when the resource is loaded
 			function ( pdb ) {
 			function ( pdb ) {
 
 

+ 1 - 1
docs/examples/zh/loaders/PDBLoader.html

@@ -25,7 +25,7 @@
 		// load a PDB resource
 		// load a PDB resource
 		loader.load(
 		loader.load(
 			// resource URL
 			// resource URL
-			'models/molecules/caffeine.pdb',
+			'models/pdb/caffeine.pdb',
 			// called when the resource is loaded
 			// called when the resource is loaded
 			function ( pdb ) {
 			function ( pdb ) {
 
 

+ 1 - 1
docs/manual/en/introduction/Animation-system.html

@@ -24,7 +24,7 @@
 
 
 			To achieve all this in one homogeneous system, the three.js animation system
 			To achieve all this in one homogeneous system, the three.js animation system
 			[link:https://github.com/mrdoob/three.js/issues/6881 has completely changed in 2015]
 			[link:https://github.com/mrdoob/three.js/issues/6881 has completely changed in 2015]
-			(be aware of outdated information!), and it has now an architecture similar to
+			(beware of outdated information!), and it has now an architecture similar to
 			Unity/Unreal Engine 4. This page gives a short overview of the main components of the
 			Unity/Unreal Engine 4. This page gives a short overview of the main components of the
 			system and how they work together.
 			system and how they work together.
 
 

+ 1 - 1
docs/manual/en/introduction/How-to-use-post-processing.html

@@ -14,7 +14,7 @@
 			Many three.js applications render their 3D objects directly to the screen. Sometimes, however, you want to apply one or more graphical
 			Many three.js applications render their 3D objects directly to the screen. Sometimes, however, you want to apply one or more graphical
 			effects like Depth-Of-Field, Bloom, Film Grain or various types of Anti-aliasing. Post-processing is a widely used approach
 			effects like Depth-Of-Field, Bloom, Film Grain or various types of Anti-aliasing. Post-processing is a widely used approach
 			to implement such effects. First, the scene is rendered to a render target which represents a buffer in the video card's memory.
 			to implement such effects. First, the scene is rendered to a render target which represents a buffer in the video card's memory.
-			In the next step one ore more post-processing passes apply filters and effects to the image buffer before it is eventually rendered to
+			In the next step one or more post-processing passes apply filters and effects to the image buffer before it is eventually rendered to
 			the screen.
 			the screen.
 		</p>
 		</p>
 		<p>
 		<p>

+ 1 - 1
docs/manual/en/introduction/Useful-links.html

@@ -13,7 +13,7 @@
 		<p class="desc">
 		<p class="desc">
 			The following is a collection of links that you might find useful when learning three.js.<br />
 			The following is a collection of links that you might find useful when learning three.js.<br />
 			If you find something that you'd like to add here, or think that one of the links below is no longer
 			If you find something that you'd like to add here, or think that one of the links below is no longer
-			relevant or working, feel free to click the 'edit' button in the top right and make some changes!<br /><br />
+			relevant or working, feel free to click the 'edit' button in the bottom right and make some changes!<br /><br />
 
 
 			Note also that as three.js is under rapid development, a lot of these links will contain information that is
 			Note also that as three.js is under rapid development, a lot of these links will contain information that is
 			out of date - if something isn't working as you'd expect or as one of these links says it should,
 			out of date - if something isn't working as you'd expect or as one of these links says it should,

+ 1 - 1
editor/js/Config.js

@@ -20,7 +20,7 @@ var Config = function () {
 		'project/renderer/shadows': true,
 		'project/renderer/shadows': true,
 		'project/renderer/shadowType': 1, // PCF
 		'project/renderer/shadowType': 1, // PCF
 		'project/renderer/physicallyCorrectLights': false,
 		'project/renderer/physicallyCorrectLights': false,
-		'project/renderer/toneMapping': 0, // linear
+		'project/renderer/toneMapping': 0, // NoToneMapping
 		'project/renderer/toneMappingExposure': 1,
 		'project/renderer/toneMappingExposure': 1,
 		'project/renderer/toneMappingWhitePoint': 1,
 		'project/renderer/toneMappingWhitePoint': 1,
 
 

+ 3 - 1
editor/sw.js

@@ -1,4 +1,4 @@
-// r115.1
+// r116
 
 
 const assets = [
 const assets = [
 	'./',
 	'./',
@@ -47,6 +47,8 @@ const assets = [
 	'../examples/jsm/exporters/PLYExporter.js',
 	'../examples/jsm/exporters/PLYExporter.js',
 	'../examples/jsm/exporters/STLExporter.js',
 	'../examples/jsm/exporters/STLExporter.js',
 
 
+	'../examples/jsm/helpers/VertexNormalsHelper.js',
+
 	'../examples/jsm/geometries/TeapotBufferGeometry.js',
 	'../examples/jsm/geometries/TeapotBufferGeometry.js',
 
 
 	'../examples/js/vr/HelioWebXRPolyfill.js',
 	'../examples/js/vr/HelioWebXRPolyfill.js',

+ 2 - 2
examples/css3d_molecules.html

@@ -140,7 +140,7 @@
 
 
 				baseSprite.onload = function () {
 				baseSprite.onload = function () {
 
 
-					loadMolecule( "models/molecules/caffeine.pdb" );
+					loadMolecule( "models/pdb/caffeine.pdb" );
 					createMenu();
 					createMenu();
 
 
 				};
 				};
@@ -173,7 +173,7 @@
 					button.innerHTML = m;
 					button.innerHTML = m;
 					menu.appendChild( button );
 					menu.appendChild( button );
 
 
-					var url = "models/molecules/" + MOLECULES[ m ];
+					var url = "models/pdb/" + MOLECULES[ m ];
 
 
 					button.addEventListener( 'click', generateButtonCallback( url ), false );
 					button.addEventListener( 'click', generateButtonCallback( url ), false );
 
 

+ 107 - 0
examples/files.js

@@ -298,6 +298,7 @@ var files = {
 		"webgl_custom_attributes_points3",
 		"webgl_custom_attributes_points3",
 		"webgl_fire",
 		"webgl_fire",
 		"webgl_gpgpu_birds",
 		"webgl_gpgpu_birds",
+		"webgl_gpgpu_birds_gltf",
 		"webgl_gpgpu_water",
 		"webgl_gpgpu_water",
 		"webgl_gpgpu_protoplanet",
 		"webgl_gpgpu_protoplanet",
 		"webgl_instancing_modified",
 		"webgl_instancing_modified",
@@ -391,3 +392,109 @@ var files = {
 		"misc_uv_tests"
 		"misc_uv_tests"
 	]
 	]
 };
 };
+
+var tags = {
+	"webgl_animation_cloth": [ "physics", "integration" ],
+	"webgl_clipping": [ "solid" ],
+	"webgl_clipping_advanced": [ "solid" ],
+	"webgl_clipping_intersection": [ "solid" ],
+	"webgl_clipping_stencil": [ "solid" ],
+	"webgl_decals": [ "normals" ],
+	"webgl_depth_texture": [ "renderTarget" ],
+	"webgl_framebuffer_texture": [ "renderTarget" ],
+	"webgl_geometry_colors_lookuptable": [ "vertex" ],
+	"webgl_geometry_hierarchy": [ "group" ],
+	"webgl_geometry_hierarchy2": [ "scene graph" ],
+	"webgl_geometry_minecraft_ao": [ "ambient occlusion" ],
+	"webgl_geometry_nurbs": [ "curve", "surface" ],
+	"webgl_geometry_spline_editor": [ "curve" ],
+	"webgl_geometry_text": [ "font" ],
+	"webgl_geometry_text_shapes": [ "font" ],
+	"webgl_geometry_text_stroke": [ "font" ],
+	"webgl_helpers": [ "normals", "tangents", "bounding box" ],
+	"webgl_instancing_performance": [ "batching", "merging" ],
+	"webgl_interactive_buffergeometry": [ "raycast", "outline" ],
+	"webgl_interactive_cubes": [ "raycast", "highlinght" ],
+	"webgl_interactive_cubes_gpu": [ "raycast", "highlight" ],
+	"webgl_interactive_cubes_ortho": [ "raycast", "highlight" ],
+	"webgl_interactive_lines": [ "raycast" ],
+	"webgl_interactive_points": [ "raycast" ],
+	"webgl_interactive_raycasting_points": [ "raycast" ],
+	"webgl_interactive_voxelpainter": [ "raycast" ],
+	"webgl_layers": [ "groups" ],
+	"webgl_lights_hemisphere": [ "directional" ],
+	"webgl_lights_pointlights": [ "multiple" ],
+	"webgl_loader_ttf": [ "text", "font" ],
+	"webgl_loader_pdb": [ "molecules" ],
+	"webgl_lod": [ "level", "details" ],
+	"webgl_materials_blending": [ "alpha" ],
+	"webgl_materials_blending_custom": [ "alpha" ],
+	"webgl_materials_channels": [ "normal", "depth", "rgba packing" ],
+	"webgl_materials_cubemap_mipmaps": [ "envmap" ],
+	"webgl_materials_envmaps_parallax": [ "onBeforeCompile" ],
+	"webgl_materials_lightmap": [ "shadows" ],
+	"webgl_materials_physical_clearcoat": [ "anisotropy" ],
+	"webgl_materials_physical_transparency": [ "alpha" ],
+	"webgl_materials_shaders_fresnel": [ "refraction" ],
+	"webgl_materials_standard": [ "pbr" ],
+	"webgl_materials_texture_canvas": [ "paint" ],
+	"webgl_materials_texture_filters": [ "mipmap", "min", "mag" ],
+	"webgl_materials_texture_manualmipmap": [ "mipmap", "min", "mag" ],
+	"webgl_materials_subsurface_scattering": [ "derivatives", "translucency" ],
+	"webgl_materials_wireframe": [ "derivatives" ],
+	"webgl_math_obb": [ "intersection", "bounding" ],
+	"webgl_math_orientation_transform": [ "rotation" ],
+	"webgl_mirror": [ "reflection" ],
+	"webgl_morphtargets_horse": [ "animation" ],
+	"webgl_multiple_elements": [ "differential equations", "physics" ],
+	"webgl_multiple_elements_text": [ "font" ],
+	"webgl_nearestneighbour": [ "kdtree" ],
+	"webgl_panorama_cube": [ "envmap" ],
+	"webgl_panorama_dualfisheye": [ "envmap" ],
+	"webgl_panorama_equirectangular": [ "envmap" ],
+	"webgl_points_billboards": [ "particles" ],
+	"webgl_points_dynamic": [ "particles" ],
+	"webgl_points_sprites": [ "particles", "snow" ],
+	"webgl_points_waves": [ "particles" ],
+	"webgl_read_float_buffer": [ "texture" ],
+	"webgl_refraction": [ "water" ],
+	"webgl_rtt": [ "renderTarget", "texture" ],
+	"webgl_shaders_ocean": [ "water" ],
+	"webgl_shaders_ocean2": [ "water" ],
+	"webgl_shaders_sky": [ "sun" ],
+	"webgl_shaders_tonemapping": [ "hrd" ],
+	"webgl_shaders_vector": [ "font" ],
+	"webgl_shading_physical": [ "pbr" ],
+	"webgl_shadow_contact": [ "onBeforeCompile", "soft" ],
+	"webgl_shadowmap_viewer": [ "directional", "spot" ],
+	"webgl_skinning_simple": [ "animation" ],
+	"webgl_tonemapping": [ "gltf" ],
+	"webgl_loader_nodes": [ "caustics", "displace", "xray" ],
+	"webgl_postprocessing_afterimage": [ "trails" ],
+	"webgl_postprocessing_dof": [ "bokeh" ],
+	"webgl_postprocessing_dof2": [ "bokeh" ],
+	"webgl_postprocessing_fxaa": [ "msaa", "multisampled" ],
+	"webgl_postprocessing_godrays": [ "light scattering" ],
+	"webgl_postprocessing_ssaa": [ "msaa", "multisampled" ],
+	"webgl_postprocessing_ssaa_unbiased": [ "msaa", "multisampled" ],
+	"webgl_postprocessing_sao": [ "ambient occlusion" ],
+	"webgl_postprocessing_smaa": [ "msaa", "multisampled" ],
+	"webgl_postprocessing_sobel": [ "filter", "edge detection" ],
+	"webgl_postprocessing_ssao": [ "ambient occlusion" ],
+	"webgl_postprocessing_unreal_bloom": [ "glow" ],
+	"webgl_postprocessing_unreal_bloom_selective": [ "glow" ],
+	"webgl_fire": [ "smoke" ],
+	"webgl_materials_modified": [ "onBeforeCompile" ],
+	"webgl_shadowmap_csm": [ "cascade" ],
+	"webgl_shadowmap_pcss": [ "soft" ],
+	"webgl_simple_gi": [ "global illumination" ],
+	"webgl_tiled_forward": [ "derivatives" ],
+	"webgl2_multisampled_renderbuffers": [ "msaa" ],
+	"physics_ammo_cloth": [ "integration" ],
+	"misc_controls_deviceorientation": [ "accelerometer", "sensors" ],
+	"misc_controls_drag": [ "translate" ],
+	"misc_controls_map": [ "drag" ],
+	"misc_controls_orbit": [ "rotation" ],
+	"misc_controls_trackball": [ "rotation" ],
+	"misc_controls_transform": [ "scale", "rotate", "translate" ]
+};

+ 1 - 0
examples/index.html

@@ -249,6 +249,7 @@
 
 
 			var link = links[ file ];
 			var link = links[ file ];
 			var name = getName( file );
 			var name = getName( file );
+			if ( file in tags ) file += tags[ file ].join( ' ' );
 			var res = file.match( exp );
 			var res = file.match( exp );
 			var text;
 			var text;
 
 

+ 0 - 2
examples/js/animation/MMDAnimationHelper.js

@@ -949,8 +949,6 @@ THREE.MMDAnimationHelper = ( function () {
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 
 
-			this.audio.startTime = this.currentTime - this.delayTime;
-
 			return true;
 			return true;
 
 
 		},
 		},

+ 2 - 0
examples/js/controls/DragControls.js

@@ -44,6 +44,8 @@ THREE.DragControls = function ( _objects, _camera, _domElement ) {
 		_domElement.removeEventListener( 'touchstart', onDocumentTouchStart, false );
 		_domElement.removeEventListener( 'touchstart', onDocumentTouchStart, false );
 		_domElement.removeEventListener( 'touchend', onDocumentTouchEnd, false );
 		_domElement.removeEventListener( 'touchend', onDocumentTouchEnd, false );
 
 
+		_domElement.style.cursor = '';
+
 	}
 	}
 
 
 	function dispose() {
 	function dispose() {

+ 11 - 1
examples/js/controls/TransformControls.js

@@ -56,7 +56,7 @@ THREE.TransformControls = function ( camera, domElement ) {
 
 
 		var allIntersections = raycaster.intersectObject( object, true );
 		var allIntersections = raycaster.intersectObject( object, true );
 
 
-		for ( var i = allIntersections.length; i --; ) {
+		for ( var i = 0; i < allIntersections.length; i ++ ) {
 
 
 			if ( allIntersections[ i ].object.visible || includeInvisible ) {
 			if ( allIntersections[ i ].object.visible || includeInvisible ) {
 
 
@@ -472,11 +472,13 @@ THREE.TransformControls = function ( camera, domElement ) {
 					_tempVector2.x = 1;
 					_tempVector2.x = 1;
 
 
 				}
 				}
+
 				if ( axis.search( 'Y' ) === - 1 ) {
 				if ( axis.search( 'Y' ) === - 1 ) {
 
 
 					_tempVector2.y = 1;
 					_tempVector2.y = 1;
 
 
 				}
 				}
+
 				if ( axis.search( 'Z' ) === - 1 ) {
 				if ( axis.search( 'Z' ) === - 1 ) {
 
 
 					_tempVector2.z = 1;
 					_tempVector2.z = 1;
@@ -1078,11 +1080,13 @@ THREE.TransformControlsGizmo = function () {
 					object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
 					object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
 
 
 				}
 				}
+
 				if ( rotation ) {
 				if ( rotation ) {
 
 
 					object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
 					object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
 
 
 				}
 				}
+
 				if ( scale ) {
 				if ( scale ) {
 
 
 					object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
 					object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
@@ -1333,6 +1337,7 @@ THREE.TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'Y' || handle.name === 'XYZY' ) {
 				if ( handle.name === 'Y' || handle.name === 'XYZY' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
@@ -1343,6 +1348,7 @@ THREE.TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'Z' || handle.name === 'XYZZ' ) {
 				if ( handle.name === 'Z' || handle.name === 'XYZZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
@@ -1353,6 +1359,7 @@ THREE.TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'XY' ) {
 				if ( handle.name === 'XY' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1363,6 +1370,7 @@ THREE.TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'YZ' ) {
 				if ( handle.name === 'YZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1373,6 +1381,7 @@ THREE.TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'XZ' ) {
 				if ( handle.name === 'XZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1623,6 +1632,7 @@ THREE.TransformControlsPlane = function () {
 						break;
 						break;
 
 
 				}
 				}
+
 				break;
 				break;
 			case 'rotate':
 			case 'rotate':
 			default:
 			default:

+ 3 - 0
examples/js/curves/NURBSUtils.js

@@ -209,6 +209,7 @@ THREE.NURBSUtils = {
 				a[ i ] = zeroArr.slice( 0 );
 				a[ i ] = zeroArr.slice( 0 );
 
 
 			}
 			}
+
 			a[ 0 ][ 0 ] = 1.0;
 			a[ 0 ][ 0 ] = 1.0;
 
 
 			for ( var k = 1; k <= n; ++ k ) {
 			for ( var k = 1; k <= n; ++ k ) {
@@ -260,6 +261,7 @@ THREE.NURBSUtils = {
 				ders[ k ][ j ] *= r;
 				ders[ k ][ j ] *= r;
 
 
 			}
 			}
+
 			r *= p - k;
 			r *= p - k;
 
 
 		}
 		}
@@ -300,6 +302,7 @@ THREE.NURBSUtils = {
 			Pw[ i ] = point;
 			Pw[ i ] = point;
 
 
 		}
 		}
+
 		for ( var k = 0; k <= du; ++ k ) {
 		for ( var k = 0; k <= du; ++ k ) {
 
 
 			var point = Pw[ span - p ].clone().multiplyScalar( nders[ k ][ 0 ] );
 			var point = Pw[ span - p ].clone().multiplyScalar( nders[ k ][ 0 ] );

+ 1 - 0
examples/js/effects/AsciiEffect.js

@@ -272,6 +272,7 @@ THREE.AsciiEffect = function ( renderer, charSet, options ) {
 				}
 				}
 
 
 			}
 			}
+
 			strChars += "<br/>";
 			strChars += "<br/>";
 
 
 		}
 		}

+ 1 - 0
examples/js/effects/PeppersGhostEffect.js

@@ -40,6 +40,7 @@ THREE.PeppersGhostEffect = function ( renderer ) {
 			_height = height / 3;
 			_height = height / 3;
 
 
 		}
 		}
+
 		renderer.setSize( width, height );
 		renderer.setSize( width, height );
 
 
 	};
 	};

+ 2 - 2
examples/js/exporters/ColladaExporter.js

@@ -571,8 +571,8 @@ THREE.ColladaExporter.prototype = {
 					matidsArray = new Array( materials.length );
 					matidsArray = new Array( materials.length );
 
 
 				}
 				}
-				matids = matidsArray.fill()
-					.map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );
+
+				matids = matidsArray.fill().map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );
 
 
 				node +=
 				node +=
 					`<instance_geometry url="#${ meshid }">` +
 					`<instance_geometry url="#${ meshid }">` +

+ 1 - 1
examples/js/exporters/DRACOExporter.js

@@ -86,7 +86,7 @@ THREE.DRACOExporter.prototype = {
 
 
 			}
 			}
 
 
-			builder.AddFacesToMesh( mesh, vertices.count / 3, faces );
+			builder.AddFacesToMesh( mesh, vertices.count, faces );
 
 
 		}
 		}
 
 

+ 1 - 1
examples/js/exporters/GLTFExporter.js

@@ -705,7 +705,7 @@ THREE.GLTFExporter.prototype = {
 			if ( attribute.normalized === true ) {
 			if ( attribute.normalized === true ) {
 
 
 				gltfAccessor.normalized = true;
 				gltfAccessor.normalized = true;
-				
+
 			}
 			}
 
 
 			if ( ! outputJSON.accessors ) {
 			if ( ! outputJSON.accessors ) {

+ 1 - 0
examples/js/geometries/TeapotBufferGeometry.js

@@ -682,6 +682,7 @@ THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLi
 						indices[ indexCount ++ ] = v3;
 						indices[ indexCount ++ ] = v3;
 
 
 					}
 					}
+
 					if ( notDegenerate( v1, v3, v4 ) ) {
 					if ( notDegenerate( v1, v3, v4 ) ) {
 
 
 						indices[ indexCount ++ ] = v1;
 						indices[ indexCount ++ ] = v1;

+ 1 - 0
examples/js/loaders/3MFLoader.js

@@ -1068,6 +1068,7 @@ THREE.ThreeMFLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 							meshes.push( newMeshes[ j ] );
 							meshes.push( newMeshes[ j ] );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'texture':
 					case 'texture':

+ 1 - 0
examples/js/loaders/AMFLoader.js

@@ -289,6 +289,7 @@ THREE.AMFLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 					}
 					}
 
 
 				}
 				}
+
 				currVerticesNode = currVerticesNode.nextElementSibling;
 				currVerticesNode = currVerticesNode.nextElementSibling;
 
 
 			}
 			}

+ 19 - 4
examples/js/loaders/AssimpLoader.js

@@ -51,6 +51,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				return n;
 				return n;
 
 
 			};
 			};
+
 			this.lerp = function ( nextKey, time ) {
 			this.lerp = function ( nextKey, time ) {
 
 
 				time -= this.time;
 				time -= this.time;
@@ -94,6 +95,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				this.keys.push( key );
 				this.keys.push( key );
 
 
 			};
 			};
+
 			this.init = function () {
 			this.init = function () {
 
 
 				this.sortKeys();
 				this.sortKeys();
@@ -137,6 +139,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 					this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].targets[ 0 ].data ) );
 					this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].targets[ 0 ].data ) );
 
 
 				}
 				}
+
 				this.init();
 				this.init();
 
 
 			};
 			};
@@ -498,6 +501,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
+
 		function cloneTreeToBones( root, scene ) {
 		function cloneTreeToBones( root, scene ) {
 
 
 			var rootBone = new THREE.Bone();
 			var rootBone = new THREE.Bone();
@@ -655,6 +659,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 					}
 					}
 
 
 				}
 				}
+
 				var skeleton = new THREE.Skeleton( allBones, offsetMatrix );
 				var skeleton = new THREE.Skeleton( allBones, offsetMatrix );
 
 
 				this.threeNode.bind( skeleton, new THREE.Matrix4() );
 				this.threeNode.bind( skeleton, new THREE.Matrix4() );
@@ -957,6 +962,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			};
 			};
 
 
 		}
 		}
+
 		var namePropMapping = {
 		var namePropMapping = {
 
 
 			"?mat.name": "name",
 			"?mat.name": "name",
@@ -1749,6 +1755,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// write faces. There are no floating-point calculations involved
 			// write faces. There are no floating-point calculations involved
 			// in these, so we can write a simple hash over the face data
 			// in these, so we can write a simple hash over the face data
 			// to the dump file. We generate a single 32 Bit hash for 512 faces
 			// to the dump file. We generate a single 32 Bit hash for 512 faces
@@ -1814,6 +1821,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// write bones
 			// write bones
 			if ( mesh.mNumBones ) {
 			if ( mesh.mNumBones ) {
 
 
@@ -1876,7 +1884,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryNodeAnim( stream, nd ) {
 		function ReadBinaryNodeAnim( stream, nd ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -1942,7 +1950,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryAnim( stream, anim ) {
 		function ReadBinaryAnim( stream, anim ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -1996,7 +2004,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryLight( stream, l ) {
 		function ReadBinaryLight( stream, l ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -2026,7 +2034,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryCamera( stream, cam ) {
 		function ReadBinaryCamera( stream, cam ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -2073,6 +2081,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// Read materials
 			// Read materials
 			if ( scene.mNumMaterials ) {
 			if ( scene.mNumMaterials ) {
 
 
@@ -2086,6 +2095,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// Read all animations
 			// Read all animations
 			if ( scene.mNumAnimations ) {
 			if ( scene.mNumAnimations ) {
 
 
@@ -2099,6 +2109,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// Read all textures
 			// Read all textures
 			if ( scene.mNumTextures ) {
 			if ( scene.mNumTextures ) {
 
 
@@ -2112,6 +2123,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// Read lights
 			// Read lights
 			if ( scene.mNumLights ) {
 			if ( scene.mNumLights ) {
 
 
@@ -2125,6 +2137,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 				}
 				}
 
 
 			}
 			}
+
 			// Read cameras
 			// Read cameras
 			if ( scene.mNumCameras ) {
 			if ( scene.mNumCameras ) {
 
 
@@ -2140,6 +2153,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 			}
 			}
 
 
 		}
 		}
+
 		var aiOrigin_CUR = 0;
 		var aiOrigin_CUR = 0;
 		var aiOrigin_BEG = 1;
 		var aiOrigin_BEG = 1;
 
 
@@ -2153,6 +2167,7 @@ THREE.AssimpLoader.prototype = Object.assign( Object.create( THREE.Loader.protot
 					stream.readOffset += off;
 					stream.readOffset += off;
 
 
 				}
 				}
+
 				if ( ori == aiOrigin_BEG ) {
 				if ( ori == aiOrigin_BEG ) {
 
 
 					stream.readOffset = off;
 					stream.readOffset = off;

+ 1 - 0
examples/js/loaders/BVHLoader.js

@@ -382,6 +382,7 @@ THREE.BVHLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 			var line;
 			var line;
 			// skip empty lines
 			// skip empty lines
 			while ( ( line = lines.shift().trim() ).length === 0 ) { }
 			while ( ( line = lines.shift().trim() ).length === 0 ) { }
+
 			return line;
 			return line;
 
 
 		}
 		}

+ 20 - 7
examples/js/loaders/ColladaLoader.js

@@ -217,6 +217,8 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 				channels: {}
 				channels: {}
 			};
 			};
 
 
+			var hasChildren = false;
+
 			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
 			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
 
 
 				var child = xml.childNodes[ i ];
 				var child = xml.childNodes[ i ];
@@ -242,6 +244,12 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 						data.channels[ id ] = parseAnimationChannel( child );
 						data.channels[ id ] = parseAnimationChannel( child );
 						break;
 						break;
 
 
+					case 'animation':
+						// hierarchy of related animations
+						parseAnimation( child );
+						hasChildren = true;
+						break;
+
 					default:
 					default:
 						console.log( child );
 						console.log( child );
 
 
@@ -249,7 +257,13 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 
 
 			}
 			}
 
 
-			library.animations[ xml.getAttribute( 'id' ) ] = data;
+			if ( hasChildren === false ) {
+
+				// since 'id' attributes can be optional, it's necessary to generate a UUID for unqiue assignment
+
+				library.animations[ xml.getAttribute( 'id' ) || THREE.MathUtils.generateUUID() ] = data;
+
+			}
 
 
 		}
 		}
 
 
@@ -2056,6 +2070,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 							data.stride = parseInt( accessor.getAttribute( 'stride' ) );
 							data.stride = parseInt( accessor.getAttribute( 'stride' ) );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 				}
 				}
@@ -2328,6 +2343,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 											}
 											}
 
 
 										}
 										}
+
 										break;
 										break;
 
 
 									case 'NORMAL':
 									case 'NORMAL':
@@ -2356,6 +2372,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 								}
 								}
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'NORMAL':
 						case 'NORMAL':
@@ -3555,12 +3572,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 
 
 			}
 			}
 
 
-			if ( object.name === '' ) {
-
-				object.name = ( type === 'JOINT' ) ? data.sid : data.name;
-
-			}
-
+			object.name = ( type === 'JOINT' ) ? data.sid : data.name;
 			object.matrix.copy( matrix );
 			object.matrix.copy( matrix );
 			object.matrix.decompose( object.position, object.quaternion, object.scale );
 			object.matrix.decompose( object.position, object.quaternion, object.scale );
 
 
@@ -3664,6 +3676,7 @@ THREE.ColladaLoader.prototype = Object.assign( Object.create( THREE.Loader.proto
 							object = new THREE.Mesh( geometry.data, material );
 							object = new THREE.Mesh( geometry.data, material );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 				}
 				}

+ 1 - 0
examples/js/loaders/DDSLoader.js

@@ -96,6 +96,7 @@ THREE.DDSLoader.prototype = Object.assign( Object.create( THREE.CompressedTextur
 				}
 				}
 
 
 			}
 			}
+
 			return byteArray;
 			return byteArray;
 
 
 		}
 		}

+ 70 - 17
examples/js/loaders/EXRLoader.js

@@ -98,6 +98,10 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 		const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
 		const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
 		const HUF_DECMASK = HUF_DECSIZE - 1;
 		const HUF_DECMASK = HUF_DECSIZE - 1;
 
 
+		const NBITS = 16;
+		const A_OFFSET = 1 << ( NBITS - 1 );
+		const MOD_MASK = ( 1 << NBITS ) - 1;
+
 		const SHORT_ZEROCODE_RUN = 59;
 		const SHORT_ZEROCODE_RUN = 59;
 		const LONG_ZEROCODE_RUN = 63;
 		const LONG_ZEROCODE_RUN = 63;
 		const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
 		const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
@@ -132,6 +136,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 				bits = ( ( tmpDataView.getUint32( 0 ) >>> 20 ) & 0x7FF ) - 64;
 				bits = ( ( tmpDataView.getUint32( 0 ) >>> 20 ) & 0x7FF ) - 64;
 
 
 			}
 			}
+
 			var exponent = bits - 1022;
 			var exponent = bits - 1022;
 			var mantissa = ldexp( value, - exponent );
 			var mantissa = ldexp( value, - exponent );
 
 
@@ -471,8 +476,22 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 
 
 		}
 		}
 
 
-		function wav2Decode( buffer, j, nx, ox, ny, oy ) {
+		function wdec16( l, h ) {
+
+			var m = UInt16( l );
+			var d = UInt16( h );
+
+			var bb = ( m - ( d >> 1 ) ) & MOD_MASK;
+			var aa = ( d + bb - A_OFFSET ) & MOD_MASK;
+
+			wdec14Return.a = aa;
+			wdec14Return.b = bb;
+
+		}
+
+		function wav2Decode( buffer, j, nx, ox, ny, oy, mx ) {
 
 
+			var w14 = mx < ( 1 << 14 );
 			var n = ( nx > ny ) ? ny : nx;
 			var n = ( nx > ny ) ? ny : nx;
 			var p = 1;
 			var p = 1;
 			var p2;
 			var p2;
@@ -504,25 +523,52 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 						var p10 = px + oy1;
 						var p10 = px + oy1;
 						var p11 = p10 + ox1;
 						var p11 = p10 + ox1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						if ( w14 ) {
 
 
-						i00 = wdec14Return.a;
-						i10 = wdec14Return.b;
+							wdec14( buffer[ px + j ], buffer[ p10 + j ] );
 
 
-						wdec14( buffer[ p01 + j ], buffer[ p11 + j ] );
+							i00 = wdec14Return.a;
+							i10 = wdec14Return.b;
 
 
-						i01 = wdec14Return.a;
-						i11 = wdec14Return.b;
+							wdec14( buffer[ p01 + j ], buffer[ p11 + j ] );
 
 
-						wdec14( i00, i01 );
+							i01 = wdec14Return.a;
+							i11 = wdec14Return.b;
 
 
-						buffer[ px + j ] = wdec14Return.a;
-						buffer[ p01 + j ] = wdec14Return.b;
+							wdec14( i00, i01 );
+
+							buffer[ px + j ] = wdec14Return.a;
+							buffer[ p01 + j ] = wdec14Return.b;
+
+							wdec14( i10, i11 );
 
 
-						wdec14( i10, i11 );
+							buffer[ p10 + j ] = wdec14Return.a;
+							buffer[ p11 + j ] = wdec14Return.b;
 
 
-						buffer[ p10 + j ] = wdec14Return.a;
-						buffer[ p11 + j ] = wdec14Return.b;
+						} else {
+
+							wdec16( buffer[ px + j ], buffer[ p10 + j ] );
+
+							i00 = wdec14Return.a;
+							i10 = wdec14Return.b;
+
+							wdec16( buffer[ p01 + j ], buffer[ p11 + j ] );
+
+							i01 = wdec14Return.a;
+							i11 = wdec14Return.b;
+
+							wdec16( i00, i01 );
+
+							buffer[ px + j ] = wdec14Return.a;
+							buffer[ p01 + j ] = wdec14Return.b;
+
+							wdec16( i10, i11 );
+
+							buffer[ p10 + j ] = wdec14Return.a;
+							buffer[ p11 + j ] = wdec14Return.b;
+
+
+						}
 
 
 					}
 					}
 
 
@@ -530,7 +576,10 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 
 
 						var p10 = px + oy1;
 						var p10 = px + oy1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						if ( w14 )
+							wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						else
+							wdec16( buffer[ px + j ], buffer[ p10 + j ] );
 
 
 						i00 = wdec14Return.a;
 						i00 = wdec14Return.a;
 						buffer[ p10 + j ] = wdec14Return.b;
 						buffer[ p10 + j ] = wdec14Return.b;
@@ -550,7 +599,10 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 
 
 						var p01 = px + ox1;
 						var p01 = px + ox1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p01 + j ] );
+						if ( w14 )
+							wdec14( buffer[ px + j ], buffer[ p01 + j ] );
+						else
+							wdec16( buffer[ px + j ], buffer[ p01 + j ] );
 
 
 						i00 = wdec14Return.a;
 						i00 = wdec14Return.a;
 						buffer[ p01 + j ] = wdec14Return.b;
 						buffer[ p01 + j ] = wdec14Return.b;
@@ -1293,7 +1345,7 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 
 
 			// Reverse LUT
 			// Reverse LUT
 			var lut = new Uint16Array( USHORT_RANGE );
 			var lut = new Uint16Array( USHORT_RANGE );
-			reverseLutFromBitmap( bitmap, lut );
+			var maxValue = reverseLutFromBitmap( bitmap, lut );
 
 
 			var length = parseUint32( inDataView, inOffset );
 			var length = parseUint32( inDataView, inOffset );
 
 
@@ -1313,7 +1365,8 @@ THREE.EXRLoader.prototype = Object.assign( Object.create( THREE.DataTextureLoade
 						cd.nx,
 						cd.nx,
 						cd.size,
 						cd.size,
 						cd.ny,
 						cd.ny,
-						cd.nx * cd.size
+						cd.nx * cd.size,
+						maxValue
 					);
 					);
 
 
 				}
 				}

+ 5 - 0
examples/js/loaders/FBXLoader.js

@@ -488,6 +488,7 @@ THREE.FBXLoader = ( function () {
 				parameters.bumpScale = materialNode.BumpFactor.value;
 				parameters.bumpScale = materialNode.BumpFactor.value;
 
 
 			}
 			}
+
 			if ( materialNode.Diffuse ) {
 			if ( materialNode.Diffuse ) {
 
 
 				parameters.color = new THREE.Color().fromArray( materialNode.Diffuse.value );
 				parameters.color = new THREE.Color().fromArray( materialNode.Diffuse.value );
@@ -2689,12 +2690,14 @@ THREE.FBXLoader = ( function () {
 				curves.x.values = curves.x.values.map( THREE.MathUtils.degToRad );
 				curves.x.values = curves.x.values.map( THREE.MathUtils.degToRad );
 
 
 			}
 			}
+
 			if ( curves.y !== undefined ) {
 			if ( curves.y !== undefined ) {
 
 
 				this.interpolateRotations( curves.y );
 				this.interpolateRotations( curves.y );
 				curves.y.values = curves.y.values.map( THREE.MathUtils.degToRad );
 				curves.y.values = curves.y.values.map( THREE.MathUtils.degToRad );
 
 
 			}
 			}
+
 			if ( curves.z !== undefined ) {
 			if ( curves.z !== undefined ) {
 
 
 				this.interpolateRotations( curves.z );
 				this.interpolateRotations( curves.z );
@@ -3867,12 +3870,14 @@ THREE.FBXLoader = ( function () {
 
 
 		var versionRegExp = /FBXVersion: (\d+)/;
 		var versionRegExp = /FBXVersion: (\d+)/;
 		var match = text.match( versionRegExp );
 		var match = text.match( versionRegExp );
+
 		if ( match ) {
 		if ( match ) {
 
 
 			var version = parseInt( match[ 1 ] );
 			var version = parseInt( match[ 1 ] );
 			return version;
 			return version;
 
 
 		}
 		}
+
 		throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' );
 		throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' );
 
 
 	}
 	}

+ 5 - 0
examples/js/loaders/KTXLoader.js

@@ -100,24 +100,28 @@ var KhronosTextureContainer = ( function () {
 			this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels );
 			this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels );
 
 
 		}
 		}
+
 		if ( this.pixelHeight === 0 || this.pixelDepth !== 0 ) {
 		if ( this.pixelHeight === 0 || this.pixelDepth !== 0 ) {
 
 
 			console.warn( 'only 2D textures currently supported' );
 			console.warn( 'only 2D textures currently supported' );
 			return;
 			return;
 
 
 		}
 		}
+
 		if ( this.numberOfArrayElements !== 0 ) {
 		if ( this.numberOfArrayElements !== 0 ) {
 
 
 			console.warn( 'texture arrays not currently supported' );
 			console.warn( 'texture arrays not currently supported' );
 			return;
 			return;
 
 
 		}
 		}
+
 		if ( this.numberOfFaces !== facesExpected ) {
 		if ( this.numberOfFaces !== facesExpected ) {
 
 
 			console.warn( 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces );
 			console.warn( 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces );
 			return;
 			return;
 
 
 		}
 		}
+
 		// we now have a completely validated file, so could use existence of loadType as success
 		// we now have a completely validated file, so could use existence of loadType as success
 		// would need to make this more elaborate & adjust checks above to support more than one load type
 		// would need to make this more elaborate & adjust checks above to support more than one load type
 		this.loadType = KhronosTextureContainer.COMPRESSED_2D;
 		this.loadType = KhronosTextureContainer.COMPRESSED_2D;
@@ -150,6 +154,7 @@ var KhronosTextureContainer = ( function () {
 				dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
 				dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
 
 
 			}
 			}
+
 			width = Math.max( 1.0, width * 0.5 );
 			width = Math.max( 1.0, width * 0.5 );
 			height = Math.max( 1.0, height * 0.5 );
 			height = Math.max( 1.0, height * 0.5 );
 
 

+ 13 - 1
examples/js/loaders/LDrawLoader.js

@@ -825,6 +825,7 @@ THREE.LDrawLoader = ( function () {
 							throw 'LDrawLoader: Invalid colour while parsing material' + lineParser.getLineNumberString() + ".";
 							throw 'LDrawLoader: Invalid colour while parsing material' + lineParser.getLineNumberString() + ".";
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case "EDGE":
 					case "EDGE":
@@ -848,6 +849,7 @@ THREE.LDrawLoader = ( function () {
 							edgeMaterial = edgeMaterial.userData.edgeMaterial;
 							edgeMaterial = edgeMaterial.userData.edgeMaterial;
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'ALPHA':
 					case 'ALPHA':
@@ -1084,6 +1086,7 @@ THREE.LDrawLoader = ( function () {
 					colourCode = mainColourCode;
 					colourCode = mainColourCode;
 
 
 				}
 				}
+
 				if ( forEdge && colourCode === '24' ) {
 				if ( forEdge && colourCode === '24' ) {
 
 
 					colourCode = mainEdgeColourCode;
 					colourCode = mainEdgeColourCode;
@@ -1219,6 +1222,7 @@ THREE.LDrawLoader = ( function () {
 										console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() );
 										console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() );
 
 
 									}
 									}
+
 									break;
 									break;
 
 
 								case '!CATEGORY':
 								case '!CATEGORY':
@@ -1244,6 +1248,7 @@ THREE.LDrawLoader = ( function () {
 										} );
 										} );
 
 
 									}
 									}
+
 									break;
 									break;
 
 
 								case 'FILE':
 								case 'FILE':
@@ -1696,8 +1701,8 @@ THREE.LDrawLoader = ( function () {
 				var isRoot = ! parentParseScope.isFromParse;
 				var isRoot = ! parentParseScope.isFromParse;
 				if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
 				if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
 
 
-
 					const objGroup = parseScope.groupObject;
 					const objGroup = parseScope.groupObject;
+
 					if ( parseScope.triangles.length > 0 ) {
 					if ( parseScope.triangles.length > 0 ) {
 
 
 						objGroup.add( createObject( parseScope.triangles, 3 ) );
 						objGroup.add( createObject( parseScope.triangles, 3 ) );
@@ -1741,12 +1746,14 @@ THREE.LDrawLoader = ( function () {
 					for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
 					for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
 
 
 						var ls = lineSegments[ i ];
 						var ls = lineSegments[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							ls.v0.applyMatrix4( parseScope.matrix );
 							ls.v0.applyMatrix4( parseScope.matrix );
 							ls.v1.applyMatrix4( parseScope.matrix );
 							ls.v1.applyMatrix4( parseScope.matrix );
 
 
 						}
 						}
+
 						parentLineSegments.push( ls );
 						parentLineSegments.push( ls );
 
 
 					}
 					}
@@ -1754,6 +1761,7 @@ THREE.LDrawLoader = ( function () {
 					for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) {
 					for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) {
 
 
 						var os = conditionalSegments[ i ];
 						var os = conditionalSegments[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							os.v0.applyMatrix4( parseScope.matrix );
 							os.v0.applyMatrix4( parseScope.matrix );
@@ -1762,6 +1770,7 @@ THREE.LDrawLoader = ( function () {
 							os.c1.applyMatrix4( parseScope.matrix );
 							os.c1.applyMatrix4( parseScope.matrix );
 
 
 						}
 						}
+
 						parentConditionalSegments.push( os );
 						parentConditionalSegments.push( os );
 
 
 					}
 					}
@@ -1769,6 +1778,7 @@ THREE.LDrawLoader = ( function () {
 					for ( var i = 0, l = triangles.length; i < l; i ++ ) {
 					for ( var i = 0, l = triangles.length; i < l; i ++ ) {
 
 
 						var tri = triangles[ i ];
 						var tri = triangles[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix );
 							tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix );
@@ -1780,6 +1790,7 @@ THREE.LDrawLoader = ( function () {
 							tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize();
 							tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize();
 
 
 						}
 						}
+
 						parentTriangles.push( tri );
 						parentTriangles.push( tri );
 
 
 					}
 					}
@@ -1872,6 +1883,7 @@ THREE.LDrawLoader = ( function () {
 							newLocationState = LDrawLoader.FILE_LOCATION_AS_IS;
 							newLocationState = LDrawLoader.FILE_LOCATION_AS_IS;
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case LDrawLoader.FILE_LOCATION_NOT_FOUND:
 					case LDrawLoader.FILE_LOCATION_NOT_FOUND:

+ 1 - 0
examples/js/loaders/LWOLoader.js

@@ -1015,6 +1015,7 @@ IFFParser.prototype = {
 					this.parseClip( length );
 					this.parseClip( length );
 
 
 				}
 				}
+
 				break;
 				break;
 
 
 			case 'STIL':
 			case 'STIL':

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

@@ -169,16 +169,19 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 				}
 				}
 
 
 			}
 			}
+
 			if ( ! headerObject.isNrrd ) {
 			if ( ! headerObject.isNrrd ) {
 
 
 				throw new Error( 'Not an NRRD file' );
 				throw new Error( 'Not an NRRD file' );
 
 
 			}
 			}
+
 			if ( headerObject.encoding === 'bz2' || headerObject.encoding === 'bzip2' ) {
 			if ( headerObject.encoding === 'bz2' || headerObject.encoding === 'bzip2' ) {
 
 
 				throw new Error( 'Bzip is not supported' );
 				throw new Error( 'Bzip is not supported' );
 
 
 			}
 			}
+
 			if ( ! headerObject.vectors ) {
 			if ( ! headerObject.vectors ) {
 
 
 				//if no space direction is set, let's use the identity
 				//if no space direction is set, let's use the identity
@@ -231,6 +234,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 				parsingFunction = parseFloat;
 				parsingFunction = parseFloat;
 
 
 			}
 			}
+
 			for ( var i = start; i < end; i ++ ) {
 			for ( var i = start; i < end; i ++ ) {
 
 
 				value = data[ i ];
 				value = data[ i ];
@@ -247,17 +251,20 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 						resultIndex ++;
 						resultIndex ++;
 
 
 					}
 					}
+
 					number = '';
 					number = '';
 
 
 				}
 				}
 
 
 			}
 			}
+
 			if ( number !== '' ) {
 			if ( number !== '' ) {
 
 
 				result[ resultIndex ] = parsingFunction( number, base );
 				result[ resultIndex ] = parsingFunction( number, base );
 				resultIndex ++;
 				resultIndex ++;
 
 
 			}
 			}
+
 			return result;
 			return result;
 
 
 		}
 		}
@@ -281,6 +288,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 			}
 			}
 
 
 		}
 		}
+
 		// parse the header
 		// parse the header
 		parseHeader( _header );
 		parseHeader( _header );
 
 
@@ -310,6 +318,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 			_data = _copy;
 			_data = _copy;
 
 
 		}
 		}
+
 		// .. let's use the underlying array buffer
 		// .. let's use the underlying array buffer
 		_data = _data.buffer;
 		_data = _data.buffer;
 
 
@@ -392,6 +401,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 			volume.lowerThreshold = min;
 			volume.lowerThreshold = min;
 
 
 		}
 		}
+
 		if ( volume.upperThreshold === Infinity ) {
 		if ( volume.upperThreshold === Infinity ) {
 
 
 			volume.upperThreshold = max;
 			volume.upperThreshold = max;
@@ -410,6 +420,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 			start = 0;
 			start = 0;
 
 
 		}
 		}
+
 		if ( end === undefined ) {
 		if ( end === undefined ) {
 
 
 			end = array.length;
 			end = array.length;
@@ -514,12 +525,14 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 				var _i, _len, _ref, _results;
 				var _i, _len, _ref, _results;
 				_ref = data.split( /\s+/ );
 				_ref = data.split( /\s+/ );
 				_results = [];
 				_results = [];
+
 				for ( _i = 0, _len = _ref.length; _i < _len; _i ++ ) {
 				for ( _i = 0, _len = _ref.length; _i < _len; _i ++ ) {
 
 
 					i = _ref[ _i ];
 					i = _ref[ _i ];
 					_results.push( parseInt( i, 10 ) );
 					_results.push( parseInt( i, 10 ) );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();
@@ -546,6 +559,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 
 
 				var _i, _len, _results;
 				var _i, _len, _results;
 				_results = [];
 				_results = [];
+
 				for ( _i = 0, _len = parts.length; _i < _len; _i ++ ) {
 				for ( _i = 0, _len = parts.length; _i < _len; _i ++ ) {
 
 
 					v = parts[ _i ];
 					v = parts[ _i ];
@@ -554,17 +568,20 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 						var _j, _len2, _ref, _results2;
 						var _j, _len2, _ref, _results2;
 						_ref = v.slice( 1, - 1 ).split( /,/ );
 						_ref = v.slice( 1, - 1 ).split( /,/ );
 						_results2 = [];
 						_results2 = [];
+
 						for ( _j = 0, _len2 = _ref.length; _j < _len2; _j ++ ) {
 						for ( _j = 0, _len2 = _ref.length; _j < _len2; _j ++ ) {
 
 
 							f = _ref[ _j ];
 							f = _ref[ _j ];
 							_results2.push( parseFloat( f ) );
 							_results2.push( parseFloat( f ) );
 
 
 						}
 						}
+
 						return _results2;
 						return _results2;
 
 
 					} )() );
 					} )() );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();
@@ -585,6 +602,7 @@ THREE.NRRDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototyp
 					_results.push( parseFloat( f ) );
 					_results.push( parseFloat( f ) );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();

+ 80 - 21
examples/js/loaders/OBJLoader.js

@@ -13,6 +13,13 @@ THREE.OBJLoader = ( function () {
 	// usemap map_name
 	// usemap map_name
 	var map_use_pattern = /^usemap /;
 	var map_use_pattern = /^usemap /;
 
 
+	var vA = new THREE.Vector3();
+	var vB = new THREE.Vector3();
+	var vC = new THREE.Vector3();
+
+	var ab = new THREE.Vector3();
+	var cb = new THREE.Vector3();
+
 	function ParserState() {
 	function ParserState() {
 
 
 		var state = {
 		var state = {
@@ -55,7 +62,9 @@ THREE.OBJLoader = ( function () {
 						vertices: [],
 						vertices: [],
 						normals: [],
 						normals: [],
 						colors: [],
 						colors: [],
-						uvs: []
+						uvs: [],
+						hasNormalIndices: false,
+						hasUVIndices: false
 					},
 					},
 					materials: [],
 					materials: [],
 					smooth: true,
 					smooth: true,
@@ -248,14 +257,35 @@ THREE.OBJLoader = ( function () {
 
 
 			},
 			},
 
 
+			addFaceNormal: function ( a, b, c ) {
+
+				var src = this.vertices;
+				var dst = this.object.geometry.normals;
+
+				vA.fromArray( src, a );
+				vB.fromArray( src, b );
+				vC.fromArray( src, c );
+
+				cb.subVectors( vC, vB );
+				ab.subVectors( vA, vB );
+				cb.cross( ab );
+
+				cb.normalize();
+
+				dst.push( cb.x, cb.y, cb.z );
+				dst.push( cb.x, cb.y, cb.z );
+				dst.push( cb.x, cb.y, cb.z );
+
+			},
+
 			addColor: function ( a, b, c ) {
 			addColor: function ( a, b, c ) {
 
 
 				var src = this.colors;
 				var src = this.colors;
 				var dst = this.object.geometry.colors;
 				var dst = this.object.geometry.colors;
 
 
-				dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
-				dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
-				dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
+				if ( src[ a ] !== undefined ) dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
+				if ( src[ b ] !== undefined ) dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
+				if ( src[ c ] !== undefined ) dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
 
 
 			},
 			},
 
 
@@ -270,6 +300,16 @@ THREE.OBJLoader = ( function () {
 
 
 			},
 			},
 
 
+			addDefaultUV: function () {
+
+				var dst = this.object.geometry.uvs;
+
+				dst.push( 0, 0 );
+				dst.push( 0, 0 );
+				dst.push( 0, 0 );
+
+			},
+
 			addUVLine: function ( a ) {
 			addUVLine: function ( a ) {
 
 
 				var src = this.uvs;
 				var src = this.uvs;
@@ -288,33 +328,47 @@ THREE.OBJLoader = ( function () {
 				var ic = this.parseVertexIndex( c, vLen );
 				var ic = this.parseVertexIndex( c, vLen );
 
 
 				this.addVertex( ia, ib, ic );
 				this.addVertex( ia, ib, ic );
+				this.addColor( ia, ib, ic );
+
+				// normals
+
+				if ( na !== undefined && na !== '' ) {
 
 
-				if ( this.colors.length > 0 ) {
+					var nLen = this.normals.length;
 
 
-					this.addColor( ia, ib, ic );
+					ia = this.parseNormalIndex( na, nLen );
+					ib = this.parseNormalIndex( nb, nLen );
+					ic = this.parseNormalIndex( nc, nLen );
+
+					this.addNormal( ia, ib, ic );
+
+					this.object.geometry.hasNormalIndices = true;
+
+				} else {
+
+					this.addFaceNormal( ia, ib, ic );
 
 
 				}
 				}
 
 
+				// uvs
+
 				if ( ua !== undefined && ua !== '' ) {
 				if ( ua !== undefined && ua !== '' ) {
 
 
 					var uvLen = this.uvs.length;
 					var uvLen = this.uvs.length;
+
 					ia = this.parseUVIndex( ua, uvLen );
 					ia = this.parseUVIndex( ua, uvLen );
 					ib = this.parseUVIndex( ub, uvLen );
 					ib = this.parseUVIndex( ub, uvLen );
 					ic = this.parseUVIndex( uc, uvLen );
 					ic = this.parseUVIndex( uc, uvLen );
-					this.addUV( ia, ib, ic );
 
 
-				}
+					this.addUV( ia, ib, ic );
 
 
-				if ( na !== undefined && na !== '' ) {
+					this.object.geometry.hasUVIndices = true;
 
 
-					// Normals are many times the same. If so, skip function call and parseInt.
-					var nLen = this.normals.length;
-					ia = this.parseNormalIndex( na, nLen );
+				} else {
 
 
-					ib = na === nb ? ia : this.parseNormalIndex( nb, nLen );
-					ic = na === nc ? ia : this.parseNormalIndex( nc, nLen );
+					// add placeholder values (for inconsistent face definitions)
 
 
-					this.addNormal( ia, ib, ic );
+					this.addDefaultUV();
 
 
 				}
 				}
 
 
@@ -461,7 +515,14 @@ THREE.OBJLoader = ( function () {
 
 
 								);
 								);
 
 
+							} else {
+
+								// if no colors are defined, add placeholders so color and vertex indices match
+
+								state.colors.push( undefined, undefined, undefined );
+
 							}
 							}
+
 							break;
 							break;
 						case 'vn':
 						case 'vn':
 							state.normals.push(
 							state.normals.push(
@@ -538,6 +599,7 @@ THREE.OBJLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					state.addLineGeometry( lineVertices, lineUVs );
 					state.addLineGeometry( lineVertices, lineUVs );
 
 
 				} else if ( lineFirstChar === 'p' ) {
 				} else if ( lineFirstChar === 'p' ) {
@@ -613,6 +675,7 @@ THREE.OBJLoader = ( function () {
 						state.object.smooth = true;
 						state.object.smooth = true;
 
 
 					}
 					}
+
 					var material = state.object.currentMaterial();
 					var material = state.object.currentMaterial();
 					if ( material ) material.smooth = state.object.smooth;
 					if ( material ) material.smooth = state.object.smooth;
 
 
@@ -648,14 +711,10 @@ THREE.OBJLoader = ( function () {
 
 
 				buffergeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( geometry.vertices, 3 ) );
 				buffergeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( geometry.vertices, 3 ) );
 
 
-				if ( geometry.normals.length > 0 ) {
+				if ( geometry.hasNormalIndices === true ) {
 
 
 					buffergeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
 					buffergeometry.setAttribute( 'normal', new THREE.Float32BufferAttribute( geometry.normals, 3 ) );
 
 
-				} else {
-
-					buffergeometry.computeVertexNormals();
-
 				}
 				}
 
 
 				if ( geometry.colors.length > 0 ) {
 				if ( geometry.colors.length > 0 ) {
@@ -665,7 +724,7 @@ THREE.OBJLoader = ( function () {
 
 
 				}
 				}
 
 
-				if ( geometry.uvs.length > 0 ) {
+				if ( geometry.hasUVIndices === true ) {
 
 
 					buffergeometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( geometry.uvs, 2 ) );
 					buffergeometry.setAttribute( 'uv', new THREE.Float32BufferAttribute( geometry.uvs, 2 ) );
 
 

+ 1 - 0
examples/js/loaders/PCDLoader.js

@@ -87,6 +87,7 @@ THREE.PCDLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' );
 						if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' );
 
 
 					}
 					}
+
 					ref -= inData[ inPtr ++ ];
 					ref -= inData[ inPtr ++ ];
 					if ( outPtr + len + 2 > outLength ) throw new Error( 'Output buffer is not large enough' );
 					if ( outPtr + len + 2 > outLength ) throw new Error( 'Output buffer is not large enough' );
 					if ( ref < 0 ) throw new Error( 'Invalid compressed data' );
 					if ( ref < 0 ) throw new Error( 'Invalid compressed data' );

File diff suppressed because it is too large
+ 23 - 16
examples/js/loaders/PDBLoader.js


+ 8 - 0
examples/js/loaders/RGBELoader.js

@@ -45,6 +45,7 @@ THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoad
 					case rgbe_memory_error: console.error( "THREE.RGBELoader: Error: " + ( msg || '' ) );
 					case rgbe_memory_error: console.error( "THREE.RGBELoader: Error: " + ( msg || '' ) );
 
 
 				}
 				}
+
 				return RGBE_RETURN_FAILURE;
 				return RGBE_RETURN_FAILURE;
 
 
 			},
 			},
@@ -91,6 +92,7 @@ THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoad
 					return s + chunk.slice( 0, i );
 					return s + chunk.slice( 0, i );
 
 
 				}
 				}
+
 				return false;
 				return false;
 
 
 			},
 			},
@@ -133,12 +135,14 @@ THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoad
 					return rgbe_error( rgbe_read_error, "no header found" );
 					return rgbe_error( rgbe_read_error, "no header found" );
 
 
 				}
 				}
+
 				/* if you want to require the magic token then uncomment the next line */
 				/* if you want to require the magic token then uncomment the next line */
 				if ( ! ( match = line.match( magic_token_re ) ) ) {
 				if ( ! ( match = line.match( magic_token_re ) ) ) {
 
 
 					return rgbe_error( rgbe_format_error, "bad initial token" );
 					return rgbe_error( rgbe_format_error, "bad initial token" );
 
 
 				}
 				}
+
 				header.valid |= RGBE_VALID_PROGRAMTYPE;
 				header.valid |= RGBE_VALID_PROGRAMTYPE;
 				header.programtype = match[ 1 ];
 				header.programtype = match[ 1 ];
 				header.string += line + "\n";
 				header.string += line + "\n";
@@ -161,17 +165,20 @@ THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoad
 						header.gamma = parseFloat( match[ 1 ], 10 );
 						header.gamma = parseFloat( match[ 1 ], 10 );
 
 
 					}
 					}
+
 					if ( match = line.match( exposure_re ) ) {
 					if ( match = line.match( exposure_re ) ) {
 
 
 						header.exposure = parseFloat( match[ 1 ], 10 );
 						header.exposure = parseFloat( match[ 1 ], 10 );
 
 
 					}
 					}
+
 					if ( match = line.match( format_re ) ) {
 					if ( match = line.match( format_re ) ) {
 
 
 						header.valid |= RGBE_VALID_FORMAT;
 						header.valid |= RGBE_VALID_FORMAT;
 						header.format = match[ 1 ];//'32-bit_rle_rgbe';
 						header.format = match[ 1 ];//'32-bit_rle_rgbe';
 
 
 					}
 					}
+
 					if ( match = line.match( dimensions_re ) ) {
 					if ( match = line.match( dimensions_re ) ) {
 
 
 						header.valid |= RGBE_VALID_DIMENSIONS;
 						header.valid |= RGBE_VALID_DIMENSIONS;
@@ -189,6 +196,7 @@ THREE.RGBELoader.prototype = Object.assign( Object.create( THREE.DataTextureLoad
 					return rgbe_error( rgbe_format_error, "missing format specifier" );
 					return rgbe_error( rgbe_format_error, "missing format specifier" );
 
 
 				}
 				}
+
 				if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
 				if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
 
 
 					return rgbe_error( rgbe_format_error, "missing image size specifier" );
 					return rgbe_error( rgbe_format_error, "missing image size specifier" );

+ 23 - 2
examples/js/loaders/SVGLoader.js

@@ -196,6 +196,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'H':
 					case 'H':
@@ -211,6 +212,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'V':
 					case 'V':
@@ -226,6 +228,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'L':
 					case 'L':
@@ -242,6 +245,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'C':
 					case 'C':
@@ -265,6 +269,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'S':
 					case 'S':
@@ -288,6 +293,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'Q':
 					case 'Q':
@@ -309,6 +315,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'T':
 					case 'T':
@@ -332,6 +339,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'A':
 					case 'A':
@@ -351,6 +359,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'm':
 					case 'm':
@@ -376,6 +385,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'h':
 					case 'h':
@@ -391,6 +401,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'v':
 					case 'v':
@@ -406,6 +417,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'l':
 					case 'l':
@@ -422,6 +434,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'c':
 					case 'c':
@@ -445,6 +458,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 's':
 					case 's':
@@ -468,6 +482,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'q':
 					case 'q':
@@ -489,6 +504,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 't':
 					case 't':
@@ -512,6 +528,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'a':
 					case 'a':
@@ -531,6 +548,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 							if ( j === 0 && doSetFirstPoint === true ) firstPoint.copy( point );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'Z':
 					case 'Z':
@@ -545,6 +563,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 							isFirstPoint = true;
 							isFirstPoint = true;
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					default:
 					default:
@@ -564,7 +583,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 
 
 		function parseCSSStylesheet( node ) {
 		function parseCSSStylesheet( node ) {
 
 
-			if ( !node.sheet || !node.sheet.cssRules || !node.sheet.cssRules.length ) return;
+			if ( ! node.sheet || ! node.sheet.cssRules || ! node.sheet.cssRules.length ) return;
 
 
 			for ( var i = 0; i < node.sheet.cssRules.length; i ++ ) {
 			for ( var i = 0; i < node.sheet.cssRules.length; i ++ ) {
 
 
@@ -585,7 +604,7 @@ THREE.SVGLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 					);
 					);
 
 
 				}
 				}
-				
+
 			}
 			}
 
 
 		}
 		}
@@ -1494,6 +1513,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () {
 					joinIsOnLeftSide = false;
 					joinIsOnLeftSide = false;
 
 
 				}
 				}
+
 				if ( iPoint === 1 ) initialJoinIsOnLeftSide = joinIsOnLeftSide;
 				if ( iPoint === 1 ) initialJoinIsOnLeftSide = joinIsOnLeftSide;
 
 
 				tempV2_3.subVectors( nextPoint, currentPoint );
 				tempV2_3.subVectors( nextPoint, currentPoint );
@@ -1521,6 +1541,7 @@ THREE.SVGLoader.pointsToStrokeWithBuffers = function () {
 						innerSideModified = true;
 						innerSideModified = true;
 
 
 					}
 					}
+
 					outerPoint.copy( tempV2_5 ).add( currentPoint );
 					outerPoint.copy( tempV2_5 ).add( currentPoint );
 					innerPoint.add( currentPoint );
 					innerPoint.add( currentPoint );
 
 

+ 4 - 0
examples/js/loaders/TGALoader.js

@@ -58,6 +58,7 @@ THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						console.error( 'THREE.TGALoader: Invalid type colormap data for indexed type.' );
 						console.error( 'THREE.TGALoader: Invalid type colormap data for indexed type.' );
 
 
 					}
 					}
+
 					break;
 					break;
 
 
 					// check colormap type
 					// check colormap type
@@ -71,6 +72,7 @@ THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						console.error( 'THREE.TGALoader: Invalid type colormap data for colormap type.' );
 						console.error( 'THREE.TGALoader: Invalid type colormap data for colormap type.' );
 
 
 					}
 					}
+
 					break;
 					break;
 
 
 					// What the need of a file without data ?
 					// What the need of a file without data ?
@@ -166,11 +168,13 @@ THREE.TGALoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						// raw pixels
 						// raw pixels
 
 
 						count *= pixel_size;
 						count *= pixel_size;
+
 						for ( i = 0; i < count; ++ i ) {
 						for ( i = 0; i < count; ++ i ) {
 
 
 							pixel_data[ shift + i ] = data[ offset ++ ];
 							pixel_data[ shift + i ] = data[ offset ++ ];
 
 
 						}
 						}
+
 						shift += count;
 						shift += count;
 
 
 					}
 					}

+ 638 - 7
examples/js/loaders/VRMLLoader.js

@@ -329,13 +329,13 @@ THREE.VRMLLoader = ( function () {
 
 
 					def: function ( ctx ) {
 					def: function ( ctx ) {
 
 
-						return ctx.Identifier[ 0 ].image;
+						return ( ctx.Identifier || ctx.NodeName )[ 0 ].image;
 
 
 					},
 					},
 
 
 					use: function ( ctx ) {
 					use: function ( ctx ) {
 
 
-						return { USE: ctx.Identifier[ 0 ].image };
+						return { USE: ( ctx.Identifier || ctx.NodeName )[ 0 ].image };
 
 
 					},
 					},
 
 
@@ -515,6 +515,8 @@ THREE.VRMLLoader = ( function () {
 
 
 					if ( object instanceof THREE.Object3D ) scene.add( object );
 					if ( object instanceof THREE.Object3D ) scene.add( object );
 
 
+					if ( node.name === 'WorldInfo' ) scene.userData.worldInfo = object;
+
 				}
 				}
 
 
 				return scene;
 				return scene;
@@ -641,6 +643,14 @@ THREE.VRMLLoader = ( function () {
 						build = buildSphereNode( node );
 						build = buildSphereNode( node );
 						break;
 						break;
 
 
+					case 'ElevationGrid':
+						build = buildElevationGridNode( node );
+						break;
+
+					case 'Extrusion':
+						build = buildExtrusionNode( node );
+						break;
+
 					case 'Color':
 					case 'Color':
 					case 'Coordinate':
 					case 'Coordinate':
 					case 'Normal':
 					case 'Normal':
@@ -648,6 +658,10 @@ THREE.VRMLLoader = ( function () {
 						build = buildGeometricNode( node );
 						build = buildGeometricNode( node );
 						break;
 						break;
 
 
+					case 'WorldInfo':
+						build = buildWorldInfoNode( node );
+						break;
+
 					case 'Anchor':
 					case 'Anchor':
 					case 'Billboard':
 					case 'Billboard':
 					case 'Collision':
 					case 'Collision':
@@ -662,7 +676,6 @@ THREE.VRMLLoader = ( function () {
 					case 'Script':
 					case 'Script':
 					case 'Sound':
 					case 'Sound':
 					case 'SpotLight':
 					case 'SpotLight':
-					case 'WorldInfo':
 
 
 					case 'CylinderSensor':
 					case 'CylinderSensor':
 					case 'PlaneSensor':
 					case 'PlaneSensor':
@@ -672,8 +685,6 @@ THREE.VRMLLoader = ( function () {
 					case 'TouchSensor':
 					case 'TouchSensor':
 					case 'VisibilitySensor':
 					case 'VisibilitySensor':
 
 
-					case 'ElevationGrid':
-					case 'Extrusion':
 					case 'Text':
 					case 'Text':
 
 
 					case 'FontStyle':
 					case 'FontStyle':
@@ -903,6 +914,7 @@ THREE.VRMLLoader = ( function () {
 								material = getNode( fieldValues[ 0 ] );
 								material = getNode( fieldValues[ 0 ] );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'geometry':
 						case 'geometry':
@@ -911,6 +923,7 @@ THREE.VRMLLoader = ( function () {
 								geometry = getNode( fieldValues[ 0 ] );
 								geometry = getNode( fieldValues[ 0 ] );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						default:
 						default:
@@ -1043,6 +1056,7 @@ THREE.VRMLLoader = ( function () {
 								material = new THREE.MeshBasicMaterial( { color: 0x000000 } );
 								material = new THREE.MeshBasicMaterial( { color: 0x000000 } );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'texture':
 						case 'texture':
@@ -1060,6 +1074,7 @@ THREE.VRMLLoader = ( function () {
 								}
 								}
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'textureTransform':
 						case 'textureTransform':
@@ -1068,6 +1083,7 @@ THREE.VRMLLoader = ( function () {
 								transformData = getNode( fieldValues[ 0 ] );
 								transformData = getNode( fieldValues[ 0 ] );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						default:
 						default:
@@ -1434,6 +1450,40 @@ THREE.VRMLLoader = ( function () {
 
 
 			}
 			}
 
 
+			function buildWorldInfoNode( node ) {
+
+				var worldInfo = {};
+
+				var fields = node.fields;
+
+				for ( var i = 0, l = fields.length; i < l; i ++ ) {
+
+					var field = fields[ i ];
+					var fieldName = field.name;
+					var fieldValues = field.values;
+
+					switch ( fieldName ) {
+
+						case 'title':
+							worldInfo.title = fieldValues[ 0 ];
+							break;
+
+						case 'info':
+							worldInfo.info = fieldValues;
+							break;
+
+						default:
+							console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
+							break;
+
+					}
+
+				}
+
+				return worldInfo;
+
+			}
+
 			function buildIndexedFaceSetNode( node ) {
 			function buildIndexedFaceSetNode( node ) {
 
 
 				var color, coord, normal, texCoord;
 				var color, coord, normal, texCoord;
@@ -1459,6 +1509,7 @@ THREE.VRMLLoader = ( function () {
 								color = getNode( colorNode );
 								color = getNode( colorNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'coord':
 						case 'coord':
@@ -1469,6 +1520,7 @@ THREE.VRMLLoader = ( function () {
 								coord = getNode( coordNode );
 								coord = getNode( coordNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'normal':
 						case 'normal':
@@ -1479,6 +1531,7 @@ THREE.VRMLLoader = ( function () {
 								normal = getNode( normalNode );
 								normal = getNode( normalNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'texCoord':
 						case 'texCoord':
@@ -1489,6 +1542,7 @@ THREE.VRMLLoader = ( function () {
 								texCoord = getNode( texCoordNode );
 								texCoord = getNode( texCoordNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'ccw':
 						case 'ccw':
@@ -1715,6 +1769,7 @@ THREE.VRMLLoader = ( function () {
 								color = getNode( colorNode );
 								color = getNode( colorNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'coord':
 						case 'coord':
@@ -1725,6 +1780,7 @@ THREE.VRMLLoader = ( function () {
 								coord = getNode( coordNode );
 								coord = getNode( coordNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'colorIndex':
 						case 'colorIndex':
@@ -1834,6 +1890,7 @@ THREE.VRMLLoader = ( function () {
 								color = getNode( colorNode );
 								color = getNode( colorNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'coord':
 						case 'coord':
@@ -1844,6 +1901,7 @@ THREE.VRMLLoader = ( function () {
 								coord = getNode( coordNode );
 								coord = getNode( coordNode );
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 
 
@@ -2024,6 +2082,557 @@ THREE.VRMLLoader = ( function () {
 
 
 			}
 			}
 
 
+			function buildElevationGridNode( node ) {
+
+				var color;
+				var normal;
+				var texCoord;
+				var height;
+
+				var colorPerVertex = true;
+				var normalPerVertex = true;
+				var solid = true;
+				var ccw = true;
+				var creaseAngle = 0;
+				var xDimension = 2;
+				var zDimension = 2;
+				var xSpacing = 1;
+				var zSpacing = 1;
+
+				var fields = node.fields;
+
+				for ( var i = 0, l = fields.length; i < l; i ++ ) {
+
+					var field = fields[ i ];
+					var fieldName = field.name;
+					var fieldValues = field.values;
+
+					switch ( fieldName ) {
+
+						case 'color':
+							var colorNode = fieldValues[ 0 ];
+
+							if ( colorNode !== null ) {
+
+								color = getNode( colorNode );
+
+							}
+
+							break;
+
+						case 'normal':
+							var normalNode = fieldValues[ 0 ];
+
+							if ( normalNode !== null ) {
+
+								normal = getNode( normalNode );
+
+							}
+
+							break;
+
+						case 'texCoord':
+							var texCoordNode = fieldValues[ 0 ];
+
+							if ( texCoordNode !== null ) {
+
+								texCoord = getNode( texCoordNode );
+
+							}
+
+							break;
+
+						case 'height':
+							height = fieldValues;
+							break;
+
+						case 'ccw':
+							ccw = fieldValues[ 0 ];
+							break;
+
+						case 'colorPerVertex':
+							colorPerVertex = fieldValues[ 0 ];
+							break;
+
+						case 'creaseAngle':
+							creaseAngle = fieldValues[ 0 ];
+							break;
+
+						case 'normalPerVertex':
+							normalPerVertex = fieldValues[ 0 ];
+							break;
+
+						case 'solid':
+							solid = fieldValues[ 0 ];
+							break;
+
+						case 'xDimension':
+							xDimension = fieldValues[ 0 ];
+							break;
+
+						case 'xSpacing':
+							xSpacing = fieldValues[ 0 ];
+							break;
+
+						case 'zDimension':
+							zDimension = fieldValues[ 0 ];
+							break;
+
+						case 'zSpacing':
+							zSpacing = fieldValues[ 0 ];
+							break;
+
+						default:
+							console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
+							break;
+
+					}
+
+				}
+
+				// vertex data
+
+				var vertices = [];
+				var normals = [];
+				var colors = [];
+				var uvs = [];
+
+				for ( var i = 0; i < zDimension; i ++ ) {
+
+					for ( var j = 0; j < xDimension; j ++ ) {
+
+						// compute a row major index
+
+						var index = ( i * xDimension ) + j;
+
+						// vertices
+
+						var x = xSpacing * i;
+						var y = height[ index ];
+						var z = zSpacing * j;
+
+						vertices.push( x, y, z );
+
+						// colors
+
+						if ( color && colorPerVertex === true ) {
+
+							var r = color[ index * 3 + 0 ];
+							var g = color[ index * 3 + 1 ];
+							var b = color[ index * 3 + 2 ];
+
+							colors.push( r, g, b );
+
+						}
+
+						// normals
+
+						if ( normal && normalPerVertex === true ) {
+
+							var xn = normal[ index * 3 + 0 ];
+							var yn = normal[ index * 3 + 1 ];
+							var zn = normal[ index * 3 + 2 ];
+
+							normals.push( xn, yn, zn );
+
+						}
+
+						// uvs
+
+						if ( texCoord ) {
+
+							var s = texCoord[ index * 2 + 0 ];
+							var t = texCoord[ index * 2 + 1 ];
+
+							uvs.push( s, t );
+
+
+						} else {
+
+							uvs.push( i / ( xDimension - 1 ), j / ( zDimension - 1 ) );
+
+						}
+
+					}
+
+				}
+
+				// indices
+
+				var indices = [];
+
+				for ( var i = 0; i < xDimension - 1; i ++ ) {
+
+					for ( var j = 0; j < zDimension - 1; j ++ ) {
+
+						// from https://tecfa.unige.ch/guides/vrml/vrml97/spec/part1/nodesRef.html#ElevationGrid
+
+						var a = i + j * xDimension;
+						var b = i + ( j + 1 ) * xDimension;
+						var c = ( i + 1 ) + ( j + 1 ) * xDimension;
+						var d = ( i + 1 ) + j * xDimension;
+
+						// faces
+
+						if ( ccw === true ) {
+
+							indices.push( a, c, b );
+							indices.push( c, a, d );
+
+						} else {
+
+							indices.push( a, b, c );
+							indices.push( c, d, a );
+
+						}
+
+					}
+
+				}
+
+				//
+
+				var positionAttribute = toNonIndexedAttribute( indices, new THREE.Float32BufferAttribute( vertices, 3 ) );
+				var uvAttribute = toNonIndexedAttribute( indices, new THREE.Float32BufferAttribute( uvs, 2 ) );
+				var colorAttribute;
+				var normalAttribute;
+
+				// color attribute
+
+				if ( color ) {
+
+					if ( colorPerVertex === false ) {
+
+						for ( var i = 0; i < xDimension - 1; i ++ ) {
+
+							for ( var j = 0; j < zDimension - 1; j ++ ) {
+
+								var index = i + j * ( xDimension - 1 );
+
+								var r = color[ index * 3 + 0 ];
+								var g = color[ index * 3 + 1 ];
+								var b = color[ index * 3 + 2 ];
+
+								// one color per quad
+
+								colors.push( r, g, b ); colors.push( r, g, b ); colors.push( r, g, b );
+								colors.push( r, g, b ); colors.push( r, g, b ); colors.push( r, g, b );
+
+							}
+
+						}
+
+						colorAttribute = new THREE.Float32BufferAttribute( colors, 3 );
+
+					} else {
+
+						colorAttribute = toNonIndexedAttribute( indices, new THREE.Float32BufferAttribute( colors, 3 ) );
+
+					}
+
+				}
+
+				// normal attribute
+
+				if ( normal ) {
+
+					if ( normalPerVertex === false ) {
+
+						for ( var i = 0; i < xDimension - 1; i ++ ) {
+
+							for ( var j = 0; j < zDimension - 1; j ++ ) {
+
+								var index = i + j * ( xDimension - 1 );
+
+								var xn = normal[ index * 3 + 0 ];
+								var yn = normal[ index * 3 + 1 ];
+								var zn = normal[ index * 3 + 2 ];
+
+								// one normal per quad
+
+								normals.push( xn, yn, zn ); normals.push( xn, yn, zn ); normals.push( xn, yn, zn );
+								normals.push( xn, yn, zn ); normals.push( xn, yn, zn ); normals.push( xn, yn, zn );
+
+							}
+
+						}
+
+						normalAttribute = new THREE.Float32BufferAttribute( normals, 3 );
+
+					} else {
+
+						normalAttribute = toNonIndexedAttribute( indices, new THREE.Float32BufferAttribute( normals, 3 ) );
+
+					}
+
+				} else {
+
+					normalAttribute = computeNormalAttribute( indices, vertices, creaseAngle );
+
+				}
+
+				// build geometry
+
+				var geometry = new THREE.BufferGeometry();
+				geometry.setAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'normal', normalAttribute );
+				geometry.setAttribute( 'uv', uvAttribute );
+
+				if ( colorAttribute ) geometry.setAttribute( 'color', colorAttribute );
+
+				// "solid" influences the material so let's store it for later use
+
+				geometry._solid = solid;
+				geometry._type = 'mesh';
+
+				return geometry;
+
+			}
+
+			function buildExtrusionNode( node ) {
+
+				var crossSection = [ 1, 1, 1, - 1, - 1, - 1, - 1, 1, 1, 1 ];
+				var spine = [ 0, 0, 0, 0, 1, 0 ];
+				var scale;
+				var orientation;
+
+				var beginCap = true;
+				var ccw = true;
+				var creaseAngle = 0;
+				var endCap = true;
+				var solid = true;
+
+				var fields = node.fields;
+
+				for ( var i = 0, l = fields.length; i < l; i ++ ) {
+
+					var field = fields[ i ];
+					var fieldName = field.name;
+					var fieldValues = field.values;
+
+					switch ( fieldName ) {
+
+						case 'beginCap':
+							beginCap = fieldValues[ 0 ];
+							break;
+
+						case 'ccw':
+							ccw = fieldValues[ 0 ];
+							break;
+
+						case 'convex':
+							// field not supported
+							break;
+
+						case 'creaseAngle':
+							creaseAngle = fieldValues[ 0 ];
+							break;
+
+						case 'crossSection':
+							crossSection = fieldValues;
+							break;
+
+						case 'endCap':
+							endCap = fieldValues[ 0 ];
+							break;
+
+						case 'orientation':
+							orientation = fieldValues;
+							break;
+
+						case 'scale':
+							scale = fieldValues;
+							break;
+
+						case 'solid':
+							solid = fieldValues[ 0 ];
+							break;
+
+						case 'spine':
+							spine = fieldValues; // only extrusion along the Y-axis are supported so far
+							break;
+
+						default:
+							console.warn( 'THREE.VRMLLoader: Unknown field:', fieldName );
+							break;
+
+					}
+
+				}
+
+				var crossSectionClosed = ( crossSection[ 0 ] === crossSection[ crossSection.length - 2 ] && crossSection[ 1 ] === crossSection[ crossSection.length - 1 ] );
+
+				// vertices
+
+				var vertices = [];
+				var spineVector = new THREE.Vector3();
+				var scaling = new THREE.Vector3();
+
+				var axis = new THREE.Vector3();
+				var vertex = new THREE.Vector3();
+				var quaternion = new THREE.Quaternion();
+
+				for ( var i = 0, j = 0, o = 0, il = spine.length; i < il; i += 3, j += 2, o += 4 ) {
+
+					spineVector.fromArray( spine, i );
+
+					scaling.x = scale ? scale[ j + 0 ] : 1;
+					scaling.y = 1;
+					scaling.z = scale ? scale[ j + 1 ] : 1;
+
+					axis.x = orientation ? orientation[ o + 0 ] : 0;
+					axis.y = orientation ? orientation[ o + 1 ] : 0;
+					axis.z = orientation ? orientation[ o + 2 ] : 1;
+					var angle = orientation ? orientation[ o + 3 ] : 0;
+
+					for ( var k = 0, kl = crossSection.length; k < kl; k += 2 ) {
+
+						vertex.x = crossSection[ k + 0 ];
+						vertex.y = 0;
+						vertex.z = crossSection[ k + 1 ];
+
+						// scale
+
+						vertex.multiply( scaling );
+
+						// rotate
+
+						quaternion.setFromAxisAngle( axis, angle );
+						vertex.applyQuaternion( quaternion );
+
+						// translate
+
+						vertex.add( spineVector );
+
+						vertices.push( vertex.x, vertex.y, vertex.z );
+
+					}
+
+				}
+
+				// indices
+
+				var indices = [];
+
+				var spineCount = spine.length / 3;
+				var crossSectionCount = crossSection.length / 2;
+
+				for ( var i = 0; i < spineCount - 1; i ++ ) {
+
+					for ( var j = 0; j < crossSectionCount - 1; j ++ ) {
+
+						var a = j + i * crossSectionCount;
+						var b = ( j + 1 ) + i * crossSectionCount;
+						var c = j + ( i + 1 ) * crossSectionCount;
+						var d = ( j + 1 ) + ( i + 1 ) * crossSectionCount;
+
+						if ( ( j === crossSectionCount - 2 ) && ( crossSectionClosed === true ) ) {
+
+							b = i * crossSectionCount;
+							d = ( i + 1 ) * crossSectionCount;
+
+						}
+
+						if ( ccw === true ) {
+
+							indices.push( a, b, c );
+							indices.push( c, b, d );
+
+						} else {
+
+							indices.push( a, c, b );
+							indices.push( c, d, b );
+
+						}
+
+					}
+
+				}
+
+				// triangulate cap
+
+				if ( beginCap === true || endCap === true ) {
+
+					var contour = [];
+
+					for ( var i = 0, l = crossSection.length; i < l; i += 2 ) {
+
+						contour.push( new THREE.Vector2( crossSection[ i ], crossSection[ i + 1 ] ) );
+
+					}
+
+					var faces = THREE.ShapeUtils.triangulateShape( contour, [] );
+					var capIndices = [];
+
+					for ( var i = 0, l = faces.length; i < l; i ++ ) {
+
+						var face = faces[ i ];
+
+						capIndices.push( face[ 0 ], face[ 1 ], face[ 2 ] );
+
+					}
+
+					// begin cap
+
+					if ( beginCap === true ) {
+
+						for ( var i = 0, l = capIndices.length; i < l; i += 3 ) {
+
+							if ( ccw === true ) {
+
+								indices.push( capIndices[ i + 0 ], capIndices[ i + 1 ], capIndices[ i + 2 ] );
+
+							} else {
+
+								indices.push( capIndices[ i + 0 ], capIndices[ i + 2 ], capIndices[ i + 1 ] );
+
+							}
+
+						}
+
+					}
+
+					// end cap
+
+					if ( endCap === true ) {
+
+						var indexOffset = crossSectionCount * ( spineCount - 1 ); // references to the first vertex of the last cross section
+
+						for ( var i = 0, l = capIndices.length; i < l; i += 3 ) {
+
+							if ( ccw === true ) {
+
+								indices.push( indexOffset + capIndices[ i + 0 ], indexOffset + capIndices[ i + 2 ], indexOffset + capIndices[ i + 1 ] );
+
+							} else {
+
+								indices.push( indexOffset + capIndices[ i + 0 ], indexOffset + capIndices[ i + 1 ], indexOffset + capIndices[ i + 2 ] );
+
+							}
+
+						}
+
+					}
+
+				}
+
+				var positionAttribute = toNonIndexedAttribute( indices, new THREE.Float32BufferAttribute( vertices, 3 ) );
+				var normalAttribute = computeNormalAttribute( indices, vertices, creaseAngle );
+
+				var geometry = new THREE.BufferGeometry();
+				geometry.setAttribute( 'position', positionAttribute );
+				geometry.setAttribute( 'normal', normalAttribute );
+				// no uvs yet
+
+				// "solid" influences the material so let's store it for later use
+
+				geometry._solid = solid;
+				geometry._type = 'mesh';
+
+				return geometry;
+
+			}
+
 			// helper functions
 			// helper functions
 
 
 			function resolveUSE( identifier ) {
 			function resolveUSE( identifier ) {
@@ -2658,14 +3267,36 @@ THREE.VRMLLoader = ( function () {
 		$.RULE( 'def', function () {
 		$.RULE( 'def', function () {
 
 
 			$.CONSUME( DEF );
 			$.CONSUME( DEF );
-			$.CONSUME( Identifier );
+			$.OR( [
+				{ ALT: function () {
+
+					$.CONSUME( Identifier );
+
+				} },
+				{ ALT: function () {
+
+					$.CONSUME( NodeName );
+
+				} }
+			] );
 
 
 		} );
 		} );
 
 
 		$.RULE( 'use', function () {
 		$.RULE( 'use', function () {
 
 
 			$.CONSUME( USE );
 			$.CONSUME( USE );
-			$.CONSUME( Identifier );
+			$.OR( [
+				{ ALT: function () {
+
+					$.CONSUME( Identifier );
+
+				} },
+				{ ALT: function () {
+
+					$.CONSUME( NodeName );
+
+				} }
+			] );
 
 
 		} );
 		} );
 
 

+ 3 - 0
examples/js/loaders/VTKLoader.js

@@ -390,6 +390,7 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						pointIndex = pointIndex + 12;
 						pointIndex = pointIndex + 12;
 
 
 					}
 					}
+
 					// increment our next pointer
 					// increment our next pointer
 					state.next = state.next + count + 1;
 					state.next = state.next + count + 1;
 
 
@@ -438,6 +439,7 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						}
 						}
 
 
 					}
 					}
+
 					// increment our next pointer
 					// increment our next pointer
 					state.next = state.next + count + 1;
 					state.next = state.next + count + 1;
 
 
@@ -475,6 +477,7 @@ THREE.VTKLoader.prototype = Object.assign( Object.create( THREE.Loader.prototype
 						}
 						}
 
 
 					}
 					}
+
 					// increment our next pointer
 					// increment our next pointer
 					state.next = state.next + count + 1;
 					state.next = state.next + count + 1;
 
 

+ 73 - 0
examples/js/loaders/XLoader.js

@@ -83,11 +83,13 @@ THREE.XLoader = ( function () {
 				this.putFlags.putPos = true;
 				this.putFlags.putPos = true;
 
 
 			}
 			}
+
 			if ( this.putFlags.putRot === undefined ) {
 			if ( this.putFlags.putRot === undefined ) {
 
 
 				this.putFlags.putRot = true;
 				this.putFlags.putRot = true;
 
 
 			}
 			}
+
 			if ( this.putFlags.putScl === undefined ) {
 			if ( this.putFlags.putScl === undefined ) {
 
 
 				this.putFlags.putScl = true;
 				this.putFlags.putScl = true;
@@ -105,6 +107,7 @@ THREE.XLoader = ( function () {
 					this.hierarchy.push( this.makeBonekeys( XAnimationInfoArray[ i ] ) );
 					this.hierarchy.push( this.makeBonekeys( XAnimationInfoArray[ i ] ) );
 
 
 				}
 				}
+
 				this.length = this.hierarchy[ 0 ].keys[ this.hierarchy[ 0 ].keys.length - 1 ].time;
 				this.length = this.hierarchy[ 0 ].keys[ this.hierarchy[ 0 ].keys.length - 1 ].time;
 
 
 			}
 			}
@@ -128,6 +131,7 @@ THREE.XLoader = ( function () {
 					return Object.assign( {}, this );
 					return Object.assign( {}, this );
 
 
 				};
 				};
+
 				return refObj;
 				return refObj;
 
 
 			}
 			}
@@ -145,16 +149,19 @@ THREE.XLoader = ( function () {
 						keyframe.pos = XAnimationInfo.keyFrames[ i ].pos;
 						keyframe.pos = XAnimationInfo.keyFrames[ i ].pos;
 
 
 					}
 					}
+
 					if ( XAnimationInfo.keyFrames[ i ].rot && this.putFlags.putRot ) {
 					if ( XAnimationInfo.keyFrames[ i ].rot && this.putFlags.putRot ) {
 
 
 						keyframe.rot = XAnimationInfo.keyFrames[ i ].rot;
 						keyframe.rot = XAnimationInfo.keyFrames[ i ].rot;
 
 
 					}
 					}
+
 					if ( XAnimationInfo.keyFrames[ i ].scl && this.putFlags.putScl ) {
 					if ( XAnimationInfo.keyFrames[ i ].scl && this.putFlags.putScl ) {
 
 
 						keyframe.scl = XAnimationInfo.keyFrames[ i ].scl;
 						keyframe.scl = XAnimationInfo.keyFrames[ i ].scl;
 
 
 					}
 					}
+
 					if ( XAnimationInfo.keyFrames[ i ].matrix ) {
 					if ( XAnimationInfo.keyFrames[ i ].matrix ) {
 
 
 						keyframe.matrix = XAnimationInfo.keyFrames[ i ].matrix;
 						keyframe.matrix = XAnimationInfo.keyFrames[ i ].matrix;
@@ -163,11 +170,13 @@ THREE.XLoader = ( function () {
 							keyframe.pos = new THREE.Vector3().setFromMatrixPosition( keyframe.matrix );
 							keyframe.pos = new THREE.Vector3().setFromMatrixPosition( keyframe.matrix );
 
 
 						}
 						}
+
 						if ( this.putFlags.putRot ) {
 						if ( this.putFlags.putRot ) {
 
 
 							keyframe.rot = new THREE.Quaternion().setFromRotationMatrix( keyframe.matrix );
 							keyframe.rot = new THREE.Quaternion().setFromRotationMatrix( keyframe.matrix );
 
 
 						}
 						}
+
 						if ( this.putFlags.putScl ) {
 						if ( this.putFlags.putScl ) {
 
 
 							keyframe.scl = new THREE.Vector3().setFromMatrixScale( keyframe.matrix );
 							keyframe.scl = new THREE.Vector3().setFromMatrixScale( keyframe.matrix );
@@ -175,9 +184,11 @@ THREE.XLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					keys.push( keyframe );
 					keys.push( keyframe );
 
 
 				}
 				}
+
 				return keys;
 				return keys;
 
 
 			}
 			}
@@ -239,6 +250,7 @@ THREE.XLoader = ( function () {
 					return;
 					return;
 
 
 				}
 				}
+
 				for ( var i = _start; i < _arg.length; i ++ ) {
 				for ( var i = _start; i < _arg.length; i ++ ) {
 
 
 					switch ( i ) {
 					switch ( i ) {
@@ -253,6 +265,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( this.options === undefined ) {
 				if ( this.options === undefined ) {
 
 
 					this.options = {};
 					this.options = {};
@@ -291,6 +304,7 @@ THREE.XLoader = ( function () {
 						find = line.indexOf( '#', readed );
 						find = line.indexOf( '#', readed );
 
 
 					}
 					}
+
 					if ( find > - 1 && find < 2 ) {
 					if ( find > - 1 && find < 2 ) {
 
 
 						var foundNewLine = - 1;
 						var foundNewLine = - 1;
@@ -321,6 +335,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				return line.substr( readed );
 				return line.substr( readed );
 
 
 			}
 			}
@@ -338,6 +353,7 @@ THREE.XLoader = ( function () {
 						find = line.indexOf( '#', readed );
 						find = line.indexOf( '#', readed );
 
 
 					}
 					}
+
 					if ( find > - 1 && find < 2 ) {
 					if ( find > - 1 && find < 2 ) {
 
 
 						var foundNewLine = - 1;
 						var foundNewLine = - 1;
@@ -368,6 +384,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				return line.substr( readed );
 				return line.substr( readed );
 
 
 			}
 			}
@@ -384,6 +401,7 @@ THREE.XLoader = ( function () {
 					return true;
 					return true;
 
 
 				}
 				}
+
 				var fileLength = reader.byteLength;
 				var fileLength = reader.byteLength;
 				for ( var index = 0; index < fileLength; index ++ ) {
 				for ( var index = 0; index < fileLength; index ++ ) {
 
 
@@ -394,6 +412,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				return false;
 				return false;
 
 
 			}
 			}
@@ -409,6 +428,7 @@ THREE.XLoader = ( function () {
 						array_buffer[ i ] = buf.charCodeAt( i ) & 0xff;
 						array_buffer[ i ] = buf.charCodeAt( i ) & 0xff;
 
 
 					}
 					}
+
 					return array_buffer.buffer || array_buffer;
 					return array_buffer.buffer || array_buffer;
 
 
 				} else {
 				} else {
@@ -515,6 +535,7 @@ THREE.XLoader = ( function () {
 							_currentObject.type = "";
 							_currentObject.type = "";
 
 
 						}
 						}
+
 						if ( _currentObject.type === "Animation" ) {
 						if ( _currentObject.type === "Animation" ) {
 
 
 							_currentObject.data = this._data.substr( findNext, findEnd - findNext ).trim();
 							_currentObject.data = this._data.substr( findNext, findEnd - findNext ).trim();
@@ -540,6 +561,7 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						_currentObject.parent = _parent;
 						_currentObject.parent = _parent;
 						if ( _currentObject.type != "template" ) {
 						if ( _currentObject.type != "template" ) {
 
 
@@ -555,6 +577,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				return {
 				return {
 					parent: _parent,
 					parent: _parent,
 					end: endRead
 					end: endRead
@@ -664,6 +687,7 @@ THREE.XLoader = ( function () {
 									this._currentAnime.AnimeFrames.push( this._currentAnimeFrames );
 									this._currentAnime.AnimeFrames.push( this._currentAnimeFrames );
 
 
 								}
 								}
+
 								this._currentAnimeFrames = new XAnimationInfo();
 								this._currentAnimeFrames = new XAnimationInfo();
 								this._currentAnimeFrames.boneName = this._currentObject.data.trim();
 								this._currentAnimeFrames.boneName = this._currentObject.data.trim();
 								break;
 								break;
@@ -673,9 +697,11 @@ THREE.XLoader = ( function () {
 								break;
 								break;
 
 
 						}
 						}
+
 						this._currentObject.worked = true;
 						this._currentObject.worked = true;
 
 
 					}
 					}
+
 					if ( this._currentObject.children.length > 0 ) {
 					if ( this._currentObject.children.length > 0 ) {
 
 
 						this._currentObject = this._currentObject.children.shift();
 						this._currentObject = this._currentObject.children.shift();
@@ -684,6 +710,7 @@ THREE.XLoader = ( function () {
 							console.log( 'processing ' + this._currentObject.name );
 							console.log( 'processing ' + this._currentObject.name );
 
 
 						}
 						}
+
 						if ( breakFlag ) break;
 						if ( breakFlag ) break;
 
 
 					} else {
 					} else {
@@ -697,6 +724,7 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						if ( this._currentObject.parent ) {
 						if ( this._currentObject.parent ) {
 
 
 							this._currentObject = this._currentObject.parent;
 							this._currentObject = this._currentObject.parent;
@@ -706,11 +734,13 @@ THREE.XLoader = ( function () {
 							breakFlag = true;
 							breakFlag = true;
 
 
 						}
 						}
+
 						if ( breakFlag ) break;
 						if ( breakFlag ) break;
 
 
 					}
 					}
 
 
 				}
 				}
+
 				return;
 				return;
 
 
 			}
 			}
@@ -723,6 +753,7 @@ THREE.XLoader = ( function () {
 					this._makeOutputGeometry();
 					this._makeOutputGeometry();
 
 
 				}
 				}
+
 				this._currentGeo = {};
 				this._currentGeo = {};
 				if ( this._currentAnime != null && this._currentAnime.name ) {
 				if ( this._currentAnime != null && this._currentAnime.name ) {
 
 
@@ -732,9 +763,11 @@ THREE.XLoader = ( function () {
 						this._currentAnimeFrames = null;
 						this._currentAnimeFrames = null;
 
 
 					}
 					}
+
 					this._makeOutputAnimation();
 					this._makeOutputAnimation();
 
 
 				}
 				}
+
 				this._currentAnime = {};
 				this._currentAnime = {};
 
 
 			}
 			}
@@ -774,6 +807,7 @@ THREE.XLoader = ( function () {
 					this._currentFrame.parentName = this._currentObject.parent.name;
 					this._currentFrame.parentName = this._currentObject.parent.name;
 
 
 				}
 				}
+
 				this.frameHierarchie.push( this._nowFrameName );
 				this.frameHierarchie.push( this._nowFrameName );
 				this.HieStack[ this._nowFrameName ] = this._currentFrame;
 				this.HieStack[ this._nowFrameName ] = this._currentFrame;
 
 
@@ -797,6 +831,7 @@ THREE.XLoader = ( function () {
 					return;
 					return;
 
 
 				}
 				}
+
 				var b = new THREE.Bone();
 				var b = new THREE.Bone();
 				b.name = this._currentFrame.name;
 				b.name = this._currentFrame.name;
 				b.applyMatrix4( this._currentFrame.FrameTransformMatrix );
 				b.applyMatrix4( this._currentFrame.FrameTransformMatrix );
@@ -854,6 +889,7 @@ THREE.XLoader = ( function () {
 								break;
 								break;
 
 
 						}
 						}
+
 						if ( find === 0 || find > maxLength ) {
 						if ( find === 0 || find > maxLength ) {
 
 
 							find = maxLength;
 							find = maxLength;
@@ -861,6 +897,7 @@ THREE.XLoader = ( function () {
 							changeMode = true;
 							changeMode = true;
 
 
 						}
 						}
+
 						switch ( this._currentObject.type ) {
 						switch ( this._currentObject.type ) {
 
 
 							case "Mesh":
 							case "Mesh":
@@ -874,6 +911,7 @@ THREE.XLoader = ( function () {
 										break;
 										break;
 
 
 								}
 								}
+
 								break;
 								break;
 							case "MeshNormals":
 							case "MeshNormals":
 								switch ( mode ) {
 								switch ( mode ) {
@@ -883,9 +921,11 @@ THREE.XLoader = ( function () {
 										break;
 										break;
 
 
 								}
 								}
+
 								break;
 								break;
 
 
 						}
 						}
+
 						endRead = find + 1;
 						endRead = find + 1;
 						if ( changeMode ) {
 						if ( changeMode ) {
 
 
@@ -894,6 +934,7 @@ THREE.XLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					if ( endRead >= this._currentObject.data.length ) {
 					if ( endRead >= this._currentObject.data.length ) {
 
 
 						break;
 						break;
@@ -1053,6 +1094,7 @@ THREE.XLoader = ( function () {
 									mode_local = 0;
 									mode_local = 0;
 
 
 								}
 								}
+
 								var line = this._currentObject.data.substr( endRead, find - endRead );
 								var line = this._currentObject.data.substr( endRead, find - endRead );
 								var data = this._readLine( line.trim() ).split( ";" );
 								var data = this._readLine( line.trim() ).split( ";" );
 								if ( this.IsUvYReverse ) {
 								if ( this.IsUvYReverse ) {
@@ -1064,12 +1106,15 @@ THREE.XLoader = ( function () {
 									this._currentGeo.GeometryData.uvs.push( parseFloat( data[ 0 ] ), parseFloat( data[ 1 ] ) );
 									this._currentGeo.GeometryData.uvs.push( parseFloat( data[ 0 ] ), parseFloat( data[ 1 ] ) );
 
 
 								}
 								}
+
 								endRead = find + 1;
 								endRead = find + 1;
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 					}
 					}
+
 					if ( endRead >= this._currentObject.data.length ) {
 					if ( endRead >= this._currentObject.data.length ) {
 
 
 						break;
 						break;
@@ -1104,6 +1149,7 @@ THREE.XLoader = ( function () {
 							mode_local = 0;
 							mode_local = 0;
 
 
 						}
 						}
+
 						var line = this._currentObject.data.substr( endRead, find - endRead );
 						var line = this._currentObject.data.substr( endRead, find - endRead );
 						var data = this._readLine( line.trim() ).split( "," );
 						var data = this._readLine( line.trim() ).split( "," );
 						for ( var i = 0; i < data.length; i ++ ) {
 						for ( var i = 0; i < data.length; i ++ ) {
@@ -1111,9 +1157,11 @@ THREE.XLoader = ( function () {
 							this._currentGeo.GeometryData.materialIndices[ i ] = parseInt( data[ i ] );
 							this._currentGeo.GeometryData.materialIndices[ i ] = parseInt( data[ i ] );
 
 
 						}
 						}
+
 						endRead = this._currentObject.data.length;
 						endRead = this._currentObject.data.length;
 
 
 					}
 					}
+
 					if ( endRead >= this._currentObject.data.length || mode >= 3 ) {
 					if ( endRead >= this._currentObject.data.length || mode >= 3 ) {
 
 
 						break;
 						break;
@@ -1157,6 +1205,7 @@ THREE.XLoader = ( function () {
 					find = this._currentObject.data.length;
 					find = this._currentObject.data.length;
 
 
 				}
 				}
+
 				line = this._currentObject.data.substr( endRead, find - endRead );
 				line = this._currentObject.data.substr( endRead, find - endRead );
 				var data3 = this._readLine( line.trim() ).split( ";" );
 				var data3 = this._readLine( line.trim() ).split( ";" );
 				_nowMat.emissive.r = parseFloat( data3[ 0 ] );
 				_nowMat.emissive.r = parseFloat( data3[ 0 ] );
@@ -1173,6 +1222,7 @@ THREE.XLoader = ( function () {
 							console.log( 'processing ' + localObject.name );
 							console.log( 'processing ' + localObject.name );
 
 
 						}
 						}
+
 						var fileName = localObject.data.substr( 1, localObject.data.length - 2 );
 						var fileName = localObject.data.substr( 1, localObject.data.length - 2 );
 						switch ( localObject.type ) {
 						switch ( localObject.type ) {
 
 
@@ -1203,6 +1253,7 @@ THREE.XLoader = ( function () {
 					}
 					}
 
 
 				}
 				}
+
 				this._currentGeo.Materials.push( _nowMat );
 				this._currentGeo.Materials.push( _nowMat );
 
 
 			}
 			}
@@ -1227,6 +1278,7 @@ THREE.XLoader = ( function () {
 					boneInf.Indeces.push( parseInt( data[ i ] ) );
 					boneInf.Indeces.push( parseInt( data[ i ] ) );
 
 
 				}
 				}
+
 				endRead = find + 1;
 				endRead = find + 1;
 				find = this._currentObject.data.indexOf( ';', endRead );
 				find = this._currentObject.data.indexOf( ';', endRead );
 				line = this._currentObject.data.substr( endRead, find - endRead );
 				line = this._currentObject.data.substr( endRead, find - endRead );
@@ -1236,6 +1288,7 @@ THREE.XLoader = ( function () {
 					boneInf.Weights.push( parseFloat( data2[ _i ] ) );
 					boneInf.Weights.push( parseFloat( data2[ _i ] ) );
 
 
 				}
 				}
+
 				endRead = find + 1;
 				endRead = find + 1;
 				find = this._currentObject.data.indexOf( ';', endRead );
 				find = this._currentObject.data.indexOf( ';', endRead );
 				if ( find <= 0 ) {
 				if ( find <= 0 ) {
@@ -1243,6 +1296,7 @@ THREE.XLoader = ( function () {
 					find = this._currentObject.data.length;
 					find = this._currentObject.data.length;
 
 
 				}
 				}
+
 				line = this._currentObject.data.substr( endRead, find - endRead );
 				line = this._currentObject.data.substr( endRead, find - endRead );
 				var data3 = this._readLine( line.trim() ).split( "," );
 				var data3 = this._readLine( line.trim() ).split( "," );
 				boneInf.OffsetMatrix = new THREE.Matrix4();
 				boneInf.OffsetMatrix = new THREE.Matrix4();
@@ -1283,6 +1337,7 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						_bones.push( b );
 						_bones.push( b );
 
 
 					}
 					}
@@ -1314,6 +1369,7 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						for ( var vi = 0; vi < this._currentGeo.BoneInfs[ bi ].Indeces.length; vi ++ ) {
 						for ( var vi = 0; vi < this._currentGeo.BoneInfs[ bi ].Indeces.length; vi ++ ) {
 
 
 							var nowVertexID = this._currentGeo.BoneInfs[ bi ].Indeces[ vi ];
 							var nowVertexID = this._currentGeo.BoneInfs[ bi ].Indeces[ vi ];
@@ -1341,6 +1397,7 @@ THREE.XLoader = ( function () {
 									break;
 									break;
 
 
 							}
 							}
+
 							this._currentGeo.VertexSetedBoneCount[ nowVertexID ] ++;
 							this._currentGeo.VertexSetedBoneCount[ nowVertexID ] ++;
 							if ( this._currentGeo.VertexSetedBoneCount[ nowVertexID ] > 4 ) {
 							if ( this._currentGeo.VertexSetedBoneCount[ nowVertexID ] > 4 ) {
 
 
@@ -1351,11 +1408,13 @@ THREE.XLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					for ( var sk = 0; sk < this._currentGeo.Materials.length; sk ++ ) {
 					for ( var sk = 0; sk < this._currentGeo.Materials.length; sk ++ ) {
 
 
 						this._currentGeo.Materials[ sk ].skinning = true;
 						this._currentGeo.Materials[ sk ].skinning = true;
 
 
 					}
 					}
+
 					var offsetList = [];
 					var offsetList = [];
 					for ( var _bi = 0; _bi < putBones.length; _bi ++ ) {
 					for ( var _bi = 0; _bi < putBones.length; _bi ++ ) {
 
 
@@ -1382,6 +1441,7 @@ THREE.XLoader = ( function () {
 					mesh = new THREE.Mesh( _bufferGeometry, this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[ 0 ] : this._currentGeo.Materials );
 					mesh = new THREE.Mesh( _bufferGeometry, this._currentGeo.Materials.length === 1 ? this._currentGeo.Materials[ 0 ] : this._currentGeo.Materials );
 
 
 				}
 				}
+
 				mesh.name = this._currentGeo.name;
 				mesh.name = this._currentGeo.name;
 				var worldBaseMx = new THREE.Matrix4();
 				var worldBaseMx = new THREE.Matrix4();
 				var currentMxFrame = this._currentGeo.baseFrame.putBone;
 				var currentMxFrame = this._currentGeo.baseFrame.putBone;
@@ -1401,9 +1461,11 @@ THREE.XLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					mesh.applyMatrix4( worldBaseMx );
 					mesh.applyMatrix4( worldBaseMx );
 
 
 				}
 				}
+
 				this.Meshes.push( mesh );
 				this.Meshes.push( mesh );
 
 
 			}
 			}
@@ -1486,6 +1548,7 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						var frameValue = data2[ 2 ].split( "," );
 						var frameValue = data2[ 2 ].split( "," );
 						switch ( nowKeyType ) {
 						switch ( nowKeyType ) {
 
 
@@ -1500,6 +1563,7 @@ THREE.XLoader = ( function () {
 								break;
 								break;
 
 
 						}
 						}
+
 						if ( ! frameFound ) {
 						if ( ! frameFound ) {
 
 
 							this._currentAnimeFrames.keyFrames.push( keyInfo );
 							this._currentAnimeFrames.keyFrames.push( keyInfo );
@@ -1539,16 +1603,19 @@ THREE.XLoader = ( function () {
 					model = this.Meshes[ 0 ];
 					model = this.Meshes[ 0 ];
 
 
 				}
 				}
+
 				if ( ! animation ) {
 				if ( ! animation ) {
 
 
 					animation = this.animations[ 0 ];
 					animation = this.animations[ 0 ];
 
 
 				}
 				}
+
 				if ( ! model || ! animation ) {
 				if ( ! model || ! animation ) {
 
 
 					return null;
 					return null;
 
 
 				}
 				}
+
 				var put = {};
 				var put = {};
 				put.fps = animation.fps;
 				put.fps = animation.fps;
 				put.name = animation.name;
 				put.name = animation.name;
@@ -1578,12 +1645,14 @@ THREE.XLoader = ( function () {
 								}
 								}
 
 
 							}
 							}
+
 							put.hierarchy.push( c_key );
 							put.hierarchy.push( c_key );
 							break;
 							break;
 
 
 						}
 						}
 
 
 					}
 					}
+
 					if ( ! findAnimation ) {
 					if ( ! findAnimation ) {
 
 
 						var _c_key = animation.hierarchy[ 0 ].copy();
 						var _c_key = animation.hierarchy[ 0 ].copy();
@@ -1596,11 +1665,13 @@ THREE.XLoader = ( function () {
 								_c_key.keys[ k ].pos.set( 0, 0, 0 );
 								_c_key.keys[ k ].pos.set( 0, 0, 0 );
 
 
 							}
 							}
+
 							if ( _c_key.keys[ k ].scl ) {
 							if ( _c_key.keys[ k ].scl ) {
 
 
 								_c_key.keys[ k ].scl.set( 1, 1, 1 );
 								_c_key.keys[ k ].scl.set( 1, 1, 1 );
 
 
 							}
 							}
+
 							if ( _c_key.keys[ k ].rot ) {
 							if ( _c_key.keys[ k ].rot ) {
 
 
 								_c_key.keys[ k ].rot.set( 0, 0, 0, 1 );
 								_c_key.keys[ k ].rot.set( 0, 0, 0, 1 );
@@ -1608,11 +1679,13 @@ THREE.XLoader = ( function () {
 							}
 							}
 
 
 						}
 						}
+
 						put.hierarchy.push( _c_key );
 						put.hierarchy.push( _c_key );
 
 
 					}
 					}
 
 
 				}
 				}
+
 				if ( ! model.geometry.animations ) {
 				if ( ! model.geometry.animations ) {
 
 
 					model.geometry.animations = [];
 					model.geometry.animations = [];

+ 19 - 1
examples/js/math/SimplexNoise.js

@@ -28,13 +28,16 @@ THREE.SimplexNoise = function ( r ) {
 	     [ - 1, 1, 1, 0 ], [ - 1, 1, - 1, 0 ], [ - 1, - 1, 1, 0 ], [ - 1, - 1, - 1, 0 ]];
 	     [ - 1, 1, 1, 0 ], [ - 1, 1, - 1, 0 ], [ - 1, - 1, 1, 0 ], [ - 1, - 1, - 1, 0 ]];
 
 
 	this.p = [];
 	this.p = [];
+
 	for ( var i = 0; i < 256; i ++ ) {
 	for ( var i = 0; i < 256; i ++ ) {
 
 
 		this.p[ i ] = Math.floor( r.random() * 256 );
 		this.p[ i ] = Math.floor( r.random() * 256 );
 
 
 	}
 	}
+
 	// To remove the need for index wrapping, double the permutation table length
 	// To remove the need for index wrapping, double the permutation table length
 	this.perm = [];
 	this.perm = [];
+
 	for ( var i = 0; i < 512; i ++ ) {
 	for ( var i = 0; i < 512; i ++ ) {
 
 
 		this.perm[ i ] = this.p[ i & 255 ];
 		this.perm[ i ] = this.p[ i & 255 ];
@@ -101,6 +104,7 @@ THREE.SimplexNoise.prototype.noise = function ( xin, yin ) {
 		i1 = 0; j1 = 1;
 		i1 = 0; j1 = 1;
 
 
 	} // upper triangle, YX order: (0,0)->(0,1)->(1,1)
 	} // upper triangle, YX order: (0,0)->(0,1)->(1,1)
+
 	// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and
 	// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and
 	// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where
 	// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where
 	// c = (3-sqrt(3))/6
 	// c = (3-sqrt(3))/6
@@ -123,6 +127,7 @@ THREE.SimplexNoise.prototype.noise = function ( xin, yin ) {
 		n0 = t0 * t0 * this.dot( this.grad3[ gi0 ], x0, y0 ); // (x,y) of grad3 used for 2D gradient
 		n0 = t0 * t0 * this.dot( this.grad3[ gi0 ], x0, y0 ); // (x,y) of grad3 used for 2D gradient
 
 
 	}
 	}
+
 	var t1 = 0.5 - x1 * x1 - y1 * y1;
 	var t1 = 0.5 - x1 * x1 - y1 * y1;
 	if ( t1 < 0 ) n1 = 0.0;
 	if ( t1 < 0 ) n1 = 0.0;
 	else {
 	else {
@@ -131,6 +136,7 @@ THREE.SimplexNoise.prototype.noise = function ( xin, yin ) {
 		n1 = t1 * t1 * this.dot( this.grad3[ gi1 ], x1, y1 );
 		n1 = t1 * t1 * this.dot( this.grad3[ gi1 ], x1, y1 );
 
 
 	}
 	}
+
 	var t2 = 0.5 - x2 * x2 - y2 * y2;
 	var t2 = 0.5 - x2 * x2 - y2 * y2;
 	if ( t2 < 0 ) n2 = 0.0;
 	if ( t2 < 0 ) n2 = 0.0;
 	else {
 	else {
@@ -139,6 +145,7 @@ THREE.SimplexNoise.prototype.noise = function ( xin, yin ) {
 		n2 = t2 * t2 * this.dot( this.grad3[ gi2 ], x2, y2 );
 		n2 = t2 * t2 * this.dot( this.grad3[ gi2 ], x2, y2 );
 
 
 	}
 	}
+
 	// Add contributions from each corner to get the final noise value.
 	// Add contributions from each corner to get the final noise value.
 	// The result is scaled to return values in the interval [-1,1].
 	// The result is scaled to return values in the interval [-1,1].
 	return 70.0 * ( n0 + n1 + n2 );
 	return 70.0 * ( n0 + n1 + n2 );
@@ -208,6 +215,7 @@ THREE.SimplexNoise.prototype.noise3d = function ( xin, yin, zin ) {
 		} // Y X Z order
 		} // Y X Z order
 
 
 	}
 	}
+
 	// A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),
 	// A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),
 	// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and
 	// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and
 	// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where
 	// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where
@@ -238,6 +246,7 @@ THREE.SimplexNoise.prototype.noise3d = function ( xin, yin, zin ) {
 		n0 = t0 * t0 * this.dot3( this.grad3[ gi0 ], x0, y0, z0 );
 		n0 = t0 * t0 * this.dot3( this.grad3[ gi0 ], x0, y0, z0 );
 
 
 	}
 	}
+
 	var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;
 	var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1;
 	if ( t1 < 0 ) n1 = 0.0;
 	if ( t1 < 0 ) n1 = 0.0;
 	else {
 	else {
@@ -246,6 +255,7 @@ THREE.SimplexNoise.prototype.noise3d = function ( xin, yin, zin ) {
 		n1 = t1 * t1 * this.dot3( this.grad3[ gi1 ], x1, y1, z1 );
 		n1 = t1 * t1 * this.dot3( this.grad3[ gi1 ], x1, y1, z1 );
 
 
 	}
 	}
+
 	var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;
 	var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2;
 	if ( t2 < 0 ) n2 = 0.0;
 	if ( t2 < 0 ) n2 = 0.0;
 	else {
 	else {
@@ -254,6 +264,7 @@ THREE.SimplexNoise.prototype.noise3d = function ( xin, yin, zin ) {
 		n2 = t2 * t2 * this.dot3( this.grad3[ gi2 ], x2, y2, z2 );
 		n2 = t2 * t2 * this.dot3( this.grad3[ gi2 ], x2, y2, z2 );
 
 
 	}
 	}
+
 	var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;
 	var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3;
 	if ( t3 < 0 ) n3 = 0.0;
 	if ( t3 < 0 ) n3 = 0.0;
 	else {
 	else {
@@ -262,6 +273,7 @@ THREE.SimplexNoise.prototype.noise3d = function ( xin, yin, zin ) {
 		n3 = t3 * t3 * this.dot3( this.grad3[ gi3 ], x3, y3, z3 );
 		n3 = t3 * t3 * this.dot3( this.grad3[ gi3 ], x3, y3, z3 );
 
 
 	}
 	}
+
 	// Add contributions from each corner to get the final noise value.
 	// Add contributions from each corner to get the final noise value.
 	// The result is scaled to stay just inside [-1,1]
 	// The result is scaled to stay just inside [-1,1]
 	return 32.0 * ( n0 + n1 + n2 + n3 );
 	return 32.0 * ( n0 + n1 + n2 + n3 );
@@ -368,6 +380,7 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
 		n0 = t0 * t0 * this.dot4( grad4[ gi0 ], x0, y0, z0, w0 );
 		n0 = t0 * t0 * this.dot4( grad4[ gi0 ], x0, y0, z0, w0 );
 
 
 	}
 	}
+
 	var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
 	var t1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;
 	if ( t1 < 0 ) n1 = 0.0;
 	if ( t1 < 0 ) n1 = 0.0;
 	else {
 	else {
@@ -376,6 +389,7 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
 		n1 = t1 * t1 * this.dot4( grad4[ gi1 ], x1, y1, z1, w1 );
 		n1 = t1 * t1 * this.dot4( grad4[ gi1 ], x1, y1, z1, w1 );
 
 
 	}
 	}
+
 	var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
 	var t2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;
 	if ( t2 < 0 ) n2 = 0.0;
 	if ( t2 < 0 ) n2 = 0.0;
 	else {
 	else {
@@ -383,7 +397,9 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
 		t2 *= t2;
 		t2 *= t2;
 		n2 = t2 * t2 * this.dot4( grad4[ gi2 ], x2, y2, z2, w2 );
 		n2 = t2 * t2 * this.dot4( grad4[ gi2 ], x2, y2, z2, w2 );
 
 
-	} var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
+	}
+
+	var t3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;
 	if ( t3 < 0 ) n3 = 0.0;
 	if ( t3 < 0 ) n3 = 0.0;
 	else {
 	else {
 
 
@@ -391,6 +407,7 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
 		n3 = t3 * t3 * this.dot4( grad4[ gi3 ], x3, y3, z3, w3 );
 		n3 = t3 * t3 * this.dot4( grad4[ gi3 ], x3, y3, z3, w3 );
 
 
 	}
 	}
+
 	var t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
 	var t4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;
 	if ( t4 < 0 ) n4 = 0.0;
 	if ( t4 < 0 ) n4 = 0.0;
 	else {
 	else {
@@ -399,6 +416,7 @@ THREE.SimplexNoise.prototype.noise4d = function ( x, y, z, w ) {
 		n4 = t4 * t4 * this.dot4( grad4[ gi4 ], x4, y4, z4, w4 );
 		n4 = t4 * t4 * this.dot4( grad4[ gi4 ], x4, y4, z4, w4 );
 
 
 	}
 	}
+
 	// Sum up and scale the result to cover the range [-1,1]
 	// Sum up and scale the result to cover the range [-1,1]
 	return 27.0 * ( n0 + n1 + n2 + n3 + n4 );
 	return 27.0 * ( n0 + n1 + n2 + n3 + n4 );
 
 

+ 2 - 0
examples/js/misc/ConvexObjectBreaker.js

@@ -388,6 +388,7 @@ THREE.ConvexObjectBreaker.prototype = {
 				radius1 = Math.max( radius1, p.x, p.y, p.z );
 				radius1 = Math.max( radius1, p.x, p.y, p.z );
 
 
 			}
 			}
+
 			this.tempCM1.add( object.position );
 			this.tempCM1.add( object.position );
 
 
 		}
 		}
@@ -407,6 +408,7 @@ THREE.ConvexObjectBreaker.prototype = {
 				radius2 = Math.max( radius2, p.x, p.y, p.z );
 				radius2 = Math.max( radius2, p.x, p.y, p.z );
 
 
 			}
 			}
+
 			this.tempCM2.add( object.position );
 			this.tempCM2.add( object.position );
 
 
 		}
 		}

+ 3 - 0
examples/js/misc/GPUComputationRenderer.js

@@ -174,6 +174,7 @@ THREE.GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 			// Adds dependencies uniforms to the ShaderMaterial
 			// Adds dependencies uniforms to the ShaderMaterial
 			var material = variable.material;
 			var material = variable.material;
 			var uniforms = material.uniforms;
 			var uniforms = material.uniforms;
+
 			if ( variable.dependencies !== null ) {
 			if ( variable.dependencies !== null ) {
 
 
 				for ( var d = 0; d < variable.dependencies.length; d ++ ) {
 				for ( var d = 0; d < variable.dependencies.length; d ++ ) {
@@ -194,6 +195,7 @@ THREE.GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 							}
 							}
 
 
 						}
 						}
+
 						if ( ! found ) {
 						if ( ! found ) {
 
 
 							return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name;
 							return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name;
@@ -267,6 +269,7 @@ THREE.GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 		materialShader.defines.resolution = 'vec2( ' + sizeX.toFixed( 1 ) + ', ' + sizeY.toFixed( 1 ) + " )";
 		materialShader.defines.resolution = 'vec2( ' + sizeX.toFixed( 1 ) + ', ' + sizeY.toFixed( 1 ) + " )";
 
 
 	}
 	}
+
 	this.addResolutionDefine = addResolutionDefine;
 	this.addResolutionDefine = addResolutionDefine;
 
 
 
 

+ 5 - 0
examples/js/misc/Ocean.js

@@ -22,6 +22,7 @@ THREE.Ocean = function ( renderer, camera, scene, options ) {
 		return value !== undefined ? value : defaultValue;
 		return value !== undefined ? value : defaultValue;
 
 
 	}
 	}
+
 	options = options || {};
 	options = options || {};
 	this.clearColor = optionalParameter( options.CLEAR_COLOR, [ 1.0, 1.0, 1.0, 0.0 ] );
 	this.clearColor = optionalParameter( options.CLEAR_COLOR, [ 1.0, 1.0, 1.0, 0.0 ] );
 	this.geometryOrigin = optionalParameter( options.GEOMETRY_ORIGIN, [ - 1000.0, - 1000.0 ] );
 	this.geometryOrigin = optionalParameter( options.GEOMETRY_ORIGIN, [ - 1000.0, - 1000.0 ] );
@@ -274,6 +275,7 @@ THREE.Ocean.prototype.renderWavePhase = function () {
 
 
 	this.scene.overrideMaterial = this.materialPhase;
 	this.scene.overrideMaterial = this.materialPhase;
 	this.screenQuad.material = this.materialPhase;
 	this.screenQuad.material = this.materialPhase;
+
 	if ( this.initial ) {
 	if ( this.initial ) {
 
 
 		this.materialPhase.uniforms.u_phases.value = this.pingPhaseTexture;
 		this.materialPhase.uniforms.u_phases.value = this.pingPhaseTexture;
@@ -284,6 +286,7 @@ THREE.Ocean.prototype.renderWavePhase = function () {
 		this.materialPhase.uniforms.u_phases.value = this.pingPhase ? this.pingPhaseFramebuffer.texture : this.pongPhaseFramebuffer.texture;
 		this.materialPhase.uniforms.u_phases.value = this.pingPhase ? this.pingPhaseFramebuffer.texture : this.pongPhaseFramebuffer.texture;
 
 
 	}
 	}
+
 	this.materialPhase.uniforms.u_deltaTime.value = this.deltaTime;
 	this.materialPhase.uniforms.u_deltaTime.value = this.deltaTime;
 	this.materialPhase.uniforms.u_size.value = this.size;
 	this.materialPhase.uniforms.u_size.value = this.size;
 	this.renderer.setRenderTarget( this.pingPhase ? this.pongPhaseFramebuffer : this.pingPhaseFramebuffer );
 	this.renderer.setRenderTarget( this.pingPhase ? this.pongPhaseFramebuffer : this.pingPhaseFramebuffer );
@@ -341,7 +344,9 @@ THREE.Ocean.prototype.renderSpectrumFFT = function () {
 		}
 		}
 
 
 	}
 	}
+
 	this.scene.overrideMaterial = this.materialOceanVertical;
 	this.scene.overrideMaterial = this.materialOceanVertical;
+
 	for ( var i = iterations; i < iterations * 2; i ++ ) {
 	for ( var i = iterations; i < iterations * 2; i ++ ) {
 
 
 		if ( i === iterations * 2 - 1 ) {
 		if ( i === iterations * 2 - 1 ) {

+ 2 - 0
examples/js/misc/Volume.js

@@ -435,6 +435,7 @@ THREE.Volume.prototype = {
 		var datasize = this.data.length;
 		var datasize = this.data.length;
 
 
 		var i = 0;
 		var i = 0;
+
 		for ( i = 0; i < datasize; i ++ ) {
 		for ( i = 0; i < datasize; i ++ ) {
 
 
 			if ( ! isNaN( this.data[ i ] ) ) {
 			if ( ! isNaN( this.data[ i ] ) ) {
@@ -446,6 +447,7 @@ THREE.Volume.prototype = {
 			}
 			}
 
 
 		}
 		}
+
 		this.min = min;
 		this.min = min;
 		this.max = max;
 		this.max = max;
 
 

+ 1 - 0
examples/js/misc/VolumeSlice.js

@@ -169,6 +169,7 @@ THREE.VolumeSlice.prototype = {
 			}
 			}
 
 
 		}
 		}
+
 		ctx.putImageData( imgData, 0, 0 );
 		ctx.putImageData( imgData, 0, 0 );
 		this.ctx.drawImage( canvas, 0, 0, iLength, jLength, 0, 0, this.canvas.width, this.canvas.height );
 		this.ctx.drawImage( canvas, 0, 0, iLength, jLength, 0, 0, this.canvas.width, this.canvas.height );
 
 

+ 7 - 0
examples/js/objects/Fire.js

@@ -89,6 +89,7 @@ THREE.Fire = function ( geometry, options ) {
 						this.sourceData[ stride ] = Math.min( Math.max( density, 0.0 ), 1.0 ) * 255;
 						this.sourceData[ stride ] = Math.min( Math.max( density, 0.0 ), 1.0 ) * 255;
 
 
 					}
 					}
+
 					if ( windX != null ) {
 					if ( windX != null ) {
 
 
 						var wind = Math.min( Math.max( windX, - 1.0 ), 1.0 );
 						var wind = Math.min( Math.max( windX, - 1.0 ), 1.0 );
@@ -96,6 +97,7 @@ THREE.Fire = function ( geometry, options ) {
 						this.sourceData[ stride + 1 ] = wind;
 						this.sourceData[ stride + 1 ] = wind;
 
 
 					}
 					}
+
 					if ( windY != null ) {
 					if ( windY != null ) {
 
 
 						var wind = Math.min( Math.max( windY, - 1.0 ), 1.0 );
 						var wind = Math.min( Math.max( windY, - 1.0 ), 1.0 );
@@ -273,6 +275,7 @@ THREE.Fire = function ( geometry, options ) {
 		shader = THREE.Fire.ColorShader;
 		shader = THREE.Fire.ColorShader;
 
 
 	}
 	}
+
 	this.material = new THREE.ShaderMaterial( {
 	this.material = new THREE.ShaderMaterial( {
 		uniforms: shader.uniforms,
 		uniforms: shader.uniforms,
 		vertexShader: shader.vertexShader,
 		vertexShader: shader.vertexShader,
@@ -434,11 +437,13 @@ THREE.Fire = function ( geometry, options ) {
 	this.onBeforeRender = function ( renderer ) {
 	this.onBeforeRender = function ( renderer ) {
 
 
 		var delta = this.clock.getDelta();
 		var delta = this.clock.getDelta();
+
 		if ( delta > 0.1 ) {
 		if ( delta > 0.1 ) {
 
 
 			delta = 0.1;
 			delta = 0.1;
 
 
 		}
 		}
+
 		var dt = delta * ( this.speed * 0.1 );
 		var dt = delta * ( this.speed * 0.1 );
 
 
 		this.configShaders( dt );
 		this.configShaders( dt );
@@ -460,11 +465,13 @@ THREE.Fire = function ( geometry, options ) {
 		this.renderSource( renderer );
 		this.renderSource( renderer );
 
 
 		this.clearDiffuse();
 		this.clearDiffuse();
+
 		for ( var i = 0; i < 21; i ++ ) {
 		for ( var i = 0; i < 21; i ++ ) {
 
 
 			this.renderDiffuse( renderer );
 			this.renderDiffuse( renderer );
 
 
 		}
 		}
+
 		this.configShaders( dt );
 		this.configShaders( dt );
 		this.renderDiffuse( renderer );
 		this.renderDiffuse( renderer );
 
 

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

@@ -191,11 +191,13 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 			this.luminanceRT.dispose();
 			this.luminanceRT.dispose();
 
 
 		}
 		}
+
 		if ( this.currentLuminanceRT ) {
 		if ( this.currentLuminanceRT ) {
 
 
 			this.currentLuminanceRT.dispose();
 			this.currentLuminanceRT.dispose();
 
 
 		}
 		}
+
 		if ( this.previousLuminanceRT ) {
 		if ( this.previousLuminanceRT ) {
 
 
 			this.previousLuminanceRT.dispose();
 			this.previousLuminanceRT.dispose();
@@ -224,6 +226,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;
 			this.materialToneMap.uniforms.luminanceMap.value = this.luminanceRT.texture;
 
 
 		}
 		}
+
 		//Put something in the adaptive luminance texture so that the scene can render initially
 		//Put something in the adaptive luminance texture so that the scene can render initially
 		this.fsQuad.material = new THREE.MeshBasicMaterial( { color: 0x777777 } );
 		this.fsQuad.material = new THREE.MeshBasicMaterial( { color: 0x777777 } );
 		this.materialLuminance.needsUpdate = true;
 		this.materialLuminance.needsUpdate = true;
@@ -250,6 +253,7 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 			this.materialToneMap.uniforms.luminanceMap.value = null;
 			this.materialToneMap.uniforms.luminanceMap.value = null;
 
 
 		}
 		}
+
 		this.materialToneMap.needsUpdate = true;
 		this.materialToneMap.needsUpdate = true;
 
 
 	},
 	},
@@ -312,31 +316,37 @@ THREE.AdaptiveToneMappingPass.prototype = Object.assign( Object.create( THREE.Pa
 			this.luminanceRT.dispose();
 			this.luminanceRT.dispose();
 
 
 		}
 		}
+
 		if ( this.previousLuminanceRT ) {
 		if ( this.previousLuminanceRT ) {
 
 
 			this.previousLuminanceRT.dispose();
 			this.previousLuminanceRT.dispose();
 
 
 		}
 		}
+
 		if ( this.currentLuminanceRT ) {
 		if ( this.currentLuminanceRT ) {
 
 
 			this.currentLuminanceRT.dispose();
 			this.currentLuminanceRT.dispose();
 
 
 		}
 		}
+
 		if ( this.materialLuminance ) {
 		if ( this.materialLuminance ) {
 
 
 			this.materialLuminance.dispose();
 			this.materialLuminance.dispose();
 
 
 		}
 		}
+
 		if ( this.materialAdaptiveLum ) {
 		if ( this.materialAdaptiveLum ) {
 
 
 			this.materialAdaptiveLum.dispose();
 			this.materialAdaptiveLum.dispose();
 
 
 		}
 		}
+
 		if ( this.materialCopy ) {
 		if ( this.materialCopy ) {
 
 
 			this.materialCopy.dispose();
 			this.materialCopy.dispose();
 
 
 		}
 		}
+
 		if ( this.materialToneMap ) {
 		if ( this.materialToneMap ) {
 
 
 			this.materialToneMap.dispose();
 			this.materialToneMap.dispose();

+ 1 - 1
examples/js/renderers/CSS3DRenderer.js

@@ -210,7 +210,7 @@ THREE.CSS3DRenderer = function () {
 				cache.objects.set( object, objectData );
 				cache.objects.set( object, objectData );
 
 
 			}
 			}
-			
+
 			element.style.display = object.visible ? '' : 'none';
 			element.style.display = object.visible ? '' : 'none';
 
 
 			if ( element.parentNode !== cameraElement ) {
 			if ( element.parentNode !== cameraElement ) {

+ 4 - 4
examples/js/shaders/ACESFilmicToneMappingShader.js

@@ -47,14 +47,14 @@ THREE.ACESFilmicToneMappingShader = {
 
 
 		'vec3 ACESFilmicToneMapping( vec3 color ) {',
 		'vec3 ACESFilmicToneMapping( vec3 color ) {',
 
 
-			// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
+		// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
 		'	const mat3 ACESInputMat = mat3(',
 		'	const mat3 ACESInputMat = mat3(',
 		'		vec3( 0.59719, 0.07600, 0.02840 ),', // transposed from source
 		'		vec3( 0.59719, 0.07600, 0.02840 ),', // transposed from source
 		'		vec3( 0.35458, 0.90834, 0.13383 ),',
 		'		vec3( 0.35458, 0.90834, 0.13383 ),',
 		'		vec3( 0.04823, 0.01566, 0.83777 )',
 		'		vec3( 0.04823, 0.01566, 0.83777 )',
 		'	);',
 		'	);',
 
 
-			// ODT_SAT => XYZ => D60_2_D65 => sRGB
+		// ODT_SAT => XYZ => D60_2_D65 => sRGB
 		'	const mat3 ACESOutputMat = mat3(',
 		'	const mat3 ACESOutputMat = mat3(',
 		'		vec3(  1.60475, -0.10208, -0.00327 ),', // transposed from source
 		'		vec3(  1.60475, -0.10208, -0.00327 ),', // transposed from source
 		'		vec3( -0.53108,  1.10813, -0.07276 ),',
 		'		vec3( -0.53108,  1.10813, -0.07276 ),',
@@ -63,12 +63,12 @@ THREE.ACESFilmicToneMappingShader = {
 
 
 		'	color = ACESInputMat * color;',
 		'	color = ACESInputMat * color;',
 
 
-			// Apply RRT and ODT
+		// Apply RRT and ODT
 		'	color = RRTAndODTFit( color );',
 		'	color = RRTAndODTFit( color );',
 
 
 		'	color = ACESOutputMat * color;',
 		'	color = ACESOutputMat * color;',
 
 
-			// Clamp to [0, 1]
+		// Clamp to [0, 1]
 		'	return saturate( color );',
 		'	return saturate( color );',
 
 
 		'}',
 		'}',

+ 2 - 2
examples/js/utils/BufferGeometryUtils.js

@@ -228,8 +228,8 @@ THREE.BufferGeometryUtils = {
 
 
 			if ( attributesCount !== attributesUsed.size ) {
 			if ( attributesCount !== attributesUsed.size ) {
 
 
-					console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
-					return null;
+				console.error( 'THREE.BufferGeometryUtils: .mergeBufferGeometries() failed with geometry at index ' + i + '. Make sure all geometries have the same number of attributes.' );
+				return null;
 
 
 			}
 			}
 
 

+ 0 - 2
examples/jsm/animation/MMDAnimationHelper.js

@@ -958,8 +958,6 @@ var MMDAnimationHelper = ( function () {
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			// 'duration' can be bigger than 'audioDuration + delayTime' because of sync configuration
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 			if ( ( this.currentTime - this.delayTime ) > this.audioDuration ) return false;
 
 
-			this.audio.startTime = this.currentTime - this.delayTime;
-
 			return true;
 			return true;
 
 
 		},
 		},

+ 2 - 0
examples/jsm/controls/DragControls.js

@@ -53,6 +53,8 @@ var DragControls = function ( _objects, _camera, _domElement ) {
 		_domElement.removeEventListener( 'touchstart', onDocumentTouchStart, false );
 		_domElement.removeEventListener( 'touchstart', onDocumentTouchStart, false );
 		_domElement.removeEventListener( 'touchend', onDocumentTouchEnd, false );
 		_domElement.removeEventListener( 'touchend', onDocumentTouchEnd, false );
 
 
+		_domElement.style.cursor = '';
+
 	}
 	}
 
 
 	function dispose() {
 	function dispose() {

+ 11 - 1
examples/jsm/controls/TransformControls.js

@@ -79,7 +79,7 @@ var TransformControls = function ( camera, domElement ) {
 
 
 		var allIntersections = raycaster.intersectObject( object, true );
 		var allIntersections = raycaster.intersectObject( object, true );
 
 
-		for ( var i = allIntersections.length; i --; ) {
+		for ( var i = 0; i < allIntersections.length; i ++ ) {
 
 
 			if ( allIntersections[ i ].object.visible || includeInvisible ) {
 			if ( allIntersections[ i ].object.visible || includeInvisible ) {
 
 
@@ -495,11 +495,13 @@ var TransformControls = function ( camera, domElement ) {
 					_tempVector2.x = 1;
 					_tempVector2.x = 1;
 
 
 				}
 				}
+
 				if ( axis.search( 'Y' ) === - 1 ) {
 				if ( axis.search( 'Y' ) === - 1 ) {
 
 
 					_tempVector2.y = 1;
 					_tempVector2.y = 1;
 
 
 				}
 				}
+
 				if ( axis.search( 'Z' ) === - 1 ) {
 				if ( axis.search( 'Z' ) === - 1 ) {
 
 
 					_tempVector2.z = 1;
 					_tempVector2.z = 1;
@@ -1101,11 +1103,13 @@ var TransformControlsGizmo = function () {
 					object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
 					object.position.set( position[ 0 ], position[ 1 ], position[ 2 ] );
 
 
 				}
 				}
+
 				if ( rotation ) {
 				if ( rotation ) {
 
 
 					object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
 					object.rotation.set( rotation[ 0 ], rotation[ 1 ], rotation[ 2 ] );
 
 
 				}
 				}
+
 				if ( scale ) {
 				if ( scale ) {
 
 
 					object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
 					object.scale.set( scale[ 0 ], scale[ 1 ], scale[ 2 ] );
@@ -1356,6 +1360,7 @@ var TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'Y' || handle.name === 'XYZY' ) {
 				if ( handle.name === 'Y' || handle.name === 'XYZY' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
@@ -1366,6 +1371,7 @@ var TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'Z' || handle.name === 'XYZZ' ) {
 				if ( handle.name === 'Z' || handle.name === 'XYZZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) > AXIS_HIDE_TRESHOLD ) {
@@ -1376,6 +1382,7 @@ var TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'XY' ) {
 				if ( handle.name === 'XY' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitZ ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1386,6 +1393,7 @@ var TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'YZ' ) {
 				if ( handle.name === 'YZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitX ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1396,6 +1404,7 @@ var TransformControlsGizmo = function () {
 					}
 					}
 
 
 				}
 				}
+
 				if ( handle.name === 'XZ' ) {
 				if ( handle.name === 'XZ' ) {
 
 
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
 					if ( Math.abs( alignVector.copy( unitY ).applyQuaternion( quaternion ).dot( this.eye ) ) < PLANE_HIDE_TRESHOLD ) {
@@ -1646,6 +1655,7 @@ var TransformControlsPlane = function () {
 						break;
 						break;
 
 
 				}
 				}
+
 				break;
 				break;
 			case 'rotate':
 			case 'rotate':
 			default:
 			default:

+ 2 - 0
examples/jsm/csm/CSM.js

@@ -276,6 +276,7 @@ export class CSM {
 			shaders.set( material, shader );
 			shaders.set( material, shader );
 
 
 		};
 		};
+
 		shaders.set( material, null );
 		shaders.set( material, null );
 
 
 	}
 	}
@@ -319,6 +320,7 @@ export class CSM {
 			target.push( new Vector2() );
 			target.push( new Vector2() );
 
 
 		}
 		}
+
 		target.length = this.breaks.length;
 		target.length = this.breaks.length;
 
 
 		for ( let i = 0; i < this.cascades; i ++ ) {
 		for ( let i = 0; i < this.cascades; i ++ ) {

+ 1 - 0
examples/jsm/csm/Frustum.js

@@ -88,6 +88,7 @@ export default class Frustum {
 			target.push( new Frustum() );
 			target.push( new Frustum() );
 
 
 		}
 		}
+
 		target.length = breaks.length;
 		target.length = breaks.length;
 
 
 		for ( let i = 0; i < breaks.length; i ++ ) {
 		for ( let i = 0; i < breaks.length; i ++ ) {

+ 3 - 0
examples/jsm/curves/NURBSUtils.js

@@ -214,6 +214,7 @@ var NURBSUtils = {
 				a[ i ] = zeroArr.slice( 0 );
 				a[ i ] = zeroArr.slice( 0 );
 
 
 			}
 			}
+
 			a[ 0 ][ 0 ] = 1.0;
 			a[ 0 ][ 0 ] = 1.0;
 
 
 			for ( var k = 1; k <= n; ++ k ) {
 			for ( var k = 1; k <= n; ++ k ) {
@@ -265,6 +266,7 @@ var NURBSUtils = {
 				ders[ k ][ j ] *= r;
 				ders[ k ][ j ] *= r;
 
 
 			}
 			}
+
 			r *= p - k;
 			r *= p - k;
 
 
 		}
 		}
@@ -305,6 +307,7 @@ var NURBSUtils = {
 			Pw[ i ] = point;
 			Pw[ i ] = point;
 
 
 		}
 		}
+
 		for ( var k = 0; k <= du; ++ k ) {
 		for ( var k = 0; k <= du; ++ k ) {
 
 
 			var point = Pw[ span - p ].clone().multiplyScalar( nders[ k ][ 0 ] );
 			var point = Pw[ span - p ].clone().multiplyScalar( nders[ k ][ 0 ] );

+ 1 - 0
examples/jsm/effects/AsciiEffect.js

@@ -274,6 +274,7 @@ var AsciiEffect = function ( renderer, charSet, options ) {
 				}
 				}
 
 
 			}
 			}
+
 			strChars += "<br/>";
 			strChars += "<br/>";
 
 
 		}
 		}

+ 1 - 0
examples/jsm/effects/PeppersGhostEffect.js

@@ -46,6 +46,7 @@ var PeppersGhostEffect = function ( renderer ) {
 			_height = height / 3;
 			_height = height / 3;
 
 
 		}
 		}
+
 		renderer.setSize( width, height );
 		renderer.setSize( width, height );
 
 
 	};
 	};

+ 2 - 2
examples/jsm/exporters/ColladaExporter.js

@@ -582,8 +582,8 @@ ColladaExporter.prototype = {
 					matidsArray = new Array( materials.length );
 					matidsArray = new Array( materials.length );
 
 
 				}
 				}
-				matids = matidsArray.fill()
-					.map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );
+
+				matids = matidsArray.fill().map( ( v, i ) => processMaterial( materials[ i % materials.length ] ) );
 
 
 				node +=
 				node +=
 					`<instance_geometry url="#${ meshid }">` +
 					`<instance_geometry url="#${ meshid }">` +

+ 1 - 1
examples/jsm/exporters/DRACOExporter.js

@@ -90,7 +90,7 @@ DRACOExporter.prototype = {
 
 
 			}
 			}
 
 
-			builder.AddFacesToMesh( mesh, vertices.count / 3, faces );
+			builder.AddFacesToMesh( mesh, vertices.count, faces );
 
 
 		}
 		}
 
 

+ 1 - 1
examples/jsm/exporters/GLTFExporter.js

@@ -727,7 +727,7 @@ GLTFExporter.prototype = {
 			if ( attribute.normalized === true ) {
 			if ( attribute.normalized === true ) {
 
 
 				gltfAccessor.normalized = true;
 				gltfAccessor.normalized = true;
-				
+
 			}
 			}
 
 
 			if ( ! outputJSON.accessors ) {
 			if ( ! outputJSON.accessors ) {

+ 1 - 0
examples/jsm/geometries/TeapotBufferGeometry.js

@@ -690,6 +690,7 @@ var TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLid,
 						indices[ indexCount ++ ] = v3;
 						indices[ indexCount ++ ] = v3;
 
 
 					}
 					}
+
 					if ( notDegenerate( v1, v3, v4 ) ) {
 					if ( notDegenerate( v1, v3, v4 ) ) {
 
 
 						indices[ indexCount ++ ] = v1;
 						indices[ indexCount ++ ] = v1;

File diff suppressed because it is too large
+ 19 - 0
examples/jsm/libs/opentype.module.min.js


+ 15 - 15
examples/jsm/libs/stats.module.d.ts

@@ -1,24 +1,24 @@
 declare interface Stats {
 declare interface Stats {
-  REVISION: number;
-  dom: HTMLDivElement;
-  addPanel(panel: Stats.Panel): Stats.Panel;
-  showPanel(id: number): void;
-  begin(): void;
-  end(): void;
-  update(): void;
-  domElement: HTMLDivElement;
-  setMode(id: number): void;
+	REVISION: number;
+	dom: HTMLDivElement;
+	addPanel( panel: Stats.Panel ): Stats.Panel;
+	showPanel( id: number ): void;
+	begin(): void;
+	end(): void;
+	update(): void;
+	domElement: HTMLDivElement;
+	setMode( id: number ): void;
 }
 }
 
 
 declare function Stats(): Stats;
 declare function Stats(): Stats;
 
 
 declare namespace Stats {
 declare namespace Stats {
-  interface Panel {
-    dom: HTMLCanvasElement;
-    update(value: number, maxValue: number): void;
-  }
+	interface Panel {
+		dom: HTMLCanvasElement;
+		update( value: number, maxValue: number ): void;
+	}
 
 
-  function Panel(): Panel;
+	function Panel(): Panel;
 }
 }
 
 
-export default Stats
+export default Stats;

+ 3 - 3
examples/jsm/libs/stats.module.js

@@ -115,9 +115,9 @@ Stats.Panel = function ( name, fg, bg ) {
 	var PR = round( window.devicePixelRatio || 1 );
 	var PR = round( window.devicePixelRatio || 1 );
 
 
 	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
 	var WIDTH = 80 * PR, HEIGHT = 48 * PR,
-			TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
-			GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
-			GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
+		TEXT_X = 3 * PR, TEXT_Y = 2 * PR,
+		GRAPH_X = 3 * PR, GRAPH_Y = 15 * PR,
+		GRAPH_WIDTH = 74 * PR, GRAPH_HEIGHT = 30 * PR;
 
 
 	var canvas = document.createElement( 'canvas' );
 	var canvas = document.createElement( 'canvas' );
 	canvas.width = WIDTH;
 	canvas.width = WIDTH;

+ 1 - 2
examples/jsm/lines/LineMaterial.d.ts

@@ -11,7 +11,6 @@ export interface LineMaterialParameters extends MaterialParameters {
 	dashScale?: number;
 	dashScale?: number;
 	dashSize?: number;
 	dashSize?: number;
 	gapSize?: number;
 	gapSize?: number;
-	opacity?: boolean;
 	linewidth?: number;
 	linewidth?: number;
 	resolution?: Vector2;
 	resolution?: Vector2;
 }
 }
@@ -24,7 +23,7 @@ export class LineMaterial extends ShaderMaterial {
 	dashScale: number;
 	dashScale: number;
 	dashSize: number;
 	dashSize: number;
 	gapSize: number;
 	gapSize: number;
-	opacity: boolean;
+	opacity: number;
 	readonly isLineMaterial: true;
 	readonly isLineMaterial: true;
 	linewidth: number;
 	linewidth: number;
 	resolution: Vector2;
 	resolution: Vector2;

+ 1 - 0
examples/jsm/loaders/3MFLoader.js

@@ -1092,6 +1092,7 @@ ThreeMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 							meshes.push( newMeshes[ j ] );
 							meshes.push( newMeshes[ j ] );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'texture':
 					case 'texture':

+ 1 - 0
examples/jsm/loaders/AMFLoader.js

@@ -302,6 +302,7 @@ AMFLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					}
 					}
 
 
 				}
 				}
+
 				currVerticesNode = currVerticesNode.nextElementSibling;
 				currVerticesNode = currVerticesNode.nextElementSibling;
 
 
 			}
 			}

+ 19 - 4
examples/jsm/loaders/AssimpLoader.js

@@ -71,6 +71,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				return n;
 				return n;
 
 
 			};
 			};
+
 			this.lerp = function ( nextKey, time ) {
 			this.lerp = function ( nextKey, time ) {
 
 
 				time -= this.time;
 				time -= this.time;
@@ -114,6 +115,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				this.keys.push( key );
 				this.keys.push( key );
 
 
 			};
 			};
+
 			this.init = function () {
 			this.init = function () {
 
 
 				this.sortKeys();
 				this.sortKeys();
@@ -157,6 +159,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].targets[ 0 ].data ) );
 					this.addKey( new Virtulous.KeyFrame( i / fps || track[ i ].time, track[ i ].targets[ 0 ].data ) );
 
 
 				}
 				}
+
 				this.init();
 				this.init();
 
 
 			};
 			};
@@ -518,6 +521,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
+
 		function cloneTreeToBones( root, scene ) {
 		function cloneTreeToBones( root, scene ) {
 
 
 			var rootBone = new Bone();
 			var rootBone = new Bone();
@@ -675,6 +679,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					}
 					}
 
 
 				}
 				}
+
 				var skeleton = new Skeleton( allBones, offsetMatrix );
 				var skeleton = new Skeleton( allBones, offsetMatrix );
 
 
 				this.threeNode.bind( skeleton, new Matrix4() );
 				this.threeNode.bind( skeleton, new Matrix4() );
@@ -977,6 +982,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			};
 			};
 
 
 		}
 		}
+
 		var namePropMapping = {
 		var namePropMapping = {
 
 
 			"?mat.name": "name",
 			"?mat.name": "name",
@@ -1769,6 +1775,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// write faces. There are no floating-point calculations involved
 			// write faces. There are no floating-point calculations involved
 			// in these, so we can write a simple hash over the face data
 			// in these, so we can write a simple hash over the face data
 			// to the dump file. We generate a single 32 Bit hash for 512 faces
 			// to the dump file. We generate a single 32 Bit hash for 512 faces
@@ -1834,6 +1841,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// write bones
 			// write bones
 			if ( mesh.mNumBones ) {
 			if ( mesh.mNumBones ) {
 
 
@@ -1896,7 +1904,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryNodeAnim( stream, nd ) {
 		function ReadBinaryNodeAnim( stream, nd ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -1962,7 +1970,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryAnim( stream, anim ) {
 		function ReadBinaryAnim( stream, anim ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -2016,7 +2024,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryLight( stream, l ) {
 		function ReadBinaryLight( stream, l ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -2046,7 +2054,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
-		// -----------------------------------------------------------------------------------
+
 		function ReadBinaryCamera( stream, cam ) {
 		function ReadBinaryCamera( stream, cam ) {
 
 
 			var chunkID = Read_uint32_t( stream );
 			var chunkID = Read_uint32_t( stream );
@@ -2093,6 +2101,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// Read materials
 			// Read materials
 			if ( scene.mNumMaterials ) {
 			if ( scene.mNumMaterials ) {
 
 
@@ -2106,6 +2115,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// Read all animations
 			// Read all animations
 			if ( scene.mNumAnimations ) {
 			if ( scene.mNumAnimations ) {
 
 
@@ -2119,6 +2129,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// Read all textures
 			// Read all textures
 			if ( scene.mNumTextures ) {
 			if ( scene.mNumTextures ) {
 
 
@@ -2132,6 +2143,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// Read lights
 			// Read lights
 			if ( scene.mNumLights ) {
 			if ( scene.mNumLights ) {
 
 
@@ -2145,6 +2157,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			// Read cameras
 			// Read cameras
 			if ( scene.mNumCameras ) {
 			if ( scene.mNumCameras ) {
 
 
@@ -2160,6 +2173,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
+
 		var aiOrigin_CUR = 0;
 		var aiOrigin_CUR = 0;
 		var aiOrigin_BEG = 1;
 		var aiOrigin_BEG = 1;
 
 
@@ -2173,6 +2187,7 @@ AssimpLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					stream.readOffset += off;
 					stream.readOffset += off;
 
 
 				}
 				}
+
 				if ( ori == aiOrigin_BEG ) {
 				if ( ori == aiOrigin_BEG ) {
 
 
 					stream.readOffset = off;
 					stream.readOffset = off;

+ 1 - 0
examples/jsm/loaders/BVHLoader.js

@@ -394,6 +394,7 @@ BVHLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			var line;
 			var line;
 			// skip empty lines
 			// skip empty lines
 			while ( ( line = lines.shift().trim() ).length === 0 ) { }
 			while ( ( line = lines.shift().trim() ).length === 0 ) { }
+
 			return line;
 			return line;
 
 
 		}
 		}

+ 20 - 7
examples/jsm/loaders/ColladaLoader.js

@@ -257,6 +257,8 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				channels: {}
 				channels: {}
 			};
 			};
 
 
+			var hasChildren = false;
+
 			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
 			for ( var i = 0, l = xml.childNodes.length; i < l; i ++ ) {
 
 
 				var child = xml.childNodes[ i ];
 				var child = xml.childNodes[ i ];
@@ -282,6 +284,12 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 						data.channels[ id ] = parseAnimationChannel( child );
 						data.channels[ id ] = parseAnimationChannel( child );
 						break;
 						break;
 
 
+					case 'animation':
+						// hierarchy of related animations
+						parseAnimation( child );
+						hasChildren = true;
+						break;
+
 					default:
 					default:
 						console.log( child );
 						console.log( child );
 
 
@@ -289,7 +297,13 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 
 			}
 			}
 
 
-			library.animations[ xml.getAttribute( 'id' ) ] = data;
+			if ( hasChildren === false ) {
+
+				// since 'id' attributes can be optional, it's necessary to generate a UUID for unqiue assignment
+
+				library.animations[ xml.getAttribute( 'id' ) || MathUtils.generateUUID() ] = data;
+
+			}
 
 
 		}
 		}
 
 
@@ -2096,6 +2110,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 							data.stride = parseInt( accessor.getAttribute( 'stride' ) );
 							data.stride = parseInt( accessor.getAttribute( 'stride' ) );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 				}
 				}
@@ -2368,6 +2383,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 											}
 											}
 
 
 										}
 										}
+
 										break;
 										break;
 
 
 									case 'NORMAL':
 									case 'NORMAL':
@@ -2396,6 +2412,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 								}
 								}
 
 
 							}
 							}
+
 							break;
 							break;
 
 
 						case 'NORMAL':
 						case 'NORMAL':
@@ -3595,12 +3612,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 
 			}
 			}
 
 
-			if ( object.name === '' ) {
-
-				object.name = ( type === 'JOINT' ) ? data.sid : data.name;
-
-			}
-
+			object.name = ( type === 'JOINT' ) ? data.sid : data.name;
 			object.matrix.copy( matrix );
 			object.matrix.copy( matrix );
 			object.matrix.decompose( object.position, object.quaternion, object.scale );
 			object.matrix.decompose( object.position, object.quaternion, object.scale );
 
 
@@ -3704,6 +3716,7 @@ ColladaLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 							object = new Mesh( geometry.data, material );
 							object = new Mesh( geometry.data, material );
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 				}
 				}

+ 1 - 0
examples/jsm/loaders/DDSLoader.js

@@ -105,6 +105,7 @@ DDSLoader.prototype = Object.assign( Object.create( CompressedTextureLoader.prot
 				}
 				}
 
 
 			}
 			}
+
 			return byteArray;
 			return byteArray;
 
 
 		}
 		}

+ 70 - 17
examples/jsm/loaders/EXRLoader.js

@@ -113,6 +113,10 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 		const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
 		const HUF_DECSIZE = 1 << HUF_DECBITS; // decoding table size
 		const HUF_DECMASK = HUF_DECSIZE - 1;
 		const HUF_DECMASK = HUF_DECSIZE - 1;
 
 
+		const NBITS = 16;
+		const A_OFFSET = 1 << ( NBITS - 1 );
+		const MOD_MASK = ( 1 << NBITS ) - 1;
+
 		const SHORT_ZEROCODE_RUN = 59;
 		const SHORT_ZEROCODE_RUN = 59;
 		const LONG_ZEROCODE_RUN = 63;
 		const LONG_ZEROCODE_RUN = 63;
 		const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
 		const SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;
@@ -147,6 +151,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 				bits = ( ( tmpDataView.getUint32( 0 ) >>> 20 ) & 0x7FF ) - 64;
 				bits = ( ( tmpDataView.getUint32( 0 ) >>> 20 ) & 0x7FF ) - 64;
 
 
 			}
 			}
+
 			var exponent = bits - 1022;
 			var exponent = bits - 1022;
 			var mantissa = ldexp( value, - exponent );
 			var mantissa = ldexp( value, - exponent );
 
 
@@ -486,8 +491,22 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 
 
 		}
 		}
 
 
-		function wav2Decode( buffer, j, nx, ox, ny, oy ) {
+		function wdec16( l, h ) {
+
+			var m = UInt16( l );
+			var d = UInt16( h );
+
+			var bb = ( m - ( d >> 1 ) ) & MOD_MASK;
+			var aa = ( d + bb - A_OFFSET ) & MOD_MASK;
+
+			wdec14Return.a = aa;
+			wdec14Return.b = bb;
+
+		}
+
+		function wav2Decode( buffer, j, nx, ox, ny, oy, mx ) {
 
 
+			var w14 = mx < ( 1 << 14 );
 			var n = ( nx > ny ) ? ny : nx;
 			var n = ( nx > ny ) ? ny : nx;
 			var p = 1;
 			var p = 1;
 			var p2;
 			var p2;
@@ -519,25 +538,52 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 						var p10 = px + oy1;
 						var p10 = px + oy1;
 						var p11 = p10 + ox1;
 						var p11 = p10 + ox1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						if ( w14 ) {
 
 
-						i00 = wdec14Return.a;
-						i10 = wdec14Return.b;
+							wdec14( buffer[ px + j ], buffer[ p10 + j ] );
 
 
-						wdec14( buffer[ p01 + j ], buffer[ p11 + j ] );
+							i00 = wdec14Return.a;
+							i10 = wdec14Return.b;
 
 
-						i01 = wdec14Return.a;
-						i11 = wdec14Return.b;
+							wdec14( buffer[ p01 + j ], buffer[ p11 + j ] );
 
 
-						wdec14( i00, i01 );
+							i01 = wdec14Return.a;
+							i11 = wdec14Return.b;
 
 
-						buffer[ px + j ] = wdec14Return.a;
-						buffer[ p01 + j ] = wdec14Return.b;
+							wdec14( i00, i01 );
+
+							buffer[ px + j ] = wdec14Return.a;
+							buffer[ p01 + j ] = wdec14Return.b;
+
+							wdec14( i10, i11 );
 
 
-						wdec14( i10, i11 );
+							buffer[ p10 + j ] = wdec14Return.a;
+							buffer[ p11 + j ] = wdec14Return.b;
 
 
-						buffer[ p10 + j ] = wdec14Return.a;
-						buffer[ p11 + j ] = wdec14Return.b;
+						} else {
+
+							wdec16( buffer[ px + j ], buffer[ p10 + j ] );
+
+							i00 = wdec14Return.a;
+							i10 = wdec14Return.b;
+
+							wdec16( buffer[ p01 + j ], buffer[ p11 + j ] );
+
+							i01 = wdec14Return.a;
+							i11 = wdec14Return.b;
+
+							wdec16( i00, i01 );
+
+							buffer[ px + j ] = wdec14Return.a;
+							buffer[ p01 + j ] = wdec14Return.b;
+
+							wdec16( i10, i11 );
+
+							buffer[ p10 + j ] = wdec14Return.a;
+							buffer[ p11 + j ] = wdec14Return.b;
+
+
+						}
 
 
 					}
 					}
 
 
@@ -545,7 +591,10 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 
 
 						var p10 = px + oy1;
 						var p10 = px + oy1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						if ( w14 )
+							wdec14( buffer[ px + j ], buffer[ p10 + j ] );
+						else
+							wdec16( buffer[ px + j ], buffer[ p10 + j ] );
 
 
 						i00 = wdec14Return.a;
 						i00 = wdec14Return.a;
 						buffer[ p10 + j ] = wdec14Return.b;
 						buffer[ p10 + j ] = wdec14Return.b;
@@ -565,7 +614,10 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 
 
 						var p01 = px + ox1;
 						var p01 = px + ox1;
 
 
-						wdec14( buffer[ px + j ], buffer[ p01 + j ] );
+						if ( w14 )
+							wdec14( buffer[ px + j ], buffer[ p01 + j ] );
+						else
+							wdec16( buffer[ px + j ], buffer[ p01 + j ] );
 
 
 						i00 = wdec14Return.a;
 						i00 = wdec14Return.a;
 						buffer[ p01 + j ] = wdec14Return.b;
 						buffer[ p01 + j ] = wdec14Return.b;
@@ -1308,7 +1360,7 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 
 
 			// Reverse LUT
 			// Reverse LUT
 			var lut = new Uint16Array( USHORT_RANGE );
 			var lut = new Uint16Array( USHORT_RANGE );
-			reverseLutFromBitmap( bitmap, lut );
+			var maxValue = reverseLutFromBitmap( bitmap, lut );
 
 
 			var length = parseUint32( inDataView, inOffset );
 			var length = parseUint32( inDataView, inOffset );
 
 
@@ -1328,7 +1380,8 @@ EXRLoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 						cd.nx,
 						cd.nx,
 						cd.size,
 						cd.size,
 						cd.ny,
 						cd.ny,
-						cd.nx * cd.size
+						cd.nx * cd.size,
+						maxValue
 					);
 					);
 
 
 				}
 				}

+ 5 - 0
examples/jsm/loaders/FBXLoader.js

@@ -535,6 +535,7 @@ var FBXLoader = ( function () {
 				parameters.bumpScale = materialNode.BumpFactor.value;
 				parameters.bumpScale = materialNode.BumpFactor.value;
 
 
 			}
 			}
+
 			if ( materialNode.Diffuse ) {
 			if ( materialNode.Diffuse ) {
 
 
 				parameters.color = new Color().fromArray( materialNode.Diffuse.value );
 				parameters.color = new Color().fromArray( materialNode.Diffuse.value );
@@ -2736,12 +2737,14 @@ var FBXLoader = ( function () {
 				curves.x.values = curves.x.values.map( MathUtils.degToRad );
 				curves.x.values = curves.x.values.map( MathUtils.degToRad );
 
 
 			}
 			}
+
 			if ( curves.y !== undefined ) {
 			if ( curves.y !== undefined ) {
 
 
 				this.interpolateRotations( curves.y );
 				this.interpolateRotations( curves.y );
 				curves.y.values = curves.y.values.map( MathUtils.degToRad );
 				curves.y.values = curves.y.values.map( MathUtils.degToRad );
 
 
 			}
 			}
+
 			if ( curves.z !== undefined ) {
 			if ( curves.z !== undefined ) {
 
 
 				this.interpolateRotations( curves.z );
 				this.interpolateRotations( curves.z );
@@ -3914,12 +3917,14 @@ var FBXLoader = ( function () {
 
 
 		var versionRegExp = /FBXVersion: (\d+)/;
 		var versionRegExp = /FBXVersion: (\d+)/;
 		var match = text.match( versionRegExp );
 		var match = text.match( versionRegExp );
+
 		if ( match ) {
 		if ( match ) {
 
 
 			var version = parseInt( match[ 1 ] );
 			var version = parseInt( match[ 1 ] );
 			return version;
 			return version;
 
 
 		}
 		}
+
 		throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' );
 		throw new Error( 'THREE.FBXLoader: Cannot find the version number for the file given.' );
 
 
 	}
 	}

+ 5 - 0
examples/jsm/loaders/KTXLoader.js

@@ -104,24 +104,28 @@ var KhronosTextureContainer = ( function () {
 			this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels );
 			this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels );
 
 
 		}
 		}
+
 		if ( this.pixelHeight === 0 || this.pixelDepth !== 0 ) {
 		if ( this.pixelHeight === 0 || this.pixelDepth !== 0 ) {
 
 
 			console.warn( 'only 2D textures currently supported' );
 			console.warn( 'only 2D textures currently supported' );
 			return;
 			return;
 
 
 		}
 		}
+
 		if ( this.numberOfArrayElements !== 0 ) {
 		if ( this.numberOfArrayElements !== 0 ) {
 
 
 			console.warn( 'texture arrays not currently supported' );
 			console.warn( 'texture arrays not currently supported' );
 			return;
 			return;
 
 
 		}
 		}
+
 		if ( this.numberOfFaces !== facesExpected ) {
 		if ( this.numberOfFaces !== facesExpected ) {
 
 
 			console.warn( 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces );
 			console.warn( 'number of faces expected' + facesExpected + ', but found ' + this.numberOfFaces );
 			return;
 			return;
 
 
 		}
 		}
+
 		// we now have a completely validated file, so could use existence of loadType as success
 		// we now have a completely validated file, so could use existence of loadType as success
 		// would need to make this more elaborate & adjust checks above to support more than one load type
 		// would need to make this more elaborate & adjust checks above to support more than one load type
 		this.loadType = KhronosTextureContainer.COMPRESSED_2D;
 		this.loadType = KhronosTextureContainer.COMPRESSED_2D;
@@ -154,6 +158,7 @@ var KhronosTextureContainer = ( function () {
 				dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
 				dataOffset += 3 - ( ( imageSize + 3 ) % 4 ); // add padding for odd sized image
 
 
 			}
 			}
+
 			width = Math.max( 1.0, width * 0.5 );
 			width = Math.max( 1.0, width * 0.5 );
 			height = Math.max( 1.0, height * 0.5 );
 			height = Math.max( 1.0, height * 0.5 );
 
 

+ 13 - 1
examples/jsm/loaders/LDrawLoader.js

@@ -843,6 +843,7 @@ var LDrawLoader = ( function () {
 							throw 'LDrawLoader: Invalid colour while parsing material' + lineParser.getLineNumberString() + ".";
 							throw 'LDrawLoader: Invalid colour while parsing material' + lineParser.getLineNumberString() + ".";
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case "EDGE":
 					case "EDGE":
@@ -866,6 +867,7 @@ var LDrawLoader = ( function () {
 							edgeMaterial = edgeMaterial.userData.edgeMaterial;
 							edgeMaterial = edgeMaterial.userData.edgeMaterial;
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case 'ALPHA':
 					case 'ALPHA':
@@ -1102,6 +1104,7 @@ var LDrawLoader = ( function () {
 					colourCode = mainColourCode;
 					colourCode = mainColourCode;
 
 
 				}
 				}
+
 				if ( forEdge && colourCode === '24' ) {
 				if ( forEdge && colourCode === '24' ) {
 
 
 					colourCode = mainEdgeColourCode;
 					colourCode = mainEdgeColourCode;
@@ -1237,6 +1240,7 @@ var LDrawLoader = ( function () {
 										console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() );
 										console.warn( 'LDrawLoader: Error parsing material' + lp.getLineNumberString() );
 
 
 									}
 									}
+
 									break;
 									break;
 
 
 								case '!CATEGORY':
 								case '!CATEGORY':
@@ -1262,6 +1266,7 @@ var LDrawLoader = ( function () {
 										} );
 										} );
 
 
 									}
 									}
+
 									break;
 									break;
 
 
 								case 'FILE':
 								case 'FILE':
@@ -1714,8 +1719,8 @@ var LDrawLoader = ( function () {
 				var isRoot = ! parentParseScope.isFromParse;
 				var isRoot = ! parentParseScope.isFromParse;
 				if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
 				if ( scope.separateObjects && ! isPrimitiveType( parseScope.type ) || isRoot ) {
 
 
-
 					const objGroup = parseScope.groupObject;
 					const objGroup = parseScope.groupObject;
+
 					if ( parseScope.triangles.length > 0 ) {
 					if ( parseScope.triangles.length > 0 ) {
 
 
 						objGroup.add( createObject( parseScope.triangles, 3 ) );
 						objGroup.add( createObject( parseScope.triangles, 3 ) );
@@ -1759,12 +1764,14 @@ var LDrawLoader = ( function () {
 					for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
 					for ( var i = 0, l = lineSegments.length; i < l; i ++ ) {
 
 
 						var ls = lineSegments[ i ];
 						var ls = lineSegments[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							ls.v0.applyMatrix4( parseScope.matrix );
 							ls.v0.applyMatrix4( parseScope.matrix );
 							ls.v1.applyMatrix4( parseScope.matrix );
 							ls.v1.applyMatrix4( parseScope.matrix );
 
 
 						}
 						}
+
 						parentLineSegments.push( ls );
 						parentLineSegments.push( ls );
 
 
 					}
 					}
@@ -1772,6 +1779,7 @@ var LDrawLoader = ( function () {
 					for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) {
 					for ( var i = 0, l = conditionalSegments.length; i < l; i ++ ) {
 
 
 						var os = conditionalSegments[ i ];
 						var os = conditionalSegments[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							os.v0.applyMatrix4( parseScope.matrix );
 							os.v0.applyMatrix4( parseScope.matrix );
@@ -1780,6 +1788,7 @@ var LDrawLoader = ( function () {
 							os.c1.applyMatrix4( parseScope.matrix );
 							os.c1.applyMatrix4( parseScope.matrix );
 
 
 						}
 						}
+
 						parentConditionalSegments.push( os );
 						parentConditionalSegments.push( os );
 
 
 					}
 					}
@@ -1787,6 +1796,7 @@ var LDrawLoader = ( function () {
 					for ( var i = 0, l = triangles.length; i < l; i ++ ) {
 					for ( var i = 0, l = triangles.length; i < l; i ++ ) {
 
 
 						var tri = triangles[ i ];
 						var tri = triangles[ i ];
+
 						if ( separateObjects ) {
 						if ( separateObjects ) {
 
 
 							tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix );
 							tri.v0 = tri.v0.clone().applyMatrix4( parseScope.matrix );
@@ -1798,6 +1808,7 @@ var LDrawLoader = ( function () {
 							tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize();
 							tri.faceNormal.crossVectors( tempVec0, tempVec1 ).normalize();
 
 
 						}
 						}
+
 						parentTriangles.push( tri );
 						parentTriangles.push( tri );
 
 
 					}
 					}
@@ -1890,6 +1901,7 @@ var LDrawLoader = ( function () {
 							newLocationState = LDrawLoader.FILE_LOCATION_AS_IS;
 							newLocationState = LDrawLoader.FILE_LOCATION_AS_IS;
 
 
 						}
 						}
+
 						break;
 						break;
 
 
 					case LDrawLoader.FILE_LOCATION_NOT_FOUND:
 					case LDrawLoader.FILE_LOCATION_NOT_FOUND:

+ 1 - 0
examples/jsm/loaders/LWOLoader.js

@@ -1044,6 +1044,7 @@ IFFParser.prototype = {
 					this.parseClip( length );
 					this.parseClip( length );
 
 
 				}
 				}
+
 				break;
 				break;
 
 
 			case 'STIL':
 			case 'STIL':

+ 18 - 0
examples/jsm/loaders/NRRDLoader.js

@@ -178,16 +178,19 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				}
 				}
 
 
 			}
 			}
+
 			if ( ! headerObject.isNrrd ) {
 			if ( ! headerObject.isNrrd ) {
 
 
 				throw new Error( 'Not an NRRD file' );
 				throw new Error( 'Not an NRRD file' );
 
 
 			}
 			}
+
 			if ( headerObject.encoding === 'bz2' || headerObject.encoding === 'bzip2' ) {
 			if ( headerObject.encoding === 'bz2' || headerObject.encoding === 'bzip2' ) {
 
 
 				throw new Error( 'Bzip is not supported' );
 				throw new Error( 'Bzip is not supported' );
 
 
 			}
 			}
+
 			if ( ! headerObject.vectors ) {
 			if ( ! headerObject.vectors ) {
 
 
 				//if no space direction is set, let's use the identity
 				//if no space direction is set, let's use the identity
@@ -240,6 +243,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				parsingFunction = parseFloat;
 				parsingFunction = parseFloat;
 
 
 			}
 			}
+
 			for ( var i = start; i < end; i ++ ) {
 			for ( var i = start; i < end; i ++ ) {
 
 
 				value = data[ i ];
 				value = data[ i ];
@@ -256,17 +260,20 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 						resultIndex ++;
 						resultIndex ++;
 
 
 					}
 					}
+
 					number = '';
 					number = '';
 
 
 				}
 				}
 
 
 			}
 			}
+
 			if ( number !== '' ) {
 			if ( number !== '' ) {
 
 
 				result[ resultIndex ] = parsingFunction( number, base );
 				result[ resultIndex ] = parsingFunction( number, base );
 				resultIndex ++;
 				resultIndex ++;
 
 
 			}
 			}
+
 			return result;
 			return result;
 
 
 		}
 		}
@@ -290,6 +297,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			}
 			}
 
 
 		}
 		}
+
 		// parse the header
 		// parse the header
 		parseHeader( _header );
 		parseHeader( _header );
 
 
@@ -319,6 +327,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			_data = _copy;
 			_data = _copy;
 
 
 		}
 		}
+
 		// .. let's use the underlying array buffer
 		// .. let's use the underlying array buffer
 		_data = _data.buffer;
 		_data = _data.buffer;
 
 
@@ -401,6 +410,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			volume.lowerThreshold = min;
 			volume.lowerThreshold = min;
 
 
 		}
 		}
+
 		if ( volume.upperThreshold === Infinity ) {
 		if ( volume.upperThreshold === Infinity ) {
 
 
 			volume.upperThreshold = max;
 			volume.upperThreshold = max;
@@ -419,6 +429,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 			start = 0;
 			start = 0;
 
 
 		}
 		}
+
 		if ( end === undefined ) {
 		if ( end === undefined ) {
 
 
 			end = array.length;
 			end = array.length;
@@ -523,12 +534,14 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 				var _i, _len, _ref, _results;
 				var _i, _len, _ref, _results;
 				_ref = data.split( /\s+/ );
 				_ref = data.split( /\s+/ );
 				_results = [];
 				_results = [];
+
 				for ( _i = 0, _len = _ref.length; _i < _len; _i ++ ) {
 				for ( _i = 0, _len = _ref.length; _i < _len; _i ++ ) {
 
 
 					i = _ref[ _i ];
 					i = _ref[ _i ];
 					_results.push( parseInt( i, 10 ) );
 					_results.push( parseInt( i, 10 ) );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();
@@ -555,6 +568,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 
 				var _i, _len, _results;
 				var _i, _len, _results;
 				_results = [];
 				_results = [];
+
 				for ( _i = 0, _len = parts.length; _i < _len; _i ++ ) {
 				for ( _i = 0, _len = parts.length; _i < _len; _i ++ ) {
 
 
 					v = parts[ _i ];
 					v = parts[ _i ];
@@ -563,17 +577,20 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 						var _j, _len2, _ref, _results2;
 						var _j, _len2, _ref, _results2;
 						_ref = v.slice( 1, - 1 ).split( /,/ );
 						_ref = v.slice( 1, - 1 ).split( /,/ );
 						_results2 = [];
 						_results2 = [];
+
 						for ( _j = 0, _len2 = _ref.length; _j < _len2; _j ++ ) {
 						for ( _j = 0, _len2 = _ref.length; _j < _len2; _j ++ ) {
 
 
 							f = _ref[ _j ];
 							f = _ref[ _j ];
 							_results2.push( parseFloat( f ) );
 							_results2.push( parseFloat( f ) );
 
 
 						}
 						}
+
 						return _results2;
 						return _results2;
 
 
 					} )() );
 					} )() );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();
@@ -594,6 +611,7 @@ NRRDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 					_results.push( parseFloat( f ) );
 					_results.push( parseFloat( f ) );
 
 
 				}
 				}
+
 				return _results;
 				return _results;
 
 
 			} )();
 			} )();

+ 82 - 22
examples/jsm/loaders/OBJLoader.js

@@ -14,7 +14,8 @@ import {
 	Mesh,
 	Mesh,
 	MeshPhongMaterial,
 	MeshPhongMaterial,
 	Points,
 	Points,
-	PointsMaterial
+	PointsMaterial,
+	Vector3
 } from "../../../build/three.module.js";
 } from "../../../build/three.module.js";
 
 
 var OBJLoader = ( function () {
 var OBJLoader = ( function () {
@@ -28,6 +29,13 @@ var OBJLoader = ( function () {
 	// usemap map_name
 	// usemap map_name
 	var map_use_pattern = /^usemap /;
 	var map_use_pattern = /^usemap /;
 
 
+	var vA = new Vector3();
+	var vB = new Vector3();
+	var vC = new Vector3();
+
+	var ab = new Vector3();
+	var cb = new Vector3();
+
 	function ParserState() {
 	function ParserState() {
 
 
 		var state = {
 		var state = {
@@ -70,7 +78,9 @@ var OBJLoader = ( function () {
 						vertices: [],
 						vertices: [],
 						normals: [],
 						normals: [],
 						colors: [],
 						colors: [],
-						uvs: []
+						uvs: [],
+						hasNormalIndices: false,
+						hasUVIndices: false
 					},
 					},
 					materials: [],
 					materials: [],
 					smooth: true,
 					smooth: true,
@@ -263,14 +273,35 @@ var OBJLoader = ( function () {
 
 
 			},
 			},
 
 
+			addFaceNormal: function ( a, b, c ) {
+
+				var src = this.vertices;
+				var dst = this.object.geometry.normals;
+
+				vA.fromArray( src, a );
+				vB.fromArray( src, b );
+				vC.fromArray( src, c );
+
+				cb.subVectors( vC, vB );
+				ab.subVectors( vA, vB );
+				cb.cross( ab );
+
+				cb.normalize();
+
+				dst.push( cb.x, cb.y, cb.z );
+				dst.push( cb.x, cb.y, cb.z );
+				dst.push( cb.x, cb.y, cb.z );
+
+			},
+
 			addColor: function ( a, b, c ) {
 			addColor: function ( a, b, c ) {
 
 
 				var src = this.colors;
 				var src = this.colors;
 				var dst = this.object.geometry.colors;
 				var dst = this.object.geometry.colors;
 
 
-				dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
-				dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
-				dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
+				if ( src[ a ] !== undefined ) dst.push( src[ a + 0 ], src[ a + 1 ], src[ a + 2 ] );
+				if ( src[ b ] !== undefined ) dst.push( src[ b + 0 ], src[ b + 1 ], src[ b + 2 ] );
+				if ( src[ c ] !== undefined ) dst.push( src[ c + 0 ], src[ c + 1 ], src[ c + 2 ] );
 
 
 			},
 			},
 
 
@@ -285,6 +316,16 @@ var OBJLoader = ( function () {
 
 
 			},
 			},
 
 
+			addDefaultUV: function () {
+
+				var dst = this.object.geometry.uvs;
+
+				dst.push( 0, 0 );
+				dst.push( 0, 0 );
+				dst.push( 0, 0 );
+
+			},
+
 			addUVLine: function ( a ) {
 			addUVLine: function ( a ) {
 
 
 				var src = this.uvs;
 				var src = this.uvs;
@@ -303,33 +344,47 @@ var OBJLoader = ( function () {
 				var ic = this.parseVertexIndex( c, vLen );
 				var ic = this.parseVertexIndex( c, vLen );
 
 
 				this.addVertex( ia, ib, ic );
 				this.addVertex( ia, ib, ic );
+				this.addColor( ia, ib, ic );
+
+				// normals
+
+				if ( na !== undefined && na !== '' ) {
 
 
-				if ( this.colors.length > 0 ) {
+					var nLen = this.normals.length;
 
 
-					this.addColor( ia, ib, ic );
+					ia = this.parseNormalIndex( na, nLen );
+					ib = this.parseNormalIndex( nb, nLen );
+					ic = this.parseNormalIndex( nc, nLen );
+
+					this.addNormal( ia, ib, ic );
+
+					this.object.geometry.hasNormalIndices = true;
+
+				} else {
+
+					this.addFaceNormal( ia, ib, ic );
 
 
 				}
 				}
 
 
+				// uvs
+
 				if ( ua !== undefined && ua !== '' ) {
 				if ( ua !== undefined && ua !== '' ) {
 
 
 					var uvLen = this.uvs.length;
 					var uvLen = this.uvs.length;
+
 					ia = this.parseUVIndex( ua, uvLen );
 					ia = this.parseUVIndex( ua, uvLen );
 					ib = this.parseUVIndex( ub, uvLen );
 					ib = this.parseUVIndex( ub, uvLen );
 					ic = this.parseUVIndex( uc, uvLen );
 					ic = this.parseUVIndex( uc, uvLen );
-					this.addUV( ia, ib, ic );
 
 
-				}
+					this.addUV( ia, ib, ic );
 
 
-				if ( na !== undefined && na !== '' ) {
+					this.object.geometry.hasUVIndices = true;
 
 
-					// Normals are many times the same. If so, skip function call and parseInt.
-					var nLen = this.normals.length;
-					ia = this.parseNormalIndex( na, nLen );
+				} else {
 
 
-					ib = na === nb ? ia : this.parseNormalIndex( nb, nLen );
-					ic = na === nc ? ia : this.parseNormalIndex( nc, nLen );
+					// add placeholder values (for inconsistent face definitions)
 
 
-					this.addNormal( ia, ib, ic );
+					this.addDefaultUV();
 
 
 				}
 				}
 
 
@@ -476,7 +531,14 @@ var OBJLoader = ( function () {
 
 
 								);
 								);
 
 
+							} else {
+
+								// if no colors are defined, add placeholders so color and vertex indices match
+
+								state.colors.push( undefined, undefined, undefined );
+
 							}
 							}
+
 							break;
 							break;
 						case 'vn':
 						case 'vn':
 							state.normals.push(
 							state.normals.push(
@@ -553,6 +615,7 @@ var OBJLoader = ( function () {
 						}
 						}
 
 
 					}
 					}
+
 					state.addLineGeometry( lineVertices, lineUVs );
 					state.addLineGeometry( lineVertices, lineUVs );
 
 
 				} else if ( lineFirstChar === 'p' ) {
 				} else if ( lineFirstChar === 'p' ) {
@@ -628,6 +691,7 @@ var OBJLoader = ( function () {
 						state.object.smooth = true;
 						state.object.smooth = true;
 
 
 					}
 					}
+
 					var material = state.object.currentMaterial();
 					var material = state.object.currentMaterial();
 					if ( material ) material.smooth = state.object.smooth;
 					if ( material ) material.smooth = state.object.smooth;
 
 
@@ -663,14 +727,10 @@ var OBJLoader = ( function () {
 
 
 				buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) );
 				buffergeometry.setAttribute( 'position', new Float32BufferAttribute( geometry.vertices, 3 ) );
 
 
-				if ( geometry.normals.length > 0 ) {
+				if ( geometry.hasNormalIndices === true ) {
 
 
 					buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
 					buffergeometry.setAttribute( 'normal', new Float32BufferAttribute( geometry.normals, 3 ) );
 
 
-				} else {
-
-					buffergeometry.computeVertexNormals();
-
 				}
 				}
 
 
 				if ( geometry.colors.length > 0 ) {
 				if ( geometry.colors.length > 0 ) {
@@ -680,7 +740,7 @@ var OBJLoader = ( function () {
 
 
 				}
 				}
 
 
-				if ( geometry.uvs.length > 0 ) {
+				if ( geometry.hasUVIndices === true ) {
 
 
 					buffergeometry.setAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) );
 					buffergeometry.setAttribute( 'uv', new Float32BufferAttribute( geometry.uvs, 2 ) );
 
 

+ 12 - 0
examples/jsm/loaders/OBJLoader2.js

@@ -39,6 +39,7 @@ const OBJLoader2 = function ( manager ) {
 		scope._onAssetAvailable( payload );
 		scope._onAssetAvailable( payload );
 
 
 	};
 	};
+
 	this.parser.setCallbackOnAssetAvailable( defaultOnAssetAvailable );
 	this.parser.setCallbackOnAssetAvailable( defaultOnAssetAvailable );
 
 
 };
 };
@@ -239,26 +240,31 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 			this.parser.setCallbackOnLoad( onLoad );
 			this.parser.setCallbackOnLoad( onLoad );
 
 
 		}
 		}
+
 		if ( onError === null || onError === undefined || ! ( onError instanceof Function ) ) {
 		if ( onError === null || onError === undefined || ! ( onError instanceof Function ) ) {
 
 
 			onError = function ( event ) {
 			onError = function ( event ) {
 
 
 				let errorMessage = event;
 				let errorMessage = event;
+
 				if ( event.currentTarget && event.currentTarget.statusText !== null ) {
 				if ( event.currentTarget && event.currentTarget.statusText !== null ) {
 
 
 					errorMessage = 'Error occurred while downloading!\nurl: ' + event.currentTarget.responseURL + '\nstatus: ' + event.currentTarget.statusText;
 					errorMessage = 'Error occurred while downloading!\nurl: ' + event.currentTarget.responseURL + '\nstatus: ' + event.currentTarget.statusText;
 
 
 				}
 				}
+
 				scope.parser.callbacks.onError( errorMessage );
 				scope.parser.callbacks.onError( errorMessage );
 
 
 			};
 			};
 
 
 		}
 		}
+
 		if ( ! url ) {
 		if ( ! url ) {
 
 
 			onError( 'An invalid url was provided. Unable to continue!' );
 			onError( 'An invalid url was provided. Unable to continue!' );
 
 
 		}
 		}
+
 		let urlFull = new URL( url, window.location.href ).href;
 		let urlFull = new URL( url, window.location.href ).href;
 		let filename = urlFull;
 		let filename = urlFull;
 		let urlParts = urlFull.split( '/' );
 		let urlParts = urlFull.split( '/' );
@@ -268,6 +274,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 			this.path = urlParts.slice( 0, urlParts.length - 1 ).join( '/' ) + '/';
 			this.path = urlParts.slice( 0, urlParts.length - 1 ).join( '/' ) + '/';
 
 
 		}
 		}
+
 		if ( onFileLoadProgress === null || onFileLoadProgress === undefined || ! ( onFileLoadProgress instanceof Function ) ) {
 		if ( onFileLoadProgress === null || onFileLoadProgress === undefined || ! ( onFileLoadProgress instanceof Function ) ) {
 
 
 			let numericalValueRef = 0;
 			let numericalValueRef = 0;
@@ -277,6 +284,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 				if ( ! event.lengthComputable ) return;
 				if ( ! event.lengthComputable ) return;
 
 
 				numericalValue = event.loaded / event.total;
 				numericalValue = event.loaded / event.total;
+
 				if ( numericalValue > numericalValueRef ) {
 				if ( numericalValue > numericalValueRef ) {
 
 
 					numericalValueRef = numericalValue;
 					numericalValueRef = numericalValue;
@@ -295,6 +303,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 			scope.parser.callbacks.onLoad( scope.parse( content ), "OBJLoader2#load: Parsing completed" );
 			scope.parser.callbacks.onLoad( scope.parse( content ), "OBJLoader2#load: Parsing completed" );
 
 
 		};
 		};
+
 		let fileLoader = new FileLoader( this.manager );
 		let fileLoader = new FileLoader( this.manager );
 		fileLoader.setPath( this.path || this.resourcePath );
 		fileLoader.setPath( this.path || this.resourcePath );
 		fileLoader.setResponseType( 'arraybuffer' );
 		fileLoader.setResponseType( 'arraybuffer' );
@@ -316,6 +325,7 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 			throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
 			throw 'Provided content is not a valid ArrayBuffer or String. Unable to continue parsing';
 
 
 		}
 		}
+
 		if ( this.parser.logging.enabled ) {
 		if ( this.parser.logging.enabled ) {
 
 
 			console.time( 'OBJLoader parse: ' + this.modelName );
 			console.time( 'OBJLoader parse: ' + this.modelName );
@@ -343,11 +353,13 @@ OBJLoader2.prototype = Object.assign( Object.create( Loader.prototype ), {
 			this.parser.callbacks.onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' );
 			this.parser.callbacks.onError( 'Provided content was neither of type String nor Uint8Array! Aborting...' );
 
 
 		}
 		}
+
 		if ( this.parser.logging.enabled ) {
 		if ( this.parser.logging.enabled ) {
 
 
 			console.timeEnd( 'OBJLoader parse: ' + this.modelName );
 			console.timeEnd( 'OBJLoader parse: ' + this.modelName );
 
 
 		}
 		}
+
 		return this.baseObject3d;
 		return this.baseObject3d;
 
 
 	},
 	},

+ 11 - 1
examples/jsm/loaders/OBJLoader2Parallel.js

@@ -71,10 +71,15 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 	setJsmWorker: function ( preferJsmWorker, jsmWorkerUrl ) {
 	setJsmWorker: function ( preferJsmWorker, jsmWorkerUrl ) {
 
 
 		this.preferJsmWorker = preferJsmWorker === true;
 		this.preferJsmWorker = preferJsmWorker === true;
+
 		if ( jsmWorkerUrl === undefined || jsmWorkerUrl === null ) {
 		if ( jsmWorkerUrl === undefined || jsmWorkerUrl === null ) {
-			throw "The url to the jsm worker is not valid. Aborting..."
+
+			throw "The url to the jsm worker is not valid. Aborting...";
+
 		}
 		}
+
 		this.jsmWorkerUrl = jsmWorkerUrl;
 		this.jsmWorkerUrl = jsmWorkerUrl;
+
 		return this;
 		return this;
 
 
 	},
 	},
@@ -96,11 +101,13 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 	buildWorkerCode: function () {
 	buildWorkerCode: function () {
 
 
 		let codeBuilderInstructions = new CodeBuilderInstructions( true, true, this.preferJsmWorker );
 		let codeBuilderInstructions = new CodeBuilderInstructions( true, true, this.preferJsmWorker );
+
 		if ( codeBuilderInstructions.isSupportsJsmWorker() ) {
 		if ( codeBuilderInstructions.isSupportsJsmWorker() ) {
 
 
 			codeBuilderInstructions.setJsmWorkerUrl( this.jsmWorkerUrl );
 			codeBuilderInstructions.setJsmWorkerUrl( this.jsmWorkerUrl );
 
 
 		}
 		}
+
 		if ( codeBuilderInstructions.isSupportsStandardWorker() ) {
 		if ( codeBuilderInstructions.isSupportsStandardWorker() ) {
 
 
 			let objectManipulator = new ObjectManipulator();
 			let objectManipulator = new ObjectManipulator();
@@ -115,6 +122,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 			codeBuilderInstructions.addStartCode( startCode );
 			codeBuilderInstructions.addStartCode( startCode );
 
 
 		}
 		}
+
 		return codeBuilderInstructions;
 		return codeBuilderInstructions;
 
 
 	},
 	},
@@ -161,6 +169,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 				throw "No callback other than the default callback was provided! Aborting!";
 				throw "No callback other than the default callback was provided! Aborting!";
 
 
 			}
 			}
+
 			// check if worker has been initialize before. If yes, skip init
 			// check if worker has been initialize before. If yes, skip init
 			if ( ! this.workerExecutionSupport.isWorkerLoaded( this.preferJsmWorker ) ) {
 			if ( ! this.workerExecutionSupport.isWorkerLoaded( this.preferJsmWorker ) ) {
 
 
@@ -172,6 +181,7 @@ OBJLoader2Parallel.prototype = Object.assign( Object.create( OBJLoader2.prototyp
 					scope._onAssetAvailable( payload );
 					scope._onAssetAvailable( payload );
 
 
 				};
 				};
+
 				function scopedOnLoad( message ) {
 				function scopedOnLoad( message ) {
 
 
 					scope.parser.callbacks.onLoad( scope.baseObject3d, message );
 					scope.parser.callbacks.onLoad( scope.baseObject3d, message );

+ 1 - 0
examples/jsm/loaders/PCDLoader.js

@@ -97,6 +97,7 @@ PCDLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 						if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' );
 						if ( inPtr >= inLength ) throw new Error( 'Invalid compressed data' );
 
 
 					}
 					}
+
 					ref -= inData[ inPtr ++ ];
 					ref -= inData[ inPtr ++ ];
 					if ( outPtr + len + 2 > outLength ) throw new Error( 'Output buffer is not large enough' );
 					if ( outPtr + len + 2 > outLength ) throw new Error( 'Output buffer is not large enough' );
 					if ( ref < 0 ) throw new Error( 'Invalid compressed data' );
 					if ( ref < 0 ) throw new Error( 'Invalid compressed data' );

+ 1 - 2
examples/jsm/loaders/PDBLoader.d.ts

@@ -8,8 +8,7 @@ export interface PDB {
 	geometryAtoms: BufferGeometry;
 	geometryAtoms: BufferGeometry;
 	geometryBonds: BufferGeometry;
 	geometryBonds: BufferGeometry;
 	json: {
 	json: {
-		atoms: any[][],
-		bonds: number[][]
+		atoms: any[][]
 	}
 	}
 }
 }
 
 

File diff suppressed because it is too large
+ 23 - 16
examples/jsm/loaders/PDBLoader.js


+ 8 - 0
examples/jsm/loaders/RGBELoader.js

@@ -58,6 +58,7 @@ RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 					case rgbe_memory_error: console.error( "RGBELoader: Error: " + ( msg || '' ) );
 					case rgbe_memory_error: console.error( "RGBELoader: Error: " + ( msg || '' ) );
 
 
 				}
 				}
+
 				return RGBE_RETURN_FAILURE;
 				return RGBE_RETURN_FAILURE;
 
 
 			},
 			},
@@ -104,6 +105,7 @@ RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 					return s + chunk.slice( 0, i );
 					return s + chunk.slice( 0, i );
 
 
 				}
 				}
+
 				return false;
 				return false;
 
 
 			},
 			},
@@ -146,12 +148,14 @@ RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 					return rgbe_error( rgbe_read_error, "no header found" );
 					return rgbe_error( rgbe_read_error, "no header found" );
 
 
 				}
 				}
+
 				/* if you want to require the magic token then uncomment the next line */
 				/* if you want to require the magic token then uncomment the next line */
 				if ( ! ( match = line.match( magic_token_re ) ) ) {
 				if ( ! ( match = line.match( magic_token_re ) ) ) {
 
 
 					return rgbe_error( rgbe_format_error, "bad initial token" );
 					return rgbe_error( rgbe_format_error, "bad initial token" );
 
 
 				}
 				}
+
 				header.valid |= RGBE_VALID_PROGRAMTYPE;
 				header.valid |= RGBE_VALID_PROGRAMTYPE;
 				header.programtype = match[ 1 ];
 				header.programtype = match[ 1 ];
 				header.string += line + "\n";
 				header.string += line + "\n";
@@ -174,17 +178,20 @@ RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 						header.gamma = parseFloat( match[ 1 ], 10 );
 						header.gamma = parseFloat( match[ 1 ], 10 );
 
 
 					}
 					}
+
 					if ( match = line.match( exposure_re ) ) {
 					if ( match = line.match( exposure_re ) ) {
 
 
 						header.exposure = parseFloat( match[ 1 ], 10 );
 						header.exposure = parseFloat( match[ 1 ], 10 );
 
 
 					}
 					}
+
 					if ( match = line.match( format_re ) ) {
 					if ( match = line.match( format_re ) ) {
 
 
 						header.valid |= RGBE_VALID_FORMAT;
 						header.valid |= RGBE_VALID_FORMAT;
 						header.format = match[ 1 ];//'32-bit_rle_rgbe';
 						header.format = match[ 1 ];//'32-bit_rle_rgbe';
 
 
 					}
 					}
+
 					if ( match = line.match( dimensions_re ) ) {
 					if ( match = line.match( dimensions_re ) ) {
 
 
 						header.valid |= RGBE_VALID_DIMENSIONS;
 						header.valid |= RGBE_VALID_DIMENSIONS;
@@ -202,6 +209,7 @@ RGBELoader.prototype = Object.assign( Object.create( DataTextureLoader.prototype
 					return rgbe_error( rgbe_format_error, "missing format specifier" );
 					return rgbe_error( rgbe_format_error, "missing format specifier" );
 
 
 				}
 				}
+
 				if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
 				if ( ! ( header.valid & RGBE_VALID_DIMENSIONS ) ) {
 
 
 					return rgbe_error( rgbe_format_error, "missing image size specifier" );
 					return rgbe_error( rgbe_format_error, "missing image size specifier" );

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