pub struct Atom {
pub color: Rgba,
pub emission: Rgb,
pub collision: BlockCollision,
}Expand description
Data of Primitive::Atom. The definition of a single block that has uniform
material properties rather than spatially varying ones; a single voxel.
All properties of an atom are intensive properties.
Fields§
§color: RgbaThe color exhibited by diffuse reflection from this block.
The RGB components of this color are the reflectance: the fraction of incoming light that is reflected rather than absorbed.
The alpha (α) component of this color specifies the opacity of this block, that is, the fraction of light that is reflected or absorbed rather than transmitted.
Whenever α is neither 1 nor 0 (and, trivially, in those cases too),
the reflectance and opacity
should be interpreted as being of a unit thickness of this material. Thus, they may be
modified by the length of material through which a light ray passes, either due to
viewing angle or due to using this block as a voxel in a Primitive::Recur.
This transformation is best understood in terms of transmittance T, defined as 1 − α. The transmittance of a given thickness of material, Td, is defined in terms of the transmittance of a unit thickness, T1, as:
Td = (T1)d.
Therefore,
αd = 1 − (1 − α1)d.
emission: RgbLight emitted (not reflected) by the block.
This quantity is the emitted portion of the luminance of this material, in unspecified units where 1.0 is the display white level (except for the effects of tone mapping). In the future this may be redefined in terms of a physical unit, but with the same dimensions.
Because we are describing a volume, not a surface, the physical
interpretation of this value depends on the opacity of the material.
If self.color.alpha() is 1.0, then this light escaping a surface must have been emitted at
the surface; if the alpha is 0.0, then it must have been emitted throughout the volume; and
in intermediate cases, then the light emitted within the volume must be greater per unit
volume to compensate for internal absorption. Still, these are not distinct cases but form
a continuum.
The emission Ed of a particular thickness d of this material is
Ed = E1 · ∫0d (T1)x dx
where E1 = self.emission and
T1 = 1.0 - self.color.alpha().
When integrated, this becomes
Ed = E1 · d
when α = 0 (T = 1) and
Ed = E1 · (Td - 1) / (T1 - 1)
otherwise.
collision: BlockCollisionThe effect on a Body of colliding with this block.
The default value is BlockCollision::Hard.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for Atom
impl<'arbitrary> Arbitrary<'arbitrary> for Atom
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Self from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary_take_rest(u: Unstructured<'arbitrary>) -> Result<Self>
Self from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Unstructured this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Unstructured this type
needs to construct itself. Read moreSource§impl VisitHandles for Atom
impl VisitHandles for Atom
Source§fn visit_handles(&self, _: &mut dyn HandleVisitor)
fn visit_handles(&self, _: &mut dyn HandleVisitor)
impl Eq for Atom
impl StructuralPartialEq for Atom
Auto Trait Implementations§
impl Freeze for Atom
impl RefUnwindSafe for Atom
impl Send for Atom
impl Sync for Atom
impl Unpin for Atom
impl UnwindSafe for Atom
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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