wip: engine enhancements and fixes
This commit is contained in:
parent
9816f14f53
commit
cc7921a5fe
27 changed files with 347 additions and 32 deletions
|
|
@ -7,3 +7,4 @@ edition = "2024"
|
|||
winit = "0.30.12"
|
||||
raidillon_core = { path = "../core" }
|
||||
raidillon_assets = { path = "../asset" }
|
||||
glam = "0.30.5"
|
||||
|
|
|
|||
24
platform/src/camera.rs
Normal file
24
platform/src/camera.rs
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
use glam::{Mat4, Vec3};
|
||||
|
||||
#[derive(Copy, Clone)]
|
||||
pub struct Camera {
|
||||
pub eye: Vec3,
|
||||
pub center: Vec3,
|
||||
pub up: Vec3,
|
||||
pub fovy: f32,
|
||||
pub aspect: f32,
|
||||
pub znear: f32,
|
||||
pub zfar: f32,
|
||||
}
|
||||
|
||||
impl Camera {
|
||||
pub fn view(&self) -> Mat4 {
|
||||
Mat4::look_at_rh(self.eye, self.center, self.up)
|
||||
}
|
||||
pub fn projection(&self) -> Mat4 {
|
||||
Mat4::perspective_rh(self.fovy, self.aspect, self.znear, self.zfar)
|
||||
}
|
||||
pub fn view_proj(&self) -> Mat4 {
|
||||
self.projection() * self.view()
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
pub mod platform;
|
||||
pub mod context;
|
||||
mod camera;
|
||||
|
||||
pub use context::PlatformContext;
|
||||
pub use platform::Platform;
|
||||
pub use camera::Camera;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue