#[non_exhaustive]pub struct SpriteItem {Show 22 fields
pub texture_id: Option<u64>,
pub positions: Vec<[f32; 3]>,
pub colours: Vec<[f32; 4]>,
pub sizes: Vec<f32>,
pub rotations: Vec<f32>,
pub uv_rects: Vec<[f32; 4]>,
pub default_colour: [f32; 4],
pub default_size: f32,
pub size_mode: SpriteSizeMode,
pub model: [[f32; 4]; 4],
pub depth_write: bool,
pub blend: SpriteBlend,
pub soft_particle_distance: Option<f32>,
pub soft_particle_distances: Vec<f32>,
pub refraction_strength: Option<f32>,
pub orientation: SpriteOrientation,
pub velocities: Vec<[f32; 3]>,
pub axis: [f32; 3],
pub lit: bool,
pub lit_params: SpriteLitParams,
pub normal_texture_id: Option<u64>,
pub settings: ItemSettings,
}Expand description
A batch of instanced billboard sprites rendered as camera-facing textured quads.
Each instance is one billboard at a world-space position. All instances in the batch share
one texture (or render as solid-colour quads when texture_id is None). Per-instance
colour, size, rotation, and atlas UV rect are specified via parallel Vec fields; empty
vecs fall back to the batch defaults.
§Particle effects
Submit a new SpriteItem each frame with updated positions and colours to animate
CPU-simulated particle effects. The host application owns simulation state (velocity,
lifetime, emission); the renderer only handles drawing.
§Texture atlases
Set uv_rects to select sub-regions of the texture per sprite, enabling flip-book
animation or mixed icon sets from a single atlas texture.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.texture_id: Option<u64>Texture ID from [ViewportGpuResources::upload_texture].
None renders solid-colour quads using colours / default_colour only.
positions: Vec<[f32; 3]>World-space positions, one per sprite instance.
colours: Vec<[f32; 4]>Per-instance RGBA colour tints. Empty = use default_colour for all.
Multiplied with the texture sample (or used directly when texture_id is None).
sizes: Vec<f32>Per-instance sizes. Empty = use default_size for all.
Interpretation depends on size_mode.
rotations: Vec<f32>Per-instance rotation angles in radians, CCW around the camera-forward axis. Empty = no rotation applied.
uv_rects: Vec<[f32; 4]>Per-instance UV rects [u0, v0, u1, v1] selecting atlas sub-regions.
Empty = full texture [0.0, 0.0, 1.0, 1.0] for all.
default_colour: [f32; 4]Fallback RGBA colour tint used when colours is empty. Default: opaque white.
default_size: f32Default size when sizes is empty. Pixels (ScreenSpace) or world units (WorldSpace).
size_mode: SpriteSizeModeWhether sizes are in screen-space pixels or world-space units.
model: [[f32; 4]; 4]World-space model transform applied to all positions. Default: identity.
depth_write: boolWhether this batch writes to the depth buffer. Default: false.
Set false for transparent or additive particle effects so sprites do not occlude
each other based on submission order. Set true for opaque world-space markers
that should participate in depth testing normally.
blend: SpriteBlendGPU blend state for this batch. Default: SpriteBlend::AlphaBlend.
soft_particle_distance: Option<f32>If Some(d), fades the sprite’s alpha as it approaches opaque scene geometry
behind it, over a distance of d world-space units. None disables soft fade.
Useful for transparent particles like smoke or fog to avoid hard intersection lines against walls and ground. Requires a sampleable scene depth resolve; see crate docs for current support status.
Used as the fallback when Self::soft_particle_distances is empty or shorter
than positions, or when a per-instance entry is zero.
soft_particle_distances: Vec<f32>Per-instance soft-fade distances, in world-space units. Lets a single batch
mix large smoke puffs (long fade) and small embers (short fade) without
splitting the draw. Empty falls back to Self::soft_particle_distance
for every instance; a zero entry falls back to the batch default as well.
refraction_strength: Option<f32>If Some(d), the sprite is drawn as a refractive distortion rather
than a normal alpha-blended billboard: the renderer samples the
already-resolved scene colour at an offset driven by the sprite’s
texture (red/green channels as signed displacement, alpha as mask)
and writes the distorted result back to the scene. d scales the
displacement in NDC pixels. Use for heat haze, shockwaves,
force-field hits, water-splash droplets.
Available on the HDR path only; the direct LDR paint_to cannot
resolve scene colour for sampling (same constraint as soft particles).
None disables refraction and the sprite draws normally.
orientation: SpriteOrientationHow each billboard is oriented in world space. Default
SpriteOrientation::CameraFacing matches the historical behaviour:
every quad turns to face the camera.
velocities: Vec<[f32; 3]>Per-instance velocity vectors. Used by
SpriteOrientation::VelocityStretched to align each quad’s long axis
with the projected motion direction. Empty disables stretching for that
instance (it falls back to a square camera-facing quad).
axis: [f32; 3]World-space axis used by SpriteOrientation::AxisLocked for the
quad’s long axis. Ignored in other orientation modes. Default
[0, 0, 1] (world up).
lit: boolWhen true, the batch runs through the lit sprite pipeline and
participates in the scene’s hemisphere ambient and direct lighting.
Default false preserves the emissive billboard look.
lit_params: SpriteLitParamsLighting parameters used when lit is true. Ignored otherwise.
normal_texture_id: Option<u64>Texture sampled as a tangent-space normal map when lit_params.normal_mode
is SpriteNormalMode::NormalMap. None falls back to the spherical
normal even when the mode requests a map.
settings: ItemSettingsPer-item render settings (visibility, appearance, pick identity, selection state).
Trait Implementations§
Source§impl Clone for SpriteItem
impl Clone for SpriteItem
Source§fn clone(&self) -> SpriteItem
fn clone(&self) -> SpriteItem
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SpriteItem
impl RefUnwindSafe for SpriteItem
impl Send for SpriteItem
impl Sync for SpriteItem
impl Unpin for SpriteItem
impl UnsafeUnpin for SpriteItem
impl UnwindSafe for SpriteItem
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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.