Browse Source

Merge branch 'dev' into ChainableEffect

Takahiro 8 years ago
parent
commit
6b75f6b4c2
41 changed files with 1428 additions and 548 deletions
  1. 19 15
      build/three.js
  2. 0 0
      build/three.js.map
  3. 9 111
      build/three.min.js
  4. 18 8
      build/three.modules.js
  5. 0 0
      build/three.modules.js.map
  6. 8 8
      docs/api/animation/AnimationAction.html
  7. 1 1
      docs/api/animation/AnimationClip.html
  8. 1 1
      docs/api/animation/AnimationMixer.html
  9. 4 4
      docs/api/cameras/OrthographicCamera.html
  10. 15 8
      docs/api/cameras/PerspectiveCamera.html
  11. 39 0
      docs/api/constants/Animation.html
  12. 0 51
      docs/api/constants/GLState.html
  13. 70 21
      docs/api/constants/Materials.html
  14. 0 42
      docs/api/constants/ShadowingTypes.html
  15. 226 51
      docs/api/constants/Textures.html
  16. 78 0
      docs/api/constants/WebGLRenderer.html
  17. 18 14
      docs/api/core/Clock.html
  18. 1 1
      docs/api/loaders/OBJLoader.html
  19. 132 57
      docs/api/materials/Material.html
  20. 1 1
      docs/api/materials/MeshBasicMaterial.html
  21. 1 1
      docs/api/materials/MeshLambertMaterial.html
  22. 1 1
      docs/api/materials/MeshPhongMaterial.html
  23. 2 2
      docs/api/renderers/WebGLRenderer.html
  24. 8 5
      docs/api/scenes/Fog.html
  25. 5 3
      docs/api/scenes/FogExp2.html
  26. 5 0
      docs/api/scenes/Scene.html
  27. 77 0
      docs/api/textures/CanvasTexture.html
  28. 41 17
      docs/api/textures/CompressedTexture.html
  29. 107 39
      docs/api/textures/Texture.html
  30. 100 0
      docs/api/textures/VideoTexture.html
  31. 6 4
      docs/list.js
  32. 264 15
      examples/js/animation/CCDIKSolver.js
  33. 69 45
      examples/js/animation/MMDPhysics.js
  34. 1 1
      examples/js/controls/OrbitControls.js
  35. 72 0
      examples/js/loaders/MMDLoader.js
  36. 7 2
      examples/webgl_loader_mmd.html
  37. 0 9
      rollup.config.js
  38. 1 1
      src/Three.js
  39. 17 5
      src/audio/AudioContext.js
  40. 2 2
      src/audio/AudioListener.js
  41. 2 2
      src/loaders/AudioLoader.js

+ 19 - 15
build/three.js

@@ -35241,17 +35241,27 @@
 
 	var context;
 
