diff --git a/library/include/PolyVoxCore/BlockVolumeIterator.inl b/library/include/PolyVoxCore/BlockVolumeIterator.inl index b1c6d04b..f08750ab 100644 --- a/library/include/PolyVoxCore/BlockVolumeIterator.inl +++ b/library/include/PolyVoxCore/BlockVolumeIterator.inl @@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "BlockVolume.h" #include "Vector.h" #include "Region.h" + +#include #pragma endregion namespace PolyVox @@ -133,27 +135,27 @@ namespace PolyVox else if(uLevel == 1) { VoxelType tValue = getVoxel(); - tValue = (std::max)(tValue, peekVoxel1px0py0pz()); - tValue = (std::max)(tValue, peekVoxel0px1py0pz()); - tValue = (std::max)(tValue, peekVoxel1px1py0pz()); - tValue = (std::max)(tValue, peekVoxel0px0py1pz()); - tValue = (std::max)(tValue, peekVoxel1px0py1pz()); - tValue = (std::max)(tValue, peekVoxel0px1py1pz()); - tValue = (std::max)(tValue, peekVoxel1px1py1pz()); + tValue = (std::min)(tValue, peekVoxel1px0py0pz()); + tValue = (std::min)(tValue, peekVoxel0px1py0pz()); + tValue = (std::min)(tValue, peekVoxel1px1py0pz()); + tValue = (std::min)(tValue, peekVoxel0px0py1pz()); + tValue = (std::min)(tValue, peekVoxel1px0py1pz()); + tValue = (std::min)(tValue, peekVoxel0px1py1pz()); + tValue = (std::min)(tValue, peekVoxel1px1py1pz()); return tValue; } else { const uint8 uSize = 1 << uLevel; - VoxelType tValue = 0; + VoxelType tValue = std::numeric_limits::max(); for(uint8 z = 0; z < uSize; ++z) { for(uint8 y = 0; y < uSize; ++y) { for(uint8 x = 0; x < uSize; ++x) { - tValue = (std::max)(tValue, mVolume.getVoxelAt(mXPosInVolume + x, mYPosInVolume + y, mZPosInVolume + z)); + tValue = (std::min)(tValue, mVolume.getVoxelAt(mXPosInVolume + x, mYPosInVolume + y, mZPosInVolume + z)); } } } diff --git a/library/include/PolyVoxCore/Constants.h b/library/include/PolyVoxCore/Constants.h index 6bfe2e23..3edeea58 100644 --- a/library/include/PolyVoxCore/Constants.h +++ b/library/include/PolyVoxCore/Constants.h @@ -37,7 +37,7 @@ namespace PolyVox //const uint32 POLYVOX_NO_OF_BLOCKS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS); //const uint32 POLYVOX_NO_OF_VOXELS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH); - const uint16 POLYVOX_REGION_SIDE_LENGTH_POWER = 4; + const uint16 POLYVOX_REGION_SIDE_LENGTH_POWER = 5; const uint16 POLYVOX_REGION_SIDE_LENGTH = (0x0001 << POLYVOX_REGION_SIDE_LENGTH_POWER); const uint16 POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_REGION_SIDE_LENGTH_POWER); }