Struct three_d::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: Vec3cull: CullTypetransformation: Mat4

Implementations

impl Particles[src]

pub fn new(
    context: &Context,
    cpu_mesh: &CPUMesh,
    acceleration: &Vec3
) -> Result<Self, Error>
[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]

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

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]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.