Voxellancer  0.3
A game about voxels in space
 All Classes Functions Pages
voxelcluster.h
1 #pragma once
2 
3 #include <set>
4 #include <memory>
5 #include <unordered_map>
6 
7 #include <glm/glm.hpp>
8 
9 #include "geometry/transform.h"
10 
11 #include "utils/vec3hash.h"
12 
17 class Voxel;
18 class VoxelRenderData;
19 class VoxelClusterBounds;
20 
21 class VoxelCluster {
22 public:
23  VoxelCluster(float scale);
24  virtual ~VoxelCluster();
25 
26  VoxelClusterBounds& bounds();
27 
28  Transform& transform();
29  const Transform& transform() const;
30  void setTransform(const Transform& transform);
31 
32  const glm::vec3& position() const;
33  const glm::quat& orientation() const;
34 
35  Voxel* voxel(const glm::ivec3& position);
36  const Voxel* voxel(const glm::ivec3& position) const;
37 
38  virtual void addVoxel(Voxel* voxel);
39  virtual void removeVoxel(Voxel* voxel);
40 
41  const std::unordered_map<glm::ivec3, Voxel*>& voxelMap() const;
42  int voxelCount() const;
43 
44  VoxelRenderData* voxelRenderData();
45 
46  virtual float emissiveness() const;
47 
48 
49 protected:
50  std::unordered_map<glm::ivec3, Voxel*> m_voxels;
51  std::unique_ptr<VoxelRenderData> m_voxelRenderData;
52  std::unique_ptr<VoxelClusterBounds> m_bounds;
53 
54  Transform m_transform;
55 };
56 
Definition: voxelcluster.h:21
Definition: transform.h:9
Definition: voxelclusterbounds.h:25
Definition: voxelrenderdata.h:21
Definition: voxel.h:15