Mr.doob 9 years ago
parent
commit
fed23b536d
100 changed files with 2345 additions and 1995 deletions
  1. 202 178
      build/three.js
  2. 98 101
      build/three.min.js
  3. 19 0
      docs/api/cameras/OrthographicCamera.html
  4. 7 2
      docs/api/cameras/PerspectiveCamera.html
  5. 29 2
      docs/api/core/Object3D.html
  6. 4 4
      docs/api/extras/SceneUtils.html
  7. 9 9
      docs/api/extras/core/CurvePath.html
  8. 2 2
      docs/api/extras/core/Path.html
  9. 7 7
      docs/api/extras/core/Shape.html
  10. 3 3
      docs/api/extras/geometries/ConeBufferGeometry.html
  11. 3 3
      docs/api/extras/geometries/ConeGeometry.html
  12. 7 3
      docs/api/extras/helpers/BoxHelper.html
  13. 0 5
      docs/api/loaders/Loader.html
  14. 1 1
      docs/api/loaders/OBJLoader.html
  15. 2 2
      docs/api/materials/LineDashedMaterial.html
  16. 2 2
      docs/api/materials/Material.html
  17. 2 2
      docs/api/materials/MeshDepthMaterial.html
  18. 1 1
      docs/api/materials/MeshLambertMaterial.html
  19. 2 2
      docs/api/materials/MeshNormalMaterial.html
  20. 2 2
      docs/api/materials/MeshPhongMaterial.html
  21. 1 1
      docs/api/materials/MeshStandardMaterial.html
  22. 2 2
      docs/api/materials/MultiMaterial.html
  23. 4 7
      docs/api/objects/Bone.html
  24. 3 5
      docs/api/objects/LOD.html
  25. 5 7
      docs/api/objects/LensFlare.html
  26. 5 7
      docs/api/objects/Line.html
  27. 4 6
      docs/api/objects/LineSegments.html
  28. 5 7
      docs/api/objects/Mesh.html
  29. 0 181
      docs/api/objects/MorphAnimMesh.html
  30. 4 11
      docs/api/objects/Points.html
  31. 2 1
      docs/api/objects/Skeleton.html
  32. 6 8
      docs/api/objects/SkinnedMesh.html
  33. 6 12
      docs/api/objects/Sprite.html
  34. 0 5
      docs/api/renderers/WebGLRenderer.html
  35. 2 2
      docs/api/renderers/webgl/plugins/LensFlarePlugin.html
  36. 2 2
      docs/api/renderers/webgl/plugins/SpritePlugin.html
  37. 2 2
      docs/api/scenes/FogExp2.html
  38. 2 2
      docs/api/textures/CompressedTexture.html
  39. 2 2
      docs/api/textures/Texture.html
  40. 3 4
      docs/list.js
  41. 16 8
      editor/index.html
  42. 19 0
      editor/js/Loader.js
  43. 1 1
      editor/js/Menubar.Edit.js
  44. 1 1
      editor/js/Sidebar.Scene.js
  45. 3 3
      editor/js/Toolbar.js
  46. 2 3
      editor/js/Viewport.js
  47. 2 26
      editor/js/libs/tern-threejs/threejs.js
  48. 0 2
      editor/js/libs/ui.js
  49. 30 8
      editor/js/libs/ui.three.js
  50. 4 1
      examples/files.js
  51. 370 0
      examples/js/GPUComputationRenderer.js
  52. 383 387
      examples/js/GPUParticleSystem.js
  53. 4 3
      examples/js/Mirror.js
  54. 20 20
      examples/js/Ocean.js
  55. 0 13
      examples/js/ShaderGodRays.js
  56. 28 28
      examples/js/ShaderSkin.js
  57. 20 20
      examples/js/ShaderTerrain.js
  58. 25 25
      examples/js/ShaderToon.js
  59. 0 233
      examples/js/SimulationRenderer.js
  60. 10 7
      examples/js/SkyShader.js
  61. 41 0
      examples/js/ViveController.js
  62. 11 11
      examples/js/WaterShader.js
  63. 10 2
      examples/js/WebVR.js
  64. 17 3
      examples/js/controls/TransformControls.js
  65. 6 0
      examples/js/controls/VRControls.js
  66. 1 7
      examples/js/crossfade/transition.js
  67. 4 4
      examples/js/effects/AnaglyphEffect.js
  68. 2 2
      examples/js/effects/ParallaxBarrierEffect.js
  69. 10 8
      examples/js/effects/VREffect.js
  70. 0 15
      examples/js/loaders/BinaryLoader.js
  71. 2 2
      examples/js/loaders/FBXLoader.js
  72. 297 0
      examples/js/loaders/GLTFLoader.js
  73. 23 44
      examples/js/loaders/MMDLoader.js
  74. 251 231
      examples/js/loaders/PLYLoader.js
  75. 0 19
      examples/js/loaders/ctm/CTMLoader.js
  76. 144 144
      examples/js/loaders/gltf/glTFLoader.js
  77. 1 0
      examples/js/nodes/materials/PhongNode.js
  78. 1 0
      examples/js/nodes/materials/StandardNode.js
  79. 4 4
      examples/js/pmrem/PMREMCubeUVPacker.js
  80. 5 5
      examples/js/pmrem/PMREMGenerator.js
  81. 4 4
      examples/js/postprocessing/AdaptiveToneMappingPass.js
  82. 8 4
      examples/js/postprocessing/EffectComposer.js
  83. 15 3
      examples/js/postprocessing/ManualMSAARenderPass.js
  84. 7 8
      examples/js/postprocessing/RenderPass.js
  85. 2 2
      examples/js/shaders/BleachBypassShader.js
  86. 4 4
      examples/js/shaders/BlendShader.js
  87. 6 6
      examples/js/shaders/BokehShader.js
  88. 23 23
      examples/js/shaders/BokehShader2.js
  89. 3 3
      examples/js/shaders/BrightnessContrastShader.js
  90. 4 4
      examples/js/shaders/ColorCorrectionShader.js
  91. 2 2
      examples/js/shaders/ColorifyShader.js
  92. 3 3
      examples/js/shaders/ConvolutionShader.js
  93. 2 2
      examples/js/shaders/CopyShader.js
  94. 4 4
      examples/js/shaders/DOFMipMapShader.js
  95. 11 11
      examples/js/shaders/DigitalGlitch.js
  96. 5 5
      examples/js/shaders/DotScreenShader.js
  97. 2 2
      examples/js/shaders/EdgeShader.js
  98. 2 2
      examples/js/shaders/EdgeShader2.js
  99. 2 2
      examples/js/shaders/FXAAShader.js
  100. 6 6
      examples/js/shaders/FilmShader.js

File diff suppressed because it is too large
+ 202 - 178
build/three.js


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


+ 19 - 0
docs/api/cameras/OrthographicCamera.html

@@ -74,6 +74,25 @@ scene.add( camera );</code>
 
 		<h2>Methods</h2>
 
+		<h3>[method:null setViewOffset]( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
+		<div>
+		fullWidth — full width of multiview setup<br />
+		fullHeight — full height of multiview setup<br />
+		x — horizontal offset of subcamera<br />
+		y — vertical offset of subcamera<br />
+		width — width of subcamera<br />
+		height — height of subcamera
+		</div>
+
+		<div>
+		Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups. For an example on how to use it see [page:PerspectiveCamera].
+		</div>
+
+		<h3>[method:null clearViewOffset]()</h3>
+		<div>
+		Removes any offset set by the .setViewOffset method.
+		</div>
+
 		<h3>[method:null updateProjectionMatrix]()</h3>
 		<div>
 		Updates the camera projection matrix. Must be called after change of parameters.

+ 7 - 2
docs/api/cameras/PerspectiveCamera.html

@@ -17,11 +17,11 @@
 
 		<h2>Example</h2>
 
-		<div>[example:canvas_effects_stereo effects / stereo ]</div>
 		<div>[example:canvas_geometry_birds geometry / birds ]</div>
 		<div>[example:canvas_geometry_cube geometry / cube ]</div>
 		<div>[example:webgl_animation_skinning_blending animation / skinning / blending ]</div>
 		<div>[example:webgl_animation_skinning_morph animation / skinning / blending ]</div>
+		<div>[example:webgl_effects_stereo effects / stereo ]</div>
 		<div>[example:webgl_interactive_cubes interactive / cubes ]</div>
 		<div>[example:webgl_loader_collada_skinning loader / collada / skinning ]</div>
 
@@ -88,7 +88,7 @@ scene.add( camera );</code>
 
 		<h3>[method:Float getFilmHeight]()</h3>
 		<div>
-		Returns the height of the image on the film. If .aspect is less than or equal to one (portrait format), the result equals .fimlGauge.
+		Returns the height of the image on the film. If .aspect is less than or equal to one (portrait format), the result equals .filmGauge.
 		</div>
 
 		<h3>[method:null setFocalLength]( [page:Float focalLength] )</h3>
@@ -157,6 +157,11 @@ camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
 		Note there is no reason monitors have to be the same size or in a grid.
 		</div>
 
+		<h3>[method:null clearViewOffset]()</h3>
+		<div>
+		Removes any offset set by the .setViewOffset method.
+		</div>
+
 		<h3>[method:null updateProjectionMatrix]()</h3>
 		<div>
 		Updates the camera projection matrix. Must be called after change of parameters.

+ 29 - 2
docs/api/core/Object3D.html

@@ -175,6 +175,30 @@
 		Translates object along z axis by distance.
 		</div>
 
+		<h3>[method:null rotateX]( [page:Float rad] )</h3>
+		<div>
+		rad - the angle to rotate in radians.<br />
+		</div>
+		<div>
+		Rotates the object around x axis in local space.
+		</div>
+
+		<h3>[method:null rotateY]( [page:Float rad] )</h3>
+		<div>
+		rad - the angle to rotate in radians.<br />
+		</div>
+		<div>
+		Rotates the object around y axis in local space.
+		</div>
+
+		<h3>[method:null rotateZ]( [page:Float rad] )</h3>
+		<div>
+		rad - the angle to rotate in radians.<br />
+		</div>
+		<div>
+		Rotates the object around z axis in local space.
+		</div>
+
 		<h3>[method:Vector3 localToWorld]( [page:Vector3 vector] )</h3>
 		<div>
 		vector - A local vector.<br />
@@ -250,9 +274,12 @@
 		Updates global transform of the object and its children.
 		</div>
 
-		<h3>[method:Object3D clone]()</h3>
+		<h3>[method:Object3D clone]( [page:Boolean recursive] )</h3>
+		<div>
+		recursive -- if true, descendants of the object are also cloned. Default is true.
+		</div>
 		<div>
-		Creates a new clone of this object and all descendants.
+		Returns a clone of this object and optionaly all descendants.
 		</div>
 
 

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

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -16,7 +16,7 @@
 		<h2>Methods</h2>
 
 
-		<h3>[method:Object3D createMultiMaterialObject]([page:Geometry geometry], [page:Array materials])</h3>
+		<h3>[method:Object3D createMultiMaterialObject]( [page:Geometry geometry], [page:Array materials] )</h3>
 		<div>
 		geometry -- The geometry for the Object. <br />
 		materials -- The materials for the object.
@@ -26,7 +26,7 @@
 		This is mostly useful for object that need a material and a wireframe implementation.
 		</div>
 
-		<h3>[method:null attach]([page:Object3D child], [page:Object3D scene], [page:Object3D parent])</h3>
+		<h3>[method:null attach]( [page:Object3D child], [page:Object3D scene], [page:Object3D parent] )</h3>
 		<div>
 		child -- The object to add to the parent  <br />
 		scene -- The scene to detach the object on. <br />
@@ -36,7 +36,7 @@
 		Attaches the object to the parent without the moving the object in the worldspace. Beware that to do this the matrixWorld needs to be updated, this can be done by calling the updateMatrixWorld method on the parent object.
 		</div>
 
-		<h3>[method:null detach]([page:Object3D child], [page:Object3D parent], [page:Object3D scene])</h3>
+		<h3>[method:null detach]( [page:Object3D child], [page:Object3D parent], [page:Object3D scene] )</h3>
 		<div>
 		child -- The object to remove from the parent  <br />
 		scene -- The scene to attach the object on. <br />

+ 9 - 9
docs/api/extras/core/CurvePath.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -48,7 +48,7 @@
 		<h2>Methods</h2>
 
 
-		<h3>[method:Array getWrapPoints]([page:Array vertices], [page:Curve curve])</h3>
+		<h3>[method:Array getWrapPoints]( [page:Array vertices], [page:Curve curve] )</h3>
 		<div>
 		vertices -- An array of [page:Vector2]s to modify<br />
 		curve -- An array of 2d [page:Curve]s
@@ -59,7 +59,7 @@
 		modification.
 		</div>
 
-		<h3>[method:null addWrapPath]([page:Curve curve])</h3>
+		<h3>[method:null addWrapPath]( [page:Curve curve] )</h3>
 		<div>
 		curve -- A [page:Curve] or object with a similar interface.
 		</div>
@@ -67,7 +67,7 @@
 		Pushes a curve onto the bends array.
 		</div>
 
-		<h3>[method:Geometry createGeometry]([page:Vector3 points])</h3>
+		<h3>[method:Geometry createGeometry]( [page:Vector3 points] )</h3>
 		<div>
 		points -- An array of [page:Vector3]s
 		</div>
@@ -75,7 +75,7 @@
 		Creates a geometry from points
 		</div>
 
-		<h3>[method:Geometry createPointsGeometry]([page:Integer divisions])</h3>
+		<h3>[method:Geometry createPointsGeometry]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- How many segments to create with [page:Vector3]s. Defaults to 12.
 		</div>
@@ -83,7 +83,7 @@
 		Creates a [page:Geometry] object comprised of [page:Vector3]s
 		</div>
 
-		<h3>[method:Geometry createSpacedPointsGeometry]([page:Integer divisions])</h3>
+		<h3>[method:Geometry createSpacedPointsGeometry]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- How many segments to create with [page:Vector3]s. Defaults to 12.
 		</div>
@@ -92,7 +92,7 @@
 		</div>
 
 
-		<h3>[method:null add]([page:Curve curve])</h3>
+		<h3>[method:null add]( [page:Curve curve] )</h3>
 		<div>
 		curve -- The [page:Curve curve] to add
 		</div>
@@ -115,7 +115,7 @@
 		Adds together the length of the curves
 		</div>
 
-		<h3>[method:Array getTransformedPoints]([page:Integer segments], [page:Array bends])</h3>
+		<h3>[method:Array getTransformedPoints]( [page:Integer segments], [page:Array bends] )</h3>
 		<div>
 		segments -- The number of segments to create using the getPoints()<br />
 		bends -- (optional) An array of [page:Curve]s used to transform the points. Defaults to this.bends if blank.
@@ -125,7 +125,7 @@
 		array of [page:Vector2]s.
 		</div>
 
-		<h3>[method:Array getTransformedSpacedPoints]([page:Integer segments], [page:Array bends])</h3>
+		<h3>[method:Array getTransformedSpacedPoints]( [page:Integer segments], [page:Array bends] )</h3>
 		<div>
 		segments -- The number of segments to create using the getPoints()<br />
 		bends -- (optional) Defaults to this.bends if blank. An array of [page:Curve]s used to transform the points.

+ 2 - 2
docs/api/extras/core/Path.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -21,7 +21,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Array points])</h3>
+		<h3>[name]( [page:Array points] )</h3>
 		<div>
 		points -- array of Vector2
 		</div>

+ 7 - 7
docs/api/extras/core/Shape.html

@@ -62,7 +62,7 @@
 		<h2>Methods</h2>
 
 
-		<h3>[method:ShapeGeometry makeGeometry]([page:Object options])</h3>
+		<h3>[method:ShapeGeometry makeGeometry]( [page:Object options] )</h3>
 		<div>
 		options -- This is passed as the second argument to [page:ShapeGeometry ShapeGeometry]
 		</div>
@@ -70,7 +70,7 @@
 		Convenience method to return ShapeGeometry
 		</div>
 
-		<h3>[method:Array extractAllPoints]([page:Integer divisions])</h3>
+		<h3>[method:Array extractAllPoints]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The number of divisions to create on the shape
 		</div>
@@ -78,7 +78,7 @@
 		Get points of shape and holes (keypoints based on segments parameter)
 		</div>
 
-		<h3>[method:ExtrudeGeometry extrude]([page:Object options])</h3>
+		<h3>[method:ExtrudeGeometry extrude]( [page:Object options] )</h3>
 		<div>
 		options -- This is passed as the second argument to [page:ExtrudeGeometry ExtrudeGeometry]
 		</div>
@@ -86,7 +86,7 @@
 		Convenience method to return ExtrudeGeometry
 		</div>
 
-		<h3>[method:Object extractPoints]([page:Integer divisions])</h3>
+		<h3>[method:Object extractPoints]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The number of divisions to create on the shape
 		</div>
@@ -94,7 +94,7 @@
 		Returns an object with a *shape* and *holes* property that each reference an array of [page:Vector2 Vector2s].
 		</div>
 
-		<h3>[method:Object extractAllSpacedPoints]([page:Integer divisions])</h3>
+		<h3>[method:Object extractAllSpacedPoints]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The number of divisions to create on the shape
 		</div>
@@ -103,7 +103,7 @@
 		points will all be equally spaced along the shape.
 		</div>
 
-		<h3>[method:Array getPointsHoles]([page:Integer divisions])</h3>
+		<h3>[method:Array getPointsHoles]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The number of divisions to create on the shape
 		</div>
@@ -111,7 +111,7 @@
 		Get an array of [page Vector2 Vector2s] that represent the holes in the shape.
 		</div>
 
-		<h3>[method:Array getSpacedPointsHoles]([page:Integer divisions])</h3>
+		<h3>[method:Array getSpacedPointsHoles]( [page:Integer divisions] )</h3>
 		<div>
 		divisions -- The number of divisions to create on the shape
 		</div>

+ 3 - 3
docs/api/extras/geometries/ConeBufferGeometry.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -29,13 +29,13 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
+		<h3>[name]([page:Float radius], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
 		radius — Radius of the cone base. Default is 20.<br />
 		height — Height of the cone. Default is 100.<br />
 		radiusSegments — Number of segmented faces around the circumference of the cone. Default is 8<br />
 		heightSegments — Number of rows of faces along the height of the cone. Default is 1.<br />
-		openEnded — A Boolean indicating whether the ends of the cone are open or capped. Default is false, meaning capped.<br />
+		openEnded — A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.<br />
 		thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
 		thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cone.
 		</div>

+ 3 - 3
docs/api/extras/geometries/ConeGeometry.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -29,13 +29,13 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
+		<h3>[name]([page:Float radius], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
 		<div>
 		radius — Radius of the cone at the base. Default is 20.<br />
 		height — Height of the cone. Default is 100.<br />
 		radiusSegments — Number of segmented faces around the circumference of the cone. Default is 8<br />
 		heightSegments — Number of rows of faces along the height of the cone. Default is 1.<br />
-		openEnded — A Boolean indicating whether the ends of the cone are open or capped. Default is false, meaning capped.<br />
+		openEnded — A Boolean indicating whether the base of the cone is open or capped. Default is false, meaning capped.<br />
 		thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
 		thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cone.
 		</div>

+ 7 - 3
docs/api/extras/helpers/BoxHelper.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -18,7 +18,7 @@
 		<h2>Example</h2>
 
 		<code>var sphere = new THREE.SphereGeometry();
-		var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial(0xff0000) );
+		var object = new THREE.Mesh( sphere, new THREE.MeshBasicMaterial( 0xff0000 ) );
 		var box = new THREE.BoxHelper( object );
 		scene.add( box );
 		</code>
@@ -26,7 +26,11 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]( [page:Object3D object] )</h3>
+		<h3>[name]( [page:Object3D object], [page:Color color] )</h3>
+		<div>
+		object -- Object3D -- the object3D to show the world-axis-aligned boundingbox.<br />
+		color -- The color of the helper. This can be a [page:Color], a hexadecimal value and an CSS-Color name. Default is 0xffff00
+		</div>
 		<div>Creates a new wireframe box matching the size of the passed box.</div>
 
 		<h2>Properties</h2>

+ 0 - 5
docs/api/loaders/Loader.html

@@ -69,11 +69,6 @@
 		Extract the base from the URL.
 		</div>
 
-		<h3>[method:DOMElement addStatusElement]()</h3>
-		<div>
-		Add a DOM element to indicate the progress and return the DOMElement
-		</div>
-
 
 		<h2>Source</h2>
 

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

@@ -46,7 +46,7 @@
 		</div>
 		<div>
 		Parse an <em>obj</em> text structure and return an [page:Object3D].<br />
-		Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshLambertMaterial].
+		Found objects are converted to [page:Mesh] with a [page:BufferGeometry] and a default [page:MeshPhongMaterial].
 		</div>
 
 		<h2>Example</h2>

+ 2 - 2
docs/api/materials/LineDashedMaterial.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -18,7 +18,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>parameters is an object with one or more properties defining the material's appearance.</div>
 		<div>
 		color — Line color in hexadecimal. Default is 0xffffff.<br />

+ 2 - 2
docs/api/materials/Material.html

@@ -150,7 +150,7 @@
 		
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 		
-		<h3>[method:Material clone]([page:material material])</h3>
+		<h3>[method:Material clone]( [page:material material] )</h3>
 		<div>
 		material -- this material gets the cloned information (optional). 
 		</div>
@@ -163,7 +163,7 @@
 		This disposes the material. Textures of a material don't get disposed. These needs to be disposed by [page:Texture Texture]. 
 		</div>
 
-		<h3>[method:null setValues]([page:object values])</h3>
+		<h3>[method:null setValues]( [page:object values] )</h3>
 		<div>
 		values -- a container with parameters.
 		</div>

+ 2 - 2
docs/api/materials/MeshDepthMaterial.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -19,7 +19,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		parameters is an object with one or more properties defining the material's appearance.
 		</div>

+ 1 - 1
docs/api/materials/MeshLambertMaterial.html

@@ -19,7 +19,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		parameters -- parameters is an object with one or more properties defining the material's appearance.
 		</div>

+ 2 - 2
docs/api/materials/MeshNormalMaterial.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -20,7 +20,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		parameters is an object with one or more properties defining the material's appearance.
 		</div>

+ 2 - 2
docs/api/materials/MeshPhongMaterial.html

@@ -19,7 +19,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		parameters -- an object with one or more of the material's properties defining the material's appearance.
 		</div>
@@ -36,7 +36,7 @@
 		emissiveMap — Set emissive map. Default is null.<br />
 		emissiveIntensity — Set emissive map intensity. Default is 1.<br />
 		bumpMap — Set bump map. Default is null.<br />
-		bumpMapScale — Set bump map scale. Default is 1.<br />
+		bumpScale — Set bump map scale. Default is 1.<br />
 		normalMap — Set normal map. Default is null.<br />
 		normalScale — Set normal map scale. Default is (1, 1).<br />
 		displacementMap — Set displacement map. Default is null.<br />

+ 1 - 1
docs/api/materials/MeshStandardMaterial.html

@@ -19,7 +19,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Object parameters])</h3>
+		<h3>[name]( [page:Object parameters] )</h3>
 		<div>
 		parameters -- an object with one or more of the material's properties defining the material's appearance.
 		</div>

+ 2 - 2
docs/api/materials/MultiMaterial.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -20,7 +20,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Array materials])</h3>
+		<h3>[name]( [page:Array materials] )</h3>
 		<div>
 		materials -- The materials for the geometry.
 		</div>

+ 4 - 7
docs/api/objects/Bone.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -30,7 +30,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:SkinnedMesh skin])</h3>
+		<h3>[name]( [page:SkinnedMesh skin] )</h3>
 		<div>
 		skin — (optional) The [page:SkinnedMesh] to which the bone belongs.
 		</div>
@@ -44,12 +44,9 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:Bone clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned Bone Object.
-		</div>
-		<div>
-		Clone a Bone Object.
+		Returns a clone of this Bone object and its descendants.
 		</div>
 
 		<h2>Source</h2>

