mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-12 18:38:43 -06:00
update frustum only if the camera moves
This commit is contained in:
parent
16bc214628
commit
158639d3b7
|
@ -8,7 +8,8 @@
|
||||||
// three layers of stolen code, yay!
|
// three layers of stolen code, yay!
|
||||||
|
|
||||||
use glam::{Vec3A, Vec4, Mat3A, vec3a, Vec3, vec4};
|
use glam::{Vec3A, Vec4, Mat3A, vec3a, Vec3, vec4};
|
||||||
use shipyard::{ViewMut, IntoIter};
|
use shipyard::{ViewMut, IntoIter, View};
|
||||||
|
use crate::transform::Transform;
|
||||||
use super::Camera;
|
use super::Camera;
|
||||||
|
|
||||||
#[repr(usize)]
|
#[repr(usize)]
|
||||||
|
@ -150,8 +151,9 @@ fn intersection<const A: usize, const B: usize, const C: usize>(planes: &[Vec4;
|
||||||
|
|
||||||
pub fn update_frustum(
|
pub fn update_frustum(
|
||||||
mut cameras: ViewMut<Camera>,
|
mut cameras: ViewMut<Camera>,
|
||||||
|
transforms: View<Transform>
|
||||||
) {
|
) {
|
||||||
for camera in (&mut cameras).iter() {
|
for (camera, _) in (&mut cameras, transforms.inserted_or_modified()).iter() {
|
||||||
camera.frustum = Frustum::compute(camera);
|
camera.frustum = Frustum::compute(camera);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue