diff --git a/crates/viewer/re_renderer/src/point_cloud_builder.rs b/crates/viewer/re_renderer/src/point_cloud_builder.rs index 6b1044bd1081..44593499e70a 100644 --- a/crates/viewer/re_renderer/src/point_cloud_builder.rs +++ b/crates/viewer/re_renderer/src/point_cloud_builder.rs @@ -68,18 +68,22 @@ impl<'ctx> PointCloudBuilder<'ctx> { pub fn batch(&mut self, label: impl Into) -> PointCloudBatchBuilder<'_, 'ctx> { self.batches.push(PointCloudBatchInfo { label: label.into(), - world_from_obj: glam::Affine3A::IDENTITY, - flags: PointCloudBatchFlags::FLAG_ENABLE_SHADING, - point_count: 0, - overall_outline_mask_ids: OutlineMaskPreference::NONE, - additional_outline_mask_ids_vertex_ranges: Vec::new(), - picking_object_id: Default::default(), - depth_offset: 0, + ..PointCloudBatchInfo::default() }); PointCloudBatchBuilder(self) } + #[inline] + pub fn batch_with_info( + &mut self, + info: PointCloudBatchInfo, + ) -> PointCloudBatchBuilder<'_, 'ctx> { + self.batches.push(info); + + PointCloudBatchBuilder(self) + } + /// Finalizes the builder and returns a point cloud draw data with all the points added so far. pub fn into_draw_data(self) -> Result { PointCloudDrawData::new(self) diff --git a/crates/viewer/re_renderer/src/renderer/point_cloud.rs b/crates/viewer/re_renderer/src/renderer/point_cloud.rs index 25b2b16468c5..ca289ba92d25 100644 --- a/crates/viewer/re_renderer/src/renderer/point_cloud.rs +++ b/crates/viewer/re_renderer/src/renderer/point_cloud.rs @@ -151,6 +151,22 @@ pub struct PointCloudBatchInfo { pub depth_offset: DepthOffset, } +impl Default for PointCloudBatchInfo { + #[inline] + fn default() -> Self { + Self { + label: DebugLabel::default(), + world_from_obj: glam::Affine3A::IDENTITY, + flags: PointCloudBatchFlags::FLAG_ENABLE_SHADING, + point_count: 0, + overall_outline_mask_ids: OutlineMaskPreference::NONE, + additional_outline_mask_ids_vertex_ranges: Vec::new(), + picking_object_id: Default::default(), + depth_offset: 0, + } + } +} + #[derive(thiserror::Error, Debug, PartialEq, Eq)] pub enum PointCloudDrawDataError { #[error("Failed to transfer data to the GPU: {0}")] diff --git a/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs b/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs index 25274d136cd3..608d0f89ed2b 100644 --- a/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs +++ b/crates/viewer/re_space_view_map/src/visualizers/geo_points.rs @@ -151,7 +151,11 @@ impl GeoPointsVisualizer { let outline = highlight.entity_outline_mask(entity_path.hash()); let mut point_batch = points - .batch(entity_path.to_string()) + .batch_with_info(re_renderer::renderer::PointCloudBatchInfo { + label: entity_path.to_string().into(), + flags: re_renderer::renderer::PointCloudBatchFlags::empty(), + ..re_renderer::renderer::PointCloudBatchInfo::default() + }) .picking_object_id(re_renderer::PickingLayerObjectId(entity_path.hash64())) .outline_mask_ids(outline.overall);