Struct re_space_view_spatial::picking::PickingContext
source · pub struct PickingContext {
pub pointer_in_ui: Vec2,
pub pointer_in_pixel: Vec2,
pub pointer_in_camera_plane: Vec2,
pub camera_plane_from_ui: RectTransform,
pub ray_in_world: Ray3,
}
Expand description
Picking context in which picking is performed.
Fields§
§pointer_in_ui: Vec2
Cursor position in the UI coordinate system.
pointer_in_pixel: Vec2
Cursor position on the renderer canvas in pixels.
pointer_in_camera_plane: Vec2
Cursor position in the UI coordinates after panning & zooming.
As of writing, for 3D spaces this is equal to Self::pointer_in_ui
,
since we don’t allow panning & zooming after perspective projection.
camera_plane_from_ui: RectTransform
Transforms ui coordinates to “ui-camera-plane-coordinates” Ui camera plane coordinates are ui coordinates that have been panned and zoomed.
See also Self::pointer_in_camera_plane
.
ray_in_world: Ray3
The picking ray used. Given in the coordinates of the space the picking is performed in.
Implementations§
source§impl PickingContext
impl PickingContext
sourcepub const UI_INTERACTION_RADIUS: f32 = 5f32
pub const UI_INTERACTION_RADIUS: f32 = 5f32
Radius in which cursor interactions may snap to the nearest object even if the cursor does not hover it directly.
Note that this needs to be scaled when zooming is applied by the virtual->visible ui rect transform.
sourcepub fn new(
pointer_in_ui: Pos2,
camera_plane_from_ui: RectTransform,
pixels_per_point: f32,
eye: &Eye
) -> Self
pub fn new( pointer_in_ui: Pos2, camera_plane_from_ui: RectTransform, pixels_per_point: f32, eye: &Eye ) -> Self
Creates a new PickingContext
for executing picking operations and providing
information about the picking ray & general circumstances.
sourcepub fn pick<'a>(
&self,
render_ctx: &RenderContext,
gpu_readback_identifier: GpuReadbackIdentifier,
previous_picking_result: &Option<PickingResult>,
images: impl Iterator<Item = &'a PickableTexturedRect>,
ui_rects: &[PickableUiRect]
) -> PickingResult
pub fn pick<'a>( &self, render_ctx: &RenderContext, gpu_readback_identifier: GpuReadbackIdentifier, previous_picking_result: &Option<PickingResult>, images: impl Iterator<Item = &'a PickableTexturedRect>, ui_rects: &[PickableUiRect] ) -> PickingResult
Performs picking for a given scene.
Auto Trait Implementations§
impl Freeze for PickingContext
impl RefUnwindSafe for PickingContext
impl Send for PickingContext
impl Sync for PickingContext
impl Unpin for PickingContext
impl UnwindSafe for PickingContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request