Sfoglia il codice sorgente

Merge branch 'dev' into geometry

# Conflicts:
#	examples/jsm/modifiers/SubdivisionModifier.js
#	examples/jsm/modifiers/TessellateModifier.js
#	src/core/DirectGeometry.d.ts
Mr.doob 4 anni fa
parent
commit
dc7e084d10
100 ha cambiato i file con 1181 aggiunte e 1340 eliminazioni
  1. 205 144
      build/three.js
  2. 0 0
      build/three.min.js
  3. 153 126
      build/three.module.js
  4. 11 0
      docs/api/en/math/Color.html
  5. 3 0
      docs/api/en/math/Vector4.html
  6. 1 1
      docs/api/zh/constants/Textures.html
  7. 3 0
      docs/api/zh/math/Vector4.html
  8. 5 5
      docs/examples/en/controls/OrbitControls.html
  9. 9 9
      docs/examples/ko/controls/OrbitControls.html
  10. 5 5
      docs/examples/zh/controls/OrbitControls.html
  11. 6 6
      editor/examples/arkanoid.app.json
  12. 4 4
      editor/examples/camera.app.json
  13. 1 1
      editor/examples/particles.app.json
  14. 4 4
      editor/examples/pong.app.json
  15. 1 1
      editor/examples/shaders.app.json
  16. 3 3
      editor/js/Editor.js
  17. 1 1
      editor/js/Loader.js
  18. 15 15
      editor/js/Menubar.Add.js
  19. 1 1
      editor/js/Sidebar.Geometry.BoxGeometry.js
  20. 1 1
      editor/js/Sidebar.Geometry.CircleGeometry.js
  21. 1 1
      editor/js/Sidebar.Geometry.CylinderGeometry.js
  22. 1 1
      editor/js/Sidebar.Geometry.DodecahedronGeometry.js
  23. 2 2
      editor/js/Sidebar.Geometry.ExtrudeGeometry.js
  24. 1 1
      editor/js/Sidebar.Geometry.IcosahedronGeometry.js
  25. 1 1
      editor/js/Sidebar.Geometry.LatheGeometry.js
  26. 1 1
      editor/js/Sidebar.Geometry.OctahedronGeometry.js
  27. 1 1
      editor/js/Sidebar.Geometry.PlaneGeometry.js
  28. 1 1
      editor/js/Sidebar.Geometry.RingGeometry.js
  29. 2 2
      editor/js/Sidebar.Geometry.ShapeGeometry.js
  30. 1 1
      editor/js/Sidebar.Geometry.SphereGeometry.js
  31. 2 2
      editor/js/Sidebar.Geometry.TeapotGeometry.js
  32. 1 1
      editor/js/Sidebar.Geometry.TetrahedronGeometry.js
  33. 1 1
      editor/js/Sidebar.Geometry.TorusGeometry.js
  34. 1 1
      editor/js/Sidebar.Geometry.TorusKnotGeometry.js
  35. 1 1
      editor/js/Sidebar.Geometry.TubeGeometry.js
  36. 1 1
      editor/js/Viewport.ViewHelper.js
  37. 1 1
      editor/js/libs/ui.three.js
  38. 18 18
      editor/sw.js
  39. 2 2
      examples/css2d_label.html
  40. 1 1
      examples/css3d_orthographic.html
  41. 1 1
      examples/css3d_sandbox.html
  42. 0 1
      examples/files.json
  43. 1 1
      examples/games_fps.html
  44. 1 1
      examples/js/animation/CCDIKSolver.js
  45. 5 5
      examples/js/animation/MMDPhysics.js
  46. 1 1
      examples/js/cameras/CinematicCamera.js
  47. 22 22
      examples/js/controls/FirstPersonControls.js
  48. 30 28
      examples/js/controls/FlyControls.js
  49. 17 7
      examples/js/controls/OrbitControls.js
  50. 37 37
      examples/js/controls/TransformControls.js
  51. 1 1
      examples/js/effects/AnaglyphEffect.js
  52. 1 1
      examples/js/effects/ParallaxBarrierEffect.js
  53. 4 4
      examples/js/geometries/ParametricGeometries.js
  54. 3 3
      examples/js/geometries/TeapotGeometry.js
  55. 30 12
      examples/js/loaders/FBXLoader.js
  56. 6 6
      examples/js/loaders/VRMLLoader.js
  57. 1 1
      examples/js/misc/ConvexObjectBreaker.js
  58. 1 1
      examples/js/misc/GPUComputationRenderer.js
  59. 2 2
      examples/js/misc/Ocean.js
  60. 1 1
      examples/js/misc/VolumeSlice.js
  61. 10 9
      examples/js/modifiers/EdgeSplitModifier.js
  62. 57 22
      examples/js/modifiers/SimplifyModifier.js
  63. 0 421
      examples/js/modifiers/SubdivisionModifier.js
  64. 192 166
      examples/js/modifiers/TessellateModifier.js
  65. 1 1
      examples/js/objects/Sky.js
  66. 1 1
      examples/js/postprocessing/CubeTexturePass.js
  67. 1 1
      examples/js/postprocessing/EffectComposer.js
  68. 2 2
      examples/js/utils/ShadowMapViewer.js
  69. 1 1
      examples/js/utils/UVsDebug.js
  70. 2 2
      examples/jsm/animation/CCDIKSolver.js
  71. 8 8
      examples/jsm/animation/MMDPhysics.js
  72. 2 2
      examples/jsm/cameras/CinematicCamera.js
  73. 22 22
      examples/jsm/controls/FirstPersonControls.js
  74. 30 28
      examples/jsm/controls/FlyControls.js
  75. 2 0
      examples/jsm/controls/OrbitControls.d.ts
  76. 17 7
      examples/jsm/controls/OrbitControls.js
  77. 43 43
      examples/jsm/controls/TransformControls.js
  78. 2 2
      examples/jsm/csm/CSMHelper.js
  79. 1 1
      examples/jsm/deprecated/Geometry.d.ts
  80. 2 2
      examples/jsm/effects/AnaglyphEffect.js
  81. 2 2
      examples/jsm/effects/ParallaxBarrierEffect.js
  82. 1 1
      examples/jsm/environments/RoomEnvironment.js
  83. 5 4
      examples/jsm/geometries/ParametricGeometries.js
  84. 2 2
      examples/jsm/geometries/RoundedBoxGeometry.d.ts
  85. 3 3
      examples/jsm/geometries/RoundedBoxGeometry.js
  86. 1 1
      examples/jsm/geometries/TeapotGeometry.d.ts
  87. 4 4
      examples/jsm/geometries/TeapotGeometry.js
  88. 2 2
      examples/jsm/helpers/LightProbeHelper.js
  89. 30 12
      examples/jsm/loaders/FBXLoader.js
  90. 2 0
      examples/jsm/loaders/LUT3dlLoader.js
  91. 2 0
      examples/jsm/loaders/LUTCubeLoader.js
  92. 7 1
      examples/jsm/loaders/SVGLoader.d.ts
  93. 10 10
      examples/jsm/loaders/VRMLLoader.js
  94. 1 1
      examples/jsm/misc/ConvexObjectBreaker.js
  95. 2 2
      examples/jsm/misc/GPUComputationRenderer.js
  96. 3 3
      examples/jsm/misc/Ocean.js
  97. 2 2
      examples/jsm/misc/VolumeSlice.js
  98. 10 9
      examples/jsm/modifiers/EdgeSplitModifier.js
  99. 58 22
      examples/jsm/modifiers/SimplifyModifier.js
  100. 0 14
      examples/jsm/modifiers/SubdivisionModifier.d.ts

+ 205 - 144
build/three.js

@@ -270,6 +270,36 @@
 	var GLSL1 = '100';
 	var GLSL3 = '300 es';
 
+	function _defineProperties(target, props) {
+		for (var i = 0; i < props.length; i++) {
+			var descriptor = props[i];
+			descriptor.enumerable = descriptor.enumerable || false;
+			descriptor.configurable = true;
+			if ("value" in descriptor) descriptor.writable = true;
+			Object.defineProperty(target, descriptor.key, descriptor);
+		}
+	}
+
+	function _createClass(Constructor, protoProps, staticProps) {
+		if (protoProps) _defineProperties(Constructor.prototype, protoProps);
+		if (staticProps) _defineProperties(Constructor, staticProps);
+		return Constructor;
+	}
+
+	function _inheritsLoose(subClass, superClass) {
+		subClass.prototype = Object.create(superClass.prototype);
+		subClass.prototype.constructor = subClass;
+		subClass.__proto__ = superClass;
+	}
+
+	function _assertThisInitialized(self) {
+		if (self === void 0) {
+			throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
+		}
+
+		return self;
+	}
+
 	/**
 	 * https://github.com/mrdoob/eventdispatcher.js/
 	 */
@@ -453,36 +483,6 @@
 		}
 	};
 
