mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-25 21:28:20 -06:00
Disable parallel
feature by default, recalc camera matrix
This commit is contained in:
parent
f5d1de39c6
commit
93457ecdcf
|
@ -8,7 +8,7 @@ publish = false
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
glam = { version = "0.23", features = ["debug-glam-assert", "fast-math", "serde"] }
|
glam = { version = "0.23", features = ["debug-glam-assert", "fast-math", "serde"] }
|
||||||
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66" }
|
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66", default-features = false, features = ["std"] }
|
||||||
strum = { version = "0.24", features = ["derive"] }
|
strum = { version = "0.24", features = ["derive"] }
|
||||||
postcard = { version = "1.0", features = ["alloc"] }
|
postcard = { version = "1.0", features = ["alloc"] }
|
||||||
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
|
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
|
||||||
|
|
|
@ -14,7 +14,7 @@ image = { version = "0.24", default_features = false, features = ["png"] }
|
||||||
strum = { version = "0.24", features = ["derive"] }
|
strum = { version = "0.24", features = ["derive"] }
|
||||||
hashbrown = "0.13"
|
hashbrown = "0.13"
|
||||||
rayon = "1.6"
|
rayon = "1.6"
|
||||||
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66", features = ["thread_local"] }
|
shipyard = { git = "https://github.com/leudz/shipyard", rev = "eb189f66", default-features = false, features = ["std", "proc", "thread_local"] }
|
||||||
nohash-hasher = "0.2.0"
|
nohash-hasher = "0.2.0"
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
flume = "0.10"
|
flume = "0.10"
|
||||||
|
@ -27,4 +27,5 @@ winapi = { version = "0.3" }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
parallel = ["shipyard/parallel"]
|
||||||
nightly = ["glam/core-simd", "kubi-shared/nightly"]
|
nightly = ["glam/core-simd", "kubi-shared/nightly"]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
use glam::{Vec3, Mat4};
|
use glam::{Vec3, Mat4};
|
||||||
use shipyard::{ViewMut, View, IntoIter, Workload, IntoWorkload, track};
|
use shipyard::{ViewMut, View, IntoIter, Workload, IntoWorkload, track, UniqueView, SystemModificator};
|
||||||
use crate::{transform::Transform, events::WindowResizedEvent};
|
use crate::{transform::Transform, rendering::WindowSize, events::WindowResizedEvent};
|
||||||
use super::Camera;
|
use super::Camera;
|
||||||
|
|
||||||
//maybe parallelize these two?
|
//maybe parallelize these two?
|
||||||
|
@ -18,11 +18,8 @@ fn update_view_matrix(
|
||||||
|
|
||||||
fn update_perspective_matrix(
|
fn update_perspective_matrix(
|
||||||
mut vm_camera: ViewMut<Camera>,
|
mut vm_camera: ViewMut<Camera>,
|
||||||
resize: View<WindowResizedEvent>,
|
size: UniqueView<WindowSize>,
|
||||||
) {
|
) {
|
||||||
let Some(&size) = resize.iter().next() else {
|
|
||||||
return
|
|
||||||
};
|
|
||||||
for mut camera in (&mut vm_camera).iter() {
|
for mut camera in (&mut vm_camera).iter() {
|
||||||
camera.perspective_matrix = Mat4::perspective_rh_gl(
|
camera.perspective_matrix = Mat4::perspective_rh_gl(
|
||||||
camera.fov,
|
camera.fov,
|
||||||
|
@ -33,9 +30,19 @@ fn update_perspective_matrix(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn need_perspective_calc(
|
||||||
|
v_camera: View<Camera>,
|
||||||
|
resize_event: View<WindowResizedEvent>,
|
||||||
|
) -> bool {
|
||||||
|
(resize_event.len() > 0) ||
|
||||||
|
(v_camera.iter().any(|camera| {
|
||||||
|
camera.perspective_matrix == Mat4::default()
|
||||||
|
}))
|
||||||
|
}
|
||||||
|
|
||||||
pub fn update_matrices() -> Workload {
|
pub fn update_matrices() -> Workload {
|
||||||
(
|
(
|
||||||
update_view_matrix,
|
update_view_matrix,
|
||||||
update_perspective_matrix,
|
update_perspective_matrix.run_if(need_perspective_calc),
|
||||||
).into_workload()
|
).into_workload()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue