Skip to content

Commit

Permalink
optimize a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
mkovaxx committed Nov 28, 2023
1 parent b0d2ad0 commit c2236dc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions crates/viewer/src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,11 @@ impl OrbitCamera {
};

let local_frame = self.get_local_frame();
let upward = local_frame.y_axis;
let position = self.target + effective_radius * local_frame.z_axis;
let view = Mat4::look_at_rh(position, self.target, upward);

// NOTE(mkovaxx): This is computing inverse(translation * orientation), but more efficiently
let view =
Mat4::from_quat(self.orientation.conjugate()) * Mat4::from_translation(-position);

proj * view
}
Expand Down

0 comments on commit c2236dc

Please sign in to comment.