+void Model::Draw() const {
+ glBindVertexArray(va);
+ glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, handle[ATTRIB_INDEX]);
+ glDrawElements(
+ GL_TRIANGLES, // how
+ count, // count
+ GL_UNSIGNED_INT, // type
+ nullptr // offset
+ );
+}
+
+
+BlockModel::BlockModel()
+: va(0)
+, handle{}
+, count(0) {
+ glGenVertexArrays(1, &va);
+ glGenBuffers(ATTRIB_COUNT, handle);
+}
+
+BlockModel::~BlockModel() {
+ glDeleteBuffers(ATTRIB_COUNT, handle);
+ glDeleteVertexArrays(1, &va);
+}
+
+BlockModel::BlockModel(BlockModel &&other)
+: va(other.va)
+, count(other.count) {
+ other.va = 0;
+ for (int i = 0; i < ATTRIB_COUNT; ++i) {
+ handle[i] = other.handle[i];
+ other.handle[i] = 0;