How zalo/mujoco_wasm works
Key Relationships to Highlight
a. Runtime Flow:
• JavaScript API → WebAssembly Module → Virtual File System
• ↓
• Scene Renderer
b. Build-time Flow:
• Header Files → Parser Scripts → Generated Bindings → Emscripten → WASM Module
Specific Implementation Details
a. Core Components:
• Relationship between mujoco_wasm.js, mujoco_wasm.wasm, and mujoco_wasm.d.ts
• Virtual File System mount points
• Model-State-Simulation class hierarchy
b. File Processing:
• XML model loading pipeline
• Asset handling (especially for complex models like shadow_hand and cassie)
• [Browser Environment]
• ↓
• [JavaScript API Layer]
• ↓
• [WebAssembly Module]
• ↓
• [Virtual File System]
Technical Details to Emphasize
• The binding layer between JavaScript and C++ (generated code)
• Memory management between JS and WASM
• File system virtualization
• TypeScript type definitions generation
• Build pipeline configuration
Important Subsystems
• Header parsing system (parse_mjxmacro.py, ast_nodes.py)
• Example scene loading mechanism
• Utility modules (Debug.js, DragStateManager.js, Reflector.js)