|
22 | 22 |
|
23 | 23 | <body>
|
24 | 24 | <div id="info">
|
25 |
| - <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> |
26 |
| - |
27 |
| - <br /> |
28 |
| - <br /> |
| 25 | + <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 /> |
29 | 26 | Mobile Home & Peachy Balloon by
|
30 | 27 | <a href="https://sketchfab.com/3d-models/mobile-home-5240b1dbc29c4ea28be7f91b3638951a" target="_blank" rel="noopener">ConradJustin</a><br/>
|
31 | 28 | The Forgotten Knight by
|
|
72 | 69 | renderer.toneMappingExposure = 1;
|
73 | 70 |
|
74 | 71 | camera = new THREE.PerspectiveCamera( 40, window.innerWidth / window.innerHeight, 0.1, 40 );
|
75 |
| - camera.position.set( -9, 2, -13 ); |
| 72 | + camera.position.set( - 9, 2, - 13 ); |
76 | 73 |
|
77 |
| - const fog = new THREE.Fog( "#131055", 15, 50 ); |
| 74 | + const fog = new THREE.Fog( '#131055', 15, 50 ); |
78 | 75 | scene.fog = fog;
|
79 | 76 |
|
80 | 77 | const controls = new OrbitControls( camera, renderer.domElement );
|
81 | 78 | controls.minDistance = .1;
|
82 | 79 | controls.maxDistance = 20;
|
83 |
| - controls.target.set( -1, 2.1, 0 ); |
| 80 | + controls.target.set( - 1, 2.1, 0 ); |
84 | 81 | controls.update();
|
85 | 82 |
|
86 | 83 | new HDRLoader()
|
|
89 | 86 |
|
90 | 87 | texture.mapping = THREE.EquirectangularReflectionMapping;
|
91 | 88 |
|
92 |
| - scene.background = new THREE.Color( "#192022" ); |
| 89 | + scene.background = new THREE.Color( '#192022' ); |
93 | 90 | scene.backgroundBlurriness = .5;
|
94 | 91 | scene.environment = texture;
|
95 |
| - scene.environmentRotation = new THREE.Euler( 0, Math.PI / -2, 0, 'XYZ' ); |
| 92 | + scene.environmentRotation = new THREE.Euler( 0, Math.PI / - 2, 0, 'XYZ' ); |
96 | 93 |
|
97 | 94 | } );
|
98 |
| - |
| 95 | + |
99 | 96 |
|
100 |
| - mixer = new THREE.AnimationMixer(scene); |
| 97 | + mixer = new THREE.AnimationMixer( scene ); |
101 | 98 |
|
102 | 99 | const loader = new GLTFLoader();
|
103 | 100 |
|
104 |
| - useNeedleProgressive(loader, renderer); |
| 101 | + useNeedleProgressive( loader, renderer ); |
105 | 102 |
|
106 |
| - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function ( gltf ) { |
| 103 | + loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZ2sPRdk-world/file', function ( gltf ) { |
107 | 104 |
|
108 | 105 | const model = gltf.scene;
|
109 | 106 |
|
110 | 107 | model.scale.multiplyScalar( 0.1 );
|
111 | 108 |
|
112 | 109 | scene.add( model );
|
113 |
| - |
| 110 | + |
114 | 111 | const animations = gltf.animations;
|
115 | 112 | if ( animations && animations.length ) {
|
116 | 113 |
|
117 |
| - for (const animation of animations) { |
| 114 | + for ( const animation of animations ) { |
118 | 115 |
|
119 |
| - mixer.clipAction(animation).play(); |
| 116 | + mixer.clipAction( animation ).play(); |
120 | 117 |
|
121 | 118 | }
|
| 119 | + |
122 | 120 | }
|
123 | 121 |
|
124 | 122 | } );
|
125 | 123 |
|
126 |
| - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function ( gltf ) { |
| 124 | + loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZnlceI-ZnlceI-world/file', function ( gltf ) { |
127 | 125 |
|
128 | 126 | const model = gltf.scene;
|
129 |
| - |
| 127 | + |
130 | 128 | model.scale.multiplyScalar( 0.0005 );
|
131 | 129 |
|
132 | 130 | model.position.set( 1.6, 6, 7 );
|
133 | 131 |
|
134 | 132 | model.rotation.set( 0, Math.PI * 1.4, 0 );
|
135 |
| - |
| 133 | + |
136 | 134 | scene.add( model );
|
137 | 135 |
|
138 | 136 | airshipModel = model;
|
139 |
| - |
| 137 | + |
140 | 138 | const animations = gltf.animations;
|
| 139 | + |
141 | 140 | if ( animations && animations.length ) {
|
142 | 141 |
|
143 |
| - for (const animation of animations) { |
| 142 | + for ( const animation of animations ) { |
144 | 143 |
|
145 |
| - mixer.clipAction(animation).play(); |
| 144 | + mixer.clipAction( animation ).play(); |
146 | 145 |
|
147 | 146 | }
|
| 147 | + |
148 | 148 | }
|
149 | 149 |
|
150 | 150 | } );
|
151 | 151 |
|
152 |
| - loader.load('https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function ( gltf ) { |
| 152 | + loader.load( 'https://cloud.needle.tools/-/assets/Z23hmXBZ21QnG-Z21QnG-product/file', function ( gltf ) { |
153 | 153 |
|
154 | 154 | const model = gltf.scene;
|
155 |
| - |
| 155 | + |
156 | 156 | model.scale.multiplyScalar( 0.5 );
|
157 | 157 |
|
158 | 158 | model.position.set( 2, 5.15, 2.3 );
|
159 | 159 |
|
160 | 160 | model.rotation.set( 0, Math.PI * 1, 0 );
|
161 |
| - |
| 161 | + |
162 | 162 | scene.add( model );
|
163 |
| - |
| 163 | + |
164 | 164 | const animations = gltf.animations;
|
165 | 165 | if ( animations && animations.length ) {
|
166 | 166 |
|
167 |
| - for (const animation of animations) { |
| 167 | + for ( const animation of animations ) { |
168 | 168 |
|
169 |
| - mixer.clipAction(animation).play(); |
| 169 | + mixer.clipAction( animation ).play(); |
170 | 170 |
|
171 | 171 | }
|
| 172 | + |
172 | 173 | }
|
173 | 174 |
|
174 | 175 | } );
|
|
199 | 200 | const dt = clock.getDelta();
|
200 | 201 | time += dt;
|
201 | 202 |
|
202 |
| - mixer.update(dt); |
| 203 | + mixer.update( dt ); |
203 | 204 |
|
204 |
| - if( airshipModel ) { |
| 205 | + if ( airshipModel ) { |
205 | 206 |
|
206 |
| - airshipModel.position.y += Math.sin(time) * 0.002; |
| 207 | + airshipModel.position.y += Math.sin( time ) * 0.002; |
207 | 208 |
|
208 | 209 | }
|
209 | 210 |
|
210 | 211 | renderer.render( scene, camera );
|
211 | 212 |
|
212 | 213 | window.requestAnimationFrame( animate );
|
| 214 | + |
213 | 215 | }
|
214 | 216 |
|
215 | 217 | animate();
|
|
0 commit comments