music-video-gen/tv-player/src/state.js
2025-11-16 16:32:13 +01:00

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,
tvScreen: null,
videoTexture: null,
screenLight: null,
lampLightPoint: null,
lampLightSpot: null,
effectsManager: null,
// 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: [],
bookLevitation: {
state: 'resting', // 'resting', 'levitating', 'returning'
timer: 0,
},
books: [], // Array to hold all individual book meshes for animation
raycaster: new THREE.Raycaster(),
seed: 12345,
};
}