Skip to content
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

Fix mesh flicker #6157

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion crates/re_query/src/range/results.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,13 @@ pub struct RangeData<'a, T> {

impl<'a, C: Component> RangeData<'a, C> {
/// Useful to abstract over latest-at and ranged results.
///
/// Use `reindexed` override the index of the data, if needed.
#[inline]
pub fn from_latest_at(
resolver: &PromiseResolver,
results: &'a LatestAtComponentResults,
reindexed: Option<(TimeInt, RowId)>,
) -> Self {
let LatestAtComponentResults {
index,
Expand All @@ -238,9 +241,10 @@ impl<'a, C: Component> RangeData<'a, C> {
} = results;

let status = results.to_dense::<C>(resolver).map(|_| ());
let index = reindexed.unwrap_or(*index);

Self {
indices: Some(Indices::Owned(vec![*index].into())),
indices: Some(Indices::Owned(vec![index].into())),
data: cached_dense.get().map(|data| Data::Owned(Arc::clone(data))),
time_range: TimeRange::new(index.0, index.0),
front_status: status.clone(),
Expand Down
10 changes: 8 additions & 2 deletions crates/re_space_view_spatial/src/visualizers/results_ext.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use re_log_types::{RowId, TimeInt};
use re_query::{LatestAtResults, PromiseResolver, PromiseResult, RangeData, RangeResults, Results};
use re_types::Component;

Expand Down Expand Up @@ -92,7 +93,7 @@ impl RangeResultsExt for LatestAtResults {
resolver: &PromiseResolver,
) -> Option<re_query::Result<RangeData<'a, C>>> {
let results = self.get(C::name())?;
let data = RangeData::from_latest_at(resolver, results);
let data = RangeData::from_latest_at(resolver, results, None);

// TODO(#5607): what should happen if the promise is still pending?
let (front_status, back_status) = data.status();
Expand All @@ -114,7 +115,12 @@ impl RangeResultsExt for LatestAtResults {
resolver: &PromiseResolver,
) -> re_query::Result<RangeData<'a, C>> {
let results = self.get_or_empty(C::name());
let data = RangeData::from_latest_at(resolver, results);
// With latest-at semantics, we just want to join the secondary components onto the primary
// ones, irrelevant of their indices.
// In particular, it is pretty common to have a secondary component be more recent than the
// associated primary component in latest-at contexts, e.g. colors in an otherwise fixed
// point cloud being changed each frame.
let data = RangeData::from_latest_at(resolver, results, Some((TimeInt::MIN, RowId::ZERO)));

// TODO(#5607): what should happen if the promise is still pending?
let (front_status, back_status) = data.status();
Expand Down
Loading