ExpressionModule
Per-particle script (FParticleExpression): the author's own math at spawn or every update, where the fixed modules run out — a spiral, a colour that follows speed, a size pulse. A spawn script runs on the CPU for both simulation modes (GPU particles are spawned by the CPU); an update script on a GPU emitter runs in the GPU expression pass, on the same bytecode.
- Module
- Particles
- Header
#include "Particles/ParticleModule.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
bool | onSpawn | Default false. |
std::string | source | |
float params[4] = |
Public functions
| Returns | Name | Description |
|---|---|---|
void | OnSpawn | |
void | OnUpdateRange | |
const char* | GetTypeName | |
Scope<ParticleModule> | Clone | |
bool | Prepare | Compiles when the source or the emitter's attribute table changed since the last call; false with CompileError() set when it does not parse. |
const std::string& | CompileError | |
const FParticleExpression& | Program | |
void | SetAttributes | The custom attributes every script of the emitter agreed on, in order of first mention across its modules (see ParticleSystem); attr.heat is the same particle slot in each of them. |
const std::vector<std::string>& | Attributes | |
bool | AppendGpuProgram | The update script packed for the GPU expression pass, with its clock advanced the way OnUpdateRange advances it on the CPU path. |
Function details
OnSpawn
void OnSpawn(Particle& particle, ParticleRandom& random, const Vec3& emitterPos) overrideOnUpdateRange
void OnUpdateRange(Particle* particles, size_t count, float deltaTime, const float* normalizedAges) overrideGetTypeName
const char* GetTypeName() const overrideClone
Scope<ParticleModule> Clone() const overridePrepare
bool Prepare()Compiles when the source or the emitter's attribute table changed since the last call; false with CompileError() set when it does not parse.
CompileError
const std::string& CompileError() constProgram
const FParticleExpression& Program() constSetAttributes
void SetAttributes(const std::vector<std::string>& attributes)The custom attributes every script of the emitter agreed on, in order of first mention across its modules (see ParticleSystem); attr.heat is the same particle slot in each of them.
Attributes
const std::vector<std::string>& Attributes() constAppendGpuProgram
bool AppendGpuProgram(float deltaTime, std::vector<uint32_t>& words)The update script packed for the GPU expression pass, with its clock advanced the way OnUpdateRange advances it on the CPU path. False when there is nothing to run there: a spawn script, or one that does not compile.