Explorar o código

Updated builds.

Mr.doob %!s(int64=2) %!d(string=hai) anos
pai
achega
ac76efffb7
Modificáronse 4 ficheiros con 386 adicións e 134 borrados
  1. 113 40
      build/three.cjs
  2. 113 40
      build/three.js
  3. 0 0
      build/three.min.js
  4. 160 54
      build/three.module.js

+ 113 - 40
build/three.cjs

@@ -411,7 +411,7 @@ function setQuaternionFromProperEuler(q, a, b, c, order) {
 	}
 }
 
-function denormalize$1(value, array) {
+function denormalize(value, array) {
 	switch (array.constructor) {
 		case Float32Array:
 			return value;
@@ -480,7 +480,7 @@ var MathUtils = /*#__PURE__*/Object.freeze({
 	floorPowerOfTwo: floorPowerOfTwo,
 	setQuaternionFromProperEuler: setQuaternionFromProperEuler,
 	normalize: normalize,
-	denormalize: denormalize$1
+	denormalize: denormalize
 });
 
 class Vector2 {
@@ -1710,14 +1710,6 @@ class Color {
 		this.r = attribute.getX(index);
 		this.g = attribute.getY(index);
 		this.b = attribute.getZ(index);
-
-		if (attribute.normalized === true) {
-			// assuming Uint8Array
-			this.r /= 255;
-			this.g /= 255;
-			this.b /= 255;
-		}
-
 		return this;
 	}
 
@@ -7131,9 +7123,15 @@ class BufferAttribute {
 				color = new Color();
 			}
 
-			array[offset++] = color.r;
-			array[offset++] = color.g;
-			array[offset++] = color.b;
+			if (this.normalized) {
+				array[offset++] = normalize(color.r, array);
+				array[offset++] = normalize(color.g, array);
+				array[offset++] = normalize(color.b, array);
+			} else {
+				array[offset++] = color.r;
+				array[offset++] = color.g;
+				array[offset++] = color.b;
+			}
 		}
 
 		return this;
@@ -7151,8 +7149,13 @@ class BufferAttribute {
 				vector = new Vector2();
 			}
 
-			array[offset++] = vector.x;
-			array[offset++] = vector.y;
+			if (this.normalized) {
+				array[offset++] = normalize(vector.x, array);
+				array[offset++] = normalize(vector.y, array);
+			} else {
+				array[offset++] = vector.x;
+				array[offset++] = vector.y;
+			}
 		}
 
 		return this;
@@ -7170,9 +7173,15 @@ class BufferAttribute {
 				vector = new Vector3();
 			}
 
-			array[offset++] = vector.x;
-			array[offset++] = vector.y;
-			array[offset++] = vector.z;
+			if (this.normalized) {
+				array[offset++] = normalize(vector.x, array);
+				array[offset++] = normalize(vector.y, array);
+				array[offset++] = normalize(vector.z, array);
+			} else {
+				array[offset++] = vector.x;
+				array[offset++] = vector.y;
+				array[offset++] = vector.z;
+			}
 		}
 
 		return this;
@@ -7190,10 +7199,17 @@ class BufferAttribute {
 				vector = new Vector4();
 			}
 
-			array[offset++] = vector.x;
-			array[offset++] = vector.y;
-			array[offset++] = vector.z;
-			array[offset++] = vector.w;
+			if (this.normalized) {
+				array[offset++] = normalize(vector.x, array);
+				array[offset++] = normalize(vector.y, array);
+				array[offset++] = normalize(vector.z, array);
+				array[offset++] = normalize(vector.w, array);
+			} else {
+				array[offset++] = vector.x;
+				array[offset++] = vector.y;
+				array[offset++] = vector.z;
+				array[offset++] = vector.w;
+			}
 		}
 
 		return this;
