Skip to main content

Crate viewport_lib_input

Crate viewport_lib_input 

Source
Expand description

Input handling for viewport-lib: a replaceable layer, not baked-in core.

The design intent is that a consumer can bring their own. Input handling splits into two halves, and either is usable on its own:

  1. Resolve: input::ViewportInput turns ViewportEvents into a single ActionFrame per frame.
  2. Apply: a camera controller takes that ActionFrame and a &mut Camera and produces a new pose. This is the half a custom controller replaces; see CameraController.

The built-in controllers (orbit, first/third-person, turntable, the flat 2D camera, and the dt-driven animator) are the batteries-included defaults. The winit/egui adapters that translate native events are optional features (winit-adapter, egui-adapter), so the crate builds with no framework dependency by default.

This crate carries no wgpu and no renderer. It stands on viewport-lib-types (the input vocabulary and the Camera type) plus glam. viewport-lib re-exports it, so viewport_lib::OrbitCameraController and friends keep working.

Modules§

controllers
The batteries-included camera controllers. Camera controllers: orbit, first-person, third-person, turntable, a flat 2D camera, and fly-to animation.
input
The event resolver, the legacy query model, and the native-event adapters. Input system: action-based input mapping with mode-sensitive bindings.
prelude
The input types most code reaches for, in one glob import: use viewport_lib_input::prelude::*;.

Structs§

Camera
The viewport camera: where it is, how it projects, and how it exposes.
LookAngles
A look direction as yaw and pitch, Z-up.

Traits§

CameraController
A camera controller: the “apply” half of input handling.