Browse Source

Examples: Clean up. (#21680)

Michael Herzog 4 years ago
parent
commit
6df08ab12e
100 changed files with 2176 additions and 1742 deletions
  1. 20 20
      examples/js/animation/CCDIKSolver.js
  2. 80 80
      examples/js/animation/MMDAnimationHelper.js
  3. 75 75
      examples/js/animation/MMDPhysics.js
  4. 3 3
      examples/js/controls/DragControls.js
  5. 9 9
      examples/js/controls/OrbitControls.js
  6. 10 10
      examples/js/controls/TrackballControls.js
  7. 2 2
      examples/js/controls/TransformControls.js
  8. 9 9
      examples/js/controls/experimental/CameraControls.js
  9. 4 4
      examples/js/csm/CSMShader.js
  10. 2 2
      examples/js/csm/Frustum.js
  11. 58 58
      examples/js/curves/NURBSUtils.js
  12. 18 18
      examples/js/deprecated/Geometry.js
  13. 4 4
      examples/js/effects/AsciiEffect.js
  14. 14 14
      examples/js/effects/OutlineEffect.js
  15. 4 4
      examples/js/exporters/ColladaExporter.js
  16. 6 6
      examples/js/exporters/DRACOExporter.js
  17. 118 118
      examples/js/exporters/GLTFExporter.js
  18. 21 21
      examples/js/exporters/MMDExporter.js
  19. 4 4
      examples/js/exporters/PLYExporter.js
  20. 3 3
      examples/js/exporters/STLExporter.js
  21. 43 43
      examples/js/exporters/USDZExporter.js
  22. 12 12
      examples/js/geometries/ParametricGeometries.js
  23. 12 12
      examples/js/geometries/RoundedBoxGeometry.js
  24. 17 17
      examples/js/geometries/TeapotGeometry.js
  25. 1 1
      examples/js/helpers/RectAreaLightHelper.js
  26. 5 5
      examples/js/lights/RectAreaLightUniformsLib.js
  27. 2 2
      examples/js/lines/LineGeometry.js
  28. 8 8
      examples/js/lines/LineMaterial.js
  29. 15 15
      examples/js/loaders/3DMLoader.js
  30. 30 30
      examples/js/loaders/BVHLoader.js
  31. 4 4
      examples/js/loaders/BasisTextureLoader.js
  32. 5 5
      examples/js/loaders/ColladaLoader.js
  33. 11 11
      examples/js/loaders/EXRLoader.js
  34. 10 10
      examples/js/loaders/FBXLoader.js
  35. 1 1
      examples/js/loaders/GCodeLoader.js
  36. 84 84
      examples/js/loaders/GLTFLoader.js
  37. 7 7
      examples/js/loaders/KTXLoader.js
  38. 12 12
      examples/js/loaders/LDrawLoader.js
  39. 2 2
      examples/js/loaders/LUTCubeLoader.js
  40. 175 175
      examples/js/loaders/MMDLoader.js
  41. 41 41
      examples/js/loaders/MTLLoader.js
  42. 10 10
      examples/js/loaders/OBJLoader.js
  43. 3 3
      examples/js/loaders/PDBLoader.js
  44. 7 7
      examples/js/loaders/PVRLoader.js
  45. 8 8
      examples/js/loaders/RGBELoader.js
  46. 1 1
      examples/js/loaders/RGBMLoader.js
  47. 25 25
      examples/js/loaders/STLLoader.js
  48. 14 14
      examples/js/loaders/SVGLoader.js
  49. 180 180
      examples/js/loaders/TDSLoader.js
  50. 8 8
      examples/js/loaders/TiltLoader.js
  51. 45 45
      examples/js/loaders/VRMLLoader.js
  52. 1 1
      examples/js/loaders/VTKLoader.js
  53. 24 24
      examples/js/loaders/lwo/IFFParser.js
  54. 8 8
      examples/js/loaders/lwo/LWO2Parser.js
  55. 7 7
      examples/js/loaders/lwo/LWO3Parser.js
  56. 8 8
      examples/js/math/ConvexHull.js
  57. 16 16
      examples/js/math/OBB.js
  58. 10 10
      examples/js/misc/ConvexObjectBreaker.js
  59. 2 2
      examples/js/misc/GPUComputationRenderer.js
  60. 22 22
      examples/js/misc/ProgressiveLightMap.js
  61. 81 81
      examples/js/misc/Volume.js
  62. 38 38
      examples/js/misc/VolumeSlice.js
  63. 27 27
      examples/js/modifiers/CurveModifier.js
  64. 5 5
      examples/js/modifiers/SimplifyModifier.js
  65. 123 6
      examples/js/objects/Lensflare.js
  66. 38 2
      examples/js/objects/Reflector.js
  67. 16 2
      examples/js/objects/ReflectorForSSRPass.js
  68. 41 2
      examples/js/objects/Refractor.js
  69. 159 26
      examples/js/objects/Sky.js
  70. 0 1
      examples/js/objects/Water.js
  71. 106 10
      examples/js/objects/Water2.js
  72. 4 4
      examples/js/postprocessing/LUTPass.js
  73. 4 4
      examples/js/postprocessing/SSRPass.js
  74. 1 1
      examples/js/postprocessing/SSRrPass.js
  75. 1 1
      examples/js/renderers/Projector.js
  76. 7 7
      examples/js/shaders/ACESFilmicToneMappingShader.js
  77. 4 4
      examples/js/shaders/AfterimageShader.js
  78. 4 4
      examples/js/shaders/BasicShader.js
  79. 4 4
      examples/js/shaders/BleachBypassShader.js
  80. 4 4
      examples/js/shaders/BlendShader.js
  81. 39 39
      examples/js/shaders/BokehShader.js
  82. 23 23
      examples/js/shaders/BokehShader2.js
  83. 4 4
      examples/js/shaders/BrightnessContrastShader.js
  84. 4 4
      examples/js/shaders/ColorCorrectionShader.js
  85. 4 4
      examples/js/shaders/ColorifyShader.js
  86. 4 4
      examples/js/shaders/ConvolutionShader.js
  87. 4 4
      examples/js/shaders/CopyShader.js
  88. 4 4
      examples/js/shaders/DOFMipMapShader.js
  89. 4 4
      examples/js/shaders/DepthLimitedBlurShader.js
  90. 4 4
      examples/js/shaders/DigitalGlitch.js
  91. 4 4
      examples/js/shaders/DotScreenShader.js
  92. 4 4
      examples/js/shaders/FXAAShader.js
  93. 5 5
      examples/js/shaders/FilmShader.js
  94. 5 5
      examples/js/shaders/FocusShader.js
  95. 4 4
      examples/js/shaders/FreiChenShader.js
  96. 4 4
      examples/js/shaders/FresnelShader.js
  97. 4 4
      examples/js/shaders/GammaCorrectionShader.js
  98. 16 16
      examples/js/shaders/GodRaysShader.js
  99. 4 4
      examples/js/shaders/HalftoneShader.js
  100. 5 5
      examples/js/shaders/HorizontalBlurShader.js

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

@@ -23,13 +23,13 @@
 	const _matrix = new THREE.Matrix4();
 	/**
  * CCD Algorithm
- *	- https://sites.google.com/site/auraliusproject/ccd-algorithm
+ *  - https://sites.google.com/site/auraliusproject/ccd-algorithm
  *
  * // ik parameter example
  * //
  * // target, effector, index in links are bone index in skeleton.bones.
  * // the bones relation should be
- * // <-- parent																	child -->
+ * // <-- parent                                  child -->
  * // links[ n ], links[ n - 1 ], ..., links[ 0 ], effector
  * iks = [ {
  *	target: 1,
@@ -45,9 +45,9 @@
 	class CCDIKSolver {
 
 		/**
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @param {Array<Object>} iks
-	 */
+   * @param {THREE.SkinnedMesh} mesh
+   * @param {Array<Object>} iks
+   */
 		constructor( mesh, iks = [] ) {
 
 			this.mesh = mesh;
@@ -57,10 +57,10 @@
 
 		}
 		/**
-	 * Update all IK bones.
-	 *
-	 * @return {CCDIKSolver}
-	 */
+   * Update all IK bones.
+   *
+   * @return {CCDIKSolver}
+   */
 
 
 		update() {
@@ -77,11 +77,11 @@
 
 		}
 		/**
-	 * Update one IK bone
-	 *
-	 * @param {Object} ik parameter
-	 * @return {CCDIKSolver}
-	 */
+   * Update one IK bone
+   *
+   * @param {Object} ik parameter
+   * @return {CCDIKSolver}
+   */
 
 
 		updateOne( ik ) {
@@ -203,10 +203,10 @@
 
 		}
 		/**
-	 * Creates Helper
-	 *
-	 * @return {CCDIKHelper}
-	 */
+   * Creates Helper
+   *
+   * @return {CCDIKHelper}
+   */
 
 
 		createHelper() {
@@ -310,8 +310,8 @@
 
 		}
 		/**
-	 * Updates IK bones visualization.
-	 */
+   * Updates IK bones visualization.
+   */
 
 
 		updateMatrixWorld( force ) {

+ 80 - 80
examples/js/animation/MMDAnimationHelper.js

@@ -5,22 +5,22 @@
  * with MMD special features as IK, Grant, and Physics.
  *
  * Dependencies
- *	- ammo.js https://github.com/kripken/ammo.js
- *	- THREE.MMDPhysics
- *	- THREE.CCDIKSolver
+ *  - ammo.js https://github.com/kripken/ammo.js
+ *  - THREE.MMDPhysics
+ *  - THREE.CCDIKSolver
  *
  * TODO
- *	- more precise grant skinning support.
+ *  - more precise grant skinning support.
  */
 
 	class MMDAnimationHelper {
 
 		/**
-	 * @param {Object} params - (optional)
-	 * @param {boolean} params.sync - Whether animation durations of added objects are synched. Default is true.
-	 * @param {Number} params.afterglow - Default is 0.0.
-	 * @param {boolean} params.resetPhysicsOnLoop - Default is true.
-	 */
+   * @param {Object} params - (optional)
+   * @param {boolean} params.sync - Whether animation durations of added objects are synched. Default is true.
+   * @param {Number} params.afterglow - Default is 0.0.
+   * @param {boolean} params.resetPhysicsOnLoop - Default is true.
+   */
 		constructor( params = {} ) {
 
 			this.meshes = [];
@@ -52,21 +52,21 @@
 
 		}
 		/**
-	 * Adds an Three.js Object to helper and setups animation.
-	 * The anmation durations of added objects are synched
-	 * if this.configuration.sync is true.
-	 *
-	 * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object
-	 * @param {Object} params - (optional)
-	 * @param {THREE.AnimationClip|Array<THREE.AnimationClip>} params.animation - Only for THREE.SkinnedMesh and THREE.Camera. Default is undefined.
-	 * @param {boolean} params.physics - Only for THREE.SkinnedMesh. Default is true.
-	 * @param {Integer} params.warmup - Only for THREE.SkinnedMesh and physics is true. Default is 60.
-	 * @param {Number} params.unitStep - Only for THREE.SkinnedMesh and physics is true. Default is 1 / 65.
-	 * @param {Integer} params.maxStepNum - Only for THREE.SkinnedMesh and physics is true. Default is 3.
-	 * @param {Vector3} params.gravity - Only for THREE.SkinnedMesh and physics is true. Default ( 0, - 9.8 * 10, 0 ).
-	 * @param {Number} params.delayTime - Only for THREE.Audio. Default is 0.0.
-	 * @return {MMDAnimationHelper}
-	 */
+   * Adds an Three.js Object to helper and setups animation.
+   * The anmation durations of added objects are synched
+   * if this.configuration.sync is true.
+   *
+   * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object
+   * @param {Object} params - (optional)
+   * @param {THREE.AnimationClip|Array<THREE.AnimationClip>} params.animation - Only for THREE.SkinnedMesh and THREE.Camera. Default is undefined.
+   * @param {boolean} params.physics - Only for THREE.SkinnedMesh. Default is true.
+   * @param {Integer} params.warmup - Only for THREE.SkinnedMesh and physics is true. Default is 60.
+   * @param {Number} params.unitStep - Only for THREE.SkinnedMesh and physics is true. Default is 1 / 65.
+   * @param {Integer} params.maxStepNum - Only for THREE.SkinnedMesh and physics is true. Default is 3.
+   * @param {Vector3} params.gravity - Only for THREE.SkinnedMesh and physics is true. Default ( 0, - 9.8 * 10, 0 ).
+   * @param {Number} params.delayTime - Only for THREE.Audio. Default is 0.0.
+   * @return {MMDAnimationHelper}
+   */
 
 
 		add( object, params = {} ) {
@@ -94,11 +94,11 @@
 
 		}
 		/**
-	 * Removes an Three.js Object from helper.
-	 *
-	 * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object
-	 * @return {MMDAnimationHelper}
-	 */
+   * Removes an Three.js Object from helper.
+   *
+   * @param {THREE.SkinnedMesh|THREE.Camera|THREE.Audio} object
+   * @return {MMDAnimationHelper}
+   */
 
 
 		remove( object ) {
@@ -126,11 +126,11 @@
 
 		}
 		/**
-	 * Updates the animation.
-	 *
-	 * @param {Number} delta
-	 * @return {MMDAnimationHelper}
-	 */
+   * Updates the animation.
+   *
+   * @param {Number} delta
+   * @return {MMDAnimationHelper}
+   */
 
 
 		update( delta ) {
@@ -149,16 +149,16 @@
 
 		}
 		/**
-	 * Changes the pose of SkinnedMesh as VPD specifies.
-	 *
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @param {Object} vpd - VPD content parsed MMDParser
-	 * @param {Object} params - (optional)
-	 * @param {boolean} params.resetPose - Default is true.
-	 * @param {boolean} params.ik - Default is true.
-	 * @param {boolean} params.grant - Default is true.
-	 * @return {MMDAnimationHelper}
-	 */
+   * Changes the pose of SkinnedMesh as VPD specifies.
+   *
+   * @param {THREE.SkinnedMesh} mesh
+   * @param {Object} vpd - VPD content parsed MMDParser
+   * @param {Object} params - (optional)
+   * @param {boolean} params.resetPose - Default is true.
+   * @param {boolean} params.ik - Default is true.
+   * @param {boolean} params.grant - Default is true.
+   * @return {MMDAnimationHelper}
+   */
 
 
 		pose( mesh, vpd, params = {} ) {
@@ -219,12 +219,12 @@
 
 		}
 		/**
-	 * Enabes/Disables an animation feature.
-	 *
-	 * @param {string} key
-	 * @param {boolean} enabled
-	 * @return {MMDAnimationHelper}
-	 */
+   * Enabes/Disables an animation feature.
+   *
+   * @param {string} key
+   * @param {boolean} enabled
+   * @return {MMDAnimationHelper}
+   */
 
 
 		enable( key, enabled ) {
@@ -251,11 +251,11 @@
 
 		}
 		/**
-	 * Creates an GrantSolver instance.
-	 *
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @return {GrantSolver}
-	 */
+   * Creates an GrantSolver instance.
+   *
+   * @param {THREE.SkinnedMesh} mesh
+   * @return {GrantSolver}
+   */
 
 
 		createGrantSolver( mesh ) {
@@ -644,9 +644,9 @@
 
 		}
 		/*
-	 * Detects the longest duration and then sets it to them to sync.
-	 * TODO: Not to access private properties ( ._actions and ._clip )
-	 */
+   * Detects the longest duration and then sets it to them to sync.
+   * TODO: Not to access private properties ( ._actions and ._clip )
+   */
 
 
 		_syncDuration() {
@@ -770,14 +770,14 @@
 
 		}
 		/*
-	 * Avoiding these two issues by restore/save bones before/after mixer animation.
-	 *
-	 * 1. PropertyMixer used by THREE.AnimationMixer holds cache value in .buffer.
-	 *		Calculating IK, Grant, and Physics after mixer animation can break
-	 *		the cache coherency.
-	 *
-	 * 2. Applying Grant two or more times without reset the posing breaks model.
-	 */
+   * Avoiding these two issues by restore/save bones before/after mixer animation.
+   *
+   * 1. PropertyMixer used by THREE.AnimationMixer holds cache value in .buffer.
+   *    Calculating IK, Grant, and Physics after mixer animation can break
+   *    the cache coherency.
+   *
+   * 2. Applying Grant two or more times without reset the posing breaks model.
+   */
 
 
 		_saveBones( mesh ) {
@@ -965,10 +965,10 @@
 	class AudioManager {
 
 		/**
-	 * @param {THREE.Audio} audio
-	 * @param {Object} params - (optional)
-	 * @param {Nuumber} params.delayTime
-	 */
+   * @param {THREE.Audio} audio
+   * @param {Object} params - (optional)
+   * @param {Nuumber} params.delayTime
+   */
 		constructor( audio, params = {} ) {
 
 			this.audio = audio;
@@ -980,9 +980,9 @@
 
 		}
 		/**
-	 * @param {Number} delta
-	 * @return {AudioManager}
-	 */
+   * @param {Number} delta
+   * @return {AudioManager}
+   */
 
 
 		control( delta ) {
@@ -1041,9 +1041,9 @@
 
 		}
 		/**
-	 * Solve all the grant bones
-	 * @return {GrantSolver}
-	 */
+   * Solve all the grant bones
+   * @return {GrantSolver}
+   */
 
 
 		update() {
@@ -1060,10 +1060,10 @@
 
 		}
 		/**
-	 * Solve a grant bone
-	 * @param {Object} grant - grant parameter
-	 * @return {GrantSolver}
-	 */
+   * Solve a grant bone
+   * @param {Object} grant - grant parameter
+   * @return {GrantSolver}
+   */
 
 
 		updateOne( grant ) {

+ 75 - 75
examples/js/animation/MMDPhysics.js

@@ -2,13 +2,13 @@
 
 	/**
  * Dependencies
- *	- Ammo.js https://github.com/kripken/ammo.js
+ *  - Ammo.js https://github.com/kripken/ammo.js
  *
  * MMDPhysics calculates physics with Ammo(Bullet based JavaScript Physics engine)
  * for MMD model loaded by MMDLoader.
  *
  * TODO
- *	- Physics in Worker
+ *  - Physics in Worker
  */
 
 	/* global Ammo */
@@ -16,14 +16,14 @@
 	class MMDPhysics {
 
 		/**
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @param {Array<Object>} rigidBodyParams
-	 * @param {Array<Object>} (optional) constraintParams
-	 * @param {Object} params - (optional)
-	 * @param {Number} params.unitStep - Default is 1 / 65.
-	 * @param {Integer} params.maxStepNum - Default is 3.
-	 * @param {Vector3} params.gravity - Default is ( 0, - 9.8 * 10, 0 )
-	 */
+   * @param {THREE.SkinnedMesh} mesh
+   * @param {Array<Object>} rigidBodyParams
+   * @param {Array<Object>} (optional) constraintParams
+   * @param {Object} params - (optional)
+   * @param {Number} params.unitStep - Default is 1 / 65.
+   * @param {Integer} params.maxStepNum - Default is 3.
+   * @param {Vector3} params.gravity - Default is ( 0, - 9.8 * 10, 0 )
+   */
 		constructor( mesh, rigidBodyParams, constraintParams = [], params = {} ) {
 
 			if ( typeof Ammo === 'undefined' ) {
@@ -35,11 +35,11 @@
 			this.manager = new ResourceManager();
 			this.mesh = mesh;
 			/*
-		 * I don't know why but 1/60 unitStep easily breaks models
-		 * so I set it 1/65 so far.
-		 * Don't set too small unitStep because
-		 * the smaller unitStep can make the performance worse.
-		 */
+     * I don't know why but 1/60 unitStep easily breaks models
+     * so I set it 1/65 so far.
+     * Don't set too small unitStep because
+     * the smaller unitStep can make the performance worse.
+     */
 
 			this.unitStep = params.unitStep !== undefined ? params.unitStep : 1 / 65;
 			this.maxStepNum = params.maxStepNum !== undefined ? params.maxStepNum : 3;
@@ -54,11 +54,11 @@
 
 		}
 		/**
-	 * Advances Physics calculation and updates bones.
-	 *
-	 * @param {Number} delta - time in second
-	 * @return {MMDPhysics}
-	 */
+   * Advances Physics calculation and updates bones.
+   *
+   * @param {Number} delta - time in second
+   * @return {MMDPhysics}
+   */
 
 
 		update( delta ) {
@@ -114,10 +114,10 @@
 
 		}
 		/**
-	 * Resets rigid bodies transorm to current bone's.
-	 *
-	 * @return {MMDPhysics}
-	 */
+   * Resets rigid bodies transorm to current bone's.
+   *
+   * @return {MMDPhysics}
+   */
 
 
 		reset() {
@@ -132,11 +132,11 @@
 
 		}
 		/**
-	 * Warm ups Rigid bodies. Calculates cycles steps.
-	 *
-	 * @param {Integer} cycles
-	 * @return {MMDPhysics}
-	 */
+   * Warm ups Rigid bodies. Calculates cycles steps.
+   *
+   * @param {Integer} cycles
+   * @return {MMDPhysics}
+   */
 
 
 		warmup( cycles ) {
@@ -151,11 +151,11 @@
 
 		}
 		/**
-	 * Sets gravity.
-	 *
-	 * @param {Vector3} gravity
-	 * @return {MMDPhysicsHelper}
-	 */
+   * Sets gravity.
+   *
+   * @param {Vector3} gravity
+   * @return {MMDPhysicsHelper}
+   */
 
 
 		setGravity( gravity ) {
@@ -166,10 +166,10 @@
 
 		}
 		/**
-	 * Creates MMDPhysicsHelper
-	 *
-	 * @return {MMDPhysicsHelper}
-	 */
+   * Creates MMDPhysicsHelper
+   *
+   * @return {MMDPhysicsHelper}
+   */
 
 
 		createHelper() {
@@ -303,8 +303,8 @@
  * This manager's responsibilies are
  *
  * 1. manage Ammo.js and Three.js object resources and
- *		improve the performance and the memory consumption by
- *		reusing objects.
+ *    improve the performance and the memory consumption by
+ *    reusing objects.
  *
  * 2. provide simple Ammo object operations.
  */
@@ -738,10 +738,10 @@
 
 		}
 		/**
-	 * Resets rigid body transform to the current bone's.
-	 *
-	 * @return {RigidBody}
-	 */
+   * Resets rigid body transform to the current bone's.
+   *
+   * @return {RigidBody}
+   */
 
 
 		reset() {
@@ -752,10 +752,10 @@
 
 		}
 		/**
-	 * Updates rigid body's transform from the current bone.
-	 *
-	 * @return {RidigBody}
-	 */
+   * Updates rigid body's transform from the current bone.
+   *
+   * @return {RidigBody}
+   */
 
 
 		updateFromBone() {
@@ -770,10 +770,10 @@
 
 		}
 		/**
-	 * Updates bone from the current ridid body's transform.
-	 *
-	 * @return {RidigBody}
-	 */
+   * Updates bone from the current ridid body's transform.
+   *
+   * @return {RidigBody}
+   */
 
 
 		updateBone() {
@@ -861,10 +861,10 @@
 
 				body.setCollisionFlags( body.getCollisionFlags() | 2 );
 				/*
-			 * It'd be better to comment out this line though in general I should call this method
-			 * because I'm not sure why but physics will be more like MMD's
-			 * if I comment out.
-			 */
+       * It'd be better to comment out this line though in general I should call this method
+       * because I'm not sure why but physics will be more like MMD's
+       * if I comment out.
+       */
 
 				body.setActivationState( 4 );
 
@@ -999,13 +999,13 @@
 	class Constraint {
 
 		/**
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @param {Ammo.btDiscreteDynamicsWorld} world
-	 * @param {RigidBody} bodyA
-	 * @param {RigidBody} bodyB
-	 * @param {Object} params
-	 * @param {ResourceManager} manager
-	 */
+   * @param {THREE.SkinnedMesh} mesh
+   * @param {Ammo.btDiscreteDynamicsWorld} world
+   * @param {RigidBody} bodyA
+   * @param {RigidBody} bodyB
+   * @param {Object} params
+   * @param {ResourceManager} manager
+   */
 		constructor( mesh, world, bodyA, bodyB, params, manager ) {
 
 			this.mesh = mesh;
@@ -1075,11 +1075,11 @@
 
 			}
 			/*
-		 * Currently(10/31/2016) official ammo.js doesn't support
-		 * btGeneric6DofSpringConstraint.setParam method.
-		 * You need custom ammo.js (add the method into idl) if you wanna use.
-		 * By setting this parameter, physics will be more like MMD's
-		 */
+     * Currently(10/31/2016) official ammo.js doesn't support
+     * btGeneric6DofSpringConstraint.setParam method.
+     * You need custom ammo.js (add the method into idl) if you wanna use.
+     * By setting this parameter, physics will be more like MMD's
+     */
 
 
 			if ( constraint.setParam !== undefined ) {
@@ -1123,11 +1123,11 @@
 	class MMDPhysicsHelper extends THREE.Object3D {
 
 		/**
-	 * Visualize Rigid bodies
-	 *
-	 * @param {THREE.SkinnedMesh} mesh
-	 * @param {Physics} physics
-	 */
+   * Visualize Rigid bodies
+   *
+   * @param {THREE.SkinnedMesh} mesh
+   * @param {Physics} physics
+   */
 		constructor( mesh, physics ) {
 
 			super();
@@ -1165,8 +1165,8 @@
 
 		}
 		/**
-	 * Updates Rigid Bodies visualization.
-	 */
+   * Updates Rigid Bodies visualization.
+   */
 
 
 		updateMatrixWorld( force ) {

+ 3 - 3
examples/js/controls/DragControls.js

@@ -89,7 +89,7 @@
 					case 'pen':
 						onMouseMove( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -181,7 +181,7 @@
 					case 'pen':
 						onMouseDown( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -228,7 +228,7 @@
 					case 'pen':
 						onMouseCancel( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 

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

@@ -2,9 +2,9 @@
 
 	// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
 	//
-	//		Orbit - left mouse / touch: one-finger move
-	//		Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-	//		Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
+	//    Orbit - left mouse / touch: one-finger move
+	//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
+	//    Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
 
 	const _changeEvent = {
 		type: 'change'
@@ -703,7 +703,7 @@
 					case 'pen':
 						onMouseDown( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -719,7 +719,7 @@
 					case 'pen':
 						onMouseMove( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -733,7 +733,7 @@
 					case 'pen':
 						onMouseUp( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -1018,9 +1018,9 @@
 	// Unlike TrackballControls, it maintains the "up" direction object.up (+Y by default).
 	// This is very similar to OrbitControls, another set of touch behavior
 	//
-	//		Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
-	//		Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-	//		Pan - left mouse, or arrow keys / touch: one-finger move
+	//    Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
+	//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
+	//    Pan - left mouse, or arrow keys / touch: one-finger move
 
 
 	class MapControls extends OrbitControls {

+ 10 - 10
examples/js/controls/TrackballControls.js

@@ -48,9 +48,9 @@
 			this.maxDistance = Infinity;
 			this.keys = [ 'KeyA',
 				/*A*/
-		 'KeyS',
+				'KeyS',
 				/*S*/
-		 'KeyD'
+				'KeyD'
 				/*D*/
 			];
 			this.mouseButtons = {
@@ -389,7 +389,7 @@
 					case 'pen':
 						onMouseDown( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -405,7 +405,7 @@
 					case 'pen':
 						onMouseMove( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -421,7 +421,7 @@
 					case 'pen':
 						onMouseUp( event );
 						break;
-				// TODO touch
+        // TODO touch
 
 				}
 
@@ -559,17 +559,17 @@
 				switch ( event.deltaMode ) {
 
 					case 2:
-					// Zoom in pages
+						// Zoom in pages
 						_zoomStart.y -= event.deltaY * 0.025;
 						break;
 
 					case 1:
-					// Zoom in lines
+						// Zoom in lines
 						_zoomStart.y -= event.deltaY * 0.01;
 						break;
 
 					default:
-					// undefined, 0, assume pixels
+						// undefined, 0, assume pixels
 						_zoomStart.y -= event.deltaY * 0.00025;
 						break;
 
@@ -597,7 +597,7 @@
 						break;
 
 					default:
-					// 2 or more
+						// 2 or more
 						_state = STATE.TOUCH_ZOOM_PAN;
 						const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
 						const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
@@ -632,7 +632,7 @@
 						break;
 
 					default:
-					// 2 or more
+						// 2 or more
 						const dx = event.touches[ 0 ].pageX - event.touches[ 1 ].pageX;
 						const dy = event.touches[ 0 ].pageY - event.touches[ 1 ].pageY;
 						_touchZoomDistanceEnd = Math.sqrt( dx * dx + dy * dy );

+ 2 - 2
examples/js/controls/TransformControls.js

@@ -150,7 +150,7 @@
 			this.domElement.addEventListener( 'pointermove', this._onPointerHover );
 			this.domElement.ownerDocument.addEventListener( 'pointerup', this._onPointerUp );
 
-		} // updateMatrixWorld	updates key transformation variables
+		} // updateMatrixWorld  updates key transformation variables
 
 
 		updateMatrixWorld() {
@@ -1438,7 +1438,7 @@
 
 				case 'rotate':
 				default:
-				// special case for rotate
+					// special case for rotate
 					_dirVector.set( 0, 0, 0 );
 
 			}

+ 9 - 9
examples/js/controls/experimental/CameraControls.js

@@ -982,9 +982,9 @@
 	CameraControls.prototype = Object.create( THREE.EventDispatcher.prototype );
 	CameraControls.prototype.constructor = CameraControls; // OrbitControls maintains the "up" direction, camera.up (+Y by default).
 	//
-	//		Orbit - left mouse / touch: one-finger move
-	//		Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-	//		Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
+	//    Orbit - left mouse / touch: one-finger move
+	//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
+	//    Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
 
 	var OrbitControls = function ( object, domElement ) {
 
@@ -999,9 +999,9 @@
 	OrbitControls.prototype = Object.create( THREE.EventDispatcher.prototype );
 	OrbitControls.prototype.constructor = OrbitControls; // MapControls maintains the "up" direction, camera.up (+Y by default)
 	//
-	//		Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
-	//		Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-	//		Pan - left mouse, or left right + ctrl/meta/shiftKey, or arrow keys / touch: one-finger move
+	//    Orbit - right mouse, or left mouse + ctrl/meta/shiftKey / touch: two-finger rotate
+	//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
+	//    Pan - left mouse, or left right + ctrl/meta/shiftKey, or arrow keys / touch: one-finger move
 
 	var MapControls = function ( object, domElement ) {
 
@@ -1016,9 +1016,9 @@
 	MapControls.prototype = Object.create( THREE.EventDispatcher.prototype );
 	MapControls.prototype.constructor = MapControls; // TrackballControls allows the camera to rotate over the polls and does not maintain camera.up
 	//
-	//		Orbit - left mouse / touch: one-finger move
-	//		Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
-	//		Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
+	//    Orbit - left mouse / touch: one-finger move
+	//    Zoom - middle mouse, or mousewheel / touch: two-finger spread or squish
+	//    Pan - right mouse, or left mouse + ctrl/meta/shiftKey, or arrow keys / touch: two-finger move
 
 	var TrackballControls = function ( object, domElement ) {
 

+ 4 - 4
examples/js/csm/CSMShader.js

@@ -2,8 +2,8 @@
 
 	const CSMShader = {
 		lights_fragment_begin:
-	/* glsl */
-	`
+  /* glsl */
+  `
 GeometricContext geometry;
 
 geometry.position = - vViewPosition;
@@ -226,8 +226,8 @@ IncidentLight directLight;
 #endif
 `,
 		lights_pars_begin:
-	/* glsl */
-	`
+  /* glsl */
+  `
 #if defined( USE_CSM ) && defined( CSM_CASCADES )
 uniform vec2 CSM_cascades[CSM_CASCADES];
 uniform float cameraNear;

+ 2 - 2
examples/js/csm/Frustum.js

@@ -23,8 +23,8 @@
 		setFromProjectionMatrix( projectionMatrix, maxFar ) {
 
 			const isOrthographic = projectionMatrix.elements[ 2 * 4 + 3 ] === 0;
-			inverseProjectionMatrix.copy( projectionMatrix ).invert(); // 3 --- 0	vertices.near/far order
-			// |		 |
+			inverseProjectionMatrix.copy( projectionMatrix ).invert(); // 3 --- 0  vertices.near/far order
+			// |     |
 			// 2 --- 1
 			// clip space spans from [-1, 1]
 

+ 58 - 58
examples/js/curves/NURBSUtils.js

@@ -13,12 +13,12 @@
 	class NURBSUtils {
 
 		/*
-	Finds knot vector span.
-		p : degree
-	u : parametric value
-	U : knot vector
-		returns the span
-	*/
+  Finds knot vector span.
+  	p : degree
+  u : parametric value
+  U : knot vector
+  	returns the span
+  */
 		static findSpan( p, u, U ) {
 
 			const n = U.length - p - 1;
@@ -59,13 +59,13 @@
 
 		}
 		/*
-	Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2
-		span : span in which u lies
-	u		: parametric point
-	p		: degree
-	U		: knot vector
-		returns array[p+1] with basis functions values.
-	*/
+  Calculate basis functions. See The NURBS Book, page 70, algorithm A2.2
+  	span : span in which u lies
+  u    : parametric point
+  p    : degree
+  U    : knot vector
+  	returns array[p+1] with basis functions values.
+  */
 
 
 		static calcBasisFunctions( span, u, p, U ) {
@@ -99,13 +99,13 @@
 
 		}
 		/*
-	Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1.
-		p : degree of B-Spline
-	U : knot vector
-	P : control points (x, y, z, w)
-	u : parametric point
-		returns point for given u
-	*/
+  Calculate B-Spline curve points. See The NURBS Book, page 82, algorithm A3.1.
+  	p : degree of B-Spline
+  U : knot vector
+  P : control points (x, y, z, w)
+  u : parametric point
+  	returns point for given u
+  */
 
 
 		static calcBSplinePoint( p, U, P, u ) {
@@ -130,14 +130,14 @@
 
 		}
 		/*
-	Calculate basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3.
-		span : span in which u lies
-	u		: parametric point
-	p		: degree
-	n		: number of derivatives to calculate
-	U		: knot vector
-		returns array[n+1][p+1] with basis functions derivatives
-	*/
+  Calculate basis functions derivatives. See The NURBS Book, page 72, algorithm A2.3.
+  	span : span in which u lies
+  u    : parametric point
+  p    : degree
+  n    : number of derivatives to calculate
+  U    : knot vector
+  	returns array[n+1][p+1] with basis functions derivatives
+  */
 
 
 		static calcBasisFunctionDerivatives( span, u, p, n, U ) {
@@ -256,14 +256,14 @@
 
 		}
 		/*
-		Calculate derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2.
-			p	: degree
-		U	: knot vector
-		P	: control points
-		u	: Parametric points
-		nd : number of derivatives
-			returns array[d+1] with derivatives
-		*/
+  	Calculate derivatives of a B-Spline. See The NURBS Book, page 93, algorithm A3.2.
+  		p  : degree
+  	U  : knot vector
+  	P  : control points
+  	u  : Parametric points
+  	nd : number of derivatives
+  		returns array[d+1] with derivatives
+  	*/
 
 
 		static calcBSplineDerivatives( p, U, P, u, nd ) {
@@ -309,9 +309,9 @@
 
 		}
 		/*
-	Calculate "K over I"
-		returns k!/(i!(k-i)!)
-	*/
+  Calculate "K over I"
+  	returns k!/(i!(k-i)!)
+  */
 
 
 		static calcKoverI( k, i ) {
@@ -342,10 +342,10 @@
 
 		}
 		/*
-	Calculate derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2.
-		Pders : result of function calcBSplineDerivatives
-		returns array with derivatives for rational curve.
-	*/
+  Calculate derivatives (0-nd) of rational curve. See The NURBS Book, page 127, algorithm A4.2.
+  	Pders : result of function calcBSplineDerivatives
+  	returns array with derivatives for rational curve.
+  */
 
 
 		static calcRationalCurveDerivatives( Pders ) {
@@ -382,14 +382,14 @@
 
 		}
 		/*
-	Calculate NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2.
-		p	: degree
-	U	: knot vector
-	P	: control points in homogeneous space
-	u	: parametric points
-	nd : number of derivatives
-		returns array with derivatives.
-	*/
+  Calculate NURBS curve derivatives. See The NURBS Book, page 127, algorithm A4.2.
+  	p  : degree
+  U  : knot vector
+  P  : control points in homogeneous space
+  u  : parametric points
+  nd : number of derivatives
+  	returns array with derivatives.
+  */
 
 
 		static calcNURBSDerivatives( p, U, P, u, nd ) {
@@ -399,13 +399,13 @@
 
 		}
 		/*
-	Calculate rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3.
-		p1, p2 : degrees of B-Spline surface
-	U1, U2 : knot vectors
-	P			: control points (x, y, z, w)
-	u, v	 : parametric values
-		returns point for given (u, v)
-	*/
+  Calculate rational B-Spline surface point. See The NURBS Book, page 134, algorithm A4.3.
+  	p1, p2 : degrees of B-Spline surface
+  U1, U2 : knot vectors
+  P      : control points (x, y, z, w)
+  u, v   : parametric values
+  	returns point for given (u, v)
+  */
 
 
 		static calcSurfacePoint( p, q, U, V, P, u, v, target ) {

+ 18 - 18
examples/js/deprecated/Geometry.js

@@ -420,7 +420,7 @@
 
 			// save original normals
 			// - create temp variables on first access
-			//	 otherwise just copy (for faster repeated calls)
+			//   otherwise just copy (for faster repeated calls)
 			for ( let f = 0, fl = this.faces.length; f < fl; f ++ ) {
 
 				const face = this.faces[ f ];
@@ -663,10 +663,10 @@
 
 		}
 		/*
-	 * Checks for duplicate vertices with hashmap.
-	 * Duplicated vertices are removed
-	 * and faces' vertices are updated.
-	 */
+   * Checks for duplicate vertices with hashmap.
+   * Duplicated vertices are removed
+   * and faces' vertices are updated.
+   */
 
 
 		mergeVertices( precisionPoints = 4 ) {
@@ -970,19 +970,19 @@
 		clone() {
 
 			/*
-		 // Handle primitives
-			 const parameters = this.parameters;
-			 if ( parameters !== undefined ) {
-			 const values = [];
-			 for ( const key in parameters ) {
-			 values.push( parameters[ key ] );
-			 }
-			 const geometry = Object.create( this.constructor.prototype );
-		 this.constructor.apply( geometry, values );
-		 return geometry;
-			 }
-			 return new this.constructor().copy( this );
-		 */
+     // Handle primitives
+    	 const parameters = this.parameters;
+    	 if ( parameters !== undefined ) {
+    	 const values = [];
+    	 for ( const key in parameters ) {
+    	 values.push( parameters[ key ] );
+    	 }
+    	 const geometry = Object.create( this.constructor.prototype );
+     this.constructor.apply( geometry, values );
+     return geometry;
+    	 }
+    	 return new this.constructor().copy( this );
+     */
 			return new Geometry().copy( this );
 
 		}

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

@@ -53,10 +53,10 @@
 			this.domElement = domElement; // Throw in ascii library from http://www.nihilogic.dk/labs/jsascii/jsascii.js
 
 			/*
-		* jsAscii 0.1
-		* Copyright (c) 2008 Jacob Seidelin, [email protected], http://blog.nihilogic.dk/
-		* MIT License [http://www.nihilogic.dk/licenses/mit-license.txt]
-		*/
+    * jsAscii 0.1
+    * Copyright (c) 2008 Jacob Seidelin, [email protected], http://blog.nihilogic.dk/
+    * MIT License [http://www.nihilogic.dk/licenses/mit-license.txt]
+    */
 
 			function initAsciiSize() {
 

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

@@ -78,7 +78,7 @@
 			const originalMaterials = {}; // object.uuid -> originalOnBeforeRender
 			// save before render and release after render.
 
-			const originalOnBeforeRenders = {}; //this.cache = cache;	// for debug
+			const originalOnBeforeRenders = {}; //this.cache = cache;  // for debug
 
 			const uniformsOutline = {
 				outlineThickness: {
@@ -395,19 +395,19 @@
 
 			};
 			/*
-		 * See #9918
-		 *
-		 * The following property copies and wrapper methods enable
-		 * OutlineEffect to be called from other *Effect, like
-		 *
-		 * effect = new StereoEffect( new OutlineEffect( renderer ) );
-		 *
-		 * function render () {
-		 *
-			 * 	effect.render( scene, camera );
-		 *
-		 * }
-		 */
+     * See #9918
+     *
+     * The following property copies and wrapper methods enable
+     * OutlineEffect to be called from other *Effect, like
+     *
+     * effect = new StereoEffect( new OutlineEffect( renderer ) );
+     *
+     * function render () {
+     *
+    	 * 	effect.render( scene, camera );
+     *
+     * }
+     */
 
 
 			this.autoClear = renderer.autoClear;

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

@@ -4,12 +4,12 @@
  * https://github.com/gkjohnson/collada-exporter-js
  *
  * Usage:
- *	const exporter = new ColladaExporter();
+ *  const exporter = new ColladaExporter();
  *
- *	const data = exporter.parse(mesh);
+ *  const data = exporter.parse(mesh);
  *
  * Format Definition:
- *	https://www.khronos.org/collada/
+ *  https://www.khronos.org/collada/
  */
 
 	class ColladaExporter {
@@ -55,7 +55,7 @@
 
 					}
 
-					const res = `${pad( '	', tagnum )}${tag}`;
+					const res = `${pad( '  ', tagnum )}${tag}`;
 
 					if ( ! HAS_TEXT.test( tag ) && ! IS_SELF_CLOSING.test( tag ) && ! IS_END_TAG.test( tag ) ) {
 

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

@@ -6,12 +6,12 @@
  * Draco files are compressed and usually are smaller than conventional 3D file formats.
  *
  * The exporter receives a options object containing
- *	- decodeSpeed, indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality)
- *	- encodeSpeed, indicates how to tune the encoder parameters (0 gives better speed but worst quality)
- *	- encoderMethod
- *	- quantization, indicates the presision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC)
- *	- exportUvs
- *	- exportNormals
+ *  - decodeSpeed, indicates how to tune the encoder regarding decode speed (0 gives better speed but worst quality)
+ *  - encodeSpeed, indicates how to tune the encoder parameters (0 gives better speed but worst quality)
+ *  - encoderMethod
+ *  - quantization, indicates the presision of each type of data stored in the draco file in the order (POSITION, NORMAL, COLOR, TEX_COORD, GENERIC)
+ *  - exportUvs
+ *  - exportNormals
  */
 
 	/* global DracoEncoderModule */

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

@@ -47,11 +47,11 @@
 
 		}
 		/**
-	 * Parse scenes and generate GLTF output
-	 * @param	{Scene or [THREE.Scenes]} input	 THREE.Scene or Array of THREE.Scenes
-	 * @param	{Function} onDone	Callback on completed
-	 * @param	{Object} options options
-	 */
+   * Parse scenes and generate GLTF output
+   * @param  {Scene or [THREE.Scenes]} input   THREE.Scene or Array of THREE.Scenes
+   * @param  {Function} onDone  Callback on completed
+   * @param  {Object} options options
+   */
 
 
 		parse( input, onDone, options ) {
@@ -128,9 +128,9 @@
 
 	/**
  * Compare two arrays
- * @param	{Array} array1 Array 1 to compare
- * @param	{Array} array2 Array 2 to compare
- * @return {Boolean}				Returns true if both arrays are equal
+ * @param  {Array} array1 Array 1 to compare
+ * @param  {Array} array2 Array 2 to compare
+ * @return {Boolean}        Returns true if both arrays are equal
  */
 
 	function equalArray( array1, array2 ) {
@@ -144,7 +144,7 @@
 	}
 	/**
  * Converts a string to an ArrayBuffer.
- * @param	{string} text
+ * @param  {string} text
  * @return {ArrayBuffer}
  */
 
@@ -185,9 +185,9 @@
 	}
 	/**
  * Get the min and max vectors from the given attribute
- * @param	{BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
- * @param	{Integer} start
- * @param	{Integer} count
+ * @param  {BufferAttribute} attribute Attribute to find the min/max in range from start to start + count
+ * @param  {Integer} start
+ * @param  {Integer} count
  * @return {Object} Object containing the `min` and `max` values (As an array of attribute.itemSize components)
  */
 
@@ -320,17 +320,17 @@
 
 		}
 		/**
-	 * Parse scenes and generate GLTF output
-	 * @param	{Scene or [THREE.Scenes]} input	 THREE.Scene or Array of THREE.Scenes
-	 * @param	{Function} onDone	Callback on completed
-	 * @param	{Object} options options
-	 */
+   * Parse scenes and generate GLTF output
+   * @param  {Scene or [THREE.Scenes]} input   THREE.Scene or Array of THREE.Scenes
+   * @param  {Function} onDone  Callback on completed
+   * @param  {Object} options options
+   */
 
 
 		write( input, onDone, options ) {
 
 			this.options = Object.assign( {}, {
-			// default options
+				// default options
 				binary: false,
 				trs: false,
 				onlyVisible: true,
@@ -432,11 +432,11 @@
 
 		}
 		/**
-	 * Serializes a userData.
-	 *
-	 * @param {THREE.Object3D|THREE.Material} object
-	 * @param {Object} objectDef
-	 */
+   * Serializes a userData.
+   *
+   * @param {THREE.Object3D|THREE.Material} object
+   * @param {Object} objectDef
+   */
 
 
 		serializeUserData( object, objectDef ) {
@@ -474,11 +474,11 @@
 
 		}
 		/**
-	 * Assign and return a temporal unique id for an object
-	 * especially which doesn't have .uuid
-	 * @param	{Object} object
-	 * @return {Integer}
-	 */
+   * Assign and return a temporal unique id for an object
+   * especially which doesn't have .uuid
+   * @param  {Object} object
+   * @return {Integer}
+   */
 
 
 		getUID( object ) {
@@ -488,11 +488,11 @@
 
 		}
 		/**
-	 * Checks if normal attribute values are normalized.
-	 *
-	 * @param {BufferAttribute} normal
-	 * @returns {Boolean}
-	 */
+   * Checks if normal attribute values are normalized.
+   *
+   * @param {BufferAttribute} normal
+   * @returns {Boolean}
+   */
 
 
 		isNormalizedNormalAttribute( normal ) {
@@ -512,12 +512,12 @@
 
 		}
 		/**
-	 * Creates normalized normal buffer attribute.
-	 *
-	 * @param {BufferAttribute} normal
-	 * @returns {BufferAttribute}
-	 *
-	 */
+   * Creates normalized normal buffer attribute.
+   *
+   * @param {BufferAttribute} normal
+   * @returns {BufferAttribute}
+   *
+   */
 
 
 		createNormalizedNormalAttribute( normal ) {
@@ -551,12 +551,12 @@
 
 		}
 		/**
-	 * Applies a texture transform, if present, to the map definition. Requires
-	 * the KHR_texture_transform extension.
-	 *
-	 * @param {Object} mapDef
-	 * @param {THREE.Texture} texture
-	 */
+   * Applies a texture transform, if present, to the map definition. Requires
+   * the KHR_texture_transform extension.
+   *
+   * @param {Object} mapDef
+   * @param {THREE.Texture} texture
+   */
 
 
 		applyTextureTransform( mapDef, texture ) {
@@ -595,10 +595,10 @@
 
 		}
 		/**
-	 * Process a buffer to append to the default one.
-	 * @param	{ArrayBuffer} buffer
-	 * @return {Integer}
-	 */
+   * Process a buffer to append to the default one.
+   * @param  {ArrayBuffer} buffer
+   * @return {Integer}
+   */
 
 
 		processBuffer( buffer ) {
@@ -614,14 +614,14 @@
 
 		}
 		/**
-	 * Process and generate a BufferView
-	 * @param	{BufferAttribute} attribute
-	 * @param	{number} componentType
-	 * @param	{number} start
-	 * @param	{number} count
-	 * @param	{number} target (Optional) Target usage of the BufferView
-	 * @return {Object}
-	 */
+   * Process and generate a BufferView
+   * @param  {BufferAttribute} attribute
+   * @param  {number} componentType
+   * @param  {number} start
+   * @param  {number} count
+   * @param  {number} target (Optional) Target usage of the BufferView
+   * @return {Object}
+   */
 
 
 		processBufferView( attribute, componentType, start, count, target ) {
@@ -715,10 +715,10 @@
 
 		}
 		/**
-	 * Process and generate a BufferView from an image Blob.
-	 * @param {Blob} blob
-	 * @return {Promise<Integer>}
-	 */
+   * Process and generate a BufferView from an image Blob.
+   * @param {Blob} blob
+   * @return {Promise<Integer>}
+   */
 
 
 		processBufferViewImage( blob ) {
@@ -748,13 +748,13 @@
 
 		}
 		/**
-	 * Process attribute to generate an accessor
-	 * @param	{BufferAttribute} attribute Attribute to process
-	 * @param	{THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
-	 * @param	{Integer} start (Optional)
-	 * @param	{Integer} count (Optional)
-	 * @return {Integer|null} Index of the processed accessor on the "accessors" array
-	 */
+   * Process attribute to generate an accessor
+   * @param  {BufferAttribute} attribute Attribute to process
+   * @param  {THREE.BufferGeometry} geometry (Optional) Geometry used for truncated draw range
+   * @param  {Integer} start (Optional)
+   * @param  {Integer} count (Optional)
+   * @return {Integer|null} Index of the processed accessor on the "accessors" array
+   */
 
 
 		processAccessor( attribute, geometry, start, count ) {
@@ -833,12 +833,12 @@
 
 		}
 		/**
-	 * Process image
-	 * @param	{Image} image to process
-	 * @param	{Integer} format of the image (e.g. THREE.RGBFormat, THREE.RGBAFormat etc)
-	 * @param	{Boolean} flipY before writing out the image
-	 * @return {Integer}		 Index of the processed texture in the "images" array
-	 */
+   * Process image
+   * @param  {Image} image to process
+   * @param  {Integer} format of the image (e.g. THREE.RGBFormat, THREE.RGBAFormat etc)
+   * @param  {Boolean} flipY before writing out the image
+   * @return {Integer}     Index of the processed texture in the "images" array
+   */
 
 
 		processImage( image, format, flipY ) {
@@ -946,10 +946,10 @@
 
 		}
 		/**
-	 * Process sampler
-	 * @param	{Texture} map Texture to process
-	 * @return {Integer}		 Index of the processed texture in the "samplers" array
-	 */
+   * Process sampler
+   * @param  {Texture} map Texture to process
+   * @return {Integer}     Index of the processed texture in the "samplers" array
+   */
 
 
 		processSampler( map ) {
@@ -966,10 +966,10 @@
 
 		}
 		/**
-	 * Process texture
-	 * @param	{Texture} map Map to process
-	 * @return {Integer} Index of the processed texture in the "textures" array
-	 */
+   * Process texture
+   * @param  {Texture} map Map to process
+   * @return {Integer} Index of the processed texture in the "textures" array
+   */
 
 
 		processTexture( map ) {
@@ -996,10 +996,10 @@
 
 		}
 		/**
-	 * Process material
-	 * @param	{THREE.Material} material Material to process
-	 * @return {Integer|null} Index of the processed material in the "materials" array
-	 */
+   * Process material
+   * @param  {THREE.Material} material Material to process
+   * @return {Integer|null} Index of the processed material in the "materials" array
+   */
 
 
 		processMaterial( material ) {
@@ -1178,10 +1178,10 @@
 
 		}
 		/**
-	 * Process mesh
-	 * @param	{THREE.Mesh} mesh Mesh to process
-	 * @return {Integer|null} Index of the processed mesh in the "meshes" array
-	 */
+   * Process mesh
+   * @param  {THREE.Mesh} mesh Mesh to process
+   * @return {Integer|null} Index of the processed mesh in the "meshes" array
+   */
 
 
 		processMesh( mesh ) {
@@ -1458,10 +1458,10 @@
 
 		}
 		/**
-	 * Process camera
-	 * @param	{THREE.Camera} camera Camera to process
-	 * @return {Integer}			Index of the processed mesh in the "camera" array
-	 */
+   * Process camera
+   * @param  {THREE.Camera} camera Camera to process
+   * @return {Integer}      Index of the processed mesh in the "camera" array
+   */
 
 
 		processCamera( camera ) {
@@ -1499,15 +1499,15 @@
 
 		}
 		/**
-	 * Creates glTF animation entry from AnimationClip object.
-	 *
-	 * Status:
-	 * - Only properties listed in PATH_PROPERTIES may be animated.
-	 *
-	 * @param {THREE.AnimationClip} clip
-	 * @param {THREE.Object3D} root
-	 * @return {number|null}
-	 */
+   * Creates glTF animation entry from AnimationClip object.
+   *
+   * Status:
+   * - Only properties listed in PATH_PROPERTIES may be animated.
+   *
+   * @param {THREE.AnimationClip} clip
+   * @param {THREE.Object3D} root
+   * @return {number|null}
+   */
 
 
 		processAnimation( clip, root ) {
@@ -1604,9 +1604,9 @@
 
 		}
 		/**
-	 * @param {THREE.Object3D} object
-	 * @return {number|null}
-	 */
+   * @param {THREE.Object3D} object
+   * @return {number|null}
+   */
 
 
 		processSkin( object ) {
@@ -1641,10 +1641,10 @@
 
 		}
 		/**
-	 * Process Object3D node
-	 * @param	{THREE.Object3D} node Object3D to processNode
-	 * @return {Integer} Index of the node in the nodes list
-	 */
+   * Process Object3D node
+   * @param  {THREE.Object3D} node Object3D to processNode
+   * @return {Integer} Index of the node in the nodes list
+   */
 
 
 		processNode( object ) {
@@ -1745,9 +1745,9 @@
 
 		}
 		/**
-	 * Process THREE.Scene
-	 * @param	{Scene} node THREE.Scene to process
-	 */
+   * Process THREE.Scene
+   * @param  {Scene} node THREE.Scene to process
+   */
 
 
 		processScene( scene ) {
@@ -1785,9 +1785,9 @@
 
 		}
 		/**
-	 * Creates a THREE.Scene to hold a list of objects and parse it
-	 * @param	{Array} objects List of objects to process
-	 */
+   * Creates a THREE.Scene to hold a list of objects and parse it
+   * @param  {Array} objects List of objects to process
+   */
 
 
 		processObjects( objects ) {
@@ -1807,8 +1807,8 @@
 
 		}
 		/**
-	 * @param {THREE.Object3D|Array<THREE.Object3D>} input
-	 */
+   * @param {THREE.Object3D|Array<THREE.Object3D>} input
+   */
 
 
 		processInput( input ) {

+ 21 - 21
examples/js/exporters/MMDExporter.js

@@ -2,33 +2,33 @@
 
 	/**
  * Dependencies
- *	- mmd-parser https://github.com/takahirox/mmd-parser
+ *  - mmd-parser https://github.com/takahirox/mmd-parser
  */
 
 	class MMDExporter {
 
 		/* TODO: implement
-	// mesh -> pmd
-	this.parsePmd = function ( object ) {
-		};
-	*/
+  // mesh -> pmd
+  this.parsePmd = function ( object ) {
+  	};
+  */
 
 		/* TODO: implement
-	// mesh -> pmx
-	this.parsePmx = function ( object ) {
-		};
-	*/
+  // mesh -> pmx
+  this.parsePmx = function ( object ) {
+  	};
+  */
 
 		/* TODO: implement
-	// animation + skeleton -> vmd
-	this.parseVmd = function ( object ) {
-		};
-	*/
+  // animation + skeleton -> vmd
+  this.parseVmd = function ( object ) {
+  	};
+  */
 
 		/*
-	 * skeleton -> vpd
-	 * Returns Shift_JIS encoded Uint8Array. Otherwise return strings.
-	 */
+   * skeleton -> vpd
+   * Returns Shift_JIS encoded Uint8Array. Otherwise return strings.
+   */
 		parseVpd( skin, outputShiftJis, useOriginalBones ) {
 
 			if ( skin.isSkinnedMesh !== true ) {
@@ -90,9 +90,9 @@
 				const bone = bones[ i ];
 				const bone2 = bones2[ i ];
 				/*
-			 * use the bone matrix saved before solving IK.
-			 * see CCDIKSolver for the detail.
-			 */
+       * use the bone matrix saved before solving IK.
+       * see CCDIKSolver for the detail.
+       */
 
 				if ( useOriginalBones === true && bone.userData.ik !== undefined && bone.userData.ik.originalMatrix !== undefined ) {
 
@@ -113,8 +113,8 @@
 				qArray[ 0 ] = - qArray[ 0 ];
 				qArray[ 1 ] = - qArray[ 1 ];
 				array.push( 'Bone' + i + '{' + bone.name );
-				array.push( '	' + toStringsFromArray( pArray ) + ';' );
-				array.push( '	' + toStringsFromArray( qArray ) + ';' );
+				array.push( '  ' + toStringsFromArray( pArray ) + ';' );
+				array.push( '  ' + toStringsFromArray( qArray ) + ';' );
 				array.push( '}' );
 				array.push( '' );
 

+ 4 - 4
examples/js/exporters/PLYExporter.js

@@ -4,10 +4,10 @@
  * https://github.com/gkjohnson/ply-exporter-js
  *
  * Usage:
- *	const exporter = new PLYExporter();
+ *  const exporter = new PLYExporter();
  *
- *	// second argument is a list of options
- *	exporter.parse(mesh, data => console.log(data), { binary: true, excludeAttributes: [ 'color' ], littleEndian: true });
+ *  // second argument is a list of options
+ *  exporter.parse(mesh, data => console.log(data), { binary: true, excludeAttributes: [ 'color' ], littleEndian: true });
  *
  * Format Definition:
  * http://paulbourke.net/dataformats/ply/
@@ -120,7 +120,7 @@
 
 			const indexByteCount = 4;
 			let header = 'ply\n' + `format ${options.binary ? options.littleEndian ? 'binary_little_endian' : 'binary_big_endian' : 'ascii'} 1.0\n` + `element vertex ${vertexCount}\n` + // position
-		'property float x\n' + 'property float y\n' + 'property float z\n';
+    'property float x\n' + 'property float y\n' + 'property float z\n';
 
 			if ( includeNormals === true ) {
 

+ 3 - 3
examples/js/exporters/STLExporter.js

@@ -2,10 +2,10 @@
 
 	/**
  * Usage:
- *	const exporter = new STLExporter();
+ *  const exporter = new STLExporter();
  *
- *	// second argument is a list of options
- *	const data = exporter.parse( mesh, { binary: true } );
+ *  // second argument is a list of options
+ *  const data = exporter.parse( mesh, { binary: true } );
  *
  */
 

+ 43 - 43
examples/js/exporters/USDZExporter.js

@@ -97,11 +97,11 @@
 
 		return `#usda 1.0
 (
-		customLayerData = {
-				string creator = "Three.js USDZExporter"
-		}
-		metersPerUnit = 1
-		upAxis = "Y"
+    customLayerData = {
+        string creator = "Three.js USDZExporter"
+    }
+    metersPerUnit = 1
+    upAxis = "Y"
 )
 
 `;
@@ -115,10 +115,10 @@
 		const transform = buildMatrix( object.matrixWorld );
 		return `def Xform "${name}"
 {
-		matrix4d xformOp:transform = ${transform}
-		uniform token[] xformOpOrder = ["xformOp:transform"]
+    matrix4d xformOp:transform = ${transform}
+    uniform token[] xformOpOrder = ["xformOp:transform"]
 
-		${define}
+    ${define}
 }
 
 `;
@@ -152,19 +152,19 @@
 		}
 
 		return `def Mesh "${name}"
-		{
-				int[] faceVertexCounts = [${buildMeshVertexCount( geometry )}]
-				int[] faceVertexIndices = [${buildMeshVertexIndices( geometry )}]
-				rel material:binding = </Materials/Material_${material.id}>
-				normal3f[] normals = [${buildVector3Array( attributes.normal, count )}] (
-						interpolation = "vertex"
-				)
-				point3f[] points = [${buildVector3Array( attributes.position, count )}]
-				float2[] primvars:st = [${buildVector2Array( attributes.uv, count )}] (
-						interpolation = "vertex"
-				)
-				uniform token subdivisionScheme = "none"
-		}
+    {
+        int[] faceVertexCounts = [${buildMeshVertexCount( geometry )}]
+        int[] faceVertexIndices = [${buildMeshVertexIndices( geometry )}]
+        rel material:binding = </Materials/Material_${material.id}>
+        normal3f[] normals = [${buildVector3Array( attributes.normal, count )}] (
+            interpolation = "vertex"
+        )
+        point3f[] points = [${buildVector3Array( attributes.position, count )}]
+        float2[] primvars:st = [${buildVector2Array( attributes.uv, count )}] (
+            interpolation = "vertex"
+        )
+        uniform token subdivisionScheme = "none"
+    }
 `;
 
 	}
@@ -265,7 +265,7 @@ ${array.join( '' )}
 	function buildMaterial( material ) {
 
 		// https://graphics.pixar.com/usd/docs/UsdPreviewSurface-Proposal.html
-		const pad = '						';
+		const pad = '            ';
 		const parameters = [];
 
 		if ( material.map !== null ) {
@@ -321,18 +321,18 @@ ${array.join( '' )}
 		}
 
 		return `
-		def Material "Material_${material.id}"
-		{
-				token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>
+    def Material "Material_${material.id}"
+    {
+        token outputs:surface.connect = </Materials/Material_${material.id}/PreviewSurface.outputs:surface>
 
-				def Shader "PreviewSurface"
-				{
-						uniform token info:id = "UsdPreviewSurface"
+        def Shader "PreviewSurface"
+        {
+            uniform token info:id = "UsdPreviewSurface"
 ${parameters.join( '\n' )}
-						int inputs:useSpecularWorkflow = 0
-						token outputs:surface
-				}
-		}
+            int inputs:useSpecularWorkflow = 0
+            token outputs:surface
+        }
+    }
 `;
 
 	}
@@ -360,17 +360,17 @@ ${array.join( '' )}
 	function buildTexture( texture ) {
 
 		return `
-		def Shader "Texture_${texture.id}"
-		{
-				uniform token info:id = "UsdUVTexture"
-				asset inputs:file = @textures/Texture_${texture.id}.jpg@
-				token inputs:wrapS = "repeat"
-				token inputs:wrapT = "repeat"
-				float outputs:r
-				float outputs:g
-				float outputs:b
-				float3 outputs:rgb
-		}
+    def Shader "Texture_${texture.id}"
+    {
+        uniform token info:id = "UsdUVTexture"
+        asset inputs:file = @textures/Texture_${texture.id}.jpg@
+        token inputs:wrapS = "repeat"
+        token inputs:wrapT = "repeat"
+        float outputs:r
+        float outputs:g
+        float outputs:b
+        float3 outputs:rgb
+    }
 `;
 
 	}

+ 12 - 12
examples/js/geometries/ParametricGeometries.js

@@ -120,10 +120,10 @@
 
 	};
 	/*********************************************
-	*
-	* Parametric Replacement for TorusKnotGeometry
-	*
-	*********************************************/
+  *
+  * Parametric Replacement for TorusKnotGeometry
+  *
+  *********************************************/
 
 	ParametricGeometries.TorusKnotGeometry = class TorusKnotGeometry extends ParametricGeometries.TubeGeometry {
 
@@ -160,10 +160,10 @@
 
 	};
 	/*********************************************
-	*
-	* Parametric Replacement for SphereGeometry
-	*
-	*********************************************/
+  *
+  * Parametric Replacement for SphereGeometry
+  *
+  *********************************************/
 
 	ParametricGeometries.SphereGeometry = class SphereGeometry extends THREE.ParametricGeometry {
 
@@ -186,10 +186,10 @@
 
 	};
 	/*********************************************
-	*
-	* Parametric Replacement for PlaneGeometry
-	*
-	*********************************************/
+  *
+  * Parametric Replacement for PlaneGeometry
+  *
+  *********************************************/
 
 	ParametricGeometries.PlaneGeometry = class PlaneGeometry extends THREE.ParametricGeometry {
 

+ 12 - 12
examples/js/geometries/RoundedBoxGeometry.js

@@ -80,48 +80,48 @@
 				switch ( side ) {
 
 					case 0:
-					// right
-					// generate UVs along Z then Y
+						// right
+						// generate UVs along Z then Y
 						faceDirVector.set( 1, 0, 0 );
 						uvs[ j + 0 ] = getUv( faceDirVector, normal, 'z', 'y', radius, depth );
 						uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'z', radius, height );
 						break;
 
 					case 1:
-					// left
-					// generate UVs along Z then Y
+						// left
+						// generate UVs along Z then Y
 						faceDirVector.set( - 1, 0, 0 );
 						uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'z', 'y', radius, depth );
 						uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'z', radius, height );
 						break;
 
 					case 2:
-					// top
-					// generate UVs along X then Z
+						// top
+						// generate UVs along X then Z
 						faceDirVector.set( 0, 1, 0 );
 						uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'z', radius, width );
 						uvs[ j + 1 ] = getUv( faceDirVector, normal, 'z', 'x', radius, depth );
 						break;
 
 					case 3:
-					// bottom
-					// generate UVs along X then Z
+						// bottom
+						// generate UVs along X then Z
 						faceDirVector.set( 0, - 1, 0 );
 						uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'z', radius, width );
 						uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'z', 'x', radius, depth );
 						break;
 
 					case 4:
-					// front
-					// generate UVs along X then Y
+						// front
+						// generate UVs along X then Y
 						faceDirVector.set( 0, 0, 1 );
 						uvs[ j + 0 ] = 1.0 - getUv( faceDirVector, normal, 'x', 'y', radius, width );
 						uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'x', radius, height );
 						break;
 
 					case 5:
-					// back
-					// generate UVs along X then Y
+						// back
+						// generate UVs along X then Y
 						faceDirVector.set( 0, 0, - 1 );
 						uvs[ j + 0 ] = getUv( faceDirVector, normal, 'x', 'y', radius, width );
 						uvs[ j + 1 ] = 1.0 - getUv( faceDirVector, normal, 'y', 'x', radius, height );

+ 17 - 17
examples/js/geometries/TeapotGeometry.js

@@ -4,23 +4,23 @@
  * Tessellates the famous Utah teapot database by Martin Newell into triangles.
  *
  * Parameters: size = 50, segments = 10, bottom = true, lid = true, body = true,
- *	 fitLid = false, blinn = true
+ *   fitLid = false, blinn = true
  *
  * size is a relative scale: I've scaled the teapot to fit vertically between -1 and 1.
  * Think of it as a "radius".
  * segments - number of line segments to subdivide each patch edge;
- *	 1 is possible but gives degenerates, so two is the real minimum.
+ *   1 is possible but gives degenerates, so two is the real minimum.
  * bottom - boolean, if true (default) then the bottom patches are added. Some consider
- *	 adding the bottom heresy, so set this to "false" to adhere to the One True Way.
+ *   adding the bottom heresy, so set this to "false" to adhere to the One True Way.
  * lid - to remove the lid and look inside, set to true.
  * body - to remove the body and leave the lid, set this and "bottom" to false.
  * fitLid - the lid is a tad small in the original. This stretches it a bit so you can't
- *	 see the teapot's insides through the gap.
+ *   see the teapot's insides through the gap.
  * blinn - Jim Blinn scaled the original data vertically by dividing by about 1.3 to look
- *	 nicer. If you want to see the original teapot, similar to the real-world model, set
- *	 this to false. True by default.
- *	 See http://en.wikipedia.org/wiki/File:Original_Utah_Teapot.jpg for the original
- *	 real-world teapot (from http://en.wikipedia.org/wiki/Utah_teapot).
+ *   nicer. If you want to see the original teapot, similar to the real-world model, set
+ *   this to false. True by default.
+ *   See http://en.wikipedia.org/wiki/File:Original_Utah_Teapot.jpg for the original
+ *   real-world teapot (from http://en.wikipedia.org/wiki/Utah_teapot).
  *
  * Note that the bottom (the last four patches) is not flat - blame Frank Crow, not me.
  *
@@ -28,17 +28,17 @@
  * patches both sides can be seen, e.g., the gap around the lid and inside the spout.
  *
  * Segments 'n' determines the number of triangles output.
- *	 Total triangles = 32*2*n*n - 8*n		[degenerates at the top and bottom cusps are deleted]
+ *   Total triangles = 32*2*n*n - 8*n    [degenerates at the top and bottom cusps are deleted]
  *
- *	 size_factor	 # triangles
- *			 1					56
- *			 2				 240
- *			 3				 552
- *			 4				 992
+ *   size_factor   # triangles
+ *       1          56
+ *       2         240
+ *       3         552
+ *       4         992
  *
- *			10				6320
- *			20			 25440
- *			30			 57360
+ *      10        6320
+ *      20       25440
+ *      30       57360
  *
  * Code converted from my ancient SPD software, http://tog.acm.org/resources/SPD/
  * Created for the Udacity course "Interactive Rendering", http://bit.ly/ericity

+ 1 - 1
examples/js/helpers/RectAreaLightHelper.js

@@ -1,7 +1,7 @@
 ( function () {
 
 	/**
- *	This helper must be added as a child of the light
+ *  This helper must be added as a child of the light
  */
 
 	class RectAreaLightHelper extends THREE.Line {

+ 5 - 5
examples/js/lights/RectAreaLightUniformsLib.js

@@ -4,11 +4,11 @@
  * Uniforms library for RectAreaLight shared webgl shaders
  *
  * NOTE: This is a temporary location for the BRDF approximation texture data
- *			 based off of Eric Heitz's work (see citation below).	BRDF data for
- *			 RectAreaLight is currently approximated using a precomputed texture
- *			 of roughly 80kb in size.	The hope is to find a better way to include
- *			 the large texture data before including the full RectAreaLight implementation
- *			 in the main build files.
+ *       based off of Eric Heitz's work (see citation below).  BRDF data for
+ *       RectAreaLight is currently approximated using a precomputed texture
+ *       of roughly 80kb in size.  The hope is to find a better way to include
+ *       the large texture data before including the full RectAreaLight implementation
+ *       in the main build files.
  *
  * TODO: figure out a way to compress the LTC BRDF data
  */

+ 2 - 2
examples/js/lines/LineGeometry.js

@@ -11,7 +11,7 @@
 
 		setPositions( array ) {
 
-			// converts [ x1, y1, z1,	x2, y2, z2, ... ] to pairs format
+			// converts [ x1, y1, z1,  x2, y2, z2, ... ] to pairs format
 			var length = array.length - 3;
 			var points = new Float32Array( 2 * length );
 
@@ -33,7 +33,7 @@
 
 		setColors( array ) {
 
-			// converts [ r1, g1, b1,	r2, g2, b2, ... ] to pairs format
+			// converts [ r1, g1, b1,  r2, g2, b2, ... ] to pairs format
 			var length = array.length - 3;
 			var colors = new Float32Array( 2 * length );
 

+ 8 - 8
examples/js/lines/LineMaterial.js

@@ -2,14 +2,14 @@
 
 	/**
  * parameters = {
- *	color: <hex>,
- *	linewidth: <float>,
- *	dashed: <boolean>,
- *	dashScale: <float>,
- *	dashSize: <float>,
- *	dashOffset: <float>,
- *	gapSize: <float>,
- *	resolution: <Vector2>, // to be set by renderer
+ *  color: <hex>,
+ *  linewidth: <float>,
+ *  dashed: <boolean>,
+ *  dashScale: <float>,
+ *  dashSize: <float>,
+ *  dashOffset: <float>,
+ *  gapSize: <float>,
+ *  resolution: <Vector2>, // to be set by renderer
  * }
  */
 

+ 15 - 15
examples/js/loaders/3DMLoader.js

@@ -539,7 +539,7 @@
 
 					} else if ( geometry.isLinearLight ) {
 
-						console.warn( 'THREE.3DMLoader:	No conversion exists for linear lights.' );
+						console.warn( 'THREE.3DMLoader:  No conversion exists for linear lights.' );
 						return;
 
 					}
@@ -920,14 +920,14 @@
 			// console.log( `Document Strings Count: ${doc.strings().count()}` );
 
 			/*
-		for( var i = 0; i < doc.strings().count(); i++ ){
-				var _string= doc.strings().get( i );
-				console.log(_string);
-			var string = extractProperties( _group );
-				strings.push( string );
-				_string.delete();
-			}
-		*/
+    for( var i = 0; i < doc.strings().count(); i++ ){
+    		var _string= doc.strings().get( i );
+    		console.log(_string);
+    	var string = extractProperties( _group );
+    		strings.push( string );
+    		_string.delete();
+    	}
+    */
 
 			doc.delete();
 			return {
@@ -1068,7 +1068,7 @@
 					break;
 
 				case rhino.ObjectType.SubD:
-				// TODO: precalculate resulting vertices and faces and warn on excessive results
+					// TODO: precalculate resulting vertices and faces and warn on excessive results
 					_geometry.subdivide( 3 );
 
 					mesh = rhino.Mesh.createFromSubDControlNet( _geometry );
@@ -1083,10 +1083,10 @@
 					break;
 
 					/*
-			case rhino.ObjectType.Annotation:
-			case rhino.ObjectType.Hatch:
-			case rhino.ObjectType.ClipPlane:
-			*/
+      case rhino.ObjectType.Annotation:
+      case rhino.ObjectType.Hatch:
+      case rhino.ObjectType.ClipPlane:
+      */
 
 				default:
 					console.warn( `THREE.3DMLoader: TODO: Implement ${objectType.constructor.name}` );
@@ -1158,7 +1158,7 @@
 					}
 
 				} else { // these are functions that could be called to extract more data.
-				//console.log( `${property}: ${object[ property ].constructor.name}` );
+					//console.log( `${property}: ${object[ property ].constructor.name}` );
 				}
 
 			}

+ 30 - 30
examples/js/loaders/BVHLoader.js

@@ -53,11 +53,11 @@
 		parse( text ) {
 
 			/*
-			reads a string array (lines) from a BVH file
-			and outputs a skeleton structure including motion data
-				returns thee root node:
-			{ name: '', channels: [], children: [] }
-		*/
+    	reads a string array (lines) from a BVH file
+    	and outputs a skeleton structure including motion data
+    		returns thee root node:
+    	{ name: '', channels: [], children: [] }
+    */
 			function readBvh( lines ) {
 
 				// read model structure
@@ -109,14 +109,14 @@
 
 			}
 			/*
-			Recursively reads data from a single frame into the bone hierarchy.
-			The passed bone hierarchy has to be structured in the same order as the BVH file.
-			keyframe data is stored in bone.frames.
-				- data: splitted string array (frame values), values are shift()ed so
-			this should be empty after parsing the whole hierarchy.
-			- frameTime: playback time for this keyframe.
-			- bone: the bone to read frame data from.
-		*/
+    	Recursively reads data from a single frame into the bone hierarchy.
+    	The passed bone hierarchy has to be structured in the same order as the BVH file.
+    	keyframe data is stored in bone.frames.
+    		- data: splitted string array (frame values), values are shift()ed so
+    	this should be empty after parsing the whole hierarchy.
+    	- frameTime: playback time for this keyframe.
+    	- bone: the bone to read frame data from.
+    */
 
 
 			function readFrameData( data, frameTime, bone ) {
@@ -182,12 +182,12 @@
 
 			}
 			/*
-		 Recursively parses the HIERACHY section of the BVH file
-			 - lines: all lines of the file. lines are consumed as we go along.
-		 - firstline: line containing the node type and name e.g. 'JOINT hip'
-		 - list: collects a flat list of nodes
-			 returns: a BVH node including children
-		*/
+     Recursively parses the HIERACHY section of the BVH file
+    	 - lines: all lines of the file. lines are consumed as we go along.
+     - firstline: line containing the node type and name e.g. 'JOINT hip'
+     - list: collects a flat list of nodes
+    	 returns: a BVH node including children
+    */
 
 
 			function readNode( lines, firstline, list ) {
@@ -279,11 +279,11 @@
 
 			}
 			/*
-			recursively converts the internal bvh node structure to a THREE.Bone hierarchy
-				source: the bvh root node
-			list: pass an empty array, collects a flat list of all converted THREE.Bones
-				returns the root THREE.Bone
-		*/
+    	recursively converts the internal bvh node structure to a THREE.Bone hierarchy
+    		source: the bvh root node
+    	list: pass an empty array, collects a flat list of all converted THREE.Bones
+    		returns the root THREE.Bone
+    */
 
 
 			function toTHREEBone( source, list ) {
@@ -307,10 +307,10 @@
 
 			}
 			/*
-			builds a THREE.AnimationClip from the keyframe data saved in each bone.
-				bone: bvh root node
-				returns: a THREE.AnimationClip containing position and quaternion tracks
-		*/
+    	builds a THREE.AnimationClip from the keyframe data saved in each bone.
+    		bone: bvh root node
+    		returns: a THREE.AnimationClip containing position and quaternion tracks
+    */
 
 
 			function toTHREEAnimation( bones ) {
@@ -360,8 +360,8 @@
 
 			}
 			/*
-			returns the next non-empty line in lines
-		*/
+    	returns the next non-empty line in lines
+    */
 
 
 			function nextLine( lines ) {

+ 4 - 4
examples/js/loaders/BasisTextureLoader.js

@@ -111,10 +111,10 @@
 
 		}
 		/**
-	 * @param {ArrayBuffer[]} buffers
-	 * @param {object?} config
-	 * @return {Promise<CompressedTexture>}
-	 */
+   * @param {ArrayBuffer[]} buffers
+   * @param {object?} config
+   * @return {Promise<CompressedTexture>}
+   */
 
 
 		_createTexture( buffers, config = {} ) {

+ 5 - 5
examples/js/loaders/ColladaLoader.js

@@ -235,7 +235,7 @@
 							break;
 
 						case 'animation':
-						// hierarchy of related animations
+							// hierarchy of related animations
 							parseAnimation( child );
 							hasChildren = true;
 							break;
@@ -297,7 +297,7 @@
 
 				if ( memberSyntax ) {
 
-					//	member selection access
+					//  member selection access
 					parts = sid.split( '.' );
 					sid = parts.shift();
 					data.member = parts.shift();
@@ -678,7 +678,7 @@
 					switch ( child.nodeName ) {
 
 						case 'skin':
-						// there is exactly one skin per controller
+							// there is exactly one skin per controller
 							data.id = parseId( child.getAttribute( 'source' ) );
 							data.skin = parseSkin( child );
 							break;
@@ -1250,7 +1250,7 @@
 
 						case 'wrapU':
 						case 'wrapV':
-						// some files have values for wrapU/wrapV which become NaN via parseInt
+							// some files have values for wrapU/wrapV which become NaN via parseInt
 							if ( child.textContent.toUpperCase() === 'TRUE' ) {
 
 								data.technique[ child.nodeName ] = 1;
@@ -1885,7 +1885,7 @@
 							break;
 
 						case 'vertices':
-						// data.sources[ id ] = data.sources[ parseId( getElementsByTagName( child, 'input' )[ 0 ].getAttribute( 'source' ) ) ];
+							// data.sources[ id ] = data.sources[ parseId( getElementsByTagName( child, 'input' )[ 0 ].getAttribute( 'source' ) ) ];
 							data.vertices = parseGeometryVertices( child );
 							break;
 

+ 11 - 11
examples/js/loaders/EXRLoader.js

@@ -12,14 +12,14 @@
 	// All rights reserved.
 	// Redistribution and use in source and binary forms, with or without
 	// modification, are permitted provided that the following conditions are met:
-	//		 * Redistributions of source code must retain the above copyright
-	//			 notice, this list of conditions and the following disclaimer.
-	//		 * Redistributions in binary form must reproduce the above copyright
-	//			 notice, this list of conditions and the following disclaimer in the
-	//			 documentation and/or other materials provided with the distribution.
-	//		 * Neither the name of the Syoyo Fujita nor the
-	//			 names of its contributors may be used to endorse or promote products
-	//			 derived from this software without specific prior written permission.
+	//     * Redistributions of source code must retain the above copyright
+	//       notice, this list of conditions and the following disclaimer.
+	//     * Redistributions in binary form must reproduce the above copyright
+	//       notice, this list of conditions and the following disclaimer in the
+	//       documentation and/or other materials provided with the distribution.
+	//     * Neither the name of the Syoyo Fujita nor the
+	//       names of its contributors may be used to endorse or promote products
+	//       derived from this software without specific prior written permission.
 	// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 	// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 	// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -42,13 +42,13 @@
 	// // Redistribution and use in source and binary forms, with or without
 	// // modification, are permitted provided that the following conditions are
 	// // met:
-	// // *			 Redistributions of source code must retain the above copyright
+	// // *       Redistributions of source code must retain the above copyright
 	// // notice, this list of conditions and the following disclaimer.
-	// // *			 Redistributions in binary form must reproduce the above
+	// // *       Redistributions in binary form must reproduce the above
 	// // copyright notice, this list of conditions and the following disclaimer
 	// // in the documentation and/or other materials provided with the
 	// // distribution.
-	// // *			 Neither the name of Industrial Light & Magic nor the names of
+	// // *       Neither the name of Industrial Light & Magic nor the names of
 	// // its contributors may be used to endorse or promote products derived
 	// // from this software without specific prior written permission.
 	// //

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

@@ -6,7 +6,7 @@
  * Versions lower than this may load but will probably have errors
  *
  * Needs Support:
- *	Morph normals / blend shape normals
+ *  Morph normals / blend shape normals
  *
  * FBX format references:
  * 	https://wiki.blender.org/index.php/User:Mont29/Foundation/FBX_File_Structure
@@ -956,13 +956,13 @@
 				switch ( type ) {
 
 					case 0:
-					// Perspective
+						// Perspective
 						model = new THREE.PerspectiveCamera( fov, aspect, nearClippingPlane, farClippingPlane );
 						if ( focalLength !== null ) model.setFocalLength( focalLength );
 						break;
 
 					case 1:
-					// Orthographic
+						// Orthographic
 						model = new THREE.OrthographicCamera( - width / 2, width / 2, height / 2, - height / 2, nearClippingPlane, farClippingPlane );
 						break;
 
@@ -1052,17 +1052,17 @@
 				switch ( type ) {
 
 					case 0:
-					// Point
+						// Point
 						model = new THREE.PointLight( color, intensity, distance, decay );
 						break;
 
 					case 1:
-					// Directional
+						// Directional
 						model = new THREE.DirectionalLight( color, intensity );
 						break;
 
 					case 2:
-					// Spot
+						// Spot
 						let angle = Math.PI / 3;
 
 						if ( lightAttribute.InnerAngle !== undefined ) {
@@ -1683,8 +1683,8 @@
 				let endOfFace = false; // Face index and vertex index arrays are combined in a single array
 				// A cube with quad faces looks like this:
 				// PolygonVertexIndex: *24 {
-				//	a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5
-				//	}
+				//  a: 0, 1, 3, -3, 2, 3, 5, -5, 4, 5, 7, -7, 6, 7, 1, -1, 1, 7, 5, -4, 6, 0, 2, -5
+				//  }
 				// Negative numbers mark the end of a face - first face here is 0, 1, 3, -3
 				// to find index of last vertex bit shift the index: ^ - 1
 
@@ -1949,7 +1949,7 @@
 
 			} );
 
-		} // a morph geometry node is similar to a standard	node, and the node is also contained
+		} // a morph geometry node is similar to a standard  node, and the node is also contained
 		// in FBXTree.Objects.Geometry, however it can only have attributes for position, normal
 		// and a special attribute Index defining which vertices of the original geometry are affected
 		// Normal and position attributes only have data for the vertices that are affected by the morph
@@ -2667,7 +2667,7 @@
 			} );
 			return values;
 
-		} // Rotations are defined as THREE.Euler angles which can have values	of any size
+		} // Rotations are defined as THREE.Euler angles which can have values  of any size
 		// These will be converted to quaternions which don't support values greater than
 		// PI, so we'll interpolate large rotations
 

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

@@ -166,7 +166,7 @@
 					state = line;
 
 				} else if ( cmd === 'G2' || cmd === 'G3' ) { //G2/G3 - Arc Movement ( G2 clock wise and G3 counter clock wise )
-				//console.warn( 'THREE.GCodeLoader: Arc command not supported' );
+					//console.warn( 'THREE.GCodeLoader: Arc command not supported' );
 				} else if ( cmd === 'G90' ) {
 
 					//G90: Set to Absolute Positioning

+ 84 - 84
examples/js/loaders/GLTFLoader.js

@@ -1350,7 +1350,7 @@
 		const s3 = ppp - pp;
 		const s0 = 1 - s2;
 		const s1 = s3 - pp + p; // Layout of keyframe output values for CUBICSPLINE animations:
-		//	 [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
+		//   [ inTangent_1, splineVertex_1, outTangent_1, inTangent_2, splineVertex_2, ... ]
 
 		for ( let i = 0; i !== stride; i ++ ) {
 
@@ -1824,8 +1824,8 @@
 
 		}
 		/**
-	 * Marks the special nodes/meshes in json for efficient parse.
-	 */
+   * Marks the special nodes/meshes in json for efficient parse.
+   */
 
 
 		_markDefs() {
@@ -1878,14 +1878,14 @@
 
 		}
 		/**
-	 * Counts references to shared node / THREE.Object3D resources. These resources
-	 * can be reused, or "instantiated", at multiple nodes in the scene
-	 * hierarchy. THREE.Mesh, Camera, and Light instances are instantiated and must
-	 * be marked. Non-scenegraph resources (like Materials, Geometries, and
-	 * Textures) can be reused directly and are not marked here.
-	 *
-	 * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
-	 */
+   * Counts references to shared node / THREE.Object3D resources. These resources
+   * can be reused, or "instantiated", at multiple nodes in the scene
+   * hierarchy. THREE.Mesh, Camera, and Light instances are instantiated and must
+   * be marked. Non-scenegraph resources (like Materials, Geometries, and
+   * Textures) can be reused directly and are not marked here.
+   *
+   * Example: CesiumMilkTruck sample model reuses "Wheel" meshes.
+   */
 
 
 		_addNodeRef( cache, index ) {
@@ -1946,11 +1946,11 @@
 
 		}
 		/**
-	 * Requests the specified dependency asynchronously, with caching.
-	 * @param {string} type
-	 * @param {number} index
-	 * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
-	 */
+   * Requests the specified dependency asynchronously, with caching.
+   * @param {string} type
+   * @param {number} index
+   * @return {Promise<Object3D|Material|THREE.Texture|AnimationClip|ArrayBuffer|Object>}
+   */
 
 
 		getDependency( type, index ) {
@@ -2035,10 +2035,10 @@
 
 		}
 		/**
-	 * Requests all dependencies of the specified type asynchronously, with caching.
-	 * @param {string} type
-	 * @return {Promise<Array<Object>>}
-	 */
+   * Requests all dependencies of the specified type asynchronously, with caching.
+   * @param {string} type
+   * @return {Promise<Array<Object>>}
+   */
 
 
 		getDependencies( type ) {
@@ -2062,10 +2062,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
-	 * @param {number} bufferIndex
-	 * @return {Promise<ArrayBuffer>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
+   * @param {number} bufferIndex
+   * @return {Promise<ArrayBuffer>}
+   */
 
 
 		loadBuffer( bufferIndex ) {
@@ -2099,10 +2099,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
-	 * @param {number} bufferViewIndex
-	 * @return {Promise<ArrayBuffer>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#buffers-and-buffer-views
+   * @param {number} bufferViewIndex
+   * @return {Promise<ArrayBuffer>}
+   */
 
 
 		loadBufferView( bufferViewIndex ) {
@@ -2118,10 +2118,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
-	 * @param {number} accessorIndex
-	 * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#accessors
+   * @param {number} accessorIndex
+   * @return {Promise<BufferAttribute|InterleavedBufferAttribute>}
+   */
 
 
 		loadAccessor( accessorIndex ) {
@@ -2242,10 +2242,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
-	 * @param {number} textureIndex
-	 * @return {Promise<THREE.Texture>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#textures
+   * @param {number} textureIndex
+   * @return {Promise<THREE.Texture>}
+   */
 
 
 		loadTexture( textureIndex ) {
@@ -2361,12 +2361,12 @@
 
 		}
 		/**
-	 * Asynchronously assigns a texture to the given material parameters.
-	 * @param {Object} materialParams
-	 * @param {string} mapName
-	 * @param {Object} mapDef
-	 * @return {Promise}
-	 */
+   * Asynchronously assigns a texture to the given material parameters.
+   * @param {Object} materialParams
+   * @param {string} mapName
+   * @param {Object} mapDef
+   * @return {Promise}
+   */
 
 
 		assignTexture( materialParams, mapName, mapDef ) {
@@ -2402,13 +2402,13 @@
 
 		}
 		/**
-	 * Assigns final material to a THREE.Mesh, THREE.Line, or THREE.Points instance. The instance
-	 * already has a material (generated from the glTF material options alone)
-	 * but reuse of the same glTF material may require multiple threejs materials
-	 * to accommodate different primitive types, defines, etc. New materials will
-	 * be created if necessary, and reused from a cache.
-	 * @param	{Object3D} mesh THREE.Mesh, THREE.Line, or THREE.Points instance.
-	 */
+   * Assigns final material to a THREE.Mesh, THREE.Line, or THREE.Points instance. The instance
+   * already has a material (generated from the glTF material options alone)
+   * but reuse of the same glTF material may require multiple threejs materials
+   * to accommodate different primitive types, defines, etc. New materials will
+   * be created if necessary, and reused from a cache.
+   * @param  {Object3D} mesh THREE.Mesh, THREE.Line, or THREE.Points instance.
+   */
 
 
 		assignFinalMaterial( mesh ) {
@@ -2516,10 +2516,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
-	 * @param {number} materialIndex
-	 * @return {Promise<Material>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#materials
+   * @param {number} materialIndex
+   * @return {Promise<Material>}
+   */
 
 
 		loadMaterial( materialIndex ) {
@@ -2702,13 +2702,13 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
-	 *
-	 * Creates BufferGeometries from primitives.
-	 *
-	 * @param {Array<GLTF.Primitive>} primitives
-	 * @return {Promise<Array<BufferGeometry>>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#geometry
+   *
+   * Creates BufferGeometries from primitives.
+   *
+   * @param {Array<GLTF.Primitive>} primitives
+   * @return {Promise<Array<BufferGeometry>>}
+   */
 
 
 		loadGeometries( primitives ) {
@@ -2772,10 +2772,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
-	 * @param {number} meshIndex
-	 * @return {Promise<Group|Mesh|SkinnedMesh>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/blob/master/specification/2.0/README.md#meshes
+   * @param {number} meshIndex
+   * @return {Promise<Group|Mesh|SkinnedMesh>}
+   */
 
 
 		loadMesh( meshIndex ) {
@@ -2888,10 +2888,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
-	 * @param {number} cameraIndex
-	 * @return {Promise<THREE.Camera>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#cameras
+   * @param {number} cameraIndex
+   * @return {Promise<THREE.Camera>}
+   */
 
 
 		loadCamera( cameraIndex ) {
@@ -2923,10 +2923,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
-	 * @param {number} skinIndex
-	 * @return {Promise<Object>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#skins
+   * @param {number} skinIndex
+   * @return {Promise<Object>}
+   */
 
 
 		loadSkin( skinIndex ) {
@@ -2951,10 +2951,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
-	 * @param {number} animationIndex
-	 * @return {Promise<AnimationClip>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#animations
+   * @param {number} animationIndex
+   * @return {Promise<AnimationClip>}
+   */
 
 
 		loadAnimation( animationIndex ) {
@@ -3129,10 +3129,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
-	 * @param {number} nodeIndex
-	 * @return {Promise<Object3D>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#nodes-and-hierarchy
+   * @param {number} nodeIndex
+   * @return {Promise<Object3D>}
+   */
 
 
 		loadNode( nodeIndex ) {
@@ -3261,10 +3261,10 @@
 
 		}
 		/**
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
-	 * @param {number} sceneIndex
-	 * @return {Promise<Group>}
-	 */
+   * Specification: https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#scenes
+   * @param {number} sceneIndex
+   * @return {Promise<Group>}
+   */
 
 
 		loadScene( sceneIndex ) {

+ 7 - 7
examples/js/loaders/KTXLoader.js

@@ -42,11 +42,11 @@
 	class KhronosTextureContainer {
 
 		/**
-	 * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
-	 * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
-	 * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
-	 * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
-	 */
+   * @param {ArrayBuffer} arrayBuffer- contents of the KTX container file
+   * @param {number} facesExpected- should be either 1 or 6, based whether a cube texture or or
+   * @param {boolean} threeDExpected- provision for indicating that data should be a 3D texture, not implemented
+   * @param {boolean} textureArrayExpected- provision for indicating that data should be a texture array, not implemented
+   */
 		constructor( arrayBuffer, facesExpected
 			/*, threeDExpected, textureArrayExpected */
 		) {
@@ -92,7 +92,7 @@
 			this.numberOfMipmapLevels = headerDataView.getUint32( 11 * dataSize, littleEndian ); // number of levels; disregard possibility of 0 for compressed textures
 
 			this.bytesOfKeyValueData = headerDataView.getUint32( 12 * dataSize, littleEndian ); // the amount of space after the header for meta-data
-			// Make sure we have a compressed type.	Not only reduces work, but probably better to let dev know they are not compressing.
+			// Make sure we have a compressed type.  Not only reduces work, but probably better to let dev know they are not compressing.
 
 			if ( this.glType !== 0 ) {
 
@@ -101,7 +101,7 @@
 
 			} else {
 
-				// value of zero is an indication to generate mipmaps @ runtime.	Not usually allowed for compressed, so disregard.
+				// value of zero is an indication to generate mipmaps @ runtime.  Not usually allowed for compressed, so disregard.
 				this.numberOfMipmapLevels = Math.max( 1, this.numberOfMipmapLevels );
 
 			}

+ 12 - 12
examples/js/loaders/LDrawLoader.js

@@ -566,7 +566,7 @@
 
 		parse( text, path, onLoad ) {
 
-			// Async parse.	This function calls onParse with the parsed THREE.Object3D as parameter
+			// Async parse.  This function calls onParse with the parsed THREE.Object3D as parameter
 			this.processObject( text, onLoad, null, path );
 
 		}
@@ -844,7 +844,7 @@
 						break;
 
 					case 'MATERIAL':
-					// Not implemented
+						// Not implemented
 						lineParser.setToEnd();
 						break;
 
@@ -870,7 +870,7 @@
 					break;
 
 				case FINISH_TYPE_PEARLESCENT:
-				// Try to imitate pearlescency by setting the specular to the complementary of the color, and low shininess
+					// Try to imitate pearlescency by setting the specular to the complementary of the color, and low shininess
 					const specular = new THREE.Color( colour );
 					const hsl = specular.getHSL( {
 						h: 0,
@@ -889,7 +889,7 @@
 					break;
 
 				case FINISH_TYPE_CHROME:
-				// Mirror finish surface
+					// Mirror finish surface
 					material = new THREE.MeshStandardMaterial( {
 						color: colour,
 						roughness: 0,
@@ -898,7 +898,7 @@
 					break;
 
 				case FINISH_TYPE_RUBBER:
-				// Rubber finish
+					// Rubber finish
 					material = new THREE.MeshStandardMaterial( {
 						color: colour,
 						roughness: 0.9,
@@ -908,7 +908,7 @@
 					break;
 
 				case FINISH_TYPE_MATTE_METALLIC:
-				// Brushed metal finish
+					// Brushed metal finish
 					material = new THREE.MeshStandardMaterial( {
 						color: colour,
 						roughness: 0.8,
@@ -917,7 +917,7 @@
 					break;
 
 				case FINISH_TYPE_METAL:
-				// Average metal finish
+					// Average metal finish
 					material = new THREE.MeshStandardMaterial( {
 						color: colour,
 						roughness: 0.2,
@@ -926,7 +926,7 @@
 					break;
 
 				default:
-				// Should not happen
+					// Should not happen
 					break;
 
 			}
@@ -1113,7 +1113,7 @@
 
 					// Line type 0: Comment or META
 					case '0':
-					// Parse meta directive
+						// Parse meta directive
 						const meta = lp.getToken();
 
 						if ( meta ) {
@@ -1203,7 +1203,7 @@
 									break;
 
 								case 'BFC':
-								// Changes to the backface culling state
+									// Changes to the backface culling state
 									while ( ! lp.isAtTheEnd() ) {
 
 										const token = lp.getToken();
@@ -1245,7 +1245,7 @@
 									break;
 
 								default:
-								// Other meta directives are not implemented
+									// Other meta directives are not implemented
 									break;
 
 							}
@@ -1771,7 +1771,7 @@
 						break;
 
 					case FILE_LOCATION_NOT_FOUND:
-					// All location possibilities have been tried, give up loading this object
+						// All location possibilities have been tried, give up loading this object
 						console.warn( 'LDrawLoader: Subobject "' + subobject.originalFileName + '" could not be found.' );
 						return;
 

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

@@ -58,8 +58,8 @@
 						break;
 
 					case 'LUT_3D_SIZE':
-					// TODO: A .CUBE LUT file specifies floating point values and could be represented with
-					// more precision than can be captured with Uint8Array.
+						// TODO: A .CUBE LUT file specifies floating point values and could be represented with
+						// more precision than can be captured with Uint8Array.
 						const sizeToken = split[ 1 ];
 						size = parseFloat( sizeToken );
 						data = new Uint8Array( size * size * size * 3 );

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

@@ -2,9 +2,9 @@
 
 	/**
  * Dependencies
- *	- mmd-parser https://github.com/takahirox/mmd-parser
- *	- THREE.TGALoader
- *	- OutlineEffect
+ *  - mmd-parser https://github.com/takahirox/mmd-parser
+ *  - THREE.TGALoader
+ *  - OutlineEffect
  *
  * MMDLoader creates Three.js Objects from MMD resources as
  * PMD, PMX, VMD, and VPD files.
@@ -13,20 +13,20 @@
  * VPD is a posing data format used in MMD(Miku Miku Dance).
  *
  * MMD official site
- *	- https://sites.google.com/view/evpvp/
+ *  - https://sites.google.com/view/evpvp/
  *
  * PMD, VMD format (in Japanese)
- *	- http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4
+ *  - http://blog.goo.ne.jp/torisu_tetosuki/e/209ad341d3ece2b1b4df24abf619d6e4
  *
  * PMX format
- *	- https://gist.github.com/felixjones/f8a06bd48f9da9a4539f
+ *  - https://gist.github.com/felixjones/f8a06bd48f9da9a4539f
  *
  * TODO
- *	- light motion in vmd support.
- *	- SDEF support.
- *	- uv/material/bone morphing support.
- *	- more precise grant skinning support.
- *	- shadow support.
+ *  - light motion in vmd support.
+ *  - SDEF support.
+ *  - uv/material/bone morphing support.
+ *  - more precise grant skinning support.
+ *  - shadow support.
  */
 
 	/**
@@ -46,9 +46,9 @@
 
 		}
 		/**
-	 * @param {string} animationPath
-	 * @return {MMDLoader}
-	 */
+   * @param {string} animationPath
+   * @return {MMDLoader}
+   */
 
 
 		setAnimationPath( animationPath ) {
@@ -59,13 +59,13 @@
 		} // Load MMD assets as Three.js Object
 
 		/**
-	 * Loads Model file (.pmd or .pmx) as a THREE.SkinnedMesh.
-	 *
-	 * @param {string} url - url to Model(.pmd or .pmx) file
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads Model file (.pmd or .pmx) as a THREE.SkinnedMesh.
+   *
+   * @param {string} url - url to Model(.pmd or .pmx) file
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		load( url, onLoad, onProgress, onError ) {
@@ -106,15 +106,15 @@
 
 		}
 		/**
-	 * Loads Motion file(s) (.vmd) as a THREE.AnimationClip.
-	 * If two or more files are specified, they'll be merged.
-	 *
-	 * @param {string|Array<string>} url - url(s) to animation(.vmd) file(s)
-	 * @param {SkinnedMesh|THREE.Camera} object - tracks will be fitting to this object
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads Motion file(s) (.vmd) as a THREE.AnimationClip.
+   * If two or more files are specified, they'll be merged.
+   *
+   * @param {string|Array<string>} url - url(s) to animation(.vmd) file(s)
+   * @param {SkinnedMesh|THREE.Camera} object - tracks will be fitting to this object
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadAnimation( url, object, onLoad, onProgress, onError ) {
@@ -128,16 +128,16 @@
 
 		}
 		/**
-	 * Loads mode file and motion file(s) as an object containing
-	 * a THREE.SkinnedMesh and a THREE.AnimationClip.
-	 * Tracks of THREE.AnimationClip are fitting to the model.
-	 *
-	 * @param {string} modelUrl - url to Model(.pmd or .pmx) file
-	 * @param {string|Array{string}} vmdUrl - url(s) to animation(.vmd) file
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads mode file and motion file(s) as an object containing
+   * a THREE.SkinnedMesh and a THREE.AnimationClip.
+   * Tracks of THREE.AnimationClip are fitting to the model.
+   *
+   * @param {string} modelUrl - url to Model(.pmd or .pmx) file
+   * @param {string|Array{string}} vmdUrl - url(s) to animation(.vmd) file
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadWithAnimation( modelUrl, vmdUrl, onLoad, onProgress, onError ) {
@@ -159,13 +159,13 @@
 		} // Load MMD assets as Object data parsed by MMDParser
 
 		/**
-	 * Loads .pmd file as an Object.
-	 *
-	 * @param {string} url - url to .pmd file
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads .pmd file as an Object.
+   *
+   * @param {string} url - url to .pmd file
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadPMD( url, onLoad, onProgress, onError ) {
@@ -180,13 +180,13 @@
 
 		}
 		/**
-	 * Loads .pmx file as an Object.
-	 *
-	 * @param {string} url - url to .pmx file
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads .pmx file as an Object.
+   *
+   * @param {string} url - url to .pmx file
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadPMX( url, onLoad, onProgress, onError ) {
@@ -201,14 +201,14 @@
 
 		}
 		/**
-	 * Loads .vmd file as an Object. If two or more files are specified
-	 * they'll be merged.
-	 *
-	 * @param {string|Array<string>} url - url(s) to .vmd file(s)
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads .vmd file as an Object. If two or more files are specified
+   * they'll be merged.
+   *
+   * @param {string|Array<string>} url - url(s) to .vmd file(s)
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadVMD( url, onLoad, onProgress, onError ) {
@@ -234,14 +234,14 @@
 
 		}
 		/**
-	 * Loads .vpd file as an Object.
-	 *
-	 * @param {string} url - url to .vpd file
-	 * @param {boolean} isUnicode
-	 * @param {function} onLoad
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 */
+   * Loads .vpd file as an Object.
+   *
+   * @param {string} url - url to .vpd file
+   * @param {boolean} isUnicode
+   * @param {function} onLoad
+   * @param {function} onProgress
+   * @param {function} onError
+   */
 
 
 		loadVPD( url, isUnicode, onLoad, onProgress, onError ) {
@@ -307,9 +307,9 @@
 
 		}
 		/**
-	 * @param {string} crossOrigin
-	 * @return {MeshBuilder}
-	 */
+   * @param {string} crossOrigin
+   * @return {MeshBuilder}
+   */
 
 
 		setCrossOrigin( crossOrigin ) {
@@ -319,12 +319,12 @@
 
 		}
 		/**
-	 * @param {Object} data - parsed PMD/PMX data
-	 * @param {string} resourcePath
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 * @return {SkinnedMesh}
-	 */
+   * @param {Object} data - parsed PMD/PMX data
+   * @param {string} resourcePath
+   * @param {function} onProgress
+   * @param {function} onError
+   * @return {SkinnedMesh}
+   */
 
 
 		build( data, resourcePath, onProgress, onError ) {
@@ -396,9 +396,9 @@
 	class GeometryBuilder {
 
 		/**
-	 * @param {Object} data - parsed PMD/PMX data
-	 * @return {BufferGeometry}
-	 */
+   * @param {Object} data - parsed PMD/PMX data
+   * @return {BufferGeometry}
+   */
 		build( data ) {
 
 			// for geometry
@@ -754,19 +754,19 @@
 						updateAttributes( attribute, morph, 1.0 );
 
 					} else if ( morph.type === 2 ) { // bone
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 3 ) { // uv
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 4 ) { // additional uv1
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 5 ) { // additional uv2
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 6 ) { // additional uv3
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 7 ) { // additional uv4
-					// TODO: implement
+						// TODO: implement
 					} else if ( morph.type === 8 ) { // material
-					// TODO: implement
+						// TODO: implement
 					}
 
 				}
@@ -788,10 +788,10 @@
 
 				}
 				/*
-				 * RigidBody position parameter in PMX seems global position
-				 * while the one in PMD seems offset from corresponding bone.
-				 * So unify being offset.
-				 */
+      	 * RigidBody position parameter in PMX seems global position
+      	 * while the one in PMD seems offset from corresponding bone.
+      	 * So unify being offset.
+      	 */
 
 
 				if ( data.metadata.format === 'pmx' ) {
@@ -892,9 +892,9 @@
 
 		}
 		/**
-	 * @param {string} crossOrigin
-	 * @return {MaterialBuilder}
-	 */
+   * @param {string} crossOrigin
+   * @return {MaterialBuilder}
+   */
 
 
 		setCrossOrigin( crossOrigin ) {
@@ -904,9 +904,9 @@
 
 		}
 		/**
-	 * @param {string} resourcePath
-	 * @return {MaterialBuilder}
-	 */
+   * @param {string} resourcePath
+   * @return {MaterialBuilder}
+   */
 
 
 		setResourcePath( resourcePath ) {
@@ -916,12 +916,12 @@
 
 		}
 		/**
-	 * @param {Object} data - parsed PMD/PMX data
-	 * @param {BufferGeometry} geometry - some properties are dependend on geometry
-	 * @param {function} onProgress
-	 * @param {function} onError
-	 * @return {Array<MeshToonMaterial>}
-	 */
+   * @param {Object} data - parsed PMD/PMX data
+   * @param {BufferGeometry} geometry - some properties are dependend on geometry
+   * @param {function} onProgress
+   * @param {function} onError
+   * @return {Array<MeshToonMaterial>}
+   */
 
 
 		build( data, geometry
@@ -940,16 +940,16 @@
 				};
 				if ( material.name !== undefined ) params.name = material.name;
 				/*
-				 * THREE.Color
-				 *
-				 * MMD				 THREE.MeshToonMaterial
-				 * diffuse	-	color
-				 * ambient	-	emissive * a
-				 *							 (a = 1.0 without map texture or 0.2 with map texture)
-				 *
-				 * THREE.MeshToonMaterial doesn't have ambient. Set it to emissive instead.
-				 * It'll be too bright if material has map texture so using coef 0.2.
-				 */
+      	 * THREE.Color
+      	 *
+      	 * MMD         THREE.MeshToonMaterial
+      	 * diffuse  -  color
+      	 * ambient  -  emissive * a
+      	 *               (a = 1.0 without map texture or 0.2 with map texture)
+      	 *
+      	 * THREE.MeshToonMaterial doesn't have ambient. Set it to emissive instead.
+      	 * It'll be too bright if material has map texture so using coef 0.2.
+      	 */
 
 				params.color = new THREE.Color().fromArray( material.diffuse );
 				params.opacity = material.diffuse[ 3 ];
@@ -1293,12 +1293,12 @@
 
 				}
 				/*
-				 * This method expects
-				 *	 texture.flipY = false
-				 *	 texture.wrapS = THREE.RepeatWrapping
-				 *	 texture.wrapT = THREE.RepeatWrapping
-				 * TODO: more precise
-				 */
+      	 * This method expects
+      	 *   texture.flipY = false
+      	 *   texture.wrapS = THREE.RepeatWrapping
+      	 *   texture.wrapT = THREE.RepeatWrapping
+      	 * TODO: more precise
+      	 */
 
 
 				function getAlphaByUv( image, uv ) {
@@ -1333,10 +1333,10 @@
 	class AnimationBuilder {
 
 		/**
-	 * @param {Object} vmd - parsed VMD data
-	 * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
-	 * @return {AnimationClip}
-	 */
+   * @param {Object} vmd - parsed VMD data
+   * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
+   * @return {AnimationClip}
+   */
 		build( vmd, mesh ) {
 
 			// combine skeletal and morph animations
@@ -1353,10 +1353,10 @@
 
 		}
 		/**
-	 * @param {Object} vmd - parsed VMD data
-	 * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
-	 * @return {AnimationClip}
-	 */
+   * @param {Object} vmd - parsed VMD data
+   * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
+   * @return {AnimationClip}
+   */
 
 
 		buildSkeletalAnimation( vmd, mesh ) {
@@ -1437,10 +1437,10 @@
 
 		}
 		/**
-	 * @param {Object} vmd - parsed VMD data
-	 * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
-	 * @return {AnimationClip}
-	 */
+   * @param {Object} vmd - parsed VMD data
+   * @param {SkinnedMesh} mesh - tracks will be fitting to mesh
+   * @return {AnimationClip}
+   */
 
 
 		buildMorphAnimation( vmd, mesh ) {
@@ -1485,9 +1485,9 @@
 
 		}
 		/**
-	 * @param {Object} vmd - parsed VMD data
-	 * @return {AnimationClip}
-	 */
+   * @param {Object} vmd - parsed VMD data
+   * @return {AnimationClip}
+   */
 
 
 		buildCameraAnimation( vmd ) {
@@ -1594,10 +1594,10 @@
 		_createTrack( node, typedKeyframeTrack, times, values, interpolations ) {
 
 			/*
-			 * optimizes here not to let KeyframeTrackPrototype optimize
-			 * because KeyframeTrackPrototype optimizes times and values but
-			 * doesn't optimize interpolations.
-			 */
+    	 * optimizes here not to let KeyframeTrackPrototype optimize
+    	 * because KeyframeTrackPrototype optimizes times and values but
+    	 * doesn't optimize interpolations.
+    	 */
 			if ( times.length > 2 ) {
 
 				times = times.slice();
@@ -1732,41 +1732,41 @@
 		_calculate( x1, x2, y1, y2, x ) {
 
 			/*
-			 * Cubic Bezier curves
-			 *	 https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves
-			 *
-			 * B(t) = ( 1 - t ) ^ 3 * P0
-			 *			+ 3 * ( 1 - t ) ^ 2 * t * P1
-			 *			+ 3 * ( 1 - t ) * t^2 * P2
-			 *			+ t ^ 3 * P3
-			 *			( 0 <= t <= 1 )
-			 *
-			 * MMD uses Cubic Bezier curves for bone and camera animation interpolation.
-			 *	 http://d.hatena.ne.jp/edvakf/20111016/1318716097
-			 *
-			 *		x = ( 1 - t ) ^ 3 * x0
-			 *			+ 3 * ( 1 - t ) ^ 2 * t * x1
-			 *			+ 3 * ( 1 - t ) * t^2 * x2
-			 *			+ t ^ 3 * x3
-			 *		y = ( 1 - t ) ^ 3 * y0
-			 *			+ 3 * ( 1 - t ) ^ 2 * t * y1
-			 *			+ 3 * ( 1 - t ) * t^2 * y2
-			 *			+ t ^ 3 * y3
-			 *			( x0 = 0, y0 = 0 )
-			 *			( x3 = 1, y3 = 1 )
-			 *			( 0 <= t, x1, x2, y1, y2 <= 1 )
-			 *
-			 * Here solves this equation with Bisection method,
-			 *	 https://en.wikipedia.org/wiki/Bisection_method
-			 * gets t, and then calculate y.
-			 *
-			 * f(t) = 3 * ( 1 - t ) ^ 2 * t * x1
-			 *			+ 3 * ( 1 - t ) * t^2 * x2
-			 *			+ t ^ 3 - x = 0
-			 *
-			 * (Another option: Newton's method
-			 *		https://en.wikipedia.org/wiki/Newton%27s_method)
-			 */
+    	 * Cubic Bezier curves
+    	 *   https://en.wikipedia.org/wiki/B%C3%A9zier_curve#Cubic_B.C3.A9zier_curves
+    	 *
+    	 * B(t) = ( 1 - t ) ^ 3 * P0
+    	 *      + 3 * ( 1 - t ) ^ 2 * t * P1
+    	 *      + 3 * ( 1 - t ) * t^2 * P2
+    	 *      + t ^ 3 * P3
+    	 *      ( 0 <= t <= 1 )
+    	 *
+    	 * MMD uses Cubic Bezier curves for bone and camera animation interpolation.
+    	 *   http://d.hatena.ne.jp/edvakf/20111016/1318716097
+    	 *
+    	 *    x = ( 1 - t ) ^ 3 * x0
+    	 *      + 3 * ( 1 - t ) ^ 2 * t * x1
+    	 *      + 3 * ( 1 - t ) * t^2 * x2
+    	 *      + t ^ 3 * x3
+    	 *    y = ( 1 - t ) ^ 3 * y0
+    	 *      + 3 * ( 1 - t ) ^ 2 * t * y1
+    	 *      + 3 * ( 1 - t ) * t^2 * y2
+    	 *      + t ^ 3 * y3
+    	 *      ( x0 = 0, y0 = 0 )
+    	 *      ( x3 = 1, y3 = 1 )
+    	 *      ( 0 <= t, x1, x2, y1, y2 <= 1 )
+    	 *
+    	 * Here solves this equation with Bisection method,
+    	 *   https://en.wikipedia.org/wiki/Bisection_method
+    	 * gets t, and then calculate y.
+    	 *
+    	 * f(t) = 3 * ( 1 - t ) ^ 2 * t * x1
+    	 *      + 3 * ( 1 - t ) * t^2 * x2
+    	 *      + t ^ 3 - x = 0
+    	 *
+    	 * (Another option: Newton's method
+    	 *    https://en.wikipedia.org/wiki/Newton%27s_method)
+    	 */
 			let c = 0.5;
 			let t = c;
 			let s = 1.0 - t;

+ 41 - 41
examples/js/loaders/MTLLoader.js

@@ -12,18 +12,18 @@
 
 		}
 		/**
-	 * Loads and parses a MTL asset from a URL.
-	 *
-	 * @param {String} url - URL to the MTL file.
-	 * @param {Function} [onLoad] - Callback invoked with the loaded object.
-	 * @param {Function} [onProgress] - Callback for download progress.
-	 * @param {Function} [onError] - Callback for download errors.
-	 *
-	 * @see setPath setResourcePath
-	 *
-	 * @note In order for relative texture references to resolve correctly
-	 * you must call setResourcePath() explicitly prior to load.
-	 */
+   * Loads and parses a MTL asset from a URL.
+   *
+   * @param {String} url - URL to the MTL file.
+   * @param {Function} [onLoad] - Callback invoked with the loaded object.
+   * @param {Function} [onProgress] - Callback for download progress.
+   * @param {Function} [onError] - Callback for download errors.
+   *
+   * @see setPath setResourcePath
+   *
+   * @note In order for relative texture references to resolve correctly
+   * you must call setResourcePath() explicitly prior to load.
+   */
 
 
 		load( url, onLoad, onProgress, onError ) {
@@ -67,16 +67,16 @@
 
 		}
 		/**
-	 * Parses a MTL file.
-	 *
-	 * @param {String} text - Content of MTL file
-	 * @return {MaterialCreator}
-	 *
-	 * @see setPath setResourcePath
-	 *
-	 * @note In order for relative texture references to resolve correctly
-	 * you must call setResourcePath() explicitly prior to parse.
-	 */
+   * Parses a MTL file.
+   *
+   * @param {String} text - Content of MTL file
+   * @return {MaterialCreator}
+   *
+   * @see setPath setResourcePath
+   *
+   * @note In order for relative texture references to resolve correctly
+   * you must call setResourcePath() explicitly prior to parse.
+   */
 
 
 		parse( text, path ) {
@@ -142,14 +142,14 @@
  * Create a new MTLLoader.MaterialCreator
  * @param baseUrl - Url relative to which textures are loaded
  * @param options - Set of options on how to construct the materials
- *									side: Which side to apply the material
- *												THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
- *									wrap: What type of wrapping to apply for textures
- *												THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
- *									normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
- *																Default: false, assumed to be already normalized
- *									ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
- *																	Default: false
+ *                  side: Which side to apply the material
+ *                        THREE.FrontSide (default), THREE.BackSide, THREE.DoubleSide
+ *                  wrap: What type of wrapping to apply for textures
+ *                        THREE.RepeatWrapping (default), THREE.ClampToEdgeWrapping, THREE.MirroredRepeatWrapping
+ *                  normalizeRGB: RGBs need to be normalized to 0-1 from 0-255
+ *                                Default: false, assumed to be already normalized
+ *                  ignoreZeroRGBs: Ignore values of RGBs (Ka,Kd,Ks) that are all 0's
+ *                                  Default: false
  * @constructor
  */
 
@@ -215,7 +215,7 @@
 						case 'kd':
 						case 'ka':
 						case 'ks':
-						// Diffuse color (color under white light) using RGB values
+							// Diffuse color (color under white light) using RGB values
 							if ( this.options && this.options.normalizeRGB ) {
 
 								value = [ value[ 0 ] / 255, value[ 1 ] / 255, value[ 2 ] / 255 ];
@@ -341,32 +341,32 @@
 
 					// Ns is material specular exponent
 					case 'kd':
-					// Diffuse color (color under white light) using RGB values
+						// Diffuse color (color under white light) using RGB values
 						params.color = new THREE.Color().fromArray( value );
 						break;
 
 					case 'ks':
-					// Specular color (color when light is reflected from shiny surface) using RGB values
+						// Specular color (color when light is reflected from shiny surface) using RGB values
 						params.specular = new THREE.Color().fromArray( value );
 						break;
 
 					case 'ke':
-					// Emissive using RGB values
+						// Emissive using RGB values
 						params.emissive = new THREE.Color().fromArray( value );
 						break;
 
 					case 'map_kd':
-					// Diffuse texture map
+						// Diffuse texture map
 						setMapForType( 'map', value );
 						break;
 
 					case 'map_ks':
-					// Specular map
+						// Specular map
 						setMapForType( 'specularMap', value );
 						break;
 
 					case 'map_ke':
-					// Emissive map
+						// Emissive map
 						setMapForType( 'emissiveMap', value );
 						break;
 
@@ -376,19 +376,19 @@
 
 					case 'map_bump':
 					case 'bump':
-					// Bump texture map
+						// Bump texture map
 						setMapForType( 'bumpMap', value );
 						break;
 
 					case 'map_d':
-					// Alpha map
+						// Alpha map
 						setMapForType( 'alphaMap', value );
 						params.transparent = true;
 						break;
 
 					case 'ns':
-					// The specular exponent (defines the focus of the specular highlight)
-					// A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
+						// The specular exponent (defines the focus of the specular highlight)
+						// A high exponent results in a tight, concentrated highlight. Ns values normally range from 0 to 1000.
 						params.shininess = parseFloat( value );
 						break;
 

+ 10 - 10
examples/js/loaders/OBJLoader.js

@@ -582,16 +582,16 @@
 					// Example asset: examples/models/obj/cerberus/Cerberus.obj
 
 					/*
-					 * http://paulbourke.net/dataformats/obj/
-					 * or
-					 * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
-					 *
-					 * From chapter "Grouping" Syntax explanation "s group_number":
-					 * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
-					 * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
-					 * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
-					 * than 0."
-					 */
+        	 * http://paulbourke.net/dataformats/obj/
+        	 * or
+        	 * http://www.cs.utah.edu/~boulos/cs3505/obj_spec.pdf
+        	 *
+        	 * From chapter "Grouping" Syntax explanation "s group_number":
+        	 * "group_number is the smoothing group number. To turn off smoothing groups, use a value of 0 or off.
+        	 * Polygonal elements use group numbers to put elements in different smoothing groups. For free-form
+        	 * surfaces, smoothing groups are either turned on or off; there is no difference between values greater
+        	 * than 0."
+        	 */
 
 					if ( result.length > 1 ) {
 

+ 3 - 3
examples/js/loaders/PDBLoader.js

@@ -77,9 +77,9 @@
 						_bhash[ h ] = _bonds.length - 1;
 
 					} else { // doesn't really work as almost all PDBs
-					// have just normal bonds appearing multiple
-					// times instead of being double/triple bonds
-					// bonds[bhash[h]][2] += 1;
+						// have just normal bonds appearing multiple
+						// times instead of being double/triple bonds
+						// bonds[bhash[h]][2] += 1;
 					}
 
 				}

+ 7 - 7
examples/js/loaders/PVRLoader.js

@@ -2,8 +2,8 @@
 
 	/*
  *	 PVR v2 (legacy) parser
- *	 TODO : Add Support for PVR v3 format
- *	 TODO : implement loadMipmaps option
+ *   TODO : Add Support for PVR v3 format
+ *   TODO : implement loadMipmaps option
  */
 
 	class PVRLoader extends THREE.CompressedTextureLoader {
@@ -59,25 +59,25 @@
 		switch ( pixelFormat ) {
 
 			case 0:
-			// PVRTC 2bpp RGB
+				// PVRTC 2bpp RGB
 				bpp = 2;
 				format = THREE.RGB_PVRTC_2BPPV1_Format;
 				break;
 
 			case 1:
-			// PVRTC 2bpp RGBA
+				// PVRTC 2bpp RGBA
 				bpp = 2;
 				format = THREE.RGBA_PVRTC_2BPPV1_Format;
 				break;
 
 			case 2:
-			// PVRTC 4bpp RGB
+				// PVRTC 4bpp RGB
 				bpp = 4;
 				format = THREE.RGB_PVRTC_4BPPV1_Format;
 				break;
 
 			case 3:
-			// PVRTC 4bpp RGBA
+				// PVRTC 4bpp RGBA
 				bpp = 4;
 				format = THREE.RGBA_PVRTC_4BPPV1_Format;
 				break;
@@ -108,7 +108,7 @@
 			numMipmaps = header[ 3 ],
 			flags = header[ 4 ],
 			// dataLength = header[ 5 ],
-			// bpp =	header[ 6 ],
+			// bpp =  header[ 6 ],
 			// bitmaskRed = header[ 7 ],
 			// bitmaskGreen = header[ 8 ],
 			// bitmaskBlue = header[ 9 ],

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

@@ -19,7 +19,7 @@
 				//RGBE_RETURN_SUCCESS = 0,
 				RGBE_RETURN_FAILURE = - 1,
 
-				/* default error routine.	change this to change error handling */
+				/* default error routine.  change this to change error handling */
 				rgbe_read_error = 1,
 				rgbe_write_error = 2,
 				rgbe_format_error = 3,
@@ -85,11 +85,11 @@
 					if ( - 1 < i ) {
 
 						/*for (i=l-1; i>=0; i--) {
-					byteCode = m.charCodeAt(i);
-					if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++;
-					else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
-					if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
-				}*/
+        	byteCode = m.charCodeAt(i);
+        	if (byteCode > 0x7f && byteCode <= 0x7ff) byteLen++;
+        	else if (byteCode > 0x7ff && byteCode <= 0xffff) byteLen += 2;
+        	if (byteCode >= 0xDC00 && byteCode <= 0xDFFF) i--; //trail surrogate
+        }*/
 						if ( false !== consume ) buffer.pos += len + i + 1;
 						return s + chunk.slice( 0, i );
 
@@ -99,7 +99,7 @@
 
 				},
 
-				/* minimal header reading.	modify if you want to parse more information */
+				/* minimal header reading.  modify if you want to parse more information */
 				RGBE_ReadHeader = function ( buffer ) {
 
 					// regexes to parse header info fields
@@ -221,7 +221,7 @@
 
 					if ( // run length encoding is not allowed so read flat
 						scanline_width < 8 || scanline_width > 0x7fff || // this file is not run length encoded
-			2 !== buffer[ 0 ] || 2 !== buffer[ 1 ] || buffer[ 2 ] & 0x80 ) {
+      2 !== buffer[ 0 ] || 2 !== buffer[ 1 ] || buffer[ 2 ] & 0x80 ) {
 
 						// return the flat buffer
 						return new Uint8Array( buffer );

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

@@ -485,7 +485,7 @@
 
 				break;
 
-			} //else {	log("unknown chunk type", type, len);	}
+			} //else {  log("unknown chunk type", type, len);  }
 
 
 			offset += len;

+ 25 - 25
examples/js/loaders/STLLoader.js

@@ -8,22 +8,22 @@
  * The loader returns a non-indexed buffer geometry.
  *
  * Limitations:
- *	Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
- *	There is perhaps some question as to how valid it is to always assume little-endian-ness.
- *	ASCII decoding assumes file is UTF-8.
+ *  Binary decoding supports "Magics" color format (http://en.wikipedia.org/wiki/STL_(file_format)#Color_in_binary_STL).
+ *  There is perhaps some question as to how valid it is to always assume little-endian-ness.
+ *  ASCII decoding assumes file is UTF-8.
  *
  * Usage:
- *	const loader = new STLLoader();
- *	loader.load( './models/stl/slotted_disk.stl', function ( geometry ) {
- *		scene.add( new THREE.Mesh( geometry ) );
- *	});
+ *  const loader = new STLLoader();
+ *  loader.load( './models/stl/slotted_disk.stl', function ( geometry ) {
+ *    scene.add( new THREE.Mesh( geometry ) );
+ *  });
  *
  * For binary STLs geometry might contain colors for vertices. To use it:
- *	// use the same code to load STL as above
- *	if (geometry.hasColors) {
- *		material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true });
- *	} else { .... }
- *	const mesh = new THREE.Mesh( geometry, material );
+ *  // use the same code to load STL as above
+ *  if (geometry.hasColors) {
+ *    material = new THREE.MeshPhongMaterial({ opacity: geometry.alpha, vertexColors: true });
+ *  } else { .... }
+ *  const mesh = new THREE.Mesh( geometry, material );
  *
  * For ASCII STLs containing multiple solids, each solid is assigned to a different group.
  * Groups can be used to assign a different color by defining an array of materials with the same length of
@@ -33,22 +33,22 @@
  *
  * For example:
  *
- *	const materials = [];
- *	const nGeometryGroups = geometry.groups.length;
+ *  const materials = [];
+ *  const nGeometryGroups = geometry.groups.length;
  *
- *	const colorMap = ...; // Some logic to index colors.
+ *  const colorMap = ...; // Some logic to index colors.
  *
- *	for (let i = 0; i < nGeometryGroups; i++) {
+ *  for (let i = 0; i < nGeometryGroups; i++) {
  *
  *		const material = new THREE.MeshPhongMaterial({
  *			color: colorMap[i],
  *			wireframe: false
  *		});
  *
- *	}
+ *  }
  *
- *	materials.push(material);
- *	const mesh = new THREE.Mesh(geometry, materials);
+ *  materials.push(material);
+ *  const mesh = new THREE.Mesh(geometry, materials);
  */
 
 	class STLLoader extends THREE.Loader {
@@ -108,7 +108,7 @@
 
 				} // An ASCII STL data must begin with 'solid ' as the first six bytes.
 				// However, ASCII STLs lacking the SPACE after the 'd' are known to be
-				// plentiful.	So, check the first 5 bytes for 'solid'.
+				// plentiful.  So, check the first 5 bytes for 'solid'.
 				// Several encodings, such as UTF-8, precede the text with up to 5 bytes:
 				// https://en.wikipedia.org/wiki/Byte_order_mark#Byte_order_marks_by_encoding
 				// Search for "solid" to start anywhere after those prefixes.
@@ -157,11 +157,11 @@
 				for ( let index = 0; index < 80 - 10; index ++ ) {
 
 					if ( reader.getUint32( index, false ) == 0x434F4C4F
-				/*COLO*/
-				&& reader.getUint8( index + 4 ) == 0x52
-				/*'R'*/
-				&& reader.getUint8( index + 5 ) == 0x3D
-				/*'='*/
+        /*COLO*/
+        && reader.getUint8( index + 4 ) == 0x52
+        /*'R'*/
+        && reader.getUint8( index + 5 ) == 0x3D
+        /*'='*/
 					) {
 
 						hasColors = true;

+ 14 - 14
examples/js/loaders/SVGLoader.js

@@ -537,7 +537,7 @@
 						default:
 							console.warn( command );
 
-					} // console.log( type, parseFloats( data ), parseFloats( data ).length	)
+					} // console.log( type, parseFloats( data ), parseFloats( data ).length  )
 
 
 					doSetFirstPoint = false;
@@ -568,13 +568,13 @@
 
 			}
 			/**
-		 * https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
-		 * https://mortoray.com/2017/02/16/rendering-an-svg-elliptical-arc-as-bezier-curves/ Appendix: Endpoint to center arc conversion
-		 * From
-		 * rx ry x-axis-rotation large-arc-flag sweep-flag x y
-		 * To
-		 * aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation
-		 */
+     * https://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes
+     * https://mortoray.com/2017/02/16/rendering-an-svg-elliptical-arc-as-bezier-curves/ Appendix: Endpoint to center arc conversion
+     * From
+     * rx ry x-axis-rotation large-arc-flag sweep-flag x y
+     * To
+     * aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise, aRotation
+     */
 
 
 			function parseArcCommand( path, rx, ry, x_axis_rotation, large_arc_flag, sweep_flag, start, end ) {
@@ -642,9 +642,9 @@
 
 			}
 			/*
-		* According to https://www.w3.org/TR/SVG/shapes.html#RectElementRXAttribute
-		* rounded corner should be rendered to elliptical arc, but bezier curve does the job well enough
-		*/
+    * According to https://www.w3.org/TR/SVG/shapes.html#RectElementRXAttribute
+    * rounded corner should be rendered to elliptical arc, but bezier curve does the job well enough
+    */
 
 
 			function parseRectNode( node ) {
@@ -1168,7 +1168,7 @@
 
 				if ( theUnit === 'px' && scope.defaultUnit !== 'px' ) {
 
-					// Conversion scale from	pixels to inches, then to default units
+					// Conversion scale from  pixels to inches, then to default units
 					scale = unitConversion[ 'in' ][ scope.defaultUnit ] / scope.defaultDPI;
 
 				} else {
@@ -2106,7 +2106,7 @@
 								break;
 
 							case 'round':
-							// Segment triangles
+								// Segment triangles
 								createSegmentTrianglesWithMiddleSection( joinIsOnLeftSide, innerSideModified ); // Join triangles
 
 								if ( joinIsOnLeftSide ) {
@@ -2567,7 +2567,7 @@
 
 					case 'butt':
 					default:
-					// Nothing to do here
+						// Nothing to do here
 						break;
 
 				}

+ 180 - 180
examples/js/loaders/TDSLoader.js

@@ -22,14 +22,14 @@
 
 		}
 		/**
-	 * Load 3ds file from url.
-	 *
-	 * @method load
-	 * @param {[type]} url URL for the file.
-	 * @param {Function} onLoad onLoad callback, receives group Object3D as argument.
-	 * @param {Function} onProgress onProgress callback.
-	 * @param {Function} onError onError callback.
-	 */
+   * Load 3ds file from url.
+   *
+   * @method load
+   * @param {[type]} url URL for the file.
+   * @param {Function} onLoad onLoad callback, receives group Object3D as argument.
+   * @param {Function} onProgress onProgress callback.
+   * @param {Function} onError onError callback.
+   */
 
 
 		load( url, onLoad, onProgress, onError ) {
@@ -67,13 +67,13 @@
 
 		}
 		/**
-	 * Parse arraybuffer data and load 3ds file.
-	 *
-	 * @method parse
-	 * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
-	 * @param {String} path Path for external resources.
-	 * @return {Group} THREE.Group loaded from 3ds file.
-	 */
+   * Parse arraybuffer data and load 3ds file.
+   *
+   * @method parse
+   * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
+   * @param {String} path Path for external resources.
+   * @return {Group} THREE.Group loaded from 3ds file.
+   */
 
 
 		parse( arraybuffer, path ) {
@@ -94,12 +94,12 @@
 
 		}
 		/**
-	 * Decode file content to read 3ds data.
-	 *
-	 * @method readFile
-	 * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
-	 * @param {String} path Path for external resources.
-	 */
+   * Decode file content to read 3ds data.
+   *
+   * @method readFile
+   * @param {ArrayBuffer} arraybuffer Arraybuffer data to be loaded.
+   * @param {String} path Path for external resources.
+   */
 
 
 		readFile( arraybuffer, path ) {
@@ -139,12 +139,12 @@
 
 		}
 		/**
-	 * Read mesh data chunk.
-	 *
-	 * @method readMeshData
-	 * @param {Dataview} data Dataview in use.
-	 * @param {String} path Path for external resources.
-	 */
+   * Read mesh data chunk.
+   *
+   * @method readMeshData
+   * @param {Dataview} data Dataview in use.
+   * @param {String} path Path for external resources.
+   */
 
 
 		readMeshData( data, path ) {
@@ -189,11 +189,11 @@
 
 		}
 		/**
-	 * Read named object chunk.
-	 *
-	 * @method readNamedObject
-	 * @param {Dataview} data Dataview in use.
-	 */
+   * Read named object chunk.
+   *
+   * @method readNamedObject
+   * @param {Dataview} data Dataview in use.
+   */
 
 
 		readNamedObject( data ) {
@@ -226,12 +226,12 @@
 
 		}
 		/**
-	 * Read material data chunk and add it to the material list.
-	 *
-	 * @method readMaterialEntry
-	 * @param {Dataview} data Dataview in use.
-	 * @param {String} path Path for external resources.
-	 */
+   * Read material data chunk and add it to the material list.
+   *
+   * @method readMaterialEntry
+   * @param {Dataview} data Dataview in use.
+   * @param {String} path Path for external resources.
+   */
 
 
 		readMaterialEntry( data, path ) {
@@ -245,84 +245,84 @@
 				if ( next === MAT_NAME ) {
 
 					material.name = this.readString( data, 64 );
-					this.debugMessage( '	 Name: ' + material.name );
+					this.debugMessage( '   Name: ' + material.name );
 
 				} else if ( next === MAT_WIRE ) {
 
-					this.debugMessage( '	 Wireframe' );
+					this.debugMessage( '   Wireframe' );
 					material.wireframe = true;
 
 				} else if ( next === MAT_WIRE_SIZE ) {
 
 					const value = this.readByte( data );
 					material.wireframeLinewidth = value;
-					this.debugMessage( '	 Wireframe Thickness: ' + value );
+					this.debugMessage( '   Wireframe Thickness: ' + value );
 
 				} else if ( next === MAT_TWO_SIDE ) {
 
 					material.side = THREE.DoubleSide;
-					this.debugMessage( '	 DoubleSided' );
+					this.debugMessage( '   DoubleSided' );
 
 				} else if ( next === MAT_ADDITIVE ) {
 
-					this.debugMessage( '	 Additive Blending' );
+					this.debugMessage( '   Additive Blending' );
 					material.blending = THREE.AdditiveBlending;
 
 				} else if ( next === MAT_DIFFUSE ) {
 
-					this.debugMessage( '	 Diffuse THREE.Color' );
+					this.debugMessage( '   Diffuse THREE.Color' );
 					material.color = this.readColor( data );
 
 				} else if ( next === MAT_SPECULAR ) {
 
-					this.debugMessage( '	 Specular THREE.Color' );
+					this.debugMessage( '   Specular THREE.Color' );
 					material.specular = this.readColor( data );
 
 				} else if ( next === MAT_AMBIENT ) {
 
-					this.debugMessage( '	 Ambient color' );
+					this.debugMessage( '   Ambient color' );
 					material.color = this.readColor( data );
 
 				} else if ( next === MAT_SHININESS ) {
 
 					const shininess = this.readPercentage( data );
 					material.shininess = shininess * 100;
-					this.debugMessage( '	 Shininess : ' + shininess );
+					this.debugMessage( '   Shininess : ' + shininess );
 
 				} else if ( next === MAT_TRANSPARENCY ) {
 
 					const transparency = this.readPercentage( data );
 					material.opacity = 1 - transparency;
-					this.debugMessage( '	Transparency : ' + transparency );
+					this.debugMessage( '  Transparency : ' + transparency );
 					material.transparent = material.opacity < 1 ? true : false;
 
 				} else if ( next === MAT_TEXMAP ) {
 
-					this.debugMessage( '	 ColorMap' );
+					this.debugMessage( '   ColorMap' );
 					this.resetPosition( data );
 					material.map = this.readMap( data, path );
 
 				} else if ( next === MAT_BUMPMAP ) {
 
-					this.debugMessage( '	 BumpMap' );
+					this.debugMessage( '   BumpMap' );
 					this.resetPosition( data );
 					material.bumpMap = this.readMap( data, path );
 
 				} else if ( next === MAT_OPACMAP ) {
 
-					this.debugMessage( '	 OpacityMap' );
+					this.debugMessage( '   OpacityMap' );
 					this.resetPosition( data );
 					material.alphaMap = this.readMap( data, path );
 
 				} else if ( next === MAT_SPECMAP ) {
 
-					this.debugMessage( '	 SpecularMap' );
+					this.debugMessage( '   SpecularMap' );
 					this.resetPosition( data );
 					material.specularMap = this.readMap( data, path );
 
 				} else {
 
-					this.debugMessage( '	 Unknown material chunk: ' + next.toString( 16 ) );
+					this.debugMessage( '   Unknown material chunk: ' + next.toString( 16 ) );
 
 				}
 
@@ -335,12 +335,12 @@
 
 		}
 		/**
-	 * Read mesh data chunk.
-	 *
-	 * @method readMesh
-	 * @param {Dataview} data Dataview in use.
-	 * @return {Mesh} The parsed mesh.
-	 */
+   * Read mesh data chunk.
+   *
+   * @method readMesh
+   * @param {Dataview} data Dataview in use.
+   * @return {Mesh} The parsed mesh.
+   */
 
 
 		readMesh( data ) {
@@ -357,7 +357,7 @@
 				if ( next === POINT_ARRAY ) {
 
 					const points = this.readWord( data );
-					this.debugMessage( '	 Vertex: ' + points ); //BufferGeometry
+					this.debugMessage( '   Vertex: ' + points ); //BufferGeometry
 
 					const vertices = [];
 
@@ -379,7 +379,7 @@
 				} else if ( next === TEX_VERTS ) {
 
 					const texels = this.readWord( data );
-					this.debugMessage( '	 UV: ' + texels ); //BufferGeometry
+					this.debugMessage( '   UV: ' + texels ); //BufferGeometry
 
 					const uvs = [];
 
@@ -394,7 +394,7 @@
 
 				} else if ( next === MESH_MATRIX ) {
 
-					this.debugMessage( '	 Tranformation Matrix (TODO)' );
+					this.debugMessage( '   Tranformation Matrix (TODO)' );
 					const values = [];
 
 					for ( let i = 0; i < 12; i ++ ) {
@@ -432,7 +432,7 @@
 
 				} else {
 
-					this.debugMessage( '	 Unknown mesh chunk: ' + next.toString( 16 ) );
+					this.debugMessage( '   Unknown mesh chunk: ' + next.toString( 16 ) );
 
 				}
 
@@ -446,19 +446,19 @@
 
 		}
 		/**
-	 * Read face array data chunk.
-	 *
-	 * @method readFaceArray
-	 * @param {Dataview} data Dataview in use.
-	 * @param {Mesh} mesh THREE.Mesh to be filled with the data read.
-	 */
+   * Read face array data chunk.
+   *
+   * @method readFaceArray
+   * @param {Dataview} data Dataview in use.
+   * @param {Mesh} mesh THREE.Mesh to be filled with the data read.
+   */
 
 
 		readFaceArray( data, mesh ) {
 
 			const chunk = this.readChunk( data );
 			const faces = this.readWord( data );
-			this.debugMessage( '	 Faces: ' + faces );
+			this.debugMessage( '   Faces: ' + faces );
 			const index = [];
 
 			for ( let i = 0; i < faces; ++ i ) {
@@ -479,7 +479,7 @@
 
 				if ( subchunk.id === MSH_MAT_GROUP ) {
 
-					this.debugMessage( '			Material THREE.Group' );
+					this.debugMessage( '      Material THREE.Group' );
 					this.resetPosition( data );
 					const group = this.readMaterialGroup( data );
 					const count = group.index.length * 3; // assuming successive indices
@@ -498,7 +498,7 @@
 
 				} else {
 
-					this.debugMessage( '			Unknown face array chunk: ' + subchunk.toString( 16 ) );
+					this.debugMessage( '      Unknown face array chunk: ' + subchunk.toString( 16 ) );
 
 				}
 
@@ -512,13 +512,13 @@
 
 		}
 		/**
-	 * Read texture map data chunk.
-	 *
-	 * @method readMap
-	 * @param {Dataview} data Dataview in use.
-	 * @param {String} path Path for external resources.
-	 * @return {Texture} Texture read from this data chunk.
-	 */
+   * Read texture map data chunk.
+   *
+   * @method readMap
+   * @param {Dataview} data Dataview in use.
+   * @param {String} path Path for external resources.
+   * @return {Texture} Texture read from this data chunk.
+   */
 
 
 		readMap( data, path ) {
@@ -535,31 +535,31 @@
 
 					const name = this.readString( data, 128 );
 					texture = loader.load( name );
-					this.debugMessage( '			File: ' + path + name );
+					this.debugMessage( '      File: ' + path + name );
 
 				} else if ( next === MAT_MAP_UOFFSET ) {
 
 					texture.offset.x = this.readFloat( data );
-					this.debugMessage( '			OffsetX: ' + texture.offset.x );
+					this.debugMessage( '      OffsetX: ' + texture.offset.x );
 
 				} else if ( next === MAT_MAP_VOFFSET ) {
 
 					texture.offset.y = this.readFloat( data );
-					this.debugMessage( '			OffsetY: ' + texture.offset.y );
+					this.debugMessage( '      OffsetY: ' + texture.offset.y );
 
 				} else if ( next === MAT_MAP_USCALE ) {
 
 					texture.repeat.x = this.readFloat( data );
-					this.debugMessage( '			RepeatX: ' + texture.repeat.x );
+					this.debugMessage( '      RepeatX: ' + texture.repeat.x );
 
 				} else if ( next === MAT_MAP_VSCALE ) {
 
 					texture.repeat.y = this.readFloat( data );
-					this.debugMessage( '			RepeatY: ' + texture.repeat.y );
+					this.debugMessage( '      RepeatY: ' + texture.repeat.y );
 
 				} else {
 
-					this.debugMessage( '			Unknown map chunk: ' + next.toString( 16 ) );
+					this.debugMessage( '      Unknown map chunk: ' + next.toString( 16 ) );
 
 				}
 
@@ -572,12 +572,12 @@
 
 		}
 		/**
-	 * Read material group data chunk.
-	 *
-	 * @method readMaterialGroup
-	 * @param {Dataview} data Dataview in use.
-	 * @return {Object} Object with name and index of the object.
-	 */
+   * Read material group data chunk.
+   *
+   * @method readMaterialGroup
+   * @param {Dataview} data Dataview in use.
+   * @return {Object} Object with name and index of the object.
+   */
 
 
 		readMaterialGroup( data ) {
@@ -585,8 +585,8 @@
 			this.readChunk( data );
 			const name = this.readString( data, 64 );
 			const numFaces = this.readWord( data );
-			this.debugMessage( '				 Name: ' + name );
-			this.debugMessage( '				 Faces: ' + numFaces );
+			this.debugMessage( '         Name: ' + name );
+			this.debugMessage( '         Faces: ' + numFaces );
 			const index = [];
 
 			for ( let i = 0; i < numFaces; ++ i ) {
@@ -602,12 +602,12 @@
 
 		}
 		/**
-	 * Read a color value.
-	 *
-	 * @method readColor
-	 * @param {DataView} data Dataview.
-	 * @return {Color} THREE.Color value read..
-	 */
+   * Read a color value.
+   *
+   * @method readColor
+   * @param {DataView} data Dataview.
+   * @return {Color} THREE.Color value read..
+   */
 
 
 		readColor( data ) {
@@ -621,7 +621,7 @@
 				const g = this.readByte( data );
 				const b = this.readByte( data );
 				color.setRGB( r / 255, g / 255, b / 255 );
-				this.debugMessage( '			THREE.Color: ' + color.r + ', ' + color.g + ', ' + color.b );
+				this.debugMessage( '      THREE.Color: ' + color.r + ', ' + color.g + ', ' + color.b );
 
 			} else if ( chunk.id === COLOR_F || chunk.id === LIN_COLOR_F ) {
 
@@ -629,11 +629,11 @@
 				const g = this.readFloat( data );
 				const b = this.readFloat( data );
 				color.setRGB( r, g, b );
-				this.debugMessage( '			THREE.Color: ' + color.r + ', ' + color.g + ', ' + color.b );
+				this.debugMessage( '      THREE.Color: ' + color.r + ', ' + color.g + ', ' + color.b );
 
 			} else {
 
-				this.debugMessage( '			Unknown color chunk: ' + chunk.toString( 16 ) );
+				this.debugMessage( '      Unknown color chunk: ' + chunk.toString( 16 ) );
 
 			}
 
@@ -642,12 +642,12 @@
 
 		}
 		/**
-	 * Read next chunk of data.
-	 *
-	 * @method readChunk
-	 * @param {DataView} data Dataview.
-	 * @return {Object} Chunk of data read.
-	 */
+   * Read next chunk of data.
+   *
+   * @method readChunk
+   * @param {DataView} data Dataview.
+   * @return {Object} Chunk of data read.
+   */
 
 
 		readChunk( data ) {
@@ -662,11 +662,11 @@
 
 		}
 		/**
-	 * Set position to the end of the current chunk of data.
-	 *
-	 * @method endChunk
-	 * @param {Object} chunk Data chunk.
-	 */
+   * Set position to the end of the current chunk of data.
+   *
+   * @method endChunk
+   * @param {Object} chunk Data chunk.
+   */
 
 
 		endChunk( chunk ) {
@@ -675,12 +675,12 @@
 
 		}
 		/**
-	 * Move to the next data chunk.
-	 *
-	 * @method nextChunk
-	 * @param {DataView} data Dataview.
-	 * @param {Object} chunk Data chunk.
-	 */
+   * Move to the next data chunk.
+   *
+   * @method nextChunk
+   * @param {DataView} data Dataview.
+   * @param {Object} chunk Data chunk.
+   */
 
 
 		nextChunk( data, chunk ) {
@@ -708,10 +708,10 @@
 
 		}
 		/**
-	 * Reset dataview position.
-	 *
-	 * @method resetPosition
-	 */
+   * Reset dataview position.
+   *
+   * @method resetPosition
+   */
 
 
 		resetPosition() {
@@ -720,12 +720,12 @@
 
 		}
 		/**
-	 * Read byte value.
-	 *
-	 * @method readByte
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read byte value.
+   *
+   * @method readByte
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readByte( data ) {
@@ -736,12 +736,12 @@
 
 		}
 		/**
-	 * Read 32 bit float value.
-	 *
-	 * @method readFloat
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read 32 bit float value.
+   *
+   * @method readFloat
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readFloat( data ) {
@@ -760,12 +760,12 @@
 
 		}
 		/**
-	 * Read 32 bit signed integer value.
-	 *
-	 * @method readInt
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read 32 bit signed integer value.
+   *
+   * @method readInt
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readInt( data ) {
@@ -776,12 +776,12 @@
 
 		}
 		/**
-	 * Read 16 bit signed integer value.
-	 *
-	 * @method readShort
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read 16 bit signed integer value.
+   *
+   * @method readShort
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readShort( data ) {
@@ -792,12 +792,12 @@
 
 		}
 		/**
-	 * Read 64 bit unsigned integer value.
-	 *
-	 * @method readDWord
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read 64 bit unsigned integer value.
+   *
+   * @method readDWord
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readDWord( data ) {
@@ -808,12 +808,12 @@
 
 		}
 		/**
-	 * Read 32 bit unsigned integer value.
-	 *
-	 * @method readWord
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read 32 bit unsigned integer value.
+   *
+   * @method readWord
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readWord( data ) {
@@ -824,13 +824,13 @@
 
 		}
 		/**
-	 * Read string value.
-	 *
-	 * @method readString
-	 * @param {DataView} data Dataview to read data from.
-	 * @param {Number} maxLength Max size of the string to be read.
-	 * @return {String} Data read from the dataview.
-	 */
+   * Read string value.
+   *
+   * @method readString
+   * @param {DataView} data Dataview to read data from.
+   * @param {Number} maxLength Max size of the string to be read.
+   * @return {String} Data read from the dataview.
+   */
 
 
 		readString( data, maxLength ) {
@@ -855,12 +855,12 @@
 
 		}
 		/**
-	 * Read percentage value.
-	 *
-	 * @method readPercentage
-	 * @param {DataView} data Dataview to read data from.
-	 * @return {Number} Data read from the dataview.
-	 */
+   * Read percentage value.
+   *
+   * @method readPercentage
+   * @param {DataView} data Dataview to read data from.
+   * @return {Number} Data read from the dataview.
+   */
 
 
 		readPercentage( data ) {
@@ -879,7 +879,7 @@
 					break;
 
 				default:
-					this.debugMessage( '			Unknown percentage chunk: ' + chunk.toString( 16 ) );
+					this.debugMessage( '      Unknown percentage chunk: ' + chunk.toString( 16 ) );
 
 			}
 
@@ -888,13 +888,13 @@
 
 		}
 		/**
-	 * Print debug message to the console.
-	 *
-	 * Is controlled by a flag to show or hide debug messages.
-	 *
-	 * @method debugMessage
-	 * @param {Object} message Debug message to print to the console.
-	 */
+   * Print debug message to the console.
+   *
+   * Is controlled by a flag to show or hide debug messages.
+   *
+   * @method debugMessage
+   * @param {Object} message Debug message to print to the console.
+   */
 
 
 		debugMessage( message ) {

+ 8 - 8
examples/js/loaders/TiltLoader.js

@@ -41,17 +41,17 @@
 
 			const zip = fflate.unzipSync( new Uint8Array( buffer.slice( 16 ) ) );
 			/*
-		const thumbnail = zip[ 'thumbnail.png' ].buffer;
-		const img = document.createElement( 'img' );
-		img.src = URL.createObjectURL( new Blob( [ thumbnail ] ) );
-		document.body.appendChild( img );
-		*/
+    const thumbnail = zip[ 'thumbnail.png' ].buffer;
+    const img = document.createElement( 'img' );
+    img.src = URL.createObjectURL( new Blob( [ thumbnail ] ) );
+    document.body.appendChild( img );
+    */
 
 			const metadata = JSON.parse( fflate.strFromU8( zip[ 'metadata.json' ] ) );
 			/*
-		const blob = new Blob( [ zip[ 'data.sketch' ].buffer ], { type: 'application/octet-stream' } );
-		window.open( URL.createObjectURL( blob ) );
-		*/
+    const blob = new Blob( [ zip[ 'data.sketch' ].buffer ], { type: 'application/octet-stream' } );
+    window.open( URL.createObjectURL( blob ) );
+    */
 
 			const data = new DataView( zip[ 'data.sketch' ].buffer );
 			const num_strokes = data.getInt32( 16, true );

+ 45 - 45
examples/js/loaders/VRMLLoader.js

@@ -651,7 +651,7 @@
 					case 'Fog':
 					case 'NavigationInfo':
 					case 'Viewpoint':
-					// node not supported yet
+						// node not supported yet
 						break;
 
 					default:
@@ -685,15 +685,15 @@
 					switch ( fieldName ) {
 
 						case 'bboxCenter':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'bboxSize':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'center':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'children':
@@ -701,7 +701,7 @@
 							break;
 
 						case 'collide':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'rotation':
@@ -715,7 +715,7 @@
 							break;
 
 						case 'scaleOrientation':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'translation':
@@ -723,7 +723,7 @@
 							break;
 
 						case 'proxy':
-						// field not supported
+							// field not supported
 							break;
 
 						default:
@@ -762,27 +762,27 @@
 							break;
 
 						case 'backUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'bottomUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'frontUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'leftUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'rightUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'topUrl':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'skyAngle':
@@ -1119,7 +1119,7 @@
 					switch ( fieldName ) {
 
 						case 'ambientIntensity':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'diffuseColor':
@@ -1161,7 +1161,7 @@
 				switch ( textureType ) {
 
 					case TEXTURE_TYPE.INTENSITY:
-					// Intensity texture: A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image
+						// Intensity texture: A one-component image specifies one-byte hexadecimal or integer values representing the intensity of the image
 						value = parseInt( hex );
 						color.r = value;
 						color.g = value;
@@ -1169,7 +1169,7 @@
 						break;
 
 					case TEXTURE_TYPE.INTENSITY_ALPHA:
-					// Intensity+Alpha texture: A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte.
+						// Intensity+Alpha texture: A two-component image specifies the intensity in the first (high) byte and the alpha opacity in the second (low) byte.
 						value = parseInt( '0x' + hex.substring( 2, 4 ) );
 						color.r = value;
 						color.g = value;
@@ -1178,14 +1178,14 @@
 						break;
 
 					case TEXTURE_TYPE.RGB:
-					// RGB texture: Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components
+						// RGB texture: Pixels in a three-component image specify the red component in the first (high) byte, followed by the green and blue components
 						color.r = parseInt( '0x' + hex.substring( 2, 4 ) );
 						color.g = parseInt( '0x' + hex.substring( 4, 6 ) );
 						color.b = parseInt( '0x' + hex.substring( 6, 8 ) );
 						break;
 
 					case TEXTURE_TYPE.RGBA:
-					// RGBA texture: Four-component images specify the alpha opacity byte after red/green/blue
+						// RGBA texture: Four-component images specify the alpha opacity byte after red/green/blue
 						color.r = parseInt( '0x' + hex.substring( 2, 4 ) );
 						color.g = parseInt( '0x' + hex.substring( 4, 6 ) );
 						color.b = parseInt( '0x' + hex.substring( 6, 8 ) );
@@ -1521,7 +1521,7 @@
 							break;
 
 						case 'convex':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'coordIndex':
@@ -1907,7 +1907,7 @@
 							break;
 
 						case 'side':
-						// field not supported
+							// field not supported
 							break;
 
 						default:
@@ -1938,7 +1938,7 @@
 					switch ( fieldName ) {
 
 						case 'bottom':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'radius':
@@ -1950,11 +1950,11 @@
 							break;
 
 						case 'side':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'top':
-						// field not supported
+							// field not supported
 							break;
 
 						default:
@@ -2311,7 +2311,7 @@
 							break;
 
 						case 'convex':
-						// field not supported
+							// field not supported
 							break;
 
 						case 'creaseAngle':
@@ -2839,27 +2839,27 @@
 
 			}
 			/**
-		 * Vertically paints the faces interpolating between the
-		 * specified colors at the specified angels. This is used for the Background
-		 * node, but could be applied to other nodes with multiple faces as well.
-		 *
-		 * When used with the Background node, default is directionIsDown is true if
-		 * interpolating the skyColor down from the Zenith. When interpolationg up from
-		 * the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
-		 *
-		 * The first angle is never specified, it is the Zenith (0 rad). Angles are specified
-		 * in radians. The geometry is thought a sphere, but could be anything. The color interpolation
-		 * is linear along the Y axis in any case.
-		 *
-		 * You must specify one more color than you have angles at the beginning of the colors array.
-		 * This is the color of the Zenith (the top of the shape).
-		 *
-		 * @param {BufferGeometry} geometry
-		 * @param {number} radius
-		 * @param {array} angles
-		 * @param {array} colors
-		 * @param {boolean} topDown - Whether to work top down or bottom up.
-		 */
+     * Vertically paints the faces interpolating between the
+     * specified colors at the specified angels. This is used for the Background
+     * node, but could be applied to other nodes with multiple faces as well.
+     *
+     * When used with the Background node, default is directionIsDown is true if
+     * interpolating the skyColor down from the Zenith. When interpolationg up from
+     * the Nadir i.e. interpolating the groundColor, the directionIsDown is false.
+     *
+     * The first angle is never specified, it is the Zenith (0 rad). Angles are specified
+     * in radians. The geometry is thought a sphere, but could be anything. The color interpolation
+     * is linear along the Y axis in any case.
+     *
+     * You must specify one more color than you have angles at the beginning of the colors array.
+     * This is the color of the Zenith (the top of the shape).
+     *
+     * @param {BufferGeometry} geometry
+     * @param {number} radius
+     * @param {array} angles
+     * @param {array} colors
+     * @param {boolean} topDown - Whether to work top down or bottom up.
+     */
 
 
 			function paintFaces( geometry, radius, angles, colors, topDown ) {

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

@@ -781,7 +781,7 @@
 
 						if ( ele.attributes.format === 'binary' && ! compressed ) {
 
-							var content = Base64toByteArray( ele[ '#text' ] ); //	VTP data for the uncompressed case has the following structure:
+							var content = Base64toByteArray( ele[ '#text' ] ); //  VTP data for the uncompressed case has the following structure:
 							// [#bytes][DATA]
 							// where "[#bytes]" is an integer value specifying the number of bytes in the block of data following it.
 

+ 24 - 24
examples/js/loaders/lwo/IFFParser.js

@@ -6,25 +6,25 @@
  * - LWO3 files are in IFF format and can contain the following data types, referred to by shorthand codes
  *
  * ATOMIC DATA TYPES
- *	ID Tag - 4x 7 bit uppercase ASCII chars: ID4
- *	signed integer, 1, 2, or 4 byte length: I1, I2, I4
- *	unsigned integer, 1, 2, or 4 byte length: U1, U2, U4
- *	float, 4 byte length: F4
- *	string, series of ASCII chars followed by null byte (If the length of the string including the null terminating byte is odd, an extra null is added so that the data that follows will begin on an even byte boundary): S0
+ *  ID Tag - 4x 7 bit uppercase ASCII chars: ID4
+ *  signed integer, 1, 2, or 4 byte length: I1, I2, I4
+ *  unsigned integer, 1, 2, or 4 byte length: U1, U2, U4
+ *  float, 4 byte length: F4
+ *  string, series of ASCII chars followed by null byte (If the length of the string including the null terminating byte is odd, an extra null is added so that the data that follows will begin on an even byte boundary): S0
  *
  * COMPOUND DATA TYPES
- *	Variable-length Index (index into an array or collection): U2 or U4 : VX
- *	Color (RGB): F4 + F4 + F4: COL12
- *	Coordinate (x, y, z): F4 + F4 + F4: VEC12
- *	Percentage F4 data type from 0->1 with 1 = 100%: FP4
- *	Angle in radian F4: ANG4
- *	Filename (string) S0: FNAM0
- *	XValue F4 + index (VX) + optional envelope( ENVL ): XVAL
- *	XValue vector VEC12 + index (VX) + optional envelope( ENVL ): XVAL3
+ *  Variable-length Index (index into an array or collection): U2 or U4 : VX
+ *  Color (RGB): F4 + F4 + F4: COL12
+ *  Coordinate (x, y, z): F4 + F4 + F4: VEC12
+ *  Percentage F4 data type from 0->1 with 1 = 100%: FP4
+ *  Angle in radian F4: ANG4
+ *  Filename (string) S0: FNAM0
+ *  XValue F4 + index (VX) + optional envelope( ENVL ): XVAL
+ *  XValue vector VEC12 + index (VX) + optional envelope( ENVL ): XVAL3
  *
- *	The IFF file is arranged in chunks:
- *	CHUNK = ID4 + length (U4) + length X bytes of data + optional 0 pad byte
- *	optional 0 pad byte is there to ensure chunk ends on even boundary, not counted in size
+ *  The IFF file is arranged in chunks:
+ *  CHUNK = ID4 + length (U4) + length X bytes of data + optional 0 pad byte
+ *  optional 0 pad byte is there to ensure chunk ends on even boundary, not counted in size
  *
  * COMPOUND DATA TYPES
  * - Chunks are combined in Forms (collections of chunks)
@@ -174,7 +174,7 @@
 				case 'IIMG': // hold reference to image path
 
 				case 'TXTR':
-				// this.setupForm( type, length );
+					// this.setupForm( type, length );
 					this.debugger.length = 4;
 					this.debugger.skipped = true;
 					break;
@@ -216,7 +216,7 @@
 					break;
 
 				case 'XREF':
-				// clone of another STIL
+					// clone of another STIL
 					this.reader.skip( 8 ); // unknown
 
 					this.currentForm.referenceTexture = {
@@ -237,7 +237,7 @@
 					break;
 
 				case 'VALU':
-				// Not in spec
+					// Not in spec
 					this.parseValueForm( length );
 					break;
 
@@ -248,7 +248,7 @@
 				case 'ATTR': // BSDF Node Attributes
 
 				case 'SATR':
-				// Standard Node Attributes
+					// Standard Node Attributes
 					this.setupForm( 'attributes', length );
 					break;
 
@@ -267,7 +267,7 @@
 					break;
 
 				case 'ENTR':
-				// Not in spec
+					// Not in spec
 					this.parseEntryForm( length );
 					break;
 					// Image Map Layer
@@ -519,7 +519,7 @@
 		// ENVL forms are currently ignored
 		parseEnvelope( length ) {
 
-			this.reader.skip( length - 4 ); // skipping	entirely for now
+			this.reader.skip( length - 4 ); // skipping  entirely for now
 
 		},
 
@@ -669,7 +669,7 @@
 		// VMAP: { type[ID4], dimension[U2], name[S0], ( vert[VX], value[F4] # dimension ) * }
 		// VMAD Associates a set of floating-point vectors with the vertices of specific polygons.
 		// Similar to VMAP UVs, but associates with polygon vertices rather than points
-		// to solve to problem of UV seams:	VMAD chunks are paired with VMAPs of the same name,
+		// to solve to problem of UV seams:  VMAD chunks are paired with VMAPs of the same name,
 		// if they exist. The vector values in the VMAD will then replace those in the
 		// corresponding VMAP, but only for calculations involving the specified polygons.
 		// VMAD { type[ID4], dimension[U2], name[S0], ( vert[VX], poly[VX], value[F4] # dimension ) * }
@@ -1052,7 +1052,7 @@
 			return a.filter( Boolean ); // return array with any empty strings removed
 
 		}
-	}; // ************** DEBUGGER	**************
+	}; // ************** DEBUGGER  **************
 
 	function Debugger() {
 

+ 8 - 8
examples/js/loaders/lwo/LWO2Parser.js

@@ -28,7 +28,7 @@
 			switch ( blockID ) {
 
 				case 'FORM':
-				// form blocks may consist of sub -chunks or sub-forms
+					// form blocks may consist of sub -chunks or sub-forms
 					this.IFF.parseForm( length );
 					break;
 					// SKIPPED CHUNKS
@@ -177,7 +177,7 @@
 				case 'IINY':
 				case 'IINZ':
 				case 'IREF':
-				// possibly a VX for reused texture nodes
+					// possibly a VX for reused texture nodes
 					if ( length === 4 ) this.IFF.currentNode[ blockID ] = this.IFF.reader.getInt32(); else this.IFF.reader.skip( length );
 					break;
 
@@ -222,7 +222,7 @@
 					// Misc CHUNKS
 
 				case 'DESC':
-				// Description Line
+					// Description Line
 					this.IFF.currentForm.description = this.IFF.reader.getString();
 					break;
 
@@ -308,7 +308,7 @@
 					break;
 
 				case 'CHAN':
-				// NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored
+					// NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored
 					if ( length === 4 ) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag(); else this.IFF.reader.skip( length );
 					break;
 					// LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format
@@ -400,23 +400,23 @@
 					break;
 
 				case 'IUVI':
-				// uv channel name
+					// uv channel name
 					this.IFF.currentNode.UVChannel = this.IFF.reader.getString( length );
 					break;
 
 				case 'IUTL':
-				// widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge
+					// widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge
 					this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32();
 					break;
 
 				case 'IVTL':
-				// heightWrappingMode
+					// heightWrappingMode
 					this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32();
 					break;
 					// LWO2 USE
 
 				case 'BLOK':
-				// skip
+					// skip
 					break;
 
 				default:

+ 7 - 7
examples/js/loaders/lwo/LWO3Parser.js

@@ -21,7 +21,7 @@
 			switch ( blockID ) {
 
 				case 'FORM':
-				// form blocks may consist of sub -chunks or sub-forms
+					// form blocks may consist of sub -chunks or sub-forms
 					this.IFF.parseForm( length );
 					break;
 					// SKIPPED CHUNKS
@@ -148,7 +148,7 @@
 				case 'IINY':
 				case 'IINZ':
 				case 'IREF':
-				// possibly a VX for reused texture nodes
+					// possibly a VX for reused texture nodes
 					if ( length === 4 ) this.IFF.currentNode[ blockID ] = this.IFF.reader.getInt32(); else this.IFF.reader.skip( length );
 					break;
 
@@ -186,7 +186,7 @@
 					// Misc CHUNKS
 
 				case 'DESC':
-				// Description Line
+					// Description Line
 					this.IFF.currentForm.description = this.IFF.reader.getString();
 					break;
 
@@ -272,7 +272,7 @@
 					break;
 
 				case 'CHAN':
-				// NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored
+					// NOTE: ENVL Forms may also have CHAN chunk, however ENVL is currently ignored
 					if ( length === 4 ) this.IFF.currentForm.textureChannel = this.IFF.reader.getIDTag(); else this.IFF.reader.skip( length );
 					break;
 					// LWO2 Spec chunks: these are needed since the SURF FORMs are often in LWO2 format
@@ -358,17 +358,17 @@
 					break;
 
 				case 'IUVI':
-				// uv channel name
+					// uv channel name
 					this.IFF.currentNode.UVChannel = this.IFF.reader.getString( length );
 					break;
 
 				case 'IUTL':
-				// widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge
+					// widthWrappingMode: 0 = Reset, 1 = Repeat, 2 = Mirror, 3 = Edge
 					this.IFF.currentNode.widthWrappingMode = this.IFF.reader.getUint32();
 					break;
 
 				case 'IVTL':
-				// heightWrappingMode
+					// heightWrappingMode
 					this.IFF.currentNode.heightWrappingMode = this.IFF.reader.getUint32();
 					break;
 

+ 8 - 8
examples/js/math/ConvexHull.js

@@ -30,10 +30,10 @@
 			// let 'a' and 'b' be 'Face' instances
 			// let 'v' be points wrapped as instance of 'Vertex'
 			//
-			//		 [v, v, ..., v, v, v, ...]
-			//			^						 ^
-			//			|						 |
-			//	a.outside		 b.outside
+			//     [v, v, ..., v, v, v, ...]
+			//      ^             ^
+			//      |             |
+			//  a.outside     b.outside
 			//
 
 			this.assigned = new VertexList();
@@ -127,7 +127,7 @@
 
 		intersectRay( ray, target ) {
 
-			// based on "Fast Ray-Convex Polyhedron Intersection"	by Eric Haines, GRAPHICS GEMS II
+			// based on "Fast Ray-Convex Polyhedron Intersection"  by Eric Haines, GRAPHICS GEMS II
 			const faces = this.faces;
 			let tNear = - Infinity;
 			let tFar = Infinity;
@@ -149,7 +149,7 @@
 
 				if ( vD > 0 ) {
 
-					//	plane faces away from the ray, so this plane is a back-face
+					//  plane faces away from the ray, so this plane is a back-face
 					tFar = Math.min( t, tFar );
 
 				} else {
@@ -699,8 +699,8 @@
 			face.getEdge( - 1 ).setTwin( horizonEdge.twin );
 			return face.getEdge( 0 ); // the half edge whose vertex is the eyeVertex
 
-		} //	Adds 'horizon.length' faces to the hull, each face will be linked with the
-		//	horizon opposite face and the face on the left/right
+		} //  Adds 'horizon.length' faces to the hull, each face will be linked with the
+		//  horizon opposite face and the face on the left/right
 
 
 		addNewFaces( eyeVertex, horizon ) {

+ 16 - 16
examples/js/math/OBB.js

@@ -71,9 +71,9 @@
 
 		}
 		/**
-	* Reference: Closest Point on OBB to Point in Real-Time Collision Detection
-	* by Christer Ericson (chapter 5.1.4)
-	*/
+  * Reference: Closest Point on OBB to Point in Real-Time Collision Detection
+  * by Christer Ericson (chapter 5.1.4)
+  */
 
 
 		clampPoint( point, result ) {
@@ -118,10 +118,10 @@
 
 		}
 		/**
-	* Reference: OBB-OBB Intersection in Real-Time Collision Detection
-	* by Christer Ericson (chapter 4.4.1)
-	*
-	*/
+  * Reference: OBB-OBB Intersection in Real-Time Collision Detection
+  * by Christer Ericson (chapter 4.4.1)
+  *
+  */
 
 
 		intersectsOBB( obb, epsilon = Number.EPSILON ) {
@@ -227,9 +227,9 @@
 
 		}
 		/**
-	* Reference: Testing Box Against Plane in Real-Time Collision Detection
-	* by Christer Ericson (chapter 5.2.3)
-	*/
+  * Reference: Testing Box Against Plane in Real-Time Collision Detection
+  * by Christer Ericson (chapter 5.2.3)
+  */
 
 
 		intersectsPlane( plane ) {
@@ -244,9 +244,9 @@
 
 		}
 		/**
-	* Performs a ray/OBB intersection test and stores the intersection point
-	* to the given 3D vector. If no intersection is detected, *null* is returned.
-	*/
+  * Performs a ray/OBB intersection test and stores the intersection point
+  * to the given 3D vector. If no intersection is detected, *null* is returned.
+  */
 
 
 		intersectRay( ray, result ) {
@@ -275,9 +275,9 @@
 
 		}
 		/**
-	* Performs a ray/OBB intersection test. Returns either true or false if
-	* there is a intersection or not.
-	*/
+  * Performs a ray/OBB intersection test. Returns either true or false if
+  * there is a intersection or not.
+  */
 
 
 		intersectsRay( ray ) {

+ 10 - 10
examples/js/misc/ConvexObjectBreaker.js

@@ -13,13 +13,13 @@
  *
  * Requisites for the object:
  *
- *	- THREE.Mesh object must have a BufferGeometry (not Geometry) and a Material
+ *  - THREE.Mesh object must have a BufferGeometry (not Geometry) and a Material
  *
- *	- Vertex normals must be planar (not smoothed)
+ *  - Vertex normals must be planar (not smoothed)
  *
- *	- The geometry must be convex (this is not checked in the library). You can create convex
- *	geometries with THREE.ConvexGeometry. The BoxGeometry, SphereGeometry and other convex primitives
- *	can also be used.
+ *  - The geometry must be convex (this is not checked in the library). You can create convex
+ *  geometries with THREE.ConvexGeometry. The BoxGeometry, SphereGeometry and other convex primitives
+ *  can also be used.
  *
  * Note: This lib adds member variables to object's userData member (see prepareBreakableObject function)
  * Use with caution and read the code when using with other libs.
@@ -83,11 +83,11 @@
 
 		}
 		/*
-	 * @param {int} maxRadialIterations Iterations for radial cuts.
-	 * @param {int} maxRandomIterations Max random iterations for not-radial cuts
-	 *
-	 * Returns the array of pieces
-	 */
+   * @param {int} maxRadialIterations Iterations for radial cuts.
+   * @param {int} maxRandomIterations Max random iterations for not-radial cuts
+   *
+   * Returns the array of pieces
+   */
 
 
 		subdivideByImpact( object, pointOfImpact, normal, maxRadialIterations, maxRandomIterations ) {

+ 2 - 2
examples/js/misc/GPUComputationRenderer.js

@@ -50,7 +50,7 @@
  * const error = gpuCompute.init();
  * if ( error !== null ) {
  *		console.error( error );
-	* }
+  * }
  *
  *
  * // In each frame...
@@ -95,7 +95,7 @@
  * @param {int} sizeX Computation problem size is always 2d: sizeX * sizeY elements.
  * @param {int} sizeY Computation problem size is always 2d: sizeX * sizeY elements.
  * @param {WebGLRenderer} renderer The renderer
-	*/
+  */
 
 	class GPUComputationRenderer {
 

+ 22 - 22
examples/js/misc/ProgressiveLightMap.js

@@ -68,9 +68,9 @@
 
 		}
 		/**
-	 * Sets these objects' materials' lightmaps and modifies their uv2's.
-	 * @param {Object3D} objects An array of objects and lights to set up your lightmap.
-	 */
+   * Sets these objects' materials' lightmaps and modifies their uv2's.
+   * @param {Object3D} objects An array of objects and lights to set up your lightmap.
+   */
 
 
 		addObjectsToLightMap( objects ) {
@@ -144,11 +144,11 @@
 
 		}
 		/**
-	 * This function renders each mesh one at a time into their respective surface maps
-	 * @param {Camera} camera Standard Rendering Camera
-	 * @param {number} blendWindow When >1, samples will accumulate over time.
-	 * @param {boolean} blurEdges	Whether to fix UV Edges via blurring
-	 */
+   * This function renders each mesh one at a time into their respective surface maps
+   * @param {Camera} camera Standard Rendering Camera
+   * @param {number} blendWindow When >1, samples will accumulate over time.
+   * @param {boolean} blurEdges  Whether to fix UV Edges via blurring
+   */
 
 
 		update( camera, blendWindow = 100, blurEdges = true ) {
@@ -220,10 +220,10 @@
 
 		}
 		/** DEBUG
-	 * Draw the lightmap in the main scene.	Call this after adding the objects to it.
-	 * @param {boolean} visible Whether the debug plane should be visible
-	 * @param {Vector3} position Where the debug plane should be drawn
-	*/
+   * Draw the lightmap in the main scene.  Call this after adding the objects to it.
+   * @param {boolean} visible Whether the debug plane should be visible
+   * @param {Vector3} position Where the debug plane should be drawn
+  */
 
 
 		showDebugLightmap( visible, position = undefined ) {
@@ -264,10 +264,10 @@
 
 		}
 		/**
-	 * INTERNAL Creates the Blurring Plane
-	 * @param {number} res The square resolution of this object's lightMap.
-	 * @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with.
-	 */
+   * INTERNAL Creates the Blurring Plane
+   * @param {number} res The square resolution of this object's lightMap.
+   * @param {WebGLRenderTexture} lightMap The lightmap to initialize the plane with.
+   */
 
 
 		_initializeBlurPlane( res, lightMap = null ) {
@@ -292,12 +292,12 @@
 
 				const bodyStart = shader.fragmentShader.indexOf( 'void main() {' );
 				shader.fragmentShader = '#define USE_UV\n' + shader.fragmentShader.slice( 0, bodyStart ) + '	uniform sampler2D previousShadowMap;\n	uniform float pixelOffset;\n' + shader.fragmentShader.slice( bodyStart - 1, - 1 ) + `	gl_FragColor.rgb = (
-									texture2D(previousShadowMap, vUv + vec2( pixelOffset,	0.0				)).rgb +
-									texture2D(previousShadowMap, vUv + vec2( 0.0				,	pixelOffset)).rgb +
-									texture2D(previousShadowMap, vUv + vec2( 0.0				, -pixelOffset)).rgb +
-									texture2D(previousShadowMap, vUv + vec2(-pixelOffset,	0.0				)).rgb +
-									texture2D(previousShadowMap, vUv + vec2( pixelOffset,	pixelOffset)).rgb +
-									texture2D(previousShadowMap, vUv + vec2(-pixelOffset,	pixelOffset)).rgb +
+									texture2D(previousShadowMap, vUv + vec2( pixelOffset,  0.0        )).rgb +
+									texture2D(previousShadowMap, vUv + vec2( 0.0        ,  pixelOffset)).rgb +
+									texture2D(previousShadowMap, vUv + vec2( 0.0        , -pixelOffset)).rgb +
+									texture2D(previousShadowMap, vUv + vec2(-pixelOffset,  0.0        )).rgb +
+									texture2D(previousShadowMap, vUv + vec2( pixelOffset,  pixelOffset)).rgb +
+									texture2D(previousShadowMap, vUv + vec2(-pixelOffset,  pixelOffset)).rgb +
 									texture2D(previousShadowMap, vUv + vec2( pixelOffset, -pixelOffset)).rgb +
 									texture2D(previousShadowMap, vUv + vec2(-pixelOffset, -pixelOffset)).rgb)/8.0;
 				}`; // Set the LightMap Accumulation Buffer

+ 81 - 81
examples/js/misc/Volume.js

@@ -6,11 +6,11 @@
  * For now it only handles 3 dimensional data.
  * See the webgl_loader_nrrd.html example and the loaderNRRD.js file to see how to use this class.
  * @class
- * @param	 {number}				xLength				 Width of the volume
- * @param	 {number}				yLength				 Length of the volume
- * @param	 {number}				zLength				 Depth of the volume
- * @param	 {string}				type						The type of data (uint8, uint16, ...)
- * @param	 {ArrayBuffer}	 arrayBuffer		 The buffer with volume data
+ * @param   {number}        xLength         Width of the volume
+ * @param   {number}        yLength         Length of the volume
+ * @param   {number}        zLength         Depth of the volume
+ * @param   {string}        type            The type of data (uint8, uint16, ...)
+ * @param   {ArrayBuffer}   arrayBuffer     The buffer with volume data
  */
 
 	var Volume = function ( xLength, yLength, zLength, type, arrayBuffer ) {
@@ -18,22 +18,22 @@
 		if ( arguments.length > 0 ) {
 
 			/**
-		 * @member {number} xLength Width of the volume in the IJK coordinate system
-		 */
+     * @member {number} xLength Width of the volume in the IJK coordinate system
+     */
 			this.xLength = Number( xLength ) || 1;
 			/**
-		 * @member {number} yLength Height of the volume in the IJK coordinate system
-		 */
+     * @member {number} yLength Height of the volume in the IJK coordinate system
+     */
 
 			this.yLength = Number( yLength ) || 1;
 			/**
-		 * @member {number} zLength Depth of the volume in the IJK coordinate system
-		 */
+     * @member {number} zLength Depth of the volume in the IJK coordinate system
+     */
 
 			this.zLength = Number( zLength ) || 1;
 			/**
-		 * @member {TypedArray} data Data of the volume
-		 */
+     * @member {TypedArray} data Data of the volume
+     */
 
 			switch ( type ) {
 
@@ -127,30 +127,30 @@
 
 		}
 		/**
-	 * @member {Array}	spacing Spacing to apply to the volume from IJK to RAS coordinate system
-	 */
+   * @member {Array}  spacing Spacing to apply to the volume from IJK to RAS coordinate system
+   */
 
 
 		this.spacing = [ 1, 1, 1 ];
 		/**
-	 * @member {Array}	offset Offset of the volume in the RAS coordinate system
-	 */
+   * @member {Array}  offset Offset of the volume in the RAS coordinate system
+   */
 
 		this.offset = [ 0, 0, 0 ];
 		/**
-	 * @member {Martrix3} matrix The IJK to RAS matrix
-	 */
+   * @member {Martrix3} matrix The IJK to RAS matrix
+   */
 
 		this.matrix = new THREE.Matrix3();
 		this.matrix.identity();
 		/**
-	 * @member {Martrix3} inverseMatrix The RAS to IJK matrix
-	 */
+   * @member {Martrix3} inverseMatrix The RAS to IJK matrix
+   */
 
 		/**
-	 * @member {number} lowerThreshold The voxels with values under this threshold won't appear in the slices.
-	 *											If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
-	 */
+   * @member {number} lowerThreshold The voxels with values under this threshold won't appear in the slices.
+   *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
+   */
 
 		var lowerThreshold = - Infinity;
 		Object.defineProperty( this, 'lowerThreshold', {
@@ -171,9 +171,9 @@
 			}
 		} );
 		/**
-	 * @member {number} upperThreshold The voxels with values over this threshold won't appear in the slices.
-	 *											If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
-	 */
+   * @member {number} upperThreshold The voxels with values over this threshold won't appear in the slices.
+   *                      If changed, geometryNeedsUpdate is automatically set to true on all the slices associated to this volume
+   */
 
 		var upperThreshold = Infinity;
 		Object.defineProperty( this, 'upperThreshold', {
@@ -194,13 +194,13 @@
 			}
 		} );
 		/**
-	 * @member {Array} sliceList The list of all the slices associated to this volume
-	 */
+   * @member {Array} sliceList The list of all the slices associated to this volume
+   */
 
 		this.sliceList = [];
 		/**
-	 * @member {Array} RASDimensions This array holds the dimensions of the volume in the RAS space
-	 */
+   * @member {Array} RASDimensions This array holds the dimensions of the volume in the RAS space
+   */
 
 	};
 
@@ -208,13 +208,13 @@
 		constructor: Volume,
 
 		/**
-	 * @member {Function} getData Shortcut for data[access(i,j,k)]
-	 * @memberof Volume
-	 * @param {number} i		First coordinate
-	 * @param {number} j		Second coordinate
-	 * @param {number} k		Third coordinate
-	 * @returns {number}	value in the data array
-	 */
+   * @member {Function} getData Shortcut for data[access(i,j,k)]
+   * @memberof Volume
+   * @param {number} i    First coordinate
+   * @param {number} j    Second coordinate
+   * @param {number} k    Third coordinate
+   * @returns {number}  value in the data array
+   */
 		getData: function ( i, j, k ) {
 
 			return this.data[ k * this.xLength * this.yLength + j * this.xLength + i ];
@@ -222,13 +222,13 @@
 		},
 
 		/**
-	 * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system
-	 * @memberof Volume
-	 * @param {number} i		First coordinate
-	 * @param {number} j		Second coordinate
-	 * @param {number} k		Third coordinate
-	 * @returns {number}	index
-	 */
+   * @member {Function} access compute the index in the data array corresponding to the given coordinates in IJK system
+   * @memberof Volume
+   * @param {number} i    First coordinate
+   * @param {number} j    Second coordinate
+   * @param {number} k    Third coordinate
+   * @returns {number}  index
+   */
 		access: function ( i, j, k ) {
 
 			return k * this.xLength * this.yLength + j * this.xLength + i;
@@ -236,11 +236,11 @@
 		},
 
 		/**
-	 * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data
-	 * @memberof Volume
-	 * @param {number} index index of the voxel
-	 * @returns {Array}	[x,y,z]
-	 */
+   * @member {Function} reverseAccess Retrieve the IJK coordinates of the voxel corresponding of the given index in the data
+   * @memberof Volume
+   * @param {number} index index of the voxel
+   * @returns {Array}  [x,y,z]
+   */
 		reverseAccess: function ( index ) {
 
 			var z = Math.floor( index / ( this.yLength * this.xLength ) );
@@ -251,15 +251,15 @@
 		},
 
 		/**
-	 * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced
-	 * @memberof Volume
-	 * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters :
-	 *																 value of the voxel
-	 *																 index of the voxel
-	 *																 the data (TypedArray)
-	 * @param {Object}	 context		You can specify a context in which call the function, default if this Volume
-	 * @returns {Volume}	 this
-	 */
+   * @member {Function} map Apply a function to all the voxels, be careful, the value will be replaced
+   * @memberof Volume
+   * @param {Function} functionToMap A function to apply to every voxel, will be called with the following parameters :
+   *                                 value of the voxel
+   *                                 index of the voxel
+   *                                 the data (TypedArray)
+   * @param {Object}   context    You can specify a context in which call the function, default if this Volume
+   * @returns {Volume}   this
+   */
 		map: function ( functionToMap, context ) {
 
 			var length = this.data.length;
@@ -276,12 +276,12 @@
 		},
 
 		/**
-	 * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.
-	 * @memberof Volume
-	 * @param {string}						axis	the normal axis to the slice 'x' 'y' or 'z'
-	 * @param {number}						index the index of the slice
-	 * @returns {Object} an object containing all the usefull information on the geometry of the slice
-	 */
+   * @member {Function} extractPerpendicularPlane Compute the orientation of the slice and returns all the information relative to the geometry such as sliceAccess, the plane matrix (orientation and position in RAS coordinate) and the dimensions of the plane in both coordinate system.
+   * @memberof Volume
+   * @param {string}            axis  the normal axis to the slice 'x' 'y' or 'z'
+   * @param {number}            index the index of the slice
+   * @returns {Object} an object containing all the usefull information on the geometry of the slice
+   */
 		extractPerpendicularPlane: function ( axis, RASIndex ) {
 
 			var iLength,
@@ -393,13 +393,13 @@
 		},
 
 		/**
-	 * @member {Function} extractSlice Returns a slice corresponding to the given axis and index
-	 *												The coordinate are given in the Right Anterior Superior coordinate format
-	 * @memberof Volume
-	 * @param {string}						axis	the normal axis to the slice 'x' 'y' or 'z'
-	 * @param {number}						index the index of the slice
-	 * @returns {VolumeSlice} the extracted slice
-	 */
+   * @member {Function} extractSlice Returns a slice corresponding to the given axis and index
+   *                        The coordinate are given in the Right Anterior Superior coordinate format
+   * @memberof Volume
+   * @param {string}            axis  the normal axis to the slice 'x' 'y' or 'z'
+   * @param {number}            index the index of the slice
+   * @returns {VolumeSlice} the extracted slice
+   */
 		extractSlice: function ( axis, index ) {
 
 			var slice = new THREE.VolumeSlice( this, index, axis );
@@ -409,11 +409,11 @@
 		},
 
 		/**
-	 * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume
-	 * @see THREE.VolumeSlice.repaint
-	 * @memberof Volume
-	 * @returns {Volume} this
-	 */
+   * @member {Function} repaintAllSlices Call repaint on all the slices extracted from this volume
+   * @see THREE.VolumeSlice.repaint
+   * @memberof Volume
+   * @returns {Volume} this
+   */
 		repaintAllSlices: function () {
 
 			this.sliceList.forEach( function ( slice ) {
@@ -426,10 +426,10 @@
 		},
 
 		/**
-	 * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume
-	 * @memberof Volume
-	 * @returns {Array} [min,max]
-	 */
+   * @member {Function} computeMinMax Compute the minimum and the maximum of the data in the volume
+   * @memberof Volume
+   * @returns {Array} [min,max]
+   */
 		computeMinMax: function () {
 
 			var min = Infinity;

+ 38 - 38
examples/js/misc/VolumeSlice.js

@@ -3,9 +3,9 @@
 	/**
  * This class has been made to hold a slice of a volume data
  * @class
- * @param	 {Volume} volume		The associated volume
- * @param	 {number}			 [index=0] The index of the slice
- * @param	 {string}			 [axis='z']			For now only 'x', 'y' or 'z' but later it will change to a normal vector
+ * @param   {Volume} volume    The associated volume
+ * @param   {number}       [index=0] The index of the slice
+ * @param   {string}       [axis='z']      For now only 'x', 'y' or 'z' but later it will change to a normal vector
  * @see Volume
  */
 
@@ -13,13 +13,13 @@
 
 		var slice = this;
 		/**
-	 * @member {Volume} volume The associated volume
-	 */
+   * @member {Volume} volume The associated volume
+   */
 
 		this.volume = volume;
 		/**
-	 * @member {Number} index The index of the slice, if changed, will automatically call updateGeometry at the next repaint
-	 */
+   * @member {Number} index The index of the slice, if changed, will automatically call updateGeometry at the next repaint
+   */
 
 		index = index || 0;
 		Object.defineProperty( this, 'index', {
@@ -37,26 +37,26 @@
 			}
 		} );
 		/**
-	 * @member {String} axis The normal axis
-	 */
+   * @member {String} axis The normal axis
+   */
 
 		this.axis = axis || 'z';
 		/**
-	 * @member {HTMLCanvasElement} canvas The final canvas used for the texture
-	 */
+   * @member {HTMLCanvasElement} canvas The final canvas used for the texture
+   */
 
 		/**
-	 * @member {CanvasRenderingContext2D} ctx Context of the canvas
-	 */
+   * @member {CanvasRenderingContext2D} ctx Context of the canvas
+   */
 
 		this.canvas = document.createElement( 'canvas' );
 		/**
-	 * @member {HTMLCanvasElement} canvasBuffer The intermediary canvas used to paint the data
-	 */
+   * @member {HTMLCanvasElement} canvasBuffer The intermediary canvas used to paint the data
+   */
 
 		/**
-	 * @member {CanvasRenderingContext2D} ctxBuffer Context of the canvas buffer
-	 */
+   * @member {CanvasRenderingContext2D} ctxBuffer Context of the canvas buffer
+   */
 
 		this.canvasBuffer = document.createElement( 'canvas' );
 		this.updateGeometry();
@@ -69,32 +69,32 @@
 			transparent: true
 		} );
 		/**
-	 * @member {Mesh} mesh The mesh ready to get used in the scene
-	 */
+   * @member {Mesh} mesh The mesh ready to get used in the scene
+   */
 
 		this.mesh = new THREE.Mesh( this.geometry, material );
 		this.mesh.matrixAutoUpdate = false;
 		/**
-	 * @member {Boolean} geometryNeedsUpdate If set to true, updateGeometry will be triggered at the next repaint
-	 */
+   * @member {Boolean} geometryNeedsUpdate If set to true, updateGeometry will be triggered at the next repaint
+   */
 
 		this.geometryNeedsUpdate = true;
 		this.repaint();
 		/**
-	 * @member {Number} iLength Width of slice in the original coordinate system, corresponds to the width of the buffer canvas
-	 */
+   * @member {Number} iLength Width of slice in the original coordinate system, corresponds to the width of the buffer canvas
+   */
 
 		/**
-	 * @member {Number} jLength Height of slice in the original coordinate system, corresponds to the height of the buffer canvas
-	 */
+   * @member {Number} jLength Height of slice in the original coordinate system, corresponds to the height of the buffer canvas
+   */
 
 		/**
-	 * @member {Function} sliceAccess Function that allow the slice to access right data
-	 * @see Volume.extractPerpendicularPlane
-	 * @param {Number} i The first coordinate
-	 * @param {Number} j The second coordinate
-	 * @returns {Number} the index corresponding to the voxel in volume.data of the given position in the slice
-	 */
+   * @member {Function} sliceAccess Function that allow the slice to access right data
+   * @see Volume.extractPerpendicularPlane
+   * @param {Number} i The first coordinate
+   * @param {Number} j The second coordinate
+   * @returns {Number} the index corresponding to the voxel in volume.data of the given position in the slice
+   */
 
 	};
 
@@ -102,9 +102,9 @@
 		constructor: VolumeSlice,
 
 		/**
-	 * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true
-	 * @memberof VolumeSlice
-	 */
+   * @member {Function} repaint Refresh the texture and the geometry if geometryNeedsUpdate is set to true
+   * @memberof VolumeSlice
+   */
 		repaint: function () {
 
 			if ( this.geometryNeedsUpdate ) {
@@ -182,10 +182,10 @@
 		},
 
 		/**
-	 * @member {Function} Refresh the geometry according to axis and index
-	 * @see Volume.extractPerpendicularPlane
-	 * @memberof VolumeSlice
-	 */
+   * @member {Function} Refresh the geometry according to axis and index
+   * @see Volume.extractPerpendicularPlane
+   * @memberof VolumeSlice
+   */
 		updateGeometry: function () {
 
 			var extracted = this.volume.extractPerpendicularPlane( this.axis, this.index );

+ 27 - 27
examples/js/modifiers/CurveModifier.js

@@ -162,9 +162,9 @@ rowOffset += instanceMatrix[3][1] * ${TEXTURE_HEIGHT}.;
 #endif
 
 vec3 spinePos = texture2D(spineTexture, vec2(mt, (0. + rowOffset + 0.5) / textureLayers)).xyz;
-vec3 a =				texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;
-vec3 b =				texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;
-vec3 c =				texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;
+vec3 a =        texture2D(spineTexture, vec2(mt, (1. + rowOffset + 0.5) / textureLayers)).xyz;
+vec3 b =        texture2D(spineTexture, vec2(mt, (2. + rowOffset + 0.5) / textureLayers)).xyz;
+vec3 c =        texture2D(spineTexture, vec2(mt, (3. + rowOffset + 0.5) / textureLayers)).xyz;
 mat3 basis = mat3(a, b, c);
 
 vec3 transformed = basis
@@ -186,9 +186,9 @@ vec3 transformedNormal = normalMatrix * (basis * objectNormal);
 	class Flow {
 
 		/**
-	 * @param {Mesh} mesh The mesh to clone and modify to bend around the curve
-	 * @param {number} numberOfCurves The amount of space that should preallocated for additional curves
-	 */
+   * @param {Mesh} mesh The mesh to clone and modify to bend around the curve
+   * @param {number} numberOfCurves The amount of space that should preallocated for additional curves
+   */
 		constructor( mesh, numberOfCurves = 1 ) {
 
 			const obj3D = mesh.clone();
@@ -238,12 +238,12 @@ vec3 transformedNormal = normalMatrix * (basis * objectNormal);
 	class InstancedFlow extends Flow {
 
 		/**
-	 *
-	 * @param {number} count The number of instanced elements
-	 * @param {number} curveCount The number of curves to preallocate for
-	 * @param {Geometry} geometry The geometry to use for the instanced mesh
-	 * @param {Material} material The material to use for the instanced mesh
-	 */
+   *
+   * @param {number} count The number of instanced elements
+   * @param {number} curveCount The number of curves to preallocate for
+   * @param {Geometry} geometry The geometry to use for the instanced mesh
+   * @param {Material} material The material to use for the instanced mesh
+   */
 		constructor( count, curveCount, geometry, material ) {
 
 			const mesh = new THREE.InstancedMesh( geometry, material, count );
@@ -254,11 +254,11 @@ vec3 transformedNormal = normalMatrix * (basis * objectNormal);
 
 		}
 		/**
-	 * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects
-	 * This writes that information to the matrix and marks it as needing update.
-	 *
-	 * @param {number} index of the instanced element to update
-	 */
+   * The extra information about which curve and curve position is stored in the translation components of the matrix for the instanced objects
+   * This writes that information to the matrix and marks it as needing update.
+   *
+   * @param {number} index of the instanced element to update
+   */
 
 
 		writeChanges( index ) {
@@ -269,11 +269,11 @@ vec3 transformedNormal = normalMatrix * (basis * objectNormal);
 
 		}
 		/**
-	 * Move an individual element along the curve by a specific amount
-	 *
-	 * @param {number} index Which element to update
-	 * @param {number} offset Move by how much
-	 */
+   * Move an individual element along the curve by a specific amount
+   *
+   * @param {number} index Which element to update
+   * @param {number} offset Move by how much
+   */
 
 
 		moveIndividualAlongCurve( index, offset ) {
@@ -283,11 +283,11 @@ vec3 transformedNormal = normalMatrix * (basis * objectNormal);
 
 		}
 		/**
-	 * Select which curve to use for an element
-	 *
-	 * @param {number} index the index of the instanced element to update
-	 * @param {number} curveNo the index of the curve it should use
-	 */
+   * Select which curve to use for an element
+   *
+   * @param {number} index the index of the instanced element to update
+   * @param {number} curveNo the index of the curve it should use
+   */
 
 
 		setCurve( index, curveNo ) {

+ 5 - 5
examples/js/modifiers/SimplifyModifier.js

@@ -2,10 +2,10 @@
 
 	/**
  *	Simplification Geometry Modifier
- *		- based on code and technique
- *		- by Stan Melax in 1998
- *		- Progressive Mesh type Polygon Reduction Algorithm
- *		- http://www.melax.com/polychop/
+ *    - based on code and technique
+ *	  - by Stan Melax in 1998
+ *	  - Progressive Mesh type Polygon Reduction Algorithm
+ *    - http://www.melax.com/polychop/
  */
 
 	const _cb = new THREE.Vector3(),
@@ -217,7 +217,7 @@
 	function computeEdgeCostAtVertex( v ) {
 
 		// compute the edge collapse cost for all edges that start
-		// from vertex v.	Since we are only interested in reducing
+		// from vertex v.  Since we are only interested in reducing
 		// the object by selecting the min cost edge at each step, we
 		// only cache the cost of the least cost edge at this vertex
 		// (in member variable collapse) as well as the value of the

+ 123 - 6
examples/js/objects/Lensflare.js

@@ -36,8 +36,33 @@
 						value: null
 					}
 				},
-				vertexShader: [ 'precision highp float;', 'uniform vec3 screenPosition;', 'uniform vec2 scale;', 'attribute vec3 position;', 'void main() {', '	gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );', '}' ].join( '\n' ),
-				fragmentShader: [ 'precision highp float;', 'void main() {', '	gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );', '}' ].join( '\n' ),
+				vertexShader:
+      /* glsl */
+      `
+
+				precision highp float;
+
+				uniform vec3 screenPosition;
+				uniform vec2 scale;
+
+				attribute vec3 position;
+
+				void main() {
+
+					gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
+
+				}`,
+				fragmentShader:
+      /* glsl */
+      `
+
+				precision highp float;
+
+				void main() {
+
+					gl_FragColor = vec4( 1.0, 0.0, 1.0, 1.0 );
+
+				}`,
 				depthTest: true,
 				depthWrite: false,
 				transparent: false
@@ -54,8 +79,42 @@
 						value: null
 					}
 				},
-				vertexShader: [ 'precision highp float;', 'uniform vec3 screenPosition;', 'uniform vec2 scale;', 'attribute vec3 position;', 'attribute vec2 uv;', 'varying vec2 vUV;', 'void main() {', '	vUV = uv;', '	gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );', '}' ].join( '\n' ),
-				fragmentShader: [ 'precision highp float;', 'uniform sampler2D map;', 'varying vec2 vUV;', 'void main() {', '	gl_FragColor = texture2D( map, vUV );', '}' ].join( '\n' ),
+				vertexShader:
+      /* glsl */
+      `
+
+				precision highp float;
+
+				uniform vec3 screenPosition;
+				uniform vec2 scale;
+
+				attribute vec3 position;
+				attribute vec2 uv;
+
+				varying vec2 vUV;
+
+				void main() {
+
+					vUV = uv;
+
+					gl_Position = vec4( position.xy * scale + screenPosition.xy, screenPosition.z, 1.0 );
+
+				}`,
+				fragmentShader:
+      /* glsl */
+      `
+
+				precision highp float;
+
+				uniform sampler2D map;
+
+				varying vec2 vUV;
+
+				void main() {
+
+					gl_FragColor = texture2D( map, vUV );
+
+				}`,
 				depthTest: false,
 				depthWrite: false,
 				transparent: false
@@ -216,8 +275,66 @@
 				value: null
 			}
 		},
-		vertexShader: [ 'precision highp float;', 'uniform vec3 screenPosition;', 'uniform vec2 scale;', 'uniform sampler2D occlusionMap;', 'attribute vec3 position;', 'attribute vec2 uv;', 'varying vec2 vUV;', 'varying float vVisibility;', 'void main() {', '	vUV = uv;', '	vec2 pos = position.xy;', '	vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );', '	visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );', '	vVisibility =				visibility.r / 9.0;', '	vVisibility *= 1.0 - visibility.g / 9.0;', '	vVisibility *=			 visibility.b / 9.0;', '	gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );', '}' ].join( '\n' ),
-		fragmentShader: [ 'precision highp float;', 'uniform sampler2D map;', 'uniform vec3 color;', 'varying vec2 vUV;', 'varying float vVisibility;', 'void main() {', '	vec4 texture = texture2D( map, vUV );', '	texture.a *= vVisibility;', '	gl_FragColor = texture;', '	gl_FragColor.rgb *= color;', '}' ].join( '\n' )
+		vertexShader:
+  /* glsl */
+  `
+
+		precision highp float;
+
+		uniform vec3 screenPosition;
+		uniform vec2 scale;
+
+		uniform sampler2D occlusionMap;
+
+		attribute vec3 position;
+		attribute vec2 uv;
+
+		varying vec2 vUV;
+		varying float vVisibility;
+
+		void main() {
+
+			vUV = uv;
+
+			vec2 pos = position.xy;
+
+			vec4 visibility = texture2D( occlusionMap, vec2( 0.1, 0.1 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.5, 0.1 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.9, 0.1 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.9, 0.5 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.9, 0.9 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.5, 0.9 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.1, 0.9 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.1, 0.5 ) );
+			visibility += texture2D( occlusionMap, vec2( 0.5, 0.5 ) );
+
+			vVisibility =        visibility.r / 9.0;
+			vVisibility *= 1.0 - visibility.g / 9.0;
+			vVisibility *=       visibility.b / 9.0;
+
+			gl_Position = vec4( ( pos * scale + screenPosition.xy ).xy, screenPosition.z, 1.0 );
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
+
+		precision highp float;
+
+		uniform sampler2D map;
+		uniform vec3 color;
+
+		varying vec2 vUV;
+		varying float vVisibility;
+
+		void main() {
+
+			vec4 texture = texture2D( map, vUV );
+			texture.a *= vVisibility;
+			gl_FragColor = texture;
+			gl_FragColor.rgb *= color;
+
+		}`
 	};
 
 	Lensflare.Geometry = function () {

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

@@ -152,8 +152,44 @@
 				value: null
 			}
 		},
-		vertexShader: [ 'uniform mat4 textureMatrix;', 'varying vec4 vUv;', 'void main() {', '	vUv = textureMatrix * vec4( position, 1.0 );', '	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}' ].join( '\n' ),
-		fragmentShader: [ 'uniform vec3 color;', 'uniform sampler2D tDiffuse;', 'varying vec4 vUv;', 'float blendOverlay( float base, float blend ) {', '	return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );', '}', 'vec3 blendOverlay( vec3 base, vec3 blend ) {', '	return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );', '}', 'void main() {', '	vec4 base = texture2DProj( tDiffuse, vUv );', '	gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );', '}' ].join( '\n' )
+		vertexShader:
+  /* glsl */
+  `
+		uniform mat4 textureMatrix;
+		varying vec4 vUv;
+
+		void main() {
+
+			vUv = textureMatrix * vec4( position, 1.0 );
+
+			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
+		uniform vec3 color;
+		uniform sampler2D tDiffuse;
+		varying vec4 vUv;
+
+		float blendOverlay( float base, float blend ) {
+
+			return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
+
+		}
+
+		vec3 blendOverlay( vec3 base, vec3 blend ) {
+
+			return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
+
+		}
+
+		void main() {
+
+			vec4 base = texture2DProj( tDiffuse, vUv );
+			gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
+
+		}`
 	};
 
 	THREE.Reflector = Reflector;

+ 16 - 2
examples/js/objects/ReflectorForSSRPass.js

@@ -250,8 +250,22 @@
 				value: new THREE.Vector2()
 			}
 		},
-		vertexShader: [ 'uniform mat4 textureMatrix;', 'varying vec4 vUv;', 'void main() {', '	vUv = textureMatrix * vec4( position, 1.0 );', '	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}' ].join( '\n' ),
-		fragmentShader: `
+		vertexShader:
+  /* glsl */
+  `
+		uniform mat4 textureMatrix;
+		varying vec4 vUv;
+
+		void main() {
+
+			vUv = textureMatrix * vec4( position, 1.0 );
+
+			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
 		uniform vec3 color;
 		uniform sampler2D tDiffuse;
 		uniform sampler2D tDepth;

+ 41 - 2
examples/js/objects/Refractor.js

@@ -206,8 +206,47 @@
 				value: null
 			}
 		},
-		vertexShader: [ 'uniform mat4 textureMatrix;', 'varying vec4 vUv;', 'void main() {', '	vUv = textureMatrix * vec4( position, 1.0 );', '	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '}' ].join( '\n' ),
-		fragmentShader: [ 'uniform vec3 color;', 'uniform sampler2D tDiffuse;', 'varying vec4 vUv;', 'float blendOverlay( float base, float blend ) {', '	return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );', '}', 'vec3 blendOverlay( vec3 base, vec3 blend ) {', '	return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );', '}', 'void main() {', '	vec4 base = texture2DProj( tDiffuse, vUv );', '	gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );', '}' ].join( '\n' )
+		vertexShader:
+  /* glsl */
+  `
+
+		uniform mat4 textureMatrix;
+
+		varying vec4 vUv;
+
+		void main() {
+
+			vUv = textureMatrix * vec4( position, 1.0 );
+			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
+
+		uniform vec3 color;
+		uniform sampler2D tDiffuse;
+
+		varying vec4 vUv;
+
+		float blendOverlay( float base, float blend ) {
+
+			return( base < 0.5 ? ( 2.0 * base * blend ) : ( 1.0 - 2.0 * ( 1.0 - base ) * ( 1.0 - blend ) ) );
+
+		}
+
+		vec3 blendOverlay( vec3 base, vec3 blend ) {
+
+			return vec3( blendOverlay( base.r, blend.r ), blendOverlay( base.g, blend.g ), blendOverlay( base.b, blend.b ) );
+
+		}
+
+		void main() {
+
+			vec4 base = texture2DProj( tDiffuse, vUv );
+			gl_FragColor = vec4( blendOverlay( base.rgb, color ), 1.0 );
+
+		}`
 	};
 
 	THREE.Refractor = Refractor;

+ 159 - 26
examples/js/objects/Sky.js

@@ -55,34 +55,167 @@
 				value: new THREE.Vector3( 0, 1, 0 )
 			}
 		},
-		vertexShader: [ 'uniform vec3 sunPosition;', 'uniform float rayleigh;', 'uniform float turbidity;', 'uniform float mieCoefficient;', 'uniform vec3 up;', 'varying vec3 vWorldPosition;', 'varying vec3 vSunDirection;', 'varying float vSunfade;', 'varying vec3 vBetaR;', 'varying vec3 vBetaM;', 'varying float vSunE;', // constants for atmospheric scattering
-			'const float e = 2.71828182845904523536028747135266249775724709369995957;', 'const float pi = 3.141592653589793238462643383279502884197169;', // wavelength of used primaries, according to preetham
-			'const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );', // this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
-			// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
-			'const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );', // mie stuff
-			// K coefficient for the primaries
-			'const float v = 4.0;', 'const vec3 K = vec3( 0.686, 0.678, 0.666 );', // MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
-			'const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );', // earth shadow hack
-			// cutoffAngle = pi / 1.95;
-			'const float cutoffAngle = 1.6110731556870734;', 'const float steepness = 1.5;', 'const float EE = 1000.0;', 'float sunIntensity( float zenithAngleCos ) {', '	zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );', '	return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );', '}', 'vec3 totalMie( float T ) {', '	float c = ( 0.2 * T ) * 10E-18;', '	return 0.434 * c * MieConst;', '}', 'void main() {', '	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', '	vWorldPosition = worldPosition.xyz;', '	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );', '	gl_Position.z = gl_Position.w;', // set z to camera.far
-			'	vSunDirection = normalize( sunPosition );', '	vSunE = sunIntensity( dot( vSunDirection, up ) );', '	vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );', '	float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );', // extinction (absorbtion + out scattering)
+		vertexShader:
+  /* glsl */
+  `
+		uniform vec3 sunPosition;
+		uniform float rayleigh;
+		uniform float turbidity;
+		uniform float mieCoefficient;
+		uniform vec3 up;
+
+		varying vec3 vWorldPosition;
+		varying vec3 vSunDirection;
+		varying float vSunfade;
+		varying vec3 vBetaR;
+		varying vec3 vBetaM;
+		varying float vSunE;
+
+		// constants for atmospheric scattering
+		const float e = 2.71828182845904523536028747135266249775724709369995957;
+		const float pi = 3.141592653589793238462643383279502884197169;
+
+		// wavelength of used primaries, according to preetham
+		const vec3 lambda = vec3( 680E-9, 550E-9, 450E-9 );
+		// this pre-calcuation replaces older TotalRayleigh(vec3 lambda) function:
+		// (8.0 * pow(pi, 3.0) * pow(pow(n, 2.0) - 1.0, 2.0) * (6.0 + 3.0 * pn)) / (3.0 * N * pow(lambda, vec3(4.0)) * (6.0 - 7.0 * pn))
+		const vec3 totalRayleigh = vec3( 5.804542996261093E-6, 1.3562911419845635E-5, 3.0265902468824876E-5 );
+
+		// mie stuff
+		// K coefficient for the primaries
+		const float v = 4.0;
+		const vec3 K = vec3( 0.686, 0.678, 0.666 );
+		// MieConst = pi * pow( ( 2.0 * pi ) / lambda, vec3( v - 2.0 ) ) * K
+		const vec3 MieConst = vec3( 1.8399918514433978E14, 2.7798023919660528E14, 4.0790479543861094E14 );
+
+		// earth shadow hack
+		// cutoffAngle = pi / 1.95;
+		const float cutoffAngle = 1.6110731556870734;
+		const float steepness = 1.5;
+		const float EE = 1000.0;
+
+		float sunIntensity( float zenithAngleCos ) {
+			zenithAngleCos = clamp( zenithAngleCos, -1.0, 1.0 );
+			return EE * max( 0.0, 1.0 - pow( e, -( ( cutoffAngle - acos( zenithAngleCos ) ) / steepness ) ) );
+		}
+
+		vec3 totalMie( float T ) {
+			float c = ( 0.2 * T ) * 10E-18;
+			return 0.434 * c * MieConst;
+		}
+
+		void main() {
+
+			vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
+			vWorldPosition = worldPosition.xyz;
+
+			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
+			gl_Position.z = gl_Position.w; // set z to camera.far
+
+			vSunDirection = normalize( sunPosition );
+
+			vSunE = sunIntensity( dot( vSunDirection, up ) );
+
+			vSunfade = 1.0 - clamp( 1.0 - exp( ( sunPosition.y / 450000.0 ) ), 0.0, 1.0 );
+
+			float rayleighCoefficient = rayleigh - ( 1.0 * ( 1.0 - vSunfade ) );
+
+			// extinction (absorbtion + out scattering)
 			// rayleigh coefficients
-			'	vBetaR = totalRayleigh * rayleighCoefficient;', // mie coefficients
-			'	vBetaM = totalMie( turbidity ) * mieCoefficient;', '}' ].join( '\n' ),
-		fragmentShader: [ 'varying vec3 vWorldPosition;', 'varying vec3 vSunDirection;', 'varying float vSunfade;', 'varying vec3 vBetaR;', 'varying vec3 vBetaM;', 'varying float vSunE;', 'uniform float mieDirectionalG;', 'uniform vec3 up;', 'const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );', // constants for atmospheric scattering
-			'const float pi = 3.141592653589793238462643383279502884197169;', 'const float n = 1.0003;', // refractive index of air
-			'const float N = 2.545E25;', // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
-			// optical length at zenith for molecules
-			'const float rayleighZenithLength = 8.4E3;', 'const float mieZenithLength = 1.25E3;', // 66 arc seconds -> degrees, and the cosine of that
-			'const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;', // 3.0 / ( 16.0 * pi )
-			'const float THREE_OVER_SIXTEENPI = 0.05968310365946075;', // 1.0 / ( 4.0 * pi )
-			'const float ONE_OVER_FOURPI = 0.07957747154594767;', 'float rayleighPhase( float cosTheta ) {', '	return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );', '}', 'float hgPhase( float cosTheta, float g ) {', '	float g2 = pow( g, 2.0 );', '	float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );', '	return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );', '}', 'void main() {', '	vec3 direction = normalize( vWorldPosition - cameraPos );', // optical length
+			vBetaR = totalRayleigh * rayleighCoefficient;
+
+			// mie coefficients
+			vBetaM = totalMie( turbidity ) * mieCoefficient;
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
+		varying vec3 vWorldPosition;
+		varying vec3 vSunDirection;
+		varying float vSunfade;
+		varying vec3 vBetaR;
+		varying vec3 vBetaM;
+		varying float vSunE;
+
+		uniform float mieDirectionalG;
+		uniform vec3 up;
+
+		const vec3 cameraPos = vec3( 0.0, 0.0, 0.0 );
+
+		// constants for atmospheric scattering
+		const float pi = 3.141592653589793238462643383279502884197169;
+
+		const float n = 1.0003; // refractive index of air
+		const float N = 2.545E25; // number of molecules per unit volume for air at 288.15K and 1013mb (sea level -45 celsius)
+
+		// optical length at zenith for molecules
+		const float rayleighZenithLength = 8.4E3;
+		const float mieZenithLength = 1.25E3;
+		// 66 arc seconds -> degrees, and the cosine of that
+		const float sunAngularDiameterCos = 0.999956676946448443553574619906976478926848692873900859324;
+
+		// 3.0 / ( 16.0 * pi )
+		const float THREE_OVER_SIXTEENPI = 0.05968310365946075;
+		// 1.0 / ( 4.0 * pi )
+		const float ONE_OVER_FOURPI = 0.07957747154594767;
+
+		float rayleighPhase( float cosTheta ) {
+			return THREE_OVER_SIXTEENPI * ( 1.0 + pow( cosTheta, 2.0 ) );
+		}
+
+		float hgPhase( float cosTheta, float g ) {
+			float g2 = pow( g, 2.0 );
+			float inverse = 1.0 / pow( 1.0 - 2.0 * g * cosTheta + g2, 1.5 );
+			return ONE_OVER_FOURPI * ( ( 1.0 - g2 ) * inverse );
+		}
+
+		void main() {
+
+			vec3 direction = normalize( vWorldPosition - cameraPos );
+
+			// optical length
 			// cutoff angle at 90 to avoid singularity in next formula.
-			'	float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );', '	float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );', '	float sR = rayleighZenithLength * inverse;', '	float sM = mieZenithLength * inverse;', // combined extinction factor
-			'	vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );', // in scattering
-			'	float cosTheta = dot( direction, vSunDirection );', '	float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );', '	vec3 betaRTheta = vBetaR * rPhase;', '	float mPhase = hgPhase( cosTheta, mieDirectionalG );', '	vec3 betaMTheta = vBetaM * mPhase;', '	vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );', '	Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );', // nightsky
-			'	float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]', '	float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]', '	vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );', '	vec3 L0 = vec3( 0.1 ) * Fex;', // composition + solar disc
-			'	float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );', '	L0 += ( vSunE * 19000.0 * Fex ) * sundisk;', '	vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );', '	vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );', '	gl_FragColor = vec4( retColor, 1.0 );', '#include <tonemapping_fragment>', '#include <encodings_fragment>', '}' ].join( '\n' )
+			float zenithAngle = acos( max( 0.0, dot( up, direction ) ) );
+			float inverse = 1.0 / ( cos( zenithAngle ) + 0.15 * pow( 93.885 - ( ( zenithAngle * 180.0 ) / pi ), -1.253 ) );
+			float sR = rayleighZenithLength * inverse;
+			float sM = mieZenithLength * inverse;
+
+			// combined extinction factor
+			vec3 Fex = exp( -( vBetaR * sR + vBetaM * sM ) );
+
+			// in scattering
+			float cosTheta = dot( direction, vSunDirection );
+
+			float rPhase = rayleighPhase( cosTheta * 0.5 + 0.5 );
+			vec3 betaRTheta = vBetaR * rPhase;
+
+			float mPhase = hgPhase( cosTheta, mieDirectionalG );
+			vec3 betaMTheta = vBetaM * mPhase;
+
+			vec3 Lin = pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * ( 1.0 - Fex ), vec3( 1.5 ) );
+			Lin *= mix( vec3( 1.0 ), pow( vSunE * ( ( betaRTheta + betaMTheta ) / ( vBetaR + vBetaM ) ) * Fex, vec3( 1.0 / 2.0 ) ), clamp( pow( 1.0 - dot( up, vSunDirection ), 5.0 ), 0.0, 1.0 ) );
+
+			// nightsky
+			float theta = acos( direction.y ); // elevation --> y-axis, [-pi/2, pi/2]
+			float phi = atan( direction.z, direction.x ); // azimuth --> x-axis [-pi/2, pi/2]
+			vec2 uv = vec2( phi, theta ) / vec2( 2.0 * pi, pi ) + vec2( 0.5, 0.0 );
+			vec3 L0 = vec3( 0.1 ) * Fex;
+
+			// composition + solar disc
+			float sundisk = smoothstep( sunAngularDiameterCos, sunAngularDiameterCos + 0.00002, cosTheta );
+			L0 += ( vSunE * 19000.0 * Fex ) * sundisk;
+
+			vec3 texColor = ( Lin + L0 ) * 0.04 + vec3( 0.0, 0.0003, 0.00075 );
+
+			vec3 retColor = pow( texColor, vec3( 1.0 / ( 1.2 + ( 1.2 * vSunfade ) ) ) );
+
+			gl_FragColor = vec4( retColor, 1.0 );
+
+			#include <tonemapping_fragment>
+			#include <encodings_fragment>
+
+		}`
 	};
 
 	THREE.Sky = Sky;

File diff suppressed because it is too large
+ 0 - 1
examples/js/objects/Water.js


+ 106 - 10
examples/js/objects/Water2.js

@@ -196,16 +196,112 @@
 				value: new THREE.Vector4()
 			}
 		},
-		vertexShader: [ '#include <common>', '#include <fog_pars_vertex>', '#include <logdepthbuf_pars_vertex>', 'uniform mat4 textureMatrix;', 'varying vec4 vCoord;', 'varying vec2 vUv;', 'varying vec3 vToEye;', 'void main() {', '	vUv = uv;', '	vCoord = textureMatrix * vec4( position, 1.0 );', '	vec4 worldPosition = modelMatrix * vec4( position, 1.0 );', '	vToEye = cameraPosition - worldPosition.xyz;', '	vec4 mvPosition =	viewMatrix * worldPosition;', // used in fog_vertex
-			'	gl_Position = projectionMatrix * mvPosition;', '	#include <logdepthbuf_vertex>', '	#include <fog_vertex>', '}' ].join( '\n' ),
-		fragmentShader: [ '#include <common>', '#include <fog_pars_fragment>', '#include <logdepthbuf_pars_fragment>', 'uniform sampler2D tReflectionMap;', 'uniform sampler2D tRefractionMap;', 'uniform sampler2D tNormalMap0;', 'uniform sampler2D tNormalMap1;', '#ifdef USE_FLOWMAP', '	uniform sampler2D tFlowMap;', '#else', '	uniform vec2 flowDirection;', '#endif', 'uniform vec3 color;', 'uniform float reflectivity;', 'uniform vec4 config;', 'varying vec4 vCoord;', 'varying vec2 vUv;', 'varying vec3 vToEye;', 'void main() {', '	#include <logdepthbuf_fragment>', '	float flowMapOffset0 = config.x;', '	float flowMapOffset1 = config.y;', '	float halfCycle = config.z;', '	float scale = config.w;', '	vec3 toEye = normalize( vToEye );', // determine flow direction
-			'	vec2 flow;', '	#ifdef USE_FLOWMAP', '		flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;', '	#else', '		flow = flowDirection;', '	#endif', '	flow.x *= - 1.0;', // sample normal maps (distort uvs with flowdata)
-			'	vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );', '	vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );', // linear interpolate to get the final normal color
-			'	float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;', '	vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );', // calculate normal vector
-			'	vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b,	normalColor.g * 2.0 - 1.0 ) );', // calculate the fresnel term to blend reflection and refraction maps
-			'	float theta = max( dot( toEye, normal ), 0.0 );', '	float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );', // calculate final uv coords
-			'	vec3 coord = vCoord.xyz / vCoord.w;', '	vec2 uv = coord.xy + coord.z * normal.xz * 0.05;', '	vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );', '	vec4 refractColor = texture2D( tRefractionMap, uv );', // multiply water color with the mix of both textures
-			'	gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );', '	#include <tonemapping_fragment>', '	#include <encodings_fragment>', '	#include <fog_fragment>', '}' ].join( '\n' )
+		vertexShader:
+  /* glsl */
+  `
+
+		#include <common>
+		#include <fog_pars_vertex>
+		#include <logdepthbuf_pars_vertex>
+
+		uniform mat4 textureMatrix;
+
+		varying vec4 vCoord;
+		varying vec2 vUv;
+		varying vec3 vToEye;
+
+		void main() {
+
+			vUv = uv;
+			vCoord = textureMatrix * vec4( position, 1.0 );
+
+			vec4 worldPosition = modelMatrix * vec4( position, 1.0 );
+			vToEye = cameraPosition - worldPosition.xyz;
+
+			vec4 mvPosition =  viewMatrix * worldPosition; // used in fog_vertex
+			gl_Position = projectionMatrix * mvPosition;
+
+			#include <logdepthbuf_vertex>
+			#include <fog_vertex>
+
+		}`,
+		fragmentShader:
+  /* glsl */
+  `
+
+		#include <common>
+		#include <fog_pars_fragment>
+		#include <logdepthbuf_pars_fragment>
+
+		uniform sampler2D tReflectionMap;
+		uniform sampler2D tRefractionMap;
+		uniform sampler2D tNormalMap0;
+		uniform sampler2D tNormalMap1;
+
+		#ifdef USE_FLOWMAP
+			uniform sampler2D tFlowMap;
+		#else
+			uniform vec2 flowDirection;
+		#endif
+
+		uniform vec3 color;
+		uniform float reflectivity;
+		uniform vec4 config;
+
+		varying vec4 vCoord;
+		varying vec2 vUv;
+		varying vec3 vToEye;
+
+		void main() {
+
+			#include <logdepthbuf_fragment>
+
+			float flowMapOffset0 = config.x;
+			float flowMapOffset1 = config.y;
+			float halfCycle = config.z;
+			float scale = config.w;
+
+			vec3 toEye = normalize( vToEye );
+
+			// determine flow direction
+			vec2 flow;
+			#ifdef USE_FLOWMAP
+				flow = texture2D( tFlowMap, vUv ).rg * 2.0 - 1.0;
+			#else
+				flow = flowDirection;
+			#endif
+			flow.x *= - 1.0;
+
+			// sample normal maps (distort uvs with flowdata)
+			vec4 normalColor0 = texture2D( tNormalMap0, ( vUv * scale ) + flow * flowMapOffset0 );
+			vec4 normalColor1 = texture2D( tNormalMap1, ( vUv * scale ) + flow * flowMapOffset1 );
+
+			// linear interpolate to get the final normal color
+			float flowLerp = abs( halfCycle - flowMapOffset0 ) / halfCycle;
+			vec4 normalColor = mix( normalColor0, normalColor1, flowLerp );
+
+			// calculate normal vector
+			vec3 normal = normalize( vec3( normalColor.r * 2.0 - 1.0, normalColor.b,  normalColor.g * 2.0 - 1.0 ) );
+
+			// calculate the fresnel term to blend reflection and refraction maps
+			float theta = max( dot( toEye, normal ), 0.0 );
+			float reflectance = reflectivity + ( 1.0 - reflectivity ) * pow( ( 1.0 - theta ), 5.0 );
+
+			// calculate final uv coords
+			vec3 coord = vCoord.xyz / vCoord.w;
+			vec2 uv = coord.xy + coord.z * normal.xz * 0.05;
+
+			vec4 reflectColor = texture2D( tReflectionMap, vec2( 1.0 - uv.x, uv.y ) );
+			vec4 refractColor = texture2D( tRefractionMap, uv );
+
+			// multiply water color with the mix of both textures
+			gl_FragColor = vec4( color, 1.0 ) * mix( refractColor, reflectColor, reflectance );
+
+			#include <tonemapping_fragment>
+			#include <encodings_fragment>
+			#include <fog_fragment>
+
+		}`
 	};
 
 	THREE.Water = Water;

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

@@ -22,8 +22,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -36,8 +36,8 @@
 
 	`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float lutSize;
 		#if USE_3DTEXTURE

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

@@ -241,10 +241,10 @@
 			this.blurMaterial2.uniforms[ 'tDiffuse' ].value = this.blurRenderTarget.texture;
 			this.blurMaterial2.uniforms[ 'resolution' ].value.set( this.width, this.height ); // // blur material 3
 			// this.blurMaterial3 = new THREE.ShaderMaterial({
-			//	 defines: Object.assign({}, THREE.SSRBlurShader.defines),
-			//	 uniforms: THREE.UniformsUtils.clone(THREE.SSRBlurShader.uniforms),
-			//	 vertexShader: THREE.SSRBlurShader.vertexShader,
-			//	 fragmentShader: THREE.SSRBlurShader.fragmentShader
+			//   defines: Object.assign({}, THREE.SSRBlurShader.defines),
+			//   uniforms: THREE.UniformsUtils.clone(THREE.SSRBlurShader.uniforms),
+			//   vertexShader: THREE.SSRBlurShader.vertexShader,
+			//   fragmentShader: THREE.SSRBlurShader.fragmentShader
 			// });
 			// this.blurMaterial3.uniforms['tDiffuse'].value = this.blurRenderTarget2.texture;
 			// this.blurMaterial3.uniforms['resolution'].value.set(this.width, this.height);

+ 1 - 1
examples/js/postprocessing/SSRrPass.js

@@ -95,7 +95,7 @@
 				depthBuffer: true
 			} );
 			this.specularRenderTarget = new THREE.WebGLRenderTarget( this.width, this.height, {
-			// TODO: Can merge with refractiveRenderTarget?
+				// TODO: Can merge with refractiveRenderTarget?
 				minFilter: THREE.NearestFilter,
 				magFilter: THREE.NearestFilter,
 				format: THREE.RGBAFormat

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

@@ -893,7 +893,7 @@
 
 						// The line segment spans two boundaries, but is outside both of them.
 						// (This can't happen when we're only clipping against just near/far but good
-						//	to leave the check here for future usage if other clip planes are added.)
+						//  to leave the check here for future usage if other clip planes are added.)
 						return false;
 
 					} else {

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

@@ -17,8 +17,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -29,8 +29,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#define saturate(a) clamp( a, 0.0, 1.0 )
 
@@ -59,9 +59,9 @@
 
 		// ODT_SAT => XYZ => D60_2_D65 => sRGB
 			const mat3 ACESOutputMat = mat3(
-				vec3(	1.60475, -0.10208, -0.00327 ), // transposed from source
-				vec3( -0.53108,	1.10813, -0.07276 ),
-				vec3( -0.07367, -0.00605,	1.07602 )
+				vec3(  1.60475, -0.10208, -0.00327 ), // transposed from source
+				vec3( -0.53108,  1.10813, -0.07276 ),
+				vec3( -0.07367, -0.00605,  1.07602 )
 			);
 
 			color = ACESInputMat * color;

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

@@ -18,8 +18,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -30,8 +30,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float damp;
 

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

@@ -6,8 +6,8 @@
 	const BasicShader = {
 		uniforms: {},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		void main() {
 
@@ -15,8 +15,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		void main() {
 

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

@@ -15,8 +15,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -27,8 +27,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float opacity;
 

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

@@ -19,8 +19,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -31,8 +31,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float opacity;
 		uniform float mixRatio;

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

@@ -37,8 +37,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -49,8 +49,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#include <common>
 
@@ -104,49 +104,49 @@
 			vec4 col = vec4( 0.0 );
 
 			col += texture2D( tColor, vUv.xy );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	 0.4	) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.15,	0.37 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29,	0.29 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.37,	0.15 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.40,	0.0	) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.37, -0.15 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29, -0.29 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	-0.4	) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.15,	0.37 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,	0.29 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.37,	0.15 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,	 0.0	) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.15, -0.37 ) * aspectcorrect ) * dofblur );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur );
 
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.15,	0.37 ) * aspectcorrect ) * dofblur9 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.37,	0.15 ) * aspectcorrect ) * dofblur9 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.37, -0.15 ) * aspectcorrect ) * dofblur9 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.15,  0.37 ) * aspectcorrect ) * dofblur9 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.37,  0.15 ) * aspectcorrect ) * dofblur9 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.37, -0.15 ) * aspectcorrect ) * dofblur9 );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.15, -0.37 ) * aspectcorrect ) * dofblur9 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.15,	0.37 ) * aspectcorrect ) * dofblur9 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.37,	0.15 ) * aspectcorrect ) * dofblur9 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.15,  0.37 ) * aspectcorrect ) * dofblur9 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.37,  0.15 ) * aspectcorrect ) * dofblur9 );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.37, -0.15 ) * aspectcorrect ) * dofblur9 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.15, -0.37 ) * aspectcorrect ) * dofblur9 );
-
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29,	0.29 ) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.40,	0.0	) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29, -0.29 ) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	-0.4	) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,	0.29 ) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,	 0.0	) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.15, -0.37 ) * aspectcorrect ) * dofblur9 );
+
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.40,  0.0  ) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur7 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur7 );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur7 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	 0.4	) * aspectcorrect ) * dofblur7 );
-
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29,	0.29 ) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.4,	 0.0	) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.29, -0.29 ) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	-0.4	) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,	0.29 ) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,	 0.0	) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur7 );
+
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29,  0.29 ) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.4,   0.0  ) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.29, -0.29 ) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,  -0.4  ) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.29,  0.29 ) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2( -0.4,   0.0  ) * aspectcorrect ) * dofblur4 );
 			col += texture2D( tColor, vUv.xy + ( vec2( -0.29, -0.29 ) * aspectcorrect ) * dofblur4 );
