feat: batch component impl

This commit is contained in:
2025-10-16 14:05:49 +02:00
parent 2144b8a03a
commit a7a4840dd4

19
src/components/batch.cpp Normal file
View File

@ -0,0 +1,19 @@
#include <GL/glew.h>
#include "components/batch.h"
unsigned int batch::LastID = 0;
batch::batch() {
m_id = ++LastID;
}
void batch::prepare(glm::mat4 *instances, unsigned int count) {
if (m_instance_vbo == 0) {
glGenBuffers(1, &m_instance_vbo);
}
glBindBuffer(GL_ARRAY_BUFFER, m_instance_vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(glm::mat4) * count, reinterpret_cast<void*>(instances), GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
}