pub struct ImageSprite {
pub image: ImageId,
pub origin: [f32; 3],
pub facing: ImageFacing,
pub size: [f32; 2],
pub tint: u32,
pub alpha_cutoff: f32,
pub depth_test: bool,
pub double_sided: bool,
}Expand description
One placed 2D image sprite for the current frame: a flat textured
quad in world space, composited over the rendered scene with the
frame’s depth buffer (so the voxel model can occlude it). Built per
frame and passed to SceneRenderer::draw_images, mirroring
Line3 / SceneRenderer::draw_lines. The texture is uploaded
once via SceneRenderer::upload_image and referenced by image.
Fields§
§image: ImageIdThe uploaded texture to draw (from SceneRenderer::upload_image).
origin: [f32; 3]World position of the quad’s top-left corner — the image’s
(column 0, row 0) texel. The quad extends size[0] along the
facing’s u and size[1] along its v.
facing: ImageFacingWorld orientation of the quad — fixed in world or camera-facing.
size: [f32; 2]World size of the quad along u and v. For pixel-art traced at
1 texel = 1 voxel, pass [width as f32, height as f32].
tint: u32Multiplied into every sampled texel (tint + opacity), 0xAARRGGBB.
0xFFFFFFFF draws the texture unchanged; the high byte scales
the texel alpha (e.g. 0x80FFFFFF = 50 % opacity).
alpha_cutoff: f32Alpha cutoff in 0.0..=1.0. Texels whose own alpha is below
this are discarded outright (not blended) — crisp pixel-art edges
instead of a semi-transparent haze, and the same threshold decides
what SceneRenderer::pick_image treats as solid. 0.0 keeps the
plain straight-alpha over-blend (every non-zero texel draws).
depth_test: booltrue: occluded by nearer rendered geometry (depth-tested against
the frame’s depth buffer, with a bias so a quad resting on a
coincident voxel face doesn’t z-fight). false: always on top.
double_sided: booltrue: draw regardless of which way the quad faces (no backface
cull) — what reference images usually want. false: cull when the
quad faces away from the camera. Ignored for
ImageFacing::Billboard (it always faces the camera).
Trait Implementations§
Source§impl Clone for ImageSprite
impl Clone for ImageSprite
Source§fn clone(&self) -> ImageSprite
fn clone(&self) -> ImageSprite
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 ImageSprite
Source§impl Debug for ImageSprite
impl Debug for ImageSprite
Source§impl PartialEq for ImageSprite
impl PartialEq for ImageSprite
Source§fn eq(&self, other: &ImageSprite) -> bool
fn eq(&self, other: &ImageSprite) -> bool
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ImageSprite
Auto Trait Implementations§
impl Freeze for ImageSprite
impl RefUnwindSafe for ImageSprite
impl Send for ImageSprite
impl Sync for ImageSprite
impl Unpin for ImageSprite
impl UnsafeUnpin for ImageSprite
impl UnwindSafe for ImageSprite
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,
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