+ 3 - 5
docs/api/objects/LOD.html

@@ -84,14 +84,12 @@
 		Update the visiblility of the level of detail based on the distance from the camera.
 		</div>
 		
-		<h3>[method:Object3D clone]( [page:Object3D object] )</h3>
+		<h3>[method:LOD clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned LOD Object.
-		</div>
-		<div>
-		Clone a LOD Object.
+		Returns a clone of this LOD object and its associated distance specific objects.
 		</div>
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 5 - 7
docs/api/objects/LensFlare.html

@@ -22,7 +22,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color])</h3>
+		<h3>[name]( [page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color] )</h3>
 		<div>
 		texture -- THREE.Texture (optional) <br />
 		size -- size in pixels (-1 = use texture.width) <br />
@@ -56,7 +56,7 @@
 		<h2>Methods</h2>
 
 
-		<h3>[method:null add]([page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color])</h3>
+		<h3>[method:null add]( [page:Texture texture], [page:Float size], [page:Float distance], [page:Materials blending], [page:Color color] )</h3>
 		<div>
 		Adds a lens flare. See the constructor for details on the parameters.
 		</div>
@@ -67,14 +67,12 @@
 		Updates the lens flare based on the [page:LensFlare.positionScreen positionScreen] property.
 		</div>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:Lens Flare clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned LensFlare Object.
-		</div>
-		<div>
-		Clone a LensFlare Object.
+		Returns a clone of this LensFlare object and its descendants.
 		</div>
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 5 - 7
docs/api/objects/Line.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -60,19 +60,17 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
+		<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
 		<div>
 		Get intersections between a casted ray and this Line. [page:Raycaster.intersectObject] will call this method.
 		</div>
 		
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:Line clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned Line Object.
-		</div>
-		<div>
-		Clone a Line Object.
+		Returns a clone of this Line object and its descendants.
 		</div>
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 4 - 6
docs/api/objects/LineSegments.html

@@ -42,20 +42,18 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
+		<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
 		<div>
 		Get intersections between a casted ray and this Line. [page:Raycaster.intersectObject] will call this method.
 		</div>
 		
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:LineSegments clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned LineSegments Object.
-		</div>
-		<div>
-		Clone a LineSegments Object.
+		Returns a clone of this LineSegments object and its descendants.
 		</div>
 
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 5 - 7
docs/api/objects/Mesh.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -86,20 +86,18 @@
 		[page:Mesh.morphTargetBase morphTargetBase] properties.
 		</div>
 
-		<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
+		<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
 		<div>
 		Get intersections between a casted ray and this mesh. [page:Raycaster.intersectObject] will call this method.
 		</div>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:Mesh clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned Mesh Object.
-		</div>
-		<div>
-		Clone a Mesh Object.
+		Returns a clone of this Mesh object and its descendants.
 		</div>
 
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 0 - 181
docs/api/objects/MorphAnimMesh.html

@@ -1,181 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-	<head>
-		<meta charset="utf-8" />
-		<base href="../../" />
-		<script src="list.js"></script>
-		<script src="page.js"></script>
-		<link type="text/css" rel="stylesheet" href="page.css" />
-	</head>
-	<body>
-		[page:Object3D] &rarr;
-
-		<h1>[name]</h1>
-
-		<div class="desc">Play a sequence of morphs in a smooth animation sequence.</div>
-
-		<h2>Examples</h2>
-		
-		<div>
-		[example:webgl_lights_hemisphere lights / hemisphere ]<br/>
-		[example:webgl_morphtargets_md2 morphtargets / md2 ]<br/>
-		[example:webgl_loader_json_blender loader / json / blender ]
-		</div>
-		
-		<code>
-		var meshAnim;
-		
-		loader.load( "models/animated/flamingo.js", function( geometry ) {
-			
-			meshAnim = new THREE.MorphAnimMesh( geometry, material );
-			meshAnim.duration = 1000;
-			scene.add( meshAnim );
-			
-		}
-		
-		function update() {
-
-			var delta = clock.getDelta();
-			meshAnim.updateAnimation( 1000 * delta );
-			
-		}
-		</code>
-
-
-		<h2>Constructor</h2>
-
-
-		<h3>[name]([page:Geometry geometry], [page:Material material])</h3>
-		<div>
-		geometry — An instance of [page:Geometry].<br />
-		material — An instance of [page:Material] (optional).
-		</div>
-
-
-		<h2>Properties</h2>
-
-
-		<h3>[property:Boolean directionBackwards]</h3>
-		<div>
-		Animation is playing backwards
-		</div>
-
-		<h3>[property:Float direction]</h3>
-		<div>
-		1 if playing forward, -1 if playing backwards
-		</div>
-
-		<h3>[property:Integer startKeyframe]</h3>
-		<div>
-		The first keyframe (morph) of the sequence
-		</div>
-
-		<h3>[property:Integer endKeyframe]</h3>
-		<div>
-		The last keyframe (morph) of the sequence
-		</div>
-		
-		<h3>[property:Boolean mirroredLoop]</h3>
-		<div>
-		Loop animation back and forth
-		</div>
-
-		<h3>[property:Integer lastKeyframe]</h3>
-		<div>
-		The index of the last keyframe played.
-		</div>
-		
-		<h3>[property:Integer currentKeyframe]</h3>
-		<div>
-		The index of the current frame being played.
-		</div>
-
-		<h3>[property:Integer length]</h3>
-		<div>
-		The number of frames (morphs)
-		</div>
-
-		<h3>[property:Float time]</h3>
-		<div>
-		The current playback position of the animation in milliseconds.
-		</div>
-
-		<h3>[property:Float duration]</h3>
-		<div>
-		The length of the animation in milliseconds.
-		</div>
-
-		<h2>Methods</h2>
-
-
-
-		<h3>[method:null setDirectionForward]()</h3>
-		<div>
-		Sets the animation to play forwards
-		</div>
-
-		<h3>[method:null setDirectionBackward]()</h3>
-		<div>
-		Set the animation to play backwards.
-		</div>
-
-		<h3>[method:null playAnimation]([page:String label], [page:Float fps])</h3>
-		<div>
-		label -- The label of the animation <br />
-		fps -- The frames per second (in seconds)
-		</div>
-		<div>
-		Starts playing a labeled animation. Animations are defined by calling [page:MorphAnimMesh.parseAnimations parseAnimations].
-		</div>
-
-		<h3>[method:null setFrameRange]([page:Integer start], [page:Integer end])</h3>
-		<div>
-		start -- The starting frame (morph) index <br />
-		end -- The ending frame (morph) index
-		</div>
-		<div>
-		Sets the range of morphs to be played
-		</div>
-
-		<h3>[method:null parseAnimations]()</h3>
-		<div>
-		Goes through the geometry's morphTargets and generates animations based on the morphTargets' names (morph.name). Names
-		are of the form "walk_01", "walk_02", "walk_03", etc or "run001", "run002", "run003". The animation label is then
-		the part before the underscore and number, so "walk" or "run" in the examples.<br/><br/>
-		
-		This function changes the underlying geometry object by adding the animations property to it. This property
-		is set to an object of key/pair values, with the key being the label and the value being an object with
-		a start and end property that represents the frame index.
-		</div>
-
-		<h3>[method:null updateAnimation]([page:Float delta])</h3>
-		<div>
-		delta -- The change in time in milliseconds
-		</div>
-		<div>
-		Update the morphTargetInfluences array on the MorphAnimMesh.
-		</div>
-
-		<h3>[method:null setAnimationLabel]([page:String label], [page:Integer start], [page:Integer end])</h3>
-		<div>
-		label -- The name of the animation <br />
-		start -- The starting frame index <br />
-		end -- The ending frame index
-		</div>
-		<div>
-		Defines an animation. Sets the geometry.animations[label] to be an object with the start and end properties.
-		</div>
-
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
-		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned MorphAnimMesh Object.
-		</div>
-		<div>
-		Clone a MorphAnimMesh Object.
-		</div>
-		
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
-	</body>
-</html>

+ 4 - 11
docs/api/objects/Points.html

@@ -38,24 +38,17 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:Points clone]()</h3>
-		<div>
-		This creates a clone of the particle system.
-		</div>
-
-		<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
+		<h3>[method:Array raycast]( [page:Raycaster raycaster], [page:Array intersects] )</h3>
 		<div>
 		Get intersections between a casted ray and this Points. [page:Raycaster.intersectObject] will call this method.
 		</div>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
-		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned Points Object.
-		</div>
+		<h3>[method:Points clone]()</h3>
 		<div>
-		Clone a Points Object.
+		Returns a clone of this Points object and its descendants.
 		</div>
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 2 - 1
docs/api/objects/Skeleton.html

@@ -123,8 +123,9 @@
 		
 		<h3>[method:Skeleton clone]()</h3>
 		<div>
-		Clone a Skeleton Object.
+		Returns a clone of this Skeleton object.
 		</div>
+
 		
 		<h2>Source</h2>
 

+ 6 - 8
docs/api/objects/SkinnedMesh.html

@@ -53,7 +53,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture])</h3>
+		<h3>[name]( [page:Geometry geometry], [page:Material material], [page:boolean useVertexTexture] )</h3>
 		<div>
         geometry — An instance of [page:Geometry]. [page:Geometry.skinIndices] and [page:Geometry.skinWeights] should be set.<br />
         material — An instance of [page:Material] (optional).<br />
@@ -102,7 +102,7 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:null bind]([page:Skeleton skeleton], [page:Matrix4 bindMatrix])</h3>
+		<h3>[method:null bind]( [page:Skeleton skeleton], [page:Matrix4 bindMatrix] )</h3>
 		<div>
 		skeleton — [page:Skeleton]<br/>
 		bindMatrix — [page:Matrix4] that represents the base transform of the skeleton
@@ -122,7 +122,7 @@
 		This method sets the skinned mesh in the rest pose.
 		</div>
 
-		<h3>[method:Bone addBone]([page:Bone bone])</h3>
+		<h3>[method:Bone addBone]( [page:Bone bone] )</h3>
 		<div>
 		bone — This is the bone that needs to be added. (optional)
 		</div>
@@ -130,13 +130,11 @@
 		This method adds the bone to the skinned mesh when it is provided. It creates a new bone and adds that when no bone is given.
 		</div>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
+		<h3>[method:SkinnedMesh clone]()</h3>
 		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned SkinnedMesh Object.
-		</div>
-		<div>
-		Clone a SkinnedMesh Object.
+		Returns a clone of this SkinnedMesh object and its descendants.
 		</div>
+
 		
 		<h2>Source</h2>
 

+ 6 - 12
docs/api/objects/Sprite.html

@@ -26,7 +26,7 @@
 
 		<h2>Constructor</h2>
 
-		<h3>[name]([page:Material material])</h3>
+		<h3>[name]( [page:Material material] )</h3>
 		<div>
                 material — An instance of [page:Material] (optional).
 		</div>
@@ -41,22 +41,16 @@
 		<div>
 		An instance of [page:Material], defining the object's appearance. Default is a [page:SpriteMaterial] which is a white plane.
 		</div>
--
-           	<h2>Methods</h2>
 
-                <h3>[method:Sprite clone]()</h3>
-                <div>
-                This creates a new clone of the sprite.
-                </div>
 
-		<h3>[method:Object3D clone]([page:Object3D object])</h3>
-		<div>
-		object -- (optional) Object3D which needs to be cloned. If undefined, clone method will create a new cloned Sprite Object.
-		</div>
+ 		<h2>Methods</h2>
+
+		<h3>[method:Sprite clone]()</h3>
 		<div>
-		Clone a Sprite Object.
+		Returns a clone of this Sprite object and its descendants.
 		</div>
 
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 0 - 5
docs/api/renderers/WebGLRenderer.html

@@ -123,11 +123,6 @@
 		<div>Default is 4. The maximum number of MorphNormals allowed in a shader. Keep in mind that the standard materials only allow 4 MorphNormals. </div>
 
 
-		<h3>[property:Boolean autoScaleCubemaps]</h3>
-
-		<div>Default is true. If set, then Cubemaps are scaled, when they are bigger than the maximum size, to make sure that they aren't bigger than the maximum size.</div>
-
-
 		<h3>[property:Object info]</h3>
 
 		<div>An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields:</div>

+ 2 - 2
docs/api/renderers/webgl/plugins/LensFlarePlugin.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -23,7 +23,7 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:null render]([page:Scene scene], [page:Camera camera], [page:Number viewportWidth], [page:Number viewportHeight])</h3>
+		<h3>[method:null render]( [page:Scene scene], [page:Camera camera], [page:Number viewportWidth], [page:Number viewportHeight] )</h3>
 		<div>
 		scene -- The scene to render. <br />
 		camera -- The camera to render. <br />

+ 2 - 2
docs/api/renderers/webgl/plugins/SpritePlugin.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -23,7 +23,7 @@
 
 		<h2>Methods</h2>
 
-		<h3>[method:null render]([page:Scene scene], [page:Camera camera])</h3>
+		<h3>[method:null render]( [page:Scene scene], [page:Camera camera] )</h3>
 		<div>
 		scene -- The scene to render. <br />
 		camera -- The camera to render.

+ 2 - 2
docs/api/scenes/FogExp2.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -16,7 +16,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]( [page:Integer hex], [page:Float density])</h3>
+		<h3>[name]( [page:Integer hex], [page:Float density] )</h3>
 
 		<div>The hex parameter is passed to the [page:Color] constructor to set the color property.  Hex can be a hexadecimal integer or a CSS-style string.</div>
 		<h2>Properties</h2>

+ 2 - 2
docs/api/textures/CompressedTexture.html

@@ -1,7 +1,7 @@
 <!DOCTYPE html>
 <html lang="en">
 	<head>
-		<meta charset="utf-8" />
+		<meta charset="utf-8" />
 		<base href="../../" />
 		<script src="list.js"></script>
 		<script src="page.js"></script>
@@ -20,7 +20,7 @@
 		<h2>Constructor</h2>
 
 
-		<h3>[name]([page:Array mipmaps], [page:Number width], [page:Number height], [page:Number format], [page:Number type], [page:Number mapping], [page:Number wrapS], [page:Number wrapT], [page:Number magFilter], [page:Number minFilter], [page:Number anisotropy])</h3>
+		<h3>[name]( [page:Array mipmaps], [page:Number width], [page:Number height], [page:Number format], [page:Number type], [page:Number mapping], [page:Number wrapS], [page:Number wrapT], [page:Number magFilter], [page:Number minFilter], [page:Number anisotropy] )</h3>
 		<div>
 		mipmaps -- The mipmaps array should contains objects with data, width and height. The mipmaps should be from of the correct format and type. <br />
 		width -- The width of the biggest mipmap<br />

+ 2 - 2
docs/api/textures/Texture.html

@@ -143,12 +143,12 @@
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
-		<h3>.clone([page:Texture texture])</h3>
+		<h3>[method:Material clone]( [page:Texture texture] )</h3>
 		<div>
 		Make copy of texture. Note this is not a "deep copy", the image is shared.
 		</div>
 
-		<h3>.dispose()</h3>
+		<h3>[method:null dispose]()</h3>
 		<div>
 		Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type.
 		</div>

+ 3 - 4
docs/list.js

@@ -114,10 +114,9 @@ var list = {
 			[ "LineSegments", "api/objects/LineSegments" ],
 			[ "LOD", "api/objects/LOD" ],
 			[ "Mesh", "api/objects/Mesh" ],
-			[ "MorphAnimMesh", "api/objects/MorphAnimMesh" ],
 			[ "Points", "api/objects/Points" ],
-			[ "SkinnedMesh", "api/objects/SkinnedMesh" ],
 			[ "Skeleton", "api/objects/Skeleton" ],
+			[ "SkinnedMesh", "api/objects/SkinnedMesh" ],
 			[ "Sprite", "api/objects/Sprite" ]
 		],
 
@@ -196,10 +195,10 @@ var list = {
 			[ "BoxGeometry", "api/extras/geometries/BoxGeometry" ],
 			[ "CircleBufferGeometry", "api/extras/geometries/CircleBufferGeometry" ],
 			[ "CircleGeometry", "api/extras/geometries/CircleGeometry" ],
-			[ "CylinderBufferGeometry", "api/extras/geometries/CylinderBufferGeometry" ],
-			[ "CylinderGeometry", "api/extras/geometries/CylinderGeometry" ],
 			[ "ConeBufferGeometry", "api/extras/geometries/ConeBufferGeometry" ],
 			[ "ConeGeometry", "api/extras/geometries/ConeGeometry" ],
+			[ "CylinderBufferGeometry", "api/extras/geometries/CylinderBufferGeometry" ],
+			[ "CylinderGeometry", "api/extras/geometries/CylinderGeometry" ],
 			[ "DodecahedronGeometry", "api/extras/geometries/DodecahedronGeometry" ],
 			[ "ExtrudeGeometry", "api/extras/geometries/ExtrudeGeometry" ],
 			[ "IcosahedronGeometry", "api/extras/geometries/IcosahedronGeometry" ],

+ 16 - 8
editor/index.html

@@ -35,12 +35,14 @@
 		<script src="../examples/js/loaders/BabylonLoader.js"></script>
 		<script src="../examples/js/loaders/ColladaLoader2.js"></script>
 		<script src="../examples/js/loaders/FBXLoader.js"></script>
+		<script src="../examples/js/loaders/GLTFLoader.js"></script>
 		<script src="../examples/js/loaders/KMZLoader.js"></script>
 		<script src="../examples/js/loaders/MD2Loader.js"></script>
 		<script src="../examples/js/loaders/OBJLoader.js"></script>
 		<script src="../examples/js/loaders/PlayCanvasLoader.js"></script>
 		<script src="../examples/js/loaders/PLYLoader.js"></script>
 		<script src="../examples/js/loaders/STLLoader.js"></script>
+		<script src="../examples/js/loaders/TGALoader.js"></script>
 		<script src="../examples/js/loaders/UTF8Loader.js"></script>
 		<script src="../examples/js/loaders/VRMLLoader.js"></script>
 		<script src="../examples/js/loaders/VTKLoader.js"></script>
@@ -297,9 +299,12 @@
 
 				switch ( event.keyCode ) {
 
-					case 8:
+					case 8: // backspace
+
 						event.preventDefault(); // prevent browser back
 
+					case 46: // delete
+
 						var object = editor.selected;
 
 						if ( confirm( 'Delete ' + object.name + '?' ) === false ) return;
@@ -320,22 +325,25 @@
 							editor.undo();
 
 						}
-						
+
 						break;
-						
+
 					case 87: // Register W for translation transform mode
+
 						editor.signals.transformModeChanged.dispatch( 'translate' );
-						
+
 						break;
-						
+
 					case 69: // Register E for rotation transform mode
+
 						editor.signals.transformModeChanged.dispatch( 'rotate' );
-						
+
 						break;
-						
+
 					case 82: // Register R for scaling transform mode
+
 						editor.signals.transformModeChanged.dispatch( 'scale' );
-						
+
 						break;
 
 				}

+ 19 - 0
editor/js/Loader.js

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

+ 1 - 1
editor/js/Menubar.Edit.js

