diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e8bbf35..1b587ab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,7 +26,7 @@ PROJECT(PolyVox) SET(POLYVOX_VERSION_MAJOR "0") SET(POLYVOX_VERSION_MINOR "2") -SET(POLYVOX_VERSION_PATCH "0") +SET(POLYVOX_VERSION_PATCH "1") SET(POLYVOX_VERSION "${POLYVOX_VERSION_MAJOR}.${POLYVOX_VERSION_MINOR}.${POLYVOX_VERSION_PATCH}" CACHE STRING "PolyVox version") MARK_AS_ADVANCED(FORCE POLYVOX_VERSION) diff --git a/README.rst b/README.rst index 9081fcb5..9bf85940 100644 --- a/README.rst +++ b/README.rst @@ -1,4 +1,5 @@ PolyVox - The voxel management and manipulation library ======================================================= +PolyVox is the core technology which lies behind our games. It is a fast, lightweight C++ library for the storage and processing of volumetric (voxel-based) environments. It has applications in both games and medical/scientific visualisation, and is released under the terms of the `zlib license `_. -For installation instructions, please see INSTALL.txt +PolyVox is a relatively low-level library, and you will need experience in C++ and computer graphics/shaders to use it effectively. It is designed to be easily integrated into existing applications and is independent of your chosen graphics API. For more details please see `this page `_ on our website. \ No newline at end of file diff --git a/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h b/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h index 5775c4ba..81ddb9e5 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h +++ b/library/PolyVoxCore/include/PolyVoxCore/DefaultIsQuadNeeded.h @@ -24,7 +24,7 @@ freely, subject to the following restrictions: #ifndef __PolyVox_DefaultIsQuadNeeded_H__ #define __PolyVox_DefaultIsQuadNeeded_H__ -#include +#include "PolyVoxCore/Impl/TypeDef.h" namespace PolyVox { diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl index 4e679477..8a6634f7 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.inl @@ -422,18 +422,25 @@ namespace PolyVox this->m_regValidRegion = regValidRegion; - m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); - m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); + //m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); + //m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); + //Compute the block side length + m_uBlockSideLength = uBlockSideLength; + m_uBlockSideLengthPower = logBase2(m_uBlockSideLength); + //m_regValidRegionInBlocks.setLowerX(this->m_regValidRegion.getLowerX() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setLowerY(this->m_regValidRegion.getLowerY() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setLowerZ(this->m_regValidRegion.getLowerZ() >> m_uBlockSideLengthPower); + m_regValidRegionInBlocks.setLowerCorner(Vector3DInt32(this->m_regValidRegion.getLowerCorner().getX() >> m_uBlockSideLengthPower, this->m_regValidRegion.getLowerCorner().getY() >> m_uBlockSideLengthPower, this->m_regValidRegion.getLowerCorner().getZ() >> m_uBlockSideLengthPower)); + //m_regValidRegionInBlocks.setUpperX(this->m_regValidRegion.getUpperX() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setUpperY(this->m_regValidRegion.getUpperY() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setUpperZ(this->m_regValidRegion.getUpperZ() >> m_uBlockSideLengthPower); + m_regValidRegionInBlocks.setUpperCorner(Vector3DInt32(this->m_regValidRegion.getUpperCorner().getX() >> m_uBlockSideLengthPower, this->m_regValidRegion.getUpperCorner().getY() >> m_uBlockSideLengthPower, this->m_regValidRegion.getUpperCorner().getZ() >> m_uBlockSideLengthPower)); setMaxNumberOfUncompressedBlocks(m_uMaxNumberOfUncompressedBlocks); //Clear the previous data m_pBlocks.clear(); - //Compute the block side length - m_uBlockSideLength = uBlockSideLength; - m_uBlockSideLengthPower = logBase2(m_uBlockSideLength); - //Clear the previous data m_pBlocks.clear(); diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl index 758e578d..39f51f3e 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl @@ -238,7 +238,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1ny1nz(void) const { - if( BORDER_LOWX(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if( BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) { return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl index 12cee40f..f811f456 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.inl @@ -197,18 +197,28 @@ namespace PolyVox throw std::invalid_argument("Block side length must be a power of two."); } - m_uBlockSideLength = uBlockSideLength; - m_uNoOfVoxelsPerBlock = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength; + //m_uBlockSideLength = uBlockSideLength; + //m_uNoOfVoxelsPerBlock = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength; m_pUncompressedBorderData = 0; this->m_regValidRegion = regValidRegion; - m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); - m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); + //m_regValidRegionInBlocks.setLowerCorner(this->m_regValidRegion.getLowerCorner() / static_cast(uBlockSideLength)); + //m_regValidRegionInBlocks.setUpperCorner(this->m_regValidRegion.getUpperCorner() / static_cast(uBlockSideLength)); //Compute the block side length m_uBlockSideLength = uBlockSideLength; m_uBlockSideLengthPower = logBase2(m_uBlockSideLength); + m_uNoOfVoxelsPerBlock = m_uBlockSideLength * m_uBlockSideLength * m_uBlockSideLength; + + //m_regValidRegionInBlocks.setLowerX(this->m_regValidRegion.getLowerX() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setLowerY(this->m_regValidRegion.getLowerY() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setLowerZ(this->m_regValidRegion.getLowerZ() >> m_uBlockSideLengthPower); + m_regValidRegionInBlocks.setLowerCorner(Vector3DInt32(this->m_regValidRegion.getLowerCorner().getX() >> m_uBlockSideLengthPower, this->m_regValidRegion.getLowerCorner().getY() >> m_uBlockSideLengthPower, this->m_regValidRegion.getLowerCorner().getZ() >> m_uBlockSideLengthPower)); + //m_regValidRegionInBlocks.setUpperX(this->m_regValidRegion.getUpperX() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setUpperY(this->m_regValidRegion.getUpperY() >> m_uBlockSideLengthPower); + //m_regValidRegionInBlocks.setUpperZ(this->m_regValidRegion.getUpperZ() >> m_uBlockSideLengthPower); + m_regValidRegionInBlocks.setUpperCorner(Vector3DInt32(this->m_regValidRegion.getUpperCorner().getX() >> m_uBlockSideLengthPower, this->m_regValidRegion.getUpperCorner().getY() >> m_uBlockSideLengthPower, this->m_regValidRegion.getUpperCorner().getZ() >> m_uBlockSideLengthPower)); //Compute the size of the volume in blocks (and note +1 at the end) m_uWidthInBlocks = m_regValidRegionInBlocks.getUpperCorner().getX() - m_regValidRegionInBlocks.getLowerCorner().getX() + 1; diff --git a/tests/TestLowPassFilter.cpp b/tests/TestLowPassFilter.cpp index 4ace36eb..902c26d6 100644 --- a/tests/TestLowPassFilter.cpp +++ b/tests/TestLowPassFilter.cpp @@ -58,7 +58,7 @@ void TestLowPassFilter::testExecute() RawVolume resultVolume(reg); - LowPassFilter< RawVolume, RawVolume, Density16 > lowPassfilter(&volData, reg, &resultVolume, reg, 5); + LowPassFilter< RawVolume, RawVolume, Density16 > lowPassfilter(&volData, reg, &resultVolume, reg, 3); //Test the normal implementation QBENCHMARK { @@ -74,16 +74,17 @@ void TestLowPassFilter::testExecute() QCOMPARE(resultVolume.getVoxelAt(7,7,7), Density8(4)); //Test the SAT implmentation - //FIXME - Shouldn't the results be the same as the normal case? - lowPassfilter.executeSAT(); + QBENCHMARK { + lowPassfilter.executeSAT(); + } QCOMPARE(resultVolume.getVoxelAt(0,0,0), Density8(4)); - QCOMPARE(resultVolume.getVoxelAt(1,1,1), Density8(8)); - QCOMPARE(resultVolume.getVoxelAt(2,2,2), Density8(19)); - QCOMPARE(resultVolume.getVoxelAt(3,3,3), Density8(12)); - QCOMPARE(resultVolume.getVoxelAt(4,4,4), Density8(19)); - QCOMPARE(resultVolume.getVoxelAt(5,5,5), Density8(12)); - QCOMPARE(resultVolume.getVoxelAt(6,6,6), Density8(8)); - QCOMPARE(resultVolume.getVoxelAt(7,7,7), Density8(2)); + QCOMPARE(resultVolume.getVoxelAt(1,1,1), Density8(21)); + QCOMPARE(resultVolume.getVoxelAt(2,2,2), Density8(10)); + QCOMPARE(resultVolume.getVoxelAt(3,3,3), Density8(21)); + QCOMPARE(resultVolume.getVoxelAt(4,4,4), Density8(10)); + QCOMPARE(resultVolume.getVoxelAt(5,5,5), Density8(21)); + QCOMPARE(resultVolume.getVoxelAt(6,6,6), Density8(10)); + QCOMPARE(resultVolume.getVoxelAt(7,7,7), Density8(4)); } QTEST_MAIN(TestLowPassFilter)