diff --git a/src/k3particles.c b/src/k3particles.c index f653fae..7b91732 100644 --- a/src/k3particles.c +++ b/src/k3particles.c @@ -76,6 +76,7 @@ static void regenerate_model(struct k3CPUQuadParticles *this, vec3 cameraRight, glm_vec3_scale(cameraRight, 0.5, halfRight); glm_vec3_scale(cameraUp, 0.5, halfUp); + #pragma omp parallel for for(size_t i = 0; i < this->count; i++) { glm_vec3_copy(this->positions[i], vpos[i * 4 + 0]); glm_vec3_copy(this->positions[i], vpos[i * 4 + 1]); @@ -116,8 +117,11 @@ static void regenerate_model(struct k3CPUQuadParticles *this, vec3 cameraRight, } } + // This update the AABB + k3MdlUpdatePos(this->mdl, vpos); + glBindBufferARB(GL_ARRAY_BUFFER_ARB, this->mdl->vstore->gl); - glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, this->mdl->offV, sizeof(*vpos) * this->capacity * 4, vpos); + //glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, this->mdl->offV, sizeof(*vpos) * this->capacity * 4, vpos); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, this->mdl->offC, sizeof(*vcols) * this->capacity * 4 * 4, vcols); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, this->mdl->offU, sizeof(*vuvs) * this->capacity * 4, vuvs); glBufferSubDataARB(GL_ARRAY_BUFFER_ARB, this->mdl->offN, sizeof(*vnrms) * this->capacity * 4 * 3, vnrms);