@@ -7258,48 +7274,67 @@ class BufferAttribute {
 	}
 
 	set(value, offset = 0) {
+		if (this.normalized) value = normalize(value, this.array);
 		this.array.set(value, offset);
 		return this;
 	}
 
 	getX(index) {
-		return this.array[index * this.itemSize];
+		let x = this.array[index * this.itemSize];
+		if (this.normalized) x = denormalize(x, this.array);
+		return x;
 	}
 
 	setX(index, x) {
+		if (this.normalized) x = normalize(x, this.array);
 		this.array[index * this.itemSize] = x;
 		return this;
 	}
 
 	getY(index) {
-		return this.array[index * this.itemSize + 1];
+		let y = this.array[index * this.itemSize + 1];
+		if (this.normalized) y = denormalize(y, this.array);
+		return y;
 	}
 
 	setY(index, y) {
+		if (this.normalized) y = normalize(y, this.array);
 		this.array[index * this.itemSize + 1] = y;
 		return this;
 	}
 
 	getZ(index) {
-		return this.array[index * this.itemSize + 2];
+		let z = this.array[index * this.itemSize + 2];
+		if (this.normalized) z = denormalize(z, this.array);
+		return z;
 	}
 
 	setZ(index, z) {
+		if (this.normalized) z = normalize(z, this.array);
 		this.array[index * this.itemSize + 2] = z;
 		return this;
 	}
 
 	getW(index) {
-		return this.array[index * this.itemSize + 3];
+		let w = this.array[index * this.itemSize + 3];
+		if (this.normalized) w = denormalize(w, this.array);
+		return w;
 	}
 
 	setW(index, w) {
+		if (this.normalized) w = normalize(w, this.array);
 		this.array[index * this.itemSize + 3] = w;
 		return this;
 	}
 
 	setXY(index, x, y) {
 		index *= this.itemSize;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+		}
+
 		this.array[index + 0] = x;
 		this.array[index + 1] = y;
 		return this;
