voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
axisAlignedBox.hpp
1 #ifndef PROCEDURAL_VOXEL_EDIT_AXISALIGNEDBOX_HPP
2 #define PROCEDURAL_VOXEL_EDIT_AXISALIGNEDBOX_HPP
3 
4 
5 #include "blub/math/axisAlignedBox.hpp"
6 #include "blub/procedural/voxel/edit/base.hpp"
7 
8 
9 namespace blub
10 {
11 namespace procedural
12 {
13 namespace voxel
14 {
15 namespace edit
16 {
17 
18 
23 template <class configType>
24 class axisAlignedBox : public base<configType>
25 {
26 public:
27  typedef configType t_config;
28  typedef base<configType> t_base;
29  typedef sharedPointer<axisAlignedBox> pointer;
30  typedef typename t_config::t_data t_voxel;
31 
37  static pointer create(const ::blub::axisAlignedBox& desc)
38  {
39  return pointer(new axisAlignedBox(desc));
40  }
44  virtual ~axisAlignedBox()
45  {
46  ;
47  }
48 
54  void setAxisAlignedBox(const ::blub::axisAlignedBox& desc)
55  {
56  m_aab = desc;
57  }
62  const ::blub::axisAlignedBox& getAxisAlignedBox() const
63  {
64  return m_aab;
65  }
66 
67 protected:
73  {
74  return blub::axisAlignedBox(m_aab.getMinimum()*trans.scale + trans.position,
75  m_aab.getMaximum()*trans.scale + trans.position);
76  }
77 
84  bool calculateOneVoxel(const vector3& pos, t_voxel* resultVoxel) const override
85  {
86  if (m_aab.contains(pos))
87  {
88  resultVoxel->setInterpolationMax();
89  return true;
90  }
91  else
92  {
93  return false;
94  }
95  }
96 
97 private:
101  axisAlignedBox(const ::blub::axisAlignedBox& desc)
102  : m_aab(desc)
103  {
104  ;
105  }
106 
107 private:
109 
110 
111 };
112 
113 
114 }
115 }
116 }
117 }
118 
119 
120 #endif // PROCEDURAL_VOXEL_EDIT_AXISALIGNEDBOX_HPP
Definition: customVertexInformation.cpp:193
void setInterpolationMax()
setInterpolationMax set interpolation to maximum.
Definition: data.hpp:129
static pointer create(const ::blub::axisAlignedBox &desc)
Allocates an instance and initialises the class.
Definition: axisAlignedBox.hpp:37
insertes/removes voxels that are included in an blub::axisAlignedBox. Always axis-aligned - use box i...
Definition: predecl.hpp:69
Definition: transform.hpp:20
bool calculateOneVoxel(const vector3 &pos, t_voxel *resultVoxel) const override
checks if voxel is inside aab
Definition: axisAlignedBox.hpp:84
blub::axisAlignedBox getAxisAlignedBoundingBox(const transform &trans) const override
returns the bounding box describing the voxel to be recalculated
Definition: axisAlignedBox.hpp:72
bool contains(const vector3 &v) const
Definition: axisAlignedBox.hpp:496
virtual ~axisAlignedBox()
Destructor.
Definition: axisAlignedBox.hpp:44
const ::blub::axisAlignedBox & getAxisAlignedBox() const
Returns the describing blub::axisAlignedBox set by constructor or by setAxisAlignedBox().
Definition: axisAlignedBox.hpp:62
Definition: vector3.hpp:26
Definition: axisAlignedBox.hpp:20
void setAxisAlignedBox(const ::blub::axisAlignedBox &desc)
Changes the voxel-describing bounding-box. DON'T change it while class is generating voxel...
Definition: axisAlignedBox.hpp:54
The data class is the default voxel. Contains an 8-bit interpolation value. Replace/derive it and set...
Definition: data.hpp:27
const vector3 & getMinimum(void) const
Definition: axisAlignedBox.hpp:126
const vector3 & getMaximum(void) const
Definition: axisAlignedBox.hpp:141
Definition: deadlineTimer.hpp:10
Definition: customVertexInformation.cpp:177