#ifndef BLANK_MODEL_OUTLINEMODEL_HPP_
#define BLANK_MODEL_OUTLINEMODEL_HPP_
+#include "../graphics/VertexArray.hpp"
+
#include <vector>
#include <GL/glew.h>
#include <glm/glm.hpp>
using Colors = std::vector<Color>;
using Indices = std::vector<Index>;
-public:
- Positions vertices;
- Colors colors;
- Indices indices;
+ enum Attribute {
+ ATTRIB_VERTEX,
+ ATTRIB_COLOR,
+ ATTRIB_INDEX,
+ ATTRIB_COUNT,
+ };
-public:
- OutlineModel() noexcept;
- ~OutlineModel() noexcept;
+ struct Buffer {
- OutlineModel(const OutlineModel &) = delete;
- OutlineModel &operator =(const OutlineModel &) = delete;
+ Positions vertices;
+ Colors colors;
+ Indices indices;
- void Invalidate() noexcept { dirty = true; }
+ void Clear() noexcept {
+ vertices.clear();
+ colors.clear();
+ indices.clear();
+ }
- void Clear() noexcept;
- void Reserve(int vtx_count, int idx_count);
+ void Reserve(size_t p, size_t i) {
+ vertices.reserve(p);
+ colors.reserve(p);
+ indices.reserve(i);
+ }
- void Draw() noexcept;
+ };
-private:
- void Update() noexcept;
+ using VAO = VertexArray<ATTRIB_COUNT>;
-private:
- enum Attribute {
- ATTRIB_VERTEX,
- ATTRIB_COLOR,
- ATTRIB_INDEX,
- ATTRIB_COUNT,
- };
+public:
+ void Update(const Buffer &) noexcept;
- GLuint va;
- GLuint handle[ATTRIB_COUNT];
- bool dirty;
+ void Draw() noexcept;
+
+private:
+ VAO vao;
};