Skip to content

MoonLiveParticles

Source: MoonLiveParticles.h

MoonLiveParticles

class MoonLiveParticles
src/light/moonlive/MoonLiveParticles.h:21

One scripted module's particle pool, with the frame clock that makes the physics run evenly.

Public Methods

inline explicit MoonLiveParticles(MoonModule & owner)

inline uint16_t resize(uint16_t count) : Size the pool to count particles, returning the count available and 0 when allocation fails.

inline void release() : Free every buffer and leave the pool invalid.

inline particles::Pool & pool()

inline uint16_t count() const

inline uint32_t advance(uint32_t nowMs) : How much of a reference frame this frame covered, in 8.8 fixed point.

More info

The pool lives outside the script arena

A pool is eight parallel arrays, where the script arena is 64 bytes across 8 members. A script could hold about five particles there, against the hundreds a particle look needs. Widening the arena is the wrong answer, since every scripted module holds one by value. A probe on the main task's stack boot-looped the P4 at 1440 bytes.

Six buffers rather than eight: acc and size are optional and neither feeds a builtin.