Skip to content

Commit

Permalink
Show which is the up-axis when showing orbit center
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Feb 14, 2024
1 parent cfbcbea commit 6b0f2d7
Showing 1 changed file with 35 additions and 7 deletions.
42 changes: 35 additions & 7 deletions crates/re_space_view_spatial/src/ui_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -680,17 +680,45 @@ pub fn view_3d(

if orbit_center_fade > 0.001 {
let half_line_length = orbit_eye.orbit_radius * 0.03;

let half_line_length = half_line_length * orbit_center_fade;

// We distinguish the eye up-axis from the other two axes:

// Default to RFU
let up = if orbit_eye.eye_up == Vec3::ZERO {
glam::Vec3::Z
} else {
orbit_eye.eye_up.normalize()
};
let (right, forward) = up.any_orthonormal_pair();
// let right = scene_view_coordinates
// .and_then(|vc| vc.right())
// .map(Vec3::from)
// .unwrap_or(glam::Vec3::X);
// let forward = scene_view_coordinates
// .and_then(|vc| vc.forward())
// .map(Vec3::from)
// .unwrap_or(glam::Vec3::Y);

line_builder
.batch("center orbit orientation help")
.add_segments(glam::Vec3::AXES.iter().map(|axis| {
(
orbit_eye.orbit_center - *axis * half_line_length,
orbit_eye.orbit_center + *axis * half_line_length,
)
}))
.add_segments(
[
(
orbit_eye.orbit_center,
orbit_eye.orbit_center + 0.5 * up * half_line_length,
),
(
orbit_eye.orbit_center - right * half_line_length,
orbit_eye.orbit_center + right * half_line_length,
),
(
orbit_eye.orbit_center - forward * half_line_length,
orbit_eye.orbit_center + forward * half_line_length,
),
]
.into_iter(),
)
.radius(Size::new_points(0.75))
// TODO(andreas): Fade this out.
.color(re_renderer::Color32::WHITE);
Expand Down

0 comments on commit 6b0f2d7

Please sign in to comment.