mirror of
https://github.com/hannobraun/Fornjot
synced 2025-05-08 11:58:27 +00:00
Rotate camera around z
This commit is contained in:
parent
7c2bffcf2c
commit
cbd4f9e216
@ -217,6 +217,7 @@ impl Mat4x4 {
|
||||
Self::perspective()
|
||||
* Self::translation([0., 0., -2.])
|
||||
* Self::rotation_x(PI / 4.)
|
||||
* Self::rotation_z(PI / 4.)
|
||||
}
|
||||
|
||||
pub fn perspective() -> Self {
|
||||
@ -263,6 +264,19 @@ impl Mat4x4 {
|
||||
],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn rotation_z(angle: f32) -> Self {
|
||||
let (sin, cos) = angle.sin_cos();
|
||||
|
||||
Self {
|
||||
columns: [
|
||||
[cos, -sin, 0., 0.],
|
||||
[sin, cos, 0., 0.],
|
||||
[0., 0., 1., 0.],
|
||||
[0., 0., 0., 1.],
|
||||
],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Mul<Self> for Mat4x4 {
|
||||
|
Loading…
Reference in New Issue
Block a user