• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl

Go to the documentation of this file.
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 #define BORDER_LOW(x) ((( x >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != x)
00025 #define BORDER_HIGH(x) ((( (x+1) >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != (x+1))
00026 //#define BORDER_LOW(x) (( x % mVolume->m_uBlockSideLength) != 0)
00027 //#define BORDER_HIGH(x) (( x % mVolume->m_uBlockSideLength) != mVolume->m_uBlockSideLength - 1)
00028 
00029 namespace PolyVox
00030 {
00031     template <typename VoxelType>
00032     LargeVolume<VoxelType>::Sampler::Sampler(LargeVolume<VoxelType>* volume)
00033         :BaseVolume<VoxelType>::template Sampler< LargeVolume<VoxelType> >(volume)
00034     {
00035     }
00036 
00037     template <typename VoxelType>
00038     LargeVolume<VoxelType>::Sampler::~Sampler()
00039     {
00040     }
00041 
00042     template <typename VoxelType>
00043     typename LargeVolume<VoxelType>::Sampler& LargeVolume<VoxelType>::Sampler::operator=(const typename LargeVolume<VoxelType>::Sampler& rhs) throw()
00044     {
00045         if(this == &rhs)
00046         {
00047             return *this;
00048         }
00049         this->mVolume = rhs.mVolume;
00050         this->mXPosInVolume = rhs.mXPosInVolume;
00051         this->mYPosInVolume = rhs.mYPosInVolume;
00052         this->mZPosInVolume = rhs.mZPosInVolume;
00053         mCurrentVoxel = rhs.mCurrentVoxel;
00054         return *this;
00055     }
00056 
00057     template <typename VoxelType>
00058     int32_t LargeVolume<VoxelType>::Sampler::getPosX(void) const
00059     {
00060         return this->mXPosInVolume;
00061     }
00062 
00063     template <typename VoxelType>
00064     int32_t LargeVolume<VoxelType>::Sampler::getPosY(void) const
00065     {
00066         return this->mYPosInVolume;
00067     }
00068 
00069     template <typename VoxelType>
00070     int32_t LargeVolume<VoxelType>::Sampler::getPosZ(void) const
00071     {
00072         return this->mZPosInVolume;
00073     }
00074 
00075     template <typename VoxelType>
00076     VoxelType LargeVolume<VoxelType>::Sampler::getSubSampledVoxel(uint8_t uLevel) const
00077     {       
00078         if(uLevel == 0)
00079         {
00080             return getVoxel();
00081         }
00082         else if(uLevel == 1)
00083         {
00084             VoxelType tValue = getVoxel();
00085             tValue = (std::min)(tValue, peekVoxel1px0py0pz());
00086             tValue = (std::min)(tValue, peekVoxel0px1py0pz());
00087             tValue = (std::min)(tValue, peekVoxel1px1py0pz());
00088             tValue = (std::min)(tValue, peekVoxel0px0py1pz());
00089             tValue = (std::min)(tValue, peekVoxel1px0py1pz());
00090             tValue = (std::min)(tValue, peekVoxel0px1py1pz());
00091             tValue = (std::min)(tValue, peekVoxel1px1py1pz());
00092             return tValue;
00093         }
00094         else
00095         {
00096             const uint8_t uSize = 1 << uLevel;
00097 
00098             VoxelType tValue = (std::numeric_limits<VoxelType>::max)();
00099             for(uint8_t z = 0; z < uSize; ++z)
00100             {
00101                 for(uint8_t y = 0; y < uSize; ++y)
00102                 {
00103                     for(uint8_t x = 0; x < uSize; ++x)
00104                     {
00105                         tValue = (std::min)(tValue, this->mVolume->getVoxelAt(this->mXPosInVolume + x, this->mYPosInVolume + y, this->mZPosInVolume + z));
00106                     }
00107                 }
00108             }
00109             return tValue;
00110         }
00111     }
00112 
00113     template <typename VoxelType>
00114     VoxelType LargeVolume<VoxelType>::Sampler::getVoxel(void) const
00115     {
00116         return *mCurrentVoxel;
00117     }
00118 
00119     template <typename VoxelType>
00120     void LargeVolume<VoxelType>::Sampler::setPosition(const Vector3DInt32& v3dNewPos)
00121     {
00122         setPosition(v3dNewPos.getX(), v3dNewPos.getY(), v3dNewPos.getZ());
00123     }
00124 
00125     template <typename VoxelType>
00126     void LargeVolume<VoxelType>::Sampler::setPosition(int32_t xPos, int32_t yPos, int32_t zPos)
00127     {
00128         this->mXPosInVolume = xPos;
00129         this->mYPosInVolume = yPos;
00130         this->mZPosInVolume = zPos;
00131 
00132         const int32_t uXBlock = this->mXPosInVolume >> this->mVolume->m_uBlockSideLengthPower;
00133         const int32_t uYBlock = this->mYPosInVolume >> this->mVolume->m_uBlockSideLengthPower;
00134         const int32_t uZBlock = this->mZPosInVolume >> this->mVolume->m_uBlockSideLengthPower;
00135 
00136         const uint16_t uXPosInBlock = this->mXPosInVolume - (uXBlock << this->mVolume->m_uBlockSideLengthPower);
00137         const uint16_t uYPosInBlock = this->mYPosInVolume - (uYBlock << this->mVolume->m_uBlockSideLengthPower);
00138         const uint16_t uZPosInBlock = this->mZPosInVolume - (uZBlock << this->mVolume->m_uBlockSideLengthPower);
00139 
00140         const uint32_t uVoxelIndexInBlock = uXPosInBlock + 
00141                 uYPosInBlock * this->mVolume->m_uBlockSideLength + 
00142                 uZPosInBlock * this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
00143 
00144         if(this->mVolume->m_regValidRegionInBlocks.containsPoint(Vector3DInt32(uXBlock, uYBlock, uZBlock)))
00145         {
00146             Block<VoxelType>* pUncompressedCurrentBlock = this->mVolume->getUncompressedBlock(uXBlock, uYBlock, uZBlock);
00147 
00148             mCurrentVoxel = pUncompressedCurrentBlock->m_tUncompressedData + uVoxelIndexInBlock;
00149         }
00150         else
00151         {
00152             mCurrentVoxel = this->mVolume->m_pUncompressedBorderData + uVoxelIndexInBlock;
00153         }
00154     }
00155 
00156     template <typename VoxelType>
00157     bool LargeVolume<VoxelType>::Sampler::setVoxel(VoxelType tValue)
00158     {
00159         //*mCurrentVoxel = tValue;
00160         //Need to think what effect this has on any existing iterators.
00161         assert(false);
00162         return false;
00163     }
00164 
00165     template <typename VoxelType>
00166     void LargeVolume<VoxelType>::Sampler::movePositiveX(void)
00167     {
00168         //Note the *pre* increament here
00169         if((++this->mXPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
00170         {
00171             //No need to compute new block.
00172             ++mCurrentVoxel;            
00173         }
00174         else
00175         {
00176             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00177             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00178         }
00179     }
00180 
00181     template <typename VoxelType>
00182     void LargeVolume<VoxelType>::Sampler::movePositiveY(void)
00183     {
00184         //Note the *pre* increament here
00185         if((++this->mYPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
00186         {
00187             //No need to compute new block.
00188             mCurrentVoxel += this->mVolume->m_uBlockSideLength;
00189         }
00190         else
00191         {
00192             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00193             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00194         }
00195     }
00196 
00197     template <typename VoxelType>
00198     void LargeVolume<VoxelType>::Sampler::movePositiveZ(void)
00199     {
00200         //Note the *pre* increament here
00201         if((++this->mZPosInVolume) % this->mVolume->m_uBlockSideLength != 0)
00202         {
00203             //No need to compute new block.
00204             mCurrentVoxel += this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
00205         }
00206         else
00207         {
00208             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00209             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00210         }
00211     }
00212 
00213     template <typename VoxelType>
00214     void LargeVolume<VoxelType>::Sampler::moveNegativeX(void)
00215     {
00216         //Note the *post* decreament here
00217         if((this->mXPosInVolume--) % this->mVolume->m_uBlockSideLength != 0)
00218         {
00219             //No need to compute new block.
00220             --mCurrentVoxel;            
00221         }
00222         else
00223         {
00224             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00225             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00226         }
00227     }
00228 
00229     template <typename VoxelType>
00230     void LargeVolume<VoxelType>::Sampler::moveNegativeY(void)
00231     {
00232         //Note the *post* decreament here
00233         if((this->mYPosInVolume--) % this->mVolume->m_uBlockSideLength != 0)
00234         {
00235             //No need to compute new block.
00236             mCurrentVoxel -= this->mVolume->m_uBlockSideLength;
00237         }
00238         else
00239         {
00240             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00241             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00242         }
00243     }
00244 
00245     template <typename VoxelType>
00246     void LargeVolume<VoxelType>::Sampler::moveNegativeZ(void)
00247     {
00248         //Note the *post* decreament here
00249         if((this->mZPosInVolume--) % this->mVolume->m_uBlockSideLength != 0)
00250         {
00251             //No need to compute new block.
00252             mCurrentVoxel -= this->mVolume->m_uBlockSideLength * this->mVolume->m_uBlockSideLength;
00253         }
00254         else
00255         {
00256             //We've hit the block boundary. Just calling setPosition() is the easiest way to resolve this.
00257             setPosition(this->mXPosInVolume, this->mYPosInVolume, this->mZPosInVolume);
00258         }
00259     }
00260 
00261     template <typename VoxelType>
00262     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const
00263     {
00264         if( BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00265         {
00266             return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00267         }
00268         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume-1);
00269     }
00270 
00271     template <typename VoxelType>
00272     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const
00273     {
00274         if( BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) )
00275         {
00276             return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength);
00277         }
00278         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume);
00279     }
00280 
00281     template <typename VoxelType>
00282     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const
00283     {
00284         if( BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00285         {
00286             return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00287         }
00288         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume-1,this->mZPosInVolume+1);
00289     }
00290 
00291     template <typename VoxelType>
00292     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const
00293     {
00294         if( BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00295         {
00296             return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00297         }
00298         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume-1);
00299     }
00300 
00301     template <typename VoxelType>
00302     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const
00303     {
00304         if( BORDER_LOW(this->mXPosInVolume) )
00305         {
00306             return *(mCurrentVoxel - 1);
00307         }
00308         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume);
00309     }
00310 
00311     template <typename VoxelType>
00312     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const
00313     {
00314         if( BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00315         {
00316             return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00317         }
00318         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume,this->mZPosInVolume+1);
00319     }
00320 
00321     template <typename VoxelType>
00322     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const
00323     {
00324         if( BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mYPosInVolume) )
00325         {
00326             return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00327         }
00328         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume-1);
00329     }
00330 
00331     template <typename VoxelType>
00332     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const
00333     {
00334         if( BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) )
00335         {
00336             return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength);
00337         }
00338         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume);
00339     }
00340 
00341     template <typename VoxelType>
00342     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const
00343     {
00344         if( BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00345         {
00346             return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00347         }
00348         return this->mVolume->getVoxelAt(this->mXPosInVolume-1,this->mYPosInVolume+1,this->mZPosInVolume+1);
00349     }
00350 
00352 
00353     template <typename VoxelType>
00354     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const
00355     {
00356         if( BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00357         {
00358             return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00359         }
00360         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume-1);
00361     }
00362 
00363     template <typename VoxelType>
00364     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const
00365     {
00366         if( BORDER_LOW(this->mYPosInVolume) )
00367         {
00368             return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength);
00369         }
00370         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume);
00371     }
00372 
00373     template <typename VoxelType>
00374     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const
00375     {
00376         if( BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00377         {
00378             return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00379         }
00380         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume-1,this->mZPosInVolume+1);
00381     }
00382 
00383     template <typename VoxelType>
00384     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const
00385     {
00386         if( BORDER_LOW(this->mZPosInVolume) )
00387         {
00388             return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00389         }
00390         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume,this->mZPosInVolume-1);
00391     }
00392 
00393     template <typename VoxelType>
00394     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py0pz(void) const
00395     {
00396             return *mCurrentVoxel;
00397     }
00398 
00399     template <typename VoxelType>
00400     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const
00401     {
00402         if( BORDER_HIGH(this->mZPosInVolume) )
00403         {
00404             return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00405         }
00406         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume,this->mZPosInVolume+1);
00407     }
00408 
00409     template <typename VoxelType>
00410     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const
00411     {
00412         if( BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00413         {
00414             return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00415         }
00416         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume-1);
00417     }
00418 
00419     template <typename VoxelType>
00420     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const
00421     {
00422         if( BORDER_HIGH(this->mYPosInVolume) )
00423         {
00424             return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength);
00425         }
00426         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume);
00427     }
00428 
00429     template <typename VoxelType>
00430     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const
00431     {
00432         if( BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00433         {
00434             return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00435         }
00436         return this->mVolume->getVoxelAt(this->mXPosInVolume,this->mYPosInVolume+1,this->mZPosInVolume+1);
00437     }
00438 
00440 
00441     template <typename VoxelType>
00442     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const
00443     {
00444         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00445         {
00446             return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00447         }
00448         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume-1);
00449     }
00450 
00451     template <typename VoxelType>
00452     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const
00453     {
00454         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) )
00455         {
00456             return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength);
00457         }
00458         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume);
00459     }
00460 
00461     template <typename VoxelType>
00462     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const
00463     {
00464         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00465         {
00466             return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00467         }
00468         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume-1,this->mZPosInVolume+1);
00469     }
00470 
00471     template <typename VoxelType>
00472     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const
00473     {
00474         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00475         {
00476             return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00477         }
00478         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume-1);
00479     }
00480 
00481     template <typename VoxelType>
00482     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const
00483     {
00484         if( BORDER_HIGH(this->mXPosInVolume) )
00485         {
00486             return *(mCurrentVoxel + 1);
00487         }
00488         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume);
00489     }
00490 
00491     template <typename VoxelType>
00492     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const
00493     {
00494         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00495         {
00496             return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00497         }
00498         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume,this->mZPosInVolume+1);
00499     }
00500 
00501     template <typename VoxelType>
00502     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const
00503     {
00504         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) )
00505         {
00506             return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00507         }
00508         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume-1);
00509     }
00510 
00511     template <typename VoxelType>
00512     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const
00513     {
00514         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) )
00515         {
00516             return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength);
00517         }
00518         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume);
00519     }
00520 
00521     template <typename VoxelType>
00522     VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const
00523     {
00524         if( BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) )
00525         {
00526             return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength);
00527         }
00528         return this->mVolume->getVoxelAt(this->mXPosInVolume+1,this->mYPosInVolume+1,this->mZPosInVolume+1);
00529     }
00530 }
00531 
00532 #undef BORDER_LOW
00533 #undef BORDER_HIGH

Generated on Sat Nov 19 2011 00:27:30 for PolyVox by  doxygen 1.7.1