|
38 | 38 |
|
39 | 39 | import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
40 | 40 |
|
| 41 | + import Stats from 'three/addons/libs/stats.module.js'; |
| 42 | + |
41 | 43 | let camera, scene, renderer;
|
42 | 44 | let mixer, objects, clock;
|
43 | 45 | let model, floor, floorPosition;
|
| 46 | + let stats; |
44 | 47 |
|
45 | 48 | init();
|
46 | 49 |
|
|
150 | 153 |
|
151 | 154 | const waterLayer0 = mx_worley_noise_float( floorUV.mul( 4 ).add( timer ) );
|
152 | 155 | const waterLayer1 = mx_worley_noise_float( floorUV.mul( 2 ).add( timer ) );
|
153 |
| - const waterLayer2 = mx_worley_noise_float( floorUV.mul( 3 ).add( timer ) ); |
154 | 156 |
|
155 |
| - const waterIntensity = waterLayer0.mul( waterLayer1 ).mul( waterLayer2 ).mul( 5 ); |
| 157 | + const waterIntensity = waterLayer0.mul( waterLayer1 ).mul( 1.4 ); |
156 | 158 | const waterColor = waterIntensity.mix( color( 0x0f5e9c ), color( 0x74ccf4 ) );
|
157 | 159 | const viewportTexture = viewportSharedTexture();
|
158 | 160 |
|
|
179 | 181 | let transition = waterPosY.add( .1 ).saturate().oneMinus();
|
180 | 182 | transition = waterPosY.lessThan( 0 ).cond( transition, normalWorld.y.mix( transition, 0 ) ).toVar();
|
181 | 183 |
|
182 |
| - material.colorNode = transition.mix( material.colorNode, material.colorNode.add( waterLayer0 ) ); |
183 |
| - floor.material.colorNode = material.colorNode; |
| 184 | + const colorNode = transition.mix( material.colorNode, material.colorNode.add( waterLayer0 ) ); |
| 185 | + |
| 186 | + //material.colorNode = colorNode; |
| 187 | + floor.material.colorNode = colorNode; |
184 | 188 |
|
185 | 189 | // renderer
|
186 | 190 |
|
|
191 | 195 | renderer.setAnimationLoop( animate );
|
192 | 196 | document.body.appendChild( renderer.domElement );
|
193 | 197 |
|
| 198 | + stats = new Stats(); |
| 199 | + document.body.appendChild( stats.dom ); |
| 200 | + |
194 | 201 | const controls = new OrbitControls( camera, renderer.domElement );
|
195 | 202 | controls.minDistance = 1;
|
196 | 203 | controls.maxDistance = 10;
|
|
223 | 230 |
|
224 | 231 | function animate() {
|
225 | 232 |
|
| 233 | + stats.update(); |
| 234 | + |
226 | 235 | const delta = clock.getDelta();
|
227 | 236 |
|
228 | 237 | floor.position.y = floorPosition.y - 5;
|
|
0 commit comments