From a7a4840dd4588a9aeb7670f821a52e418db77f76 Mon Sep 17 00:00:00 2001 From: admin Date: Thu, 16 Oct 2025 14:05:49 +0200 Subject: [PATCH] feat: batch component impl --- src/components/batch.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/components/batch.cpp diff --git a/src/components/batch.cpp b/src/components/batch.cpp new file mode 100644 index 0000000..c0e9301 --- /dev/null +++ b/src/components/batch.cpp @@ -0,0 +1,19 @@ +#include + +#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(instances), GL_DYNAMIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); +} \ No newline at end of file