sampling in random hemisphere

This commit is contained in:
Piotrek
2021-04-25 13:50:39 +02:00
parent 8585f21c70
commit 9718ea68dd
7 changed files with 57 additions and 25 deletions
+3 -3
View File
@@ -14,8 +14,8 @@ impl Camera {
pub fn new(aspect: f32, fov: f32) -> Self {
Self {
position: (2.0, 1.0, -1.0).into(),
forward: (-0.66, -0.33, 0.66).into(),
position: (1.0, 2.0, 1.0).into(),
forward: (0.66, -0.25, 0.66).into(),
up: Vector3::unit_y(),
aspect,
fovy: fov,
@@ -33,6 +33,6 @@ impl Camera {
}
pub fn view_matrix(&self) -> Matrix4<f32> {
return Matrix4::look_to_rh((0.0,0.0,0.0).into(), self.forward, self.up);
return Matrix4::look_to_rh((0.0,0.0,0.0).into(), self.forward.normalize(), self.up);
}
}