-			col += texture2D( tColor, vUv.xy + ( vec2(	0.0,	 0.4	) * aspectcorrect ) * dofblur4 );
+			col += texture2D( tColor, vUv.xy + ( vec2(  0.0,   0.4  ) * aspectcorrect ) * dofblur4 );
 
 			gl_FragColor = col / 41.0;
 			gl_FragColor.a = 1.0;

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

@@ -81,8 +81,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -93,8 +93,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#include <common>
 
@@ -105,7 +105,7 @@
 		uniform float textureWidth;
 		uniform float textureHeight;
 
-		uniform float focalDepth;	//focal distance value in meters, but you may use autofocus option below
+		uniform float focalDepth;  //focal distance value in meters, but you may use autofocus option below
 		uniform float focalLength; //focal length in mm
 		uniform float fstop; //f-stop value
 		uniform bool showFocus; //show debug focus point and focal range (red = focal point, green = focal range)
@@ -176,14 +176,14 @@
 		float penta(vec2 coords) {
 			//pentagonal shape
 			float scale = float(rings) - 1.3;
-			vec4	HS0 = vec4( 1.0,				 0.0,				 0.0,	1.0);
-			vec4	HS1 = vec4( 0.309016994, 0.951056516, 0.0,	1.0);
-			vec4	HS2 = vec4(-0.809016994, 0.587785252, 0.0,	1.0);
-			vec4	HS3 = vec4(-0.809016994,-0.587785252, 0.0,	1.0);
-			vec4	HS4 = vec4( 0.309016994,-0.951056516, 0.0,	1.0);
-			vec4	HS5 = vec4( 0.0				,0.0				 , 1.0,	1.0);
+			vec4  HS0 = vec4( 1.0,         0.0,         0.0,  1.0);
+			vec4  HS1 = vec4( 0.309016994, 0.951056516, 0.0,  1.0);
+			vec4  HS2 = vec4(-0.809016994, 0.587785252, 0.0,  1.0);
+			vec4  HS3 = vec4(-0.809016994,-0.587785252, 0.0,  1.0);
+			vec4  HS4 = vec4( 0.309016994,-0.951056516, 0.0,  1.0);
+			vec4  HS5 = vec4( 0.0        ,0.0         , 1.0,  1.0);
 
-			vec4	one = vec4( 1.0 );
+			vec4  one = vec4( 1.0 );
 
 			vec4 P = vec4((coords),vec2(scale, scale));
 
@@ -220,17 +220,17 @@
 			offset[1] = vec2( 0.0, -wh.y);
 			offset[2] = vec2( wh.x -wh.y);
 
-			offset[3] = vec2(-wh.x,	0.0);
-			offset[4] = vec2( 0.0,	 0.0);
-			offset[5] = vec2( wh.x,	0.0);
+			offset[3] = vec2(-wh.x,  0.0);
+			offset[4] = vec2( 0.0,   0.0);
+			offset[5] = vec2( wh.x,  0.0);
 
 			offset[6] = vec2(-wh.x, wh.y);
-			offset[7] = vec2( 0.0,	wh.y);
+			offset[7] = vec2( 0.0,  wh.y);
 			offset[8] = vec2( wh.x, wh.y);
 
-			kernel[0] = 1.0/16.0;	 kernel[1] = 2.0/16.0;	 kernel[2] = 1.0/16.0;
-			kernel[3] = 2.0/16.0;	 kernel[4] = 4.0/16.0;	 kernel[5] = 2.0/16.0;
-			kernel[6] = 1.0/16.0;	 kernel[7] = 2.0/16.0;	 kernel[8] = 1.0/16.0;
+			kernel[0] = 1.0/16.0;   kernel[1] = 2.0/16.0;   kernel[2] = 1.0/16.0;
+			kernel[3] = 2.0/16.0;   kernel[4] = 4.0/16.0;   kernel[5] = 2.0/16.0;
+			kernel[6] = 1.0/16.0;   kernel[7] = 2.0/16.0;   kernel[8] = 1.0/16.0;
 
 
 			for( int i=0; i<9; i++ ) {
@@ -392,8 +392,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying float vViewZDepth;
 
@@ -406,8 +406,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float mNear;
 		uniform float mFar;

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

@@ -19,8 +19,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -32,8 +32,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform sampler2D tDiffuse;
 		uniform float brightness;

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

@@ -20,8 +20,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -33,8 +33,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform sampler2D tDiffuse;
 		uniform vec3 powRGB;

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

@@ -14,8 +14,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -26,8 +26,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform vec3 color;
 		uniform sampler2D tDiffuse;

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

@@ -23,8 +23,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform vec2 uImageIncrement;
 
@@ -37,8 +37,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float cKernel[ KERNEL_SIZE_INT ];
 

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

@@ -13,8 +13,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -25,8 +25,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float opacity;
 

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

@@ -21,8 +21,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -33,8 +33,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float focus;
 		uniform float maxblur;

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

@@ -37,8 +37,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#include <common>
 
@@ -54,8 +54,8 @@
 			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#include <common>
 		#include <packing>

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

@@ -51,8 +51,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 		void main() {
@@ -60,8 +60,8 @@
 			gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform int byp; //should we apply the glitch ?
 

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

@@ -25,8 +25,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -37,8 +37,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform vec2 center;
 		uniform float angle;

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

@@ -17,8 +17,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -63,8 +63,8 @@
 		//
 		//----------------------------------------------------------------------------------
 
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		precision highp float;
 

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

@@ -41,8 +41,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -53,8 +53,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#include <common>
 
@@ -103,7 +103,7 @@
 
 			}
 
-			gl_FragColor =	vec4( cResult, cTextureScreen.a );
+			gl_FragColor =  vec4( cResult, cTextureScreen.a );
 
 		}`
 	};

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

@@ -24,8 +24,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -36,8 +36,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float screenWidth;
 		uniform float screenHeight;
@@ -62,7 +62,7 @@
 
 			f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;
 
-			vec2 sampleSize = vec2(	1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );
+			vec2 sampleSize = vec2(  1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );
 
 			add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );
 			if( tmp.b < color.b ) color = tmp;

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

@@ -17,8 +17,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -29,8 +29,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform sampler2D tDiffuse;
 		varying vec2 vUv;

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

@@ -22,8 +22,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform float mRefractionRatio;
 		uniform float mFresnelBias;
@@ -53,8 +53,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform samplerCube tCube;
 

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

@@ -11,8 +11,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -23,8 +23,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform sampler2D tDiffuse;
 

+ 16 - 16
examples/js/shaders/GodRaysShader.js

@@ -25,8 +25,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -37,8 +37,8 @@
 
 	 }`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -78,8 +78,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -90,8 +90,8 @@
 
 	 }`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#define TAPS_PER_PASS 6.0
 
@@ -195,8 +195,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -207,8 +207,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -249,8 +249,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -261,8 +261,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 

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

@@ -49,8 +49,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUV;
 
@@ -61,8 +61,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		#define SQRT2_MINUS_ONE 0.41421356
 		#define SQRT2_HALF_MINUS_ONE 0.20710678

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

@@ -3,7 +3,7 @@
 	/**
  * Two pass Gaussian blur filter (horizontal and vertical blur shaders)
  * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/
- *	 and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
+ *   and used in http://www.cake23.de/traveling-wavefronts-lit-up.html
  *
  * - 9 samples per pass
  * - standard deviation 2.7
@@ -19,8 +19,8 @@
 			}
 		},
 		vertexShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		varying vec2 vUv;
 
@@ -31,8 +31,8 @@
 
 		}`,
 		fragmentShader:
-	/* glsl */
-	`
+  /* glsl */
+  `
 
 		uniform sampler2D tDiffuse;
 		uniform float h;

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