i've added so much and idek anymore
This commit is contained in:
parent
c120871293
commit
51ff181659
19 changed files with 1573 additions and 10 deletions
41
src/particles/ParticleFactory.h
Normal file
41
src/particles/ParticleFactory.h
Normal file
|
@ -0,0 +1,41 @@
|
|||
#pragma once
|
||||
|
||||
#include "Particle.h"
|
||||
#include <glm/glm.hpp>
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
|
||||
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<Particle> createParticlesAlongPath(const glm::vec2& start, const glm::vec2& end, float spacing = 8.0f);
|
||||
std::vector<Particle> 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);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue