feat: 3 scene rendering setup

This commit is contained in:
2026-03-18 08:49:51 -04:00
parent 933c6afd08
commit 358122a74a
33 changed files with 1094 additions and 1132 deletions

View File

@@ -0,0 +1,25 @@
import * as THREE from "three";
/**
* Universe rendering layer — always the first layer rendered.
* Contains the infinite backdrop: backdrop stars and nebula clouds.
* Has no dedicated camera; rendered with whichever camera is active for the current POV
* so the backdrop always aligns with the foreground view.
*/
export class UniverseLayer {
readonly scene = new THREE.Scene();
/** Backdrop stars and nebula clouds. Follows the active camera to act as a skybox. */
readonly ambienceGroup = new THREE.Group();
constructor() {
this.scene.background = new THREE.Color(0x040912);
this.scene.add(this.ambienceGroup);
}
updateAmbience(activeCamera: THREE.Camera, delta: number) {
this.ambienceGroup.position.copy(activeCamera.position);
this.ambienceGroup.rotation.y += delta * 0.005;
this.ambienceGroup.rotation.x = Math.sin(performance.now() * 0.00003) * 0.015;
}
}