@@ -7307,6 +7342,13 @@ class BufferAttribute {
 
 	setXYZ(index, x, y, z) {
 		index *= this.itemSize;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+			z = normalize(z, this.array);
+		}
+
 		this.array[index + 0] = x;
 		this.array[index + 1] = y;
 		this.array[index + 2] = z;
@@ -7315,6 +7357,14 @@ class BufferAttribute {
 
 	setXYZW(index, x, y, z, w) {
 		index *= this.itemSize;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+			z = normalize(z, this.array);
+			w = normalize(w, this.array);
+		}
+
 		this.array[index + 0] = x;
 		this.array[index + 1] = y;
 		this.array[index + 2] = z;
@@ -12713,13 +12763,6 @@ function absNumericalSort(a, b) {
 	return Math.abs(b[1]) - Math.abs(a[1]);
 }
 
-function denormalize(morph, attribute) {
-	let denominator = 1;
-	const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
-	if (array instanceof Int8Array) denominator = 127;else if (array instanceof Uint8Array) denominator = 255;else if (array instanceof Uint16Array) denominator = 65535;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array);
-	morph.divideScalar(denominator);
-}
-
 function WebGLMorphtargets(gl, capabilities, textures) {
 	const influencesList = {};
 	const morphInfluences = new Float32Array(8);
@@ -12779,7 +12822,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
 
 						if (hasMorphPosition === true) {
 							morph.fromBufferAttribute(morphTarget, j);
-							if (morphTarget.normalized === true) denormalize(morph, morphTarget);
 							buffer[offset + stride + 0] = morph.x;
 							buffer[offset + stride + 1] = morph.y;
 							buffer[offset + stride + 2] = morph.z;
@@ -12788,7 +12830,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
 
 						if (hasMorphNormals === true) {
 							morph.fromBufferAttribute(morphNormal, j);
-							if (morphNormal.normalized === true) denormalize(morph, morphNormal);
 							buffer[offset + stride + 4] = morph.x;
 							buffer[offset + stride + 5] = morph.y;
 							buffer[offset + stride + 6] = morph.z;
@@ -12797,7 +12838,6 @@ function WebGLMorphtargets(gl, capabilities, textures) {
 
 						if (hasMorphColors === true) {
 							morph.fromBufferAttribute(morphColor, j);
-							if (morphColor.normalized === true) denormalize(morph, morphColor);
 							buffer[offset + stride + 8] = morph.x;
 							buffer[offset + stride + 9] = morph.y;
 							buffer[offset + stride + 10] = morph.z;
@@ -21198,43 +21238,61 @@ class InterleavedBufferAttribute {
 	}
 
 	setX(index, x) {
+		if (this.normalized) x = normalize(x, this.array);
 		this.data.array[index * this.data.stride + this.offset] = x;
 		return this;
 	}
 
 	setY(index, y) {
+		if (this.normalized) y = normalize(y, this.array);
 		this.data.array[index * this.data.stride + this.offset + 1] = y;
 		return this;
 	}
 
 	setZ(index, z) {
+		if (this.normalized) z = normalize(z, this.array);
 		this.data.array[index * this.data.stride + this.offset + 2] = z;
 		return this;
 	}
 
 	setW(index, w) {
+		if (this.normalized) w = normalize(w, this.array);
 		this.data.array[index * this.data.stride + this.offset + 3] = w;
 		return this;
 	}
 
 	getX(index) {
-		return this.data.array[index * this.data.stride + this.offset];
+		let x = this.data.array[index * this.data.stride + this.offset];
+		if (this.normalized) x = denormalize(x, this.array);
+		return x;
 	}
 
 	getY(index) {
-		return this.data.array[index * this.data.stride + this.offset + 1];
+		let y = this.data.array[index * this.data.stride + this.offset + 1];
+		if (this.normalized) y = denormalize(y, this.array);
+		return y;
 	}
 
 	getZ(index) {
-		return this.data.array[index * this.data.stride + this.offset + 2];
+		let z = this.data.array[index * this.data.stride + this.offset + 2];
+		if (this.normalized) z = denormalize(z, this.array);
+		return z;
 	}
 
 	getW(index) {
-		return this.data.array[index * this.data.stride + this.offset + 3];
+		let w = this.data.array[index * this.data.stride + this.offset + 3];
+		if (this.normalized) w = denormalize(w, this.array);
+		return w;
 	}
 
 	setXY(index, x, y) {
 		index = index * this.data.stride + this.offset;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+		}
+
 		this.data.array[index + 0] = x;
 		this.data.array[index + 1] = y;
 		return this;
@@ -21242,6 +21300,13 @@ class InterleavedBufferAttribute {
 
 	setXYZ(index, x, y, z) {
 		index = index * this.data.stride + this.offset;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+			z = normalize(z, this.array);
+		}
+
 		this.data.array[index + 0] = x;
 		this.data.array[index + 1] = y;
 		this.data.array[index + 2] = z;
@@ -21250,6 +21315,14 @@ class InterleavedBufferAttribute {
 
 	setXYZW(index, x, y, z, w) {
 		index = index * this.data.stride + this.offset;
+
+		if (this.normalized) {
+			x = normalize(x, this.array);
+			y = normalize(y, this.array);
+			z = normalize(z, this.array);
+			w = normalize(w, this.array);
+		}
+
 		this.data.array[index + 0] = x;
 		this.data.array[index + 1] = y;
 		this.data.array[index + 2] = z;

+ 113 - 40
build/three.js

@@ -413,7 +413,7 @@
 		}
 	}
 
-	function denormalize$1(value, array) {
+	function denormalize(value, array) {
 		switch (array.constructor) {
 			case Float32Array:
 				return value;
@@ -482,7 +482,7 @@
 		floorPowerOfTwo: floorPowerOfTwo,
 		setQuaternionFromProperEuler: setQuaternionFromProperEuler,
 		normalize: normalize,
-		denormalize: denormalize$1
+		denormalize: denormalize
 	});
 
 	class Vector2 {
@@ -1712,14 +1712,6 @@
 			this.r = attribute.getX(index);
 			this.g = attribute.getY(index);
 			this.b = attribute.getZ(index);
-
-			if (attribute.normalized === true) {
-				// assuming Uint8Array
-				this.r /= 255;
-				this.g /= 255;
-				this.b /= 255;
-			}
-
 			return this;
 		}
 
@@ -7133,9 +7125,15 @@
 					color = new Color();
 				}
 
-				array[offset++] = color.r;
-				array[offset++] = color.g;
-				array[offset++] = color.b;
+				if (this.normalized) {
+					array[offset++] = normalize(color.r, array);
+					array[offset++] = normalize(color.g, array);
+					array[offset++] = normalize(color.b, array);
+				} else {
+					array[offset++] = color.r;
+					array[offset++] = color.g;
+					array[offset++] = color.b;
+				}
 			}
 
 			return this;
@@ -7153,8 +7151,13 @@
 					vector = new Vector2();
 				}
 
-				array[offset++] = vector.x;
-				array[offset++] = vector.y;
+				if (this.normalized) {
+					array[offset++] = normalize(vector.x, array);
+					array[offset++] = normalize(vector.y, array);
+				} else {
+					array[offset++] = vector.x;
+					array[offset++] = vector.y;
+				}
 			}
 
 			return this;
@@ -7172,9 +7175,15 @@
 					vector = new Vector3();
 				}
 
-				array[offset++] = vector.x;
-				array[offset++] = vector.y;
-				array[offset++] = vector.z;
+				if (this.normalized) {
+					array[offset++] = normalize(vector.x, array);
+					array[offset++] = normalize(vector.y, array);
+					array[offset++] = normalize(vector.z, array);
+				} else {
+					array[offset++] = vector.x;
+					array[offset++] = vector.y;
+					array[offset++] = vector.z;
+				}
 			}
 
 			return this;
@@ -7192,10 +7201,17 @@
 					vector = new Vector4();
 				}
 
-				array[offset++] = vector.x;
-				array[offset++] = vector.y;
-				array[offset++] = vector.z;
-				array[offset++] = vector.w;
+				if (this.normalized) {
+					array[offset++] = normalize(vector.x, array);
+					array[offset++] = normalize(vector.y, array);
+					array[offset++] = normalize(vector.z, array);
+					array[offset++] = normalize(vector.w, array);
+				} else {
+					array[offset++] = vector.x;
+					array[offset++] = vector.y;
+					array[offset++] = vector.z;
+					array[offset++] = vector.w;
+				}
 			}
 
 			return this;
