How meta-quest/webxr-showcases works
Project type and purpose
• Type: Single-page WebXR front-end application.
• Purpose: Allow users to view, customize, and interact with 3D sneaker models in a Mixed Reality environment directly in their browser.
File structure (key directories/files)
• src/
• HTML entry point: index.html
• JS modules under src/ (e.g., index.js, scene.js, player.js, sneaker.js, configUI.js, etc.)
• Styles: styles/index.css
• Assets: assets/gltf/, assets/audio/, assets/*.glb, assets/*.exr
• content/
• Raw 3D source files (Blender) and pre-compressed glTF binaries.
• Build config: webpack.config.cjs
• Packaging: package.json
Main components
a. Static Web Server / CDN
• Hosts the bundled application (HTML, JS, CSS, assets) – e.g., GitHub Pages or any static-site host.
b. Client Browser (WebXR-enabled)
• Loads the page via HTTP(S).
• WebAssembly/JavaScript runtime executes the bundle.
c. WebXR & Rendering Layer
• WebXR API (device/session management)
• WebGL renderer (likely Three.js under the hood)
d. Application Modules
• Entry Point (index.js)
• Scene Manager (scene.js)
• Interaction & Input (player.js, pointer.js, grab.js, follow.js)
• Sneaker Model Loader & Controller (sneaker.js, configUI.js, size.js)
• UI / Audio Manager (audio.js, constants.js)
e. Asset Pipeline
• glTF/GLB models, textures (KTX2), HDR environment maps (EXR), audio files
f. Browser APIs & External Services
• WebXR Device API
• WebGL / Three.js (rendering)
• (Optional) Analytics or telemetry if added
Relationships and data flow
• User → Browser UI → WebXR session start
• Browser (entry HTML/JS) → Loads application bundle from static host
• Application modules request assets → HTTP GET to host → Asset cache
• Scene Manager passes glTF data to renderer → Display in headset
• Input modules capture controller poses → Update scene & UI modules
• UI & Audio modules respond to interactions → Play sounds, update overlays
Architectural patterns and design principles
• Modular JavaScript: each feature in its own module
• Bundle & build via Webpack: single-page app
• Separation of concerns: rendering vs. input vs. UI vs. asset loading
• Client-only architecture: no backend or database