mirror of
https://github.com/storytold/spark.git
synced 2026-10-26 08:47:57 +00:00
shift splat and camera to be at origin
This commit is contained in:
committed by
Diego Marcos
parent
72bfeba345
commit
f369779dcc
@@ -49,7 +49,6 @@
|
|||||||
0.1,
|
0.1,
|
||||||
1000
|
1000
|
||||||
);
|
);
|
||||||
camera.position.set(8, 12, 104);
|
|
||||||
|
|
||||||
const renderer = new THREE.WebGLRenderer();
|
const renderer = new THREE.WebGLRenderer();
|
||||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||||
@@ -72,6 +71,11 @@
|
|||||||
const backgroundURL = await getAssetFileURL("snow-street.spz");
|
const backgroundURL = await getAssetFileURL("snow-street.spz");
|
||||||
const background = new SplatMesh({ url: backgroundURL });
|
const background = new SplatMesh({ url: backgroundURL });
|
||||||
background.quaternion.set(1, 0, 0, 0);
|
background.quaternion.set(1, 0, 0, 0);
|
||||||
|
background.position.set(
|
||||||
|
background.position.x - 8,
|
||||||
|
background.position.y - 12,
|
||||||
|
background.position.z - 104,
|
||||||
|
);
|
||||||
scene.add(background);
|
scene.add(background);
|
||||||
await background.initialized;
|
await background.initialized;
|
||||||
|
|
||||||
@@ -104,7 +108,7 @@
|
|||||||
|
|
||||||
const gui = new GUI({ title: "Snow Particle Simulation" });
|
const gui = new GUI({ title: "Snow Particle Simulation" });
|
||||||
const params = {
|
const params = {
|
||||||
fallVelocity: 0.1,
|
fallVelocity: 0.04,
|
||||||
wanderScale: generators.DEFAULT_SNOW.wanderScale,
|
wanderScale: generators.DEFAULT_SNOW.wanderScale,
|
||||||
wanderVariance: generators.DEFAULT_SNOW.wanderVariance,
|
wanderVariance: generators.DEFAULT_SNOW.wanderVariance,
|
||||||
maxScale: 0.01,
|
maxScale: 0.01,
|
||||||
@@ -219,8 +223,8 @@
|
|||||||
controls.update(dt, camera);
|
controls.update(dt, camera);
|
||||||
|
|
||||||
// camera movement
|
// camera movement
|
||||||
const targetZ = 90.5;
|
const targetZ = -13.5;
|
||||||
const startZ = 104;
|
const startZ = 0;
|
||||||
const duration = 90;
|
const duration = 90;
|
||||||
const progress = Math.min(1, t / duration);
|
const progress = Math.min(1, t / duration);
|
||||||
const smoothProgress = Math.sin(progress * Math.PI * 0.5);
|
const smoothProgress = Math.sin(progress * Math.PI * 0.5);
|
||||||
|
|||||||
Reference in New Issue
Block a user