-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finalize move of SpatialSpaceView to SpaceViewClass trait framework (#…
…2311) <!-- Open the PR up as a draft until you feel it is ready for a proper review. Do not make PR:s from your own `main` branch, as that makes it difficult for reviewers to add their own fixes. Add any improvements to the branch as new commits to make it easier for reviewers to follow the progress. All commits will be squashed to a single commit once the PR is merged into `main`. Make sure you mention any issues that this PR closes in the description, as well as any other related issues. To get an auto-generated PR description you can put "copilot:summary" or "copilot:walkthrough" anywhere. --> ### What This fully decouples all `SpatialSpaceView` code from the rest of the project. The only thing exported by `re_space_view_spatial` is now the `SpatialSpaceView` type itself which is registered on space view startup. <img width="775" alt="image" src="https://github.com/rerun-io/rerun/assets/1220815/b2af26c8-b770-48f8-9d54-e064c4ce66b6"> In order to accomplish this, some of the interfaces of `SpaceViewClass` needed to be widened a bit. It would be nice to retract some of that in the future, in particular around object properties and object property defaults which should be handled by the blueprint. ### Checklist * [x] I have read and agree to [Contributor Guide](https://github.com/rerun-io/rerun/blob/main/CONTRIBUTING.md) and the [Code of Conduct](https://github.com/rerun-io/rerun/blob/main/CODE_OF_CONDUCT.md) * [x] I've included a screenshot or gif (if applicable) <!-- This line will get updated when the PR build summary job finishes. --> PR Build Summary: https://build.rerun.io/pr/2311 <!-- pr-link-docs:start --> Docs preview: https://rerun.io/preview/f9d42be/docs <!-- pr-link-docs:end -->
- Loading branch information
Showing
48 changed files
with
829 additions
and
828 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#[derive(Clone, Copy)] | ||
pub enum UnreachableTransformReason { | ||
/// `SpaceInfoCollection` is outdated and can't find a corresponding space info for the given path. | ||
/// | ||
/// If at all, this should only happen for a single frame until space infos are rebuilt. | ||
UnknownSpaceInfo, | ||
|
||
/// More than one pinhole camera between this and the reference space. | ||
NestedPinholeCameras, | ||
|
||
/// Exiting out of a space with a pinhole camera that doesn't have a resolution is not supported. | ||
InversePinholeCameraWithoutResolution, | ||
|
||
/// Unknown transform between this and the reference space. | ||
DisconnectedSpace, | ||
} | ||
|
||
impl std::fmt::Display for UnreachableTransformReason { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
f.write_str(match self { | ||
Self::UnknownSpaceInfo => | ||
"Can't determine transform because internal data structures are not in a valid state. Please file an issue on https://github.com/rerun-io/rerun/", | ||
Self::NestedPinholeCameras => | ||
"Can't display entities under nested pinhole cameras.", | ||
Self::DisconnectedSpace => | ||
"Can't display entities that are in an explicitly disconnected space.", | ||
Self::InversePinholeCameraWithoutResolution => | ||
"Can't display entities that would require inverting a pinhole camera without a specified resolution.", | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
use egui::Color32; | ||
use re_data_store::EntityPath; | ||
use re_log_types::InstanceKey; | ||
use re_renderer::LineStripSeriesBuilder; | ||
|
||
const AXIS_COLOR_X: Color32 = Color32::from_rgb(255, 25, 25); | ||
const AXIS_COLOR_Y: Color32 = Color32::from_rgb(0, 240, 0); | ||
const AXIS_COLOR_Z: Color32 = Color32::from_rgb(80, 80, 255); | ||
|
||
pub fn add_axis_lines( | ||
line_builder: &mut LineStripSeriesBuilder, | ||
transform: macaw::IsoTransform, | ||
ent_path: Option<&EntityPath>, | ||
axis_length: f32, | ||
) { | ||
use re_renderer::renderer::LineStripFlags; | ||
|
||
// TODO(andreas): It would be nice if could display the semantics (left/right/up) as a tooltip on hover. | ||
let line_radius = re_renderer::Size::new_scene(axis_length * 0.05); | ||
let origin = transform.translation(); | ||
|
||
let mut line_batch = | ||
line_builder | ||
.batch("origin axis") | ||
.picking_object_id(re_renderer::PickingLayerObjectId( | ||
ent_path.map_or(0, |p| p.hash64()), | ||
)); | ||
let picking_instance_id = re_renderer::PickingLayerInstanceId(InstanceKey::SPLAT.0); | ||
|
||
line_batch | ||
.add_segment( | ||
origin, | ||
origin + transform.transform_vector3(glam::Vec3::X) * axis_length, | ||
) | ||
.radius(line_radius) | ||
.color(AXIS_COLOR_X) | ||
.flags( | ||
LineStripFlags::FLAG_COLOR_GRADIENT | ||
| LineStripFlags::FLAG_CAP_END_TRIANGLE | ||
| LineStripFlags::FLAG_CAP_START_ROUND, | ||
) | ||
.picking_instance_id(picking_instance_id); | ||
line_batch | ||
.add_segment( | ||
origin, | ||
origin + transform.transform_vector3(glam::Vec3::Y) * axis_length, | ||
) | ||
.radius(line_radius) | ||
.color(AXIS_COLOR_Y) | ||
.flags( | ||
LineStripFlags::FLAG_COLOR_GRADIENT | ||
| LineStripFlags::FLAG_CAP_END_TRIANGLE | ||
| LineStripFlags::FLAG_CAP_START_ROUND, | ||
) | ||
.picking_instance_id(picking_instance_id); | ||
line_batch | ||
.add_segment( | ||
origin, | ||
origin + transform.transform_vector3(glam::Vec3::Z) * axis_length, | ||
) | ||
.radius(line_radius) | ||
.color(AXIS_COLOR_Z) | ||
.flags( | ||
LineStripFlags::FLAG_COLOR_GRADIENT | ||
| LineStripFlags::FLAG_CAP_END_TRIANGLE | ||
| LineStripFlags::FLAG_CAP_START_ROUND, | ||
) | ||
.picking_instance_id(picking_instance_id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
crates/re_space_view_spatial/src/scene/contexts/non_interactive_entities.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use nohash_hasher::IntSet; | ||
use re_log_types::EntityPathHash; | ||
use re_viewer_context::SceneContextPart; | ||
|
||
/// List of all non-interactive entities for lookup during picking evaluation. | ||
/// | ||
/// TODO(wumpf/jleibs): This is a temporary solution until the picking code can query propagated blueprint properties directly. | ||
#[derive(Default)] | ||
pub struct NonInteractiveEntities(pub IntSet<EntityPathHash>); | ||
|
||
impl SceneContextPart for NonInteractiveEntities { | ||
fn archetypes(&self) -> Vec<re_viewer_context::ArchetypeDefinition> { | ||
Vec::new() | ||
} | ||
|
||
fn populate( | ||
&mut self, | ||
_ctx: &mut re_viewer_context::ViewerContext<'_>, | ||
query: &re_viewer_context::SceneQuery<'_>, | ||
_space_view_state: &dyn re_viewer_context::SpaceViewState, | ||
) { | ||
re_tracing::profile_function!(); | ||
|
||
self.0 = query | ||
.entity_props_map | ||
.iter() | ||
.filter_map(|(entity_path, props)| { | ||
if props.interactive { | ||
None | ||
} else { | ||
Some(entity_path.hash()) | ||
} | ||
}) | ||
.collect(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
11ece53
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'Rust Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
1.25
.mono_points_arrow_batched/encode_log_msg
619210
ns/iter (± 9879
)411995
ns/iter (± 1792
)1.50
batch_points_arrow/encode_log_msg
112881
ns/iter (± 2222
)56372
ns/iter (± 142
)2.00
This comment was automatically generated by workflow using github-action-benchmark.