Files
Cubed/include/Cubed/render/vertex_array.hpp
zhenyan121 2e9df71b31 perf(render): batch model rendering with instancing
Replaces per-entity draw calls with instanced rendering for both main and shadow passes. Each model's node hierarchy is flattened once and instance matrices are updated per frame, reducing draw calls and CPU overhead.
2026-08-06 14:41:28 +08:00

27 lines
643 B
C++

#pragma once
#include <glad/glad.h>
namespace Cubed {
class VertexArray {
public:
VertexArray();
VertexArray(const VertexArray&) = delete;
VertexArray(VertexArray&&) noexcept;
VertexArray& operator=(const VertexArray&) = delete;
VertexArray& operator=(VertexArray&&) noexcept;
~VertexArray();
void bind() const;
static void unbind();
GLuint id() const;
void attribute(GLuint index, GLint size, GLenum type, GLsizei stride,
const void* ptr, bool normalized = false) const;
void divisor(GLuint index, GLuint divisor = 1);
private:
GLuint m_vao = 0;
};
} // namespace Cubed