瀏覽代碼

Merge remote-tracking branch 'mrdoob-origin/dev' into gltf-webp-bug

# Conflicts:
#	examples/js/loaders/GLTFLoader.js
#	examples/jsm/loaders/GLTFLoader.js
Garrett Johnson 4 年之前
父節點
當前提交
08f03cead8
共有 34 個文件被更改,包括 607 次插入756 次删除
  1. 1 1
      .github/CONTRIBUTING.md
  2. 204 126
      build/three.js
  3. 0 0
      build/three.min.js
  4. 154 132
      build/three.module.js
  5. 8 0
      docs/examples/en/exporters/GLTFExporter.html
  6. 13 7
      docs/examples/en/loaders/GLTFLoader.html
  7. 8 0
      docs/examples/zh/exporters/GLTFExporter.html
  8. 13 6
      docs/examples/zh/loaders/GLTFLoader.html
  9. 6 6
      docs/manual/ar/introduction/Installation.html
  10. 6 6
      docs/manual/en/introduction/Installation.html
  11. 15 15
      docs/manual/ko/introduction/Installation.html
  12. 4 4
      docs/manual/zh/introduction/Installation.html
  13. 9 39
      examples/js/loaders/GLTFLoader.js
  14. 9 39
      examples/jsm/loaders/GLTFLoader.js
  15. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox.bin
  16. 0 237
      examples/models/gltf/BoomBox/glTF-dds/BoomBox.gltf
  17. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.dds
  18. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.png
  19. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.dds
  20. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.png
  21. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.dds
  22. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.png
  23. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.dds
  24. 二進制
      examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.png
  25. 1 4
      examples/webgl_loader_gltf_extensions.html
  26. 1 1
      examples/webgl_loader_gltf_variants.html
  27. 7 11
      src/objects/Group.js
  28. 34 35
      src/objects/LOD.js
  29. 7 9
      src/objects/LineLoop.js
  30. 31 32
      src/objects/Skeleton.js
  31. 38 41
      src/objects/Sprite.js
  32. 1 1
      src/renderers/shaders/UniformsUtils.js
  33. 36 4
      src/renderers/webgl/WebGLState.js
  34. 1 0
      utils/build/rollup.config.js

+ 1 - 1
.github/CONTRIBUTING.md

@@ -77,6 +77,6 @@ When you’ve decided to make changes, start with the following:
 
 * Once done with a patch / feature do not add more commits to a feature branch
 * Create separate branches per patch or feature.
-* If you make a PR but it is not actually ready to be pulled into the dev branch, add `[Draft]` into the PR title and/or convert it to a draft PR
+* If you make a PR but it is not actually ready to be pulled into the dev branch then please [convert it to a draft PR](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-stage-of-a-pull-request#converting-a-pull-request-to-a-draft).
 
 This project is currently contributed to mostly via everyone's spare time. Please keep that in mind as it may take some time for the appropriate feedback to get to you. If you are unsure about adding a new feature, it might be better to ask first to see whether other people think it's a good idea.

+ 204 - 126
build/three.js

@@ -9696,7 +9696,7 @@
 			for (var p in src[u]) {
 				var property = src[u][p];
 
-				if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture)) {
+				if (property && (property.isColor || property.isMatrix3 || property.isMatrix4 || property.isVector2 || property.isVector3 || property.isVector4 || property.isTexture || property.isQuaternion)) {
 					dst[u][p] = property.clone();
 				} else if (Array.isArray(property)) {
 					dst[u][p] = property.slice();
@@ -15655,7 +15655,7 @@
 		var stencilBuffer = new StencilBuffer();
 		var enabledCapabilities = {};
 		var currentProgram = null;
-		var currentBlendingEnabled = null;
+		var currentBlendingEnabled = false;
 		var currentBlending = null;
 		var currentBlendEquation = null;
 		var currentBlendSrc = null;
@@ -15758,7 +15758,7 @@
 
 		function setBlending(blending, blendEquation, blendSrc, blendDst, blendEquationAlpha, blendSrcAlpha, blendDstAlpha, premultipliedAlpha) {
 			if (blending === NoBlending) {
-				if (currentBlendingEnabled) {
+				if (currentBlendingEnabled === true) {
 					disable(3042);
 					currentBlendingEnabled = false;
 				}
@@ -15766,7 +15766,7 @@
 				return;
 			}
 
-			if (!currentBlendingEnabled) {
+			if (currentBlendingEnabled === false) {
 				enable(3042);
 				currentBlendingEnabled = true;
 			}
@@ -16026,11 +16026,34 @@
 
 
 		function reset() {
+			// reset state
+			gl.disable(3042);
+			gl.disable(2884);
+			gl.disable(2929);
+			gl.disable(32823);
+			gl.disable(3089);
+			gl.disable(2960);
+			gl.blendEquation(32774);
+			gl.blendFunc(1, 0);
+			gl.blendFuncSeparate(1, 0, 1, 0);
+			gl.colorMask(true, true, true, true);
+			gl.clearColor(0, 0, 0, 0);
+			gl.depthMask(true);
+			gl.depthFunc(513);
+			gl.clearDepth(1);
+			gl.stencilMask(0xffffffff);
+			gl.stencilFunc(519, 0, 1);
+			gl.stencilOp(7680, 7680, 7680);
+			gl.clearStencil(0);
+			gl.cullFace(1029);
+			gl.frontFace(2305);
+			gl.polygonOffset(0, 0); // reset internals
+
 			enabledCapabilities = {};
 			currentTextureSlot = null;
 			currentBoundTextures = {};
 			currentProgram = null;
-			currentBlendingEnabled = null;
+			currentBlendingEnabled = false;
 			currentBlending = null;
 			currentBlendEquation = null;
 			currentBlendSrc = null;
@@ -17106,15 +17129,22 @@
 		isArrayCamera: true
 	});
 
-	function Group() {
-		Object3D.call(this);
-		this.type = 'Group';
-	}
+	var Group = /*#__PURE__*/function (_Object3D) {
+		_inheritsLoose(Group, _Object3D);
 
-	Group.prototype = Object.assign(Object.create(Object3D.prototype), {
-		constructor: Group,
-		isGroup: true
-	});
+		function Group() {
+			var _this;
+
+			_this = _Object3D.call(this) || this;
+			_this.type = 'Group';
+			Object.defineProperty(_assertThisInitialized(_this), 'isGroup', {
+				value: true
+			});
+			return _this;
+		}
+
+		return Group;
+	}(Object3D);
 
 	function WebXRController() {
 		this._targetRay = null;
@@ -19927,55 +19957,63 @@
 
 	var _geometry;
 
-	var _intersectPoint = new Vector3();
+	var _intersectPoint = /*@__PURE__*/new Vector3();
 
-	var _worldScale = new Vector3();
+	var _worldScale = /*@__PURE__*/new Vector3();
 
-	var _mvPosition = new Vector3();
+	var _mvPosition = /*@__PURE__*/new Vector3();
 
-	var _alignedPosition = new Vector2();
+	var _alignedPosition = /*@__PURE__*/new Vector2();
 
-	var _rotatedPosition = new Vector2();
+	var _rotatedPosition = /*@__PURE__*/new Vector2();
 
-	var _viewWorldMatrix = new Matrix4();
+	var _viewWorldMatrix = /*@__PURE__*/new Matrix4();
 
-	var _vA$1 = new Vector3();
+	var _vA$1 = /*@__PURE__*/new Vector3();
 
-	var _vB$1 = new Vector3();
+	var _vB$1 = /*@__PURE__*/new Vector3();
 
-	var _vC$1 = new Vector3();
+	var _vC$1 = /*@__PURE__*/new Vector3();
 
-	var _uvA$1 = new Vector2();
+	var _uvA$1 = /*@__PURE__*/new Vector2();
 
-	var _uvB$1 = new Vector2();
+	var _uvB$1 = /*@__PURE__*/new Vector2();
 
-	var _uvC$1 = new Vector2();
+	var _uvC$1 = /*@__PURE__*/new Vector2();
 
-	function Sprite(material) {
-		Object3D.call(this);
-		this.type = 'Sprite';
+	var Sprite = /*#__PURE__*/function (_Object3D) {
+		_inheritsLoose(Sprite, _Object3D);
+
+		function Sprite(material) {
+			var _this;
+
+			_this = _Object3D.call(this) || this;
+			_this.type = 'Sprite';
 
-		if (_geometry === undefined) {
-			_geometry = new BufferGeometry();
-			var float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]);
-			var interleavedBuffer = new InterleavedBuffer(float32Array, 5);
+			if (_geometry === undefined) {
+				_geometry = new BufferGeometry();
+				var float32Array = new Float32Array([-0.5, -0.5, 0, 0, 0, 0.5, -0.5, 0, 1, 0, 0.5, 0.5, 0, 1, 1, -0.5, 0.5, 0, 0, 1]);
+				var interleavedBuffer = new InterleavedBuffer(float32Array, 5);
 
-			_geometry.setIndex([0, 1, 2, 0, 2, 3]);
+				_geometry.setIndex([0, 1, 2, 0, 2, 3]);
 
-			_geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));
+				_geometry.setAttribute('position', new InterleavedBufferAttribute(interleavedBuffer, 3, 0, false));
 
-			_geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));
+				_geometry.setAttribute('uv', new InterleavedBufferAttribute(interleavedBuffer, 2, 3, false));
+			}
+
+			_this.geometry = _geometry;
+			_this.material = material !== undefined ? material : new SpriteMaterial();
+			_this.center = new Vector2(0.5, 0.5);
+			Object.defineProperty(_assertThisInitialized(_this), 'isSprite', {
+				value: true
+			});
+			return _this;
 		}
 
-		this.geometry = _geometry;
-		this.material = material !== undefined ? material : new SpriteMaterial();
-		this.center = new Vector2(0.5, 0.5);
-	}
+		var _proto = Sprite.prototype;
 
-	Sprite.prototype = Object.assign(Object.create(Object3D.prototype), {
-		constructor: Sprite,
-		isSprite: true,
-		raycast: function raycast(raycaster, intersects) {
+		_proto.raycast = function raycast(raycaster, intersects) {
 			if (raycaster.camera === null) {
 				console.error('THREE.Sprite: "Raycaster.camera" needs to be set in order to raycast against sprites.');
 			}
@@ -20036,14 +20074,17 @@
 				face: null,
 				object: this
 			});
-		},
-		copy: function copy(source) {
+		};
+
+		_proto.copy = function copy(source) {
 			Object3D.prototype.copy.call(this, source);
 			if (source.center !== undefined) this.center.copy(source.center);
 			this.material = source.material;
 			return this;
-		}
-	});
+		};
+
+		return Sprite;
+	}(Object3D);
 
 	function transformVertex(vertexPosition, mvPosition, center, scale, sin, cos) {
 		// compute position in camera space
@@ -20064,28 +20105,37 @@
 		vertexPosition.applyMatrix4(_viewWorldMatrix);
 	}
 
