|
|
@@ -22,10 +22,7 @@
|
|
|
|
|
|
<body>
|
|
|
<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
|
|
|
<a href="https://sketchfab.com/3d-models/mobile-home-5240b1dbc29c4ea28be7f91b3638951a" target="_blank" rel="noopener">ConradJustin</a><br/>
|
|
|
The Forgotten Knight by
|
|
|
@@ -72,15 +69,15 @@
|
|
|
renderer.toneMappingExposure = 1;
|
|
|
|
|
|
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;
|
|
|
|
|
|
const controls = new OrbitControls( camera, renderer.domElement );
|
|
|
controls.minDistance = .1;
|
|
|
controls.maxDistance = 20;
|
|
|
- controls.target.set( -1, 2.1, 0 );
|
|
|
+ controls.target.set( - 1, 2.1, 0 );
|
|
|
controls.update();
|
|
|
|
|
|
new HDRLoader()
|
|
|
@@ -89,86 +86,90 @@
|
|
|
|
|
|
texture.mapping = THREE.EquirectangularReflectionMapping;
|
|
|
|
|
|
- scene.background = new THREE.Color( "#192022" );
|
|
|
+ scene.background = new THREE.Color( '#192022' );
|
|
|
scene.backgroundBlurriness = .5;
|
|
|
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();
|
|
|
|
|
|
- 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;
|
|
|
|
|
|
model.scale.multiplyScalar( 0.1 );
|
|
|
|
|
|
scene.add( model );
|
|
|
-
|
|
|
+
|
|
|
const animations = gltf.animations;
|
|
|
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;
|
|
|
-
|
|
|
+
|
|
|
model.scale.multiplyScalar( 0.0005 );
|
|
|
|
|
|
model.position.set( 1.6, 6, 7 );
|
|
|
|
|
|
model.rotation.set( 0, Math.PI * 1.4, 0 );
|
|
|
-
|
|
|
+
|
|
|
scene.add( model );
|
|
|
|
|
|
airshipModel = model;
|
|
|
-
|
|
|
+
|
|
|
const animations = gltf.animations;
|
|
|
+
|
|
|
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;
|
|
|
-
|
|
|
+
|
|
|
model.scale.multiplyScalar( 0.5 );
|
|
|
|
|
|
model.position.set( 2, 5.15, 2.3 );
|
|
|
|
|
|
model.rotation.set( 0, Math.PI * 1, 0 );
|
|
|
-
|
|
|
+
|
|
|
scene.add( model );
|
|
|
-
|
|
|
+
|
|
|
const animations = gltf.animations;
|
|
|
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();
|
|
|
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 );
|
|
|
|
|
|
window.requestAnimationFrame( animate );
|
|
|
+
|
|
|
}
|
|
|
|
|
|
animate();
|