@@ -104,7 +104,7 @@ Menubar.Edit = function ( editor ) {
 
 	var option = new UI.Row();
 	option.setClass( 'option' );
-	option.setTextContent( 'Delete' );
+	option.setTextContent( 'Delete (Del)' );
 	option.onClick( function () {
 
 		var object = editor.selected;

+ 1 - 1
editor/js/Sidebar.Scene.js

@@ -182,7 +182,7 @@ Sidebar.Scene = function ( editor ) {
 				var object = objects[ i ];
 
 				var option = buildOption( object, true );
-				option.style.marginLeft = ( pad * 10 ) + 'px';
+				option.style.paddingLeft = ( pad * 10 ) + 'px';
 				options.push( option );
 
 				addObjects( object.children, pad + 1 );

+ 3 - 3
editor/js/Toolbar.js

@@ -14,21 +14,21 @@ var Toolbar = function ( editor ) {
 
 	// translate / rotate / scale
 
-	var translate = new UI.Button( 'translate' ).onClick( function () {
+	var translate = new UI.Button( 'translate ( w )' ).onClick( function () {
 
 		signals.transformModeChanged.dispatch( 'translate' );
 
 	} );
 	buttons.add( translate );
 
-	var rotate = new UI.Button( 'rotate' ).onClick( function () {
+	var rotate = new UI.Button( 'rotate ( e )' ).onClick( function () {
 
 		signals.transformModeChanged.dispatch( 'rotate' );
 
 	} );
 	buttons.add( rotate );
 
-	var scale = new UI.Button( 'scale' ).onClick( function () {
+	var scale = new UI.Button( 'scale ( r )' ).onClick( function () {
 
 		signals.transformModeChanged.dispatch( 'scale' );
 

+ 2 - 3
editor/js/Viewport.js

@@ -75,7 +75,7 @@ var Viewport = function ( editor ) {
 
 		var object = transformControls.object;
 
-		if ( object !== null ) {
+		if ( object !== undefined ) {
 
 			switch ( transformControls.getMode() ) {
 
@@ -364,8 +364,7 @@ var Viewport = function ( editor ) {
 
 		if ( object !== null ) {
 
-			if ( object.geometry !== undefined &&
-				 object instanceof THREE.Sprite === false ) {
+			if ( object.geometry !== undefined ) {
 
 				selectionBox.update( object );
 				selectionBox.visible = true;

+ 2 - 26
editor/js/libs/tern-threejs/threejs.js

@@ -2268,14 +2268,6 @@
           "!type": "boolean",
           "!doc": "If true, the ajax request will use cookies."
         },
-        "showStatus": {
-          "!type": "bool",
-          "!doc": "If true, show loading status in the statusDomElement."
-        },
-        "statusDomElement": {
-          "!type": "DOMElement",
-          "!doc": "This is the recipient of status messages."
-        },
         "onLoadStart": {
           "!type": "function",
           "!doc": "The default is a function with empty body."
@@ -2311,26 +2303,14 @@
         "extractUrlBase": {
           "!type": "fn(url: string) -> string",
           "!doc": "Extract the base from the URL."
-        },
-        "addStatusElement": {
-          "!type": "fn() -> DOMElement",
-          "!doc": "Add a DOM element to indicate the progress and return the DOMElement"
         }
       },
       "!doc": "A loader for loading objects in JSON format.",
-      "!type": "fn(showStatus: bool)"
+      "!type": "fn()"
     },
     "Loader": {
       "!url": "http://threejs.org/docs/#Reference/loaders/Loader",
       "prototype": {
-        "showStatus": {
-          "!type": "bool",
-          "!doc": "If true, show loading status in the statusDomElement."
-        },
-        "statusDomElement": {
-          "!type": "DOMElement",
-          "!doc": "This is the recipient of status messages."
-        },
         "onLoadStart": {
           "!type": "function",
           "!doc": "The default is a function with empty body."
@@ -2362,14 +2342,10 @@
         "extractUrlBase": {
           "!type": "fn(url: string) -> string",
           "!doc": "Extract the base from the URL."
-        },
-        "addStatusElement": {
-          "!type": "fn() -> DOMElement",
-          "!doc": "Add a DOM element to indicate the progress and return the DOMElement"
         }
       },
       "!doc": "Base class for implementing loaders.",
-      "!type": "fn(showStatus: bool)"
+      "!type": "fn()"
     },
     "LoadingManager": {
       "!url": "http://threejs.org/docs/#Reference/loaders/LoadingManager",

+ 0 - 2
editor/js/libs/ui.js

@@ -1045,8 +1045,6 @@ UI.Button = function ( value ) {
 
 	UI.Element.call( this );
 
-	var scope = this;
-
 	var dom = document.createElement( 'button' );
 	dom.className = 'Button';
 

+ 30 - 8
editor/js/libs/ui.three.js

@@ -49,14 +49,15 @@ UI.Texture = function ( mapping ) {
 		if ( file.type.match( 'image.*' ) ) {
 
 			var reader = new FileReader();
-			reader.addEventListener( 'load', function ( event ) {
 
-				var image = document.createElement( 'img' );
-				image.addEventListener( 'load', function( event ) {
+			if ( file.type === 'image/targa' ) {
 
-					var texture = new THREE.Texture( this, mapping );
+				reader.addEventListener( 'load', function ( event ) {
+
+					var canvas = new THREE.TGALoader().parse( event.target.result );
+
+					var texture = new THREE.CanvasTexture( canvas, mapping );
 					texture.sourceFile = file.name;
-					texture.needsUpdate = true;
 
 					scope.setValue( texture );
 
@@ -64,11 +65,32 @@ UI.Texture = function ( mapping ) {
 
 				}, false );
 
-				image.src = event.target.result;
+				reader.readAsArrayBuffer( file );
+
+			} else {
+
+				reader.addEventListener( 'load', function ( event ) {
+
+					var image = document.createElement( 'img' );
+					image.addEventListener( 'load', function( event ) {
+
+						var texture = new THREE.Texture( this, mapping );
+						texture.sourceFile = file.name;
+						texture.needsUpdate = true;
+
+						scope.setValue( texture );
 
-			}, false );
+						if ( scope.onChangeCallback ) scope.onChangeCallback();
 
-			reader.readAsDataURL( file );
+					}, false );
+
+					image.src = event.target.result;
+
+				}, false );
+
+				reader.readAsDataURL( file );
+
+			}
 
 		}
 

+ 4 - 1
examples/files.js

@@ -44,6 +44,8 @@ var files = {
 		"webgl_geometry_text_earcut",
 		"webgl_geometry_text_pnltri",
 		"webgl_gpgpu_birds",
+		"webgl_gpgpu_water",
+		"webgl_gpgpu_protoplanet",
 		"webgl_gpu_particle_system",
 		"webgl_hdr",
 		"webgl_helpers",
@@ -123,7 +125,6 @@ var files = {
 		"webgl_materials_cubemap_balls_refraction",
 		"webgl_materials_cubemap_dynamic",
 		"webgl_materials_cubemap_dynamic2",
-		"webgl_materials_cubemap_escher",
 		"webgl_materials_cubemap_refraction",
 		"webgl_materials_displacementmap",
 		"webgl_materials_envmaps",
@@ -149,6 +150,7 @@ var files = {
 		"webgl_materials_variations_lambert",
 		"webgl_materials_variations_phong",
 		"webgl_materials_variations_standard",
+		"webgl_materials_variations_physical",
 		"webgl_materials_video",
 		"webgl_materials_wireframe",
 		"webgl_mirror",
@@ -170,6 +172,7 @@ var files = {
 		"webgl_objects_update",
 		"webgl_octree",
 		"webgl_octree_raycasting",
+		"webgl_panorama_cube",
 		"webgl_panorama_dualfisheye",
 		"webgl_panorama_equirectangular",
 		"webgl_performance",

+ 370 - 0
examples/js/GPUComputationRenderer.js

@@ -0,0 +1,370 @@
+/**
+ * @author yomboprime https://github.com/yomboprime
+ *
+ * GPUComputationRenderer, based on SimulationRenderer by zz85
+ *
+ * The GPUComputationRenderer uses the concept of variables. These variables are RGBA float textures that hold 4 floats
+ * for each compute element (texel)
+ *
+ * Each variable has a fragment shader that defines the computation made to obtain the variable in question.
+ * You can use as many variables you need, and make dependencies so you can use textures of other variables in the shader
+ * (the sampler uniforms are added automatically) Most of the variables will need themselves as dependency.
+ *
+ * The renderer has actually two render targets per variable, to make ping-pong. Textures from the current frame are used
+ * as inputs to render the textures of the next frame.
+ *
+ * The render targets of the variables can be used as input textures for your visualization shaders.
+ *
+ * Variable names should be valid identifiers and should not collide with THREE GLSL used identifiers.
+ * a common approach could be to use 'texture' prefixing the variable name; i.e texturePosition, textureVelocity...
+ *
+ * The size of the computation (sizeX * sizeY) is defined as 'resolution' automatically in the shader. For example:
+ * #DEFINE resolution vec2( 1024.0, 1024.0 )
+ *
+ * -------------
+ *
+ * Basic use:
+ *
+ * // Initialization...
+ *
+ * // Create computation renderer
+ * var gpuCompute = new GPUComputationRenderer( 1024, 1024, renderer );
+ *
+ * // Create initial state float textures
+ * var pos0 = gpuCompute.createTexture();
+ * var vel0 = gpuCompute.createTexture();
+ * // and fill in here the texture data...
+ *
+ * // Add texture variables
+ * var velVar = gpuCompute.addVariable( "textureVelocity", fragmentShaderVel, pos0 );
+ * var posVar = gpuCompute.addVariable( "texturePosition", fragmentShaderPos, vel0 );
+ *
+ * // Add variable dependencies
+ * gpuCompute.setVariableDependencies( velVar, [ velVar, posVar ] );
+ * gpuCompute.setVariableDependencies( posVar, [ velVar, posVar ] );
+ *
+ * // Add custom uniforms
+ * velVar.material.uniforms.time = { value: 0.0 };
+ *
+ * // Check for completeness
+ * var error = gpuCompute.init();
+ * if ( error !== null ) {
+ *		console.error( error );
+  * }
+ *
+ *
+ * // In each frame...
+ *
+ * // Compute!
+ * gpuCompute.compute();
+ *
+ * // Update texture uniforms in your visualization materials with the gpu renderer output
+ * myMaterial.uniforms.myTexture.value = gpuCompute.getCurrentRenderTarget( posVar ).texture;
+ *
+ * // Do your rendering
+ * renderer.render( myScene, myCamera );
+ *
+ * -------------
+ *
+ * Also, you can use utility functions to create ShaderMaterial and perform computations (rendering between textures)
+ * Note that the shaders can have multiple input textures.
+ *
+ * var myFilter1 = gpuCompute.createShaderMaterial( myFilterFragmentShader1, { theTexture: { value: null } } );
+ * var myFilter2 = gpuCompute.createShaderMaterial( myFilterFragmentShader2, { theTexture: { value: null } } );
+ *
+ * var inputTexture = gpuCompute.createTexture();
+ *
+ * // Fill in here inputTexture...
+ *
+ * myFilter1.uniforms.theTexture.value = inputTexture;
+ *
+ * var myRenderTarget = gpuCompute.createRenderTarget();
+ * myFilter2.uniforms.theTexture.value = myRenderTarget.texture;
+ *
+ * var outputRenderTarget = gpuCompute.createRenderTarget();
+ *
+ * // Now use the output texture where you want:
+ * myMaterial.uniforms.map.value = outputRenderTarget.texture;
+ *
+ * // And compute each frame, before rendering to screen:
+ * gpuCompute.doRenderTarget( myFilter1, myRenderTarget );
+ * gpuCompute.doRenderTarget( myFilter2, outputRenderTarget );
+ * 
+ *
+ *
+ * @param {int} sizeX Computation problem size is always 2d: sizeX * sizeY elements.
+ * @param {int} sizeY Computation problem size is always 2d: sizeX * sizeY elements.
+ * @param {WebGLRenderer} renderer The renderer
+  */
+
+function GPUComputationRenderer( sizeX, sizeY, renderer ) {
+
+	this.variables = [];
+
+	this.currentTextureIndex = 0;
+
+	var scene = new THREE.Scene();
+
+	var camera = new THREE.Camera();
+	camera.position.z = 1;
+
+	var passThruUniforms = {
+		texture: { value: null }
+	};
+
+	var passThruShader = createShaderMaterial( getPassThroughFragmentShader(), passThruUniforms );
+
+	var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), passThruShader );
+	scene.add( mesh );
+
+
+	this.addVariable = function( variableName, computeFragmentShader, initialValueTexture ) {
+
+		var material = this.createShaderMaterial( computeFragmentShader );
+
+		var variable = {
+			name: variableName,
+			initialValueTexture: initialValueTexture,
+			material: material,
+			dependencies: null,
+			renderTargets: [],
+			wrapS: null,
+			wrapT: null,
+			minFilter: THREE.NearestFilter,
+			magFilter: THREE.NearestFilter
+		};
+
+		this.variables.push( variable );
+
+		return variable;
+		
+	};
+
+	this.setVariableDependencies = function( variable, dependencies ) {
+
+		variable.dependencies = dependencies;
+
+	};
+
+	this.init = function() {
+
+		if ( ! renderer.extensions.get( "OES_texture_float" ) ) {
+
+			return "No OES_texture_float support for float textures.";
+
+		}
+
+		if ( renderer.capabilities.maxVertexTextures === 0 ) {
+
+			return "No support for vertex shader textures.";
+
+		}
+
+		for ( var i = 0; i < this.variables.length; i++ ) {
+
+			var variable = this.variables[ i ];
+
+			// Creates rendertargets and initialize them with input texture
+			variable.renderTargets[ 0 ] = this.createRenderTarget( sizeX, sizeY, variable.wrapS, variable.wrapT, variable.minFilter, variable.magFilter );
+			variable.renderTargets[ 1 ] = this.createRenderTarget( sizeX, sizeY, variable.wrapS, variable.wrapT, variable.minFilter, variable.magFilter );
+			this.renderTexture( variable.initialValueTexture, variable.renderTargets[ 0 ] );
+			this.renderTexture( variable.initialValueTexture, variable.renderTargets[ 1 ] );
+
+			// Adds dependencies uniforms to the ShaderMaterial
+			var material = variable.material;
+			var uniforms = material.uniforms;
+			if ( variable.dependencies !== null ) {
+
+				for ( var d = 0; d < variable.dependencies.length; d++ ) {
+
+					var depVar = variable.dependencies[ d ];
+
+					if ( depVar.name !== variable.name ) {
+
+						// Checks if variable exists
+						var found = false;
+						for ( var j = 0; j < this.variables.length; j++ ) {
+
+							if ( depVar.name === this.variables[ j ].name ) {
+								found = true;
+								break;
+							}
+
+						}
+						if ( ! found ) {
+							return "Variable dependency not found. Variable=" + variable.name + ", dependency=" + depVar.name;
+						}
+
+					}
+
+					uniforms[ depVar.name ] = { value: null };
+
+					material.fragmentShader = "\nuniform sampler2D " + depVar.name + ";\n" + material.fragmentShader;
+
+				}
+			}
+		}
+
+		this.currentTextureIndex = 0;
+
+		return null;
+
+	};
+
+	this.compute = function() {
+
+		var currentTextureIndex = this.currentTextureIndex;
+		var nextTextureIndex = this.currentTextureIndex === 0 ? 1 : 0;
+
+		for ( var i = 0, il = this.variables.length; i < il; i++ ) {
+
+			var variable = this.variables[ i ];
+
+			// Sets texture dependencies uniforms
+			if ( variable.dependencies !== null ) {
+
+				var uniforms = variable.material.uniforms;
+				for ( var d = 0, dl = variable.dependencies.length; d < dl; d++ ) {
+
+					var depVar = variable.dependencies[ d ];
+
+					uniforms[ depVar.name ].value = depVar.renderTargets[ currentTextureIndex ].texture;
+
+				}
+
+			}
+
+			// Performs the computation for this variable
+			this.doRenderTarget( variable.material, variable.renderTargets[ nextTextureIndex ] );
+
+		}
+
+		this.currentTextureIndex = nextTextureIndex;
+	};
+
+	this.getCurrentRenderTarget = function( variable ) {
+
+		return variable.renderTargets[ this.currentTextureIndex ];
+
+	};
+
+	this.getAlternateRenderTarget = function( variable ) {
+
+		return variable.renderTargets[ this.currentTextureIndex === 0 ? 1 : 0 ];
+
+	};
+
+	function addResolutionDefine( materialShader ) {
+
+		materialShader.defines.resolution = 'vec2( ' + sizeX.toFixed( 1 ) + ', ' + sizeY.toFixed( 1 ) + " )";
+
+	};
+	this.addResolutionDefine = addResolutionDefine;
+
+
+	// The following functions can be used to compute things manually
+
+	function createShaderMaterial( computeFragmentShader, uniforms ) {
+
+		uniforms = uniforms || {};
+
+		var material = new THREE.ShaderMaterial( {
+			uniforms: uniforms,
+			vertexShader: getPassThroughVertexShader(),
+			fragmentShader: computeFragmentShader
+		} );
+
+		addResolutionDefine( material );
+
+		return material;
+	};
+	this.createShaderMaterial = createShaderMaterial;
+
+	this.createRenderTarget = function( sizeXTexture, sizeYTexture, wrapS, wrapT, minFilter, magFilter ) {
+
+		sizeXTexture = sizeXTexture || sizeX;
+		sizeYTexture = sizeYTexture || sizeY;
+
+		wrapS = wrapS || THREE.ClampToEdgeWrapping;
+		wrapT = wrapT || THREE.ClampToEdgeWrapping;
+
+		minFilter = minFilter || THREE.NearestFilter;
+		magFilter = magFilter || THREE.NearestFilter;
+
+		var renderTarget = new THREE.WebGLRenderTarget( sizeXTexture, sizeYTexture, {
+			wrapS: wrapS,
+			wrapT: wrapT,
+			minFilter: minFilter,
+			magFilter: magFilter,
+			format: THREE.RGBAFormat,
+			type: THREE.FloatType,
+			stencilBuffer: false
+		} );
+
+		return renderTarget;
+
+	};
+
+    this.createTexture = function( sizeXTexture, sizeYTexture ) {
+
+		sizeXTexture = sizeXTexture || sizeX;
+		sizeYTexture = sizeYTexture || sizeY;
+
+		var a = new Float32Array( sizeXTexture * sizeYTexture * 4 );
+		var texture = new THREE.DataTexture( a, sizeX, sizeY, THREE.RGBAFormat, THREE.FloatType );
+		texture.needsUpdate = true;
+
+		return texture;
+
+	};
+
+
+	this.renderTexture = function( input, output ) {
+
+		// Takes a texture, and render out in rendertarget
+		// input = Texture
+		// output = RenderTarget
+
+		passThruUniforms.texture.value = input;
+
+		this.doRenderTarget( passThruShader, output);
+
+		passThruUniforms.texture.value = null;
+
+	};
+
+	this.doRenderTarget = function( material, output ) {
+
+		mesh.material = material;
+		renderer.render( scene, camera, output );
+		mesh.material = passThruShader;
+
+	};
+
+	// Shaders
+
+	function getPassThroughVertexShader() {
+
+		return	"void main()	{\n" +
+				"\n" +
+				"	gl_Position = vec4( position, 1.0 );\n" +
+				"\n" +
+				"}\n";
+
+	}
+
+	function getPassThroughFragmentShader() {
+
+		return	"uniform sampler2D texture;\n" +
+				"\n" +
+				"void main() {\n" +
+				"\n" +
+				"	vec2 uv = gl_FragCoord.xy / resolution.xy;\n" +
+				"\n" +
+				"	gl_FragColor = texture2D( texture, uv );\n" +
+				"\n" +
+				"}\n";
+
+	}
+
+}

+ 383 - 387
examples/js/GPUParticleSystem.js

@@ -2,7 +2,7 @@
  * GPU Particle System
  * @author flimshaw - Charlie Hoey - http://charliehoey.com
  *
- * A simple to use, general purpose GPU system.  Particles are spawn-and-forget with
+ * A simple to use, general purpose GPU system. Particles are spawn-and-forget with
  * several options available, and do not require monitoring or cleanup after spawning.
  * Because the paths of all particles are completely deterministic once spawned, the scale
  * and direction of time is also variable.
@@ -17,265 +17,261 @@
 
 THREE.GPUParticleSystem = function(options) {
 
-  var self = this;
-  var options = options || {};
+	var self = this;
+	var options = options || {};
 
-  // parse options and use defaults
-  self.PARTICLE_COUNT = options.maxParticles || 1000000;
-  self.PARTICLE_CONTAINERS = options.containerCount || 1;
-  self.PARTICLES_PER_CONTAINER = Math.ceil(self.PARTICLE_COUNT / self.PARTICLE_CONTAINERS);
-  self.PARTICLE_CURSOR = 0;
-  self.time = 0;
+	// parse options and use defaults
+	self.PARTICLE_COUNT = options.maxParticles || 1000000;
+	self.PARTICLE_CONTAINERS = options.containerCount || 1;
+	self.PARTICLES_PER_CONTAINER = Math.ceil(self.PARTICLE_COUNT / self.PARTICLE_CONTAINERS);
+	self.PARTICLE_CURSOR = 0;
+	self.time = 0;
 
 
-  // Custom vertex and fragement shader
-  var GPUParticleShader = {
+	// Custom vertex and fragement shader
+	var GPUParticleShader = {
 
-    vertexShader: [
+		vertexShader: [
 
-      'precision highp float;',
-      'const vec4 bitSh = vec4(256. * 256. * 256., 256. * 256., 256., 1.);',
-      'const vec4 bitMsk = vec4(0.,vec3(1./256.0));',
-      'const vec4 bitShifts = vec4(1.) / bitSh;',
+			'precision highp float;',
+			'const vec4 bitSh = vec4(256. * 256. * 256., 256. * 256., 256., 1.);',
+			'const vec4 bitMsk = vec4(0.,vec3(1./256.0));',
+			'const vec4 bitShifts = vec4(1.) / bitSh;',
 
-      '#define FLOAT_MAX  1.70141184e38',
-      '#define FLOAT_MIN  1.17549435e-38',
+			'#define FLOAT_MAX	1.70141184e38',
+			'#define FLOAT_MIN	1.17549435e-38',
 
-      'lowp vec4 encode_float(highp float v) {',
-      'highp float av = abs(v);',
+			'lowp vec4 encode_float(highp float v) {',
+			'highp float av = abs(v);',
 
-      '//Handle special cases',
-      'if(av < FLOAT_MIN) {',
-      'return vec4(0.0, 0.0, 0.0, 0.0);',
-      '} else if(v > FLOAT_MAX) {',
-      'return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;',
-      '} else if(v < -FLOAT_MAX) {',
-      'return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;',
-      '}',
+			'//Handle special cases',
+			'if(av < FLOAT_MIN) {',
+			'return vec4(0.0, 0.0, 0.0, 0.0);',
+			'} else if(v > FLOAT_MAX) {',
+			'return vec4(127.0, 128.0, 0.0, 0.0) / 255.0;',
+			'} else if(v < -FLOAT_MAX) {',
+			'return vec4(255.0, 128.0, 0.0, 0.0) / 255.0;',
+			'}',
 
-      'highp vec4 c = vec4(0,0,0,0);',
+			'highp vec4 c = vec4(0,0,0,0);',
 
-      '//Compute exponent and mantissa',
-      'highp float e = floor(log2(av));',
-      'highp float m = av * pow(2.0, -e) - 1.0;',
+			'//Compute exponent and mantissa',
+			'highp float e = floor(log2(av));',
+			'highp float m = av * pow(2.0, -e) - 1.0;',
 
-      //Unpack mantissa
-      'c[1] = floor(128.0 * m);',
-      'm -= c[1] / 128.0;',
-      'c[2] = floor(32768.0 * m);',
-      'm -= c[2] / 32768.0;',
-      'c[3] = floor(8388608.0 * m);',
+			//Unpack mantissa
+			'c[1] = floor(128.0 * m);',
+			'm -= c[1] / 128.0;',
+			'c[2] = floor(32768.0 * m);',
+			'm -= c[2] / 32768.0;',
+			'c[3] = floor(8388608.0 * m);',
 
-      '//Unpack exponent',
-      'highp float ebias = e + 127.0;',
-      'c[0] = floor(ebias / 2.0);',
-      'ebias -= c[0] * 2.0;',
-      'c[1] += floor(ebias) * 128.0;',
+			'//Unpack exponent',
+			'highp float ebias = e + 127.0;',
+			'c[0] = floor(ebias / 2.0);',
+			'ebias -= c[0] * 2.0;',
+			'c[1] += floor(ebias) * 128.0;',
 
-      '//Unpack sign bit',
-      'c[0] += 128.0 * step(0.0, -v);',
+			'//Unpack sign bit',
+			'c[0] += 128.0 * step(0.0, -v);',
 
-      '//Scale back to range',
-      'return c / 255.0;',
-      '}',
+			'//Scale back to range',
+			'return c / 255.0;',
+			'}',
 
-      'vec4 pack(const in float depth)',
-      '{',
-      'const vec4 bit_shift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);',
-      'const vec4 bit_mask  = vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);',
-      'vec4 res = mod(depth*bit_shift*vec4(255), vec4(256))/vec4(255);',
-      'res -= res.xxyz * bit_mask;',
-      'return res;',
-      '}',
+			'vec4 pack(const in float depth)',
+			'{',
+			'const vec4 bit_shift = vec4(256.0*256.0*256.0, 256.0*256.0, 256.0, 1.0);',
+			'const vec4 bit_mask	= vec4(0.0, 1.0/256.0, 1.0/256.0, 1.0/256.0);',
+			'vec4 res = mod(depth*bit_shift*vec4(255), vec4(256))/vec4(255);',
+			'res -= res.xxyz * bit_mask;',
+			'return res;',
+			'}',
 
-      'float unpack(const in vec4 rgba_depth)',
-      '{',
-      'const vec4 bit_shift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);',
-      'float depth = dot(rgba_depth, bit_shift);',
-      'return depth;',
-      '}',
+			'float unpack(const in vec4 rgba_depth)',
+			'{',
+			'const vec4 bit_shift = vec4(1.0/(256.0*256.0*256.0), 1.0/(256.0*256.0), 1.0/256.0, 1.0);',
+			'float depth = dot(rgba_depth, bit_shift);',
+			'return depth;',
+			'}',
 
-      'uniform float uTime;',
-      'uniform float uScale;',
-      'uniform sampler2D tNoise;',
+			'uniform float uTime;',
+			'uniform float uScale;',
+			'uniform sampler2D tNoise;',
 
-      'attribute vec4 particlePositionsStartTime;',
-      'attribute vec4 particleVelColSizeLife;',
+			'attribute vec4 particlePositionsStartTime;',
+			'attribute vec4 particleVelColSizeLife;',
 
-      'varying vec4 vColor;',
-      'varying float lifeLeft;',
+			'varying vec4 vColor;',
+			'varying float lifeLeft;',
 
-      'void main() {',
+			'void main() {',
 
-      '// unpack things from our attributes',
-      'vColor = encode_float( particleVelColSizeLife.y );',
+			'// unpack things from our attributes',
+			'vColor = encode_float( particleVelColSizeLife.y );',
 
-      '// convert our velocity back into a value we can use',
-      'vec4 velTurb = encode_float( particleVelColSizeLife.x );',
-      'vec3 velocity = vec3( velTurb.xyz );',
-      'float turbulence = velTurb.w;',
+			'// convert our velocity back into a value we can use',
+			'vec4 velTurb = encode_float( particleVelColSizeLife.x );',
+			'vec3 velocity = vec3( velTurb.xyz );',
+			'float turbulence = velTurb.w;',
 
-      'vec3 newPosition;',
+			'vec3 newPosition;',
 
-      'float timeElapsed = uTime - particlePositionsStartTime.a;',
+			'float timeElapsed = uTime - particlePositionsStartTime.a;',
 
-      'lifeLeft = 1. - (timeElapsed / particleVelColSizeLife.w);',
+			'lifeLeft = 1. - (timeElapsed / particleVelColSizeLife.w);',
 
-      'gl_PointSize = ( uScale * particleVelColSizeLife.z ) * lifeLeft;',
+			'gl_PointSize = ( uScale * particleVelColSizeLife.z ) * lifeLeft;',
 
-      'velocity.x = ( velocity.x - .5 ) * 3.;',
-      'velocity.y = ( velocity.y - .5 ) * 3.;',
-      'velocity.z = ( velocity.z - .5 ) * 3.;',
+			'velocity.x = ( velocity.x - .5 ) * 3.;',
+			'velocity.y = ( velocity.y - .5 ) * 3.;',
+			'velocity.z = ( velocity.z - .5 ) * 3.;',
 
-      'newPosition = particlePositionsStartTime.xyz + ( velocity * 10. ) * ( uTime - particlePositionsStartTime.a );',
+			'newPosition = particlePositionsStartTime.xyz + ( velocity * 10. ) * ( uTime - particlePositionsStartTime.a );',
 
-      'vec3 noise = texture2D( tNoise, vec2( newPosition.x * .015 + (uTime * .05), newPosition.y * .02 + (uTime * .015) )).rgb;',
-      'vec3 noiseVel = ( noise.rgb - .5 ) * 30.;',
+			'vec3 noise = texture2D( tNoise, vec2( newPosition.x * .015 + (uTime * .05), newPosition.y * .02 + (uTime * .015) )).rgb;',
+			'vec3 noiseVel = ( noise.rgb - .5 ) * 30.;',
 
-      'newPosition = mix(newPosition, newPosition + vec3(noiseVel * ( turbulence * 5. ) ), (timeElapsed / particleVelColSizeLife.a) );',
-
-      'if( velocity.y > 0. && velocity.y < .05 ) {',
-      'lifeLeft = 0.;',
-      '}',
+			'newPosition = mix(newPosition, newPosition + vec3(noiseVel * ( turbulence * 5. ) ), (timeElapsed / particleVelColSizeLife.a) );',
 
-      'if( velocity.x < -1.45 ) {',
-      'lifeLeft = 0.;',
-      '}',
+			'if( velocity.y > 0. && velocity.y < .05 ) {',
+			'lifeLeft = 0.;',
+			'}',
 
-      'if( timeElapsed > 0. ) {',
-      'gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );',
-      '} else {',
-      'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
-      'lifeLeft = 0.;',
-      'gl_PointSize = 0.;',
-      '}',
-      '}'
+			'if( velocity.x < -1.45 ) {',
+			'lifeLeft = 0.;',
+			'}',
 
-    ].join("\n"),
+			'if( timeElapsed > 0. ) {',
+			'gl_Position = projectionMatrix * modelViewMatrix * vec4( newPosition, 1.0 );',
+			'} else {',
+			'gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );',
+			'lifeLeft = 0.;',
+			'gl_PointSize = 0.;',
+			'}',
+			'}'
 
-    fragmentShader: [
+		].join("\n"),
 
-      'float scaleLinear(float value, vec2 valueDomain) {',
-      'return (value - valueDomain.x) / (valueDomain.y - valueDomain.x);',
-      '}',
+		fragmentShader: [
 
-      'float scaleLinear(float value, vec2 valueDomain, vec2 valueRange) {',
-      'return mix(valueRange.x, valueRange.y, scaleLinear(value, valueDomain));',
-      '}',
+			'float scaleLinear(float value, vec2 valueDomain) {',
+			'return (value - valueDomain.x) / (valueDomain.y - valueDomain.x);',
+			'}',
 
-      'varying vec4 vColor;',
-      'varying float lifeLeft;',
+			'float scaleLinear(float value, vec2 valueDomain, vec2 valueRange) {',
+			'return mix(valueRange.x, valueRange.y, scaleLinear(value, valueDomain));',
+			'}',
 
-      'uniform sampler2D tSprite;',
+			'varying vec4 vColor;',
+			'varying float lifeLeft;',
 
-      'void main() {',
+			'uniform sampler2D tSprite;',
 
-      'float alpha = 0.;',
+			'void main() {',
 
-      'if( lifeLeft > .995 ) {',
-      'alpha = scaleLinear( lifeLeft, vec2(1., .995), vec2(0., 1.));//mix( 0., 1., ( lifeLeft - .95 ) * 100. ) * .75;',
-      '} else {',
-      'alpha = lifeLeft * .75;',
-      '}',
+			'float alpha = 0.;',
 
-      'vec4 tex = texture2D( tSprite, gl_PointCoord );',
+			'if( lifeLeft > .995 ) {',
+			'alpha = scaleLinear( lifeLeft, vec2(1., .995), vec2(0., 1.));//mix( 0., 1., ( lifeLeft - .95 ) * 100. ) * .75;',
+			'} else {',
+			'alpha = lifeLeft * .75;',
+			'}',
 
-      'gl_FragColor = vec4( vColor.rgb * tex.a, alpha * tex.a );',
-      '}'
+			'vec4 tex = texture2D( tSprite, gl_PointCoord );',
 
-    ].join("\n")
+			'gl_FragColor = vec4( vColor.rgb * tex.a, alpha * tex.a );',
+			'}'
 
-  };
+		].join("\n")
 
-  // preload a million random numbers
-  self.rand = [];
+	};
 
-  for (var i = 1e5; i > 0; i--) {
-    self.rand.push(Math.random() - .5);
-  }
+	// preload a million random numbers
+	self.rand = [];
 
-  self.random = function() {
-    return ++i >= self.rand.length ? self.rand[i = 1] : self.rand[i];
-  }
+	for (var i = 1e5; i > 0; i--) {
+		self.rand.push(Math.random() - .5);
+	}
 
-  var textureLoader = new THREE.TextureLoader();
+	self.random = function() {
+		return ++i >= self.rand.length ? self.rand[i = 1] : self.rand[i];
+	}
 
-  self.particleNoiseTex = textureLoader.load("textures/perlin-512.png");
-  self.particleNoiseTex.wrapS = self.particleNoiseTex.wrapT = THREE.RepeatWrapping;
+	var textureLoader = new THREE.TextureLoader();
 
-  self.particleSpriteTex = textureLoader.load("textures/particle2.png");
-  self.particleSpriteTex.wrapS = self.particleSpriteTex.wrapT = THREE.RepeatWrapping;
+	self.particleNoiseTex = textureLoader.load("textures/perlin-512.png");
+	self.particleNoiseTex.wrapS = self.particleNoiseTex.wrapT = THREE.RepeatWrapping;
 
-  self.particleShaderMat = new THREE.ShaderMaterial({
-    transparent: true,
-    depthWrite: false,
-    uniforms: {
-      "uTime": {
-        type: "f",
-        value: 0.0
-      },
-      "uScale": {
-        type: "f",
-        value: 1.0
-      },
-      "tNoise": {
-        type: "t",
-        value: self.particleNoiseTex
-      },
-      "tSprite": {
-        type: "t",
-        value: self.particleSpriteTex
-      }
-    },
-    blending: THREE.AdditiveBlending,
-    vertexShader: GPUParticleShader.vertexShader,
-    fragmentShader: GPUParticleShader.fragmentShader
-  });
+	self.particleSpriteTex = textureLoader.load("textures/particle2.png");
+	self.particleSpriteTex.wrapS = self.particleSpriteTex.wrapT = THREE.RepeatWrapping;
 
-  // define defaults for all values
-  self.particleShaderMat.defaultAttributeValues.particlePositionsStartTime = [0, 0, 0, 0];
-  self.particleShaderMat.defaultAttributeValues.particleVelColSizeLife = [0, 0, 0, 0];
+	self.particleShaderMat = new THREE.ShaderMaterial({
+		transparent: true,
+		depthWrite: false,
+		uniforms: {
+			"uTime": {
+				value: 0.0
+			},
+			"uScale": {
+				value: 1.0
+			},
+			"tNoise": {
+				value: self.particleNoiseTex
+			},
+			"tSprite": {
+				value: self.particleSpriteTex
+			}
+		},
+		blending: THREE.AdditiveBlending,
+		vertexShader: GPUParticleShader.vertexShader,
+		fragmentShader: GPUParticleShader.fragmentShader
+	});
 
-  self.particleContainers = [];
+	// define defaults for all values
+	self.particleShaderMat.defaultAttributeValues.particlePositionsStartTime = [0, 0, 0, 0];
+	self.particleShaderMat.defaultAttributeValues.particleVelColSizeLife = [0, 0, 0, 0];
 
+	self.particleContainers = [];
 
-  // extend Object3D
-  THREE.Object3D.apply(this, arguments);
 
-  this.init = function() {
+	// extend Object3D
+	THREE.Object3D.apply(this, arguments);
 
-    for (var i = 0; i < self.PARTICLE_CONTAINERS; i++) {
+	this.init = function() {
 
-      var c = new THREE.GPUParticleContainer(self.PARTICLES_PER_CONTAINER, self);
-      self.particleContainers.push(c);
-      self.add(c);
+		for (var i = 0; i < self.PARTICLE_CONTAINERS; i++) {
 
-    }
+			var c = new THREE.GPUParticleContainer(self.PARTICLES_PER_CONTAINER, self);
+			self.particleContainers.push(c);
+			self.add(c);
 
-  }
+		}
 
-  this.spawnParticle = function(options) {
+	}
 
-    self.PARTICLE_CURSOR++;
-    if (self.PARTICLE_CURSOR >= self.PARTICLE_COUNT) {
-      self.PARTICLE_CURSOR = 1;
-    }
+	this.spawnParticle = function(options) {
 
-    var currentContainer = self.particleContainers[Math.floor(self.PARTICLE_CURSOR / self.PARTICLES_PER_CONTAINER)];
+		self.PARTICLE_CURSOR++;
+		if (self.PARTICLE_CURSOR >= self.PARTICLE_COUNT) {
+			self.PARTICLE_CURSOR = 1;
+		}
 
-    currentContainer.spawnParticle(options);
+		var currentContainer = self.particleContainers[Math.floor(self.PARTICLE_CURSOR / self.PARTICLES_PER_CONTAINER)];
 
-  }
+		currentContainer.spawnParticle(options);
 
-  this.update = function(time) {
-    for (var i = 0; i < self.PARTICLE_CONTAINERS; i++) {
+	}
 
-      self.particleContainers[i].update(time);
+	this.update = function(time) {
+		for (var i = 0; i < self.PARTICLE_CONTAINERS; i++) {
 
-    }
-  };
+			self.particleContainers[i].update(time);
 
-  this.init();
+		}
+	};
+
+	this.init();
 
 }
 
@@ -286,220 +282,220 @@ THREE.GPUParticleSystem.prototype.constructor = THREE.GPUParticleSystem;
 // Subclass for particle containers, allows for very large arrays to be spread out
 THREE.GPUParticleContainer = function(maxParticles, particleSystem) {
 
-  var self = this;
-  self.PARTICLE_COUNT = maxParticles || 100000;
-  self.PARTICLE_CURSOR = 0;
-  self.time = 0;
-  self.DPR = window.devicePixelRatio;
-  self.GPUParticleSystem = particleSystem;
-
-  var particlesPerArray = Math.floor(self.PARTICLE_COUNT / self.MAX_ATTRIBUTES);
-
-  // extend Object3D
-  THREE.Object3D.apply(this, arguments);
-
-  // construct a couple small arrays used for packing variables into floats etc
-  var UINT8_VIEW = new Uint8Array(4)
-  var FLOAT_VIEW = new Float32Array(UINT8_VIEW.buffer)
-
-  function decodeFloat(x, y, z, w) {
-    UINT8_VIEW[0] = Math.floor(w)
-    UINT8_VIEW[1] = Math.floor(z)
-    UINT8_VIEW[2] = Math.floor(y)
-    UINT8_VIEW[3] = Math.floor(x)
-    return FLOAT_VIEW[0]
-  }
-
-  function componentToHex(c) {
-    var hex = c.toString(16);
-    return hex.length == 1 ? "0" + hex : hex;
-  }
-
-  function rgbToHex(r, g, b) {
-    return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
-  }
-
-  function hexToRgb(hex) {
-    var r = hex >> 16;
-    var g = (hex & 0x00FF00) >> 8;
-    var b = hex & 0x0000FF;
-
-    if (r > 0) r--;
-    if (g > 0) g--;
-    if (b > 0) b--;
-
-    return [r, g, b];
-  };
-
-  self.particles = [];
-  self.deadParticles = [];
-  self.particlesAvailableSlot = [];
-
-  // create a container for particles
-  self.particleUpdate = false;
-
-  // Shader Based Particle System
-  self.particleShaderGeo = new THREE.BufferGeometry();
-
-  // new hyper compressed attributes
-  self.particleVertices = new Float32Array(self.PARTICLE_COUNT * 3); // position
-  self.particlePositionsStartTime = new Float32Array(self.PARTICLE_COUNT * 4); // position
-  self.particleVelColSizeLife = new Float32Array(self.PARTICLE_COUNT * 4);
-
-  for (var i = 0; i < self.PARTICLE_COUNT; i++) {
-    self.particlePositionsStartTime[i * 4 + 0] = 100; //x
-    self.particlePositionsStartTime[i * 4 + 1] = 0; //y
-    self.particlePositionsStartTime[i * 4 + 2] = 0.0; //z
-    self.particlePositionsStartTime[i * 4 + 3] = 0.0; //startTime
-
-    self.particleVertices[i * 3 + 0] = 0; //x
-    self.particleVertices[i * 3 + 1] = 0; //y
-    self.particleVertices[i * 3 + 2] = 0.0; //z
-
-    self.particleVelColSizeLife[i * 4 + 0] = decodeFloat(128, 128, 0, 0); //vel
-    self.particleVelColSizeLife[i * 4 + 1] = decodeFloat(0, 254, 0, 254); //color
-    self.particleVelColSizeLife[i * 4 + 2] = 1.0; //size
-    self.particleVelColSizeLife[i * 4 + 3] = 0.0; //lifespan
-  }
-
-  self.particleShaderGeo.addAttribute('position', new THREE.BufferAttribute(self.particleVertices, 3));
-  self.particleShaderGeo.addAttribute('particlePositionsStartTime', new THREE.BufferAttribute(self.particlePositionsStartTime, 4).setDynamic(true));
-  self.particleShaderGeo.addAttribute('particleVelColSizeLife', new THREE.BufferAttribute(self.particleVelColSizeLife, 4).setDynamic(true));
-
-  self.posStart = self.particleShaderGeo.getAttribute('particlePositionsStartTime')
-  self.velCol = self.particleShaderGeo.getAttribute('particleVelColSizeLife');
-
-  self.particleShaderMat = self.GPUParticleSystem.particleShaderMat;
-
-  this.init = function() {
-    self.particleSystem = new THREE.Points(self.particleShaderGeo, self.particleShaderMat);
-    self.particleSystem.frustumCulled = false;
-    this.add(self.particleSystem);
-  };
-
-  var options = {},
-    position = new THREE.Vector3(),
-    velocity = new THREE.Vector3(),
-    positionRandomness = 0.,
-    velocityRandomness = 0.,
-    color = 0xffffff,
-    colorRandomness = 0.,
-    turbulence = 0.,
-    lifetime = 0.,
-    size = 0.,
-    sizeRandomness = 0.,
-    i;
-
-  var maxVel = 2;
-  var maxSource = 250;
-  this.offset = 0;
-  this.count = 0;
-
-  this.spawnParticle = function(options) {
-
-    options = options || {};
-
-    // setup reasonable default values for all arguments
-    position = options.position !== undefined ? position.copy(options.position) : position.set(0., 0., 0.);
-    velocity = options.velocity !== undefined ? velocity.copy(options.velocity) : velocity.set(0., 0., 0.);
-    positionRandomness = options.positionRandomness !== undefined ? options.positionRandomness : 0.0;
-    velocityRandomness = options.velocityRandomness !== undefined ? options.velocityRandomness : 0.0;
-    color = options.color !== undefined ? options.color : 0xffffff;
-    colorRandomness = options.colorRandomness !== undefined ? options.colorRandomness : 1.0;
-    turbulence = options.turbulence !== undefined ? options.turbulence : 1.0;
-    lifetime = options.lifetime !== undefined ? options.lifetime : 5.0;
-    size = options.size !== undefined ? options.size : 10;
-    sizeRandomness = options.sizeRandomness !== undefined ? options.sizeRandomness : 0.0,
-      smoothPosition = options.smoothPosition !== undefined ? options.smoothPosition : false;
-
-    if (self.DPR !== undefined) size *= self.DPR;
+	var self = this;
+	self.PARTICLE_COUNT = maxParticles || 100000;
+	self.PARTICLE_CURSOR = 0;
+	self.time = 0;
+	self.DPR = window.devicePixelRatio;
+	self.GPUParticleSystem = particleSystem;
+
+	var particlesPerArray = Math.floor(self.PARTICLE_COUNT / self.MAX_ATTRIBUTES);
+
+	// extend Object3D
+	THREE.Object3D.apply(this, arguments);
+
+	// construct a couple small arrays used for packing variables into floats etc
+	var UINT8_VIEW = new Uint8Array(4)
+	var FLOAT_VIEW = new Float32Array(UINT8_VIEW.buffer)
+
+	function decodeFloat(x, y, z, w) {
+		UINT8_VIEW[0] = Math.floor(w)
+		UINT8_VIEW[1] = Math.floor(z)
+		UINT8_VIEW[2] = Math.floor(y)
+		UINT8_VIEW[3] = Math.floor(x)
+		return FLOAT_VIEW[0]
+	}
+
+	function componentToHex(c) {
+		var hex = c.toString(16);
+		return hex.length == 1 ? "0" + hex : hex;
+	}
+
+	function rgbToHex(r, g, b) {
+		return "#" + componentToHex(r) + componentToHex(g) + componentToHex(b);
+	}
+
+	function hexToRgb(hex) {
+		var r = hex >> 16;
+		var g = (hex & 0x00FF00) >> 8;
+		var b = hex & 0x0000FF;
+
+		if (r > 0) r--;
+		if (g > 0) g--;
+		if (b > 0) b--;
+
+		return [r, g, b];
+	};
+
+	self.particles = [];
+	self.deadParticles = [];
+	self.particlesAvailableSlot = [];
+
+	// create a container for particles
+	self.particleUpdate = false;
+
+	// Shader Based Particle System
+	self.particleShaderGeo = new THREE.BufferGeometry();
+
+	// new hyper compressed attributes
+	self.particleVertices = new Float32Array(self.PARTICLE_COUNT * 3); // position
+	self.particlePositionsStartTime = new Float32Array(self.PARTICLE_COUNT * 4); // position
+	self.particleVelColSizeLife = new Float32Array(self.PARTICLE_COUNT * 4);
+
+	for (var i = 0; i < self.PARTICLE_COUNT; i++) {
+		self.particlePositionsStartTime[i * 4 + 0] = 100; //x
+		self.particlePositionsStartTime[i * 4 + 1] = 0; //y
+		self.particlePositionsStartTime[i * 4 + 2] = 0.0; //z
+		self.particlePositionsStartTime[i * 4 + 3] = 0.0; //startTime
+
+		self.particleVertices[i * 3 + 0] = 0; //x
+		self.particleVertices[i * 3 + 1] = 0; //y
+		self.particleVertices[i * 3 + 2] = 0.0; //z
+
+		self.particleVelColSizeLife[i * 4 + 0] = decodeFloat(128, 128, 0, 0); //vel
+		self.particleVelColSizeLife[i * 4 + 1] = decodeFloat(0, 254, 0, 254); //color
+		self.particleVelColSizeLife[i * 4 + 2] = 1.0; //size
+		self.particleVelColSizeLife[i * 4 + 3] = 0.0; //lifespan
+	}
+
+	self.particleShaderGeo.addAttribute('position', new THREE.BufferAttribute(self.particleVertices, 3));
+	self.particleShaderGeo.addAttribute('particlePositionsStartTime', new THREE.BufferAttribute(self.particlePositionsStartTime, 4).setDynamic(true));
+	self.particleShaderGeo.addAttribute('particleVelColSizeLife', new THREE.BufferAttribute(self.particleVelColSizeLife, 4).setDynamic(true));
+
+	self.posStart = self.particleShaderGeo.getAttribute('particlePositionsStartTime')
+	self.velCol = self.particleShaderGeo.getAttribute('particleVelColSizeLife');
+
+	self.particleShaderMat = self.GPUParticleSystem.particleShaderMat;
+
+	this.init = function() {
+		self.particleSystem = new THREE.Points(self.particleShaderGeo, self.particleShaderMat);
+		self.particleSystem.frustumCulled = false;
+		this.add(self.particleSystem);
+	};
+
+	var options = {},
+		position = new THREE.Vector3(),
+		velocity = new THREE.Vector3(),
+		positionRandomness = 0.,
+		velocityRandomness = 0.,
+		color = 0xffffff,
+		colorRandomness = 0.,
+		turbulence = 0.,
+		lifetime = 0.,
+		size = 0.,
+		sizeRandomness = 0.,
+		i;
+
+	var maxVel = 2;
+	var maxSource = 250;
+	this.offset = 0;
+	this.count = 0;
+
+	this.spawnParticle = function(options) {
+
+		options = options || {};
+
+		// setup reasonable default values for all arguments
+		position = options.position !== undefined ? position.copy(options.position) : position.set(0., 0., 0.);
+		velocity = options.velocity !== undefined ? velocity.copy(options.velocity) : velocity.set(0., 0., 0.);
+		positionRandomness = options.positionRandomness !== undefined ? options.positionRandomness : 0.0;
+		velocityRandomness = options.velocityRandomness !== undefined ? options.velocityRandomness : 0.0;
+		color = options.color !== undefined ? options.color : 0xffffff;
+		colorRandomness = options.colorRandomness !== undefined ? options.colorRandomness : 1.0;
+		turbulence = options.turbulence !== undefined ? options.turbulence : 1.0;
+		lifetime = options.lifetime !== undefined ? options.lifetime : 5.0;
+		size = options.size !== undefined ? options.size : 10;
+		sizeRandomness = options.sizeRandomness !== undefined ? options.sizeRandomness : 0.0,
+			smoothPosition = options.smoothPosition !== undefined ? options.smoothPosition : false;
+
+		if (self.DPR !== undefined) size *= self.DPR;
 
-    i = self.PARTICLE_CURSOR;
-
-    self.posStart.array[i * 4 + 0] = position.x + ((particleSystem.random()) * positionRandomness); // - ( velocity.x * particleSystem.random() ); //x
-    self.posStart.array[i * 4 + 1] = position.y + ((particleSystem.random()) * positionRandomness); // - ( velocity.y * particleSystem.random() ); //y
-    self.posStart.array[i * 4 + 2] = position.z + ((particleSystem.random()) * positionRandomness); // - ( velocity.z * particleSystem.random() ); //z
-    self.posStart.array[i * 4 + 3] = self.time + (particleSystem.random() * 2e-2); //startTime
-
-    if (smoothPosition === true) {
-      self.posStart.array[i * 4 + 0] += -(velocity.x * particleSystem.random()); //x
-      self.posStart.array[i * 4 + 1] += -(velocity.y * particleSystem.random()); //y
-      self.posStart.array[i * 4 + 2] += -(velocity.z * particleSystem.random()); //z
-    }
+		i = self.PARTICLE_CURSOR;
+
+		self.posStart.array[i * 4 + 0] = position.x + ((particleSystem.random()) * positionRandomness); // - ( velocity.x * particleSystem.random() ); //x
+		self.posStart.array[i * 4 + 1] = position.y + ((particleSystem.random()) * positionRandomness); // - ( velocity.y * particleSystem.random() ); //y
+		self.posStart.array[i * 4 + 2] = position.z + ((particleSystem.random()) * positionRandomness); // - ( velocity.z * particleSystem.random() ); //z
+		self.posStart.array[i * 4 + 3] = self.time + (particleSystem.random() * 2e-2); //startTime
+
+		if (smoothPosition === true) {
+			self.posStart.array[i * 4 + 0] += -(velocity.x * particleSystem.random()); //x
+			self.posStart.array[i * 4 + 1] += -(velocity.y * particleSystem.random()); //y
+			self.posStart.array[i * 4 + 2] += -(velocity.z * particleSystem.random()); //z
+		}
 
-    var velX = velocity.x + (particleSystem.random()) * velocityRandomness;
-    var velY = velocity.y + (particleSystem.random()) * velocityRandomness;
-    var velZ = velocity.z + (particleSystem.random()) * velocityRandomness;
+		var velX = velocity.x + (particleSystem.random()) * velocityRandomness;
+		var velY = velocity.y + (particleSystem.random()) * velocityRandomness;
+		var velZ = velocity.z + (particleSystem.random()) * velocityRandomness;
 
-    // convert turbulence rating to something we can pack into a vec4
-    var turbulence = Math.floor(turbulence * 254);
+		// convert turbulence rating to something we can pack into a vec4
+		var turbulence = Math.floor(turbulence * 254);
 
-    // clamp our value to between 0. and 1.
-    velX = Math.floor(maxSource * ((velX - -maxVel) / (maxVel - -maxVel)));
-    velY = Math.floor(maxSource * ((velY - -maxVel) / (maxVel - -maxVel)));
-    velZ = Math.floor(maxSource * ((velZ - -maxVel) / (maxVel - -maxVel)));
-
-    self.velCol.array[i * 4 + 0] = decodeFloat(velX, velY, velZ, turbulence); //vel
-
-    var rgb = hexToRgb(color);
-
-    for (var c = 0; c < rgb.length; c++) {
-      rgb[c] = Math.floor(rgb[c] + ((particleSystem.random()) * colorRandomness) * 254);
-      if (rgb[c] > 254) rgb[c] = 254;
-      if (rgb[c] < 0) rgb[c] = 0;
-    }
-
-    self.velCol.array[i * 4 + 1] = decodeFloat(rgb[0], rgb[1], rgb[2], 254); //color
-    self.velCol.array[i * 4 + 2] = size + (particleSystem.random()) * sizeRandomness; //size
-    self.velCol.array[i * 4 + 3] = lifetime; //lifespan
-
-    if (this.offset == 0) {
-      this.offset = self.PARTICLE_CURSOR;
-    }
-
-    self.count++;
+		// clamp our value to between 0. and 1.
+		velX = Math.floor(maxSource * ((velX - -maxVel) / (maxVel - -maxVel)));
+		velY = Math.floor(maxSource * ((velY - -maxVel) / (maxVel - -maxVel)));
+		velZ = Math.floor(maxSource * ((velZ - -maxVel) / (maxVel - -maxVel)));
+
+		self.velCol.array[i * 4 + 0] = decodeFloat(velX, velY, velZ, turbulence); //vel
+
+		var rgb = hexToRgb(color);
+
+		for (var c = 0; c < rgb.length; c++) {
+			rgb[c] = Math.floor(rgb[c] + ((particleSystem.random()) * colorRandomness) * 254);
+			if (rgb[c] > 254) rgb[c] = 254;
+			if (rgb[c] < 0) rgb[c] = 0;
+		}
+
+		self.velCol.array[i * 4 + 1] = decodeFloat(rgb[0], rgb[1], rgb[2], 254); //color
+		self.velCol.array[i * 4 + 2] = size + (particleSystem.random()) * sizeRandomness; //size
+		self.velCol.array[i * 4 + 3] = lifetime; //lifespan
+
+		if (this.offset == 0) {
+			this.offset = self.PARTICLE_CURSOR;
+		}
+
+		self.count++;
 
-    self.PARTICLE_CURSOR++;
+		self.PARTICLE_CURSOR++;
 
-    if (self.PARTICLE_CURSOR >= self.PARTICLE_COUNT) {
-      self.PARTICLE_CURSOR = 0;
-    }
+		if (self.PARTICLE_CURSOR >= self.PARTICLE_COUNT) {
+			self.PARTICLE_CURSOR = 0;
+		}
 
-    self.particleUpdate = true;
+		self.particleUpdate = true;
 
-  }
+	}
 
-  this.update = function(time) {
+	this.update = function(time) {
 
-    self.time = time;
-    self.particleShaderMat.uniforms['uTime'].value = time;
+		self.time = time;
+		self.particleShaderMat.uniforms['uTime'].value = time;
 
-    this.geometryUpdate();
+		this.geometryUpdate();
 
-  };
+	};
 
-  this.geometryUpdate = function() {
-    if (self.particleUpdate == true) {
-      self.particleUpdate = false;
+	this.geometryUpdate = function() {
+		if (self.particleUpdate == true) {
+			self.particleUpdate = false;
 
-      // if we can get away with a partial buffer update, do so
-      if (self.offset + self.count < self.PARTICLE_COUNT) {
-        self.posStart.updateRange.offset = self.velCol.updateRange.offset = self.offset * 4;
-        self.posStart.updateRange.count = self.velCol.updateRange.count = self.count * 4;
-      } else {
-        self.posStart.updateRange.offset = 0;
-        self.posStart.updateRange.count = self.velCol.updateRange.count = (self.PARTICLE_COUNT * 4);
-      }
+			// if we can get away with a partial buffer update, do so
+			if (self.offset + self.count < self.PARTICLE_COUNT) {
+				self.posStart.updateRange.offset = self.velCol.updateRange.offset = self.offset * 4;
+				self.posStart.updateRange.count = self.velCol.updateRange.count = self.count * 4;
+			} else {
+				self.posStart.updateRange.offset = 0;
+				self.posStart.updateRange.count = self.velCol.updateRange.count = (self.PARTICLE_COUNT * 4);
+			}
 
-      self.posStart.needsUpdate = true;
-      self.velCol.needsUpdate = true;
+			self.posStart.needsUpdate = true;
+			self.velCol.needsUpdate = true;
 
-      self.offset = 0;
-      self.count = 0;
-    }
-  }
+			self.offset = 0;
+			self.count = 0;
+		}
+	}
 
-  this.init();
+	this.init();
 
 }
 

+ 4 - 3
examples/js/Mirror.js

@@ -4,9 +4,10 @@
 
 THREE.ShaderLib[ 'mirror' ] = {
 
-	uniforms: { "mirrorColor": { type: "c", value: new THREE.Color( 0x7F7F7F ) },
-				"mirrorSampler": { type: "t", value: null },
-				"textureMatrix" : { type: "m4", value: new THREE.Matrix4() }
+	uniforms: {
+		"mirrorColor": { value: new THREE.Color( 0x7F7F7F ) },
+		"mirrorSampler": { value: null },
+		"textureMatrix" : { value: new THREE.Matrix4() }
 	},
 
 	vertexShader: [

+ 20 - 20
examples/js/Ocean.js

@@ -97,9 +97,9 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: "#define HORIZONTAL \n" + oceanHorizontalShader.fragmentShader
 	} );
-	this.materialOceanHorizontal.uniforms.u_transformSize = { type: "f", value: this.resolution };
-	this.materialOceanHorizontal.uniforms.u_subtransformSize = { type: "f", value: null };
-	this.materialOceanHorizontal.uniforms.u_input = { type: "t", value: null };
+	this.materialOceanHorizontal.uniforms.u_transformSize = { value: this.resolution };
+	this.materialOceanHorizontal.uniforms.u_subtransformSize = { value: null };
+	this.materialOceanHorizontal.uniforms.u_input = { value: null };
 	this.materialOceanHorizontal.depthTest = false;
 
 	// 2 - Vertical wave vertices used for FFT
@@ -110,9 +110,9 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: oceanVerticalShader.fragmentShader
 	} );
-	this.materialOceanVertical.uniforms.u_transformSize = { type: "f", value: this.resolution };
-	this.materialOceanVertical.uniforms.u_subtransformSize = { type: "f", value: null };
-	this.materialOceanVertical.uniforms.u_input = { type: "t", value: null };
+	this.materialOceanVertical.uniforms.u_transformSize = { value: this.resolution };
+	this.materialOceanVertical.uniforms.u_subtransformSize = { value: null };
+	this.materialOceanVertical.uniforms.u_input = { value: null };
 	this.materialOceanVertical.depthTest = false;
 
 	// 3 - Initial spectrum used to generate height map
@@ -123,8 +123,8 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: initialSpectrumShader.fragmentShader
 	} );
-	this.materialInitialSpectrum.uniforms.u_wind = { type: "v2", value: new THREE.Vector2() };
-	this.materialInitialSpectrum.uniforms.u_resolution = { type: "f", value: this.resolution };
+	this.materialInitialSpectrum.uniforms.u_wind = { value: new THREE.Vector2() };
+	this.materialInitialSpectrum.uniforms.u_resolution = { value: this.resolution };
 	this.materialInitialSpectrum.depthTest = false;
 
 	// 4 - Phases used to animate heightmap
@@ -135,7 +135,7 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: phaseShader.fragmentShader
 	} );
-	this.materialPhase.uniforms.u_resolution = { type: "f", value: this.resolution };
+	this.materialPhase.uniforms.u_resolution = { value: this.resolution };
 	this.materialPhase.depthTest = false;
 
 	// 5 - Shader used to update spectrum
@@ -146,8 +146,8 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: spectrumShader.fragmentShader
 	} );
-	this.materialSpectrum.uniforms.u_initialSpectrum = { type: "t", value: null };
-	this.materialSpectrum.uniforms.u_resolution = { type: "f", value: this.resolution };
+	this.materialSpectrum.uniforms.u_initialSpectrum = { value: null };
+	this.materialSpectrum.uniforms.u_resolution = { value: this.resolution };
 	this.materialSpectrum.depthTest = false;
 
 	// 6 - Shader used to update spectrum normals
@@ -158,8 +158,8 @@
 		vertexShader: fullscreeenVertexShader.vertexShader,
 		fragmentShader: normalShader.fragmentShader
 	} );
-	this.materialNormal.uniforms.u_displacementMap = { type: "t", value: null };
-	this.materialNormal.uniforms.u_resolution = { type: "f", value: this.resolution };
+	this.materialNormal.uniforms.u_displacementMap = { value: null };
+	this.materialNormal.uniforms.u_resolution = { value: this.resolution };
 	this.materialNormal.depthTest = false;
 
 	// 7 - Shader used to update normals
@@ -171,13 +171,13 @@
 		fragmentShader: oceanShader.fragmentShader
 	} );
 	// this.materialOcean.wireframe = true;
-	this.materialOcean.uniforms.u_geometrySize = { type: "f", value: this.resolution };
-	this.materialOcean.uniforms.u_displacementMap = { type: "t", value: this.displacementMapFramebuffer.texture };
-	this.materialOcean.uniforms.u_normalMap = { type: "t", value: this.normalMapFramebuffer.texture };
-	this.materialOcean.uniforms.u_oceanColor = { type: "v3", value: this.oceanColor };
-	this.materialOcean.uniforms.u_skyColor = { type: "v3", value: this.skyColor };
-	this.materialOcean.uniforms.u_sunDirection = { type: "v3", value: new THREE.Vector3( this.sunDirectionX, this.sunDirectionY, this.sunDirectionZ ) };
-	this.materialOcean.uniforms.u_exposure = { type: "f", value: this.exposure };
+	this.materialOcean.uniforms.u_geometrySize = { value: this.resolution };
+	this.materialOcean.uniforms.u_displacementMap = { value: this.displacementMapFramebuffer.texture };
+	this.materialOcean.uniforms.u_normalMap = { value: this.normalMapFramebuffer.texture };
+	this.materialOcean.uniforms.u_oceanColor = { value: this.oceanColor };
+	this.materialOcean.uniforms.u_skyColor = { value: this.skyColor };
+	this.materialOcean.uniforms.u_sunDirection = { value: new THREE.Vector3( this.sunDirectionX, this.sunDirectionY, this.sunDirectionZ ) };
+	this.materialOcean.uniforms.u_exposure = { value: this.exposure };
 
 	// Disable blending to prevent default premultiplied alpha values
 	this.materialOceanHorizontal.blending = 0;

+ 0 - 13
examples/js/ShaderGodRays.js

@@ -44,17 +44,12 @@ THREE.ShaderGodRays = {
 		uniforms: {
 
 			tInput: {
-				type: "t",
 				value: null
 			},
-
 			fStepSize: {
-				type: "f",
 				value: 1.0
 			},
-
 			vSunPositionScreenSpace: {
-				type: "v2",
 				value: new THREE.Vector2( 0.5, 0.5 )
 			}
 
@@ -171,22 +166,18 @@ THREE.ShaderGodRays = {
 		uniforms: {
 
 			tColors: {
-				type: "t",
 				value: null
 			},
 
 			tGodRays: {
-				type: "t",
 				value: null
 			},
 
 			fGodRayIntensity: {
-				type: "f",
 				value: 0.69
 			},
 
 			vSunPositionScreenSpace: {
-				type: "v2",
 				value: new THREE.Vector2( 0.5, 0.5 )
 			}
 
@@ -241,22 +232,18 @@ THREE.ShaderGodRays = {
 		uniforms: {
 
 			vSunPositionScreenSpace: {
-				type: "v2",
 				value: new THREE.Vector2( 0.5, 0.5 )
 			},
 
 			fAspect: {
-				type: "f",
 				value: 1.0
 			},
 
 			sunColor: {
-				type: "c",
 				value: new THREE.Color( 0xffee00 )
 			},
 
 			bgColor: {
-				type: "c",
 				value: new THREE.Color( 0x000000 )
 			}
 

+ 28 - 28
examples/js/ShaderSkin.js

@@ -29,27 +29,27 @@ THREE.ShaderSkin = {
 
 			{
 
-				"enableBump"	: { type: "i", value: 0 },
-				"enableSpecular": { type: "i", value: 0 },
+				"enableBump": { value: 0 },
+				"enableSpecular": { value: 0 },
 
-				"tDiffuse"	: { type: "t", value: null },
-				"tBeckmann"	: { type: "t", value: null },
+				"tDiffuse": { value: null },
+				"tBeckmann": { value: null },
 
-				"diffuse":  { type: "c", value: new THREE.Color( 0xeeeeee ) },
-				"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
-				"opacity": 	  { type: "f", value: 1 },
+				"diffuse": { value: new THREE.Color( 0xeeeeee ) },
+				"specular": { value: new THREE.Color( 0x111111 ) },
+				"opacity": { value: 1 },
 
-				"uRoughness": 	  		{ type: "f", value: 0.15 },
-				"uSpecularBrightness": 	{ type: "f", value: 0.75 },
+				"uRoughness": { value: 0.15 },
+				"uSpecularBrightness": { value: 0.75 },
 
-				"bumpMap"	: { type: "t", value: null },
-				"bumpScale" : { type: "f", value: 1 },
+				"bumpMap": { value: null },
+				"bumpScale": { value: 1 },
 
-				"specularMap" : { type: "t", value: null },
+				"specularMap": { value: null },
 
-				"offsetRepeat" : { type: "v4", value: new THREE.Vector4( 0, 0, 1, 1 ) },
+				"offsetRepeat": { value: new THREE.Vector4( 0, 0, 1, 1 ) },
 
-				"uWrapRGB":	{ type: "v3", value: new THREE.Vector3( 0.75, 0.375, 0.1875 ) }
+				"uWrapRGB": { value: new THREE.Vector3( 0.75, 0.375, 0.1875 ) }
 
 			}
 
@@ -312,26 +312,26 @@ THREE.ShaderSkin = {
 
 			{
 
-				"passID": { type: "i", value: 0 },
+				"passID": { value: 0 },
 
-				"tDiffuse"	: { type: "t", value: null },
-				"tNormal"	: { type: "t", value: null },
+				"tDiffuse"	: { value: null },
+				"tNormal"	: { value: null },
 
-				"tBlur1"	: { type: "t", value: null },
-				"tBlur2"	: { type: "t", value: null },
-				"tBlur3"	: { type: "t", value: null },
-				"tBlur4"	: { type: "t", value: null },
+				"tBlur1"	: { value: null },
+				"tBlur2"	: { value: null },
+				"tBlur3"	: { value: null },
+				"tBlur4"	: { value: null },
 
-				"tBeckmann"	: { type: "t", value: null },
+				"tBeckmann"	: { value: null },
 
-				"uNormalScale": { type: "f", value: 1.0 },
+				"uNormalScale": { value: 1.0 },
 
-				"diffuse":  { type: "c", value: new THREE.Color( 0xeeeeee ) },
-				"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
-				"opacity": 	  { type: "f", value: 1 },
+				"diffuse":  { value: new THREE.Color( 0xeeeeee ) },
+				"specular": { value: new THREE.Color( 0x111111 ) },
+				"opacity": 	  { value: 1 },
 
-				"uRoughness": 	  		{ type: "f", value: 0.15 },
-				"uSpecularBrightness": 	{ type: "f", value: 0.75 }
+				"uRoughness": 	  		{ value: 0.15 },
+				"uSpecularBrightness": 	{ value: 0.75 }
 
 			}
 

+ 20 - 20
examples/js/ShaderTerrain.js

@@ -22,32 +22,32 @@ THREE.ShaderTerrain = {
 
 			{
 
-				"enableDiffuse1"  : { type: "i", value: 0 },
-				"enableDiffuse2"  : { type: "i", value: 0 },
-				"enableSpecular"  : { type: "i", value: 0 },
-				"enableReflection": { type: "i", value: 0 },
+				"enableDiffuse1": { value: 0 },
+				"enableDiffuse2": { value: 0 },
+				"enableSpecular": { value: 0 },
+				"enableReflection": { value: 0 },
 
-				"tDiffuse1"	   : { type: "t", value: null },
-				"tDiffuse2"	   : { type: "t", value: null },
-				"tDetail"	   : { type: "t", value: null },
-				"tNormal"	   : { type: "t", value: null },
-				"tSpecular"	   : { type: "t", value: null },
-				"tDisplacement": { type: "t", value: null },
+				"tDiffuse1": { value: null },
+				"tDiffuse2": { value: null },
+				"tDetail": { value: null },
+				"tNormal": { value: null },
+				"tSpecular": { value: null },
+				"tDisplacement": { value: null },
 
-				"uNormalScale": { type: "f", value: 1.0 },
+				"uNormalScale": { value: 1.0 },
 
-				"uDisplacementBias": { type: "f", value: 0.0 },
-				"uDisplacementScale": { type: "f", value: 1.0 },
+				"uDisplacementBias": { value: 0.0 },
+				"uDisplacementScale": { value: 1.0 },
 
-				"diffuse": { type: "c", value: new THREE.Color( 0xeeeeee ) },
-				"specular": { type: "c", value: new THREE.Color( 0x111111 ) },
-				"shininess": { type: "f", value: 30 },
-				"opacity": { type: "f", value: 1 },
+				"diffuse": { value: new THREE.Color( 0xeeeeee ) },
+				"specular": { value: new THREE.Color( 0x111111 ) },
+				"shininess": { value: 30 },
+				"opacity": { value: 1 },
 
-				"uRepeatBase"    : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
-				"uRepeatOverlay" : { type: "v2", value: new THREE.Vector2( 1, 1 ) },
+				"uRepeatBase": { value: new THREE.Vector2( 1, 1 ) },
+				"uRepeatOverlay": { value: new THREE.Vector2( 1, 1 ) },
 
-				"uOffset" : { type: "v2", value: new THREE.Vector2( 0, 0 ) }
+				"uOffset": { value: new THREE.Vector2( 0, 0 ) }
 
 			}
 

+ 25 - 25
examples/js/ShaderToon.js

@@ -16,12 +16,12 @@ THREE.ShaderToon = {
 
 		uniforms: {
 
-			"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-			"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+			"uDirLightPos": { value: new THREE.Vector3() },
+			"uDirLightColor": { value: new THREE.Color( 0xeeeeee ) },
 
-			"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+			"uAmbientLightColor": { value: new THREE.Color( 0x050505 ) },
 
-			"uBaseColor":  { type: "c", value: new THREE.Color( 0xffffff ) }
+			"uBaseColor": { value: new THREE.Color( 0xffffff ) }
 
 		},
 
@@ -92,16 +92,16 @@ THREE.ShaderToon = {
 
 		uniforms: {
 
-			"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-			"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+			"uDirLightPos": { value: new THREE.Vector3() },
+			"uDirLightColor": { value: new THREE.Color( 0xeeeeee ) },
 
-			"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+			"uAmbientLightColor": { value: new THREE.Color( 0x050505 ) },
 
-			"uBaseColor":  { type: "c", value: new THREE.Color( 0xeeeeee ) },
-			"uLineColor1": { type: "c", value: new THREE.Color( 0x808080 ) },
-			"uLineColor2": { type: "c", value: new THREE.Color( 0x000000 ) },
-			"uLineColor3": { type: "c", value: new THREE.Color( 0x000000 ) },
-			"uLineColor4": { type: "c", value: new THREE.Color( 0x000000 ) }
+			"uBaseColor": { value: new THREE.Color( 0xeeeeee ) },
+			"uLineColor1": { value: new THREE.Color( 0x808080 ) },
+			"uLineColor2": { value: new THREE.Color( 0x000000 ) },
+			"uLineColor3": { value: new THREE.Color( 0x000000 ) },
+			"uLineColor4": { value: new THREE.Color( 0x000000 ) }
 
 		},
 
@@ -162,16 +162,16 @@ THREE.ShaderToon = {
 
 		uniforms: {
 
-			"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-			"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+			"uDirLightPos":	{ value: new THREE.Vector3() },
+			"uDirLightColor": { value: new THREE.Color( 0xeeeeee ) },
 
-			"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+			"uAmbientLightColor": { value: new THREE.Color( 0x050505 ) },
 
-			"uBaseColor":  { type: "c", value: new THREE.Color( 0xffffff ) },
-			"uLineColor1": { type: "c", value: new THREE.Color( 0x000000 ) },
-			"uLineColor2": { type: "c", value: new THREE.Color( 0x000000 ) },
-			"uLineColor3": { type: "c", value: new THREE.Color( 0x000000 ) },
-			"uLineColor4": { type: "c", value: new THREE.Color( 0x000000 ) }
+			"uBaseColor":  { value: new THREE.Color( 0xffffff ) },
+			"uLineColor1": { value: new THREE.Color( 0x000000 ) },
+			"uLineColor2": { value: new THREE.Color( 0x000000 ) },
+			"uLineColor3": { value: new THREE.Color( 0x000000 ) },
+			"uLineColor4": { value: new THREE.Color( 0x000000 ) }
 
 		},
 
@@ -257,13 +257,13 @@ THREE.ShaderToon = {
 
 		uniforms: {
 
-			"uDirLightPos":	{ type: "v3", value: new THREE.Vector3() },
-			"uDirLightColor": { type: "c", value: new THREE.Color( 0xeeeeee ) },
+			"uDirLightPos":	{ value: new THREE.Vector3() },
+			"uDirLightColor": { value: new THREE.Color( 0xeeeeee ) },
 
-			"uAmbientLightColor": { type: "c", value: new THREE.Color( 0x050505 ) },
+			"uAmbientLightColor": { value: new THREE.Color( 0x050505 ) },
 
-			"uBaseColor":  { type: "c", value: new THREE.Color( 0xffffff ) },
-			"uLineColor1": { type: "c", value: new THREE.Color( 0x000000 ) }
+			"uBaseColor":  { value: new THREE.Color( 0xffffff ) },
+			"uLineColor1": { value: new THREE.Color( 0x000000 ) }
 
 		},
 

+ 0 - 233
examples/js/SimulationRenderer.js

@@ -1,233 +0,0 @@
-/**
- * @author zz85 https://github.com/zz85 / http://www.lab4games.net/zz85/blog
- *
- * Bird Simulation Render
- *
- * 	A simple scene rendering a quad of the following shaders
- *	1. Pass-thru Shader,
- *	2. Bird Position Update Shader,
- *	3. Bird Velocity Update Shader
- *
- */
-
-function SimulationRenderer( WIDTH, renderer ) {
-
-	WIDTH = WIDTH || 4;
-	var camera = new THREE.Camera();
-	camera.position.z = 1;
-
-	if ( ! renderer.extensions.get( "OES_texture_float" ) ) {
-
-		alert( "No OES_texture_float support for float textures!" );
-		return;
-
-	}
-
-	if ( renderer.capabilities.maxVertexTextures === 0 ) {
-
-		alert( "No support for vertex shader textures!" );
-		return;
-
-	}
-
-	var scene = new THREE.Scene();
-
-	var uniforms = {
-		time: { type: "f", value: 1.0 },
-		resolution: { type: "v2", value: new THREE.Vector2( WIDTH, WIDTH ) },
-		texture: { type: "t", value: null }
-	};
-
-	var passThruShader = new THREE.ShaderMaterial( {
-		uniforms: uniforms,
-		vertexShader: document.getElementById( 'vertexShader' ).textContent,
-		fragmentShader: document.getElementById( 'fragmentShader' ).textContent
-	} );
-
-	var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), passThruShader );
-
-	var positionShader = new THREE.ShaderMaterial( {
-
-		uniforms: {
-			time: { type: "f", value: 1.0 },
-			delta: { type: "f", value: 0.0 },
-			resolution: { type: "v2", value: new THREE.Vector2( WIDTH, WIDTH ) },
-			texturePosition: { type: "t", value: null },
-			textureVelocity: { type: "t", value: null },
-		},
-		vertexShader: document.getElementById( 'vertexShader' ).textContent,
-		fragmentShader: document.getElementById( 'fragmentShaderPosition' ).textContent
-
-	} );
-
-	this.positionShader = positionShader;
-
-	var velocityShader = new THREE.ShaderMaterial( {
-
-		uniforms: {
-			time: { type: "f", value: 1.0 },
-			delta: { type: "f", value: 0.0 },
-			resolution: { type: "v2", value: new THREE.Vector2( WIDTH, WIDTH ) },
-			texturePosition: { type: "t", value: null },
-			textureVelocity: { type: "t", value: null },
-			testing: { type: "f", value: 1.0 },
-			seperationDistance: { type: "f", value: 1.0 },
-			alignmentDistance: { type: "f", value: 1.0 },
-			cohesionDistance: { type: "f", value: 1.0 },
-			freedomFactor: { type: "f", value: 1.0 },
-			predator: { type: "v3", value: new THREE.Vector3() }
-		},
-		defines: {
-			WIDTH: WIDTH.toFixed( 2 )
-		},
-		vertexShader: document.getElementById( 'vertexShader' ).textContent,
-		fragmentShader: document.getElementById( 'fragmentShaderVelocity' ).textContent
-
-	} );
-
-	this.velocityUniforms = velocityShader.uniforms;
-
-	scene.add( mesh );
-
-	var flipflop = true;
-	var rtPosition1, rtPosition2, rtVelocity1, rtVelocity2;
-
-	function init() {
-
-		var dtPosition = generatePositionTexture();
-		var dtVelocity = generateVelocityTexture();
-
-		rtPosition1 = getRenderTarget( THREE.RGBAFormat );
-		rtPosition2 = rtPosition1.clone();
-		rtVelocity1 = getRenderTarget( THREE.RGBAFormat );
-		rtVelocity2 = rtVelocity1.clone();
-
-		simulator.renderTexture( dtPosition, rtPosition1 );
-		simulator.renderTexture( rtPosition1.texture, rtPosition2 );
-
-		simulator.renderTexture( dtVelocity, rtVelocity1 );
-		simulator.renderTexture( rtVelocity1.texture, rtVelocity2 );
-
-		simulator.velocityUniforms.testing.value = 10;
-
-	}
-
-	this.init = init;
-
-	function getRenderTarget( type ) {
-
-		var renderTarget = new THREE.WebGLRenderTarget( WIDTH, WIDTH, {
-			wrapS: THREE.RepeatWrapping,
-			wrapT: THREE.RepeatWrapping,
-			minFilter: THREE.NearestFilter,
-			magFilter: THREE.NearestFilter,
-			format: type,
-			type: THREE.FloatType,
-			stencilBuffer: false
-		} );
-
-		return renderTarget;
-
-	}
-
-	// Takes a texture, and render out as another texture
-	this.renderTexture = function ( input, output ) {
-
-		mesh.material = passThruShader;
-		uniforms.texture.value = input;
-		renderer.render( scene, camera, output );
-
-	};
-
-
-	this.renderPosition = function( position, velocity, output, delta ) {
-
-		mesh.material = positionShader;
-		positionShader.uniforms.texturePosition.value = position;
-		positionShader.uniforms.textureVelocity.value = velocity;
-		positionShader.uniforms.time.value = performance.now();
-		positionShader.uniforms.delta.value = delta;
-		renderer.render( scene, camera, output );
-		this.currentPosition = output.texture;
-
-	};
-
-	this.renderVelocity = function( position, velocity, output, delta ) {
-
-		mesh.material = velocityShader;
-		velocityShader.uniforms.texturePosition.value = position;
-		velocityShader.uniforms.textureVelocity.value = velocity;
-		velocityShader.uniforms.time.value = performance.now();
-		velocityShader.uniforms.delta.value = delta;
-		renderer.render( scene, camera, output );
-		this.currentVelocity = output.texture;
-
-	};
-
-	this.simulate = function( delta ) {
-
-		if ( flipflop ) {
-
-			simulator.renderVelocity( rtPosition1.texture, rtVelocity1.texture, rtVelocity2, delta );
-			simulator.renderPosition( rtPosition1.texture, rtVelocity2.texture, rtPosition2, delta );
-
-		} else {
-
-			simulator.renderVelocity( rtPosition2.texture, rtVelocity2.texture, rtVelocity1, delta );
-			simulator.renderPosition( rtPosition2.texture, rtVelocity1.texture, rtPosition1, delta );
-
-		}
-
-		flipflop = ! flipflop;
-
-	};
-
-	function generatePositionTexture() {
-
-		var a = new Float32Array( PARTICLES * 4 );
-
-		for ( var k = 0, kl = a.length; k < kl; k += 4 ) {
-
-			var x = Math.random() * BOUNDS - BOUNDS_HALF;
-			var y = Math.random() * BOUNDS - BOUNDS_HALF;
-			var z = Math.random() * BOUNDS - BOUNDS_HALF;
-
-			a[ k + 0 ] = x;
-			a[ k + 1 ] = y;
-			a[ k + 2 ] = z;
-			a[ k + 3 ] = 1;
-
-		}
-
-		var texture = new THREE.DataTexture( a, WIDTH, WIDTH, THREE.RGBAFormat, THREE.FloatType );
-		texture.needsUpdate = true;
-
-		return texture;
-
-	}
-
-	function generateVelocityTexture() {
-
-		var a = new Float32Array( PARTICLES * 4 );
-
-		for ( var k = 0, kl = a.length; k < kl; k += 4 ) {
-
-			var x = Math.random() - 0.5;
-			var y = Math.random() - 0.5;
-			var z = Math.random() - 0.5;
-
-			a[ k + 0 ] = x * 10;
-			a[ k + 1 ] = y * 10;
-			a[ k + 2 ] = z * 10;
-			a[ k + 3 ] = 1;
-
-		}
-
-		var texture = new THREE.DataTexture( a, WIDTH, WIDTH, THREE.RGBAFormat, THREE.FloatType ); // was RGB format. changed to RGBA format. see discussion in #8415 / #8450
-		texture.needsUpdate = true;
-
-		return texture;
-
-	}
-
-}

+ 10 - 7
examples/js/SkyShader.js

@@ -18,12 +18,12 @@ THREE.ShaderLib[ 'sky' ] = {
 
 	uniforms: {
 
-		luminance:	 { type: "f", value: 1 },
-		turbidity:	 { type: "f", value: 2 },
-		reileigh:	 { type: "f", value: 1 },
-		mieCoefficient:	 { type: "f", value: 0.005 },
-		mieDirectionalG: { type: "f", value: 0.8 },
-		sunPosition: 	 { type: "v3", value: new THREE.Vector3() }
+		luminance: { value: 1 },
+		turbidity: { value: 2 },
+		reileigh: { value: 1 },
+		mieCoefficient: { value: 0.005 },
+		mieDirectionalG: { value: 0.8 },
+		sunPosition: { value: new THREE.Vector3() }
 
 	},
 
@@ -126,7 +126,10 @@ THREE.ShaderLib[ 'sky' ] = {
 
 		"float sunIntensity(float zenithAngleCos)",
 		"{",
-			"return EE * max(0.0, 1.0 - exp(-((cutoffAngle - acos(zenithAngleCos))/steepness)));",
+		// This function originally used `exp(n)`, but it returns an incorrect value
+		// on Samsung S6 phones. So it has been replaced with the equivalent `pow(e, n)`.
+		// See https://github.com/mrdoob/three.js/issues/8382
+			"return EE * max(0.0, 1.0 - pow(e, -((cutoffAngle - acos(zenithAngleCos))/steepness)));",
 		"}",
 
 		"// float logLuminance(vec3 c)",

+ 41 - 0
examples/js/ViveController.js

@@ -0,0 +1,41 @@
+THREE.ViveController = function ( id ) {
+
+	THREE.Object3D.call( this );
+
+	this.matrixAutoUpdate = false;
+	this.standingMatrix = new THREE.Matrix4();
+
+	var scope = this;
+
+	function update() {
+
+		requestAnimationFrame( update );
+
+		var gamepad = navigator.getGamepads()[ id ];
+
+		if ( gamepad !== undefined && gamepad.pose !== null ) {
+
+			var pose = gamepad.pose;
+
+			scope.position.fromArray( pose.position );
+			scope.quaternion.fromArray( pose.orientation );
+			scope.matrix.compose( scope.position, scope.quaternion, scope.scale );
+			scope.matrix.multiplyMatrices( scope.standingMatrix, scope.matrix );
+			scope.matrixWorldNeedsUpdate = true;
+
+			scope.visible = true;
+
+		} else {
+
+			scope.visible = false;
+
+		}
+
+	}
+
+	update();
+
+};
+
+THREE.ViveController.prototype = Object.create( THREE.Object3D.prototype );
+THREE.ViveController.prototype.constructor = THREE.ViveController;

+ 11 - 11
examples/js/WaterShader.js

@@ -11,17 +11,17 @@ THREE.ShaderLib[ 'water' ] = {
 
 	uniforms: THREE.UniformsUtils.merge( [
 		THREE.UniformsLib[ "fog" ], {
-			"normalSampler":    { type: "t", value: null },
-			"mirrorSampler":    { type: "t", value: null },
-			"alpha":            { type: "f", value: 1.0 },
-			"time":             { type: "f", value: 0.0 },
-			"distortionScale":  { type: "f", value: 20.0 },
-			"noiseScale":       { type: "f", value: 1.0 },
-			"textureMatrix" :   { type: "m4", value: new THREE.Matrix4() },
-			"sunColor":         { type: "c", value: new THREE.Color( 0x7F7F7F ) },
-			"sunDirection":     { type: "v3", value: new THREE.Vector3( 0.70707, 0.70707, 0 ) },
-			"eye":              { type: "v3", value: new THREE.Vector3() },
-			"waterColor":       { type: "c", value: new THREE.Color( 0x555555 ) }
+			"normalSampler":    { value: null },
+			"mirrorSampler":    { value: null },
+			"alpha":            { value: 1.0 },
+			"time":             { value: 0.0 },
+			"distortionScale":  { value: 20.0 },
+			"noiseScale":       { value: 1.0 },
+			"textureMatrix" :   { value: new THREE.Matrix4() },
+			"sunColor":         { value: new THREE.Color( 0x7F7F7F ) },
+			"sunDirection":     { value: new THREE.Vector3( 0.70707, 0.70707, 0 ) },
+			"eye":              { value: new THREE.Vector3() },
+			"waterColor":       { value: new THREE.Color( 0x555555 ) }
 		}
 	] ),
 

+ 10 - 2
examples/js/WebVR.js

@@ -72,8 +72,9 @@ var WEBVR = {
 
 		var button = document.createElement( 'button' );
 		button.style.position = 'absolute';
-		button.style.left = 'calc(50% - 30px)';
+		button.style.left = 'calc(50% - 50px)';
 		button.style.bottom = '20px';
+		button.style.width = '100px';
 		button.style.border = '0';
 		button.style.padding = '8px';
 		button.style.cursor = 'pointer';
@@ -82,14 +83,21 @@ var WEBVR = {
 		button.style.fontFamily = 'sans-serif';
 		button.style.fontSize = '13px';
 		button.style.fontStyle = 'normal';
+		button.style.textAlign = 'center';
 		button.style.zIndex = '999';
 		button.textContent = 'ENTER VR';
 		button.onclick = function() {
 
-			effect.setFullScreen( true );
+			effect.isPresenting ? effect.exitPresent() : effect.requestPresent();
 
 		};
 
+		window.addEventListener( 'vrdisplaypresentchange', function ( event ) {
+
+			button.textContent = effect.isPresenting ? 'EXIT VR' : 'ENTER VR';
+
+		}, false );
+
 		return button;
 
 	}

+ 17 - 3
examples/js/controls/TransformControls.js

@@ -1,7 +1,6 @@
 /**
  * @author arodic / https://github.com/arodic
  */
- /*jshint sub:true*/
 
 ( function () {
 
@@ -1101,17 +1100,32 @@
 
 		function onPointerUp( event ) {
 
+			event.preventDefault(); // Prevent MouseEvent on mobile
+
 			if ( event.button !== undefined && event.button !== 0 ) return;
 
 			if ( _dragging && ( scope.axis !== null ) ) {
 
 				mouseUpEvent.mode = _mode;
-				scope.dispatchEvent( mouseUpEvent )
+				scope.dispatchEvent( mouseUpEvent );
 
 			}
 
 			_dragging = false;
-			onPointerHover( event );
+
+			if ( event instanceof TouchEvent ) {
+
+				// Force "rollover"
+
+				scope.axis = null;
+				scope.update();
+				scope.dispatchEvent( changeEvent );
+
+			} else {
+
+				onPointerHover( event );
+
+			}
 
 		}
 

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

@@ -58,6 +58,12 @@ THREE.VRControls = function ( object, onError ) {
 	// standing=true but the VRDisplay doesn't provide stageParameters.
 	this.userHeight = 1.6;
 
+	this.getStandingMatrix = function () {
+
+		return standingMatrix;
+
+	};
+
 	this.update = function () {
 
 		if ( vrInput ) {

+ 1 - 7
examples/js/crossfade/transition.js

@@ -13,27 +13,21 @@ function Transition ( sceneA, sceneB ) {
 		uniforms: {
 
 			tDiffuse1: {
-				type: "t",
 				value: null
 			},
 			tDiffuse2: {
-				type: "t",
 				value: null
 			},
 			mixRatio: {
-				type: "f",
 				value: 0.0
 			},
 			threshold: {
-				type: "f",
 				value: 0.1
 			},
 			useTexture: {
-				type: "i",
-				value: 1,
+				value: 1
 			},
 			tMixTexture: {
-				type: "t",
 				value: this.textures[ 0 ]
 			}
 		},

+ 4 - 4
examples/js/effects/AnaglyphEffect.js

@@ -46,11 +46,11 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
 
 		uniforms: {
 
-			"mapLeft": { type: "t", value: _renderTargetL.texture },
-			"mapRight": { type: "t", value: _renderTargetR.texture },
+			"mapLeft": { value: _renderTargetL.texture },
+			"mapRight": { value: _renderTargetR.texture },
 
-			"colorMatrixLeft": { type: "m3", value: this.colorMatrixLeft },
-			"colorMatrixRight": { type: "m3", value: this.colorMatrixRight }
+			"colorMatrixLeft": { value: this.colorMatrixLeft },
+			"colorMatrixRight": { value: this.colorMatrixRight }
 
 		},
 

+ 2 - 2
examples/js/effects/ParallaxBarrierEffect.js

@@ -21,8 +21,8 @@ THREE.ParallaxBarrierEffect = function ( renderer ) {
 
 		uniforms: {
 
-			"mapLeft": { type: "t", value: _renderTargetL.texture },
-			"mapRight": { type: "t", value: _renderTargetR.texture }
+			"mapLeft": { value: _renderTargetL.texture },
+			"mapRight": { value: _renderTargetR.texture }
 
 		},
 

+ 10 - 8
examples/js/effects/VREffect.js

@@ -59,9 +59,10 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	//
 
+	this.isPresenting = false;
 	this.scale = 1;
 
-	var isPresenting = false;
+	var scope = this;
 
 	var rendererSize = renderer.getSize();
 	var rendererPixelRatio = renderer.getPixelRatio();
@@ -70,7 +71,7 @@ THREE.VREffect = function ( renderer, onError ) {
 
 		rendererSize = { width: width, height: height };
 
-		if ( isPresenting ) {
+		if ( scope.isPresenting ) {
 
 			var eyeParamsL = vrHMD.getEyeParameters( 'left' );
 			renderer.setPixelRatio( 1 );
@@ -104,16 +105,16 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	function onFullscreenChange () {
 
-		var wasPresenting = isPresenting;
-		isPresenting = vrHMD !== undefined && ( vrHMD.isPresenting || ( isDeprecatedAPI && document[ fullscreenElement ] instanceof window.HTMLElement ) );
+		var wasPresenting = scope.isPresenting;
+		scope.isPresenting = vrHMD !== undefined && ( vrHMD.isPresenting || ( isDeprecatedAPI && document[ fullscreenElement ] instanceof window.HTMLElement ) );
 
-		if ( wasPresenting === isPresenting ) {
+		if ( wasPresenting === scope.isPresenting ) {
 
 			return;
 
 		}
 
-		if ( isPresenting ) {
+		if ( scope.isPresenting ) {
 
 			rendererPixelRatio = renderer.getPixelRatio();
 			rendererSize = renderer.getSize();
@@ -180,7 +181,8 @@ THREE.VREffect = function ( renderer, onError ) {
 				return;
 
 			}
-			if ( isPresenting === boolean ) {
+
+			if ( scope.isPresenting === boolean ) {
 
 				resolve();
 				return;
@@ -241,7 +243,7 @@ THREE.VREffect = function ( renderer, onError ) {
 
 	this.render = function ( scene, camera ) {
 
-		if ( vrHMD && isPresenting ) {
+		if ( vrHMD && scope.isPresenting ) {
 
 			var autoUpdate = scene.autoUpdate;
 

+ 0 - 15
examples/js/loaders/BinaryLoader.js

@@ -19,21 +19,6 @@ THREE.BinaryLoader.prototype = {
 
 	constructor: THREE.BinaryLoader,
 
-	// Deprecated
-	
-	get statusDomElement () {
-
-		if ( this._statusDomElement === undefined ) {
-
-			this._statusDomElement = document.createElement( 'div' );
-
-		}
-
-		console.warn( 'THREE.BinaryLoader: .statusDomElement has been removed.' );
-		return this._statusDomElement;
-
-	},
-
 	// Load models generated by slim OBJ converter with BINARY option (converter_obj_three_slim.py -t binary)
 	//  - binary models consist of two files: JS and BIN
 	//  - parameters

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

@@ -16,9 +16,9 @@
 
 ( function() {
 
-	THREE.FBXLoader = function ( showStatus, manager ) {
+	THREE.FBXLoader = function ( manager ) {
 
-		THREE.Loader.call( this, showStatus );
+		THREE.Loader.call( this );
 		this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
 		this.textureLoader = null;
 		this.textureBasePath = null;

+ 297 - 0
examples/js/loaders/GLTFLoader.js

@@ -0,0 +1,297 @@
+/**
+ * @author mrdoob / http://mrdoob.com/
+ */
+
+THREE.GLTFLoader = function ( manager ) {
+
+	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
+
+};
+
+THREE.GLTFLoader.prototype = {
+
+	constructor: THREE.GLTFLoader,
+
+	load: function ( url, onLoad, onProgress, onError ) {
+
+		var scope = this;
+
+		var loader = new THREE.XHRLoader( scope.manager );
+		loader.load( url, function ( text ) {
+
+			onLoad( scope.parse( JSON.parse( text ) ) );
+
+		}, onProgress, onError );
+
+	},
+
+	setCrossOrigin: function ( value ) {
+
+		this.crossOrigin = value;
+
+	},
+
+	parse: function ( json ) {
+
+		function stringToArrayBuffer( string ) {
+
+			var bytes = atob( string );
+			var buffer = new ArrayBuffer( bytes.length );
+			var bufferView = new Uint8Array( buffer );
+
+			for ( var i = 0; i < bytes.length; i ++ ) {
+
+				bufferView[ i ] = bytes.charCodeAt( i );
+
+			}
+
+			return buffer;
+
+		}
+
+		console.time( 'GLTFLoader' );
+
+		var library = {
+			buffers: {},
+			bufferViews: {},
+			accessors: {},
+			meshes: {},
+			nodes: {},
+			scenes: {}
+		};
+
+		// buffers
+
+		var buffers = json.buffers;
+
+		for ( var bufferId in buffers ) {
+
+			var buffer = buffers[ bufferId ];
+
+			if ( buffer.type === 'arraybuffer' ) {
+
+				var header = 'data:application/octet-stream;base64,';
+
+				if ( buffer.uri.indexOf( header ) === 0 ) {
+
+					library.buffers[ bufferId ] = stringToArrayBuffer( buffer.uri.substr( header.length ) );
+
+				}
+
+			}
+
+		}
+
+		// buffer views
+
+		var bufferViews = json.bufferViews;
+
+		for ( var bufferViewId in bufferViews ) {
+
+			var bufferView = bufferViews[ bufferViewId ];
+			var arraybuffer = library.buffers[ bufferView.buffer ];
+
+			library.bufferViews[ bufferViewId ] = arraybuffer.slice( bufferView.byteOffset, bufferView.byteOffset + bufferView.byteLength );
+
+		}
+
+		// accessors
+
+		var COMPONENT_TYPES = {
+			5120: Int8Array,
+			5121: Uint8Array,
+			5122: Int16Array,
+			5123: Uint16Array,
+			5126: Float32Array,
+		};
+
+		var TYPE_SIZES = {
+			'SCALAR': 1, 'VEC2': 2, 'VEC3': 3, 'VEC4': 4,
+			'MAT2': 4, 'MAT3': 9, 'MAT4': 16
+		};
+
+		var accessors = json.accessors;
+
+		for ( var accessorId in accessors ) {
+
+			var accessor = accessors[ accessorId ];
+
+			var arraybuffer = library.bufferViews[ accessor.bufferView ];
+			var itemSize = TYPE_SIZES[ accessor.type ];
+			var TypedArray = COMPONENT_TYPES[ accessor.componentType ];
+
+			var array = new TypedArray( arraybuffer, accessor.byteOffset, accessor.count * itemSize );
+
+			library.accessors[ accessorId ] = new THREE.BufferAttribute( array, itemSize );
+
+		}
+
+		// meshes
+
+		var meshes = json.meshes;
+
+		for ( var meshId in meshes ) {
+
+			var mesh = meshes[ meshId ];
+
+			var geometries = {
+				name: mesh.name,
+				array: []
+			};
+
+			var primitives = mesh.primitives;
+
+			for ( var i = 0; i < primitives.length; i ++ ) {
+
+				var primitive = primitives[ i ];
+				var attributes = primitive.attributes;
+
+				var geometry = new THREE.BufferGeometry();
+
+				if ( primitive.indices ) {
+
+					geometry.setIndex( library.accessors[ primitive.indices ] );
+
+				}
+
+				for ( var attributeId in attributes ) {
+
+					var attribute = attributes[ attributeId ];
+					var bufferAttribute = library.accessors[ attribute ];
+
+					switch ( attributeId ) {
+
+						case 'POSITION':
+							geometry.addAttribute( 'position', bufferAttribute );
+							break;
+
+						case 'NORMAL':
+							geometry.addAttribute( 'normal', bufferAttribute );
+							break;
+
+						case 'TEXCOORD_0':
+							geometry.addAttribute( 'uv', bufferAttribute );
+							break;
+
+					}
+
+				}
+
+				geometries.array.push( geometry );
+
+			}
+
+			library.meshes[ meshId ] = geometries;
+
+		}
+
+		// nodes
+
+		var nodes = json.nodes;
+		var matrix = new THREE.Matrix4();
+
+		for ( var nodeId in nodes ) {
+
+			var node = nodes[ nodeId ];
+
+			var object = new THREE.Group();
+			object.name = node.name;
+
+			if ( node.translation !== undefined ) {
+
+				object.position.fromArray( node.translation );
+
+			}
+
+			if ( node.rotation !== undefined ) {
+
+				object.quaternion.fromArray( node.rotation );
+
+			}
+
+			if ( node.scale !== undefined ) {
+
+				object.scale.fromArray( node.scale );
+
+			}
+
+			if ( node.matrix !== undefined ) {
+
+				matrix.fromArray( node.matrix );
+				matrix.decompose( object.position, object.quaternion, object.scale );
+
+			}
+
+			if ( node.meshes !== undefined ) {
+
+				for ( var i = 0; i < node.meshes.length; i ++ ) {
+
+					var meshId = node.meshes[ i ];
+
+					var geometries = library.meshes[ meshId ];
+
+					var group = new THREE.Group();
+					group.name = geometries.name;
+					object.add( group );
+
+					var array = geometries.array;
+
+					for ( var j = 0; j < array.length; j ++ ) {
+
+						group.add( new THREE.Mesh( array[ j ], new THREE.MeshNormalMaterial() ) );
+
+					}
+
+				}
+
+			}
+
+			library.nodes[ nodeId ] = object;
+
+		}
+
+		for ( var nodeId in nodes ) {
+
+			var node = nodes[ nodeId ];
+
+			for ( var i = 0; i < node.children.length; i ++ ) {
+
+				var child = node.children[ i ];
+
+				library.nodes[ nodeId ].add( library.nodes[ child ] );
+
+			}
+
+		}
+
+		// scenes
+
+		var scenes = json.scenes;
+
+		for ( var sceneId in scenes ) {
+
+			var scene = scenes[ sceneId ];
+			var container = new THREE.Scene();
+
+			for ( var i = 0; i < scene.nodes.length; i ++ ) {
+
+				var node = scene.nodes[ i ];
+				container.add( library.nodes[ node ] );
+
+			}
+
+			library.scenes[ sceneId ] = container;
+
+		}
+
+		console.timeEnd( 'GLTFLoader' );
+
+		return {
+
+			scene: library.scenes[ json.scene ]
+
+		};
+
+	}
+
+};

+ 23 - 44
examples/js/loaders/MMDLoader.js

@@ -33,9 +33,9 @@
  *  - shadow support.
  */
 
-THREE.MMDLoader = function ( showStatus, manager ) {
+THREE.MMDLoader = function ( manager ) {
 
-	THREE.Loader.call( this, showStatus );
+	THREE.Loader.call( this );
 	this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager;
 	this.defaultTexturePath = './models/default/';
 
@@ -989,7 +989,7 @@ THREE.MMDLoader.prototype.parsePmx = function ( buffer ) {
 		var parseFace = function () {
 
 			var p = {};
-			p.indices = dv.getIndexArray( metadata.vertexIndexSize, 3 );
+			p.indices = dv.getIndexArray( metadata.vertexIndexSize, 3, true );
 			return p;
 
 		};
@@ -1214,7 +1214,7 @@ THREE.MMDLoader.prototype.parsePmx = function ( buffer ) {
 				} else if ( p.type === 1 ) {  // vertex morph
 
 					var m = {};
-					m.index = dv.getIndex( pmx.metadata.vertexIndexSize );
+					m.index = dv.getIndex( pmx.metadata.vertexIndexSize, true );
 					m.position = dv.getFloat32Array( 3 );
 					p.elements.push( m );
 
@@ -1229,7 +1229,7 @@ THREE.MMDLoader.prototype.parsePmx = function ( buffer ) {
 				} else if ( p.type === 3 ) {  // uv morph
 
 					var m = {};
-					m.index = dv.getIndex( pmx.metadata.vertexIndexSize );
+					m.index = dv.getIndex( pmx.metadata.vertexIndexSize, true );
 					m.uv = dv.getFloat32Array( 4 );
 					p.elements.push( m );
 
@@ -1268,7 +1268,6 @@ THREE.MMDLoader.prototype.parsePmx = function ( buffer ) {
 
 		}
 
-
 	};
 
 	var parseFrames = function () {
@@ -3449,18 +3448,18 @@ THREE.MMDLoader.DataView.prototype = {
 
 	},
 
-	getIndex: function ( type ) {
+	getIndex: function ( type, isUnsigned ) {
 
 		switch ( type ) {
 
 			case 1:
-				return this.getInt8();
+				return ( isUnsigned === true ) ? this.getUint8() : this.getInt8();
 
 			case 2:
-				return this.getInt16();
+				return ( isUnsigned === true ) ? this.getUint16() : this.getInt16();
 
 			case 4:
-				return this.getInt32();
+				return this.getInt32(); // No Uint32
 
 			default:
 				throw 'unknown number type ' + type + ' exception.';
@@ -3469,13 +3468,13 @@ THREE.MMDLoader.DataView.prototype = {
 
 	},
 
-	getIndexArray: function ( type, size ) {
+	getIndexArray: function ( type, size, isUnsigned ) {
 
 		var a = [];
 
 		for ( var i = 0; i < size; i++ ) {
 
-			a.push( this.getIndex( type ) );
+			a.push( this.getIndex( type, isUnsigned ) );
 
 		}
 
@@ -3674,20 +3673,20 @@ THREE.ShaderLib[ 'mmd' ] = {
 		THREE.UniformsLib[ "lights" ],
 
 		{
-			"emissive" : { type: "c", value: new THREE.Color( 0x000000 ) },
-			"specular" : { type: "c", value: new THREE.Color( 0x111111 ) },
-			"shininess": { type: "f", value: 30 }
+			"emissive" : { value: new THREE.Color( 0x000000 ) },
+			"specular" : { value: new THREE.Color( 0x111111 ) },
+			"shininess": { value: 30 }
 		},
 
 		// ---- MMD specific for cel shading(outline drawing and toon mapping)
 		{
-			"outlineDrawing"  : { type: "i", value: 0 },
-			"outlineThickness": { type: "f", value: 0.0 },
-			"outlineColor"    : { type: "c", value: new THREE.Color( 0x000000 ) },
-			"outlineAlpha"    : { type: "f", value: 1.0 },
-			"celShading"      : { type: "i", value: 0 },
-			"toonMap"         : { type: "t", value: null },
-			"hasToonTexture"  : { type: "i", value: 0 }
+			"outlineDrawing"  : { value: 0 },
+			"outlineThickness": { value: 0.0 },
+			"outlineColor"    : { value: new THREE.Color( 0x000000 ) },
+			"outlineAlpha"    : { value: 1.0 },
+			"celShading"      : { value: 0 },
+			"toonMap"         : { value: null },
+			"hasToonTexture"  : { value: 0 }
 		}
 		// ---- MMD specific for cel shading(outline drawing and toon mapping)
 
@@ -3864,6 +3863,7 @@ THREE.ShaderLib[ 'mmd' ] = {
 			THREE.ShaderChunk[ "alphamap_fragment" ],
 			THREE.ShaderChunk[ "alphatest_fragment" ],
 			THREE.ShaderChunk[ "specularmap_fragment" ],
+			THREE.ShaderChunk[ "normal_flip" ],
 			THREE.ShaderChunk[ "normal_fragment" ],
 			THREE.ShaderChunk[ "emissivemap_fragment" ],
 
@@ -4521,32 +4521,11 @@ THREE.MMDHelper.prototype = {
 
 	},
 
-	resetPose: function ( mesh ) {
-
-		var bones = mesh.skeleton.bones;
-		var bones2 = mesh.geometry.bones;
-
-		var v = new THREE.Vector3();
-		var q = new THREE.Quaternion();
-
-		for ( var i = 0; i < bones.length; i++ ) {
-
-			var b = bones2[ i ];
-			v.set( b.pos[ 0 ], b.pos[ 1 ], b.pos[ 2 ] );
-			q.set( b.rotq[ 0 ], b.rotq[ 1 ], b.rotq[ 2 ], b.rotq[ 3 ] );
-
-			bones[ i ].position.copy( v );
-			bones[ i ].quaternion.copy( q );
-
-		}
-
-	},
-
 	poseAsVpd: function ( mesh, vpd, params ) {
 
 		if ( ! ( params && params.preventResetPose === true ) ) {
 
-			this.resetPose( mesh );
+			mesh.pose();
 
 		}
 

+ 251 - 231
examples/js/loaders/PLYLoader.js

@@ -1,8 +1,8 @@
 /**
  * @author Wei Meng / http://about.me/menway
  *
- * Description: A THREE loader for PLY ASCII files (known as the Polygon File Format or the Stanford Triangle Format).
- *
+ * Description: A THREE loader for PLY ASCII files (known as the Polygon
+ * File Format or the Stanford Triangle Format).
  *
  * Limitations: ASCII decoding assumes file is UTF-8.
  *
@@ -59,418 +59,438 @@ THREE.PLYLoader.prototype = {
 
 	},
 
-	bin2str: function ( buf ) {
+	parse: function ( data ) {
 
-		var array_buffer = new Uint8Array( buf );
-		var str = '';
-		for ( var i = 0; i < buf.byteLength; i ++ ) {
+		function isASCII( data ) {
 
-			str += String.fromCharCode( array_buffer[ i ] ); // implicitly assumes little-endian
+			var header = parseHeader( bin2str( data ) );
+			return header.format === "ascii";
 
 		}
 
-		return str;
+		function bin2str( buf ) {
 
-	},
+			var array_buffer = new Uint8Array( buf );
+			var str = '';
 
-	isASCII: function( data ) {
+			for ( var i = 0; i < buf.byteLength; i ++ ) {
 
-		var header = this.parseHeader( this.bin2str( data ) );
+				str += String.fromCharCode( array_buffer[ i ] ); // implicitly assumes little-endian
 
-		return header.format === "ascii";
+			}
 
-	},
+			return str;
 
-	parse: function ( data ) {
+		}
 
-		if ( data instanceof ArrayBuffer ) {
+		function parseHeader( data ) {
 
-			return this.isASCII( data )
-				? this.parseASCII( this.bin2str( data ) )
-				: this.parseBinary( data );
+			var patternHeader = /ply([\s\S]*)end_header\s/;
+			var headerText = "";
+			var headerLength = 0;
+			var result = patternHeader.exec( data );
 
-		} else {
+			if ( result !== null ) {
 
-			return this.parseASCII( data );
+				headerText = result [ 1 ];
+				headerLength = result[ 0 ].length;
 
-		}
+			}
 
-	},
+			var header = {
+				comments: [],
+				elements: [],
+				headerLength: headerLength
+			};
 
-	parseHeader: function ( data ) {
+			var lines = headerText.split( '\n' );
+			var currentElement;
+			var lineType, lineValues;
 
-		var patternHeader = /ply([\s\S]*)end_header\s/;
-		var headerText = "";
-		var headerLength = 0;
-		var result = patternHeader.exec( data );
-		if ( result !== null ) {
+			function make_ply_element_property( propertValues, propertyNameMapping ) {
 
-			headerText = result [ 1 ];
-			headerLength = result[ 0 ].length;
+				var property = { type: propertValues[ 0 ] };
 
-		}
+				if ( property.type === 'list' ) {
 
-		var header = {
-			comments: [],
-			elements: [],
-			headerLength: headerLength
-		};
+					property.name = propertValues[ 3 ];
+					property.countType = propertValues[ 1 ];
+					property.itemType = propertValues[ 2 ];
 
-		var lines = headerText.split( '\n' );
-		var currentElement = undefined;
-		var lineType, lineValues;
+				} else {
 
-		function make_ply_element_property( propertValues, propertyNameMapping ) {
+					property.name = propertValues[ 1 ];
 
-			var property = {
-				type: propertValues[ 0 ]
-			};
+				}
 
-			if ( property.type === 'list' ) {
+				if ( property.name in propertyNameMapping ) {
 
-				property.name = propertValues[ 3 ];
-				property.countType = propertValues[ 1 ];
-				property.itemType = propertValues[ 2 ];
+					property.name = propertyNameMapping[ property.name ];
 
-			} else {
+				}
 
-				property.name = propertValues[ 1 ];
+				return property;
 
 			}
 
-			if ( property.name in propertyNameMapping ) {
+			for ( var i = 0; i < lines.length; i ++ ) {
 
-				property.name = propertyNameMapping[ property.name ];
+				var line = lines[ i ];
+				line = line.trim();
 
-			}
+				if ( line === "" ) continue;
 
-			return property;
-
-		}
+				lineValues = line.split( /\s+/ );
+				lineType = lineValues.shift();
+				line = lineValues.join( " " );
 
-		for ( var i = 0; i < lines.length; i ++ ) {
+				switch ( lineType ) {
 
-			var line = lines[ i ];
-			line = line.trim();
-			if ( line === "" ) {
+					case "format":
 
-				continue;
+						header.format = lineValues[ 0 ];
+						header.version = lineValues[ 1 ];
 
-			}
-			lineValues = line.split( /\s+/ );
-			lineType = lineValues.shift();
-			line = lineValues.join( " " );
+						break;
 
-			switch ( lineType ) {
+					case "comment":
 
-			case "format":
+						header.comments.push( line );
 
-				header.format = lineValues[ 0 ];
-				header.version = lineValues[ 1 ];
+						break;
 
-				break;
+					case "element":
 
-			case "comment":
+						if ( currentElement !== undefined ) {
 
-				header.comments.push( line );
+							header.elements.push( currentElement );
 
-				break;
+						}
 
-			case "element":
+						currentElement = {};
+						currentElement.name = lineValues[ 0 ];
+						currentElement.count = parseInt( lineValues[ 1 ] );
+						currentElement.properties = [];
 
-				if ( ! ( currentElement === undefined ) ) {
+						break;
 
-					header.elements.push( currentElement );
+					case "property":
 
-				}
+						currentElement.properties.push( make_ply_element_property( lineValues, scope.propertyNameMapping ) );
 
-				currentElement = Object();
-				currentElement.name = lineValues[ 0 ];
-				currentElement.count = parseInt( lineValues[ 1 ] );
-				currentElement.properties = [];
+						break;
 
-				break;
 
-			case "property":
+					default:
 
-				currentElement.properties.push( make_ply_element_property( lineValues, this.propertyNameMapping ) );
+						console.log( "unhandled", lineType, lineValues );
 
-				break;
+				}
 
+			}
 
-			default:
+			if ( currentElement !== undefined ) {
 
-				console.log( "unhandled", lineType, lineValues );
+				header.elements.push( currentElement );
 
 			}
 
-		}
-
-		if ( ! ( currentElement === undefined ) ) {
-
-			header.elements.push( currentElement );
+			return header;
 
 		}
 
-		return header;
+		function parseASCIINumber( n, type ) {
 
-	},
+			switch ( type ) {
 
-	parseASCIINumber: function ( n, type ) {
+			case 'char': case 'uchar': case 'short': case 'ushort': case 'int': case 'uint':
+			case 'int8': case 'uint8': case 'int16': case 'uint16': case 'int32': case 'uint32':
 
-		switch ( type ) {
+				return parseInt( n );
 
-		case 'char': case 'uchar': case 'short': case 'ushort': case 'int': case 'uint':
-		case 'int8': case 'uint8': case 'int16': case 'uint16': case 'int32': case 'uint32':
+			case 'float': case 'double': case 'float32': case 'float64':
 
-			return parseInt( n );
+				return parseFloat( n );
 
-		case 'float': case 'double': case 'float32': case 'float64':
-
-			return parseFloat( n );
+			}
 
 		}
 
-	},
+		function parseASCIIElement( properties, line ) {
 
-	parseASCIIElement: function ( properties, line ) {
+			var values = line.split( /\s+/ );
 
-		var values = line.split( /\s+/ );
+			var element = {};
 
-		var element = Object();
+			for ( var i = 0; i < properties.length; i ++ ) {
 
-		for ( var i = 0; i < properties.length; i ++ ) {
+				if ( properties[ i ].type === "list" ) {
 
-			if ( properties[ i ].type === "list" ) {
+					var list = [];
+					var n = parseASCIINumber( values.shift(), properties[ i ].countType );
 
-				var list = [];
-				var n = this.parseASCIINumber( values.shift(), properties[ i ].countType );
+					for ( var j = 0; j < n; j ++ ) {
 
-				for ( var j = 0; j < n; j ++ ) {
+						list.push( parseASCIINumber( values.shift(), properties[ i ].itemType ) );
 
-					list.push( this.parseASCIINumber( values.shift(), properties[ i ].itemType ) );
+					}
 
-				}
+					element[ properties[ i ].name ] = list;
 
-				element[ properties[ i ].name ] = list;
+				} else {
 
-			} else {
+					element[ properties[ i ].name ] = parseASCIINumber( values.shift(), properties[ i ].type );
 
-				element[ properties[ i ].name ] = this.parseASCIINumber( values.shift(), properties[ i ].type );
+				}
 
 			}
 
+			return element;
+
 		}
 
-		return element;
+		function parseASCII( data ) {
 
-	},
+			// PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format)
 
-	parseASCII: function ( data ) {
+			var geometry = new THREE.Geometry();
 
-		// PLY ascii format specification, as per http://en.wikipedia.org/wiki/PLY_(file_format)
+			var result;
 
-		var geometry = new THREE.Geometry();
+			var header = parseHeader( data );
 
-		var result;
+			var patternBody = /end_header\s([\s\S]*)$/;
+			var body = "";
+			if ( ( result = patternBody.exec( data ) ) !== null ) {
 
-		var header = this.parseHeader( data );
+				body = result [ 1 ];
 
-		var patternBody = /end_header\s([\s\S]*)$/;
-		var body = "";
-		if ( ( result = patternBody.exec( data ) ) !== null ) {
+			}
 
-			body = result [ 1 ];
+			var lines = body.split( '\n' );
+			var currentElement = 0;
+			var currentElementCount = 0;
+			geometry.useColor = false;
 
-		}
+			for ( var i = 0; i < lines.length; i ++ ) {
 
-		var lines = body.split( '\n' );
-		var currentElement = 0;
-		var currentElementCount = 0;
-		geometry.useColor = false;
+				var line = lines[ i ];
+				line = line.trim();
+				if ( line === "" ) {
 
-		for ( var i = 0; i < lines.length; i ++ ) {
+					continue;
 
-			var line = lines[ i ];
-			line = line.trim();
-			if ( line === "" ) {
+				}
 
-				continue;
+				if ( currentElementCount >= header.elements[ currentElement ].count ) {
 
-			}
+					currentElement ++;
+					currentElementCount = 0;
 
-			if ( currentElementCount >= header.elements[ currentElement ].count ) {
+				}
 
-				currentElement ++;
-				currentElementCount = 0;
+				var element = parseASCIIElement( header.elements[ currentElement ].properties, line );
 
-			}
+				handleElement( geometry, header.elements[ currentElement ].name, element );
 
-			var element = this.parseASCIIElement( header.elements[ currentElement ].properties, line );
+				currentElementCount ++;
 
-			this.handleElement( geometry, header.elements[ currentElement ].name, element );
+			}
 
-			currentElementCount ++;
+			return postProcess( geometry );
 
 		}
 
-		return this.postProcess( geometry );
+		function postProcess( geometry ) {
 
-	},
+			if ( geometry.useColor ) {
 
-	postProcess: function ( geometry ) {
+				for ( var i = 0; i < geometry.faces.length; i ++ ) {
 
-		if ( geometry.useColor ) {
+					geometry.faces[ i ].vertexColors = [
+						geometry.colors[ geometry.faces[ i ].a ],
+						geometry.colors[ geometry.faces[ i ].b ],
+						geometry.colors[ geometry.faces[ i ].c ]
+					];
 
-			for ( var i = 0; i < geometry.faces.length; i ++ ) {
+				}
 
-				geometry.faces[ i ].vertexColors = [
-					geometry.colors[ geometry.faces[ i ].a ],
-					geometry.colors[ geometry.faces[ i ].b ],
-					geometry.colors[ geometry.faces[ i ].c ]
-				];
+				geometry.elementsNeedUpdate = true;
 
 			}
 
-			geometry.elementsNeedUpdate = true;
+			geometry.computeBoundingSphere();
+
+			return geometry;
 
 		}
 
-		geometry.computeBoundingSphere();
+		function handleElement( geometry, elementName, element ) {
 
-		return geometry;
+			if ( elementName === "vertex" ) {
 
-	},
+				geometry.vertices.push(
+					new THREE.Vector3( element.x, element.y, element.z )
+				);
 
-	handleElement: function ( geometry, elementName, element ) {
+				if ( 'red' in element && 'green' in element && 'blue' in element ) {
 
-		if ( elementName === "vertex" ) {
+					geometry.useColor = true;
 
-			geometry.vertices.push(
-				new THREE.Vector3( element.x, element.y, element.z )
-			);
+					var color = new THREE.Color();
+					color.setRGB( element.red / 255.0, element.green / 255.0, element.blue / 255.0 );
+					geometry.colors.push( color );
 
-			if ( 'red' in element && 'green' in element && 'blue' in element ) {
+				}
 
-				geometry.useColor = true;
+			} else if ( elementName === "face" ) {
 
-				var color = new THREE.Color();
-				color.setRGB( element.red / 255.0, element.green / 255.0, element.blue / 255.0 );
-				geometry.colors.push( color );
+				var vertex_indices = element.vertex_indices;
+				var texcoord = element.texcoord;
 
-			}
+				if ( vertex_indices.length === 3 ) {
 
-		} else if ( elementName === "face" ) {
+					geometry.faces.push(
+						new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] )
+					);
 
-			var vertex_indices = element.vertex_indices;
+					if ( texcoord ) {
+						geometry.faceVertexUvs[ 0 ].push( [
+							new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]),
+							new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+							new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ])
+						] );
+					}
 
-			if ( vertex_indices.length === 3 ) {
+				} else if ( vertex_indices.length === 4 ) {
 
-				geometry.faces.push(
-					new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 2 ] )
-				);
+					geometry.faces.push(
+						new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] ),
+						new THREE.Face3( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] )
+					);
 
-			} else if ( vertex_indices.length === 4 ) {
+					if ( texcoord ) {
+						geometry.faceVertexUvs[ 0 ].push( [
+							new THREE.Vector2( texcoord[ 0 ], texcoord[ 1 ]),
+							new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+							new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ])
+						], [
+							new THREE.Vector2( texcoord[ 2 ], texcoord[ 3 ]),
+							new THREE.Vector2( texcoord[ 4 ], texcoord[ 5 ]),
+							new THREE.Vector2( texcoord[ 6 ], texcoord[ 7 ])
+						] );
+					}
 
-				geometry.faces.push(
-					new THREE.Face3( vertex_indices[ 0 ], vertex_indices[ 1 ], vertex_indices[ 3 ] ),
-					new THREE.Face3( vertex_indices[ 1 ], vertex_indices[ 2 ], vertex_indices[ 3 ] )
-				);
+				}
 
 			}
 
 		}
 
-	},
+		function binaryRead( dataview, at, type, little_endian ) {
 
-	binaryRead: function ( dataview, at, type, little_endian ) {
+			switch ( type ) {
 
-		switch ( type ) {
+				// corespondences for non-specific length types here match rply:
+				case 'int8':		case 'char':	 return [ dataview.getInt8( at ), 1 ];
+				case 'uint8':		case 'uchar':	 return [ dataview.getUint8( at ), 1 ];
+				case 'int16':		case 'short':	 return [ dataview.getInt16( at, little_endian ), 2 ];
+				case 'uint16':	case 'ushort': return [ dataview.getUint16( at, little_endian ), 2 ];
+				case 'int32':		case 'int':		 return [ dataview.getInt32( at, little_endian ), 4 ];
+				case 'uint32':	case 'uint':	 return [ dataview.getUint32( at, little_endian ), 4 ];
+				case 'float32': case 'float':	 return [ dataview.getFloat32( at, little_endian ), 4 ];
+				case 'float64': case 'double': return [ dataview.getFloat64( at, little_endian ), 8 ];
 
-			// corespondences for non-specific length types here match rply:
-		case 'int8':		case 'char':	 return [ dataview.getInt8( at ), 1 ];
+			}
 
-		case 'uint8':		case 'uchar':	 return [ dataview.getUint8( at ), 1 ];
+		}
 
-		case 'int16':		case 'short':	 return [ dataview.getInt16( at, little_endian ), 2 ];
+		function binaryReadElement( dataview, at, properties, little_endian ) {
 
-		case 'uint16':	case 'ushort': return [ dataview.getUint16( at, little_endian ), 2 ];
+			var element = {};
+			var result, read = 0;
 
-		case 'int32':		case 'int':		 return [ dataview.getInt32( at, little_endian ), 4 ];
+			for ( var i = 0; i < properties.length; i ++ ) {
 
-		case 'uint32':	case 'uint':	 return [ dataview.getUint32( at, little_endian ), 4 ];
+				if ( properties[ i ].type === "list" ) {
 
-		case 'float32': case 'float':	 return [ dataview.getFloat32( at, little_endian ), 4 ];
+					var list = [];
 
-		case 'float64': case 'double': return [ dataview.getFloat64( at, little_endian ), 8 ];
+					result = binaryRead( dataview, at + read, properties[ i ].countType, little_endian );
+					var n = result[ 0 ];
+					read += result[ 1 ];
 
-		}
+					for ( var j = 0; j < n; j ++ ) {
 
-	},
+						result = binaryRead( dataview, at + read, properties[ i ].itemType, little_endian );
+						list.push( result[ 0 ] );
+						read += result[ 1 ];
 
-	binaryReadElement: function ( dataview, at, properties, little_endian ) {
+					}
 
-		var element = Object();
-		var result, read = 0;
+					element[ properties[ i ].name ] = list;
 
-		for ( var i = 0; i < properties.length; i ++ ) {
+				} else {
 
-			if ( properties[ i ].type === "list" ) {
+					result = binaryRead( dataview, at + read, properties[ i ].type, little_endian );
+					element[ properties[ i ].name ] = result[ 0 ];
+					read += result[ 1 ];
 
-				var list = [];
+				}
 
-				result = this.binaryRead( dataview, at + read, properties[ i ].countType, little_endian );
-				var n = result[ 0 ];
-				read += result[ 1 ];
+			}
 
-				for ( var j = 0; j < n; j ++ ) {
+			return [ element, read ];
 
-					result = this.binaryRead( dataview, at + read, properties[ i ].itemType, little_endian );
-					list.push( result[ 0 ] );
-					read += result[ 1 ];
+		}
 
-				}
+		function parseBinary( data ) {
 
-				element[ properties[ i ].name ] = list;
+			var geometry = new THREE.Geometry();
 
-			} else {
+			var header = parseHeader( bin2str( data ) );
+			var little_endian = ( header.format === "binary_little_endian" );
+			var body = new DataView( data, header.headerLength );
+			var result, loc = 0;
 
-				result = this.binaryRead( dataview, at + read, properties[ i ].type, little_endian );
-				element[ properties[ i ].name ] = result[ 0 ];
-				read += result[ 1 ];
+			for ( var currentElement = 0; currentElement < header.elements.length; currentElement ++ ) {
 
-			}
+				for ( var currentElementCount = 0; currentElementCount < header.elements[ currentElement ].count; currentElementCount ++ ) {
 
-		}
+					result = binaryReadElement( body, loc, header.elements[ currentElement ].properties, little_endian );
+					loc += result[ 1 ];
+					var element = result[ 0 ];
 
-		return [ element, read ];
+					handleElement( geometry, header.elements[ currentElement ].name, element );
 
-	},
+				}
 
-	parseBinary: function ( data ) {
+			}
 
-		var geometry = new THREE.Geometry();
+			return postProcess( geometry );
 
-		var header = this.parseHeader( this.bin2str( data ) );
-		var little_endian = ( header.format === "binary_little_endian" );
-		var body = new DataView( data, header.headerLength );
-		var result, loc = 0;
+		}
 
-		for ( var currentElement = 0; currentElement < header.elements.length; currentElement ++ ) {
+		//
 
-			for ( var currentElementCount = 0; currentElementCount < header.elements[ currentElement ].count; currentElementCount ++ ) {
+		console.time( 'PLYLoader' );
 
-				result = this.binaryReadElement( body, loc, header.elements[ currentElement ].properties, little_endian );
-				loc += result[ 1 ];
-				var element = result[ 0 ];
+		var geometry;
+		var scope = this;
 
-				this.handleElement( geometry, header.elements[ currentElement ].name, element );
+		if ( data instanceof ArrayBuffer ) {
 
-			}
+			geometry = isASCII( data ) ? parseASCII( bin2str( data ) ) : parseBinary( data );
+
+		} else {
+
+			geometry = parseASCII( data );
 
 		}
 
-		return this.postProcess( geometry );
+		console.timeEnd( 'PLYLoader' );
+
+		return geometry;
 
 	}
 

+ 0 - 19
examples/js/loaders/ctm/CTMLoader.js

@@ -12,25 +12,6 @@ THREE.CTMLoader = function () {
 
 	THREE.Loader.call( this );
 
-	// Deprecated
-	
-	Object.defineProperties( this, {
-		statusDomElement: {
-			get: function () {
-
-				if ( this._statusDomElement === undefined ) {
-
-					this._statusDomElement = document.createElement( 'div' );
-
-				}
-
-				console.warn( 'THREE.BinaryLoader: .statusDomElement has been removed.' );
-				return this._statusDomElement;
-
-			}
-		},
-	} );
-
 };
 
 THREE.CTMLoader.prototype = Object.create( THREE.Loader.prototype );

File diff suppressed because it is too large
+ 144 - 144
examples/js/loaders/gltf/glTFLoader.js


+ 1 - 0
examples/js/nodes/materials/PhongNode.js

@@ -153,6 +153,7 @@ THREE.PhongNode.prototype.build = function( builder ) {
 
 		var output = [
 				// prevent undeclared normal
+				THREE.ShaderChunk[ "normal_flip" ],
 				THREE.ShaderChunk[ "normal_fragment" ],
 
 				// prevent undeclared material

+ 1 - 0
examples/js/nodes/materials/StandardNode.js

@@ -169,6 +169,7 @@ THREE.StandardNode.prototype.build = function( builder ) {
 
 		var output = [
 				// prevent undeclared normal
+				THREE.ShaderChunk[ "normal_flip" ],
 				THREE.ShaderChunk[ "normal_fragment" ],
 
 				// prevent undeclared material

+ 4 - 4
examples/js/pmrem/PMREMCubeUVPacker.js

@@ -128,10 +128,10 @@ THREE.PMREMCubeUVPacker.prototype = {
 		var shaderMaterial = new THREE.ShaderMaterial( {
 
 			uniforms: {
-				"faceIndex": { type: 'i', value: 0 },
-				"mapSize": { type: 'f', value: 0 },
-				"envMap": { type: 't', value: null },
-				"testColor": { type: 'v3', value: new THREE.Vector3( 1, 1, 1 ) }
+				"faceIndex": { value: 0 },
+				"mapSize": { value: 0 },
+				"envMap": { value: null },
+				"testColor": { value: new THREE.Vector3( 1, 1, 1 ) }
 			},
 
 			vertexShader:

+ 5 - 5
examples/js/pmrem/PMREMGenerator.js

@@ -135,11 +135,11 @@ THREE.PMREMGenerator.prototype = {
 		return new THREE.ShaderMaterial( {
 
 			uniforms: {
-				"faceIndex": { type: 'i', value: 0 },
-				"roughness": { type: 'f', value: 0.5 },
-				"mapSize": { type: 'f', value: 0.5 },
-				"envMap": { type: 't', value: null },
-				"testColor": { type: 'v3', value: new THREE.Vector3( 1, 1, 1 ) }
+				"faceIndex": { value: 0 },
+				"roughness": { value: 0.5 },
+				"mapSize": { value: 0.5 },
+				"envMap": { value: null },
+				"testColor": { value: new THREE.Vector3( 1, 1, 1 ) }
 			},
 
 			vertexShader:

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

@@ -52,10 +52,10 @@ THREE.AdaptiveToneMappingPass = function ( adaptive, resolution ) {
 			"MIP_LEVEL_1X1" : ( Math.log( this.resolution ) / Math.log( 2.0 ) ).toFixed( 1 ),
 		},
 		uniforms: {
-			"lastLum": { type: "t", value: null },
-			"currentLum": { type: "t", value: null },
-			"delta": { type: 'f', value: 0.016 },
-			"tau": { type: 'f', value: 1.0 }
+			"lastLum": { value: null },
+			"currentLum": { value: null },
+			"delta": { value: 0.016 },
+			"tau": { value: 1.0 }
 		},
 		vertexShader: [
 			"varying vec2 vUv;",

+ 8 - 4
examples/js/postprocessing/EffectComposer.js

@@ -91,13 +91,17 @@ Object.assign( THREE.EffectComposer.prototype, {
 
 			}
 
-			if ( pass instanceof THREE.MaskPass ) {
+			if ( THREE.MaskPass !== undefined ) {
 
-				maskActive = true;
+				if ( pass instanceof THREE.MaskPass ) {
 
-			} else if ( pass instanceof THREE.ClearMaskPass ) {
+					maskActive = true;
 
-				maskActive = false;
+				} else if ( pass instanceof THREE.ClearMaskPass ) {
+
+					maskActive = false;
+
+				}
 
 			}
 

+ 15 - 3
examples/js/postprocessing/ManualMSAARenderPass.js

@@ -10,7 +10,7 @@
 *
 */
 
-THREE.ManualMSAARenderPass = function ( scene, camera ) {
+THREE.ManualMSAARenderPass = function ( scene, camera, clearColor, clearAlpha ) {
 
 	THREE.Pass.call( this );
 
@@ -20,6 +20,10 @@ THREE.ManualMSAARenderPass = function ( scene, camera ) {
 	this.sampleLevel = 4; // specified as n, where the number of samples is 2^n, so sampleLevel = 4, is 2^4 samples, 16.
 	this.unbiased = true;
 
+	// as we need to clear the buffer in this pass, clearColor must be set to something, defaults to black.
+	this.clearColor = ( clearColor !== undefined ) ? clearColor : 0x000000;
+	this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
+
 	if ( THREE.CopyShader === undefined ) console.error( "THREE.ManualMSAARenderPass relies on THREE.CopyShader" );
 
 	var copyShader = THREE.CopyShader;
@@ -78,6 +82,9 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
 		var autoClear = renderer.autoClear;
 		renderer.autoClear = false;
 
+		var oldClearColor = renderer.getClearColor().getHex();
+		var oldClearAlpha = renderer.getClearAlpha();
+
 		var baseSampleWeight = 1.0 / jitterOffsets.length;
 		var roundingRange = 1 / 32;
 		this.copyUniforms[ "tDiffuse" ].value = this.sampleRenderTarget.texture;
@@ -104,20 +111,25 @@ THREE.ManualMSAARenderPass.prototype = Object.assign( Object.create( THREE.Pass.
 			}
 
 			this.copyUniforms[ "opacity" ].value = sampleWeight;
-
+			renderer.setClearColor( this.clearColor, this.clearAlpha );
 			renderer.render( this.scene, this.camera, this.sampleRenderTarget, true );
-			renderer.render( this.scene2, this.camera2, writeBuffer, (i === 0) );
+			if (i === 0) {
+				renderer.setClearColor( 0x000000, 0.0 );
+			}
+			renderer.render( this.scene2, this.camera2, this.renderToScreen ? null : writeBuffer, (i === 0) );
 
 		}
 
 		if ( this.camera.clearViewOffset ) this.camera.clearViewOffset();
 
 		renderer.autoClear = autoClear;
+		renderer.setClearColor( oldClearColor, oldClearAlpha );
 
 	}
 
 } );
 
+
 // These jitter vectors are specified in integers because it is easier.
 // I am assuming a [-8,8) integer grid, but it needs to be mapped onto [-0.5,0.5)
 // before being used, thus these integers need to be scaled by 1/16.

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

@@ -12,10 +12,7 @@ THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clear
 	this.overrideMaterial = overrideMaterial;
 
 	this.clearColor = clearColor;
-	this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 1;
-
-	this.oldClearColor = new THREE.Color();
-	this.oldClearAlpha = 1;
+	this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0;
 
 	this.clear = true;
 	this.needsSwap = false;
@@ -30,20 +27,22 @@ THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype
 
 		this.scene.overrideMaterial = this.overrideMaterial;
 
+		var oldClearColor, oldClearAlpha;
+
 		if ( this.clearColor ) {
 
-			this.oldClearColor.copy( renderer.getClearColor() );
-			this.oldClearAlpha = renderer.getClearAlpha();
+			oldClearColor = renderer.getClearColor().getHex();
+			oldClearAlpha = renderer.getClearAlpha();
 
 			renderer.setClearColor( this.clearColor, this.clearAlpha );
 
 		}
 
-		renderer.render( this.scene, this.camera, readBuffer, this.clear );
+		renderer.render( this.scene, this.camera, this.renderToScreen ? null : readBuffer, this.clear );
 
 		if ( this.clearColor ) {
 
-			renderer.setClearColor( this.oldClearColor, this.oldClearAlpha );
+			renderer.setClearColor( oldClearColor, oldClearAlpha );
 
 		}
 

+ 2 - 2
examples/js/shaders/BleachBypassShader.js

@@ -10,8 +10,8 @@ THREE.BleachBypassShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"opacity":  { type: "f", value: 1.0 }
+		"tDiffuse": { value: null },
+		"opacity":  { value: 1.0 }
 
 	},
 

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

@@ -8,10 +8,10 @@ THREE.BlendShader = {
 
 	uniforms: {
 
-		"tDiffuse1": { type: "t", value: null },
-		"tDiffuse2": { type: "t", value: null },
-		"mixRatio":  { type: "f", value: 0.5 },
-		"opacity":   { type: "f", value: 1.0 }
+		"tDiffuse1": { value: null },
+		"tDiffuse2": { value: null },
+		"mixRatio":  { value: 0.5 },
+		"opacity":   { value: 1.0 }
 
 	},
 

+ 6 - 6
examples/js/shaders/BokehShader.js

@@ -10,12 +10,12 @@ THREE.BokehShader = {
 
 	uniforms: {
 
-		"tColor":   { type: "t", value: null },
-		"tDepth":   { type: "t", value: null },
-		"focus":    { type: "f", value: 1.0 },
-		"aspect":   { type: "f", value: 1.0 },
-		"aperture": { type: "f", value: 0.025 },
-		"maxblur":  { type: "f", value: 1.0 }
+		"tColor":   { value: null },
+		"tDepth":   { value: null },
+		"focus":    { value: 1.0 },
+		"aspect":   { value: 1.0 },
+		"aperture": { value: 0.025 },
+		"maxblur":  { value: 1.0 }
 
 	},
 

+ 23 - 23
examples/js/shaders/BokehShader2.js

@@ -14,37 +14,37 @@ THREE.BokehShader = {
 
 	uniforms: {
 
-		"textureWidth":  { type: "f", value: 1.0 },
-		"textureHeight":  { type: "f", value: 1.0 },
+		"textureWidth":  { value: 1.0 },
+		"textureHeight":  { value: 1.0 },
 
-		"focalDepth":   { type: "f", value: 1.0 },
-		"focalLength":   { type: "f", value: 24.0 },
-		"fstop": { type: "f", value: 0.9 },
+		"focalDepth":   { value: 1.0 },
+		"focalLength":   { value: 24.0 },
+		"fstop": { value: 0.9 },
 
-		"tColor":   { type: "t", value: null },
-		"tDepth":   { type: "t", value: null },
+		"tColor":   { value: null },
+		"tDepth":   { value: null },
 
-		"maxblur":  { type: "f", value: 1.0 },
+		"maxblur":  { value: 1.0 },
 
-		"showFocus":   { type: "i", value: 0 },
-		"manualdof":   { type: "i", value: 0 },
-		"vignetting":   { type: "i", value: 0 },
-		"depthblur":   { type: "i", value: 0 },
+		"showFocus":   { value: 0 },
+		"manualdof":   { value: 0 },
+		"vignetting":   { value: 0 },
+		"depthblur":   { value: 0 },
 
-		"threshold":  { type: "f", value: 0.5 },
-		"gain":  { type: "f", value: 2.0 },
-		"bias":  { type: "f", value: 0.5 },
-		"fringe":  { type: "f", value: 0.7 },
+		"threshold":  { value: 0.5 },
+		"gain":  { value: 2.0 },
+		"bias":  { value: 0.5 },
+		"fringe":  { value: 0.7 },
 
-		"znear":  { type: "f", value: 0.1 },
-		"zfar":  { type: "f", value: 100 },
+		"znear":  { value: 0.1 },
+		"zfar":  { value: 100 },
 
-		"noise":  { type: "i", value: 1 },
-		"dithering":  { type: "f", value: 0.0001 },
-		"pentagon": { type: "i", value: 0 },
+		"noise":  { value: 1 },
+		"dithering":  { value: 0.0001 },
+		"pentagon": { value: 0 },
 
-		"shaderFocus":  { type: "i", value: 1 },
-		"focusCoords":  { type: "v2", value: new THREE.Vector2() },
+		"shaderFocus":  { value: 1 },
+		"focusCoords":  { value: new THREE.Vector2() },
 
 
 	},

+ 3 - 3
examples/js/shaders/BrightnessContrastShader.js

@@ -11,9 +11,9 @@ THREE.BrightnessContrastShader = {
 
 	uniforms: {
 
-		"tDiffuse":   { type: "t", value: null },
-		"brightness": { type: "f", value: 0 },
-		"contrast":   { type: "f", value: 0 }
+		"tDiffuse":   { value: null },
+		"brightness": { value: 0 },
+		"contrast":   { value: 0 }
 
 	},
 

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

@@ -8,10 +8,10 @@ THREE.ColorCorrectionShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"powRGB":   { type: "v3", value: new THREE.Vector3( 2, 2, 2 ) },
-		"mulRGB":   { type: "v3", value: new THREE.Vector3( 1, 1, 1 ) },
-		"addRGB":   { type: "v3", value: new THREE.Vector3( 0, 0, 0 ) }
+		"tDiffuse": { value: null },
+		"powRGB":   { value: new THREE.Vector3( 2, 2, 2 ) },
+		"mulRGB":   { value: new THREE.Vector3( 1, 1, 1 ) },
+		"addRGB":   { value: new THREE.Vector3( 0, 0, 0 ) }
 
 	},
 

+ 2 - 2
examples/js/shaders/ColorifyShader.js

@@ -8,8 +8,8 @@ THREE.ColorifyShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"color":    { type: "c", value: new THREE.Color( 0xffffff ) }
+		"tDiffuse": { value: null },
+		"color":    { value: new THREE.Color( 0xffffff ) }
 
 	},
 

+ 3 - 3
examples/js/shaders/ConvolutionShader.js

@@ -17,9 +17,9 @@ THREE.ConvolutionShader = {
 
 	uniforms: {
 
-		"tDiffuse":        { type: "t", value: null },
-		"uImageIncrement": { type: "v2", value: new THREE.Vector2( 0.001953125, 0.0 ) },
-		"cKernel":         { type: "fv1", value: [] }
+		"tDiffuse":        { value: null },
+		"uImageIncrement": { value: new THREE.Vector2( 0.001953125, 0.0 ) },
+		"cKernel":         { value: [] }
 
 	},
 

+ 2 - 2
examples/js/shaders/CopyShader.js

@@ -8,8 +8,8 @@ THREE.CopyShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"opacity":  { type: "f", value: 1.0 }
+		"tDiffuse": { value: null },
+		"opacity":  { value: 1.0 }
 
 	},
 

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

@@ -10,10 +10,10 @@ THREE.DOFMipMapShader = {
 
 	uniforms: {
 
-		"tColor":   { type: "t", value: null },
-		"tDepth":   { type: "t", value: null },
-		"focus":    { type: "f", value: 1.0 },
-		"maxblur":  { type: "f", value: 1.0 }
+		"tColor":   { value: null },
+		"tDepth":   { value: null },
+		"focus":    { value: 1.0 },
+		"maxblur":  { value: 1.0 }
 
 	},
 

+ 11 - 11
examples/js/shaders/DigitalGlitch.js

@@ -14,17 +14,17 @@ THREE.DigitalGlitch = {
 
 	uniforms: {
 
-		"tDiffuse":		{ type: "t", value: null },//diffuse texture
-		"tDisp":		{ type: "t", value: null },//displacement texture for digital glitch squares
-		"byp":			{ type: "i", value: 0 },//apply the glitch ?
-		"amount":		{ type: "f", value: 0.08 },
-		"angle":		{ type: "f", value: 0.02 },
-		"seed":			{ type: "f", value: 0.02 },
-		"seed_x":		{ type: "f", value: 0.02 },//-1,1
-		"seed_y":		{ type: "f", value: 0.02 },//-1,1
-		"distortion_x":	{ type: "f", value: 0.5 },
-		"distortion_y":	{ type: "f", value: 0.6 },
-		"col_s":		{ type: "f", value: 0.05 }
+		"tDiffuse":		{ value: null },//diffuse texture
+		"tDisp":		{ value: null },//displacement texture for digital glitch squares
+		"byp":			{ value: 0 },//apply the glitch ?
+		"amount":		{ value: 0.08 },
+		"angle":		{ value: 0.02 },
+		"seed":			{ value: 0.02 },
+		"seed_x":		{ value: 0.02 },//-1,1
+		"seed_y":		{ value: 0.02 },//-1,1
+		"distortion_x":	{ value: 0.5 },
+		"distortion_y":	{ value: 0.6 },
+		"col_s":		{ value: 0.05 }
 	},
 
 	vertexShader: [

+ 5 - 5
examples/js/shaders/DotScreenShader.js

@@ -10,11 +10,11 @@ THREE.DotScreenShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"tSize":    { type: "v2", value: new THREE.Vector2( 256, 256 ) },
-		"center":   { type: "v2", value: new THREE.Vector2( 0.5, 0.5 ) },
-		"angle":    { type: "f", value: 1.57 },
-		"scale":    { type: "f", value: 1.0 }
+		"tDiffuse": { value: null },
+		"tSize":    { value: new THREE.Vector2( 256, 256 ) },
+		"center":   { value: new THREE.Vector2( 0.5, 0.5 ) },
+		"angle":    { value: 1.57 },
+		"scale":    { value: 1.0 }
 
 	},
 

+ 2 - 2
examples/js/shaders/EdgeShader.js

@@ -11,8 +11,8 @@ THREE.EdgeShader = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"aspect":    { type: "v2", value: new THREE.Vector2( 512, 512 ) },
+		"tDiffuse": { value: null },
+		"aspect":    { value: new THREE.Vector2( 512, 512 ) },
 	},
 
 	vertexShader: [

+ 2 - 2
examples/js/shaders/EdgeShader2.js

@@ -11,8 +11,8 @@ THREE.EdgeShader2 = {
 
 	uniforms: {
 
-		"tDiffuse": { type: "t", value: null },
-		"aspect":    { type: "v2", value: new THREE.Vector2( 512, 512 ) },
+		"tDiffuse": { value: null },
+		"aspect":    { value: new THREE.Vector2( 512, 512 ) },
 	},
 
 	vertexShader: [

+ 2 - 2
examples/js/shaders/FXAAShader.js

@@ -12,8 +12,8 @@ THREE.FXAAShader = {
 
 	uniforms: {
 
-		"tDiffuse":   { type: "t", value: null },
-		"resolution": { type: "v2", value: new THREE.Vector2( 1 / 1024, 1 / 512 ) }
+		"tDiffuse":   { value: null },
+		"resolution": { value: new THREE.Vector2( 1 / 1024, 1 / 512 ) }
 
 	},
 

+ 6 - 6
examples/js/shaders/FilmShader.js

@@ -24,12 +24,12 @@ THREE.FilmShader = {
 
 	uniforms: {
 
-		"tDiffuse":   { type: "t", value: null },
-		"time":       { type: "f", value: 0.0 },
-		"nIntensity": { type: "f", value: 0.5 },
-		"sIntensity": { type: "f", value: 0.05 },
-		"sCount":     { type: "f", value: 4096 },
-		"grayscale":  { type: "i", value: 1 }
+		"tDiffuse":   { value: null },
+		"time":       { value: 0.0 },
+		"nIntensity": { value: 0.5 },
+		"sIntensity": { value: 0.05 },
+		"sCount":     { value: 4096 },
+		"grayscale":  { value: 1 }
 
 	},
 

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