Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
Loading...
Searching...
No Matches
ParticleShapes.hpp File Reference

Where a particle is born and which way it leaves — a pure function of the emitter's own configuration. More...

#include "../core/Types.hpp"
#include "../math/Math.hpp"
#include "../ecs/components/ParticleEmitter.hpp"
#include <cmath>
#include <functional>
Include dependency graph for ParticleShapes.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  esengine::particle::EmitterFrame
struct  esengine::particle::SpawnSample

Namespaces

namespace  esengine
namespace  esengine::particle

Typedefs

using esengine::particle::RandomRange = std::function<f32(f32, f32)>

Functions

glm::vec3 esengine::particle::worldPointOf (const glm::vec3 &local, const EmitterFrame &f)
glm::vec3 esengine::particle::worldDirOf (const glm::vec3 &local, const EmitterFrame &f)
 A local direction placed in the world — rotation ALONE.
glm::vec3 esengine::particle::coneDirection (f32 halfAngle, const RandomRange &rand)
 A direction inside the cap of half-angle halfAngle about local +Y.
SpawnSample esengine::particle::sampleShape (const ecs::ParticleEmitter &emitter, const RandomRange &rand)

Detailed Description

Where a particle is born and which way it leaves — a pure function of the emitter's own configuration.

Header-only and free of the simulation, because it is the one part of emission that is a DISTRIBUTION rather than a frame: a rendered picture is a projection and cannot answer whether directions are isotropic, so the shapes are tested here as the distributions they are.

Every shape answers in the same two terms, so the integrator never learns a new kind of aim. Local +Y is the axis a directed shape points along — where a 2D cone has always pointed.

Definition in file ParticleShapes.hpp.