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);
  }

  render(renderer: THREE.WebGLRenderer, camera: THREE.Camera) {
    renderer.render(this.scene, camera);
  }
}
