Selaa lähdekoodia

Updated builds.

Mr.doob 4 vuotta sitten
vanhempi
commit
97092cd078
3 muutettua tiedostoa jossa 80 lisäystä ja 32 poistoa
  1. 33 16
      build/three.js
  2. 0 0
      build/three.min.js
  3. 47 16
      build/three.module.js

+ 33 - 16
build/three.js

@@ -9220,7 +9220,7 @@
 				target = new Vector3();
 			}
 
-			this.updateMatrixWorld(true);
+			this.updateWorldMatrix(true, false);
 			var e = this.matrixWorld.elements;
 			return target.set(-e[8], -e[9], -e[10]).normalize();
 		},
@@ -13833,7 +13833,7 @@
 		return (lightB.castShadow ? 1 : 0) - (lightA.castShadow ? 1 : 0);
 	}
 
-	function WebGLLights() {
+	function WebGLLights(extensions, capabilities) {
 		var cache = new UniformsCache();
 		var shadowCache = ShadowUniformsCache();
 		var state = {
@@ -14054,8 +14054,22 @@
 			}
 
 			if (rectAreaLength > 0) {
-				state.rectAreaLTC1 = UniformsLib.LTC_1;
-				state.rectAreaLTC2 = UniformsLib.LTC_2;
+				if (capabilities.isWebGL2) {
+					// WebGL 2
+					state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+					state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+				} else {
+					// WebGL 1
+					if (extensions.has('OES_texture_float_linear') === true) {
+						state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+						state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+					} else if (extensions.has('OES_texture_half_float_linear') === true) {
+						state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
+						state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
+					} else {
+						console.error('THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.');
+					}
+				}
 			}
 
 			state.ambient[0] = r;
@@ -14096,8 +14110,8 @@
 		};
 	}
 
-	function WebGLRenderState() {
-		var lights = new WebGLLights();
+	function WebGLRenderState(extensions, capabilities) {
+		var lights = new WebGLLights(extensions, capabilities);
 		var lightsArray = [];
 		var shadowsArray = [];
 
@@ -14132,19 +14146,19 @@
 		};
 	}
 
