pub struct AmbientParticlesConfig {
pub enabled: bool,
pub count: u32,
pub volume_radius: f32,
pub size_range: (f32, f32),
pub color: Color,
pub shape: AmbientParticleShape,
pub edge_fade: f32,
pub drift_speed: f32,
pub seed: u32,
}Expand description
Controls the ambient particles drawn by AmbientParticlesPlugin.
Insert a customized instance before or after adding the plugin; the plugin
only initializes the resource when the game has not inserted one. Changes
made at runtime are applied on the next frame: the pool grows or shrinks to
count, and the shared mesh and material follow shape and color.
Values that cannot be used (a non-finite or non-positive volume_radius,
a zero count, enabled: false) produce no particles instead of an error.
Fields§
§enabled: boolWhether particles are shown. When false the pool is emptied.
Default: true.
count: u32Number of pooled particle entities.
The particles are spread over the cube that bounds the volume and only
the ones inside the sphere are visible, so on average a little over
half of them are visible at once. Default: 96.
volume_radius: f32Radius of the sphere around the viewer in which particles are visible, in world units.
Default: 24.0.
size_range: (f32, f32)Smallest and largest particle size, in world units.
Each particle gets a fixed size between the two values. The order of
the two values does not matter. Default: (0.03, 0.08).
color: ColorBase color of the shared unlit material.
A color with alpha below 1 is drawn with alpha blending. Default: opaque white.
shape: AmbientParticleShapeMesh shared by all particles. Default: AmbientParticleShape::Cube.
edge_fade: f32Fraction of volume_radius, from the surface of the sphere inward,
over which particles shrink to nothing.
Clamped to 0.0..=1.0. With 0.0 particles keep their full size up
to the surface and disappear there. Default: 0.25.
drift_speed: f32Speed, in world units per second, at which each particle drifts along its own fixed direction.
0.0 keeps particles at rest in the world, so they only appear to
move when the viewer moves. Default: 0.0.
seed: u32Seed of the particle field. Two configs that differ only in the seed place their particles differently.
Default: 0.
Implementations§
Source§impl AmbientParticlesConfig
impl AmbientParticlesConfig
Sourcepub fn active_count(&self) -> u32
pub fn active_count(&self) -> u32
Number of particles the pool should hold for this configuration.
Returns 0 when the config is disabled or its volume_radius is not
a finite positive number; otherwise returns count.
use voxel_framework::particles::AmbientParticlesConfig;
let config = AmbientParticlesConfig::default();
assert_eq!(config.active_count(), config.count);
let disabled = AmbientParticlesConfig {
enabled: false,
..Default::default()
};
assert_eq!(disabled.active_count(), 0);Trait Implementations§
Source§impl Clone for AmbientParticlesConfig
impl Clone for AmbientParticlesConfig
Source§impl Debug for AmbientParticlesConfig
impl Debug for AmbientParticlesConfig
Source§impl Default for AmbientParticlesConfig
impl Default for AmbientParticlesConfig
Source§impl PartialEq for AmbientParticlesConfig
impl PartialEq for AmbientParticlesConfig
impl Resource for AmbientParticlesConfig
impl StructuralPartialEq for AmbientParticlesConfig
Auto Trait Implementations§
impl !RefUnwindSafe for AmbientParticlesConfig
impl !UnwindSafe for AmbientParticlesConfig
impl Forget for AmbientParticlesConfig
impl Freeze for AmbientParticlesConfigwhere
*const ArcInner<StrongHandle> is !null: Freeze,
PhantomData<ArcInner<StrongHandle>>: Freeze,
PhantomData<fn() -> Mesh>: Freeze,
impl Move for AmbientParticlesConfig
impl Send for AmbientParticlesConfig
impl Sync for AmbientParticlesConfig
impl Unpin for AmbientParticlesConfig
impl UnsafeUnpin for AmbientParticlesConfigwhere
*const ArcInner<StrongHandle> is !null: UnsafeUnpin,
PhantomData<ArcInner<StrongHandle>>: UnsafeUnpin,
PhantomData<fn() -> Mesh>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
Source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U
T ShaderType for self. When used in AsBindGroup
derives, it is safe to assume that all images in self exist.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> ConditionalSend for Twhere
T: Send,
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
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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
Source§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates Self using default().
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
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