-	var _v1$4 = new Vector3();
+	var _v1$4 = /*@__PURE__*/new Vector3();
 
-	var _v2$2 = new Vector3();
+	var _v2$2 = /*@__PURE__*/new Vector3();
 
-	function LOD() {
-		Object3D.call(this);
-		this._currentLevel = 0;
-		this.type = 'LOD';
-		Object.defineProperties(this, {
-			levels: {
-				enumerable: true,
-				value: []
-			}
-		});
-		this.autoUpdate = true;
-	}
+	var LOD = /*#__PURE__*/function (_Object3D) {
+		_inheritsLoose(LOD, _Object3D);
+
+		function LOD() {
+			var _this;
+
+			_this = _Object3D.call(this) || this;
+			_this._currentLevel = 0;
+			_this.type = 'LOD';
+			Object.defineProperties(_assertThisInitialized(_this), {
+				levels: {
+					enumerable: true,
+					value: []
+				},
+				isLOD: {
+					value: true
+				}
+			});
+			_this.autoUpdate = true;
+			return _this;
+		}
+
+		var _proto = LOD.prototype;
+
+		_proto.copy = function copy(source) {
+			_Object3D.prototype.copy.call(this, source, false);
 
-	LOD.prototype = Object.assign(Object.create(Object3D.prototype), {
-		constructor: LOD,
-		isLOD: true,
-		copy: function copy(source) {
-			Object3D.prototype.copy.call(this, source, false);
 			var levels = source.levels;
 
 			for (var i = 0, l = levels.length; i < l; i++) {
@@ -20095,8 +20145,9 @@
 
 			this.autoUpdate = source.autoUpdate;
 			return this;
-		},
-		addLevel: function addLevel(object, distance) {
+		};
+
+		_proto.addLevel = function addLevel(object, distance) {
 			if (distance === void 0) {
 				distance = 0;
 			}
@@ -20117,11 +20168,13 @@
 			});
 			this.add(object);
 			return this;
-		},
-		getCurrentLevel: function getCurrentLevel() {
+		};
+
+		_proto.getCurrentLevel = function getCurrentLevel() {
 			return this._currentLevel;
-		},
-		getObjectForDistance: function getObjectForDistance(distance) {
+		};
+
+		_proto.getObjectForDistance = function getObjectForDistance(distance) {
 			var levels = this.levels;
 
 			if (levels.length > 0) {
@@ -20137,8 +20190,9 @@
 			}
 
 			return null;
-		},
-		raycast: function raycast(raycaster, intersects) {
+		};
+
+		_proto.raycast = function raycast(raycaster, intersects) {
 			var levels = this.levels;
 
 			if (levels.length > 0) {
@@ -20147,8 +20201,9 @@
 				var distance = raycaster.ray.origin.distanceTo(_v1$4);
 				this.getObjectForDistance(distance).raycast(raycaster, intersects);
 			}
-		},
-		update: function update(camera) {
+		};
+
+		_proto.update = function update(camera) {
 			var levels = this.levels;
 
 			if (levels.length > 1) {
@@ -20175,9 +20230,11 @@
 					levels[i].object.visible = false;
 				}
 			}
-		},
-		toJSON: function toJSON(meta) {
-			var data = Object3D.prototype.toJSON.call(this, meta);
+		};
+
+		_proto.toJSON = function toJSON(meta) {
+			var data = _Object3D.prototype.toJSON.call(this, meta);
+
 			if (this.autoUpdate === false) data.object.autoUpdate = false;
 			data.object.levels = [];
 			var levels = this.levels;
@@ -20191,8 +20248,10 @@
 			}
 
 			return data;
-		}
-	});
+		};
+
+		return LOD;
+	}(Object3D);
 
 	var _basePosition = new Vector3();
 
@@ -20307,31 +20366,33 @@
 		isBone: true
 	});
 
-	var _offsetMatrix = new Matrix4();
+	var _offsetMatrix = /*@__PURE__*/new Matrix4();
 
-	var _identityMatrix = new Matrix4();
+	var _identityMatrix = /*@__PURE__*/new Matrix4();
 
-	function Skeleton(bones, boneInverses) {
-		if (bones === void 0) {
-			bones = [];
-		}
+	var Skeleton = /*#__PURE__*/function () {
+		function Skeleton(bones, boneInverses) {
+			if (bones === void 0) {
+				bones = [];
+			}
+
+			if (boneInverses === void 0) {
+				boneInverses = [];
+			}
 
-		if (boneInverses === void 0) {
-			boneInverses = [];
+			this.uuid = MathUtils.generateUUID();
+			this.bones = bones.slice(0);
+			this.boneInverses = boneInverses;
+			this.boneMatrices = null;
+			this.boneTexture = null;
+			this.boneTextureSize = 0;
+			this.frame = -1;
+			this.init();
 		}
 
-		this.uuid = MathUtils.generateUUID();
-		this.bones = bones.slice(0);
-		this.boneInverses = boneInverses;
-		this.boneMatrices = null;
-		this.boneTexture = null;
-		this.boneTextureSize = 0;
-		this.frame = -1;
-		this.init();
-	}
+		var _proto = Skeleton.prototype;
 
-	Object.assign(Skeleton.prototype, {
-		init: function init() {
+		_proto.init = function init() {
 			var bones = this.bones;
 			var boneInverses = this.boneInverses;
 			this.boneMatrices = new Float32Array(bones.length * 16); // calculate inverse bone matrices if necessary
@@ -20349,8 +20410,9 @@
 					}
 				}
 			}
-		},
-		calculateInverses: function calculateInverses() {
+		};
+
+		_proto.calculateInverses = function calculateInverses() {
 			this.boneInverses.length = 0;
 
 			for (var i = 0, il = this.bones.length; i < il; i++) {
@@ -20362,8 +20424,9 @@
 
 				this.boneInverses.push(inverse);
 			}
-		},
-		pose: function pose() {
+		};
+
+		_proto.pose = function pose() {
 			// recover the bind-time world matrices
 			for (var i = 0, il = this.bones.length; i < il; i++) {
 				var bone = this.bones[i];
@@ -20389,8 +20452,9 @@
 					_bone.matrix.decompose(_bone.position, _bone.quaternion, _bone.scale);
 				}
 			}
-		},
-		update: function update() {
+		};
+
+		_proto.update = function update() {
 			var bones = this.bones;
 			var boneInverses = this.boneInverses;
 			var boneMatrices = this.boneMatrices;
@@ -20408,11 +20472,13 @@
 			if (boneTexture !== null) {
 				boneTexture.needsUpdate = true;
 			}
-		},
-		clone: function clone() {
+		};
+
+		_proto.clone = function clone() {
 			return new Skeleton(this.bones, this.boneInverses);
-		},
-		getBoneByName: function getBoneByName(name) {
+		};
+
+		_proto.getBoneByName = function getBoneByName(name) {
 			for (var i = 0, il = this.bones.length; i < il; i++) {
 				var bone = this.bones[i];
 
@@ -20422,14 +20488,16 @@
 			}
 
 			return undefined;
-		},
-		dispose: function dispose() {
+		};
+
+		_proto.dispose = function dispose() {
 			if (this.boneTexture !== null) {
 				this.boneTexture.dispose();
 				this.boneTexture = null;
 			}
-		},
-		fromJSON: function fromJSON(json, bones) {
+		};
+
+		_proto.fromJSON = function fromJSON(json, bones) {
 			this.uuid = json.uuid;
 
 			for (var i = 0, l = json.bones.length; i < l; i++) {
@@ -20447,8 +20515,9 @@
 
 			this.init();
 			return this;
-		},
-		toJSON: function toJSON() {
+		};
+
+		_proto.toJSON = function toJSON() {
 			var data = {
 				metadata: {
 					version: 4.5,
@@ -20470,8 +20539,10 @@
 			}
 
 			return data;
-		}
-	});
+		};
+
+		return Skeleton;
+	}();
 
 	var _instanceLocalMatrix = new Matrix4();
 