-	function _defineProperties(target, props) {
-		for (var i = 0; i < props.length; i++) {
-			var descriptor = props[i];
-			descriptor.enumerable = descriptor.enumerable || false;
-			descriptor.configurable = true;
-			if ("value" in descriptor) descriptor.writable = true;
-			Object.defineProperty(target, descriptor.key, descriptor);
-		}
-	}
-
-	function _createClass(Constructor, protoProps, staticProps) {
-		if (protoProps) _defineProperties(Constructor.prototype, protoProps);
-		if (staticProps) _defineProperties(Constructor, staticProps);
-		return Constructor;
-	}
-
-	function _inheritsLoose(subClass, superClass) {
-		subClass.prototype = Object.create(superClass.prototype);
-		subClass.prototype.constructor = subClass;
-		subClass.__proto__ = superClass;
-	}
-
-	function _assertThisInitialized(self) {
-		if (self === void 0) {
-			throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
-		}
-
-		return self;
-	}
-
 	var Vector2 = /*#__PURE__*/function () {
 		function Vector2(x, y) {
 			if (x === void 0) {
@@ -1637,6 +1637,14 @@
 			return this;
 		};
 
+		_proto.multiply = function multiply(v) {
+			this.x *= v.x;
+			this.y *= v.y;
+			this.z *= v.z;
+			this.w *= v.w;
+			return this;
+		};
+
 		_proto.multiplyScalar = function multiplyScalar(scalar) {
 			this.x *= scalar;
 			this.y *= scalar;
@@ -1969,28 +1977,37 @@
 	 * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
 	*/
 
-	function WebGLRenderTarget(width, height, options) {
-		this.width = width;
-		this.height = height;
-		this.scissor = new Vector4(0, 0, width, height);
-		this.scissorTest = false;
-		this.viewport = new Vector4(0, 0, width, height);
-		options = options || {};
-		this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
-		this.texture.image = {};
-		this.texture.image.width = width;
-		this.texture.image.height = height;
-		this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
-		this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
-		this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
-		this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
-		this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
-	}
-
-	WebGLRenderTarget.prototype = Object.assign(Object.create(EventDispatcher.prototype), {
-		constructor: WebGLRenderTarget,
-		isWebGLRenderTarget: true,
-		setSize: function setSize(width, height) {
+	var WebGLRenderTarget = /*#__PURE__*/function (_EventDispatcher) {
+		_inheritsLoose(WebGLRenderTarget, _EventDispatcher);
+
+		function WebGLRenderTarget(width, height, options) {
+			var _this;
+
+			_this = _EventDispatcher.call(this) || this;
+			Object.defineProperty(_assertThisInitialized(_this), 'isWebGLRenderTarget', {
+				value: true
+			});
+			_this.width = width;
+			_this.height = height;
+			_this.scissor = new Vector4(0, 0, width, height);
+			_this.scissorTest = false;
+			_this.viewport = new Vector4(0, 0, width, height);
+			options = options || {};
+			_this.texture = new Texture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
+			_this.texture.image = {};
+			_this.texture.image.width = width;
+			_this.texture.image.height = height;
+			_this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
+			_this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
+			_this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
+			_this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
+			_this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
+			return _this;
+		}
+
+		var _proto = WebGLRenderTarget.prototype;
+
+		_proto.setSize = function setSize(width, height) {
 			if (this.width !== width || this.height !== height) {
 				this.width = width;
 				this.height = height;
@@ -2001,11 +2018,13 @@
 
 			this.viewport.set(0, 0, width, height);
 			this.scissor.set(0, 0, width, height);
-		},
-		clone: function clone() {
+		};
+
+		_proto.clone = function clone() {
 			return new this.constructor().copy(this);
-		},
-		copy: function copy(source) {
+		};
+
+		_proto.copy = function copy(source) {
 			this.width = source.width;
 			this.height = source.height;
 			this.viewport.copy(source.viewport);
@@ -2014,28 +2033,42 @@
 			this.stencilBuffer = source.stencilBuffer;
 			this.depthTexture = source.depthTexture;
 			return this;
-		},
-		dispose: function dispose() {
+		};
+
+		_proto.dispose = function dispose() {
 			this.dispatchEvent({
 				type: 'dispose'
 			});
+		};
+
+		return WebGLRenderTarget;
+	}(EventDispatcher);
+
+	var WebGLMultisampleRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) {
+		_inheritsLoose(WebGLMultisampleRenderTarget, _WebGLRenderTarget);
+
+		function WebGLMultisampleRenderTarget(width, height, options) {
+			var _this;
+
+			_this = _WebGLRenderTarget.call(this, width, height, options) || this;
+			Object.defineProperty(_assertThisInitialized(_this), 'isWebGLMultisampleRenderTarget', {
+				value: true
+			});
+			_this.samples = 4;
+			return _this;
 		}
-	});
 
-	function WebGLMultisampleRenderTarget(width, height, options) {
-		WebGLRenderTarget.call(this, width, height, options);
-		this.samples = 4;
-	}
+		var _proto = WebGLMultisampleRenderTarget.prototype;
+
+		_proto.copy = function copy(source) {
+			_WebGLRenderTarget.prototype.copy.call(this, source);
 
-	WebGLMultisampleRenderTarget.prototype = Object.assign(Object.create(WebGLRenderTarget.prototype), {
-		constructor: WebGLMultisampleRenderTarget,
-		isWebGLMultisampleRenderTarget: true,
-		copy: function copy(source) {
-			WebGLRenderTarget.prototype.copy.call(this, source);
 			this.samples = source.samples;
 			return this;
-		}
-	});
+		};
+
+		return WebGLMultisampleRenderTarget;
+	}(WebGLRenderTarget);
 
 	var Quaternion = /*#__PURE__*/function () {
 		function Quaternion(x, y, z, w) {
@@ -6693,6 +6726,13 @@
 			return this;
 		};
 
+		_proto.lerpColors = function lerpColors(color1, color2, alpha) {
+			this.r = color1.r + (color2.r - color1.r) * alpha;
+			this.g = color1.g + (color2.g - color1.g) * alpha;
+			this.b = color1.b + (color2.b - color1.b) * alpha;
+			return this;
+		};
+
 		_proto.lerpHSL = function lerpHSL(color, alpha) {
 			this.getHSL(_hslA);
 			color.getHSL(_hslB);
@@ -9408,7 +9448,7 @@
 		 * Values for focal length and film gauge must have the same unit.
 		 */
 		setFocalLength: function setFocalLength(focalLength) {
-			// see http://www.bobatkins.com/photography/technical/field_of_view.html
+			/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
 			var vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
 			this.fov = MathUtils.RAD2DEG * 2 * Math.atan(vExtentSlope);
 			this.updateProjectionMatrix();
@@ -9637,75 +9677,85 @@
 		}
 	});
 
-	function WebGLCubeRenderTarget(size, options, dummy) {
-		if (Number.isInteger(options)) {
-			console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )');
-			options = dummy;
+	var WebGLCubeRenderTarget = /*#__PURE__*/function (_WebGLRenderTarget) {
+		_inheritsLoose(WebGLCubeRenderTarget, _WebGLRenderTarget);
+
+		function WebGLCubeRenderTarget(size, options, dummy) {
+			var _this;
+
+			if (Number.isInteger(options)) {
+				console.warn('THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )');
+				options = dummy;
+			}
+
+			_this = _WebGLRenderTarget.call(this, size, size, options) || this;
+			Object.defineProperty(_assertThisInitialized(_this), 'isWebGLCubeRenderTarget', {
+				value: true
+			});
+			options = options || {};
+			_this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
+			_this.texture._needsFlipEnvMap = false;
+			return _this;
 		}
 
-		WebGLRenderTarget.call(this, size, size, options);
-		options = options || {};
-		this.texture = new CubeTexture(undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding);
-		this.texture._needsFlipEnvMap = false;
-	}
+		var _proto = WebGLCubeRenderTarget.prototype;
 
-	WebGLCubeRenderTarget.prototype = Object.create(WebGLRenderTarget.prototype);
-	WebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget;
-	WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
+		_proto.fromEquirectangularTexture = function fromEquirectangularTexture(renderer, texture) {
+			this.texture.type = texture.type;
+			this.texture.format = RGBAFormat; // see #18859
 
-	WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function (renderer, texture) {
-		this.texture.type = texture.type;
-		this.texture.format = RGBAFormat; // see #18859
+			this.texture.encoding = texture.encoding;
+			this.texture.generateMipmaps = texture.generateMipmaps;
+			this.texture.minFilter = texture.minFilter;
+			this.texture.magFilter = texture.magFilter;
+			var shader = {
+				uniforms: {
+					tEquirect: {
+						value: null
+					}
+				},
+				vertexShader:
+				/* glsl */
+				"\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t\t}\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t\t#include <begin_vertex>\n\t\t\t\t\t#include <project_vertex>\n\n\t\t\t\t}\n\t\t\t",
+				fragmentShader:
+				/* glsl */
+				"\n\n\t\t\t\tuniform sampler2D tEquirect;\n\n\t\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t\t#include <common>\n\n\t\t\t\tvoid main() {\n\n\t\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t\t}\n\t\t\t"
+			};
+			var geometry = new BoxGeometry(5, 5, 5);
+			var material = new ShaderMaterial({
+				name: 'CubemapFromEquirect',
+				uniforms: cloneUniforms(shader.uniforms),
+				vertexShader: shader.vertexShader,
+				fragmentShader: shader.fragmentShader,
+				side: BackSide,
+				blending: NoBlending
+			});
+			material.uniforms.tEquirect.value = texture;
+			var mesh = new Mesh(geometry, material);
+			var currentMinFilter = texture.minFilter; // Avoid blurred poles
 
-		this.texture.encoding = texture.encoding;
-		this.texture.generateMipmaps = texture.generateMipmaps;
-		this.texture.minFilter = texture.minFilter;
-		this.texture.magFilter = texture.magFilter;
-		var shader = {
-			uniforms: {
-				tEquirect: {
-					value: null
-				}
-			},
-			vertexShader:
-			/* glsl */
-			"\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\tvec3 transformDirection( in vec3 dir, in mat4 matrix ) {\n\n\t\t\t\treturn normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );\n\n\t\t\t}\n\n\t\t\tvoid main() {\n\n\t\t\t\tvWorldDirection = transformDirection( position, modelMatrix );\n\n\t\t\t\t#include <begin_vertex>\n\t\t\t\t#include <project_vertex>\n\n\t\t\t}\n\t\t",
-			fragmentShader:
-			/* glsl */
-			"\n\n\t\t\tuniform sampler2D tEquirect;\n\n\t\t\tvarying vec3 vWorldDirection;\n\n\t\t\t#include <common>\n\n\t\t\tvoid main() {\n\n\t\t\t\tvec3 direction = normalize( vWorldDirection );\n\n\t\t\t\tvec2 sampleUV = equirectUv( direction );\n\n\t\t\t\tgl_FragColor = texture2D( tEquirect, sampleUV );\n\n\t\t\t}\n\t\t"
-		};
-		var geometry = new BoxGeometry(5, 5, 5);
-		var material = new ShaderMaterial({
-			name: 'CubemapFromEquirect',
-			uniforms: cloneUniforms(shader.uniforms),
-			vertexShader: shader.vertexShader,
-			fragmentShader: shader.fragmentShader,
-			side: BackSide,
-			blending: NoBlending
-		});
-		material.uniforms.tEquirect.value = texture;
-		var mesh = new Mesh(geometry, material);
-		var currentMinFilter = texture.minFilter; // Avoid blurred poles
-
-		if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter;
-		var camera = new CubeCamera(1, 10, this);
-		camera.update(renderer, mesh);
-		texture.minFilter = currentMinFilter;
-		mesh.geometry.dispose();
-		mesh.material.dispose();
-		return this;
-	};
+			if (texture.minFilter === LinearMipmapLinearFilter) texture.minFilter = LinearFilter;
+			var camera = new CubeCamera(1, 10, this);
+			camera.update(renderer, mesh);
+			texture.minFilter = currentMinFilter;
+			mesh.geometry.dispose();
+			mesh.material.dispose();
+			return this;
+		};
 
-	WebGLCubeRenderTarget.prototype.clear = function (renderer, color, depth, stencil) {
-		var currentRenderTarget = renderer.getRenderTarget();
+		_proto.clear = function clear(renderer, color, depth, stencil) {
+			var currentRenderTarget = renderer.getRenderTarget();
 
-		for (var i = 0; i < 6; i++) {
-			renderer.setRenderTarget(this, i);
-			renderer.clear(color, depth, stencil);
-		}
+			for (var i = 0; i < 6; i++) {
+				renderer.setRenderTarget(this, i);
+				renderer.clear(color, depth, stencil);
+			}
 
-		renderer.setRenderTarget(currentRenderTarget);
-	};
+			renderer.setRenderTarget(currentRenderTarget);
+		};
+
+		return WebGLCubeRenderTarget;
+	}(WebGLRenderTarget);
 
 	function DataTexture(data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding) {
 		Texture.call(this, null, mapping, wrapS, wrapT, magFilter, minFilter, format, type, anisotropy, encoding);
@@ -17686,7 +17736,9 @@
 			extensions = new WebGLExtensions(_gl);
 			capabilities = new WebGLCapabilities(_gl, extensions, parameters);
 
-			if (capabilities.isWebGL2 === false) {
+			if (capabilities.isWebGL2) {
+				extensions.get('EXT_color_buffer_float');
+			} else {
 				extensions.get('WEBGL_depth_texture');
 				extensions.get('OES_texture_float');
 				extensions.get('OES_texture_half_float');
@@ -17698,6 +17750,7 @@
 			}
 
 			extensions.get('OES_texture_float_linear');
+			extensions.get('EXT_color_buffer_half_float');
 			utils = new WebGLUtils(_gl, extensions, capabilities);
 			state = new WebGLState(_gl, extensions, capabilities);
 			state.scissor(_currentScissor.copy(_scissor).multiplyScalar(_pixelRatio).floor());
@@ -18779,9 +18832,11 @@
 						return;
 					}
 
+					var halfFloatSupportedByExt = textureType === HalfFloatType && (extensions.has('EXT_color_buffer_half_float') || capabilities.isWebGL2 && extensions.has('EXT_color_buffer_float'));
+
 					if (textureType !== UnsignedByteType && utils.convert(textureType) !== _gl.getParameter(35738) && // IE11, Edge and Chrome Mac < 52 (#9513)
-					!(textureType === FloatType && (capabilities.isWebGL2 || extensions.get('OES_texture_float') || extensions.get('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox
-					!(textureType === HalfFloatType && (capabilities.isWebGL2 ? extensions.get('EXT_color_buffer_float') : extensions.get('EXT_color_buffer_half_float')))) {
+					!(textureType === FloatType && (capabilities.isWebGL2 || extensions.has('OES_texture_float') || extensions.has('WEBGL_color_buffer_float'))) && // Chrome Mac >= 52 and Firefox
+					!halfFloatSupportedByExt) {
 						console.error('THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.');
 						return;
 					}
@@ -29796,14 +29851,18 @@
 		}
 	});
 
-	function Font(data) {
-		this.type = 'Font';
-		this.data = data;
-	}
+	var Font = /*#__PURE__*/function () {
+		function Font(data) {
+			Object.defineProperty(this, 'isFont', {
+				value: true
+			});
+			this.type = 'Font';
+			this.data = data;
+		}
 
-	Object.assign(Font.prototype, {
-		isFont: true,
-		generateShapes: function generateShapes(text, size) {
+		var _proto = Font.prototype;
+
+		_proto.generateShapes = function generateShapes(text, size) {
 			if (size === void 0) {
 				size = 100;
 			}
@@ -29816,8 +29875,10 @@
 			}
 
 			return shapes;
-		}
-	});
+		};
+
+		return Font;
+	}();
 
 	function createPaths(text, size, data) {
 		var chars = Array.from ? Array.from(text) : String(text).split(''); // workaround for IE11, see #13988

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


+ 153 - 126
build/three.module.js

@@ -1958,6 +1958,17 @@ class Vector4 {
 
 	}
 
+	multiply( v ) {
+
+		this.x *= v.x;
+		this.y *= v.y;
+		this.z *= v.z;
+		this.w *= v.w;
+
+		return this;
+
+	}
+
 	multiplyScalar( scalar ) {
 
 		this.x *= scalar;
@@ -2377,40 +2388,40 @@ class Vector4 {
  * Texture parameters for an auto-generated target texture
  * depthBuffer/stencilBuffer: Booleans to indicate if we should generate these buffers
 */
-function WebGLRenderTarget( width, height, options ) {
+class WebGLRenderTarget extends EventDispatcher {
 
-	this.width = width;
-	this.height = height;
+	constructor( width, height, options ) {
 
-	this.scissor = new Vector4( 0, 0, width, height );
-	this.scissorTest = false;
+		super();
 
-	this.viewport = new Vector4( 0, 0, width, height );
+		Object.defineProperty( this, 'isWebGLRenderTarget', { value: true } );
 
-	options = options || {};
+		this.width = width;
+		this.height = height;
 
-	this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
+		this.scissor = new Vector4( 0, 0, width, height );
+		this.scissorTest = false;
 
-	this.texture.image = {};
-	this.texture.image.width = width;
-	this.texture.image.height = height;
+		this.viewport = new Vector4( 0, 0, width, height );
 
-	this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
-	this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
+		options = options || {};
 
-	this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
-	this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
-	this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
+		this.texture = new Texture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
 
-}
+		this.texture.image = {};
+		this.texture.image.width = width;
+		this.texture.image.height = height;
 
-WebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prototype ), {
+		this.texture.generateMipmaps = options.generateMipmaps !== undefined ? options.generateMipmaps : false;
+		this.texture.minFilter = options.minFilter !== undefined ? options.minFilter : LinearFilter;
 
-	constructor: WebGLRenderTarget,
+		this.depthBuffer = options.depthBuffer !== undefined ? options.depthBuffer : true;
+		this.stencilBuffer = options.stencilBuffer !== undefined ? options.stencilBuffer : false;
+		this.depthTexture = options.depthTexture !== undefined ? options.depthTexture : null;
 
-	isWebGLRenderTarget: true,
+	}
 
-	setSize: function ( width, height ) {
+	setSize( width, height ) {
 
 		if ( this.width !== width || this.height !== height ) {
 
@@ -2427,15 +2438,15 @@ WebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prot
 		this.viewport.set( 0, 0, width, height );
 		this.scissor.set( 0, 0, width, height );
 
-	},
+	}
 
-	clone: function () {
+	clone() {
 
 		return new this.constructor().copy( this );
 
-	},
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
 		this.width = source.width;
 		this.height = source.height;
@@ -2450,33 +2461,31 @@ WebGLRenderTarget.prototype = Object.assign( Object.create( EventDispatcher.prot
 
 		return this;
 
-	},
+	}
 
-	dispose: function () {
+	dispose() {
 
 		this.dispatchEvent( { type: 'dispose' } );
 
 	}
 
-} );
+}
 
-function WebGLMultisampleRenderTarget( width, height, options ) {
+class WebGLMultisampleRenderTarget extends WebGLRenderTarget {
 
-	WebGLRenderTarget.call( this, width, height, options );
+	constructor( width, height, options ) {
 
-	this.samples = 4;
+		super( width, height, options );
 
-}
+		Object.defineProperty( this, 'isWebGLMultisampleRenderTarget', { value: true } );
 
-WebGLMultisampleRenderTarget.prototype = Object.assign( Object.create( WebGLRenderTarget.prototype ), {
+		this.samples = 4;
 
-	constructor: WebGLMultisampleRenderTarget,
-
-	isWebGLMultisampleRenderTarget: true,
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
-		WebGLRenderTarget.prototype.copy.call( this, source );
+		super.copy.call( this, source );
 
 		this.samples = source.samples;
 
@@ -2484,7 +2493,7 @@ WebGLMultisampleRenderTarget.prototype = Object.assign( Object.create( WebGLRend
 
 	}
 
-} );
+}
 
 class Quaternion {
 
@@ -8302,6 +8311,16 @@ class Color {
 
 	}
 
+	lerpColors( color1, color2, alpha ) {
+
+		this.r = color1.r + ( color2.r - color1.r ) * alpha;
+		this.g = color1.g + ( color2.g - color1.g ) * alpha;
+		this.b = color1.b + ( color2.b - color1.b ) * alpha;
+
+		return this;
+
+	}
+
 	lerpHSL( color, alpha ) {
 
 		this.getHSL( _hslA );
@@ -12005,7 +12024,7 @@ PerspectiveCamera.prototype = Object.assign( Object.create( Camera.prototype ),
 	 */
 	setFocalLength: function ( focalLength ) {
 
-		// see http://www.bobatkins.com/photography/technical/field_of_view.html
+		/** see {@link http://www.bobatkins.com/photography/technical/field_of_view.html} */
 		const vExtentSlope = 0.5 * this.getFilmHeight() / focalLength;
 
 		this.fov = MathUtils.RAD2DEG * 2 * Math.atan( vExtentSlope );
@@ -12318,137 +12337,138 @@ Object.defineProperty( CubeTexture.prototype, 'images', {
 
 } );
 
-function WebGLCubeRenderTarget( size, options, dummy ) {
+class WebGLCubeRenderTarget extends WebGLRenderTarget {
 
-	if ( Number.isInteger( options ) ) {
+	constructor( size, options, dummy ) {
 
-		console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );
+		if ( Number.isInteger( options ) ) {
 
-		options = dummy;
+			console.warn( 'THREE.WebGLCubeRenderTarget: constructor signature is now WebGLCubeRenderTarget( size, options )' );
 
-	}
+			options = dummy;
 
-	WebGLRenderTarget.call( this, size, size, options );
+		}
 
-	options = options || {};
+		super( size, size, options );
 
-	this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
+		Object.defineProperty( this, 'isWebGLCubeRenderTarget', { value: true } );
 
-	this.texture._needsFlipEnvMap = false;
+		options = options || {};
 
-}
+		this.texture = new CubeTexture( undefined, options.mapping, options.wrapS, options.wrapT, options.magFilter, options.minFilter, options.format, options.type, options.anisotropy, options.encoding );
 
-WebGLCubeRenderTarget.prototype = Object.create( WebGLRenderTarget.prototype );
-WebGLCubeRenderTarget.prototype.constructor = WebGLCubeRenderTarget;
+		this.texture._needsFlipEnvMap = false;
 
-WebGLCubeRenderTarget.prototype.isWebGLCubeRenderTarget = true;
+	}
 
-WebGLCubeRenderTarget.prototype.fromEquirectangularTexture = function ( renderer, texture ) {
+	fromEquirectangularTexture( renderer, texture ) {
 
-	this.texture.type = texture.type;
-	this.texture.format = RGBAFormat; // see #18859
-	this.texture.encoding = texture.encoding;
+		this.texture.type = texture.type;
+		this.texture.format = RGBAFormat; // see #18859
+		this.texture.encoding = texture.encoding;
 
-	this.texture.generateMipmaps = texture.generateMipmaps;
-	this.texture.minFilter = texture.minFilter;
-	this.texture.magFilter = texture.magFilter;
+		this.texture.generateMipmaps = texture.generateMipmaps;
+		this.texture.minFilter = texture.minFilter;
+		this.texture.magFilter = texture.magFilter;
 
-	const shader = {
+		const shader = {
 
-		uniforms: {
-			tEquirect: { value: null },
-		},
+			uniforms: {
+				tEquirect: { value: null },
+			},
 
-		vertexShader: /* glsl */`
+			vertexShader: /* glsl */`
 
-			varying vec3 vWorldDirection;
+				varying vec3 vWorldDirection;
 
-			vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
+				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
 
-				return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
+					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
 
-			}
+				}
 
-			void main() {
+				void main() {
 
-				vWorldDirection = transformDirection( position, modelMatrix );
+					vWorldDirection = transformDirection( position, modelMatrix );
 
-				#include <begin_vertex>
-				#include <project_vertex>
+					#include <begin_vertex>
+					#include <project_vertex>
 
-			}
-		`,
+				}
+			`,
 
-		fragmentShader: /* glsl */`
+			fragmentShader: /* glsl */`
 
-			uniform sampler2D tEquirect;
+				uniform sampler2D tEquirect;
 
-			varying vec3 vWorldDirection;
+				varying vec3 vWorldDirection;
 
-			#include <common>
+				#include <common>
 
-			void main() {
+				void main() {
 
-				vec3 direction = normalize( vWorldDirection );
+					vec3 direction = normalize( vWorldDirection );
 
-				vec2 sampleUV = equirectUv( direction );
+					vec2 sampleUV = equirectUv( direction );
 
-				gl_FragColor = texture2D( tEquirect, sampleUV );
+					gl_FragColor = texture2D( tEquirect, sampleUV );
 
-			}
-		`
-	};
+				}
+			`
+		};
 
-	const geometry = new BoxGeometry( 5, 5, 5 );
+		const geometry = new BoxGeometry( 5, 5, 5 );
 
-	const material = new ShaderMaterial( {
+		const material = new ShaderMaterial( {
 
-		name: 'CubemapFromEquirect',
+			name: 'CubemapFromEquirect',
 
-		uniforms: cloneUniforms( shader.uniforms ),
-		vertexShader: shader.vertexShader,
-		fragmentShader: shader.fragmentShader,
-		side: BackSide,
-		blending: NoBlending
+			uniforms: cloneUniforms( shader.uniforms ),
+			vertexShader: shader.vertexShader,
+			fragmentShader: shader.fragmentShader,
+			side: BackSide,
+			blending: NoBlending
 
-	} );
+		} );
 
-	material.uniforms.tEquirect.value = texture;
+		material.uniforms.tEquirect.value = texture;
 
-	const mesh = new Mesh( geometry, material );
+		const mesh = new Mesh( geometry, material );
 
-	const currentMinFilter = texture.minFilter;
+		const currentMinFilter = texture.minFilter;
 
-	// Avoid blurred poles
-	if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;
+		// Avoid blurred poles
+		if ( texture.minFilter === LinearMipmapLinearFilter ) texture.minFilter = LinearFilter;
 
-	const camera = new CubeCamera( 1, 10, this );
-	camera.update( renderer, mesh );
+		const camera = new CubeCamera( 1, 10, this );
+		camera.update( renderer, mesh );
 
-	texture.minFilter = currentMinFilter;
+		texture.minFilter = currentMinFilter;
 
-	mesh.geometry.dispose();
-	mesh.material.dispose();
+		mesh.geometry.dispose();
+		mesh.material.dispose();
 
-	return this;
+		return this;
 
-};
+	}
 
-WebGLCubeRenderTarget.prototype.clear = function ( renderer, color, depth, stencil ) {
+	clear( renderer, color, depth, stencil ) {
 
-	const currentRenderTarget = renderer.getRenderTarget();
+		const currentRenderTarget = renderer.getRenderTarget();
 
-	for ( let i = 0; i < 6; i ++ ) {
+		for ( let i = 0; i < 6; i ++ ) {
 
-		renderer.setRenderTarget( this, i );
+			renderer.setRenderTarget( this, i );
 
-		renderer.clear( color, depth, stencil );
+			renderer.clear( color, depth, stencil );
 
-	}
+		}
 
-	renderer.setRenderTarget( currentRenderTarget );
+		renderer.setRenderTarget( currentRenderTarget );
 
-};
+	}
+
+}
 
 function DataTexture( data, width, height, format, type, mapping, wrapS, wrapT, magFilter, minFilter, anisotropy, encoding ) {
 
@@ -23520,7 +23540,11 @@ function WebGLRenderer( parameters ) {
 
 		capabilities = new WebGLCapabilities( _gl, extensions, parameters );
 
-		if ( capabilities.isWebGL2 === false ) {
+		if ( capabilities.isWebGL2 ) {
+
+			extensions.get( 'EXT_color_buffer_float' );
+
+		} else {
 
 			extensions.get( 'WEBGL_depth_texture' );
 			extensions.get( 'OES_texture_float' );
@@ -23534,6 +23558,7 @@ function WebGLRenderer( parameters ) {
 		}
 
 		extensions.get( 'OES_texture_float_linear' );
+		extensions.get( 'EXT_color_buffer_half_float' );
 
 		utils = new WebGLUtils( _gl, extensions, capabilities );
 
@@ -25133,9 +25158,11 @@ function WebGLRenderer( parameters ) {
 
 				}
 
+				const halfFloatSupportedByExt = ( textureType === HalfFloatType ) && ( extensions.has( 'EXT_color_buffer_half_float' ) || ( capabilities.isWebGL2 && extensions.has( 'EXT_color_buffer_float' ) ) );
+
 				if ( textureType !== UnsignedByteType && utils.convert( textureType ) !== _gl.getParameter( 35738 ) && // IE11, Edge and Chrome Mac < 52 (#9513)
-					! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.get( 'OES_texture_float' ) || extensions.get( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
-					! ( textureType === HalfFloatType && ( capabilities.isWebGL2 ? extensions.get( 'EXT_color_buffer_float' ) : extensions.get( 'EXT_color_buffer_half_float' ) ) ) ) {
+					! ( textureType === FloatType && ( capabilities.isWebGL2 || extensions.has( 'OES_texture_float' ) || extensions.has( 'WEBGL_color_buffer_float' ) ) ) && // Chrome Mac >= 52 and Firefox
+					! halfFloatSupportedByExt ) {
 
 					console.error( 'THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not in UnsignedByteType or implementation defined type.' );
 					return;
@@ -40356,19 +40383,19 @@ Object.assign( ShapePath.prototype, {
 
 } );
 
-function Font( data ) {
+class Font {
 
-	this.type = 'Font';
+	constructor( data ) {
 
-	this.data = data;
+		Object.defineProperty( this, 'isFont', { value: true } );
 
-}
+		this.type = 'Font';
 
-Object.assign( Font.prototype, {
+		this.data = data;
 
-	isFont: true,
+	}
 
-	generateShapes: function ( text, size = 100 ) {
+	generateShapes( text, size = 100 ) {
 
 		const shapes = [];
 		const paths = createPaths( text, size, this.data );
@@ -40383,7 +40410,7 @@ Object.assign( Font.prototype, {
 
 	}
 
-} );
+}
 
 function createPaths( text, size, data ) {
 

+ 11 - 0
docs/api/en/math/Color.html

@@ -218,6 +218,17 @@ const color7 = new THREE.Color( 1, 0, 0 );
 		this color and 1.0 is the first argument.
 		</p>
 
+		<h3>[method:this lerpColors]( [param:Color color1], [param:Color color2], [param:Float alpha] )</h3>
+		<p>
+		[page:Color color1] - the starting [page:Color].<br />
+		[page:Color color2] - [page:Color] to interpolate towards.<br />
+		[page:Float alpha] - interpolation factor, typically in the closed interval [0, 1].<br /><br />
+
+		Sets this color to be the color linearly interpolated between [page:Color color1] and
+		[page:Color color2] where alpha is the percent distance along the line connecting the two colors
+		- alpha = 0 will be [page:Color color1], and alpha = 1 will be [page:Color color2].
+		</p>
+
 		<h3>[method:Color lerpHSL]( [param:Color color], [param:Float alpha] ) </h3>
 		<p>
 		[page:Color color] - color to converge on.<br />

+ 3 - 0
docs/api/en/math/Vector4.html

@@ -241,6 +241,9 @@
 		that value with the corresponding min value.
 		</p>
 
+		<h3>[method:this multiply]( [param:Vector4 v] )</h3>
+		<p>Multiplies this vector by [page:Vector4 v].</p>
+
 		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>Multiplies this vector by scalar [page:Float s].</p>
 

+ 1 - 1
docs/api/zh/constants/Textures.html

@@ -9,7 +9,7 @@
 </head>
 
 <body>
-	<h1>材质常量(Texture Constants)</h1>
+	<h1>纹理常量(Texture Constants)</h1>
 
 	<h2>映射模式</h2>
 	<code>

+ 3 - 0
docs/api/zh/math/Vector4.html

@@ -240,6 +240,9 @@
 		则将该值替换为对应的最小值。
 		</p>
 
+		<h3>[method:this multiply]( [param:Vector4 v] )</h3>
+		<p>将该向量与所传入的向量[page:Vector4 v]进行相乘。</p>
+
 		<h3>[method:this multiplyScalar]( [param:Float s] )</h3>
 		<p>将该向量与所传入的标量[page:Float s]进行相乘。</p>
 

+ 5 - 5
docs/examples/en/controls/OrbitControls.html

@@ -115,11 +115,6 @@
 			Note that if this is enabled, you must call [page:.update] () in your animation loop.
 		</p>
 
-		<h3>[property:Boolean enableKeys]</h3>
-		<p>
-			Enable or disable the use of keyboard controls.
-		</p>
-
 		<h3>[property:Boolean enablePan]</h3>
 		<p>
 			Enable or disable camera panning. Default is true.
@@ -288,6 +283,11 @@ controls.touches = {
 			Get the current vertical rotation, in radians.
 		</p>
 
+		<h3>[method:void listenToKeyEvents] ( [param:HTMLDOMElement domElement] )</h3>
+		<p>
+			Adds key event listeners to the given DOM element. *window* is a recommended argument for using this method.
+		</p>
+
 		<h3>[method:null reset] ()</h3>
 		<p>
 			Reset the controls to their state from either the last time the [page:.saveState] was called, or the initial state.

+ 9 - 9
docs/examples/ko/controls/OrbitControls.html

@@ -80,7 +80,7 @@
 		<h3>[property:Boolean autoRotate]</h3>
 		<p>
 			대상 주위를 자동으로 회전하려면 true로 설정합니다.<br> autoRotate를 활성할 경우, 애니메이션 루프에서 [page:.update()]를 호출해야 합니다.
-			
+
 		</p>
 
 		<h3>[property:Float autoRotateSpeed]</h3>
@@ -110,11 +110,6 @@
 			만약 enableDamping을 활성화 할 경우, 애니메이션 루프에서 [page:.update]를 호출해야 합니다.
 		</p>
 
-		<h3>[property:Boolean enableKeys]</h3>
-		<p>
-			키보드 컨트롤의 활성화 또는 비활성화를 설정합니다. 기본값은 *true* 입니다.
-		</p>
-
 		<h3>[property:Boolean enablePan]</h3>
 		<p>
 			카매라 패닝의 활성화 또는 비활성화를 설정합니다. 기본값은 *true* 입니다.
@@ -123,9 +118,9 @@
 		<h3>[property:Boolean enableRotate]</h3>
 		<p>
 			카메라의 수직 및 수평 회전의 활성화 또는 비활성화를 설정합니다. 기본값은 *true* 입니다.<br>
-			[page:.minPolarAngle polar angle] 또는 page:.minAzimuthAngle azimuth angle]의 최소 및 최대를 동일한 값으로 설정하여 단일 축을 비활성화 할 수 있습니다. 
+			[page:.minPolarAngle polar angle] 또는 page:.minAzimuthAngle azimuth angle]의 최소 및 최대를 동일한 값으로 설정하여 단일 축을 비활성화 할 수 있습니다.
 			그러면 수직 또는 수평 회전이 해당 값으로 고정됩니다.
-			
+
 		</p>
 
 		<h3>[property:Boolean enableZoom]</h3>
@@ -148,7 +143,7 @@ controls.keys = {
 	RIGHT: 39, // 오른쪽 화살표
 	BOTTOM: 40 // 아래쪽 화살표
 }
-			 </code> 
+			 </code>
 			 전체 키코드 목록은 [link:https://developer.mozilla.org/ko/docs/Web/API/KeyboardEvent/keyCode this page] 를 참조하세요.
 		</p>
 
@@ -283,6 +278,11 @@ controls.touches = {
 			라디안 단위로 현재 수직 회전값을 가져옵니다.
 		</p>
 
+		<h3>[method:void listenToKeyEvents] ( [param:HTMLDOMElement domElement] )</h3>
+		<p>
+			Adds key event listeners to the given DOM element. *window* is a recommended argument for using this method.
+		</p>
+
 		<h3>[method:null reset] ()</h3>
 		<p>
 			컨트롤이 마지막으로 호출된 [page:.saveState] 시점으로 돌리거나, 초기상태로 재설정합니다.

+ 5 - 5
docs/examples/zh/controls/OrbitControls.html

@@ -113,11 +113,6 @@
 			请注意,如果该值被启用,你将必须在你的动画循环里调用[page:.update]()。
 		</p>
 
-		<h3>[property:Boolean enableKeys]</h3>
-		<p>
-			启用或禁用键盘控制。
-		</p>
-
 		<h3>[property:Boolean enablePan]</h3>
 		<p>
 			启用或禁用摄像机平移,默认为true。
@@ -288,6 +283,11 @@ controls.touches = {
 			获得当前的垂直旋转,单位为弧度。
 		</p>
 
+		<h3>[method:void listenToKeyEvents] ( [param:HTMLDOMElement domElement] )</h3>
+		<p>
+			Adds key event listeners to the given DOM element. *window* is a recommended argument for using this method.
+		</p>
+
 		<h3>[method:null reset] ()</h3>
 		<p>
 			将控制器重置为上次调用[page:.saveState]时的状态,或者初始状态。

+ 6 - 6
editor/examples/arkanoid.app.json

@@ -37,7 +37,7 @@
 		"geometries": [
 			{
 				"uuid": "BBEE74D1-E43D-4C32-A9F3-4656E78C26F3",
-				"type": "PlaneBufferGeometry",
+				"type": "PlaneGeometry",
 				"width": 30,
 				"height": 40,
 				"widthSegments": 1,
@@ -45,7 +45,7 @@
 			},
 			{
 				"uuid": "C1722F5F-89AD-45D8-B78C-D1D34AF2A012",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 2,
 				"height": 1,
 				"depth": 1,
@@ -55,7 +55,7 @@
 			},
 			{
 				"uuid": "327EFFCF-649C-4EF3-86D4-B422C5A86E89",
-				"type": "CylinderBufferGeometry",
+				"type": "CylinderGeometry",
 				"radiusTop": 0.5,
 				"radiusBottom": 0.5,
 				"height": 2,
@@ -65,7 +65,7 @@
 			},
 			{
 				"uuid": "0791211B-BB02-4E57-82B5-64C05DE92B39",
-				"type": "SphereBufferGeometry",
+				"type": "SphereGeometry",
 				"radius": 0.5,
 				"widthSegments": 32,
 				"heightSegments": 16,
@@ -76,7 +76,7 @@
 			},
 			{
 				"uuid": "73F12A47-9EA7-47FD-BCF3-89B8219B2626",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 2,
 				"height": 1,
 				"depth": 1,
@@ -86,7 +86,7 @@
 			},
 			{
 				"uuid": "3BDEB9FB-BDD4-44AD-8A47-008BED1C8982",
-				"type": "CylinderBufferGeometry",
+				"type": "CylinderGeometry",
 				"radiusTop": 0.5,
 				"radiusBottom": 0.5,
 				"height": 2,

+ 4 - 4
editor/examples/camera.app.json

@@ -37,7 +37,7 @@
 		"geometries": [
 			{
 				"uuid": "6D90C4BE-EBA6-4E21-8F54-7CFDAA61F30B",
-				"type": "PlaneBufferGeometry",
+				"type": "PlaneGeometry",
 				"width": 10,
 				"height": 10,
 				"widthSegments": 1,
@@ -45,7 +45,7 @@
 			},
 			{
 				"uuid": "D3008B2A-ACDD-43CC-87F7-4F942607D21A",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 1,
 				"height": 1,
 				"depth": 1,
@@ -55,7 +55,7 @@
 			},
 			{
 				"uuid": "F482ACD4-013A-49CF-AE0F-C9FF4ADAE409",
-				"type": "CylinderBufferGeometry",
+				"type": "CylinderGeometry",
 				"radiusTop": 0,
 				"radiusBottom": 0.4,
 				"height": 0.75,
@@ -65,7 +65,7 @@
 			},
 			{
 				"uuid": "51CDDCED-BC71-4B1B-A485-725B6A48204B",
-				"type": "IcosahedronBufferGeometry",
+				"type": "IcosahedronGeometry",
 				"radius": 0.4,
 				"detail": 2
 			}],

+ 1 - 1
editor/examples/particles.app.json

@@ -37,7 +37,7 @@
 		"geometries": [
 			{
 				"uuid": "C3C0CE7D-10B8-43FC-8F74-011CC6E57800",
-				"type": "PlaneBufferGeometry",
+				"type": "PlaneGeometry",
 				"width": 100,
 				"height": 100,
 				"widthSegments": 1,

+ 4 - 4
editor/examples/pong.app.json

@@ -37,7 +37,7 @@
 		"geometries": [
 			{
 				"uuid": "490CEBA3-6A25-4BE1-B517-C5FB11A5D18A",
-				"type": "PlaneBufferGeometry",
+				"type": "PlaneGeometry",
 				"width": 6,
 				"height": 4,
 				"widthSegments": 1,
@@ -45,7 +45,7 @@
 			},
 			{
 				"uuid": "D9A92F2D-2F08-4851-99C7-12D8D1CA13C7",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 0.1,
 				"height": 0.1,
 				"depth": 0.1,
@@ -55,7 +55,7 @@
 			},
 			{
 				"uuid": "5E63B8CF-E225-4ABC-994A-4D06BD4E21EB",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 0.2,
 				"height": 0.2,
 				"depth": 1,
@@ -65,7 +65,7 @@
 			},
 			{
 				"uuid": "D61532B4-24C3-4BC4-B56B-7245E8163E09",
-				"type": "BoxBufferGeometry",
+				"type": "BoxGeometry",
 				"width": 0.2,
 				"height": 0.2,
 				"depth": 1,

+ 1 - 1
editor/examples/shaders.app.json

@@ -37,7 +37,7 @@
 		"geometries": [
 			{
 				"uuid": "EA781333-F3AE-470D-9110-A9724FCB42AA",
-				"type": "IcosahedronBufferGeometry",
+				"type": "IcosahedronGeometry",
 				"radius": 1,
 				"detail": 4
 			}],

+ 3 - 3
editor/js/Editor.js

@@ -388,7 +388,7 @@ Editor.prototype = {
 
 	addHelper: function () {
 
-		var geometry = new THREE.SphereBufferGeometry( 2, 4, 2 );
+		var geometry = new THREE.SphereGeometry( 2, 4, 2 );
 		var material = new THREE.MeshBasicMaterial( { color: 0xff0000, visible: false } );
 
 		return function ( object, helper ) {
@@ -554,7 +554,7 @@ Editor.prototype = {
 
 		}
 
-		this.select( this.scene.getObjectById( id, true ) );
+		this.select( this.scene.getObjectById( id ) );
 
 	},
 
@@ -592,7 +592,7 @@ Editor.prototype = {
 
 	focusById: function ( id ) {
 
-		this.focus( this.scene.getObjectById( id, true ) );
+		this.focus( this.scene.getObjectById( id ) );
 
 	},
 

+ 1 - 1
editor/js/Loader.js

@@ -498,7 +498,7 @@ function Loader( editor ) {
 
 							var shape = shapes[ j ];
 
-							var geometry = new THREE.ShapeBufferGeometry( shape );
+							var geometry = new THREE.ShapeGeometry( shape );
 							var mesh = new THREE.Mesh( geometry, material );
 
 							group.add( mesh );

+ 15 - 15
editor/js/Menubar.Add.js

@@ -46,7 +46,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/box' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.BoxBufferGeometry( 1, 1, 1, 1, 1, 1 );
+		var geometry = new THREE.BoxGeometry( 1, 1, 1, 1, 1, 1 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Box';
 
@@ -62,7 +62,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/circle' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.CircleBufferGeometry( 1, 8, 0, Math.PI * 2 );
+		var geometry = new THREE.CircleGeometry( 1, 8, 0, Math.PI * 2 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Circle';
 
@@ -78,7 +78,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/cylinder' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.CylinderBufferGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
+		var geometry = new THREE.CylinderGeometry( 1, 1, 1, 8, 1, false, 0, Math.PI * 2 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Cylinder';
 
@@ -94,7 +94,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/dodecahedron' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.DodecahedronBufferGeometry( 1, 0 );
+		var geometry = new THREE.DodecahedronGeometry( 1, 0 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Dodecahedron';
 
@@ -110,7 +110,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/icosahedron' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.IcosahedronBufferGeometry( 1, 0 );
+		var geometry = new THREE.IcosahedronGeometry( 1, 0 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Icosahedron';
 
@@ -140,7 +140,7 @@ function MenubarAdd( editor ) {
 			new THREE.Vector2( 0.3, 1.2 )
 		];
 
-		var geometry = new THREE.LatheBufferGeometry( points, 12, 0, Math.PI * 2 );
+		var geometry = new THREE.LatheGeometry( points, 12, 0, Math.PI * 2 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial( { side: THREE.DoubleSide } ) );
 		mesh.name = 'Lathe';
 
@@ -156,7 +156,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/octahedron' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.OctahedronBufferGeometry( 1, 0 );
+		var geometry = new THREE.OctahedronGeometry( 1, 0 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Octahedron';
 
@@ -172,7 +172,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/plane' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.PlaneBufferGeometry( 1, 1, 1, 1 );
+		var geometry = new THREE.PlaneGeometry( 1, 1, 1, 1 );
 		var material = new THREE.MeshStandardMaterial();
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.name = 'Plane';
@@ -189,7 +189,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/ring' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.RingBufferGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
+		var geometry = new THREE.RingGeometry( 0.5, 1, 8, 1, 0, Math.PI * 2 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Ring';
 
@@ -205,7 +205,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/sphere' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.SphereBufferGeometry( 1, 8, 6, 0, Math.PI * 2, 0, Math.PI );
+		var geometry = new THREE.SphereGeometry( 1, 8, 6, 0, Math.PI * 2, 0, Math.PI );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Sphere';
 
@@ -236,7 +236,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/tetrahedron' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.TetrahedronBufferGeometry( 1, 0 );
+		var geometry = new THREE.TetrahedronGeometry( 1, 0 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Tetrahedron';
 
@@ -252,7 +252,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/torus' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.TorusBufferGeometry( 1, 0.4, 8, 6, Math.PI * 2 );
+		var geometry = new THREE.TorusGeometry( 1, 0.4, 8, 6, Math.PI * 2 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Torus';
 
@@ -268,7 +268,7 @@ function MenubarAdd( editor ) {
 	option.setTextContent( strings.getKey( 'menubar/add/torusknot' ) );
 	option.onClick( function () {
 
-		var geometry = new THREE.TorusKnotBufferGeometry( 1, 0.4, 64, 8, 2, 3 );
+		var geometry = new THREE.TorusKnotGeometry( 1, 0.4, 64, 8, 2, 3 );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'TorusKnot';
 
@@ -291,7 +291,7 @@ function MenubarAdd( editor ) {
 			new THREE.Vector3( - 2, 2, 2 )
 		] );
 
-		var geometry = new THREE.TubeBufferGeometry( path, 64, 1, 8, false );
+		var geometry = new THREE.TubeGeometry( path, 64, 1, 8, false );
 		var mesh = new THREE.Mesh( geometry, new THREE.MeshStandardMaterial() );
 		mesh.name = 'Tube';
 
@@ -318,7 +318,7 @@ function MenubarAdd( editor ) {
 
 		var material = new THREE.MeshStandardMaterial();
 
-		var geometry = new TeapotBufferGeometry( size, segments, bottom, lid, body, fitLid, blinnScale );
+		var geometry = new TeapotGeometry( size, segments, bottom, lid, body, fitLid, blinnScale );
 		var mesh = new THREE.Mesh( geometry, material );
 		mesh.name = 'Teapot';
 

+ 1 - 1
editor/js/Sidebar.Geometry.BoxBufferGeometry.js → editor/js/Sidebar.Geometry.BoxGeometry.js

@@ -77,7 +77,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.BoxBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.BoxGeometry(
 			width.getValue(),
 			height.getValue(),
 			depth.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.CircleBufferGeometry.js → editor/js/Sidebar.Geometry.CircleGeometry.js

@@ -57,7 +57,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.CircleBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.CircleGeometry(
 			radius.getValue(),
 			segments.getValue(),
 			thetaStart.getValue() * THREE.MathUtils.DEG2RAD,

+ 1 - 1
editor/js/Sidebar.Geometry.CylinderBufferGeometry.js → editor/js/Sidebar.Geometry.CylinderGeometry.js

@@ -77,7 +77,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.CylinderBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.CylinderGeometry(
 			radiusTop.getValue(),
 			radiusBottom.getValue(),
 			height.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.DodecahedronBufferGeometry.js → editor/js/Sidebar.Geometry.DodecahedronGeometry.js

@@ -37,7 +37,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.DodecahedronBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.DodecahedronGeometry(
 			radius.getValue(),
 			detail.getValue()
 		) ) );

+ 2 - 2
editor/js/Sidebar.Geometry.ExtrudeBufferGeometry.js → editor/js/Sidebar.Geometry.ExtrudeGeometry.js

@@ -113,7 +113,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeGeometry(
 			parameters.shapes,
 			{
 				curveSegments: curveSegments.getValue(),
@@ -131,7 +131,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function toShape() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeGeometry(
 			parameters.shapes,
 			options.curveSegments
 		) ) );

+ 1 - 1
editor/js/Sidebar.Geometry.IcosahedronBufferGeometry.js → editor/js/Sidebar.Geometry.IcosahedronGeometry.js

@@ -39,7 +39,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.IcosahedronBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.IcosahedronGeometry(
 			radius.getValue(),
 			detail.getValue()
 		) ) );

+ 1 - 1
editor/js/Sidebar.Geometry.LatheBufferGeometry.js → editor/js/Sidebar.Geometry.LatheGeometry.js

@@ -56,7 +56,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.LatheBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.LatheGeometry(
 			points.getValue(),
 			segments.getValue(),
 			phiStart.getValue() / 180 * Math.PI,

+ 1 - 1
editor/js/Sidebar.Geometry.OctahedronBufferGeometry.js → editor/js/Sidebar.Geometry.OctahedronGeometry.js

@@ -40,7 +40,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.OctahedronBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.OctahedronGeometry(
 			radius.getValue(),
 			detail.getValue()
 		) ) );

+ 1 - 1
editor/js/Sidebar.Geometry.PlaneBufferGeometry.js → editor/js/Sidebar.Geometry.PlaneGeometry.js

@@ -58,7 +58,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.PlaneBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.PlaneGeometry(
 			width.getValue(),
 			height.getValue(),
 			widthSegments.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.RingBufferGeometry.js → editor/js/Sidebar.Geometry.RingGeometry.js

@@ -77,7 +77,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.RingBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.RingGeometry(
 			innerRadius.getValue(),
 			outerRadius.getValue(),
 			thetaSegments.getValue(),

+ 2 - 2
editor/js/Sidebar.Geometry.ShapeBufferGeometry.js → editor/js/Sidebar.Geometry.ShapeGeometry.js

@@ -31,7 +31,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function changeShape() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeGeometry(
 			parameters.shapes,
 			curveSegments.getValue()
 		) ) );
@@ -40,7 +40,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function toExtrude() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeGeometry(
 			parameters.shapes, {
 				curveSegments: curveSegments.getValue()
 			}

+ 1 - 1
editor/js/Sidebar.Geometry.SphereBufferGeometry.js → editor/js/Sidebar.Geometry.SphereGeometry.js

@@ -88,7 +88,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.SphereBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.SphereGeometry(
 			radius.getValue(),
 			widthSegments.getValue(),
 			heightSegments.getValue(),

+ 2 - 2
editor/js/Sidebar.Geometry.TeapotBufferGeometry.js → editor/js/Sidebar.Geometry.TeapotGeometry.js

@@ -1,6 +1,6 @@
 import { UIRow, UIText, UIInteger, UICheckbox, UINumber } from './libs/ui.js';
 
-import { TeapotBufferGeometry } from '../../examples/jsm/geometries/TeapotBufferGeometry.js';
+import { TeapotGeometry } from '../../examples/jsm/geometries/TeapotGeometry.js';
 
 function GeometryParametersPanel( signals, object ) {
 
@@ -82,7 +82,7 @@ function GeometryParametersPanel( signals, object ) {
 
 		object.geometry.dispose();
 
-		object.geometry = new TeapotBufferGeometry(
+		object.geometry = new TeapotGeometry(
 			size.getValue(),
 			segments.getValue(),
 			bottom.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.TetrahedronBufferGeometry.js → editor/js/Sidebar.Geometry.TetrahedronGeometry.js

@@ -40,7 +40,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.TetrahedronBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.TetrahedronGeometry(
 			radius.getValue(),
 			detail.getValue()
 		) ) );

+ 1 - 1
editor/js/Sidebar.Geometry.TorusBufferGeometry.js → editor/js/Sidebar.Geometry.TorusGeometry.js

@@ -68,7 +68,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.TorusBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.TorusGeometry(
 			radius.getValue(),
 			tube.getValue(),
 			radialSegments.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.TorusKnotBufferGeometry.js → editor/js/Sidebar.Geometry.TorusKnotGeometry.js

@@ -78,7 +78,7 @@ function GeometryParametersPanel( editor, object ) {
 
 	function update() {
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.TorusKnotBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.TorusKnotGeometry(
 			radius.getValue(),
 			tube.getValue(),
 			tubularSegments.getValue(),

+ 1 - 1
editor/js/Sidebar.Geometry.TubeBufferGeometry.js → editor/js/Sidebar.Geometry.TubeGeometry.js

@@ -88,7 +88,7 @@ function GeometryParametersPanel( editor, object ) {
 
 		tensionRow.setDisplay( curveType.getValue() == 'catmullrom' ? '' : 'none' );
 
-		editor.execute( new SetGeometryCommand( editor, object, new THREE.TubeBufferGeometry(
+		editor.execute( new SetGeometryCommand( editor, object, new THREE.TubeGeometry(
 			new THREE.CatmullRomCurve3( points.getValue(), closed.getValue(), curveType.getValue(), tension.getValue() ),
 			tubularSegments.getValue(),
 			radius.getValue(),

+ 1 - 1
editor/js/Viewport.ViewHelper.js

@@ -47,7 +47,7 @@ function ViewHelper( editorCamera, container ) {
 	var camera = new THREE.OrthographicCamera( - 2, 2, 2, - 2, 0, 4 );
 	camera.position.set( 0, 0, 2 );
 
-	var geometry = new THREE.BoxBufferGeometry( 0.8, 0.05, 0.05 ).translate( 0.4, 0, 0 );
+	var geometry = new THREE.BoxGeometry( 0.8, 0.05, 0.05 ).translate( 0.4, 0, 0 );
 
 	var xAxis = new THREE.Mesh( geometry, getAxisMaterial( color1 ) );
 	var yAxis = new THREE.Mesh( geometry, getAxisMaterial( color2 ) );

+ 1 - 1
editor/js/libs/ui.three.js

@@ -943,7 +943,7 @@ function renderToCanvas( texture ) {
 	var camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
 
 	var material = new THREE.MeshBasicMaterial( { map: texture } );
-	var quad = new THREE.PlaneBufferGeometry( 2, 2 );
+	var quad = new THREE.PlaneGeometry( 2, 2 );
 	var mesh = new THREE.Mesh( quad, material );
 	scene.add( mesh );
 

+ 18 - 18
editor/sw.js

@@ -61,7 +61,7 @@ const assets = [
 
 	'../examples/jsm/helpers/VertexNormalsHelper.js',
 
-	'../examples/jsm/geometries/TeapotBufferGeometry.js',
+	'../examples/jsm/geometries/TeapotGeometry.js',
 
 	'../examples/jsm/webxr/VRButton.js',
 
@@ -140,23 +140,23 @@ const assets = [
 	'./js/Sidebar.Geometry.Geometry.js',
 	'./js/Sidebar.Geometry.BufferGeometry.js',
 	'./js/Sidebar.Geometry.Modifiers.js',
-	'./js/Sidebar.Geometry.BoxBufferGeometry.js',
-	'./js/Sidebar.Geometry.CircleBufferGeometry.js',
-	'./js/Sidebar.Geometry.CylinderBufferGeometry.js',
-	'./js/Sidebar.Geometry.DodecahedronBufferGeometry.js',
-	'./js/Sidebar.Geometry.ExtrudeBufferGeometry.js',
-	'./js/Sidebar.Geometry.IcosahedronBufferGeometry.js',
-	'./js/Sidebar.Geometry.LatheBufferGeometry.js',
-	'./js/Sidebar.Geometry.OctahedronBufferGeometry.js',
-	'./js/Sidebar.Geometry.PlaneBufferGeometry.js',
-	'./js/Sidebar.Geometry.RingBufferGeometry.js',
-	'./js/Sidebar.Geometry.SphereBufferGeometry.js',
-	'./js/Sidebar.Geometry.ShapeBufferGeometry.js',
-	'./js/Sidebar.Geometry.TetrahedronBufferGeometry.js',
-	'./js/Sidebar.Geometry.TorusBufferGeometry.js',
-	'./js/Sidebar.Geometry.TorusKnotBufferGeometry.js',
-	'./js/Sidebar.Geometry.TubeBufferGeometry.js',
-	'./js/Sidebar.Geometry.TeapotBufferGeometry.js',
+	'./js/Sidebar.Geometry.BoxGeometry.js',
+	'./js/Sidebar.Geometry.CircleGeometry.js',
+	'./js/Sidebar.Geometry.CylinderGeometry.js',
+	'./js/Sidebar.Geometry.DodecahedronGeometry.js',
+	'./js/Sidebar.Geometry.ExtrudeGeometry.js',
+	'./js/Sidebar.Geometry.IcosahedronGeometry.js',
+	'./js/Sidebar.Geometry.LatheGeometry.js',
+	'./js/Sidebar.Geometry.OctahedronGeometry.js',
+	'./js/Sidebar.Geometry.PlaneGeometry.js',
+	'./js/Sidebar.Geometry.RingGeometry.js',
+	'./js/Sidebar.Geometry.SphereGeometry.js',
+	'./js/Sidebar.Geometry.ShapeGeometry.js',
+	'./js/Sidebar.Geometry.TetrahedronGeometry.js',
+	'./js/Sidebar.Geometry.TorusGeometry.js',
+	'./js/Sidebar.Geometry.TorusKnotGeometry.js',
+	'./js/Sidebar.Geometry.TubeGeometry.js',
+	'./js/Sidebar.Geometry.TeapotGeometry.js',
 	'./js/Sidebar.Material.js',
 	'./js/Sidebar.Animation.js',
 	'./js/Sidebar.Script.js',

+ 2 - 2
examples/css2d_label.html

@@ -53,7 +53,7 @@
 
 				//
 
-				const earthGeometry = new THREE.SphereBufferGeometry( EARTH_RADIUS, 16, 16 );
+				const earthGeometry = new THREE.SphereGeometry( EARTH_RADIUS, 16, 16 );
 				const earthMaterial = new THREE.MeshPhongMaterial( {
 					specular: 0x333333,
 					shininess: 5,
@@ -65,7 +65,7 @@
 				const earth = new THREE.Mesh( earthGeometry, earthMaterial );
 				scene.add( earth );
 
-				const moonGeometry = new THREE.SphereBufferGeometry( MOON_RADIUS, 16, 16 );
+				const moonGeometry = new THREE.SphereGeometry( MOON_RADIUS, 16, 16 );
 				const moonMaterial = new THREE.MeshPhongMaterial( {
 					shininess: 5,
 					map: textureLoader.load( 'textures/planets/moon_1024.jpg' )

+ 1 - 1
examples/css3d_orthographic.html

@@ -109,7 +109,7 @@
 					object.rotation.copy( rot );
 					scene2.add( object );
 
-					const geometry = new THREE.PlaneBufferGeometry( width, height );
+					const geometry = new THREE.PlaneGeometry( width, height );
 					const mesh = new THREE.Mesh( geometry, material );
 					mesh.position.copy( object.position );
 					mesh.rotation.copy( object.rotation );

+ 1 - 1
examples/css3d_sandbox.html

@@ -65,7 +65,7 @@
 					object.scale.y = Math.random() + 0.5;
 					scene2.add( object );
 
-					const geometry = new THREE.PlaneBufferGeometry( 100, 100 );
+					const geometry = new THREE.PlaneGeometry( 100, 100 );
 					const mesh = new THREE.Mesh( geometry, material );
 					mesh.position.copy( object.position );
 					mesh.rotation.copy( object.rotation );

+ 0 - 1
examples/files.json

@@ -185,7 +185,6 @@
 		"webgl_modifier_curve_instanced",
 		"webgl_modifier_edgesplit",
 		"webgl_modifier_simplifier",
-		"webgl_modifier_subdivision",
 		"webgl_modifier_tessellation",
 		"webgl_morphtargets",
 		"webgl_morphtargets_horse",

+ 1 - 1
examples/games_fps.html

@@ -77,7 +77,7 @@
 			const NUM_SPHERES = 20;
 			const SPHERE_RADIUS = 0.2;
 
-			const sphereGeometry = new THREE.SphereBufferGeometry( SPHERE_RADIUS, 32, 32 );
+			const sphereGeometry = new THREE.SphereGeometry( SPHERE_RADIUS, 32, 32 );
 			const sphereMaterial = new THREE.MeshStandardMaterial( { color: 0x888855, roughness: 0.8, metalness: 0.5 } );
 
 			const spheres = [];

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

@@ -257,7 +257,7 @@ THREE.CCDIKSolver = ( function () {
 		this.matrix.copy( mesh.matrixWorld );
 		this.matrixAutoUpdate = false;
 
-		this.sphereGeometry = new THREE.SphereBufferGeometry( 0.25, 16, 8 );
+		this.sphereGeometry = new THREE.SphereGeometry( 0.25, 16, 8 );
 
 		this.targetSphereMaterial = new THREE.MeshBasicMaterial( {
 			color: new THREE.Color( 0xff8888 ),

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

@@ -1358,10 +1358,10 @@ THREE.MMDPhysics = ( function () {
 				switch ( param.shapeType ) {
 
 					case 0:
-						return new THREE.SphereBufferGeometry( param.width, 16, 8 );
+						return new THREE.SphereGeometry( param.width, 16, 8 );
 
 					case 1:
-						return new THREE.BoxBufferGeometry( param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8 );
+						return new THREE.BoxGeometry( param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8 );
 
 					case 2:
 						return new createCapsuleGeometry( param.width, param.height, 16, 8 );
@@ -1376,9 +1376,9 @@ THREE.MMDPhysics = ( function () {
 			// copy from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mytest37.js?ver=20160815
 			function createCapsuleGeometry( radius, cylinderHeight, segmentsRadius, segmentsHeight ) {
 
-				var geometry = new THREE.CylinderBufferGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
-				var upperSphere = new THREE.Mesh( new THREE.SphereBufferGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, 0, Math.PI / 2 ) );
-				var lowerSphere = new THREE.Mesh( new THREE.SphereBufferGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, Math.PI / 2, Math.PI / 2 ) );
+				var geometry = new THREE.CylinderGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
+				var upperSphere = new THREE.Mesh( new THREE.SphereGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, 0, Math.PI / 2 ) );
+				var lowerSphere = new THREE.Mesh( new THREE.SphereGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, Math.PI / 2, Math.PI / 2 ) );
 
 				upperSphere.position.set( 0, cylinderHeight / 2, 0 );
 				lowerSphere.position.set( 0, - cylinderHeight / 2, 0 );

+ 1 - 1
examples/js/cameras/CinematicCamera.js

@@ -158,7 +158,7 @@ THREE.CinematicCamera.prototype.initPostProcessing = function () {
 			}
 		} );
 
-		this.postprocessing.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( window.innerWidth, window.innerHeight ), this.postprocessing.materialBokeh );
+		this.postprocessing.quad = new THREE.Mesh( new THREE.PlaneGeometry( window.innerWidth, window.innerHeight ), this.postprocessing.materialBokeh );
 		this.postprocessing.quad.position.z = - 500;
 		this.postprocessing.scene.add( this.postprocessing.quad );
 

+ 22 - 22
examples/js/controls/FirstPersonControls.js

@@ -149,22 +149,22 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 		//event.preventDefault();
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 38: /*up*/
-			case 87: /*W*/ this.moveForward = true; break;
+			case 'ArrowUp':
+			case 'KeyW': this.moveForward = true; break;
 
-			case 37: /*left*/
-			case 65: /*A*/ this.moveLeft = true; break;
+			case 'ArrowLeft':
+			case 'KeyA': this.moveLeft = true; break;
 
-			case 40: /*down*/
-			case 83: /*S*/ this.moveBackward = true; break;
+			case 'ArrowDown':
+			case 'KeyS': this.moveBackward = true; break;
 
-			case 39: /*right*/
-			case 68: /*D*/ this.moveRight = true; break;
+			case 'ArrowRight':
+			case 'KeyD': this.moveRight = true; break;
 
-			case 82: /*R*/ this.moveUp = true; break;
-			case 70: /*F*/ this.moveDown = true; break;
+			case 'KeyR': this.moveUp = true; break;
+			case 'KeyF': this.moveDown = true; break;
 
 		}
 
@@ -172,22 +172,22 @@ THREE.FirstPersonControls = function ( object, domElement ) {
 
 	this.onKeyUp = function ( event ) {
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 38: /*up*/
-			case 87: /*W*/ this.moveForward = false; break;
+			case 'ArrowUp':
+			case 'KeyW': this.moveForward = false; break;
 
-			case 37: /*left*/
-			case 65: /*A*/ this.moveLeft = false; break;
+			case 'ArrowLeft':
+			case 'KeyA': this.moveLeft = false; break;
 
-			case 40: /*down*/
-			case 83: /*S*/ this.moveBackward = false; break;
+			case 'ArrowDown':
+			case 'KeyS': this.moveBackward = false; break;
 
-			case 39: /*right*/
-			case 68: /*D*/ this.moveRight = false; break;
+			case 'ArrowRight':
+			case 'KeyD': this.moveRight = false; break;
 
-			case 82: /*R*/ this.moveUp = false; break;
-			case 70: /*F*/ this.moveDown = false; break;
+			case 'KeyR': this.moveUp = false; break;
+			case 'KeyF': this.moveDown = false; break;
 
 		}
 

+ 30 - 28
examples/js/controls/FlyControls.js

@@ -46,27 +46,28 @@ THREE.FlyControls = function ( object, domElement ) {
 
 		//event.preventDefault();
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 16: /* shift */ this.movementSpeedMultiplier = .1; break;
+			case 'ShiftLeft':
+			case 'ShiftRight': this.movementSpeedMultiplier = .1; break;
 
-			case 87: /*W*/ this.moveState.forward = 1; break;
-			case 83: /*S*/ this.moveState.back = 1; break;
+			case 'KeyW': this.moveState.forward = 1; break;
+			case 'KeyS': this.moveState.back = 1; break;
 
-			case 65: /*A*/ this.moveState.left = 1; break;
-			case 68: /*D*/ this.moveState.right = 1; break;
+			case 'KeyA': this.moveState.left = 1; break;
+			case 'KeyD': this.moveState.right = 1; break;
 
-			case 82: /*R*/ this.moveState.up = 1; break;
-			case 70: /*F*/ this.moveState.down = 1; break;
+			case 'KeyR': this.moveState.up = 1; break;
+			case 'KeyF': this.moveState.down = 1; break;
 
-			case 38: /*up*/ this.moveState.pitchUp = 1; break;
-			case 40: /*down*/ this.moveState.pitchDown = 1; break;
+			case 'ArrowUp': this.moveState.pitchUp = 1; break;
+			case 'ArrowDown': this.moveState.pitchDown = 1; break;
 
-			case 37: /*left*/ this.moveState.yawLeft = 1; break;
-			case 39: /*right*/ this.moveState.yawRight = 1; break;
+			case 'ArrowLeft': this.moveState.yawLeft = 1; break;
+			case 'ArrowRight': this.moveState.yawRight = 1; break;
 
-			case 81: /*Q*/ this.moveState.rollLeft = 1; break;
-			case 69: /*E*/ this.moveState.rollRight = 1; break;
+			case 'KeyQ': this.moveState.rollLeft = 1; break;
+			case 'KeyE': this.moveState.rollRight = 1; break;
 
 		}
 
@@ -77,27 +78,28 @@ THREE.FlyControls = function ( object, domElement ) {
 
 	this.keyup = function ( event ) {
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 16: /* shift */ this.movementSpeedMultiplier = 1; break;
+			case 'ShiftLeft':
+			case 'ShiftRight': this.movementSpeedMultiplier = 1; break;
 
-			case 87: /*W*/ this.moveState.forward = 0; break;
-			case 83: /*S*/ this.moveState.back = 0; break;
+			case 'KeyW': this.moveState.forward = 0; break;
+			case 'KeyS': this.moveState.back = 0; break;
 
-			case 65: /*A*/ this.moveState.left = 0; break;
-			case 68: /*D*/ this.moveState.right = 0; break;
+			case 'KeyA': this.moveState.left = 0; break;
+			case 'KeyD': this.moveState.right = 0; break;
 
-			case 82: /*R*/ this.moveState.up = 0; break;
-			case 70: /*F*/ this.moveState.down = 0; break;
+			case 'KeyR': this.moveState.up = 0; break;
+			case 'KeyF': this.moveState.down = 0; break;
 
-			case 38: /*up*/ this.moveState.pitchUp = 0; break;
-			case 40: /*down*/ this.moveState.pitchDown = 0; break;
+			case 'ArrowUp': this.moveState.pitchUp = 0; break;
+			case 'ArrowDown': this.moveState.pitchDown = 0; break;
 
-			case 37: /*left*/ this.moveState.yawLeft = 0; break;
-			case 39: /*right*/ this.moveState.yawRight = 0; break;
+			case 'ArrowLeft': this.moveState.yawLeft = 0; break;
+			case 'ArrowRight': this.moveState.yawRight = 0; break;
 
-			case 81: /*Q*/ this.moveState.rollLeft = 0; break;
-			case 69: /*E*/ this.moveState.rollRight = 0; break;
+			case 'KeyQ': this.moveState.rollLeft = 0; break;
+			case 'KeyE': this.moveState.rollRight = 0; break;
 
 		}
 

+ 17 - 7
examples/js/controls/OrbitControls.js

@@ -62,9 +62,6 @@ THREE.OrbitControls = function ( object, domElement ) {
 	this.autoRotate = false;
 	this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
 
-	// Set to false to disable use of the keys
-	this.enableKeys = true;
-
 	// The four arrow keys
 	this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
 
@@ -79,6 +76,9 @@ THREE.OrbitControls = function ( object, domElement ) {
 	this.position0 = this.object.position.clone();
 	this.zoom0 = this.object.zoom;
 
+	// the target DOM element for key events
+	this._domElementKeyEvents = null;
+
 	//
 	// public methods
 	//
@@ -95,6 +95,13 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 	};
 
+	this.listenToKeyEvents = function ( domElement ) {
+
+		domElement.addEventListener( 'keydown', onKeyDown, false );
+		this._domElementKeyEvents = domElement;
+
+	};
+
 	this.saveState = function () {
 
 		scope.target0.copy( scope.target );
@@ -274,7 +281,12 @@ THREE.OrbitControls = function ( object, domElement ) {
 		scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove, false );
 		scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp, false );
 
-		scope.domElement.removeEventListener( 'keydown', onKeyDown, false );
+
+		if ( scope._domElementKeyEvents !== null ) {
+
+			scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown, false );
+
+		}
 
 		//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
 
@@ -989,7 +1001,7 @@ THREE.OrbitControls = function ( object, domElement ) {
 
 	function onKeyDown( event ) {
 
-		if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
+		if ( scope.enabled === false || scope.enablePan === false ) return;
 
 		handleKeyDown( event );
 
@@ -1169,8 +1181,6 @@ THREE.OrbitControls = function ( object, domElement ) {
 	scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
 	scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
 
-	scope.domElement.addEventListener( 'keydown', onKeyDown, false );
-
 	// force an update at start
 
 	this.update();

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

@@ -800,9 +800,9 @@ THREE.TransformControlsGizmo = function () {
 
 	// reusable geometry
 
-	var arrowGeometry = new THREE.CylinderBufferGeometry( 0, 0.05, 0.2, 12, 1, false );
+	var arrowGeometry = new THREE.CylinderGeometry( 0, 0.05, 0.2, 12, 1, false );
 
-	var scaleHandleGeometry = new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 );
+	var scaleHandleGeometry = new THREE.BoxGeometry( 0.125, 0.125, 0.125 );
 
 	var lineGeometry = new THREE.BufferGeometry();
 	lineGeometry.setAttribute( 'position', new THREE.Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
@@ -855,20 +855,20 @@ THREE.TransformControlsGizmo = function () {
 			[ new THREE.Line( lineGeometry, matLineBlue ), null, [ 0, - Math.PI / 2, 0 ]]
 		],
 		XYZ: [
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ], [ 0, 0, 0 ]]
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ], [ 0, 0, 0 ]]
 		],
 		XY: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matYellowTransparent.clone() ), [ 0.15, 0.15, 0 ]],
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.295, 0.295 ), matYellowTransparent.clone() ), [ 0.15, 0.15, 0 ]],
 			[ new THREE.Line( lineGeometry, matLineYellow ), [ 0.18, 0.3, 0 ], null, [ 0.125, 1, 1 ]],
 			[ new THREE.Line( lineGeometry, matLineYellow ), [ 0.3, 0.18, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]]
 		],
 		YZ: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matCyanTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]],
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.295, 0.295 ), matCyanTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]],
 			[ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.18, 0.3 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]],
 			[ new THREE.Line( lineGeometry, matLineCyan ), [ 0, 0.3, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		],
 		XZ: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.295, 0.295 ), matMagentaTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]],
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.295, 0.295 ), matMagentaTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]],
 			[ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.18, 0, 0.3 ], null, [ 0.125, 1, 1 ]],
 			[ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.3, 0, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		]
@@ -876,34 +876,34 @@ THREE.TransformControlsGizmo = function () {
 
 	var pickerTranslate = {
 		X: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
 		],
 		Y: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ]]
 		],
 		Z: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ]]
 		],
 		XYZ: [
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.2, 0 ), matInvisible ) ]
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.2, 0 ), matInvisible ) ]
 		],
 		XY: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ]]
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ]]
 		],
 		YZ: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ]]
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ]]
 		],
 		XZ: [
-			[ new THREE.Mesh( new THREE.PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ - Math.PI / 2, 0, 0 ]]
+			[ new THREE.Mesh( new THREE.PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ - Math.PI / 2, 0, 0 ]]
 		]
 	};
 
 	var helperTranslate = {
 		START: [
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
 		],
 		END: [
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
 		],
 		DELTA: [
 			[ new THREE.Line( TranslateHelperGeometry(), matHelper ), null, null, null, 'helper' ]
@@ -922,22 +922,22 @@ THREE.TransformControlsGizmo = function () {
 	var gizmoRotate = {
 		X: [
 			[ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineRed ) ],
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ]],
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ]],
 		],
 		Y: [
 			[ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineGreen ), null, [ 0, 0, - Math.PI / 2 ]],
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ]],
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ]],
 		],
 		Z: [
 			[ new THREE.Line( CircleGeometry( 1, 0.5 ), matLineBlue ), null, [ 0, Math.PI / 2, 0 ]],
-			[ new THREE.Mesh( new THREE.OctahedronBufferGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ]],
+			[ new THREE.Mesh( new THREE.OctahedronGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ]],
 		],
 		E: [
 			[ new THREE.Line( CircleGeometry( 1.25, 1 ), matLineYellowTransparent ), null, [ 0, Math.PI / 2, 0 ]],
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, - Math.PI / 2 ], [ 1, 1, 0.001 ]],
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ - 1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, - 1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, 1.17, 0 ], [ 0, 0, 0 ], [ 1, 1, 0.001 ]],
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, - Math.PI / 2 ], [ 1, 1, 0.001 ]],
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ - 1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, - 1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, 1.17, 0 ], [ 0, 0, 0 ], [ 1, 1, 0.001 ]],
 		],
 		XYZE: [
 			[ new THREE.Line( CircleGeometry( 1, 1 ), matLineGray ), null, [ 0, Math.PI / 2, 0 ]]
@@ -952,19 +952,19 @@ THREE.TransformControlsGizmo = function () {
 
 	var pickerRotate = {
 		X: [
-			[ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]],
+			[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]],
 		],
 		Y: [
-			[ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]],
+			[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]],
 		],
 		Z: [
-			[ new THREE.Mesh( new THREE.TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
+			[ new THREE.Mesh( new THREE.TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
 		],
 		E: [
-			[ new THREE.Mesh( new THREE.TorusBufferGeometry( 1.25, 0.1, 2, 24 ), matInvisible ) ]
+			[ new THREE.Mesh( new THREE.TorusGeometry( 1.25, 0.1, 2, 24 ), matInvisible ) ]
 		],
 		XYZE: [
-			[ new THREE.Mesh( new THREE.SphereBufferGeometry( 0.7, 10, 8 ), matInvisible ) ]
+			[ new THREE.Mesh( new THREE.SphereGeometry( 0.7, 10, 8 ), matInvisible ) ]
 		]
 	};
 
@@ -997,25 +997,25 @@ THREE.TransformControlsGizmo = function () {
 			[ new THREE.Line( lineGeometry, matLineMagenta ), [ 0.98, 0, 0.855 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		],
 		XYZX: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 1.1, 0, 0 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 1.1, 0, 0 ]],
 		],
 		XYZY: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 1.1, 0 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 1.1, 0 ]],
 		],
 		XYZZ: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 0, 1.1 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 0, 1.1 ]],
 		]
 	};
 
 	var pickerScale = {
 		X: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
 		],
 		Y: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ]]
 		],
 		Z: [
-			[ new THREE.Mesh( new THREE.CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]]
+			[ new THREE.Mesh( new THREE.CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]]
 		],
 		XY: [
 			[ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0.85, 0 ], null, [ 3, 3, 0.2 ]],
@@ -1027,13 +1027,13 @@ THREE.TransformControlsGizmo = function () {
 			[ new THREE.Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0, 0.85 ], null, [ 3, 0.2, 3 ]],
 		],
 		XYZX: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ]],
 		],
 		XYZY: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ]],
 		],
 		XYZZ: [
-			[ new THREE.Mesh( new THREE.BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ]],
+			[ new THREE.Mesh( new THREE.BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ]],
 		]
 	};
 
@@ -1560,7 +1560,7 @@ THREE.TransformControlsPlane = function () {
 	'use strict';
 
 	THREE.Mesh.call( this,
-		new THREE.PlaneBufferGeometry( 100000, 100000, 2, 2 ),
+		new THREE.PlaneGeometry( 100000, 100000, 2, 2 ),
 		new THREE.MeshBasicMaterial( { visible: false, wireframe: true, side: THREE.DoubleSide, transparent: true, opacity: 0.1, toneMapped: false } )
 	);
 

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

@@ -107,7 +107,7 @@ THREE.AnaglyphEffect = function ( renderer, width, height ) {
 
 	} );
 
-	var _mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), _material );
+	var _mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material );
 	_scene.add( _mesh );
 
 	this.setSize = function ( width, height ) {

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

@@ -59,7 +59,7 @@ THREE.ParallaxBarrierEffect = function ( renderer ) {
 
 	} );
 
