Browse Source

Merge pull request #2 from mrdoob/dev

Merging master
Garrett Johnson 7 years ago
parent
commit
99438ae6fb
100 changed files with 2995 additions and 2607 deletions
  1. 1 1
      .github/ISSUE_TEMPLATE.md
  2. 50 38
      build/three.js
  3. 389 386
      build/three.min.js
  4. 50 38
      build/three.module.js
  5. 9 3
      docs/api/core/BufferGeometry.html
  6. 14 14
      docs/api/core/Object3D.html
  7. 1 1
      docs/api/loaders/JSONLoader.html
  8. 3 0
      docs/api/materials/PointsMaterial.html
  9. 14 14
      docs/api/math/Matrix3.html
  10. 29 29
      docs/api/math/Matrix4.html
  11. 34 34
      docs/api/math/Vector2.html
  12. 52 52
      docs/api/math/Vector3.html
  13. 35 35
      docs/api/math/Vector4.html
  14. 1 1
      docs/api/objects/Line.html
  15. 1 1
      docs/api/objects/Mesh.html
  16. 1 1
      docs/api/objects/Points.html
  17. 1 1
      docs/api/objects/Sprite.html
  18. 1 0
      docs/api/textures/DataTexture.html
  19. 1 1
      docs/examples/exporters/GLTFExporter.html
  20. 62 0
      docs/examples/exporters/PLYExporter.html
  21. 2 2
      docs/examples/quickhull/QuickHull.html
  22. 1 0
      docs/examples/renderers/CSS2DRenderer.html
  23. 3 1
      docs/list.js
  24. 5 5
      docs/manual/introduction/Animation-system.html
  25. 1 1
      docs/manual/introduction/Creating-a-scene.html
  26. 3 3
      docs/manual/introduction/FAQ.html
  27. 3 3
      docs/manual/introduction/Import-via-modules.html
  28. 129 0
      docs/manual/introduction/Loading-3D-models.html
  29. 7 0
      docs/manual/introduction/Useful-links.html
  30. 1 1
      docs/page.js
  31. 11 27
      docs/scenes/geometry-browser.html
  32. 150 0
      examples/css2d_label.html
  33. 6 2
      examples/files.js
  34. 2 7
      examples/js/BufferGeometryUtils.js
  35. 14 10
      examples/js/Cloth.js
  36. 9 8
      examples/js/MorphBlendMesh.js
  37. 7 7
      examples/js/ParametricGeometries.js
  38. 1 1
      examples/js/animation/CCDIKSolver.js
  39. 8 5
      examples/js/animation/MMDAnimationHelper.js
  40. 14 6
      examples/js/cameras/CinematicCamera.js
  41. 0 149
      examples/js/controls/VRControls.js
  42. 2 4
      examples/js/curves/NURBSSurface.js
  43. 11 14
      examples/js/curves/NURBSUtils.js
  44. 1 1
      examples/js/effects/OutlineEffect.js
  45. 0 533
      examples/js/effects/VREffect.js
  46. 5 0
      examples/js/exporters/GLTFExporter.js
  47. 417 112
      examples/js/exporters/PLYExporter.js
  48. 0 94
      examples/js/exporters/STLBinaryExporter.js
  49. 110 25
      examples/js/exporters/STLExporter.js
  50. 79 1
      examples/js/loaders/ColladaLoader.js
  51. 5 0
      examples/js/loaders/DRACOLoader.js
  52. 1 7
      examples/js/loaders/EquiangularToCubeGenerator.js
  53. 44 49
      examples/js/loaders/GLTFLoader.js
  54. 199 131
      examples/js/loaders/MD2Loader.js
  55. 8 7
      examples/js/loaders/MMDLoader.js
  56. 2 1
      examples/js/loaders/NodeMaterialLoader.js
  57. 15 4
      examples/js/loaders/SVGLoader.js
  58. 21 69
      examples/js/loaders/TDSLoader.js
  59. 22 48
      examples/js/loaders/VTKLoader.js
  60. 7 2
      examples/js/loaders/XLoader.js
  61. 96 63
      examples/js/modifiers/SimplifyModifier.js
  62. 2 2
      examples/js/nodes/InputNode.js
  63. 8 8
      examples/js/nodes/NodeMaterial.js
  64. 29 0
      examples/js/nodes/NodeUniform.js
  65. 4 4
      examples/js/nodes/accessors/CameraNode.js
  66. 4 19
      examples/js/nodes/inputs/FloatNode.js
  67. 3 18
      examples/js/nodes/inputs/IntNode.js
  68. 4 4
      examples/js/nodes/utils/BlurNode.js
  69. 3 3
      examples/js/nodes/utils/TimerNode.js
  70. 2 2
      examples/js/nodes/utils/VelocityNode.js
  71. 2 2
      examples/js/objects/Reflector.js
  72. 0 2
      examples/js/objects/ReflectorRTT.js
  73. 1 7
      examples/js/pmrem/PMREMCubeUVPacker.js
  74. 1 7
      examples/js/pmrem/PMREMGenerator.js
  75. 62 0
      examples/js/renderers/CSS2DRenderer.js
  76. 91 26
      examples/js/shaders/BokehShader2.js
  77. 7 2
      examples/js/vr/WebVR.js
  78. 193 0
      examples/misc_exporter_stl.html
  79. 0 0
      examples/nodes/caustic.json
  80. 0 0
      examples/nodes/displace.json
  81. 0 0
      examples/nodes/wave.json
  82. 0 0
      examples/nodes/xray.json
  83. 0 1
      examples/webgl_buffergeometry_instancing_lambert.html
  84. 2 2
      examples/webgl_geometry_colors_json.html
  85. 3 3
      examples/webgl_geometry_nurbs.html
  86. 29 23
      examples/webgl_interactive_voxelpainter.html
  87. 1 1
      examples/webgl_loader_json.html
  88. 12 8
      examples/webgl_loader_mmd.html
  89. 8 4
      examples/webgl_loader_mmd_audio.html
  90. 23 18
      examples/webgl_loader_mmd_pose.html
  91. 1 0
      examples/webgl_loader_nodes.html
  92. 45 139
      examples/webgl_loader_texture_hdr.html
  93. 16 18
      examples/webgl_loader_x.html
  94. 102 101
      examples/webgl_materials_nodes.html
  95. 1 0
      examples/webgl_mirror_nodes.html
  96. 44 88
      examples/webgl_modifier_simplifier.html
  97. 27 6
      examples/webgl_morphtargets_sphere.html
  98. 71 13
      examples/webgl_postprocessing_dof2.html
  99. 23 22
      examples/webgl_postprocessing_nodes.html
  100. 0 1
      examples/webgl_shaders_tonemapping.html

+ 1 - 1
.github/ISSUE_TEMPLATE.md

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

File diff suppressed because it is too large
+ 50 - 38
build/three.js


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


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


+ 9 - 3
docs/api/core/BufferGeometry.html

@@ -185,6 +185,12 @@
 		Optional name for this bufferGeometry instance. Default is an empty string.
 		Optional name for this bufferGeometry instance. Default is an empty string.
 		</p>
 		</p>
 
 
+		<h3>[property:Object userData]</h3>
+		<p>
+		An object that can be used to store custom data about the BufferGeometry. It should not hold
+		references to functions as these will not be cloned.
+		</p>
+
 		<h3>[property:String uuid]</h3>
 		<h3>[property:String uuid]</h3>
 		<p>
 		<p>
 		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
 		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
@@ -242,19 +248,19 @@
 		<h3>[method:null dispose]()</h3>
 		<h3>[method:null dispose]()</h3>
 		<p>
 		<p>
 		Disposes the object from memory. <br />
 		Disposes the object from memory. <br />
-		You need to call this when you want the bufferGeometry removed while the application is running.
+		You need to call this when you want the BufferGeometry removed while the application is running.
 		</p>
 		</p>
 
 
 		<h3>[method:BufferGeometry fromDirectGeometry]( [param:Geometry] )</h3>
 		<h3>[method:BufferGeometry fromDirectGeometry]( [param:Geometry] )</h3>
 		<p>
 		<p>
-			Populates this BufferGeometry with data from a [page:DirectGeometry] object.<br /><br />
+			Populates this BufferGeometry with data from a [page:DirectGeometry] object containing faces. Not implemented for a line geometry.<br /><br />
 
 
 			Note: [page:DirectGeometry] is mainly used as an intermediary object for converting between [page:Geometry]
 			Note: [page:DirectGeometry] is mainly used as an intermediary object for converting between [page:Geometry]
 			and BufferGeometry.
 			and BufferGeometry.
 		</p>
 		</p>
 
 
 		<h3>[method:BufferGeometry fromGeometry]( [param:Geometry] )</h3>
 		<h3>[method:BufferGeometry fromGeometry]( [param:Geometry] )</h3>
-		<p>Populates this BufferGeometry with data from a [page:Geometry] object.</p>
+		<p>Populates this BufferGeometry with data from a [page:Geometry] object containing faces. Not implemented for a line geometry.</p>
 
 
 		<h3>[method:BufferAttribute getAttribute]( [param:String name] )</h3>
 		<h3>[method:BufferAttribute getAttribute]( [param:String name] )</h3>
 		<p>Returns the [page:BufferAttribute attribute] with the specified name.</p>
 		<p>Returns the [page:BufferAttribute attribute] with the specified name.</p>

+ 14 - 14
docs/api/core/Object3D.html

@@ -191,7 +191,7 @@
 
 
 		<h3>[method:null add]( [param:Object3D object], ... )</h3>
 		<h3>[method:null add]( [param:Object3D object], ... )</h3>
 		<p>
 		<p>
-		Adds *object* as child of this object. An arbitrary number of objects may be added. Any current parent on an 
+		Adds *object* as child of this object. An arbitrary number of objects may be added. Any current parent on an
 		object passed in here will be removed, since an object can have at most one parent.<br /><br />
 		object passed in here will be removed, since an object can have at most one parent.<br /><br />
 
 
 		See [page:Group] for info on manually grouping objects.
 		See [page:Group] for info on manually grouping objects.
@@ -210,7 +210,7 @@
 		Returns a clone of this object and optionally all descendants.
 		Returns a clone of this object and optionally all descendants.
 		</p>
 		</p>
 
 
-		<h3>[method:Object3D copy]( [param:Object3D object], [param:Boolean recursive] )</h3>
+		<h3>[method:this copy]( [param:Object3D object], [param:Boolean recursive] )</h3>
 		<p>
 		<p>
 		recursive -- if true, descendants of the object are also copied. Default is true.<br /><br />
 		recursive -- if true, descendants of the object are also copied. Default is true.<br /><br />
 
 
@@ -301,7 +301,7 @@
 		Removes *object* as child of this object. An arbitrary number of objects may be removed.
 		Removes *object* as child of this object. An arbitrary number of objects may be removed.
 		</p>
 		</p>
 
 
-		<h3>[method:Object3D rotateOnAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
+		<h3>[method:this rotateOnAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
 		<p>
 		<p>
 		axis -- A normalized vector in object space. <br />
 		axis -- A normalized vector in object space. <br />
 		angle -- The angle in radians.<br /><br />
 		angle -- The angle in radians.<br /><br />
@@ -309,7 +309,7 @@
 		Rotate an object along an axis in object space. The axis is assumed to be normalized.
 		Rotate an object along an axis in object space. The axis is assumed to be normalized.
 		</p>
 		</p>
 
 
-		<h3>[method:Object3D rotateOnWorldAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
+		<h3>[method:this rotateOnWorldAxis]( [param:Vector3 axis], [param:Float angle] )</h3>
 		<p>
 		<p>
 		axis -- A normalized vector in world space. <br />
 		axis -- A normalized vector in world space. <br />
 		angle -- The angle in radians.<br /><br />
 		angle -- The angle in radians.<br /><br />
@@ -318,21 +318,21 @@
 		Method Assumes no rotated parent.
 		Method Assumes no rotated parent.
 		</p>
 		</p>
 
 
-		<h3>[method:null rotateX]( [param:Float rad] )</h3>
+		<h3>[method:this rotateX]( [param:Float rad] )</h3>
 		<p>
 		<p>
 		rad - the angle to rotate in radians.<br /><br />
 		rad - the angle to rotate in radians.<br /><br />
 
 
 		Rotates the object around x axis in local space.
 		Rotates the object around x axis in local space.
 		</p>
 		</p>
 
 
-		<h3>[method:null rotateY]( [param:Float rad] )</h3>
+		<h3>[method:this rotateY]( [param:Float rad] )</h3>
 		<p>
 		<p>
 		rad - the angle to rotate in radians.<br /><br />
 		rad - the angle to rotate in radians.<br /><br />
 
 
 		Rotates the object around y axis in local space.
 		Rotates the object around y axis in local space.
 		</p>
 		</p>
 
 
-		<h3>[method:null rotateZ]( [param:Float rad] )</h3>
+		<h3>[method:this rotateZ]( [param:Float rad] )</h3>
 		<p>
 		<p>
 		rad - the angle to rotate in radians.<br /><br />
 		rad - the angle to rotate in radians.<br /><br />
 
 
@@ -378,7 +378,7 @@
 			Convert the object to JSON format.
 			Convert the object to JSON format.
 		</p>
 		</p>
 
 
-		<h3>[method:Object3D translateOnAxis]( [param:Vector3 axis], [param:Float distance] )</h3>
+		<h3>[method:this translateOnAxis]( [param:Vector3 axis], [param:Float distance] )</h3>
 		<p>
 		<p>
 		axis -- A normalized vector in object space.<br />
 		axis -- A normalized vector in object space.<br />
 		distance -- The distance to translate.<br /><br />
 		distance -- The distance to translate.<br /><br />
@@ -386,14 +386,14 @@
 		Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
 		Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
 		</p>
 		</p>
 
 
-		<h3>[method:null translateX]( [param:Float distance] )</h3>
-		<p>Translates object along x axis by *distance* units.</p>
+		<h3>[method:this translateX]( [param:Float distance] )</h3>
+		<p>Translates object along x axis in object space by *distance* units.</p>
 
 
-		<h3>[method:null translateY]( [param:Float distance] )</h3>
-		<p>Translates object along y axis by *distance* units.</p>
+		<h3>[method:this translateY]( [param:Float distance] )</h3>
+		<p>Translates object along y axis in object space by *distance* units.</p>
 
 
-		<h3>[method:null translateZ]( [param:Float distance] )</h3>
-		<p>Translates object along z axis by *distance* units.</p>
+		<h3>[method:this translateZ]( [param:Float distance] )</h3>
+		<p>Translates object along z axis in object space by *distance* units.</p>
 
 
 		<h3>[method:null traverse]( [param:Function callback] )</h3>
 		<h3>[method:null traverse]( [param:Function callback] )</h3>
 		<p>
 		<p>

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

@@ -18,7 +18,7 @@
 		<h2>Example</h2>
 		<h2>Example</h2>
 
 
 		<p>
 		<p>
-		[example:webgl_loader_json_blender WebGL / loader / json / blender]<br />
+		[example:webgl_loader_json WebGL / loader / json]<br />
 		[example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]
 		[example:webgl_loader_json_objconverter WebGL / loader / json / objconverter]
 		</p>
 		</p>
 
 

+ 3 - 0
docs/api/materials/PointsMaterial.html

@@ -84,6 +84,9 @@ scene.add( starField );
 
 
 		<p>Sets the color of the points using data from a [page:Texture].</p>
 		<p>Sets the color of the points using data from a [page:Texture].</p>
 
 
+		<h3>[property:Boolean morphTargets]</h3>
+		<p>Define whether the material uses morphTargets. Default is false.</p>
+
 		<h3>[property:Number size]</h3>
 		<h3>[property:Number size]</h3>
 		<p>Sets the size of the points. Default is 1.0.</p>
 		<p>Sets the size of the points. Default is 1.0.</p>
 
 

+ 14 - 14
docs/api/math/Matrix3.html

@@ -83,7 +83,7 @@ m.elements = [ 11, 21, 31,
 		<h3>[method:Matrix3 clone]()</h3>
 		<h3>[method:Matrix3 clone]()</h3>
 		<p>Creates a new Matrix3 and with identical elements to this one.</p>
 		<p>Creates a new Matrix3 and with identical elements to this one.</p>
 
 
-		<h3>[method:Matrix3 copy]( [param:Matrix3 m] )</h3>
+		<h3>[method:this copy]( [param:Matrix3 m] )</h3>
 		<p>Copies the elements of matrix [page:Matrix3 m] into this matrix.</p>
 		<p>Copies the elements of matrix [page:Matrix3 m] into this matrix.</p>
 
 
 		<h3>[method:Float determinant]()</h3>
 		<h3>[method:Float determinant]()</h3>
@@ -95,7 +95,7 @@ m.elements = [ 11, 21, 31,
 		<h3>[method:Boolean equals]( [param:Matrix3 m] )</h3>
 		<h3>[method:Boolean equals]( [param:Matrix3 m] )</h3>
 		<p>Return true if this matrix and [page:Matrix3 m] are equal.</p>
 		<p>Return true if this matrix and [page:Matrix3 m] are equal.</p>
 
 
-		<h3>[method:Matrix3 fromArray]( [param:Array array], [param:Integer offset] )</h3>
+		<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
 		<p>
 		<p>
 		[page:Array array] - the array to read the elements from.<br />
 		[page:Array array] - the array to read the elements from.<br />
 		[page:Integer offset] - (optional) index of first element in the array. Default is 0.<br /><br />
 		[page:Integer offset] - (optional) index of first element in the array. Default is 0.<br /><br />
@@ -104,7 +104,7 @@ m.elements = [ 11, 21, 31,
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 getInverse]( [param:Matrix3 m], [param:Boolean throwOnDegenerate] )</h3>
+		<h3>[method:this getInverse]( [param:Matrix3 m], [param:Boolean throwOnDegenerate] )</h3>
 		<p>
 		<p>
 		[page:Matrix3 m] - the matrix to take the inverse of.<br />
 		[page:Matrix3 m] - the matrix to take the inverse of.<br />
 		[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
 		[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
@@ -115,7 +115,7 @@ m.elements = [ 11, 21, 31,
 		If [page:Boolean throwOnDegenerate] is not set and the matrix is not invertible, set this to the 3x3 identity matrix.
 		If [page:Boolean throwOnDegenerate] is not set and the matrix is not invertible, set this to the 3x3 identity matrix.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 getNormalMatrix]( [param:Matrix4 m] )</h3>
+		<h3>[method:this getNormalMatrix]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		[page:Matrix4 m] - [page:Matrix4]<br /><br />
 		[page:Matrix4 m] - [page:Matrix4]<br /><br />
 
 
@@ -124,7 +124,7 @@ m.elements = [ 11, 21, 31,
 	  of the matrix [page:Matrix4 m].
 	  of the matrix [page:Matrix4 m].
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 identity]()</h3>
+		<h3>[method:this identity]()</h3>
 		<p>
 		<p>
 		Resets this matrix to the 3x3 identity matrix:
 		Resets this matrix to the 3x3 identity matrix:
 		<code>
 		<code>
@@ -135,17 +135,17 @@ m.elements = [ 11, 21, 31,
 
 
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 multiply]( [param:Matrix3 m] )</h3>
+		<h3>[method:this multiply]( [param:Matrix3 m] )</h3>
 		<p>Post-multiplies this matrix by [page:Matrix3 m].</p>
 		<p>Post-multiplies this matrix by [page:Matrix3 m].</p>
 
 
-		<h3>[method:Matrix3 multiplyMatrices]( [param:Matrix3 a], [param:Matrix3 b] )</h3>
+		<h3>[method:this multiplyMatrices]( [param:Matrix3 a], [param:Matrix3 b] )</h3>
 		<p>Sets this matrix to [page:Matrix3 a] x [page:Matrix3 b].</p>
 		<p>Sets this matrix to [page:Matrix3 a] x [page:Matrix3 b].</p>
 
 
-		<h3>[method:Matrix3 multiplyScalar]( [param:Float s] )</h3>
+		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies every component of the matrix by the scalar value *s*.</p>
 		<p>Multiplies every component of the matrix by the scalar value *s*.</p>
 
 
 		<h3>
 		<h3>
-			[method:Matrix3 set](
+			[method:this set](
 			[page:Float n11], [page:Float n12], [page:Float n13],
 			[page:Float n11], [page:Float n12], [page:Float n13],
 			[page:Float n21], [page:Float n22], [page:Float n23],
 			[page:Float n21], [page:Float n22], [page:Float n23],
 			[page:Float n31], [page:Float n32], [page:Float n33] )
 			[page:Float n31], [page:Float n32], [page:Float n33] )
@@ -163,14 +163,14 @@ m.elements = [ 11, 21, 31,
 		sequence of values.
 		sequence of values.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 premultiply]( [param:Matrix3 m] )</h3>
+		<h3>[method:this premultiply]( [param:Matrix3 m] )</h3>
 		<p>Pre-multiplies this matrix by [page:Matrix3 m].</p>
 		<p>Pre-multiplies this matrix by [page:Matrix3 m].</p>
 
 
-		<h3>[method:Matrix3 setFromMatrix4]( [param:Matrix4 m] )</h3>
+		<h3>[method:this setFromMatrix4]( [param:Matrix4 m] )</h3>
 		<p>Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</p>
 		<p>Set this matrx to the upper 3x3 matrix of the Matrix4 [page:Matrix4 m].</p>
 
 
 		<h3>
 		<h3>
-			[method:Matrix3 setUvTransform](
+			[method:this setUvTransform](
 			[page:Float tx], [page:Float ty], [page:Float sx], [page:Float sy],
 			[page:Float tx], [page:Float ty], [page:Float sx], [page:Float sy],
 			[page:Float rotation], [page:Float cx], [page:Float cy] )
 			[page:Float rotation], [page:Float cx], [page:Float cy] )
 		</h3>
 		</h3>
@@ -195,10 +195,10 @@ m.elements = [ 11, 21, 31,
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix3 transpose]()</h3>
+		<h3>[method:this transpose]()</h3>
 		<p>[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.</p>
 		<p>[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix in place.</p>
 
 
-		<h3>[method:Matrix3 transposeIntoArray]( [param:Array array] )</h3>
+		<h3>[method:this transposeIntoArray]( [param:Array array] )</h3>
 		<p>
 		<p>
 		[page:Array array] -  array to store the resulting vector in.<br /><br />
 		[page:Array array] -  array to store the resulting vector in.<br /><br />
 
 

+ 29 - 29
docs/api/math/Matrix4.html

@@ -119,7 +119,7 @@ m.elements = [ 11, 21, 31, 41,
 		<h3>[method:Matrix4 clone]()</h3>
 		<h3>[method:Matrix4 clone]()</h3>
 		<p>Creates a new Matrix4 with identical [page:.elements elements] to this one.</p>
 		<p>Creates a new Matrix4 with identical [page:.elements elements] to this one.</p>
 
 
-		<h3>[method:Matrix4 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:Quaternion quaternion] and [page:Vector3 scale]. Internally this calls
@@ -128,10 +128,10 @@ m.elements = [ 11, 21, 31, 41,
 		[page:.setPosition setPosition]( [page:Vector3 position] ).
 		[page:.setPosition setPosition]( [page:Vector3 position] ).
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 copy]( [param:Matrix4 m] )</h3>
+		<h3>[method:this copy]( [param:Matrix4 m] )</h3>
 		<p>Copies the [page:.elements elements] of matrix [page:Matrix4 m] into this matrix.</p>
 		<p>Copies the [page:.elements elements] of matrix [page:Matrix4 m] into this matrix.</p>
 
 
-		<h3>[method:Matrix4 copyPosition]( [param:Matrix4 m] )</h3>
+		<h3>[method:this copyPosition]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Copies the translation component of the supplied matrix [page:Matrix4 m] into this
 		Copies the translation component of the supplied matrix [page:Matrix4 m] into this
 		matrix's translation component.
 		matrix's translation component.
@@ -154,7 +154,7 @@ m.elements = [ 11, 21, 31, 41,
 		<h3>[method:Boolean equals]( [param:Matrix4 m] )</h3>
 		<h3>[method:Boolean equals]( [param:Matrix4 m] )</h3>
 		<p>Return true if this matrix and [page:Matrix4 m] are equal.</p>
 		<p>Return true if this matrix and [page:Matrix4 m] are equal.</p>
 
 
-		<h3>[method:Matrix4 extractBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
+		<h3>[method:this extractBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
 		<p>
 		<p>
 		Extracts the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] of this
 		Extracts the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] of this
 		matrix into the three axis vectors provided. If this matrix is:
 		matrix into the three axis vectors provided. If this matrix is:
@@ -172,13 +172,13 @@ zAxis = (c, g, k)
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 extractRotation]( [param:Matrix4 m] )</h3>
+		<h3>[method:this extractRotation]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Extracts the rotation component of the supplied matrix [page:Matrix4 m] into this matrix's
 		Extracts the rotation component of the supplied matrix [page:Matrix4 m] into this matrix's
 		rotation component.
 		rotation component.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 fromArray]( [param:Array array], [param:Integer offset] )</h3>
+		<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
 		<p>
 		<p>
 		[page:Array array] - the array to read the elements from.<br />
 		[page:Array array] - the array to read the elements from.<br />
 		[page:Integer offset] - ( optional ) offset into the array. Default is 0.<br /><br />
 		[page:Integer offset] - ( optional ) offset into the array. Default is 0.<br /><br />
@@ -187,7 +187,7 @@ zAxis = (c, g, k)
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 getInverse]( [param:Matrix4 m], [param:Boolean throwOnDegenerate] )</h3>
+		<h3>[method:this getInverse]( [param:Matrix4 m], [param:Boolean throwOnDegenerate] )</h3>
 		<p>
 		<p>
 		[page:Matrix4 m] - the matrix to take the inverse of.<br />
 		[page:Matrix4 m] - the matrix to take the inverse of.<br />
 		[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
 		[page:Boolean throwOnDegenerate] - (optional) If true, throw an error if the matrix is degenerate (not invertible).<br /><br />
@@ -202,16 +202,16 @@ zAxis = (c, g, k)
 		<h3>[method:Float getMaxScaleOnAxis]()</h3>
 		<h3>[method:Float getMaxScaleOnAxis]()</h3>
 		<p>Gets the maximum scale value of the 3 axes.</p>
 		<p>Gets the maximum scale value of the 3 axes.</p>
 
 
-		<h3>[method:Matrix4 identity]()</h3>
+		<h3>[method:this identity]()</h3>
 		<p>Resets this matrix to the [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].</p>
 		<p>Resets this matrix to the [link:https://en.wikipedia.org/wiki/Identity_matrix identity matrix].</p>
 
 
-		<h3>[method:Matrix4 lookAt]( [param:Vector3 eye], [param:Vector3 center], [param:Vector3 up], )</h3>
+		<h3>[method:this lookAt]( [param:Vector3 eye], [param:Vector3 center], [param:Vector3 up], )</h3>
 		<p>
 		<p>
 			Constructs a rotation matrix, looking from [page:Vector3 eye] towards [page:Vector3 center]
 			Constructs a rotation matrix, looking from [page:Vector3 eye] towards [page:Vector3 center]
 			oriented by the [page:Vector3 up] vector.
 			oriented by the [page:Vector3 up] vector.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationAxis]( [param:Vector3 axis], [param:Float theta] )</h3>
+		<h3>[method:this makeRotationAxis]( [param:Vector3 axis], [param:Float theta] )</h3>
 		<p>
 		<p>
 		[page:Vector3 axis] — Rotation axis, should be normalized.<br />
 		[page:Vector3 axis] — Rotation axis, should be normalized.<br />
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 		[page:Float theta] — Rotation angle in radians.<br /><br />
@@ -222,7 +222,7 @@ zAxis = (c, g, k)
 		See the discussion [link:http://www.gamedev.net/reference/articles/article1199.asp here].
 		See the discussion [link:http://www.gamedev.net/reference/articles/article1199.asp here].
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
+		<h3>[method:this makeBasis]( [param:Vector3 xAxis], [param:Vector3 yAxis], [param:Vector3 zAxis] )</h3>
 		<p>
 		<p>
 		Set this to the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] matrix consisting
 		Set this to the [link:https://en.wikipedia.org/wiki/Basis_(linear_algebra) basis] matrix consisting
 		of the three provided basis vectors:
 		of the three provided basis vectors:
@@ -234,26 +234,26 @@ xAxis.z, yAxis.z, zAxis.z, 0,
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makePerspective]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
+		<h3>[method:this makePerspective]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
 		<p>
 		<p>
 			Creates a [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection perspective projection] matrix.
 			Creates a [link:https://en.wikipedia.org/wiki/3D_projection#Perspective_projection perspective projection] matrix.
 			This is used internally by [page:PerspectiveCamera.updateProjectionMatrix]()
 			This is used internally by [page:PerspectiveCamera.updateProjectionMatrix]()
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeOrthographic]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
+		<h3>[method:this makeOrthographic]( [param:Float left], [param:Float right], [param:Float top], [param:Float bottom], [param:Float near], [param:Float far] )</h3>
 		<p>
 		<p>
 		Creates an [link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection] matrix.
 		Creates an [link:https://en.wikipedia.org/wiki/Orthographic_projection orthographic projection] matrix.
 		This is used internally by [page:OrthographicCamera.updateProjectionMatrix]().
 		This is used internally by [page:OrthographicCamera.updateProjectionMatrix]().
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationFromEuler]( [param:Euler euler] )</h3>
+		<h3>[method:this makeRotationFromEuler]( [param:Euler euler] )</h3>
 		<p>
 		<p>
 		Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given [page:Euler Euler Angle].
 		Sets the rotation component (the upper left 3x3 matrix) of this matrix to the rotation specified by the given [page:Euler Euler Angle].
 		The rest of the matrix is set to the identity. Depending on the [page:Euler.order order] of the [page:Euler euler], there are six possible outcomes.
 		The rest of the matrix is set to the identity. Depending on the [page:Euler.order order] of the [page:Euler euler], there are six possible outcomes.
 		See [link:https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix this page] for a complete list.
 		See [link:https://en.wikipedia.org/wiki/Euler_angles#Rotation_matrix this page] for a complete list.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationFromQuaternion]( [param:Quaternion q] )</h3>
+		<h3>[method:this makeRotationFromQuaternion]( [param:Quaternion q] )</h3>
 		<p>
 		<p>
 		Sets the rotation component of this matrix to the rotation specified by [page:Quaternion q], as outlined
 		Sets the rotation component of this matrix to the rotation specified by [page:Quaternion q], as outlined
 		[link:https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion here].
 		[link:https://en.wikipedia.org/wiki/Rotation_matrix#Quaternion here].
@@ -266,7 +266,7 @@ xAxis.z, yAxis.z, zAxis.z, 0,
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationX]( [param:Float theta] )</h3>
+		<h3>[method:this makeRotationX]( [param:Float theta] )</h3>
 		<p>
 		<p>
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 
 
@@ -280,7 +280,7 @@ xAxis.z, yAxis.z, zAxis.z, 0,
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationY]( [param:Float theta] )</h3>
+		<h3>[method:this makeRotationY]( [param:Float theta] )</h3>
 		<p>
 		<p>
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 
 
@@ -294,7 +294,7 @@ cos(&theta;)  0 sin(&theta;) 0
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeRotationZ]( [param:Float theta] )</h3>
+		<h3>[method:this makeRotationZ]( [param:Float theta] )</h3>
 		<p>
 		<p>
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 		[page:Float theta] — Rotation angle in radians.<br /><br />
 
 
@@ -308,7 +308,7 @@ sin(&theta;) cos(&theta;)  0 0
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeScale]( [param:Float x], [param:Float y], [param:Float z] )</h3>
+		<h3>[method:this makeScale]( [param:Float x], [param:Float y], [param:Float z] )</h3>
 		<p>
 		<p>
 			[page:Float x] - the amount to scale in the X axis.<br />
 			[page:Float x] - the amount to scale in the X axis.<br />
 			[page:Float y] - the amount to scale in the Y axis.<br />
 			[page:Float y] - the amount to scale in the Y axis.<br />
@@ -323,7 +323,7 @@ x, 0, 0, 0,
 			</code>
 			</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeShear]( [param:Float x], [param:Float y], [param:Float z] )</h3>
+		<h3>[method:this makeShear]( [param:Float x], [param:Float y], [param:Float z] )</h3>
 		<p>
 		<p>
 		[page:Float x] - the amount to shear in the X axis.<br />
 		[page:Float x] - the amount to shear in the X axis.<br />
 		[page:Float y] - the amount to shear in the Y axis.<br />
 		[page:Float y] - the amount to shear in the Y axis.<br />
@@ -338,7 +338,7 @@ x, y, 1, 0,
 </code>
 </code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 makeTranslation]( [param:Float x], [param:Float y], [param:Float z] )</h3>
+		<h3>[method:this makeTranslation]( [param:Float x], [param:Float y], [param:Float z] )</h3>
 		<p>
 		<p>
 			[page:Float x] - the amount to translate in the X axis.<br />
 			[page:Float x] - the amount to translate in the X axis.<br />
 			[page:Float y] - the amount to translate in the Y axis.<br />
 			[page:Float y] - the amount to translate in the Y axis.<br />
@@ -353,22 +353,22 @@ x, y, 1, 0,
 		</code>
 		</code>
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 multiply]( [param:Matrix4 m] )</h3>
+		<h3>[method:this multiply]( [param:Matrix4 m] )</h3>
 		<p>Post-multiplies this matrix by [page:Matrix4 m].</p>
 		<p>Post-multiplies this matrix by [page:Matrix4 m].</p>
 
 
-		<h3>[method:Matrix4 multiplyMatrices]( [param:Matrix4 a], [param:Matrix4 b] )</h3>
+		<h3>[method:this multiplyMatrices]( [param:Matrix4 a], [param:Matrix4 b] )</h3>
 		<p>Sets this matrix to [page:Matrix4 a] x [page:Matrix4 b].</p>
 		<p>Sets this matrix to [page:Matrix4 a] x [page:Matrix4 b].</p>
 
 
-		<h3>[method:Matrix4 multiplyScalar]( [param:Float s] )</h3>
+		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies every component of the matrix by a scalar value [page:Float s].</p>
 		<p>Multiplies every component of the matrix by a scalar value [page:Float s].</p>
 
 
-		<h3>[method:Matrix4 premultiply]( [param:Matrix4 m] )</h3>
+		<h3>[method:this premultiply]( [param:Matrix4 m] )</h3>
 		<p>Pre-multiplies this matrix by [page:Matrix4 m].</p>
 		<p>Pre-multiplies this matrix by [page:Matrix4 m].</p>
 
 
-		<h3>[method:Matrix4 scale]( [param:Vector3 v] )</h3>
+		<h3>[method:this scale]( [param:Vector3 v] )</h3>
 		<p>Multiplies the columns of this matrix by vector [page:Vector3 v].</p>
 		<p>Multiplies the columns of this matrix by vector [page:Vector3 v].</p>
 
 
-		<h3>[method:Matrix4 set](
+		<h3>[method:this set](
 			[page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14],
 			[page:Float n11], [page:Float n12], [page:Float n13], [page:Float n14],
 			[page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24],
 			[page:Float n21], [page:Float n22], [page:Float n23], [page:Float n24],
 			[page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34],
 			[page:Float n31], [page:Float n32], [page:Float n33], [page:Float n34],
@@ -378,7 +378,7 @@ x, y, 1, 0,
 			[page:Float n12], ... [page:Float n44].
 			[page:Float n12], ... [page:Float n44].
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 setPosition]( [param:Vector3 v] )</h3>
+		<h3>[method:this setPosition]( [param:Vector3 v] )</h3>
 		<p>
 		<p>
 			Sets the position component for this matrix from vector [page:Vector3 v], without affecting the
 			Sets the position component for this matrix from vector [page:Vector3 v], without affecting the
 			rest of the matrix - i.e. if the matrix is currently:
 			rest of the matrix - i.e. if the matrix is currently:
@@ -406,7 +406,7 @@ m, n, o, p
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		[link:https://en.wikipedia.org/wiki/Row-_and_column-major_order#Column-major_order column-major] format.
 		</p>
 		</p>
 
 
-		<h3>[method:Matrix4 transpose]()</h3>
+		<h3>[method:this transpose]()</h3>
 		<p>[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix.</p>
 		<p>[link:https://en.wikipedia.org/wiki/Transpose Transposes] this matrix.</p>
 
 
 		<h2>Source</h2>
 		<h2>Source</h2>

+ 34 - 34
docs/api/math/Vector2.html

@@ -82,16 +82,16 @@
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:Vector2 add]( [param:Vector2 v] )</h3>
+		<h3>[method:this add]( [param:Vector2 v] )</h3>
 		<p>Adds [page:Vector2 v] to this vector.</p>
 		<p>Adds [page:Vector2 v] to this vector.</p>
 
 
-		<h3>[method:Vector2 addScalar]( [param:Float s] )</h3>
+		<h3>[method:this addScalar]( [param:Float s] )</h3>
 		<p>Adds the scalar value [page:Float s] to this vector's [page:.x x] and [page:.y y] values.</p>
 		<p>Adds the scalar value [page:Float s] to this vector's [page:.x x] and [page:.y y] values.</p>
 
 
-		<h3>[method:Vector2 addScaledVector]( [param:Vector2 v], [param:Float s] )</h3>
+		<h3>[method:this addScaledVector]( [param:Vector2 v], [param:Float s] )</h3>
 		<p>Adds the multiple of [page:Vector2 v] and [page:Float s] to this vector.</p>
 		<p>Adds the multiple of [page:Vector2 v] and [page:Float s] to this vector.</p>
 
 
-		<h3>[method:Vector2 addVectors]( [param:Vector2 a], [param:Vector2 b] )</h3>
+		<h3>[method:this addVectors]( [param:Vector2 a], [param:Vector2 b] )</h3>
 		<p>Sets this vector to [page:Vector2 a] + [page:Vector2 b].</p>
 		<p>Sets this vector to [page:Vector2 a] + [page:Vector2 b].</p>
 
 
 		<h3>[method:Float angle]()</h3>
 		<h3>[method:Float angle]()</h3>
@@ -99,17 +99,17 @@
 		Computes the angle in radians of this vector with respect to the positive x-axis.
 		Computes the angle in radians of this vector with respect to the positive x-axis.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 applyMatrix3]( [param:Matrix3 m] )</h3>
+		<h3>[method:this applyMatrix3]( [param:Matrix3 m] )</h3>
 		<p>
 		<p>
 		Multiplies this vector (with an implicit 1 as the 3rd component) by m.
 		Multiplies this vector (with an implicit 1 as the 3rd component) by m.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 ceil]()</h3>
+		<h3>[method:this ceil]()</h3>
 		<p>
 		<p>
 		The [page:.x x] and [page:.y y] components of the vector are rounded up to the nearest integer value.
 		The [page:.x x] and [page:.y y] components of the vector are rounded up to the nearest integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 clamp]( [param:Vector2 min], [param:Vector2 max] )</h3>
+		<h3>[method:this clamp]( [param:Vector2 min], [param:Vector2 max] )</h3>
 		<p>
 		<p>
 		[page:Vector2 min] - the minimum x and y values.<br />
 		[page:Vector2 min] - the minimum x and y values.<br />
 		[page:Vector2 max] - the maximum x and y values in the desired range<br /><br />
 		[page:Vector2 max] - the maximum x and y values in the desired range<br /><br />
@@ -118,7 +118,7 @@
 		If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.
 		If this vector's x or y value is less than the min vector's x or y value, it is replaced by the corresponding value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 clampLength]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampLength]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
@@ -127,7 +127,7 @@
 		If this vector's length is less than the min value, it is replaced by the min value.
 		If this vector's length is less than the min value, it is replaced by the min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 clampScalar]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampScalar]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
@@ -141,7 +141,7 @@
 		Returns a new Vector2 with the same [page:.x x] and [page:.y y] values as this one.
 		Returns a new Vector2 with the same [page:.x x] and [page:.y y] values as this one.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 copy]( [param:Vector2 v] )</h3>
+		<h3>[method:this copy]( [param:Vector2 v] )</h3>
 		<p>
 		<p>
 			Copies the values of the passed Vector2's [page:.x x] and [page:.y y]
 			Copies the values of the passed Vector2's [page:.x x] and [page:.y y]
 			properties to this Vector2.
 			properties to this Vector2.
@@ -162,10 +162,10 @@
 		as it is slightly more efficient to calculate.
 		as it is slightly more efficient to calculate.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 divide]( [param:Vector2 v] )</h3>
+		<h3>[method:this divide]( [param:Vector2 v] )</h3>
 		<p>Divides this vector by [page:Vector2 v].</p>
 		<p>Divides this vector by [page:Vector2 v].</p>
 
 
-		<h3>[method:Vector2 divideScalar]( [param:Float s] )</h3>
+		<h3>[method:this divideScalar]( [param:Float s] )</h3>
 		<p>
 		<p>
 		Divides this vector by scalar [page:Float s].<br />
 		Divides this vector by scalar [page:Float s].<br />
 		Sets vector to *( 0, 0 )* if [page:Float s] = 0.
 		Sets vector to *( 0, 0 )* if [page:Float s] = 0.
@@ -180,10 +180,10 @@
 		<h3>[method:Boolean equals]( [param:Vector2 v] )</h3>
 		<h3>[method:Boolean equals]( [param:Vector2 v] )</h3>
 		<p>Checks for strict equality of this vector and [page:Vector2 v].</p>
 		<p>Checks for strict equality of this vector and [page:Vector2 v].</p>
 
 
-		<h3>[method:Vector2 floor]()</h3>
+		<h3>[method:this floor]()</h3>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 
 
-		<h3>[method:Vector2 fromArray]( [param:Array array], [param:Integer offset] )</h3>
+		<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
 		<p>
 		<p>
 		[page:Array array] - the source array.<br />
 		[page:Array array] - the source array.<br />
 		[page:Integer offset] - (optional) offset into the array. Default is 0.<br /><br />
 		[page:Integer offset] - (optional) offset into the array. Default is 0.<br /><br />
@@ -191,7 +191,7 @@
 		Sets this vector's [page:.x x] value to be array[ offset ] and [page:.y y] value to be array[ offset + 1 ].
 		Sets this vector's [page:.x x] value to be array[ offset ] and [page:.y y] value to be array[ offset + 1 ].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
+		<h3>[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
 		<p>
 		<p>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
 		[page:Integer index] - index in the attribute.<br /><br />
@@ -223,7 +223,7 @@
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 lerp]( [param:Vector2 v], [param:Float alpha] )</h3>
+		<h3>[method:this lerp]( [param:Vector2 v], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector2 v] - [page:Vector2] to interpolate towards.<br />
 		[page:Vector2 v] - [page:Vector2] to interpolate towards.<br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
@@ -232,7 +232,7 @@
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector2 v].
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector2 v].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 lerpVectors]( [param:Vector2 v1], [param:Vector2 v2], [param:Float alpha] )</h3>
+		<h3>[method:this lerpVectors]( [param:Vector2 v1], [param:Vector2 v2], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector2 v1] - the starting [page:Vector2].<br />
 		[page:Vector2 v1] - the starting [page:Vector2].<br />
 		[page:Vector2 v2] - [page:Vector2] to interpolate towards.<br />
 		[page:Vector2 v2] - [page:Vector2] to interpolate towards.<br />
@@ -243,35 +243,35 @@
 		- alpha = 0 will be [page:Vector2 v1], and alpha = 1 will be [page:Vector2 v2].
 		- alpha = 0 will be [page:Vector2 v1], and alpha = 1 will be [page:Vector2 v2].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 negate]()</h3>
+		<h3>[method:this negate]()</h3>
 		<p>Inverts this vector - i.e. sets x = -x and y = -y.</p>
 		<p>Inverts this vector - i.e. sets x = -x and y = -y.</p>
 
 
-		<h3>[method:Vector2 normalize]()</h3>
+		<h3>[method:this normalize]()</h3>
 		<p>
 		<p>
 		Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		as this one, but [page:.length length] 1.
 		as this one, but [page:.length length] 1.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 max]( [param:Vector2 v] )</h3>
+		<h3>[method:this max]( [param:Vector2 v] )</h3>
 		<p>
 		<p>
 		If this vector's x or y value is less than [page:Vector2 v]'s x or y value, replace
 		If this vector's x or y value is less than [page:Vector2 v]'s x or y value, replace
 		that value with the corresponding max value.
 		that value with the corresponding max value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 min]( [param:Vector2 v] )</h3>
+		<h3>[method:this min]( [param:Vector2 v] )</h3>
 		<p>
 		<p>
 		If this vector's x or y value is greater than [page:Vector2 v]'s x or y value, replace
 		If this vector's x or y value is greater than [page:Vector2 v]'s x or y value, replace
 		that value with the corresponding min value.
 		that value with the corresponding min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 multiply]( [param:Vector2 v] )</h3>
+		<h3>[method:this multiply]( [param:Vector2 v] )</h3>
 		<p>Multiplies this vector by [page:Vector2 v].</p>
 		<p>Multiplies this vector by [page:Vector2 v].</p>
 
 
 
 
-		<h3>[method:Vector2 multiplyScalar]( [param:Float s] )</h3>
+		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 
 
-		<h3>[method:Vector2 rotateAround]( [param:Vector2 center], [param:float angle] )</h3>
+		<h3>[method:this rotateAround]( [param:Vector2 center], [param:float angle] )</h3>
 		<p>
 		<p>
 			[page:Vector2 center] - the point around which to rotate.<br />
 			[page:Vector2 center] - the point around which to rotate.<br />
 			[page:float angle] - the angle to rotate, in radians.<br /><br />
 			[page:float angle] - the angle to rotate, in radians.<br /><br />
@@ -279,15 +279,15 @@
 			Rotates the vector around [page:Vector2 center] by [page:float angle] radians.
 			Rotates the vector around [page:Vector2 center] by [page:float angle] radians.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 round]()</h3>
+		<h3>[method:this round]()</h3>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 
 
-		<h3>[method:Vector2 roundToZero]()</h3>
+		<h3>[method:this roundToZero]()</h3>
 		<p>
 		<p>
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 set]( [param:Float x], [param:Float y] )</h3>
+		<h3>[method:this set]( [param:Float x], [param:Float y] )</h3>
 		<p>Sets the [page:.x x] and [page:.y y] components of this vector.</p>
 		<p>Sets the [page:.x x] and [page:.y y] components of this vector.</p>
 
 
 		<h3>[method:null setComponent]( [param:Integer index], [param:Float value] )</h3>
 		<h3>[method:null setComponent]( [param:Integer index], [param:Float value] )</h3>
@@ -299,30 +299,30 @@
 		If index equals 1 set [page:.y y] to [page:Float value]
 		If index equals 1 set [page:.y y] to [page:Float value]
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 setLength]( [param:Float l] )</h3>
+		<h3>[method:this setLength]( [param:Float l] )</h3>
 		<p>
 		<p>
 		Sets this vector to the vector with the same direction as this one, but [page:.length length]
 		Sets this vector to the vector with the same direction as this one, but [page:.length length]
 		[page:Float l].
 		[page:Float l].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 setScalar]( [param:Float scalar] )</h3>
+		<h3>[method:this setScalar]( [param:Float scalar] )</h3>
 		<p>
 		<p>
 		Sets the [page:.x x] and [page:.y y] values of this vector both equal to [page:Float scalar].
 		Sets the [page:.x x] and [page:.y y] values of this vector both equal to [page:Float scalar].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector2 setX]( [param:Float x] )</h3>
+		<h3>[method:this setX]( [param:Float x] )</h3>
 		<p>Replaces this vector's [page:.x x] value with [page:Float x].</p>
 		<p>Replaces this vector's [page:.x x] value with [page:Float x].</p>
 
 
-		<h3>[method:Vector2 setY]( [param:Float y] )</h3>
+		<h3>[method:this setY]( [param:Float y] )</h3>
 		<p>Replaces this vector's [page:.y y] value with [page:Float y].</p>
 		<p>Replaces this vector's [page:.y y] value with [page:Float y].</p>
 
 
-		<h3>[method:Vector2 sub]( [param:Vector2 v] )</h3>
+		<h3>[method:this sub]( [param:Vector2 v] )</h3>
 		<p>Subtracts [page:Vector2 v] from this vector.</p>
 		<p>Subtracts [page:Vector2 v] from this vector.</p>
 
 
-		<h3>[method:Vector2 subScalar]( [param:Float s] )</h3>
+		<h3>[method:this subScalar]( [param:Float s] )</h3>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x] and [page:.y y] components.</p>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x] and [page:.y y] components.</p>
 
 
-		<h3>[method:Vector2 subVectors]( [param:Vector2 a], [param:Vector2 b] )</h3>
+		<h3>[method:this subVectors]( [param:Vector2 a], [param:Vector2 b] )</h3>
 		<p>Sets this vector to [page:Vector2 a] - [page:Vector2 b].</p>
 		<p>Sets this vector to [page:Vector2 a] - [page:Vector2 b].</p>
 
 
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>

+ 52 - 52
docs/api/math/Vector3.html

@@ -79,19 +79,19 @@ var d = a.distanceTo( b );
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:Vector3 add]( [param:Vector3 v] )</h3>
+		<h3>[method:this add]( [param:Vector3 v] )</h3>
 		<p>Adds [page:Vector3 v] to this vector.</p>
 		<p>Adds [page:Vector3 v] to this vector.</p>
 
 
-		<h3>[method:Vector3 addScalar]( [param:Float s] )</h3>
+		<h3>[method:this addScalar]( [param:Float s] )</h3>
 		<p>Adds the scalar value s to this vector's [page:.x x], [page:.y y] and [page:.z z] values.</p>
 		<p>Adds the scalar value s to this vector's [page:.x x], [page:.y y] and [page:.z z] values.</p>
 
 
-		<h3>[method:Vector3 addScaledVector]( [param:Vector3 v], [param:Float s] )</h3>
+		<h3>[method:this addScaledVector]( [param:Vector3 v], [param:Float s] )</h3>
 		<p>Adds the multiple of [page:Vector3 v] and [page:Float s] to this vector.</p>
 		<p>Adds the multiple of [page:Vector3 v] and [page:Float s] to this vector.</p>
 
 
-		<h3>[method:Vector3 addVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
+		<h3>[method:this addVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
 		<p>Sets this vector to [page:Vector3 a] + [page:Vector3 b].</p>
 		<p>Sets this vector to [page:Vector3 a] + [page:Vector3 b].</p>
 
 
-		<h3>[method:Vector3 applyAxisAngle]( [param:Vector3 axis], [param:Float angle] )</h3>
+		<h3>[method:this applyAxisAngle]( [param:Vector3 axis], [param:Float angle] )</h3>
 		<p>
 		<p>
 		[page:Vector3 axis] - A normalized [page:Vector3].<br />
 		[page:Vector3 axis] - A normalized [page:Vector3].<br />
 		[page:Float angle] - An angle in radians.<br /><br />
 		[page:Float angle] - An angle in radians.<br /><br />
@@ -99,21 +99,21 @@ var d = a.distanceTo( b );
 		Applies a rotation specified by an axis and an angle to this vector.
 		Applies a rotation specified by an axis and an angle to this vector.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 applyEuler]( [param:Euler euler] )</h3>
+		<h3>[method:this applyEuler]( [param:Euler euler] )</h3>
 		<p>
 		<p>
 		Applies euler transform to this vector by converting the [page:Euler] object to a
 		Applies euler transform to this vector by converting the [page:Euler] object to a
 		[page:Quaternion] and applying.
 		[page:Quaternion] and applying.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 applyMatrix3]( [param:Matrix3 m] )</h3>
+		<h3>[method:this applyMatrix3]( [param:Matrix3 m] )</h3>
 		<p>Multiplies this vector by [page:Matrix3 m]</p>
 		<p>Multiplies this vector by [page:Matrix3 m]</p>
 
 
-		<h3>[method:Vector3 applyMatrix4]( [param:Matrix4 m] )</h3>
+		<h3>[method:this applyMatrix4]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
 		Multiplies this vector (with an implicit 1 in the 4th dimension) and m, and divides by perspective.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 applyQuaternion]( [param:Quaternion quaternion] )</h3>
+		<h3>[method:this applyQuaternion]( [param:Quaternion quaternion] )</h3>
 		<p>
 		<p>
 		Applies a [page:Quaternion] transform to this vector.
 		Applies a [page:Quaternion] transform to this vector.
 		</p>
 		</p>
@@ -124,12 +124,12 @@ var d = a.distanceTo( b );
 		Returns the angle between this vector and vector [page:Vector3 v] in radians.
 		Returns the angle between this vector and vector [page:Vector3 v] in radians.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 ceil]()</h3>
+		<h3>[method:this ceil]()</h3>
 		<p>
 		<p>
 		The [page:.x x], [page:.y y] and [page:.z z] components of the vector are rounded up to the nearest integer value.
 		The [page:.x x], [page:.y y] and [page:.z z] components of the vector are rounded up to the nearest integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 clamp]( [param:Vector3 min], [param:Vector3 max] )</h3>
+		<h3>[method:this clamp]( [param:Vector3 min], [param:Vector3 max] )</h3>
 		<p>
 		<p>
 		[page:Vector3 min] - the minimum [page:.x x], [page:.y y] and [page:.z z] values.<br />
 		[page:Vector3 min] - the minimum [page:.x x], [page:.y y] and [page:.z z] values.<br />
 		[page:Vector3 max] - the maximum [page:.x x], [page:.y y] and [page:.z z] values in the desired range<br /><br />
 		[page:Vector3 max] - the maximum [page:.x x], [page:.y y] and [page:.z z] values in the desired range<br /><br />
@@ -138,7 +138,7 @@ var d = a.distanceTo( b );
 		If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value.
 		If this vector's x, y or z value is less than the min vector's x, y or z value, it is replaced by the corresponding value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 clampLength]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampLength]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
@@ -147,7 +147,7 @@ var d = a.distanceTo( b );
 		If this vector's length is less than the min value, it is replaced by the min value.
 		If this vector's length is less than the min value, it is replaced by the min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 clampScalar]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampScalar]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
@@ -161,18 +161,18 @@ var d = a.distanceTo( b );
 		Returns a new vector3 with the same [page:.x x], [page:.y y] and [page:.z z] values as this one.
 		Returns a new vector3 with the same [page:.x x], [page:.y y] and [page:.z z] values as this one.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 copy]( [param:Vector3 v] )</h3>
+		<h3>[method:this copy]( [param:Vector3 v] )</h3>
 		<p>
 		<p>
 			Copies the values of the passed vector3's [page:.x x], [page:.y y] and [page:.z z]
 			Copies the values of the passed vector3's [page:.x x], [page:.y y] and [page:.z z]
 			properties to this vector3.
 			properties to this vector3.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 cross]( [param:Vector3 v] )</h3>
+		<h3>[method:this cross]( [param:Vector3 v] )</h3>
 		<p>
 		<p>
 		Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of itself and [page:Vector3 v].
 		Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of itself and [page:Vector3 v].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 crossVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
+		<h3>[method:this crossVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
 		<p>
 		<p>
 		Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of [page:Vector3 a] and [page:Vector3 b].
 		Sets this vector to [link:https://en.wikipedia.org/wiki/Cross_product cross product] of [page:Vector3 a] and [page:Vector3 b].
 		</p>
 		</p>
@@ -192,10 +192,10 @@ var d = a.distanceTo( b );
 		as it is slightly more efficient to calculate.
 		as it is slightly more efficient to calculate.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 divide]( [param:Vector3 v] )</h3>
+		<h3>[method:this divide]( [param:Vector3 v] )</h3>
 		<p>Divides this vector by [page:Vector3 v].</p>
 		<p>Divides this vector by [page:Vector3 v].</p>
 
 
-		<h3>[method:Vector3 divideScalar]( [param:Float s] )</h3>
+		<h3>[method:this divideScalar]( [param:Float s] )</h3>
 		<p>
 		<p>
 		Divides this vector by scalar [page:Float s].<br />
 		Divides this vector by scalar [page:Float s].<br />
 		Sets vector to *( 0, 0, 0 )* if *[page:Float s] = 0*.
 		Sets vector to *( 0, 0, 0 )* if *[page:Float s] = 0*.
@@ -210,10 +210,10 @@ var d = a.distanceTo( b );
 		<h3>[method:Boolean equals]( [param:Vector3 v] )</h3>
 		<h3>[method:Boolean equals]( [param:Vector3 v] )</h3>
 		<p>Checks for strict equality of this vector and [page:Vector3 v].</p>
 		<p>Checks for strict equality of this vector and [page:Vector3 v].</p>
 
 
-		<h3>[method:Vector3 floor]()</h3>
+		<h3>[method:this floor]()</h3>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 
 
-		<h3>[method:Vector3 fromArray]( [param:Array array], [param:Integer offset] )</h3>
+		<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
 		<p>
 		<p>
 		[page:Array array] - the source array.<br />
 		[page:Array array] - the source array.<br />
 		[page:Integer offset] - ( optional) offset into the array. Default is 0.<br /><br />
 		[page:Integer offset] - ( optional) offset into the array. Default is 0.<br /><br />
@@ -222,7 +222,7 @@ var d = a.distanceTo( b );
 		and [page:.z z] value to be array[ offset + 2 ].
 		and [page:.z z] value to be array[ offset + 2 ].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
+		<h3>[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
 		<p>
 		<p>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
 		[page:Integer index] - index in the attribute.<br /><br />
@@ -255,7 +255,7 @@ var d = a.distanceTo( b );
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 lerp]( [param:Vector3 v], [param:Float alpha] )</h3>
+		<h3>[method:this lerp]( [param:Vector3 v], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector3 v] - [page:Vector3] to interpolate towards.<br />
 		[page:Vector3 v] - [page:Vector3] to interpolate towards.<br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
@@ -264,7 +264,7 @@ var d = a.distanceTo( b );
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector3 v].
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector3 v].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 lerpVectors]( [param:Vector3 v1], [param:Vector3 v2], [param:Float alpha] )</h3>
+		<h3>[method:this lerpVectors]( [param:Vector3 v1], [param:Vector3 v2], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector3 v1] - the starting [page:Vector3].<br />
 		[page:Vector3 v1] - the starting [page:Vector3].<br />
 		[page:Vector3 v2] - [page:Vector3] to interpolate towards.<br />
 		[page:Vector3 v2] - [page:Vector3] to interpolate towards.<br />
@@ -275,44 +275,44 @@ var d = a.distanceTo( b );
 		- alpha = 0 will be [page:Vector3 v1], and alpha = 1 will be [page:Vector3 v2].
 		- alpha = 0 will be [page:Vector3 v1], and alpha = 1 will be [page:Vector3 v2].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 max]( [param:Vector3 v] )</h3>
+		<h3>[method:this max]( [param:Vector3 v] )</h3>
 		<p>
 		<p>
 		If this vector's x, y or z value is less than [page:Vector3 v]'s x, y or z value, replace
 		If this vector's x, y or z value is less than [page:Vector3 v]'s x, y or z value, replace
 		that value with the corresponding max value.
 		that value with the corresponding max value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 min]( [param:Vector3 v] )</h3>
+		<h3>[method:this min]( [param:Vector3 v] )</h3>
 		<p>
 		<p>
 		If this vector's x, y or z value is greater than [page:Vector3 v]'s x, y or z value, replace
 		If this vector's x, y or z value is greater than [page:Vector3 v]'s x, y or z value, replace
 		that value with the corresponding min value.
 		that value with the corresponding min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 multiply]( [param:Vector3 v] )</h3>
+		<h3>[method:this multiply]( [param:Vector3 v] )</h3>
 		<p>Multiplies this vector by [page:Vector3 v].</p>
 		<p>Multiplies this vector by [page:Vector3 v].</p>
 
 
-		<h3>[method:Vector3 multiplyScalar]( [param:Float s] )</h3>
+		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 
 
-		<h3>[method:Vector3 multiplyVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
+		<h3>[method:this multiplyVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
 		<p>Sets this vector equal to [page:Vector3 a] * [page:Vector3 b], component-wise.</p>
 		<p>Sets this vector equal to [page:Vector3 a] * [page:Vector3 b], component-wise.</p>
 
 
-		<h3>[method:Vector3 negate]()</h3>
+		<h3>[method:this negate]()</h3>
 		<p>Inverts this vector - i.e. sets x = -x, y = -y and z = -z.</p>
 		<p>Inverts this vector - i.e. sets x = -x, y = -y and z = -z.</p>
 
 
-		<h3>[method:Vector3 normalize]()</h3>
+		<h3>[method:this normalize]()</h3>
 		<p>
 		<p>
 		Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		Convert this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		as this one, but [page:.length length] 1.
 		as this one, but [page:.length length] 1.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 project]( [param:Camera camera] )</h3>
+		<h3>[method:this project]( [param:Camera camera] )</h3>
 		<p>
 		<p>
 		[page:Camera camera] — camera to use in the projection.<br /><br />
 		[page:Camera camera] — camera to use in the projection.<br /><br />
 
 
 		[link:https://en.wikipedia.org/wiki/Vector_projection Projects] the vector with the camera.
 		[link:https://en.wikipedia.org/wiki/Vector_projection Projects] the vector with the camera.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 projectOnPlane]( [param:Vector3 planeNormal] )</h3>
+		<h3>[method:this projectOnPlane]( [param:Vector3 planeNormal] )</h3>
 		<p>
 		<p>
 		[page:Vector3 planeNormal] - A vector representing a plane normal.<br /><br />
 		[page:Vector3 planeNormal] - A vector representing a plane normal.<br /><br />
 
 
@@ -320,10 +320,10 @@ var d = a.distanceTo( b );
 		normal from this vector.
 		normal from this vector.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 projectOnVector]( [param:Vector3] )</h3>
+		<h3>[method:this projectOnVector]( [param:Vector3] )</h3>
 		<p>[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto another vector.</p>
 		<p>[link:https://en.wikipedia.org/wiki/Vector_projection Projects] this vector onto another vector.</p>
 
 
-		<h3>[method:Vector3 reflect]( [param:Vector3 normal] )</h3>
+		<h3>[method:this reflect]( [param:Vector3 normal] )</h3>
 		<p>
 		<p>
 		[page:Vector3 normal] - the normal to the reflecting plane<br /><br />
 		[page:Vector3 normal] - the normal to the reflecting plane<br /><br />
 
 
@@ -331,15 +331,15 @@ var d = a.distanceTo( b );
 		have unit length.
 		have unit length.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 round]()</h3>
+		<h3>[method:this round]()</h3>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 
 
-		<h3>[method:Vector3 roundToZero]()</h3>
+		<h3>[method:this roundToZero]()</h3>
 		<p>
 		<p>
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 set]( [param:Float x], [param:Float y], [param:Float z] )</h3>
+		<h3>[method:this set]( [param:Float x], [param:Float y], [param:Float z] )</h3>
 		<p>Sets the [page:.x x], [page:.y y] and [page:.z z] components of this vector.</p>
 		<p>Sets the [page:.x x], [page:.y y] and [page:.z z] components of this vector.</p>
 
 
 		<h3>[method:null setComponent]( [param:Integer index], [param:Float value] )</h3>
 		<h3>[method:null setComponent]( [param:Integer index], [param:Float value] )</h3>
@@ -352,61 +352,61 @@ var d = a.distanceTo( b );
 		If index equals 2 set [page:.z z] to [page:Float value]
 		If index equals 2 set [page:.z z] to [page:Float value]
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setFromCylindrical]( [param:Cylindrical c] )</h3>
+		<h3>[method:this setFromCylindrical]( [param:Cylindrical c] )</h3>
 		<p>
 		<p>
 		Sets this vector from the cylindrical coordinates [page:Cylindrical c].
 		Sets this vector from the cylindrical coordinates [page:Cylindrical c].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setFromMatrixColumn]( [param:Matrix4 matrix], [param:Integer index] )</h3>
+		<h3>[method:this setFromMatrixColumn]( [param:Matrix4 matrix], [param:Integer index] )</h3>
 		<p>
 		<p>
 		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] equal to the column of
 		Sets this vector's [page:.x x], [page:.y y] and [page:.z z] equal to the column of
 		the [page:Matrix4 matrix] specified by the [page:Integer index].
 		the [page:Matrix4 matrix] specified by the [page:Integer index].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setFromMatrixPosition]( [param:Matrix4 m] )</h3>
+		<h3>[method:this setFromMatrixPosition]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Sets this vector to the position elements of the
 		Sets this vector to the position elements of the
 		[link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
 		[link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setFromMatrixScale]( [param:Matrix4 m] )</h3>
+		<h3>[method:this setFromMatrixScale]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Sets this vector to the scale elements of the
 		Sets this vector to the scale elements of the
 		[link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
 		[link:https://en.wikipedia.org/wiki/Transformation_matrix transformation matrix] [page:Matrix4 m].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setFromSpherical]( [param:Spherical s] )</h3>
+		<h3>[method:this setFromSpherical]( [param:Spherical s] )</h3>
 		<p>
 		<p>
 		Sets this vector from the spherical coordinates [page:Spherical s].
 		Sets this vector from the spherical coordinates [page:Spherical s].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setLength]( [param:Float l] )</h3>
+		<h3>[method:this setLength]( [param:Float l] )</h3>
 		<p>
 		<p>
 		Set this vector to the vector with the same direction as this one, but [page:.length length]
 		Set this vector to the vector with the same direction as this one, but [page:.length length]
 		[page:Float l].
 		[page:Float l].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setScalar]( [param:Float scalar] )</h3>
+		<h3>[method:this setScalar]( [param:Float scalar] )</h3>
 		<p>
 		<p>
 		Set the [page:.x x], [page:.y y] and [page:.z z] values of this vector both equal to [page:Float scalar].
 		Set the [page:.x x], [page:.y y] and [page:.z z] values of this vector both equal to [page:Float scalar].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 setX]( [param:Float x] )</h3>
+		<h3>[method:this setX]( [param:Float x] )</h3>
 		<p>Replace this vector's [page:.x x] value with [page:Float x].</p>
 		<p>Replace this vector's [page:.x x] value with [page:Float x].</p>
 
 
-		<h3>[method:Vector3 setY]( [param:Float y] )</h3>
+		<h3>[method:this setY]( [param:Float y] )</h3>
 		<p>Replace this vector's [page:.y y] value with [page:Float y].</p>
 		<p>Replace this vector's [page:.y y] value with [page:Float y].</p>
 
 
-		<h3>[method:Vector3 setZ]( [param:Float z] )</h3>
+		<h3>[method:this setZ]( [param:Float z] )</h3>
 		<p>Replace this vector's [page:.z z] value with [page:Float z].</p>
 		<p>Replace this vector's [page:.z z] value with [page:Float z].</p>
 
 
-		<h3>[method:Vector3 sub]( [param:Vector3 v] )</h3>
+		<h3>[method:this sub]( [param:Vector3 v] )</h3>
 		<p>Subtracts [page:Vector3 v] from this vector.</p>
 		<p>Subtracts [page:Vector3 v] from this vector.</p>
 
 
-		<h3>[method:Vector3 subScalar]( [param:Float s] )</h3>
+		<h3>[method:this subScalar]( [param:Float s] )</h3>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x], [page:.y y] and [page:.z z] compnents.</p>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x], [page:.y y] and [page:.z z] compnents.</p>
 
 
-		<h3>[method:Vector3 subVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
+		<h3>[method:this subVectors]( [param:Vector3 a], [param:Vector3 b] )</h3>
 		<p>Sets this vector to [page:Vector3 a] - [page:Vector3 b].</p>
 		<p>Sets this vector to [page:Vector3 a] - [page:Vector3 b].</p>
 
 
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
@@ -418,13 +418,13 @@ var d = a.distanceTo( b );
 		Returns an array [x, y, z], or copies x, y and z into the provided [page:Array array].
 		Returns an array [x, y, z], or copies x, y and z into the provided [page:Array array].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 transformDirection]( [param:Matrix4 m] )</h3>
+		<h3>[method:this transformDirection]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a [page:Matrix4 m])
 		Transforms the direction of this vector by a matrix (the upper left 3 x 3 subset of a [page:Matrix4 m])
 		and then [page:.normalize normalizes] the result.
 		and then [page:.normalize normalizes] the result.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector3 unproject]( [param:Camera camera] )</h3>
+		<h3>[method:this unproject]( [param:Camera camera] )</h3>
 		<p>
 		<p>
 		[page:Camera camera] — camera to use in the projection.<br /><br />
 		[page:Camera camera] — camera to use in the projection.<br /><br />
 
 

+ 35 - 35
docs/api/math/Vector4.html

@@ -81,29 +81,29 @@ var d = a.dot( b );
 
 
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 
 
-		<h3>[method:Vector4 add]( [param:Vector4 v] )</h3>
+		<h3>[method:this add]( [param:Vector4 v] )</h3>
 		<p>Adds [page:Vector4 v] to this vector.</p>
 		<p>Adds [page:Vector4 v] to this vector.</p>
 
 
-		<h3>[method:Vector4 addScalar]( [param:Float s] )</h3>
+		<h3>[method:this addScalar]( [param:Float s] )</h3>
 		<p>Adds the scalar value s to this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.</p>
 		<p>Adds the scalar value s to this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.</p>
 
 
-		<h3>[method:Vector4 addScaledVector]( [param:Vector4 v], [param:Float s] )</h3>
+		<h3>[method:this addScaledVector]( [param:Vector4 v], [param:Float s] )</h3>
 		<p>Adds the multiple of [page:Vector4 v] and [page:Float s] to this vector.</p>
 		<p>Adds the multiple of [page:Vector4 v] and [page:Float s] to this vector.</p>
 
 
-		<h3>[method:Vector4 addVectors]( [param:Vector4 a], [param:Vector4 b] )</h3>
+		<h3>[method:this addVectors]( [param:Vector4 a], [param:Vector4 b] )</h3>
 		<p>Sets this vector to [page:Vector4 a] + [page:Vector4 b].</p>
 		<p>Sets this vector to [page:Vector4 a] + [page:Vector4 b].</p>
 
 
-		<h3>[method:Vector4 applyMatrix4]( [param:Matrix4 m] )</h3>
+		<h3>[method:this applyMatrix4]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 		Multiplies this vector by 4 x 4 [page:Matrix4 m].
 		Multiplies this vector by 4 x 4 [page:Matrix4 m].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 ceil]()</h3>
+		<h3>[method:this ceil]()</h3>
 		<p>
 		<p>
 		The [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of the vector are rounded up to the nearest integer value.
 		The [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of the vector are rounded up to the nearest integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 clamp]( [param:Vector4 min], [param:Vector4 max] )</h3>
+		<h3>[method:this clamp]( [param:Vector4 min], [param:Vector4 max] )</h3>
 		<p>
 		<p>
 		[page:Vector4 min] - the minimum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.<br />
 		[page:Vector4 min] - the minimum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values.<br />
 		[page:Vector4 max] - the maximum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values in the desired range<br /><br />
 		[page:Vector4 max] - the maximum [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values in the desired range<br /><br />
@@ -112,7 +112,7 @@ var d = a.dot( b );
 		If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, it is replaced by the corresponding value.
 		If this vector's x, y, z or w value is less than the min vector's x, y, z or w value, it is replaced by the corresponding value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 clampLength]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampLength]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float min] - the minimum value the length will be clamped to <br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
 		[page:Float max] - the maximum value the length will be clamped to<br /><br />
@@ -121,7 +121,7 @@ var d = a.dot( b );
 		If this vector's length is less than the min value, it is replaced by the min value.
 		If this vector's length is less than the min value, it is replaced by the min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 clampScalar]( [param:Float min], [param:Float max] )</h3>
+		<h3>[method:this clampScalar]( [param:Float min], [param:Float max] )</h3>
 		<p>
 		<p>
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float min] - the minimum value the components will be clamped to <br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
 		[page:Float max] - the maximum value the components will be clamped to<br /><br />
@@ -135,13 +135,13 @@ var d = a.dot( b );
 		Returns a new Vector4 with the same [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values as this one.
 		Returns a new Vector4 with the same [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values as this one.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 copy]( [param:Vector4 v] )</h3>
+		<h3>[method:this copy]( [param:Vector4 v] )</h3>
 		<p>
 		<p>
 			Copies the values of the passed Vector4's [page:.x x], [page:.y y], [page:.z z] and [page:.w w]
 			Copies the values of the passed Vector4's [page:.x x], [page:.y y], [page:.z z] and [page:.w w]
 			properties to this Vector4.
 			properties to this Vector4.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 divideScalar]( [param:Float s] )</h3>
+		<h3>[method:this divideScalar]( [param:Float s] )</h3>
 		<p>
 		<p>
 		Divides this vector by scalar [page:Float s].<br />
 		Divides this vector by scalar [page:Float s].<br />
 		Sets vector to *( 0, 0, 0, 0 )* if *[page:Float s] = 0*.
 		Sets vector to *( 0, 0, 0, 0 )* if *[page:Float s] = 0*.
@@ -156,10 +156,10 @@ var d = a.dot( b );
 		<h3>[method:Boolean equals]( [param:Vector4 v] )</h3>
 		<h3>[method:Boolean equals]( [param:Vector4 v] )</h3>
 		<p>Checks for strict equality of this vector and [page:Vector4 v].</p>
 		<p>Checks for strict equality of this vector and [page:Vector4 v].</p>
 
 
-		<h3>[method:Vector4 floor]()</h3>
+		<h3>[method:this floor]()</h3>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 		<p>The components of the vector are rounded down to the nearest integer value.</p>
 
 
-		<h3>[method:Vector4 fromArray]( [param:Array array], [param:Integer offset] )</h3>
+		<h3>[method:this fromArray]( [param:Array array], [param:Integer offset] )</h3>
 		<p>
 		<p>
 		[page:Array array] - the source array.<br />
 		[page:Array array] - the source array.<br />
 		[page:Integer offset] - (optional) offset into the array. Default is 0.<br /><br />
 		[page:Integer offset] - (optional) offset into the array. Default is 0.<br /><br />
@@ -168,7 +168,7 @@ var d = a.dot( b );
 		[page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ].
 		[page:.z z] value to be array[ offset + 2 ] and [page:.w w ] value to be array[ offset + 3 ].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
+		<h3>[method:this fromBufferAttribute]( [param:BufferAttribute attribute], [param:Integer index] )</h3>
 		<p>
 		<p>
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:BufferAttribute attribute] - the source attribute.<br />
 		[page:Integer index] - index in the attribute.<br /><br />
 		[page:Integer index] - index in the attribute.<br /><br />
@@ -202,7 +202,7 @@ var d = a.dot( b );
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		vectors, you should compare the length squared instead as it is slightly more efficient to calculate.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 lerp]( [param:Vector4 v], [param:Float alpha] )</h3>
+		<h3>[method:this lerp]( [param:Vector4 v], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector4 v] - [page:Vector4] to interpolate towards.<br />
 		[page:Vector4 v] - [page:Vector4] to interpolate towards.<br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
 		alpha - interpolation factor in the closed interval [0, 1].<br /><br />
@@ -211,7 +211,7 @@ var d = a.dot( b );
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector4 v].
 		distance along the line - alpha = 0 will be this vector, and alpha = 1 will be [page:Vector4 v].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 lerpVectors]( [param:Vector4 v1], [param:Vector4 v2], [param:Float alpha] )</h3>
+		<h3>[method:this lerpVectors]( [param:Vector4 v1], [param:Vector4 v2], [param:Float alpha] )</h3>
 		<p>
 		<p>
 		[page:Vector4 v1] - the starting [page:Vector4].<br />
 		[page:Vector4 v1] - the starting [page:Vector4].<br />
 		[page:Vector4 v2] - [page:Vector4] to interpolate towards.<br />
 		[page:Vector4 v2] - [page:Vector4] to interpolate towards.<br />
@@ -222,42 +222,42 @@ var d = a.dot( b );
 		- alpha = 0 will be [page:Vector4 v1], and alpha = 1 will be [page:Vector4 v2].
 		- alpha = 0 will be [page:Vector4 v1], and alpha = 1 will be [page:Vector4 v2].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 negate]()</h3>
+		<h3>[method:this negate]()</h3>
 		<p>Inverts this vector - i.e. sets x = -x, y = -y, z = -z and w = -w.</p>
 		<p>Inverts this vector - i.e. sets x = -x, y = -y, z = -z and w = -w.</p>
 
 
-		<h3>[method:Vector4 normalize]()</h3>
+		<h3>[method:this normalize]()</h3>
 		<p>
 		<p>
 		Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		Converts this vector to a [link:https://en.wikipedia.org/wiki/Unit_vector unit vector] - that is, sets it equal to the vector with the same direction
 		as this one, but [page:.length length] 1.
 		as this one, but [page:.length length] 1.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 max]( [param:Vector4 v] )</h3>
+		<h3>[method:this max]( [param:Vector4 v] )</h3>
 		<p>
 		<p>
 		If this vector's x, y, z or w value is less than [page:Vector4 v]'s x, y, z or w value, replace
 		If this vector's x, y, z or w value is less than [page:Vector4 v]'s x, y, z or w value, replace
 		that value with the corresponding max value.
 		that value with the corresponding max value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 min]( [param:Vector4 v] )</h3>
+		<h3>[method:this min]( [param:Vector4 v] )</h3>
 		<p>
 		<p>
 		If this vector's x, y, z or w value is greater than [page:Vector4 v]'s x, y, z or w value, replace
 		If this vector's x, y, z or w value is greater than [page:Vector4 v]'s x, y, z or w value, replace
 		that value with the corresponding min value.
 		that value with the corresponding min value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 multiplyScalar]( [param:Float s] )</h3>
+		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 
 
-		<h3>[method:Vector4 round]()</h3>
+		<h3>[method:this round]()</h3>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 		<p>The components of the vector are rounded to the nearest integer value.</p>
 
 
-		<h3>[method:Vector4 roundToZero]()</h3>
+		<h3>[method:this roundToZero]()</h3>
 		<p>
 		<p>
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		The components of the vector are rounded towards zero (up if negative, down if positive) to an integer value.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 set]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )</h3>
+		<h3>[method:this set]( [param:Float x], [param:Float y], [param:Float z], [param:Float w] )</h3>
 		<p>Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of this vector.</p>
 		<p>Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] components of this vector.</p>
 
 
-		<h3>[method:Vector4 setAxisAngleFromQuaternion]( [param:Quaterion q] )</h3>
+		<h3>[method:this setAxisAngleFromQuaternion]( [param:Quaterion q] )</h3>
 		<p>
 		<p>
 			[page:Quaterion q] - a normalized [page:Quaterion]<br /><br />
 			[page:Quaterion q] - a normalized [page:Quaterion]<br /><br />
 
 
@@ -265,7 +265,7 @@ var d = a.dot( b );
 			quaternion's axis and [page:.w w] to the angle.
 			quaternion's axis and [page:.w w] to the angle.
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 setAxisAngleFromRotationMatrix]( [param:Matrix4 m] )</h3>
+		<h3>[method:this setAxisAngleFromRotationMatrix]( [param:Matrix4 m] )</h3>
 		<p>
 		<p>
 			 [page:Matrix4 m] - a [page:Matrix4] of which the upper left 3x3 matrix is a pure rotation matrix.<br /><br />
 			 [page:Matrix4 m] - a [page:Matrix4] of which the upper left 3x3 matrix is a pure rotation matrix.<br /><br />
 
 
@@ -284,36 +284,36 @@ var d = a.dot( b );
 		</p>
 		</p>
 
 
 
 
-		<h3>[method:Vector4 setLength]( [param:Float l] )</h3>
+		<h3>[method:this setLength]( [param:Float l] )</h3>
 		<p>
 		<p>
 		Sets this vector to the vector with the same direction as this one, but [page:.length length]
 		Sets this vector to the vector with the same direction as this one, but [page:.length length]
 		[page:Float l].
 		[page:Float l].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 setScalar]( [param:Float scalar] )</h3>
+		<h3>[method:this setScalar]( [param:Float scalar] )</h3>
 		<p>
 		<p>
 		Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values of this vector both equal to [page:Float scalar].
 		Sets the [page:.x x], [page:.y y], [page:.z z] and [page:.w w] values of this vector both equal to [page:Float scalar].
 		</p>
 		</p>
 
 
-		<h3>[method:Vector4 setX]( [param:Float x] )</h3>
+		<h3>[method:this setX]( [param:Float x] )</h3>
 		<p>Replaces this vector's [page:.x x] value with [page:Float x].</p>
 		<p>Replaces this vector's [page:.x x] value with [page:Float x].</p>
 
 
-		<h3>[method:Vector4 setY]( [param:Float y] )</h3>
+		<h3>[method:this setY]( [param:Float y] )</h3>
 		<p>Replaces this vector's [page:.y y] value with [page:Float y].</p>
 		<p>Replaces this vector's [page:.y y] value with [page:Float y].</p>
 
 
-		<h3>[method:Vector4 setZ]( [param:Float z] )</h3>
+		<h3>[method:this setZ]( [param:Float z] )</h3>
 		<p>Replaces this vector's [page:.z z] value with [page:Float z].</p>
 		<p>Replaces this vector's [page:.z z] value with [page:Float z].</p>
 
 
-		<h3>[method:Vector4 setW]( [param:Float w] )</h3>
+		<h3>[method:this setW]( [param:Float w] )</h3>
 		<p>Replaces this vector's [page:.w w] value with [page:Float w].</p>
 		<p>Replaces this vector's [page:.w w] value with [page:Float w].</p>
 
 
-		<h3>[method:Vector4 sub]( [param:Vector4 v] )</h3>
+		<h3>[method:this sub]( [param:Vector4 v] )</h3>
 		<p>Subtracts [page:Vector4 v] from this vector.</p>
 		<p>Subtracts [page:Vector4 v] from this vector.</p>
 
 
-		<h3>[method:Vector4 subScalar]( [param:Float s] )</h3>
+		<h3>[method:this subScalar]( [param:Float s] )</h3>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] compnents.</p>
 		<p>Subtracts [page:Float s]  from this vector's [page:.x x], [page:.y y], [page:.z z] and [page:.w w] compnents.</p>
 
 
-		<h3>[method:Vector4 subVectors]( [param:Vector4 a], [param:Vector4 b] )</h3>
+		<h3>[method:this subVectors]( [param:Vector4 a], [param:Vector4 b] )</h3>
 		<p>Sets this vector to [page:Vector4 a] - [page:Vector4 b].</p>
 		<p>Sets this vector to [page:Vector4 a] - [page:Vector4 b].</p>
 
 
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>
 		<h3>[method:Array toArray]( [param:Array array], [param:Integer offset] )</h3>

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

@@ -79,7 +79,7 @@
 		Computes an array of distance values which are necessary for [page:LineDashedMaterial]. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.
 		Computes an array of distance values which are necessary for [page:LineDashedMaterial]. For each vertex in the geometry, the method calculates the cumulative length from the current point to the very beginning of the line.
 		</p>
 		</p>
 
 
-		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
+		<h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
 		<p>
 		<p>
 		Get intersections between a casted [page:Ray] and this Line.
 		Get intersections between a casted [page:Ray] and this Line.
 		[page:Raycaster.intersectObject] will call this method.
 		[page:Raycaster.intersectObject] will call this method.

+ 1 - 1
docs/api/objects/Mesh.html

@@ -92,7 +92,7 @@
 		<h3>[method:Mesh clone]()</h3>
 		<h3>[method:Mesh clone]()</h3>
 		<p>Returns a clone of this [name] object and its descendants.</p>
 		<p>Returns a clone of this [name] object and its descendants.</p>
 
 
-		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
+		<h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
 		<p>
 		<p>
 		Get intersections between a casted ray and this mesh.
 		Get intersections between a casted ray and this mesh.
 		[page:Raycaster.intersectObject] will call this method.
 		[page:Raycaster.intersectObject] will call this method.

+ 1 - 1
docs/api/objects/Points.html

@@ -58,7 +58,7 @@
 		<h2>Methods</h2>
 		<h2>Methods</h2>
 		<p>See the base [page:Object3D] class for common methods.</p>
 		<p>See the base [page:Object3D] class for common methods.</p>
 
 
-		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
+		<h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
 		<p>
 		<p>
 		Get intersections between a casted ray and this Points.
 		Get intersections between a casted ray and this Points.
 		[page:Raycaster.intersectObject] will call this method.
 		[page:Raycaster.intersectObject] will call this method.

+ 1 - 1
docs/api/objects/Sprite.html

@@ -76,7 +76,7 @@ scene.add( sprite );
 		Copies the properties of the passed sprite to this one.
 		Copies the properties of the passed sprite to this one.
 		</p>
 		</p>
 
 
-		<h3>[method:Array raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
+		<h3>[method:null raycast]( [param:Raycaster raycaster], [param:Array intersects] )</h3>
 		<p>
 		<p>
 		Get intersections between a casted ray and this sprite.
 		Get intersections between a casted ray and this sprite.
 		[page:Raycaster.intersectObject] will call this method.
 		[page:Raycaster.intersectObject] will call this method.

+ 1 - 0
docs/api/textures/DataTexture.html

@@ -57,6 +57,7 @@
 		// used the buffer to create a [name]
 		// used the buffer to create a [name]
 
 
 		var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
 		var texture = new THREE.DataTexture( data, width, height, THREE.RGBFormat );
+		texture.needsUpdate = true
 		</code>
 		</code>
 
 
 		<h2>Properties</h2>
 		<h2>Properties</h2>

+ 1 - 1
docs/examples/exporters/GLTFExporter.html

@@ -25,7 +25,7 @@
 
 
 		<code>
 		<code>
 		// Instantiate a exporter
 		// Instantiate a exporter
-		var exporter = new THREE.GLTFExporter( defaultOptions );
+		var exporter = new THREE.GLTFExporter();
 
 
 		// Parse the input and generate the glTF output
 		// Parse the input and generate the glTF output
 		exporter.parse( scene, function ( gltf ) {
 		exporter.parse( scene, function ( gltf ) {

+ 62 - 0
docs/examples/exporters/PLYExporter.html

@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>[name]</h1>
+
+		<p class="desc">
+		An exporter for *PLY*.
+		<br /><br />
+		<a href="https://www.khronos.org/gltf">PLY</a> (Polygon or Stanford Triangle Format) is a
+		file format for efficient delivery and loading of simple, static 3D content in a dense format.
+		Both binary and ascii formats are supported. PLY can store vertex positions, colors, normals and
+		uv coordinates. No textures or texture references are saved.
+		</p>
+
+		<h2>Example</h2>
+
+		<code>
+		// Instantiate an exporter
+		var exporter = new THREE.PLYExporter();
+
+		// Parse the input and generate the ply output
+		var data = exporter.parse( scene, options );
+		downloadFile(data);
+		</code>
+
+		<h2>Constructor</h2>
+
+		<h3>[name]()</h3>
+		<p>
+		</p>
+		<p>
+		Creates a new [name].
+		</p>
+
+		<h2>Methods</h2>
+
+		<h3>[method:null parse]( [param:Object3D input], [param:Object options] )</h3>
+		<p>
+		[page:Object input] — Object3D<br />
+		[page:Options options] — Export options<br />
+		<ul>
+			<li>excludeAttributes - array. Which properties to explicitly exclude from the exported PLY file. Valid values are 'color', 'normal', 'uv', and 'index'. If triangle indices are excluded, then a point cloud is exported. Default is an empty array.</li>
+			<li>binary - bool. Export in binary format, returning an ArrayBuffer. Default is false.</li>
+		</ul>
+		</p>
+		<p>
+		Generates ply file data as string or ArrayBuffer (ascii or binary) output from the input object.
+		If the object is composed of multiple children and geometry, they are merged into a single mesh in the file.
+		</p>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/examples/js/exporters/PLYExporter.js examples/js/exporters/PLYExporter.js]
+	</body>
+</html>

+ 2 - 2
docs/examples/quickhull/QuickHull.html

@@ -72,13 +72,13 @@
 		<p>Makes this convex hull empty.</p>
 		<p>Makes this convex hull empty.</p>
 
 
 		<h3>[method:QuickHull addVertexToFace]( [param:VertexNode vertex], [param:Face face]	)</h3>
 		<h3>[method:QuickHull addVertexToFace]( [param:VertexNode vertex], [param:Face face]	)</h3>
-		[page:VertexNodeNode vertex] - The vetex to add.<br /><br />
+		[page:VertexNodeNode vertex] - The vertex to add.<br /><br />
 		[page:Face face] - The target face.<br /><br />
 		[page:Face face] - The target face.<br /><br />
 
 
 		<p>Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.</p>
 		<p>Adds a vertex to the 'assigned' list of vertices and assigns it to the given face.</p>
 
 
 		<h3>[method:QuickHull removeVertexFromFace]( [param:VertexNode vertex], [param:Face face]	)</h3>
 		<h3>[method:QuickHull removeVertexFromFace]( [param:VertexNode vertex], [param:Face face]	)</h3>
-		[page:VertexNode vertex] - The vetex to remove.<br /><br />
+		[page:VertexNode vertex] - The vertex to remove.<br /><br />
 		[page:Face face] - The target face.<br /><br />
 		[page:Face face] - The target face.<br /><br />
 
 
 		<p>Removes a vertex from the 'assigned' list of vertices and from the given face. It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' is linked correctly after the removal.</p>
 		<p>Removes a vertex from the 'assigned' list of vertices and from the given face. It also makes sure that the link from 'face' to the first vertex it sees in 'assigned' is linked correctly after the removal.</p>

+ 1 - 0
docs/examples/renderers/CSS2DRenderer.html

@@ -33,6 +33,7 @@
 		<h2>Examples</h2>
 		<h2>Examples</h2>
 
 
 		<p>
 		<p>
+			[example:css2d_label]<br>
 			[example:webgl_loader_pdb molecules]
 			[example:webgl_loader_pdb molecules]
 		</p>
 		</p>
 
 

+ 3 - 1
docs/list.js

@@ -10,6 +10,7 @@ var list = {
 			"How to run things locally": "manual/introduction/How-to-run-things-locally",
 			"How to run things locally": "manual/introduction/How-to-run-things-locally",
 			"Drawing Lines": "manual/introduction/Drawing-lines",
 			"Drawing Lines": "manual/introduction/Drawing-lines",
 			"Creating Text": "manual/introduction/Creating-text",
 			"Creating Text": "manual/introduction/Creating-text",
+			"Loading 3D Models": "manual/introduction/Loading-3D-models",
 			"Migration Guide": "manual/introduction/Migration-guide",
 			"Migration Guide": "manual/introduction/Migration-guide",
 			"Code Style Guide": "manual/introduction/Code-style-guide",
 			"Code Style Guide": "manual/introduction/Code-style-guide",
 			"FAQ": "manual/introduction/FAQ",
 			"FAQ": "manual/introduction/FAQ",
@@ -373,7 +374,8 @@ var list = {
 		},
 		},
 
 
 		"Exporters": {
 		"Exporters": {
-			"GLTFExporter": "examples/exporters/GLTFExporter"
+			"GLTFExporter": "examples/exporters/GLTFExporter",
+			"PLYExporter": "examples/exporters/PLYExporter"
 		},
 		},
 
 
 		"Plugins": {
 		"Plugins": {

+ 5 - 5
docs/manual/introduction/Animation-system.html

@@ -35,11 +35,11 @@
 		<p class="desc">
 		<p class="desc">
 
 
 			If you have successfully imported an animated 3D object (it doesn't matter if it has
 			If you have successfully imported an animated 3D object (it doesn't matter if it has
-			bones or morph targets or both) - for example exporting it from Blender with the
-			[link:https://github.com/mrdoob/three.js/tree/master/utils/exporters/blender/addons/io_three Blender exporter] and
-			loading it into a three.js scene using [page:JSONLoader] -, one of the geometry's
-			properties of the loaded mesh should be an array named "animations", containing the
-			[page:AnimationClip AnimationClips] for this model (see a list of possible loaders below).<br /><br />
+			bones or morph targets or both)  for example exporting it from Blender with the
+			[link:https://github.com/KhronosGroup/glTF-Blender-Exporter glTF Blender exporter] and
+			loading it into a three.js scene using [page:GLTFLoader] — one of the response fields
+			should be an array named "animations", containing the [page:AnimationClip AnimationClips]
+			for this model (see a list of possible loaders below).<br /><br />
 
 
 			Each *AnimationClip* usually holds the data for a certain activity of the object. If the
 			Each *AnimationClip* usually holds the data for a certain activity of the object. If the
 			mesh is a character, for example, there may be one AnimationClip for a walkcycle, a second
 			mesh is a character, for example, there may be one AnimationClip for a walkcycle, a second

+ 1 - 1
docs/manual/introduction/Creating-a-scene.html

@@ -14,7 +14,7 @@
 
 
 		<h2>Before we start</h2>
 		<h2>Before we start</h2>
 
 
-		<p>Before you can use three.js, you need somewhere to display it. Save the following HTML to a file on your computer, along with a copy of <a href="http://threejs.org/build/three.js">three.js</a> in the js/ directory, and open it in your browser.</p>
+		<p>Before you can use three.js, you need somewhere to display it. Save the following HTML to a file on your computer, along with a copy of [link:https://threejs.org/build/three.js three.js] in the js/ directory, and open it in your browser.</p>
 
 
 		<code>
 		<code>
 		&lt;!DOCTYPE html&gt;
 		&lt;!DOCTYPE html&gt;

+ 3 - 3
docs/manual/introduction/FAQ.html

@@ -16,7 +16,7 @@
 				The recommended format for importing and exporting assets is glTF (GL Transmission Format). Because glTF is focused on runtime asset delivery, it is compact to transmit and fast to load.
 				The recommended format for importing and exporting assets is glTF (GL Transmission Format). Because glTF is focused on runtime asset delivery, it is compact to transmit and fast to load.
 			</p>
 			</p>
 			<p>
 			<p>
-				three.js provides loaders for many other popular formats like FBX, Collada or OBJ as well. Nevertheless, you should always try to establish a glTF based workflow in your projects first.
+				three.js provides loaders for many other popular formats like FBX, Collada or OBJ as well. Nevertheless, you should always try to establish a glTF based workflow in your projects first. For more information, see [link:#manual/introduction/Loading-3D-models loading 3D models].
 			</p>
 			</p>
 		</div>
 		</div>
 
 
@@ -26,9 +26,9 @@
 
 
 				<p>These tags control viewport size and scale for mobile browsers (where page content may be rendered at different size than visible viewport).</p>
 				<p>These tags control viewport size and scale for mobile browsers (where page content may be rendered at different size than visible viewport).</p>
 
 
-				<p><a href="https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html">Safari: Using the Viewport</a></p>
+				<p>[link:https://developer.apple.com/library/content/documentation/AppleApplications/Reference/SafariWebContent/UsingtheViewport/UsingtheViewport.html Safari: Using the Viewport]</p>
 
 
-				<p><a href="https://developer.mozilla.org/en/Mobile/Viewport_meta_tag">MDN: Using the viewport meta tag</a></p>
+				<p>[link:https://developer.mozilla.org/en/Mobile/Viewport_meta_tag MDN: Using the viewport meta tag]</p>
 		</div>
 		</div>
 
 
 		<h2>How can scene scale be preserved on resize?</h2>
 		<h2>How can scene scale be preserved on resize?</h2>

+ 3 - 3
docs/manual/introduction/Import-via-modules.html

@@ -23,11 +23,11 @@
 
 
 		<h2>Installation via npm</h2>
 		<h2>Installation via npm</h2>
 
 
-		<p>Three.js is published as an npm module, see: <a href="https://www.npmjs.com/package/three" target="_blank">npm</a>. This means all you need to do to include three.js into your project is run "npm install three"</p>
+		<p>Three.js is published as an npm module, see: [link:https://www.npmjs.com/package/three npm]. This means all you need to do to include three.js into your project is run "npm install three"</p>
 
 
 		<h2>Importing the module</h2>
 		<h2>Importing the module</h2>
 
 
-		<p>Assuming that you're bundling your files with a tool such as <a href="https://webpack.github.io/" target="_blank">Webpack</a> or <a href="https://github.com/substack/node-browserify" target="_blank">Browserify</a>, which allow you to "require('modules') in the browser by bundling up all of your dependencies."</p>
+		<p>Assuming that you're bundling your files with a tool such as [link:https://webpack.github.io/ Webpack] or [link:https://github.com/substack/node-browserify Browserify], which allow you to "require('modules') in the browser by bundling up all of your dependencies."</p>
 
 
 		<p>
 		<p>
 			You should now be able to import the module into your source files and continue to use it as per normal.
 			You should now be able to import the module into your source files and continue to use it as per normal.
@@ -41,7 +41,7 @@
 		</code>
 		</code>
 
 
 		<p>
 		<p>
-			You're also able to leverage <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import" target="_blank">ES6 import syntax</a>:
+			You're also able to leverage [link:https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import ES6 import syntax]:
 		</p>
 		</p>
 
 
 		<code>
 		<code>

+ 129 - 0
docs/manual/introduction/Loading-3D-models.html

@@ -0,0 +1,129 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+  <meta charset="utf-8">
+  <base href="../../" />
+  <script src="list.js"></script>
+  <script src="page.js"></script>
+  <link type="text/css" rel="stylesheet" href="page.css" />
+</head>
+
+<body>
+  <h1>[name]</h1>
+  <br />
+
+  <p>
+    3D models are available in hundreds of file formats, each with different
+    purposes, assorted features, and varying complexity. Although
+    <a href="https://github.com/mrdoob/three.js/tree/dev/examples/js/loaders">
+    three.js provides many loaders</a>, choosing the right format and
+    workflow will save time and frustration later on. Some formats are
+    difficult to work with, inefficient for realtime experiences, or simply not
+    fully supported at this time.
+  </p>
+
+  <p>
+    This guide provides a workflow recommended for most users, and suggestions
+    for what to try if things don't go as expected.
+  </p>
+
+  <h2>Before we start</h2>
+
+  <p>
+    If you're new to running a local server, begin with
+    [link:#manual/introduction/How-to-run-things-locally how to run things locally]
+    first. Many common errors viewing 3D models can be avoided by hosting files
+    correctly.
+  </p>
+
+  <h2>Recommended workflow</h2>
+
+  <p>
+    Where possible, we recommend using glTF (GL Transmission Format). Both
+    <small>.GLB</small> and <small>.GLTF</small> versions of the format are
+    well supported. Because glTF is focused on runtime asset delivery, it is
+    compact to transmit and fast to load. Features include meshes, materials,
+    textures, skins, skeletons, morph targets, animations, lights, and
+    cameras.
+  </p>
+
+  <p>
+    Public-domain glTF files are available on sites like
+    <a href="https://sketchfab.com/models?features=downloadable&sort_by=-likeCount&type=models">
+    Sketchfab</a>, or various tools include glTF export:
+  </p>
+
+  <ul>
+    <li><a href="https://github.com/KhronosGroup/glTF-Blender-Exporter">glTF-Blender-Exporter</a> by the Khronos Group</li>
+    <li><a href="https://github.com/KhronosGroup/COLLADA2GLTF">COLLADA2GLTF</a> by the Khronos Group</li>
+    <li><a href="https://github.com/facebookincubator/FBX2glTF">FBX2GLTF</a> by Facebook</li>
+    <li><a href="https://github.com/AnalyticalGraphicsInc/obj2gltf">OBJ2GLTF</a> by Analytical Graphics Inc</li>
+    <li><a href="https://www.allegorithmic.com/products/substance-painter">Substance Painter</a> by Allegorithmic</li>
+    <li><a href="https://www.foundry.com/products/modo">Modo</a> by Foundry</li>
+    <li><a href="https://www.marmoset.co/toolbag/">Toolbag</a> by Marmoset</li>
+    <li>&hellip;and <a href="https://github.com/khronosgroup/gltf#gltf-tools">many more</a></li>
+  </ul>
+
+  <p>
+    If your preferred tools do not support glTF, consider requesting glTF
+    export from the authors, or posting on
+    <a href="https://github.com/KhronosGroup/glTF/issues/1051">the glTF roadmap thread</a>.
+  </p>
+
+  <p>
+    When glTF is not an option, popular formats such as FBX, OBJ, or COLLADA
+    are also available and regularly maintained.
+  </p>
+
+  <h2>Troubleshooting</h2>
+
+  <p>
+    You've spent hours modeling an artisanal masterpiece, you load it into
+    the webpage, and — oh no! 😭 It's distorted, miscolored, or missing entirely.
+    Start with these troubleshooting steps:
+  </p>
+
+  <ol>
+    <li>
+      Check the JavaScript console for errors, and make sure you've used an
+      <em>onError</em> callback when calling <em>.load()</em> to log the result.
+    </li>
+    <li>
+      View the model in another application. For glTF, drag-and-drop viewers
+      are available for
+      <a href="https://gltf-viewer.donmccurdy.com/">three.js</a> and
+      <a href="http://sandbox.babylonjs.com/">babylon.js</a>. If the model
+      appears correctly in one or more applications,
+      <a href="https://github.com/mrdoob/three.js/issues/new">file a bug against three.js</a>.
+      If the model cannot be shown in any application, we strongly encourage
+      filing a bug with the application used to create the model.
+    </li>
+    <li>
+      Try scaling the model up or down by a factor of 1000. Many models are
+      scaled differently, and large models may not appear if the camera is
+      inside the model.
+    </li>
+    <li>
+      Look for failed texture requests in the network tab, like
+      <em>C:\\Path\To\Model\texture.jpg</em>. Use paths relative to your
+      model instead, such as <em>images/texture.jpg</em> — this may require
+      editing the model file in a text editor.
+    </li>
+  </ol>
+
+  <h2>Asking for help</h2>
+
+  <p>
+    If you've gone through the troubleshooting process above and your model
+    still isn't working, the right approach to asking for help will get you to
+    a solution faster. Post a question on the
+    <a href="https://discourse.threejs.org/">three.js forum</a> and, whenever possible,
+    include your model (or a simpler model with the same problem) in any formats
+    you have available. Include enough information for someone else to reproduce
+    the issue quickly — ideally, a live demo.
+  </p>
+
+</body>
+
+</html>

+ 7 - 0
docs/manual/introduction/Useful-links.html

@@ -126,6 +126,13 @@
 			[link:http://idflood.github.io/ThreeNodes.js/ ThreeNodes.js].
 			[link:http://idflood.github.io/ThreeNodes.js/ ThreeNodes.js].
 		</li>
 		</li>
 	 </ul>
 	 </ul>
+		
+	<h2>WebGL References</h2>
+	 <ul>
+		 <li>
+			[link:https://www.khronos.org/files/webgl/webgl-reference-card-1_0.pdf] - Reference of all WebGL and GLSL keywords, terminology, syntex and definations.
+		 </li>
+	 </ul>
 
 
 	 <h2>Old Links</h2>
 	 <h2>Old Links</h2>
 	 <p>
 	 <p>

+ 1 - 1
docs/page.js

@@ -70,7 +70,7 @@ function onDocumentLoad( event ) {
 	text = text.replace( /\[example:([\w\_]+)\]/gi, "[example:$1 $1]" ); // [example:name] to [example:name title]
 	text = text.replace( /\[example:([\w\_]+)\]/gi, "[example:$1 $1]" ); // [example:name] to [example:name title]
 	text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, "<a href=\"../examples/#$1\"  target=\"_blank\">$2</a>" ); // [example:name title]
 	text = text.replace( /\[example:([\w\_]+) ([\w\:\/\.\-\_ \s]+)\]/gi, "<a href=\"../examples/#$1\"  target=\"_blank\">$2</a>" ); // [example:name title]
 
 
-	text = text.replace( /<a class="param" onclick="window.parent.setUrlFragment\('\w+'\)">(null|Boolean|Object|Array|Number|String|Integer|Float|TypedArray|ArrayBuffer)<\/a>/gi, '<span class="param">$1</span>' ); // remove links to primitive types
+	text = text.replace( /<a class="param" onclick="window.parent.setUrlFragment\('\w+'\)">(null|this|Boolean|Object|Array|Number|String|Integer|Float|TypedArray|ArrayBuffer)<\/a>/gi, '<span class="param">$1</span>' ); // remove links to primitive types
 
 
 	document.body.innerHTML = text;
 	document.body.innerHTML = text;
 
 

+ 11 - 27
docs/scenes/geometry-browser.html

@@ -72,36 +72,20 @@
 			scene.add( lights[ 1 ] );
 			scene.add( lights[ 1 ] );
 			scene.add( lights[ 2 ] );
 			scene.add( lights[ 2 ] );
 
 
-			var mesh = new THREE.Object3D();
+			var group = new THREE.Group();
 
 
-			mesh.add( new THREE.LineSegments(
+			var geometry = new THREE.BufferGeometry();
+			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( [], 3 ) );
 
 
-				new THREE.Geometry(),
+			var lineMaterial = new THREE.LineBasicMaterial( { color: 0xffffff, transparent: true, opacity: 0.5 } );
+			var meshMaterial = new THREE.MeshPhongMaterial( { color: 0x156289, emissive: 0x072534, side: THREE.DoubleSide, flatShading: true } );
 
 
-				new THREE.LineBasicMaterial( {
-					color: 0xffffff,
-					transparent: true,
-					opacity: 0.5
-				} )
+			group.add( new THREE.LineSegments( geometry, lineMaterial ) );
+			group.add( new THREE.Mesh( geometry, meshMaterial ) );
 
 
-			) );
+			var options = chooseFromHash( group );
 
 
-			mesh.add( new THREE.Mesh(
-
-				new THREE.Geometry(),
-
-				new THREE.MeshPhongMaterial( {
-					color: 0x156289,
-					emissive: 0x072534,
-					side: THREE.DoubleSide,
-					flatShading: true
-				} )
-
-			) );
-
-			var options = chooseFromHash( mesh );
-
-			scene.add( mesh );
+			scene.add( group );
 
 
 			var prevFog = false;
 			var prevFog = false;
 
 
@@ -111,8 +95,8 @@
 
 
 				if ( ! options.fixed ) {
 				if ( ! options.fixed ) {
 
 
-					mesh.rotation.x += 0.005;
-					mesh.rotation.y += 0.005;
+					group.rotation.x += 0.005;
+					group.rotation.y += 0.005;
 
 
 				}
 				}
 
 

+ 150 - 0
examples/css2d_label.html

@@ -0,0 +1,150 @@
+<!DOCTYPE html>
+<html>
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<title>three.js css2d - label</title>
+		<style>
+			body {
+				background-color: #000;
+				margin: 0;
+				overflow: hidden;
+			}
+			#info {
+				position: absolute;
+				top: 0px;
+				width: 100%;
+				color: #FFF;
+				padding: 5px;
+				font-family: Monospace;
+				font-size: 13px;
+				text-align: center;
+				z-index: 1;
+			}
+
+			.label{
+				color: #FFF;
+				font-family: sans-serif;
+				padding: 2px;
+				background: rgba( 0, 0, 0, .6 );
+			}
+
+			a {
+				color: #000000;
+			}
+
+		</style>
+	</head>
+	<body>
+		<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - three.js css2d - label</div>
+
+		<script src="../build/three.js"></script>
+
+		<script src="js/controls/OrbitControls.js"></script>
+
+		<script src="js/renderers/CSS2DRenderer.js"></script>
+
+		<script>
+
+			var camera, scene, renderer, labelRenderer;
+			var controls;
+			var clock = new THREE.Clock();
+			var textureLoader = new THREE.TextureLoader();
+
+			var earth, moon;
+
+			init();
+			animate();
+
+			function init() {
+
+				var EARTH_RADIUS = 1;
+				var MOON_RADIUS = 0.27;
+
+				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.set( 10, 5, 20 );
+
+				controls = new THREE.OrbitControls( camera );
+
+				scene = new THREE.Scene();
+
+				scene2 = new THREE.Scene();
+
+				dirLight = new THREE.DirectionalLight( 0xffffff );
+				dirLight.position.set( 0, 0, 1 );
+				scene.add( dirLight );
+
+				var axesHelper = new THREE.AxesHelper( 5 );
+				scene.add( axesHelper );
+
+				//
+
+				var earthGeometry = new THREE.SphereBufferGeometry( EARTH_RADIUS, 16, 16 );
+				var earthMaterial = new THREE.MeshPhongMaterial( {
+					specular: 0x333333,
+					shininess: 5,
+					map: textureLoader.load( 'textures/planets/earth_atmos_2048.jpg' ),
+					specularMap: textureLoader.load( 'textures/planets/earth_specular_2048.jpg' ),
+					normalMap: textureLoader.load( 'textures/planets/earth_normal_2048.jpg' ),
+					normalScale: new THREE.Vector2( 0.85, 0.85 )
+				} );
+				earth = new THREE.Mesh( earthGeometry, earthMaterial );
+				scene.add( earth );
+
+				var moonGeometry = new THREE.SphereBufferGeometry( MOON_RADIUS, 16, 16 );
+				var moonMaterial = new THREE.MeshPhongMaterial( {
+					shininess: 5,
+					map: textureLoader.load( 'textures/planets/moon_1024.jpg' )
+				} );
+				moon = new THREE.Mesh( moonGeometry, moonMaterial );
+				scene.add( moon );
+
+				//
+
+				var earthDiv = document.createElement( 'div' );
+				earthDiv.className = 'label';
+				earthDiv.textContent = 'Earth';
+				earthDiv.style.marginTop = '-1em';
+				var earthLabel = new THREE.CSS2DObject( earthDiv );
+				earthLabel.position.set( 0, EARTH_RADIUS, 0 );
+				earth.add( earthLabel );
+
+				var moonDiv = document.createElement( 'div' );
+				moonDiv.className = 'label';
+				moonDiv.textContent = 'Moon';
+				moonDiv.style.marginTop = '-1em';
+				var moonLabel = new THREE.CSS2DObject( moonDiv );
+				moonLabel.position.set( 0, MOON_RADIUS, 0 );
+				moon.add( moonLabel );
+
+				//
+
+				renderer = new THREE.WebGLRenderer();
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				document.body.appendChild( renderer.domElement );
+
+				labelRenderer = new THREE.CSS2DRenderer();
+				labelRenderer.setSize( window.innerWidth, window.innerHeight );
+				labelRenderer.domElement.style.position = 'absolute';
+				labelRenderer.domElement.style.top = 0;
+				document.body.appendChild( labelRenderer.domElement );
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+
+				var elapsed = clock.getElapsedTime();
+
+				moon.position.set( Math.sin( elapsed ) * 5, 0, Math.cos( elapsed ) * 5 );
+
+				renderer.render( scene, camera );
+				labelRenderer.render( scene, camera );
+
+			}
+
+		</script>
+	</body>
+</html>

+ 6 - 2
examples/files.js

@@ -22,7 +22,7 @@ var files = {
 		"webgl_geometries",
 		"webgl_geometries",
 		"webgl_geometries_parametric",
 		"webgl_geometries_parametric",
 		"webgl_geometry_colors",
 		"webgl_geometry_colors",
-		"webgl_geometry_colors_blender",
+		"webgl_geometry_colors_json",
 		"webgl_geometry_colors_lookuptable",
 		"webgl_geometry_colors_lookuptable",
 		"webgl_geometry_convex",
 		"webgl_geometry_convex",
 		"webgl_geometry_cube",
 		"webgl_geometry_cube",
@@ -93,7 +93,7 @@ var files = {
 		"webgl_loader_gltf",
 		"webgl_loader_gltf",
 		"webgl_loader_gltf_extensions",
 		"webgl_loader_gltf_extensions",
 		"webgl_loader_imagebitmap",
 		"webgl_loader_imagebitmap",
-		"webgl_loader_json_blender",
+		"webgl_loader_json",
 		"webgl_loader_json_claraio",
 		"webgl_loader_json_claraio",
 		"webgl_loader_json_objconverter",
 		"webgl_loader_json_objconverter",
 		"webgl_loader_kmz",
 		"webgl_loader_kmz",
@@ -342,6 +342,7 @@ var files = {
 		"misc_controls_transform",
 		"misc_controls_transform",
 		"misc_exporter_gltf",
 		"misc_exporter_gltf",
 		"misc_exporter_obj",
 		"misc_exporter_obj",
+		"misc_exporter_stl",
 		"misc_fps",
 		"misc_fps",
 		"misc_lights_test",
 		"misc_lights_test",
 		"misc_lookat",
 		"misc_lookat",
@@ -359,6 +360,9 @@ var files = {
 		"css3d_sprites",
 		"css3d_sprites",
 		"css3d_youtube"
 		"css3d_youtube"
 	],
 	],
+	"css2d": [
+		"css2d_label"
+	],
 	"canvas": [
 	"canvas": [
 		"canvas_ascii_effect",
 		"canvas_ascii_effect",
 		"canvas_camera_orthographic",
 		"canvas_camera_orthographic",

+ 2 - 7
examples/js/BufferGeometryUtils.js

@@ -236,13 +236,8 @@ THREE.BufferGeometryUtils = {
 
 
 			// gather .userData
 			// gather .userData
 
 
-			if ( geometry.userData !== undefined ) {
-
-				mergedGeometry.userData = mergedGeometry.userData || {};
-				mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
-				mergedGeometry.userData.mergedUserData.push( geometry.userData );
-
-			}
+			mergedGeometry.userData.mergedUserData = mergedGeometry.userData.mergedUserData || [];
+			mergedGeometry.userData.mergedUserData.push( geometry.userData );
 
 
 			if ( useGroups ) {
 			if ( useGroups ) {
 
 

+ 14 - 10
examples/js/Cloth.js

@@ -46,15 +46,13 @@ var lastTime;
 
 
 function plane( width, height ) {
 function plane( width, height ) {
 
 
-	return function ( u, v, optionalTarget ) {
-
-		var result = optionalTarget || new THREE.Vector3();
+	return function ( u, v, target ) {
 
 
 		var x = ( u - 0.5 ) * width;
 		var x = ( u - 0.5 ) * width;
 		var y = ( v + 0.5 ) * height;
 		var y = ( v + 0.5 ) * height;
 		var z = 0;
 		var z = 0;
 
 
-		return result.set( x, y, z );
+		target.set( x, y, z );
 
 
 	};
 	};
 
 
@@ -62,20 +60,26 @@ function plane( width, height ) {
 
 
 function Particle( x, y, z, mass ) {
 function Particle( x, y, z, mass ) {
 
 
-	this.position = clothFunction( x, y ); // position
-	this.previous = clothFunction( x, y ); // previous
-	this.original = clothFunction( x, y );
+	this.position = new THREE.Vector3();
+	this.previous = new THREE.Vector3();
+	this.original = new THREE.Vector3();
 	this.a = new THREE.Vector3( 0, 0, 0 ); // acceleration
 	this.a = new THREE.Vector3( 0, 0, 0 ); // acceleration
 	this.mass = mass;
 	this.mass = mass;
 	this.invMass = 1 / mass;
 	this.invMass = 1 / mass;
 	this.tmp = new THREE.Vector3();
 	this.tmp = new THREE.Vector3();
 	this.tmp2 = new THREE.Vector3();
 	this.tmp2 = new THREE.Vector3();
 
 
+	// init
+
+	clothFunction( x, y, this.position ); // position
+	clothFunction( x, y, this.previous ); // previous
+	clothFunction( x, y, this.original );
+
 }
 }
 
 
 // Force -> Acceleration
 // Force -> Acceleration
 
 
-Particle.prototype.addForce = function( force ) {
+Particle.prototype.addForce = function ( force ) {
 
 
 	this.a.add(
 	this.a.add(
 		this.tmp2.copy( force ).multiplyScalar( this.invMass )
 		this.tmp2.copy( force ).multiplyScalar( this.invMass )
@@ -86,7 +90,7 @@ Particle.prototype.addForce = function( force ) {
 
 
 // Performs Verlet integration
 // Performs Verlet integration
 
 
-Particle.prototype.integrate = function( timesq ) {
+Particle.prototype.integrate = function ( timesq ) {
 
 
 	var newPos = this.tmp.subVectors( this.position, this.previous );
 	var newPos = this.tmp.subVectors( this.position, this.previous );
 	newPos.multiplyScalar( DRAG ).add( this.position );
 	newPos.multiplyScalar( DRAG ).add( this.position );
@@ -280,7 +284,7 @@ function simulate( time ) {
 
 
 	// Ball Constraints
 	// Ball Constraints
 
 
-	ballPosition.z = - Math.sin( Date.now() / 600 ) * 90 ; //+ 40;
+	ballPosition.z = - Math.sin( Date.now() / 600 ) * 90; //+ 40;
 	ballPosition.x = Math.cos( Date.now() / 400 ) * 70;
 	ballPosition.x = Math.cos( Date.now() / 400 ) * 70;
 
 
 	if ( sphere.visible ) {
 	if ( sphere.visible ) {

+ 9 - 8
examples/js/MorphBlendMesh.js

@@ -12,9 +12,9 @@ THREE.MorphBlendMesh = function ( geometry, material ) {
 	// prepare default animation
 	// prepare default animation
 	// (all frames played together in 1 second)
 	// (all frames played together in 1 second)
 
 
-	var numFrames = this.geometry.morphTargets.length;
+	var numFrames = Object.keys( this.morphTargetDictionary ).length;
 
 
-	var name = "__default";
+	var name = '__default';
 
 
 	var startFrame = 0;
 	var startFrame = 0;
 	var endFrame = numFrames - 1;
 	var endFrame = numFrames - 1;
@@ -24,7 +24,7 @@ THREE.MorphBlendMesh = function ( geometry, material ) {
 	this.createAnimation( name, startFrame, endFrame, fps );
 	this.createAnimation( name, startFrame, endFrame, fps );
 	this.setAnimationWeight( name, 1 );
 	this.setAnimationWeight( name, 1 );
 
 
-}
+};
 
 
 THREE.MorphBlendMesh.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), {
 THREE.MorphBlendMesh.prototype = Object.assign( Object.create( THREE.Mesh.prototype ), {
 
 
@@ -61,18 +61,17 @@ THREE.MorphBlendMesh.prototype = Object.assign( Object.create( THREE.Mesh.protot
 
 
 	},
 	},
 
 
-		autoCreateAnimations: function ( fps ) {
+	autoCreateAnimations: function ( fps ) {
 
 
 		var pattern = /([a-z]+)_?(\d+)/i;
 		var pattern = /([a-z]+)_?(\d+)/i;
 
 
 		var firstAnimation, frameRanges = {};
 		var firstAnimation, frameRanges = {};
 
 
-		var geometry = this.geometry;
+		var i = 0;
 
 
-		for ( var i = 0, il = geometry.morphTargets.length; i < il; i ++ ) {
+		for ( var key in this.morphTargetDictionary ) {
 
 
-			var morph = geometry.morphTargets[ i ];
-			var chunks = morph.name.match( pattern );
+			var chunks = key.match( pattern );
 
 
 			if ( chunks && chunks.length > 1 ) {
 			if ( chunks && chunks.length > 1 ) {
 
 
@@ -89,6 +88,8 @@ THREE.MorphBlendMesh.prototype = Object.assign( Object.create( THREE.Mesh.protot
 
 
 			}
 			}
 
 
+			i ++;
+
 		}
 		}
 
 
 		for ( var name in frameRanges ) {
 		for ( var name in frameRanges ) {

+ 7 - 7
examples/js/ParametricGeometries.js

@@ -28,7 +28,7 @@ THREE.ParametricGeometries = {
 
 
 		y = - 2 * ( 1 - Math.cos( u ) / 2 ) * Math.sin( v );
 		y = - 2 * ( 1 - Math.cos( u ) / 2 ) * Math.sin( v );
 
 
-		return target.set( x, y, z );
+		target.set( x, y, z );
 
 
 	},
 	},
 
 
@@ -40,7 +40,7 @@ THREE.ParametricGeometries = {
 			var y = 0;
 			var y = 0;
 			var z = v * height;
 			var z = v * height;
 
 
-			return target.set( x, y, z );
+			target.set( x, y, z );
 
 
 		};
 		};
 
 
@@ -61,7 +61,7 @@ THREE.ParametricGeometries = {
 		y = Math.sin( v ) * ( a + u * Math.cos( v / 2 ) );
 		y = Math.sin( v ) * ( a + u * Math.cos( v / 2 ) );
 		z = u * Math.sin( v / 2 );
 		z = u * Math.sin( v / 2 );
 
 
-		return target.set( x, y, z );
+		target.set( x, y, z );
 
 
 	},
 	},
 
 
@@ -83,7 +83,7 @@ THREE.ParametricGeometries = {
 		y = ( major + x ) * Math.sin( u );
 		y = ( major + x ) * Math.sin( u );
 		x = ( major + x ) * Math.cos( u );
 		x = ( major + x ) * Math.cos( u );
 
 
-		return target.set( x, y, z );
+		target.set( x, y, z );
 
 
 	}
 	}
 
 
@@ -146,7 +146,7 @@ THREE.ParametricGeometries.TubeGeometry = function ( path, segments, radius, seg
 		pos.y += cx * normal.y + cy * binormal.y;
 		pos.y += cx * normal.y + cy * binormal.y;
 		pos.z += cx * normal.z + cy * binormal.z;
 		pos.z += cx * normal.z + cy * binormal.z;
 
 
-		return target.copy( pos );
+		target.copy( pos );
 
 
 	};
 	};
 
 
@@ -225,7 +225,7 @@ THREE.ParametricGeometries.SphereGeometry = function ( size, u, v ) {
 		var y = size * Math.sin( u ) * Math.sin( v );
 		var y = size * Math.sin( u ) * Math.sin( v );
 		var z = size * Math.cos( u );
 		var z = size * Math.cos( u );
 
 
-		return target.set( x, y, z );
+		target.set( x, y, z );
 
 
 	}
 	}
 
 
@@ -251,7 +251,7 @@ THREE.ParametricGeometries.PlaneGeometry = function ( width, depth, segmentsWidt
 		var y = 0;
 		var y = 0;
 		var z = v * depth;
 		var z = v * depth;
 
 
-		return target.set( x, y, z );
+		target.set( x, y, z );
 
 
 	}
 	}
 
 

+ 1 - 1
examples/js/animation/CCDIKSolver.js

@@ -203,7 +203,7 @@ THREE.CCDIKSolver = ( function () {
 		 */
 		 */
 		createHelper: function () {
 		createHelper: function () {
 
 
-			return new CCDIKHelper( this.mesh, this.mesh.geometry.iks );
+			return new CCDIKHelper( this.mesh, this.mesh.geometry.userData.MMD.iks );
 
 
 		},
 		},
 
 

+ 8 - 5
examples/js/animation/MMDAnimationHelper.js

@@ -275,7 +275,7 @@ THREE.MMDAnimationHelper = ( function () {
 		 */
 		 */
 		createGrantSolver: function ( mesh ) {
 		createGrantSolver: function ( mesh ) {
 
 
-			return new GrantSolver( mesh, mesh.geometry.grants );
+			return new GrantSolver( mesh, mesh.geometry.userData.MMD.grants );
 
 
 		},
 		},
 
 
@@ -581,8 +581,8 @@ THREE.MMDAnimationHelper = ( function () {
 
 
 		_optimizeIK: function ( mesh, physicsEnabled ) {
 		_optimizeIK: function ( mesh, physicsEnabled ) {
 
 
-			var iks = mesh.geometry.iks;
-			var bones = mesh.geometry.bones;
+			var iks = mesh.geometry.userData.MMD.iks;
+			var bones = mesh.geometry.userData.MMD.bones;
 
 
 			for ( var i = 0, il = iks.length; i < il; i ++ ) {
 			for ( var i = 0, il = iks.length; i < il; i ++ ) {
 
 
@@ -619,7 +619,7 @@ THREE.MMDAnimationHelper = ( function () {
 
 
 			}
 			}
 
 
-			return new THREE.CCDIKSolver( mesh, mesh.geometry.iks );
+			return new THREE.CCDIKSolver( mesh, mesh.geometry.userData.MMD.iks );
 
 
 		},
 		},
 
 
@@ -632,7 +632,10 @@ THREE.MMDAnimationHelper = ( function () {
 			}
 			}
 
 
 			return new THREE.MMDPhysics(
 			return new THREE.MMDPhysics(
-				mesh, mesh.geometry.rigidBodies, mesh.geometry.constraints, params );
+				mesh,
+				mesh.geometry.userData.MMD.rigidBodies,
+				mesh.geometry.userData.MMD.constraints,
+				params );
 
 
 		},
 		},
 
 

+ 14 - 6
examples/js/cameras/CinematicCamera.js

@@ -5,20 +5,28 @@
  * @author kaypiKun
  * @author kaypiKun
  */
  */
 
 
-THREE.CinematicCamera = function( fov, aspect, near, far ) {
+THREE.CinematicCamera = function ( fov, aspect, near, far ) {
 
 
 	THREE.PerspectiveCamera.call( this, fov, aspect, near, far );
 	THREE.PerspectiveCamera.call( this, fov, aspect, near, far );
 
 
-	this.type = "CinematicCamera";
+	this.type = 'CinematicCamera';
 
 
-	this.postprocessing = { enabled	: true };
+	this.postprocessing = { enabled: true };
 	this.shaderSettings = {
 	this.shaderSettings = {
 		rings: 3,
 		rings: 3,
 		samples: 4
 		samples: 4
 	};
 	};
 
 
-	this.material_depth = new THREE.MeshDepthMaterial();
-	this.material_depth.depthPacking = THREE.RGBADepthPacking;
+	var depthShader = THREE.BokehDepthShader;
+
+	this.materialDepth = new THREE.ShaderMaterial( {
+		uniforms: depthShader.uniforms,
+		vertexShader: depthShader.vertexShader,
+		fragmentShader: depthShader.fragmentShader
+	} );
+
+	this.materialDepth.uniforms[ 'mNear' ].value = near;
+	this.materialDepth.uniforms[ 'mFar' ].value = far;
 
 
 	// In case of cinematicCamera, having a default lens set is important
 	// In case of cinematicCamera, having a default lens set is important
 	this.setLens();
 	this.setLens();
@@ -178,7 +186,7 @@ THREE.CinematicCamera.prototype.renderCinematic = function ( scene, renderer ) {
 
 
 		// Render depth into texture
 		// Render depth into texture
 
 
-		scene.overrideMaterial = this.material_depth;
+		scene.overrideMaterial = this.materialDepth;
 		renderer.render( scene, camera, this.postprocessing.rtTextureDepth, true );
 		renderer.render( scene, camera, this.postprocessing.rtTextureDepth, true );
 
 
 		// Render bokeh composite
 		// Render bokeh composite

+ 0 - 149
examples/js/controls/VRControls.js

@@ -1,149 +0,0 @@
-/**
- * @author dmarcos / https://github.com/dmarcos
- * @author mrdoob / http://mrdoob.com
- */
-
-THREE.VRControls = function ( object, onError ) {
-
-	var scope = this;
-
-	var vrDisplay, vrDisplays;
-
-	var standingMatrix = new THREE.Matrix4();
-
-	var frameData = null;
-
-	if ( 'VRFrameData' in window ) {
-
-		frameData = new VRFrameData();
-
-	}
-
-	function gotVRDisplays( displays ) {
-
-		vrDisplays = displays;
-
-		if ( displays.length > 0 ) {
-
-			vrDisplay = displays[ 0 ];
-
-		} else {
-
-			if ( onError ) onError( 'VR input not available.' );
-
-		}
-
-	}
-
-	if ( navigator.getVRDisplays ) {
-
-		navigator.getVRDisplays().then( gotVRDisplays ).catch( function () {
-
-			console.warn( 'THREE.VRControls: Unable to get VR Displays' );
-
-		} );
-
-	}
-
-	// the Rift SDK returns the position in meters
-	// this scale factor allows the user to define how meters
-	// are converted to scene units.
-
-	this.scale = 1;
-
-	// If true will use "standing space" coordinate system where y=0 is the
-	// floor and x=0, z=0 is the center of the room.
-	this.standing = false;
-
-	// Distance from the users eyes to the floor in meters. Used when
-	// standing=true but the VRDisplay doesn't provide stageParameters.
-	this.userHeight = 1.6;
-
-	this.getVRDisplay = function () {
-
-		return vrDisplay;
-
-	};
-
-	this.setVRDisplay = function ( value ) {
-
-		vrDisplay = value;
-
-	};
-
-	this.getVRDisplays = function () {
-
-		console.warn( 'THREE.VRControls: getVRDisplays() is being deprecated.' );
-		return vrDisplays;
-
-	};
-
-	this.getStandingMatrix = function () {
-
-		return standingMatrix;
-
-	};
-
-	this.update = function () {
-
-		if ( vrDisplay ) {
-
-			var pose;
-
-			if ( vrDisplay.getFrameData ) {
-
-				vrDisplay.getFrameData( frameData );
-				pose = frameData.pose;
-
-			} else if ( vrDisplay.getPose ) {
-
-				pose = vrDisplay.getPose();
-
-			}
-
-			if ( pose.orientation !== null ) {
-
-				object.quaternion.fromArray( pose.orientation );
-
-			}
-
-			if ( pose.position !== null ) {
-
-				object.position.fromArray( pose.position );
-
-			} else {
-
-				object.position.set( 0, 0, 0 );
-
-			}
-
-			if ( this.standing ) {
-
-				if ( vrDisplay.stageParameters ) {
-
-					object.updateMatrix();
-
-					standingMatrix.fromArray( vrDisplay.stageParameters.sittingToStandingTransform );
-					object.applyMatrix( standingMatrix );
-
-				} else {
-
-					object.position.setY( object.position.y + this.userHeight );
-
-				}
-
-			}
-
-			object.position.multiplyScalar( scope.scale );
-
-		}
-
-	};
-
-	this.dispose = function () {
-
-		vrDisplay = null;
-
-	};
-
-};

+ 2 - 4
examples/js/curves/NURBSSurface.js

@@ -42,14 +42,12 @@ THREE.NURBSSurface.prototype = {
 
 
 	constructor: THREE.NURBSSurface,
 	constructor: THREE.NURBSSurface,
 
 
-	getPoint: function ( t1, t2 ) {
+	getPoint: function ( t1, t2, target ) {
 
 
 		var u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u
 		var u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u
 		var v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->u
 		var v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->u
 
 
-		return THREE.NURBSUtils.calcSurfacePoint( this.degree1, this.degree2, this.knots1, this.knots2, this.controlPoints, u, v );
+		THREE.NURBSUtils.calcSurfacePoint( this.degree1, this.degree2, this.knots1, this.knots2, this.controlPoints, u, v, target );
 
 
 	}
 	}
 };
 };
-
-

+ 11 - 14
examples/js/curves/NURBSUtils.js

@@ -19,7 +19,7 @@ THREE.NURBSUtils = {
 	p : degree
 	p : degree
 	u : parametric value
 	u : parametric value
 	U : knot vector
 	U : knot vector
-	
+
 	returns the span
 	returns the span
 	*/
 	*/
 	findSpan: function( p,  u,  U ) {
 	findSpan: function( p,  u,  U ) {
@@ -43,7 +43,7 @@ THREE.NURBSUtils = {
 		var mid = Math.floor( ( low + high ) / 2 );
 		var mid = Math.floor( ( low + high ) / 2 );
 
 
 		while ( u < U[ mid ] || u >= U[ mid + 1 ] ) {
 		while ( u < U[ mid ] || u >= U[ mid + 1 ] ) {
-		  
+
 			if ( u < U[ mid ] ) {
 			if ( u < U[ mid ] ) {
 
 
 				high = mid;
 				high = mid;
@@ -61,16 +61,16 @@ THREE.NURBSUtils = {
 		return mid;
 		return mid;
 
 
 	},
 	},
-    
-		
+
+
 	/*
 	/*
 	Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2
 	Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2
-   
+
 	span : span in which u lies
 	span : span in which u lies
 	u    : parametric point
 	u    : parametric point
 	p    : degree
 	p    : degree
 	U    : knot vector
 	U    : knot vector
-	
+
 	returns array[p+1] with basis functions values.
 	returns array[p+1] with basis functions values.
 	*/
 	*/
 	calcBasisFunctions: function( span, u, p, U ) {
 	calcBasisFunctions: function( span, u, p, U ) {
@@ -81,7 +81,7 @@ THREE.NURBSUtils = {
 		N[ 0 ] = 1.0;
 		N[ 0 ] = 1.0;
 
 
 		for ( var j = 1; j <= p; ++ j ) {
 		for ( var j = 1; j <= p; ++ j ) {
-	   
+
 			left[ j ] = u - U[ span + 1 - j ];
 			left[ j ] = u - U[ span + 1 - j ];
 			right[ j ] = U[ span + j ] - u;
 			right[ j ] = U[ span + j ] - u;
 
 
@@ -108,7 +108,7 @@ THREE.NURBSUtils = {
 
 
 	/*
 	/*
 	Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1.
 	Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1.
- 
+
 	p : degree of B-Spline
 	p : degree of B-Spline
 	U : knot vector
 	U : knot vector
 	P : control points (x, y, z, w)
 	P : control points (x, y, z, w)
@@ -422,7 +422,7 @@ THREE.NURBSUtils = {
 
 
 	/*
 	/*
 	Calculate rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3.
 	Calculate rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3.
- 
+
 	p1, p2 : degrees of B-Spline surface
 	p1, p2 : degrees of B-Spline surface
 	U1, U2 : knot vectors
 	U1, U2 : knot vectors
 	P      : control points (x, y, z, w)
 	P      : control points (x, y, z, w)
@@ -430,7 +430,7 @@ THREE.NURBSUtils = {
 
 
 	returns point for given (u, v)
 	returns point for given (u, v)
 	*/
 	*/
-	calcSurfacePoint: function( p, q, U, V, P, u, v ) {
+	calcSurfacePoint: function ( p, q, U, V, P, u, v, target ) {
 
 
 		var uspan = this.findSpan( p, u, U );
 		var uspan = this.findSpan( p, u, U );
 		var vspan = this.findSpan( q, v, V );
 		var vspan = this.findSpan( q, v, V );
@@ -462,11 +462,8 @@ THREE.NURBSUtils = {
 		}
 		}
 
 
 		Sw.divideScalar( Sw.w );
 		Sw.divideScalar( Sw.w );
-		return new THREE.Vector3( Sw.x, Sw.y, Sw.z );
+		target.set( Sw.x, Sw.y, Sw.z );
 
 
 	}
 	}
 
 
 };
 };
-
-
-

+ 1 - 1
examples/js/effects/OutlineEffect.js

@@ -448,7 +448,7 @@ THREE.OutlineEffect = function ( renderer, parameters ) {
 	 * The following property copies and wrapper methods enable
 	 * The following property copies and wrapper methods enable
 	 * THREE.OutlineEffect to be called from other *Effect, like
 	 * THREE.OutlineEffect to be called from other *Effect, like
 	 *
 	 *
-	 * effect = new THREE.VREffect( new THREE.OutlineEffect( renderer ) );
+	 * effect = new THREE.StereoEffect( new THREE.OutlineEffect( renderer ) );
 	 *
 	 *
 	 * function render () {
 	 * function render () {
 	 *
 	 *

+ 0 - 533
examples/js/effects/VREffect.js

@@ -1,533 +0,0 @@
-/**
- * @author dmarcos / https://github.com/dmarcos
- * @author mrdoob / http://mrdoob.com
- *
- * WebVR Spec: http://mozvr.github.io/webvr-spec/webvr.html
- *
- * Firefox: http://mozvr.com/downloads/
- * Chromium: https://webvr.info/get-chrome
- */
-
-THREE.VREffect = function ( renderer, onError ) {
-
-	var vrDisplay, vrDisplays;
-	var eyeTranslationL = new THREE.Vector3();
-	var eyeTranslationR = new THREE.Vector3();
-	var renderRectL, renderRectR;
-	var headMatrix = new THREE.Matrix4();
-	var eyeMatrixL = new THREE.Matrix4();
-	var eyeMatrixR = new THREE.Matrix4();
-
-	var frameData = null;
-
-	if ( 'VRFrameData' in window ) {
-
-		frameData = new window.VRFrameData();
-
-	}
-
-	function gotVRDisplays( displays ) {
-
-		vrDisplays = displays;
-
-		if ( displays.length > 0 ) {
-
-			vrDisplay = displays[ 0 ];
-
-		} else {
-
-			if ( onError ) onError( 'HMD not available' );
-
-		}
-
-	}
-
-	if ( navigator.getVRDisplays ) {
-
-		navigator.getVRDisplays().then( gotVRDisplays ).catch( function () {
-
-			console.warn( 'THREE.VREffect: Unable to get VR Displays' );
-
-		} );
-
-	}
-
-	//
-
-	this.isPresenting = false;
-
-	var scope = this;
-
-	var rendererSize = renderer.getSize();
-	var rendererUpdateStyle = false;
-	var rendererPixelRatio = renderer.getPixelRatio();
-
-	this.getVRDisplay = function () {
-
-		return vrDisplay;
-
-	};
-
-	this.setVRDisplay = function ( value ) {
-
-		vrDisplay = value;
-
-	};
-
-	this.getVRDisplays = function () {
-
-		console.warn( 'THREE.VREffect: getVRDisplays() is being deprecated.' );
-		return vrDisplays;
-
-	};
-
-	this.setSize = function ( width, height, updateStyle ) {
-
-		rendererSize = { width: width, height: height };
-		rendererUpdateStyle = updateStyle;
-
-		if ( scope.isPresenting ) {
-
-			var eyeParamsL = vrDisplay.getEyeParameters( 'left' );
-			renderer.setPixelRatio( 1 );
-			renderer.setSize( eyeParamsL.renderWidth * 2, eyeParamsL.renderHeight, false );
-
-		} else {
-
-			renderer.setPixelRatio( rendererPixelRatio );
-			renderer.setSize( width, height, updateStyle );
-
-		}
-
-	};
-
-	// VR presentation
-
-	var canvas = renderer.domElement;
-	var defaultLeftBounds = [ 0.0, 0.0, 0.5, 1.0 ];
-	var defaultRightBounds = [ 0.5, 0.0, 0.5, 1.0 ];
-
-	function onVRDisplayPresentChange() {
-
-		var wasPresenting = scope.isPresenting;
-		scope.isPresenting = vrDisplay !== undefined && vrDisplay.isPresenting;
-
-		if ( scope.isPresenting ) {
-
-			var eyeParamsL = vrDisplay.getEyeParameters( 'left' );
-			var eyeWidth = eyeParamsL.renderWidth;
-			var eyeHeight = eyeParamsL.renderHeight;
-
-			if ( ! wasPresenting ) {
-
-				rendererPixelRatio = renderer.getPixelRatio();
-				rendererSize = renderer.getSize();
-
-				renderer.setPixelRatio( 1 );
-				renderer.setSize( eyeWidth * 2, eyeHeight, false );
-
-			}
-
-		} else if ( wasPresenting ) {
-
-			renderer.setPixelRatio( rendererPixelRatio );
-			renderer.setSize( rendererSize.width, rendererSize.height, rendererUpdateStyle );
-
-		}
-
-	}
-
-	window.addEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
-
-	this.setFullScreen = function ( boolean ) {
-
-		return new Promise( function ( resolve, reject ) {
-
-			if ( vrDisplay === undefined ) {
-
-				reject( new Error( 'No VR hardware found.' ) );
-				return;
-
-			}
-
-			if ( scope.isPresenting === boolean ) {
-
-				resolve();
-				return;
-
-			}
-
-			if ( boolean ) {
-
-				resolve( vrDisplay.requestPresent( [ { source: canvas } ] ) );
-
-			} else {
-
-				resolve( vrDisplay.exitPresent() );
-
-			}
-
-		} );
-
-	};
-
-	this.requestPresent = function () {
-
-		return this.setFullScreen( true );
-
-	};
-
-	this.exitPresent = function () {
-
-		return this.setFullScreen( false );
-
-	};
-
-	this.requestAnimationFrame = function ( f ) {
-
-		if ( vrDisplay !== undefined ) {
-
-			return vrDisplay.requestAnimationFrame( f );
-
-		} else {
-
-			return window.requestAnimationFrame( f );
-
-		}
-
-	};
-
-	this.cancelAnimationFrame = function ( h ) {
-
-		if ( vrDisplay !== undefined ) {
-
-			vrDisplay.cancelAnimationFrame( h );
-
-		} else {
-
-			window.cancelAnimationFrame( h );
-
-		}
-
-	};
-
-	this.submitFrame = function () {
-
-		if ( vrDisplay !== undefined && scope.isPresenting ) {
-
-			vrDisplay.submitFrame();
-
-		}
-
-	};
-
-	this.autoSubmitFrame = true;
-
-	// render
-
-	var cameraL = new THREE.PerspectiveCamera();
-	cameraL.layers.enable( 1 );
-
-	var cameraR = new THREE.PerspectiveCamera();
-	cameraR.layers.enable( 2 );
-
-	this.render = function ( scene, camera, renderTarget, forceClear ) {
-
-		if ( vrDisplay && scope.isPresenting ) {
-
-			var autoUpdate = scene.autoUpdate;
-
-			if ( autoUpdate ) {
-
-				scene.updateMatrixWorld();
-				scene.autoUpdate = false;
-
-			}
-
-			if ( Array.isArray( scene ) ) {
-
-				console.warn( 'THREE.VREffect.render() no longer supports arrays. Use object.layers instead.' );
-				scene = scene[ 0 ];
-
-			}
-
-			// When rendering we don't care what the recommended size is, only what the actual size
-			// of the backbuffer is.
-			var size = renderer.getSize();
-			var layers = vrDisplay.getLayers();
-			var leftBounds;
-			var rightBounds;
-
-			if ( layers.length ) {
-
-				var layer = layers[ 0 ];
-
-				leftBounds = layer.leftBounds !== null && layer.leftBounds.length === 4 ? layer.leftBounds : defaultLeftBounds;
-				rightBounds = layer.rightBounds !== null && layer.rightBounds.length === 4 ? layer.rightBounds : defaultRightBounds;
-
-			} else {
-
-				leftBounds = defaultLeftBounds;
-				rightBounds = defaultRightBounds;
-
-			}
-
-			renderRectL = {
-				x: Math.round( size.width * leftBounds[ 0 ] ),
-				y: Math.round( size.height * leftBounds[ 1 ] ),
-				width: Math.round( size.width * leftBounds[ 2 ] ),
-				height: Math.round( size.height * leftBounds[ 3 ] )
-			};
-			renderRectR = {
-				x: Math.round( size.width * rightBounds[ 0 ] ),
-				y: Math.round( size.height * rightBounds[ 1 ] ),
-				width: Math.round( size.width * rightBounds[ 2 ] ),
-				height: Math.round( size.height * rightBounds[ 3 ] )
-			};
-
-			if ( renderTarget ) {
-
-				renderer.setRenderTarget( renderTarget );
-				renderTarget.scissorTest = true;
-
-			} else {
-
-				renderer.setRenderTarget( null );
-				renderer.setScissorTest( true );
-
-			}
-
-			if ( renderer.autoClear || forceClear ) renderer.clear();
-
-			if ( camera.parent === null ) camera.updateMatrixWorld();
-
-			camera.matrixWorld.decompose( cameraL.position, cameraL.quaternion, cameraL.scale );
-
-			cameraR.position.copy( cameraL.position );
-			cameraR.quaternion.copy( cameraL.quaternion );
-			cameraR.scale.copy( cameraL.scale );
-
-			if ( vrDisplay.getFrameData ) {
-
-				vrDisplay.depthNear = camera.near;
-				vrDisplay.depthFar = camera.far;
-
-				vrDisplay.getFrameData( frameData );
-
-				cameraL.projectionMatrix.elements = frameData.leftProjectionMatrix;
-				cameraR.projectionMatrix.elements = frameData.rightProjectionMatrix;
-
-				getEyeMatrices( frameData );
-
-				cameraL.updateMatrix();
-				cameraL.matrix.multiply( eyeMatrixL );
-				cameraL.matrix.decompose( cameraL.position, cameraL.quaternion, cameraL.scale );
-
-				cameraR.updateMatrix();
-				cameraR.matrix.multiply( eyeMatrixR );
-				cameraR.matrix.decompose( cameraR.position, cameraR.quaternion, cameraR.scale );
-
-			} else {
-
-				var eyeParamsL = vrDisplay.getEyeParameters( 'left' );
-				var eyeParamsR = vrDisplay.getEyeParameters( 'right' );
-
-				cameraL.projectionMatrix = fovToProjection( eyeParamsL.fieldOfView, true, camera.near, camera.far );
-				cameraR.projectionMatrix = fovToProjection( eyeParamsR.fieldOfView, true, camera.near, camera.far );
-
-				eyeTranslationL.fromArray( eyeParamsL.offset );
-				eyeTranslationR.fromArray( eyeParamsR.offset );
-
-				cameraL.translateOnAxis( eyeTranslationL, cameraL.scale.x );
-				cameraR.translateOnAxis( eyeTranslationR, cameraR.scale.x );
-
-			}
-
-			// render left eye
-			if ( renderTarget ) {
-
-				renderTarget.viewport.set( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
-				renderTarget.scissor.set( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
-
-			} else {
-
-				renderer.setViewport( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
-				renderer.setScissor( renderRectL.x, renderRectL.y, renderRectL.width, renderRectL.height );
-
-			}
-			renderer.render( scene, cameraL, renderTarget, forceClear );
-
-			// render right eye
-			if ( renderTarget ) {
-
-				renderTarget.viewport.set( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
-				renderTarget.scissor.set( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
-
-			} else {
-
-				renderer.setViewport( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
-				renderer.setScissor( renderRectR.x, renderRectR.y, renderRectR.width, renderRectR.height );
-
-			}
-			renderer.render( scene, cameraR, renderTarget, forceClear );
-
-			if ( renderTarget ) {
-
-				renderTarget.viewport.set( 0, 0, size.width, size.height );
-				renderTarget.scissor.set( 0, 0, size.width, size.height );
-				renderTarget.scissorTest = false;
-				renderer.setRenderTarget( null );
-
-			} else {
-
-				renderer.setViewport( 0, 0, size.width, size.height );
-				renderer.setScissorTest( false );
-
-			}
-
-			if ( autoUpdate ) {
-
-				scene.autoUpdate = true;
-
-			}
-
-			if ( scope.autoSubmitFrame ) {
-
-				scope.submitFrame();
-
-			}
-
-			return;
-
-		}
-
-		// Regular render mode if not HMD
-
-		renderer.render( scene, camera, renderTarget, forceClear );
-
-	};
-
-	this.dispose = function () {
-
-		window.removeEventListener( 'vrdisplaypresentchange', onVRDisplayPresentChange, false );
-
-	};
-
-	//
-
-	var poseOrientation = new THREE.Quaternion();
-	var posePosition = new THREE.Vector3();
-
-	// Compute model matrices of the eyes with respect to the head.
-	function getEyeMatrices( frameData ) {
-
-		// Compute the matrix for the position of the head based on the pose
-		if ( frameData.pose.orientation ) {
-
-			poseOrientation.fromArray( frameData.pose.orientation );
-			headMatrix.makeRotationFromQuaternion( poseOrientation );
-
-		}	else {
-
-			headMatrix.identity();
-
-		}
-
-		if ( frameData.pose.position ) {
-
-			posePosition.fromArray( frameData.pose.position );
-			headMatrix.setPosition( posePosition );
-
-		}
-
-		// The view matrix transforms vertices from sitting space to eye space. As such, the view matrix can be thought of as a product of two matrices:
-		// headToEyeMatrix * sittingToHeadMatrix
-
-		// The headMatrix that we've calculated above is the model matrix of the head in sitting space, which is the inverse of sittingToHeadMatrix.
-		// So when we multiply the view matrix with headMatrix, we're left with headToEyeMatrix:
-		// viewMatrix * headMatrix = headToEyeMatrix * sittingToHeadMatrix * headMatrix = headToEyeMatrix
-
-		eyeMatrixL.fromArray( frameData.leftViewMatrix );
-		eyeMatrixL.multiply( headMatrix );
-		eyeMatrixR.fromArray( frameData.rightViewMatrix );
-		eyeMatrixR.multiply( headMatrix );
-
-		// The eye's model matrix in head space is the inverse of headToEyeMatrix we calculated above.
-
-		eyeMatrixL.getInverse( eyeMatrixL );
-		eyeMatrixR.getInverse( eyeMatrixR );
-
-	}
-
-	function fovToNDCScaleOffset( fov ) {
-
-		var pxscale = 2.0 / ( fov.leftTan + fov.rightTan );
-		var pxoffset = ( fov.leftTan - fov.rightTan ) * pxscale * 0.5;
-		var pyscale = 2.0 / ( fov.upTan + fov.downTan );
-		var pyoffset = ( fov.upTan - fov.downTan ) * pyscale * 0.5;
-		return { scale: [ pxscale, pyscale ], offset: [ pxoffset, pyoffset ] };
-
-	}
-
-	function fovPortToProjection( fov, rightHanded, zNear, zFar ) {
-
-		rightHanded = rightHanded === undefined ? true : rightHanded;
-		zNear = zNear === undefined ? 0.01 : zNear;
-		zFar = zFar === undefined ? 10000.0 : zFar;
-
-		var handednessScale = rightHanded ? - 1.0 : 1.0;
-
-		// start with an identity matrix
-		var mobj = new THREE.Matrix4();
-		var m = mobj.elements;
-
-		// and with scale/offset info for normalized device coords
-		var scaleAndOffset = fovToNDCScaleOffset( fov );
-
-		// X result, map clip edges to [-w,+w]
-		m[ 0 * 4 + 0 ] = scaleAndOffset.scale[ 0 ];
-		m[ 0 * 4 + 1 ] = 0.0;
-		m[ 0 * 4 + 2 ] = scaleAndOffset.offset[ 0 ] * handednessScale;
-		m[ 0 * 4 + 3 ] = 0.0;
-
-		// Y result, map clip edges to [-w,+w]
-		// Y offset is negated because this proj matrix transforms from world coords with Y=up,
-		// but the NDC scaling has Y=down (thanks D3D?)
-		m[ 1 * 4 + 0 ] = 0.0;
-		m[ 1 * 4 + 1 ] = scaleAndOffset.scale[ 1 ];
-		m[ 1 * 4 + 2 ] = - scaleAndOffset.offset[ 1 ] * handednessScale;
-		m[ 1 * 4 + 3 ] = 0.0;
-
-		// Z result (up to the app)
-		m[ 2 * 4 + 0 ] = 0.0;
-		m[ 2 * 4 + 1 ] = 0.0;
-		m[ 2 * 4 + 2 ] = zFar / ( zNear - zFar ) * - handednessScale;
-		m[ 2 * 4 + 3 ] = ( zFar * zNear ) / ( zNear - zFar );
-
-		// W result (= Z in)
-		m[ 3 * 4 + 0 ] = 0.0;
-		m[ 3 * 4 + 1 ] = 0.0;
-		m[ 3 * 4 + 2 ] = handednessScale;
-		m[ 3 * 4 + 3 ] = 0.0;
-
-		mobj.transpose();
-		return mobj;
-
-	}
-
-	function fovToProjection( fov, rightHanded, zNear, zFar ) {
-
-		var DEG2RAD = Math.PI / 180.0;
-
-		var fovPort = {
-			upTan: Math.tan( fov.upDegrees * DEG2RAD ),
-			downTan: Math.tan( fov.downDegrees * DEG2RAD ),
-			leftTan: Math.tan( fov.leftDegrees * DEG2RAD ),
-			rightTan: Math.tan( fov.rightDegrees * DEG2RAD )
-		};
-
-		return fovPortToProjection( fovPort, rightHanded, zNear, zFar );
-
-	}
-
-};

+ 5 - 0
examples/js/exporters/GLTFExporter.js

@@ -66,6 +66,7 @@ THREE.GLTFExporter.prototype = {
 	parse: function ( input, onDone, options ) {
 	parse: function ( input, onDone, options ) {
 
 
 		var DEFAULT_OPTIONS = {
 		var DEFAULT_OPTIONS = {
+			binary: false,
 			trs: false,
 			trs: false,
 			onlyVisible: true,
 			onlyVisible: true,
 			truncateDrawRange: true,
 			truncateDrawRange: true,
@@ -1181,6 +1182,8 @@ THREE.GLTFExporter.prototype = {
 
 
 			}
 			}
 
 
+			var extras = ( Object.keys( geometry.userData ).length > 0 ) ? serializeUserData( geometry ) : undefined;
+
 			var forceIndices = options.forceIndices;
 			var forceIndices = options.forceIndices;
 			var isMultiMaterial = Array.isArray( mesh.material );
 			var isMultiMaterial = Array.isArray( mesh.material );
 
 
@@ -1222,6 +1225,8 @@ THREE.GLTFExporter.prototype = {
 					attributes: attributes,
 					attributes: attributes,
 				};
 				};
 
 
+				if ( extras ) primitive.extras = extras;
+
 				if ( targets.length > 0 ) primitive.targets = targets;
 				if ( targets.length > 0 ) primitive.targets = targets;
 
 
 				if ( geometry.index !== null ) {
 				if ( geometry.index !== null ) {

+ 417 - 112
examples/js/exporters/PLYExporter.js

@@ -5,9 +5,8 @@
  * Usage:
  * Usage:
  *  var exporter = new THREE.PLYExporter();
  *  var exporter = new THREE.PLYExporter();
  *
  *
- *  // second argument is an array of attributes to
- *  // exclude from the format ('color', 'uv', 'normal')
- *  var data = exporter.parse(mesh, [ 'color' ]);
+ *  // second argument is a list of options
+ *  var data = exporter.parse( mesh, { binary: true, excludeAttributes: [ 'color' ] } );
  *
  *
  * Format Definition:
  * Format Definition:
  *  http://paulbourke.net/dataformats/ply/
  *  http://paulbourke.net/dataformats/ply/
@@ -19,40 +18,75 @@ THREE.PLYExporter.prototype = {
 
 
 	constructor: THREE.PLYExporter,
 	constructor: THREE.PLYExporter,
 
 
-	parse: function ( object, excludeProperties ) {
+	parse: function ( object, options ) {
 
 
-		if ( Array.isArray( excludeProperties ) !== true ) {
+		// Iterate over the valid meshes in the object
+		function traverseMeshes( cb ) {
 
 
-			excludeProperties = [];
+			object.traverse( function ( child ) {
+
+				if ( child.isMesh === true ) {
+
+					var mesh = child;
+					var geometry = mesh.geometry;
+
+					if ( geometry.isGeometry === true ) {
+
+						geometry = geomToBufferGeom.get( geometry );
+
+					}
+
+					if ( geometry.isBufferGeometry === true ) {
+
+						if ( geometry.getAttribute( 'position' ) !== undefined ) {
+
+							cb( mesh, geometry );
+
+						}
+
+					}
+
+				}
+
+			} );
 
 
 		}
 		}
 
 
-		var includeNormals = excludeProperties.indexOf( 'normal' ) === - 1;
-		var includeColors = excludeProperties.indexOf( 'color' ) === - 1;
-		var includeUVs = excludeProperties.indexOf( 'uv' ) === - 1;
+		// Default options
+		var defaultOptions = {
+			binary: false,
+			excludeAttributes: [] // normal, uv, color, index
+		};
+
+		options = Object.assign( defaultOptions, options );
 
 
-		// count the number of vertices
+		var excludeAttributes = options.excludeAttributes;
+		var geomToBufferGeom = new WeakMap();
+		var includeNormals = false;
+		var includeColors = false;
+		var includeUVs = false;
+		var includeIndices = true;
+
+		// count the vertices, check which properties are used,
+		// and cache the BufferGeometry
 		var vertexCount = 0;
 		var vertexCount = 0;
 		var faceCount = 0;
 		var faceCount = 0;
-		var vertexList = '';
-		var faceList = '';
-
-		var vertex = new THREE.Vector3();
-		var normalMatrixWorld = new THREE.Matrix3();
 		object.traverse( function ( child ) {
 		object.traverse( function ( child ) {
 
 
-			if ( child instanceof THREE.Mesh ) {
+			if ( child.isMesh === true ) {
 
 
 				var mesh = child;
 				var mesh = child;
 				var geometry = mesh.geometry;
 				var geometry = mesh.geometry;
 
 
-				if ( geometry instanceof THREE.Geometry ) {
+				if ( geometry.isGeometry === true ) {
 
 
-					geometry = new THREE.BufferGeometry().setFromObject( mesh );
+					var bufferGeometry = geomToBufferGeom.get( geometry ) || new THREE.BufferGeometry().setFromObject( mesh );
+					geomToBufferGeom.set( geometry, bufferGeometry );
+					geometry = bufferGeometry;
 
 
 				}
 				}
 
 
-				if ( geometry instanceof THREE.BufferGeometry ) {
+				if ( geometry.isBufferGeometry === true ) {
 
 
 					var vertices = geometry.getAttribute( 'position' );
 					var vertices = geometry.getAttribute( 'position' );
 					var normals = geometry.getAttribute( 'normal' );
 					var normals = geometry.getAttribute( 'normal' );
@@ -60,102 +94,279 @@ THREE.PLYExporter.prototype = {
 					var colors = geometry.getAttribute( 'color' );
 					var colors = geometry.getAttribute( 'color' );
 					var indices = geometry.getIndex();
 					var indices = geometry.getIndex();
 
 
-					normalMatrixWorld.getNormalMatrix( mesh.matrixWorld );
-
 					if ( vertices === undefined ) {
 					if ( vertices === undefined ) {
 
 
 						return;
 						return;
 
 
 					}
 					}
 
 
-					// form each line
-					for ( var i = 0, l = vertices.count; i < l; i ++ ) {
+					vertexCount += vertices.count;
+					faceCount += indices ? indices.count / 3 : vertices.count / 3;
+
+					if ( normals !== undefined ) includeNormals = true;
+
+					if ( uvs !== undefined ) includeUVs = true;
 
 
-						vertex.x = vertices.getX( i );
-						vertex.y = vertices.getY( i );
-						vertex.z = vertices.getZ( i );
+					if ( colors !== undefined ) includeColors = true;
 
 
-						vertex.applyMatrix4( mesh.matrixWorld );
+				}
 
 
+			}
 
 
-						// Position information
-						var line =
-							vertex.x + ' ' +
-							vertex.y + ' ' +
-							vertex.z;
+		} );
 
 
-						// Normal information
-						if ( includeNormals === true ) {
+		includeNormals = includeNormals && excludeAttributes.indexOf( 'normal' ) === - 1;
+		includeColors = includeColors && excludeAttributes.indexOf( 'color' ) === - 1;
+		includeUVs = includeUVs && excludeAttributes.indexOf( 'uv' ) === - 1;
+		includeIndices = includeIndices && excludeAttributes.indexOf( 'index' ) === - 1;
 
 
-							if ( normals !== undefined ) {
 
 
-								vertex.x = normals.getX( i );
-								vertex.y = normals.getY( i );
-								vertex.z = normals.getZ( i );
+		if ( includeIndices && faceCount !== Math.floor( faceCount ) ) {
 
 
-								vertex.applyMatrix3( normalMatrixWorld );
+			// point cloud meshes will not have an index array and may not have a
+			// number of vertices that is divisble by 3 (and therefore representable
+			// as triangles)
+			console.error(
 
 
-								line += ' ' +
-									vertex.x + ' ' +
-									vertex.y + ' ' +
-									vertex.z;
+				'PLYExporter: Failed to generate a valid PLY file with triangle indices because the ' +
+				'number of indices is not divisible by 3.'
 
 
-							} else {
+			);
 
 
-								line += ' 0 0 0';
+			return null;
 
 
-							}
+		}
 
 
-						}
+		// get how many bytes will be needed to save out the faces
+		// so we can use a minimal amount of memory / data
+		var indexByteCount = 1;
+
+		if ( vertexCount > 256 ) { // 2^8 bits
+
+			indexByteCount = 2;
+
+		}
+
+		if ( vertexCount > 65536 ) { // 2^16 bits
+
+			indexByteCount = 4;
+
+		}
+
+
+		var header =
+			'ply\n' +
+			`format ${ options.binary ? 'binary_big_endian' : 'ascii' } 1.0\n` +
+			`element vertex ${vertexCount}\n` +
+
+			// position
+			'property float x\n' +
+			'property float y\n' +
+			'property float z\n';
+
+		if ( includeNormals === true ) {
+
+			// normal
+			header +=
+				'property float nx\n' +
+				'property float ny\n' +
+				'property float nz\n';
+
+		}
+
+		if ( includeUVs === true ) {
+
+			// uvs
+			header +=
+				'property float s\n' +
+				'property float t\n';
+
+		}
+
+		if ( includeColors === true ) {
+
+			// colors
+			header +=
+				'property uchar red\n' +
+				'property uchar green\n' +
+				'property uchar blue\n';
+
+		}
+
+		if ( includeIndices === true ) {
+
+			// faces
+			header +=
+				`element face ${faceCount}\n` +
+				`property list uchar uint${ indexByteCount * 8 } vertex_index\n`;
+
+		}
 
 
-						// UV information
-						if ( includeUVs === true ) {
+		header += 'end_header\n';
 
 
-							if ( uvs !== undefined ) {
 
 
-								line += ' ' +
-									uvs.getX( i ) + ' ' +
-									uvs.getY( i );
+		// Generate attribute data
+		var vertex = new THREE.Vector3();
+		var normalMatrixWorld = new THREE.Matrix3();
+
+		if ( options.binary === true ) {
+
+			// Binary File Generation
+			var headerBin = new TextEncoder().encode( header );
+
+			// 3 position values at 4 bytes
+			// 3 normal values at 4 bytes
+			// 3 color channels with 1 byte
+			// 2 uv values at 4 bytes
+			var vertexListLength = vertexCount * ( 4 * 3 + ( includeNormals ? 4 * 3 : 0 ) + ( includeColors ? 3 : 0 ) + ( includeUVs ? 4 * 2 : 0 ) );
+
+			// 1 byte shape desciptor
+			// 3 vertex indices at ${indexByteCount} bytes
+			var faceListLength = includeIndices ? faceCount * ( indexByteCount * 3 + 1 ) : 0;
+			var output = new DataView( new ArrayBuffer( headerBin.length + vertexListLength + faceListLength ) );
+			new Uint8Array( output.buffer ).set( headerBin, 0 );
+
+
+			var vOffset = headerBin.length;
+			var fOffset = headerBin.length + vertexListLength;
+			var writtenVertices = 0;
+			traverseMeshes( function ( mesh, geometry ) {
+
+				var vertices = geometry.getAttribute( 'position' );
+				var normals = geometry.getAttribute( 'normal' );
+				var uvs = geometry.getAttribute( 'uv' );
+				var colors = geometry.getAttribute( 'color' );
+				var indices = geometry.getIndex();
+
+				normalMatrixWorld.getNormalMatrix( mesh.matrixWorld );
+
+				for ( var i = 0, l = vertices.count; i < l; i ++ ) {
+
+					vertex.x = vertices.getX( i );
+					vertex.y = vertices.getY( i );
+					vertex.z = vertices.getZ( i );
+
+					vertex.applyMatrix4( mesh.matrixWorld );
 
 
-							} else if ( includeUVs !== false ) {
 
 
-								line += ' 0 0';
+					// Position information
+					output.setFloat32( vOffset, vertex.x );
+					vOffset += 4;
 
 
-							}
+					output.setFloat32( vOffset, vertex.y );
+					vOffset += 4;
+
+					output.setFloat32( vOffset, vertex.z );
+					vOffset += 4;
+
+					// Normal information
+					if ( includeNormals === true ) {
+
+						if ( normals != null ) {
+
+							vertex.x = normals.getX( i );
+							vertex.y = normals.getY( i );
+							vertex.z = normals.getZ( i );
+
+							vertex.applyMatrix3( normalMatrixWorld );
+
+							output.setFloat32( vOffset, vertex.x );
+							vOffset += 4;
+
+							output.setFloat32( vOffset, vertex.y );
+							vOffset += 4;
+
+							output.setFloat32( vOffset, vertex.z );
+							vOffset += 4;
+
+						} else {
+
+							output.setFloat32( vOffset, 0 );
+							vOffset += 4;
+
+							output.setFloat32( vOffset, 0 );
+							vOffset += 4;
+
+							output.setFloat32( vOffset, 0 );
+							vOffset += 4;
 
 
 						}
 						}
 
 
-						// Color information
-						if ( includeColors === true ) {
+					}
 
 
-							if ( colors !== undefined ) {
+					// UV information
+					if ( includeUVs === true ) {
 
 
-								line += ' ' +
-									Math.floor( colors.getX( i ) ) + ' ' +
-									Math.floor( colors.getY( i ) ) + ' ' +
-									Math.floor( colors.getZ( i ) );
+						if ( uvs != null ) {
 
 
-							} else {
+							output.setFloat32( vOffset, uvs.getX( i ) );
+							vOffset += 4;
 
 
-								line += ' 255 255 255';
+							output.setFloat32( vOffset, uvs.getY( i ) );
+							vOffset += 4;
 
 
-							}
+						} else if ( includeUVs !== false ) {
+
+							output.setFloat32( vOffset, 0 );
+							vOffset += 4;
+
+							output.setFloat32( vOffset, 0 );
+							vOffset += 4;
 
 
 						}
 						}
 
 
-						vertexList += line + '\n';
+					}
+
+					// Color information
+					if ( includeColors === true ) {
+
+						if ( colors != null ) {
+
+							output.setUint8( vOffset, Math.floor( colors.getX( i ) * 255 ) );
+							vOffset += 1;
+
+							output.setUint8( vOffset, Math.floor( colors.getY( i ) * 255 ) );
+							vOffset += 1;
+
+							output.setUint8( vOffset, Math.floor( colors.getZ( i ) * 255 ) );
+							vOffset += 1;
+
+						} else {
+
+							output.setUint8( vOffset, 255 );
+							vOffset += 1;
+
+							output.setUint8( vOffset, 255 );
+							vOffset += 1;
+
+							output.setUint8( vOffset, 255 );
+							vOffset += 1;
+
+						}
 
 
 					}
 					}
 
 
+				}
+
+				if ( includeIndices === true ) {
 
 
 					// Create the face list
 					// Create the face list
+					var faceIndexFunc = `setUint${indexByteCount * 8}`;
 					if ( indices !== null ) {
 					if ( indices !== null ) {
 
 
-						for ( i = 0, l = indices.count; i < l; i += 3 ) {
+						for ( var i = 0, l = indices.count; i < l; i += 3 ) {
+
+							output.setUint8( fOffset, 3 );
+							fOffset += 1;
 
 
-							faceList += `3 ${ indices.getX( i + 0 ) + vertexCount }`;
-							faceList += ` ${ indices.getX( i + 1 ) + vertexCount }`;
-							faceList += ` ${ indices.getX( i + 2 ) + vertexCount }\n`;
+							output[ faceIndexFunc ]( fOffset, indices.getX( i + 0 ) + writtenVertices );
+							fOffset += indexByteCount;
+
+							output[ faceIndexFunc ]( fOffset, indices.getX( i + 1 ) + writtenVertices );
+							fOffset += indexByteCount;
+
+							output[ faceIndexFunc ]( fOffset, indices.getX( i + 2 ) + writtenVertices );
+							fOffset += indexByteCount;
 
 
 						}
 						}
 
 
@@ -163,70 +374,164 @@ THREE.PLYExporter.prototype = {
 
 
 						for ( var i = 0, l = vertices.count; i < l; i += 3 ) {
 						for ( var i = 0, l = vertices.count; i < l; i += 3 ) {
 
 
-							faceList += `3 ${ vertexCount + i } ${ vertexCount + i + 1 } ${ vertexCount + i + 2 }\n`;
+							output.setUint8( fOffset, 3 );
+							fOffset += 1;
+
+							output[ faceIndexFunc ]( fOffset, writtenVertices + i );
+							fOffset += indexByteCount;
+
+							output[ faceIndexFunc ]( fOffset, writtenVertices + i + 1 );
+							fOffset += indexByteCount;
+
+							output[ faceIndexFunc ]( fOffset, writtenVertices + i + 2 );
+							fOffset += indexByteCount;
 
 
 						}
 						}
 
 
 					}
 					}
 
 
-					vertexCount += vertices.count;
-					faceCount += indices ? indices.count / 3 : vertices.count / 3;
+				}
+
+
+				// Save the amount of verts we've already written so we can offset
+				// the face index on the next mesh
+				writtenVertices += vertices.count;
+
+			} );
+
+			return output;
+
+		} else {
+
+			// Ascii File Generation
+			// count the number of vertices
+			var writtenVertices = 0;
+			var vertexList = '';
+			var faceList = '';
+
+			traverseMeshes( function ( mesh, geometry ) {
+
+				var vertices = geometry.getAttribute( 'position' );
+				var normals = geometry.getAttribute( 'normal' );
+				var uvs = geometry.getAttribute( 'uv' );
+				var colors = geometry.getAttribute( 'color' );
+				var indices = geometry.getIndex();
+
+				normalMatrixWorld.getNormalMatrix( mesh.matrixWorld );
+
+				// form each line
+				for ( var i = 0, l = vertices.count; i < l; i ++ ) {
+
+					vertex.x = vertices.getX( i );
+					vertex.y = vertices.getY( i );
+					vertex.z = vertices.getZ( i );
+
+					vertex.applyMatrix4( mesh.matrixWorld );
+
+
+					// Position information
+					var line =
+						vertex.x + ' ' +
+						vertex.y + ' ' +
+						vertex.z;
+
+					// Normal information
+					if ( includeNormals === true ) {
+
+						if ( normals != null ) {
+
+							vertex.x = normals.getX( i );
+							vertex.y = normals.getY( i );
+							vertex.z = normals.getZ( i );
+
+							vertex.applyMatrix3( normalMatrixWorld );
+
+							line += ' ' +
+								vertex.x + ' ' +
+								vertex.y + ' ' +
+								vertex.z;
+
+						} else {
+
+							line += ' 0 0 0';
+
+						}
+
+					}
+
+					// UV information
+					if ( includeUVs === true ) {
+
+						if ( uvs != null ) {
+
+							line += ' ' +
+								uvs.getX( i ) + ' ' +
+								uvs.getY( i );
+
+						} else if ( includeUVs !== false ) {
+
+							line += ' 0 0';
+
+						}
+
+					}
+
+					// Color information
+					if ( includeColors === true ) {
+
+						if ( colors != null ) {
+
+							line += ' ' +
+								Math.floor( colors.getX( i ) * 255 ) + ' ' +
+								Math.floor( colors.getY( i ) * 255 ) + ' ' +
+								Math.floor( colors.getZ( i ) * 255 );
+
+						} else {
+
+							line += ' 255 255 255';
+
+						}
+
+					}
+
+					vertexList += line + '\n';
 
 
 				}
 				}
 
 
-			}
+				// Create the face list
+				if ( includeIndices === true ) {
 
 
-		} );
+					if ( indices !== null ) {
 
 
-		var output =
-			'ply\n' +
-			'format ascii 1.0\n' +
-			`element vertex ${vertexCount}\n` +
+						for ( var i = 0, l = indices.count; i < l; i += 3 ) {
 
 
-			// position
-			'property float x\n' +
-			'property float y\n' +
-			'property float z\n';
+							faceList += `3 ${ indices.getX( i + 0 ) + writtenVertices }`;
+							faceList += ` ${ indices.getX( i + 1 ) + writtenVertices }`;
+							faceList += ` ${ indices.getX( i + 2 ) + writtenVertices }\n`;
 
 
-		if ( includeNormals === true ) {
+						}
 
 
-			// normal
-			output +=
-				'property float nx\n' +
-				'property float ny\n' +
-				'property float nz\n';
+					} else {
 
 
-		}
+						for ( var i = 0, l = vertices.count; i < l; i += 3 ) {
 
 
-		if ( includeUVs === true ) {
+							faceList += `3 ${ writtenVertices + i } ${ writtenVertices + i + 1 } ${ writtenVertices + i + 2 }\n`;
 
 
-			// uvs
-			output +=
-				'property float s\n' +
-				'property float t\n';
+						}
 
 
-		}
+					}
 
 
-		if ( includeColors === true ) {
+					faceCount += indices ? indices.count / 3 : vertices.count / 3;
 
 
-			// colors
-			output +=
-				'property uchar red\n' +
-				'property uchar green\n' +
-				'property uchar blue\n';
+				}
 
 
-		}
+				writtenVertices += vertices.count;
 
 
-		// faces
-		output +=
-			`element face ${faceCount}\n` +
-			'property list uchar int vertex_index\n' +
-			'end_header\n' +
+			} );
 
 
-			`${vertexList}\n` +
-			`${faceList}\n`;
+			return `${ header }${vertexList}\n${ includeIndices ? `${faceList}\n` : '' }`;
 
 
-		return output;
+		}
 
 
 	}
 	}
 
 

+ 0 - 94
examples/js/exporters/STLBinaryExporter.js

@@ -1,94 +0,0 @@
-/**
- * @author kovacsv / http://kovacsv.hu/
- * @author mrdoob / http://mrdoob.com/
- * @author mudcube / http://mudcu.be/
- */
-
-THREE.STLBinaryExporter = function () {};
-
-THREE.STLBinaryExporter.prototype = {
-
-	constructor: THREE.STLBinaryExporter,
-
-	parse: ( function () {
-
-		var vector = new THREE.Vector3();
-		var normalMatrixWorld = new THREE.Matrix3();
-
-		return function parse( scene ) {
-
-			// We collect objects first, as we may need to convert from BufferGeometry to Geometry
-			var objects = [];
-			var triangles = 0;
-			scene.traverse( function ( object ) {
-
-				if ( ! ( object instanceof THREE.Mesh ) ) return;
-
-				var geometry = object.geometry;
-				if ( geometry instanceof THREE.BufferGeometry ) {
-
-					geometry = new THREE.Geometry().fromBufferGeometry( geometry );
-
-				}
-
-				if ( ! ( geometry instanceof THREE.Geometry ) ) return;
-				triangles += geometry.faces.length;
-
-				objects.push( {
-
-					geometry: geometry,
-					matrix: object.matrixWorld
-
-				} );
-
-			} );
-
-			var offset = 80; // skip header
-			var bufferLength = triangles * 2 + triangles * 3 * 4 * 4 + 80 + 4;
-			var arrayBuffer = new ArrayBuffer( bufferLength );
-			var output = new DataView( arrayBuffer );
-			output.setUint32( offset, triangles, true ); offset += 4;
-
-			// Traversing our collected objects
-			objects.forEach( function ( object ) {
-
-				var vertices = object.geometry.vertices;
-				var faces = object.geometry.faces;
-
-				normalMatrixWorld.getNormalMatrix( object.matrix );
-
-				for ( var i = 0, l = faces.length; i < l; i ++ ) {
-
-					var face = faces[ i ];
-
-					vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize();
-
-					output.setFloat32( offset, vector.x, true ); offset += 4; // normal
-					output.setFloat32( offset, vector.y, true ); offset += 4;
-					output.setFloat32( offset, vector.z, true ); offset += 4;
-
-					var indices = [ face.a, face.b, face.c ];
-
-					for ( var j = 0; j < 3; j ++ ) {
-
-						vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( object.matrix );
-
-						output.setFloat32( offset, vector.x, true ); offset += 4; // vertices
-						output.setFloat32( offset, vector.y, true ); offset += 4;
-						output.setFloat32( offset, vector.z, true ); offset += 4;
-
-					}
-
-					output.setUint16( offset, 0, true ); offset += 2; // attribute byte count
-
-				}
-
-			} );
-
-			return output;
-
-		};
-
-	}() )
-
-};

+ 110 - 25
examples/js/exporters/STLExporter.js

@@ -1,6 +1,15 @@
 /**
 /**
  * @author kovacsv / http://kovacsv.hu/
  * @author kovacsv / http://kovacsv.hu/
  * @author mrdoob / http://mrdoob.com/
  * @author mrdoob / http://mrdoob.com/
+ * @author mudcube / http://mudcu.be/
+ * @author Mugen87 / https://github.com/Mugen87
+ *
+ * Usage:
+ *  var exporter = new THREE.STLExporter();
+ *
+ *  // second argument is a list of options
+ *  var data = exporter.parse( mesh, { binary: true } );
+ *
  */
  */
 
 
 THREE.STLExporter = function () {};
 THREE.STLExporter = function () {};
@@ -14,65 +23,141 @@ THREE.STLExporter.prototype = {
 		var vector = new THREE.Vector3();
 		var vector = new THREE.Vector3();
 		var normalMatrixWorld = new THREE.Matrix3();
 		var normalMatrixWorld = new THREE.Matrix3();
 
 
-		return function parse( scene ) {
+		return function parse( scene, options ) {
 
 
-			var output = '';
+			if ( options === undefined ) options = {};
 
 
-			output += 'solid exported\n';
+			var binary = options.binary !== undefined ? options.binary : false;
+
+			//
+
+			var objects = [];
+			var triangles = 0;
 
 
 			scene.traverse( function ( object ) {
 			scene.traverse( function ( object ) {
 
 
-				if ( object instanceof THREE.Mesh ) {
+				if ( object.isMesh ) {
 
 
 					var geometry = object.geometry;
 					var geometry = object.geometry;
-					var matrixWorld = object.matrixWorld;
 
 
-					if ( geometry instanceof THREE.BufferGeometry ) {
+					if ( geometry.isBufferGeometry ) {
 
 
 						geometry = new THREE.Geometry().fromBufferGeometry( geometry );
 						geometry = new THREE.Geometry().fromBufferGeometry( geometry );
 
 
 					}
 					}
 
 
-					if ( geometry instanceof THREE.Geometry ) {
+					if ( geometry.isGeometry ) {
 
 
-						var vertices = geometry.vertices;
-						var faces = geometry.faces;
+						triangles += geometry.faces.length;
 
 
-						normalMatrixWorld.getNormalMatrix( matrixWorld );
+						objects.push( {
 
 
-						for ( var i = 0, l = faces.length; i < l; i ++ ) {
+							geometry: geometry,
+							matrixWorld: object.matrixWorld
 
 
-							var face = faces[ i ];
+						} );
 
 
-							vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize();
+					}
 
 
-							output += '\tfacet normal ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n';
-							output += '\t\touter loop\n';
+				}
 
 
-							var indices = [ face.a, face.b, face.c ];
+			} );
 
 
-							for ( var j = 0; j < 3; j ++ ) {
+			if ( binary ) {
+
+				var offset = 80; // skip header
+				var bufferLength = triangles * 2 + triangles * 3 * 4 * 4 + 80 + 4;
+				var arrayBuffer = new ArrayBuffer( bufferLength );
+				var output = new DataView( arrayBuffer );
+				output.setUint32( offset, triangles, true ); offset += 4;
+
+				for ( var i = 0, il = objects.length; i < il; i ++ ) {
+
+					var object = objects[ i ];
+
+					var vertices = object.geometry.vertices;
+					var faces = object.geometry.faces;
+					var matrixWorld = object.matrixWorld;
 
 
-								vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( matrixWorld );
+					normalMatrixWorld.getNormalMatrix( matrixWorld );
 
 
-								output += '\t\t\tvertex ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n';
+					for ( var j = 0, jl = faces.length; j < jl; j ++ ) {
 
 
-							}
+						var face = faces[ j ];
 
 
-							output += '\t\tendloop\n';
-							output += '\tendfacet\n';
+						vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize();
+
+						output.setFloat32( offset, vector.x, true ); offset += 4; // normal
+						output.setFloat32( offset, vector.y, true ); offset += 4;
+						output.setFloat32( offset, vector.z, true ); offset += 4;
+
+						var indices = [ face.a, face.b, face.c ];
+
+						for ( var k = 0; k < 3; k ++ ) {
+
+							vector.copy( vertices[ indices[ k ] ] ).applyMatrix4( matrixWorld );
+
+							output.setFloat32( offset, vector.x, true ); offset += 4; // vertices
+							output.setFloat32( offset, vector.y, true ); offset += 4;
+							output.setFloat32( offset, vector.z, true ); offset += 4;
 
 
 						}
 						}
 
 
+						output.setUint16( offset, 0, true ); offset += 2; // attribute byte count
+
 					}
 					}
 
 
 				}
 				}
 
 
-			} );
+				return output;
+
+			} else {
+
+				var output = '';
+
+				output += 'solid exported\n';
+
+				for ( var i = 0, il = objects.length; i < il; i ++ ) {
+
+					var object = objects[ i ];
+
+					var vertices = object.geometry.vertices;
+					var faces = object.geometry.faces;
+					var matrixWorld = object.matrixWorld;
+
+					normalMatrixWorld.getNormalMatrix( matrixWorld );
+
+					for ( var j = 0, jl = faces.length; j < jl; j ++ ) {
+
+						var face = faces[ j ];
+
+						vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize();
+
+						output += '\tfacet normal ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n';
+						output += '\t\touter loop\n';
+
+						var indices = [ face.a, face.b, face.c ];
+
+						for ( var k = 0; k < 3; k ++ ) {
+
+							vector.copy( vertices[ indices[ k ] ] ).applyMatrix4( matrixWorld );
+
+							output += '\t\t\tvertex ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n';
+
+						}
+
+						output += '\t\tendloop\n';
+						output += '\tendfacet\n';
+
+					}
+
+				}
+
+				output += 'endsolid exported\n';
 
 
-			output += 'endsolid exported\n';
+				return output;
 
 
-			return output;
+			}
 
 
 		};
 		};
 
 

+ 79 - 1
examples/js/loaders/ColladaLoader.js

@@ -2686,6 +2686,82 @@ THREE.ColladaLoader.prototype = {
 
 
 		}
 		}
 
 
+		// physics
+
+		function parsePhysicsModel( xml ) {
+
+			var data = {
+				name: xml.getAttribute( 'name' ) || '',
+				rigidBodies: {}
+			};
+
+			for ( var i = 0; i < xml.childNodes.length; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'rigid_body':
+						data.rigidBodies[ child.getAttribute( 'name' ) ] = {};
+						parsePhysicsRigidBody( child, data.rigidBodies[ child.getAttribute( 'name' ) ] );
+						break;
+
+				}
+
+			}
+
+			library.physicsModels[ xml.getAttribute( 'id' ) ] = data;
+
+		}
+
+		function parsePhysicsRigidBody( xml, data ) {
+
+			for ( var i = 0; i < xml.childNodes.length; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'technique_common':
+						parsePhysicsTechniqueCommon( child, data );
+						break;
+
+				}
+
+			}
+
+		}
+
+		function parsePhysicsTechniqueCommon( xml, data ) {
+
+			for ( var i = 0; i < xml.childNodes.length; i ++ ) {
+
+				var child = xml.childNodes[ i ];
+
+				if ( child.nodeType !== 1 ) continue;
+
+				switch ( child.nodeName ) {
+
+					case 'inertia':
+						data.inertia = parseFloats( child.textContent );
+						break;
+
+					case 'mass':
+						data.mass = parseFloats( child.textContent )[0];
+						break;
+
+				}
+
+			}
+
+		}
+
+		// scene
+
 		function parseKinematicsScene( xml ) {
 		function parseKinematicsScene( xml ) {
 
 
 			var data = {
 			var data = {
@@ -3282,7 +3358,7 @@ THREE.ColladaLoader.prototype = {
 						// and weights defined for it. But we still have to add the bone to the sorted bone list in order to
 						// and weights defined for it. But we still have to add the bone to the sorted bone list in order to
 						// ensure a correct animation of the model.
 						// ensure a correct animation of the model.
 
 
-						 boneInverse = new THREE.Matrix4();
+						boneInverse = new THREE.Matrix4();
 
 
 					}
 					}
 
 
@@ -3684,6 +3760,7 @@ THREE.ColladaLoader.prototype = {
 			nodes: {},
 			nodes: {},
 			visualScenes: {},
 			visualScenes: {},
 			kinematicsModels: {},
 			kinematicsModels: {},
+			physicsModels: {},
 			kinematicsScenes: {}
 			kinematicsScenes: {}
 		};
 		};
 
 
@@ -3699,6 +3776,7 @@ THREE.ColladaLoader.prototype = {
 		parseLibrary( collada, 'library_nodes', 'node', parseNode );
 		parseLibrary( collada, 'library_nodes', 'node', parseNode );
 		parseLibrary( collada, 'library_visual_scenes', 'visual_scene', parseVisualScene );
 		parseLibrary( collada, 'library_visual_scenes', 'visual_scene', parseVisualScene );
 		parseLibrary( collada, 'library_kinematics_models', 'kinematics_model', parseKinematicsModel );
 		parseLibrary( collada, 'library_kinematics_models', 'kinematics_model', parseKinematicsModel );
+		parseLibrary( collada, 'library_physics_models', 'physics_model', parsePhysicsModel );
 		parseLibrary( collada, 'scene', 'instance_kinematics_scene', parseKinematicsScene );
 		parseLibrary( collada, 'scene', 'instance_kinematics_scene', parseKinematicsScene );
 
 
 		buildLibrary( library.animations, buildAnimation );
 		buildLibrary( library.animations, buildAnimation );

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

@@ -52,14 +52,17 @@ THREE.DRACOLoader.prototype = {
 
 
     setPath: function(value) {
     setPath: function(value) {
         this.path = value;
         this.path = value;
+        return this;
     },
     },
 
 
     setCrossOrigin: function(value) {
     setCrossOrigin: function(value) {
         this.crossOrigin = value;
         this.crossOrigin = value;
+        return this;
     },
     },
 
 
     setVerbosity: function(level) {
     setVerbosity: function(level) {
         this.verbosity = level;
         this.verbosity = level;
+        return this;
     },
     },
 
 
     /**
     /**
@@ -70,6 +73,7 @@ THREE.DRACOLoader.prototype = {
      */
      */
     setDrawMode: function(drawMode) {
     setDrawMode: function(drawMode) {
         this.drawMode = drawMode;
         this.drawMode = drawMode;
+        return this;
     },
     },
 
 
     /**
     /**
@@ -84,6 +88,7 @@ THREE.DRACOLoader.prototype = {
           skipDequantization = skip;
           skipDequantization = skip;
         this.getAttributeOptions(attributeName).skipDequantization =
         this.getAttributeOptions(attributeName).skipDequantization =
             skipDequantization;
             skipDequantization;
+        return this;
     },
     },
 
 
     /**
     /**

+ 1 - 7
examples/js/loaders/EquiangularToCubeGenerator.js

@@ -95,13 +95,7 @@ THREE.EquiangularToCubeGenerator.prototype = {
 					gl_FragColor = vec4( color, 1.0 );\n\
 					gl_FragColor = vec4( color, 1.0 );\n\
 				}",
 				}",
 
 
-			blending: THREE.CustomBlending,
-			premultipliedAlpha: false,
-			blendSrc: THREE.OneFactor,
-			blendDst: THREE.ZeroFactor,
-			blendSrcAlpha: THREE.OneFactor,
-			blendDstAlpha: THREE.ZeroFactor,
-			blendEquation: THREE.AddEquation
+			blending: THREE.NoBlending
 
 
 		} );
 		} );
 
 

+ 44 - 49
examples/js/loaders/GLTFLoader.js

@@ -246,9 +246,9 @@ THREE.GLTFLoader = ( function () {
 	/**
 	/**
 	 * DDS Texture Extension
 	 * DDS Texture Extension
 	 *
 	 *
-	 * Specification: 
+	 * Specification:
 	 * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
 	 * https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
-	 * 
+	 *
 	 */
 	 */
 	function GLTFTextureDDSExtension() {
 	function GLTFTextureDDSExtension() {
 
 
@@ -455,7 +455,7 @@ THREE.GLTFLoader = ( function () {
 	 *
 	 *
 	 * Specification: https://github.com/KhronosGroup/glTF/pull/874
 	 * Specification: https://github.com/KhronosGroup/glTF/pull/874
 	 */
 	 */
-	function GLTFDracoMeshCompressionExtension ( json, dracoLoader ) {
+	function GLTFDracoMeshCompressionExtension( json, dracoLoader ) {
 
 
 		if ( ! dracoLoader ) {
 		if ( ! dracoLoader ) {
 
 
@@ -481,7 +481,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		for ( var attributeName in gltfAttributeMap ) {
 		for ( var attributeName in gltfAttributeMap ) {
 
 
-			if ( !( attributeName in ATTRIBUTES ) ) continue;
+			if ( ! ( attributeName in ATTRIBUTES ) ) continue;
 
 
 			threeAttributeMap[ ATTRIBUTES[ attributeName ] ] = gltfAttributeMap[ attributeName ];
 			threeAttributeMap[ ATTRIBUTES[ attributeName ] ] = gltfAttributeMap[ attributeName ];
 
 
@@ -494,7 +494,7 @@ THREE.GLTFLoader = ( function () {
 				var accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];
 				var accessorDef = json.accessors[ primitive.attributes[ attributeName ] ];
 				var componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
 				var componentType = WEBGL_COMPONENT_TYPES[ accessorDef.componentType ];
 
 
-				attributeTypeMap[ ATTRIBUTES[ attributeName ] ]  = componentType;
+				attributeTypeMap[ ATTRIBUTES[ attributeName ] ] = componentType;
 				attributeNormalizedMap[ ATTRIBUTES[ attributeName ] ] = accessorDef.normalized === true;
 				attributeNormalizedMap[ ATTRIBUTES[ attributeName ] ] = accessorDef.normalized === true;
 
 
 			}
 			}
@@ -934,7 +934,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		THREE.Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
 		THREE.Interpolant.call( this, parameterPositions, sampleValues, sampleSize, resultBuffer );
 
 
-	};
+	}
 
 
 	GLTFCubicSplineInterpolant.prototype = Object.create( THREE.Interpolant.prototype );
 	GLTFCubicSplineInterpolant.prototype = Object.create( THREE.Interpolant.prototype );
 	GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant;
 	GLTFCubicSplineInterpolant.prototype.constructor = GLTFCubicSplineInterpolant;
@@ -966,10 +966,10 @@ THREE.GLTFLoader = ( function () {
 		//   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
 		//   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
 		for ( var i = 0; i !== stride; i ++ ) {
 		for ( var i = 0; i !== stride; i ++ ) {
 
 
-			var p0 = values[ offset0 + i + stride ];        // splineVertex_k
-			var m0 = values[ offset0 + i + stride2 ] * td;  // outTangent_k * (t_k+1 - t_k)
-			var p1 = values[ offset1 + i + stride ];        // splineVertex_k+1
-			var m1 = values[ offset1 + i ] * td;            // inTangent_k+1 * (t_k+1 - t_k)
+			var p0 = values[ offset0 + i + stride ]; // splineVertex_k
+			var m0 = values[ offset0 + i + stride2 ] * td; // outTangent_k * (t_k+1 - t_k)
+			var p1 = values[ offset1 + i + stride ]; // splineVertex_k+1
+			var m1 = values[ offset1 + i ] * td; // inTangent_k+1 * (t_k+1 - t_k)
 
 
 			result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
 			result[ i ] = s0 * p0 + s1 * m0 + s2 * p1 + s3 * m1;
 
 
@@ -1123,7 +1123,7 @@ THREE.GLTFLoader = ( function () {
 		WEIGHT: 'skinWeight', // deprecated
 		WEIGHT: 'skinWeight', // deprecated
 		JOINTS_0: 'skinIndex',
 		JOINTS_0: 'skinIndex',
 		JOINT: 'skinIndex' // deprecated
 		JOINT: 'skinIndex' // deprecated
-	}
+	};
 
 
 	var PATH_PROPERTIES = {
 	var PATH_PROPERTIES = {
 		scale: 'scale',
 		scale: 'scale',
@@ -1214,7 +1214,7 @@ THREE.GLTFLoader = ( function () {
 	/**
 	/**
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
 	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#morph-targets
 	 *
 	 *
-	 * @param {THREE.Geometry} geometry
+	 * @param {THREE.BufferGeometry} geometry
 	 * @param {Array<GLTF.Target>} targets
 	 * @param {Array<GLTF.Target>} targets
 	 * @param {Array<THREE.BufferAttribute>} accessors
 	 * @param {Array<THREE.BufferAttribute>} accessors
 	 */
 	 */
@@ -1533,7 +1533,7 @@ THREE.GLTFLoader = ( function () {
 		// BufferGeometry caching
 		// BufferGeometry caching
 		this.primitiveCache = [];
 		this.primitiveCache = [];
 		this.multiplePrimitivesCache = [];
 		this.multiplePrimitivesCache = [];
-		this.multiPassGeometryCache = []
+		this.multiPassGeometryCache = [];
 
 
 		this.textureLoader = new THREE.TextureLoader( this.options.manager );
 		this.textureLoader = new THREE.TextureLoader( this.options.manager );
 		this.textureLoader.setCrossOrigin( this.options.crossOrigin );
 		this.textureLoader.setCrossOrigin( this.options.crossOrigin );
@@ -2178,7 +2178,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		}
 		}
 
 
-		if ( materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial) {
+		if ( materialDef.normalTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
 
 
 			pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture.index ) );
 			pending.push( parser.assignTexture( materialParams, 'normalMap', materialDef.normalTexture.index ) );
 
 
@@ -2192,7 +2192,7 @@ THREE.GLTFLoader = ( function () {
 
 
 		}
 		}
 
 
-		if ( materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial) {
+		if ( materialDef.occlusionTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
 
 
 			pending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture.index ) );
 			pending.push( parser.assignTexture( materialParams, 'aoMap', materialDef.occlusionTexture.index ) );
 
 
@@ -2204,13 +2204,13 @@ THREE.GLTFLoader = ( function () {
 
 
 		}
 		}
 
 
-		if ( materialDef.emissiveFactor !== undefined && materialType !== THREE.MeshBasicMaterial) {
+		if ( materialDef.emissiveFactor !== undefined && materialType !== THREE.MeshBasicMaterial ) {
 
 
 			materialParams.emissive = new THREE.Color().fromArray( materialDef.emissiveFactor );
 			materialParams.emissive = new THREE.Color().fromArray( materialDef.emissiveFactor );
 
 
 		}
 		}
 
 
-		if ( materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial) {
+		if ( materialDef.emissiveTexture !== undefined && materialType !== THREE.MeshBasicMaterial ) {
 
 
 			pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture.index ) );
 			pending.push( parser.assignTexture( materialParams, 'emissiveMap', materialDef.emissiveTexture.index ) );
 
 
@@ -2240,9 +2240,10 @@ THREE.GLTFLoader = ( function () {
 
 
 			}
 			}
 
 
-			// emissiveTexture and baseColorTexture use sRGB encoding.
+			// baseColorTexture, emissiveTexture, and specularGlossinessTexture use sRGB encoding.
 			if ( material.map ) material.map.encoding = THREE.sRGBEncoding;
 			if ( material.map ) material.map.encoding = THREE.sRGBEncoding;
 			if ( material.emissiveMap ) material.emissiveMap.encoding = THREE.sRGBEncoding;
 			if ( material.emissiveMap ) material.emissiveMap.encoding = THREE.sRGBEncoding;
+			if ( material.specularMap ) material.specularMap.encoding = THREE.sRGBEncoding;
 
 
 			if ( materialDef.extras ) material.userData = materialDef.extras;
 			if ( materialDef.extras ) material.userData = materialDef.extras;
 
 
@@ -2269,7 +2270,7 @@ THREE.GLTFLoader = ( function () {
 			var bufferAttribute = accessors[ attributes[ gltfAttributeName ] ];
 			var bufferAttribute = accessors[ attributes[ gltfAttributeName ] ];
 
 
 			// Skip attributes already provided by e.g. Draco extension.
 			// Skip attributes already provided by e.g. Draco extension.
-			if ( !threeAttributeName ) continue;
+			if ( ! threeAttributeName ) continue;
 			if ( threeAttributeName in geometry.attributes ) continue;
 			if ( threeAttributeName in geometry.attributes ) continue;
 
 
 			geometry.addAttribute( threeAttributeName, bufferAttribute );
 			geometry.addAttribute( threeAttributeName, bufferAttribute );
@@ -2507,7 +2508,7 @@ THREE.GLTFLoader = ( function () {
 
 
 					var mesh;
 					var mesh;
 
 
-					var material = isMultiMaterial ? originalMaterials : originalMaterials[ i ]
+					var material = isMultiMaterial ? originalMaterials : originalMaterials[ i ];
 
 
 					if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||
 					if ( primitive.mode === WEBGL_CONSTANTS.TRIANGLES ||
 						primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||
 						primitive.mode === WEBGL_CONSTANTS.TRIANGLE_STRIP ||
@@ -2591,7 +2592,7 @@ THREE.GLTFLoader = ( function () {
 								THREE.Material.prototype.copy.call( pointsMaterial, material );
 								THREE.Material.prototype.copy.call( pointsMaterial, material );
 								pointsMaterial.color.copy( material.color );
 								pointsMaterial.color.copy( material.color );
 								pointsMaterial.map = material.map;
 								pointsMaterial.map = material.map;
-								pointsMaterial.lights = false;  // PointsMaterial doesn't support lights yet
+								pointsMaterial.lights = false; // PointsMaterial doesn't support lights yet
 
 
 								scope.cache.add( cacheKey, pointsMaterial );
 								scope.cache.add( cacheKey, pointsMaterial );
 
 
@@ -2610,7 +2611,7 @@ THREE.GLTFLoader = ( function () {
 								lineMaterial = new THREE.LineBasicMaterial();
 								lineMaterial = new THREE.LineBasicMaterial();
 								THREE.Material.prototype.copy.call( lineMaterial, material );
 								THREE.Material.prototype.copy.call( lineMaterial, material );
 								lineMaterial.color.copy( material.color );
 								lineMaterial.color.copy( material.color );
-								lineMaterial.lights = false;  // LineBasicMaterial doesn't support lights yet
+								lineMaterial.lights = false; // LineBasicMaterial doesn't support lights yet
 
 
 								scope.cache.add( cacheKey, lineMaterial );
 								scope.cache.add( cacheKey, lineMaterial );
 
 
@@ -2620,43 +2621,37 @@ THREE.GLTFLoader = ( function () {
 
 
 						}
 						}
 
 
-						// If the material will be modified later on, clone it now.
+						// Clone the material if it will be modified
 						if ( useVertexColors || useFlatShading || useSkinning || useMorphTargets ) {
 						if ( useVertexColors || useFlatShading || useSkinning || useMorphTargets ) {
 
 
-							material = material.isGLTFSpecularGlossinessMaterial
-									? extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ].cloneMaterial( material )
-									: material.clone();
-
-						}
-
-						if ( useSkinning ) {
-
-							material.skinning = true;
+							var cacheKey = 'ClonedMaterial:' + material.uuid + ':';
 
 
-						}
-
-						if ( useVertexColors ) {
-
-							material.vertexColors = THREE.VertexColors;
-							material.needsUpdate = true;
+							if ( material.isGLTFSpecularGlossinessMaterial ) cacheKey += 'specular-glossiness:';
+							if ( useSkinning ) cacheKey += 'skinning:';
+							if ( useVertexColors ) cacheKey += 'vertex-colors:';
+							if ( useFlatShading ) cacheKey += 'flat-shading:';
+							if ( useMorphTargets ) cacheKey += 'morph-targets:';
+							if ( useMorphNormals ) cacheKey += 'morph-normals:';
 
 
-						}
-
-						if ( useFlatShading ) {
+							var cachedMaterial = scope.cache.get( cacheKey );
 
 
-							material.flatShading = true;
+							if ( ! cachedMaterial ) {
 
 
-						}
+								cachedMaterial = material.isGLTFSpecularGlossinessMaterial
+									? extensions[ EXTENSIONS.KHR_MATERIALS_PBR_SPECULAR_GLOSSINESS ].cloneMaterial( material )
+									: material.clone();
 
 
-						if ( useMorphTargets ) {
+								if ( useSkinning ) cachedMaterial.skinning = true;
+								if ( useVertexColors ) cachedMaterial.vertexColors = THREE.VertexColors;
+								if ( useFlatShading ) cachedMaterial.flatShading = true;
+								if ( useMorphTargets ) cachedMaterial.morphTargets = true;
+								if ( useMorphNormals ) cachedMaterial.morphNormals = true;
 
 
-							material.morphTargets = true;
+								scope.cache.add( cacheKey, cachedMaterial );
 
 
-						}
-
-						if ( useMorphNormals ) {
+							}
 
 
-							material.morphNormals = true;
+							material = cachedMaterial;
 
 
 						}
 						}
 
 

+ 199 - 131
examples/js/loaders/MD2Loader.js

@@ -28,88 +28,88 @@ THREE.MD2Loader.prototype = {
 
 
 	parse: ( function () {
 	parse: ( function () {
 
 
-		var normals = [
-			[ -0.525731,  0.000000,  0.850651 ], [ -0.442863,  0.238856,  0.864188 ],
-			[ -0.295242,  0.000000,  0.955423 ], [ -0.309017,  0.500000,  0.809017 ],
-			[ -0.162460,  0.262866,  0.951056 ], [  0.000000,  0.000000,  1.000000 ],
-			[  0.000000,  0.850651,  0.525731 ], [ -0.147621,  0.716567,  0.681718 ],
-			[  0.147621,  0.716567,  0.681718 ], [  0.000000,  0.525731,  0.850651 ],
-			[  0.309017,  0.500000,  0.809017 ], [  0.525731,  0.000000,  0.850651 ],
-			[  0.295242,  0.000000,  0.955423 ], [  0.442863,  0.238856,  0.864188 ],
-			[  0.162460,  0.262866,  0.951056 ], [ -0.681718,  0.147621,  0.716567 ],
-			[ -0.809017,  0.309017,  0.500000 ], [ -0.587785,  0.425325,  0.688191 ],
-			[ -0.850651,  0.525731,  0.000000 ], [ -0.864188,  0.442863,  0.238856 ],
-			[ -0.716567,  0.681718,  0.147621 ], [ -0.688191,  0.587785,  0.425325 ],
-			[ -0.500000,  0.809017,  0.309017 ], [ -0.238856,  0.864188,  0.442863 ],
-			[ -0.425325,  0.688191,  0.587785 ], [ -0.716567,  0.681718, -0.147621 ],
-			[ -0.500000,  0.809017, -0.309017 ], [ -0.525731,  0.850651,  0.000000 ],
-			[  0.000000,  0.850651, -0.525731 ], [ -0.238856,  0.864188, -0.442863 ],
-			[  0.000000,  0.955423, -0.295242 ], [ -0.262866,  0.951056, -0.162460 ],
-			[  0.000000,  1.000000,  0.000000 ], [  0.000000,  0.955423,  0.295242 ],
-			[ -0.262866,  0.951056,  0.162460 ], [  0.238856,  0.864188,  0.442863 ],
-			[  0.262866,  0.951056,  0.162460 ], [  0.500000,  0.809017,  0.309017 ],
-			[  0.238856,  0.864188, -0.442863 ], [  0.262866,  0.951056, -0.162460 ],
-			[  0.500000,  0.809017, -0.309017 ], [  0.850651,  0.525731,  0.000000 ],
-			[  0.716567,  0.681718,  0.147621 ], [  0.716567,  0.681718, -0.147621 ],
-			[  0.525731,  0.850651,  0.000000 ], [  0.425325,  0.688191,  0.587785 ],
-			[  0.864188,  0.442863,  0.238856 ], [  0.688191,  0.587785,  0.425325 ],
-			[  0.809017,  0.309017,  0.500000 ], [  0.681718,  0.147621,  0.716567 ],
-			[  0.587785,  0.425325,  0.688191 ], [  0.955423,  0.295242,  0.000000 ],
-			[  1.000000,  0.000000,  0.000000 ], [  0.951056,  0.162460,  0.262866 ],
-			[  0.850651, -0.525731,  0.000000 ], [  0.955423, -0.295242,  0.000000 ],
-			[  0.864188, -0.442863,  0.238856 ], [  0.951056, -0.162460,  0.262866 ],
-			[  0.809017, -0.309017,  0.500000 ], [  0.681718, -0.147621,  0.716567 ],
-			[  0.850651,  0.000000,  0.525731 ], [  0.864188,  0.442863, -0.238856 ],
-			[  0.809017,  0.309017, -0.500000 ], [  0.951056,  0.162460, -0.262866 ],
-			[  0.525731,  0.000000, -0.850651 ], [  0.681718,  0.147621, -0.716567 ],
-			[  0.681718, -0.147621, -0.716567 ], [  0.850651,  0.000000, -0.525731 ],
-			[  0.809017, -0.309017, -0.500000 ], [  0.864188, -0.442863, -0.238856 ],
-			[  0.951056, -0.162460, -0.262866 ], [  0.147621,  0.716567, -0.681718 ],
-			[  0.309017,  0.500000, -0.809017 ], [  0.425325,  0.688191, -0.587785 ],
-			[  0.442863,  0.238856, -0.864188 ], [  0.587785,  0.425325, -0.688191 ],
-			[  0.688191,  0.587785, -0.425325 ], [ -0.147621,  0.716567, -0.681718 ],
-			[ -0.309017,  0.500000, -0.809017 ], [  0.000000,  0.525731, -0.850651 ],
-			[ -0.525731,  0.000000, -0.850651 ], [ -0.442863,  0.238856, -0.864188 ],
-			[ -0.295242,  0.000000, -0.955423 ], [ -0.162460,  0.262866, -0.951056 ],
-			[  0.000000,  0.000000, -1.000000 ], [  0.295242,  0.000000, -0.955423 ],
-			[  0.162460,  0.262866, -0.951056 ], [ -0.442863, -0.238856, -0.864188 ],
-			[ -0.309017, -0.500000, -0.809017 ], [ -0.162460, -0.262866, -0.951056 ],
-			[  0.000000, -0.850651, -0.525731 ], [ -0.147621, -0.716567, -0.681718 ],
-			[  0.147621, -0.716567, -0.681718 ], [  0.000000, -0.525731, -0.850651 ],
-			[  0.309017, -0.500000, -0.809017 ], [  0.442863, -0.238856, -0.864188 ],
-			[  0.162460, -0.262866, -0.951056 ], [  0.238856, -0.864188, -0.442863 ],
-			[  0.500000, -0.809017, -0.309017 ], [  0.425325, -0.688191, -0.587785 ],
-			[  0.716567, -0.681718, -0.147621 ], [  0.688191, -0.587785, -0.425325 ],
-			[  0.587785, -0.425325, -0.688191 ], [  0.000000, -0.955423, -0.295242 ],
-			[  0.000000, -1.000000,  0.000000 ], [  0.262866, -0.951056, -0.162460 ],
-			[  0.000000, -0.850651,  0.525731 ], [  0.000000, -0.955423,  0.295242 ],
-			[  0.238856, -0.864188,  0.442863 ], [  0.262866, -0.951056,  0.162460 ],
-			[  0.500000, -0.809017,  0.309017 ], [  0.716567, -0.681718,  0.147621 ],
-			[  0.525731, -0.850651,  0.000000 ], [ -0.238856, -0.864188, -0.442863 ],
-			[ -0.500000, -0.809017, -0.309017 ], [ -0.262866, -0.951056, -0.162460 ],
-			[ -0.850651, -0.525731,  0.000000 ], [ -0.716567, -0.681718, -0.147621 ],
-			[ -0.716567, -0.681718,  0.147621 ], [ -0.525731, -0.850651,  0.000000 ],
-			[ -0.500000, -0.809017,  0.309017 ], [ -0.238856, -0.864188,  0.442863 ],
-			[ -0.262866, -0.951056,  0.162460 ], [ -0.864188, -0.442863,  0.238856 ],
-			[ -0.809017, -0.309017,  0.500000 ], [ -0.688191, -0.587785,  0.425325 ],
-			[ -0.681718, -0.147621,  0.716567 ], [ -0.442863, -0.238856,  0.864188 ],
-			[ -0.587785, -0.425325,  0.688191 ], [ -0.309017, -0.500000,  0.809017 ],
-			[ -0.147621, -0.716567,  0.681718 ], [ -0.425325, -0.688191,  0.587785 ],
-			[ -0.162460, -0.262866,  0.951056 ], [  0.442863, -0.238856,  0.864188 ],
-			[  0.162460, -0.262866,  0.951056 ], [  0.309017, -0.500000,  0.809017 ],
-			[  0.147621, -0.716567,  0.681718 ], [  0.000000, -0.525731,  0.850651 ],
-			[  0.425325, -0.688191,  0.587785 ], [  0.587785, -0.425325,  0.688191 ],
-			[  0.688191, -0.587785,  0.425325 ], [ -0.955423,  0.295242,  0.000000 ],
-			[ -0.951056,  0.162460,  0.262866 ], [ -1.000000,  0.000000,  0.000000 ],
-			[ -0.850651,  0.000000,  0.525731 ], [ -0.955423, -0.295242,  0.000000 ],
-			[ -0.951056, -0.162460,  0.262866 ], [ -0.864188,  0.442863, -0.238856 ],
-			[ -0.951056,  0.162460, -0.262866 ], [ -0.809017,  0.309017, -0.500000 ],
-			[ -0.864188, -0.442863, -0.238856 ], [ -0.951056, -0.162460, -0.262866 ],
-			[ -0.809017, -0.309017, -0.500000 ], [ -0.681718,  0.147621, -0.716567 ],
-			[ -0.681718, -0.147621, -0.716567 ], [ -0.850651,  0.000000, -0.525731 ],
-			[ -0.688191,  0.587785, -0.425325 ], [ -0.587785,  0.425325, -0.688191 ],
-			[ -0.425325,  0.688191, -0.587785 ], [ -0.425325, -0.688191, -0.587785 ],
-			[ -0.587785, -0.425325, -0.688191 ], [ -0.688191, -0.587785, -0.425325 ]
+		var normalData = [
+			[ - 0.525731, 0.000000, 0.850651 ], [ - 0.442863, 0.238856, 0.864188 ],
+			[ - 0.295242, 0.000000, 0.955423 ], [ - 0.309017, 0.500000, 0.809017 ],
+			[ - 0.162460, 0.262866, 0.951056 ], [ 0.000000, 0.000000, 1.000000 ],
+			[ 0.000000, 0.850651, 0.525731 ], [ - 0.147621, 0.716567, 0.681718 ],
+			[ 0.147621, 0.716567, 0.681718 ], [ 0.000000, 0.525731, 0.850651 ],
+			[ 0.309017, 0.500000, 0.809017 ], [ 0.525731, 0.000000, 0.850651 ],
+			[ 0.295242, 0.000000, 0.955423 ], [ 0.442863, 0.238856, 0.864188 ],
+			[ 0.162460, 0.262866, 0.951056 ], [ - 0.681718, 0.147621, 0.716567 ],
+			[ - 0.809017, 0.309017, 0.500000 ], [ - 0.587785, 0.425325, 0.688191 ],
+			[ - 0.850651, 0.525731, 0.000000 ], [ - 0.864188, 0.442863, 0.238856 ],
+			[ - 0.716567, 0.681718, 0.147621 ], [ - 0.688191, 0.587785, 0.425325 ],
+			[ - 0.500000, 0.809017, 0.309017 ], [ - 0.238856, 0.864188, 0.442863 ],
+			[ - 0.425325, 0.688191, 0.587785 ], [ - 0.716567, 0.681718, - 0.147621 ],
+			[ - 0.500000, 0.809017, - 0.309017 ], [ - 0.525731, 0.850651, 0.000000 ],
+			[ 0.000000, 0.850651, - 0.525731 ], [ - 0.238856, 0.864188, - 0.442863 ],
+			[ 0.000000, 0.955423, - 0.295242 ], [ - 0.262866, 0.951056, - 0.162460 ],
+			[ 0.000000, 1.000000, 0.000000 ], [ 0.000000, 0.955423, 0.295242 ],
+			[ - 0.262866, 0.951056, 0.162460 ], [ 0.238856, 0.864188, 0.442863 ],
+			[ 0.262866, 0.951056, 0.162460 ], [ 0.500000, 0.809017, 0.309017 ],
+			[ 0.238856, 0.864188, - 0.442863 ], [ 0.262866, 0.951056, - 0.162460 ],
+			[ 0.500000, 0.809017, - 0.309017 ], [ 0.850651, 0.525731, 0.000000 ],
+			[ 0.716567, 0.681718, 0.147621 ], [ 0.716567, 0.681718, - 0.147621 ],
+			[ 0.525731, 0.850651, 0.000000 ], [ 0.425325, 0.688191, 0.587785 ],
+			[ 0.864188, 0.442863, 0.238856 ], [ 0.688191, 0.587785, 0.425325 ],
+			[ 0.809017, 0.309017, 0.500000 ], [ 0.681718, 0.147621, 0.716567 ],
+			[ 0.587785, 0.425325, 0.688191 ], [ 0.955423, 0.295242, 0.000000 ],
+			[ 1.000000, 0.000000, 0.000000 ], [ 0.951056, 0.162460, 0.262866 ],
+			[ 0.850651, - 0.525731, 0.000000 ], [ 0.955423, - 0.295242, 0.000000 ],
+			[ 0.864188, - 0.442863, 0.238856 ], [ 0.951056, - 0.162460, 0.262866 ],
+			[ 0.809017, - 0.309017, 0.500000 ], [ 0.681718, - 0.147621, 0.716567 ],
+			[ 0.850651, 0.000000, 0.525731 ], [ 0.864188, 0.442863, - 0.238856 ],
+			[ 0.809017, 0.309017, - 0.500000 ], [ 0.951056, 0.162460, - 0.262866 ],
+			[ 0.525731, 0.000000, - 0.850651 ], [ 0.681718, 0.147621, - 0.716567 ],
+			[ 0.681718, - 0.147621, - 0.716567 ], [ 0.850651, 0.000000, - 0.525731 ],
+			[ 0.809017, - 0.309017, - 0.500000 ], [ 0.864188, - 0.442863, - 0.238856 ],
+			[ 0.951056, - 0.162460, - 0.262866 ], [ 0.147621, 0.716567, - 0.681718 ],
+			[ 0.309017, 0.500000, - 0.809017 ], [ 0.425325, 0.688191, - 0.587785 ],
+			[ 0.442863, 0.238856, - 0.864188 ], [ 0.587785, 0.425325, - 0.688191 ],
+			[ 0.688191, 0.587785, - 0.425325 ], [ - 0.147621, 0.716567, - 0.681718 ],
+			[ - 0.309017, 0.500000, - 0.809017 ], [ 0.000000, 0.525731, - 0.850651 ],
+			[ - 0.525731, 0.000000, - 0.850651 ], [ - 0.442863, 0.238856, - 0.864188 ],
+			[ - 0.295242, 0.000000, - 0.955423 ], [ - 0.162460, 0.262866, - 0.951056 ],
+			[ 0.000000, 0.000000, - 1.000000 ], [ 0.295242, 0.000000, - 0.955423 ],
+			[ 0.162460, 0.262866, - 0.951056 ], [ - 0.442863, - 0.238856, - 0.864188 ],
+			[ - 0.309017, - 0.500000, - 0.809017 ], [ - 0.162460, - 0.262866, - 0.951056 ],
+			[ 0.000000, - 0.850651, - 0.525731 ], [ - 0.147621, - 0.716567, - 0.681718 ],
+			[ 0.147621, - 0.716567, - 0.681718 ], [ 0.000000, - 0.525731, - 0.850651 ],
+			[ 0.309017, - 0.500000, - 0.809017 ], [ 0.442863, - 0.238856, - 0.864188 ],
+			[ 0.162460, - 0.262866, - 0.951056 ], [ 0.238856, - 0.864188, - 0.442863 ],
+			[ 0.500000, - 0.809017, - 0.309017 ], [ 0.425325, - 0.688191, - 0.587785 ],
+			[ 0.716567, - 0.681718, - 0.147621 ], [ 0.688191, - 0.587785, - 0.425325 ],
+			[ 0.587785, - 0.425325, - 0.688191 ], [ 0.000000, - 0.955423, - 0.295242 ],
+			[ 0.000000, - 1.000000, 0.000000 ], [ 0.262866, - 0.951056, - 0.162460 ],
+			[ 0.000000, - 0.850651, 0.525731 ], [ 0.000000, - 0.955423, 0.295242 ],
+			[ 0.238856, - 0.864188, 0.442863 ], [ 0.262866, - 0.951056, 0.162460 ],
+			[ 0.500000, - 0.809017, 0.309017 ], [ 0.716567, - 0.681718, 0.147621 ],
+			[ 0.525731, - 0.850651, 0.000000 ], [ - 0.238856, - 0.864188, - 0.442863 ],
+			[ - 0.500000, - 0.809017, - 0.309017 ], [ - 0.262866, - 0.951056, - 0.162460 ],
+			[ - 0.850651, - 0.525731, 0.000000 ], [ - 0.716567, - 0.681718, - 0.147621 ],
+			[ - 0.716567, - 0.681718, 0.147621 ], [ - 0.525731, - 0.850651, 0.000000 ],
+			[ - 0.500000, - 0.809017, 0.309017 ], [ - 0.238856, - 0.864188, 0.442863 ],
+			[ - 0.262866, - 0.951056, 0.162460 ], [ - 0.864188, - 0.442863, 0.238856 ],
+			[ - 0.809017, - 0.309017, 0.500000 ], [ - 0.688191, - 0.587785, 0.425325 ],
+			[ - 0.681718, - 0.147621, 0.716567 ], [ - 0.442863, - 0.238856, 0.864188 ],
+			[ - 0.587785, - 0.425325, 0.688191 ], [ - 0.309017, - 0.500000, 0.809017 ],
+			[ - 0.147621, - 0.716567, 0.681718 ], [ - 0.425325, - 0.688191, 0.587785 ],
+			[ - 0.162460, - 0.262866, 0.951056 ], [ 0.442863, - 0.238856, 0.864188 ],
+			[ 0.162460, - 0.262866, 0.951056 ], [ 0.309017, - 0.500000, 0.809017 ],
+			[ 0.147621, - 0.716567, 0.681718 ], [ 0.000000, - 0.525731, 0.850651 ],
+			[ 0.425325, - 0.688191, 0.587785 ], [ 0.587785, - 0.425325, 0.688191 ],
+			[ 0.688191, - 0.587785, 0.425325 ], [ - 0.955423, 0.295242, 0.000000 ],
+			[ - 0.951056, 0.162460, 0.262866 ], [ - 1.000000, 0.000000, 0.000000 ],
+			[ - 0.850651, 0.000000, 0.525731 ], [ - 0.955423, - 0.295242, 0.000000 ],
+			[ - 0.951056, - 0.162460, 0.262866 ], [ - 0.864188, 0.442863, - 0.238856 ],
+			[ - 0.951056, 0.162460, - 0.262866 ], [ - 0.809017, 0.309017, - 0.500000 ],
+			[ - 0.864188, - 0.442863, - 0.238856 ], [ - 0.951056, - 0.162460, - 0.262866 ],
+			[ - 0.809017, - 0.309017, - 0.500000 ], [ - 0.681718, 0.147621, - 0.716567 ],
+			[ - 0.681718, - 0.147621, - 0.716567 ], [ - 0.850651, 0.000000, - 0.525731 ],
+			[ - 0.688191, 0.587785, - 0.425325 ], [ - 0.587785, 0.425325, - 0.688191 ],
+			[ - 0.425325, 0.688191, - 0.587785 ], [ - 0.425325, - 0.688191, - 0.587785 ],
+			[ - 0.587785, - 0.425325, - 0.688191 ], [ - 0.688191, - 0.587785, - 0.425325 ]
 		];
 		];
 
 
 		return function ( buffer ) {
 		return function ( buffer ) {
@@ -151,11 +151,11 @@ THREE.MD2Loader.prototype = {
 
 
 			//
 			//
 
 
-			var geometry = new THREE.Geometry();
+			var geometry = new THREE.BufferGeometry();
 
 
 			// uvs
 			// uvs
 
 
-			var uvs = [];
+			var uvsTemp = [];
 			var offset = header.offset_st;
 			var offset = header.offset_st;
 
 
 			for ( var i = 0, l = header.num_st; i < l; i ++ ) {
 			for ( var i = 0, l = header.num_st; i < l; i ++ ) {
@@ -163,7 +163,7 @@ THREE.MD2Loader.prototype = {
 				var u = data.getInt16( offset + 0, true );
 				var u = data.getInt16( offset + 0, true );
 				var v = data.getInt16( offset + 2, true );
 				var v = data.getInt16( offset + 2, true );
 
 
-				uvs.push( new THREE.Vector2( u / header.skinwidth, 1 - ( v / header.skinheight ) ) );
+				uvsTemp.push( u / header.skinwidth, 1 - ( v / header.skinheight ) );
 
 
 				offset += 4;
 				offset += 4;
 
 
@@ -171,21 +171,24 @@ THREE.MD2Loader.prototype = {
 
 
 			// triangles
 			// triangles
 
 
-			var offset = header.offset_tris;
+			offset = header.offset_tris;
 
 
-			for ( var i = 0, l = header.num_tris; i < l; i ++ ) {
+			var vertexIndices = [];
+			var uvIndices = [];
 
 
-				var a = data.getUint16( offset + 0, true );
-				var b = data.getUint16( offset + 2, true );
-				var c = data.getUint16( offset + 4, true );
+			for ( var i = 0, l = header.num_tris; i < l; i ++ ) {
 
 
-				geometry.faces.push( new THREE.Face3( a, b, c ) );
+				vertexIndices.push(
+					data.getUint16( offset + 0, true ),
+					data.getUint16( offset + 2, true ),
+					data.getUint16( offset + 4, true )
+				);
 
 
-				geometry.faceVertexUvs[ 0 ].push( [
-					uvs[ data.getUint16( offset + 6, true ) ],
-					uvs[ data.getUint16( offset + 8, true ) ],
-					uvs[ data.getUint16( offset + 10, true ) ]
-				] );
+				uvIndices.push(
+					data.getUint16( offset + 6, true ),
+					data.getUint16( offset + 8, true ),
+					data.getUint16( offset + 10, true )
+				);
 
 
 				offset += 12;
 				offset += 12;
 
 
@@ -197,7 +200,9 @@ THREE.MD2Loader.prototype = {
 			var scale = new THREE.Vector3();
 			var scale = new THREE.Vector3();
 			var string = [];
 			var string = [];
 
 
-			var offset = header.offset_frames;
+			var frames = [];
+
+			offset = header.offset_frames;
 
 
 			for ( var i = 0, l = header.num_frames; i < l; i ++ ) {
 			for ( var i = 0, l = header.num_frames; i < l; i ++ ) {
 
 
@@ -237,68 +242,131 @@ THREE.MD2Loader.prototype = {
 					var x = data.getUint8( offset ++, true );
 					var x = data.getUint8( offset ++, true );
 					var y = data.getUint8( offset ++, true );
 					var y = data.getUint8( offset ++, true );
 					var z = data.getUint8( offset ++, true );
 					var z = data.getUint8( offset ++, true );
-					var n = normals[ data.getUint8( offset ++, true ) ];
-
-					var vertex = new THREE.Vector3(
-						x * scale.x + translation.x,
-						z * scale.z + translation.z,
-						y * scale.y + translation.y
-					);
+					var n = normalData[ data.getUint8( offset ++, true ) ];
 
 
-					var normal = new THREE.Vector3( n[ 0 ], n[ 2 ], n[ 1 ] );
+					x = x * scale.x + translation.x;
+					y = y * scale.y + translation.y;
+					z = z * scale.z + translation.z;
 
 
-					frame.vertices.push( vertex );
-					frame.normals.push( normal );
+					frame.vertices.push( x, z, y ); // convert to Y-up
+					frame.normals.push( n[ 0 ], n[ 2 ], n[ 1 ] ); // convert to Y-up
 
 
 				}
 				}
 
 
-				geometry.morphTargets.push( frame );
+				frames.push( frame );
 
 
 			}
 			}
 
 
-			// Static
+			// static
+
+			var positions = [];
+			var normals = [];
+			var uvs = [];
+
+			var verticesTemp = frames[ 0 ].vertices;
+			var normalsTemp = frames[ 0 ].normals;
+
+			for ( var i = 0, l = vertexIndices.length; i < l; i ++ ) {
+
+				var vertexIndex = vertexIndices[ i ];
+				var stride = vertexIndex * 3;
+
+				//
+
+				var x = verticesTemp[ stride ];
+				var y = verticesTemp[ stride + 1 ];
+				var z = verticesTemp[ stride + 2 ];
 
 
-			geometry.vertices = geometry.morphTargets[ 0 ].vertices;
+				positions.push( x, y, z );
 
 
-			var morphTarget = geometry.morphTargets[ 0 ];
+				//
 
 
-			for ( var j = 0, jl = geometry.faces.length; j < jl; j ++ ) {
+				var nx = normalsTemp[ stride ];
+				var ny = normalsTemp[ stride + 1 ];
+				var nz = normalsTemp[ stride + 2 ];
 
 
-				var face = geometry.faces[ j ];
+				normals.push( nx, ny, nz );
 
 
-				face.vertexNormals = [
-					morphTarget.normals[ face.a ],
-					morphTarget.normals[ face.b ],
-					morphTarget.normals[ face.c ]
-				];
+				//
+
+				var uvIndex = uvIndices[ i ];
+				stride = uvIndex * 2;
+
+				var u = uvsTemp[ stride ];
+				var v = uvsTemp[ stride + 1 ];
+
+				uvs.push( u, v );
 
 
 			}
 			}
 
 
+			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
+			geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
+			geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
+
+			// animation
 
 
-			// Convert to geometry.morphNormals
+			var morphPositions = [];
+			var morphNormals = [];
 
 
-			for ( var i = 0, l = geometry.morphTargets.length; i < l; i ++ ) {
+			for ( var i = 0, l = frames.length; i < l; i ++ ) {
 
 
-				var morphTarget = geometry.morphTargets[ i ];
-				var vertexNormals = [];
+				var frame = frames[ i ];
+				var attributeName = frame.name;
 
 
-				for ( var j = 0, jl = geometry.faces.length; j < jl; j ++ ) {
+				if ( frame.vertices.length > 0 ) {
 
 
-					var face = geometry.faces[ j ];
+					var positions = [];
 
 
-					vertexNormals.push( {
-						a: morphTarget.normals[ face.a ],
-						b: morphTarget.normals[ face.b ],
-						c: morphTarget.normals[ face.c ]
-					} );
+					for ( var j = 0, jl = vertexIndices.length; j < jl; j ++ ) {
+
+						var vertexIndex = vertexIndices[ j ];
+						var stride = vertexIndex * 3;
+
+						var x = frame.vertices[ stride ];
+						var y = frame.vertices[ stride + 1 ];
+						var z = frame.vertices[ stride + 2 ];
+
+						positions.push( x, y, z );
+
+					}
+
+					var positionAttribute = new THREE.Float32BufferAttribute( positions, 3 );
+					positionAttribute.name = attributeName;
+
+					morphPositions.push( positionAttribute );
 
 
 				}
 				}
 
 
-				geometry.morphNormals.push( { vertexNormals: vertexNormals } );
+				if ( frame.normals.length > 0 ) {
+
+					var normals = [];
+
+					for ( var j = 0, jl = vertexIndices.length; j < jl; j ++ ) {
+
+						var vertexIndex = vertexIndices[ j ];
+						var stride = vertexIndex * 3;
+
+						var nx = frame.normals[ stride ];
+						var ny = frame.normals[ stride + 1 ];
+						var nz = frame.normals[ stride + 2 ];
+
+						normals.push( nx, ny, nz );
+
+					}
+
+					var normalAttribute = new THREE.Float32BufferAttribute( normals, 3 );
+					normalAttribute.name = attributeName;
+
+					morphNormals.push( normalAttribute );
+
+				}
 
 
 			}
 			}
 
 
-			geometry.animations = THREE.AnimationClip.CreateClipsFromMorphTargetSequences( geometry.morphTargets, 10 );
+			geometry.morphAttributes.position = morphPositions;
+			geometry.morphAttributes.normal = morphNormals;
+
+			geometry.animations = THREE.AnimationClip.CreateClipsFromMorphTargetSequences( frames, 10 );
 
 
 			console.timeEnd( 'MD2Loader' );
 			console.timeEnd( 'MD2Loader' );
 
 

+ 8 - 7
examples/js/loaders/MMDLoader.js

@@ -841,13 +841,14 @@ THREE.MMDLoader = ( function () {
 			geometry.morphTargets = morphTargets;
 			geometry.morphTargets = morphTargets;
 			geometry.morphAttributes.position = morphPositions;
 			geometry.morphAttributes.position = morphPositions;
 
 
-			geometry.iks = iks;
-			geometry.grants = grants;
-
-			geometry.rigidBodies = rigidBodies;
-			geometry.constraints = constraints;
-
-			geometry.mmdFormat = data.metadata.format;
+			geometry.userData.MMD = {
+				bones: bones,
+				iks: iks,
+				grants: grants,
+				rigidBodies: rigidBodies,
+				constraints: constraints,
+				format: data.metadata.format
+			};
 
 
 			geometry.computeBoundingSphere();
 			geometry.computeBoundingSphere();
 
 

+ 2 - 1
examples/js/loaders/NodeMaterialLoader.js

@@ -184,9 +184,10 @@ Object.assign( THREE.NodeMaterialLoader.prototype, {
 
 
 			switch ( node.type ) {
 			switch ( node.type ) {
 
 
+				case "IntNode":
 				case "FloatNode":
 				case "FloatNode":
 
 
-					object.number = node.number;
+					object.value = node.value;
 
 
 					break;
 					break;
 
 

+ 15 - 4
examples/js/loaders/SVGLoader.js

@@ -289,6 +289,8 @@ THREE.SVGLoader.prototype = {
 								point.x + numbers[ j + 4 ],
 								point.x + numbers[ j + 4 ],
 								point.y + numbers[ j + 5 ]
 								point.y + numbers[ j + 5 ]
 							);
 							);
+							control.x = point.x + numbers[ j + 2 ];
+							control.y = point.y + numbers[ j + 3 ];
 							point.x += numbers[ j + 4 ];
 							point.x += numbers[ j + 4 ];
 							point.y += numbers[ j + 5 ];
 							point.y += numbers[ j + 5 ];
 						}
 						}
@@ -297,8 +299,6 @@ THREE.SVGLoader.prototype = {
 					case 's':
 					case 's':
 						var numbers = parseFloats( data );
 						var numbers = parseFloats( data );
 						path.bezierCurveTo(
 						path.bezierCurveTo(
-							// TODO: Not sure if point needs
-							// to be added to reflection...
 							getReflection( point.x, control.x ),
 							getReflection( point.x, control.x ),
 							getReflection( point.y, control.y ),
 							getReflection( point.y, control.y ),
 							point.x + numbers[ 0 ],
 							point.x + numbers[ 0 ],
@@ -620,7 +620,7 @@ THREE.SVGLoader.prototype = {
 
 
 		function getReflection( a, b ) {
 		function getReflection( a, b ) {
 
 
-			return 2 * a - ( b - a );
+			return a - ( b - a );
 
 
 		}
 		}
 
 
@@ -630,7 +630,18 @@ THREE.SVGLoader.prototype = {
 
 
 			for ( var i = 0; i < array.length; i ++ ) {
 			for ( var i = 0; i < array.length; i ++ ) {
 
 
-				array[ i ] = parseFloat( array[ i ] );
+				var number = array[ i ];
+
+				// Handle values like 48.6037.7
+				// TODO Find a regex for this
+
+				if ( number.indexOf( '.' ) !== number.lastIndexOf( '.' ) ) {
+
+					array.splice( i + 1, 0, '0.' + number.split( '.' )[ 2 ] );
+
+				}
+
+				array[ i ] = parseFloat( number );
 
 
 			}
 			}
 
 

+ 21 - 69
examples/js/loaders/TDSLoader.js

@@ -1,5 +1,5 @@
 /*
 /*
- * Autodesk 3DS threee.js file loader, based on lib3ds.
+ * Autodesk 3DS three.js file loader, based on lib3ds.
  *
  *
  * Loads geometry with uv and materials basic properties with texture support.
  * Loads geometry with uv and materials basic properties with texture support.
  *
  *
@@ -321,20 +321,9 @@ THREE.TDSLoader.prototype = {
 		var chunk = this.readChunk( data );
 		var chunk = this.readChunk( data );
 		var next = this.nextChunk( data, chunk );
 		var next = this.nextChunk( data, chunk );
 
 
-		var useBufferGeometry = false;
-		var geometry = null;
+		var geometry = new THREE.BufferGeometry();
 		var uvs = [];
 		var uvs = [];
 
 
-		if ( useBufferGeometry ) {
-
-			geometry = new THREE.BufferGeometry();
-
-		}	else {
-
-			geometry = new THREE.Geometry();
-
-		}
-
 		var material = new THREE.MeshPhongMaterial();
 		var material = new THREE.MeshPhongMaterial();
 		var mesh = new THREE.Mesh( geometry, material );
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.name = 'mesh';
 		mesh.name = 'mesh';
@@ -349,29 +338,18 @@ THREE.TDSLoader.prototype = {
 
 
 				//BufferGeometry
 				//BufferGeometry
 
 
-				if ( useBufferGeometry )	{
-
-					var vertices = [];
-					for ( var i = 0; i < points; i ++ )		{
-
-						vertices.push( this.readFloat( data ) );
-						vertices.push( this.readFloat( data ) );
-						vertices.push( this.readFloat( data ) );
-
-					}
-
-					geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( vertices ), 3 ) );
-
-				} else	{ //Geometry
+				var vertices = [];
 
 
-					for ( var i = 0; i < points; i ++ )		{
+				for ( var i = 0; i < points; i ++ )		{
 
 
-						geometry.vertices.push( new THREE.Vector3( this.readFloat( data ), this.readFloat( data ), this.readFloat( data ) ) );
-
-					}
+					vertices.push( this.readFloat( data ) );
+					vertices.push( this.readFloat( data ) );
+					vertices.push( this.readFloat( data ) );
 
 
 				}
 				}
 
 
+				geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( vertices, 3 ) );
+
 			} else if ( next === FACE_ARRAY ) {
 			} else if ( next === FACE_ARRAY ) {
 
 
 				this.resetPosition( data );
 				this.resetPosition( data );
@@ -385,27 +363,17 @@ THREE.TDSLoader.prototype = {
 
 
 				//BufferGeometry
 				//BufferGeometry
 
 
-				if ( useBufferGeometry )	{
-
-					var uvs = [];
-					for ( var i = 0; i < texels; i ++ )		{
-
-						uvs.push( this.readFloat( data ) );
-						uvs.push( this.readFloat( data ) );
-
-					}
-					geometry.addAttribute( 'uv', new THREE.BufferAttribute( new Float32Array( uvs ), 2 ) );
+				var uvs = [];
 
 
-				} else { //Geometry
+				for ( var i = 0; i < texels; i ++ )		{
 
 
-					uvs = [];
-					for ( var i = 0; i < texels; i ++ )		{
+					uvs.push( this.readFloat( data ) );
+					uvs.push( this.readFloat( data ) );
 
 
-						uvs.push( new THREE.Vector2( this.readFloat( data ), this.readFloat( data ) ) );
+				}
 
 
-					}
+				geometry.addAttribute( 'uv', new THREE.Float32BufferAttribute( uvs, 2 ) );
 
 
-				}
 
 
 			} else if ( next === MESH_MATRIX ) {
 			} else if ( next === MESH_MATRIX ) {
 
 
@@ -464,27 +432,7 @@ THREE.TDSLoader.prototype = {
 
 
 		this.endChunk( chunk );
 		this.endChunk( chunk );
 
 
-		if ( ! useBufferGeometry ) {
-
-			//geometry.faceVertexUvs[0][faceIndex][vertexIndex]
-
-			if ( uvs.length > 0 ) {
-
-				var faceUV = [];
-
-				for ( var i = 0; i < geometry.faces.length; i ++ ) {
-
-					faceUV.push( [ uvs[ geometry.faces[ i ].a ], uvs[ geometry.faces[ i ].b ], uvs[ geometry.faces[ i ].c ] ] );
-
-				}
-
-				geometry.faceVertexUvs[ 0 ] = faceUV;
-
-			}
-
-			geometry.computeVertexNormals();
-
-		}
+		geometry.computeVertexNormals();
 
 
 		return mesh;
 		return mesh;
 
 
@@ -504,14 +452,18 @@ THREE.TDSLoader.prototype = {
 
 
 		this.debugMessage( '   Faces: ' + faces );
 		this.debugMessage( '   Faces: ' + faces );
 
 
+		var index = [];
+
 		for ( var i = 0; i < faces; ++ i ) {
 		for ( var i = 0; i < faces; ++ i ) {
 
 
-			mesh.geometry.faces.push( new THREE.Face3( this.readWord( data ), this.readWord( data ), this.readWord( data ) ) );
+			index.push( this.readWord( data ), this.readWord( data ), this.readWord( data ) );
 
 
 			var visibility = this.readWord( data );
 			var visibility = this.readWord( data );
 
 
 		}
 		}
 
 
+		mesh.geometry.setIndex( index );
+
 		//The rest of the FACE_ARRAY chunk is subchunks
 		//The rest of the FACE_ARRAY chunk is subchunks
 
 
 		while ( this.position < chunk.end ) {
 		while ( this.position < chunk.end ) {

+ 22 - 48
examples/js/loaders/VTKLoader.js

@@ -250,77 +250,51 @@ Object.assign( THREE.VTKLoader.prototype, THREE.EventDispatcher.prototype, {
 
 
 			}
 			}
 
 
-			var geometry;
-			var stagger = 'point';
+			var geometry = new THREE.BufferGeometry();
+			geometry.setIndex( indices );
+			geometry.addAttribute( 'position', new THREE.Float32BufferAttribute( positions, 3 ) );
 
 
-			if ( colors.length === indices.length ) {
+			if ( normals.length === positions.length ) {
 
 
-				stagger = 'cell';
+				geometry.addAttribute( 'normal', new THREE.Float32BufferAttribute( normals, 3 ) );
 
 
 			}
 			}
 
 
-			if ( stagger === 'point' ) {
+			if ( colors.length !== indices.length ) {
 
 
-				// Nodal. Use BufferGeometry
-				geometry = new THREE.BufferGeometry();
-				geometry.setIndex( new THREE.BufferAttribute( new Uint32Array( indices ), 1 ) );
-				geometry.addAttribute( 'position', new THREE.BufferAttribute( new Float32Array( positions ), 3 ) );
+				// stagger
 
 
 				if ( colors.length === positions.length ) {
 				if ( colors.length === positions.length ) {
 
 
-					geometry.addAttribute( 'color', new THREE.BufferAttribute( new Float32Array( colors ), 3 ) );
-
-				}
-
-				if ( normals.length === positions.length ) {
-
-					geometry.addAttribute( 'normal', new THREE.BufferAttribute( new Float32Array( normals ), 3 ) );
+					geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( colors, 3 ) );
 
 
 				}
 				}
 
 
 			} else {
 			} else {
 
 
-				// Cell centered colors. The only way to attach a solid color to each triangle
-				// is to use Geometry, which is less efficient than BufferGeometry
-				geometry = new THREE.Geometry();
-
-				var numTriangles = indices.length / 3;
-				var numPoints = positions.length / 3;
-				var face;
-				var ia, ib, ic;
-				var x, y, z;
-				var r, g, b;
+				// cell
 
 
-				for ( var j = 0; j < numPoints; ++ j ) {
+				geometry = geometry.toNonIndexed();
+				var numTriangles = geometry.attributes.position.count / 3;
 
 
-					x = positions[ 3 * j + 0 ];
-					y = positions[ 3 * j + 1 ];
-					z = positions[ 3 * j + 2 ];
-					geometry.vertices.push( new THREE.Vector3( x, y, z ) );
+				if ( colors.length === ( numTriangles * 3 ) ) {
 
 
-				}
-
-				for ( var i = 0; i < numTriangles; ++ i ) {
-
-					ia = indices[ 3 * i + 0 ];
-					ib = indices[ 3 * i + 1 ];
-					ic = indices[ 3 * i + 2 ];
-					geometry.faces.push( new THREE.Face3( ia, ib, ic ) );
+					var newColors = [];
 
 
-				}
-
-				if ( colors.length === numTriangles * 3 ) {
+					for ( var i = 0; i < numTriangles; i ++ ) {
 
 
-					for ( var i = 0; i < numTriangles; ++ i ) {
+						var r = colors[ 3 * i + 0 ];
+						var g = colors[ 3 * i + 1 ];
+						var b = colors[ 3 * i + 2 ];
 
 
-						face = geometry.faces[ i ];
-						r = colors[ 3 * i + 0 ];
-						g = colors[ 3 * i + 1 ];
-						b = colors[ 3 * i + 2 ];
-						face.color = new THREE.Color().setRGB( r, g, b );
+						newColors.push( r, g, b );
+						newColors.push( r, g, b );
+						newColors.push( r, g, b );
 
 
 					}
 					}
 
 
+					geometry.addAttribute( 'color', new THREE.Float32BufferAttribute( newColors, 3 ) );
+
 				}
 				}
 
 
 			}
 			}

+ 7 - 2
examples/js/loaders/XLoader.js

@@ -1,3 +1,8 @@
+/**
+ * @author adrs2002 / https://github.com/adrs2002
+ */
+
+
 ( function ( global, factory ) {
 ( function ( global, factory ) {
 
 
 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
 	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
@@ -203,13 +208,13 @@
 
 
 	var XLoader = function () {
 	var XLoader = function () {
 
 
-		function XLoader( manager, texloader ) {
+		function XLoader( manager ) {
 
 
 			classCallCheck( this, XLoader );
 			classCallCheck( this, XLoader );
 
 
 			this.debug = false;
 			this.debug = false;
 			this.manager = manager !== undefined ? manager : new THREE.DefaultLoadingManager();
 			this.manager = manager !== undefined ? manager : new THREE.DefaultLoadingManager();
-			this.texloader = texloader !== undefined ? texloader : new THREE.TextureLoader();
+			this.texloader = new THREE.TextureLoader( this.manager );
 			this.url = "";
 			this.url = "";
 			this.baseDir = "";
 			this.baseDir = "";
 			this._putMatLength = 0;
 			this._putMatLength = 0;

+ 96 - 63
examples/js/modifiers/SimplifyModifier.js

@@ -8,24 +8,22 @@
  *    - http://www.melax.com/polychop/
  *    - http://www.melax.com/polychop/
  */
  */
 
 
-THREE.SimplifyModifier = function() {
+THREE.SimplifyModifier = function () {};
 
 
-};
-
-(function() {
+( function () {
 
 
 	var cb = new THREE.Vector3(), ab = new THREE.Vector3();
 	var cb = new THREE.Vector3(), ab = new THREE.Vector3();
 
 
 	function pushIfUnique( array, object ) {
 	function pushIfUnique( array, object ) {
 
 
-		if ( array.indexOf( object ) === -1 ) array.push( object );
+		if ( array.indexOf( object ) === - 1 ) array.push( object );
 
 
 	}
 	}
 
 
 	function removeFromArray( array, object ) {
 	function removeFromArray( array, object ) {
 
 
 		var k = array.indexOf( object );
 		var k = array.indexOf( object );
-		if ( k > -1 ) array.splice( k, 1 );
+		if ( k > - 1 ) array.splice( k, 1 );
 
 
 	}
 	}
 
 
@@ -38,14 +36,14 @@ THREE.SimplifyModifier = function() {
 		var curvature = 0;
 		var curvature = 0;
 
 
 		var sideFaces = [];
 		var sideFaces = [];
-		var i, uFaces = u.faces, il = u.faces.length, face, sideFace;
+		var i, il = u.faces.length, face, sideFace;
 
 
 		// find the "sides" triangles that are on the edge uv
 		// find the "sides" triangles that are on the edge uv
-		for ( i = 0 ; i < il; i ++ ) {
+		for ( i = 0; i < il; i ++ ) {
 
 
 			face = u.faces[ i ];
 			face = u.faces[ i ];
 
 
-			if ( face.hasVertex(v) ) {
+			if ( face.hasVertex( v ) ) {
 
 
 				sideFaces.push( face );
 				sideFaces.push( face );
 
 
@@ -55,20 +53,22 @@ THREE.SimplifyModifier = function() {
 
 
 		// use the triangle facing most away from the sides
 		// use the triangle facing most away from the sides
 		// to determine our curvature term
 		// to determine our curvature term
-		for ( i = 0 ; i < il; i ++ ) {
+		for ( i = 0; i < il; i ++ ) {
 
 
 			var minCurvature = 1;
 			var minCurvature = 1;
 			face = u.faces[ i ];
 			face = u.faces[ i ];
 
 
-			for( var j = 0; j < sideFaces.length; j ++ ) {
+			for ( var j = 0; j < sideFaces.length; j ++ ) {
 
 
 				sideFace = sideFaces[ j ];
 				sideFace = sideFaces[ j ];
 				// use dot product of face normals.
 				// use dot product of face normals.
 				var dotProd = face.normal.dot( sideFace.normal );
 				var dotProd = face.normal.dot( sideFace.normal );
-				minCurvature = Math.min( minCurvature, ( 1.001 - dotProd ) / 2);
+				minCurvature = Math.min( minCurvature, ( 1.001 - dotProd ) / 2 );
+
 			}
 			}
 
 
 			curvature = Math.max( curvature, minCurvature );
 			curvature = Math.max( curvature, minCurvature );
+
 		}
 		}
 
 
 		// crude approach in attempt to preserve borders
 		// crude approach in attempt to preserve borders
@@ -79,6 +79,7 @@ THREE.SimplifyModifier = function() {
 			// we add some arbitrary cost for borders,
 			// we add some arbitrary cost for borders,
 			// borders += 10;
 			// borders += 10;
 			curvature = 1;
 			curvature = 1;
+
 		}
 		}
 
 
 		var amt = edgelength * curvature + borders;
 		var amt = edgelength * curvature + borders;
@@ -88,6 +89,7 @@ THREE.SimplifyModifier = function() {
 	}
 	}
 
 
 	function computeEdgeCostAtVertex( v ) {
 	function computeEdgeCostAtVertex( v ) {
+
 		// compute the edge collapse cost for all edges that start
 		// compute the edge collapse cost for all edges that start
 		// from vertex v.  Since we are only interested in reducing
 		// from vertex v.  Since we are only interested in reducing
 		// the object by selecting the min cost edge at each step, we
 		// the object by selecting the min cost edge at each step, we
@@ -113,12 +115,14 @@ THREE.SimplifyModifier = function() {
 
 
 			var collapseCost = computeEdgeCollapseCost( v, v.neighbors[ i ] );
 			var collapseCost = computeEdgeCollapseCost( v, v.neighbors[ i ] );
 
 
-			if ( !v.collapseNeighbor ) {
+			if ( ! v.collapseNeighbor ) {
+
 				v.collapseNeighbor = v.neighbors[ i ];
 				v.collapseNeighbor = v.neighbors[ i ];
 				v.collapseCost = collapseCost;
 				v.collapseCost = collapseCost;
 				v.minCost = collapseCost;
 				v.minCost = collapseCost;
 				v.totalCost = 0;
 				v.totalCost = 0;
 				v.costCount = 0;
 				v.costCount = 0;
+
 			}
 			}
 
 
 			v.costCount ++;
 			v.costCount ++;
@@ -166,13 +170,16 @@ THREE.SimplifyModifier = function() {
 		var vs = [ this.v1, this.v2, this.v3 ];
 		var vs = [ this.v1, this.v2, this.v3 ];
 		var v1, v2;
 		var v1, v2;
 
 
-		for( var i = 0 ; i < 3 ; i ++ ) {
+		for ( var i = 0; i < 3; i ++ ) {
+
 			v1 = vs[ i ];
 			v1 = vs[ i ];
-			v2 = vs[( i+1) % 3 ];
+			v2 = vs[ ( i + 1 ) % 3 ];
+
+			if ( ! v1 || ! v2 ) continue;
 
 
-			if( !v1 || !v2 ) continue;
 			v1.removeIfNonNeighbor( v2 );
 			v1.removeIfNonNeighbor( v2 );
 			v2.removeIfNonNeighbor( v1 );
 			v2.removeIfNonNeighbor( v1 );
+
 		}
 		}
 
 
 	}
 	}
@@ -181,7 +188,7 @@ THREE.SimplifyModifier = function() {
 
 
 		// Collapse the edge uv by moving vertex u onto v
 		// Collapse the edge uv by moving vertex u onto v
 
 
-		if ( !v ) {
+		if ( ! v ) {
 
 
 			// u is a vertex all by itself so just delete it..
 			// u is a vertex all by itself so just delete it..
 			removeVertex( u, vertices );
 			removeVertex( u, vertices );
@@ -192,7 +199,7 @@ THREE.SimplifyModifier = function() {
 		var i;
 		var i;
 		var tmpVertices = [];
 		var tmpVertices = [];
 
 
-		for( i = 0 ; i < u.neighbors.length; i ++ ) {
+		for ( i = 0; i < u.neighbors.length; i ++ ) {
 
 
 			tmpVertices.push( u.neighbors[ i ] );
 			tmpVertices.push( u.neighbors[ i ] );
 
 
@@ -200,7 +207,7 @@ THREE.SimplifyModifier = function() {
 
 
 
 
 		// delete triangles on edge uv:
 		// delete triangles on edge uv:
-		for( i = u.faces.length - 1; i >= 0; i -- ) {
+		for ( i = u.faces.length - 1; i >= 0; i -- ) {
 
 
 			if ( u.faces[ i ].hasVertex( v ) ) {
 			if ( u.faces[ i ].hasVertex( v ) ) {
 
 
@@ -211,9 +218,9 @@ THREE.SimplifyModifier = function() {
 		}
 		}
 
 
 		// update remaining triangles to have v instead of u
 		// update remaining triangles to have v instead of u
-		for( i = u.faces.length -1 ; i >= 0; i -- ) {
+		for ( i = u.faces.length - 1; i >= 0; i -- ) {
 
 
-			u.faces[i].replaceVertex( u, v );
+			u.faces[ i ].replaceVertex( u, v );
 
 
 		}
 		}
 
 
@@ -221,7 +228,7 @@ THREE.SimplifyModifier = function() {
 		removeVertex( u, vertices );
 		removeVertex( u, vertices );
 
 
 		// recompute the edge collapse costs in neighborhood
 		// recompute the edge collapse costs in neighborhood
-		for( i = 0; i < tmpVertices.length; i ++ ) {
+		for ( i = 0; i < tmpVertices.length; i ++ ) {
 
 
 			computeEdgeCostAtVertex( tmpVertices[ i ] );
 			computeEdgeCostAtVertex( tmpVertices[ i ] );
 
 
@@ -237,13 +244,14 @@ THREE.SimplifyModifier = function() {
 
 
 		var least = vertices[ 0 ];
 		var least = vertices[ 0 ];
 
 
-		for (var i = 0; i < vertices.length; i ++ ) {
+		for ( var i = 0; i < vertices.length; i ++ ) {
 
 
 			if ( vertices[ i ].collapseCost < least.collapseCost ) {
 			if ( vertices[ i ].collapseCost < least.collapseCost ) {
 
 
 				least = vertices[ i ];
 				least = vertices[ i ];
 
 
 			}
 			}
+
 		}
 		}
 
 
 		return least;
 		return least;
@@ -253,6 +261,7 @@ THREE.SimplifyModifier = function() {
 	// we use a triangle class to represent structure of face slightly differently
 	// we use a triangle class to represent structure of face slightly differently
 
 
 	function Triangle( v1, v2, v3, a, b, c ) {
 	function Triangle( v1, v2, v3, a, b, c ) {
+
 		this.a = a;
 		this.a = a;
 		this.b = b;
 		this.b = b;
 		this.c = c;
 		this.c = c;
@@ -280,7 +289,7 @@ THREE.SimplifyModifier = function() {
 
 
 	}
 	}
 
 
-	Triangle.prototype.computeNormal = function() {
+	Triangle.prototype.computeNormal = function () {
 
 
 		var vA = this.v1.position;
 		var vA = this.v1.position;
 		var vB = this.v2.position;
 		var vB = this.v2.position;
@@ -294,13 +303,13 @@ THREE.SimplifyModifier = function() {
 
 
 	};
 	};
 
 
-	Triangle.prototype.hasVertex = function( v ) {
+	Triangle.prototype.hasVertex = function ( v ) {
 
 
 		return v === this.v1 || v === this.v2 || v === this.v3;
 		return v === this.v1 || v === this.v2 || v === this.v3;
 
 
 	};
 	};
 
 
-	Triangle.prototype.replaceVertex = function( oldv, newv ) {
+	Triangle.prototype.replaceVertex = function ( oldv, newv ) {
 
 
 		if ( oldv === this.v1 ) this.v1 = newv;
 		if ( oldv === this.v1 ) this.v1 = newv;
 		else if ( oldv === this.v2 ) this.v2 = newv;
 		else if ( oldv === this.v2 ) this.v2 = newv;
@@ -347,17 +356,19 @@ THREE.SimplifyModifier = function() {
 
 
 	}
 	}
 
 
-	Vertex.prototype.addUniqueNeighbor = function( vertex ) {
-		pushIfUnique(this.neighbors, vertex);
+	Vertex.prototype.addUniqueNeighbor = function ( vertex ) {
+
+		pushIfUnique( this.neighbors, vertex );
+
 	};
 	};
 
 
-	Vertex.prototype.removeIfNonNeighbor = function( n ) {
+	Vertex.prototype.removeIfNonNeighbor = function ( n ) {
 
 
 		var neighbors = this.neighbors;
 		var neighbors = this.neighbors;
 		var faces = this.faces;
 		var faces = this.faces;
 
 
 		var offset = neighbors.indexOf( n );
 		var offset = neighbors.indexOf( n );
-		if ( offset === -1 ) return;
+		if ( offset === - 1 ) return;
 		for ( var i = 0; i < faces.length; i ++ ) {
 		for ( var i = 0; i < faces.length; i ++ ) {
 
 
 			if ( faces[ i ].hasVertex( n ) ) return;
 			if ( faces[ i ].hasVertex( n ) ) return;
@@ -365,13 +376,15 @@ THREE.SimplifyModifier = function() {
 		}
 		}
 
 
 		neighbors.splice( offset, 1 );
 		neighbors.splice( offset, 1 );
+
 	};
 	};
 
 
-	THREE.SimplifyModifier.prototype.modify = function( geometry, count ) {
+	THREE.SimplifyModifier.prototype.modify = function ( geometry, count ) {
+
+		if ( geometry.isBufferGeometry ) {
 
 
-		if ( geometry instanceof THREE.BufferGeometry && !geometry.vertices && !geometry.faces ) {
-			console.log('converting BufferGeometry to Geometry');
 			geometry = new THREE.Geometry().fromBufferGeometry( geometry );
 			geometry = new THREE.Geometry().fromBufferGeometry( geometry );
+
 		}
 		}
 
 
 		geometry.mergeVertices();
 		geometry.mergeVertices();
@@ -379,83 +392,103 @@ THREE.SimplifyModifier = function() {
 		var oldVertices = geometry.vertices; // Three Position
 		var oldVertices = geometry.vertices; // Three Position
 		var oldFaces = geometry.faces; // Three Face
 		var oldFaces = geometry.faces; // Three Face
 
 
-		var newGeometry = new THREE.Geometry();
-
 		// conversion
 		// conversion
-		var vertices = new Array( oldVertices.length ); // Simplify Custom Vertex Struct
-		var faces = new Array( oldFaces.length ); // Simplify Custom Traignle Struct
+		var vertices = [];
+		var faces = [];
 
 
-		var i, il, face;
+		var i, il;
 
 
 		//
 		//
 		// put data of original geometry in different data structures
 		// put data of original geometry in different data structures
 		//
 		//
 
 
 		// add vertices
 		// add vertices
+
 		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
 		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
 
 
-			vertices[ i ] = new Vertex( oldVertices[ i ], i );
+			var vertex = new Vertex( oldVertices[ i ], i );
+			vertices.push( vertex );
 
 
 		}
 		}
 
 
 		// add faces
 		// add faces
+
 		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
 		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
 
 
-			face = oldFaces[ i ];
-			faces[ i ] = new Triangle( vertices[ face.a ], vertices[ face.b ], vertices[ face.c ], face.a, face.b, face.c );
+			var face = oldFaces[ i ];
+
+			var a = face.a;
+			var b = face.b;
+			var c = face.c;
+
+			var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
+			faces.push( triangle );
 
 
 		}
 		}
 
 
 		// compute all edge collapse costs
 		// compute all edge collapse costs
+
 		for ( i = 0, il = vertices.length; i < il; i ++ ) {
 		for ( i = 0, il = vertices.length; i < il; i ++ ) {
 
 
 			computeEdgeCostAtVertex( vertices[ i ] );
 			computeEdgeCostAtVertex( vertices[ i ] );
 
 
 		}
 		}
 
 
-		var permutation = new Array( vertices.length );
-		var map = new Array( vertices.length );
-
 		var nextVertex;
 		var nextVertex;
 
 
 		var z = count;
 		var z = count;
 
 
-		// console.time('z')
-		// console.profile('zz');
+		while ( z -- ) {
 
 
-		while( z-- ) {
 			nextVertex = minimumCostEdge( vertices );
 			nextVertex = minimumCostEdge( vertices );
-			if (!nextVertex) {
-				console.log('no next vertex');
+
+			if ( ! nextVertex ) {
+
+				console.log( 'THREE.SimplifyModifier: No next vertex' );
 				break;
 				break;
+
 			}
 			}
+
 			collapse( vertices, faces, nextVertex, nextVertex.collapseNeighbor );
 			collapse( vertices, faces, nextVertex, nextVertex.collapseNeighbor );
+
 		}
 		}
 
 
-		// console.profileEnd('zz');
-		// console.timeEnd('z')
+		//
+
+		var simplifiedGeometry = new THREE.BufferGeometry();
+		var position = [];
+		var index = [];
 
 
-		// TODO convert to buffer geometry.
-		var newGeo = new THREE.Geometry();
+		//
 
 
 		for ( i = 0; i < vertices.length; i ++ ) {
 		for ( i = 0; i < vertices.length; i ++ ) {
 
 
-			var v = vertices[ i ];
-			newGeo.vertices.push( v.position )
+			var vertex = vertices[ i ].position;
+			position.push( vertex.x, vertex.y, vertex.z );
 
 
 		}
 		}
 
 
+		//
+
 		for ( i = 0; i < faces.length; i ++ ) {
 		for ( i = 0; i < faces.length; i ++ ) {
 
 
-			var tri = faces[ i ];
-			newGeo.faces.push( new THREE.Face3(
-				vertices.indexOf(tri.v1),
-				vertices.indexOf(tri.v2),
-				vertices.indexOf(tri.v3)
-			) )
+			var face = faces[ i ];
+
+			var a = vertices.indexOf( face.v1 );
+			var b = vertices.indexOf( face.v2 );
+			var c = vertices.indexOf( face.v3 );
+
+			index.push( a, b, c );
 
 
 		}
 		}
 
 
-		return newGeo;
+		//
+
+		simplifiedGeometry.addAttribute( 'position', new THREE.Float32BufferAttribute( position, 3 ) );
+		simplifiedGeometry.setIndex( index );
+
+		return simplifiedGeometry;
+
 	};
 	};
-})();
+
+} )();

+ 2 - 2
examples/js/nodes/InputNode.js

@@ -42,7 +42,7 @@ THREE.InputNode.prototype.generate = function ( builder, output, uuid, type, ns,
 
 
 			if ( ! data.vertex ) {
 			if ( ! data.vertex ) {
 
 
-				data.vertex = material.createVertexUniform( type, this.value, ns, needsUpdate );
+				data.vertex = material.createVertexUniform( type, this, ns, needsUpdate );
 
 
 			}
 			}
 
 
@@ -52,7 +52,7 @@ THREE.InputNode.prototype.generate = function ( builder, output, uuid, type, ns,
 
 
 			if ( ! data.fragment ) {
 			if ( ! data.fragment ) {
 
 
-				data.fragment = material.createFragmentUniform( type, this.value, ns, needsUpdate );
+				data.fragment = material.createFragmentUniform( type, this, ns, needsUpdate );
 
 
 			}
 			}
 
 

+ 8 - 8
examples/js/nodes/NodeMaterial.js

@@ -282,16 +282,16 @@ THREE.NodeMaterial.prototype.mergeUniform = function ( uniforms ) {
 
 
 };
 };
 
 
-THREE.NodeMaterial.prototype.createUniform = function ( type, value, ns, needsUpdate ) {
+THREE.NodeMaterial.prototype.createUniform = function ( type, node, ns, needsUpdate ) {
 
 
 	var index = this.uniformList.length;
 	var index = this.uniformList.length;
 
 
-	var uniform = {
+	var uniform = new THREE.NodeUniform( {
 		type: type,
 		type: type,
-		value: value,
 		name: ns ? ns : 'nVu' + index,
 		name: ns ? ns : 'nVu' + index,
+		node: node,
 		needsUpdate: needsUpdate
 		needsUpdate: needsUpdate
-	};
+	} );
 
 
 	this.uniformList.push( uniform );
 	this.uniformList.push( uniform );
 
 
@@ -487,9 +487,9 @@ THREE.NodeMaterial.prototype.getCodePars = function ( pars, prefix ) {
 
 
 };
 };
 
 
-THREE.NodeMaterial.prototype.createVertexUniform = function ( type, value, ns, needsUpdate ) {
+THREE.NodeMaterial.prototype.createVertexUniform = function ( type, node, ns, needsUpdate ) {
 
 
-	var uniform = this.createUniform( type, value, ns, needsUpdate );
+	var uniform = this.createUniform( type, node, ns, needsUpdate );
 
 
 	this.vertexUniform.push( uniform );
 	this.vertexUniform.push( uniform );
 	this.vertexUniform[ uniform.name ] = uniform;
 	this.vertexUniform[ uniform.name ] = uniform;
@@ -500,9 +500,9 @@ THREE.NodeMaterial.prototype.createVertexUniform = function ( type, value, ns, n
 
 
 };
 };
 
 
-THREE.NodeMaterial.prototype.createFragmentUniform = function ( type, value, ns, needsUpdate ) {
+THREE.NodeMaterial.prototype.createFragmentUniform = function ( type, node, ns, needsUpdate ) {
 
 
-	var uniform = this.createUniform( type, value, ns, needsUpdate );
+	var uniform = this.createUniform( type, node, ns, needsUpdate );
 
 
 	this.fragmentUniform.push( uniform );
 	this.fragmentUniform.push( uniform );
 	this.fragmentUniform[ uniform.name ] = uniform;
 	this.fragmentUniform[ uniform.name ] = uniform;

+ 29 - 0
examples/js/nodes/NodeUniform.js

@@ -0,0 +1,29 @@
+/**
+ * @author sunag / http://www.sunag.com.br/
+ */
+
+THREE.NodeUniform = function ( params ) {
+
+	params = params || {};
+
+	this.name = params.name;
+	this.type = params.type;
+	this.node = params.node;
+	this.needsUpdate = params.needsUpdate;
+
+};
+
+Object.defineProperties( THREE.NodeUniform.prototype, {
+	value: {
+		get: function () {
+
+			return this.node.value;
+
+		},
+		set: function ( val ) {
+
+			this.node.value = val;
+
+		}
+	}
+} );

+ 4 - 4
examples/js/nodes/accessors/CameraNode.js

@@ -150,8 +150,8 @@ THREE.CameraNode.prototype.onUpdateFrame = function ( frame ) {
 
 
 			var camera = this.camera;
 			var camera = this.camera;
 
 
-			this.near.number = camera.near;
-			this.far.number = camera.far;
+			this.near.value = camera.near;
+			this.far.value = camera.far;
 
 
 			break;
 			break;
 
 
@@ -175,8 +175,8 @@ THREE.CameraNode.prototype.toJSON = function ( meta ) {
 
 
 			case THREE.CameraNode.DEPTH:
 			case THREE.CameraNode.DEPTH:
 
 
-				data.near = this.near.number;
-				data.far = this.far.number;
+				data.near = this.near.value;
+				data.far = this.far.value;
 
 
 				break;
 				break;
 
 

+ 4 - 19
examples/js/nodes/inputs/FloatNode.js

@@ -6,7 +6,7 @@ THREE.FloatNode = function ( value ) {
 
 
 	THREE.InputNode.call( this, 'fv1' );
 	THREE.InputNode.call( this, 'fv1' );
 
 
-	this.value = [ value || 0 ];
+	this.value = value || 0;
 
 
 };
 };
 
 
@@ -14,26 +14,11 @@ THREE.FloatNode.prototype = Object.create( THREE.InputNode.prototype );
 THREE.FloatNode.prototype.constructor = THREE.FloatNode;
 THREE.FloatNode.prototype.constructor = THREE.FloatNode;
 THREE.FloatNode.prototype.nodeType = "Float";
 THREE.FloatNode.prototype.nodeType = "Float";
 
 
-Object.defineProperties( THREE.FloatNode.prototype, {
-	number: {
-		get: function () {
-
-			return this.value[ 0 ];
-
-		},
-		set: function ( val ) {
-
-			this.value[ 0 ] = val;
-
-		}
-	}
-} );
-
 THREE.FloatNode.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
 THREE.FloatNode.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
 
 
-	var value = this.number;
+	var val = this.value;
 
 
-	return builder.format( Math.floor( value ) !== value ? value : value + ".0", type, output );
+	return builder.format( Math.floor( val ) !== val ? val : val + ".0", type, output );
 
 
 };
 };
 
 
@@ -45,7 +30,7 @@ THREE.FloatNode.prototype.toJSON = function ( meta ) {
 
 
 		data = this.createJSONNode( meta );
 		data = this.createJSONNode( meta );
 
 
-		data.number = this.number;
+		data.value = this.value;
 
 
 		if ( this.readonly === true ) data.readonly = true;
 		if ( this.readonly === true ) data.readonly = true;
 
 

+ 3 - 18
examples/js/nodes/inputs/IntNode.js

@@ -6,7 +6,7 @@ THREE.IntNode = function ( value ) {
 
 
 	THREE.InputNode.call( this, 'iv1' );
 	THREE.InputNode.call( this, 'iv1' );
 
 
-	this.value = [ Math.floor( value || 0 ) ];
+	this.value = Math.floor( value || 0 );
 
 
 };
 };
 
 
@@ -14,24 +14,9 @@ THREE.IntNode.prototype = Object.create( THREE.InputNode.prototype );
 THREE.IntNode.prototype.constructor = THREE.IntNode;
 THREE.IntNode.prototype.constructor = THREE.IntNode;
 THREE.IntNode.prototype.nodeType = "Int";
 THREE.IntNode.prototype.nodeType = "Int";
 
 
-Object.defineProperties( THREE.IntNode.prototype, {
-	number: {
-		get: function () {
-
-			return this.value[ 0 ];
-
-		},
-		set: function ( val ) {
-
-			this.value[ 0 ] = Math.floor( val );
-
-		}
-	}
-} );
-
 THREE.IntNode.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
 THREE.IntNode.prototype.generateReadonly = function ( builder, output, uuid, type, ns, needsUpdate ) {
 
 
-	return builder.format( this.number, type, output );
+	return builder.format( this.value, type, output );
 
 
 };
 };
 
 
@@ -43,7 +28,7 @@ THREE.IntNode.prototype.toJSON = function ( meta ) {
 
 
 		data = this.createJSONNode( meta );
 		data = this.createJSONNode( meta );
 
 
-		data.number = this.number;
+		data.value = this.value;
 
 
 		if ( this.readonly === true ) data.readonly = true;
 		if ( this.readonly === true ) data.readonly = true;
 
 

+ 4 - 4
examples/js/nodes/utils/BlurNode.js

@@ -59,15 +59,15 @@ THREE.BlurNode.prototype.updateFrame = function ( frame ) {
 
 
 	if ( this.size ) {
 	if ( this.size ) {
 
 
-		this.horizontal.number = this.radius.x / this.size.x;
-		this.vertical.number = this.radius.y / this.size.y;
+		this.horizontal.value = this.radius.x / this.size.x;
+		this.vertical.value = this.radius.y / this.size.y;
 
 
 	} else if ( this.value.value && this.value.value.image ) {
 	} else if ( this.value.value && this.value.value.image ) {
 
 
 		var image = this.value.value.image;
 		var image = this.value.value.image;
 
 
-		this.horizontal.number = this.radius.x / image.width;
-		this.vertical.number = this.radius.y / image.height;
+		this.horizontal.value = this.radius.x / image.width;
+		this.vertical.value = this.radius.y / image.height;
 
 
 	}
 	}
 
 

+ 3 - 3
examples/js/nodes/utils/TimerNode.js

@@ -42,19 +42,19 @@ THREE.TimerNode.prototype.updateFrame = function ( frame ) {
 
 
 		case THREE.TimerNode.LOCAL:
 		case THREE.TimerNode.LOCAL:
 
 
-			this.number += frame.delta * scale;
+			this.value += frame.delta * scale;
 
 
 			break;
 			break;
 
 
 		case THREE.TimerNode.DELTA:
 		case THREE.TimerNode.DELTA:
 
 
-			this.number = frame.delta * scale;
+			this.value = frame.delta * scale;
 
 
 			break;
 			break;
 
 
 		default:
 		default:
 
 
-			this.number = frame.time * scale;
+			this.value = frame.time * scale;
 
 
 	}
 	}
 
 

+ 2 - 2
examples/js/nodes/utils/VelocityNode.js

@@ -74,7 +74,7 @@ THREE.VelocityNode.prototype.setTarget = function ( target ) {
 
 
 	if ( target ) {
 	if ( target ) {
 
 
-		this.position = target.getWorldPosition();
+		this.position = target.getWorldPosition( this.position || new THREE.Vector3() );
 		this.oldPosition = this.position.clone();
 		this.oldPosition = this.position.clone();
 
 
 	}
 	}
@@ -85,7 +85,7 @@ THREE.VelocityNode.prototype.updateFrameVelocity = function ( frame ) {
 
 
 	if ( this.target ) {
 	if ( this.target ) {
 
 
-		this.position = this.target.getWorldPosition();
+		this.position = this.target.getWorldPosition( this.position || new THREE.Vector3() );
 		this.velocity.subVectors( this.position, this.oldPosition );
 		this.velocity.subVectors( this.position, this.oldPosition );
 		this.oldPosition.copy( this.position );
 		this.oldPosition.copy( this.position );
 
 

+ 2 - 2
examples/js/objects/Reflector.js

@@ -55,8 +55,7 @@ THREE.Reflector = function ( geometry, options ) {
 	var material = new THREE.ShaderMaterial( {
 	var material = new THREE.ShaderMaterial( {
 		uniforms: THREE.UniformsUtils.clone( shader.uniforms ),
 		uniforms: THREE.UniformsUtils.clone( shader.uniforms ),
 		fragmentShader: shader.fragmentShader,
 		fragmentShader: shader.fragmentShader,
-		vertexShader: shader.vertexShader,
-
+		vertexShader: shader.vertexShader
 	} );
 	} );
 
 
 	material.uniforms.tDiffuse.value = renderTarget.texture;
 	material.uniforms.tDiffuse.value = renderTarget.texture;
@@ -64,6 +63,7 @@ THREE.Reflector = function ( geometry, options ) {
 	material.uniforms.textureMatrix.value = textureMatrix;
 	material.uniforms.textureMatrix.value = textureMatrix;
 
 
 	this.material = material;
 	this.material = material;
+	this.renderOrder = - Infinity; // render first
 
 
 	this.onBeforeRender = function ( renderer, scene, camera ) {
 	this.onBeforeRender = function ( renderer, scene, camera ) {
 
 

+ 0 - 2
examples/js/objects/ReflectorRTT.js

@@ -4,8 +4,6 @@ THREE.ReflectorRTT = function ( geometry, options ) {
 
 
 	this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
 	this.geometry.setDrawRange( 0, 0 ); // avoid rendering geometry
 
 
-	this.renderOrder = -Infinity; // render RTT first
-
 };
 };
 
 
 THREE.ReflectorRTT.prototype = Object.create( THREE.Reflector.prototype );
 THREE.ReflectorRTT.prototype = Object.create( THREE.Reflector.prototype );

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

@@ -178,13 +178,7 @@ THREE.PMREMCubeUVPacker.prototype = {
 					gl_FragColor = linearToOutputTexel( color );\
 					gl_FragColor = linearToOutputTexel( color );\
 				}",
 				}",
 
 
-			blending: THREE.CustomBlending,
-			premultipliedAlpha: false,
-			blendSrc: THREE.OneFactor,
-			blendDst: THREE.ZeroFactor,
-			blendSrcAlpha: THREE.OneFactor,
-			blendDstAlpha: THREE.ZeroFactor,
-			blendEquation: THREE.AddEquation
+			blending: THREE.NoBlending
 
 
 		} );
 		} );
 
 

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

@@ -259,13 +259,7 @@ THREE.PMREMGenerator.prototype = {
 					gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
 					gl_FragColor = linearToOutputTexel( vec4( rgbColor, 1.0 ) );\n\
 				}",
 				}",
 
 
-			blending: THREE.CustomBlending,
-			premultipliedAlpha: false,
-			blendSrc: THREE.OneFactor,
-			blendDst: THREE.ZeroFactor,
-			blendSrcAlpha: THREE.OneFactor,
-			blendDstAlpha: THREE.ZeroFactor,
-			blendEquation: THREE.AddEquation
+			blending: THREE.NoBlending
 
 
 		} );
 		} );
 
 

+ 62 - 0
examples/js/renderers/CSS2DRenderer.js

@@ -37,6 +37,10 @@ THREE.CSS2DRenderer = function () {
 	var viewMatrix = new THREE.Matrix4();
 	var viewMatrix = new THREE.Matrix4();
 	var viewProjectionMatrix = new THREE.Matrix4();
 	var viewProjectionMatrix = new THREE.Matrix4();
 
 
+	var cache = {
+		objects: new WeakMap()
+	};
+
 	var domElement = document.createElement( 'div' );
 	var domElement = document.createElement( 'div' );
 	domElement.style.overflow = 'hidden';
 	domElement.style.overflow = 'hidden';
 
 
@@ -79,6 +83,12 @@ THREE.CSS2DRenderer = function () {
 			element.style.oTransform = style;
 			element.style.oTransform = style;
 			element.style.transform = style;
 			element.style.transform = style;
 
 
+			var objectData = {
+				distanceToCameraSquared: getDistanceToSquared( camera, object )
+			};
+
+			cache.objects.set( object, objectData );
+
 			if ( element.parentNode !== domElement ) {
 			if ( element.parentNode !== domElement ) {
 
 
 				domElement.appendChild( element );
 				domElement.appendChild( element );
@@ -95,6 +105,57 @@ THREE.CSS2DRenderer = function () {
 
 
 	};
 	};
 
 
+	var getDistanceToSquared = function () {
+
+		var a = new THREE.Vector3();
+		var b = new THREE.Vector3();
+
+		return function ( object1, object2 ) {
+
+			a.setFromMatrixPosition( object1.matrixWorld );
+			b.setFromMatrixPosition( object2.matrixWorld );
+
+			return a.distanceToSquared( b );
+
+		};
+
+	}();
+
+	var filterAndFlatten = function ( scene ) {
+
+		var result = [];
+
+		scene.traverse( function ( object ) {
+
+			if ( object instanceof THREE.CSS2DObject ) result.push( object );
+
+		} );
+
+		return result;
+
+	};
+
+	var zOrder = function ( scene ) {
+
+		var sorted = filterAndFlatten( scene ).sort( function ( a, b ) {
+
+			var distanceA = cache.objects.get( a ).distanceToCameraSquared;
+			var distanceB = cache.objects.get( b ).distanceToCameraSquared;
+
+			return distanceA - distanceB;
+
+		} );
+
+		var zMax = sorted.length;
+
+		for ( var i = 0, l = sorted.length; i < l; i ++ ) {
+
+			sorted[ i ].element.style.zIndex = zMax - i;
+
+		}
+
+	};
+
 	this.render = function ( scene, camera ) {
 	this.render = function ( scene, camera ) {
 
 
 		scene.updateMatrixWorld();
 		scene.updateMatrixWorld();
@@ -105,6 +166,7 @@ THREE.CSS2DRenderer = function () {
 		viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );
 		viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix );
 
 
 		renderObject( scene, camera );
 		renderObject( scene, camera );
+		zOrder( scene );
 
 
 	};
 	};
 
 

+ 91 - 26
examples/js/shaders/BokehShader2.js

@@ -26,7 +26,9 @@ THREE.BokehShader = {
 
 
 		"maxblur":  { value: 1.0 },
 		"maxblur":  { value: 1.0 },
 
 
+		"showFocus":   { value: 0 },
 		"manualdof":   { value: 0 },
 		"manualdof":   { value: 0 },
+		"vignetting":   { value: 0 },
 		"depthblur":   { value: 0 },
 		"depthblur":   { value: 0 },
 
 
 		"threshold":  { value: 0.5 },
 		"threshold":  { value: 0.5 },
@@ -75,6 +77,7 @@ THREE.BokehShader = {
 		"uniform float focalDepth;  //focal distance value in meters, but you may use autofocus option below",
 		"uniform float focalDepth;  //focal distance value in meters, but you may use autofocus option below",
 		"uniform float focalLength; //focal length in mm",
 		"uniform float focalLength; //focal length in mm",
 		"uniform float fstop; //f-stop value",
 		"uniform float fstop; //f-stop value",
+		"uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)",
 
 
 		"/*",
 		"/*",
 		"make sure that these two values are the same for your camera, otherwise distances will be wrong.",
 		"make sure that these two values are the same for your camera, otherwise distances will be wrong.",
@@ -99,6 +102,12 @@ THREE.BokehShader = {
 
 
 		"float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)",
 		"float CoC = 0.03; //circle of confusion size in mm (35mm film = 0.03mm)",
 
 
+		"uniform bool vignetting; // use optical lens vignetting",
+
+		"float vignout = 1.3; // vignetting outer border",
+		"float vignin = 0.0; // vignetting inner border",
+		"float vignfade = 22.0; // f-stops till vignete fades",
+
 		"uniform bool shaderFocus;",
 		"uniform bool shaderFocus;",
 		"// disable if you use external focalDepth value",
 		"// disable if you use external focalDepth value",
 
 
@@ -133,22 +142,6 @@ THREE.BokehShader = {
 
 
 		"//------------------------------------------",
 		"//------------------------------------------",
 
 
-		"float getDepth( const in vec2 screenPosition ) {",
-		"	#if DEPTH_PACKING == 1",
-		"	return unpackRGBAToDepth( texture2D( tDepth, screenPosition ) );",
-		"	#else",
-		"	return texture2D( tDepth, screenPosition ).x;",
-		"	#endif",
-		"}",
-
-		"float getViewZ( const in float depth ) {",
-		"	#if PERSPECTIVE_CAMERA == 1",
-		"	return perspectiveDepthToViewZ( depth, znear, zfar );",
-		"	#else",
-		"	return orthographicDepthToViewZ( depth, znear, zfar );",
-		"	#endif",
-		"}",
-
 		"float penta(vec2 coords) {",
 		"float penta(vec2 coords) {",
 			"//pentagonal shape",
 			"//pentagonal shape",
 			"float scale = float(rings) - 1.3;",
 			"float scale = float(rings) - 1.3;",
@@ -210,7 +203,7 @@ THREE.BokehShader = {
 
 
 
 
 			"for( int i=0; i<9; i++ ) {",
 			"for( int i=0; i<9; i++ ) {",
-				"float tmp = getDepth( coords + offset[ i ] );",
+				"float tmp = texture2D(tDepth, coords + offset[i]).r;",
 				"d += tmp * kernel[i];",
 				"d += tmp * kernel[i];",
 			"}",
 			"}",
 
 
@@ -234,6 +227,28 @@ THREE.BokehShader = {
 			"return col+mix(vec3(0.0),col,thresh*blur);",
 			"return col+mix(vec3(0.0),col,thresh*blur);",
 		"}",
 		"}",
 
 
+		"vec3 debugFocus(vec3 col, float blur, float depth) {",
+			"float edge = 0.002*depth; //distance based edge smoothing",
+			"float m = clamp(smoothstep(0.0,edge,blur),0.0,1.0);",
+			"float e = clamp(smoothstep(1.0-edge,1.0,blur),0.0,1.0);",
+
+			"col = mix(col,vec3(1.0,0.5,0.0),(1.0-m)*0.6);",
+			"col = mix(col,vec3(0.0,0.5,1.0),((1.0-e)-(1.0-m))*0.2);",
+
+			"return col;",
+		"}",
+
+		"float linearize(float depth) {",
+			"return -zfar * znear / (depth * (zfar - znear) - zfar);",
+		"}",
+
+
+		"float vignette() {",
+			"float dist = distance(vUv.xy, vec2(0.5,0.5));",
+			"dist = smoothstep(vignout+(fstop/vignfade), vignin+(fstop/vignfade), dist);",
+			"return clamp(dist,0.0,1.0);",
+		"}",
+
 		"float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {",
 		"float gather(float i, float j, int ringsamples, inout vec3 col, float w, float h, float blur) {",
 			"float rings2 = float(rings);",
 			"float rings2 = float(rings);",
 			"float step = PI*2.0 / float(ringsamples);",
 			"float step = PI*2.0 / float(ringsamples);",
@@ -250,20 +265,20 @@ THREE.BokehShader = {
 		"void main() {",
 		"void main() {",
 			"//scene depth calculation",
 			"//scene depth calculation",
 
 
-			"float depth = getViewZ( getDepth( vUv.xy ) );",
+			"float depth = linearize(texture2D(tDepth,vUv.xy).x);",
 
 
 			"// Blur depth?",
 			"// Blur depth?",
-			"if (depthblur) {",
-				"depth = getViewZ(bdepth(vUv.xy));",
+			"if ( depthblur ) {",
+				"depth = linearize(bdepth(vUv.xy));",
 			"}",
 			"}",
 
 
 			"//focal plane calculation",
 			"//focal plane calculation",
 
 
-			"float fDepth = - focalDepth;", // viewZ is negative
+			"float fDepth = focalDepth;",
 
 
 			"if (shaderFocus) {",
 			"if (shaderFocus) {",
 
 
-				"fDepth = getViewZ( getDepth( focusCoords ) );",
+				"fDepth = linearize(texture2D(tDepth,focusCoords).x);",
 
 
 			"}",
 			"}",
 
 
@@ -272,14 +287,14 @@ THREE.BokehShader = {
 			"float blur = 0.0;",
 			"float blur = 0.0;",
 
 
 			"if (manualdof) {",
 			"if (manualdof) {",
-				"float a = depth - fDepth; // Focal plane",
+				"float a = depth-fDepth; // Focal plane",
 				"float b = (a-fdofstart)/fdofdist; // Far DoF",
 				"float b = (a-fdofstart)/fdofdist; // Far DoF",
 				"float c = (-a-ndofstart)/ndofdist; // Near Dof",
 				"float c = (-a-ndofstart)/ndofdist; // Near Dof",
 				"blur = (a>0.0) ? b : c;",
 				"blur = (a>0.0) ? b : c;",
 			"} else {",
 			"} else {",
-				"float f = focalLength;",
-				"float d = fDepth;",
-				"float o = depth;",
+				"float f = focalLength; // focal length in mm",
+				"float d = fDepth*1000.0; // focal plane in mm",
+				"float o = depth*1000.0; // depth in mm",
 
 
 				"float a = (o*f)/(o-f);",
 				"float a = (o*f)/(o-f);",
 				"float b = (d*f)/(d-f);",
 				"float b = (d*f)/(d-f);",
@@ -325,6 +340,14 @@ THREE.BokehShader = {
 				"col /= s; //divide by sample count",
 				"col /= s; //divide by sample count",
 			"}",
 			"}",
 
 
+			"if (showFocus) {",
+				"col = debugFocus(col, blur, depth);",
+			"}",
+
+			"if (vignetting) {",
+				"col *= vignette();",
+			"}",
+
 			"gl_FragColor.rgb = col;",
 			"gl_FragColor.rgb = col;",
 			"gl_FragColor.a = 1.0;",
 			"gl_FragColor.a = 1.0;",
 		"} "
 		"} "
@@ -332,3 +355,45 @@ THREE.BokehShader = {
 	].join( "\n" )
 	].join( "\n" )
 
 
 };
 };
+
+THREE.BokehDepthShader = {
+
+	uniforms: {
+
+		"mNear": { value: 1.0 },
+		"mFar": { value: 1000.0 },
+
+	},
+
+	vertexShader: [
+
+		"varying float vViewZDepth;",
+
+		"void main() {",
+
+		"	#include <begin_vertex>",
+		"	#include <project_vertex>",
+
+		"	vViewZDepth = - mvPosition.z;",
+
+		"}"
+
+	].join( "\n" ),
+
+	fragmentShader: [
+
+		"uniform float mNear;",
+		"uniform float mFar;",
+
+		"varying float vViewZDepth;",
+
+		"void main() {",
+
+		"	float color = 1.0 - smoothstep( mNear, mFar, vViewZDepth );",
+		"	gl_FragColor = vec4( vec3( color ), 1.0 );",
+
+		"} "
+
+	].join( "\n" )
+
+};

+ 7 - 2
examples/js/vr/WebVR.js

@@ -7,7 +7,7 @@
 
 
 var WEBVR = {
 var WEBVR = {
 
 
-	createButton: function ( renderer ) {
+	createButton: function ( renderer, options ) {
 
 
 		function showEnterVR( device ) {
 		function showEnterVR( device ) {
 
 
@@ -38,9 +38,12 @@ var WEBVR = {
 
 
 			function onSessionStarted( session ) {
 			function onSessionStarted( session ) {
 
 
+				if ( options === undefined ) options = {};
+				if ( options.frameOfReferenceType === undefined ) options.frameOfReferenceType = 'stage';
+
 				session.addEventListener( 'end', onSessionEnded );
 				session.addEventListener( 'end', onSessionEnded );
 
 
-				renderer.vr.setSession( session );
+				renderer.vr.setSession( session, options );
 				button.textContent = 'EXIT XR';
 				button.textContent = 'EXIT XR';
 
 
 				currentSession = session;
 				currentSession = session;
@@ -49,6 +52,8 @@ var WEBVR = {
 
 
 			function onSessionEnded( event ) {
 			function onSessionEnded( event ) {
 
 
+				currentSession.removeEventListener( 'end', onSessionEnded );
+
 				renderer.vr.setSession( null );
 				renderer.vr.setSession( null );
 				button.textContent = 'ENTER XR';
 				button.textContent = 'ENTER XR';
 
 

+ 193 - 0
examples/misc_exporter_stl.html

@@ -0,0 +1,193 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<title>three.js webgl - exporter - stl</title>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
+		<style>
+			body {
+				font-family: Monospace;
+				background-color: #000;
+				color: #fff;
+				margin: 0px;
+				overflow: hidden;
+			}
+			#info {
+				color: #fff;
+				position: absolute;
+				top: 10px;
+				width: 100%;
+				text-align: center;
+				display:block;
+			}
+			#info a {
+				color: #046;
+				font-weight: bold;
+			}
+		</style>
+	</head>
+	<body>
+		<div id="info">
+			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - exporter - stl
+		</div>
+
+		<script src="../build/three.js"></script>
+		<script src="js/controls/OrbitControls.js"></script>
+		<script src="js/exporters/STLExporter.js"></script>
+
+		<script src="js/Detector.js"></script>
+		<script src="js/libs/dat.gui.min.js"></script>
+
+		<script>
+
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+
+			var scene, camera, renderer, exporter;
+
+			init();
+			animate();
+
+			function init() {
+
+				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.set( 200, 100, 200 );
+
+				scene = new THREE.Scene();
+				scene.background = new THREE.Color( 0xa0a0a0 );
+				scene.fog = new THREE.Fog( 0xa0a0a0, 200, 1000 );
+
+				exporter = new THREE.STLExporter();
+
+				//
+
+				var hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444 );
+				hemiLight.position.set( 0, 200, 0 );
+				scene.add( hemiLight );
+
+				var directionalLight = new THREE.DirectionalLight( 0xffffff );
+				directionalLight.position.set( 0, 200, 100 );
+				directionalLight.castShadow = true;
+				directionalLight.shadow.camera.top = 180;
+				directionalLight.shadow.camera.bottom = - 100;
+				directionalLight.shadow.camera.left = - 120;
+				directionalLight.shadow.camera.right = 120;
+				scene.add( directionalLight );
+
+				// ground
+
+				var ground = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
+				ground.rotation.x = - Math.PI / 2;
+				ground.receiveShadow = true;
+				scene.add( ground );
+
+				var grid = new THREE.GridHelper( 2000, 20, 0x000000, 0x000000 );
+				grid.material.opacity = 0.2;
+				grid.material.transparent = true;
+				scene.add( grid );
+
+				// export mesh
+
+				var geometry = new THREE.BoxBufferGeometry( 50, 50, 50 );
+				var material = new THREE.MeshPhongMaterial( { color: 0x00ff00 } );
+
+				mesh = new THREE.Mesh( geometry, material );
+				mesh.castShadow = true;
+				mesh.position.y = 25;
+				scene.add( mesh );
+
+				//
+
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				renderer.shadowMap.enabled = true;
+				document.body.appendChild( renderer.domElement );
+
+				//
+
+				var controls = new THREE.OrbitControls( camera, renderer.domElement );
+				controls.target.set( 0, 25, 0 );
+				controls.update();
+
+				//
+
+				var params = {
+					ASCII: function() {
+						exportASCII();
+					},
+					Binary: function() {
+						exportBinary();
+					}
+				}
+
+				var gui = new dat.GUI();
+				var folder = gui.addFolder( 'Export' );
+
+				folder.add( params, 'ASCII' );
+				folder.add( params, 'Binary' );
+				folder.open();
+
+				//
+
+				window.addEventListener( 'resize', onWindowResize, false );
+
+			}
+
+			function onWindowResize() {
+
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
+
+			}
+
+			function animate() {
+
+				requestAnimationFrame( animate );
+				renderer.render( scene, camera );
+
+			}
+
+			function exportASCII() {
+
+				var result = exporter.parse( mesh );
+				saveString( result, 'box.stl' );
+
+			}
+
+			function exportBinary() {
+
+				var result = exporter.parse( mesh, { binary: true } );
+				saveArrayBuffer( result, 'box.stl' );
+
+			}
+
+			var link = document.createElement( 'a' );
+			link.style.display = 'none';
+			document.body.appendChild( link );
+
+			function save( blob, filename ) {
+
+				link.href = URL.createObjectURL( blob );
+				link.download = filename;
+				link.click();
+
+			}
+
+			function saveString( text, filename ) {
+
+				save( new Blob( [ text ], { type: 'text/plain' } ), filename );
+
+			}
+
+			function saveArrayBuffer( buffer, filename ) {
+
+				save( new Blob( [ buffer ], { type: 'application/octet-stream' } ), filename );
+
+			}
+
+		</script>
+
+	</body>
+</html>

File diff suppressed because it is too large
+ 0 - 0
examples/nodes/caustic.json


File diff suppressed because it is too large
+ 0 - 0
examples/nodes/displace.json


File diff suppressed because it is too large
+ 0 - 0
examples/nodes/wave.json


File diff suppressed because it is too large
+ 0 - 0
examples/nodes/xray.json


+ 0 - 1
examples/webgl_buffergeometry_instancing_lambert.html

@@ -144,7 +144,6 @@
 				#include <envmap_pars_vertex>
 				#include <envmap_pars_vertex>
 				#include <bsdfs>
 				#include <bsdfs>
 				#include <lights_pars_begin>
 				#include <lights_pars_begin>
-				#include <lights_pars_maps>
 				#include <color_pars_vertex>
 				#include <color_pars_vertex>
 				#include <fog_pars_vertex>
 				#include <fog_pars_vertex>
 				#include <morphtarget_pars_vertex>
 				#include <morphtarget_pars_vertex>

+ 2 - 2
examples/webgl_geometry_colors_blender.html → examples/webgl_geometry_colors_json.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - io blender - vertex colors</title>
+		<title>three.js webgl - json - vertex colors</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
@@ -32,7 +32,7 @@
 	<body>
 	<body>
 
 
 		<div id="container"></div>
 		<div id="container"></div>
-		<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - io blender - vertex colors</div>
+		<div id="info"><a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> webgl - json - vertex colors</div>
 
 
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 
 

+ 3 - 3
examples/webgl_geometry_nurbs.html

@@ -68,7 +68,7 @@
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
 				scene.background = new THREE.Color( 0xf0f0f0 );
 				scene.background = new THREE.Color( 0xf0f0f0 );
-				
+
 				scene.add( new THREE.AmbientLight( 0x808080 ) );
 				scene.add( new THREE.AmbientLight( 0x808080 ) );
 
 
 				var light = new THREE.DirectionalLight( 0xffffff, 1 );
 				var light = new THREE.DirectionalLight( 0xffffff, 1 );
@@ -159,9 +159,9 @@
 				map.wrapS = map.wrapT = THREE.RepeatWrapping;
 				map.wrapS = map.wrapT = THREE.RepeatWrapping;
 				map.anisotropy = 16;
 				map.anisotropy = 16;
 
 
-				function getSurfacePoint( u, v ) {
+				function getSurfacePoint( u, v, target ) {
 
 
-					return nurbsSurface.getPoint( u, v );
+					return nurbsSurface.getPoint( u, v, target );
 
 
 				}
 				}
 
 

+ 29 - 23
examples/webgl_interactive_voxelpainter.html

@@ -6,17 +6,35 @@
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
 			body {
 			body {
-				font-family: Monospace;
-				background-color: #f0f0f0;
-				margin: 0px;
-				overflow: hidden;
+				background:#777;
+				padding:0;
+				margin:0;
+				font-weight: bold;
+				overflow:hidden;
 			}
 			}
 
 
-			#oldie { background-color: #ddd !important }
+			#info {
+				position: absolute;
+				top: 0px;
+				width: 100%;
+				padding: 5px;
+				font-family:Monospace;
+				font-size:13px;
+				text-align:center;
+			}
+
+			a {
+				color: #ff0000;
+			}
 		</style>
 		</style>
 	</head>
 	</head>
 	<body>
 	<body>
 
 
+		<div id="info">
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - voxel painter - webgl<br>
+			<strong>click</strong>: add voxel, <strong>shift + click</strong>: remove voxel
+		</div>
+
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 
 
 		<script src="js/Detector.js"></script>
 		<script src="js/Detector.js"></script>
@@ -25,7 +43,6 @@
 
 
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			var container;
 			var camera, scene, renderer;
 			var camera, scene, renderer;
 			var plane, cube;
 			var plane, cube;
 			var mouse, raycaster, isShiftDown = false;
 			var mouse, raycaster, isShiftDown = false;
@@ -40,17 +57,6 @@
 
 
 			function init() {
 			function init() {
 
 
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
-				var info = document.createElement( 'div' );
-				info.style.position = 'absolute';
-				info.style.top = '10px';
-				info.style.width = '100%';
-				info.style.textAlign = 'center';
-				info.innerHTML = '<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - voxel painter - webgl<br><strong>click</strong>: add voxel, <strong>shift + click</strong>: remove voxel';
-				container.appendChild( info );
-
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 10000 );
 				camera.position.set( 500, 800, 1300 );
 				camera.position.set( 500, 800, 1300 );
 				camera.lookAt( new THREE.Vector3() );
 				camera.lookAt( new THREE.Vector3() );
@@ -60,15 +66,15 @@
 
 
 				// roll-over helpers
 				// roll-over helpers
 
 
-				var rollOverGeo = new THREE.BoxGeometry( 50, 50, 50 );
+				var rollOverGeo = new THREE.BoxBufferGeometry( 50, 50, 50 );
 				rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
 				rollOverMaterial = new THREE.MeshBasicMaterial( { color: 0xff0000, opacity: 0.5, transparent: true } );
 				rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial );
 				rollOverMesh = new THREE.Mesh( rollOverGeo, rollOverMaterial );
 				scene.add( rollOverMesh );
 				scene.add( rollOverMesh );
 
 
 				// cubes
 				// cubes
 
 
-				cubeGeo = new THREE.BoxGeometry( 50, 50, 50 );
-				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0xfeb74c, map: new THREE.TextureLoader().load( "textures/square-outline-textured.png" ) } );
+				cubeGeo = new THREE.BoxBufferGeometry( 50, 50, 50 );
+				cubeMaterial = new THREE.MeshLambertMaterial( { color: 0xfeb74c, map: new THREE.TextureLoader().load( 'textures/square-outline-textured.png' ) } );
 
 
 				// grid
 				// grid
 
 
@@ -88,7 +94,7 @@
 
 
 				objects.push( plane );
 				objects.push( plane );
 
 
-				// Lights
+				// lights
 
 
 				var ambientLight = new THREE.AmbientLight( 0x606060 );
 				var ambientLight = new THREE.AmbientLight( 0x606060 );
 				scene.add( ambientLight );
 				scene.add( ambientLight );
@@ -100,7 +106,7 @@
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer = new THREE.WebGLRenderer( { antialias: true } );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setPixelRatio( window.devicePixelRatio );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
+				document.body.appendChild( renderer.domElement );
 
 
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.addEventListener( 'mousemove', onDocumentMouseMove, false );
 				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
 				document.addEventListener( 'mousedown', onDocumentMouseDown, false );
@@ -163,7 +169,7 @@
 
 
 					if ( isShiftDown ) {
 					if ( isShiftDown ) {
 
 
-						if ( intersect.object != plane ) {
+						if ( intersect.object !== plane ) {
 
 
 							scene.remove( intersect.object );
 							scene.remove( intersect.object );
 
 

+ 1 - 1
examples/webgl_loader_json_blender.html → examples/webgl_loader_json.html

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

+ 12 - 8
examples/webgl_loader_mmd.html

@@ -82,14 +82,14 @@
 				scene.background = new THREE.Color( 0xffffff );
 				scene.background = new THREE.Color( 0xffffff );
 
 
 				var gridHelper = new THREE.PolarGridHelper( 30, 10 );
 				var gridHelper = new THREE.PolarGridHelper( 30, 10 );
-				gridHelper.position.y = -10;
+				gridHelper.position.y = - 10;
 				scene.add( gridHelper );
 				scene.add( gridHelper );
 
 
 				var ambient = new THREE.AmbientLight( 0x666666 );
 				var ambient = new THREE.AmbientLight( 0x666666 );
 				scene.add( ambient );
 				scene.add( ambient );
 
 
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
-				directionalLight.position.set( -1, 1, 1 ).normalize();
+				directionalLight.position.set( - 1, 1, 1 ).normalize();
 				scene.add( directionalLight );
 				scene.add( directionalLight );
 
 
 				//
 				//
@@ -108,14 +108,18 @@
 
 
 				// model
 				// model
 
 
-				var onProgress = function ( xhr ) {
+				function onProgress( xhr ) {
+
 					if ( xhr.lengthComputable ) {
 					if ( xhr.lengthComputable ) {
+
 						var percentComplete = xhr.loaded / xhr.total * 100;
 						var percentComplete = xhr.loaded / xhr.total * 100;
-						console.log( Math.round(percentComplete, 2) + '% downloaded' );
+						console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
+
 					}
 					}
+
 				};
 				};
 
 
-				var onError = function ( xhr ) {
+				function onError( xhr ) {
 				};
 				};
 
 
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';
@@ -130,7 +134,7 @@
 				loader.loadWithAnimation( modelFile, vmdFiles, function ( mmd ) {
 				loader.loadWithAnimation( modelFile, vmdFiles, function ( mmd ) {
 
 
 					mesh = mmd.mesh;
 					mesh = mmd.mesh;
-					mesh.position.y = -10;
+					mesh.position.y = - 10;
 					scene.add( mesh );
 					scene.add( mesh );
 
 
 					helper.add( mesh, {
 					helper.add( mesh, {
@@ -157,7 +161,7 @@
 				var phongMaterials;
 				var phongMaterials;
 				var originalMaterials;
 				var originalMaterials;
 
 
-				function makePhongMaterials ( materials ) {
+				function makePhongMaterials( materials ) {
 
 
 					var array = [];
 					var array = [];
 
 
@@ -175,7 +179,7 @@
 
 
 				}
 				}
 
 
-				function initGui () {
+				function initGui() {
 
 
 					var api = {
 					var api = {
 						'animation': true,
 						'animation': true,

+ 8 - 4
examples/webgl_loader_mmd_audio.html

@@ -87,7 +87,7 @@
 				scene.add( ambient );
 				scene.add( ambient );
 
 
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
-				directionalLight.position.set( -1, 1, 1 ).normalize();
+				directionalLight.position.set( - 1, 1, 1 ).normalize();
 				scene.add( directionalLight );
 				scene.add( directionalLight );
 
 
 				//
 				//
@@ -101,14 +101,18 @@
 
 
 				// model
 				// model
 
 
-				var onProgress = function ( xhr ) {
+				function onProgress( xhr ) {
+
 					if ( xhr.lengthComputable ) {
 					if ( xhr.lengthComputable ) {
+
 						var percentComplete = xhr.loaded / xhr.total * 100;
 						var percentComplete = xhr.loaded / xhr.total * 100;
-						console.log( Math.round(percentComplete, 2) + '% downloaded' );
+						console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
+
 					}
 					}
+
 				};
 				};
 
 
-				var onError = function ( xhr ) {
+				function onError( xhr ) {
 				};
 				};
 
 
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';

+ 23 - 18
examples/webgl_loader_mmd_pose.html

@@ -80,7 +80,7 @@
 				scene.add( ambient );
 				scene.add( ambient );
 
 
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
 				var directionalLight = new THREE.DirectionalLight( 0x887766 );
-				directionalLight.position.set( -1, 1, 1 ).normalize();
+				directionalLight.position.set( - 1, 1, 1 ).normalize();
 				scene.add( directionalLight );
 				scene.add( directionalLight );
 
 
 				//
 				//
@@ -94,14 +94,18 @@
 
 
 				// model
 				// model
 
 
-				var onProgress = function ( xhr ) {
+				function onProgress( xhr ) {
+
 					if ( xhr.lengthComputable ) {
 					if ( xhr.lengthComputable ) {
+
 						var percentComplete = xhr.loaded / xhr.total * 100;
 						var percentComplete = xhr.loaded / xhr.total * 100;
-						console.log( Math.round(percentComplete, 2) + '% downloaded' );
+						console.log( Math.round( percentComplete, 2 ) + '% downloaded' );
+
 					}
 					}
+
 				};
 				};
 
 
-				var onError = function ( xhr ) {
+				function onError( xhr ) {
 				};
 				};
 
 
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';
 				var modelFile = 'models/mmd/miku/miku_v2.pmd';
@@ -126,13 +130,13 @@
 				loader.load( modelFile, function ( object ) {
 				loader.load( modelFile, function ( object ) {
 
 
 					mesh = object;
 					mesh = object;
-					mesh.position.y = -10;
+					mesh.position.y = - 10;
 
 
 					scene.add( mesh );
 					scene.add( mesh );
 
 
 					var vpdIndex = 0;
 					var vpdIndex = 0;
 
 
-					function loadVpd () {
+					function loadVpd() {
 
 
 						var vpdFile = vpdFiles[ vpdIndex ];
 						var vpdFile = vpdFiles[ vpdIndex ];
 
 
@@ -140,7 +144,7 @@
 
 
 							vpds.push( vpd );
 							vpds.push( vpd );
 
 
-							vpdIndex++;
+							vpdIndex ++;
 
 
 							if ( vpdIndex < vpdFiles.length ) {
 							if ( vpdIndex < vpdFiles.length ) {
 
 
@@ -155,6 +159,7 @@
 						}, onProgress, onError );
 						}, onProgress, onError );
 
 
 					}
 					}
+
 					loadVpd();
 					loadVpd();
 
 
 				}, onProgress, onError );
 				}, onProgress, onError );
@@ -163,7 +168,7 @@
 
 
 				window.addEventListener( 'resize', onWindowResize, false );
 				window.addEventListener( 'resize', onWindowResize, false );
 
 
-				function initGui () {
+				function initGui() {
 
 
 					var gui = new dat.GUI();
 					var gui = new dat.GUI();
 
 
@@ -175,13 +180,13 @@
 					var poses = gui.addFolder( 'Poses' );
 					var poses = gui.addFolder( 'Poses' );
 					var morphs = gui.addFolder( 'Morphs' );
 					var morphs = gui.addFolder( 'Morphs' );
 
 
-					function getBaseName ( s ) {
+					function getBaseName( s ) {
 
 
 						return s.slice( s.lastIndexOf( '/' ) + 1 );
 						return s.slice( s.lastIndexOf( '/' ) + 1 );
 
 
 					}
 					}
 
 
-					function initControls () {
+					function initControls() {
 
 
 						for ( var key in dictionary ) {
 						for ( var key in dictionary ) {
 
 
@@ -189,7 +194,7 @@
 
 
 						}
 						}
 
 
-						controls.pose = -1;
+						controls.pose = - 1;
 
 
 						for ( var i = 0; i < vpdFiles.length; i++ ) {
 						for ( var i = 0; i < vpdFiles.length; i++ ) {
 
 
@@ -199,7 +204,7 @@
 
 
 					}
 					}
 
 
-					function initKeys () {
+					function initKeys() {
 
 
 						for ( var key in dictionary ) {
 						for ( var key in dictionary ) {
 
 
@@ -209,9 +214,9 @@
 
 
 					}
 					}
 
 
-					function initPoses () {
+					function initPoses() {
 
 
-						var files = { default: -1 };
+						var files = { default: - 1 };
 
 
 						for ( var i = 0; i < vpdFiles.length; i++ ) {
 						for ( var i = 0; i < vpdFiles.length; i++ ) {
 
 
@@ -223,7 +228,7 @@
 
 
 					}
 					}
 
 
-					function initMorphs () {
+					function initMorphs() {
 
 
 						for ( var key in dictionary ) {
 						for ( var key in dictionary ) {
 
 
@@ -233,7 +238,7 @@
 
 
 					}
 					}
 
 
-					function onChangeMorph () {
+					function onChangeMorph() {
 
 
 						for ( var i = 0; i < keys.length; i++ ) {
 						for ( var i = 0; i < keys.length; i++ ) {
 
 
@@ -245,11 +250,11 @@
 
 
 					}
 					}
 
 
-					function onChangePose () {
+					function onChangePose() {
 
 
 						var index = parseInt( controls.pose );
 						var index = parseInt( controls.pose );
 
 
-						if ( index === -1 ) {
+						if ( index === - 1 ) {
 
 
 							mesh.pose();
 							mesh.pose();
 
 

+ 1 - 0
examples/webgl_loader_nodes.html

@@ -50,6 +50,7 @@
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/AttributeNode.js"></script>
 		<script src="js/nodes/AttributeNode.js"></script>
+		<script src="js/nodes/NodeUniform.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>

+ 45 - 139
examples/webgl_loader_texture_hdr.html

@@ -31,142 +31,75 @@
 	</head>
 	</head>
 	<body>
 	<body>
 
 
-		<div id="container"></div>
 		<div id="info">
 		<div id="info">
-			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - webgl HDR texture loader example -
-			based on <a href="http://spidergl.org/example.php?id=13" target="_blank" rel="noopener">SpiderGL</a>
+			<a href="http://threejs.org" target="_blank" rel="noopener">three.js</a> - webgl HDR (RGBE) texture loader example
 		</div>
 		</div>
 
 
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 		<script src="js/loaders/RGBELoader.js"></script>
 		<script src="js/loaders/RGBELoader.js"></script>
 
 
-		<script src="js/Detector.js"></script>
-		<script src="js/libs/stats.min.js"></script>
-
-		<!-- HDR fragment shader -->
-
-		<script id="fs-hdr" type="x-shader/x-fragment">
-
-			uniform sampler2D   tDiffuse;
-			uniform float       exposure;
-			uniform float       brightMax;
-
-			varying vec2  vUv;
-
-			vec3 decode_pnghdr( const in vec4 color ) {
-
-				vec4 rgbcolor = vec4( 0.0, 0.0, 0.0, 0.0 );
-
-				if ( color.w > 0.0 ) {
-					float f = pow(2.0, 127.0*(color.w-0.5));
-					rgbcolor.xyz = color.xyz * f;
-				}
-				return rgbcolor.xyz;
+		<script src="js/libs/dat.gui.min.js"></script>
 
 
-				/*
-				// remove gamma correction
-				vec4 res = color * color;
-
-				// decoded RI
-				float ri = pow( 2.0, res.w * 32.0 - 16.0 );
-
-				// decoded HDR pixel
-				res.xyz = res.xyz * ri;
-				return res.xyz;
-				*/
-			}
-
-			void main()	{
-
-				vec4 color = texture2D( tDiffuse, vUv );
-				color.xyz  = decode_pnghdr( color );
-
-				// apply gamma correction and exposure
-				//gl_FragColor = vec4( pow( exposure * color.xyz, vec3( 0.474 ) ), 1.0 );
+		<script src="js/Detector.js"></script>
 
 
-				// Perform tone-mapping
-				float Y = dot(vec4(0.30, 0.59, 0.11, 0.0), color);
-				float YD = exposure * (exposure/brightMax + 1.0) / (exposure + 1.0);
-				color *= YD;
+		<script>
 
 
-				gl_FragColor = vec4( color.xyz, 1.0 );
+			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
 
 
-			}
+			var params = {
+				exposure: 1.0
+			};
 
 
-		</script>
+			var renderer, scene, camera;
 
 
-		<!-- HDR vertex shader -->
+			init();
 
 
-		<script id="vs-hdr" type="x-shader/x-vertex">
+			function init() {
 
 
-			varying vec2 vUv;
+				renderer = new THREE.WebGLRenderer();
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				document.body.appendChild( renderer.domElement );
 
 
-			void main()	{
+				renderer.toneMapping = THREE.ReinhardToneMapping;
+				renderer.toneMappingExposure = params.exposure;
 
 
-				vUv  = uv;
-				gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+				renderer.gammaOutput = true;
 
 
-			}
+				scene = new THREE.Scene();
 
 
-		</script>
+				var aspect = window.innerWidth / window.innerHeight;
 
 
+				camera = new THREE.OrthographicCamera( - aspect, aspect, 1, - 1, 0, 1 );
 
 
-		<script>
+				new THREE.RGBELoader().load( 'textures/miranda_uncropped.hdr', function( texture, textureData ) {
 
 
-			if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
+					//console.log( textureData );
+					//console.log( texture );
 
 
-			var container, stats;
+					texture.encoding = THREE.RGBEEncoding;
+					texture.minFilter = THREE.NearestFilter;
+					texture.magFilter = THREE.NearestFilter;
+					texture.flipY = true;
 
 
-			var camera, scene, renderer;
-			var materialHDR, quad, gamma, exposure;
+					var material = new THREE.MeshBasicMaterial( { map: texture } );
 
 
-			var sign = 1, rate = 1;
+					var quad = new THREE.PlaneBufferGeometry( textureData.width / textureData.height, 1 );
 
 
-			var clock = new THREE.Clock();
+					var mesh = new THREE.Mesh( quad, material );
 
 
-			init();
+					scene.add( mesh );
 
 
-			function init() {
+					render();
 
 
-				container = document.getElementById( 'container' );
-
-				camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 10000 );
-				camera.position.z = 900;
-
-				scene = new THREE.Scene();
-
-				var loader = new THREE.RGBELoader();
-
-				var texture = loader.load( "textures/miranda_uncropped.hdr", function( texture, textureData ){
-					console.log( textureData.header ); // header string
-					console.log( [textureData.width, textureData.height] ); // dimensions
-					materialHDR = new THREE.ShaderMaterial( {
-
-						uniforms: {
-							tDiffuse:  { value: texture },
-							exposure:  { value: textureData.exposure },
-							brightMax: { value: textureData.gamma }
-							},
-						vertexShader: getText( 'vs-hdr' ),
-						fragmentShader: getText( 'fs-hdr' )
-
-					} );
-					quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( textureData.width, textureData.height ), materialHDR );
-					quad.position.z = -100;
-					scene.add( quad );
-					animate();
 				} );
 				} );
-				texture.minFilter = THREE.LinearFilter;
-				texture.magFilter = THREE.NearestFilter;
 
 
+				//
 
 
-				renderer = new THREE.WebGLRenderer();
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
+				var gui = new dat.GUI();
 
 
-				stats = new Stats();
-				container.appendChild( stats.dom );
+				gui.add( params, 'exposure', 0, 2 ).onChange( render );
+				gui.open();
 
 
 				//
 				//
 
 
@@ -174,55 +107,28 @@
 
 
 			}
 			}
 
 
+			function onWindowResize() {
 
 
+				var aspect = window.innerWidth / window.innerHeight;
 
 
-			function onWindowResize() {
+				var frustumHeight = camera.top - camera.bottom;
+
+				camera.left = - frustumHeight * aspect / 2;
+				camera.right = frustumHeight * aspect / 2;
 
 
-				camera.aspect = window.innerWidth / window.innerHeight;
 				camera.updateProjectionMatrix();
 				camera.updateProjectionMatrix();
 
 
 				renderer.setSize( window.innerWidth, window.innerHeight );
 				renderer.setSize( window.innerWidth, window.innerHeight );
 
 
-			}
-
-			function getText( id ) {
-
-				return document.getElementById( id ).textContent;
+				render();
 
 
 			}
 			}
 
 
 			//
 			//
 
 
-			function animate() {
-
-				requestAnimationFrame( animate );
-
-				render();
-				stats.update();
-
-			}
-
 			function render() {
 			function render() {
 
 
-				var delta = clock.getDelta() * 5;
-
-				if ( materialHDR.uniforms.exposure.value > 0 || materialHDR.uniforms.exposure.value < 1 ) {
-
-					rate = 0.25;
-
-				} else {
-
-					rate = 1;
-
-				}
-
-				if ( materialHDR.uniforms.exposure.value > 5 || materialHDR.uniforms.exposure.value <= 0 ) {
-
-					sign *= -1;
-
-				}
-
-				materialHDR.uniforms.exposure.value += sign * rate * delta;
+				renderer.toneMappingExposure = params.exposure;
 
 
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 

+ 16 - 18
examples/webgl_loader_x.html

@@ -23,22 +23,22 @@
         a {
         a {
             color: #ff0000
             color: #ff0000
         }
         }
-        
-        #info2 { 
-            color: #fff; 
-            background-color: #000; 
-            position: absolute; 
-            top: 3em; 
-            right : 0px; 
-            width: 10em; 
-            z-index: 200; 
-            display: block;  
+
+        #info2 {
+            color: #fff;
+            background-color: #000;
+            position: absolute;
+            top: 3em;
+            right : 0px;
+            width: 10em;
+            z-index: 200;
+            display: block;
         }
         }
-    
-        td { 
+
+        td {
             padding: 0.5em;
             padding: 0.5em;
         }
         }
-        
+
     </style>
     </style>
 </head>
 </head>
 <body>
 <body>
@@ -71,7 +71,7 @@
 	<script src='js/Detector.js'></script>
 	<script src='js/Detector.js'></script>
 	<script src='js/libs/stats.min.js'></script>
 	<script src='js/libs/stats.min.js'></script>
 	<script src='js/libs/dat.gui.min.js'></script>
 	<script src='js/libs/dat.gui.min.js'></script>
-    
+
     <script>
     <script>
 
 
         if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
         if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
@@ -81,7 +81,6 @@
         var clock = new THREE.Clock();
         var clock = new THREE.Clock();
         var mixers = [];
         var mixers = [];
         var manager = null;
         var manager = null;
-        var Texloader = null;
 
 
         var skeletonHelper = null;
         var skeletonHelper = null;
         var animates = [];
         var animates = [];
@@ -156,8 +155,7 @@
 
 
             };
             };
 
 
-            Texloader = new THREE.TextureLoader();
-            var loader = new THREE.XLoader( manager, Texloader );
+            var loader = new THREE.XLoader( manager );
 
 
             actions[ 0 ] = {};
             actions[ 0 ] = {};
 
 
@@ -244,7 +242,7 @@
 
 
             } else {
             } else {
 
 
-                var loader2 = new THREE.XLoader( manager, Texloader );
+                var loader2 = new THREE.XLoader( manager );
                 loader2.load( [ 'models/xfile/' + animeName + '.x', { putPos: false, putScl: false } ], function () {
                 loader2.load( [ 'models/xfile/' + animeName + '.x', { putPos: false, putScl: false } ], function () {
 
 
                     // !! important!
                     // !! important!

+ 102 - 101
examples/webgl_materials_nodes.html

@@ -50,6 +50,7 @@
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/AttributeNode.js"></script>
 		<script src="js/nodes/AttributeNode.js"></script>
+		<script src="js/nodes/NodeUniform.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
@@ -432,33 +433,33 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'roughnessA', roughnessA.number, function ( val ) {
+					addGui( 'roughnessA', roughnessA.value, function ( val ) {
 
 
-						roughnessA.number = val;
+						roughnessA.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'metalnessA', metalnessA.number, function ( val ) {
+					addGui( 'metalnessA', metalnessA.value, function ( val ) {
 
 
-						metalnessA.number = val;
+						metalnessA.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'roughnessB', roughnessB.number, function ( val ) {
+					addGui( 'roughnessB', roughnessB.value, function ( val ) {
 
 
-						roughnessB.number = val;
+						roughnessB.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'metalnessB', metalnessB.number, function ( val ) {
+					addGui( 'metalnessB', metalnessB.value, function ( val ) {
 
 
-						metalnessB.number = val;
+						metalnessB.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'normalScale', normalScale.number, function ( val ) {
+					addGui( 'normalScale', normalScale.value, function ( val ) {
 
 
-						normalScale.number = val;
+						normalScale.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -539,51 +540,51 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'reflectivity', reflectivity.number, function ( val ) {
+					addGui( 'reflectivity', reflectivity.value, function ( val ) {
 
 
-						reflectivity.number = val;
+						reflectivity.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'clearCoat', clearCoat.number, function ( val ) {
+					addGui( 'clearCoat', clearCoat.value, function ( val ) {
 
 
-						clearCoat.number = val;
+						clearCoat.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'clearCoatRoughness', clearCoatRoughness.number, function ( val ) {
+					addGui( 'clearCoatRoughness', clearCoatRoughness.value, function ( val ) {
 
 
-						clearCoatRoughness.number = val;
+						clearCoatRoughness.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'roughnessA', roughnessA.number, function ( val ) {
+					addGui( 'roughnessA', roughnessA.value, function ( val ) {
 
 
-						roughnessA.number = val;
+						roughnessA.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'metalnessA', metalnessA.number, function ( val ) {
+					addGui( 'metalnessA', metalnessA.value, function ( val ) {
 
 
-						metalnessA.number = val;
+						metalnessA.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'roughnessB', roughnessB.number, function ( val ) {
+					addGui( 'roughnessB', roughnessB.value, function ( val ) {
 
 
-						roughnessB.number = val;
+						roughnessB.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'metalnessB', metalnessB.number, function ( val ) {
+					addGui( 'metalnessB', metalnessB.value, function ( val ) {
 
 
-						metalnessB.number = val;
+						metalnessB.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'normalScale', normalScale.number, function ( val ) {
+					addGui( 'normalScale', normalScale.value, function ( val ) {
 
 
-						normalScale.number = val;
+						normalScale.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -663,21 +664,21 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'speed', speed.number, function ( val ) {
+					addGui( 'speed', speed.value, function ( val ) {
 
 
-						speed.number = val;
+						speed.value = val;
 
 
 					}, false, 0, 10 );
 					}, false, 0, 10 );
 
 
-					addGui( 'scale', scale.number, function ( val ) {
+					addGui( 'scale', scale.value, function ( val ) {
 
 
-						scale.number = val;
+						scale.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
-					addGui( 'worldScale', worldScale.number, function ( val ) {
+					addGui( 'worldScale', worldScale.value, function ( val ) {
 
 
-						worldScale.number = val;
+						worldScale.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -753,14 +754,14 @@
 						intensity = val;
 						intensity = val;
 
 
 						viewZ.b.z = - intensity;
 						viewZ.b.z = - intensity;
-						rim.b.number = intensity;
+						rim.b.value = intensity;
 
 
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
-					addGui( 'power', power.number, function ( val ) {
+					addGui( 'power', power.value, function ( val ) {
 
 
-						power.number = val;
+						power.value = val;
 
 
 					}, false, 0, 6 );
 					}, false, 0, 6 );
 
 
@@ -812,33 +813,33 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'hue', hue.number, function ( val ) {
+					addGui( 'hue', hue.value, function ( val ) {
 
 
-						hue.number = val;
+						hue.value = val;
 
 
 					}, false, 0, Math.PI * 2 );
 					}, false, 0, Math.PI * 2 );
 
 
-					addGui( 'saturation', sataturation.number, function ( val ) {
+					addGui( 'saturation', sataturation.value, function ( val ) {
 
 
-						sataturation.number = val;
+						sataturation.value = val;
 
 
 					}, false, 0, 2 );
 					}, false, 0, 2 );
 
 
-					addGui( 'vibrance', vibrance.number, function ( val ) {
+					addGui( 'vibrance', vibrance.value, function ( val ) {
 
 
-						vibrance.number = val;
+						vibrance.value = val;
 
 
 					}, false, - 1, 1 );
 					}, false, - 1, 1 );
 
 
-					addGui( 'brightness', brightness.number, function ( val ) {
+					addGui( 'brightness', brightness.value, function ( val ) {
 
 
-						brightness.number = val;
+						brightness.value = val;
 
 
 					}, false, 0, .5 );
 					}, false, 0, .5 );
 
 
-					addGui( 'contrast', contrast.number, function ( val ) {
+					addGui( 'contrast', contrast.value, function ( val ) {
 
 
-						contrast.number = val;
+						contrast.value = val;
 
 
 					}, false, 0, 2 );
 					}, false, 0, 2 );
 
 
@@ -1026,15 +1027,15 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'reflectance', reflectance.number, function ( val ) {
+					addGui( 'reflectance', reflectance.value, function ( val ) {
 
 
-						reflectance.number = val;
+						reflectance.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
-					addGui( 'power', power.number, function ( val ) {
+					addGui( 'power', power.value, function ( val ) {
 
 
-						power.number = val;
+						power.value = val;
 
 
 					}, false, 0, 5 );
 					}, false, 0, 5 );
 
 
@@ -1079,15 +1080,15 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'offset', offset.number, function ( val ) {
+					addGui( 'offset', offset.value, function ( val ) {
 
 
-						offset.number = val;
+						offset.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'scale', scale.number, function ( val ) {
+					addGui( 'scale', scale.value, function ( val ) {
 
 
-						scale.number = val;
+						scale.value = val;
 
 
 					}, false, 0, 10 );
 					}, false, 0, 10 );
 
 
@@ -1123,9 +1124,9 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'saturation', sat.number, function ( val ) {
+					addGui( 'saturation', sat.value, function ( val ) {
 
 
-						sat.number = val;
+						sat.value = val;
 
 
 					}, false, 0, 2 );
 					}, false, 0, 2 );
 
 
@@ -1166,15 +1167,15 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'hard', hard.number, function ( val ) {
+					addGui( 'hard', hard.value, function ( val ) {
 
 
-						hard.number = val;
+						hard.value = val;
 
 
 					}, false, 0, 20 );
 					}, false, 0, 20 );
 
 
-					addGui( 'offset', offset.number, function ( val ) {
+					addGui( 'offset', offset.value, function ( val ) {
 
 
-						offset.number = val;
+						offset.value = val;
 
 
 					}, false, - 10, 10 );
 					}, false, - 10, 10 );
 
 
@@ -1244,15 +1245,15 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'speed', speed.number, function ( val ) {
+					addGui( 'speed', speed.value, function ( val ) {
 
 
-						speed.number = val;
+						speed.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'scale', scale.number, function ( val ) {
+					addGui( 'scale', scale.value, function ( val ) {
 
 
-						scale.number = val;
+						scale.value = val;
 
 
 					}, false, 0, 10 );
 					}, false, 0, 10 );
 
 
@@ -1333,8 +1334,8 @@
 					var colorB = new THREE.ColorNode( 0x0054df );
 					var colorB = new THREE.ColorNode( 0x0054df );
 
 
 					var depth = new THREE.CameraNode( THREE.CameraNode.DEPTH );
 					var depth = new THREE.CameraNode( THREE.CameraNode.DEPTH );
-					depth.near.number = 1;
-					depth.far.number = 200;
+					depth.near.value = 1;
+					depth.far.value = 200;
 
 
 					var colors = new THREE.Math3Node(
 					var colors = new THREE.Math3Node(
 						colorB,
 						colorB,
@@ -1348,15 +1349,15 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'near', depth.near.number, function ( val ) {
+					addGui( 'near', depth.near.value, function ( val ) {
 
 
-						depth.near.number = val;
+						depth.near.value = val;
 
 
 					}, false, 1, 1200 );
 					}, false, 1, 1200 );
 
 
-					addGui( 'far', depth.far.number, function ( val ) {
+					addGui( 'far', depth.far.value, function ( val ) {
 
 
-						depth.far.number = val;
+						depth.far.value = val;
 
 
 					}, false, 1, 1200 );
 					}, false, 1, 1200 );
 
 
@@ -1502,27 +1503,27 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'timeScale', timeScale.number, function ( val ) {
+					addGui( 'timeScale', timeScale.value, function ( val ) {
 
 
-						timeScale.number = val;
+						timeScale.value = val;
 
 
 					}, false, 0, 5 );
 					}, false, 0, 5 );
 
 
-					addGui( 'intensity', intensity.number, function ( val ) {
+					addGui( 'intensity', intensity.value, function ( val ) {
 
 
-						intensity.number = val;
+						intensity.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
-					addGui( 'scale', scale.number, function ( val ) {
+					addGui( 'scale', scale.value, function ( val ) {
 
 
-						scale.number = val;
+						scale.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'alpha', alpha.number, function ( val ) {
+					addGui( 'alpha', alpha.value, function ( val ) {
 
 
-						alpha.number = val;
+						alpha.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -1611,9 +1612,9 @@
 
 
 					}, false, 0, .95 );
 					}, false, 0, .95 );
 
 
-					addGui( 'scale', scale.number, function ( val ) {
+					addGui( 'scale', scale.value, function ( val ) {
 
 
-						scale.number = val;
+						scale.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
@@ -1678,15 +1679,15 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'mildness', mildness.number, function ( val ) {
+					addGui( 'mildness', mildness.value, function ( val ) {
 
 
-						mildness.number = val;
+						mildness.value = val;
 
 
 					}, false, 1, 2 );
 					}, false, 1, 2 );
 
 
-					addGui( 'fur', fur.number, function ( val ) {
+					addGui( 'fur', fur.value, function ( val ) {
 
 
-						fur.number = val;
+						fur.value = val;
 
 
 					}, false, 0, 2 );
 					}, false, 0, 2 );
 
 
@@ -1774,15 +1775,15 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'wrapLight', wrapLight.number, function ( val ) {
+					addGui( 'wrapLight', wrapLight.value, function ( val ) {
 
 
-						wrapLight.number = val;
+						wrapLight.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
-					addGui( 'wrapShadow', wrapShadow.number, function ( val ) {
+					addGui( 'wrapShadow', wrapShadow.value, function ( val ) {
 
 
-						wrapShadow.number = val;
+						wrapShadow.value = val;
 
 
 					}, false, - 1, 0 );
 					}, false, - 1, 0 );
 
 
@@ -1877,21 +1878,21 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'count', count.number, function ( val ) {
+					addGui( 'count', count.value, function ( val ) {
 
 
-						count.number = val;
+						count.value = val;
 
 
 					}, false, 1, 8 );
 					}, false, 1, 8 );
 
 
-					addGui( 'lineSize', lineSize.number, function ( val ) {
+					addGui( 'lineSize', lineSize.value, function ( val ) {
 
 
-						lineSize.number = val;
+						lineSize.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
-					addGui( 'lineInner', lineInner.number, function ( val ) {
+					addGui( 'lineInner', lineInner.value, function ( val ) {
 
 
-						lineInner.number = val;
+						lineInner.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -1947,9 +1948,9 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'speed', speed.number, function ( val ) {
+					addGui( 'speed', speed.value, function ( val ) {
 
 
-						speed.number = val;
+						speed.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -2081,9 +2082,9 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'alpha', alpha.number, function ( val ) {
+					addGui( 'alpha', alpha.value, function ( val ) {
 
 
-						alpha.number = val;
+						alpha.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 
@@ -2139,9 +2140,9 @@
 
 
 					// GUI
 					// GUI
 
 
-					addGui( 'speed', speed.number, function ( val ) {
+					addGui( 'speed', speed.value, function ( val ) {
 
 
-						speed.number = val;
+						speed.value = val;
 
 
 					}, false, 0, 3 );
 					}, false, 0, 3 );
 
 
@@ -2292,9 +2293,9 @@
 
 
 					}, true );
 					}, true );
 
 
-					addGui( 'area', sss.b.number, function ( val ) {
+					addGui( 'area', sss.b.value, function ( val ) {
 
 
-						sss.b.number = val;
+						sss.b.value = val;
 
 
 					}, false, 0, 1 );
 					}, false, 0, 1 );
 
 

+ 1 - 0
examples/webgl_mirror_nodes.html

@@ -48,6 +48,7 @@
 		<script src="js/nodes/ConstNode.js"></script>
 		<script src="js/nodes/ConstNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
+		<script src="js/nodes/NodeUniform.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>

+ 44 - 88
examples/webgl_modifier_simplifier.html

@@ -7,10 +7,13 @@
 		<style>
 		<style>
 			body {
 			body {
 				font-family: Monospace;
 				font-family: Monospace;
-				background-color: #f0f0f0;
+				color: #fff;
 				margin: 0px;
 				margin: 0px;
 				overflow: hidden;
 				overflow: hidden;
 			}
 			}
+			a {
+				color: #ffffff;
+			}
 		</style>
 		</style>
 	</head>
 	</head>
 	<body>
 	<body>
@@ -18,127 +21,80 @@
 		<script src="../build/three.js"></script>
 		<script src="../build/three.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/controls/OrbitControls.js"></script>
 		<script src="js/modifiers/SimplifyModifier.js"></script>
 		<script src="js/modifiers/SimplifyModifier.js"></script>
-		<script src="js/libs/stats.min.js"></script>
 
 
 		<script>
 		<script>
 
 
-			var container, stats;
-
-			var camera, controls, scene, renderer;
-
-			var boxGeometry = new THREE.BoxGeometry( 80, 80, 80, 4, 4, 4 );
-			var torusGeometry = new THREE.TorusGeometry( 50, 25, 8, 8, Math.PI * 2 );
-			var sphereGeometry = new THREE.SphereGeometry( 50, 15, 15 );
-			var planeGeometry = new THREE.PlaneGeometry( 100, 100, 6, 6 );
-
-			var modifer = new THREE.SimplifyModifier();
-			var meshes = [];
-			var count = 0;
-
-			var wireframeMaterial = new THREE.MeshBasicMaterial( { color: 0x000000, wireframe: true, transparent: true } );
+			var renderer, scene, camera;
 
 
 			init();
 			init();
-			animate();
-
-
-			function addStuff( geometry ) {
-
-				count ++;
-
-				var mesh, wireframe;
-
-				var material = new THREE.MeshBasicMaterial( { color: Math.random() * 0xffffff } );
-
-				var simplified = modifer.modify( geometry, geometry.vertices.length * 0.5 | 0 );
-
-				mesh = new THREE.Mesh( simplified, material );
-				wireframe = new THREE.Mesh( simplified, wireframeMaterial );
-				mesh.add( wireframe );
-				mesh.position.x = - 200;
-				mesh.position.y = count * 150 - 300;
-
-				scene.add( mesh );
-				meshes.push( mesh );
-
-				mesh = new THREE.Mesh( geometry, material );
-				wireframe = new THREE.Mesh( geometry, wireframeMaterial );
-				mesh.add( wireframe );
-				mesh.position.x = 200;
-				mesh.position.y = count * 150 - 300;
-
-				scene.add( mesh );
-				meshes.push ( mesh );
-
-			}
 
 
 			function init() {
 			function init() {
 
 
-				container = document.createElement( 'div' );
-				document.body.appendChild( container );
-
 				var info = document.createElement( 'div' );
 				var info = document.createElement( 'div' );
 				info.style.position = 'absolute';
 				info.style.position = 'absolute';
 				info.style.top = '10px';
 				info.style.top = '10px';
 				info.style.width = '100%';
 				info.style.width = '100%';
 				info.style.textAlign = 'center';
 				info.style.textAlign = 'center';
-				info.innerHTML = '50% Vertex Reduction using SimplifyModifier';
-				container.appendChild( info );
+				info.innerHTML = '<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - Vertex Reduction using SimplifyModifier';
+				document.body.appendChild( info );
 
 
-				camera = new THREE.PerspectiveCamera( 70, window.innerWidth / window.innerHeight, 1, 1000 );
-				camera.position.z = 500;
+				renderer = new THREE.WebGLRenderer( { antialias: true } );
+				renderer.setPixelRatio( window.devicePixelRatio );
+				renderer.setSize( window.innerWidth, window.innerHeight );
+				document.body.appendChild( renderer.domElement );
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0xf0f0f0 );
 
 
-				var light = new THREE.PointLight( 0xffffff, 1.5 );
-				light.position.set( 1000, 1000, 2000 );
-				scene.add( light );
+				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 1, 1000 );
+				camera.position.z = 15;
 
 
-				addStuff( planeGeometry );
-				addStuff( boxGeometry );
-				addStuff( sphereGeometry );
-				addStuff( torusGeometry );
+				var controls = new THREE.OrbitControls( camera, renderer.domElement );
+				controls.addEventListener( 'change', render ); // use if there is no animation loop
+				controls.enablePan = false;
+				controls.enableZoom = false;
 
 
-				renderer = new THREE.WebGLRenderer( { antialias: true } );
-				renderer.setPixelRatio( window.devicePixelRatio );
-				renderer.setSize( window.innerWidth, window.innerHeight );
-				container.appendChild( renderer.domElement );
+				scene.add( new THREE.AmbientLight( 0xffffff, 0.2 ) );
 
 
-				stats = new Stats();
-				container.appendChild( stats.dom );
+				var light = new THREE.PointLight( 0xffffff, 0.7 );
+				camera.add( light );
+				scene.add( camera );
 
 
-				//
+				new THREE.JSONLoader().load( "models/json/leeperrysmith/LeePerrySmith.json", function ( geometry ) {
 
 
-				controls = new THREE.OrbitControls( camera, renderer.domElement );
+					var material = new THREE.MeshPhongMaterial( { color: 0xAEAED5, shininess: 1 } );
 
 
-				window.addEventListener( 'resize', onWindowResize, false );
+					var mesh = new THREE.Mesh( geometry, material );
+					mesh.position.x = - 3;
+					mesh.rotation.y = Math.PI / 2;
+					scene.add( mesh );
 
 
-			}
+					var modifer = new THREE.SimplifyModifier();
 
 
-			function onWindowResize() {
+					var simplified = modifer.modify( geometry, Math.floor( geometry.vertices.length * 0.9375 ) ); // number of vertices to remove
 
 
-				camera.aspect = window.innerWidth / window.innerHeight;
-				camera.updateProjectionMatrix();
+					var material = new THREE.MeshPhongMaterial( { color: 0xAEAED5, shininess: 1, flatShading: true } );
 
 
-				renderer.setSize( window.innerWidth, window.innerHeight );
+					var mesh = new THREE.Mesh( simplified, material );
+					mesh.position.x = 3;
+					mesh.rotation.y = - Math.PI / 2;
+					scene.add( mesh );
 
 
-			}
+					render();
 
 
-			//
+				} );
 
 
-			function animate() {
+				window.addEventListener( 'resize', onWindowResize, false );
 
 
-				meshes.forEach( function( m ) {
-					m.rotation.x += 0.01;
-					m.rotation.y += 0.01;
-					m.rotation.z += 0.01;
-				} );
+			}
+
+			function onWindowResize() {
+
+				renderer.setSize( window.innerWidth, window.innerHeight );
 
 
-				requestAnimationFrame( animate );
+				camera.aspect = window.innerWidth / window.innerHeight;
+				camera.updateProjectionMatrix();
 
 
-				stats.begin();
 				render();
 				render();
-				stats.end();
 
 
 			}
 			}
 
 

+ 27 - 6
examples/webgl_morphtargets_sphere.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <!DOCTYPE html>
 <html lang="en">
 <html lang="en">
 	<head>
 	<head>
-		<title>three.js webgl - morph targets - horse</title>
+		<title>three.js webgl - morph targets - sphere</title>
 		<meta charset="utf-8">
 		<meta charset="utf-8">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
 		<style>
 		<style>
@@ -63,15 +63,13 @@
 				camera.position.set( 0, 5, 5 );
 				camera.position.set( 0, 5, 5 );
 
 
 				scene = new THREE.Scene();
 				scene = new THREE.Scene();
-				scene.background = new THREE.Color( 0x222222 );
-				scene.fog = new THREE.Fog( 0x000000, 1, 15000 );
 
 
 				var light = new THREE.PointLight( 0xff2200, 0.7 );
 				var light = new THREE.PointLight( 0xff2200, 0.7 );
 				light.position.set( 100, 100, 100 );
 				light.position.set( 100, 100, 100 );
 				scene.add( light );
 				scene.add( light );
 
 
 				light = new THREE.PointLight( 0x22ff00, 0.7 );
 				light = new THREE.PointLight( 0x22ff00, 0.7 );
-				light.position.set( -100, -100, -100 );
+				light.position.set( - 100, - 100, - 100 );
 				scene.add( light );
 				scene.add( light );
 
 
 				light = new THREE.AmbientLight( 0x111111 );
 				light = new THREE.AmbientLight( 0x111111 );
@@ -90,9 +88,30 @@
 
 
 					mesh.rotation.z = Math.PI / 2;
 					mesh.rotation.z = Math.PI / 2;
 
 
+					//mesh.material.visible = false;
+
 					scene.add( mesh );
 					scene.add( mesh );
 
 
-				});
+					//
+
+					var pointsMaterial = new THREE.PointsMaterial( {
+
+						size: 10,
+						sizeAttenuation: false,
+						map: new THREE.TextureLoader().load( 'textures/sprites/disc.png' ),
+						alphaTest: 0.5,
+						morphTargets: true
+
+					} );
+
+					points = new THREE.Points( mesh.geometry, pointsMaterial );
+
+					points.morphTargetInfluences = mesh.morphTargetInfluences;
+					points.morphTargetDictionary = mesh.morphTargetDictionary;
+
+					mesh.add( points );
+
+				} );
 
 
 				//
 				//
 
 
@@ -104,6 +123,8 @@
 				//
 				//
 
 
 				controls = new THREE.OrbitControls( camera, renderer.domElement );
 				controls = new THREE.OrbitControls( camera, renderer.domElement );
+				controls.minDistance = 1;
+				controls.maxDistance = 20;
 
 
 				//
 				//
 
 
@@ -137,7 +158,7 @@
 
 
 					if ( mesh.morphTargetInfluences[ 1 ] <= 0 || mesh.morphTargetInfluences[ 1 ] >= 1 ) {
 					if ( mesh.morphTargetInfluences[ 1 ] <= 0 || mesh.morphTargetInfluences[ 1 ] >= 1 ) {
 
 
-						sign *= -1;
+						sign *= - 1;
 
 
 					}
 					}
 
 

+ 71 - 13
examples/webgl_postprocessing_dof2.html

@@ -96,9 +96,16 @@ Use WEBGL Depth buffer support?
 				renderer.autoClear = false;
 				renderer.autoClear = false;
 				container.appendChild( renderer.domElement );
 				container.appendChild( renderer.domElement );
 
 
-				materialDepth = new THREE.MeshDepthMaterial();
-				materialDepth.depthPacking = THREE.RGBADepthPacking;
-				materialDepth.blending = THREE.NoBlending;
+				var depthShader = THREE.BokehDepthShader;
+
+				materialDepth = new THREE.ShaderMaterial( {
+					uniforms: depthShader.uniforms,
+					vertexShader: depthShader.vertexShader,
+					fragmentShader: depthShader.fragmentShader
+				} );
+
+				materialDepth.uniforms[ 'mNear' ].value = camera.near;
+				materialDepth.uniforms[ 'mFar' ].value = camera.far;
 
 
 				// skybox
 				// skybox
 
 
@@ -110,7 +117,21 @@ Use WEBGL Depth buffer support?
 				var textureCube = new THREE.CubeTextureLoader().load( urls );
 				var textureCube = new THREE.CubeTextureLoader().load( urls );
 				textureCube.format = THREE.RGBFormat;
 				textureCube.format = THREE.RGBFormat;
 
 
-				scene.background = textureCube;
+				var shader = THREE.ShaderLib[ 'cube' ];
+				shader.uniforms[ 'tCube' ].value = textureCube;
+
+				material = new THREE.ShaderMaterial( {
+
+					fragmentShader: shader.fragmentShader,
+					vertexShader: shader.vertexShader,
+					uniforms: shader.uniforms,
+					depthWrite: false,
+					side: THREE.BackSide
+
+				} );
+
+				mesh = new THREE.Mesh( new THREE.BoxBufferGeometry( 1000, 1000, 1000 ), material );
+				scene.add( mesh );
 
 
 				// plane particles
 				// plane particles
 
 
@@ -226,11 +247,13 @@ Use WEBGL Depth buffer support?
 					jsDepthCalculation: true,
 					jsDepthCalculation: true,
 					shaderFocus: false,
 					shaderFocus: false,
 
 
-					fstop: 10,
+					fstop: 2.2,
 					maxblur: 1.0,
 					maxblur: 1.0,
 
 
+					showFocus: false,
 					focalDepth: 2.8,
 					focalDepth: 2.8,
 					manualdof: false,
 					manualdof: false,
+					vignetting: false,
 					depthblur: false,
 					depthblur: false,
 
 
 					threshold: 0.5,
 					threshold: 0.5,
@@ -272,10 +295,13 @@ Use WEBGL Depth buffer support?
 				gui.add( effectController, 'shaderFocus' ).onChange( matChanger );
 				gui.add( effectController, 'shaderFocus' ).onChange( matChanger );
 				gui.add( effectController, 'focalDepth', 0.0, 200.0 ).listen().onChange( matChanger );
 				gui.add( effectController, 'focalDepth', 0.0, 200.0 ).listen().onChange( matChanger );
 
 
-				gui.add( effectController, 'fstop', 1, 50, 0.1 ).onChange( matChanger );
+				gui.add( effectController, 'fstop', 0.1, 22, 0.001 ).onChange( matChanger );
 				gui.add( effectController, 'maxblur', 0.0, 5.0, 0.025 ).onChange( matChanger );
 				gui.add( effectController, 'maxblur', 0.0, 5.0, 0.025 ).onChange( matChanger );
 
 
+				gui.add( effectController, 'showFocus' ).onChange( matChanger );
 				gui.add( effectController, 'manualdof' ).onChange( matChanger );
 				gui.add( effectController, 'manualdof' ).onChange( matChanger );
+				gui.add( effectController, 'vignetting' ).onChange( matChanger );
+
 				gui.add( effectController, 'depthblur' ).onChange( matChanger );
 				gui.add( effectController, 'depthblur' ).onChange( matChanger );
 
 
 				gui.add( effectController, 'threshold', 0, 1, 0.001 ).onChange( matChanger );
 				gui.add( effectController, 'threshold', 0, 1, 0.001 ).onChange( matChanger );
@@ -284,8 +310,11 @@ Use WEBGL Depth buffer support?
 				gui.add( effectController, 'fringe', 0, 5, 0.001 ).onChange( matChanger );
 				gui.add( effectController, 'fringe', 0, 5, 0.001 ).onChange( matChanger );
 
 
 				gui.add( effectController, 'focalLength', 16, 80, 0.001 ).onChange( matChanger );
 				gui.add( effectController, 'focalLength', 16, 80, 0.001 ).onChange( matChanger );
+
 				gui.add( effectController, 'noise' ).onChange( matChanger );
 				gui.add( effectController, 'noise' ).onChange( matChanger );
+
 				gui.add( effectController, 'dithering', 0, 0.001, 0.0001 ).onChange( matChanger );
 				gui.add( effectController, 'dithering', 0, 0.001, 0.0001 ).onChange( matChanger );
+
 				gui.add( effectController, 'pentagon' ).onChange( matChanger );
 				gui.add( effectController, 'pentagon' ).onChange( matChanger );
 
 
 				gui.add( shaderSettings, 'rings', 1, 8).step(1).onChange( shaderUpdate );
 				gui.add( shaderSettings, 'rings', 1, 8).step(1).onChange( shaderUpdate );
@@ -369,9 +398,7 @@ Use WEBGL Depth buffer support?
 					fragmentShader: bokeh_shader.fragmentShader,
 					fragmentShader: bokeh_shader.fragmentShader,
 					defines: {
 					defines: {
 						RINGS: shaderSettings.rings,
 						RINGS: shaderSettings.rings,
-						SAMPLES: shaderSettings.samples,
-						DEPTH_PACKING: 1, // RGBADepth
-						PERSPECTIVE_CAMERA: 1
+						SAMPLES: shaderSettings.samples
 					}
 					}
 
 
 				} );
 				} );
@@ -399,6 +426,28 @@ Use WEBGL Depth buffer support?
 
 
 			}
 			}
 
 
+			function linearize( depth ) {
+
+				var zfar = camera.far;
+				var znear = camera.near;
+				return - zfar * znear / ( depth * ( zfar - znear ) - zfar );
+
+			}
+
+
+			function smoothstep( near, far, depth ) {
+
+				var x = saturate( ( depth - near ) / ( far - near ) );
+				return x * x * ( 3 - 2 * x );
+
+			}
+
+			function saturate( x ) {
+
+				return Math.max( 0, Math.min( 1, x ) );
+
+			}
+
 			function render() {
 			function render() {
 
 
 				var time = Date.now() * 0.00015;
 				var time = Date.now() * 0.00015;
@@ -417,13 +466,22 @@ Use WEBGL Depth buffer support?
 
 
 					var intersects = raycaster.intersectObjects( scene.children, true );
 					var intersects = raycaster.intersectObjects( scene.children, true );
 
 
-					var targetDistance = ( intersects.length > 0 ) ? intersects[ 0 ].distance : 1000;
 
 
-					distance += ( targetDistance - distance ) * 0.05;
+					if ( intersects.length > 0 ) {
+
+						var targetDistance = intersects[ 0 ].distance;
+
+						distance += (targetDistance - distance) * 0.03;
+
+						var sdistance = smoothstep(camera.near, camera.far, distance);
 
 
-					postprocessing.bokeh_uniforms[ 'focalDepth' ].value = distance;
+						var ldistance = linearize(1 -  sdistance);
 
 
-					effectController[ 'focalDepth' ] = distance;
+						postprocessing.bokeh_uniforms[ 'focalDepth' ].value = ldistance;
+
+						effectController['focalDepth'] = ldistance;
+
+					}
 
 
 				}
 				}
 
 

+ 23 - 22
examples/webgl_postprocessing_nodes.html

@@ -49,6 +49,7 @@
 		<script src="js/nodes/ConstNode.js"></script>
 		<script src="js/nodes/ConstNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
 		<script src="js/nodes/FunctionCallNode.js"></script>
+		<script src="js/nodes/NodeUniform.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeBuilder.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeLib.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
 		<script src="js/nodes/NodeFrame.js"></script>
@@ -201,33 +202,33 @@
 
 
 						// GUI
 						// GUI
 
 
-						addGui( 'hue', hue.number, function ( val ) {
+						addGui( 'hue', hue.value, function ( val ) {
 
 
-							hue.number = val;
+							hue.value = val;
 
 
 						}, false, 0, Math.PI * 2 );
 						}, false, 0, Math.PI * 2 );
 
 
-						addGui( 'saturation', sataturation.number, function ( val ) {
+						addGui( 'saturation', sataturation.value, function ( val ) {
 
 
-							sataturation.number = val;
+							sataturation.value = val;
 
 
 						}, false, 0, 2 );
 						}, false, 0, 2 );
 
 
-						addGui( 'vibrance', vibrance.number, function ( val ) {
+						addGui( 'vibrance', vibrance.value, function ( val ) {
 
 
-							vibrance.number = val;
+							vibrance.value = val;
 
 
 						}, false, - 1, 1 );
 						}, false, - 1, 1 );
 
 
-						addGui( 'brightness', brightness.number, function ( val ) {
+						addGui( 'brightness', brightness.value, function ( val ) {
 
 
-							brightness.number = val;
+							brightness.value = val;
 
 
 						}, false, 0, .5 );
 						}, false, 0, .5 );
 
 
-						addGui( 'contrast', contrast.number, function ( val ) {
+						addGui( 'contrast', contrast.value, function ( val ) {
 
 
-							contrast.number = val;
+							contrast.value = val;
 
 
 						}, false, 0, 2 );
 						}, false, 0, 2 );
 
 
@@ -257,9 +258,9 @@
 
 
 						}, true );
 						}, true );
 
 
-						addGui( 'fade', percent.number, function ( val ) {
+						addGui( 'fade', percent.value, function ( val ) {
 
 
-							percent.number = val;
+							percent.value = val;
 
 
 						}, false, 0, 1 );
 						}, false, 0, 1 );
 
 
@@ -285,9 +286,9 @@
 
 
 						// GUI
 						// GUI
 
 
-						addGui( 'alpha', alpha.number, function ( val ) {
+						addGui( 'alpha', alpha.value, function ( val ) {
 
 
-							alpha.number = val;
+							alpha.value = val;
 
 
 						}, false, 0, 1 );
 						}, false, 0, 1 );
 
 
@@ -345,9 +346,9 @@
 
 
 						// GUI
 						// GUI
 
 
-						addGui( 'saturation', sat.number, function ( val ) {
+						addGui( 'saturation', sat.value, function ( val ) {
 
 
-							sat.number = val;
+							sat.value = val;
 
 
 						}, false, 0, 2 );
 						}, false, 0, 2 );
 
 
@@ -398,9 +399,9 @@
 
 
 						// GUI
 						// GUI
 
 
-						addGui( 'scale', scale.number, function ( val ) {
+						addGui( 'scale', scale.value, function ( val ) {
 
 
-							scale.number = val;
+							scale.value = val;
 
 
 						}, false, 0, 1 );
 						}, false, 0, 1 );
 
 
@@ -450,15 +451,15 @@
 
 
 						// GUI
 						// GUI
 
 
-						addGui( 'scale', scale.number, function ( val ) {
+						addGui( 'scale', scale.value, function ( val ) {
 
 
-							scale.number = val;
+							scale.value = val;
 
 
 						}, false, 16, 1024 );
 						}, false, 16, 1024 );
 
 
-						addGui( 'fade', fade.number, function ( val ) {
+						addGui( 'fade', fade.value, function ( val ) {
 
 
-							fade.number = val;
+							fade.value = val;
 
 
 						}, false, 0, 1 );
 						}, false, 0, 1 );
 
 

+ 0 - 1
examples/webgl_shaders_tonemapping.html

@@ -161,7 +161,6 @@
 						THREE.ShaderChunk[ "common" ],
 						THREE.ShaderChunk[ "common" ],
 						THREE.ShaderChunk[ "bsdfs" ],
 						THREE.ShaderChunk[ "bsdfs" ],
 						THREE.ShaderChunk[ "lights_pars_begin" ],
 						THREE.ShaderChunk[ "lights_pars_begin" ],
-						THREE.ShaderChunk[ "lights_pars_maps" ],
 						THREE.ShaderChunk[ "lights_phong_pars_fragment" ],
 						THREE.ShaderChunk[ "lights_phong_pars_fragment" ],
 
 
 						"void main() {",
 						"void main() {",

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