@@ -20811,15 +20882,22 @@
 		}
 	});
 
-	function LineLoop(geometry, material) {
-		Line.call(this, geometry, material);
-		this.type = 'LineLoop';
-	}
+	var LineLoop = /*#__PURE__*/function (_Line) {
+		_inheritsLoose(LineLoop, _Line);
 
-	LineLoop.prototype = Object.assign(Object.create(Line.prototype), {
-		constructor: LineLoop,
-		isLineLoop: true
-	});
+		function LineLoop(geometry, material) {
+			var _this;
+
+			_this = _Line.call(this, geometry, material) || this;
+			_this.type = 'LineLoop';
+			Object.defineProperty(_assertThisInitialized(_this), 'isLineLoop', {
+				value: true
+			});
+			return _this;
+		}
+
+		return LineLoop;
+	}(Line);
 
 	/**
 	 * parameters = {

文件差異過大導致無法顯示
+ 0 - 0
build/three.min.js


+ 154 - 132
build/three.module.js

@@ -11260,7 +11260,7 @@ function cloneUniforms( src ) {
 			if ( property && ( property.isColor ||
 				property.isMatrix3 || property.isMatrix4 ||
 				property.isVector2 || property.isVector3 || property.isVector4 ||
-				property.isTexture ) ) {
+				property.isTexture || property.isQuaternion ) ) {
 
 				dst[ u ][ p ] = property.clone();
 
@@ -19386,7 +19386,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	let currentProgram = null;
 
-	let currentBlendingEnabled = null;
+	let currentBlendingEnabled = false;
 	let currentBlending = null;
 	let currentBlendEquation = null;
 	let currentBlendSrc = null;
@@ -19548,7 +19548,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		if ( blending === NoBlending ) {
 
-			if ( currentBlendingEnabled ) {
+			if ( currentBlendingEnabled === true ) {
 
 				disable( 3042 );
 				currentBlendingEnabled = false;
@@ -19559,7 +19559,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		}
 
-		if ( ! currentBlendingEnabled ) {
+		if ( currentBlendingEnabled === false ) {
 
 			enable( 3042 );
 			currentBlendingEnabled = true;
@@ -19945,6 +19945,38 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	function reset() {
 
+		// reset state
+
+		gl.disable( 3042 );
+		gl.disable( 2884 );
+		gl.disable( 2929 );
+		gl.disable( 32823 );
+		gl.disable( 3089 );
+		gl.disable( 2960 );
+
+		gl.blendEquation( 32774 );
+		gl.blendFunc( 1, 0 );
+		gl.blendFuncSeparate( 1, 0, 1, 0 );
+
+		gl.colorMask( true, true, true, true );
+		gl.clearColor( 0, 0, 0, 0 );
+
+		gl.depthMask( true );
+		gl.depthFunc( 513 );
+		gl.clearDepth( 1 );
+
+		gl.stencilMask( 0xffffffff );
+		gl.stencilFunc( 519, 0, 1 );
+		gl.stencilOp( 7680, 7680, 7680 );
+		gl.clearStencil( 0 );
+
+		gl.cullFace( 1029 );
+		gl.frontFace( 2305 );
+
+		gl.polygonOffset( 0, 0 );
+
+		// reset internals
+
 		enabledCapabilities = {};
 
 		currentTextureSlot = null;
@@ -19952,7 +19984,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		currentProgram = null;
 
-		currentBlendingEnabled = null;
+		currentBlendingEnabled = false;
 		currentBlending = null;
 		currentBlendEquation = null;
 		currentBlendSrc = null;
@@ -21533,21 +21565,17 @@ ArrayCamera.prototype = Object.assign( Object.create( PerspectiveCamera.prototyp
 
 } );
 
-function Group() {
-
-	Object3D.call( this );
-
-	this.type = 'Group';
-
-}
+class Group extends Object3D {
 
-Group.prototype = Object.assign( Object.create( Object3D.prototype ), {
+	constructor() {
 
-	constructor: Group,
+		super();
+		this.type = 'Group';
+		Object.defineProperty( this, 'isGroup', { value: true } );
 
-	isGroup: true
+	}
 
-} );
+}
 
 function WebXRController() {
 
@@ -25533,61 +25561,58 @@ SpriteMaterial.prototype.copy = function ( source ) {
 
 let _geometry;
 
-const _intersectPoint = new Vector3();
-const _worldScale = new Vector3();
-const _mvPosition = new Vector3();
-
-const _alignedPosition = new Vector2();
-const _rotatedPosition = new Vector2();
-const _viewWorldMatrix = new Matrix4();
-
-const _vA$1 = new Vector3();
-const _vB$1 = new Vector3();
-const _vC$1 = new Vector3();
+const _intersectPoint = /*@__PURE__*/ new Vector3();
+const _worldScale = /*@__PURE__*/ new Vector3();
+const _mvPosition = /*@__PURE__*/ new Vector3();
 
-const _uvA$1 = new Vector2();
-const _uvB$1 = new Vector2();
-const _uvC$1 = new Vector2();
+const _alignedPosition = /*@__PURE__*/ new Vector2();
+const _rotatedPosition = /*@__PURE__*/ new Vector2();
+const _viewWorldMatrix = /*@__PURE__*/ new Matrix4();
 
-function Sprite( material ) {
+const _vA$1 = /*@__PURE__*/ new Vector3();
+const _vB$1 = /*@__PURE__*/ new Vector3();
+const _vC$1 = /*@__PURE__*/ new Vector3();
 
-	Object3D.call( this );
+const _uvA$1 = /*@__PURE__*/ new Vector2();
+const _uvB$1 = /*@__PURE__*/ new Vector2();
+const _uvC$1 = /*@__PURE__*/ new Vector2();
 
-	this.type = 'Sprite';
+class Sprite extends Object3D {
 
-	if ( _geometry === undefined ) {
+	constructor( material ) {
 
-		_geometry = new BufferGeometry();
+		super();
+		this.type = 'Sprite';
 
-		const float32Array = new Float32Array( [
-			- 0.5, - 0.5, 0, 0, 0,
-			0.5, - 0.5, 0, 1, 0,
-			0.5, 0.5, 0, 1, 1,
-			- 0.5, 0.5, 0, 0, 1
-		] );
+		if ( _geometry === undefined ) {
 
-		const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
+			_geometry = new BufferGeometry();
 
-		_geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
-		_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
-		_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
+			const float32Array = new Float32Array( [
+				- 0.5, - 0.5, 0, 0, 0,
+				0.5, - 0.5, 0, 1, 0,
+				0.5, 0.5, 0, 1, 1,
+				- 0.5, 0.5, 0, 0, 1
+			] );
 
-	}
+			const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
 
-	this.geometry = _geometry;
-	this.material = ( material !== undefined ) ? material : new SpriteMaterial();
+			_geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
+			_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
+			_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
 
-	this.center = new Vector2( 0.5, 0.5 );
+		}
 
-}
+		this.geometry = _geometry;
+		this.material = ( material !== undefined ) ? material : new SpriteMaterial();
 
-Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
+		this.center = new Vector2( 0.5, 0.5 );
 
-	constructor: Sprite,
+		Object.defineProperty( this, 'isSprite', { value: true } );
 
-	isSprite: true,
+	}
 
-	raycast: function ( raycaster, intersects ) {
+	raycast( raycaster, intersects ) {
 
 		if ( raycaster.camera === null ) {
 
@@ -25660,9 +25685,9 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		} );
 
-	},
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
 		Object3D.prototype.copy.call( this, source );
 
@@ -25674,7 +25699,7 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 	}
 
-} );
+}
 
 function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
 
@@ -25703,37 +25728,36 @@ function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos )
 
 }
 
-const _v1$4 = new Vector3();
-const _v2$2 = new Vector3();
-
-function LOD() {
+const _v1$4 = /*@__PURE__*/ new Vector3();
+const _v2$2 = /*@__PURE__*/ new Vector3();
 
-	Object3D.call( this );
-
-	this._currentLevel = 0;
+class LOD extends Object3D {
 
-	this.type = 'LOD';
+	constructor() {
 
-	Object.defineProperties( this, {
-		levels: {
-			enumerable: true,
-			value: []
-		}
-	} );
+		super();
 
-	this.autoUpdate = true;
+		this._currentLevel = 0;
 
-}
+		this.type = 'LOD';
 
-LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
+		Object.defineProperties( this, {
+			levels: {
+				enumerable: true,
+				value: []
+			},
+			isLOD: {
+				value: true,
+			}
+		} );
 
-	constructor: LOD,
+		this.autoUpdate = true;
 
-	isLOD: true,
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
-		Object3D.prototype.copy.call( this, source, false );
+		super.copy( source, false );
 
 		const levels = source.levels;
 
@@ -25749,9 +25773,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return this;
 
-	},
+	}
 
