Skip to content

Commit

Permalink
independent scenes and retiring Objects (#270)
Browse files Browse the repository at this point in the history
* preparing the field

* some more setup and decoupling text-entry UI from Objects

* decoupling tensor UI from Objects and fusing old & new

* decoupling 3D scenes from Objects

* moving view_text_entry over to new logical organization

* moving view_tensor over to new logical organization

* view2d: no more wildcard imports

* decoupling 2D scenes from Objects (part 1)

* TextEntry are now Objects-free end to end

* dont need em sticky objects no more

* Tensors are now Objects-free end to end

* Point3Ds are now Objects-free end to end

* InstanceHash::from_props => InstanceHash::from_path_and_index

* abstracting away object store retrieval

* random cleanups

* Box3Ds are now Objects-free end to end

* cleaning up the DataVec::as_vec situation

* Path3Ds are now Objects-free end to end + a lot segments cleanup

* LineSegments3D are now Objects-free end to end + related improvements

* Mesh3Ds are now Objects-free end to end + related improvements

* Arrow3Ds are now Objects-free end to end + related improvements

* keeping em warnings under control

* Tensor & TextEntry moving towards independent scenes

* start independentizing view_3d too

* tensor mapping UI now lives with the rest of its kind

* cleaning up view_3d's module situation

* Images are now Objects-free end to end

* BBox2Ds are now Objects-free end to end

* Point2Ds are now Objects-free end to end

* Legends/ClassDescr are now Objects-free, and Objects is gone for good

* plugging back legends into images

* bringing back data store benchmarks

* independent view_2d

* some more clean up

* bringing the tooltip back

* no need for this i guess

* scene cleanup and doc

* TODO hunting, cleanup....

* 2d: naming and making loading phase more digestible

* 2d: cleanup and document frame delay for hovering

* more fixes and TODO hunting

* 3d: naming and making loading phase more digestible

* tensor: naming and making loading phase more digestible

* text: naming and making loading phase more digestible

* bring back bench assertion

* last cleanup

* more profiling

* addressing PR comments
  • Loading branch information
teh-cmc authored Nov 8, 2022
1 parent c04d80d commit 53ff959
Show file tree
Hide file tree
Showing 40 changed files with 1,880 additions and 1,967 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 36 additions & 9 deletions crates/re_data_store/benches/obj_query_benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use criterion::{criterion_group, criterion_main, Criterion};

use itertools::Itertools;
use nohash_hasher::IntMap;
use re_data_store::*;
use re_data_store::{query::visit_type_data_3, *};
use re_log_types::*;

#[cfg(not(debug_assertions))]
Expand All @@ -23,16 +23,43 @@ fn timeline() -> Timeline {
Timeline::new("frame", TimeType::Sequence)
}

fn do_query<'s>(
obj_types: &IntMap<ObjTypePath, ObjectType>,
data_store: &'s DataStore,
) -> Objects<'s> {
#[allow(dead_code)]
#[derive(Clone, Copy)]
struct Point {
pos: [f32; 3],
color: Option<[u8; 4]>,
}

fn do_query(obj_types: &IntMap<ObjTypePath, ObjectType>, data_store: &DataStore) -> Vec<Point> {
let time_query = TimeQuery::LatestAt(NUM_FRAMES / 2);
let mut objects = Objects::default();
let timeline_store = data_store.get(&timeline()).unwrap();
objects.query(timeline_store, &time_query, obj_types);
assert_eq!(objects.point3d.len(), NUM_POINTS as usize);
objects

let mut points = Vec::new();

for (obj_path, obj_store) in timeline_store.iter() {
let _ = obj_types.get(obj_path.obj_type_path()).unwrap();
visit_type_data_3(
obj_store,
&FieldName::from("pos"),
&time_query,
("_visible", "color", "radius"),
|_instance_index: Option<&IndexHash>,
_time: i64,
_msg_id: &MsgId,
pos: &[f32; 3],
_visible: Option<&bool>,
color: Option<&[u8; 4]>,
_radius: Option<&f32>| {
points.push(Point {
pos: *pos,
color: color.cloned(),
});
},
);
}

assert_eq!(points.len(), NUM_POINTS as usize);
points
}

fn mono_data_messages() -> Vec<DataMsg> {
Expand Down
21 changes: 10 additions & 11 deletions crates/re_data_store/src/instance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::hash::Hash;

use re_log_types::{Index, IndexHash, ObjPath, ObjPathHash};

use crate::{DataStore, InstanceProps};
use crate::DataStore;

// ----------------------------------------------------------------------------

Expand All @@ -27,12 +27,12 @@ impl InstanceId {

/// Does this object match this instance id?
#[inline]
pub fn is_instance(&self, props: &InstanceProps<'_>) -> bool {
&self.obj_path == props.obj_path
pub fn is_instance(&self, obj_path: &ObjPath, instance_index: IndexHash) -> bool {
&self.obj_path == obj_path
&& if let Some(index) = &self.instance_index {
index.hash() == props.instance_index
index.hash() == instance_index
} else {
props.instance_index.is_none()
instance_index.is_none()
}
}

Expand Down Expand Up @@ -72,10 +72,10 @@ impl InstanceIdHash {
};

#[inline]
pub fn from_props(props: &InstanceProps<'_>) -> Self {
pub fn from_path_and_index(obj_path: &ObjPath, instance_index: IndexHash) -> Self {
Self {
obj_path_hash: *props.obj_path.hash(),
instance_index_hash: props.instance_index,
obj_path_hash: *obj_path.hash(),
instance_index_hash: instance_index,
}
}

Expand All @@ -93,8 +93,7 @@ impl InstanceIdHash {

/// Does this object match this instance id?
#[inline]
pub fn is_instance(&self, props: &InstanceProps<'_>) -> bool {
&self.obj_path_hash == props.obj_path.hash()
&& self.instance_index_hash == props.instance_index
pub fn is_instance(&self, obj_path: &ObjPath, instance_index: IndexHash) -> bool {
&self.obj_path_hash == obj_path.hash() && self.instance_index_hash == instance_index
}
}
2 changes: 0 additions & 2 deletions crates/re_data_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ mod instance;
pub mod log_db;
pub mod object_tree;
pub mod object_tree_properties;
pub mod objects;
pub mod query;
mod stores;

Expand All @@ -32,7 +31,6 @@ pub use instance::*;
pub use log_db::LogDb;
pub use object_tree::*;
pub use object_tree_properties::*;
pub use objects::*;
pub use stores::*;

use re_log_types::DataType;
Expand Down
Loading

0 comments on commit 53ff959

Please sign in to comment.