-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Chunkified, deserialization-free Point Cloud visualizers #7011
Conversation
af25ad5
to
ee0abec
Compare
97bf8e9
to
35b5990
Compare
a52cea0
to
afdb95c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some concerns on usability/how easy it is to mess up. Otherwise looking great.
iter_primitive_arrays
<3. Ages ago I whined "why aren't we just reinterpret casting our float arrays T_T" and now we finally have it. What a time to be alive!
Either::Right( | ||
self.iter_component_offsets(component_name) | ||
.map(move |(idx, len)| { | ||
bytemuck::cast_slice(&values[idx * size..idx * size + len * size]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, the doc wasn't joking, we're talking ptr cast fast here :O
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be nervous though about alignment issues?
I figure right now we don't have any special alignment requirements on any of our types and I'm not sure its possible to have that and still implement arrow2::types::NativeType
🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we be nervous though about alignment issues?
I wouldn't be: bytemuck::cast_slice
panics on misalignment, which can only happen if someone has just modified this view's code and/or the arrow representation of points, at which point I sure hope said someone will try the view to see if it still works (and would insta panic).
let world_from_entity = | ||
if view_ctx.space_view_class_identifier() == SpatialSpaceView3D::identifier() { | ||
transforms.reference_from_entity(&data_result.entity_path) | ||
} else { | ||
transforms.reference_from_entity_ignoring_pinhole( | ||
&data_result.entity_path, | ||
ctx.recording(), | ||
&latest_at, | ||
) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(fyi I'm break this on another PR, merge should be trivial thougyh)
.sum::<usize>(); | ||
let num_positions = all_position_chunks | ||
.iter() | ||
.flat_map(|chunk| chunk.iter_primitive_array::<2, f32>(&Position2D::name())) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's a bit unfortunate how easy it is to get this wrong here: We first specify Position2D
's name, then have to know this is two floats and then cast it to Position2D
. If any of these steps are wrong, we get into a weird state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same remark as above: you don't really get into a weird state most of the time, you just insta panic. And again you have to be actively modifying this code etc.
let all_positions_indexed = all_position_chunks.iter().flat_map(|chunk| { | ||
itertools::izip!( | ||
chunk.iter_component_indices(&timeline, &Position2D::name()), | ||
chunk.iter_primitive_array::<2, f32>(&Position2D::name()) | ||
) | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be nice to have a similar utility like iter_as
here to make this shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😭 I used to have them, but it seemed really over the top to maintain yet another set of helpers just for this part.
I'll try it once again and see how it feels.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Brought them back! 🙇
afdb95c
to
0e29c96
Compare
Title! This introduces new neat zero-deser zero-copy helper for generic arrow buffers. - DNM: requires #7011 --- #### Mesh3D https://github.com/rerun-io/rerun/blob/c070efbee3713bf6459190aa5ace203a5a8b3678/crates/viewer/re_space_view_spatial/src/visualizers/meshes.rs#L179-L277  #### Asset3D https://github.com/rerun-io/rerun/blob/c070efbee3713bf6459190aa5ace203a5a8b3678/crates/viewer/re_space_view_spatial/src/visualizers/assets3d.rs#L149-L206 
Title!
Because this is the first spatial view we've ever chunkified, this includes a new
entity_iterator
etc.The old ones will be removed once everything has been ported.
rerun/crates/viewer/re_space_view_spatial/src/visualizers/points3d.rs
Lines 202 to 271 in 35b5990
Checklist
main
build: rerun.io/viewernightly
build: rerun.io/viewerCHANGELOG.md
and the migration guideTo run all checks from
main
, comment on the PR with@rerun-bot full-check
.