// Copyright (c) 2012-2023 Wojciech Figat. All rights reserved. #pragma once #include "Engine/Scripting/ScriptingType.h" class TaskGraphSystem; struct RenderContext; struct RenderView; class ParticleEmitter; class ParticleSystemInstance; class ParticleEffect; class ParticleSystem; class ParticleBuffer; class SceneRenderTask; class Actor; /// /// The particles simulation service. /// API_CLASS(Static) class FLAXENGINE_API Particles { DECLARE_SCRIPTING_TYPE_NO_SPAWN(Particles); /// /// The system for Particles update. /// API_FIELD(ReadOnly) static TaskGraphSystem* System; public: /// /// Updates the effect during next particles simulation tick. /// /// The effect. static void UpdateEffect(ParticleEffect* effect); /// /// Called when effect gets removed from gameplay. All references to it should be cleared. /// /// The effect. static void OnEffectDestroy(ParticleEffect* effect); public: /// /// Draws the particles. /// /// The rendering context. /// The owning actor. static void DrawParticles(RenderContext& renderContext, ParticleEffect* effect); public: /// /// Enables or disables particle buffer pooling. /// static bool EnableParticleBufferPooling; /// /// The particle buffer recycle timeout (in seconds). /// static float ParticleBufferRecycleTimeout; /// /// Acquires the free particle buffer for the emitter instance data. /// /// The emitter. /// The particle buffer. static ParticleBuffer* AcquireParticleBuffer(ParticleEmitter* emitter); /// /// Recycles the used particle buffer. /// /// The particle buffer. static void RecycleParticleBuffer(ParticleBuffer* buffer); /// /// Called when emitter gets unloaded. Particle buffers using this emitter has to be cleared. /// /// The emitter. static void OnEmitterUnload(ParticleEmitter* emitter); };