-	function WebGLRenderStates() {
+	function WebGLRenderStates(extensions, capabilities) {
 		var renderStates = new WeakMap();
 
 		function get(scene, camera) {
 			var renderState;
 
 			if (renderStates.has(scene) === false) {
-				renderState = new WebGLRenderState();
+				renderState = new WebGLRenderState(extensions, capabilities);
 				renderStates.set(scene, new WeakMap());
 				renderStates.get(scene).set(camera, renderState);
 			} else {
 				if (renderStates.get(scene).has(camera) === false) {
-					renderState = new WebGLRenderState();
+					renderState = new WebGLRenderState(extensions, capabilities);
 					renderStates.get(scene).set(camera, renderState);
 				} else {
 					renderState = renderStates.get(scene).get(camera);
@@ -17431,7 +17445,7 @@
 			programCache = new WebGLPrograms(_this, cubemaps, extensions, capabilities, bindingStates, clipping);
 			materials = new WebGLMaterials(properties);
 			renderLists = new WebGLRenderLists(properties);
-			renderStates = new WebGLRenderStates();
+			renderStates = new WebGLRenderStates(extensions, capabilities);
 			background = new WebGLBackground(_this, cubemaps, state, objects, _premultipliedAlpha);
 			bufferRenderer = new WebGLBufferRenderer(_gl, extensions, info, capabilities);
 			indexedBufferRenderer = new WebGLIndexedBufferRenderer(_gl, extensions, info, capabilities);
@@ -29190,12 +29204,12 @@
 			var material = new Materials[json.type]();
 			if (json.uuid !== undefined) material.uuid = json.uuid;
 			if (json.name !== undefined) material.name = json.name;
-			if (json.color !== undefined) material.color.setHex(json.color);
+			if (json.color !== undefined && material.color !== undefined) material.color.setHex(json.color);
 			if (json.roughness !== undefined) material.roughness = json.roughness;
 			if (json.metalness !== undefined) material.metalness = json.metalness;
 			if (json.sheen !== undefined) material.sheen = new Color().setHex(json.sheen);
-			if (json.emissive !== undefined) material.emissive.setHex(json.emissive);
-			if (json.specular !== undefined) material.specular.setHex(json.specular);
+			if (json.emissive !== undefined && material.emissive !== undefined) material.emissive.setHex(json.emissive);
+			if (json.specular !== undefined && material.specular !== undefined) material.specular.setHex(json.specular);
 			if (json.shininess !== undefined) material.shininess = json.shininess;
 			if (json.clearcoat !== undefined) material.clearcoat = json.clearcoat;
 			if (json.clearcoatRoughness !== undefined) material.clearcoatRoughness = json.clearcoatRoughness;
@@ -31105,10 +31119,10 @@
 
 			if (this._connected === true) {
 				this.disconnect();
-				this.filters = value;
+				this.filters = value.slice();
 				this.connect();
 			} else {
-				this.filters = value;
+				this.filters = value.slice();
 			}
 
 			return this;
@@ -32178,7 +32192,10 @@
 						var _lastIndex = --nObjects,
 								_lastObject = objects[_lastIndex];
 
-						indicesByUUID[_lastObject.uuid] = index;
+						if (_lastIndex > 0) {
+							indicesByUUID[_lastObject.uuid] = index;
+						}
+
 						objects[index] = _lastObject;
 						objects.pop(); // accounting is done, now do the same for all bindings
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 0 - 0
build/three.min.js


+ 47 - 16
build/three.module.js

@@ -11840,7 +11840,7 @@ Camera.prototype = Object.assign( Object.create( Object3D.prototype ), {
 
 		}
 
-		this.updateMatrixWorld( true );
+		this.updateWorldMatrix( true, false );
 
 		const e = this.matrixWorld.elements;
 
@@ -18234,7 +18234,7 @@ function shadowCastingLightsFirst( lightA, lightB ) {
 
 }
 
-function WebGLLights() {
+function WebGLLights( extensions, capabilities ) {
 
 	const cache = new UniformsCache();
 
@@ -18491,8 +18491,34 @@ function WebGLLights() {
 
 		if ( rectAreaLength > 0 ) {
 
-			state.rectAreaLTC1 = UniformsLib.LTC_1;
-			state.rectAreaLTC2 = UniformsLib.LTC_2;
+			if ( capabilities.isWebGL2 ) {
+
+				// WebGL 2
+
+				state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+				state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+
+			} else {
+
+				// WebGL 1
+
+				if ( extensions.has( 'OES_texture_float_linear' ) === true ) {
+
+					state.rectAreaLTC1 = UniformsLib.LTC_FLOAT_1;
+					state.rectAreaLTC2 = UniformsLib.LTC_FLOAT_2;
+
+				} else if ( extensions.has( 'OES_texture_half_float_linear' ) === true ) {
+
+					state.rectAreaLTC1 = UniformsLib.LTC_HALF_1;
+					state.rectAreaLTC2 = UniformsLib.LTC_HALF_2;
+
+				} else {
+
+					console.error( 'THREE.WebGLRenderer: Unable to use RectAreaLight. Missing WebGL extensions.' );
+
+				}
+
+			}
 
 		}
 
@@ -18550,9 +18576,9 @@ function WebGLLights() {
 
 }
 
-function WebGLRenderState() {
+function WebGLRenderState( extensions, capabilities ) {
 
-	const lights = new WebGLLights();
+	const lights = new WebGLLights( extensions, capabilities );
 
 	const lightsArray = [];
 	const shadowsArray = [];
@@ -18600,7 +18626,7 @@ function WebGLRenderState() {
 
 }
 
-function WebGLRenderStates() {
+function WebGLRenderStates( extensions, capabilities ) {
 
 	let renderStates = new WeakMap();
 
@@ -18610,7 +18636,7 @@ function WebGLRenderStates() {
 
 		if ( renderStates.has( scene ) === false ) {
 
-			renderState = new WebGLRenderState();
+			renderState = new WebGLRenderState( extensions, capabilities );
 			renderStates.set( scene, new WeakMap() );
 			renderStates.get( scene ).set( camera, renderState );
 
@@ -18618,7 +18644,7 @@ function WebGLRenderStates() {
 
 			if ( renderStates.get( scene ).has( camera ) === false ) {
 
-				renderState = new WebGLRenderState();
+				renderState = new WebGLRenderState( extensions, capabilities );
 				renderStates.get( scene ).set( camera, renderState );
 
 			} else {
@@ -23340,7 +23366,7 @@ function WebGLRenderer( parameters ) {
 		programCache = new WebGLPrograms( _this, cubemaps, extensions, capabilities, bindingStates, clipping );
 		materials = new WebGLMaterials( properties );
 		renderLists = new WebGLRenderLists( properties );
-		renderStates = new WebGLRenderStates();
+		renderStates = new WebGLRenderStates( extensions, capabilities );
 		background = new WebGLBackground( _this, cubemaps, state, objects, _premultipliedAlpha );
 
 		bufferRenderer = new WebGLBufferRenderer( _gl, extensions, info, capabilities );
@@ -40081,12 +40107,12 @@ MaterialLoader.prototype = Object.assign( Object.create( Loader.prototype ), {
 
 		if ( json.uuid !== undefined ) material.uuid = json.uuid;
 		if ( json.name !== undefined ) material.name = json.name;
-		if ( json.color !== undefined ) material.color.setHex( json.color );
+		if ( json.color !== undefined && material.color !== undefined ) material.color.setHex( json.color );
 		if ( json.roughness !== undefined ) material.roughness = json.roughness;
 		if ( json.metalness !== undefined ) material.metalness = json.metalness;
 		if ( json.sheen !== undefined ) material.sheen = new Color().setHex( json.sheen );
-		if ( json.emissive !== undefined ) material.emissive.setHex( json.emissive );
-		if ( json.specular !== undefined ) material.specular.setHex( json.specular );
+		if ( json.emissive !== undefined && material.emissive !== undefined ) material.emissive.setHex( json.emissive );
+		if ( json.specular !== undefined && material.specular !== undefined ) material.specular.setHex( json.specular );
 		if ( json.shininess !== undefined ) material.shininess = json.shininess;
 		if ( json.clearcoat !== undefined ) material.clearcoat = json.clearcoat;
 		if ( json.clearcoatRoughness !== undefined ) material.clearcoatRoughness = json.clearcoatRoughness;
@@ -42885,12 +42911,12 @@ class Audio extends Object3D {
 		if ( this._connected === true ) {
 
 			this.disconnect();
-			this.filters = value;
+			this.filters = value.slice();
 			this.connect();
 
 		} else {
 
-			this.filters = value;
+			this.filters = value.slice();
 
 		}
 
@@ -44472,7 +44498,12 @@ Object.assign( AnimationObjectGroup.prototype, {
 					const lastIndex = -- nObjects,
 						lastObject = objects[ lastIndex ];
 
-					indicesByUUID[ lastObject.uuid ] = index;
+					if ( lastIndex > 0 ) {
+
+						indicesByUUID[ lastObject.uuid ] = index;
+
+					}
+
 					objects[ index ] = lastObject;
 					objects.pop();
 

Kaikkia tiedostoja ei voida näyttää, sillä liian monta tiedostoa muuttui tässä diffissä