How steve245270533/gallery works
Project Type and Purpose
• This is a browser-based, single-page 3D interactive “digital gallery” demo built on Three.js and WebGL.
• It uses Blender-exported .glb scene files, position-based audio, custom collision detection, raycasting for interactions, and a virtual joystick for mobile.
• No backend services—fully front-end, served via Vite/PNPM, with a GitHub Actions deploy pipeline.
File Structure and Extract Main Components
A. Build & Deployment Layer
• package.json, pnpm-lock.yaml, tsconfig.json/node, vite.config.ts → dependency and build config
• .github/workflows/deploy.yml → CI/CD pipeline for deployment
B. Public/Static Hosting Layer
• index.html, public/ocean & public/universe → two themed build outputs with their own HTML/CSS/JS bundles
C. Application Code (src/)
1. Constants.ts → global resource URLs and event names
2. core/ → wraps Three.js primitives (Scene, Camera, Renderer)
3. loader/ → unified loader for GLB models, textures, audio
4. assets/ → raw media (audio clips, 3D models, textures)
5. environment/ → scene graph construction (floor, walls, lighting, mirror reflector)
6. character/ → avatar model, animations, movement mesh
7. controlManage/ → input abstraction (keyboard, mouse drag, virtual joystick)
8. rayCasterControls/ → raycaster logic for detecting interactions with paintings
9. ui/ + css3DRenderer/ → on-screen HUD, loading screens, detail windows, virtual joystick via CSS3DRenderer
10. audio/ → three.js positional audio source management
11. world/ → orchestrator that instantiates and ties together core, environment, character, controls, loader, UI, audio, and raycasting
12. utils/Emitter.ts → central event bus; typeAssert.ts → safety checks
Relationships & Data Flow
• main.ts → creates World instance
• World → calls Loader to fetch all assets → on load complete spawns Environment, Character, UI, Audio, Controls, Raycaster
• Controls emit movement events via Emitter → Character updates position → Core’s render loop re-draws scene
• RayCaster listens to pointer events → issues “object selected” events → UI displays details
• CSS3DRenderer layer overlays DOM UI elements into WebGL canvas
• Build artifacts are output to public/ocean and public/universe folders, then deployed via GitHub Actions
Architectural Patterns & Principles
• Modular separation by domain: core, loader, environment, character, controls, UI, audio
• Event-driven internal communication via Emitter (publish/subscribe)
• Single responsibility per module (loader only loads, controlManage only handles input)
• Orchestration layer (world/) as a composition root
• Separation between WebGL components (three.js) and DOM UI (css3DRenderer)