mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 05:08:21 -06:00
Migrate to shipyard master
This commit is contained in:
parent
d583673081
commit
0dbb7e21ee
|
@ -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"] }
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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<const A: usize, const B: usize, const C: usize>(planes: &[Vec4;
|
|||
|
||||
pub fn update_frustum(
|
||||
mut cameras: ViewMut<Camera>,
|
||||
transforms: View<Transform>
|
||||
transforms: View<Transform, { track::All }>
|
||||
) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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<Camera>,
|
||||
v_transform: View<Transform>
|
||||
v_transform: View<Transform, { track::All }>
|
||||
) {
|
||||
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,
|
||||
|
|
|
@ -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<Transform>,
|
||||
transforms: View<Transform, { track::All }>,
|
||||
player: View<MainPlayer>,
|
||||
mut entities: EntitiesViewMut,
|
||||
mut events: ViewMut<EventComponent>,
|
||||
|
|
|
@ -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<FlyController>,
|
||||
mut transforms: ViewMut<Transform>,
|
||||
mut transforms: ViewMut<Transform, { track::All }>,
|
||||
inputs: UniqueView<Inputs>,
|
||||
settings: UniqueView<GameSettings>,
|
||||
dt: UniqueView<DeltaTime>,
|
||||
|
@ -37,7 +37,7 @@ fn update_look(
|
|||
|
||||
fn update_movement(
|
||||
controllers: View<FlyController>,
|
||||
mut transforms: ViewMut<Transform>,
|
||||
mut transforms: ViewMut<Transform, { track::All }>,
|
||||
inputs: UniqueView<Inputs>,
|
||||
dt: UniqueView<DeltaTime>,
|
||||
) {
|
||||
|
|
|
@ -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<UniqueView<ProgressbarShaderPrefab>>,
|
||||
view: UniqueView<GuiView>,
|
||||
components: View<GuiComponent>,
|
||||
transforms: View<Transform2d>,
|
||||
transforms: View<Transform2d, { track::All }>,
|
||||
progressbars: View<ProgressbarComponent>,
|
||||
primary: View<PrimaryColor>,
|
||||
secondary: View<SecondaryColor>,
|
||||
|
|
|
@ -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<WindowSize>,
|
||||
bar: UniqueView<ProgressbarId>,
|
||||
mut transforms: ViewMut<Transform2d>
|
||||
mut transforms: ViewMut<Transform2d, { track::All }>
|
||||
) {
|
||||
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<ProgressbarComponent>,
|
||||
eid: UniqueView<ProgressbarId>,
|
||||
) {
|
||||
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
|
||||
});
|
||||
|
|
|
@ -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<UniqueViewMut<RenderTarget>>,
|
||||
player: View<MainPlayer>,
|
||||
transforms: View<Transform>,
|
||||
transforms: View<Transform, { track::All }>,
|
||||
buffers: NonSendSync<UniqueView<CubePrimitive>>,
|
||||
program: NonSendSync<UniqueView<ColoredShaderPrefab>>,
|
||||
camera: View<Camera>,
|
||||
|
|
|
@ -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<GameSettings>,
|
||||
v_local_player: View<MainPlayer>,
|
||||
v_transform: View<Transform>,
|
||||
v_transform: View<Transform, { track::All }>,
|
||||
mut vm_world: UniqueViewMut<ChunkStorage>,
|
||||
) {
|
||||
//Check if the player actually moved
|
||||
|
|
|
@ -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<RaycastReport>);
|
||||
|
||||
pub fn update_raycasts(
|
||||
transform: View<Transform>,
|
||||
transform: View<Transform, { track::All }>,
|
||||
mut raycast: ViewMut<LookingAtBlock>,
|
||||
world: UniqueView<ChunkStorage>,
|
||||
) {
|
||||
|
@ -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.)));
|
||||
|
|
Loading…
Reference in a new issue