Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
voxelrenderdata.h
1 #pragma once
2 
3 #include <unordered_map>
4 #include <string>
5 
6 #include <GL/glew.h>
7 
8 #include <glow/ref_ptr.h>
9 
10 #include "utils/vec3hash.h"
11 #include "etc/contextdependant.h"
12 
13 namespace glow {
14  class Program;
15  class VertexArrayObject;
16  class Buffer;
17  class Texture;
18 };
19 class Voxel;
20 
22 public:
23  VoxelRenderData(std::unordered_map<glm::ivec3, Voxel*> &voxel);
24 
25  void invalidate();
26  int voxelCount();
27 
28  glow::VertexArrayObject* vertexArrayObject();
29 
30 protected:
31  std::unordered_map<glm::ivec3, Voxel*> &m_voxel;
32  bool m_isDirty;
33  int m_bufferSize;
34 
35  glow::ref_ptr<glow::Buffer> m_voxelDataBuffer;
36  glow::ref_ptr<glow::VertexArrayObject> m_vertexArrayObject;
37 
38  void updateBuffer();
39  void setupVertexAttributes();
40  void setupVertexAttribute(GLint offset, const std::string& name, int numPerVertex, GLenum type, GLboolean normalised, int bindingNum);
41 
42  virtual void beforeContextDestroy() override;
43  virtual void afterContextRebuild() override;
44 };
45 
Definition: contextdependant.h:7
Definition: voxelrenderdata.h:21
Definition: voxel.h:15