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);
}
void LiteParticles2D::setParticleBufferSize(uint32_t new_buffer_size) {
_particle_buffer_size = new_buffer_size;
resetBuffers();
}
void LiteParticles2D::resetBuffers(void) {
const auto gl_buffer_type = GL_DYNAMIC_COPY;
auto reset_buffer_0 = [this](size_t i) {

View File

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