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
55
src/particles/ParticleSystem.h
Normal file
55
src/particles/ParticleSystem.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
#pragma once
|
||||
|
||||
#include "Particle.h"
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
// ParticleSystem class header - manages collections of particles
|
||||
|
||||
class ParticleSystem {
|
||||
public:
|
||||
ParticleSystem(int width, int height);
|
||||
~ParticleSystem() = default;
|
||||
|
||||
// Disable copying
|
||||
ParticleSystem(const ParticleSystem&) = delete;
|
||||
ParticleSystem& operator=(const ParticleSystem&) = delete;
|
||||
|
||||
// Core simulation methods
|
||||
void update(float deltaTime);
|
||||
void step();
|
||||
|
||||
// Particle management methods
|
||||
void addParticle(const Particle& particle);
|
||||
void removeParticle(int x, int y);
|
||||
bool isEmpty(int x, int y) const;
|
||||
|
||||
// Material placement methods
|
||||
void placeMaterial(int x, int y, Particle::MaterialType material);
|
||||
bool isValidPosition(int x, int y) const;
|
||||
|
||||
// Getter methods
|
||||
int getWidth() const { return width_; }
|
||||
int getHeight() const { return height_; }
|
||||
int getParticleCount() const { return particleCount_; }
|
||||
Particle* getParticle(int x, int y);
|
||||
const std::vector<std::unique_ptr<Particle>>& getAllParticles() const { return particles_; }
|
||||
|
||||
private:
|
||||
int width_;
|
||||
int height_;
|
||||
std::vector<std::vector<std::unique_ptr<Particle>>> grid_;
|
||||
std::vector<std::unique_ptr<Particle>> particles_;
|
||||
int particleCount_;
|
||||
|
||||
// Helper methods
|
||||
void initializeGrid();
|
||||
void updateParticlePosition(Particle& particle, float deltaTime);
|
||||
bool tryMoveParticle(Particle& particle, const glm::vec2& direction);
|
||||
void applyBoundaryConstraints(Particle& particle);
|
||||
bool isAtBoundary(const Particle& particle) const;
|
||||
bool wouldCrossBoundary(const Particle& particle, const glm::vec2& direction) const;
|
||||
void handleBoundaryCollision(Particle& particle);
|
||||
bool isMovingTowardsBoundary(const Particle& particle) const;
|
||||
void clampParticleToBoundaries(Particle& particle);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue