Skip to content

Commit

Permalink
don't shade geopoints
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Nov 13, 2024
1 parent 20d094e commit f1f70be
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
18 changes: 11 additions & 7 deletions crates/viewer/re_renderer/src/point_cloud_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,22 @@ impl<'ctx> PointCloudBuilder<'ctx> {
pub fn batch(&mut self, label: impl Into<DebugLabel>) -> 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, PointCloudDrawDataError> {
PointCloudDrawData::new(self)
Expand Down
16 changes: 16 additions & 0 deletions crates/viewer/re_renderer/src/renderer/point_cloud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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}")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit f1f70be

Please sign in to comment.