@@ -7260,48 +7276,67 @@
 		}
 
 		set(value, offset = 0) {
+			if (this.normalized) value = normalize(value, this.array);
 			this.array.set(value, offset);
 			return this;
 		}
 
 		getX(index) {
-			return this.array[index * this.itemSize];
+			let x = this.array[index * this.itemSize];
+			if (this.normalized) x = denormalize(x, this.array);
+			return x;
 		}
 
 		setX(index, x) {
+			if (this.normalized) x = normalize(x, this.array);
 			this.array[index * this.itemSize] = x;
 			return this;
 		}
 
 		getY(index) {
-			return this.array[index * this.itemSize + 1];
+			let y = this.array[index * this.itemSize + 1];
+			if (this.normalized) y = denormalize(y, this.array);
+			return y;
 		}
 
 		setY(index, y) {
+			if (this.normalized) y = normalize(y, this.array);
 			this.array[index * this.itemSize + 1] = y;
 			return this;
 		}
 
 		getZ(index) {
-			return this.array[index * this.itemSize + 2];
+			let z = this.array[index * this.itemSize + 2];
+			if (this.normalized) z = denormalize(z, this.array);
+			return z;
 		}
 
 		setZ(index, z) {
+			if (this.normalized) z = normalize(z, this.array);
 			this.array[index * this.itemSize + 2] = z;
 			return this;
 		}
 
 		getW(index) {
-			return this.array[index * this.itemSize + 3];
+			let w = this.array[index * this.itemSize + 3];
+			if (this.normalized) w = denormalize(w, this.array);
+			return w;
 		}
 
 		setW(index, w) {
+			if (this.normalized) w = normalize(w, this.array);
 			this.array[index * this.itemSize + 3] = w;
 			return this;
 		}
 
 		setXY(index, x, y) {
 			index *= this.itemSize;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+			}
+
 			this.array[index + 0] = x;
 			this.array[index + 1] = y;
 			return this;
@@ -7309,6 +7344,13 @@
 
 		setXYZ(index, x, y, z) {
 			index *= this.itemSize;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+				z = normalize(z, this.array);
+			}
+
 			this.array[index + 0] = x;
 			this.array[index + 1] = y;
 			this.array[index + 2] = z;
@@ -7317,6 +7359,14 @@
 
 		setXYZW(index, x, y, z, w) {
 			index *= this.itemSize;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+				z = normalize(z, this.array);
+				w = normalize(w, this.array);
+			}
+
 			this.array[index + 0] = x;
 			this.array[index + 1] = y;
 			this.array[index + 2] = z;
@@ -12715,13 +12765,6 @@
 		return Math.abs(b[1]) - Math.abs(a[1]);
 	}
 
