mirror of
https://github.com/lisk77/comet.git
synced 2025-10-25 06:18:49 +00:00
feat: finally added a working multi-camera system where the highest priority Camera2D will be used to make the RenderCamera (unfortunately not very efficient because it creates a new RenderCamera every tick, but it works i guess)
This commit is contained in:
parent
4e9e296ba4
commit
445818b79b
4 changed files with 20 additions and 41 deletions
|
|
@ -10,13 +10,13 @@ pub const OPENGL_TO_WGPU_MATRIX: cgmath::Matrix4<f32> = cgmath::Matrix4::new(
|
|||
|
||||
const SAFE_FRAC_PI_2: f32 = std::f32::consts::FRAC_PI_2 - 0.0001;
|
||||
|
||||
pub struct Camera {
|
||||
pub struct RenderCamera {
|
||||
zoom: f32,
|
||||
dimension: Vec2,
|
||||
position: Vec3
|
||||
}
|
||||
|
||||
impl Camera {
|
||||
impl RenderCamera {
|
||||
pub fn new(
|
||||
zoom: f32,
|
||||
dimension: Vec2,
|
||||
|
|
@ -64,7 +64,7 @@ impl CameraUniform {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn update_view_proj(&mut self, camera: &Camera) {
|
||||
pub fn update_view_proj(&mut self, camera: &RenderCamera) {
|
||||
self.view_proj = camera.build_view_projection_matrix().into();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue