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, lampLightPoint: null, lampLightSpot: null, 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 }, // VCR Display lastUpdateTime: -1, baseTime: 0, blinkState: false, lastBlinkToggleTime: 0, vcrDisplayTexture: null, // Video Playback isVideoLoaded: false, videoUrls: [], currentVideoIndex: -1, // Scene constants originalLampIntensity: 0.3, originalScreenIntensity: 0.2, screenIntensityPulse: 0.2, roomSize: 5, roomHeight: 3, debugLight: false, // DOM Elements container: document.body, videoElement: document.getElementById('video'), fileInput: document.getElementById('fileInput'), loadTapeButton: document.getElementById('loadTapeButton'), // Utilities loader: new THREE.TextureLoader(), landingSurfaces: [], crawlSurfaces: [], // Surfaces for spiders to crawl on bookLevitation: { state: 'resting', // 'resting', 'levitating', 'returning' timer: 0, }, books: [], // Array to hold all individual book meshes for animation pictureFrames: [], raycaster: new THREE.Raycaster(), seed: 12345, }; }