feat(rerun): retain live playback and recover isolated viewer resources
This commit is contained in:
+418
-49
@@ -1,3 +1,93 @@
|
||||
--- a/crates/viewer/re_renderer/shader/point_cloud.wgsl
|
||||
+++ b/crates/viewer/re_renderer/shader/point_cloud.wgsl
|
||||
@@ -19,7 +19,7 @@
|
||||
// 256bytes in order to allow them to be buffer-suballocations.
|
||||
// However, wgpu doesn't know this at this point and therefore requires `DownlevelFlags::BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`
|
||||
// if we wouldn't add padding here, which isn't available on WebGL.
|
||||
- _padding: vec4f,
|
||||
+ height_slice: vec4f,
|
||||
};
|
||||
@group(1) @binding(3)
|
||||
var<uniform> draw_data: DrawDataUniformBuffer;
|
||||
@@ -147,6 +147,12 @@
|
||||
out.point_center = point_data.pos;
|
||||
out.quad_offset_from_center = quad.pos_in_world - point_data.pos;
|
||||
out.picking_instance_id = point_data.picking_instance_id;
|
||||
+ // Whole point quads outside the display slice are clipped in every pass.
|
||||
+ // This preserves point IDs and affects retained history immediately.
|
||||
+ if draw_data.height_slice.z > 0.0 &&
|
||||
+ (point_data.pos.z < draw_data.height_slice.x || point_data.pos.z > draw_data.height_slice.y) {
|
||||
+ out.position = vec4f(2.0, 2.0, 2.0, 1.0);
|
||||
+ }
|
||||
|
||||
return out;
|
||||
}
|
||||
--- a/crates/viewer/re_renderer/src/point_cloud_builder.rs
|
||||
+++ b/crates/viewer/re_renderer/src/point_cloud_builder.rs
|
||||
@@ -24,6 +24,7 @@
|
||||
pub(crate) batches: Vec<PointCloudBatchInfo>,
|
||||
|
||||
pub(crate) radius_boost_in_ui_points_for_outlines: f32,
|
||||
+ pub(crate) nodedc_height_slice: Option<[f32; 2]>,
|
||||
}
|
||||
|
||||
impl<'ctx> PointCloudBuilder<'ctx> {
|
||||
@@ -35,7 +36,14 @@
|
||||
picking_instance_ids_buffer: DataTextureSource::new(ctx),
|
||||
batches: Vec::with_capacity(16),
|
||||
radius_boost_in_ui_points_for_outlines: 0.0,
|
||||
- }
|
||||
+ nodedc_height_slice: None,
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /// Clip in world coordinates in the existing point vertex shader, including
|
||||
+ /// picking/outlines. Cached geometry and source point indices stay intact.
|
||||
+ pub fn nodedc_height_slice(&mut self, range: Option<[f32; 2]>) {
|
||||
+ self.nodedc_height_slice = range.filter(|r| r[0].is_finite() && r[1].is_finite() && r[0] <= r[1]);
|
||||
}
|
||||
|
||||
/// Returns number of points that can be added without reallocation.
|
||||
--- a/crates/viewer/re_renderer/src/renderer/point_cloud.rs
|
||||
+++ b/crates/viewer/re_renderer/src/renderer/point_cloud.rs
|
||||
@@ -132,7 +132,8 @@
|
||||
#[derive(Clone, Copy, bytemuck::Pod, bytemuck::Zeroable)]
|
||||
pub struct DrawDataUniformBuffer {
|
||||
pub radius_boost_in_ui_points: wgpu_buffer_types::F32RowPadded,
|
||||
- pub end_padding: [wgpu_buffer_types::PaddingRow; 16 - 1],
|
||||
+ pub height_slice: wgpu_buffer_types::Vec4,
|
||||
+ pub end_padding: [wgpu_buffer_types::PaddingRow; 16 - 2],
|
||||
}
|
||||
|
||||
/// Uniform buffer that changes for every batch of points.
|
||||
@@ -340,6 +341,7 @@
|
||||
picking_instance_ids_buffer,
|
||||
batches,
|
||||
radius_boost_in_ui_points_for_outlines,
|
||||
+ nodedc_height_slice,
|
||||
} = builder;
|
||||
|
||||
let point_renderer = ctx.renderer::<PointCloudRenderer>();
|
||||
@@ -388,16 +390,19 @@
|
||||
"PointCloudDrawData::picking_instance_id_texture",
|
||||
)?;
|
||||
|
||||
+ let height_slice = nodedc_height_slice.map_or(glam::Vec4::ZERO, |r| glam::vec4(r[0], r[1], 1.0, 0.0));
|
||||
let draw_data_uniform_buffer_bindings = create_and_fill_uniform_buffer_batch(
|
||||
ctx,
|
||||
"PointCloudDrawData::DrawDataUniformBuffer".into(),
|
||||
[
|
||||
gpu_data::DrawDataUniformBuffer {
|
||||
radius_boost_in_ui_points: 0.0.into(),
|
||||
+ height_slice: height_slice.into(),
|
||||
end_padding: Default::default(),
|
||||
},
|
||||
gpu_data::DrawDataUniformBuffer {
|
||||
radius_boost_in_ui_points: radius_boost_in_ui_points_for_outlines.into(),
|
||||
+ height_slice: height_slice.into(),
|
||||
end_padding: Default::default(),
|
||||
},
|
||||
]
|
||||
--- a/crates/viewer/re_view_spatial/src/eye.rs
|
||||
+++ b/crates/viewer/re_view_spatial/src/eye.rs
|
||||
@@ -2,7 +2,7 @@
|
||||
@@ -9,7 +99,16 @@
|
||||
use re_sdk_types::blueprint::components::{AngularSpeed, Eye3DKind};
|
||||
use re_sdk_types::components::{LinearSpeed, Position3D, Vector3D};
|
||||
use re_view::controls::{
|
||||
@@ -214,6 +214,8 @@
|
||||
@@ -199,6 +199,8 @@
|
||||
/// This should not be used to get the current tracked entity, get that
|
||||
/// via view properties instead.
|
||||
pub last_tracked_entity: Option<EntityPath>,
|
||||
+ // NODE.DC: prior entity position, not a replacement camera controller.
|
||||
+ last_tracked_position: Option<Vec3>,
|
||||
|
||||
interpolation: Option<EyeInterpolation>,
|
||||
|
||||
@@ -214,6 +216,8 @@
|
||||
pub last_look_target: Option<Vec3>,
|
||||
pub last_orbit_radius: Option<f32>,
|
||||
pub last_eye_up: Option<Vec3>,
|
||||
@@ -18,7 +117,7 @@
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, re_byte_size::SizeBytes)]
|
||||
@@ -241,6 +243,7 @@
|
||||
@@ -241,6 +245,7 @@
|
||||
fov_y: Option<f32>,
|
||||
|
||||
did_interact: bool,
|
||||
@@ -26,7 +125,7 @@
|
||||
}
|
||||
|
||||
impl EyeController {
|
||||
@@ -250,16 +253,8 @@
|
||||
@@ -250,16 +255,8 @@
|
||||
/// Avoids breaking the view by zooming in too far.
|
||||
pub const MIN_ORBIT_DISTANCE: f32 = Eye::PERSPECTIVE_NEAR_PLANE * 2.0;
|
||||
|
||||
@@ -45,7 +144,7 @@
|
||||
|
||||
fn get_eye(&self) -> Eye {
|
||||
Eye {
|
||||
@@ -317,6 +312,10 @@
|
||||
@@ -317,6 +314,10 @@
|
||||
.0,
|
||||
);
|
||||
|
||||
@@ -56,7 +155,7 @@
|
||||
Ok(Self {
|
||||
pos,
|
||||
look_target,
|
||||
@@ -325,6 +324,7 @@
|
||||
@@ -325,6 +326,7 @@
|
||||
eye_up,
|
||||
did_interact: false,
|
||||
fov_y,
|
||||
@@ -64,7 +163,7 @@
|
||||
})
|
||||
}
|
||||
|
||||
@@ -482,12 +482,45 @@
|
||||
@@ -482,10 +484,68 @@
|
||||
let up = rot * Vec3::Y;
|
||||
let right = rot * -Vec3::X; // TODO(emilk): why do we need a negation here? O.o
|
||||
|
||||
@@ -84,8 +183,24 @@
|
||||
|
||||
self.pos += translate;
|
||||
self.look_target += translate;
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
+ /// Move the existing eye by the tracked entity's translation, retaining
|
||||
+ /// the operator's offset, orientation and radius. Admission does not jump.
|
||||
+ fn follow_translation(&mut self, previous: Option<Vec3>, current: Vec3) {
|
||||
+ if let Some(previous) = previous {
|
||||
+ let delta = current - previous;
|
||||
+ if delta.is_finite() && delta != Vec3::ZERO {
|
||||
+ self.pos += delta;
|
||||
+ self.look_target += delta;
|
||||
+ // The next frame reconstructs this rig from the blueprint.
|
||||
+ // Its existing write gate must also commit autonomous tracking,
|
||||
+ // otherwise every frame falls back to the last manual eye.
|
||||
+ self.did_interact = true;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /// Translate the whole rig, not its orientation/radius, onto the grid.
|
||||
+ /// Called only by deliberate navigation while not following an entity.
|
||||
+ fn anchor_orbit_to_grid(&mut self) {
|
||||
@@ -97,6 +212,15 @@
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ /// Ground only an automatic fallback; explicit/saved eyes retain height.
|
||||
+ fn anchor_fallback_orbit_to_grid(&mut self, has_explicit_target: bool) {
|
||||
+ if !has_explicit_target && self.kind == Eye3DKind::Orbital {
|
||||
+ let before = self.look_target;
|
||||
+ self.anchor_orbit_to_grid();
|
||||
+ self.did_interact |= self.look_target != before;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ fn zoom_orbit(&mut self, zoom_factor: f32) {
|
||||
+ if !zoom_factor.is_finite() || zoom_factor <= 0.0 {
|
||||
+ return;
|
||||
@@ -105,12 +229,10 @@
|
||||
+ .clamp(Self::MIN_ORBIT_DISTANCE, Self::MAX_ORBITAL_RADIUS);
|
||||
+ self.pos = self.look_target - self.fwd() * new_radius;
|
||||
+ self.did_interact = true;
|
||||
+ }
|
||||
+
|
||||
}
|
||||
|
||||
fn handle_drag(&mut self, response: &egui::Response, drag_threshold: f32) {
|
||||
if response.drag_delta().length() > drag_threshold {
|
||||
let roll = response.dragged_by(ROLL_MOUSE)
|
||||
@@ -513,7 +546,7 @@
|
||||
@@ -513,7 +573,7 @@
|
||||
}
|
||||
|
||||
/// Handle zoom/scroll input.
|
||||
@@ -119,7 +241,7 @@
|
||||
let zoom_factor = egui_ctx.input(|input| {
|
||||
// egui's default horizontal_scroll_modifier is shift, which is also our speed-up modifier.
|
||||
// This means that a user who wants to speed up scroll-to-zoom will generate a horizontal scroll delta.
|
||||
@@ -528,22 +561,7 @@
|
||||
@@ -528,22 +588,7 @@
|
||||
|
||||
match self.kind {
|
||||
Eye3DKind::Orbital => {
|
||||
@@ -143,7 +265,7 @@
|
||||
}
|
||||
Eye3DKind::FirstPerson => {
|
||||
// Move along the forward axis when zooming in first person mode.
|
||||
@@ -707,25 +725,6 @@
|
||||
@@ -707,25 +752,6 @@
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +291,7 @@
|
||||
pub fn find_camera(cameras: &[PinholeWrapper], needle: &EntityPath) -> Option<Eye> {
|
||||
let mut found_camera = None;
|
||||
|
||||
@@ -744,6 +743,103 @@
|
||||
@@ -744,6 +770,173 @@
|
||||
|
||||
fn ease_out(t: f32) -> f32 {
|
||||
1. - (1. - t) * (1. - t)
|
||||
@@ -193,6 +315,76 @@
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn following_commits_motion_without_manual_input_across_frames() {
|
||||
+ let initial = controller();
|
||||
+ let mut saved = (initial.pos, initial.look_target, initial.eye_up);
|
||||
+ let mut previous = Vec3::ZERO;
|
||||
+ for target in [vec3(1.0, 2.0, 0.5), vec3(5.0, -3.0, 1.0), vec3(9.0, 7.0, 2.0)] {
|
||||
+ // Each native frame reads the last saved blueprint, not the previous
|
||||
+ // temporary controller. No mouse interaction opens the write gate.
|
||||
+ let mut frame = controller();
|
||||
+ (frame.pos, frame.look_target, frame.eye_up) = saved;
|
||||
+ frame.follow_translation(Some(previous), target);
|
||||
+ assert!(frame.did_interact, "tracking must reach save_to_blueprint");
|
||||
+ assert!((frame.pos - initial.pos - target).length() < 0.001);
|
||||
+ assert!((frame.look_target - initial.look_target - target).length() < 0.001);
|
||||
+ assert_eq!(frame.eye_up, initial.eye_up);
|
||||
+ assert!((frame.radius() - initial.radius()).abs() < 0.001);
|
||||
+ saved = (frame.pos, frame.look_target, frame.eye_up);
|
||||
+ previous = target;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn following_admission_idle_and_invalid_pose_do_not_write_camera() {
|
||||
+ for (previous, current) in [
|
||||
+ (None, vec3(12.0, 8.0, 2.0)),
|
||||
+ (Some(Vec3::ZERO), Vec3::ZERO),
|
||||
+ (Some(Vec3::ZERO), Vec3::splat(f32::NAN)),
|
||||
+ (Some(Vec3::ZERO), Vec3::splat(f32::INFINITY)),
|
||||
+ ] {
|
||||
+ let mut c = controller();
|
||||
+ let before = (c.pos, c.look_target, c.eye_up);
|
||||
+ c.follow_translation(previous, current);
|
||||
+ assert_eq!((c.pos, c.look_target, c.eye_up), before);
|
||||
+ assert!(!c.did_interact);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn following_keeps_admission_eye_and_manual_offset() {
|
||||
+ let mut c = controller();
|
||||
+ let before = (c.pos, c.look_target, c.eye_up);
|
||||
+ c.follow_translation(None, vec3(12.0, 8.0, 2.0));
|
||||
+ assert_eq!((c.pos, c.look_target, c.eye_up), before);
|
||||
+ c.translate(egui::vec2(4.0, 3.0));
|
||||
+ c.rotate(egui::vec2(2.0, 1.0));
|
||||
+ c.zoom_orbit(2.0);
|
||||
+ let before = (c.pos, c.look_target, c.eye_up, c.radius());
|
||||
+ let movement = vec3(900.0, -230.0, 3.0);
|
||||
+ c.follow_translation(Some(Vec3::ZERO), movement);
|
||||
+ assert!((c.pos - before.0 - movement).length() < 0.001);
|
||||
+ assert!((c.look_target - before.1 - movement).length() < 0.001);
|
||||
+ assert_eq!(c.eye_up, before.2);
|
||||
+ assert!((c.radius() - before.3).abs() < 0.001);
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn saved_eye_keeps_height_when_tracking_is_disabled() {
|
||||
+ let mut c = controller();
|
||||
+ c.pos += vec3(0.0, 0.0, 40.0);
|
||||
+ c.look_target += vec3(0.0, 0.0, 40.0);
|
||||
+ let before = (c.pos, c.look_target, c.radius());
|
||||
+ c.anchor_fallback_orbit_to_grid(true);
|
||||
+ assert_eq!((c.pos, c.look_target, c.radius()), before);
|
||||
+ assert!(!c.did_interact);
|
||||
+ c.anchor_fallback_orbit_to_grid(false);
|
||||
+ assert_eq!(c.look_target.z, 0.0);
|
||||
+ assert!((c.radius() - before.2).abs() < 0.0001);
|
||||
+ assert!(c.did_interact);
|
||||
+ }
|
||||
+
|
||||
+ #[test]
|
||||
+ fn pan_is_on_grid_and_moves_the_whole_rig() {
|
||||
+ let mut c = controller();
|
||||
+ let offset = c.pos - c.look_target;
|
||||
@@ -273,23 +465,24 @@
|
||||
}
|
||||
|
||||
impl EyeState {
|
||||
@@ -804,9 +900,32 @@
|
||||
@@ -804,8 +997,32 @@
|
||||
}
|
||||
}
|
||||
|
||||
+ // Anchor before the first paint, not on the first orbit drag. This
|
||||
+ // avoids a one-off camera jump when the scene-bounds fallback is high.
|
||||
+ if tracking_entity.is_none() && eye_controller.kind == Eye3DKind::Orbital
|
||||
+ && (eye_controller.grid_plane.normal.dot(eye_controller.look_target)
|
||||
+ - eye_controller.grid_plane.d).abs() > 1.0e-5
|
||||
+ {
|
||||
+ eye_controller.anchor_orbit_to_grid();
|
||||
+ eye_controller.did_interact = true;
|
||||
+ // Anchor scene-bounds fallbacks before first paint, but never project
|
||||
+ // an explicitly saved eye onto the grid when tracking is switched off.
|
||||
+ if tracking_entity.is_none() {
|
||||
+ let has_explicit_target = eye_property
|
||||
+ .component_or_empty::<Position3D>(
|
||||
+ EyeControls3D::descriptor_look_target().component,
|
||||
+ )?
|
||||
+ .is_some();
|
||||
+ eye_controller.anchor_fallback_orbit_to_grid(has_explicit_target);
|
||||
+ }
|
||||
+
|
||||
// Handle spinning before inputs because some inputs depend on view direction.
|
||||
self.handle_spinning(ctx, eye_property, &mut eye_controller)?;
|
||||
|
||||
+
|
||||
+ // NODE.DC: pin manual map navigation to the XY grid. Tracking and
|
||||
+ // explicit camera presets retain their own target until manual input.
|
||||
+ let manual_input = response.drag_delta().length_sq() > 0.0
|
||||
@@ -302,11 +495,125 @@
|
||||
+ eye_controller.anchor_orbit_to_grid();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
|
||||
// We do input before tracking entity, because the input can cause the eye
|
||||
// to stop tracking.
|
||||
let gamepad_navigation_status = eye_controller.handle_input(
|
||||
@@ -1241,6 +1360,7 @@
|
||||
@@ -892,15 +1109,14 @@
|
||||
|
||||
let new_tracking = self.last_tracked_entity.as_ref() != Some(&tracking_entity);
|
||||
if new_tracking {
|
||||
- self.start_interpolation();
|
||||
+ self.last_tracked_position = None;
|
||||
self.last_tracked_entity = Some(tracking_entity.clone());
|
||||
- }
|
||||
-
|
||||
- // If the position that doesn't move by changing the eye's rotation changed.
|
||||
- let did_eye_orbit_center_change = match eye_controller.kind {
|
||||
- Eye3DKind::FirstPerson => eye_controller.pos != old_pos,
|
||||
- Eye3DKind::Orbital => eye_controller.look_target != old_look_target,
|
||||
- };
|
||||
+ if find_camera(cameras, &tracking_entity).is_some() {
|
||||
+ self.start_interpolation();
|
||||
+ } else {
|
||||
+ self.stop_interpolation();
|
||||
+ }
|
||||
+ }
|
||||
|
||||
if let Some(target_eye) = find_camera(cameras, &tracking_entity) {
|
||||
if eye_controller.did_interact
|
||||
@@ -942,51 +1158,12 @@
|
||||
.region_of_interest_per_entity
|
||||
.get(&tracking_entity.hash())
|
||||
{
|
||||
- // If we're tracking something new, set the current position & look target to the correct view.
|
||||
- if new_tracking {
|
||||
- let fwd = eye_controller.fwd();
|
||||
- let radius = entity_bbox.centered_bounding_sphere_radius() * 1.5;
|
||||
- let radius = if radius < 0.0001 {
|
||||
- // Handle zero-sized bounding boxes:
|
||||
- (bounding_boxes
|
||||
- .region_of_interest_current
|
||||
- .centered_bounding_sphere_radius()
|
||||
- * 1.5)
|
||||
- .at_least(0.02)
|
||||
- } else {
|
||||
- radius
|
||||
- };
|
||||
- eye_controller.pos = eye_controller.look_target - fwd * radius;
|
||||
- // Force write of pos and look target to not use fallbacks for that.
|
||||
- eye_property.save_blueprint_component(
|
||||
- ctx.viewer_ctx,
|
||||
- &EyeControls3D::descriptor_position(),
|
||||
- &Position3D::from(eye_controller.pos),
|
||||
- );
|
||||
-
|
||||
- eye_property.save_blueprint_component(
|
||||
- ctx.viewer_ctx,
|
||||
- &EyeControls3D::descriptor_look_target(),
|
||||
- &Position3D::from(eye_controller.look_target),
|
||||
- );
|
||||
- }
|
||||
-
|
||||
- let orbit_radius = eye_controller.pos.distance(eye_controller.look_target);
|
||||
-
|
||||
+ // Preserve the entire eye at admission, including off-center pan.
|
||||
+ // Subsequent target translation moves the same native rig. Manual
|
||||
+ // orbit/pan/zoom has already run above and remains authoritative.
|
||||
let pos = entity_bbox.center();
|
||||
-
|
||||
- let fwd = eye_controller.fwd();
|
||||
-
|
||||
- match eye_controller.kind {
|
||||
- Eye3DKind::FirstPerson => {
|
||||
- eye_controller.pos = pos;
|
||||
- eye_controller.look_target = pos + fwd;
|
||||
- }
|
||||
- Eye3DKind::Orbital => {
|
||||
- eye_controller.look_target = pos;
|
||||
- eye_controller.pos = pos - fwd * orbit_radius;
|
||||
- }
|
||||
- }
|
||||
+ eye_controller.follow_translation(self.last_tracked_position, pos);
|
||||
+ self.last_tracked_position = Some(pos);
|
||||
}
|
||||
|
||||
self.last_look_target = Some(eye_controller.look_target);
|
||||
@@ -994,26 +1171,17 @@
|
||||
self.last_orbit_radius =
|
||||
Some(eye_controller.pos.distance(eye_controller.look_target));
|
||||
|
||||
- // When we stop tracking, set the blueprint eye state to the tracked view.
|
||||
- if eye_controller.did_interact && did_eye_orbit_center_change {
|
||||
- eye_controller.save_to_blueprint(
|
||||
- ctx.viewer_ctx,
|
||||
- eye_property,
|
||||
- old_pos,
|
||||
- old_look_target,
|
||||
- old_eye_up,
|
||||
- );
|
||||
-
|
||||
- eye_property.clear_blueprint_component(
|
||||
- ctx.viewer_ctx,
|
||||
- EyeControls3D::descriptor_tracking_entity(),
|
||||
- );
|
||||
- } else {
|
||||
- return Some(eye_controller.get_eye());
|
||||
- }
|
||||
+ // Commit only changed native components. This keeps the next frame
|
||||
+ // relative to the displayed eye, without HTTP, pointer replay or a
|
||||
+ // second navigation loop. Panning never silently disables Follow.
|
||||
+ eye_controller.save_to_blueprint(
|
||||
+ ctx.viewer_ctx, eye_property, old_pos, old_look_target, old_eye_up,
|
||||
+ );
|
||||
+ return Some(eye_controller.get_eye());
|
||||
}
|
||||
} else {
|
||||
self.last_tracked_entity = None;
|
||||
+ self.last_tracked_position = None;
|
||||
}
|
||||
|
||||
None
|
||||
@@ -1241,6 +1409,7 @@
|
||||
};
|
||||
|
||||
self.last_eye = Some(eye);
|
||||
@@ -314,28 +621,66 @@
|
||||
|
||||
Ok(eye)
|
||||
}
|
||||
--- a/crates/viewer/re_viewer_context/src/view/view_states.rs
|
||||
+++ b/crates/viewer/re_viewer_context/src/view/view_states.rs
|
||||
@@ -173,6 +173,13 @@
|
||||
}
|
||||
--- a/crates/viewer/re_view_spatial/src/ui.rs
|
||||
+++ b/crates/viewer/re_view_spatial/src/ui.rs
|
||||
@@ -51,6 +51,8 @@
|
||||
#[derive(Clone, Default, re_byte_size::SizeBytes)]
|
||||
pub struct SpatialViewState {
|
||||
pub bounding_boxes: SceneBoundingBoxes,
|
||||
+ /// Optional display-only world-Z slice. No data/store/accumulation mutation.
|
||||
+ pub nodedc_height_slice: Option<[f32; 2]>,
|
||||
pub show_bounding_box: bool,
|
||||
|
||||
impl ViewStates {
|
||||
+ /// NODE.DC: read-only per-recording state access for native camera snapshots.
|
||||
+ pub fn states_for_store<'a>(&'a self, store_id: &'a StoreId) -> impl Iterator<Item = &'a dyn ViewState> {
|
||||
+ self.states.iter().filter_map(move |((id, _), state)| {
|
||||
+ (id == store_id).then_some(state.as_ref())
|
||||
+ })
|
||||
+ }
|
||||
+
|
||||
pub fn get(&self, store_id: &StoreId, view_id: ViewId) -> Option<&dyn ViewState> {
|
||||
self.states
|
||||
.get(&(store_id.clone(), view_id))
|
||||
pub show_smoothed_bbox: bool,
|
||||
--- a/crates/viewer/re_view_spatial/src/visualizers/points3d.rs
|
||||
+++ b/crates/viewer/re_view_spatial/src/visualizers/points3d.rs
|
||||
@@ -416,6 +416,9 @@
|
||||
let output = VisualizerExecutionOutput::default();
|
||||
|
||||
let mut point_builder = PointCloudBuilder::new(ctx.viewer_ctx.render_ctx());
|
||||
+ if let Some(state) = ctx.view_state.as_any().downcast_ref::<crate::SpatialViewState>() {
|
||||
+ point_builder.nodedc_height_slice(state.nodedc_height_slice);
|
||||
+ }
|
||||
point_builder.radius_boost_in_ui_points_for_outlines(
|
||||
re_view::SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES,
|
||||
);
|
||||
--- a/crates/viewer/re_viewer/src/web.rs
|
||||
+++ b/crates/viewer/re_viewer/src/web.rs
|
||||
@@ -384,6 +384,26 @@
|
||||
let recording = hub.entity_db(recording_id)?;
|
||||
|
||||
@@ -386,6 +386,59 @@
|
||||
Some(recording.store_id().recording_id().to_string())
|
||||
}
|
||||
|
||||
+ /// Local presentation only; finite bounds are validated before any state changes.
|
||||
+ #[wasm_bindgen]
|
||||
+ pub fn nodedc_height_slice(&self, lower: Option<f32>, upper: Option<f32>) -> bool {
|
||||
+ let range = match (lower, upper) {
|
||||
+ (None, None) => None,
|
||||
+ (Some(lo), Some(hi)) if lo.is_finite() && hi.is_finite() && lo <= hi => Some([lo, hi]),
|
||||
+ _ => return false,
|
||||
+ };
|
||||
+ let Some(mut app) = self.runner.app_mut::<crate::App>() else { return false; };
|
||||
+ let Some(store_id) = app.active_recording_id().cloned() else { return false; };
|
||||
+ let mut found = false;
|
||||
+ for state in app.state.view_states.states_for_store_mut(&store_id) {
|
||||
+ if let Some(state) = state.as_any_mut().downcast_mut::<re_view_spatial::SpatialViewState>() {
|
||||
+ state.nodedc_height_slice = range;
|
||||
+ found = true;
|
||||
+ }
|
||||
+ }
|
||||
+ if found { app.egui_ctx.request_repaint(); }
|
||||
+ found
|
||||
+ }
|
||||
+
|
||||
+ #[wasm_bindgen]
|
||||
+ pub fn nodedc_height_bounds(&self) -> Option<String> {
|
||||
+ let app = self.runner.app_mut::<crate::App>()?;
|
||||
+ let store_id = app.active_recording_id()?;
|
||||
+ let state = app.state.view_states.states_for_store(store_id)
|
||||
+ .filter_map(|state| state.as_any().downcast_ref::<re_view_spatial::SpatialViewState>())
|
||||
+ .max_by(|a,b| a.state_3d.eye_state.last_render_time.total_cmp(&b.state_3d.eye_state.last_render_time))?;
|
||||
+ let bounds = state.bounding_boxes.region_of_interest_current;
|
||||
+ if !bounds.is_finite() { return None; }
|
||||
+ Some(serde_json::json!({"min":bounds.min.z,"max":bounds.max.z}).to_string())
|
||||
+ }
|
||||
+
|
||||
+ /// NODE.DC navigation/v1. Last rendered native eye, never a replay of DOM deltas.
|
||||
@@ -356,6 +701,30 @@
|
||||
+ "lookTarget": eye_state.last_look_target?.to_array(),
|
||||
+ "eyeUp": eye_state.last_eye_up?.to_array(),
|
||||
+ }).to_string())
|
||||
}
|
||||
|
||||
+ }
|
||||
+
|
||||
//TODO(#10737): we should refer to logical recordings using store id (recording id is ambiguous)
|
||||
#[wasm_bindgen]
|
||||
pub fn set_active_recording_id(&self, recording_id: &str) {
|
||||
--- a/crates/viewer/re_viewer_context/src/view/view_states.rs
|
||||
+++ b/crates/viewer/re_viewer_context/src/view/view_states.rs
|
||||
@@ -173,6 +173,19 @@
|
||||
}
|
||||
|
||||
impl ViewStates {
|
||||
+ /// NODE.DC: read-only per-recording state access for native camera snapshots.
|
||||
+ pub fn states_for_store<'a>(&'a self, store_id: &'a StoreId) -> impl Iterator<Item = &'a dyn ViewState> {
|
||||
+ self.states.iter().filter_map(move |((id, _), state)| {
|
||||
+ (id == store_id).then_some(state.as_ref())
|
||||
+ })
|
||||
+ }
|
||||
+
|
||||
+ pub fn states_for_store_mut<'a>(&'a mut self, store_id: &'a StoreId) -> impl Iterator<Item = &'a mut (dyn ViewState + 'static)> {
|
||||
+ self.states.iter_mut().filter_map(move |((id, _), state)| {
|
||||
+ (id == store_id).then_some(state.as_mut())
|
||||
+ })
|
||||
+ }
|
||||
+
|
||||
pub fn get(&self, store_id: &StoreId, view_id: ViewId) -> Option<&dyn ViewState> {
|
||||
self.states
|
||||
.get(&(store_id.clone(), view_id))
|
||||
|
||||
@@ -15,6 +15,8 @@ portable source patch and paired generated runtime. Keep the upstream licenses.
|
||||
are not shaders and must not enter the build.
|
||||
4. On Worker006, create a temporary container from the pinned Rust image in
|
||||
the manifest, with 4 CPUs, 16 GB memory, no GPU, no ports and no private data.
|
||||
This build raised its own CPU quota to 8, then 16 after checking spare host
|
||||
capacity; no Docker Desktop resource settings or other containers changed.
|
||||
Use the `ndc-` name and NODE.DC ownership labels required by AGENTS.md.
|
||||
Copy the archive to `/work/patched-source.tar.gz` and the repository's
|
||||
`scripts/build-rerun-navigation.sh` to `/work/build-rerun-navigation.sh`.
|
||||
|
||||
+27
-10
@@ -3,33 +3,50 @@
|
||||
"upstreamVersion": "0.36.3",
|
||||
"upstreamCommit": "6ded109d33c549e98185f7c95fa8009d44e4adef",
|
||||
"upstreamArchiveSha256": "3f92aef3f33f63c79b275b5c66a65d73192e75967cbcd3d1f16c75010996f896",
|
||||
"patchSha256": "a893a4b4e7523cca88284316c88b930c3b91ba973ed3f954c9ca632f71252e64",
|
||||
"patchSha256": "91ac2a6edb93f20e8f38670a2f58e99f1218fe07f8a3fceefec136df509537d6",
|
||||
"cargoLockSha256": "74cdf9c3c8c5dbe5a368f1a9a58b011e2a45720843b30e552bc7b1d8ac21d791",
|
||||
"buildScriptSha256": "e3cbd5da889403eda3ffba7c020b6075bdfb025b823d1bf503b639f59688135a",
|
||||
"buildDate": "2026-09-21",
|
||||
"buildDate": "2026-11-03",
|
||||
"rustImage": "rust:1.95-bookworm@sha256:6258907abe69656e41cd992e0b705cdcfabcbbe3db374f92ed2d47121282d4a1",
|
||||
"binaryenVersion": "117",
|
||||
"binaryenArchiveSha256": "3dc677006555b355ea2da5e82602065a161d5e83eaefd3f759afa00b96e83212",
|
||||
"wasmBindgenVersion": "0.2.126",
|
||||
"nativeTestsPassed": 6,
|
||||
"nativeTestsPassed": 10,
|
||||
"files": {
|
||||
"index.js": { "upstreamSha256": "009aa5f66c8674ea268a91926c00e2f82cc7a7b7e5535056d93bd4656d6f6812" },
|
||||
"index.ts": { "upstreamSha256": "087b25170f720a28aa69c411903133286238900050ac775d2cc511b919846696" },
|
||||
"index.d.ts": { "upstreamSha256": "649637dad4e50ef4f2310fc1920b580d16832226a0dda5238355059bf167efba" },
|
||||
"index.js": {
|
||||
"upstreamSha256": "009aa5f66c8674ea268a91926c00e2f82cc7a7b7e5535056d93bd4656d6f6812"
|
||||
},
|
||||
"index.ts": {
|
||||
"upstreamSha256": "087b25170f720a28aa69c411903133286238900050ac775d2cc511b919846696"
|
||||
},
|
||||
"index.d.ts": {
|
||||
"upstreamSha256": "649637dad4e50ef4f2310fc1920b580d16832226a0dda5238355059bf167efba"
|
||||
},
|
||||
"re_viewer.js": {
|
||||
"upstreamSha256": "d2a94836dd0e6de40538c4d657cfb423b1803e354e6ee0cd550735eb5aaab09b",
|
||||
"artifact": "re_viewer.nodedc.js",
|
||||
"sha256": "610d89abffcc5c329797e77794ae2ab5b426c80a5b23fd24064c7d47c6583d3a"
|
||||
"sha256": "7cf2396b18d1b6ab80af03826b94ed8a658071704fbe7b58b860265aab46d19c",
|
||||
"previousArtifactSha256": "7cf2396b18d1b6ab80af03826b94ed8a658071704fbe7b58b860265aab46d19c"
|
||||
},
|
||||
"re_viewer.d.ts": {
|
||||
"upstreamSha256": "9a77a4e1e1aa8311185a3f275bf326a8fff2844e468e561c59d5f0ee7aa6debe",
|
||||
"artifact": "re_viewer.nodedc.d.ts",
|
||||
"sha256": "cfbf010d66560af919aa68d255a6ddc7120829f8ee8f27a41f56d943cd54e598"
|
||||
"sha256": "cafb702c9d3c37d01012afa358f337cfcc8ba3e101bfdacfb03455de972166c7",
|
||||
"previousArtifactSha256": "cafb702c9d3c37d01012afa358f337cfcc8ba3e101bfdacfb03455de972166c7"
|
||||
},
|
||||
"re_viewer_bg.wasm": {
|
||||
"upstreamSha256": "02d6d9c3a569d3faceb01cf89104342d970fc85e7c31a08dedd357b6c7104d2f",
|
||||
"artifact": "re_viewer_bg.nodedc.wasm",
|
||||
"sha256": "2b661de545ac90bb950eda1a28fc5a7c3ce4ca7f5bb24894789acf7589495185"
|
||||
"sha256": "309ff802d9be926fd58cbf3e36819d7da02bd4e580f44d2f636214d18ec3eac3",
|
||||
"previousArtifactSha256": "18e4d6fa8889ac73ecfc366df720a88678d9de2fcabd3302bb8b259147c78906"
|
||||
}
|
||||
}
|
||||
},
|
||||
"buildCpuRange": [
|
||||
8,
|
||||
16
|
||||
],
|
||||
"buildMemoryGiB": 16,
|
||||
"qualificationScriptSha256": "ebd65eb3b2143ffe5f8b3e0f718653a836a4cdb76375f47c93fdaf616a041e50",
|
||||
"regressionBeforeFix": "following_commits_motion_without_manual_input_across_frames: expected failure",
|
||||
"patchedSourceArchiveSha256": "bfc8297d5cb73059981aff47c7b7638e07a782b854f57fe65a92c16fe041ee1e"
|
||||
}
|
||||
|
||||
@@ -69,6 +69,11 @@ declare namespace wasm_bindgen {
|
||||
* excludes states retained for a previously selected/reset pane.
|
||||
*/
|
||||
nodedc_camera_eye(): string | undefined;
|
||||
nodedc_height_bounds(): string | undefined;
|
||||
/**
|
||||
* Local presentation only; finite bounds are validated before any state changes.
|
||||
*/
|
||||
nodedc_height_slice(lower?: number | null, upper?: number | null): boolean;
|
||||
/**
|
||||
* Open a new channel for streaming data.
|
||||
*
|
||||
@@ -115,6 +120,8 @@ declare interface InitOutput {
|
||||
readonly webhandle_has_panicked: (a: number) => number;
|
||||
readonly webhandle_new: (a: any) => [number, number, number];
|
||||
readonly webhandle_nodedc_camera_eye: (a: number) => [number, number];
|
||||
readonly webhandle_nodedc_height_bounds: (a: number) => [number, number];
|
||||
readonly webhandle_nodedc_height_slice: (a: number, b: number, c: number) => number;
|
||||
readonly webhandle_open_channel: (a: number, b: number, c: number, d: number, e: number) => void;
|
||||
readonly webhandle_override_panel_state: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
||||
readonly webhandle_panic_callstack: (a: number) => [number, number];
|
||||
|
||||
@@ -256,6 +256,28 @@ const exports = { __proto__: null };
|
||||
}
|
||||
return v1;
|
||||
}
|
||||
/**
|
||||
* @returns {string | undefined}
|
||||
*/
|
||||
nodedc_height_bounds() {
|
||||
const ret = wasm.webhandle_nodedc_height_bounds(this.__wbg_ptr);
|
||||
let v1;
|
||||
if (ret[0] !== 0) {
|
||||
v1 = getStringFromWasm0(ret[0], ret[1]).slice();
|
||||
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
||||
}
|
||||
return v1;
|
||||
}
|
||||
/**
|
||||
* Local presentation only; finite bounds are validated before any state changes.
|
||||
* @param {number | null} [lower]
|
||||
* @param {number | null} [upper]
|
||||
* @returns {boolean}
|
||||
*/
|
||||
nodedc_height_slice(lower, upper) {
|
||||
const ret = wasm.webhandle_nodedc_height_slice(this.__wbg_ptr, isLikeNone(lower) ? Number.MAX_SAFE_INTEGER : Math.fround(lower), isLikeNone(upper) ? Number.MAX_SAFE_INTEGER : Math.fround(upper));
|
||||
return ret !== 0;
|
||||
}
|
||||
/**
|
||||
* Open a new channel for streaming data.
|
||||
*
|
||||
|
||||
BIN
Binary file not shown.
Reference in New Issue
Block a user