-
Notifications
You must be signed in to change notification settings - Fork 373
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
Finalize move of SpatialSpaceView to SpaceViewClass trait framework #2311
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
938e8c9
remove old ui scene
Wumpf b823cf4
remove annotations from old scene
Wumpf 0a87ff8
remove any_outlines from old scene
Wumpf 867be9f
remove old spatial scene types
Wumpf 5aaab97
make draw_data on `TypedScene` "a thing"
Wumpf 8b63278
fully decouple SpatialSpaceView
Wumpf 9d24ac8
fix up help text and ui for space origin
Wumpf e0904ad
doc fix
Wumpf cb71864
remove old ui_renderer_bridge
Wumpf b94bfaa
fix picking skipping everything but interactive object
Wumpf 23b1a12
fix entity property heuristics not being applied
Wumpf 4ba818c
fix bounding box for depth clouds
Wumpf c330c87
Merge remote-tracking branch 'origin/main' into andreas/traitify-spat…
Wumpf 7a5d7a6
lint fix
Wumpf 34cc532
rename to UnreachableTransformReason
Wumpf c9127f5
todo comment fixes
Wumpf f9d42be
Merge remote-tracking branch 'origin/main' into andreas/traitify-spat…
Wumpf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Interesting... this does feel a bit awkward. Need to think about how to clean it up when moving this over to the blueprint.
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.
yes, this one is weird. We should solve this differently. This was a shortcut I took because I couldn't figure how to do that better. I mean really if the picking code could just do a blueprint query this would be nicer!!
I'll leave a todo note with both our handles ;)