#pragma once #include "Particle.h" #include #include #include class ParticleFactory { public: ParticleFactory(); ~ParticleFactory() = default; // Disable copying ParticleFactory(const ParticleFactory&) = delete; ParticleFactory& operator=(const ParticleFactory&) = delete; // Core particle creation methods Particle createParticle(Particle::MaterialType material, const glm::vec2& position); Particle createSandParticle(const glm::vec2& position); // Batch particle creation std::vector createParticlesAlongPath(const glm::vec2& start, const glm::vec2& end, float spacing = 8.0f); std::vector createParticlesInArea(const glm::vec2& center, float radius, int count); // Configuration void setParticleSize(float size) { particleSize_ = size; } void setOffsetRange(float range) { offsetRange_ = range; } float getParticleSize() const { return particleSize_; } float getOffsetRange() const { return offsetRange_; } private: float particleSize_; float offsetRange_; // Performance optimization: minimum distance threshold static constexpr float MIN_PATH_DISTANCE = 4.0f; // Don't create particles for very short paths // Helper methods glm::vec2 generateRandomOffset(); float randomFloat(float min, float max); };