diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-11 09:53:25 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-11 09:53:25 +0200 |
| commit | 37496a6db6b73b987b881ddd568d4a609389670c (patch) | |
| tree | 85c54e5920893d958a751c78fa3dd30f06115c30 /engine/src/camera.rs | |
| parent | b732fa6378964ab9ca23fd71d7a82f39f6ae0009 (diff) | |
refactor(engine): move matrix creation fns to appropriate places
Diffstat (limited to 'engine/src/camera.rs')
| -rw-r--r-- | engine/src/camera.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/engine/src/camera.rs b/engine/src/camera.rs index b697ee3..4a7768b 100644 --- a/engine/src/camera.rs +++ b/engine/src/camera.rs @@ -1,4 +1,5 @@ use crate::ecs::Component; +use crate::matrix::Matrix; use crate::projection::{Perspective, Projection}; use crate::reflection::Reflection; use crate::vector::Vec3; @@ -13,6 +14,18 @@ pub struct Camera pub projection: Projection, } +impl Camera +{ + pub fn to_view_matrix(&self, camera_world_pos: Vec3<f32>) -> Matrix<f32, 4, 4> + { + let mut view = Matrix::new(); + + view.look_at(camera_world_pos, self.target, self.global_up); + + view + } +} + impl Default for Camera { fn default() -> Self |
