Struct three_d::object::Particles [−][src]
pub struct Particles { pub acceleration: Vec3, pub cull: CullType, pub transformation: Mat4, // some fields omitted }
Expand description
Particle effect with fixed vertex shader and customizable fragment shader (see also ParticlesProgram).
Each particle is initialised with a position and velocity using the update function and a global acceleration.
Then when time passes, their position is updated based on
new_position = start_position + start_velocity * time + 0.5 * acceleration * time * time
Fields
acceleration: Vec3
cull: CullType
transformation: Mat4
Implementations
impl Particles
[src]
impl Particles
[src]pub fn new(
context: &Context,
cpu_mesh: &CPUMesh,
acceleration: &Vec3
) -> Result<Self, Error>
[src]
context: &Context,
cpu_mesh: &CPUMesh,
acceleration: &Vec3
) -> Result<Self, Error>
pub fn update(&mut self, data: &[ParticleData])
[src]
pub fn update(&mut self, data: &[ParticleData])
[src]Updates the particles with the given initial data. The list contain one entry for each particle.
pub fn render(
&self,
program: &ParticlesProgram,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera,
time: f32
) -> Result<(), Error>
[src]
pub fn render(
&self,
program: &ParticlesProgram,
render_states: RenderStates,
viewport: Viewport,
camera: &Camera,
time: f32
) -> Result<(), Error>
[src]Render all defined particles with the given ParticlesProgram. Must be called in a render target render function, for example in the callback function of Screen::write. The transformation can be used to position, orientate and scale the particles.