Byte Engine Docs
View on docs.rs

particles

Generated Rust API reference for byte_engine.

byte_engine / rendering / particles


Module particles

GPU-simulated particle systems.

A particle system is a .particles asset: a list of data modules that baking turns into a simulation kernel and a draw pipeline. Particles live and move entirely on the GPU: the CPU only says how many to spawn and where, and the GPU sizes its own simulation and draw with indirect commands. Install the runtime with crate::application::graphics::setup_particles, then create a ParticleEmitter with a crate::gameplay::Transform through the world.

Quick Reference

ItemKindDescription
ParticleEmitterstruct
ParticleManagerstruct

Structs

ParticleEmitter

struct ParticleEmitter {
    pub system: String,
    pub rate: Option<f32>,
    pub burst: Option<u32>,
}

Defined in crates/byte-engine/src/rendering/particles/emitter.rs:18-25

The ParticleEmitter struct places a source of one particle system in the world, such as a grinder throwing sparks or a chimney trailing smoke.

Create one through crate::core::factory::Creator::create together with a crate::gameplay::Transform. The transform moves, turns, and scales the system's spawn modules, so a cone fires along the transform's local +Z axis. Publish a new value with crate::core::factory::Factory::derive on the same handle to change it, and delete the handle to stop it; particles already in flight finish their lives.

use byte_engine::rendering::ParticleEmitter;
let grinder = ParticleEmitter::new("byte-engine/particles/sparks.particles");
let hit = ParticleEmitter { rate: Some(0.0), burst: Some(60), ..grinder.clone() };

Fields

  • system: String

    The ID of the .particles asset this emitter spawns.

  • rate: Option<f32>

    Particles spawned per second, or None for the system's spawn.rate.

  • burst: Option<u32>

    Particles spawned once each time this value is published, or None for the system's spawn.burst.

Implementations

  • fn new(system: impl Into<String>) -> Self

    Creates an emitter that spawns system at the rate and burst its asset sets.

Trait Implementations

impl ArchivePointee for ParticleEmitter
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ParticleEmitter
impl Clone for ParticleEmitter
impl Debug for ParticleEmitter
  • fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result
impl Downcast for ParticleEmitter
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for ParticleEmitter
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Inspectable for ParticleEmitter
  • fn as_string(&self) -> String
impl Instrument for ParticleEmitter
impl LayoutRaw for ParticleEmitter
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ParticleEmitter
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl PartialEq for ParticleEmitter
impl Pointee for ParticleEmitter
  • type Metadata = ()
impl Read for ParticleEmitter
impl StructuralPartialEq for ParticleEmitter
impl WithSubscriber for ParticleEmitter

ParticleManager

struct ParticleManager {
    // [REDACTED: Private Fields]
}

Defined in crates/byte-engine/src/rendering/particles/manager.rs:36-52

The ParticleManager struct runs every particle system the world's emitters use: it loads each .particles system once, turns emitters into spawn requests, and records the GPU simulation and draw for every camera.

Register it after the scene pipeline whose main color and depth it draws into, through crate::application::graphics::setup_particles. Emitters arrive as ParticleEmitter creations on the world it was built from.

Trait Implementations

impl ArchivePointee for ParticleManager
  • type ArchivedMetadata = ()
  • fn pointer_metadata(_: &<T as ArchivePointee>::ArchivedMetadata) -> <T as Pointee>::Metadata
impl<ST> CastableFrom for ParticleManager
impl Downcast for ParticleManager
  • fn into_any(self: Box<T>) -> Box<dyn Any>
  • fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
  • fn as_any(&self) -> &dyn Any
  • fn as_any_mut(&mut self) -> &mut dyn Any
impl DowncastSync for ParticleManager
  • fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>
impl Instrument for ParticleManager
impl LayoutRaw for ParticleManager
  • fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
impl<T, N1> Niching for ParticleManager
  • unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
  • fn resolve_niched(out: Place<NichedOption<T, N1>>)
impl Pointee for ParticleManager
  • type Metadata = ()
impl Read for ParticleManager
impl WithSubscriber for ParticleManager

On this page