Commit Graph

3 Commits

Author SHA1 Message Date
Danny McGee a1779fb1ec Add formatting, linting, and testing to CI checks (#44)
This PR adds `cargo fmt -- --check`, `nx lint ...` and `nx test ...` as
GitHub Actions. This will cause future PRs to automatically fail when
formatting issues, Clippy warnings, or test failures are present in the
changed code.
2024-02-15 16:04:45 -05:00
Danny McGee 06751e54f6 Object picking (#8)
This PR implements basic object selection, with help from `bevy_mod_picking` and
`bevy_mod_outline`.

### Work Done
 * Click to select objects in the world
 * Selected objects become visually highlighted
 * The selected entity is available globally on the `Res<Selection>` resource
 * Selected entities can also be queried via the `Selected` marker component
 * Pressing `F` will "focus" the camera on the selected entity
 * Pressing `Esc` will clear the active selection

### Known Issues
 * We're currently using `bevy_mod_picking`'s "Selection" feature, which isn't 
   aware of our own input events. As a consequence, it will select the object
   under the cursor when releasing `LMB` after orbiting the camera, which is not
   what we want. This should be pretty easily fixable by dropping
   `bevy_mod_picking`'s selection feature and reading the object under the
   cursor in our own click listener that only runs if the LMB event is
   unhandled.
 * The skinned mesh is not currently selectable. This is likely fixable by
   adjusting the logic in `scene::mark_scene_objects`... somehow. The `Gltf`
   data structure is kind of a nightmare to work with, so this will take some
   investigation.

### Future Enhancements
 * For parity with other DCC apps, the "Focus" action should also adjust the
   camera zoom level to "frame" the selected object in the view. Punting on that
   for now because I'm not super confident about the math involved.
 * Group selection with Shift/Ctrl and/or marquee selection would be really nice
   to have, but probably not critical for now.
2023-11-02 13:32:58 -04:00
Danny McGee ce6db7fc3c Refactoring, reorganization and cleanup (#7)
### New `math` module
 * Traits for error-tolerant floating-point comparisons
 * Traits for interpolation and easing
 * Bevy plugin to manage 3D interpolations with ECS components

### `skybox` module refactor
 * ECS resource to enable external skybox selection/updates
 * System run conditions for more idiomatic/ECS-friendly control flow

### Camera controller refactor
 * Renamed from `orbit_cam` to `camera_controller`
 * Now delegates to the new interpolation plugin for WASD motion smoothing
 * Simple API for attaching the `CameraController` component to the camera from
   another module -- this resolves an awkward separation-of-concerns situation
	where we had to configure a bunch of render-quality settings in the camera
	controller module

### Scene module refactor
 * Renamed from `test_scene` to `scene`
 * This module is now responsible for configuring the skybox
 * This module is now responsible for spawning the camera and configuring the
   render settings
2023-10-31 16:39:10 -04:00