mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-08 17:57:02 +08:00
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.
27 lines
643 B
C++
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
|