voxelTerrain
 All Classes Functions Variables Typedefs Enumerations Pages
data.hpp
1 #ifndef BLUB_PROCEDURAL_VOXEL_DATA_HPP
2 #define BLUB_PROCEDURAL_VOXEL_DATA_HPP
3 
4 #include "blub/core/classVersion.hpp"
5 #include "blub/core/globals.hpp"
6 #include "blub/serialization/access.hpp"
7 #include "blub/serialization/nameValuePair.hpp"
8 
9 
10 namespace blub
11 {
12 namespace procedural
13 {
14 namespace voxel
15 {
16 
17 
27 class data
28 {
29 public:
33  data()
34  : interpolation(-127)
35  {
36  ;
37  }
43  bool operator ==(const data& other) const
44  {
45  return other.interpolation == interpolation;
46  }
52  bool operator !=(const data& other) const
53  {
54  return other.interpolation != interpolation;
55  }
56 
61  void setInterpolation(const int8 &toSet)
62  {
63  interpolation = toSet;
64  }
65 
71  {
72  return interpolation;
73  }
74 
79  const int8 &getInterpolation() const
80  {
81  return interpolation;
82  }
83 
88  bool isMax() const
89  {
90  return interpolation >= 127;
91  }
92 
97  bool isMin() const
98  {
99  return interpolation <= -127;
100  }
101 
105  void setMin()
106  {
108  }
109 
113  void setMax()
114  {
116  }
117 
122  {
123  interpolation = -127;
124  }
125 
130  {
131  interpolation = 127;
132  }
133 
134 private:
135  BLUB_SERIALIZATION_ACCESS
136 
137  template <class formatType>
138  void serialize(formatType & readWrite, const uint32& version)
139  {
140  using namespace serialization;
141 
142  (void)version;
143 
144  readWrite & BLUB_SERIALIZATION_NAMEVALUEPAIR(interpolation);
145  }
146 
147 
148 protected:
153 
154 
155 };
156 
157 
158 }
159 }
160 }
161 
162 
163 #endif // BLUB_PROCEDURAL_VOXEL_DATA_HPP
void setMax()
setMax sets all values to maximum. See class description.
Definition: data.hpp:113
void setInterpolationMax()
setInterpolationMax set interpolation to maximum.
Definition: data.hpp:129
void setMin()
setMin sets all values to minimum. See class description.
Definition: data.hpp:105
int8 interpolation
interpolation signed 8-bit interpolation value default used by voxel::tile::surface ...
Definition: data.hpp:152
bool operator==(const data &other) const
operator == compares interpolation.
Definition: data.hpp:43
void setInterpolation(const int8 &toSet)
setInterpolation sets interpolation
Definition: data.hpp:61
bool isMax() const
isMax checks if all values are maximum. See class description.
Definition: data.hpp:88
data()
data constructor
Definition: data.hpp:33
bool operator!=(const data &other) const
operator != compares interpolation.
Definition: data.hpp:52
bool isMin() const
isMin checks if all values are minimum. See class description.
Definition: data.hpp:97
The data class is the default voxel. Contains an 8-bit interpolation value. Replace/derive it and set...
Definition: data.hpp:27
const int8 & getInterpolation() const
getInterpolation returns const reference to interpolation.
Definition: data.hpp:79
int8 & getInterpolation()
getInterpolation returns reference to interpolation.
Definition: data.hpp:70
Definition: deadlineTimer.hpp:10
void setInterpolationMin()
setInterpolationMin sets the interpolation to minimum.
Definition: data.hpp:121