Skip to content

Commit

Permalink
Added panorama
Browse files Browse the repository at this point in the history
  • Loading branch information
underoot committed Mar 13, 2024
1 parent 92e2be0 commit 9786fc7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
Binary file added public/panorama.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,18 @@ new GLTFLoader().load("train/scene.gltf", (gltf) => {
scene.add(train);
});

const img = "/panorama.jpg";

const texture = new THREE.TextureLoader().load(img);
const geometry = new THREE.SphereGeometry(5000, 60, 40);
const material = new THREE.MeshBasicMaterial({
map: texture,
side: THREE.DoubleSide,
});
const sphere = new THREE.Mesh(geometry, material);

scene.add(sphere);

let min = 2;

function start() {
Expand All @@ -209,6 +221,13 @@ function start() {
});

setInterval(() => {
// Move panorama with camera
sphere.position.set(
person.camera.position.x,
person.camera.position.y,
person.camera.position.z
);

if (finalPoints[currentIndex] == null) {
document.querySelector(".outro")?.classList.add("shown");
return;
Expand Down

0 comments on commit 9786fc7

Please sign in to comment.