diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h index 371bb66e..f223498a 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolume.h @@ -177,8 +177,6 @@ namespace PolyVox Sampler(LargeVolume* volume); ~Sampler(); - Sampler& operator=(const Sampler& rhs); - /// \deprecated POLYVOX_DEPRECATED VoxelType getSubSampledVoxel(uint8_t uLevel) const; inline VoxelType getVoxel(void) const; diff --git a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl index 97c11c9f..733de9b3 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/LargeVolumeSampler.inl @@ -39,21 +39,6 @@ namespace PolyVox { } - template - typename LargeVolume::Sampler& LargeVolume::Sampler::operator=(const typename LargeVolume::Sampler& rhs) - { - if(this == &rhs) - { - return *this; - } - this->mVolume = rhs.mVolume; - this->mXPosInVolume = rhs.mXPosInVolume; - this->mYPosInVolume = rhs.mYPosInVolume; - this->mZPosInVolume = rhs.mZPosInVolume; - mCurrentVoxel = rhs.mCurrentVoxel; - return *this; - } - template VoxelType LargeVolume::Sampler::getSubSampledVoxel(uint8_t uLevel) const { diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h index 3ddafdbf..95326ee7 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolume.h @@ -87,8 +87,6 @@ namespace PolyVox Sampler(SimpleVolume* volume); ~Sampler(); - Sampler& operator=(const Sampler& rhs); - /// \deprecated POLYVOX_DEPRECATED VoxelType getSubSampledVoxel(uint8_t uLevel) const; /// Get the value of the current voxel diff --git a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl index 97842995..2f6f62f8 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/SimpleVolumeSampler.inl @@ -42,21 +42,6 @@ namespace PolyVox { } - template - typename SimpleVolume::Sampler& SimpleVolume::Sampler::operator=(const typename SimpleVolume::Sampler& rhs) - { - if(this == &rhs) - { - return *this; - } - this->mVolume = rhs.mVolume; - this->mXPosInVolume = rhs.mXPosInVolume; - this->mYPosInVolume = rhs.mYPosInVolume; - this->mZPosInVolume = rhs.mZPosInVolume; - mCurrentVoxel = rhs.mCurrentVoxel; - return *this; - } - template VoxelType SimpleVolume::Sampler::getSubSampledVoxel(uint8_t uLevel) const { diff --git a/tests/testvolume.cpp b/tests/testvolume.cpp index 251e90b9..943ffe53 100644 --- a/tests/testvolume.cpp +++ b/tests/testvolume.cpp @@ -66,7 +66,7 @@ int32_t complexVolumeTest(void) //Test border wrap mode for(int z = testVolume.getEnclosingRegion().getLowerZ(); z <= testVolume.getEnclosingRegion().getUpperZ(); z++) { - //Just a few slices from y + //Extending outside in y for(int y = testVolume.getEnclosingRegion().getLowerY() - 3; y <= testVolume.getEnclosingRegion().getUpperY() + 5; y++) { for(int x = testVolume.getEnclosingRegion().getLowerX(); x <= testVolume.getEnclosingRegion().getUpperX(); x++) @@ -81,7 +81,7 @@ int32_t complexVolumeTest(void) { for(int y = testVolume.getEnclosingRegion().getLowerY(); y <= testVolume.getEnclosingRegion().getUpperY(); y++) { - //Just a few slices from y + //Extending outside in x for(int x = testVolume.getEnclosingRegion().getLowerX() - 2; x <= testVolume.getEnclosingRegion().getUpperX() + 4; x++) { result += testVolume.getVoxelWithWrapping(x, y, z, WrapModes::Clamp); @@ -89,25 +89,76 @@ int32_t complexVolumeTest(void) } } + //Test the sampler setPosition + /*VolumeType::Sampler sampler(&testVolume); + sampler.setWrapMode(WrapModes::Border, 1); + + for(int z = testVolume.getEnclosingRegion().getLowerZ() - 2; z <= testVolume.getEnclosingRegion().getUpperZ() + 1; z++) + { + for(int y = testVolume.getEnclosingRegion().getLowerY() - 1; y <= testVolume.getEnclosingRegion().getUpperY() + 3; y++) + { + for(int x = testVolume.getEnclosingRegion().getLowerX() - 4; x <= testVolume.getEnclosingRegion().getUpperX() + 2; x++) + { + sampler.setPosition(x,y,z); + result += sampler.getVoxel(); + } + } + }*/ + + //Test the sampler move functions + VolumeType::Sampler xSampler(&testVolume); + VolumeType::Sampler ySampler(&testVolume); + VolumeType::Sampler zSampler(&testVolume); + VolumeType::Sampler sampler(&testVolume); + + xSampler.setWrapMode(WrapModes::Border, 1); + ySampler.setWrapMode(WrapModes::Border, 1); + zSampler.setWrapMode(WrapModes::Border, 1); + sampler.setWrapMode(WrapModes::Border, 1); + + //zSampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, testVolume.getEnclosingRegion().getLowerZ() - 2); + for(int z = testVolume.getEnclosingRegion().getLowerZ() - 2; z <= testVolume.getEnclosingRegion().getUpperZ() + 1; z++) + { + //ySampler = zSampler; + ySampler.setPosition(testVolume.getEnclosingRegion().getLowerX() - 4, testVolume.getEnclosingRegion().getLowerY() - 1, z); + for(int y = testVolume.getEnclosingRegion().getLowerY() - 1; y <= testVolume.getEnclosingRegion().getUpperY() + 3; y++) + { + xSampler = ySampler; + for(int x = testVolume.getEnclosingRegion().getLowerX() - 4; x <= testVolume.getEnclosingRegion().getUpperX() + 2; x++) + { + sampler.setPosition(x,y,z); + + int32_t sample = sampler.isCurrentPositionValid(); + int32_t xSample = xSampler.isCurrentPositionValid(); + assert(sample == xSample); + + result += xSampler.getVoxel(); + xSampler.movePositiveX(); + } + ySampler.movePositiveY(); + } + //zSampler.movePositiveZ(); + } + return result; } void TestVolume::testLargeVolume() { int32_t result = complexVolumeTest< LargeVolume >(); - QCOMPARE(result, static_cast(616456320)); + QCOMPARE(result, static_cast(818107008)); } void TestVolume::testRawVolume() { int32_t result = complexVolumeTest< RawVolume >(); - QCOMPARE(result, static_cast(616456320)); + QCOMPARE(result, static_cast(818107008)); } void TestVolume::testSimpleVolume() { int32_t result = complexVolumeTest< SimpleVolume >(); - QCOMPARE(result, static_cast(616456320)); + QCOMPARE(result, static_cast(818107008)); } QTEST_MAIN(TestVolume)