allow changing particle buffer size

This commit is contained in:
Green Sky 2022-04-26 15:27:15 +02:00
parent 5cc6aa8c74
commit 5023a658e7
2 changed files with 9 additions and 4 deletions

View File

@ -304,6 +304,12 @@ void LiteParticles2D::render(Services::OpenGLRenderer& rs, Engine& engine) {
renderParticles(rs, scene); renderParticles(rs, scene);
} }
void LiteParticles2D::setParticleBufferSize(uint32_t new_buffer_size) {
_particle_buffer_size = new_buffer_size;
resetBuffers();
}
void LiteParticles2D::resetBuffers(void) { void LiteParticles2D::resetBuffers(void) {
const auto gl_buffer_type = GL_DYNAMIC_COPY; const auto gl_buffer_type = GL_DYNAMIC_COPY;
auto reset_buffer_0 = [this](size_t i) { auto reset_buffer_0 = [this](size_t i) {

View File

@ -47,10 +47,8 @@ namespace MM::OpenGL::RenderTasks {
float _time {0}; float _time {0};
public: public:
//glm::vec3 env_vec{0, 1, 0}; // TODO: impl some environment controlled force
//float env_force{0.3}; //glm::vec2 env_vec{0, 1};
//float noise_force{0.5};
//float dampening{0.99};
LiteParticles2D(Engine& engine); LiteParticles2D(Engine& engine);
~LiteParticles2D(void); ~LiteParticles2D(void);
@ -62,6 +60,7 @@ namespace MM::OpenGL::RenderTasks {
void renderParticles(Services::OpenGLRenderer& rs, Scene& scene); void renderParticles(Services::OpenGLRenderer& rs, Scene& scene);
void render(Services::OpenGLRenderer& rs, Engine& engine) override; void render(Services::OpenGLRenderer& rs, Engine& engine) override;
void setParticleBufferSize(uint32_t new_buffer_size = 10'000);
void resetBuffers(void); void resetBuffers(void);
void resetTypeBuffers(void); void resetTypeBuffers(void);