Explorar el Código

Examples: Clean up. (#31643)

* Examples: Clean up.

* Update webgl_loader_gltf_progressive_lod.html

* Examples: More clean up.
Michael Herzog hace 6 meses
padre
commit
4203d2b303

BIN
examples/screenshots/webgl_loader_gltf_progressive_lod.jpg


+ 33 - 31
examples/webgl_loader_gltf_progressive_lod.html

@@ -22,10 +22,7 @@
 
 
 	<body>
 	<body>
 		<div id="info">
 		<div id="info">
-			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - GLTF progressive loading: 82x faster - <a href="https://www.npmjs.com/package/@needle-tools/gltf-progressive" target="_blank" rel="noopener">@needle-tools/gltf-progressive</a>
-			
-			<br />
-			<br />
+			<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - GLTF progressive loading: 82x faster - <a href="https://www.npmjs.com/package/@needle-tools/gltf-progressive" target="_blank" rel="noopener">@needle-tools/gltf-progressive</a><br />
 			Mobile Home & Peachy Balloon by
 			Mobile Home & Peachy Balloon by
 			<a href="https://sketchfab.com/3d-models/mobile-home-5240b1dbc29c4ea28be7f91b3638951a" target="_blank" rel="noopener">ConradJustin</a><br/>
 			<a href="https://sketchfab.com/3d-models/mobile-home-5240b1dbc29c4ea28be7f91b3638951a" target="_blank" rel="noopener">ConradJustin</a><br/>
 			The Forgotten Knight by 
 			The Forgotten Knight by 
@@ -72,15 +69,15 @@
 				renderer.toneMappingExposure = 1;
 				renderer.toneMappingExposure = 1;
 
 
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 0.1, 40 );
 				camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 0.1, 40 );
-				camera.position.set( -9, 2, -13 );
+				camera.position.set( - 9, 2, - 13 );
 
 
-				const fog = new THREE.Fog( "#131055", 15, 50 );
+				const fog = new THREE.Fog( '#131055', 15, 50 );
 				scene.fog = fog;
 				scene.fog = fog;
 
 
 				const controls = new OrbitControls( camera, renderer.domElement );
 				const controls = new OrbitControls( camera, renderer.domElement );
 				controls.minDistance = .1;
 				controls.minDistance = .1;
 				controls.maxDistance = 20;
 				controls.maxDistance = 20;
-				controls.target.set( -1, 2.1, 0 );
+				controls.target.set( - 1, 2.1, 0 );
 				controls.update();
 				controls.update();
 
 
 				new HDRLoader()
 				new HDRLoader()
@@ -89,86 +86,90 @@
 
 
 						texture.mapping = THREE.EquirectangularReflectionMapping;
 						texture.mapping = THREE.EquirectangularReflectionMapping;
 
 
-						scene.background = new THREE.Color( "#192022" );
+						scene.background = new THREE.Color( '#192022' );
 						scene.backgroundBlurriness = .5;
 						scene.backgroundBlurriness = .5;
 						scene.environment = texture;
 						scene.environment = texture;
-						scene.environmentRotation = new THREE.Euler( 0, Math.PI / -2, 0, 'XYZ' );
+						scene.environmentRotation = new THREE.Euler( 0, Math.PI / - 2, 0, 'XYZ' );
 
 
 					} );
 					} );
-				
+			
 
 
-				mixer = new THREE.AnimationMixer(scene);
+				mixer = new THREE.AnimationMixer( scene );
 
 
 				const loader = new GLTFLoader();
 				const loader = new GLTFLoader();
 
 
-				useNeedleProgressive(loader, renderer);
+				useNeedleProgressive( loader, renderer );
 
 
-				loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function ( gltf ) {
+				loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function ( gltf ) {
 
 
 					const model = gltf.scene;
 					const model = gltf.scene;
 
 
 					model.scale.multiplyScalar( 0.1 );
 					model.scale.multiplyScalar( 0.1 );
 
 
 					scene.add( model );
 					scene.add( model );
-					
+			
 					const animations = gltf.animations;
 					const animations = gltf.animations;
 					if ( animations && animations.length ) {
 					if ( animations && animations.length ) {
 
 
-						for (const animation of animations) {
+						for ( const animation of animations ) {
 
 
-							mixer.clipAction(animation).play();
+							mixer.clipAction( animation ).play();
 
 
 						}
 						}
+			
 					}
 					}
 			
 			
 				} );
 				} );
 
 
-				loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function ( gltf ) {
+				loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function ( gltf ) {
 
 
 					const model = gltf.scene;
 					const model = gltf.scene;
-					
+			
 					model.scale.multiplyScalar( 0.0005 );
 					model.scale.multiplyScalar( 0.0005 );
 
 
 					model.position.set( 1.6, 6, 7 );
 					model.position.set( 1.6, 6, 7 );
 
 
 					model.rotation.set( 0, Math.PI * 1.4, 0 );
 					model.rotation.set( 0, Math.PI * 1.4, 0 );
-					
+			
 					scene.add( model );
 					scene.add( model );
 
 
 					airshipModel = model;
 					airshipModel = model;
-					
+			
 					const animations = gltf.animations;
 					const animations = gltf.animations;
+			
 					if ( animations && animations.length ) {
 					if ( animations && animations.length ) {
 
 
-						for (const animation of animations) {
+						for ( const animation of animations ) {
 
 
-							mixer.clipAction(animation).play();
+							mixer.clipAction( animation ).play();
 
 
 						}
 						}
+			
 					}
 					}
 
 
 				} );
 				} );
 
 
-				loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function ( gltf ) {
+				loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function ( gltf ) {
 
 
 					const model = gltf.scene;
 					const model = gltf.scene;
-					
+			
 					model.scale.multiplyScalar( 0.5 );
 					model.scale.multiplyScalar( 0.5 );
 
 
 					model.position.set( 2, 5.15, 2.3 );
 					model.position.set( 2, 5.15, 2.3 );
 
 
 					model.rotation.set( 0, Math.PI * 1, 0 );
 					model.rotation.set( 0, Math.PI * 1, 0 );
-					
+			
 					scene.add( model );
 					scene.add( model );
-					
+			
 					const animations = gltf.animations;
 					const animations = gltf.animations;
 					if ( animations && animations.length ) {
 					if ( animations && animations.length ) {
 
 
-						for (const animation of animations) {
+						for ( const animation of animations ) {
 
 
-							mixer.clipAction(animation).play();
+							mixer.clipAction( animation ).play();
 
 
 						}
 						}
+			
 					}
 					}
 
 
 				} );
 				} );
@@ -199,17 +200,18 @@
 				const dt = clock.getDelta();
 				const dt = clock.getDelta();
 				time += dt;
 				time += dt;
 
 
-				mixer.update(dt);
+				mixer.update( dt );
 
 
-				if( airshipModel ) {
+				if ( airshipModel ) {
 
 
-					airshipModel.position.y += Math.sin(time) * 0.002;
+					airshipModel.position.y += Math.sin( time ) * 0.002;
 
 
 				}
 				}
 
 
 				renderer.render( scene, camera );
 				renderer.render( scene, camera );
 
 
 				window.requestAnimationFrame( animate );
 				window.requestAnimationFrame( animate );
+
 			}
 			}
 
 
 			animate();
 			animate();

粤ICP备19079148号