summaryrefslogtreecommitdiff
path: root/engine/src/camera.rs
blob: b98f3f416245a4391d06dce1a4af4d37bb4061f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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
    }
}