From 6b18472c5ea79af98f67eb30313839b9fbc0cd3c Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Thu, 28 Nov 2024 13:56:17 +0100 Subject: [PATCH] fixup: plane offset handling --- crates/viewer/re_renderer/src/renderer/world_grid.rs | 3 --- crates/viewer/re_space_view_spatial/src/ui_3d.rs | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/viewer/re_renderer/src/renderer/world_grid.rs b/crates/viewer/re_renderer/src/renderer/world_grid.rs index 910ec309ca05..d5c8532a808f 100644 --- a/crates/viewer/re_renderer/src/renderer/world_grid.rs +++ b/crates/viewer/re_renderer/src/renderer/world_grid.rs @@ -28,9 +28,6 @@ pub struct WorldGridConfiguration { /// How thick the lines are in UI units. pub thickness_ui: f32, - - /// Offset of the grid along its normal. - pub normal_offset: f32, } mod gpu_data { diff --git a/crates/viewer/re_space_view_spatial/src/ui_3d.rs b/crates/viewer/re_space_view_spatial/src/ui_3d.rs index 76ae2912e47a..04d453bffe2c 100644 --- a/crates/viewer/re_space_view_spatial/src/ui_3d.rs +++ b/crates/viewer/re_space_view_spatial/src/ui_3d.rs @@ -735,12 +735,12 @@ impl SpatialSpaceView3D { grid_config.component_or_fallback::(ctx, self, state)?; let orientation = grid_config.component_or_fallback::(ctx, self, state)?; + let normal_offset = **grid_config.component_or_fallback::(ctx, self, state)?; let plane = match orientation { - PlaneOrientation::Xy => re_math::Plane3::XY, - PlaneOrientation::Yz => re_math::Plane3::YZ, - PlaneOrientation::Xz => re_math::Plane3::ZX, + PlaneOrientation::Xy => re_math::Plane3::from_normal_dist(glam::Vec3::Z, normal_offset), + PlaneOrientation::Yz => re_math::Plane3::from_normal_dist(glam::Vec3::X, normal_offset), + PlaneOrientation::Xz => re_math::Plane3::from_normal_dist(glam::Vec3::Y, normal_offset), }; - let normal_offset = **grid_config.component_or_fallback::(ctx, self, state)?; let Some(render_ctx) = ctx.render_ctx else { return Ok(None); @@ -753,7 +753,6 @@ impl SpatialSpaceView3D { plane, spacing, thickness_ui, - normal_offset, }, ))) }