Skip to main content

RenderEvent

Trait RenderEvent 

Source
pub trait RenderEvent:
    'static
    + Send
    + Sync {
    const KIND: u32;

    // Required methods
    fn entity(&self) -> u32;
    fn position(&self) -> [f32; 3];

    // Provided methods
    fn intensity(&self) -> f32 { ... }
    fn data(&self) -> [f32; 4] { ... }
}
Expand description

Implemented by ECS event types that should be extracted as FrameEvents for the TS audio/VFX layer.

Each implementor must provide a unique KIND constant and methods to extract entity, position, and intensity.

Required Associated Constants§

Source

const KIND: u32

Unique event-type identifier. Must be stable across frames.

Required Methods§

Source

fn entity(&self) -> u32

Source entity index, or 0 if not entity-specific.

Source

fn position(&self) -> [f32; 3]

World-space position for spatial audio.

Provided Methods§

Source

fn intensity(&self) -> f32

Intensity/magnitude for volume scaling. Defaults to 1.0.

Source

fn data(&self) -> [f32; 4]

Extra payload for event-specific data (e.g. color [r,g,b,a], direction [dx,dy,dz,0], variant ID [id,0,0,0]). Defaults to [0.0; 4].

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§