00001 /******************************************************************************* 00002 Copyright (c) 2005-2009 David Williams 00003 00004 This software is provided 'as-is', without any express or implied 00005 warranty. In no event will the authors be held liable for any damages 00006 arising from the use of this software. 00007 00008 Permission is granted to anyone to use this software for any purpose, 00009 including commercial applications, and to alter it and redistribute it 00010 freely, subject to the following restrictions: 00011 00012 1. The origin of this software must not be misrepresented; you must not 00013 claim that you wrote the original software. If you use this software 00014 in a product, an acknowledgment in the product documentation would be 00015 appreciated but is not required. 00016 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 00020 3. This notice may not be removed or altered from any source 00021 distribution. 00022 *******************************************************************************/ 00023 00024 namespace PolyVox 00025 { 00026 template <typename VoxelType> 00027 BaseVolume<VoxelType>::BaseVolume 00028 ( 00029 const Region& regValid 00030 ) 00031 :m_regValidRegion(regValid) 00032 { 00033 } 00034 00038 template <typename VoxelType> 00039 BaseVolume<VoxelType>::~BaseVolume() 00040 { 00041 } 00042 00048 template <typename VoxelType> 00049 VoxelType BaseVolume<VoxelType>::getBorderValue(void) const 00050 { 00051 assert(false); 00052 return VoxelType(); 00053 } 00054 00058 template <typename VoxelType> 00059 Region BaseVolume<VoxelType>::getEnclosingRegion(void) const 00060 { 00061 return m_regValidRegion; 00062 } 00063 00068 template <typename VoxelType> 00069 int32_t BaseVolume<VoxelType>::getWidth(void) const 00070 { 00071 return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1; 00072 } 00073 00078 template <typename VoxelType> 00079 int32_t BaseVolume<VoxelType>::getHeight(void) const 00080 { 00081 return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1; 00082 } 00083 00088 template <typename VoxelType> 00089 int32_t BaseVolume<VoxelType>::getDepth(void) const 00090 { 00091 return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1; 00092 } 00093 00099 template <typename VoxelType> 00100 int32_t BaseVolume<VoxelType>::getShortestSideLength(void) const 00101 { 00102 return m_uShortestSideLength; 00103 } 00104 00110 template <typename VoxelType> 00111 int32_t BaseVolume<VoxelType>::getLongestSideLength(void) const 00112 { 00113 return m_uLongestSideLength; 00114 } 00115 00122 template <typename VoxelType> 00123 float BaseVolume<VoxelType>::getDiagonalLength(void) const 00124 { 00125 return m_fDiagonalLength; 00126 } 00127 00134 template <typename VoxelType> 00135 VoxelType BaseVolume<VoxelType>::getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const 00136 { 00137 assert(false); 00138 return VoxelType(); 00139 } 00140 00145 template <typename VoxelType> 00146 VoxelType BaseVolume<VoxelType>::getVoxelAt(const Vector3DInt32& v3dPos) const 00147 { 00148 assert(false); 00149 return VoxelType(); 00150 } 00151 00155 template <typename VoxelType> 00156 void BaseVolume<VoxelType>::setBorderValue(const VoxelType& tBorder) 00157 { 00158 assert(false); 00159 } 00160 00168 template <typename VoxelType> 00169 bool BaseVolume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) 00170 { 00171 assert(false); 00172 return false; 00173 } 00174 00180 template <typename VoxelType> 00181 bool BaseVolume<VoxelType>::setVoxelAt(const Vector3DInt32& v3dPos, VoxelType tValue) 00182 { 00183 assert(false); 00184 return false; 00185 } 00186 00190 template <typename VoxelType> 00191 uint32_t BaseVolume<VoxelType>::calculateSizeInBytes(void) 00192 { 00193 return getWidth() * getHeight() * getDepth() * sizeof(VoxelType); 00194 } 00195 } 00196