diff options
author | HampusM <hampus@hampusmat.com> | 2023-10-23 22:38:12 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2023-10-23 22:38:12 +0200 |
commit | c846fe5e269a827b3c324fb66b75be3fabc56a57 (patch) | |
tree | b8204121ae095b62078e157afe1f2df0ec7290df /engine/src/camera.rs | |
parent | 386aad9dac7c22cabb0f1bbba33d248c40bb0310 (diff) |
feat(engine): add camera
Diffstat (limited to 'engine/src/camera.rs')
-rw-r--r-- | engine/src/camera.rs | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/engine/src/camera.rs b/engine/src/camera.rs new file mode 100644 index 0000000..b98f3f4 --- /dev/null +++ b/engine/src/camera.rs @@ -0,0 +1,34 @@ +use crate::transform::Transform; +use crate::vector::Vec3; + +#[derive(Debug)] +pub struct Camera +{ + transform: Transform, +} + +impl Camera +{ + pub fn translate(&mut self, translation: Vec3<f32>) + { + self.transform.set_translation(translation); + } + + pub(crate) fn new() -> Self + { + let mut transform = Transform::new(); + + transform.set_translation(Vec3 { + x: 0.0, + y: 0.0, + z: -3.0, + }); + + Self { transform } + } + + pub(crate) fn transform(&self) -> &Transform + { + &self.transform + } +} |