pub struct Slot { /* private fields */ }Expand description
What one part of a mesh draws with: a material and its maps, over some of the mesh’s triangles.
A slot is a length, not a range.
Implementations§
Source§impl Slot
impl Slot
Sourcepub fn new(index_count: u32, material: Material) -> Self
pub fn new(index_count: u32, material: Material) -> Self
A slot drawn with material over a white default, for the next
index_count indices.
Sourcepub fn textured(self, texture: TextureData) -> Self
pub fn textured(self, texture: TextureData) -> Self
Samples this slot from texture, in place of the white default.
Sourcepub fn relief(self, relief: ReliefData) -> Self
pub fn relief(self, relief: ReliefData) -> Self
The relief is a texture map: RGB holds each texel’s normal, +Y up
the map, and A its depth where the relief declares one, 1.0 one
sprite width, half in front of the sprite and half behind.
Required if you want a surface lit by normals its own corners do not hold. A billboarded or upright draw reads the normal in the axes the camera turned; every other draw reads it through the derivative basis — the basis its own position and UV derivatives span — and ignores the depth. The relief is windowed like the color texture, so each sheet cell lines up with its own relief cell. A depth also decides what a billboarded or upright draw casts: a texel with no depth casts nothing, and depth under the sprite’s own texels, down to its foot, produces a shadow that starts at the ground it is drawn on.
Sourcepub fn shading(self, shading: ShadingData) -> Self
pub fn shading(self, shading: ShadingData) -> Self
The shading map holds each texel’s occlusion in R, its roughness in
G and its metallic in B. The roughness and metallic each scale the
slot’s own lane; the occlusion instead darkens what the texel takes
of the frame’s sky.
Required if you want the roughness, the metallic or the sky’s own light on one material to differ across the surface. Every light of the frame lands whole, whatever the occlusion holds.
Sourcepub fn emissive_map(self, emissive: TextureData) -> Self
pub fn emissive_map(self, emissive: TextureData) -> Self
The emissive map is the light this slot casts per texel, scaled by the material’s emissive color.
Required if you want part of a surface to cast light while the rest of it does not. A material casts none by default, so the map alone casts nothing.
Sourcepub fn index_count(&self) -> u32
pub fn index_count(&self) -> u32
The number of the mesh’s indices this slot covers.
Sourcepub fn texture(&self) -> Option<&TextureData>
pub fn texture(&self) -> Option<&TextureData>
The pixels this slot samples, absent while it is drawn over white.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Slot
impl RefUnwindSafe for Slot
impl Send for Slot
impl Sync for Slot
impl Unpin for Slot
impl UnsafeUnpin for Slot
impl UnwindSafe for Slot
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
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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