diff --git a/kubi-server/Cargo.toml b/kubi-server/Cargo.toml index 13c0063..db71968 100644 --- a/kubi-server/Cargo.toml +++ b/kubi-server/Cargo.toml @@ -9,7 +9,7 @@ kubi-shared = { path = "../kubi-shared" } kubi-udp = { path = "../kubi-udp" } kubi-logging = { path = "../kubi-logging" } log = "*" -shipyard = "0.6" +shipyard = { git = "https://github.com/leudz/shipyard", rev = "9fd2aaa32bccee29bd7fc99ccaabec950fe13ed0" } serde = "1.0" toml = "0.7" glam = { version = "0.22", features = ["debug-glam-assert", "fast-math"] } diff --git a/kubi-shared/Cargo.toml b/kubi-shared/Cargo.toml index 73e4cd5..3bb4711 100644 --- a/kubi-shared/Cargo.toml +++ b/kubi-shared/Cargo.toml @@ -8,7 +8,7 @@ publish = false [dependencies] glam = { version = "0.22", features = ["debug-glam-assert", "fast-math", "serde"] } -shipyard = "0.6" +shipyard = { git = "https://github.com/leudz/shipyard", rev = "9fd2aaa32bccee29bd7fc99ccaabec950fe13ed0" } strum = { version = "0.24", features = ["derive"] } bincode = "2.0.0-rc" anyhow = "1.0" diff --git a/kubi/Cargo.toml b/kubi/Cargo.toml index 4d586d8..6fe7557 100644 --- a/kubi/Cargo.toml +++ b/kubi/Cargo.toml @@ -15,7 +15,7 @@ image = { version = "0.24", default_features = false, features = ["png"] } strum = { version = "0.24", features = ["derive"] } hashbrown = "0.13" rayon = "1.6" -shipyard = { version = "0.6", features = ["thread_local"] } +shipyard = { git = "https://github.com/leudz/shipyard", rev = "9fd2aaa32bccee29bd7fc99ccaabec950fe13ed0", features = ["thread_local"] } nohash-hasher = "0.2.0" anyhow = "1.0" flume = "0.10" diff --git a/kubi/src/camera/frustum.rs b/kubi/src/camera/frustum.rs index 9042dd4..7fc00f3 100644 --- a/kubi/src/camera/frustum.rs +++ b/kubi/src/camera/frustum.rs @@ -8,7 +8,7 @@ // three layers of stolen code, yay! use glam::{Vec3A, Vec4, Mat3A, vec3a, Vec3, vec4}; -use shipyard::{ViewMut, IntoIter, View}; +use shipyard::{ViewMut, IntoIter, View, track}; use crate::transform::Transform; use super::Camera; @@ -122,9 +122,9 @@ fn intersection(planes: &[Vec4; pub fn update_frustum( mut cameras: ViewMut, - transforms: View + transforms: View ) { - for (camera, _) in (&mut cameras, transforms.inserted_or_modified()).iter() { - camera.frustum = Frustum::compute(camera); + for (mut camera, _) in (&mut cameras, transforms.inserted_or_modified()).iter() { + camera.frustum = Frustum::compute(&camera); } } diff --git a/kubi/src/camera/matrices.rs b/kubi/src/camera/matrices.rs index 7537700..5f2c003 100644 --- a/kubi/src/camera/matrices.rs +++ b/kubi/src/camera/matrices.rs @@ -1,5 +1,5 @@ use glam::{Vec3, Mat4}; -use shipyard::{ViewMut, View, IntoIter, Workload, IntoWorkload}; +use shipyard::{ViewMut, View, IntoIter, Workload, IntoWorkload, track}; use crate::{transform::Transform, events::WindowResizedEvent}; use super::Camera; @@ -7,11 +7,11 @@ use super::Camera; fn update_view_matrix( mut vm_camera: ViewMut, - v_transform: View + v_transform: View ) { - for (camera, transform) in (&mut vm_camera, v_transform.inserted_or_modified()).iter() { + for (mut camera, transform) in (&mut vm_camera, v_transform.inserted_or_modified()).iter() { let (_, rotation, translation) = transform.0.to_scale_rotation_translation(); - let direction = (rotation * Vec3::NEG_Z).normalize(); + let direction = (rotation.normalize() * Vec3::NEG_Z).normalize(); camera.view_matrix = Mat4::look_to_rh(translation, direction, camera.up); } } @@ -24,7 +24,7 @@ fn update_perspective_matrix( let Some(&size) = resize.iter().next() else { return }; - for camera in (&mut vm_camera).iter() { + for mut camera in (&mut vm_camera).iter() { camera.perspective_matrix = Mat4::perspective_rh_gl( camera.fov, size.0.x as f32 / size.0.y as f32, diff --git a/kubi/src/events/player_actions.rs b/kubi/src/events/player_actions.rs index 09b8a0c..7c086d2 100644 --- a/kubi/src/events/player_actions.rs +++ b/kubi/src/events/player_actions.rs @@ -1,4 +1,4 @@ -use shipyard::{Component, View, ViewMut, EntitiesViewMut, IntoIter}; +use shipyard::{Component, View, ViewMut, EntitiesViewMut, IntoIter, track}; use glam::{IVec3, Quat, Vec3}; use crate::{ @@ -21,7 +21,7 @@ pub enum PlayerActionEvent { } pub fn generate_move_events( - transforms: View, + transforms: View, player: View, mut entities: EntitiesViewMut, mut events: ViewMut, diff --git a/kubi/src/fly_controller.rs b/kubi/src/fly_controller.rs index 81b5ea8..57276cb 100644 --- a/kubi/src/fly_controller.rs +++ b/kubi/src/fly_controller.rs @@ -1,5 +1,5 @@ use glam::{Vec3, Mat4, Quat, EulerRot, Vec2}; -use shipyard::{Component, View, ViewMut, IntoIter, UniqueView, Workload, IntoWorkload}; +use shipyard::{Component, View, ViewMut, IntoIter, UniqueView, Workload, IntoWorkload, track}; use std::f32::consts::PI; use crate::{transform::Transform, input::Inputs, settings::GameSettings, delta_time::DeltaTime}; @@ -17,7 +17,7 @@ const MAX_PITCH: f32 = PI/2. - 0.05; fn update_look( controllers: View, - mut transforms: ViewMut, + mut transforms: ViewMut, inputs: UniqueView, settings: UniqueView, dt: UniqueView, @@ -37,7 +37,7 @@ fn update_look( fn update_movement( controllers: View, - mut transforms: ViewMut, + mut transforms: ViewMut, inputs: UniqueView, dt: UniqueView, ) { diff --git a/kubi/src/gui/progressbar.rs b/kubi/src/gui/progressbar.rs index 9a945c7..0fe9b26 100644 --- a/kubi/src/gui/progressbar.rs +++ b/kubi/src/gui/progressbar.rs @@ -1,11 +1,12 @@ -use shipyard::{UniqueView, UniqueViewMut, NonSendSync, View, Component, IntoIter, IntoWithId, Get}; +use shipyard::{UniqueView, UniqueViewMut, NonSendSync, View, Component, IntoIter, IntoWithId, Get, track}; use glium::{Surface, uniform, DrawParameters}; use crate::{ prefabs::ProgressbarShaderPrefab, rendering::{ RenderTarget, primitives::rect::RectPrimitive - }, transform::Transform2d, + }, + transform::Transform2d, }; use super::{GuiComponent, PrimaryColor, SecondaryColor, GuiView}; @@ -20,7 +21,7 @@ pub fn render_progressbars( program: NonSendSync>, view: UniqueView, components: View, - transforms: View, + transforms: View, progressbars: View, primary: View, secondary: View, diff --git a/kubi/src/loading_screen.rs b/kubi/src/loading_screen.rs index 75873ff..cb01e21 100644 --- a/kubi/src/loading_screen.rs +++ b/kubi/src/loading_screen.rs @@ -1,4 +1,4 @@ -use shipyard::{UniqueView, UniqueViewMut, Workload, IntoWorkload, EntityId, Unique, AllStoragesViewMut, ViewMut, Get, SystemModificator}; +use shipyard::{UniqueView, UniqueViewMut, Workload, IntoWorkload, EntityId, Unique, AllStoragesViewMut, ViewMut, Get, SystemModificator, track}; use glam::{Mat3, vec2}; use crate::{ world::ChunkStorage, @@ -34,7 +34,7 @@ fn spawn_loading_screen( fn resize_progress_bar( size: UniqueView, bar: UniqueView, - mut transforms: ViewMut + mut transforms: ViewMut ) { let mut trans = (&mut transforms).get(bar.0).unwrap(); trans.0.x_axis.x = size.0.x as f32; @@ -45,7 +45,7 @@ fn update_progress_bar_progress ( mut bar: ViewMut, eid: UniqueView, ) { - let bar = (&mut bar).get(eid.0).unwrap(); + let mut bar = (&mut bar).get(eid.0).unwrap(); let loaded = world.chunks.iter().fold(0, |acc, (&_, chunk)| { acc + chunk.desired_state.matches_current(chunk.current_state) as usize }); diff --git a/kubi/src/rendering/world.rs b/kubi/src/rendering/world.rs index 9029381..81d94c7 100644 --- a/kubi/src/rendering/world.rs +++ b/kubi/src/rendering/world.rs @@ -1,5 +1,5 @@ use glam::{Vec3, Mat4, Quat, ivec3}; -use shipyard::{NonSendSync, UniqueView, UniqueViewMut, View, IntoIter}; +use shipyard::{NonSendSync, UniqueView, UniqueViewMut, View, IntoIter, track}; use glium::{ implement_vertex, uniform, Surface, DrawParameters, @@ -114,7 +114,7 @@ pub fn draw_world( pub fn draw_current_chunk_border( mut target: NonSendSync>, player: View, - transforms: View, + transforms: View, buffers: NonSendSync>, program: NonSendSync>, camera: View, diff --git a/kubi/src/world/loading.rs b/kubi/src/world/loading.rs index 3b6fb83..18c0172 100644 --- a/kubi/src/world/loading.rs +++ b/kubi/src/world/loading.rs @@ -1,6 +1,6 @@ use glam::{IVec3, ivec3}; use glium::{VertexBuffer, IndexBuffer, index::PrimitiveType}; -use shipyard::{View, UniqueView, UniqueViewMut, IntoIter, Workload, IntoWorkload, NonSendSync}; +use shipyard::{View, UniqueView, UniqueViewMut, IntoIter, Workload, IntoWorkload, NonSendSync, track}; use crate::{ player::MainPlayer, transform::Transform, @@ -29,7 +29,7 @@ pub fn update_loaded_world_around_player() -> Workload { pub fn update_chunks_if_player_moved( v_settings: UniqueView, v_local_player: View, - v_transform: View, + v_transform: View, mut vm_world: UniqueViewMut, ) { //Check if the player actually moved diff --git a/kubi/src/world/raycast.rs b/kubi/src/world/raycast.rs index 1485abd..d34aafe 100644 --- a/kubi/src/world/raycast.rs +++ b/kubi/src/world/raycast.rs @@ -1,5 +1,5 @@ use glam::{Vec3, IVec3}; -use shipyard::{View, Component, ViewMut, IntoIter, UniqueView}; +use shipyard::{View, Component, ViewMut, IntoIter, UniqueView, track}; use crate::{transform::Transform, world::block::BlockDescriptorSource}; use super::{ChunkStorage, block::Block}; @@ -48,7 +48,7 @@ impl ChunkStorage { pub struct LookingAtBlock(pub Option); pub fn update_raycasts( - transform: View, + transform: View, mut raycast: ViewMut, world: UniqueView, ) { @@ -56,7 +56,7 @@ pub fn update_raycasts( if !(world.is_inserted_or_modified() || (transform.inserted_or_modified(), &raycast).iter().next().is_some()) { return } - for (transform, report) in (&transform, &mut raycast).iter() { + for (transform, mut report) in (&transform, &mut raycast).iter() { let (_, rotation, position) = transform.0.to_scale_rotation_translation(); let direction = (rotation * Vec3::NEG_Z).normalize(); *report = LookingAtBlock(world.raycast(position, direction, Some(30.)));