mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 00:23:14 +00:00
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
This commit is contained in:
+11
-8
@@ -1,18 +1,20 @@
|
||||
#![allow(clippy::type_complexity)]
|
||||
|
||||
use bevy::prelude::*;
|
||||
use camera_controller::{CameraController, CameraControllerPlugin, CameraMotionSystem};
|
||||
use input::StudioInputPlugin;
|
||||
use orbit_cam::{CameraMotionSystem, OrbitCam, OrbitCamPlugin};
|
||||
use math::InterpolationPlugin;
|
||||
use scene::ScenePlugin;
|
||||
use skybox::SkyboxPlugin;
|
||||
use test_scene::TestScenePlugin;
|
||||
use ui::UiLayerPlugin;
|
||||
use viewport::ViewportSize;
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
mod camera_controller;
|
||||
mod input;
|
||||
mod orbit_cam;
|
||||
mod math;
|
||||
mod scene;
|
||||
mod skybox;
|
||||
mod test_scene;
|
||||
mod ui;
|
||||
mod viewport;
|
||||
|
||||
@@ -36,8 +38,9 @@ pub fn init(viewport_size: ViewportSize) {
|
||||
..default()
|
||||
}),
|
||||
StudioInputPlugin,
|
||||
OrbitCamPlugin,
|
||||
TestScenePlugin,
|
||||
InterpolationPlugin,
|
||||
CameraControllerPlugin,
|
||||
ScenePlugin,
|
||||
SkyboxPlugin,
|
||||
UiLayerPlugin,
|
||||
))
|
||||
@@ -45,8 +48,8 @@ pub fn init(viewport_size: ViewportSize) {
|
||||
.run();
|
||||
}
|
||||
|
||||
fn draw_world_axes(mut gizmos: Gizmos, q: Query<&OrbitCam>) {
|
||||
let &OrbitCam { focus, radius, .. } = q.single();
|
||||
fn draw_world_axes(mut gizmos: Gizmos, q: Query<&CameraController>) {
|
||||
let &CameraController { focus, radius, .. } = q.single();
|
||||
|
||||
let mut draw_axis = |direction: Vec3, color: Color| {
|
||||
let end = focus + direction * radius / 15.;
|
||||
|
||||
Reference in New Issue
Block a user