Mugen87 1 рік тому
батько
коміт
fc5a228101
5 змінених файлів з 105 додано та 171 видалено
  1. 35 57
      build/three.cjs
  2. 35 57
      build/three.js
  3. 0 0
      build/three.min.js
  4. 35 57
      build/three.module.js
  5. 0 0
      build/three.module.min.js

+ 35 - 57
build/three.cjs

@@ -29089,14 +29089,18 @@ class WebGLRenderer {
 
 		}
 
-		this.compile = function ( scene, camera ) {
+		this.compile = function ( scene, camera, targetScene = null ) {
 
-			currentRenderState = renderStates.get( scene );
+			if ( targetScene === null ) targetScene = scene;
+
+			currentRenderState = renderStates.get( targetScene );
 			currentRenderState.init();
 
 			renderStateStack.push( currentRenderState );
 
-			scene.traverseVisible( function ( object ) {
+			// gather lights from both the target scene and the new object that will be added to the scene.
+
+			targetScene.traverseVisible( function ( object ) {
 
 				if ( object.isLight && object.layers.test( camera.layers ) ) {
 
@@ -29112,67 +29116,31 @@ class WebGLRenderer {
 
 			} );
 
-			currentRenderState.setupLights( _this._useLegacyLights );
-
-			scene.traverse( function ( object ) {
-
-				const material = object.material;
+			if ( scene !== targetScene ) {
 
-				if ( material ) {
+				scene.traverseVisible( function ( object ) {
 
-					if ( Array.isArray( material ) ) {
+					if ( object.isLight && object.layers.test( camera.layers ) ) {
 
-						for ( let i = 0; i < material.length; i ++ ) {
+						currentRenderState.pushLight( object );
 
-							const material2 = material[ i ];
+						if ( object.castShadow ) {
 
-							prepareMaterial( material2, scene, object );
+							currentRenderState.pushShadow( object );
 
 						}
 
-					} else {
-
-						prepareMaterial( material, scene, object );
-
 					}
 
-				}
-
-			} );
-
-			renderStateStack.pop();
-			currentRenderState = null;
-
-		};
-
-		// compileAsync
-
-		this.compileAsync = function ( scene, camera ) {
-
-			currentRenderState = renderStates.get( scene );
-			currentRenderState.init();
-
-			renderStateStack.push( currentRenderState );
-
-			scene.traverseVisible( function ( object ) {
-
-				if ( object.isLight && object.layers.test( camera.layers ) ) {
-
-					currentRenderState.pushLight( object );
-
-					if ( object.castShadow ) {
-
-						currentRenderState.pushShadow( object );
-
-					}
-
-				}
+				} );
 
-			} );
+			}
 
 			currentRenderState.setupLights( _this._useLegacyLights );
 
-			const compiling = new Set();
+			// Only initialize materials in the new scene, not the targetScene.
+
+			const materials = new Set();
 
 			scene.traverse( function ( object ) {
 
@@ -29186,15 +29154,15 @@ class WebGLRenderer {
 
 							const material2 = material[ i ];
 
-							prepareMaterial( material2, scene, object );
-							compiling.add( material2 );
+							prepareMaterial( material2, targetScene, object );
+							materials.add( material2 );
 
 						}
 
 					} else {
 
-						prepareMaterial( material, scene, object );
-						compiling.add( material );
+						prepareMaterial( material, targetScene, object );
+						materials.add( material );
 
 					}
 
@@ -29205,6 +29173,16 @@ class WebGLRenderer {
 			renderStateStack.pop();
 			currentRenderState = null;
 
+			return materials;
+
+		};
+
+		// compileAsync
+
+		this.compileAsync = function ( scene, camera, targetScene = null ) {
+
+			const materials = this.compile( scene, camera, targetScene );
+
 			// Wait for all the materials in the new object to indicate that they're
 			// ready to be used before resolving the promise.
 
@@ -29212,7 +29190,7 @@ class WebGLRenderer {
 
 				function checkMaterialsReady() {
 
-					compiling.forEach( function ( material ) {
+					materials.forEach( function ( material ) {
 
 						const materialProperties = properties.get( material );
 						const program = materialProperties.currentProgram;
@@ -29220,7 +29198,7 @@ class WebGLRenderer {
 						if ( program.isReady() ) {
 
 							// remove any programs that report they're ready to use from the list
-							compiling.delete( material );
+							materials.delete( material );
 
 						}
 
@@ -29228,7 +29206,7 @@ class WebGLRenderer {
 
 					// once the list of compiling materials is empty, call the callback
 
-					if ( compiling.size === 0 ) {
+					if ( materials.size === 0 ) {
 
 						resolve( scene );
 						return;

+ 35 - 57
build/three.js

@@ -29094,14 +29094,18 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 			}
 
-			this.compile = function ( scene, camera ) {
+			this.compile = function ( scene, camera, targetScene = null ) {
 
-				currentRenderState = renderStates.get( scene );
+				if ( targetScene === null ) targetScene = scene;
+
+				currentRenderState = renderStates.get( targetScene );
 				currentRenderState.init();
 
 				renderStateStack.push( currentRenderState );
 
-				scene.traverseVisible( function ( object ) {
+				// gather lights from both the target scene and the new object that will be added to the scene.
+
+				targetScene.traverseVisible( function ( object ) {
 
 					if ( object.isLight && object.layers.test( camera.layers ) ) {
 
@@ -29117,67 +29121,31 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 				} );
 
-				currentRenderState.setupLights( _this._useLegacyLights );
-
-				scene.traverse( function ( object ) {
-
-					const material = object.material;
+				if ( scene !== targetScene ) {
 
-					if ( material ) {
+					scene.traverseVisible( function ( object ) {
 
-						if ( Array.isArray( material ) ) {
+						if ( object.isLight && object.layers.test( camera.layers ) ) {
 
-							for ( let i = 0; i < material.length; i ++ ) {
+							currentRenderState.pushLight( object );
 
-								const material2 = material[ i ];
+							if ( object.castShadow ) {
 
-								prepareMaterial( material2, scene, object );
+								currentRenderState.pushShadow( object );
 
 							}
 
-						} else {
-
-							prepareMaterial( material, scene, object );
-
 						}
 
-					}
-
-				} );
-
-				renderStateStack.pop();
-				currentRenderState = null;
-
-			};
-
-			// compileAsync
-
-			this.compileAsync = function ( scene, camera ) {
-
-				currentRenderState = renderStates.get( scene );
-				currentRenderState.init();
-
-				renderStateStack.push( currentRenderState );
-
-				scene.traverseVisible( function ( object ) {
-
-					if ( object.isLight && object.layers.test( camera.layers ) ) {
-
-						currentRenderState.pushLight( object );
-
-						if ( object.castShadow ) {
-
-							currentRenderState.pushShadow( object );
-
-						}
-
-					}
+					} );
 
-				} );
+				}
 
 				currentRenderState.setupLights( _this._useLegacyLights );
 
-				const compiling = new Set();
+				// Only initialize materials in the new scene, not the targetScene.
+
+				const materials = new Set();
 
 				scene.traverse( function ( object ) {
 
@@ -29191,15 +29159,15 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 								const material2 = material[ i ];
 
-								prepareMaterial( material2, scene, object );
-								compiling.add( material2 );
+								prepareMaterial( material2, targetScene, object );
+								materials.add( material2 );
 
 							}
 
 						} else {
 
-							prepareMaterial( material, scene, object );
-							compiling.add( material );
+							prepareMaterial( material, targetScene, object );
+							materials.add( material );
 
 						}
 
@@ -29210,6 +29178,16 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 				renderStateStack.pop();
 				currentRenderState = null;
 
+				return materials;
+
+			};
+
+			// compileAsync
+
+			this.compileAsync = function ( scene, camera, targetScene = null ) {
+
+				const materials = this.compile( scene, camera, targetScene );
+
 				// Wait for all the materials in the new object to indicate that they're
 				// ready to be used before resolving the promise.
 
@@ -29217,7 +29195,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 					function checkMaterialsReady() {
 
-						compiling.forEach( function ( material ) {
+						materials.forEach( function ( material ) {
 
 							const materialProperties = properties.get( material );
 							const program = materialProperties.currentProgram;
@@ -29225,7 +29203,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 							if ( program.isReady() ) {
 
 								// remove any programs that report they're ready to use from the list
-								compiling.delete( material );
+								materials.delete( material );
 
 							}
 
@@ -29233,7 +29211,7 @@ console.warn( 'Scripts "build/three.js" and "build/three.min.js" are deprecated
 
 						// once the list of compiling materials is empty, call the callback
 
-						if ( compiling.size === 0 ) {
+						if ( materials.size === 0 ) {
 
 							resolve( scene );
 							return;

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
build/three.min.js


+ 35 - 57
build/three.module.js

@@ -29087,14 +29087,18 @@ class WebGLRenderer {
 
 		}
 
-		this.compile = function ( scene, camera ) {
+		this.compile = function ( scene, camera, targetScene = null ) {
 
-			currentRenderState = renderStates.get( scene );
+			if ( targetScene === null ) targetScene = scene;
+
+			currentRenderState = renderStates.get( targetScene );
 			currentRenderState.init();
 
 			renderStateStack.push( currentRenderState );
 
-			scene.traverseVisible( function ( object ) {
+			// gather lights from both the target scene and the new object that will be added to the scene.
+
+			targetScene.traverseVisible( function ( object ) {
 
 				if ( object.isLight && object.layers.test( camera.layers ) ) {
 
@@ -29110,67 +29114,31 @@ class WebGLRenderer {
 
 			} );
 
-			currentRenderState.setupLights( _this._useLegacyLights );
-
-			scene.traverse( function ( object ) {
-
-				const material = object.material;
+			if ( scene !== targetScene ) {
 
-				if ( material ) {
+				scene.traverseVisible( function ( object ) {
 
-					if ( Array.isArray( material ) ) {
+					if ( object.isLight && object.layers.test( camera.layers ) ) {
 
-						for ( let i = 0; i < material.length; i ++ ) {
+						currentRenderState.pushLight( object );
 
-							const material2 = material[ i ];
+						if ( object.castShadow ) {
 
-							prepareMaterial( material2, scene, object );
+							currentRenderState.pushShadow( object );
 
 						}
 
-					} else {
-
-						prepareMaterial( material, scene, object );
-
 					}
 
-				}
-
-			} );
-
-			renderStateStack.pop();
-			currentRenderState = null;
-
-		};
-
-		// compileAsync
-
-		this.compileAsync = function ( scene, camera ) {
-
-			currentRenderState = renderStates.get( scene );
-			currentRenderState.init();
-
-			renderStateStack.push( currentRenderState );
-
-			scene.traverseVisible( function ( object ) {
-
-				if ( object.isLight && object.layers.test( camera.layers ) ) {
-
-					currentRenderState.pushLight( object );
-
-					if ( object.castShadow ) {
-
-						currentRenderState.pushShadow( object );
-
-					}
-
-				}
+				} );
 
-			} );
+			}
 
 			currentRenderState.setupLights( _this._useLegacyLights );
 
-			const compiling = new Set();
+			// Only initialize materials in the new scene, not the targetScene.
+
+			const materials = new Set();
 
 			scene.traverse( function ( object ) {
 
@@ -29184,15 +29152,15 @@ class WebGLRenderer {
 
 							const material2 = material[ i ];
 
-							prepareMaterial( material2, scene, object );
-							compiling.add( material2 );
+							prepareMaterial( material2, targetScene, object );
+							materials.add( material2 );
 
 						}
 
 					} else {
 
-						prepareMaterial( material, scene, object );
-						compiling.add( material );
+						prepareMaterial( material, targetScene, object );
+						materials.add( material );
 
 					}
 
@@ -29203,6 +29171,16 @@ class WebGLRenderer {
 			renderStateStack.pop();
 			currentRenderState = null;
 
+			return materials;
+
+		};
+
+		// compileAsync
+
+		this.compileAsync = function ( scene, camera, targetScene = null ) {
+
+			const materials = this.compile( scene, camera, targetScene );
+
 			// Wait for all the materials in the new object to indicate that they're
 			// ready to be used before resolving the promise.
 
@@ -29210,7 +29188,7 @@ class WebGLRenderer {
 
 				function checkMaterialsReady() {
 
-					compiling.forEach( function ( material ) {
+					materials.forEach( function ( material ) {
 
 						const materialProperties = properties.get( material );
 						const program = materialProperties.currentProgram;
@@ -29218,7 +29196,7 @@ class WebGLRenderer {
 						if ( program.isReady() ) {
 
 							// remove any programs that report they're ready to use from the list
-							compiling.delete( material );
+							materials.delete( material );
 
 						}
 
@@ -29226,7 +29204,7 @@ class WebGLRenderer {
 
 					// once the list of compiling materials is empty, call the callback
 
-					if ( compiling.size === 0 ) {
+					if ( materials.size === 0 ) {
 
 						resolve( scene );
 						return;

Різницю між файлами не показано, бо вона завелика
+ 0 - 0
build/three.module.min.js


Деякі файли не було показано, через те що забагато файлів було змінено