-	addLevel: function ( object, distance = 0 ) {
+	addLevel( object, distance = 0 ) {
 
 		distance = Math.abs( distance );
 
@@ -25775,15 +25799,15 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return this;
 
-	},
+	}
 
-	getCurrentLevel: function () {
+	getCurrentLevel() {
 
 		return this._currentLevel;
 
-	},
+	}
 
-	getObjectForDistance: function ( distance ) {
+	getObjectForDistance( distance ) {
 
 		const levels = this.levels;
 
@@ -25807,9 +25831,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return null;
 
-	},
+	}
 
-	raycast: function ( raycaster, intersects ) {
+	raycast( raycaster, intersects ) {
 
 		const levels = this.levels;
 
@@ -25823,9 +25847,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-	},
+	}
 
-	update: function ( camera ) {
+	update( camera ) {
 
 		const levels = this.levels;
 
@@ -25865,11 +25889,11 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-	},
+	}
 
-	toJSON: function ( meta ) {
+	toJSON( meta ) {
 
-		const data = Object3D.prototype.toJSON.call( this, meta );
+		const data = super.toJSON( meta );
 
 		if ( this.autoUpdate === false ) data.object.autoUpdate = false;
 
@@ -25892,7 +25916,7 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 	}
 
-} );
+}
 
 const _basePosition = new Vector3();
 
@@ -26060,29 +26084,29 @@ Bone.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 } );
 
-const _offsetMatrix = new Matrix4();
-const _identityMatrix = new Matrix4();
+const _offsetMatrix = /*@__PURE__*/ new Matrix4();
+const _identityMatrix = /*@__PURE__*/ new Matrix4();
 
