diff options
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 + } +} |