Initial version of IteratorController and making LowPassFilter use iterators.
This commit is contained in:
parent
90063354bd
commit
e8b3fd16e2
@ -31,6 +31,8 @@ SET(CORE_INC_FILES
|
||||
include/PolyVoxCore/Density.h
|
||||
include/PolyVoxCore/GradientEstimators.h
|
||||
include/PolyVoxCore/GradientEstimators.inl
|
||||
include/PolyVoxCore/IteratorController.h
|
||||
include/PolyVoxCore/IteratorController.inl
|
||||
include/PolyVoxCore/LargeVolume.h
|
||||
include/PolyVoxCore/LargeVolume.inl
|
||||
include/PolyVoxCore/LargeVolumeSampler.inl
|
||||
|
@ -21,6 +21,7 @@ freely, subject to the following restrictions:
|
||||
distribution.
|
||||
*******************************************************************************/
|
||||
|
||||
#include "PolyVoxCore/IteratorController.h"
|
||||
#include "PolyVoxCore/RawVolume.h"
|
||||
|
||||
namespace PolyVox
|
||||
@ -139,8 +140,34 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
RawVolume<uint32_t>::Sampler satVolumeIter(&satVolume);
|
||||
|
||||
IteratorController<RawVolume<uint32_t>::Sampler> satIterCont;
|
||||
satIterCont.m_regValid = Region(satLowerCorner, satUpperCorner);
|
||||
satIterCont.m_Iter = &satVolumeIter;
|
||||
satIterCont.reset();
|
||||
|
||||
SrcVolumeType<VoxelType>::Sampler srcVolumeIter(m_pVolSrc);
|
||||
|
||||
IteratorController<SrcVolumeType<VoxelType>::Sampler> srcIterCont;
|
||||
srcIterCont.m_regValid = Region(satLowerCorner, satUpperCorner);
|
||||
srcIterCont.m_Iter = &srcVolumeIter;
|
||||
srcIterCont.reset();
|
||||
|
||||
do
|
||||
{
|
||||
uint32_t previousSum = satVolumeIter.peekVoxel1nx0py0pz();
|
||||
|
||||
uint32_t currentVal = srcVolumeIter.getVoxel().getDensity();
|
||||
|
||||
satVolumeIter.setVoxel(previousSum + currentVal);
|
||||
|
||||
srcIterCont.moveForward();
|
||||
|
||||
}while(satIterCont.moveForward());
|
||||
|
||||
//Build SAT in three passes
|
||||
for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
|
||||
/*for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
|
||||
{
|
||||
for(int32_t y = satLowerCorner.getY(); y <= satUpperCorner.getY(); y++)
|
||||
{
|
||||
@ -152,7 +179,7 @@ namespace PolyVox
|
||||
satVolume.setVoxelAt(x,y,z,previousSum + currentVal);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
for(int32_t z = satLowerCorner.getZ(); z <= satUpperCorner.getZ(); z++)
|
||||
{
|
||||
|
@ -61,6 +61,10 @@ void TestLowPassFilter::testExecute()
|
||||
LowPassFilter<RawVolume, RawVolume, Density8> pass1(&volData, reg, &resultVolume, reg, 5);
|
||||
|
||||
pass1.executeSAT();
|
||||
|
||||
std::cout << "Voxel = " << static_cast<int>(resultVolume.getVoxelAt(1,2,3).getDensity()) << std::endl; // 7
|
||||
std::cout << "Voxel = " << static_cast<int>(resultVolume.getVoxelAt(10,6,7).getDensity()) << std::endl; // 17
|
||||
std::cout << "Voxel = " << static_cast<int>(resultVolume.getVoxelAt(15,2,12).getDensity()) << std::endl; // 4
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestLowPassFilter)
|
||||
|
Loading…
x
Reference in New Issue
Block a user