-function Skeleton( bones = [], boneInverses = [] ) {
+class Skeleton {
 
-	this.uuid = MathUtils.generateUUID();
+	constructor( bones = [], boneInverses = [] ) {
 
-	this.bones = bones.slice( 0 );
-	this.boneInverses = boneInverses;
-	this.boneMatrices = null;
+		this.uuid = MathUtils.generateUUID();
 
-	this.boneTexture = null;
-	this.boneTextureSize = 0;
+		this.bones = bones.slice( 0 );
+		this.boneInverses = boneInverses;
+		this.boneMatrices = null;
 
-	this.frame = - 1;
+		this.boneTexture = null;
+		this.boneTextureSize = 0;
 
-	this.init();
+		this.frame = - 1;
 
-}
+		this.init();
 
-Object.assign( Skeleton.prototype, {
+	}
 
-	init: function () {
+	init() {
 
 		const bones = this.bones;
 		const boneInverses = this.boneInverses;
@@ -26115,9 +26139,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	calculateInverses: function () {
+	calculateInverses() {
 
 		this.boneInverses.length = 0;
 
@@ -26135,9 +26159,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	pose: function () {
+	pose() {
 
 		// recover the bind-time world matrices
 
@@ -26178,9 +26202,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	update: function () {
+	update() {
 
 		const bones = this.bones;
 		const boneInverses = this.boneInverses;
@@ -26206,15 +26230,15 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	clone: function () {
+	clone() {
 
 		return new Skeleton( this.bones, this.boneInverses );
 
-	},
+	}
 
-	getBoneByName: function ( name ) {
+	getBoneByName( name ) {
 
 		for ( let i = 0, il = this.bones.length; i < il; i ++ ) {
 
@@ -26230,9 +26254,9 @@ Object.assign( Skeleton.prototype, {
 
 		return undefined;
 
-	},
+	}
 
-	dispose: function ( ) {
+	dispose( ) {
 
 		if ( this.boneTexture !== null ) {
 
@@ -26242,9 +26266,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	fromJSON: function ( json, bones ) {
+	fromJSON( json, bones ) {
 
 		this.uuid = json.uuid;
 
@@ -26269,9 +26293,9 @@ Object.assign( Skeleton.prototype, {
 
 		return this;
 
-	},
+	}
 
-	toJSON: function () {
+	toJSON() {
 
 		const data = {
 			metadata: {
@@ -26302,7 +26326,7 @@ Object.assign( Skeleton.prototype, {
 
 	}
 
-} );
+}
 
 const _instanceLocalMatrix = new Matrix4();
 const _instanceWorldMatrix = new Matrix4();
@@ -26776,21 +26800,19 @@ LineSegments.prototype = Object.assign( Object.create( Line.prototype ), {
 
 } );
 
-function LineLoop( geometry, material ) {
+class LineLoop extends Line {
 
-	Line.call( this, geometry, material );
+	constructor( geometry, material ) {
 
-	this.type = 'LineLoop';
-
-}
+		super( geometry, material );
+		this.type = 'LineLoop';
+		Object.defineProperty( this, 'isLineLoop', { value: true } );
 
-LineLoop.prototype = Object.assign( Object.create( Line.prototype ), {
+	}
 
-	constructor: LineLoop,
 
-	isLineLoop: true,
 
-} );
+}
 
 /**
  * parameters = {

+ 8 - 0
docs/examples/en/exporters/GLTFExporter.html

@@ -33,6 +33,14 @@
 			<li>KHR_texture_transform</li>
 		</ul>
 
+		<p>
+			The following glTF 2.0 extension is supported by an external user plugin
+		</p>
+
+		<ul>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions KHR_materials_variants]</li>
+		</ul>
+
 		<h2>Code Example</h2>
 
 		<code>

+ 13 - 7
docs/examples/en/loaders/GLTFLoader.html

@@ -38,7 +38,15 @@
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_meshopt_compression</li>
-			<li>MSFT_texture_dds</li>
+		</ul>
+
+		<p>
+			The following glTF 2.0 extension is supported by an external user plugin
+		</p>
+
+		<ul>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions KHR_materials_variants]<sup>3</sup></li>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions MSFT_texture_dds]</li>
 		</ul>
 
 		<p><i>
@@ -54,6 +62,10 @@
 			#[link:https://github.com/mrdoob/three.js/issues/12788 12788].
 		</i></p>
 
+		<p><i>
+			<sup>3</sup>You can also manually process the extension after loading in your application. See [link:https://threejs.org/examples/#webgl_loader_gltf_variants Three.js glTF materials variants example].
+		</i></p>
+
 		<h2>Code Example</h2>
 
 		<code>
@@ -193,12 +205,6 @@
 		Refer to this [link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme] for the details of Draco and its decoder.
 		</p>
 
-
-		<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
-		<p>
-		[page:DDSLoader ddsLoader] — Instance of THREE.DDSLoader, to be used for loading compressed textures with the MSFT_TEXTURE_DDS extension.
-		</p>
-
 		<h3>[method:null setKTX2Loader]( [param:KTX2Loader ktx2Loader] )</h3>
 		<p>
 		[page:KTX2Loader ktx2Loader] — Instance of THREE.KTX2Loader, to be used for loading KTX2 compressed textures.

+ 8 - 0
docs/examples/zh/exporters/GLTFExporter.html

@@ -33,6 +33,14 @@
 			<li>KHR_texture_transform</li>
 		</ul>
 
+		<p>
+			The following glTF 2.0 extension is supported by an external user plugin
+		</p>
+
+		<ul>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions KHR_materials_variants]</li>
+		</ul>
+
 		<h2>代码示例</h2>
 
 		<code>

+ 13 - 6
docs/examples/zh/loaders/GLTFLoader.html

@@ -36,7 +36,15 @@
 			<li>KHR_texture_transform<sup>2</sup></li>
 			<li>EXT_texture_webp</li>
 			<li>EXT_meshopt_compression</li>
-			<li>MSFT_texture_dds</li>
+		</ul>
+
+		<p>
+			The following glTF 2.0 extension is supported by an external user plugin
+		</p>
+
+		<ul>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions KHR_materials_variants]<sup>3</sup></li>
+			<li>[link:https://github.com/takahirox/three-gltf-extensions MSFT_texture_dds]</li>
 		</ul>
 
 		<p><i>
@@ -53,6 +61,10 @@
 			#[link:https://github.com/mrdoob/three.js/issues/12788 12788]。
 		</i></p>
 
+		<p><i>
+			<sup>3</sup>You can also manually process the extension after loading in your application. See [link:https://threejs.org/examples/#webgl_loader_gltf_variants Three.js glTF materials variants example].
+		</i></p>
+
 		<h2>代码示例</h2>
 
 		<code>
@@ -188,11 +200,6 @@
 		请参阅[link:https://github.com/mrdoob/three.js/tree/dev/examples/js/libs/draco#readme readme]来了解Draco及其解码器的详细信息。
 		</p>
 
-		<h3>[method:null setDDSLoader]( [param:DDSLoader ddsLoader] )</h3>
-		<p>
-		[page:DDSLoader ddsLoader] — THREE.DDSLoader的实例,用于加载使用MSFT_TEXTURE_DDS扩展压缩过的纹理。
-		</p>
-
 		<h3>[method:null parse]( [param:ArrayBuffer data], [param:String path], [param:Function onLoad], [param:Function onError] )</h3>
 		<p>
 		[page:ArrayBuffer data] — 需要解析的glTF文件,值为一个ArrayBuffer或<em>JSON</em>字符串。<br />

+ 6 - 6
docs/manual/ar/introduction/Installation.html

@@ -87,9 +87,9 @@
 		<code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import * as THREE from 'https://unpkg.com/three/build/three.module.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import * as THREE from 'https://unpkg.com/three@&lt;version&gt;/build/three.module.js';
 
 		  const scene = new THREE.Scene();
 
@@ -125,9 +125,9 @@
 		<code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import { OrbitControls } from 'https://unpkg.com/three/examples/jsm/controls/OrbitControls.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import { OrbitControls } from 'https://unpkg.com/three@&lt;version&gt;/examples/jsm/controls/OrbitControls.js';
 
 		  const controls = new OrbitControls();
 

+ 6 - 6
docs/manual/en/introduction/Installation.html

@@ -69,9 +69,9 @@
 		<code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import * as THREE from 'https://unpkg.com/three/build/three.module.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import * as THREE from 'https://unpkg.com/three@&lt;version&gt;/build/three.module.js';
 
 		  const scene = new THREE.Scene();
 
@@ -107,9 +107,9 @@
 		<code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import { OrbitControls } from 'https://unpkg.com/three/examples/jsm/controls/OrbitControls.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import { OrbitControls } from 'https://unpkg.com/three@&lt;version&gt;/examples/jsm/controls/OrbitControls.js';
 
 		  const controls = new OrbitControls();
 

+ 15 - 15
docs/manual/ko/introduction/Installation.html

@@ -79,9 +79,9 @@
     <code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import * as THREE from 'https://unpkg.com/three@&lt;VERSION>/build/three.module.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import * as THREE from 'https://unpkg.com/three@&lt;version&gt;/build/three.module.js';
 
 		  const scene = new THREE.Scene();
 
@@ -99,12 +99,12 @@
     <p>
         three.js는 3D 엔진의 주요 컴포넌트들에 초점을 두고 있습니다. 다른 여러 유용한 컴포넌트들 —
         controls, loaders, post-processing effects — 은
-        [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm examples/jsm] 폴더에 있습니다. 이들은 "예제"로 불리는데, 그대로 사용할 수도 있고, 
+        [link:https://github.com/mrdoob/three.js/tree/dev/examples/jsm examples/jsm] 폴더에 있습니다. 이들은 "예제"로 불리는데, 그대로 사용할 수도 있고,
         재조합 및 커스터마이징이 가능하기 때문입니다. 이 컴포넌트들은 언제나 코어 라이브러리와 상응하게 이루어져있으며, 이는 다른 비슷한 서드파티 패키지들이 다양한 사람들에 의해 유지보수되고, 최신버전 반영이 안되는 점과는 대비되는 점입니다.
     </p>
 
     <p>
-        예제들은 각각 따로 <em>설치할</em> 필요는 없지만, 각각 <em>import</em>를 해 주어야 합니다. 
+        예제들은 각각 따로 <em>설치할</em> 필요는 없지만, 각각 <em>import</em>를 해 주어야 합니다.
         three.js가 npm을 통해 설치되었다면, [page:OrbitControls] 컴포넌트를 다음과 같이 불러올 수 있습니다.
     </p>
 
@@ -122,9 +122,9 @@
     <code>
 		&lt;script type="module">
 
-		  // Find the latest version by visiting https://unpkg.com/three. The URL will
-		  // redirect to the newest stable release.
-		  import { OrbitControls } from 'https://unpkg.com/three@&lt;VERSION>/examples/jsm/controls/OrbitControls.js';
+		  // Find the latest version by visiting https://unpkg.com/three.
+
+		  import { OrbitControls } from 'https://unpkg.com/three@&lt;version&gt;/examples/jsm/controls/OrbitControls.js';
 
 		  const controls = new OrbitControls();
 
@@ -140,7 +140,7 @@
     <h3>CommonJS 불러오기</h3>
 
     <p>
-        대부분의 자바스크립트 번들러는 이제 ES 모듈을 기본적으로 지원하지만, 오래된 빌드 도구들은 그렇지 않을 수 있습니다. 
+        대부분의 자바스크립트 번들러는 이제 ES 모듈을 기본적으로 지원하지만, 오래된 빌드 도구들은 그렇지 않을 수 있습니다.
         이 경우에, 번들러에 ES 모듈을 인식할 수 있도록 설정해줄 수 있습니다. 예를들어 [link:http://browserify.org/
         Browserify] 는 [link:https://github.com/babel/babelify babelify] 플러그인을 불러오기만 하면 됩니다.
     </p>
@@ -150,16 +150,16 @@
     <p>
         npm을 통해 설치하는 경우, 호스팅 및 CDN으로 설치했을 때와 import 경로가 다릅니다. 이 점은 양쪽의 사용자 모두에게 불편한 문제가 될 것이라는 점을 알고 있습니다.
         빌드 도구나 번들러를 사용하는 개발자들은 상대경로보다 단순한 패키지 구분자(ex: 'three')로 사용하기를 선호하지만 <em>examples/</em> 폴더의 파일들은
-        <em>three.module.js</em>에 상대 경로를 사용하기 때문에 예상을 빗나가게 됩니다. 빌드 도구를 사용하지 않는 사람들 — 빠른 프로토타입 제작, 학습용도, 개인적 취향 — 도 마찬가지로 이러한 상대 경로를 싫어할 텐데, 
+        <em>three.module.js</em>에 상대 경로를 사용하기 때문에 예상을 빗나가게 됩니다. 빌드 도구를 사용하지 않는 사람들 — 빠른 프로토타입 제작, 학습용도, 개인적 취향 — 도 마찬가지로 이러한 상대 경로를 싫어할 텐데,
         특정 폴더 구조가 필요하고, 전역 <em>THREE.*</em>를 사용하는 것보다 엄격하기 때문입니다.
     </p>
 
     <p>
-        [link:https://github.com/WICG/import-maps import maps] 이 후에 활발하게 지원된다면 이러한 상대 경로들을 npm 패키지 이름, 'three'처럼 단순한 패키지 식별자로 변경할 예정입니다. 
-        이는 npm 패키지에서 주로 쓰이는 경로 작성법과 일치하고, 두 사용자군 모두에게 파일을 불러오는 데에 동일한 코드를 사용할 수 있게 해 줄 것입니다. 
-        빌드 도구를 사용하지 않는 것을 선호하는 사용자들에게도, 간단한 JSON 맵핑을 통해 CDN이나 직접 파일 폴더에서 불러오는 것을 가능하게 해 줄 것입니다. 
+        [link:https://github.com/WICG/import-maps import maps] 이 후에 활발하게 지원된다면 이러한 상대 경로들을 npm 패키지 이름, 'three'처럼 단순한 패키지 식별자로 변경할 예정입니다.
+        이는 npm 패키지에서 주로 쓰이는 경로 작성법과 일치하고, 두 사용자군 모두에게 파일을 불러오는 데에 동일한 코드를 사용할 수 있게 해 줄 것입니다.
+        빌드 도구를 사용하지 않는 것을 선호하는 사용자들에게도, 간단한 JSON 맵핑을 통해 CDN이나 직접 파일 폴더에서 불러오는 것을 가능하게 해 줄 것입니다.
         실험적 방법으로, [link:https://glitch.com/edit/#!/three-import-map?path=index.html import map
-        예제]처럼 map polyfill과 함께 import 해서 더 간단하게 사용해볼 수도 있습니다. 
+        예제]처럼 map polyfill과 함께 import 해서 더 간단하게 사용해볼 수도 있습니다.
     </p>
 
     <h3>Node.js</h3>
@@ -183,4 +183,4 @@
 
 </body>
 
-</html>
+</html>

+ 4 - 4
docs/manual/zh/introduction/Installation.html

@@ -70,8 +70,8 @@
 		&lt;script type="module">
 
 		  // 通过访问 https://unpkg.com/three 来查找最新版本。
-		  // 该URL将会重定向到最新的稳定版本。
-		  import * as THREE from 'https://unpkg.com/three/build/three.module.js';
+
+		  import * as THREE from 'https://unpkg.com/three@&lt;version&gt;/build/three.module.js';
 
 		  const scene = new THREE.Scene();
 
@@ -108,8 +108,8 @@
 		&lt;script type="module">
 
 		  // 通过访问 https://unpkg.com/three 来查找最新版本。
-		  // 该URL将会重定向到最新的稳定版本。
-		  import { OrbitControls } from 'https://unpkg.com/three/examples/jsm/controls/OrbitControls.js';
+
+		  import { OrbitControls } from 'https://unpkg.com/three@&lt;version&gt;/examples/jsm/controls/OrbitControls.js';
 
 		  const controls = new OrbitControls();
 

+ 9 - 39
examples/js/loaders/GLTFLoader.js

@@ -5,7 +5,6 @@ THREE.GLTFLoader = ( function () {
 		THREE.Loader.call( this, manager );
 
 		this.dracoLoader = null;
-		this.ddsLoader = null;
 		this.ktx2Loader = null;
 		this.meshoptDecoder = null;
 
@@ -131,10 +130,13 @@ THREE.GLTFLoader = ( function () {
 
 		},
 
-		setDDSLoader: function ( ddsLoader ) {
+		setDDSLoader: function () {
 
-			this.ddsLoader = ddsLoader;
-			return this;
+			throw new Error(
+
+				'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
+
+			);
 
 		},
 
@@ -268,10 +270,6 @@ THREE.GLTFLoader = ( function () {
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							break;
 
-						case EXTENSIONS.MSFT_TEXTURE_DDS:
-							extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
-							break;
-
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							break;
@@ -354,29 +352,9 @@ THREE.GLTFLoader = ( function () {
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
-		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
-		MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
+		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
 	};
 
-	/**
-	 * DDS Texture Extension
-	 *
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
-	 *
-	 */
-	function GLTFTextureDDSExtension( ddsLoader ) {
-
-		if ( ! ddsLoader ) {
-
-			throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing THREE.DDSLoader' );
-
-		}
-
-		this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
-		this.ddsLoader = ddsLoader;
-
-	}
-
 	/**
 	 * Punctual Lights Extension
 	 *
@@ -2394,15 +2372,7 @@ THREE.GLTFLoader = ( function () {
 
 		var source;
 
-		if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {
-
-			source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];
-
-		} else {
-
-			source = json.images[ textureDef.source ];
-
-		}
+		source = json.images[ textureDef.source ];
 
 		var loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
 			? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
@@ -2568,7 +2538,7 @@ THREE.GLTFLoader = ( function () {
 	 * Assigns final material to a Mesh, Line, or Points instance. The instance
 	 * already has a material (generated from the glTF material options alone)
 	 * but reuse of the same glTF material may require multiple threejs materials
-	 * to accomodate different primitive types, defines, etc. New materials will
+	 * to accommodate different primitive types, defines, etc. New materials will
 	 * be created if necessary, and reused from a cache.
 	 * @param  {THREE.Object3D} mesh Mesh, Line, or Points instance.
 	 */

+ 9 - 39
examples/jsm/loaders/GLTFLoader.js

@@ -70,7 +70,6 @@ var GLTFLoader = ( function () {
 		Loader.call( this, manager );
 
 		this.dracoLoader = null;
-		this.ddsLoader = null;
 		this.ktx2Loader = null;
 		this.meshoptDecoder = null;
 
@@ -196,10 +195,13 @@ var GLTFLoader = ( function () {
 
 		},
 
-		setDDSLoader: function ( ddsLoader ) {
+		setDDSLoader: function () {
 
-			this.ddsLoader = ddsLoader;
-			return this;
+			throw new Error(
+
+				'THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".'
+
+			);
 
 		},
 
@@ -333,10 +335,6 @@ var GLTFLoader = ( function () {
 							extensions[ extensionName ] = new GLTFDracoMeshCompressionExtension( json, this.dracoLoader );
 							break;
 
-						case EXTENSIONS.MSFT_TEXTURE_DDS:
-							extensions[ extensionName ] = new GLTFTextureDDSExtension( this.ddsLoader );
-							break;
-
 						case EXTENSIONS.KHR_TEXTURE_TRANSFORM:
 							extensions[ extensionName ] = new GLTFTextureTransformExtension();
 							break;
@@ -419,29 +417,9 @@ var GLTFLoader = ( function () {
 		KHR_TEXTURE_TRANSFORM: 'KHR_texture_transform',
 		KHR_MESH_QUANTIZATION: 'KHR_mesh_quantization',
 		EXT_TEXTURE_WEBP: 'EXT_texture_webp',
-		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression',
-		MSFT_TEXTURE_DDS: 'MSFT_texture_dds'
+		EXT_MESHOPT_COMPRESSION: 'EXT_meshopt_compression'
 	};
 
-	/**
-	 * DDS Texture Extension
-	 *
-	 * Specification: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Vendor/MSFT_texture_dds
-	 *
-	 */
-	function GLTFTextureDDSExtension( ddsLoader ) {
-
-		if ( ! ddsLoader ) {
-
-			throw new Error( 'THREE.GLTFLoader: Attempting to load .dds texture without importing DDSLoader' );
-
-		}
-
-		this.name = EXTENSIONS.MSFT_TEXTURE_DDS;
-		this.ddsLoader = ddsLoader;
-
-	}
-
 	/**
 	 * Punctual Lights Extension
 	 *
@@ -2459,15 +2437,7 @@ var GLTFLoader = ( function () {
 
 		var source;
 
-		if ( textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ] ) {
-
-			source = json.images[ textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].source ];
-
-		} else {
-
-			source = json.images[ textureDef.source ];
-
-		}
+		source = json.images[ textureDef.source ];
 
 		var loader = textureExtensions[ EXTENSIONS.MSFT_TEXTURE_DDS ]
 			? parser.extensions[ EXTENSIONS.MSFT_TEXTURE_DDS ].ddsLoader
@@ -2633,7 +2603,7 @@ var GLTFLoader = ( function () {
 	 * Assigns final material to a Mesh, Line, or Points instance. The instance
 	 * already has a material (generated from the glTF material options alone)
 	 * but reuse of the same glTF material may require multiple threejs materials
-	 * to accomodate different primitive types, defines, etc. New materials will
+	 * to accommodate different primitive types, defines, etc. New materials will
 	 * be created if necessary, and reused from a cache.
 	 * @param  {Object3D} mesh Mesh, Line, or Points instance.
 	 */

二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox.bin


+ 0 - 237
examples/models/gltf/BoomBox/glTF-dds/BoomBox.gltf

@@ -1,237 +0,0 @@
-{
-  "accessors": [
-    {
-      "bufferView": 0,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC2",
-      "max": [
-        0.9999003,
-        -0.0221377648
-      ],
-      "min": [
-        0.0006585993,
-        -0.996773958
-      ]
-    },
-    {
-      "bufferView": 1,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC3",
-      "max": [
-        1.0,
-        1.0,
-        0.9999782
-      ],
-      "min": [
-        -1.0,
-        -1.0,
-        -0.9980823
-      ]
-    },
-    {
-      "bufferView": 2,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC4",
-      "max": [
-        1.0,
-        0.9999976,
-        1.0,
-        1.0
-      ],
-      "min": [
-        -0.9991289,
-        -0.999907851,
-        -1.0,
-        1.0
-      ]
-    },
-    {
-      "bufferView": 3,
-      "componentType": 5126,
-      "count": 3575,
-      "type": "VEC3",
-      "max": [
-        0.009921154,
-        0.00977163,
-        0.0100762453
-      ],
-      "min": [
-        -0.009921154,
-        -0.00977163,
-        -0.0100762453
-      ]
-    },
-    {
-      "bufferView": 4,
-      "componentType": 5123,
-      "count": 18108,
-      "type": "SCALAR",
-      "max": [
-        3574
-      ],
-      "min": [
-        0
-      ]
-    }
-  ],
-  "asset": {
-    "generator": "glTF Tools for Unity",
-    "version": "2.0"
-  },
-  "bufferViews": [
-    {
-      "buffer": 0,
-      "byteLength": 28600
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 28600,
-      "byteLength": 42900
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 71500,
-      "byteLength": 57200
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 128700,
-      "byteLength": 42900
-    },
-    {
-      "buffer": 0,
-      "byteOffset": 171600,
-      "byteLength": 36216
-    }
-  ],
-  "buffers": [
-    {
-      "uri": "BoomBox.bin",
-      "byteLength": 207816
-    }
-  ],
-  "images": [
-    {
-      "uri": "BoomBox_baseColor.png"
-    },
-    {
-      "uri": "BoomBox_occlusionRoughnessMetallic.png"
-    },
-    {
-      "uri": "BoomBox_normal.png"
-    },
-    {
-      "uri": "BoomBox_emissive.png"
-    },
-    {
-      "uri": "BoomBox_baseColor.dds"
-    },
-    {
-      "uri": "BoomBox_occlusionRoughnessMetallic.dds"
-    },
-    {
-      "uri": "BoomBox_normal.dds"
-    },
-    {
-      "uri": "BoomBox_emissive.dds"
-    }
-  ],
-  "meshes": [
-    {
-      "primitives": [
-        {
-          "attributes": {
-            "TEXCOORD_0": 0,
-            "NORMAL": 1,
-            "TANGENT": 2,
-            "POSITION": 3
-          },
-          "indices": 4,
-          "material": 0
-        }
-      ],
-      "name": "BoomBox"
-    }
-  ],
-  "materials": [
-    {
-      "pbrMetallicRoughness": {
-        "baseColorTexture": {
-          "index": 0
-        },
-        "metallicRoughnessTexture": {
-          "index": 1
-        }
-      },
-      "normalTexture": {
-        "index": 2
-      },
-      "occlusionTexture": {
-        "index": 1
-      },
-      "emissiveFactor": [
-        1.0,
-        1.0,
-        1.0
-      ],
-      "emissiveTexture": {
-        "index": 3
-      },
-      "name": "BoomBox_Mat"
-    }
-  ],
-  "nodes": [
-    {
-      "mesh": 0,
-      "name": "BoomBox"
-    }
-  ],
-  "scene": 0,
-  "scenes": [
-    {
-      "nodes": [
-        0
-      ]
-    }
-  ],
-  "textures": [
-    {
-      "source": 0,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 4
-        }
-    }
-    },
-    {
-      "source": 1,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 5
-        }
-    }
-    },
-    {
-      "source": 2,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 6
-        }
-    }
-    },
-    {
-      "source": 3,
-      "extensions": {
-        "MSFT_texture_dds": {
-            "source": 7
-        }
-    }
-    }
-  ],
-  "extensionsUsed": [
-    "MSFT_texture_dds"
-  ]
-}

二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.dds


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_baseColor.png


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.dds


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_emissive.png


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.dds


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_normal.png


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.dds


二進制
examples/models/gltf/BoomBox/glTF-dds/BoomBox_occlusionRoughnessMetallic.png


+ 1 - 4
examples/webgl_loader_gltf_extensions.html

@@ -21,7 +21,6 @@
 			import { GUI } from './jsm/libs/dat.gui.module.js';
 			import { OrbitControls } from './jsm/controls/OrbitControls.js';
 			import { GLTFLoader } from './jsm/loaders/GLTFLoader.js';
-			import { DDSLoader } from './jsm/loaders/DDSLoader.js';
 			import { DRACOLoader } from './jsm/loaders/DRACOLoader.js';
 			import { RGBELoader } from './jsm/loaders/RGBELoader.js';
 
@@ -39,7 +38,7 @@
 					authorURL: 'https://www.microsoft.com/',
 					cameraPos: new THREE.Vector3( 0.02, 0.01, 0.03 ),
 					objectRotation: new THREE.Euler( 0, Math.PI, 0 ),
-					extensions: [ 'glTF', 'glTF-pbrSpecularGlossiness', 'glTF-Binary', 'glTF-dds' ],
+					extensions: [ 'glTF', 'glTF-pbrSpecularGlossiness', 'glTF-Binary' ],
 					addEnvMap: true
 				},
 				'Bot Skinned': {
@@ -267,8 +266,6 @@
 				dracoLoader.setDecoderPath( 'js/libs/draco/gltf/' );
 				loader.setDRACOLoader( dracoLoader );
 
-				loader.setDDSLoader( new DDSLoader() );
-
 				let url = sceneInfo.url.replace( /%s/g, state.extension );
 
 				if ( state.extension === 'glTF-Binary' ) {

+ 1 - 1
examples/webgl_loader_gltf_variants.html

@@ -12,7 +12,7 @@
 			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - GLTFLoader + <a href="https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_variants" target="_blank" rel="noopener">KHR_materials_variants</a> extension<br />
 			<a href="https://github.com/pushmatrix/glTF-Sample-Models/tree/master/2.0/MaterialsVariantsShoe" target="_blank" rel="noopener">Materials Variants Shoe</a> by
 			<a href="https://github.com/Shopify" target="_blank" rel="noopener">Shopify, Inc</a><br />
-			<a href="https://hdrihaven.com/hdri/?h=royal_esplanade" target="_blank" rel="noopener">Royal Esplanade</a> by <a href="https://hdrihaven.com/" target="_blank" rel="noopener">HDRI Haven</a>
+			<a href="https://hdrihaven.com/hdri/?h=quarry_01" target="_blank" rel="noopener">Quarry</a> by <a href="https://hdrihaven.com/" target="_blank" rel="noopener">HDRI Haven</a>
 		</div>
 
 		<script type="module">

+ 7 - 11
src/objects/Group.js

@@ -1,20 +1,16 @@
 import { Object3D } from '../core/Object3D.js';
 
-function Group() {
+class Group extends Object3D {
 
-	Object3D.call( this );
+	constructor() {
 
-	this.type = 'Group';
+		super();
+		this.type = 'Group';
+		Object.defineProperty( this, 'isGroup', { value: true } );
 
-}
-
-Group.prototype = Object.assign( Object.create( Object3D.prototype ), {
-
-	constructor: Group,
+	}
 
-	isGroup: true
-
-} );
+}
 
 
 export { Group };

+ 34 - 35
src/objects/LOD.js

@@ -1,37 +1,36 @@
 import { Vector3 } from '../math/Vector3.js';
 import { Object3D } from '../core/Object3D.js';
 
-const _v1 = new Vector3();
-const _v2 = new Vector3();
+const _v1 = /*@__PURE__*/ new Vector3();
+const _v2 = /*@__PURE__*/ new Vector3();
 
-function LOD() {
+class LOD extends Object3D {
 
-	Object3D.call( this );
+	constructor() {
 
-	this._currentLevel = 0;
+		super();
 
-	this.type = 'LOD';
+		this._currentLevel = 0;
 
-	Object.defineProperties( this, {
-		levels: {
-			enumerable: true,
-			value: []
-		}
-	} );
-
-	this.autoUpdate = true;
-
-}
+		this.type = 'LOD';
 
-LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
+		Object.defineProperties( this, {
+			levels: {
+				enumerable: true,
+				value: []
+			},
+			isLOD: {
+				value: true,
+			}
+		} );
 
-	constructor: LOD,
+		this.autoUpdate = true;
 
-	isLOD: true,
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
-		Object3D.prototype.copy.call( this, source, false );
+		super.copy( source, false );
 
 		const levels = source.levels;
 
@@ -47,9 +46,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return this;
 
-	},
+	}
 
-	addLevel: function ( object, distance = 0 ) {
+	addLevel( object, distance = 0 ) {
 
 		distance = Math.abs( distance );
 
@@ -73,15 +72,15 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return this;
 
-	},
+	}
 
-	getCurrentLevel: function () {
+	getCurrentLevel() {
 
 		return this._currentLevel;
 
-	},
+	}
 
-	getObjectForDistance: function ( distance ) {
+	getObjectForDistance( distance ) {
 
 		const levels = this.levels;
 
@@ -105,9 +104,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		return null;
 
-	},
+	}
 
-	raycast: function ( raycaster, intersects ) {
+	raycast( raycaster, intersects ) {
 
 		const levels = this.levels;
 
@@ -121,9 +120,9 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-	},
+	}
 
-	update: function ( camera ) {
+	update( camera ) {
 
 		const levels = this.levels;
 
@@ -163,11 +162,11 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-	},
+	}
 
-	toJSON: function ( meta ) {
+	toJSON( meta ) {
 
-		const data = Object3D.prototype.toJSON.call( this, meta );
+		const data = super.toJSON( meta );
 
 		if ( this.autoUpdate === false ) data.object.autoUpdate = false;
 
@@ -190,7 +189,7 @@ LOD.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 	}
 
-} );
+}
 
 
 export { LOD };

+ 7 - 9
src/objects/LineLoop.js

@@ -1,20 +1,18 @@
 import { Line } from './Line.js';
 
-function LineLoop( geometry, material ) {
+class LineLoop extends Line {
 
-	Line.call( this, geometry, material );
+	constructor( geometry, material ) {
 
-	this.type = 'LineLoop';
+		super( geometry, material );
+		this.type = 'LineLoop';
+		Object.defineProperty( this, 'isLineLoop', { value: true } );
 
-}
-
-LineLoop.prototype = Object.assign( Object.create( Line.prototype ), {
+	}
 
-	constructor: LineLoop,
 
-	isLineLoop: true,
 
-} );
+}
 
 
 export { LineLoop };

+ 31 - 32
src/objects/Skeleton.js

@@ -2,29 +2,29 @@ import { Bone } from './Bone.js';
 import { Matrix4 } from '../math/Matrix4.js';
 import { MathUtils } from '../math/MathUtils.js';
 
-const _offsetMatrix = new Matrix4();
-const _identityMatrix = new Matrix4();
+const _offsetMatrix = /*@__PURE__*/ new Matrix4();
+const _identityMatrix = /*@__PURE__*/ new Matrix4();
 
-function Skeleton( bones = [], boneInverses = [] ) {
+class Skeleton {
 
-	this.uuid = MathUtils.generateUUID();
+	constructor( bones = [], boneInverses = [] ) {
 
-	this.bones = bones.slice( 0 );
-	this.boneInverses = boneInverses;
-	this.boneMatrices = null;
+		this.uuid = MathUtils.generateUUID();
 
-	this.boneTexture = null;
-	this.boneTextureSize = 0;
+		this.bones = bones.slice( 0 );
+		this.boneInverses = boneInverses;
+		this.boneMatrices = null;
 
-	this.frame = - 1;
+		this.boneTexture = null;
+		this.boneTextureSize = 0;
 
-	this.init();
+		this.frame = - 1;
 
-}
+		this.init();
 
-Object.assign( Skeleton.prototype, {
+	}
 
-	init: function () {
+	init() {
 
 		const bones = this.bones;
 		const boneInverses = this.boneInverses;
@@ -57,9 +57,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	calculateInverses: function () {
+	calculateInverses() {
 
 		this.boneInverses.length = 0;
 
@@ -77,9 +77,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	pose: function () {
+	pose() {
 
 		// recover the bind-time world matrices
 
@@ -120,9 +120,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	update: function () {
+	update() {
 
 		const bones = this.bones;
 		const boneInverses = this.boneInverses;
@@ -148,15 +148,15 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	clone: function () {
+	clone() {
 
 		return new Skeleton( this.bones, this.boneInverses );
 
-	},
+	}
 
-	getBoneByName: function ( name ) {
+	getBoneByName( name ) {
 
 		for ( let i = 0, il = this.bones.length; i < il; i ++ ) {
 
@@ -172,9 +172,9 @@ Object.assign( Skeleton.prototype, {
 
 		return undefined;
 
-	},
+	}
 
-	dispose: function ( ) {
+	dispose( ) {
 
 		if ( this.boneTexture !== null ) {
 
@@ -184,9 +184,9 @@ Object.assign( Skeleton.prototype, {
 
 		}
 
-	},
+	}
 
-	fromJSON: function ( json, bones ) {
+	fromJSON( json, bones ) {
 
 		this.uuid = json.uuid;
 
@@ -211,9 +211,9 @@ Object.assign( Skeleton.prototype, {
 
 		return this;
 
-	},
+	}
 
-	toJSON: function () {
+	toJSON() {
 
 		const data = {
 			metadata: {
@@ -244,7 +244,6 @@ Object.assign( Skeleton.prototype, {
 
 	}
 
-} );
-
+}
 
 export { Skeleton };

+ 38 - 41
src/objects/Sprite.js

@@ -10,61 +10,58 @@ import { SpriteMaterial } from '../materials/SpriteMaterial.js';
 
 let _geometry;
 
-const _intersectPoint = new Vector3();
-const _worldScale = new Vector3();
-const _mvPosition = new Vector3();
+const _intersectPoint = /*@__PURE__*/ new Vector3();
+const _worldScale = /*@__PURE__*/ new Vector3();
+const _mvPosition = /*@__PURE__*/ new Vector3();
 
-const _alignedPosition = new Vector2();
-const _rotatedPosition = new Vector2();
-const _viewWorldMatrix = new Matrix4();
+const _alignedPosition = /*@__PURE__*/ new Vector2();
+const _rotatedPosition = /*@__PURE__*/ new Vector2();
+const _viewWorldMatrix = /*@__PURE__*/ new Matrix4();
 
-const _vA = new Vector3();
-const _vB = new Vector3();
-const _vC = new Vector3();
+const _vA = /*@__PURE__*/ new Vector3();
+const _vB = /*@__PURE__*/ new Vector3();
+const _vC = /*@__PURE__*/ new Vector3();
 
-const _uvA = new Vector2();
-const _uvB = new Vector2();
-const _uvC = new Vector2();
+const _uvA = /*@__PURE__*/ new Vector2();
+const _uvB = /*@__PURE__*/ new Vector2();
+const _uvC = /*@__PURE__*/ new Vector2();
 
-function Sprite( material ) {
+class Sprite extends Object3D {
 
-	Object3D.call( this );
+	constructor( material ) {
 
-	this.type = 'Sprite';
+		super();
+		this.type = 'Sprite';
 
-	if ( _geometry === undefined ) {
+		if ( _geometry === undefined ) {
 
-		_geometry = new BufferGeometry();
+			_geometry = new BufferGeometry();
 
-		const float32Array = new Float32Array( [
-			- 0.5, - 0.5, 0, 0, 0,
-			0.5, - 0.5, 0, 1, 0,
-			0.5, 0.5, 0, 1, 1,
-			- 0.5, 0.5, 0, 0, 1
-		] );
+			const float32Array = new Float32Array( [
+				- 0.5, - 0.5, 0, 0, 0,
+				0.5, - 0.5, 0, 1, 0,
+				0.5, 0.5, 0, 1, 1,
+				- 0.5, 0.5, 0, 0, 1
+			] );
 
-		const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
+			const interleavedBuffer = new InterleavedBuffer( float32Array, 5 );
 
-		_geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
-		_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
-		_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
+			_geometry.setIndex( [ 0, 1, 2,	0, 2, 3 ] );
+			_geometry.setAttribute( 'position', new InterleavedBufferAttribute( interleavedBuffer, 3, 0, false ) );
+			_geometry.setAttribute( 'uv', new InterleavedBufferAttribute( interleavedBuffer, 2, 3, false ) );
 
-	}
-
-	this.geometry = _geometry;
-	this.material = ( material !== undefined ) ? material : new SpriteMaterial();
-
-	this.center = new Vector2( 0.5, 0.5 );
+		}
 
-}
+		this.geometry = _geometry;
+		this.material = ( material !== undefined ) ? material : new SpriteMaterial();
 
-Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
+		this.center = new Vector2( 0.5, 0.5 );
 
-	constructor: Sprite,
+		Object.defineProperty( this, 'isSprite', { value: true } );
 
-	isSprite: true,
+	}
 
-	raycast: function ( raycaster, intersects ) {
+	raycast( raycaster, intersects ) {
 
 		if ( raycaster.camera === null ) {
 
@@ -137,9 +134,9 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		} );
 
-	},
+	}
 
-	copy: function ( source ) {
+	copy( source ) {
 
 		Object3D.prototype.copy.call( this, source );
 
@@ -151,7 +148,7 @@ Sprite.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 	}
 
-} );
+}
 
 function transformVertex( vertexPosition, mvPosition, center, scale, sin, cos ) {
 

+ 1 - 1
src/renderers/shaders/UniformsUtils.js

@@ -17,7 +17,7 @@ export function cloneUniforms( src ) {
 			if ( property && ( property.isColor ||
 				property.isMatrix3 || property.isMatrix4 ||
 				property.isVector2 || property.isVector3 || property.isVector4 ||
-				property.isTexture ) ) {
+				property.isTexture || property.isQuaternion ) ) {
 
 				dst[ u ][ p ] = property.clone();
 

+ 36 - 4
src/renderers/webgl/WebGLState.js

@@ -318,7 +318,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	let currentProgram = null;
 
-	let currentBlendingEnabled = null;
+	let currentBlendingEnabled = false;
 	let currentBlending = null;
 	let currentBlendEquation = null;
 	let currentBlendSrc = null;
@@ -480,7 +480,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		if ( blending === NoBlending ) {
 
-			if ( currentBlendingEnabled ) {
+			if ( currentBlendingEnabled === true ) {
 
 				disable( gl.BLEND );
 				currentBlendingEnabled = false;
@@ -491,7 +491,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		}
 
-		if ( ! currentBlendingEnabled ) {
+		if ( currentBlendingEnabled === false ) {
 
 			enable( gl.BLEND );
 			currentBlendingEnabled = true;
@@ -877,6 +877,38 @@ function WebGLState( gl, extensions, capabilities ) {
 
 	function reset() {
 
+		// reset state
+
+		gl.disable( gl.BLEND );
+		gl.disable( gl.CULL_FACE );
+		gl.disable( gl.DEPTH_TEST );
+		gl.disable( gl.POLYGON_OFFSET_FILL );
+		gl.disable( gl.SCISSOR_TEST );
+		gl.disable( gl.STENCIL_TEST );
+
+		gl.blendEquation( gl.FUNC_ADD );
+		gl.blendFunc( gl.ONE, gl.ZERO );
+		gl.blendFuncSeparate( gl.ONE, gl.ZERO, gl.ONE, gl.ZERO );
+
+		gl.colorMask( true, true, true, true );
+		gl.clearColor( 0, 0, 0, 0 );
+
+		gl.depthMask( true );
+		gl.depthFunc( gl.LESS );
+		gl.clearDepth( 1 );
+
+		gl.stencilMask( 0xffffffff );
+		gl.stencilFunc( gl.ALWAYS, 0, 1 );
+		gl.stencilOp( gl.KEEP, gl.KEEP, gl.KEEP );
+		gl.clearStencil( 0 );
+
+		gl.cullFace( gl.BACK );
+		gl.frontFace( gl.CCW );
+
+		gl.polygonOffset( 0, 0 );
+
+		// reset internals
+
 		enabledCapabilities = {};
 
 		currentTextureSlot = null;
@@ -884,7 +916,7 @@ function WebGLState( gl, extensions, capabilities ) {
 
 		currentProgram = null;
 
-		currentBlendingEnabled = null;
+		currentBlendingEnabled = false;
 		currentBlending = null;
 		currentBlendEquation = null;
 		currentBlendSrc = null;

+ 1 - 0
utils/build/rollup.config.js

@@ -70,6 +70,7 @@ function glconstants() {
 		RGBA: 6408,
 		LUMINANCE: 6409,
 		LUMINANCE_ALPHA: 6410,
+		KEEP: 7680,
 		RED_INTEGER: 36244,
 		RG: 33319,
 		RG_INTEGER: 33320,

部分文件因文件數量過多而無法顯示