Particle bugfixes and openmp-ization

This commit is contained in:
mid 2025-05-10 18:22:13 +03:00
parent ab903ed4c0
commit 4d74b5e3e9

View File

@ -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);