#[non_exhaustive]pub struct Hit<'d, D> {
pub exception: Option<Exception>,
pub surface: ColorBuf,
pub t_distance: Option<f64>,
pub block: &'d D,
pub position: Option<Position>,
}Expand description
Data passed by the raytracer to Accumulate::add() implementations.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.exception: Option<Exception>If Some, indicates that this hit denotes an exceptional situation rather than
an ordinary interaction of the ray with a block in the space.
surface: ColorBufContains the opacity/transmittance and the light output of the encountered surface, in the direction towards the camera.
This may also represent the ray traversing a thickness of transparent material when volume rendering is enabled, but it should be treated the same regardless.
t_distance: Option<f64>Distance along the ray at which the encountered surface was intersected.
This distance is in units of the length of the original ray’s direction vector. Therefore, when forming an image, whether this value is Euclidean distance from the camera, or distance along the Z axis, depends on whether the rays are constructed with a constant length or a constant Z component.
It is None when the event creating this hit does not correspond to a single
point in physical space, such as error indicators or 2D overlays.
block: &'d DRtBlockData value for the block this surface or volume is part of.
position: Option<Position>Which cube and voxel of the space the encountered surface belongs to,
or None if this is a special case without a definite position such as the sky or
an error report.
If a position in continuous space is desired, use t_distance and the original ray
to reconstruct it instead.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<'d, D> Freeze for Hit<'d, D>
impl<'d, D> RefUnwindSafe for Hit<'d, D>where
&'d D: RefUnwindSafe,
impl<'d, D> Send for Hit<'d, D>
impl<'d, D> Sync for Hit<'d, D>
impl<'d, D> Unpin for Hit<'d, D>
impl<'d, D> UnsafeUnpin for Hit<'d, D>where
&'d D: UnsafeUnpin,
impl<'d, D> UnwindSafe for Hit<'d, D>where
&'d D: UnwindSafe,
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>
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ConditionalSend for Twhere
T: Send,
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 more