pub struct ParticleEmitter {Show 17 fields
pub asset_id: AssetId,
pub texture: Option<TextureHandle>,
pub position: [f32; 3],
pub direction: [f32; 3],
pub spread_deg: f32,
pub speed_min: f32,
pub speed_max: f32,
pub lifetime_min: f32,
pub lifetime_max: f32,
pub gravity: [f32; 3],
pub spawn_rate: f32,
pub max_particles: u32,
pub size_start: f32,
pub size_end: f32,
pub color_start: [f32; 4],
pub color_end: [f32; 4],
pub visible: bool,
}Expand description
A billboard particle emitter.
Particles spawn from position in a cone centred on direction (half-angle
spread_deg), with a speed drawn from [speed_min, speed_max] and a
lifetime from [lifetime_min, lifetime_max]. Over each particle’s life its
size interpolates from size_start to size_end and its colour from
color_start to color_end. Each particle is drawn as a camera-facing quad
textured by texture.
The pool holds max_particles particles; new ones spawn at spawn_rate per
second, reusing slots as old particles die.
ParticleEmitter {
position: [0.0, 1.0, 0.0],
direction: [0.0, 1.0, 0.0],
spread_deg: 25.0,
speed_min: 2.0,
speed_max: 5.0,
lifetime_min: 0.5,
..Default::default()
};Fields§
§asset_id: AssetIdAsset identity; injected via inject_name. Not part of args.
texture: Option<TextureHandle>Texture sampled per particle. None uses a white fallback so
the colour gradient still shows.
position: [f32; 3]World-space spawn origin.
direction: [f32; 3]Mean emission direction. The cone of width spread_deg is centred on
this vector. Normalised on load; a zero vector falls back to [0, 1, 0].
spread_deg: f32Cone half-angle in degrees around direction. 0 emits a straight
jet; 180 emits in all directions.
speed_min: f32Lower bound on initial speed (m/s). Floored at 0.
speed_max: f32Upper bound on initial speed (m/s). Lifted to at least speed_min.
lifetime_min: f32Lower bound on particle lifetime (seconds). Must be > 0.
lifetime_max: f32Upper bound on particle lifetime (seconds). Lifted to at least
lifetime_min.
gravity: [f32; 3]Constant acceleration applied to each particle, in world units per second squared.
spawn_rate: f32Particles spawned per second. 0 produces a one-shot burst that then
empties as particles age out.
max_particles: u32Maximum number of particles alive at once. Clamped to [1, 65536].
size_start: f32Billboard side length at spawn, in world units.
size_end: f32Billboard side length at death, in world units.
color_start: [f32; 4]Linear-space RGBA multiplier applied to the texture at spawn.
color_end: [f32; 4]Linear-space RGBA multiplier applied to the texture at death.
visible: boolWhen false the emitter is skipped each frame.
Trait Implementations§
Source§impl Clone for ParticleEmitter
impl Clone for ParticleEmitter
Source§fn clone(&self) -> ParticleEmitter
fn clone(&self) -> ParticleEmitter
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Component for ParticleEmitter
impl Component for ParticleEmitter
Source§const NAME: &'static str = "ParticleEmitter"
const NAME: &'static str = "ParticleEmitter"
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<ParticleEmitter, CnResult>
fn from_baked(bytes: &[u8]) -> Result<ParticleEmitter, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for ParticleEmitter
impl ComponentSlot for ParticleEmitter
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<ParticleEmitter>
fn slot(s: &ComponentStorage) -> &Column<ParticleEmitter>
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<ParticleEmitter>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<ParticleEmitter>
Source§impl Debug for ParticleEmitter
impl Debug for ParticleEmitter
Source§impl Default for ParticleEmitter
impl Default for ParticleEmitter
Source§fn default() -> ParticleEmitter
fn default() -> ParticleEmitter
Source§impl<'de> Deserialize<'de> for ParticleEmitterwhere
ParticleEmitter: Default,
impl<'de> Deserialize<'de> for ParticleEmitterwhere
ParticleEmitter: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParticleEmitter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ParticleEmitter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<ParticleEmitter> for ComponentAsset
impl From<ParticleEmitter> for ComponentAsset
Source§fn from(c: ParticleEmitter) -> ComponentAsset
fn from(c: ParticleEmitter) -> ComponentAsset
impl RuntimeComponent for ParticleEmitter
Source§impl Serialize for ParticleEmitter
impl Serialize for ParticleEmitter
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for ParticleEmitter
impl RefUnwindSafe for ParticleEmitter
impl Send for ParticleEmitter
impl Sync for ParticleEmitter
impl Unpin for ParticleEmitter
impl UnsafeUnpin for ParticleEmitter
impl UnwindSafe for ParticleEmitter
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().