pub struct Volume {
pub shader: Arc<str>,
pub params: [f32; 32],
}Expand description
An app’s shader that draws inside a mesh: each pixel the mesh covers asks it what the camera’s ray through the pixel meets.
shader is WGSL that defines
fn volume(eye: vec3<f32>, direction: vec3<f32>, entry: f32, exit: f32, footprint: f32) -> VolumeHitin the mesh’s own coordinates: the eye; the ray’s direction, of length
one; how far along the ray it enters the mesh’s bounds, zero for an eye
inside them, and leaves the mesh; and how wide a pixel is, in radians.
It returns a VolumeHit: the colour, premultiplied, nothing at an alpha
of zero; and the point the ray met, which sets the pixel’s depth.
volume_param(index) reads params[index], volume_content(uv) the
surface’s content and volume_light() the scene’s light, in the mesh’s
coordinates. The renderer puts
MESH_VOLUME_PRELUDE_WGSL,
which declares them, before it. The mesh’s normals must point out of it.
Fields§
§shader: Arc<str>The app’s WGSL. Keep one Arc per shader: the renderer builds a
pipeline for each.
params: [f32; 32]The values the shader reads.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Volume
impl RefUnwindSafe for Volume
impl Send for Volume
impl Sync for Volume
impl Unpin for Volume
impl UnsafeUnpin for Volume
impl UnwindSafe for Volume
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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