-	function denormalize(morph, attribute) {
-		let denominator = 1;
-		const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
-		if (array instanceof Int8Array) denominator = 127;else if (array instanceof Uint8Array) denominator = 255;else if (array instanceof Uint16Array) denominator = 65535;else if (array instanceof Int16Array) denominator = 32767;else if (array instanceof Int32Array) denominator = 2147483647;else console.error('THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array);
-		morph.divideScalar(denominator);
-	}
-
 	function WebGLMorphtargets(gl, capabilities, textures) {
 		const influencesList = {};
 		const morphInfluences = new Float32Array(8);
@@ -12781,7 +12824,6 @@
 
 							if (hasMorphPosition === true) {
 								morph.fromBufferAttribute(morphTarget, j);
-								if (morphTarget.normalized === true) denormalize(morph, morphTarget);
 								buffer[offset + stride + 0] = morph.x;
 								buffer[offset + stride + 1] = morph.y;
 								buffer[offset + stride + 2] = morph.z;
@@ -12790,7 +12832,6 @@
 
 							if (hasMorphNormals === true) {
 								morph.fromBufferAttribute(morphNormal, j);
-								if (morphNormal.normalized === true) denormalize(morph, morphNormal);
 								buffer[offset + stride + 4] = morph.x;
 								buffer[offset + stride + 5] = morph.y;
 								buffer[offset + stride + 6] = morph.z;
@@ -12799,7 +12840,6 @@
 
 							if (hasMorphColors === true) {
 								morph.fromBufferAttribute(morphColor, j);
-								if (morphColor.normalized === true) denormalize(morph, morphColor);
 								buffer[offset + stride + 8] = morph.x;
 								buffer[offset + stride + 9] = morph.y;
 								buffer[offset + stride + 10] = morph.z;
@@ -21200,43 +21240,61 @@
 		}
 
 		setX(index, x) {
+			if (this.normalized) x = normalize(x, this.array);
 			this.data.array[index * this.data.stride + this.offset] = x;
 			return this;
 		}
 
 		setY(index, y) {
+			if (this.normalized) y = normalize(y, this.array);
 			this.data.array[index * this.data.stride + this.offset + 1] = y;
 			return this;
 		}
 
 		setZ(index, z) {
+			if (this.normalized) z = normalize(z, this.array);
 			this.data.array[index * this.data.stride + this.offset + 2] = z;
 			return this;
 		}
 
 		setW(index, w) {
+			if (this.normalized) w = normalize(w, this.array);
 			this.data.array[index * this.data.stride + this.offset + 3] = w;
 			return this;
 		}
 
 		getX(index) {
-			return this.data.array[index * this.data.stride + this.offset];
+			let x = this.data.array[index * this.data.stride + this.offset];
+			if (this.normalized) x = denormalize(x, this.array);
+			return x;
 		}
 
 		getY(index) {
-			return this.data.array[index * this.data.stride + this.offset + 1];
+			let y = this.data.array[index * this.data.stride + this.offset + 1];
+			if (this.normalized) y = denormalize(y, this.array);
+			return y;
 		}
 
 		getZ(index) {
-			return this.data.array[index * this.data.stride + this.offset + 2];
+			let z = this.data.array[index * this.data.stride + this.offset + 2];
+			if (this.normalized) z = denormalize(z, this.array);
+			return z;
 		}
 
 		getW(index) {
-			return this.data.array[index * this.data.stride + this.offset + 3];
+			let w = this.data.array[index * this.data.stride + this.offset + 3];
+			if (this.normalized) w = denormalize(w, this.array);
+			return w;
 		}
 
 		setXY(index, x, y) {
 			index = index * this.data.stride + this.offset;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+			}
+
 			this.data.array[index + 0] = x;
 			this.data.array[index + 1] = y;
 			return this;
@@ -21244,6 +21302,13 @@
 
 		setXYZ(index, x, y, z) {
 			index = index * this.data.stride + this.offset;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+				z = normalize(z, this.array);
+			}
+
 			this.data.array[index + 0] = x;
 			this.data.array[index + 1] = y;
 			this.data.array[index + 2] = z;
@@ -21252,6 +21317,14 @@
 
 		setXYZW(index, x, y, z, w) {
 			index = index * this.data.stride + this.offset;
+
+			if (this.normalized) {
+				x = normalize(x, this.array);
+				y = normalize(y, this.array);
+				z = normalize(z, this.array);
+				w = normalize(w, this.array);
+			}
+
 			this.data.array[index + 0] = x;
 			this.data.array[index + 1] = y;
 			this.data.array[index + 2] = z;

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
build/three.min.js


+ 160 - 54
build/three.module.js

@@ -499,7 +499,7 @@ function setQuaternionFromProperEuler( q, a, b, c, order ) {
 
 }
 
-function denormalize$1( value, array ) {
+function denormalize( value, array ) {
 
 	switch ( array.constructor ) {
 
@@ -588,7 +588,7 @@ var MathUtils = /*#__PURE__*/Object.freeze({
 	floorPowerOfTwo: floorPowerOfTwo,
 	setQuaternionFromProperEuler: setQuaternionFromProperEuler,
 	normalize: normalize,
-	denormalize: denormalize$1
+	denormalize: denormalize
 });
 
 class Vector2 {
@@ -2075,16 +2075,6 @@ class Color {
 		this.g = attribute.getY( index );
 		this.b = attribute.getZ( index );
 
-		if ( attribute.normalized === true ) {
-
-			// assuming Uint8Array
-
-			this.r /= 255;
-			this.g /= 255;
-			this.b /= 255;
-
-		}
-
 		return this;
 
 	}
@@ -9297,9 +9287,19 @@ class BufferAttribute {
 
 			}
 
-			array[ offset ++ ] = color.r;
-			array[ offset ++ ] = color.g;
-			array[ offset ++ ] = color.b;
+			if ( this.normalized ) {
+
+				array[ offset ++ ] = normalize( color.r, array );
+				array[ offset ++ ] = normalize( color.g, array );
+				array[ offset ++ ] = normalize( color.b, array );
+
+			} else {
+
+				array[ offset ++ ] = color.r;
+				array[ offset ++ ] = color.g;
+				array[ offset ++ ] = color.b;
+
+			}
 
 		}
 
@@ -9323,8 +9323,17 @@ class BufferAttribute {
 
 			}
 
-			array[ offset ++ ] = vector.x;
-			array[ offset ++ ] = vector.y;
+			if ( this.normalized ) {
+
+				array[ offset ++ ] = normalize( vector.x, array );
+				array[ offset ++ ] = normalize( vector.y, array );
+
+			} else {
+
+				array[ offset ++ ] = vector.x;
+				array[ offset ++ ] = vector.y;
+
+			}
 
 		}
 
@@ -9348,9 +9357,19 @@ class BufferAttribute {
 
 			}
 
-			array[ offset ++ ] = vector.x;
-			array[ offset ++ ] = vector.y;
-			array[ offset ++ ] = vector.z;
+			if ( this.normalized ) {
+
+				array[ offset ++ ] = normalize( vector.x, array );
+				array[ offset ++ ] = normalize( vector.y, array );
+				array[ offset ++ ] = normalize( vector.z, array );
+
+			} else {
+
+				array[ offset ++ ] = vector.x;
+				array[ offset ++ ] = vector.y;
+				array[ offset ++ ] = vector.z;
+
+			}
 
 		}
 
@@ -9374,10 +9393,21 @@ class BufferAttribute {
 
 			}
 
-			array[ offset ++ ] = vector.x;
-			array[ offset ++ ] = vector.y;
-			array[ offset ++ ] = vector.z;
-			array[ offset ++ ] = vector.w;
+			if ( this.normalized ) {
+
+				array[ offset ++ ] = normalize( vector.x, array );
+				array[ offset ++ ] = normalize( vector.y, array );
+				array[ offset ++ ] = normalize( vector.z, array );
+				array[ offset ++ ] = normalize( vector.w, array );
+
+			} else {
+
+				array[ offset ++ ] = vector.x;
+				array[ offset ++ ] = vector.y;
+				array[ offset ++ ] = vector.z;
+				array[ offset ++ ] = vector.w;
+
+			}
 
 		}
 
@@ -9465,6 +9495,8 @@ class BufferAttribute {
 
 	set( value, offset = 0 ) {
 
+		if ( this.normalized ) value = normalize( value, this.array );
+
 		this.array.set( value, offset );
 
 		return this;
@@ -9473,12 +9505,18 @@ class BufferAttribute {
 
 	getX( index ) {
 
-		return this.array[ index * this.itemSize ];
+		let x = this.array[ index * this.itemSize ];
+
+		if ( this.normalized ) x = denormalize( x, this.array );
+
+		return x;
 
 	}
 
 	setX( index, x ) {
 
+		if ( this.normalized ) x = normalize( x, this.array );
+
 		this.array[ index * this.itemSize ] = x;
 
 		return this;
@@ -9487,12 +9525,18 @@ class BufferAttribute {
 
 	getY( index ) {
 
-		return this.array[ index * this.itemSize + 1 ];
+		let y = this.array[ index * this.itemSize + 1 ];
+
+		if ( this.normalized ) y = denormalize( y, this.array );
+
+		return y;
 
 	}
 
 	setY( index, y ) {
 
+		if ( this.normalized ) y = normalize( y, this.array );
+
 		this.array[ index * this.itemSize + 1 ] = y;
 
 		return this;
@@ -9501,12 +9545,18 @@ class BufferAttribute {
 
 	getZ( index ) {
 
-		return this.array[ index * this.itemSize + 2 ];
+		let z = this.array[ index * this.itemSize + 2 ];
+
+		if ( this.normalized ) z = denormalize( z, this.array );
+
+		return z;
 
 	}
 
 	setZ( index, z ) {
 
+		if ( this.normalized ) z = normalize( z, this.array );
+
 		this.array[ index * this.itemSize + 2 ] = z;
 
 		return this;
@@ -9515,12 +9565,18 @@ class BufferAttribute {
 
 	getW( index ) {
 
-		return this.array[ index * this.itemSize + 3 ];
+		let w = this.array[ index * this.itemSize + 3 ];
+
+		if ( this.normalized ) w = denormalize( w, this.array );
+
+		return w;
 
 	}
 
 	setW( index, w ) {
 
+		if ( this.normalized ) w = normalize( w, this.array );
+
 		this.array[ index * this.itemSize + 3 ] = w;
 
 		return this;
@@ -9531,6 +9587,13 @@ class BufferAttribute {
 
 		index *= this.itemSize;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+
+		}
+
 		this.array[ index + 0 ] = x;
 		this.array[ index + 1 ] = y;
 
@@ -9542,6 +9605,14 @@ class BufferAttribute {
 
 		index *= this.itemSize;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+			z = normalize( z, this.array );
+
+		}
+
 		this.array[ index + 0 ] = x;
 		this.array[ index + 1 ] = y;
 		this.array[ index + 2 ] = z;
@@ -9554,6 +9625,15 @@ class BufferAttribute {
 
 		index *= this.itemSize;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+			z = normalize( z, this.array );
+			w = normalize( w, this.array );
+
+		}
+
 		this.array[ index + 0 ] = x;
 		this.array[ index + 1 ] = y;
 		this.array[ index + 2 ] = z;
@@ -16623,22 +16703,6 @@ function absNumericalSort( a, b ) {
 
 }
 
-function denormalize( morph, attribute ) {
-
-	let denominator = 1;
-	const array = attribute.isInterleavedBufferAttribute ? attribute.data.array : attribute.array;
-
-	if ( array instanceof Int8Array ) denominator = 127;
-	else if ( array instanceof Uint8Array ) denominator = 255;
-	else if ( array instanceof Uint16Array ) denominator = 65535;
-	else if ( array instanceof Int16Array ) denominator = 32767;
-	else if ( array instanceof Int32Array ) denominator = 2147483647;
-	else console.error( 'THREE.WebGLMorphtargets: Unsupported morph attribute data type: ', array );
-
-	morph.divideScalar( denominator );
-
-}
-
 function WebGLMorphtargets( gl, capabilities, textures ) {
 
 	const influencesList = {};
@@ -16722,8 +16786,6 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
 
 							morph.fromBufferAttribute( morphTarget, j );
 
-							if ( morphTarget.normalized === true ) denormalize( morph, morphTarget );
-
 							buffer[ offset + stride + 0 ] = morph.x;
 							buffer[ offset + stride + 1 ] = morph.y;
 							buffer[ offset + stride + 2 ] = morph.z;
@@ -16735,8 +16797,6 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
 
 							morph.fromBufferAttribute( morphNormal, j );
 
-							if ( morphNormal.normalized === true ) denormalize( morph, morphNormal );
-
 							buffer[ offset + stride + 4 ] = morph.x;
 							buffer[ offset + stride + 5 ] = morph.y;
 							buffer[ offset + stride + 6 ] = morph.z;
@@ -16748,8 +16808,6 @@ function WebGLMorphtargets( gl, capabilities, textures ) {
 
 							morph.fromBufferAttribute( morphColor, j );
 
-							if ( morphColor.normalized === true ) denormalize( morph, morphColor );
-
 							buffer[ offset + stride + 8 ] = morph.x;
 							buffer[ offset + stride + 9 ] = morph.y;
 							buffer[ offset + stride + 10 ] = morph.z;
@@ -29072,6 +29130,8 @@ class InterleavedBufferAttribute {
 
 	setX( index, x ) {
 
+		if ( this.normalized ) x = normalize( x, this.array );
+
 		this.data.array[ index * this.data.stride + this.offset ] = x;
 
 		return this;
@@ -29080,6 +29140,8 @@ class InterleavedBufferAttribute {
 
 	setY( index, y ) {
 
+		if ( this.normalized ) y = normalize( y, this.array );
+
 		this.data.array[ index * this.data.stride + this.offset + 1 ] = y;
 
 		return this;
@@ -29088,6 +29150,8 @@ class InterleavedBufferAttribute {
 
 	setZ( index, z ) {
 
+		if ( this.normalized ) z = normalize( z, this.array );
+
 		this.data.array[ index * this.data.stride + this.offset + 2 ] = z;
 
 		return this;
@@ -29096,6 +29160,8 @@ class InterleavedBufferAttribute {
 
 	setW( index, w ) {
 
+		if ( this.normalized ) w = normalize( w, this.array );
+
 		this.data.array[ index * this.data.stride + this.offset + 3 ] = w;
 
 		return this;
@@ -29104,25 +29170,41 @@ class InterleavedBufferAttribute {
 
 	getX( index ) {
 
-		return this.data.array[ index * this.data.stride + this.offset ];
+		let x = this.data.array[ index * this.data.stride + this.offset ];
+
+		if ( this.normalized ) x = denormalize( x, this.array );
+
+		return x;
 
 	}
 
 	getY( index ) {
 
-		return this.data.array[ index * this.data.stride + this.offset + 1 ];
+		let y = this.data.array[ index * this.data.stride + this.offset + 1 ];
+
+		if ( this.normalized ) y = denormalize( y, this.array );
+
+		return y;
 
 	}
 
 	getZ( index ) {
 
-		return this.data.array[ index * this.data.stride + this.offset + 2 ];
+		let z = this.data.array[ index * this.data.stride + this.offset + 2 ];
+
+		if ( this.normalized ) z = denormalize( z, this.array );
+
+		return z;
 
 	}
 
 	getW( index ) {
 
-		return this.data.array[ index * this.data.stride + this.offset + 3 ];
+		let w = this.data.array[ index * this.data.stride + this.offset + 3 ];
+
+		if ( this.normalized ) w = denormalize( w, this.array );
+
+		return w;
 
 	}
 
@@ -29130,6 +29212,13 @@ class InterleavedBufferAttribute {
 
 		index = index * this.data.stride + this.offset;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+
+		}
+
 		this.data.array[ index + 0 ] = x;
 		this.data.array[ index + 1 ] = y;
 
@@ -29141,6 +29230,14 @@ class InterleavedBufferAttribute {
 
 		index = index * this.data.stride + this.offset;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+			z = normalize( z, this.array );
+
+		}
+
 		this.data.array[ index + 0 ] = x;
 		this.data.array[ index + 1 ] = y;
 		this.data.array[ index + 2 ] = z;
@@ -29153,6 +29250,15 @@ class InterleavedBufferAttribute {
 
 		index = index * this.data.stride + this.offset;
 
+		if ( this.normalized ) {
+
+			x = normalize( x, this.array );
+			y = normalize( y, this.array );
+			z = normalize( z, this.array );
+			w = normalize( w, this.array );
+
+		}
+
 		this.data.array[ index + 0 ] = x;
 		this.data.array[ index + 1 ] = y;
 		this.data.array[ index + 2 ] = z;

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio