56 lines
1.3 KiB
JavaScript
56 lines
1.3 KiB
JavaScript
import * as THREE from 'three';
|
|
|
|
export let state = undefined;
|
|
|
|
export function initState() {
|
|
state = {
|
|
// Core Three.js components
|
|
scene: null,
|
|
camera: null,
|
|
renderer: null,
|
|
clock: new THREE.Clock(),
|
|
tvScreen: null,
|
|
tvScreenPowered: false,
|
|
videoTexture: null,
|
|
screenLight: null, // Light from the crystal ball
|
|
candleLight: null, // Light from the candle
|
|
effectsManager: null,
|
|
screenEffect: {
|
|
active: false,
|
|
type: 0,
|
|
startTime: 0,
|
|
duration: 1000, // in ms
|
|
onComplete: null,
|
|
easing: (t) => t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t, // easeInOutQuad
|
|
},
|
|
|
|
|
|
// Video Playback
|
|
isVideoLoaded: false,
|
|
videoUrls: [],
|
|
currentVideoIndex: -1,
|
|
|
|
// Scene constants
|
|
originalLampIntensity: 0.3,
|
|
originalScreenIntensity: 0.2,
|
|
screenIntensityPulse: 0.2,
|
|
roomSize: 5,
|
|
roomHeight: 3,
|
|
debugLight: false, // Turn on light helpers
|
|
debugCamera: false, // Turn on camera helpers
|
|
|
|
// DOM Elements
|
|
container: document.body,
|
|
videoElement: document.getElementById('video'),
|
|
fileInput: document.getElementById('fileInput'),
|
|
loadTapeButton: document.getElementById('loadTapeButton'),
|
|
|
|
// Utilities
|
|
loader: new THREE.TextureLoader(),
|
|
pictureFrames: [],
|
|
raycaster: new THREE.Raycaster(),
|
|
seed: 12345,
|
|
};
|
|
|
|
}
|