rename FreeFlyCamera to FreeFly3dCamera

This commit is contained in:
SeanOMik 2024-11-15 23:07:48 -05:00
parent 503ea5b450
commit ad4de0b5be
Signed by: SeanOMik
GPG Key ID: FEC9E2FC15235964
10 changed files with 23 additions and 23 deletions

View File

@ -13,13 +13,13 @@ pub const ACTLBL_LOOK_UP_DOWN: &str = "LookUpDown";
pub const ACTLBL_LOOK_ROLL: &str = "LookRoll"; pub const ACTLBL_LOOK_ROLL: &str = "LookRoll";
#[derive(Clone, Component, Reflect)] #[derive(Clone, Component, Reflect)]
pub struct FreeFlyCamera { pub struct FreeFly3dCamera {
pub speed: f32, pub speed: f32,
pub look_speed: f32, pub look_speed: f32,
pub mouse_sensitivity: f32, pub mouse_sensitivity: f32,
} }
impl Default for FreeFlyCamera { impl Default for FreeFly3dCamera {
fn default() -> Self { fn default() -> Self {
Self { Self {
speed: 4.0, speed: 4.0,
@ -29,7 +29,7 @@ impl Default for FreeFlyCamera {
} }
} }
impl FreeFlyCamera { impl FreeFly3dCamera {
pub fn new(speed: f32, look_speed: f32, mouse_sensitivity: f32) -> Self { pub fn new(speed: f32, look_speed: f32, mouse_sensitivity: f32) -> Self {
Self { Self {
speed, speed,
@ -39,7 +39,7 @@ impl FreeFlyCamera {
} }
} }
pub fn free_fly_camera_controller(delta_time: Res<DeltaTime>, handler: Res<ActionHandler>, view: View<(&mut Transform, &FreeFlyCamera)>) -> anyhow::Result<()> { pub fn free_fly_3d_camera_controller(delta_time: Res<DeltaTime>, handler: Res<ActionHandler>, view: View<(&mut Transform, &FreeFly3dCamera)>) -> anyhow::Result<()> {
let delta_time = **delta_time; let delta_time = **delta_time;
for (mut transform, fly) in view.into_iter() { for (mut transform, fly) in view.into_iter() {
let forward = transform.forward(); let forward = transform.forward();
@ -91,6 +91,6 @@ pub struct FreeFlyCameraPlugin;
impl Plugin for FreeFlyCameraPlugin { impl Plugin for FreeFlyCameraPlugin {
fn setup(&mut self, app: &mut App) { fn setup(&mut self, app: &mut App) {
app.with_system("free_fly_camera_system", free_fly_camera_controller, &[]); app.with_system("free_fly_camera_system", free_fly_3d_camera_controller, &[]);
} }
} }

View File

@ -1,7 +1,7 @@
pub mod camera; mod camera;
pub use camera::*; pub use camera::*;
pub mod free_fly_camera; mod free_fly_camera;
pub use free_fly_camera::*; pub use free_fly_camera::*;
pub use lyra_scene::*; pub use lyra_scene::*;

View File

@ -1,10 +1,10 @@
use crate::{lua::LuaWrapper, ScriptBorrow}; use crate::{lua::LuaWrapper, ScriptBorrow};
use lyra_game::scene::FreeFlyCamera; use lyra_game::scene::FreeFly3dCamera;
use lyra_scripting_derive::to_lua_convert; use lyra_scripting_derive::to_lua_convert;
to_lua_convert!( to_lua_convert!(
// Struct that is being wrapped // Struct that is being wrapped
FreeFlyCamera, FreeFly3dCamera,
// Reflection type, can be 'component' or 'resource' // Reflection type, can be 'component' or 'resource'
reflect=component, reflect=component,
fields={ fields={

View File

@ -9,7 +9,7 @@ use lyra_engine::{
math::{self, Transform, Vec3}, math::{self, Transform, Vec3},
render::light::directional::DirectionalLight, render::light::directional::DirectionalLight,
scene::{ scene::{
system_update_world_transforms, Camera2dBundle, CameraProjection, FreeFlyCamera, FreeFlyCameraPlugin, OrthographicProjection, ScaleMode, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN system_update_world_transforms, Camera2dBundle, CameraProjection, FreeFly3dCamera, FreeFlyCameraPlugin, OrthographicProjection, ScaleMode, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN
}, },
sprite::{self, Sprite}, sprite::{self, Sprite},
}; };
@ -172,6 +172,6 @@ fn setup_scene_plugin(app: &mut App) {
}, },
//Transform::from_xyz(200.0, 120.0, 0.0), //Transform::from_xyz(200.0, 120.0, 0.0),
Transform::from_xyz(0.0, 0.0, 0.0), Transform::from_xyz(0.0, 0.0, 0.0),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
} }

View File

@ -9,7 +9,7 @@ use lyra_engine::{
Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource,
InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput,
}, math::{self, Transform, Vec3}, render::light::directional::DirectionalLight, scene::{ }, math::{self, Transform, Vec3}, render::light::directional::DirectionalLight, scene::{
CameraBundle, FreeFlyCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN CameraBundle, FreeFly3dCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN
}, DeltaTime }, DeltaTime
}; };
use tracing::info; use tracing::info;
@ -129,7 +129,7 @@ fn setup_scene_plugin(app: &mut App) {
world.spawn(( world.spawn((
CameraBundle::default(), CameraBundle::default(),
Transform::from_xyz(0.0, 0.0, 1.5), Transform::from_xyz(0.0, 0.0, 1.5),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
let fps_counter = |counter: Res<fps_counter::FPSCounter>, let fps_counter = |counter: Res<fps_counter::FPSCounter>,

View File

@ -3,7 +3,7 @@ use lyra_engine::{
Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource,
InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput,
}, math::{self, Transform, Vec3}, render::light::directional::DirectionalLight, scene::{ }, math::{self, Transform, Vec3}, render::light::directional::DirectionalLight, scene::{
self, CameraBundle, FreeFlyCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN self, CameraBundle, FreeFly3dCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN
}, script::{lua::{LuaScript, LuaScriptingPlugin}, Script, ScriptList} }, script::{lua::{LuaScript, LuaScriptingPlugin}, Script, ScriptList}
}; };
@ -128,7 +128,7 @@ fn setup_scene_plugin(app: &mut App) {
world.spawn(( world.spawn((
CameraBundle::default(), CameraBundle::default(),
Transform::from_xyz(0.0, 0.0, 5.5), Transform::from_xyz(0.0, 0.0, 5.5),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
} }

View File

@ -1,4 +1,4 @@
use lyra_engine::{assets::ResourceManager, ecs::query::Res, game::App, gltf::Gltf, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Quat, Transform, Vec3}, render::light::{directional::DirectionalLight, PointLight}, scene::{CameraBundle, FreeFlyCamera, FreeFlyCameraPlugin, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN}, DeltaTime}; use lyra_engine::{assets::ResourceManager, ecs::query::Res, game::App, gltf::Gltf, input::{Action, ActionHandler, ActionKind, ActionMapping, ActionMappingId, ActionSource, InputActionPlugin, KeyCode, LayoutId, MouseAxis, MouseInput}, math::{self, Quat, Transform, Vec3}, render::light::{directional::DirectionalLight, PointLight}, scene::{CameraBundle, FreeFly3dCamera, FreeFlyCameraPlugin, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN}, DeltaTime};
use rand::Rng; use rand::Rng;
use tracing::info; use tracing::info;
@ -192,6 +192,6 @@ fn setup_scene_plugin(app: &mut App) {
Quat::from_xyzw(0.03375484, -0.7116095, 0.0342693, 0.70092666), Quat::from_xyzw(0.03375484, -0.7116095, 0.0342693, 0.70092666),
Vec3::ONE, Vec3::ONE,
), ),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
} }

View File

@ -12,7 +12,7 @@ use lyra_engine::{
light::{directional::DirectionalLight, SpotLight}, light::{directional::DirectionalLight, SpotLight},
}, },
scene::{ scene::{
CameraBundle, FreeFlyCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, CameraBundle, FreeFly3dCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT,
ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD,
ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN,
}, },
@ -239,5 +239,5 @@ fn setup_scene_plugin(app: &mut App) {
let mut pos = Transform::from_xyz(-1.0, -10.0, -1.5); let mut pos = Transform::from_xyz(-1.0, -10.0, -1.5);
pos.rotate_x(math::Angle::Degrees(-27.0)); pos.rotate_x(math::Angle::Degrees(-27.0));
pos.rotate_y(math::Angle::Degrees(-90.0)); pos.rotate_y(math::Angle::Degrees(-90.0));
world.spawn((CameraBundle::default(), pos, FreeFlyCamera::default())); world.spawn((CameraBundle::default(), pos, FreeFly3dCamera::default()));
} }

View File

@ -9,7 +9,7 @@ use lyra_engine::{
math::{self, Transform, Vec3}, math::{self, Transform, Vec3},
render::light::directional::DirectionalLight, render::light::directional::DirectionalLight,
scene::{ scene::{
system_update_world_transforms, CameraBundle, FreeFlyCamera, FreeFlyCameraPlugin, system_update_world_transforms, CameraBundle, FreeFly3dCamera, FreeFlyCameraPlugin,
WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN,
ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN,
}, },
@ -150,6 +150,6 @@ fn setup_scene_plugin(app: &mut App) {
world.spawn(( world.spawn((
CameraBundle::default(), CameraBundle::default(),
Transform::from_xyz(0.0, 0.0, 5.5), Transform::from_xyz(0.0, 0.0, 5.5),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
} }

View File

@ -16,7 +16,7 @@ use lyra_engine::{
math::{self, Quat, Transform, Vec3}, math::{self, Quat, Transform, Vec3},
render::light::{directional::DirectionalLight, PointLight, SpotLight}, render::light::{directional::DirectionalLight, PointLight, SpotLight},
scene::{ scene::{
self, FreeFlyCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT, self, FreeFly3dCamera, FreeFlyCameraPlugin, WorldTransform, ACTLBL_LOOK_LEFT_RIGHT,
ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD, ACTLBL_LOOK_ROLL, ACTLBL_LOOK_UP_DOWN, ACTLBL_MOVE_FORWARD_BACKWARD,
ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN, ACTLBL_MOVE_LEFT_RIGHT, ACTLBL_MOVE_UP_DOWN,
}, },
@ -378,7 +378,7 @@ fn setup_scene_plugin(app: &mut App) {
Quat::from_xyzw(0.03375484, -0.7116095, 0.0342693, 0.70092666), Quat::from_xyzw(0.03375484, -0.7116095, 0.0342693, 0.70092666),
Vec3::ONE, Vec3::ONE,
), ),
FreeFlyCamera::default(), FreeFly3dCamera::default(),
)); ));
//Ok(()) //Ok(())