-	function getAudioContext() {
+	var AudioContext = {
 
-		if ( context === undefined ) {
+		getContext: function () {
 
-			context = new ( window.AudioContext || window.webkitAudioContext )();
+			if ( context === undefined ) {
 
-		}
+				context = new ( window.AudioContext || window.webkitAudioContext )();
+
+			}
 
-		return context;
+			return context;
 
-	}
+		},
+
+		setContext: function ( value ) {
+
+			context = value;
+
+		}
+
+	};
 
 	/**
 	 * @author Reece Aaron Lecrivain / http://reecenotes.com/
@@ -35271,7 +35281,7 @@
 			loader.setResponseType( 'arraybuffer' );
 			loader.load( url, function ( buffer ) {
 
-				var context = getAudioContext();
+				var context = AudioContext.getContext();
 
 				context.decodeAudioData( buffer, function ( audioBuffer ) {
 
@@ -35474,7 +35484,7 @@
 
 		this.type = 'AudioListener';
 
-		this.context = getAudioContext();
+		this.context = AudioContext.getContext();
 
 		this.gain = this.context.createGain();
 		this.gain.connect( this.context.destination );
@@ -42191,7 +42201,7 @@
 	exports.Camera = Camera;
 	exports.AudioListener = AudioListener;
 	exports.PositionalAudio = PositionalAudio;
-	exports.getAudioContext = getAudioContext;
+	exports.AudioContext = AudioContext;
 	exports.AudioAnalyser = AudioAnalyser;
 	exports.Audio = Audio;
 	exports.VectorKeyframeTrack = VectorKeyframeTrack;
@@ -42502,11 +42512,5 @@
 
 	Object.defineProperty(exports, '__esModule', { value: true });
 
-	Object.defineProperty( exports, 'AudioContext', {
-		get: function () {
-			return exports.getAudioContext();
-		}
-	});
-
 })));
 //# sourceMappingURL=three.js.map

File diff suppressed because it is too large
+ 0 - 0
build/three.js.map


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


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


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


+ 8 - 8
docs/api/animation/AnimationAction.html

@@ -1,13 +1,13 @@
 <!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>
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
     <h1>[name]</h1>
 
     <div class="desc">

+ 1 - 1
docs/api/animation/AnimationClip.html

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

+ 1 - 1
docs/api/animation/AnimationMixer.html

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

+ 4 - 4
docs/api/cameras/OrthographicCamera.html

@@ -51,7 +51,7 @@ scene.add( camera );</code>
 		<h2>Properties</h2>
 
 		<h3>[property:number zoom]</h3>
-		<div>Gets or sets the zoom factor of the camera. </div>
+		<div>Gets or sets the zoom factor of the camera. Default is *1*.</div>
 
 		<h3>[property:Float left]</h3>
 		<div>Camera frustum left plane.</div>
@@ -66,10 +66,10 @@ scene.add( camera );</code>
 		<div>Camera frustum bottom plane.</div>
 
 		<h3>[property:Float near]</h3>
-		<div>Camera frustum near plane.</div>
+		<div>Camera frustum near plane. Default is *0.1*.</div>
 
 		<h3>[property:Float far]</h3>
-		<div>Camera frustum far plane.</div>
+		<div>Camera frustum far plane. Default is *2000*.</div>
 
 
 		<h2>Methods</h2>
@@ -101,7 +101,7 @@ scene.add( camera );</code>
 		<h3>[method:OrthographicCamera clone]()</h3>
 		<div>
 		<br />
-		It returns a clone of OrthographicCamera.
+		Returns a clone of the OrthographicCamera.
 		</div>
 
 

+ 15 - 8
docs/api/cameras/PerspectiveCamera.html

@@ -43,31 +43,38 @@ scene.add( camera );</code>
 		<h2>Properties</h2>
 
 		<h3>[property:Float fov]</h3>
-		<div>Camera frustum vertical field of view, from bottom to top of view, in degrees.</div>
+		<div>Camera frustum vertical field of view, from bottom to top of view, in degrees. Default is *50*.</div>
 
 		<h3>[property:number zoom]</h3>
-		<div>Gets or sets the zoom factor of the camera. </div>
+		<div>Gets or sets the zoom factor of the camera. Default is *1*.</div>
 
 		<h3>[property:Float near]</h3>
-		<div>Camera frustum near plane.</div>
+		<div>Camera frustum near plane. Default is *0.1*.</div>
 
 		<h3>[property:Float far]</h3>
-		<div>Camera frustum far plane.</div>
+		<div>Camera frustum far plane. Default is *2000*.</div>
 
 		<h3>[property:Float focus]</h3>
-		<div>Object distance used for stereoscopy and depth-of-field effects. This parameter does not influence the projection matrix unless a StereoCamera is being used.</div>
+		<div>Object distance used for stereoscopy and depth-of-field effects.
+			This parameter does not influence the projection matrix unless a StereoCamera is being used.
+			Default is *10*.
+		</div>
 
 		<h3>[property:Float aspect]</h3>
-		<div>Camera frustum aspect ratio, window width divided by window height.</div>
+		<div>Camera frustum aspect ratio, usually the canvas width / canvas height. Default is *1* (square canvas).</div>
 
 		<h3>[property:Object view]</h3>
-		<div>Frustum window specification or null.</div>
+		<div>
+			Frustum window specification or null.
+			This is set using the [page:PerspectiveCamera.setViewOffset .setViewOffset] method
+			and cleared using [page:PerspectiveCamera.clearViewOffset .clearViewOffset].
+		</div>
 
 		<h3>[property:Float filmGauge]</h3>
 		<div>Film size used for the larger axis. Default is 35 (millimeters). This parameter does not influence the projection matrix unless .filmOffset is set to a nonzero value.</div>
 
 		<h3>[property:Float filmOffset]</h3>
-		<div>Horizontal off-center offset in the same unit as .filmGauge.</div>
+		<div>Horizontal off-center offset in the same unit as .filmGauge. Default is *0*.</div>
 
 		<h2>Methods</h2>
 

+ 39 - 0
docs/api/constants/Animation.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>Animation Constants</h1>
+
+		<h2>Loop Modes</h2>
+    
+		<code>
+THREE.LoopOnce
+THREE.LoopRepeat
+THREE.LoopPingPong
+		</code>
+
+    <h2>Interpolation Modes</h2>
+    <code>
+THREE.InterpolateDiscrete
+THREE.InterpolateLinear
+THREE.InterpolateSmooth
+    </code>
+
+    <h2>Ending Modes</h2>
+    <code>
+THREE.ZeroCurvatureEnding
+THREE.ZeroSlopeEnding
+THREE.WrapAroundEnding
+    </code>
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
+	</body>
+</html>

+ 0 - 51
docs/api/constants/GLState.html

@@ -1,51 +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>
-		<h1>GL State Constants</h1>
-		These are used by the WebGLRenderer to set gl.cullFace and gl.frontFace states in the GPU.
-
-		<h2>Cull Face Modes</h2>
-		<code>
-		THREE.CullFaceNone
-		</code>
-		<p>Disable face culling.</p>
-		<code>
-		THREE.CullFaceBack
-		</code>
-		<p>Cull back faces (default).</p>
-		<code>
-		THREE.CullFaceFront
-		</code>
-		<p>Cull front faces.</p>
-		<code>
-		THREE.CullFaceFrontBack
-		</code>
-		<p>Cull both front and back faces.</p>
-
-		<h2>Front Face Direction</h2>
-		Set the winding order for polygons to either clockwise or counter-clockwise (default).
-		<code>
-		THREE.FrontFaceDirectionCW
-		THREE.FrontFaceDirectionCCW
-		</code>
-
-		<h2>Usage</h2>
-
-		<code>
-		var renderer = new THREE.WebGLRenderer();
-
-		renderer.setFaceCulling ( THREE.CullFaceBack, THREE.FrontFaceDirectionCCW );  //defaults
-		</code>
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
-	</body>
-</html>

+ 70 - 21
docs/api/constants/Materials.html

@@ -10,47 +10,96 @@
 	<body>
 		<h1>Material Constants</h1>
 
+		<div class="desc">
+		These constants define properties common to all material types,
+		with the exception of Texture Combine Operations which only apply to [page:MeshBasicMaterial.combine MeshBasicMaterial], [page:MeshLambertMaterial.combine MeshLambertMaterial] and [page:MeshPhongMaterial.combine MeshPhongMaterial].<br />
+		</div>
+
+
 		<h2>Side</h2>
-		<div>
-		THREE.FrontSide<br />
-		THREE.BackSide<br />
+		<code>
+		THREE.FrontSide
+		THREE.BackSide
 		THREE.DoubleSide
+		</code>
+		<div>
+		Defines which side of faces will be rendered - front, back or both.
+		Default is [page:Constant FrontSide].
 		</div>
 
+
 		<h2>Shading</h2>
+		<code>
+	  THREE.SmoothShading
+		THREE.FlatShading
+		</code>
 		<div>
-		THREE.FlatShading<br />
-		THREE.SmoothShading
+		[page:Constant SmoothShading] is the default and linearly interpolates color between vertices.<br />
+		[page:Constant FlatShading] uses the color of the first vertex for every pixel in a face.
 		</div>
 
 		<h2>Colors</h2>
-		<div>
-		THREE.NoColors<br />
-		THREE.FaceColors<br />
+		<code>
+		THREE.NoColors
+		THREE.FaceColors
 		THREE.VertexColors
+		</code>
+		<div>
+		[page:Constant NoColors] is the default and applies the material's color to all faces.<br />
+		[page:Constant FaceColors] colors faces according to each [page:Face3 Face3][property:Color color] value.<br />
+		[page:Constant VertexColors] colors faces according to each [page:Face3 Face3][property:Array vertexColors] value. This is an array of three [page:Color Color]s, one for each vertex in the face.<br />
+		See the [example:webgl_geometry_colors geometry / colors] example.
 		</div>
 
 		<h2>Blending Mode</h2>
-		<div>
-		THREE.NoBlending<br />
-		THREE.NormalBlending<br />
-		THREE.AdditiveBlending<br />
-		THREE.SubtractiveBlending<br />
-		THREE.MultiplyBlending<br />
+		<code>
+		THREE.NoBlending
+		THREE.NormalBlending
+		THREE.AdditiveBlending
+		THREE.SubtractiveBlending
+		THREE.MultiplyBlending
 		THREE.CustomBlending
+		</code>
+		<div>
+		These control the source and destination blending equations for the material's RGB and Alpha sent to the WebGLRenderer for use by WebGL.<br />
+		[page:Constant NormalBlending] is the default.<br />
+		Note that [page:Constant CustomBlending] must be set to use [page:CustomBlendingEquation Custom Blending Equations].<br />
+		See the [example:webgl_materials_blending materials / blending] example.<br />
 		</div>
 
 		<h2>Depth Mode</h2>
-		<div>
-		THREE.NeverDepth<br />
-		THREE.AlwaysDepth<br />
-		THREE.LessDepth<br />
-		THREE.LessEqualDepth<br />
-		THREE.GreaterEqualDepth<br />
-		THREE.GreaterDepth<br />
+		<code>
+		THREE.NeverDepth
+		THREE.AlwaysDepth
+		THREE.LessDepth
+		THREE.LessEqualDepth
+		THREE.GreaterEqualDepth
+		THREE.GreaterDepth
 		THREE.NotEqualDepth
+		</code>
+		<div>
+		Which depth function the material uses to compare incoming pixels Z-depth against the current Z-depth buffer value. If the result of the comparison is true, the pixel will be drawn.<br />
+		[page:Materials NeverDepth] will never return true.<br />
+		[page:Materials AlwaysDepth] will always return true.<br />
+		[page:Materials LessDepth] will return true if the incoming pixel Z-depth is less than the current buffer Z-depth.<br />
+		[page:Materials LessEqualDepth] is the default and will return true if the incoming pixel Z-depth is less than or equal to the current buffer Z-depth.<br />
+		[page:Materials GreaterEqualDepth] will return true if the incoming pixel Z-depth is greater than or equal to the current buffer Z-depth.<br />
+		[page:Materials GreaterDepth] will return true if the incoming pixel Z-depth is greater than the current buffer Z-depth.<br />
+		[page:Materials NotEqualDepth] will return true if the incoming pixel Z-depth is equal to the current buffer Z-depth.<br />
 		</div>
 
+		<h2>Texture Combine Operations</h2>
+		<code>
+		THREE.MultiplyOperation
+		THREE.MixOperation
+		THREE.AddOperation
+		</code>
+		These define how the result of the surface's color is combined with the environment map (if present), for [page:MeshBasicMaterial.combine MeshBasicMaterial], [page:MeshLambertMaterial.combine MeshLambertMaterial] and [page:MeshPhongMaterial.combine MeshPhongMaterial]. <br />
+		[page:Constant MultiplyOperation] is the default and multiplies the environment map color with the surface color.<br />
+		[page:Constant MixOperation] uses reflectivity to blend between the two colors.<br />
+		[page:Constant AddOperation] adds the two colors.
+
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]

+ 0 - 42
docs/api/constants/ShadowingTypes.html

@@ -1,42 +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>
-		<h1>Shadowing Type Constants</h1>
-		<p>These define the shadow map types used by the WebGLRenderer.</p>
-
-		<h2>Shadow Map Types</h2>
-		<code>
-		THREE.BasicShadowMap
-		</code>
-		<p>Unfiltered shadow maps - fastest, but lowest quality.</p>
-		<code>
-		THREE.PCFShadowMap
-		</code>
-		<p>Shadow maps filtered using the Percentage-Closer Filtering (PCF) algorithm (default).</p>
-		<code>
-		THREE.PCFSoftShadowMap
-		</code>
-		<p>Shadow maps filtered using the Percentage-Closer Soft Shadows (PCSS) algorithm.</p>
-
-		<h2>Usage</h2>
-		<code>
-		var renderer = new THREE.WebGLRenderer();
-		renderer.shadowMap.enabled = true;
-		renderer.shadowMap.type = THREE.PCFShadowMap; //default
-		</code>
-
-		Note that this just enables shadows in the renderer and sets the shadow map type. <br />
-		To actually cast shadows you will have to set up shadows for the any light you want to cast shadows, and for meshes you want to cast / receive shadows. <br />
-
-		<h2>Source</h2>
-
-		[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
-	</body>
-</html>

+ 226 - 51
docs/api/constants/Textures.html

@@ -10,83 +10,258 @@
 	<body>
 		<h1>Texture Constants</h1>
 
-		<h2>Operations</h2>
-		<div>
-		THREE.MultiplyOperation<br />
-		THREE.MixOperation<br />
-		THREE.AddOperation
-		</div>
-
 		<h2>Mapping Modes</h2>
-		<div>
-		THREE.UVMapping<br />
-		THREE.CubeReflectionMapping<br />
-		THREE.CubeRefractionMapping<br />
-		THREE.EquirectangularReflectionMapping<br />
-		THREE.EquirectangularRefractionMapping<br />
+		<code>
+		THREE.UVMapping
+		THREE.CubeReflectionMapping
+		THREE.CubeRefractionMapping
+		THREE.EquirectangularReflectionMapping
+		THREE.EquirectangularRefractionMapping
 		THREE.SphericalReflectionMapping
+		THREE.CubeUVReflectionMapping
+		THREE.CubeUVRefractionMapping
+		</code>
+		<div>
+		These define the texture's mapping mode.<br />
+		[page:Constant UVMapping] is the default, and maps the texture using the mesh's UV coordinates.<br /><br />
+
+		The rest define environment mapping types.<br /><br />
+
+		[page:Constant CubeReflectionMapping] and [page:Constant CubeRefractionMapping] are for
+		use with a [page:CubeTexture CubeTexture], which is made up of six textures, one for each face of the cube.<br />
+		[page:Constant CubeReflectionMapping] is the default for a [page:CubeTexture CubeTexture]. <br /><br />
+
+		[page:Constant EquirectangularReflectionMapping] and [page:Constant EquirectangularRefractionMapping]
+		are for use with an equirectangular environment map.<br /><br />
+
+		[page:Constant SphericalReflectionMapping] is for use with a spherical reflection map.<br /><br />
+
+		See the [example:webgl_materials_envmaps materials / envmaps] example.
 		</div>
 
+
 		<h2>Wrapping Modes</h2>
-		<div>
-		THREE.RepeatWrapping<br />
-		THREE.ClampToEdgeWrapping<br />
+		<code>
+		THREE.RepeatWrapping
+		THREE.ClampToEdgeWrapping
 		THREE.MirroredRepeatWrapping
+		</code>
+		<div>
+		These define the texture's [page:Texture.wrapS wrapS] and [page:Texture.wrapT wrapT] properties,
+		which define horizontal and vertical texture wrapping.<br /><br />
+
+		With [page:constant RepeatWrapping] the texture will simply repeat to infinity.<br /><br />
+
+		[page:constant ClampToEdgeWrapping] is the default.
+		The last pixel of the texture stretches to the edge of the mesh.<br /><br />
+
+		With [page:constant MirroredRepeatWrapping] the texture will repeats to infinity, mirroring on each repeat.<br />
 		</div>
 
-		<h2>Filters</h2>
+		<h2>Magnification Filters</h2>
+		<code>
+		THREE.NearestFilter
+		THREE.LinearFilter
+		</code>
 		<div>
-		THREE.NearestFilter<br />
-		THREE.NearestMipMapNearestFilter<br />
-		THREE.NearestMipMapLinearFilter<br />
-		THREE.LinearFilter<br />
-		THREE.LinearMipMapNearestFilter<br />
-		THREE.LinearMipMapLinearFilter
+		For use with a texture's [page:Texture.magFilter magFilter]	property,
+		these define the texture magnification function to be used when the pixel being textured maps to an
+		area less than or equal to one texture element (texel).<br /><br />
+
+		[page:constant NearestFilter] returns the value of the texture element that is nearest
+		(in Manhattan distance) to the specified texture coordinates.<br /><br />
+
+		[page:constant LinearFilter] is the default and returns the weighted average
+		of the four texture elements that are closest to the specified texture coordinates,
+		and can include items wrapped or repeated from other parts of a texture,
+		depending on the values of [page:Texture.wrapS wrapS] and [page:Texture.wrapT wrapT], and on the exact mapping.
 		</div>
 
-		<h2>Data Types</h2>
+		<h2>Minification Filters</h2>
+		<code>
+		THREE.NearestFilter
+		THREE.NearestMipMapNearestFilter
+		THREE.NearestMipMapLinearFilter
+		THREE.LinearFilter
+		THREE.LinearMipMapNearestFilter
+		THREE.LinearMipMapLinearFilter
+		</code>
 		<div>
-		THREE.UnsignedByteType<br />
-		THREE.ByteType<br />
-		THREE.ShortType<br />
-		THREE.UnsignedShortType<br />
-		THREE.IntType<br />
-		THREE.UnsignedIntType<br />
-		THREE.FloatType<br />
-		THREE.HalfFloatType
+		For use with a texture's [page:Texture.minFilter minFilter]	property, these define
+		the texture minifying function that is used whenever the pixel being textured maps
+		to an area greater than one texture element (texel).<br /><br />
+
+		In addition to [page:constant NearestFilter] and [page:constant LinearFilter],
+		the following four functions can be used for minification:<br /><br />
+
+		[page:constant NearestMipMapNearestFilter] chooses the mipmap that most closely
+		matches the size of the pixel being textured
+		and uses the [page:constant NearestFilter] criterion (the texel nearest to the
+		center of the pixel) to produce a texture value.<br /><br />
+
+		[page:constant NearestMipMapLinearFilter] chooses the two mipmaps that most closely
+		match the size of the pixel being textured and uses the [page:constant NearestFilter] criterion to produce
+		a texture value from each mipmap. The final texture value is a weighted average of those two values.<br /><br />
+
+		[page:constant LinearMipMapNearestFilter] chooses the mipmap that most closely matches
+		the size of the pixel being textured and uses the [page:constant LinearFilter] criterion
+		(a weighted average of the four texels that are closest to the center of the pixel)
+		to produce a texture value.<br /><br />
+
+		[page:constant LinearMipMapLinearFilter] is the default and chooses the two mipmaps
+		that most closely match the size of the pixel being textured and uses the [page:constant LinearFilter] criterion
+		to produce a texture value from each mipmap. The final texture value is a weighted average of those two values.<br /><br />
+
+		See the [example:webgl_materials_texture_filters materials / texture / filters] example.
 		</div>
 
-		<h2>Pixel Types</h2>
-		<div>
-		THREE.UnsignedShort4444Type<br />
-		THREE.UnsignedShort5551Type<br />
+		<h2>Types</h2>
+		<code>
+		THREE.UnsignedByteType
+		THREE.ByteType
+		THREE.ShortType
+		THREE.UnsignedShortType
+		THREE.IntType
+		THREE.UnsignedIntType
+		THREE.FloatType
+		THREE.HalfFloatType
+		THREE.UnsignedShort4444Type
+		THREE.UnsignedShort5551Type
 		THREE.UnsignedShort565Type
+		THREE.UnsignedInt248Type
+		</code>
+		<div>
+		For use with a texture's [page:Texture.type type]	property, which must correspond to the correct format. See below for details.<br /><br />
+
+		[page:constant UnsignedByteType] is the default.
 		</div>
 
-		<h2>Pixel Formats</h2>
-		<div>
-		THREE.AlphaFormat<br />
-		THREE.RGBFormat<br />
-		THREE.RGBAFormat<br />
-		THREE.LuminanceFormat<br />
-		THREE.LuminanceAlphaFormat<br />
+		<h2>Formats</h2>
+		<code>
+		THREE.AlphaFormat
+		THREE.RGBFormat
+		THREE.RGBAFormat
+		THREE.LuminanceFormat
+		THREE.LuminanceAlphaFormat
 		THREE.RGBEFormat
+		THREE.DepthFormat
+		THREE.DepthStencilFormat
+		</code>
+		<div>
+		For use with a texture's [page:Texture.format format]	property, these define
+		how elements of a 2d texture, or *texels*, are read by shaders.<br /><br />
+
+		[page:constant AlphaFormat] discards the red, green and blue components and reads just the alpha component.
+		The [page:Texture.type type] must be [page:constant UnsignedByteType].<br /><br />
+
+		[page:constant RGBFormat] discards the alpha components and reads the red, green and blue components.
+		The [page:Texture.type type] must be [page:constant UnsignedByteType] or [page:constant UnsignedShort565Type].<br /><br />
+
+		[page:constant RGBAFormat] is the default and reads the red, green, blue and alpha components.
+		The [page:Texture.type type] must be [page:constant UnsignedByteType], [page:constant UnsignedShort4444Type] or [page:constant THREE.UnsignedShort5551Type].<br /><br />
+
+		[page:constant LuminanceFormat] reads each element as a single luminance component.
+		 This is then converted to a floating point, clamped to the range [0,1], and then assembled
+		 into an RGBA element by placing the luminance value in the red, green and blue channels,
+		 and attaching 1.0 to the alpha channel. The [page:Texture.type type] must be [page:constant UnsignedByteType].<br /><br />
+
+		[page:constant LuminanceAlphaFormat] reads each element as a luminance/alpha double.
+		The same process occurs as for the [page:constant LuminanceFormat], except that the
+		alpha channel may have values other than *1.0*. The [page:Texture.type type] must be [page:constant UnsignedByteType].<br /><br />
+
+		[page:constant RGBEFormat] is identical to [page:constant RGBAFormat].<br /><br />
+
+		[page:constant DepthFormat] reads each element as a single depth value, converts it to floating point, and clamps to the range [0,1].
+		The [page:Texture.type type] must be [page:constant UnsignedIntType] or [page:constant UnsignedShortType].
+		This is the default for [page:DepthTexture DepthTexture].<br /><br />
+
+		[page:constant DepthStencilFormat] reads each element is a pair of depth and stencil values.
+		The depth component of the pair is interpreted as in [page:constant DepthFormat].
+		The stencil component is interpreted based on the depth + stencil internal format.
+		The [page:Texture.type type] must be [page:constant UnsignedInt248Type].<br /><br />
+
+		Note that the texture must have the correct [page:Texture.type type] set, as described above.
+		See <a href="https://developer.mozilla.org/en/docs/Web/API/WebGLRenderingContext/texImage2D">this page</a> for details.
 		</div>
 
 		<h2>DDS / ST3C Compressed Texture Formats</h2>
-		<div>
-		THREE.RGB_S3TC_DXT1_Format<br />
-		THREE.RGBA_S3TC_DXT1_Format<br />
-		THREE.RGBA_S3TC_DXT3_Format<br />
+		<code>
+		THREE.RGB_S3TC_DXT1_Format
+		THREE.RGBA_S3TC_DXT1_Format
+		THREE.RGBA_S3TC_DXT3_Format
 		THREE.RGBA_S3TC_DXT5_Format
+		</code>
+		<div>
+		For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+		these require support for the
+		<a href="https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_s3tc/">WEBGL_compressed_texture_s3tc</a>
+		extension. <br />
+		According to <a href="http://webglstats.com/">WebglStats</a>, as of February 2016
+		over 80% of WebGL enabled devices support this extension.<br /><br />
+
+		There are four <a href="https://en.wikipedia.org/wiki/S3_Texture_Compression">S3TC</a> formats available via this extension. These are:<br />
+		[page:constant RGB_S3TC_DXT1_Format]: A DXT1-compressed image in an RGB image format.<br />
+		[page:constant RGBA_S3TC_DXT1_Format]: A DXT1-compressed image in an RGB image format with a simple on/off alpha value.<br />
+		[page:constant RGBA_S3TC_DXT3_Format]: A DXT3-compressed image in an RGBA image format. Compared to a 32-bit RGBA texture, it offers 4:1 compression.<br />
+		[page:constant RGBA_S3TC_DXT5_Format]: A DXT5-compressed image in an RGBA image format. It also provides a 4:1 compression, but differs to the DXT3 compression in how the alpha compression is done.<br />
 		</div>
 
 		<h2>PVRTC Compressed Texture Formats</h2>
-		<div>
-		THREE.RGB_PVRTC_4BPPV1_Format<br />
-		THREE.RGB_PVRTC_2BPPV1_Format<br />
-		THREE.RGBA_PVRTC_4BPPV1_Format<br />
+		<code>
+		THREE.RGB_PVRTC_4BPPV1_Format
+		THREE.RGB_PVRTC_2BPPV1_Format
+		THREE.RGBA_PVRTC_4BPPV1_Format
 		THREE.RGBA_PVRTC_2BPPV1_Format
+		</code>
+		<div>
+		For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+		these require support for the <a href="https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_pvrtc/">WEBGL_compressed_texture_pvrtc</a>
+		extension. <br />
+		According to <a href="http://webglstats.com/">WebglStats</a>, as of February 2016
+		less than 8% of WebGL enabled devices support this extenstion.
+		PVRTC is typically only available on mobile devices with PowerVR chipsets,
+		which are mainly Apple devices.<br /><br />
+
+		There are four <a href="https://en.wikipedia.org/wiki/PVRTC">PVRTC</a> formats available via this extension. These are:<br />
+		[page:constant RGB_PVRTC_4BPPV1_Format]: RGB compression in 4-bit mode. One block for each 4×4 pixels.<br />
+		[page:constant RGB_PVRTC_2BPPV1_Format]: RGB compression in 2-bit mode. One block for each 8×4 pixels.<br />
+		[page:constant RGBA_PVRTC_4BPPV1_Format]: RGBA compression in 4-bit mode. One block for each 4×4 pixels.<br />
+		[page:constant RGBA_PVRTC_2BPPV1_Format]: RGBA compression in 2-bit mode. One block for each 8×4 pixels.<br />
+		</div>
+
+		<h2>ETC Compressed Texture Format</h2>
+		<code>
+		THREE.RGB_ETC1_Format
+		</code>
+		<div>
+		For use with a [page:CompressedTexture CompressedTexture]'s [page:Texture.format format]	property,
+		these require support for the <a href="https://www.khronos.org/registry/webgl/extensions/WEBGL_compressed_texture_etc1/">WEBGL_compressed_texture_etc1</a>
+		extension. <br />
+		According to <a href="http://webglstats.com/">WebglStats</a>, as of February 2016
+		just over 13% of WebGL enabled devices support this extenstion.<br /><br />
+		</div>
+
+		<h2>Encoding</h2>
+		<code>
+		THREE.LinearEncoding
+		THREE.sRGBEncoding
+		THREE.GammaEncoding
+		THREE.RGBEEncoding
+		THREE.LogLuvEncoding
+		THREE.RGBM7Encoding
+		THREE.RGBM16Encoding
+		THREE.RGBDEncoding
+		THREE.BasicDepthPacking
+		THREE.RGBADepthPacking
+		</code>
+		<div>
+		For use with a Texture's [page:Texture.encoding encoding]	property.<br /><br />
+
+		If the encoding type is changed after the texture has already been used by a material,
+		you will need to set [page:Material.needsUpdate Material.needsUpdate] to *true* to make the material recompile.<br /><br />
+
+		[page:constant LinearEncoding] is the default.
+		Values other than this are only valid for a material's map, envMap and emissiveMap.
 		</div>
 
 		<h2>Source</h2>

+ 78 - 0
docs/api/constants/WebGLRenderer.html

@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html lang="en">
+	<head>
+		<meta charset="utf-8" />
+		<base href="../../" />
+		<script src="list.js"></script>
+		<script src="page.js"></script>
+		<link type="text/css" rel="stylesheet" href="page.css" />
+	</head>
+	<body>
+		<h1>WebGLRenderer Constants</h1>
+
+		<h2>Cull Face Modes</h2>
+		<code>
+		THREE.CullFaceNone
+		THREE.CullFaceBack
+		THREE.CullFaceFront
+		THREE.CullFaceFrontBack
+		</code>
+		<div>
+		These are used by the WebGLRenderer's [page:WebGLRenderer.setFaceCulling setFaceCulling] method.<br /><br />
+		[page:constant CullFaceNone] disables face culling.<br />
+		[page:constant CullFaceBack] culls back faces (default).<br />
+		[page:constant CullFaceFront] culls front faces.<br />
+		[page:constant CullFaceFrontBack] culls both front and back faces.
+		</div>
+
+		<h2>Front Face Direction</h2>
+		<code>
+		THREE.FrontFaceDirectionCW
+		THREE.FrontFaceDirectionCCW
+		</code>
+		<div>
+		These are used by the WebGLRenderer's [page:WebGLRenderer.setFaceCulling setFaceCulling] method.<br /><br />
+		[page:constant FrontFaceDirectionCW] sets the winding order for polygons to clockwise.<br />
+		[page:constant FrontFaceDirectionCW] sets the winding order for polygons to counter-clockwise (default).
+		</div>
+
+		<h2>Shadow Types</h2>
+		<code>
+		THREE.BasicShadowMap
+		THREE.PCFShadowMap
+		THREE.PCFSoftShadowMap
+		</code>
+		<div>
+		These define the WebGLRenderer's [page:WebGLRenderer.shadowMap.type shadowMap.type] property.<br /><br />
+
+		[page:constant BasicShadowMap] gives unfiltered shadow maps - fastest, but lowest quality.<br />
+		[page:constant PCFShadowMap] filters shadow maps using the Percentage-Closer Filtering (PCF) algorithm (default).<br />
+		[page:constant PCFSoftShadowMap] filters shadow maps using the Percentage-Closer Soft Shadows (PCSS) algorithm.
+		</div>
+
+		<h2>Tone Mapping</h2>
+		<code>
+		THREE.NoToneMapping
+		THREE.LinearToneMapping
+		THREE.ReinhardToneMapping
+		THREE.Uncharted2ToneMapping
+		THREE.CineonToneMapping
+		</code>
+		<div>
+		These define the WebGLRenderer's [page:WebGLRenderer.toneMapping toneMapping] property.
+		This is used to approximate the appearance of high dynamic range (HDR) on the
+		low dynamic range medium of a standard computer monitor or mobile device's screen.<br /><br />
+
+		[page:constant NoToneMapping] disables tone mapping.<br />
+		[page:constant LinearToneMapping] is the default.<br /><br />
+
+		See the [example:webgl_tonemapping WebGL / tonemapping] example.
+
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/constants.js src/constants.js]
+	</body>
+</html>

+ 18 - 14
docs/api/core/Clock.html

@@ -10,7 +10,10 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">Object for keeping track of time.</div>
+		<div class="desc">
+		Object for keeping track of time. This uses <a href="https://developer.mozilla.org/en-US/docs/Web/API/Performance/now">performance.now()</a>
+		if it is available, otherwise it reverts to the less accurate <a href="https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date/now">Date.now()</a>.
+		</div>
 
 
 		<h2>Constructor</h2>
@@ -18,38 +21,36 @@
 
 		<h3>[name]( [page:Boolean autoStart] )</h3>
 		<div>
-		autoStart — Automatically start the clock. Default is true.
+		autoStart — (optional) whether to automatically start the clock. Default is true.
 		</div>
 
 		<h2>Properties</h2>
 
 		<h3>[property:Boolean autoStart]</h3>
 		<div>
-		If set, starts the clock automatically when the first update is called.
+		If set, starts the clock automatically when the first update is called. Default is true.
 		</div>
 
 		<h3>[property:Float startTime]</h3>
 		<div>
-		When the clock is running, It holds the start time of the clock. <br />
-		This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
+		Holds the time at which the clock's [page:Clock.start start] method was last called.
  		</div>
 
 
 		<h3>[property:Float oldTime]</h3>
 		<div>
-		When the clock is running, It holds the previous time from a update.<br />
-		This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
+		Holds the time at which the clock's [page:Clock.start start], [page:Clock.getElapsedTime getElapsedTime] or [page:Clock.getDelta getDelta]
+		methods were last called.
  		</div>
 
 		<h3>[property:Float elapsedTime]</h3>
 		<div>
-		When the clock is running, It holds the time elapsed between the start of the clock to the previous update.<br />
-		This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
+		Keeps track of the total time that the clock has been running.
  		</div>
 
 		<h3>[property:Boolean running]</h3>
 		<div>
-		This property keeps track whether the clock is running or not.
+		Whether the clock is running or not.
  		</div>
 
 
@@ -57,22 +58,25 @@
 
 		<h3>[method:null start]()</h3>
 		<div>
-		Starts clock.
+		Starts clock. Also sets the [page:Clock.startTime startTime] and [page:Clock.oldTime oldTime]
+		to the current time, sets [page:Clock.elapsedTime elapsedTime] to *0* and [page:Clock.running running] to *true*.
 		</div>
 
 		<h3>[method:null stop]()</h3>
 		<div>
-		Stops clock.
+		Stops clock and sets [page:Clock.oldTime oldTime] to the current time.
 		</div>
 
 		<h3>[method:Float getElapsedTime]()</h3>
 		<div>
-		Get the seconds passed since the clock started.
+		Get the seconds passed since the clock started and sets [page:Clock.oldTime oldTime] to the current time.<br />
+		If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
 		</div>
 
 		<h3>[method:Float getDelta]()</h3>
 		<div>
-		Get the seconds passed since the last call to this method.
+		Get the seconds passed since the time [page:Clock.oldTime oldTime] was set and sets [page:Clock.oldTime oldTime] to the current time.<br />
+		If [page:Clock.autoStart autoStart] is *true* and the clock is not running, also starts the clock.
 		</div>
 
 

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

@@ -47,7 +47,7 @@
 		<div>
 		Returns an [page:Object3D]. It contains the parsed meshes as [page:Mesh] and lines as [page:LineSegments].<br />
 		All geometry is created as [page:BufferGeometry]. Default materials are created as [page:MeshPhongMaterial].<br />
-		If an <em>obj</em> object or group uses multiple materials while declaring faces geometry groups and an [page:MultiMaterial] is used.
+		If an <em>obj</em> object or group uses multiple materials while declaring faces geometry groups and a [page:MultiMaterial] is used.
 		</div>
 
 		<h2>Example</h2>

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

@@ -10,8 +10,15 @@
 	<body>
 		<h1>[name]</h1>
 
-		<div class="desc">Materials describe the appearance of [page:Object objects]. They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.</div>
-
+		<div class="desc">
+		<p>
+		Materials describe the appearance of [page:Object objects].
+		They are defined in a (mostly) renderer-independent way, so you don't have to rewrite materials if you decide to use a different renderer.
+		</p>
+		<P>
+		With the exception of [page:MultiMaterial MultiMaterial], the following properties and methods are inherited by all other material types (although they may have different defaults).
+		</P>
+		</div>
 
 		<h2>Constructor</h2>
 
@@ -34,55 +41,96 @@
 		Material name. Default is an empty string.
 		</div>
 
+		<h3>[property:String type]</h3>
+		<div>
+		Value is the string 'Material'. This shouldn't be changed, and can be used to find all objects of this type in a scene.
+		</div>
+
+		<h3>[property:Boolean fog]</h3>
+		<div>
+		Whether the material is affected by fog. Default is *true*.
+		</div>
+
+		<h3>[property:Boolean lights]</h3>
+		<div>
+		Whether the material is affected by lights. Default is *true*.
+		</div>
+
+		<h3>[property:Integer side]</h3>
+		<div>
+		Defines which side of faces will be rendered - front, back or both.
+		Default is [page:Materials THREE.FrontSide].
+		Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
+		</div>
+
+		<h3>[property:Integer shading]</h3>
+		<div>
+		Defines how the material is shaded.
+		This can be either [page:Materials THREE.SmoothShading] (default)	or [page:Materials THREE.FlatShading].
+		</div>
+
+		<h3>[property:Integer vertexColors]</h3>
+		<div>
+		Defines whether vertex coloring is used.
+		Default is [page:Materials THREE.NoColors].
+		Other options are [page:Materials THREE.VertexColors] and [page:Materials THREE.FaceColors].
+		</div>
+
 		<h3>[property:Float opacity]</h3>
 		<div>
-		Float in the range of 0.0 - 1.0 indicating how transparent the material is.
-		A value of 0.0 indicates fully transparent, 1.0 is fully opaque. If
-		*transparent* is not set to true for the material, the material will remain
-		fully opaque and this value will only affect its color.
+		Float in the range of *0.0* - *1.0* indicating how transparent the material is.
+		A value of *0.0* indicates fully transparent, *1.0* is fully opaque.<br />
+		If the material's [property:Boolean transparent] property is not set to *true*, the material will remain
+		fully opaque and this value will only affect its color. <br />
+		Default is *1.0*.
 		</div>
-		<div>Default is *1.0*.</div>
 
 		<h3>[property:Boolean transparent]</h3>
 		<div>
 		Defines whether this material is transparent. This has an effect on rendering
-		as transparent objects need special treatment and are rendered after 
-		non-transparent objects. For a working example of this behaviour, check the
-		[page:WebGLRenderer WebGLRenderer] code.<br />
+		as transparent objects need special treatment and are rendered after
+		non-transparent objects. <br />
 		When set to true, the extent to which the material is transparent is
-		controlled by setting *opacity*.
+		controlled by setting it's [property:Float opacity] property. <br />
+		Default is *false*.
 		</div>
-		<div>Default is *false*.</div>
 
 		<h3>[property:Blending blending]</h3>
 		<div>
-		Which blending to use when displaying objects with this material. Default is [page:Materials NormalBlending]. See the blending mode [page:Materials constants] for all possible values.
-
+		Which blending to use when displaying objects with this material. <br />
+		This must be set to [page:Materials CustomBlending] to use custom [property:Constant blendSrc], [property:Constant blendDst] or [property:Constant blendEquation].<br />
+		See the blending mode [page:Materials constants] for all possible values. Default is [page:Materials NormalBlending].
 		</div>
 
 		<h3>[property:Integer blendSrc]</h3>
 		<div>
-		Blending source. It's one of the blending mode constants defined in Three.js. Default is [page:CustomBlendingEquation SrcAlphaFactor]. See the destination factors [page:CustomBlendingEquation constants] for all possible values.
+		Blending source. Default is [page:CustomBlendingEquation SrcAlphaFactor].
+		See the source factors [page:CustomBlendingEquation constants] for all possible values.<br />
+		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 
 		<h3>[property:Integer blendDst]</h3>
 		<div>
-		Blending destination. It's one of the blending mode constants defined in [page:Three Three.js]. Default is [page:CustomBlendingEquation OneMinusSrcAlphaFactor].
+		Blending destination. Default is [page:CustomBlendingEquation OneMinusSrcAlphaFactor].
+		See the destination factors [page:CustomBlendingEquation constants] for all possible values.<br />
+		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 
 		<h3>[property:Integer blendEquation]</h3>
 		<div>
-		Blending equation to use when applying blending. It's one of the constants defined in [page:Three Three.js]. Default is [page:CustomBlendingEquation AddEquation.]
+		Blending equation to use when applying blending. Default is [page:CustomBlendingEquation AddEquation].
+		See the blending equation [page:CustomBlendingEquation constants] for all possible values.<br />
+		The material's [property:Constant blending] must be set to [page:Materials CustomBlending] for this to have any effect.
 		</div>
 
-		<h3>[property:Boolean depthTest]</h3>
+		<h3>[property:Integer depthFunc]</h3>
 		<div>
-		Whether to have depth test enabled when rendering this material. Default is *true*.
+		Which depth function to use. Default is [page:Materials LessEqualDepth]. See the depth mode [page:Materials constants] for all possible values.
 		</div>
 
-		<h3>[property:Integer depthFunc]</h3>
+		<h3>[property:Boolean depthTest]</h3>
 		<div>
-		What depth function to use. Default is [page:Materials THREE.LessEqualDepth].
+		Whether to have depth test enabled when rendering this material. Default is *true*.
 		</div>
 
 		<h3>[property:Boolean depthWrite]</h3>
@@ -93,91 +141,118 @@
 		When drawing 2D overlays it can be useful to disable the depth writing in order to layer several things together without creating z-index artifacts.
 		</div>
 
-		<h3>[property:Boolean polygonOffset]</h3>
+		<h3>[property:Array clippingPlanes]</h3>
 		<div>
-		Whether to use polygon offset. Default is *false*. This corresponds to the *POLYGON_OFFSET_FILL* WebGL feature.
+		User-defined clipping planes specified as THREE.Plane objects in world space.
+		These planes apply to the objects this material is attached to.
+		Points in space whose dot product with the plane is negative are cut away.
+		See the [example:webgl_clipping_intersection WebGL / clipping /intersection] example.
+		Default is *null*.
 		</div>
 
-		<h3>[property:Integer polygonOffsetFactor]</h3>
+		<h3>[property:Boolean clipIntersection]</h3>
 		<div>
-		Sets the polygon offset factor. Default is *0*.
+		Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union.
+		Default is *false*.
 		</div>
 
-		<h3>[property:Integer polygonOffsetUnits]</h3>
+		<h3>[property:Boolean clipShadows]</h3>
 		<div>
-		Sets the polygon offset units. Default is *0*.
+		Defines whether to clip shadows according to the clipping planes specified on this material. Default is *false*.
 		</div>
 
-		<h3>[property:Number alphaTest]</h3>
+		<h3>[property:Boolean colorWrite]</h3>
 		<div>
-		Sets the alpha value to be used when running an alpha test. Default is *0*.
+		Whether to render the material's color.
+		This can be used in conjunction with a mesh's [property:Integer renderOrder] property to create invisible objects that occlude other objects. Default is *true*.
 		</div>
 
-		<h3>[property:Array clippingPlanes]</h3>
-
+		<h3>[property:String precision]</h3>
 		<div>
-		User-defined clipping planes specified as THREE.Plane objects in world space. These planes apply to the objects this material is attached to. Points in space whose dot product with the plane is negative are cut away. Default is null.
+		Override the renderer's default precision for this material. Can be "*highp*", "*mediump*" or "*lowp*".
+		Defaults for the WebGLRenderer is "*highp*" if supported by the device.
 		</div>
 
-		<h3>[property:Boolean clipIntersection]</h3>
-
-		<div>Changes the behavior of clipping planes so that only their intersection is clipped, rather than their union. Default is false. See <a href="http://threejs.org/examples/#webgl_clipping_intersection">example</a> </div>
+		<h3>[property:Boolean polygonOffset]</h3>
+		<div>
+		Whether to use polygon offset. Default is *false*. This corresponds to the *GL_POLYGON_OFFSET_FILL* WebGL feature.
+		</div>
 
-		<h3>[property:Boolean clipShadows]</h3>
+		<h3>[property:Integer polygonOffsetFactor]</h3>
 		<div>
-		Defines whether to clip shadows according to the clipping planes specified on this material. Default is false.
+		Sets the polygon offset factor. Default is *0*.
 		</div>
 
-		<h3>[property:Float overdraw]</h3>
+		<h3>[property:Integer polygonOffsetUnits]</h3>
 		<div>
-		Amount of triangle expansion at draw time. This is a workaround for cases when gaps appear between triangles when using [page:CanvasRenderer]. *0.5* tends to give good results across browsers. Default is *0*.
+		Sets the polygon offset units. Default is *0*.
 		</div>
 
-		<h3>[property:Boolean visible]</h3>
+		<h3>[property:Float alphaTest]</h3>
 		<div>
-		Defines whether this material is visible. Default is *true*.
+		Sets the alpha value to be used when running an alpha test.
+		The material will not be renderered if the opacity is lower than this value.
+		Default is *0*.
 		</div>
 
-		<h3>[property:Enum side]</h3>
+		<h3>[property:Boolean premultipliedAlpha]</h3>
 		<div>
-		Defines which of the face sides will be rendered - front, back or both.
+		Whether to premultiply the alpha (transparency) value.
+		See [Example:webgl_materials_transparency WebGL / Materials / Transparency] for an example of the difference.
+		Default is *false*.
 		</div>
+
+		<h3>[property:Float overdraw]</h3>
 		<div>
-		Default is [page:Materials THREE.FrontSide]. Other options are [page:Materials THREE.BackSide] and [page:Materials THREE.DoubleSide].
+		Amount of triangle expansion at draw time.
+		This is a workaround for cases when gaps appear between triangles when using [page:CanvasRenderer].
+		*0.5* tends to give good results across browsers. Default is *0*.
 		</div>
 
-		<h3>[property:Boolean needsUpdate]</h3>
+		<h3>[property:Boolean visible]</h3>
 		<div>
-		Specifies that the material needs to be updated at the WebGL level. Set it to true if you made changes that need to be reflected in WebGL.
+		Defines whether this material is visible. Default is *true*.
 		</div>
+
+		<h3>[property:Boolean needsUpdate]</h3>
 		<div>
+		Specifies that the material needs to be updated at the WebGL level.
+		Set it to true if you made changes that need to be reflected in WebGL.<br />
 		This property is automatically set to *true* when instancing a new material.
 		</div>
 
-		
+
 		<h2>Methods</h2>
-		
+
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
-		
-		<h3>[method:Material clone]( [page:material material] )</h3>
+
+		<h3>[method:null setValues]( [page:object values] )</h3>
 		<div>
-		material -- this material gets the cloned information (optional). 
+		values -- a container with parameters.<br />
+		Sets the properties based on the *values*.
 		</div>
+
+		<h3>[method:null toJSON]( [page:object meta] )</h3>
 		<div>
-		This clones the material in the optional parameter and returns it.
+		meta -- object containing metadata such as textures or images for the material.<br />
+		Convert the material to Three JSON format.
 		</div>
 
-		<h3>[method:null dispose]()</h3>
+		<h3>[method:Material clone]( [page:material material] )</h3>
 		<div>
-		This disposes the material. Textures of a material don't get disposed. These needs to be disposed by [page:Texture Texture]. 
+		material -- this material gets the cloned information (optional).<br />
+		This clones the material in the optional parameter and returns it.
 		</div>
 
-		<h3>[method:null setValues]( [page:object values] )</h3>
+		<h3>[method:null update]()</h3>
 		<div>
-		values -- a container with parameters.
+		Call [method:null dispatchEvent]( { type: '[page:object update]' }) on the material.
 		</div>
+
+		<h3>[method:null dispose]()</h3>
 		<div>
-		Sets the properties based on the *values*.
+		This disposes the material. Textures of a material don't get disposed.
+		These needs to be disposed by [page:Texture Texture].
 		</div>
 
 		<h2>Source</h2>

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

@@ -90,7 +90,7 @@
 		<h3>[property:Integer combine]</h3>
 		<div>How to combine the result of the surface's color with the environment map, if any.</div>
 
-		<div>Options are [page:Textures THREE.Multiply] (default), [page:Textures THREE.MixOperation], [page:Textures THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
+		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
 
 		<h3>[property:Float reflectivity]</h3>
 		<div>How much the environment map affects the surface; also see "combine".</div>

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

@@ -113,7 +113,7 @@
 		<h3>[property:Integer combine]</h3>
 		<div>How to combine the result of the surface's color with the environment map, if any.</div>
 
-		<div>Options are [page:Textures THREE.Multiply] (default), [page:Textures THREE.MixOperation], [page:Textures THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
+		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
 
 		<h3>[property:Float reflectivity]</h3>
 		<div>How much the environment map affects the surface; also see "combine".</div>

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

@@ -175,7 +175,7 @@
 		<h3>[property:Integer combine]</h3>
 		<div>How to combine the result of the surface's color with the environment map, if any.</div>
 
-		<div>Options are [page:Textures THREE.MultiplyOperation] (default), [page:Textures THREE.MixOperation], [page:Textures THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
+		<div>Options are [page:Materials THREE.Multiply] (default), [page:Materials THREE.MixOperation], [page:Materials THREE.AddOperation]. If mix is chosen, the reflectivity is used to blend between the two colors.</div>
 
 		<h3>[property:Float reflectivity]</h3>
 		<div>How much the environment map affects the surface; also see "combine".</div>

+ 2 - 2
docs/api/renderers/WebGLRenderer.html

@@ -103,7 +103,7 @@
 		<h3>[property:Integer shadowMap.type]</h3>
 
 		<div>Defines shadow map type (unfiltered, percentage close filtering, percentage close filtering with bilinear filtering in shader)</div>
-		<div>Options are THREE.BasicShadowMap, THREE.PCFShadowMap (default), THREE.PCFSoftShadowMap. See [page:ShadowingTypes ShadowingTypes constants] for details.</div>
+		<div>Options are THREE.BasicShadowMap, THREE.PCFShadowMap (default), THREE.PCFSoftShadowMap. See [page:WebGLRenderer WebGLRenderer constants] for details.</div>
 
 		<h3>[property:Boolean shadowMap.renderReverseSided]</h3>
 
@@ -240,7 +240,7 @@
 
 		<h3>[method:null setFaceCulling]( cullFace, frontFace )</h3>
 		<div>
-		See [page:GLState GLState constants] for all possible values for [page:String cullFace] and [page:String frontFace].<br />
+		See [page:WebGLRenderer WebGLRenderer constants] for all possible values for [page:String cullFace] and [page:String frontFace].<br />
 		Used for setting the gl.frontFace and gl.cullFace states in the GPU, thus enabling/disabling face culling when rendering.<br />
 		If cullFace is set to THREE.[page:String CullFaceNone], culling will be disabled.<br />
 		</div>

+ 8 - 5
docs/api/scenes/Fog.html

@@ -14,7 +14,7 @@
 
 
 		<h2>Constructor</h2>
-		
+
 
 		<h3>[name]( [page:Integer hex], [page:Float near], [page:Float far] )</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>
@@ -22,7 +22,7 @@
 		<h2>Properties</h2>
 
 		<h3>[property:String name]</h3>
-		<div>Default is the empty string.</div>
+		<div>Optional name of the object (doesn't need to be unique). Default is an empty string.</div>
 
 		<h3>[property:Color color]</h3>
 		<div>Fog color.  Example: If set to black, far away objects will be rendered black.</div>
@@ -30,15 +30,18 @@
 		<h3>[property:Float near]</h3>
 		<div>The minimum distance to start applying fog. Objects that are less than 'near' units from the active camera won't be affected by fog.</div>
 		<div>Default is 1.</div>
-		
+
 		<h3>[property:Float far]</h3>
 		<div>The maximum distance at which fog stops being calculated and applied. Objects that are more than 'far' units away from the active camera won't be affected by fog.</div>
 		<div>Default is 1000.</div>
-		
+
 		<h2>Methods</h2>
 
 		<h3>[method:Fog clone]()</h3>
-		<div>Returns a copy of this.</div>
+		<div>Returns a new fog instance with the same parameters as this one.</div>
+
+		<h3>[method:Fog toJSON]()</h3>
+		<div>Return fog data in JSON format.</div>
 
 		<h2>Source</h2>
 

+ 5 - 3
docs/api/scenes/FogExp2.html

@@ -22,7 +22,7 @@
 		<h2>Properties</h2>
 
 		<h3>[property:String name]</h3>
-		<div>Default is the empty string.</div>
+		<div>Optional name of the object (doesn't need to be unique). Default is an empty string.</div>
 
 		<h3>[property:Color color]</h3>
 		<div>Fog color. Example: If set to black, far away objects will be rendered black.</div>
@@ -32,10 +32,12 @@
 		<div>Default is 0.00025.</div>
 
 		<h2>Methods</h2>
-		
+
 		<h3>[method:FogExp2 clone]()</h3>
-		<div>Returns a copy of this.</div>
+		<div>Returns a new FogExp2 instance with the same parameters as this one.</div>
 
+		<h3>[method:FogExp2 toJSON]()</h3>
+		<div>Return FogExp2 data in JSON format.</div>
 
 		<h2>Source</h2>
 

+ 5 - 0
docs/api/scenes/Scene.html

@@ -46,6 +46,11 @@
 
 		<h2>Methods</h2>
 
+		<h3>[method:JSON toJSON]</h3>
+		<div>
+		Return the scene data in JSON format.
+		</div>
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 77 - 0
docs/api/textures/CanvasTexture.html

@@ -0,0 +1,77 @@
+<!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:Texture] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">
+		Creates a texture from a canvas element.<br /><br />
+
+		This is almost the same as the base [page:Texture Texture] class, except that it sets [page:Texture.needsUpdate needsUpdate] to *true* immediately.
+		</div>
+
+
+		<h2>Constructor</h2>
+		<h3>[name]( [page:HTMLElement canvas], [page:Constant mapping], [page:Constant wrapS], [page:Constant wrapT], [page:Constant magFilter], [page:Constant minFilter], [page:Constant format], [page:Constant type], [page:Number anisotropy] )</h3>
+		<div>
+		[page:HTMLElement canvas] -- The HTML canvas element from which to load the texture. <br />
+
+		[page:Constant mapping] --  How the image is applied to the object. An object type of [page:Textures THREE.UVMapping].
+		See [page:Textures mapping constants] for other choices.<br />
+
+		[page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel.
+		The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.<br />
+
+		[page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel.
+		 The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.<br />
+
+    [page:Constant format] -- The format used in the texture.
+     See [page:Textures format constants] for other choices.<br />
+
+    [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType].
+     See [page:Textures type constants] for other choices.<br />
+
+		[page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels.
+		By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used.
+		Use [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.<br /><br />
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+    See the base [page:Texture Texture] class for common properties.
+    </div>
+
+		<h3>[property:boolean needsUpdate]</h3>
+
+		<div>
+			True by default. This is required so that the canvas data is loaded.
+		</div>
+
+		<h2>Methods</h2>
+
+    <div>
+    See the base [page:Texture Texture] class for common methods.
+    </div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 41 - 17
docs/api/textures/CompressedTexture.html

@@ -13,41 +13,65 @@
 		<h1>[name]</h1>
 
 		<div class="desc">
-			Creates a texture based on data in compressed form.
+		Creates a texture based on data in compressed form, for example from a <a href="https://en.wikipedia.org/wiki/DirectDraw_Surface">DDS</a> file.<br /><br />
+
+		
+		For use with the [page:CompressedTextureLoader CompressedTextureLoader].
 		</div>
 
 
 		<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>
-		<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 />
-		height -- The height of the biggest mipmap <br />
-		format -- The format used in the mipmaps <br />
-		type -- The type used in the mipmaps <br />
-		mapping --  How the image is applied to the object. An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection.<br />
-		wrapS -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.<br />
-		wrapT -- The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.<br />
-		magFilter -- How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texels.<br />
-		minFilter -- How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipMapLinearFilter, which uses mipmapping and a trilinear filter. Other choices are THREE.NearestFilter, THREE.NearestMipMapNearestFilter, THREE.NearestMipMapLinearFilter, THREE.LinearFilter, and THREE.LinearMipMapNearestFilter. These vary whether the nearest texel or nearest four texels are retrieved on the nearest mipmap or nearest two mipmaps. Interpolation occurs among the samples retrieved.<br />
-		anisotropy -- The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.</div>
+		<h3>[name]( [page:Array mipmaps], [page:Number width], [page:Number height], [page:Constant format], [page:Constant type], [page:Constant mapping], [page:Constant wrapS], [page:Constant wrapT], [page:Constant magFilter], [page:Constant minFilter], [page:Number anisotropy] )</h3>
 		<div>
-		This creates a texture from compressed data. This is mostly used in ImageUtils.loadCompressedTexture.
+		[page:Array mipmaps] -- The mipmaps array should contains objects with data, width and height. The mipmaps should be from of the correct format and type. <br />
+
+		[page:Number width] -- The width of the biggest mipmap<br />
+
+		[page:Number height] -- The height of the biggest mipmap <br />
+
+		[page:Constant format] -- The format used in the mipmaps.
+		See [page:Textures ST3C Compressed Texture Formats],
+		[page:Textures PVRTC Compressed Texture Formats] and
+		[page:Textures ETC Compressed Texture Format] for other choices.<br />
+
+		[page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType].
+		See [page:Textures type constants] for other choices.<br />
+
+		[page:Constant mapping] --  How the image is applied to the object. An object type of [page:Textures THREE.UVMapping].
+		See [page:Textures mapping constants] for other choices.<br />
+
+		[page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel.
+		The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.<br />
+
+		[page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel.
+		 The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.<br />
+
+		[page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels.
+		By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used.
+		Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.<br /><br />
 		</div>
 
 
 		<h2>Properties</h2>
 
+		See the base [page:Texture Texture] class for common properties.
+
 		<h3>[property:boolean flipY]</h3>
-		
+
 		<div>
 			False by default. Flipping textures does not work for compressed textures.
 		</div>
 
 		<h3>[property:boolean generateMipmaps]</h3>
-		
+
 		<div>
 			False by default. Mipmaps can't be generated for compressed textures
 		</div>

+ 107 - 39
docs/api/textures/Texture.html

@@ -31,81 +31,128 @@
 
 		<h3>[property:Integer id]</h3>
 		<div>
-		Unique number for this texture instance.
+		Readonly - unique number for this texture instance.
 		</div>
 
-		<h3>[property:Image image]</h3>
+		<h3>[property:String uuid]</h3>
 		<div>
-		An Image object, typically created using the ImageUtils or [page:ImageLoader ImageLoader] classes. The Image object can include an image (e.g., PNG, JPG, GIF, DDS), video (e.g., MP4, OGG/OGV), or set of six images for a cube map. To use video as a texture you need to have a playing HTML5 video element as a source for your texture image and continuously update this texture as long as video is playing.
+		[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
+		This gets automatically assigned, so this shouldn't be edited.
 		</div>
 
-		<h3>[property:object mapping]</h3>
+		<h3>[property:String name]</h3>
 		<div>
-		How the image is applied to the object. An object type of THREE.UVMapping is the default, where the U,V coordinates are used to apply the map, and a single texture is expected. The other types are THREE.CubeReflectionMapping, for cube maps used as a reflection map; THREE.CubeRefractionMapping, refraction mapping; and THREE.SphericalReflectionMapping, a spherical reflection map projection.
+		Optional name of the object (doesn't need to be unique). Default is an empty string.
 		</div>
 
-		<h3>[property:number wrapS]</h3>
+		<h3>[property:Image image]</h3>
 		<div>
-		The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
+		An image object, typically created using the [page:TextureLoader.load] method.
+		This can be any image (e.g., PNG, JPG, GIF, DDS) or video (e.g., MP4, OGG/OGV) type supported by Three.<br /><br />
+
+		To use video as a texture you need to have a playing HTML5
+		video element as a source for your texture image and continuously update this texture
+		as long as video is playing - the [page:VideoTexture VideoTexture] class handles this automatically.
 		</div>
 
-		<h3>[property:number wrapT]</h3>
+		<h3>[property:string sourceFile]</h3>
 		<div>
-		The default is THREE.ClampToEdgeWrapping, where the edge is clamped to the outer edge texels. The other two choices are THREE.RepeatWrapping and THREE.MirroredRepeatWrapping.
+		This property is currently unused.
 		</div>
 
+		<h3>[property:array mipmaps]</h3>
 		<div>
-		NOTE: tiling of images in textures only functions if image dimensions are powers of two (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels. Individual dimensions need not be equal, but each must be a power of two. This is a limitation of WebGL, not Three.js.
+		Array of user-specified mipmaps (optional).
 		</div>
 
-		<h3>[property:number magFilter]</h3>
+		<h3>[property:object mapping]</h3>
 		<div>
-		How the texture is sampled when a texel covers more than one pixel. The default is THREE.LinearFilter, which takes the four closest texels and bilinearly interpolates among them. The other option is THREE.NearestFilter, which uses the value of the closest texel.
+		How the image is applied to the object. An object type of [page:Textures THREE.UVMapping] is the default,
+		where the U,V coordinates are used to apply the map.<br />
+
+		See the [page:Textures texture constants] page for other mapping types.
 		</div>
 
-		<h3>[property:number minFilter]</h3>
+		<h3>[property:number wrapS]</h3>
 		<div>
-		How the texture is sampled when a texel covers less than one pixel. The default is THREE.LinearMipMapLinearFilter, which uses mipmapping and a trilinear filter. Other choices are THREE.NearestFilter, THREE.NearestMipMapNearestFilter, THREE.NearestMipMapLinearFilter, THREE.LinearFilter, and THREE.LinearMipMapNearestFilter. These vary whether the nearest texel or nearest four texels are retrieved on the nearest mipmap or nearest two mipmaps. Interpolation occurs among the samples retrieved.
+		This defines how the texture is wrapped horizontally and corresponds to *U* in UV mapping.<br />
+		The default is [page:Textures THREE.ClampToEdgeWrapping], where the edge is clamped to the outer edge texels.
+		The other two choices are [page:Textures THREE.RepeatWrapping] and [page:Textures THREE.MirroredRepeatWrapping].
+		See the [page:Textures texture constants] page for details.
 		</div>
 
-		<h3>[property:number format]</h3>
+		<h3>[property:number wrapT]</h3>
 		<div>
-		The default is THREE.RGBAFormat for the texture. Other formats are: THREE.AlphaFormat, THREE.RGBFormat, THREE.LuminanceFormat, and THREE.LuminanceAlphaFormat. There are also compressed texture formats, if the S3TC extension is supported: THREE.RGB_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT1_Format, THREE.RGBA_S3TC_DXT3_Format, and THREE.RGBA_S3TC_DXT5_Format.
+		This defines how the texture is wrapped vertically and corresponds to *V* in UV mapping.<br />
+		The same choices are available as for [property:number wrapS].<br /><br />
+
+		NOTE: tiling of images in textures only functions if image dimensions are powers of two
+		 (2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, ...) in terms of pixels.
+		 Individual dimensions need not be equal, but each must be a power of two.
+		 This is a limitation of WebGL, not Three.js.
 		</div>
 
-		<h3>[property:number type]</h3>
+		<h3>[property:number magFilter]</h3>
+		<div>
+		How the texture is sampled when a texel covers more than one pixel. The default is
+		 [page:Textures THREE.LinearFilter], which takes the four closest texels and bilinearly interpolates among them.
+		 The other option is [page:Textures THREE.NearestFilter], which uses the value of the closest texel.<br />
+		 See the [page:Textures texture constants] page for details.
+		</div>
+
+		<h3>[property:number minFilter]</h3>
 		<div>
-		The default is THREE.UnsignedByteType. Other valid types (as WebGL allows) are THREE.ByteType, THREE.ShortType, THREE.UnsignedShortType, THREE.IntType, THREE.UnsignedIntType, THREE.FloatType, THREE.UnsignedShort4444Type, THREE.UnsignedShort5551Type, and THREE.UnsignedShort565Type.
+		How the texture is sampled when a texel covers less than one pixel. The default is
+		[page:Textures THREE.LinearMipMapLinearFilter], which uses mipmapping and a trilinear filter. <br /><br />
+
+		See the [page:Textures texture constants] page for all possible choices.
 		</div>
 
 		<h3>[property:number anisotropy]</h3>
 		<div>
-		The number of samples taken along the axis through the pixel that has the highest density of texels. By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used. Use renderer.getMaxAnisotropy() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
+		The number of samples taken along the axis through the pixel that has the highest density of texels.
+		By default, this value is 1. A higher value gives a less blurry result than a basic mipmap,
+		at the cost of more texture samples being used. Use [page:WebGLRenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to
+		find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.
 		</div>
 
-		<h3>[property:boolean needsUpdate]</h3>
+		<h3>[property:number format]</h3>
 		<div>
-		If a texture is changed after creation, set this flag to true so that the texture is properly set up. Particularly important for setting the wrap mode.
+		The default is [page:Textures THREE.RGBAFormat], although the [page:TextureLoader TextureLoader] will automatically
+		et this to [page:Textures THREE.RGBFormat] for JPG images. <br /><br />
+
+		See the [page:Textures texture constants] page for details of other formats.
 		</div>
 
-		<h3>[property:Vector2 repeat]</h3>
+		<h3>[property:number type]</h3>
 		<div>
-		How many times the texture is repeated across the surface, in each direction U and V.
+		This must correspond to the [page:Texture.format .format]. The default is [page:Textures THREE.UnsignedByteType],
+		which will be used for most texture formats.<br /><br />
+
+		See the [page:Textures texture constants] page for details of other formats.
 		</div>
 
 		<h3>[property:Vector2 offset]</h3>
 		<div>
-		How much a single repetition of the texture is offset from the beginning, in each direction U and V. Typical range is 0.0 to 1.0.
+		How much a single repetition of the texture is offset from the beginning, in each direction U and V.
+		Typical range is *0.0* to *1.0*.
 		</div>
 
-		<h3>[property:string name]</h3>
+		<h3>[property:Vector2 repeat]</h3>
 		<div>
-		Given name of the texture, empty string by default.
+		How many times the texture is repeated across the surface, in each direction U and V.
 		</div>
 
 		<h3>[property:boolean generateMipmaps]</h3>
 		<div>
-		Whether to generate mipmaps (if possible) for a texture. True by default.
+		Whether to generate mipmaps (if possible) for a texture. True by default. Set this to false if you are
+		creating mipmaps manually.
+		</div>
+
+		<h3>[property:boolean premultiplyAlpha]</h3>
+		<div>
+		False by default, which is the norm for PNG images. Set to true if the RGB values have
+		been stored premultiplied by alpha.
 		</div>
 
 		<h3>[property:boolean flipY]</h3>
@@ -113,29 +160,38 @@
 		True by default. Flips the image's Y axis to match the WebGL texture coordinate space.
 		</div>
 
-		<h3>[property:array mipmaps]</h3>
+		<h3>[property:number unpackAlignment]</h3>
 		<div>
-		Array of user-specified mipmaps (optional).
+		4 by default. Specifies the alignment requirements for the start of each pixel row in memory.
+		The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes),
+		4 (word-alignment), and 8 (rows start on double-word boundaries).
+		See <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml">glPixelStorei</a>
+		for more information.
 		</div>
 
-		<h3>[property:number unpackAlignment]</h3>
+		<h3>[property:number encoding]</h3>
 		<div>
-		4 by default. Specifies the alignment requirements for the start of each pixel row in memory. The allowable values are 1 (byte-alignment), 2 (rows aligned to even-numbered bytes), 4 (word-alignment), and 8 (rows start on double-word boundaries). See <a href="http://www.khronos.org/opengles/sdk/docs/man/xhtml/glPixelStorei.xml">glPixelStorei</a> for more information.
+		[page:Textures THREE.LinearEncoding] is the default.
+		See the [page:Textures texture constants] page for details of other formats.<br /><br />
+
+		Note that ff this value is changed on a texture after the material has been used,
+		it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader.
 		</div>
 
-		<h3>[property:boolean premultiplyAlpha]</h3>
+		<h3>[property:Integer version]</h3>
 		<div>
-		False by default, which is the norm for PNG images. Set to true if the RGB values have been stored premultiplied by alpha.
+		This starts at *0* and counts how many times [property:Boolean needsUpdate] is set to *true*.
 		</div>
 
-		<h3>[property:number encoding]</h3>
+		<h3>[property:Function onUpdate]</h3>
 		<div>
-		Set to THREE.LinearEncoding by default, but supports sRGB, RGBE, RGBM, RGBD, LogLuv and Gamma corrected encodings.  IMPORTANT: If this value is changed on a texture after the material has been used, it is necessary to trigger a Material.needsUpdate for this value to be realized in the shader.
+		A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true
+		and then the texture is used).
 		</div>
 
-		<h3>[property:object onUpdate]</h3>
+		<h3>[property:Boolean needsUpdate]</h3>
 		<div>
-		A callback function, called when the texture is updated (e.g., when needsUpdate has been set to true and then the texture is used).
+		Set this to *true* to trigger an update next time the texture is used. Particularly important for setting the wrap mode.
 		</div>
 
 
@@ -143,9 +199,15 @@
 
 		<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
 
-		<h3>[method:Material clone]( [page:Texture texture] )</h3>
+		<h3>[method:Texture clone]( [page:Texture texture] )</h3>
 		<div>
-		Make copy of texture. Note this is not a "deep copy", the image is shared.
+		Make copy of the texture. Note this is not a "deep copy", the image is shared.
+		</div>
+
+		<h3>[method:Texture toJSON]( meta )</h3>
+		<div>
+		meta -- optional object containing metadata.<br />
+		Convert the material to Three JSON format.
 		</div>
 
 		<h3>[method:null dispose]()</h3>
@@ -153,6 +215,12 @@
 		Call [page:EventDispatcher EventDispatcher].dispatchEvent with a 'dispose' event type.
 		</div>
 
+		<h3>[method:null transformUv]( uv )</h3>
+		<div>
+		Transform the uv based on the value of this texture's [page:Texture.repeat .repeat], [page:Texture.offset .offset],
+		[page:Texture.wrapS .wrapS], [page:Texture.wrapT .wrapT] and [page:Texture.flipY .flipY] properties.
+		</div>
+
 		<h2>Source</h2>
 
 		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]

+ 100 - 0
docs/api/textures/VideoTexture.html

@@ -0,0 +1,100 @@
+<!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:Texture] &rarr;
+
+		<h1>[name]</h1>
+
+		<div class="desc">
+		Creates a texture for use with a video texture.<br /><br />
+
+		This is almost the same as the base [page:Texture Texture] class,
+    except that it continuosly sets [page:Texture.needsUpdate needsUpdate] to *true*
+    (using <a href="https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame">requestAnimationFrame</a>)
+    so that the texture is updated as the video plays. Automatic creation of [page:Texture.mipmaps mipmaps]
+    is also disabled.
+		</div>
+
+    <h2>Example</h2>
+
+		<div>[example:webgl_materials_video materials / video ]</div>
+
+		<code>
+//assuming you have created a HTML video element with id="video"
+var video = document.getElementById( 'video' );
+
+var texture = new THREE.VideoTexture( video );
+texture.minFilter = THREE.LinearFilter;
+texture.magFilter = THREE.LinearFilter;
+texture.format = THREE.RGBFormat;
+    </code>
+
+
+		<h2>Constructor</h2>
+		<h3>[name]( [page:Video video], [page:Constant mapping], [page:Constant wrapS], [page:Constant wrapT], [page:Constant magFilter], [page:Constant minFilter], [page:Constant format], [page:Constant type], [page:Number anisotropy] )</h3>
+		<div>
+		[page:Video video] -- The video element to use as the texture. <br />
+
+		[page:Constant mapping] --  How the image is applied to the object. An object type of [page:Textures THREE.UVMapping].
+		See [page:Textures mapping constants] for other choices.<br />
+
+		[page:Constant wrapS] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant wrapT] -- The default is [page:Textures THREE.ClampToEdgeWrapping].
+		See [page:Textures wrap mode constants] for other choices.<br />
+
+		[page:Constant magFilter] -- How the texture is sampled when a texel covers more than one pixel.
+		The default is [page:Textures THREE.LinearFilter]. See [page:Textures magnification filter constants] for other choices.<br />
+
+		[page:Constant minFilter] -- How the texture is sampled when a texel covers less than one pixel.
+		 The default is [page:Textures THREE.LinearMipMapLinearFilter]. See [page:Textures minification filter constants] for other choices.<br />
+
+    [page:Constant format] -- The format used in the texture.
+     See [page:Textures format constants] for other choices.<br />
+
+    [page:Constant type] -- Default is [page:Textures THREE.UnsignedByteType].
+     See [page:Textures type constants] for other choices.<br />
+
+		[page:Number anisotropy] -- The number of samples taken along the axis through the pixel that has the highest density of texels.
+		By default, this value is 1. A higher value gives a less blurry result than a basic mipmap, at the cost of more texture samples being used.
+		Use [page:WebGLrenderer.getMaxAnisotropy renderer.getMaxAnisotropy]() to find the maximum valid anisotropy value for the GPU; this value is usually a power of 2.<br /><br />
+		</div>
+
+
+		<h2>Properties</h2>
+
+		<div>
+    See the base [page:Texture Texture] class for common properties.
+    </div>
+
+		<h3>[property:boolean needsUpdate]</h3>
+		<div>
+		You will not need to set this manually here as it is handled by the [page:VideoTexture.update update] method.
+		</div>
+
+		<h2>Methods</h2>
+
+    <div>
+    See the base [page:Texture Texture] class for common methods.
+    </div>
+
+    <h3>[method:null update]()</h3>
+		<div>
+		This is called automatically and sets [property:boolean needsUpdate] to *true* every time
+    a new frame is available.
+		</div>
+
+
+		<h2>Source</h2>
+
+		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
+	</body>
+</html>

+ 6 - 4
docs/list.js

@@ -9,12 +9,12 @@ var list = {
 
 	"Reference": {
 		"Constants": [
+			[ "Animation", "api/constants/Animation" ],
 			[ "CustomBlendingEquation", "api/constants/CustomBlendingEquations" ],
 			[ "DrawModes", "api/constants/DrawModes" ],
-			[ "GLState", "api/constants/GLState" ],
 			[ "Materials", "api/constants/Materials" ],
-			[ "ShadowingTypes", "api/constants/ShadowingTypes" ],
-			[ "Textures", "api/constants/Textures" ]
+			[ "Textures", "api/constants/Textures" ],
+			[ "WebGLRenderer", "api/constants/WebGLRenderer" ]
 		],
 
 		"Cameras": [
@@ -197,10 +197,12 @@ var list = {
 		],
 
 		"Textures": [
+			[ "CanvasTexture", "api/textures/CanvasTexture" ],
 			[ "CompressedTexture", "api/textures/CompressedTexture" ],
 			[ "CubeTexture", "api/textures/CubeTexture" ],
 			[ "DataTexture", "api/textures/DataTexture" ],
-			[ "Texture", "api/textures/Texture" ]
+			[ "Texture", "api/textures/Texture" ],
+			[ "VideoTexture", "api/textures/VideoTexture" ]
 		],
 
 		"Animation": [

+ 264 - 15
examples/js/animation/CCDIKSolver.js

@@ -6,13 +6,16 @@
  *
  * mesh.geometry needs to have iks array.
  *
- * ik parameter example
- *
+ * // ik parameter example
+ * //
  * // target, effector, index in links are bone index in skeleton.
+ * // the bones relation should be
+ * // <-- parent                                  child -->
+ * // links[ n ], links[ n - 1 ], ..., links[ 0 ], effector
  * ik = {
  *	target: 1,
  *	effector: 2,
- *	links: [ { index: 5 }, { index: 4, limitation: new THREE.Vector3( 1, 0, 0 ) }, { index : 3 } ],
+ *	links: [ { index: 5, limitation: new THREE.Vector3( 1, 0, 0 ) }, { index: 4, enabled: false }, { index : 3 } ],
  *	iteration: 10,
  *	minAngle: 0.0,
  *	maxAngle: 1.0,
@@ -23,43 +26,103 @@ THREE.CCDIKSolver = function ( mesh ) {
 
 	this.mesh = mesh;
 
+	this._valid();
+
 };
 
 THREE.CCDIKSolver.prototype = {
 
 	constructor: THREE.CCDIKSolver,
 
+	_valid: function () {
+
+		var iks = this.mesh.geometry.iks;
+		var bones = this.mesh.skeleton.bones;
+
+		for ( var i = 0, il = iks.length; i < il; i ++ ) {
+
+			var ik = iks[ i ];
+
+			var effector = bones[ ik.effector ];
+
+			var links = ik.links;
+
+			var link0, link1;
+
+			link0 = effector;
+
+			for ( var j = 0, jl = links.length; j < jl; j ++ ) {
+
+				link1 = bones[ links[ j ].index ];
+
+				if ( link0.parent !== link1 ) {
+
+					console.warn( 'THREE.CCDIKSolver: bone ' + link0.name + ' is not the child of bone ' + link1.name );
+
+				}
+
+				link0 = link1;
+
+			}
+
+		}
+
+	},
+
 	update: function () {
 
-		var effectorVec = new THREE.Vector3();
+		var q = new THREE.Quaternion();
+
+		var targetPos = new THREE.Vector3();
 		var targetVec = new THREE.Vector3();
+		var effectorPos = new THREE.Vector3();
+		var effectorVec = new THREE.Vector3();
+		var linkPos = new THREE.Vector3();
+		var invLinkQ = new THREE.Quaternion();
 		var axis = new THREE.Vector3();
-		var q = new THREE.Quaternion();
 
 		var bones = this.mesh.skeleton.bones;
 		var iks = this.mesh.geometry.iks;
 
+		var boneParams = this.mesh.geometry.bones;
+
 		// for reference overhead reduction in loop
 		var math = Math;
 
+		this.mesh.updateMatrixWorld( true );
+
 		for ( var i = 0, il = iks.length; i < il; i++ ) {
 
 			var ik = iks[ i ];
 			var effector = bones[ ik.effector ];
 			var target = bones[ ik.target ];
-			var targetPos = target.getWorldPosition();
+
+			// don't use getWorldPosition() here for the performance
+			// because it calls updateMatrixWorld( true ) inside.
+			targetPos.setFromMatrixPosition( target.matrixWorld );
+
 			var links = ik.links;
 			var iteration = ik.iteration !== undefined ? ik.iteration : 1;
 
 			for ( var j = 0; j < iteration; j++ ) {
 
+				var rotated = false;
+
 				for ( var k = 0, kl = links.length; k < kl; k++ ) {
 
 					var link = bones[ links[ k ].index ];
+
+					// skip this link and following links.
+					// this skip is used for MMD performance optimization.
+					if ( links[ k ].enabled === false ) break;
+
 					var limitation = links[ k ].limitation;
-					var linkPos = link.getWorldPosition();
-					var invLinkQ = link.getWorldQuaternion().inverse();
-					var effectorPos = effector.getWorldPosition();
+
+					// don't use getWorldPosition/Quaternion() here for the performance
+					// because they call updateMatrixWorld( true ) inside.
+					linkPos.setFromMatrixPosition( link.matrixWorld );
+					invLinkQ.setFromRotationMatrix( link.matrixWorld ).inverse();
+					effectorPos.setFromMatrixPosition( effector.matrixWorld );
 
 					// work in link world
 					effectorVec.subVectors( effectorPos, linkPos );
@@ -86,11 +149,7 @@ THREE.CCDIKSolver.prototype = {
 
 					// skip if changing angle is too small to prevent vibration of bone
 					// Refer to http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mmd.three.js
-					if ( angle < 1e-5 ) {
-
-						continue;
-
-					}
+					if ( angle < 1e-5 ) continue;
 
 					if ( ik.minAngle !== undefined && angle < ik.minAngle ) {
 
@@ -130,16 +189,206 @@ THREE.CCDIKSolver.prototype = {
 					}
 
 					link.updateMatrixWorld( true );
+					rotated = true;
 
 				}
 
+				if ( ! rotated ) break;
+
 			}
 
-			this.mesh.updateMatrixWorld( true );
+		}
+
+		// just in case
+		this.mesh.updateMatrixWorld( true );
+
+	}
+
+};
+
+
+THREE.CCDIKHelper = function ( mesh ) {
+
+	if ( mesh.geometry.iks === undefined || mesh.skeleton === undefined ) {
+
+		throw 'THREE.CCDIKHelper requires iks in mesh.geometry and skeleton in mesh.';
+
+	}
+
+	THREE.Object3D.call( this );
+
+	this.root = mesh;
+
+	this.matrix = mesh.matrixWorld;
+	this.matrixAutoUpdate = false;
+
+	this.sphereGeometry = new THREE.SphereBufferGeometry( 0.25, 16, 8 );
+
+	this.targetSphereMaterial = new THREE.MeshBasicMaterial( {
+		color: new THREE.Color( 0xff8888 ),
+		depthTest: false,
+		depthWrite: false,
+		transparent: true
+	} );
+
+	this.effectorSphereMaterial = new THREE.MeshBasicMaterial( {
+		color: new THREE.Color( 0x88ff88 ),
+		depthTest: false,
+		depthWrite: false,
+		transparent: true
+	} );
+
+	this.linkSphereMaterial = new THREE.MeshBasicMaterial( {
+		color: new THREE.Color( 0x8888ff ),
+		depthTest: false,
+		depthWrite: false,
+		transparent: true
+	} );
+
+	this.lineMaterial = new THREE.LineBasicMaterial( {
+		color: new THREE.Color( 0xff0000 ),
+		depthTest: false,
+		depthWrite: false,
+		transparent: true
+	} );
+
+	this._init();
+	this.update();
+
+};
+
+THREE.CCDIKHelper.prototype = Object.create( THREE.Object3D.prototype );
+THREE.CCDIKHelper.prototype.constructor = THREE.CCDIKHelper;
+
+THREE.CCDIKHelper.prototype._init = function () {
+
+	var self = this;
+	var mesh = this.root;
+	var iks = mesh.geometry.iks;
+
+	function createLineGeometry( ik ) {
+
+		var geometry = new THREE.BufferGeometry();
+		var vertices = new Float32Array( ( 2 + ik.links.length ) * 3 );
+		geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
+
+		return geometry;
+
+	}
+
+	function createTargetMesh() {
+
+		return new THREE.Mesh( self.sphereGeometry, self.targetSphereMaterial );
+
+	}
+
+	function createEffectorMesh() {
+
+		return new THREE.Mesh( self.sphereGeometry, self.effectorSphereMaterial );
+
+	}
+
+	function createLinkMesh() {
+
+		return new THREE.Mesh( self.sphereGeometry, self.linkSphereMaterial );
+
+	}
+
+	function createLine( ik ) {
+
+		return new THREE.Line( createLineGeometry( ik ), self.lineMaterial );
+
+	}
+
+	for ( var i = 0, il = iks.length; i < il; i ++ ) {
+
+		var ik = iks[ i ];
+
+		this.add( createTargetMesh() );
+		this.add( createEffectorMesh() );
+
+		for ( var j = 0, jl = ik.links.length; j < jl; j ++ ) {
+
+			this.add( createLinkMesh() );
 
 		}
 
+		this.add( createLine( ik ) );
+
 	}
 
 };
 
+THREE.CCDIKHelper.prototype.update = function () {
+
+	var offset = 0;
+
+	var mesh = this.root;
+	var iks = mesh.geometry.iks;
+	var bones = mesh.skeleton.bones;
+
+	var matrixWorldInv = new THREE.Matrix4().getInverse( mesh.matrixWorld );
+	var vector = new THREE.Vector3();
+
+	function getPosition( bone ) {
+
+		vector.setFromMatrixPosition( bone.matrixWorld );
+		vector.applyMatrix4( matrixWorldInv );
+
+		return vector;
+
+	}
+
+	function setPositionOfBoneToAttributeArray( array, index, bone ) {
+
+		var v = getPosition( bone );
+
+		array[ index * 3 + 0 ] = v.x;
+		array[ index * 3 + 1 ] = v.y;
+		array[ index * 3 + 2 ] = v.z;
+
+	}
+
+	for ( var i = 0, il = iks.length; i < il; i ++ ) {
+
+		var ik = iks[ i ];
+
+		var targetBone = bones[ ik.target ];
+		var effectorBone = bones[ ik.effector ];
+
+		var targetMesh = this.children[ offset ++ ];
+		var effectorMesh = this.children[ offset ++ ];
+
+		targetMesh.position.copy( getPosition( targetBone ) );
+		effectorMesh.position.copy( getPosition( effectorBone ) );
+
+		for ( var j = 0, jl = ik.links.length; j < jl; j ++ ) {
+
+			var link = ik.links[ j ];
+			var linkBone = bones[ link.index ];
+
+			var linkMesh = this.children[ offset ++ ];
+
+			linkMesh.position.copy( getPosition( linkBone ) );
+
+		}
+
+		var line = this.children[ offset ++ ];
+		var array = line.geometry.attributes.position.array;
+
+		setPositionOfBoneToAttributeArray( array, 0, targetBone );
+		setPositionOfBoneToAttributeArray( array, 1, effectorBone );
+
+		for ( var j = 0, jl = ik.links.length; j < jl; j ++ ) {
+
+			var link = ik.links[ j ];
+			var linkBone = bones[ link.index ];
+			setPositionOfBoneToAttributeArray( array, j + 2, linkBone );
+
+		}
+
+		line.geometry.attributes.position.needsUpdate = true;
+
+	}
+
+};

+ 69 - 45
examples/js/animation/MMDPhysics.js

@@ -1031,11 +1031,6 @@ THREE.MMDPhysics.Constraint.prototype = {
 };
 
 
-/*
- * This helper displays rigid bodies of mesh for debug.
- * It should be under Scene because it just sets world position/roration to meshes
- * for simplicity.
- */
 THREE.MMDPhysicsHelper = function ( mesh ) {
 
 	if ( mesh.physics === undefined || mesh.geometry.rigidBodies === undefined ) {
@@ -1046,9 +1041,48 @@ THREE.MMDPhysicsHelper = function ( mesh ) {
 
 	THREE.Object3D.call( this );
 
-	this.mesh = mesh;
+	this.root = mesh;
+
+	this.matrix = mesh.matrixWorld;
+	this.matrixAutoUpdate = false;
+
+	this.materials = [];
+
+	this.materials.push(
+		new THREE.MeshBasicMaterial( {
+			color: new THREE.Color( 0xff8888 ),
+			wireframe: true,
+			depthTest: false,
+			depthWrite: false,
+			opacity: 0.25,
+			transparent: true
+		} )
+	);
+
+	this.materials.push(
+		new THREE.MeshBasicMaterial( {
+			color: new THREE.Color( 0x88ff88 ),
+			wireframe: true,
+			depthTest: false,
+			depthWrite: false,
+			opacity: 0.25,
+			transparent: true
+		} )
+	);
+
+	this.materials.push(
+		new THREE.MeshBasicMaterial( {
+			color: new THREE.Color( 0x8888ff ),
+			wireframe: true,
+			depthTest: false,
+			depthWrite: false,
+			opacity: 0.25,
+			transparent: true
+		} )
+	);
 
 	this._init();
+	this.update();
 
 };
 
@@ -1057,6 +1091,9 @@ THREE.MMDPhysicsHelper.prototype.constructor = THREE.MMDPhysicsHelper;
 
 THREE.MMDPhysicsHelper.prototype._init = function () {
 
+	var mesh = this.root;
+	var rigidBodies = mesh.geometry.rigidBodies;
+
 	function createGeometry( param ) {
 
 		switch ( param.shapeType ) {
@@ -1097,67 +1134,54 @@ THREE.MMDPhysicsHelper.prototype._init = function () {
 
 	}
 
+	for ( var i = 0, il = rigidBodies.length; i < il; i ++ ) {
 
-	function createMaterial( param ) {
+		var param = rigidBodies[ i ];
+		this.add( new THREE.Mesh( createGeometry( param ), this.materials[ param.type ] ) );
 
-		var color;
+	}
 
-		switch ( param.type ) {
+};
 
-			case 0:
-				color = 0xff8888;
-				break;
+THREE.MMDPhysicsHelper.prototype.update = function () {
 
-			case 1:
-				color = 0x88ff88;
-				break;
+	var mesh = this.root;
+	var rigidBodies = mesh.geometry.rigidBodies;
+	var bodies = mesh.physics.bodies;
 
-			case 2:
-				color = 0x8888ff;
-				break;
+	var matrixWorldInv = new THREE.Matrix4().getInverse( mesh.matrixWorld );
+	var vector = new THREE.Vector3();
+	var quaternion = new THREE.Quaternion();
+	var quaternion2 = new THREE.Quaternion();
 
-			default:
-				color = 0x000000;
-				break;
+	function getPosition( origin ) {
 
-		}
+		vector.set( origin.x(), origin.y(), origin.z() );
+		vector.applyMatrix4( matrixWorldInv );
 
-		return new THREE.MeshBasicMaterial( {
-			color: new THREE.Color( color ),
-			wireframe: true,
-			depthTest: false,
-			depthWrite: false,
-			opacity: 0.25,
-			transparent: true
-		} );
+		return vector;
 
 	}
 
-	for ( var i = 0, il = this.mesh.geometry.rigidBodies.length; i < il; i ++ ) {
+	function getQuaternion( rotation ) {
 
-		var param = this.mesh.geometry.rigidBodies[ i ];
+		quaternion.set( rotation.x(), rotation.y(), rotation.z(), rotation.w() );
+		quaternion2.setFromRotationMatrix( matrixWorldInv );
+		quaternion2.multiply( quaternion );
 
-		var mesh = new THREE.Mesh( createGeometry( param ), createMaterial( param ) );
-		this.add( mesh );
+		return quaternion2;
 
 	}
 
-};
-
-THREE.MMDPhysicsHelper.prototype.update = function () {
+	for ( var i = 0, il = rigidBodies.length; i < il; i ++ ) {
 
-	for ( var i = 0, il = this.mesh.geometry.rigidBodies.length; i < il; i ++ ) {
-
-		var body = this.mesh.physics.bodies[ i ].body;
+		var body = bodies[ i ].body;
 		var mesh = this.children[ i ];
 
 		var tr = body.getCenterOfMassTransform();
 
-		var o = tr.getOrigin();
-		var r = tr.getRotation();
-
-		mesh.position.set( o.x(), o.y(), o.z() );
-		mesh.quaternion.set( r.x(), r.y(), r.z(), r.w() );
+		mesh.position.copy( getPosition( tr.getOrigin() ) );
+		mesh.quaternion.copy( getQuaternion( tr.getRotation() ) );
 
 	}
 

+ 1 - 1
examples/js/controls/OrbitControls.js

@@ -11,7 +11,7 @@
 //
 //    Orbit - left mouse / touch: one finger move
 //    Zoom - middle mouse, or mousewheel / touch: two finger spread or squish
-//    Pan - right mouse, or arrow keys / touch: three finter swipe
+//    Pan - right mouse, or arrow keys / touch: three finger swipe
 
 THREE.OrbitControls = function ( object, domElement ) {
 

+ 72 - 0
examples/js/loaders/MMDLoader.js

@@ -1764,6 +1764,21 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 		var bones = [];
 
+		var rigidBodies = model.rigidBodies;
+		var dictionary = {};
+
+		for ( var i = 0, il = rigidBodies.length; i < il; i ++ ) {
+
+			var body = rigidBodies[ i ];
+			var value = dictionary[ body.boneIndex ];
+
+			// keeps greater number if already value is set without any special reasons
+			value = value === undefined ? body.type : Math.max( body.type, value );
+
+			dictionary[ body.boneIndex ] = value;
+
+		}
+
 		for ( var i = 0; i < model.metadata.boneCount; i++ ) {
 
 			var bone = {};
@@ -1783,6 +1798,8 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 			}
 
+			bone.rigidBodyType = dictionary[ i ] !== undefined ? dictionary[ i ] : -1;
+
 			bones.push( bone );
 
 		}
@@ -1853,6 +1870,7 @@ THREE.MMDLoader.prototype.createMesh = function ( model, texturePath, onProgress
 
 					var link = {};
 					link.index = ik.links[ j ].index;
+					link.enabled = true;
 
 					if ( ik.links[ j ].angleLimitation === 1 ) {
 
@@ -3886,10 +3904,64 @@ THREE.MMDHelper.prototype = {
 
 		physics.warmup( warmup );
 
+		this.updateIKParametersDependingOnPhysicsEnabled( mesh, true );
+
 		mesh.physics = physics;
 
 	},
 
+	enablePhysics: function ( enabled ) {
+
+		if ( enabled === true ) {
+
+			this.doPhysics = true;
+
+		} else {
+
+			this.doPhysics = false;
+
+		}
+
+		for ( var i = 0, il = this.meshes.length; i < il; i ++ ) {
+
+			this.updateIKParametersDependingOnPhysicsEnabled( this.meshes[ i ], enabled );
+
+		}
+
+	},
+
+	updateIKParametersDependingOnPhysicsEnabled: function ( mesh, physicsEnabled ) {
+
+		var iks = mesh.geometry.iks;
+		var bones = mesh.geometry.bones;
+
+		for ( var j = 0, jl = iks.length; j < jl; j ++ ) {
+
+			var ik = iks[ j ];
+			var links = ik.links;
+
+			for ( var k = 0, kl = links.length; k < kl; k ++ ) {
+
+				var link = links[ k ];
+
+				if ( physicsEnabled === true ) {
+
+					// disable IK of the bone the corresponding rigidBody type of which is 1 or 2
+					// because its rotation will be overriden by physics
+					link.enabled = bones[ link.index ].rigidBodyType > 0 ? false : true;
+
+				} else {
+
+					link.enabled = true;
+
+				}
+
+			}
+
+		}
+
+	},
+
 	setAnimations: function () {
 
 		for ( var i = 0; i < this.meshes.length; i++ ) {

+ 7 - 2
examples/webgl_loader_mmd.html

@@ -53,7 +53,7 @@
 			var container, stats;
 
 			var mesh, camera, scene, renderer;
-			var helper, physicsHelper;
+			var helper, ikHelper, physicsHelper;
 
 			var mouseX = 0, mouseY = 0;
 
@@ -122,6 +122,10 @@
 					helper.add( mesh );
 					helper.setAnimation( mesh );
 
+					// create CCDIKHelper after calling helper.setAnimation()
+					ikHelper = new THREE.CCDIKHelper( mesh );
+					scene.add( ikHelper );
+
 					/*
 					 * Note: You're recommended to call helper.setPhysics()
 					 *       after calling helper.setAnimation().
@@ -186,7 +190,8 @@
 				camera.lookAt( scene.position );
 
 				helper.animate( clock.getDelta() );
-				if ( physicsHelper !== undefined ) physicsHelper.update();
+				if ( physicsHelper !== undefined && physicsHelper.visible ) physicsHelper.update();
+				if ( ikHelper !== undefined && ikHelper.visible ) ikHelper.update();
 				effect.render( scene, camera );
 
 			}

+ 0 - 9
rollup.config.js

@@ -1,11 +1,3 @@
-
-var outro = `
-Object.defineProperty( exports, 'AudioContext', {
-	get: function () {
-		return exports.getAudioContext();
-	}
-});`;
-
 function glsl () {
 	return {
 		transform ( code, id ) {
@@ -42,6 +34,5 @@ export default {
 			dest: 'build/three.modules.js'
 		}
 	],
-	outro: outro,
 	sourceMap: true
 };

+ 1 - 1
src/Three.js

@@ -63,7 +63,7 @@ export { CubeCamera } from './cameras/CubeCamera.js';
 export { Camera } from './cameras/Camera.js';
 export { AudioListener } from './audio/AudioListener.js';
 export { PositionalAudio } from './audio/PositionalAudio.js';
-export { getAudioContext } from './audio/AudioContext.js';
+export { AudioContext } from './audio/AudioContext.js';
 export { AudioAnalyser } from './audio/AudioAnalyser.js';
 export { Audio } from './audio/Audio.js';
 export { VectorKeyframeTrack } from './animation/tracks/VectorKeyframeTrack.js';

+ 17 - 5
src/audio/AudioContext.js

@@ -1,13 +1,25 @@
 var context;
 
-export function getAudioContext() {
+var AudioContext = {
 
-	if ( context === undefined ) {
+	getContext: function () {
 
-		context = new ( window.AudioContext || window.webkitAudioContext )();
+		if ( context === undefined ) {
+
+			context = new ( window.AudioContext || window.webkitAudioContext )();
+
+		}
+
+		return context;
+
+	},
+
+	setContext: function ( value ) {
+
+		context = value;
 
 	}
 
-	return context;
+};
 
-}
+export { AudioContext };

+ 2 - 2
src/audio/AudioListener.js

@@ -5,7 +5,7 @@
 import { Vector3 } from '../math/Vector3';
 import { Quaternion } from '../math/Quaternion';
 import { Object3D } from '../core/Object3D';
-import { getAudioContext } from './AudioContext';
+import { AudioContext } from './AudioContext';
 
 function AudioListener() {
 
@@ -13,7 +13,7 @@ function AudioListener() {
 
 	this.type = 'AudioListener';
 
-	this.context = getAudioContext();
+	this.context = AudioContext.getContext();
 
 	this.gain = this.context.createGain();
 	this.gain.connect( this.context.destination );

+ 2 - 2
src/loaders/AudioLoader.js

@@ -1,4 +1,4 @@
-import { getAudioContext } from '../audio/AudioContext';
+import { AudioContext } from '../audio/AudioContext';
 import { FileLoader } from './FileLoader';
 import { DefaultLoadingManager } from './LoadingManager';
 
@@ -20,7 +20,7 @@ Object.assign( AudioLoader.prototype, {
 		loader.setResponseType( 'arraybuffer' );
 		loader.load( url, function ( buffer ) {
 
-			var context = getAudioContext();
+			var context = AudioContext.getContext();
 
 			context.decodeAudioData( buffer, function ( audioBuffer ) {
 

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