1 #ifndef VECTOR3INT32MAP_HPP
2 #define VECTOR3INT32MAP_HPP
4 #include "blub/math/axisAlignedBoxInt32.hpp"
5 #include "blub/core/noncopyable.hpp"
11 template <
typename dataType>
23 if (m_data !=
nullptr)
29 void setValue(
const vector3int32& pos,
const dataType& toSet)
31 const int32 index(convertToIndex(pos));
32 BASSERT(index < m_bounds.getVolume());
33 m_data[index] = toSet;
37 const int32 index(convertToIndex(pos));
45 resizedAabb.extend(aabb);
46 if (resizedAabb == m_bounds)
53 const dataType* oldData(m_data);
55 m_bounds = resizedAabb;
56 BASSERT(m_bounds.getVolume() > 0);
57 m_data =
new dataType[m_bounds.getVolume()];
59 if (oldData !=
nullptr)
61 for (int32 indX = oldStart.x; indX < oldEnd.x; ++indX)
63 for (int32 indY = oldStart.y; indY < oldEnd.y; ++indY)
65 for (int32 indZ = oldStart.z; indZ < oldEnd.z; ++indZ)
67 m_data[convertToIndex(
vector3int32(indX, indY, indZ))] = oldData[convertToIndex(
vector3int32(indX, indY, indZ), oldBounds)];
78 resizedAabb.extend(toExtend);
84 resizedAabb.extend(toExtend);
95 int32 convertToIndex(
const vector3int32& toConvert)
const
97 return convertToIndex(toConvert, m_bounds);
101 BASSERT(toConvert >= bounds.getMinimum());
102 BASSERT(toConvert < bounds.getMaximum());
106 return (toConvert.x-min.x)*size.y*size.z + (toConvert.y-min.y)*size.z + (toConvert.z-min.z);
118 #endif // VECTOR3INT32MAP_HPP
Definition: vector3int32map.hpp:12
Definition: axisAlignedBoxInt32.hpp:12
Definition: noncopyable.hpp:10
Definition: deadlineTimer.hpp:10