Expand description
Particle effect that can be rendered with any material.
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: Vec3The acceleration applied to all particles. Default is gravity.
time: f32A time variable that should be updated each frame.
Implementations
sourceimpl Particles
impl Particles
sourcepub fn new(context: &Context, cpu_mesh: &CPUMesh) -> ThreeDResult<Self>
pub fn new(context: &Context, cpu_mesh: &CPUMesh) -> ThreeDResult<Self>
Creates a new set of particles with geometry defined by the given cpu mesh.
sourcepub fn update(&mut self, data: &[ParticleData])
pub fn update(&mut self, data: &[ParticleData])
Updates the particles with the given initial data. The list contain one entry for each particle.
Trait Implementations
sourceimpl Geometry for Particles
impl Geometry for Particles
sourcefn aabb(&self) -> AxisAlignedBoundingBox
fn aabb(&self) -> AxisAlignedBoundingBox
Returns the AxisAlignedBoundingBox for this geometry. Read more
sourcefn transformation(&self) -> Mat4
fn transformation(&self) -> Mat4
Returns the local to world transformation applied to this geometry. Read more
sourceimpl GeometryMut for Particles
impl GeometryMut for Particles
sourcefn set_transformation(&mut self, transformation: Mat4)
fn set_transformation(&mut self, transformation: Mat4)
Set the local to world transformation applied to this geometry. Read more
sourceimpl Shadable for Particles
impl Shadable for Particles
sourcefn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
fn render_with_material(
&self,
material: &dyn Material,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
Render the object with the given material. Must be called in a render target render function, for example in the callback function of Screen::write. You can use Lights::default() if you know the material does not require lights. Read more
sourcefn render_forward(
&self,
material: &dyn Material,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
fn render_forward(
&self,
material: &dyn Material,
camera: &Camera,
lights: &Lights
) -> ThreeDResult<()>
use render_with_material instead
Render the object with the given material. Must be called in a render target render function, for example in the callback function of Screen::write. You can use Lights::default() if you know the material does not require lights. Read more
sourcefn render_deferred(
&self,
_material: &DeferredPhysicalMaterial,
_camera: &Camera,
_viewport: Viewport
) -> ThreeDResult<()>
fn render_deferred(
&self,
_material: &DeferredPhysicalMaterial,
_camera: &Camera,
_viewport: Viewport
) -> ThreeDResult<()>
Render the geometry and surface material parameters of the object. Should usually not be called directly but used in DeferredPipeline::geometry_pass. Read more
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcepub fn borrow_mut(&mut self) -> &mut T
pub fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more