← back to Dw War Room

src/scene/Lighting.ts

61 lines

// ═══════════════════════════════════════════════
// DW War Room 3D — Lighting Setup
// Sci-fi ambient with purple accents
// ═══════════════════════════════════════════════

import * as THREE from 'three';

export function createLighting(scene: THREE.Scene): void {
  // Ambient — cool neutral base (lifted from dark purple to architectural neutral)
  const ambient = new THREE.AmbientLight(0x223344, 0.6);
  scene.add(ambient);

  // Primary directional — cool white key light with shadows
  const mainLight = new THREE.DirectionalLight(0xddeeff, 1.2);
  mainLight.position.set(8, 25, 12);
  mainLight.castShadow = true;
  mainLight.shadow.mapSize.width = 2048;
  mainLight.shadow.mapSize.height = 2048;
  mainLight.shadow.camera.near = 0.5;
  mainLight.shadow.camera.far = 80;
  mainLight.shadow.camera.left = -30;
  mainLight.shadow.camera.right = 30;
  mainLight.shadow.camera.top = 30;
  mainLight.shadow.camera.bottom = -30;
  mainLight.shadow.bias = -0.0005;
  scene.add(mainLight);

  // Secondary fill — warm gold from front-right (corporate warmth)
  const fillLight = new THREE.DirectionalLight(0xffd580, 0.35);
  fillLight.position.set(15, 10, 15);
  scene.add(fillLight);

  // Cool white accent from left (clean industrial)
  const leftAccent = new THREE.PointLight(0xc8d8f0, 0.5, 55);
  leftAccent.position.set(-15, 8, 0);
  scene.add(leftAccent);

  // Warm gold accent from right
  const rightAccent = new THREE.PointLight(0xffa040, 0.3, 55);
  rightAccent.position.set(15, 8, 0);
  scene.add(rightAccent);

  // Red warning light (for escalations) — starts dim
  const redLight = new THREE.PointLight(0xef4444, 0.0, 30);
  redLight.position.set(0, 12, -10);
  redLight.name = 'escalation-light';
  scene.add(redLight);

  // Subtle uplight from floor — bounced ambient warmth
  const uplift = new THREE.PointLight(0x334455, 0.2, 20);
  uplift.position.set(0, 0.5, 0);
  scene.add(uplift);
}

export function pulseEscalationLight(scene: THREE.Scene, intensity: number): void {
  const light = scene.getObjectByName('escalation-light') as THREE.PointLight;
  if (light) {
    light.intensity = intensity;
  }
}