Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef __PolyVox_ConstVolumeProxy_H__
00025 #define __PolyVox_ConstVolumeProxy_H__
00026
00027 #include "PolyVoxCore/Region.h"
00028 #include "PolyVoxCore/Vector.h"
00029
00030 namespace PolyVox
00031 {
00032 template <typename VoxelType>
00033 class ConstVolumeProxy
00034 {
00035
00036 friend class LargeVolume<VoxelType>;
00037 public:
00038 VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const
00039 {
00040 assert(m_regValid.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)));
00041 return m_pVolume.getVoxelAt(uXPos, uYPos, uZPos);
00042 }
00043
00044 VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const
00045 {
00046 assert(m_regValid.containsPoint(v3dPos));
00047 return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
00048 }
00049
00050 void setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const
00051 {
00052 assert(m_regValid.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)));
00053 m_pVolume.setVoxelAtConst(uXPos, uYPos, uZPos, tValue);
00054 }
00055
00056 void setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue) const
00057 {
00058 assert(m_regValid.containsPoint(v3dPos));
00059 setVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ(), tValue);
00060 }
00061 private:
00062
00063 ConstVolumeProxy(const LargeVolume<VoxelType>& pVolume, const Region& regValid)
00064 :m_pVolume(pVolume)
00065 ,m_regValid(regValid)
00066 {
00067 }
00068
00069 const LargeVolume<VoxelType>& m_pVolume;
00070 const Region& m_regValid;
00071 };
00072 }
00073
00074 #endif //__PolyVox_ConstVolumeProxy_H__