Skip to content

Commit

Permalink
Update Orthographic projection when position/target changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asny committed Nov 27, 2024
1 parent 4ceae1a commit 253986b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,9 @@ impl Camera {
Point3::from_vec(self.target),
self.up,
);
if let ProjectionType::Orthographic { height } = self.projection_type {
self.set_orthographic_projection(height, self.z_near, self.z_far);
}
self.update_screen2ray();
self.update_frustrum();
}
Expand Down Expand Up @@ -704,9 +707,6 @@ impl Camera {
self.target + v - v.project_on(self.view_direction()),
self.up,
);
if let ProjectionType::Orthographic { height } = self.projection_type {
self.set_orthographic_projection(height, self.z_near, self.z_far);
}
}
}

Expand All @@ -717,10 +717,6 @@ impl Camera {
let zoom_factor = zoom_factor.max(std::f32::EPSILON);
let position = self.target + (self.position - self.target).normalize() / zoom_factor;
self.set_view(position, self.target, self.up);

if let ProjectionType::Orthographic { height } = self.projection_type {
self.set_orthographic_projection(height, self.z_near, self.z_far);
}
}

///
Expand Down

0 comments on commit 253986b

Please sign in to comment.