Expand description
§berdicles
Expressive CPU particle system for the bevy engine.
§Feature Set
- Instancing based CPU particles.
- Expressive trait based particles.
- Particles as emitters.
- Particles trails.
- Particle events.
- Billboard particles.
Non-features
- GPU simulation.
- SIMD and similar optimizations.
Basically the crates trades some potential optimizations for expressiveness.
§Getting Started
Add a ParticleSystemBundle, which is a MaterialMeshBundle with a ParticleInstance.
- Huh?
First we need to add ParticleMaterialPlugin, not MaterialPlugin, which sets up a different render pipeline.
This uses the mesh as the particle shape and the shader for instancing. The StandardParticle is already setup
in this crate, but you can define your own Material by referencing this shader’s source code.
To create a ParticleInstance we need a ParticleSystem trait implementor and a Particle that it spawns.
§Sub-particle Systems
SubParticleSystem uses a parent particle system’s particles as spawners.
- Add
ParticleParent(Entity)to point to a parent - Add the downcast function
as_sub_particle_systemto yourParticleSystemimplementation.
Yes you can chain these infinitely.
§Event Particle Systems
EventParticleSystem can listen to events like particle despawning or colliding and spawn particles on events.
- Add
ParticleParent(Entity)to point to a parent - Add
ParticleEventBufferto the parent to record these events, - Add the downcast function
as_event_particle_systemto yourParticleSystemimplementation.
§Trail Rendering
We can render trails behind particles as mesh.
- Implement
TrailedParticleon your particle. - Add
on_update,detach_sliceandas_trail_particle_systemto yourParticleSystemimplementation. - Add
TrailMeshOf(Entity)to aMaterialMeshBundleto render them.
§Versions
| bevy | berdicles |
|---|---|
| 0.14 | latest |
§License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
§Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Modules§
- Shader module for
berdicles. - Module for rendering trails.
- Utility for implementing particles.
Structs§
- Marker component that selects
Camerafor billboard rendering. - Add to a
ParticleSystemBundleto make it always face the camera. Materialthat displays useful debug info of a particle.- Instance buffer of a particle.
- Type erased buffer for particles.
- Event and data on an individual particle.
- A buffer of particle events. If added to a particle bundle, will record particle events happened in this frame. Also enables
EventParticleSystem. - Component form of a type erased
ParticleSystem. - Add particle rendering pipeline for a
Material. - Parent of the particle, if present will read data/event from the parent’s particle buffer.
- Plugin for
berdicle. - A Bundle of a particle system.
- A domain specific data structure for implementing
TrailBuffer.
Enums§
- If and how a particle has expired.
- Strategy for cleaning up particle buffers.
- Type of particle buffer.
- Event on individual particle.
Traits§
- Type erased
EventParticleSystem. - Type erased version of
ParticleSystem. - An erased
SubParticleSystem. - A
ParticleSystemthat spawns particles on parent’s emitted events. - A particle spawner type.
- A
ParticleSystemthat spawns particles from a parentParticleSystem’s alive particles.
Functions§
- System for calculating billboard orientation.
- The main system of
berdicle, runs inUpdate.