pub struct ViewCutout {
pub focus_world: [f32; 3],
pub radius_px: f32,
pub feather_px: f32,
pub margin: f32,
pub z_bias: f32,
}Expand description
OC.0 — a camera-relative “keyhole” through front geometry (stage
OC). A cell is hidden iff ALL of: its centre lies inside the view
cone that radius_px subtends around the
eye→focus_world axis (the reveal distance
tapers to zero across the feather band, closing the hole into a
smooth funnel), it is closer to the eye than the nearest point of
the character column at its own height minus
margin, and its grid-local z is above the focus
plane (walls cut; the floor in front of the character stays).
The facade derives everything per frame inside the render call —
the pixel radius converts to a cone angle under the frame’s own
projection, so the circle stays put under fixed-res / SSAA
(radius_px / feather_px are given in logical pixels; the
angles are resolution-invariant).
Fields§
§focus_world: [f32; 3]World-space focus point the keyhole opens around (typically the controlled character’s chest/head). Projected each frame; a focus at/behind the near plane disables the cutout that frame.
radius_px: f32Keyhole radius in logical (post-resolve) pixels — the OUTER edge; nothing is cut past it.
feather_px: f32Width of the radial taper band INSIDE the radius, logical
pixels: the reveal distance scales linearly from full at
radius − feather to zero at radius, so the keyhole’s rim is
a deterministic geometric funnel (no dither — a stochastic edge
read as a noise mosaic on every surface it crossed). Wider =
softer, more conical rim. <= 0 gives a hard edge.
margin: f32Reveal margin, world units: how far short of the character
COLUMN the cut stops. The reveal surface hugs the column — the
vertical segment at the focus xy between the focus plane (the
feet) and its mirror above the focus (the head) — so an
obstacle the character stands right behind melts down to the
boots; margin keeps a thin shell around the body un-cut.
z_bias: f32Focus-plane bias, world units along grid-local z (z-down: positive lowers the cutting plane, hiding more; negative raises it). Tune so doorway lintels cut while the character’s floor stays.
Implementations§
Source§impl ViewCutout
impl ViewCutout
Sourcepub fn new(focus_world: [f32; 3]) -> Self
pub fn new(focus_world: [f32; 3]) -> Self
A keyhole with the Boarding demo’s tune around focus_world
(radius 110 px, feather 24 px, margin 1.5), with the cutting
plane placed just BELOW the focus (z_bias +0.5) — so pass a
focus near the character’s FEET and the plane lands at floor
level, cutting front walls down to the boots while the floor
stays. Focusing the chest instead needs a positive z_bias of
the chest-to-feet distance (the demo: chest focus, bias +6.5);
the original head-level plane left waist-high wall stumps in
front of the character.
Trait Implementations§
Source§impl Clone for ViewCutout
impl Clone for ViewCutout
Source§fn clone(&self) -> ViewCutout
fn clone(&self) -> ViewCutout
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ViewCutout
Source§impl Debug for ViewCutout
impl Debug for ViewCutout
Source§impl PartialEq for ViewCutout
impl PartialEq for ViewCutout
impl StructuralPartialEq for ViewCutout
Auto Trait Implementations§
impl Freeze for ViewCutout
impl RefUnwindSafe for ViewCutout
impl Send for ViewCutout
impl Sync for ViewCutout
impl Unpin for ViewCutout
impl UnsafeUnpin for ViewCutout
impl UnwindSafe for ViewCutout
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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 more