Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
voxelrenderer.h
1 #pragma once
2 #include <memory>
3 
4 #include <glm/glm.hpp>
5 
6 #include <glow/ref_ptr.h>
7 
8 #include "etc/contextdependant.h"
9 
10 
11 namespace glow {
12  class Texture;
13  class Program;
14  class VertexArrayObject;
15  class Buffer;
16  template<typename T>
17  class Uniform;
18 };
19 
20 class Camera;
21 class VoxelCluster;
22 class VoxelMesh;
23 
25 public:
26  void prepareDraw(const Camera& camera, bool withBorder = true);
27  void draw(VoxelCluster& cluster);
28  void afterDraw();
29 
30  bool prepared();
31 
32  static std::shared_ptr<VoxelRenderer> instance();
33  static glow::Program* program();
34  static VoxelMesh& voxelMesh();
35 
36 
37 protected:
38  glow::ref_ptr<glow::Program> m_program;
39  std::unique_ptr<VoxelMesh> m_voxelMesh;
40  bool m_prepared;
41 
42  glow::Uniform<glm::mat4>* m_modelMatrixUniform;
43  glow::Uniform<float>* m_emissivenessUniform;
44 
45  static std::weak_ptr<VoxelRenderer> s_instance;
46 
47  VoxelRenderer();
48  void createAndSetupShaders();
49  virtual void beforeContextDestroy() override;
50  virtual void afterContextRebuild() override;
51 };
52 
Definition: contextdependant.h:7
Definition: voxelcluster.h:21
Definition: camera.h:10
Definition: voxelmesh.h:21
Definition: voxelrenderer.h:17
Definition: voxelrenderer.h:24