Struct three_d::Particles [−][src]
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
Implementations
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]
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,
transformation: &Mat4,
camera: &Camera,
time: f32
) -> Result<(), Error>
[src]
&self,
program: &ParticlesProgram,
render_states: RenderStates,
viewport: Viewport,
transformation: &Mat4,
camera: &Camera,
time: f32
) -> Result<(), Error>
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.
Auto Trait Implementations
impl !RefUnwindSafe for Particles
impl !Send for Particles
impl !Sync for Particles
impl Unpin for Particles
impl UnwindSafe for Particles
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,