Skip to content

Commit

Permalink
desktop: Rerun: avoid logging mostly-empty InstancePoses3D.
Browse files Browse the repository at this point in the history
  • Loading branch information
kpreid committed Oct 10, 2024
1 parent 779ad6e commit fbad5f1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
18 changes: 10 additions & 8 deletions all-is-cubes-desktop/src/glue/rerun_mesh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,16 @@ impl RerunMesher {
for (i, cubes) in instances {
if let Some(mesh) = self.csm.block_instance_mesh(i) {
if let Some(dm) = &mesh.render_data {
dm.destination.log(
&rg::entity_path![],
&rg::archetypes::InstancePoses3D::new().with_translations(
cubes
.into_iter()
.map(|cube| rg::convert_vec(cube.lower_bounds().to_vector())),
),
)
let translations: &dyn re_sdk::ComponentBatch = &cubes
.into_iter()
.map(|cube| {
rg::components::PoseTranslation3D(rg::convert_vec(
cube.lower_bounds().to_vector(),
))
})
.collect::<Vec<_>>();
dm.destination
.log_component_batches(&rg::entity_path![], false, [translations])
}
}
}
Expand Down
12 changes: 12 additions & 0 deletions all-is-cubes/src/rerun_glue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ impl Destination {
self.catch(|| self.stream.log_static(self.path.join(path_suffix), data))
}

pub fn log_component_batches<'a>(
&self,
path_suffix: &EntityPath,
r#static: bool,
data: impl IntoIterator<Item = &'a dyn re_sdk::ComponentBatch>,
) {
self.catch(|| {
self.stream
.log_component_batches(self.path.join(path_suffix), r#static, data)
})
}

pub fn clear_recursive(&self, path_suffix: &EntityPath) {
// TODO: this is no longer necessary
self.log(path_suffix, &archetypes::Clear::new(true));
Expand Down

0 comments on commit fbad5f1

Please sign in to comment.