|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
Namespaces | |
| namespace | noise |
Classes | |
| struct | Particle |
| class | ParticlePool |
| struct | ScheduledBurst |
| One burst of a schedule: count particles at time seconds after the emitter starts emitting. More... | |
| struct | EmitterFrame |
| struct | SpawnSample |
| struct | StretchedQuad |
| How a stretched particle's quad is laid along its velocity. More... | |
| struct | ForceFieldInstance |
| struct | SdfColliderInstance |
| struct | CollisionQuery |
| struct | CollisionReply |
| struct | CollisionEvent |
| struct | CollisionStats |
| struct | GpuStep |
| What one frame asks of a GPU-simulated emitter: how long to advance, how many to spawn and where in the ring they go. More... | |
| struct | EmitterState |
| class | ParticleSystem |
Typedefs | |
| using | EasingType = ecs::ParticleEasing |
| using | RandomRange = std::function<f32(f32, f32)> |
| using | ColorLut = std::array<glm::vec4, kColorLutSize> |
| using | SizeLut = std::array<f32, kColorLutSize> |
Functions | |
| f32 | unitHash (u32 v) |
| u32 | burstsDue (const std::vector< ScheduledBurst > &schedule, f32 prev, f32 cur, f32 duration, bool looping) |
| How many particles the schedule releases while the emitter's clock goes from prev to cur. | |
| f32 | applyEasing (EasingType type, f32 t) |
| glm::vec3 | worldPointOf (const glm::vec3 &local, const EmitterFrame &f) |
| glm::vec3 | worldDirOf (const glm::vec3 &local, const EmitterFrame &f) |
| A local direction placed in the world — rotation ALONE. | |
| glm::vec3 | coneDirection (f32 halfAngle, const RandomRange &rand) |
A direction inside the cap of half-angle halfAngle about local +Y. | |
| SpawnSample | sampleShape (const ecs::ParticleEmitter &emitter, const RandomRange &rand) |
| glm::vec3 | limitedVelocity (glm::vec3 velocity, f32 limit, f32 dampen, f32 dt) |
| A particle's velocity after its speed limit has pulled it back. | |
| glm::vec2 | velocityOnScreen (const glm::vec3 &velocity, const glm::vec3 &towardViewer) |
| StretchedQuad | stretchedQuad (glm::vec2 velocity, f32 rotation, f32 size, f32 lengthScale, f32 velocityScale) |
| static glm::vec4 | sampleColorLut (const ColorLut &lut, f32 t) |
| static f32 | sampleSizeLut (const SizeLut &lut, f32 t) |
| static void | applyForceField (const ForceFieldInstance &ff, Particle &p, f32 dt) |
| f32 | sdfDistance (const SdfColliderInstance &c, const glm::vec3 &point) |
| How far a world point is outside a collider, negative inside; what the kernel's sdfOne answers. | |
Variables | |
| constexpr int | kColorLutSize = 32 |
| constexpr int | kMaxTrailPoints = 12 |
| using esengine::particle::ColorLut = std::array<glm::vec4, kColorLutSize> |
Definition at line 33 of file ParticleSystem.hpp.
Definition at line 14 of file ParticleEasing.hpp.
| using esengine::particle::RandomRange = std::function<f32(f32, f32)> |
A uniform draw in [a, b). Injected so a test can be deterministic.
Definition at line 28 of file ParticleShapes.hpp.
| using esengine::particle::SizeLut = std::array<f32, kColorLutSize> |
Definition at line 35 of file ParticleSystem.hpp.
|
inline |
Definition at line 20 of file ParticleEasing.hpp.
References esengine::animation::easeInOutQuad(), esengine::animation::easeInQuad(), esengine::animation::easeLinear(), and esengine::animation::easeOutQuad().
|
static |
Definition at line 623 of file ParticleSystem.cpp.
References esengine::particle::ForceFieldInstance::direction, esengine::ecs::Directional, esengine::ecs::Drag, esengine::particle::ForceFieldInstance::falloff, esengine::ecs::Point, esengine::particle::ForceFieldInstance::position, esengine::particle::Particle::position, esengine::particle::ForceFieldInstance::radius, esengine::particle::ForceFieldInstance::radiusSq, esengine::particle::ForceFieldInstance::strength, esengine::particle::ForceFieldInstance::type, esengine::particle::Particle::velocity, and esengine::ecs::Vortex.
|
inline |
How many particles the schedule releases while the emitter's clock goes from prev to cur.
A burst fires once per pass over its time: prev < time <= cur. A looping emitter repeats its schedule every duration, so each cycle the clock crossed in this step is checked. prev starts below zero, so a burst at 0 fires on the first step.
Definition at line 23 of file ParticleBursts.hpp.
Referenced by esengine::particle::ParticleSystem::update().
|
inline |
A direction inside the cap of half-angle halfAngle about local +Y.
cos(theta) is what must be uniform, not theta: sampling the angle crowds the axis, the same mistake latitude/longitude makes at a sphere's poles. PI/2 is the +Y hemisphere and PI the whole sphere, so one function is Cone, Hemisphere and Sphere.
Definition at line 65 of file ParticleShapes.hpp.
References esengine::math::TWO_PI.
Referenced by sampleShape().
|
inline |
A particle's velocity after its speed limit has pulled it back.
The excess over the limit shrinks by dampen for every 1/60 s that passes, so the braking does not change with the frame rate: 1 removes the whole excess at once, a small value eases a fast particle down over several frames. A particle within the limit is left as it is.
Definition at line 20 of file ParticleSpeedLimit.hpp.
Definition at line 608 of file ParticleSystem.cpp.
References kColorLutSize, and esengine::math::lerp().
|
inline |
One sample from emitter's shape, in emitter local space.
Definition at line 73 of file ParticleShapes.hpp.
References esengine::ecs::ParticleEmitter::angleSpreadMax, esengine::ecs::ParticleEmitter::angleSpreadMin, esengine::ecs::Box, esengine::ecs::Circle, esengine::ecs::Cone, coneDirection(), esengine::math::DEG_TO_RAD, esengine::particle::SpawnSample::direction, esengine::math::HALF_PI, esengine::ecs::Hemisphere, esengine::math::PI, esengine::ecs::Point, esengine::particle::SpawnSample::position, esengine::ecs::ParticleEmitter::shape, esengine::ecs::ParticleEmitter::shapeAngle, esengine::ecs::ParticleEmitter::shapeRadius, esengine::ecs::ParticleEmitter::shapeSize, esengine::ecs::Sphere, and esengine::math::TWO_PI.
Definition at line 615 of file ParticleSystem.cpp.
References kColorLutSize, and esengine::math::lerp().
| f32 esengine::particle::sdfDistance | ( | const SdfColliderInstance & | c, |
| const glm::vec3 & | point ) |
How far a world point is outside a collider, negative inside; what the kernel's sdfOne answers.
Definition at line 868 of file ParticleSystem.cpp.
References esengine::particle::SdfColliderInstance::ext, esengine::particle::SdfColliderInstance::inverted, esengine::particle::SdfColliderInstance::position, esengine::particle::SdfColliderInstance::rotation, sdfDistance(), and esengine::particle::SdfColliderInstance::shape.
Referenced by sdfDistance().
|
inline |
Definition at line 34 of file ParticleStretch.hpp.
Referenced by esengine::ParticlePlugin::collect().
Definition at line 32 of file Particle.hpp.
Referenced by esengine::ParticlePlugin::collect().
|
inline |
Definition at line 24 of file ParticleStretch.hpp.
References esengine::towardViewer().
Referenced by esengine::ParticlePlugin::collect().
|
inline |
A local direction placed in the world — rotation ALONE.
Scaling an aim would skew a cone's half-angle and translating one would make it depend on where the emitter stands.
Definition at line 48 of file ParticleShapes.hpp.
References esengine::particle::EmitterFrame::rotation.
|
inline |
A local point placed in the world: scale sizes the shape, rotation aims it.
Definition at line 39 of file ParticleShapes.hpp.
References esengine::particle::EmitterFrame::position, esengine::particle::EmitterFrame::rotation, and esengine::particle::EmitterFrame::scale.
|
inlineconstexpr |
Definition at line 32 of file ParticleSystem.hpp.
Referenced by sampleColorLut(), sampleSizeLut(), esengine::particle::ParticleSystem::setColorLut(), esengine::particle::ParticleSystem::setSizeLut(), and esengine::particle::ParticleSystem::setSpeedLut().
|
inlineconstexpr |
Definition at line 40 of file ParticleSystem.hpp.
Referenced by esengine::ParticlePlugin::collect(), esengine::particle::ParticleSystem::resolveCollisions(), esengine::GpuParticles::submit(), and esengine::particle::ParticleSystem::update().