est_render/math/
mvp.rs

1use super::Matrix4;
2
3pub struct ModelViewProjection {
4    pub model: Matrix4,
5    pub view: Matrix4,
6    pub projection: Matrix4,
7}
8
9impl ModelViewProjection {
10    pub fn matrix4(&self) -> Matrix4 {
11        self.projection * self.view * self.model
12    }
13
14    pub fn set_model(&mut self, model: Matrix4) {
15        self.model = model;
16    }
17
18    pub fn set_view(&mut self, view: Matrix4) {
19        self.view = view;
20    }
21
22    pub fn set_projection(&mut self, projection: Matrix4) {
23        self.projection = projection;
24    }
25
26    pub unsafe fn address_of(&self) -> *const f32 {
27        &self.model.m[0][0] as *const f32
28    }
29}