-	var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), _material );
+	var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), _material );
 	_scene.add( mesh );
 
 	this.setSize = function ( width, height ) {

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

@@ -143,7 +143,7 @@ THREE.ParametricGeometries.TubeGeometry = function ( path, segments, radius, seg
 
 };
 
-THREE.ParametricGeometries.TubeGeometry.prototype = Object.create( THREE.Geometry.prototype );
+THREE.ParametricGeometries.TubeGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
 THREE.ParametricGeometries.TubeGeometry.prototype.constructor = THREE.ParametricGeometries.TubeGeometry;
 
 
@@ -194,7 +194,7 @@ THREE.ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segments
 
 };
 
-THREE.ParametricGeometries.TorusKnotGeometry.prototype = Object.create( THREE.Geometry.prototype );
+THREE.ParametricGeometries.TorusKnotGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
 THREE.ParametricGeometries.TorusKnotGeometry.prototype.constructor = THREE.ParametricGeometries.TorusKnotGeometry;
 
 
@@ -222,7 +222,7 @@ THREE.ParametricGeometries.SphereGeometry = function ( size, u, v ) {
 
 };
 
-THREE.ParametricGeometries.SphereGeometry.prototype = Object.create( THREE.Geometry.prototype );
+THREE.ParametricGeometries.SphereGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
 THREE.ParametricGeometries.SphereGeometry.prototype.constructor = THREE.ParametricGeometries.SphereGeometry;
 
 
