pub struct ParticleEmitter {
pub params: EmitterParams,
pub tex_scale_x: f32,
pub tex_scale_y: f32,
/* private fields */
}Expand description
Runtime particle emitter
Fields§
§params: EmitterParamsCurrent parameters from animation
tex_scale_x: f32Texture scale X (1 / rows)
tex_scale_y: f32Texture scale Y (1 / cols)
Implementations§
Source§impl ParticleEmitter
impl ParticleEmitter
Sourcepub fn new(m2_emitter: &M2ParticleEmitter) -> Self
pub fn new(m2_emitter: &M2ParticleEmitter) -> Self
Create a new particle emitter from parsed M2 data
Sourcepub fn bone_index(&self) -> u16
pub fn bone_index(&self) -> u16
Get the bone index this emitter is attached to
Sourcepub fn texture_index(&self) -> u16
pub fn texture_index(&self) -> u16
Get the texture index
Sourcepub fn blend_mode(&self) -> BlendMode
pub fn blend_mode(&self) -> BlendMode
Get the blend mode
Sourcepub fn particle_count(&self) -> usize
pub fn particle_count(&self) -> usize
Get the current number of particles
Sourcepub fn max_particles(&self) -> usize
pub fn max_particles(&self) -> usize
Get the maximum number of particles
Sourcepub fn update(
&mut self,
dt_ms: f32,
bone_transform: &[f32; 16],
bone_post_billboard: &[f32; 16],
)
pub fn update( &mut self, dt_ms: f32, bone_transform: &[f32; 16], bone_post_billboard: &[f32; 16], )
Update the emitter
§Arguments
dt_ms- Delta time in millisecondsbone_transform- 4x4 bone transform matrix (column-major)bone_post_billboard- 4x4 post-billboard transform matrix (column-major)
Sourcepub fn update_params(&mut self, params: EmitterParams)
pub fn update_params(&mut self, params: EmitterParams)
Update parameters from animation state
Call this before update() to sync animated parameters.
Sourcepub fn fill_texture_data(&self) -> Vec<f32>
pub fn fill_texture_data(&self) -> Vec<f32>
Fill texture data for GPU upload
Returns a Vec of f32 values in the format:
- Texel 0: position.xyz + 0.0
- Texel 1: color.rgba
- Texel 2: scale.xy + 0.0 + 0.0
- Texel 3: tex_coord.xy + 0.0 + 0.0
Trait Implementations§
Source§impl Clone for ParticleEmitter
impl Clone for ParticleEmitter
Source§fn clone(&self) -> ParticleEmitter
fn clone(&self) -> ParticleEmitter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ParticleEmitter
impl RefUnwindSafe for ParticleEmitter
impl Send for ParticleEmitter
impl Sync for ParticleEmitter
impl Unpin 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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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