|
Estella 0.113.0
A fast 2D and 3D game engine powered by WebAssembly and ECS
|
#include <GpuParticles.hpp>
Classes | |
| struct | Job |
Public Member Functions | |
| GpuParticles (GfxDevice &device) | |
| ~GpuParticles () | |
| GpuParticles (const GpuParticles &)=delete | |
| GpuParticles & | operator= (const GpuParticles &)=delete |
| bool | available () const |
| Whether the device can run the kernel at all. | |
| void | beginFrame () |
| A new frame: the previous frame's jobs are gone, and a slot nobody asked for in a while is given back. | |
| bool | submit (Entity entity, const ecs::ParticleEmitter &emitter, const ecs::Transform &transform, particle::ParticleSystem &system, const particle::GpuStep &step, const glm::vec4 &eye, BufferHandle &instances, BufferHandle &segments, u32 &segmentCount) |
| Queues the step an emitter needs and says where its particles are. The step is committed to the emitter only once the kernel has run it; an emitter already queued this frame is not queued twice. | |
| bool | wantsDepth () const |
| An emitter collided with the depth last frame, so the scene must draw into a target whose depth can be read. | |
| void | declareDepthCopy (rg::RenderGraph &graph, rg::ResourceId scene, u32 sceneW, u32 sceneH, const glm::mat4 &clip) |
Copies the scene's depth for next frame's kernel, once a frame. clip is the view that drew it, in the device's clip range. | |
| rg::ResourceId | declare (rg::RenderGraph &graph) |
| Adds the compute pass for what was submitted. The resource it writes must be named by the pass that draws the result. | |
| void | release () |
| u32 | slotCount () const |
| Slots live right now, for the stats. | |
| u32 | lastDispatches () const |
| u32 | drawnSlots () const |
| Particle slots handed to a draw this frame, over every emitter and camera: what the GPU is asked to draw. | |
| void | setDepthGridMax (u32 texels) |
| u32 | depthGridWidth () const |
Definition at line 42 of file GpuParticles.hpp.
|
explicit |
Definition at line 715 of file GpuParticles.cpp.
References release().
Referenced by GpuParticles(), and operator=().
| esengine::GpuParticles::~GpuParticles | ( | ) |
Definition at line 717 of file GpuParticles.cpp.
|
delete |
References GpuParticles().
| bool esengine::GpuParticles::available | ( | ) | const |
Whether the device can run the kernel at all.
Definition at line 721 of file GpuParticles.cpp.
| void esengine::GpuParticles::beginFrame | ( | ) |
A new frame: the previous frame's jobs are gone, and a slot nobody asked for in a while is given back.
Definition at line 759 of file GpuParticles.cpp.
| rg::ResourceId esengine::GpuParticles::declare | ( | rg::RenderGraph & | graph | ) |
Adds the compute pass for what was submitted. The resource it writes must be named by the pass that draws the result.
Definition at line 1082 of file GpuParticles.cpp.
References esengine::RGBA8.
| void esengine::GpuParticles::declareDepthCopy | ( | rg::RenderGraph & | graph, |
| rg::ResourceId | scene, | ||
| u32 | sceneW, | ||
| u32 | sceneH, | ||
| const glm::mat4 & | clip ) |
Copies the scene's depth for next frame's kernel, once a frame. clip is the view that drew it, in the device's clip range.
Definition at line 1021 of file GpuParticles.cpp.
References esengine::RGBA8.
|
inline |
Definition at line 87 of file GpuParticles.hpp.
|
inline |
Particle slots handed to a draw this frame, over every emitter and camera: what the GPU is asked to draw.
Definition at line 84 of file GpuParticles.hpp.
|
inline |
Definition at line 82 of file GpuParticles.hpp.
|
delete |
References GpuParticles().
| void esengine::GpuParticles::release | ( | ) |
Definition at line 735 of file GpuParticles.cpp.
References esengine::Invalid.
Referenced by GpuParticles().
| void esengine::GpuParticles::setDepthGridMax | ( | u32 | texels | ) |
Definition at line 1078 of file GpuParticles.cpp.
|
inline |
Slots live right now, for the stats.
Definition at line 81 of file GpuParticles.hpp.
| bool esengine::GpuParticles::submit | ( | Entity | entity, |
| const ecs::ParticleEmitter & | emitter, | ||
| const ecs::Transform & | transform, | ||
| particle::ParticleSystem & | system, | ||
| const particle::GpuStep & | step, | ||
| const glm::vec4 & | eye, | ||
| BufferHandle & | instances, | ||
| BufferHandle & | segments, | ||
| u32 & | segmentCount ) |
Queues the step an emitter needs and says where its particles are. The step is committed to the emitter only once the kernel has run it; an emitter already queued this frame is not queued twice.
| drawCount | How many slots may hold a live particle once the step has run. |
| eye | Where the frame is seen from, as FrameConstants::camera has it: what a trail's quads are turned to face. |
| instances | The buffer to draw them from. |
| segments | The buffer to draw its trails from, and how many; untouched where it has none. |
Definition at line 863 of file GpuParticles.cpp.
References esengine::ecs::Birth, esengine::GpuParticles::Job::block, esengine::ecs::Collision, esengine::ecs::Death, esengine::math::DEG_TO_RAD, esengine::ecs::Depth, esengine::particle::ForceFieldInstance::direction, ES_LOG_ERROR, esengine::GpuParticles::Job::eventCapacity, esengine::particle::ForceFieldInstance::falloff, esengine::ecs::Floor, esengine::GpuParticles::Job::inheritVelocity, esengine::Invalid, esengine::particle::kMaxTrailPoints, esengine::ecs::Local, esengine::ecs::Physics2D, esengine::ecs::Physics3D, esengine::particle::ForceFieldInstance::position, esengine::particle::ForceFieldInstance::radius, esengine::renderOrigin(), esengine::GpuParticles::Job::reportEvents, esengine::ecs::Sdf, esengine::Storage, esengine::particle::ForceFieldInstance::strength, esengine::GpuParticles::Job::subEmitter, esengine::GfxContent::transient(), and esengine::particle::ForceFieldInstance::type.
Referenced by esengine::ParticlePlugin::collect().
|
inline |
An emitter collided with the depth last frame, so the scene must draw into a target whose depth can be read.
Definition at line 70 of file GpuParticles.hpp.