@@ -248,5 +248,5 @@ THREE.ParametricGeometries.PlaneGeometry = function ( width, depth, segmentsWidt
 
 };
 
-THREE.ParametricGeometries.PlaneGeometry.prototype = Object.create( THREE.Geometry.prototype );
+THREE.ParametricGeometries.PlaneGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
 THREE.ParametricGeometries.PlaneGeometry.prototype.constructor = THREE.ParametricGeometries.PlaneGeometry;

+ 3 - 3
examples/js/geometries/TeapotBufferGeometry.js → examples/js/geometries/TeapotGeometry.js

@@ -47,7 +47,7 @@
  *
  */
 
-THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLid, blinn ) {
+THREE.TeapotGeometry = function ( size, segments, bottom, lid, body, fitLid, blinn ) {
 
 	// 32 * 4 * 4 Bezier spline patches
 	var teapotPatches = [
@@ -710,5 +710,5 @@ THREE.TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLi
 };
 
 
-THREE.TeapotBufferGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
-THREE.TeapotBufferGeometry.prototype.constructor = THREE.TeapotBufferGeometry;
+THREE.TeapotGeometry.prototype = Object.create( THREE.BufferGeometry.prototype );
+THREE.TeapotGeometry.prototype.constructor = THREE.TeapotGeometry;

+ 30 - 12
examples/js/loaders/FBXLoader.js

@@ -822,11 +822,17 @@ THREE.FBXLoader = ( function () {
 
 				if ( node.userData.transformData ) {
 
-					if ( node.parent ) node.userData.transformData.parentMatrixWorld = node.parent.matrix;
+					if ( node.parent ) {
+
+						node.userData.transformData.parentMatrix = node.parent.matrix;
+						node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;
+
+					}
 
 					var transform = generateTransform( node.userData.transformData );
 
 					node.applyMatrix4( transform );
+					node.updateWorldMatrix();
 
 				}
 
@@ -3980,6 +3986,7 @@ THREE.FBXLoader = ( function () {
 		var lRotationPivotM = new THREE.Matrix4();
 
 		var lParentGX = new THREE.Matrix4();
+		var lParentLX = new THREE.Matrix4();
 		var lGlobalT = new THREE.Matrix4();
 
 		var inheritType = ( transformData.inheritType ) ? transformData.inheritType : 0;
@@ -4007,6 +4014,7 @@ THREE.FBXLoader = ( function () {
 			var array = transformData.postRotation.map( THREE.MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
+			lPostRotationM.invert();
 
 		}
 
@@ -4019,37 +4027,44 @@ THREE.FBXLoader = ( function () {
 		if ( transformData.rotationPivot ) lRotationPivotM.setPosition( tempVec.fromArray( transformData.rotationPivot ) );
 
 		// parent transform
-		if ( transformData.parentMatrixWorld ) lParentGX = transformData.parentMatrixWorld;
+		if ( transformData.parentMatrixWorld ) {
+
+			lParentLX.copy( transformData.parentMatrix );
+			lParentGX.copy( transformData.parentMatrixWorld );
 
+		}
+
+		var lLRM = new THREE.Matrix4().copy( lPreRotationM ).multiply( lRotationM ).multiply( lPostRotationM );
 		// Global Rotation
-		var lLRM = lPreRotationM.multiply( lRotationM ).multiply( lPostRotationM );
 		var lParentGRM = new THREE.Matrix4();
-		lParentGX.extractRotation( lParentGRM );
+		lParentGRM.extractRotation( lParentGX );
 
 		// Global Shear*Scaling
 		var lParentTM = new THREE.Matrix4();
 		lParentTM.copyPosition( lParentGX );
 
 		var lParentGSM = new THREE.Matrix4();
-		lParentGSM.copy( lParentGRM ).invert().multiply( lParentGX );
+		var lParentGRSM = new THREE.Matrix4().copy( lParentTM ).invert().multiply( lParentGX );
+		lParentGSM.copy( lParentGRM ).invert().multiply( lParentGRSM );
+		var lLSM = lScalingM;
 
 		var lGlobalRS = new THREE.Matrix4();
 
 		if ( inheritType === 0 ) {
 
-			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lLSM );
 
 		} else if ( inheritType === 1 ) {
 
-			lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lLSM );
 
 		} else {
 
-			var lParentLSM_inv = new THREE.Matrix4();
-			lParentLSM_inv.copy( lScalingM ).invert();
-			var lParentGSM_noLocal = new THREE.Matrix4().multiply( lParentGSM ).multiply( lParentLSM_inv );
+			var lParentLSM = new THREE.Matrix4().scale( new THREE.Vector3().setFromMatrixScale( lParentLX ) );
+			var lParentLSM_inv = new THREE.Matrix4().copy( lParentLSM ).invert();
+			var lParentGSM_noLocal = new THREE.Matrix4().copy( lParentGSM ).multiply( lParentLSM_inv );
 
-			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lLSM );
 
 		}
 
@@ -4066,7 +4081,10 @@ THREE.FBXLoader = ( function () {
 		var lGlobalTranslation = new THREE.Matrix4().copy( lParentGX ).multiply( lLocalTWithAllPivotAndOffsetInfo );
 		lGlobalT.copyPosition( lGlobalTranslation );
 
-		lTransform = new THREE.Matrix4().multiply( lGlobalT ).multiply( lGlobalRS );
+		lTransform = new THREE.Matrix4().copy( lGlobalT ).multiply( lGlobalRS );
+
+		// from global to local
+		lTransform.premultiply( lParentGX.invert() );
 
 		return lTransform;
 

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

@@ -868,7 +868,7 @@ THREE.VRMLLoader = ( function () {
 
 				if ( skyColor ) {
 
-					var skyGeometry = new THREE.SphereBufferGeometry( radius, 32, 16 );
+					var skyGeometry = new THREE.SphereGeometry( radius, 32, 16 );
 					var skyMaterial = new THREE.MeshBasicMaterial( { fog: false, side: THREE.BackSide, depthWrite: false, depthTest: false } );
 
 					if ( skyColor.length > 3 ) {
@@ -893,7 +893,7 @@ THREE.VRMLLoader = ( function () {
 
 					if ( groundColor.length > 0 ) {
 
-						var groundGeometry = new THREE.SphereBufferGeometry( radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
+						var groundGeometry = new THREE.SphereGeometry( radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
 						var groundMaterial = new THREE.MeshBasicMaterial( { fog: false, side: THREE.BackSide, vertexColors: true, depthWrite: false, depthTest: false } );
 
 						paintFaces( groundGeometry, radius, groundAngle, toColorArray( groundColor ), false );
@@ -1974,7 +1974,7 @@ THREE.VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new THREE.BoxBufferGeometry( size.x, size.y, size.z );
+				var geometry = new THREE.BoxGeometry( size.x, size.y, size.z );
 
 				return geometry;
 
@@ -2018,7 +2018,7 @@ THREE.VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new THREE.ConeBufferGeometry( radius, height, 16, 1, openEnded );
+				var geometry = new THREE.ConeGeometry( radius, height, 16, 1, openEnded );
 
 				return geometry;
 
@@ -2066,7 +2066,7 @@ THREE.VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new THREE.CylinderBufferGeometry( radius, radius, height, 16, 1 );
+				var geometry = new THREE.CylinderGeometry( radius, radius, height, 16, 1 );
 
 				return geometry;
 
@@ -2098,7 +2098,7 @@ THREE.VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new THREE.SphereBufferGeometry( radius, 16, 16 );
+				var geometry = new THREE.SphereGeometry( radius, 16, 16 );
 
 				return geometry;
 

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

@@ -16,7 +16,7 @@
  *  - 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 BoxBufferGeometry, SphereBufferGeometry and other convex primitives
+ *  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)

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

@@ -114,7 +114,7 @@ THREE.GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 
 	var passThruShader = createShaderMaterial( getPassThroughFragmentShader(), passThruUniforms );
 
-	var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), passThruShader );
+	var mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ), passThruShader );
 	scene.add( mesh );
 
 

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

@@ -188,7 +188,7 @@ THREE.Ocean = function ( renderer, camera, scene, options ) {
 	this.materialOcean.blending = 0;
 
 	// Create the simulation plane
-	this.screenQuad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ) );
+	this.screenQuad = new THREE.Mesh( new THREE.PlaneGeometry( 2, 2 ) );
 	this.scene.add( this.screenQuad );
 
 	// Initialise spectrum data
@@ -201,7 +201,7 @@ THREE.Ocean = function ( renderer, camera, scene, options ) {
 
 THREE.Ocean.prototype.generateMesh = function () {
 
-	var geometry = new THREE.PlaneBufferGeometry( this.geometrySize, this.geometrySize, this.geometryResolution, this.geometryResolution );
+	var geometry = new THREE.PlaneGeometry( this.geometrySize, this.geometrySize, this.geometryResolution, this.geometryResolution );
 
 	geometry.rotateX( - Math.PI / 2 );
 

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

@@ -199,7 +199,7 @@ THREE.VolumeSlice.prototype = {
 
 		if ( this.geometry ) this.geometry.dispose(); // dispose existing geometry
 
-		this.geometry = new THREE.PlaneBufferGeometry( extracted.planeWidth, extracted.planeHeight );
+		this.geometry = new THREE.PlaneGeometry( extracted.planeWidth, extracted.planeHeight );
 
 		if ( this.mesh ) {
 

+ 10 - 9
examples/js/modifiers/EdgeSplitModifier.js

@@ -153,36 +153,37 @@ THREE.EdgeSplitModifier = function () {
 
 	this.modify = function ( geometry, cutOffAngle, tryKeepNormals = true ) {
 
-		const wasNotBufferGeometry = geometry.isBufferGeometry === undefined;
-		if ( ! geometry.isBufferGeometry ) {
+		if ( geometry.isGeometry === true ) {
 
-			geometry = new THREE.BufferGeometry().fromGeometry( geometry );
+			console.error( 'THREE.EdgeSplitModifier no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );
+			return;
 
 		}
 
-
 		let hadNormals = false;
 		oldNormals = null;
+
 		if ( geometry.attributes.normal ) {
 
 			hadNormals = true;
 
-			if ( wasNotBufferGeometry === false )
-				geometry = geometry.clone();
+			geometry = geometry.clone();
+
+			if ( tryKeepNormals === true && geometry.index !== null ) {
 
-			if ( tryKeepNormals && geometry.index )
 				oldNormals = geometry.attributes.normal.array;
 
+			}
+
 			geometry.deleteAttribute( 'normal' );
 
 		}
 
-
 		if ( geometry.index == null ) {
 
 			if ( THREE.BufferGeometryUtils === undefined ) {
 
-			 	throw 'THREE.EdgeSplitModifier relies on THREE.BufferGeometryUtils';
+				throw 'THREE.EdgeSplitModifier relies on THREE.BufferGeometryUtils';
 
 			}
 

+ 57 - 22
examples/js/modifiers/SimplifyModifier.js

@@ -6,7 +6,15 @@
  *    - http://www.melax.com/polychop/
  */
 
-THREE.SimplifyModifier = function () {};
+THREE.SimplifyModifier = function () {
+
+	if ( THREE.BufferGeometryUtils === undefined ) {
+
+		throw 'THREE.SimplifyModifier relies on THREE.BufferGeometryUtils';
+
+	}
+
+};
 
 ( function () {
 
@@ -379,54 +387,81 @@ THREE.SimplifyModifier = function () {};
 
 	THREE.SimplifyModifier.prototype.modify = function ( geometry, count ) {
 
-		if ( geometry.isBufferGeometry ) {
+		if ( geometry.isGeometry === true ) {
 
-			geometry = new THREE.Geometry().fromBufferGeometry( geometry );
+			console.error( 'THREE.SimplifyModifier no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );
+			return;
 
 		}
 
-		geometry.mergeVertices();
+		geometry = geometry.clone();
+		var attributes = geometry.attributes;
 
-		var oldVertices = geometry.vertices; // Three Position
-		var oldFaces = geometry.faces; // Three Face
+		// this modifier can only process indexed and non-indexed geomtries with a position attribute
 
-		// conversion
-		var vertices = [];
-		var faces = [];
+		for ( var name in attributes ) {
+
+			if ( name !== 'position' ) geometry.deleteAttribute( name );
+
+		}
 
-		var i, il;
+		geometry = THREE.BufferGeometryUtils.mergeVertices( geometry );
 
 		//
 		// put data of original geometry in different data structures
 		//
 
+		var vertices = [];
+		var faces = [];
+
 		// add vertices
 
-		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
+		var positionAttribute = geometry.getAttribute( 'position' );
 
-			var vertex = new Vertex( oldVertices[ i ], i );
+		for ( var i = 0; i < positionAttribute.count; i ++ ) {
+
+			var v = new THREE.Vector3().fromBufferAttribute( positionAttribute, i );
+
+			var vertex = new Vertex( v, i );
 			vertices.push( vertex );
 
 		}
 
 		// add faces
 
-		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
+		var index = geometry.getIndex();
+
+		if ( index !== null ) {
+
+			for ( var i = 0; i < index.count; i += 3 ) {
 
-			var face = oldFaces[ i ];
+				var a = index.getX( i );
+				var b = index.getX( i + 1 );
+				var c = index.getX( i + 2 );
+
+				var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
+				faces.push( triangle );
+
+			}
 
-			var a = face.a;
-			var b = face.b;
-			var c = face.c;
+		} else {
 
-			var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
-			faces.push( triangle );
+			for ( var i = 0; i < positionAttribute.count; i += 3 ) {
+
+				var a = i;
+				var b = i + 1;
+				var c = i + 2;
+
+				var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
+				faces.push( triangle );
+
+			}
 
 		}
 
 		// compute all edge collapse costs
 
-		for ( i = 0, il = vertices.length; i < il; i ++ ) {
+		for ( var i = 0, il = vertices.length; i < il; i ++ ) {
 
 			computeEdgeCostAtVertex( vertices[ i ] );
 
@@ -459,7 +494,7 @@ THREE.SimplifyModifier = function () {};
 
 		//
 
-		for ( i = 0; i < vertices.length; i ++ ) {
+		for ( var i = 0; i < vertices.length; i ++ ) {
 
 			var vertex = vertices[ i ].position;
 			position.push( vertex.x, vertex.y, vertex.z );
@@ -468,7 +503,7 @@ THREE.SimplifyModifier = function () {};
 
 		//
 
-		for ( i = 0; i < faces.length; i ++ ) {
+		for ( var i = 0; i < faces.length; i ++ ) {
 
 			var face = faces[ i ];
 

+ 0 - 421
examples/js/modifiers/SubdivisionModifier.js

@@ -1,421 +0,0 @@
-/**
- *	Subdivision Geometry Modifier
- *		using Loop Subdivision Scheme
- *
- *	References:
- *		http://graphics.stanford.edu/~mdfisher/subdivision.html
- *		http://www.holmes3d.net/graphics/subdivision/
- *		http://www.cs.rutgers.edu/~decarlo/readings/subdiv-sg00c.pdf
- *
- *	Known Issues:
- *		- currently doesn't handle "Sharp Edges"
- */
-
-THREE.SubdivisionModifier = function ( subdivisions ) {
-
-	this.subdivisions = ( subdivisions === undefined ) ? 1 : subdivisions;
-
-};
-
-// Applies the "modify" pattern
-THREE.SubdivisionModifier.prototype.modify = function ( geometry ) {
-
-	var isBufferGeometry = geometry.isBufferGeometry;
-
-	if ( isBufferGeometry ) {
-
-		geometry = new THREE.Geometry().fromBufferGeometry( geometry );
-
-	} else {
-
-		geometry = geometry.clone();
-
-	}
-
-	geometry.mergeVertices( 6 );
-
-	var repeats = this.subdivisions;
-
-	while ( repeats -- > 0 ) {
-
-		this.smooth( geometry );
-
-	}
-
-	geometry.computeFaceNormals();
-	geometry.computeVertexNormals();
-
-	if ( isBufferGeometry ) {
-
-		return new THREE.BufferGeometry().fromGeometry( geometry );
-
-	} else {
-
-		return geometry;
-
-	}
-
-};
-
-( function () {
-
-	// Some constants
-	var ABC = [ 'a', 'b', 'c' ];
-
-
-	function getEdge( a, b, map ) {
-
-		var vertexIndexA = Math.min( a, b );
-		var vertexIndexB = Math.max( a, b );
-
-		var key = vertexIndexA + '_' + vertexIndexB;
-
-		return map[ key ];
-
-	}
-
-
-	function processEdge( a, b, vertices, map, face, metaVertices ) {
-
-		var vertexIndexA = Math.min( a, b );
-		var vertexIndexB = Math.max( a, b );
-
-		var key = vertexIndexA + '_' + vertexIndexB;
-
-		var edge;
-
-		if ( key in map ) {
-
-			edge = map[ key ];
-
-		} else {
-
-			var vertexA = vertices[ vertexIndexA ];
-			var vertexB = vertices[ vertexIndexB ];
-
-			edge = {
-
-				a: vertexA, // pointer reference
-				b: vertexB,
-				newEdge: null,
-				// aIndex: a, // numbered reference
-				// bIndex: b,
-				faces: [] // pointers to face
-
-			};
-
-			map[ key ] = edge;
-
-		}
-
-		edge.faces.push( face );
-
-		metaVertices[ a ].edges.push( edge );
-		metaVertices[ b ].edges.push( edge );
-
-
-	}
-
-	function generateLookups( vertices, faces, metaVertices, edges ) {
-
-		var i, il, face;
-
-		for ( i = 0, il = vertices.length; i < il; i ++ ) {
-
-			metaVertices[ i ] = { edges: [] };
-
-		}
-
-		for ( i = 0, il = faces.length; i < il; i ++ ) {
-
-			face = faces[ i ];
-
-			processEdge( face.a, face.b, vertices, edges, face, metaVertices );
-			processEdge( face.b, face.c, vertices, edges, face, metaVertices );
-			processEdge( face.c, face.a, vertices, edges, face, metaVertices );
-
-		}
-
-	}
-
-	function newFace( newFaces, a, b, c, materialIndex ) {
-
-		newFaces.push( new THREE.Face3( a, b, c, undefined, undefined, materialIndex ) );
-
-	}
-
-	function midpoint( a, b ) {
-
-		return ( Math.abs( b - a ) / 2 ) + Math.min( a, b );
-
-	}
-
-	function newUv( newUvs, a, b, c ) {
-
-		newUvs.push( [ a.clone(), b.clone(), c.clone() ] );
-
-	}
-
-	/////////////////////////////
-
-	// Performs one iteration of Subdivision
-	THREE.SubdivisionModifier.prototype.smooth = function ( geometry ) {
-
-		var tmp = new THREE.Vector3();
-
-		var oldVertices, oldFaces, oldUvs;
-		var newVertices, newFaces, newUVs = [];
-
-		var n, i, il, j, k;
-		var metaVertices, sourceEdges;
-
-		// new stuff.
-		var sourceEdges, newEdgeVertices, newSourceVertices;
-
-		oldVertices = geometry.vertices; // { x, y, z}
-		oldFaces = geometry.faces; // { a: oldVertex1, b: oldVertex2, c: oldVertex3 }
-		oldUvs = geometry.faceVertexUvs;
-
-		var hasUvs = oldUvs[ 0 ] !== undefined && oldUvs[ 0 ].length > 0;
-
-		if ( hasUvs ) {
-
-			for ( var j = 0; j < oldUvs.length; j ++ ) {
-
-				newUVs.push( [] );
-
-			}
-
-		}
-
-		/******************************************************
-		 *
-		 * Step 0: Preprocess Geometry to Generate edges Lookup
-		 *
-		 *******************************************************/
-
-		metaVertices = new Array( oldVertices.length );
-		sourceEdges = {}; // Edge => { oldVertex1, oldVertex2, faces[]  }
-
-		generateLookups( oldVertices, oldFaces, metaVertices, sourceEdges );
-
-
-		/******************************************************
-		 *
-		 *	Step 1.
-		 *	For each edge, create a new Edge Vertex,
-		 *	then position it.
-		 *
-		 *******************************************************/
-
-		newEdgeVertices = [];
-		var other, currentEdge, newEdge, face;
-		var edgeVertexWeight, adjacentVertexWeight, connectedFaces;
-
-		for ( i in sourceEdges ) {
-
-			currentEdge = sourceEdges[ i ];
-			newEdge = new THREE.Vector3();
-
-			edgeVertexWeight = 3 / 8;
-			adjacentVertexWeight = 1 / 8;
-
-			connectedFaces = currentEdge.faces.length;
-
-			// check how many linked faces. 2 should be correct.
-			if ( connectedFaces != 2 ) {
-
-				// if length is not 2, handle condition
-				edgeVertexWeight = 0.5;
-				adjacentVertexWeight = 0;
-
-				if ( connectedFaces != 1 ) {
-
-					// console.warn( 'Subdivision Modifier: Number of connected faces != 2, is: ', connectedFaces, currentEdge );
-
-				}
-
-			}
-
-			newEdge.addVectors( currentEdge.a, currentEdge.b ).multiplyScalar( edgeVertexWeight );
-
-			tmp.set( 0, 0, 0 );
-
-			for ( j = 0; j < connectedFaces; j ++ ) {
-
-				face = currentEdge.faces[ j ];
-
-				for ( k = 0; k < 3; k ++ ) {
-
-					other = oldVertices[ face[ ABC[ k ] ] ];
-					if ( other !== currentEdge.a && other !== currentEdge.b ) break;
-
-				}
-
-				tmp.add( other );
-
-			}
-
-			tmp.multiplyScalar( adjacentVertexWeight );
-			newEdge.add( tmp );
-
-			currentEdge.newEdge = newEdgeVertices.length;
-			newEdgeVertices.push( newEdge );
-
-			// console.log(currentEdge, newEdge);
-
-		}
-
-		/******************************************************
-		 *
-		 *	Step 2.
-		 *	Reposition each source vertices.
-		 *
-		 *******************************************************/
-
-		var beta, sourceVertexWeight, connectingVertexWeight;
-		var connectingEdge, connectingEdges, oldVertex, newSourceVertex;
-		newSourceVertices = [];
-
-		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
-
-			oldVertex = oldVertices[ i ];
-
-			// find all connecting edges (using lookupTable)
-			connectingEdges = metaVertices[ i ].edges;
-			n = connectingEdges.length;
-
-			if ( n == 3 ) {
-
-				beta = 3 / 16;
-
-			} else if ( n > 3 ) {
-
-				beta = 3 / ( 8 * n ); // Warren's modified formula
-
-			}
-
-			// Loop's original beta formula
-			// beta = 1 / n * ( 5/8 - Math.pow( 3/8 + 1/4 * Math.cos( 2 * Math. PI / n ), 2) );
-
-			sourceVertexWeight = 1 - n * beta;
-			connectingVertexWeight = beta;
-
-			if ( n <= 2 ) {
-
-				// crease and boundary rules
-				// console.warn('crease and boundary rules');
-
-				if ( n == 2 ) {
-
-					// console.warn( '2 connecting edges', connectingEdges );
-					sourceVertexWeight = 3 / 4;
-					connectingVertexWeight = 1 / 8;
-
-					// sourceVertexWeight = 1;
-					// connectingVertexWeight = 0;
-
-				} else if ( n == 1 ) {
-
-					// console.warn( 'only 1 connecting edge' );
-
-				} else if ( n == 0 ) {
-
-					// console.warn( '0 connecting edges' );
-
-				}
-
-			}
-
-			newSourceVertex = oldVertex.clone().multiplyScalar( sourceVertexWeight );
-
-			tmp.set( 0, 0, 0 );
-
-			for ( j = 0; j < n; j ++ ) {
-
-				connectingEdge = connectingEdges[ j ];
-				other = connectingEdge.a !== oldVertex ? connectingEdge.a : connectingEdge.b;
-				tmp.add( other );
-
-			}
-
-			tmp.multiplyScalar( connectingVertexWeight );
-			newSourceVertex.add( tmp );
-
-			newSourceVertices.push( newSourceVertex );
-
-		}
-
-
-		/******************************************************
-		 *
-		 *	Step 3.
-		 *	Generate Faces between source vertices
-		 *	and edge vertices.
-		 *
-		 *******************************************************/
-
-		newVertices = newSourceVertices.concat( newEdgeVertices );
-		var sl = newSourceVertices.length, edge1, edge2, edge3;
-		newFaces = [];
-
-		var uv, x0, x1, x2;
-		var x3 = new THREE.Vector2();
-		var x4 = new THREE.Vector2();
-		var x5 = new THREE.Vector2();
-
-		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
-
-			face = oldFaces[ i ];
-
-			// find the 3 new edges vertex of each old face
-
-			edge1 = getEdge( face.a, face.b, sourceEdges ).newEdge + sl;
-			edge2 = getEdge( face.b, face.c, sourceEdges ).newEdge + sl;
-			edge3 = getEdge( face.c, face.a, sourceEdges ).newEdge + sl;
-
-			// create 4 faces.
-
-			newFace( newFaces, edge1, edge2, edge3, face.materialIndex );
-			newFace( newFaces, face.a, edge1, edge3, face.materialIndex );
-			newFace( newFaces, face.b, edge2, edge1, face.materialIndex );
-			newFace( newFaces, face.c, edge3, edge2, face.materialIndex );
-
-			// create 4 new uv's
-
-			if ( hasUvs ) {
-
-				for ( var j = 0; j < oldUvs.length; j ++ ) {
-
-					uv = oldUvs[ j ][ i ];
-
-					x0 = uv[ 0 ];
-					x1 = uv[ 1 ];
-					x2 = uv[ 2 ];
-
-					x3.set( midpoint( x0.x, x1.x ), midpoint( x0.y, x1.y ) );
-					x4.set( midpoint( x1.x, x2.x ), midpoint( x1.y, x2.y ) );
-					x5.set( midpoint( x0.x, x2.x ), midpoint( x0.y, x2.y ) );
-
-					newUv( newUVs[ j ], x3, x4, x5 );
-					newUv( newUVs[ j ], x0, x3, x5 );
-
-					newUv( newUVs[ j ], x1, x4, x3 );
-					newUv( newUVs[ j ], x2, x5, x4 );
-
-				}
-
-			}
-
-		}
-
-		// Overwrite old arrays
-		geometry.vertices = newVertices;
-		geometry.faces = newFaces;
-		if ( hasUvs ) geometry.faceVertexUvs = newUVs;
-
-		// console.log('done');
-
-	};
-
-} )();

+ 192 - 166
examples/js/modifiers/TessellateModifier.js

@@ -2,273 +2,299 @@
  * Break faces with edges longer than maxEdgeLength
  */
 
-THREE.TessellateModifier = function ( maxEdgeLength = 0.1, maxIterations = 6, maxFaces = Infinity ) {
+THREE.TessellateModifier = function ( maxEdgeLength = 0.1, maxIterations = 6 ) {
 
 	this.maxEdgeLength = maxEdgeLength;
 	this.maxIterations = maxIterations;
-	this.maxFaces = maxFaces;
 
 };
 
-// Applies the "modify" pattern
 THREE.TessellateModifier.prototype.modify = function ( geometry ) {
 
-	const isBufferGeometry = geometry.isBufferGeometry;
+	if ( geometry.isGeometry === true ) {
 
-	if ( isBufferGeometry ) {
+		console.error( 'THREE.TessellateModifier no longer supports THREE.Geometry. Use THREE.BufferGeometry instead.' );
+		return geometry;
 
-		geometry = new THREE.Geometry().fromBufferGeometry( geometry );
+	}
 
-	} else {
+	if ( geometry.index !== null ) {
 
-		geometry = geometry.clone();
+		geometry = geometry.toNonIndexed();
 
 	}
 
-	geometry.mergeVertices( 6 );
+	//
 
-	let finalized = false;
-	let iteration = 0;
+	const maxIterations = this.maxIterations;
 	const maxEdgeLengthSquared = this.maxEdgeLength * this.maxEdgeLength;
 
-	let edge;
-
-	while ( ! finalized && iteration < this.maxIterations && geometry.faces.length < this.maxFaces ) {
-
-		const faces = [];
-		const faceVertexUvs = [];
-
-		finalized = true;
-		iteration ++;
-
-		for ( var i = 0, il = geometry.faceVertexUvs.length; i < il; i ++ ) {
-
-			faceVertexUvs[ i ] = [];
-
-		}
-
-		for ( var i = 0, il = geometry.faces.length; i < il; i ++ ) {
+	const va = new THREE.Vector3();
+	const vb = new THREE.Vector3();
+	const vc = new THREE.Vector3();
+	const vm = new THREE.Vector3();
+	const vs = [ va, vb, vc, vm ];
+
+	const na = new THREE.Vector3();
+	const nb = new THREE.Vector3();
+	const nc = new THREE.Vector3();
+	const nm = new THREE.Vector3();
+	const ns = [ na, nb, nc, nm ];
+
+	const ca = new THREE.Color();
+	const cb = new THREE.Color();
+	const cc = new THREE.Color();
+	const cm = new THREE.Color();
+	const cs = [ ca, cb, cc, cm ];
+
+	const ua = new THREE.Vector2();
+	const ub = new THREE.Vector2();
+	const uc = new THREE.Vector2();
+	const um = new THREE.Vector2();
+	const us = [ ua, ub, uc, um ];
+
+	const u2a = new THREE.Vector2();
+	const u2b = new THREE.Vector2();
+	const u2c = new THREE.Vector2();
+	const u2m = new THREE.Vector2();
+	const u2s = [ u2a, u2b, u2c, u2m ];
+
+	const attributes = geometry.attributes;
+	const hasNormals = attributes.normal !== undefined;
+	const hasColors = attributes.color !== undefined;
+	const hasUVs = attributes.uv !== undefined;
+	const hasUV2s = attributes.uv2 !== undefined;
+
+	let positions = attributes.position.array;
+	let normals = hasNormals ? attributes.normal.array : null;
+	let colors = hasColors ? attributes.color.array : null;
+	let uvs = hasUVs ? attributes.uv.array : null;
+	let uv2s = hasUV2s ? attributes.uv2.array : null;
+
+	let positions2 = positions;
+	let normals2 = normals;
+	let colors2 = colors;
+	let uvs2 = uvs;
+	let uv2s2 = uv2s;
 
-			const face = geometry.faces[ i ];
-
-			if ( face instanceof THREE.Face3 ) {
-
-				const a = face.a;
-				const b = face.b;
-				const c = face.c;
-
-				const va = geometry.vertices[ a ];
-				const vb = geometry.vertices[ b ];
-				const vc = geometry.vertices[ c ];
-
-				const dab = va.distanceToSquared( vb );
-				const dbc = vb.distanceToSquared( vc );
-				const dac = va.distanceToSquared( vc );
+	let iteration = 0;
+	let tessellating = true;
 
-				const limitReached = ( faces.length + il - i ) >= this.maxFaces;
+	function addTriangle( a, b, c ) {
 
-				if ( ! limitReached && ( dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared ) ) {
+		const v1 = vs[ a ];
+		const v2 = vs[ b ];
+		const v3 = vs[ c ];
 
-					finalized = false;
+		positions2.push( v1.x, v1.y, v1.z );
+		positions2.push( v2.x, v2.y, v2.z );
+		positions2.push( v3.x, v3.y, v3.z );
 
-					const m = geometry.vertices.length;
+		if ( hasNormals ) {
 
-					const triA = face.clone();
-					const triB = face.clone();
+			const n1 = ns[ a ];
+			const n2 = ns[ b ];
+			const n3 = ns[ c ];
 
-					if ( dab >= dbc && dab >= dac ) {
+			normals2.push( n1.x, n1.y, n1.z );
+			normals2.push( n2.x, n2.y, n2.z );
+			normals2.push( n3.x, n3.y, n3.z );
 
-						var vm = va.clone();
-						vm.lerp( vb, 0.5 );
+		}
 
-						triA.a = a;
-						triA.b = m;
-						triA.c = c;
+		if ( hasColors ) {
 
-						triB.a = m;
-						triB.b = b;
-						triB.c = c;
+			const c1 = cs[ a ];
+			const c2 = cs[ b ];
+			const c3 = cs[ c ];
 
-						if ( face.vertexNormals.length === 3 ) {
+			colors2.push( c1.x, c1.y, c1.z );
+			colors2.push( c2.x, c2.y, c2.z );
+			colors2.push( c3.x, c3.y, c3.z );
 
-							var vnm = face.vertexNormals[ 0 ].clone();
-							vnm.lerp( face.vertexNormals[ 1 ], 0.5 );
+		}
 
-							triA.vertexNormals[ 1 ].copy( vnm );
-							triB.vertexNormals[ 0 ].copy( vnm );
+		if ( hasUVs ) {
 
-						}
+			const u1 = us[ a ];
+			const u2 = us[ b ];
+			const u3 = us[ c ];
 
-						if ( face.vertexColors.length === 3 ) {
+			uvs2.push( u1.x, u1.y );
+			uvs2.push( u2.x, u2.y );
+			uvs2.push( u3.x, u3.y );
 
-							var vcm = face.vertexColors[ 0 ].clone();
-							vcm.lerp( face.vertexColors[ 1 ], 0.5 );
+		}
 
-							triA.vertexColors[ 1 ].copy( vcm );
-							triB.vertexColors[ 0 ].copy( vcm );
+		if ( hasUV2s ) {
 
-						}
+			const u21 = u2s[ a ];
+			const u22 = u2s[ b ];
+			const u23 = u2s[ c ];
 
-						edge = 0;
+			uv2s2.push( u21.x, u21.y );
+			uv2s2.push( u22.x, u22.y );
+			uv2s2.push( u23.x, u23.y );
 
-					} else if ( dbc >= dab && dbc >= dac ) {
+		}
 
-						var vm = vb.clone();
-						vm.lerp( vc, 0.5 );
+	}
 
-						triA.a = a;
-						triA.b = b;
-						triA.c = m;
+	while ( tessellating && iteration < maxIterations ) {
 
-						triB.a = m;
-						triB.b = c;
-						triB.c = a;
+		iteration ++;
+		tessellating = false;
 
-						if ( face.vertexNormals.length === 3 ) {
+		positions = positions2;
+		positions2 = [];
 
-							var vnm = face.vertexNormals[ 1 ].clone();
-							vnm.lerp( face.vertexNormals[ 2 ], 0.5 );
+		if ( hasNormals ) {
 
-							triA.vertexNormals[ 2 ].copy( vnm );
+			normals = normals2;
+			normals2 = [];
 
-							triB.vertexNormals[ 0 ].copy( vnm );
-							triB.vertexNormals[ 1 ].copy( face.vertexNormals[ 2 ] );
-							triB.vertexNormals[ 2 ].copy( face.vertexNormals[ 0 ] );
+		}
 
-						}
+		if ( hasColors ) {
 
-						if ( face.vertexColors.length === 3 ) {
+			colors = colors2;
+			colors2 = [];
 
-							var vcm = face.vertexColors[ 1 ].clone();
-							vcm.lerp( face.vertexColors[ 2 ], 0.5 );
+		}
 
-							triA.vertexColors[ 2 ].copy( vcm );
+		if ( hasUVs ) {
 
-							triB.vertexColors[ 0 ].copy( vcm );
-							triB.vertexColors[ 1 ].copy( face.vertexColors[ 2 ] );
-							triB.vertexColors[ 2 ].copy( face.vertexColors[ 0 ] );
+			uvs = uvs2;
+			uvs2 = [];
 
-						}
+		}
 
-						edge = 1;
+		if ( hasUV2s ) {
 
-					} else {
+			uv2s = uv2s2;
+			uv2s2 = [];
 
-						var vm = va.clone();
-						vm.lerp( vc, 0.5 );
+		}
 
-						triA.a = a;
-						triA.b = b;
-						triA.c = m;
+		for ( var i = 0, i2 = 0, il = positions.length; i < il; i += 9, i2 += 6 ) {
 
-						triB.a = m;
-						triB.b = b;
-						triB.c = c;
+			va.fromArray( positions, i + 0 );
+			vb.fromArray( positions, i + 3 );
+			vc.fromArray( positions, i + 6 );
 
-						if ( face.vertexNormals.length === 3 ) {
+			if ( hasNormals ) {
 
-							var vnm = face.vertexNormals[ 0 ].clone();
-							vnm.lerp( face.vertexNormals[ 2 ], 0.5 );
+				na.fromArray( normals, i + 0 );
+				nb.fromArray( normals, i + 3 );
+				nc.fromArray( normals, i + 6 );
 
-							triA.vertexNormals[ 2 ].copy( vnm );
-							triB.vertexNormals[ 0 ].copy( vnm );
+			}
 
-						}
+			if ( hasColors ) {
 
-						if ( face.vertexColors.length === 3 ) {
+				ca.fromArray( colors, i + 0 );
+				cb.fromArray( colors, i + 3 );
+				cc.fromArray( colors, i + 6 );
 
-							var vcm = face.vertexColors[ 0 ].clone();
-							vcm.lerp( face.vertexColors[ 2 ], 0.5 );
+			}
 
-							triA.vertexColors[ 2 ].copy( vcm );
-							triB.vertexColors[ 0 ].copy( vcm );
+			if ( hasUVs ) {
 
-						}
+				ua.fromArray( uvs, i2 + 0 );
+				ub.fromArray( uvs, i2 + 2 );
+				uc.fromArray( uvs, i2 + 4 );
 
-						edge = 2;
+			}
 
-					}
+			if ( hasUV2s ) {
 
-					faces.push( triA, triB );
-					geometry.vertices.push( vm );
+				u2a.fromArray( uv2s, i2 + 0 );
+				u2b.fromArray( uv2s, i2 + 2 );
+				u2c.fromArray( uv2s, i2 + 4 );
 
-					for ( var j = 0, jl = geometry.faceVertexUvs.length; j < jl; j ++ ) {
+			}
 
-						if ( geometry.faceVertexUvs[ j ].length ) {
+			const dab = va.distanceToSquared( vb );
+			const dbc = vb.distanceToSquared( vc );
+			const dac = va.distanceToSquared( vc );
 
-							const uvs = geometry.faceVertexUvs[ j ][ i ];
+			if ( dab > maxEdgeLengthSquared || dbc > maxEdgeLengthSquared || dac > maxEdgeLengthSquared ) {
 
-							const uvA = uvs[ 0 ];
-							const uvB = uvs[ 1 ];
-							const uvC = uvs[ 2 ];
+				tessellating = true;
 
-							// AB
+				if ( dab >= dbc && dab >= dac ) {
 
-							if ( edge === 0 ) {
+					vm.lerpVectors( va, vb, 0.5 );
+					if ( hasNormals ) nm.lerpVectors( na, nb, 0.5 );
+					if ( hasColors ) cm.lerpColors( ca, cb, 0.5 );
+					if ( hasUVs ) um.lerpVectors( ua, ub, 0.5 );
+					if ( hasUV2s ) u2m.lerpVectors( u2a, u2b, 0.5 );
 
-								var uvM = uvA.clone();
-								uvM.lerp( uvB, 0.5 );
+					addTriangle( 0, 3, 2 );
+					addTriangle( 3, 1, 2 );
 
-								var uvsTriA = [ uvA.clone(), uvM.clone(), uvC.clone() ];
-								var uvsTriB = [ uvM.clone(), uvB.clone(), uvC.clone() ];
+				} else if ( dbc >= dab && dbc >= dac ) {
 
-								// BC
+					vm.lerpVectors( vb, vc, 0.5 );
+					if ( hasNormals ) nm.lerpVectors( nb, nc, 0.5 );
+					if ( hasColors ) cm.lerpColors( cb, cc, 0.5 );
+					if ( hasUVs ) um.lerpVectors( ub, uc, 0.5 );
+					if ( hasUV2s ) u2m.lerpVectors( u2b, u2c, 0.5 );
 
-							} else if ( edge === 1 ) {
+					addTriangle( 0, 1, 3 );
+					addTriangle( 3, 2, 0 );
 
-								var uvM = uvB.clone();
-								uvM.lerp( uvC, 0.5 );
+				} else {
 
-								var uvsTriA = [ uvA.clone(), uvB.clone(), uvM.clone() ];
-								var uvsTriB = [ uvM.clone(), uvC.clone(), uvA.clone() ];
+					vm.lerpVectors( va, vc, 0.5 );
+					if ( hasNormals ) nm.lerpVectors( na, nc, 0.5 );
+					if ( hasColors ) cm.lerpColors( ca, cc, 0.5 );
+					if ( hasUVs ) um.lerpVectors( ua, uc, 0.5 );
+					if ( hasUV2s ) u2m.lerpVectors( u2a, u2c, 0.5 );
 
-								// AC
+					addTriangle( 0, 1, 3 );
+					addTriangle( 3, 1, 2 );
 
-							} else {
+				}
 
-								var uvM = uvA.clone();
-								uvM.lerp( uvC, 0.5 );
+			} else {
 
-								var uvsTriA = [ uvA.clone(), uvB.clone(), uvM.clone() ];
-								var uvsTriB = [ uvM.clone(), uvB.clone(), uvC.clone() ];
+				addTriangle( 0, 1, 2 );
 
-							}
+			}
 
-							faceVertexUvs[ j ].push( uvsTriA, uvsTriB );
+		}
 
-						}
+	}
 
-					}
+	const geometry2 = new THREE.BufferGeometry();
 
-				} else {
+	geometry2.setAttribute( 'position', new THREE.Float32BufferAttribute( positions2, 3 ) );
 
-					faces.push( face );
+	if ( hasNormals ) {
 
-					for ( var j = 0, jl = geometry.faceVertexUvs.length; j < jl; j ++ ) {
+		geometry2.setAttribute( 'normal', new THREE.Float32BufferAttribute( normals2, 3 ) );
 
-						faceVertexUvs[ j ].push( geometry.faceVertexUvs[ j ][ i ] );
+	}
 
-					}
+	if ( hasColors ) {
 
-				}
+		geometry2.setAttribute( 'color', new THREE.Float32BufferAttribute( colors2, 3 ) );
 
-			}
+	}
 
-		}
+	if ( hasUVs ) {
 
-		geometry.faces = faces;
-		geometry.faceVertexUvs = faceVertexUvs;
+		geometry2.setAttribute( 'uv', new THREE.Float32BufferAttribute( uvs2, 2 ) );
 
 	}
 
-	if ( isBufferGeometry ) {
-
-		return new THREE.BufferGeometry().fromGeometry( geometry );
+	if ( hasUV2s ) {
 
-	} else {
-
-		return geometry;
+		geometry2.setAttribute( 'uv2', new THREE.Float32BufferAttribute( uv2s2, 2 ) );
 
 	}
 
+	return geometry2;
+
 };

+ 1 - 1
examples/js/objects/Sky.js

@@ -25,7 +25,7 @@ THREE.Sky = function () {
 		depthWrite: false
 	} );
 
-	THREE.Mesh.call( this, new THREE.BoxBufferGeometry( 1, 1, 1 ), material );
+	THREE.Mesh.call( this, new THREE.BoxGeometry( 1, 1, 1 ), material );
 
 };
 

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

@@ -8,7 +8,7 @@ THREE.CubeTexturePass = function ( camera, envMap, opacity ) {
 
 	this.cubeShader = THREE.ShaderLib[ 'cube' ];
 	this.cubeMesh = new THREE.Mesh(
-		new THREE.BoxBufferGeometry( 10, 10, 10 ),
+		new THREE.BoxGeometry( 10, 10, 10 ),
 		new THREE.ShaderMaterial( {
 			uniforms: this.cubeShader.uniforms,
 			vertexShader: this.cubeShader.vertexShader,

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

@@ -261,7 +261,7 @@ Object.assign( THREE.Pass.prototype, {
 THREE.Pass.FullScreenQuad = ( function () {
 
 	var camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 );
-	var geometry = new THREE.PlaneBufferGeometry( 2, 2 );
+	var geometry = new THREE.PlaneGeometry( 2, 2 );
 
 	var FullScreenQuad = function ( material ) {
 

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

@@ -53,7 +53,7 @@ THREE.ShadowMapViewer = function ( light ) {
 		vertexShader: shader.vertexShader,
 		fragmentShader: shader.fragmentShader
 	} );
-	var plane = new THREE.PlaneBufferGeometry( frame.width, frame.height );
+	var plane = new THREE.PlaneGeometry( frame.width, frame.height );
 	var mesh = new THREE.Mesh( plane, material );
 
 	scene.add( mesh );
@@ -85,7 +85,7 @@ THREE.ShadowMapViewer = function ( light ) {
 		var labelMaterial = new THREE.MeshBasicMaterial( { map: labelTexture, side: THREE.DoubleSide } );
 		labelMaterial.transparent = true;
 
-		var labelPlane = new THREE.PlaneBufferGeometry( labelCanvas.width, labelCanvas.height );
+		var labelPlane = new THREE.PlaneGeometry( labelCanvas.width, labelCanvas.height );
 		labelMesh = new THREE.Mesh( labelPlane, labelMaterial );
 
 		scene.add( labelMesh );

+ 1 - 1
examples/js/utils/UVsDebug.js

@@ -2,7 +2,7 @@
  * tool for "unwrapping" and debugging three.js geometries UV mapping
  *
  * Sample usage:
- *	document.body.appendChild( THREE.UVsDebug( new THREE.SphereBufferGeometry( 10, 10, 10, 10 ) );
+ *	document.body.appendChild( THREE.UVsDebug( new THREE.SphereGeometry( 10, 10, 10, 10 ) );
  *
  */
 

+ 2 - 2
examples/jsm/animation/CCDIKSolver.js

@@ -9,7 +9,7 @@ import {
 	MeshBasicMaterial,
 	Object3D,
 	Quaternion,
-	SphereBufferGeometry,
+	SphereGeometry,
 	Vector3
 } from '../../../build/three.module.js';
 
@@ -272,7 +272,7 @@ var CCDIKSolver = ( function () {
 		this.matrix.copy( mesh.matrixWorld );
 		this.matrixAutoUpdate = false;
 
-		this.sphereGeometry = new SphereBufferGeometry( 0.25, 16, 8 );
+		this.sphereGeometry = new SphereGeometry( 0.25, 16, 8 );
 
 		this.targetSphereMaterial = new MeshBasicMaterial( {
 			color: new Color( 0xff8888 ),

+ 8 - 8
examples/jsm/animation/MMDPhysics.js

@@ -1,15 +1,15 @@
 import {
 	Bone,
-	BoxBufferGeometry,
+	BoxGeometry,
 	Color,
-	CylinderBufferGeometry,
+	CylinderGeometry,
 	Euler,
 	Matrix4,
 	Mesh,
 	MeshBasicMaterial,
 	Object3D,
 	Quaternion,
-	SphereBufferGeometry,
+	SphereGeometry,
 	Vector3
 } from '../../../build/three.module.js';
 
@@ -1373,10 +1373,10 @@ var MMDPhysics = ( function () {
 				switch ( param.shapeType ) {
 
 					case 0:
-						return new SphereBufferGeometry( param.width, 16, 8 );
+						return new SphereGeometry( param.width, 16, 8 );
 
 					case 1:
-						return new BoxBufferGeometry( param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8 );
+						return new BoxGeometry( param.width * 2, param.height * 2, param.depth * 2, 8, 8, 8 );
 
 					case 2:
 						return new createCapsuleGeometry( param.width, param.height, 16, 8 );
@@ -1391,9 +1391,9 @@ var MMDPhysics = ( function () {
 			// copy from http://www20.atpages.jp/katwat/three.js_r58/examples/mytest37/mytest37.js?ver=20160815
 			function createCapsuleGeometry( radius, cylinderHeight, segmentsRadius, segmentsHeight ) {
 
-				var geometry = new CylinderBufferGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
-				var upperSphere = new Mesh( new SphereBufferGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, 0, Math.PI / 2 ) );
-				var lowerSphere = new Mesh( new SphereBufferGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, Math.PI / 2, Math.PI / 2 ) );
+				var geometry = new CylinderGeometry( radius, radius, cylinderHeight, segmentsRadius, segmentsHeight, true );
+				var upperSphere = new Mesh( new SphereGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, 0, Math.PI / 2 ) );
+				var lowerSphere = new Mesh( new SphereGeometry( radius, segmentsRadius, segmentsHeight, 0, Math.PI * 2, Math.PI / 2, Math.PI / 2 ) );
 
 				upperSphere.position.set( 0, cylinderHeight / 2, 0 );
 				lowerSphere.position.set( 0, - cylinderHeight / 2, 0 );

+ 2 - 2
examples/jsm/cameras/CinematicCamera.js

@@ -3,7 +3,7 @@ import {
 	Mesh,
 	OrthographicCamera,
 	PerspectiveCamera,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	RGBFormat,
 	Scene,
 	ShaderMaterial,
@@ -173,7 +173,7 @@ CinematicCamera.prototype.initPostProcessing = function () {
 			}
 		} );
 
-		this.postprocessing.quad = new Mesh( new PlaneBufferGeometry( window.innerWidth, window.innerHeight ), this.postprocessing.materialBokeh );
+		this.postprocessing.quad = new Mesh( new PlaneGeometry( window.innerWidth, window.innerHeight ), this.postprocessing.materialBokeh );
 		this.postprocessing.quad.position.z = - 500;
 		this.postprocessing.scene.add( this.postprocessing.quad );
 

+ 22 - 22
examples/jsm/controls/FirstPersonControls.js

@@ -155,22 +155,22 @@ var FirstPersonControls = function ( object, domElement ) {
 
 		//event.preventDefault();
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 38: /*up*/
-			case 87: /*W*/ this.moveForward = true; break;
+			case 'ArrowUp':
+			case 'KeyW': this.moveForward = true; break;
 
-			case 37: /*left*/
-			case 65: /*A*/ this.moveLeft = true; break;
+			case 'ArrowLeft':
+			case 'KeyA': this.moveLeft = true; break;
 
-			case 40: /*down*/
-			case 83: /*S*/ this.moveBackward = true; break;
+			case 'ArrowDown':
+			case 'KeyS': this.moveBackward = true; break;
 
-			case 39: /*right*/
-			case 68: /*D*/ this.moveRight = true; break;
+			case 'ArrowRight':
+			case 'KeyD': this.moveRight = true; break;
 
-			case 82: /*R*/ this.moveUp = true; break;
-			case 70: /*F*/ this.moveDown = true; break;
+			case 'KeyR': this.moveUp = true; break;
+			case 'KeyF': this.moveDown = true; break;
 
 		}
 
@@ -178,22 +178,22 @@ var FirstPersonControls = function ( object, domElement ) {
 
 	this.onKeyUp = function ( event ) {
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 38: /*up*/
-			case 87: /*W*/ this.moveForward = false; break;
+			case 'ArrowUp':
+			case 'KeyW': this.moveForward = false; break;
 
-			case 37: /*left*/
-			case 65: /*A*/ this.moveLeft = false; break;
+			case 'ArrowLeft':
+			case 'KeyA': this.moveLeft = false; break;
 
-			case 40: /*down*/
-			case 83: /*S*/ this.moveBackward = false; break;
+			case 'ArrowDown':
+			case 'KeyS': this.moveBackward = false; break;
 
-			case 39: /*right*/
-			case 68: /*D*/ this.moveRight = false; break;
+			case 'ArrowRight':
+			case 'KeyD': this.moveRight = false; break;
 
-			case 82: /*R*/ this.moveUp = false; break;
-			case 70: /*F*/ this.moveDown = false; break;
+			case 'KeyR': this.moveUp = false; break;
+			case 'KeyF': this.moveDown = false; break;
 
 		}
 

+ 30 - 28
examples/jsm/controls/FlyControls.js

@@ -52,27 +52,28 @@ var FlyControls = function ( object, domElement ) {
 
 		//event.preventDefault();
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 16: /* shift */ this.movementSpeedMultiplier = .1; break;
+			case 'ShiftLeft':
+			case 'ShiftRight': this.movementSpeedMultiplier = .1; break;
 
-			case 87: /*W*/ this.moveState.forward = 1; break;
-			case 83: /*S*/ this.moveState.back = 1; break;
+			case 'KeyW': this.moveState.forward = 1; break;
+			case 'KeyS': this.moveState.back = 1; break;
 
-			case 65: /*A*/ this.moveState.left = 1; break;
-			case 68: /*D*/ this.moveState.right = 1; break;
+			case 'KeyA': this.moveState.left = 1; break;
+			case 'KeyD': this.moveState.right = 1; break;
 
-			case 82: /*R*/ this.moveState.up = 1; break;
-			case 70: /*F*/ this.moveState.down = 1; break;
+			case 'KeyR': this.moveState.up = 1; break;
+			case 'KeyF': this.moveState.down = 1; break;
 
-			case 38: /*up*/ this.moveState.pitchUp = 1; break;
-			case 40: /*down*/ this.moveState.pitchDown = 1; break;
+			case 'ArrowUp': this.moveState.pitchUp = 1; break;
+			case 'ArrowDown': this.moveState.pitchDown = 1; break;
 
-			case 37: /*left*/ this.moveState.yawLeft = 1; break;
-			case 39: /*right*/ this.moveState.yawRight = 1; break;
+			case 'ArrowLeft': this.moveState.yawLeft = 1; break;
+			case 'ArrowRight': this.moveState.yawRight = 1; break;
 
-			case 81: /*Q*/ this.moveState.rollLeft = 1; break;
-			case 69: /*E*/ this.moveState.rollRight = 1; break;
+			case 'KeyQ': this.moveState.rollLeft = 1; break;
+			case 'KeyE': this.moveState.rollRight = 1; break;
 
 		}
 
@@ -83,27 +84,28 @@ var FlyControls = function ( object, domElement ) {
 
 	this.keyup = function ( event ) {
 
-		switch ( event.keyCode ) {
+		switch ( event.code ) {
 
-			case 16: /* shift */ this.movementSpeedMultiplier = 1; break;
+			case 'ShiftLeft':
+			case 'ShiftRight': this.movementSpeedMultiplier = 1; break;
 
-			case 87: /*W*/ this.moveState.forward = 0; break;
-			case 83: /*S*/ this.moveState.back = 0; break;
+			case 'KeyW': this.moveState.forward = 0; break;
+			case 'KeyS': this.moveState.back = 0; break;
 
-			case 65: /*A*/ this.moveState.left = 0; break;
-			case 68: /*D*/ this.moveState.right = 0; break;
+			case 'KeyA': this.moveState.left = 0; break;
+			case 'KeyD': this.moveState.right = 0; break;
 
-			case 82: /*R*/ this.moveState.up = 0; break;
-			case 70: /*F*/ this.moveState.down = 0; break;
+			case 'KeyR': this.moveState.up = 0; break;
+			case 'KeyF': this.moveState.down = 0; break;
 
-			case 38: /*up*/ this.moveState.pitchUp = 0; break;
-			case 40: /*down*/ this.moveState.pitchDown = 0; break;
+			case 'ArrowUp': this.moveState.pitchUp = 0; break;
+			case 'ArrowDown': this.moveState.pitchDown = 0; break;
 
-			case 37: /*left*/ this.moveState.yawLeft = 0; break;
-			case 39: /*right*/ this.moveState.yawRight = 0; break;
+			case 'ArrowLeft': this.moveState.yawLeft = 0; break;
+			case 'ArrowRight': this.moveState.yawRight = 0; break;
 
-			case 81: /*Q*/ this.moveState.rollLeft = 0; break;
-			case 69: /*E*/ this.moveState.rollRight = 0; break;
+			case 'KeyQ': this.moveState.rollLeft = 0; break;
+			case 'KeyE': this.moveState.rollRight = 0; break;
 
 		}
 

+ 2 - 0
examples/jsm/controls/OrbitControls.d.ts

@@ -50,6 +50,8 @@ export class OrbitControls {
 
 	update(): boolean;
 
+	listenToKeyEvents( domElement: HTMLElement ): void;
+
 	saveState(): void;
 
 	reset(): void;

+ 17 - 7
examples/jsm/controls/OrbitControls.js

@@ -72,9 +72,6 @@ var OrbitControls = function ( object, domElement ) {
 	this.autoRotate = false;
 	this.autoRotateSpeed = 2.0; // 30 seconds per round when fps is 60
 
-	// Set to false to disable use of the keys
-	this.enableKeys = true;
-
 	// The four arrow keys
 	this.keys = { LEFT: 37, UP: 38, RIGHT: 39, BOTTOM: 40 };
 
@@ -89,6 +86,9 @@ var OrbitControls = function ( object, domElement ) {
 	this.position0 = this.object.position.clone();
 	this.zoom0 = this.object.zoom;
 
+	// the target DOM element for key events
+	this._domElementKeyEvents = null;
+
 	//
 	// public methods
 	//
@@ -105,6 +105,13 @@ var OrbitControls = function ( object, domElement ) {
 
 	};
 
+	this.listenToKeyEvents = function ( domElement ) {
+
+		domElement.addEventListener( 'keydown', onKeyDown, false );
+		this._domElementKeyEvents = domElement;
+
+	};
+
 	this.saveState = function () {
 
 		scope.target0.copy( scope.target );
@@ -284,7 +291,12 @@ var OrbitControls = function ( object, domElement ) {
 		scope.domElement.ownerDocument.removeEventListener( 'pointermove', onPointerMove, false );
 		scope.domElement.ownerDocument.removeEventListener( 'pointerup', onPointerUp, false );
 
-		scope.domElement.removeEventListener( 'keydown', onKeyDown, false );
+
+		if ( scope._domElementKeyEvents !== null ) {
+
+			scope._domElementKeyEvents.removeEventListener( 'keydown', onKeyDown, false );
+
+		}
 
 		//scope.dispatchEvent( { type: 'dispose' } ); // should this be added here?
 
@@ -999,7 +1011,7 @@ var OrbitControls = function ( object, domElement ) {
 
 	function onKeyDown( event ) {
 
-		if ( scope.enabled === false || scope.enableKeys === false || scope.enablePan === false ) return;
+		if ( scope.enabled === false || scope.enablePan === false ) return;
 
 		handleKeyDown( event );
 
@@ -1179,8 +1191,6 @@ var OrbitControls = function ( object, domElement ) {
 	scope.domElement.addEventListener( 'touchend', onTouchEnd, false );
 	scope.domElement.addEventListener( 'touchmove', onTouchMove, false );
 
-	scope.domElement.addEventListener( 'keydown', onKeyDown, false );
-
 	// force an update at start
 
 	this.update();

+ 43 - 43
examples/jsm/controls/TransformControls.js

@@ -1,8 +1,8 @@
 import {
-	BoxBufferGeometry,
+	BoxGeometry,
 	BufferGeometry,
 	Color,
-	CylinderBufferGeometry,
+	CylinderGeometry,
 	DoubleSide,
 	Euler,
 	Float32BufferAttribute,
@@ -12,12 +12,12 @@ import {
 	Mesh,
 	MeshBasicMaterial,
 	Object3D,
-	OctahedronBufferGeometry,
-	PlaneBufferGeometry,
+	OctahedronGeometry,
+	PlaneGeometry,
 	Quaternion,
 	Raycaster,
-	SphereBufferGeometry,
-	TorusBufferGeometry,
+	SphereGeometry,
+	TorusGeometry,
 	Vector3
 } from '../../../build/three.module.js';
 
@@ -823,9 +823,9 @@ var TransformControlsGizmo = function () {
 
 	// reusable geometry
 
-	var arrowGeometry = new CylinderBufferGeometry( 0, 0.05, 0.2, 12, 1, false );
+	var arrowGeometry = new CylinderGeometry( 0, 0.05, 0.2, 12, 1, false );
 
-	var scaleHandleGeometry = new BoxBufferGeometry( 0.125, 0.125, 0.125 );
+	var scaleHandleGeometry = new BoxGeometry( 0.125, 0.125, 0.125 );
 
 	var lineGeometry = new BufferGeometry();
 	lineGeometry.setAttribute( 'position', new Float32BufferAttribute( [ 0, 0, 0,	1, 0, 0 ], 3 ) );
@@ -878,20 +878,20 @@ var TransformControlsGizmo = function () {
 			[ new Line( lineGeometry, matLineBlue ), null, [ 0, - Math.PI / 2, 0 ]]
 		],
 		XYZ: [
-			[ new Mesh( new OctahedronBufferGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ], [ 0, 0, 0 ]]
+			[ new Mesh( new OctahedronGeometry( 0.1, 0 ), matWhiteTransparent.clone() ), [ 0, 0, 0 ], [ 0, 0, 0 ]]
 		],
 		XY: [
-			[ new Mesh( new PlaneBufferGeometry( 0.295, 0.295 ), matYellowTransparent.clone() ), [ 0.15, 0.15, 0 ]],
+			[ new Mesh( new PlaneGeometry( 0.295, 0.295 ), matYellowTransparent.clone() ), [ 0.15, 0.15, 0 ]],
 			[ new Line( lineGeometry, matLineYellow ), [ 0.18, 0.3, 0 ], null, [ 0.125, 1, 1 ]],
 			[ new Line( lineGeometry, matLineYellow ), [ 0.3, 0.18, 0 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]]
 		],
 		YZ: [
-			[ new Mesh( new PlaneBufferGeometry( 0.295, 0.295 ), matCyanTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]],
+			[ new Mesh( new PlaneGeometry( 0.295, 0.295 ), matCyanTransparent.clone() ), [ 0, 0.15, 0.15 ], [ 0, Math.PI / 2, 0 ]],
 			[ new Line( lineGeometry, matLineCyan ), [ 0, 0.18, 0.3 ], [ 0, 0, Math.PI / 2 ], [ 0.125, 1, 1 ]],
 			[ new Line( lineGeometry, matLineCyan ), [ 0, 0.3, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		],
 		XZ: [
-			[ new Mesh( new PlaneBufferGeometry( 0.295, 0.295 ), matMagentaTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]],
+			[ new Mesh( new PlaneGeometry( 0.295, 0.295 ), matMagentaTransparent.clone() ), [ 0.15, 0, 0.15 ], [ - Math.PI / 2, 0, 0 ]],
 			[ new Line( lineGeometry, matLineMagenta ), [ 0.18, 0, 0.3 ], null, [ 0.125, 1, 1 ]],
 			[ new Line( lineGeometry, matLineMagenta ), [ 0.3, 0, 0.18 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		]
@@ -899,34 +899,34 @@ var TransformControlsGizmo = function () {
 
 	var pickerTranslate = {
 		X: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0.6, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
 		],
 		Y: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0.6, 0 ]]
 		],
 		Z: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 1, 4, 1, false ), matInvisible ), [ 0, 0, 0.6 ], [ Math.PI / 2, 0, 0 ]]
 		],
 		XYZ: [
-			[ new Mesh( new OctahedronBufferGeometry( 0.2, 0 ), matInvisible ) ]
+			[ new Mesh( new OctahedronGeometry( 0.2, 0 ), matInvisible ) ]
 		],
 		XY: [
-			[ new Mesh( new PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ]]
+			[ new Mesh( new PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0.2, 0 ]]
 		],
 		YZ: [
-			[ new Mesh( new PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ]]
+			[ new Mesh( new PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0, 0.2, 0.2 ], [ 0, Math.PI / 2, 0 ]]
 		],
 		XZ: [
-			[ new Mesh( new PlaneBufferGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ - Math.PI / 2, 0, 0 ]]
+			[ new Mesh( new PlaneGeometry( 0.4, 0.4 ), matInvisible ), [ 0.2, 0, 0.2 ], [ - Math.PI / 2, 0, 0 ]]
 		]
 	};
 
 	var helperTranslate = {
 		START: [
-			[ new Mesh( new OctahedronBufferGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
+			[ new Mesh( new OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
 		],
 		END: [
-			[ new Mesh( new OctahedronBufferGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
+			[ new Mesh( new OctahedronGeometry( 0.01, 2 ), matHelper ), null, null, null, 'helper' ]
 		],
 		DELTA: [
 			[ new Line( TranslateHelperGeometry(), matHelper ), null, null, null, 'helper' ]
@@ -945,22 +945,22 @@ var TransformControlsGizmo = function () {
 	var gizmoRotate = {
 		X: [
 			[ new Line( CircleGeometry( 1, 0.5 ), matLineRed ) ],
-			[ new Mesh( new OctahedronBufferGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ]],
+			[ new Mesh( new OctahedronGeometry( 0.04, 0 ), matRed ), [ 0, 0, 0.99 ], null, [ 1, 3, 1 ]],
 		],
 		Y: [
 			[ new Line( CircleGeometry( 1, 0.5 ), matLineGreen ), null, [ 0, 0, - Math.PI / 2 ]],
-			[ new Mesh( new OctahedronBufferGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ]],
+			[ new Mesh( new OctahedronGeometry( 0.04, 0 ), matGreen ), [ 0, 0, 0.99 ], null, [ 3, 1, 1 ]],
 		],
 		Z: [
 			[ new Line( CircleGeometry( 1, 0.5 ), matLineBlue ), null, [ 0, Math.PI / 2, 0 ]],
-			[ new Mesh( new OctahedronBufferGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ]],
+			[ new Mesh( new OctahedronGeometry( 0.04, 0 ), matBlue ), [ 0.99, 0, 0 ], null, [ 1, 3, 1 ]],
 		],
 		E: [
 			[ new Line( CircleGeometry( 1.25, 1 ), matLineYellowTransparent ), null, [ 0, Math.PI / 2, 0 ]],
-			[ new Mesh( new CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, - Math.PI / 2 ], [ 1, 1, 0.001 ]],
-			[ new Mesh( new CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ - 1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
-			[ new Mesh( new CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, - 1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
-			[ new Mesh( new CylinderBufferGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, 1.17, 0 ], [ 0, 0, 0 ], [ 1, 1, 0.001 ]],
+			[ new Mesh( new CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 1.17, 0, 0 ], [ 0, 0, - Math.PI / 2 ], [ 1, 1, 0.001 ]],
+			[ new Mesh( new CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ - 1.17, 0, 0 ], [ 0, 0, Math.PI / 2 ], [ 1, 1, 0.001 ]],
+			[ new Mesh( new CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, - 1.17, 0 ], [ Math.PI, 0, 0 ], [ 1, 1, 0.001 ]],
+			[ new Mesh( new CylinderGeometry( 0.03, 0, 0.15, 4, 1, false ), matLineYellowTransparent ), [ 0, 1.17, 0 ], [ 0, 0, 0 ], [ 1, 1, 0.001 ]],
 		],
 		XYZE: [
 			[ new Line( CircleGeometry( 1, 1 ), matLineGray ), null, [ 0, Math.PI / 2, 0 ]]
@@ -975,19 +975,19 @@ var TransformControlsGizmo = function () {
 
 	var pickerRotate = {
 		X: [
-			[ new Mesh( new TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]],
+			[ new Mesh( new TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, - Math.PI / 2, - Math.PI / 2 ]],
 		],
 		Y: [
-			[ new Mesh( new TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]],
+			[ new Mesh( new TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ Math.PI / 2, 0, 0 ]],
 		],
 		Z: [
-			[ new Mesh( new TorusBufferGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
+			[ new Mesh( new TorusGeometry( 1, 0.1, 4, 24 ), matInvisible ), [ 0, 0, 0 ], [ 0, 0, - Math.PI / 2 ]],
 		],
 		E: [
-			[ new Mesh( new TorusBufferGeometry( 1.25, 0.1, 2, 24 ), matInvisible ) ]
+			[ new Mesh( new TorusGeometry( 1.25, 0.1, 2, 24 ), matInvisible ) ]
 		],
 		XYZE: [
-			[ new Mesh( new SphereBufferGeometry( 0.7, 10, 8 ), matInvisible ) ]
+			[ new Mesh( new SphereGeometry( 0.7, 10, 8 ), matInvisible ) ]
 		]
 	};
 
@@ -1020,25 +1020,25 @@ var TransformControlsGizmo = function () {
 			[ new Line( lineGeometry, matLineMagenta ), [ 0.98, 0, 0.855 ], [ 0, - Math.PI / 2, 0 ], [ 0.125, 1, 1 ]]
 		],
 		XYZX: [
-			[ new Mesh( new BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 1.1, 0, 0 ]],
+			[ new Mesh( new BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 1.1, 0, 0 ]],
 		],
 		XYZY: [
-			[ new Mesh( new BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 1.1, 0 ]],
+			[ new Mesh( new BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 1.1, 0 ]],
 		],
 		XYZZ: [
-			[ new Mesh( new BoxBufferGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 0, 1.1 ]],
+			[ new Mesh( new BoxGeometry( 0.125, 0.125, 0.125 ), matWhiteTransparent.clone() ), [ 0, 0, 1.1 ]],
 		]
 	};
 
 	var pickerScale = {
 		X: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0.5, 0, 0 ], [ 0, 0, - Math.PI / 2 ]]
 		],
 		Y: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0.5, 0 ]]
 		],
 		Z: [
-			[ new Mesh( new CylinderBufferGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]]
+			[ new Mesh( new CylinderGeometry( 0.2, 0, 0.8, 4, 1, false ), matInvisible ), [ 0, 0, 0.5 ], [ Math.PI / 2, 0, 0 ]]
 		],
 		XY: [
 			[ new Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0.85, 0 ], null, [ 3, 3, 0.2 ]],
@@ -1050,13 +1050,13 @@ var TransformControlsGizmo = function () {
 			[ new Mesh( scaleHandleGeometry, matInvisible ), [ 0.85, 0, 0.85 ], null, [ 3, 0.2, 3 ]],
 		],
 		XYZX: [
-			[ new Mesh( new BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ]],
+			[ new Mesh( new BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 1.1, 0, 0 ]],
 		],
 		XYZY: [
-			[ new Mesh( new BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ]],
+			[ new Mesh( new BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 1.1, 0 ]],
 		],
 		XYZZ: [
-			[ new Mesh( new BoxBufferGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ]],
+			[ new Mesh( new BoxGeometry( 0.2, 0.2, 0.2 ), matInvisible ), [ 0, 0, 1.1 ]],
 		]
 	};
 
@@ -1583,7 +1583,7 @@ var TransformControlsPlane = function () {
 	'use strict';
 
 	Mesh.call( this,
-		new PlaneBufferGeometry( 100000, 100000, 2, 2 ),
+		new PlaneGeometry( 100000, 100000, 2, 2 ),
 		new MeshBasicMaterial( { visible: false, wireframe: true, side: DoubleSide, transparent: true, opacity: 0.1, toneMapped: false } )
 	);
 

+ 2 - 2
examples/jsm/csm/CSMHelper.js

@@ -6,7 +6,7 @@ import {
 	LineBasicMaterial,
 	Box3Helper,
 	Box3,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	MeshBasicMaterial,
 	BufferAttribute,
 	DoubleSide
@@ -95,7 +95,7 @@ class CSMHelper extends Group {
 
 			const cascadeLine = new Box3Helper( new Box3(), 0xffffff );
 			const planeMat = new MeshBasicMaterial( { transparent: true, opacity: 0.1, depthWrite: false, side: DoubleSide } );
-			const cascadePlane = new Mesh( new PlaneBufferGeometry(), planeMat );
+			const cascadePlane = new Mesh( new PlaneGeometry(), planeMat );
 			const shadowLineGroup = new Group();
 			const shadowLine = new Box3Helper( new Box3(), 0xffff00 );
 			shadowLineGroup.add( shadowLine );

+ 1 - 1
examples/jsm/deprecated/Geometry.d.ts

@@ -35,7 +35,7 @@ export interface MorphNormals {
 /**
  * Base class for geometries
  *
- * @see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js|src/core/Geometry.js}
+ * see {@link https://github.com/mrdoob/three.js/blob/master/src/core/Geometry.js|src/core/Geometry.js}
  */
 export class Geometry extends EventDispatcher {
 

+ 2 - 2
examples/jsm/effects/AnaglyphEffect.js

@@ -4,7 +4,7 @@ import {
 	Mesh,
 	NearestFilter,
 	OrthographicCamera,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	RGBAFormat,
 	Scene,
 	ShaderMaterial,
@@ -121,7 +121,7 @@ var AnaglyphEffect = function ( renderer, width, height ) {
 
 	} );
 
-	var _mesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), _material );
+	var _mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material );
 	_scene.add( _mesh );
 
 	this.setSize = function ( width, height ) {

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

@@ -3,7 +3,7 @@ import {
 	Mesh,
 	NearestFilter,
 	OrthographicCamera,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	RGBAFormat,
 	Scene,
 	ShaderMaterial,
@@ -72,7 +72,7 @@ var ParallaxBarrierEffect = function ( renderer ) {
 
 	} );
 
-	var mesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), _material );
+	var mesh = new Mesh( new PlaneGeometry( 2, 2 ), _material );
 	_scene.add( mesh );
 
 	this.setSize = function ( width, height ) {

+ 1 - 1
examples/jsm/environments/RoomEnvironment.js

@@ -8,7 +8,7 @@ function RoomEnvironment() {
 
 	const scene = new THREE.Scene();
 
-	const geometry = new THREE.BoxBufferGeometry();
+	const geometry = new THREE.BoxGeometry();
 	geometry.deleteAttribute( 'uv' );
 
 	const roomMaterial = new THREE.MeshStandardMaterial( { side: THREE.BackSide } );

+ 5 - 4
examples/jsm/geometries/ParametricGeometries.js

@@ -1,4 +1,5 @@
 import {
+	BufferGeometry,
 	Curve,
 	ParametricGeometry,
 	Vector3
@@ -149,7 +150,7 @@ ParametricGeometries.TubeGeometry = function ( path, segments, radius, segmentsR
 
 };
 
-ParametricGeometries.TubeGeometry.prototype = Object.create( Geometry.prototype );
+ParametricGeometries.TubeGeometry.prototype = Object.create( BufferGeometry.prototype );
 ParametricGeometries.TubeGeometry.prototype.constructor = ParametricGeometries.TubeGeometry;
 
 
@@ -200,7 +201,7 @@ ParametricGeometries.TorusKnotGeometry = function ( radius, tube, segmentsT, seg
 
 };
 
-ParametricGeometries.TorusKnotGeometry.prototype = Object.create( Geometry.prototype );
+ParametricGeometries.TorusKnotGeometry.prototype = Object.create( BufferGeometry.prototype );
 ParametricGeometries.TorusKnotGeometry.prototype.constructor = ParametricGeometries.TorusKnotGeometry;
 
 
@@ -228,7 +229,7 @@ ParametricGeometries.SphereGeometry = function ( size, u, v ) {
 
 };
 
-ParametricGeometries.SphereGeometry.prototype = Object.create( Geometry.prototype );
+ParametricGeometries.SphereGeometry.prototype = Object.create( BufferGeometry.prototype );
 ParametricGeometries.SphereGeometry.prototype.constructor = ParametricGeometries.SphereGeometry;
 
 
@@ -254,7 +255,7 @@ ParametricGeometries.PlaneGeometry = function ( width, depth, segmentsWidth, seg
 
 };
 
-ParametricGeometries.PlaneGeometry.prototype = Object.create( Geometry.prototype );
+ParametricGeometries.PlaneGeometry.prototype = Object.create( BufferGeometry.prototype );
 ParametricGeometries.PlaneGeometry.prototype.constructor = ParametricGeometries.PlaneGeometry;
 
 export { ParametricGeometries };

+ 2 - 2
examples/jsm/geometries/RoundedBoxBufferGeometry.d.ts → examples/jsm/geometries/RoundedBoxGeometry.d.ts

@@ -1,8 +1,8 @@
 import {
-	BoxBufferGeometry
+	BoxGeometry
 } from '../../../src/Three';
 
-export class RoundedBoxBufferGeometry extends BoxBufferGeometry {
+export class RoundedBoxGeometry extends BoxGeometry {
 
 	constructor( width?: number, height?: number, depth?: number, segments?: number, radius?: number );
 

+ 3 - 3
examples/jsm/geometries/RoundedBoxBufferGeometry.js → examples/jsm/geometries/RoundedBoxGeometry.js

@@ -1,5 +1,5 @@
 import {
-	BoxBufferGeometry,
+	BoxGeometry,
 	Vector3
 } from '../../../build/three.module.js';
 
@@ -37,7 +37,7 @@ function getUv( faceDirVector, normal, uvAxis, projectionAxis, radius, sideLengt
 
 }
 
-class RoundedBoxBufferGeometry extends BoxBufferGeometry {
+class RoundedBoxGeometry extends BoxGeometry {
 
 	constructor( width = 1, height = 1, depth = 1, segments = 2, radius = 0.1 ) {
 
@@ -151,4 +151,4 @@ class RoundedBoxBufferGeometry extends BoxBufferGeometry {
 
 }
 
-export { RoundedBoxBufferGeometry };
+export { RoundedBoxGeometry };

+ 1 - 1
examples/jsm/geometries/TeapotBufferGeometry.d.ts → examples/jsm/geometries/TeapotGeometry.d.ts

@@ -2,7 +2,7 @@ import {
 	BufferGeometry
 } from '../../../src/Three';
 
-export class TeapotBufferGeometry extends BufferGeometry {
+export class TeapotGeometry extends BufferGeometry {
 
 	constructor( size?: number, segments?: number, bottom?: boolean, lid?: boolean, body?: boolean, fitLid?: boolean, blinn?: number );
 

+ 4 - 4
examples/jsm/geometries/TeapotBufferGeometry.js → examples/jsm/geometries/TeapotGeometry.js

@@ -55,7 +55,7 @@ import {
  *
  */
 
-var TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLid, blinn ) {
+var TeapotGeometry = function ( size, segments, bottom, lid, body, fitLid, blinn ) {
 
 	// 32 * 4 * 4 Bezier spline patches
 	var teapotPatches = [
@@ -718,7 +718,7 @@ var TeapotBufferGeometry = function ( size, segments, bottom, lid, body, fitLid,
 };
 
 
-TeapotBufferGeometry.prototype = Object.create( BufferGeometry.prototype );
-TeapotBufferGeometry.prototype.constructor = TeapotBufferGeometry;
+TeapotGeometry.prototype = Object.create( BufferGeometry.prototype );
+TeapotGeometry.prototype.constructor = TeapotGeometry;
 
-export { TeapotBufferGeometry };
+export { TeapotGeometry };

+ 2 - 2
examples/jsm/helpers/LightProbeHelper.js

@@ -1,7 +1,7 @@
 import {
 	Mesh,
 	ShaderMaterial,
-	SphereBufferGeometry
+	SphereGeometry
 } from '../../../build/three.module.js';
 
 function LightProbeHelper( lightProbe, size ) {
@@ -98,7 +98,7 @@ function LightProbeHelper( lightProbe, size ) {
 
 	} );
 
-	var geometry = new SphereBufferGeometry( 1, 32, 16 );
+	var geometry = new SphereGeometry( 1, 32, 16 );
 
 	Mesh.call( this, geometry, material );
 

+ 30 - 12
examples/jsm/loaders/FBXLoader.js

@@ -869,11 +869,17 @@ var FBXLoader = ( function () {
 
 				if ( node.userData.transformData ) {
 
-					if ( node.parent ) node.userData.transformData.parentMatrixWorld = node.parent.matrix;
+					if ( node.parent ) {
+
+						node.userData.transformData.parentMatrix = node.parent.matrix;
+						node.userData.transformData.parentMatrixWorld = node.parent.matrixWorld;
+
+					}
 
 					var transform = generateTransform( node.userData.transformData );
 
 					node.applyMatrix4( transform );
+					node.updateWorldMatrix();
 
 				}
 
@@ -4027,6 +4033,7 @@ var FBXLoader = ( function () {
 		var lRotationPivotM = new Matrix4();
 
 		var lParentGX = new Matrix4();
+		var lParentLX = new Matrix4();
 		var lGlobalT = new Matrix4();
 
 		var inheritType = ( transformData.inheritType ) ? transformData.inheritType : 0;
@@ -4054,6 +4061,7 @@ var FBXLoader = ( function () {
 			var array = transformData.postRotation.map( MathUtils.degToRad );
 			array.push( transformData.eulerOrder );
 			lPostRotationM.makeRotationFromEuler( tempEuler.fromArray( array ) );
+			lPostRotationM.invert();
 
 		}
 
@@ -4066,37 +4074,44 @@ var FBXLoader = ( function () {
 		if ( transformData.rotationPivot ) lRotationPivotM.setPosition( tempVec.fromArray( transformData.rotationPivot ) );
 
 		// parent transform
-		if ( transformData.parentMatrixWorld ) lParentGX = transformData.parentMatrixWorld;
+		if ( transformData.parentMatrixWorld ) {
+
+			lParentLX.copy( transformData.parentMatrix );
+			lParentGX.copy( transformData.parentMatrixWorld );
 
+		}
+
+		var lLRM = new Matrix4().copy( lPreRotationM ).multiply( lRotationM ).multiply( lPostRotationM );
 		// Global Rotation
-		var lLRM = lPreRotationM.multiply( lRotationM ).multiply( lPostRotationM );
 		var lParentGRM = new Matrix4();
-		lParentGX.extractRotation( lParentGRM );
+		lParentGRM.extractRotation( lParentGX );
 
 		// Global Shear*Scaling
 		var lParentTM = new Matrix4();
 		lParentTM.copyPosition( lParentGX );
 
 		var lParentGSM = new Matrix4();
-		lParentGSM.copy( lParentGRM ).invert().multiply( lParentGX );
+		var lParentGRSM = new Matrix4().copy( lParentTM ).invert().multiply( lParentGX );
+		lParentGSM.copy( lParentGRM ).invert().multiply( lParentGRSM );
+		var lLSM = lScalingM;
 
 		var lGlobalRS = new Matrix4();
 
 		if ( inheritType === 0 ) {
 
-			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM ).multiply( lLSM );
 
 		} else if ( inheritType === 1 ) {
 
-			lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lParentGSM ).multiply( lLRM ).multiply( lLSM );
 
 		} else {
 
-			var lParentLSM_inv = new Matrix4();
-			lParentLSM_inv.copy( lScalingM ).invert();
-			var lParentGSM_noLocal = new Matrix4().multiply( lParentGSM ).multiply( lParentLSM_inv );
+			var lParentLSM = new Matrix4().scale( new Vector3().setFromMatrixScale( lParentLX ) );
+			var lParentLSM_inv = new Matrix4().copy( lParentLSM ).invert();
+			var lParentGSM_noLocal = new Matrix4().copy( lParentGSM ).multiply( lParentLSM_inv );
 
-			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lScalingM );
+			lGlobalRS.copy( lParentGRM ).multiply( lLRM ).multiply( lParentGSM_noLocal ).multiply( lLSM );
 
 		}
 
@@ -4113,7 +4128,10 @@ var FBXLoader = ( function () {
 		var lGlobalTranslation = new Matrix4().copy( lParentGX ).multiply( lLocalTWithAllPivotAndOffsetInfo );
 		lGlobalT.copyPosition( lGlobalTranslation );
 
-		lTransform = new Matrix4().multiply( lGlobalT ).multiply( lGlobalRS );
+		lTransform = new Matrix4().copy( lGlobalT ).multiply( lGlobalRS );
+
+		// from global to local
+		lTransform.premultiply( lParentGX.invert() );
 
 		return lTransform;
 

+ 2 - 0
examples/jsm/loaders/LUT3dlLoader.js

@@ -114,6 +114,7 @@ export class LUT3dlLoader extends Loader {
 		texture.format = RGBFormat;
 		texture.type = UnsignedByteType;
 		texture.magFilter = LinearFilter;
+		texture.minFilter = LinearFilter;
 		texture.wrapS = ClampToEdgeWrapping;
 		texture.wrapT = ClampToEdgeWrapping;
 		texture.generateMipmaps = false;
@@ -126,6 +127,7 @@ export class LUT3dlLoader extends Loader {
 		texture3D.format = RGBFormat;
 		texture3D.type = UnsignedByteType;
 		texture3D.magFilter = LinearFilter;
+		texture3D.minFilter = LinearFilter;
 		texture3D.wrapS = ClampToEdgeWrapping;
 		texture3D.wrapT = ClampToEdgeWrapping;
 		texture3D.wrapR = ClampToEdgeWrapping;

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

@@ -120,6 +120,7 @@ export class LUTCubeLoader extends Loader {
 		texture.format = RGBFormat;
 		texture.type = UnsignedByteType;
 		texture.magFilter = LinearFilter;
+		texture.minFilter = LinearFilter;
 		texture.wrapS = ClampToEdgeWrapping;
 		texture.wrapT = ClampToEdgeWrapping;
 		texture.generateMipmaps = false;
@@ -132,6 +133,7 @@ export class LUTCubeLoader extends Loader {
 		texture3D.format = RGBFormat;
 		texture3D.type = UnsignedByteType;
 		texture3D.magFilter = LinearFilter;
+		texture3D.minFilter = LinearFilter;
 		texture3D.wrapS = ClampToEdgeWrapping;
 		texture3D.wrapT = ClampToEdgeWrapping;
 		texture3D.wrapR = ClampToEdgeWrapping;

+ 7 - 1
examples/jsm/loaders/SVGLoader.d.ts

@@ -6,8 +6,14 @@ import {
 	Vector3
 } from '../../../src/Three';
 
+interface SVGResultPaths extends ShapePath {
+	userData?: {
+		[key: string]: any
+	}
+}
+
 export interface SVGResult {
-	paths: ShapePath[];
+	paths: SVGResultPaths[];
 	xml: XMLDocument;
 }
 

+ 10 - 10
examples/jsm/loaders/VRMLLoader.js

@@ -1,12 +1,12 @@
 import {
 	BackSide,
-	BoxBufferGeometry,
+	BoxGeometry,
 	BufferAttribute,
 	BufferGeometry,
 	ClampToEdgeWrapping,
 	Color,
-	ConeBufferGeometry,
-	CylinderBufferGeometry,
+	ConeGeometry,
+	CylinderGeometry,
 	DataTexture,
 	DoubleSide,
 	FileLoader,
@@ -29,7 +29,7 @@ import {
 	RepeatWrapping,
 	Scene,
 	ShapeUtils,
-	SphereBufferGeometry,
+	SphereGeometry,
 	TextureLoader,
 	Vector2,
 	Vector3
@@ -906,7 +906,7 @@ var VRMLLoader = ( function () {
 
 				if ( skyColor ) {
 
-					var skyGeometry = new SphereBufferGeometry( radius, 32, 16 );
+					var skyGeometry = new SphereGeometry( radius, 32, 16 );
 					var skyMaterial = new MeshBasicMaterial( { fog: false, side: BackSide, depthWrite: false, depthTest: false } );
 
 					if ( skyColor.length > 3 ) {
@@ -931,7 +931,7 @@ var VRMLLoader = ( function () {
 
 					if ( groundColor.length > 0 ) {
 
-						var groundGeometry = new SphereBufferGeometry( radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
+						var groundGeometry = new SphereGeometry( radius, 32, 16, 0, 2 * Math.PI, 0.5 * Math.PI, 1.5 * Math.PI );
 						var groundMaterial = new MeshBasicMaterial( { fog: false, side: BackSide, vertexColors: true, depthWrite: false, depthTest: false } );
 
 						paintFaces( groundGeometry, radius, groundAngle, toColorArray( groundColor ), false );
@@ -2012,7 +2012,7 @@ var VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new BoxBufferGeometry( size.x, size.y, size.z );
+				var geometry = new BoxGeometry( size.x, size.y, size.z );
 
 				return geometry;
 
@@ -2056,7 +2056,7 @@ var VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new ConeBufferGeometry( radius, height, 16, 1, openEnded );
+				var geometry = new ConeGeometry( radius, height, 16, 1, openEnded );
 
 				return geometry;
 
@@ -2104,7 +2104,7 @@ var VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new CylinderBufferGeometry( radius, radius, height, 16, 1 );
+				var geometry = new CylinderGeometry( radius, radius, height, 16, 1 );
 
 				return geometry;
 
@@ -2136,7 +2136,7 @@ var VRMLLoader = ( function () {
 
 				}
 
-				var geometry = new SphereBufferGeometry( radius, 16, 16 );
+				var geometry = new SphereGeometry( radius, 16, 16 );
 
 				return geometry;
 

+ 1 - 1
examples/jsm/misc/ConvexObjectBreaker.js

@@ -24,7 +24,7 @@ import { ConvexGeometry } from '../geometries/ConvexGeometry.js';
  *  - 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 ConvexGeometry. The BoxBufferGeometry, SphereBufferGeometry and other convex primitives
+ *  geometries with 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)

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

@@ -5,7 +5,7 @@ import {
 	FloatType,
 	Mesh,
 	NearestFilter,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	RGBAFormat,
 	Scene,
 	ShaderMaterial,
@@ -128,7 +128,7 @@ var GPUComputationRenderer = function ( sizeX, sizeY, renderer ) {
 
 	var passThruShader = createShaderMaterial( getPassThroughFragmentShader(), passThruUniforms );
 
-	var mesh = new Mesh( new PlaneBufferGeometry( 2, 2 ), passThruShader );
+	var mesh = new Mesh( new PlaneGeometry( 2, 2 ), passThruShader );
 	scene.add( mesh );
 
 

+ 3 - 3
examples/jsm/misc/Ocean.js

@@ -7,7 +7,7 @@ import {
 	Mesh,
 	NearestFilter,
 	OrthographicCamera,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	RGBAFormat,
 	RepeatWrapping,
 	Scene,
@@ -209,7 +209,7 @@ var Ocean = function ( renderer, camera, scene, options ) {
 	this.materialOcean.blending = 0;
 
 	// Create the simulation plane
-	this.screenQuad = new Mesh( new PlaneBufferGeometry( 2, 2 ) );
+	this.screenQuad = new Mesh( new PlaneGeometry( 2, 2 ) );
 	this.scene.add( this.screenQuad );
 
 	// Initialise spectrum data
@@ -222,7 +222,7 @@ var Ocean = function ( renderer, camera, scene, options ) {
 
 Ocean.prototype.generateMesh = function () {
 
-	var geometry = new PlaneBufferGeometry( this.geometrySize, this.geometrySize, this.geometryResolution, this.geometryResolution );
+	var geometry = new PlaneGeometry( this.geometrySize, this.geometrySize, this.geometryResolution, this.geometryResolution );
 
 	geometry.rotateX( - Math.PI / 2 );
 

+ 2 - 2
examples/jsm/misc/VolumeSlice.js

@@ -4,7 +4,7 @@ import {
 	LinearFilter,
 	Mesh,
 	MeshBasicMaterial,
-	PlaneBufferGeometry,
+	PlaneGeometry,
 	Texture
 } from '../../../build/three.module.js';
 
@@ -209,7 +209,7 @@ VolumeSlice.prototype = {
 
 		if ( this.geometry ) this.geometry.dispose(); // dispose existing geometry
 
-		this.geometry = new PlaneBufferGeometry( extracted.planeWidth, extracted.planeHeight );
+		this.geometry = new PlaneGeometry( extracted.planeWidth, extracted.planeHeight );
 
 		if ( this.mesh ) {
 

+ 10 - 9
examples/jsm/modifiers/EdgeSplitModifier.js

@@ -160,36 +160,37 @@ var EdgeSplitModifier = function () {
 
 	this.modify = function ( geometry, cutOffAngle, tryKeepNormals = true ) {
 
-		const wasNotBufferGeometry = geometry.isBufferGeometry === undefined;
-		if ( ! geometry.isBufferGeometry ) {
+		if ( geometry.isGeometry === true ) {
 
-			geometry = new BufferGeometry().fromGeometry( geometry );
+			console.error( 'THREE.EdgeSplitModifier no longer supports THREE.Geometry. Use BufferGeometry instead.' );
+			return;
 
 		}
 
-
 		let hadNormals = false;
 		oldNormals = null;
+
 		if ( geometry.attributes.normal ) {
 
 			hadNormals = true;
 
-			if ( wasNotBufferGeometry === false )
-				geometry = geometry.clone();
+			geometry = geometry.clone();
+
+			if ( tryKeepNormals === true && geometry.index !== null ) {
 
-			if ( tryKeepNormals && geometry.index )
 				oldNormals = geometry.attributes.normal.array;
 
+			}
+
 			geometry.deleteAttribute( 'normal' );
 
 		}
 
-
 		if ( geometry.index == null ) {
 
 			if ( BufferGeometryUtils === undefined ) {
 
-			 	throw 'THREE.EdgeSplitModifier relies on BufferGeometryUtils';
+				throw 'THREE.EdgeSplitModifier relies on BufferGeometryUtils';
 
 			}
 

+ 58 - 22
examples/jsm/modifiers/SimplifyModifier.js

@@ -3,6 +3,7 @@ import {
 	Float32BufferAttribute,
 	Vector3
 } from '../../../build/three.module.js';
+import { BufferGeometryUtils } from '../utils/BufferGeometryUtils.js';
 
 /**
  *	Simplification Geometry Modifier
@@ -12,7 +13,15 @@ import {
  *    - http://www.melax.com/polychop/
  */
 
-var SimplifyModifier = function () {};
+var SimplifyModifier = function () {
+
+	if ( BufferGeometryUtils === undefined ) {
+
+		throw 'THREE.SimplifyModifier relies on BufferGeometryUtils';
+
+	}
+
+};
 
 ( function () {
 
@@ -385,54 +394,81 @@ var SimplifyModifier = function () {};
 
 	SimplifyModifier.prototype.modify = function ( geometry, count ) {
 
-		if ( geometry.isBufferGeometry ) {
+		if ( geometry.isGeometry === true ) {
 
-			geometry = new Geometry().fromBufferGeometry( geometry );
+			console.error( 'THREE.SimplifyModifier no longer supports Geometry. Use BufferGeometry instead.' );
+			return;
 
 		}
 
-		geometry.mergeVertices();
+		geometry = geometry.clone();
+		var attributes = geometry.attributes;
 
-		var oldVertices = geometry.vertices; // Three Position
-		var oldFaces = geometry.faces; // Three Face
+		// this modifier can only process indexed and non-indexed geomtries with a position attribute
 
-		// conversion
-		var vertices = [];
-		var faces = [];
+		for ( var name in attributes ) {
+
+			if ( name !== 'position' ) geometry.deleteAttribute( name );
+
+		}
 
-		var i, il;
+		geometry = BufferGeometryUtils.mergeVertices( geometry );
 
 		//
 		// put data of original geometry in different data structures
 		//
 
+		var vertices = [];
+		var faces = [];
+
 		// add vertices
 
-		for ( i = 0, il = oldVertices.length; i < il; i ++ ) {
+		var positionAttribute = geometry.getAttribute( 'position' );
 
-			var vertex = new Vertex( oldVertices[ i ], i );
+		for ( var i = 0; i < positionAttribute.count; i ++ ) {
+
+			var v = new Vector3().fromBufferAttribute( positionAttribute, i );
+
+			var vertex = new Vertex( v, i );
 			vertices.push( vertex );
 
 		}
 
 		// add faces
 
-		for ( i = 0, il = oldFaces.length; i < il; i ++ ) {
+		var index = geometry.getIndex();
+
+		if ( index !== null ) {
+
+			for ( var i = 0; i < index.count; i += 3 ) {
 
-			var face = oldFaces[ i ];
+				var a = index.getX( i );
+				var b = index.getX( i + 1 );
+				var c = index.getX( i + 2 );
+
+				var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
+				faces.push( triangle );
+
+			}
 
-			var a = face.a;
-			var b = face.b;
-			var c = face.c;
+		} else {
 
-			var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
-			faces.push( triangle );
+			for ( var i = 0; i < positionAttribute.count; i += 3 ) {
+
+				var a = i;
+				var b = i + 1;
+				var c = i + 2;
+
+				var triangle = new Triangle( vertices[ a ], vertices[ b ], vertices[ c ], a, b, c );
+				faces.push( triangle );
+
+			}
 
 		}
 
 		// compute all edge collapse costs
 
-		for ( i = 0, il = vertices.length; i < il; i ++ ) {
+		for ( var i = 0, il = vertices.length; i < il; i ++ ) {
 
 			computeEdgeCostAtVertex( vertices[ i ] );
 
@@ -465,7 +501,7 @@ var SimplifyModifier = function () {};
 
 		//
 
-		for ( i = 0; i < vertices.length; i ++ ) {
+		for ( var i = 0; i < vertices.length; i ++ ) {
 
 			var vertex = vertices[ i ].position;
 			position.push( vertex.x, vertex.y, vertex.z );
@@ -474,7 +510,7 @@ var SimplifyModifier = function () {};
 
 		//
 
-		for ( i = 0; i < faces.length; i ++ ) {
+		for ( var i = 0; i < faces.length; i ++ ) {
 
 			var face = faces[ i ];
 

+ 0 - 14
examples/jsm/modifiers/SubdivisionModifier.d.ts

@@ -1,14 +0,0 @@
-import {
-	BufferGeometry,
-	Geometry
-} from '../../../src/Three';
-
-export class SubdivisionModifier {
-
-	constructor( subdivisions?: number );
-	subdivisions: number;
-
-	modify( geometry: Geometry | BufferGeometry ): Geometry | BufferGeometry;
-	smooth( geometry: Geometry ): void;
-
-}

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