3D Viewport

This 3D viewport system provides a consistent, high-fidelity experience across platforms and input methods. It abstracts camera management and input handling, allowing developers to focus on application logic.

Multi-Platform Support

The viewport is built to work on both native desktop and web (WebAssembly) environments, handling platform-specific details automatically:

  • DPI Scaling: Ensures the viewport and overlays are rendered at the correct resolution and scale regardless of pixel density.
  • Cross-Platform Input: Unifies input handling across operating systems and browsers.

Camera Management

The viewport manages camera state, including perspective and orthographic projections. It supports common navigation patterns:

  • Orbit, Pan, and Zoom: Standard controls for navigating 3D space.
  • Smooth Interpolation: Fluid camera movements when switching views or focusing on objects.

Multi-Touch Support

The viewport includes native support for multi-touch gestures on compatible hardware:

  • Pinch-to-Zoom: Natural zooming using two-finger gestures.
  • Two-Finger Rotate/Pan: Multi-touch interactions for orienting the scene.