Merge branch 'develop' into feature/cubiquity-version
Conflicts: library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.inl library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.inl
This commit is contained in:
commit
328d40f712
@ -201,15 +201,15 @@ void load(const ConstVolumeProxy<MaterialDensityPair44>& volume, const PolyVox::
|
||||
{
|
||||
Perlin perlin(2,2,1,234);
|
||||
|
||||
for(int x = reg.getLowerCorner().getX(); x <= reg.getUpperCorner().getX(); x++)
|
||||
for(int x = reg.getLowerX(); x <= reg.getUpperX(); x++)
|
||||
{
|
||||
for(int y = reg.getLowerCorner().getY(); y <= reg.getUpperCorner().getY(); y++)
|
||||
for(int y = reg.getLowerY(); y <= reg.getUpperY(); y++)
|
||||
{
|
||||
float perlinVal = perlin.Get(x / static_cast<float>(255-1), y / static_cast<float>(255-1));
|
||||
perlinVal += 1.0f;
|
||||
perlinVal *= 0.5f;
|
||||
perlinVal *= 255;
|
||||
for(int z = reg.getLowerCorner().getZ(); z <= reg.getUpperCorner().getZ(); z++)
|
||||
for(int z = reg.getLowerZ(); z <= reg.getUpperZ(); z++)
|
||||
{
|
||||
MaterialDensityPair44 voxel;
|
||||
if(z < perlinVal)
|
||||
|
@ -45,8 +45,8 @@ namespace PolyVox
|
||||
|
||||
//Our initial indices. It doesn't matter exactly what we set here, but the code below makes
|
||||
//sure they are different for different regions which helps reduce tiling patterns in the results.
|
||||
uRandomUnitVectorIndex += region.getLowerCorner().getX() + region.getLowerCorner().getY() + region.getLowerCorner().getZ();
|
||||
uRandomVectorIndex += region.getLowerCorner().getX() + region.getLowerCorner().getY() + region.getLowerCorner().getZ();
|
||||
uRandomUnitVectorIndex += region.getLowerX() + region.getLowerY() + region.getLowerZ();
|
||||
uRandomVectorIndex += region.getLowerX() + region.getLowerY() + region.getLowerZ();
|
||||
|
||||
//This value helps us jump around in the array a bit more, so the
|
||||
//nth 'random' value isn't always followed by the n+1th 'random' value.
|
||||
@ -69,11 +69,11 @@ namespace PolyVox
|
||||
const Vector3DFloat v3dOffset(0.5f,0.5f,0.5f);
|
||||
|
||||
//This loop iterates over the bottom-lower-left voxel in each of the cells in the output array
|
||||
for(uint16_t z = region.getLowerCorner().getZ(); z <= region.getUpperCorner().getZ(); z += iRatioZ)
|
||||
for(uint16_t z = region.getLowerZ(); z <= region.getUpperZ(); z += iRatioZ)
|
||||
{
|
||||
for(uint16_t y = region.getLowerCorner().getY(); y <= region.getUpperCorner().getY(); y += iRatioY)
|
||||
for(uint16_t y = region.getLowerY(); y <= region.getUpperY(); y += iRatioY)
|
||||
{
|
||||
for(uint16_t x = region.getLowerCorner().getX(); x <= region.getUpperCorner().getX(); x += iRatioX)
|
||||
for(uint16_t x = region.getLowerX(); x <= region.getUpperX(); x += iRatioX)
|
||||
{
|
||||
//Compute a start position corresponding to
|
||||
//the centre of the cell in the output array.
|
||||
|
@ -96,7 +96,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t BaseVolume<VoxelType>::getWidth(void) const
|
||||
{
|
||||
return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1;
|
||||
return m_regValidRegion.getUpperX() - m_regValidRegion.getLowerX() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -106,7 +106,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t BaseVolume<VoxelType>::getHeight(void) const
|
||||
{
|
||||
return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1;
|
||||
return m_regValidRegion.getUpperY() - m_regValidRegion.getLowerY() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -116,7 +116,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t BaseVolume<VoxelType>::getDepth(void) const
|
||||
{
|
||||
return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1;
|
||||
return m_regValidRegion.getUpperZ() - m_regValidRegion.getLowerZ() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -65,7 +65,7 @@ namespace PolyVox
|
||||
void compress(Compressor* pCompressor);
|
||||
void uncompress(Compressor* pCompressor);
|
||||
|
||||
void* m_pCompressedData;
|
||||
uint8_t* m_pCompressedData;
|
||||
uint32_t m_uCompressedDataLength;
|
||||
VoxelType* m_tUncompressedData;
|
||||
uint16_t m_uSideLength;
|
||||
|
@ -167,7 +167,7 @@ namespace PolyVox
|
||||
uCompressedLength = pCompressor->compress(pSrcData, uSrcLength, pDstData, uDstLength);
|
||||
|
||||
// Create new compressed data and copy across
|
||||
m_pCompressedData = reinterpret_cast<void*>( new uint8_t[uCompressedLength] );
|
||||
m_pCompressedData = new uint8_t[uCompressedLength];
|
||||
memcpy(m_pCompressedData, pDstData, uCompressedLength);
|
||||
m_uCompressedDataLength = uCompressedLength;
|
||||
}
|
||||
@ -187,7 +187,7 @@ namespace PolyVox
|
||||
uCompressedLength = pCompressor->compress(pSrcData, uSrcLength, pDstData, uDstLength);
|
||||
|
||||
// Create new compressed data and copy across
|
||||
m_pCompressedData = reinterpret_cast<void*>( new uint8_t[uCompressedLength] );
|
||||
m_pCompressedData = new uint8_t[uCompressedLength];
|
||||
memcpy(m_pCompressedData, pDstData, uCompressedLength);
|
||||
m_uCompressedDataLength = uCompressedLength;
|
||||
}
|
||||
|
@ -34,24 +34,24 @@ namespace PolyVox
|
||||
{
|
||||
Vector3DInt32 v3dInitialPosition(m_Iter->getPosition().getX(), m_Iter->getPosition().getY(), m_Iter->getPosition().getZ());
|
||||
|
||||
if(v3dInitialPosition.getX() < m_regValid.getUpperCorner().getX())
|
||||
if(v3dInitialPosition.getX() < m_regValid.getUpperX())
|
||||
{
|
||||
m_Iter->movePositiveX();
|
||||
return true;
|
||||
}
|
||||
|
||||
v3dInitialPosition.setX(m_regValid.getLowerCorner().getX());
|
||||
v3dInitialPosition.setX(m_regValid.getLowerX());
|
||||
|
||||
if(v3dInitialPosition.getY() < m_regValid.getUpperCorner().getY())
|
||||
if(v3dInitialPosition.getY() < m_regValid.getUpperY())
|
||||
{
|
||||
v3dInitialPosition.setY(v3dInitialPosition.getY() + 1);
|
||||
m_Iter->setPosition(v3dInitialPosition);
|
||||
return true;
|
||||
}
|
||||
|
||||
v3dInitialPosition.setY(m_regValid.getLowerCorner().getY());
|
||||
v3dInitialPosition.setY(m_regValid.getLowerY());
|
||||
|
||||
if(v3dInitialPosition.getZ() < m_regValid.getUpperCorner().getZ())
|
||||
if(v3dInitialPosition.getZ() < m_regValid.getUpperZ())
|
||||
{
|
||||
v3dInitialPosition.setZ(v3dInitialPosition.getZ() + 1);
|
||||
m_Iter->setPosition(v3dInitialPosition);
|
||||
|
@ -21,12 +21,12 @@ freely, subject to the following restrictions:
|
||||
distribution.
|
||||
*******************************************************************************/
|
||||
|
||||
#define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerX()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerY()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerZ()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
|
@ -53,21 +53,21 @@ namespace PolyVox
|
||||
template< typename SrcVolumeType, typename DstVolumeType, typename AccumulationType>
|
||||
void LowPassFilter<SrcVolumeType, DstVolumeType, AccumulationType>::execute()
|
||||
{
|
||||
int32_t iSrcMinX = m_regSrc.getLowerCorner().getX();
|
||||
int32_t iSrcMinY = m_regSrc.getLowerCorner().getY();
|
||||
int32_t iSrcMinZ = m_regSrc.getLowerCorner().getZ();
|
||||
int32_t iSrcMinX = m_regSrc.getLowerX();
|
||||
int32_t iSrcMinY = m_regSrc.getLowerY();
|
||||
int32_t iSrcMinZ = m_regSrc.getLowerZ();
|
||||
|
||||
int32_t iSrcMaxX = m_regSrc.getUpperCorner().getX();
|
||||
int32_t iSrcMaxY = m_regSrc.getUpperCorner().getY();
|
||||
int32_t iSrcMaxZ = m_regSrc.getUpperCorner().getZ();
|
||||
int32_t iSrcMaxX = m_regSrc.getUpperX();
|
||||
int32_t iSrcMaxY = m_regSrc.getUpperY();
|
||||
int32_t iSrcMaxZ = m_regSrc.getUpperZ();
|
||||
|
||||
int32_t iDstMinX = m_regDst.getLowerCorner().getX();
|
||||
int32_t iDstMinY = m_regDst.getLowerCorner().getY();
|
||||
int32_t iDstMinZ = m_regDst.getLowerCorner().getZ();
|
||||
int32_t iDstMinX = m_regDst.getLowerX();
|
||||
int32_t iDstMinY = m_regDst.getLowerY();
|
||||
int32_t iDstMinZ = m_regDst.getLowerZ();
|
||||
|
||||
//int32_t iDstMaxX = m_regDst.getUpperCorner().getX();
|
||||
//int32_t iDstMaxY = m_regDst.getUpperCorner().getY();
|
||||
//int32_t iDstMaxZ = m_regDst.getUpperCorner().getZ();
|
||||
//int32_t iDstMaxX = m_regDst.getUpperX();
|
||||
//int32_t iDstMaxY = m_regDst.getUpperY();
|
||||
//int32_t iDstMaxZ = m_regDst.getUpperZ();
|
||||
|
||||
typename SrcVolumeType::Sampler srcSampler(m_pVolSrc);
|
||||
|
||||
|
@ -21,12 +21,12 @@ freely, subject to the following restrictions:
|
||||
distribution.
|
||||
*******************************************************************************/
|
||||
|
||||
#define CAN_GO_NEG_X(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getX())
|
||||
#define CAN_GO_POS_X(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getX())
|
||||
#define CAN_GO_NEG_Y(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getY())
|
||||
#define CAN_GO_POS_Y(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getY())
|
||||
#define CAN_GO_NEG_Z(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ())
|
||||
#define CAN_GO_POS_Z(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ())
|
||||
#define CAN_GO_NEG_X(val) (val > this->mVolume->getEnclosingRegion().getLowerX())
|
||||
#define CAN_GO_POS_X(val) (val < this->mVolume->getEnclosingRegion().getUpperX())
|
||||
#define CAN_GO_NEG_Y(val) (val > this->mVolume->getEnclosingRegion().getLowerY())
|
||||
#define CAN_GO_POS_Y(val) (val < this->mVolume->getEnclosingRegion().getUpperY())
|
||||
#define CAN_GO_NEG_Z(val) (val > this->mVolume->getEnclosingRegion().getLowerZ())
|
||||
#define CAN_GO_POS_Z(val) (val < this->mVolume->getEnclosingRegion().getUpperZ())
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
|
@ -281,9 +281,9 @@ namespace PolyVox
|
||||
m_regValidRegionInBlocks.setUpperZ(this->m_regValidRegion.getUpperZ() >> 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;
|
||||
m_uHeightInBlocks = m_regValidRegionInBlocks.getUpperCorner().getY() - m_regValidRegionInBlocks.getLowerCorner().getY() + 1;
|
||||
m_uDepthInBlocks = m_regValidRegionInBlocks.getUpperCorner().getZ() - m_regValidRegionInBlocks.getLowerCorner().getZ() + 1;
|
||||
m_uWidthInBlocks = m_regValidRegionInBlocks.getUpperX() - m_regValidRegionInBlocks.getLowerX() + 1;
|
||||
m_uHeightInBlocks = m_regValidRegionInBlocks.getUpperY() - m_regValidRegionInBlocks.getLowerY() + 1;
|
||||
m_uDepthInBlocks = m_regValidRegionInBlocks.getUpperZ() - m_regValidRegionInBlocks.getLowerZ() + 1;
|
||||
m_uNoOfBlocksInVolume = m_uWidthInBlocks * m_uHeightInBlocks * m_uDepthInBlocks;
|
||||
|
||||
//Allocate the data
|
||||
@ -304,9 +304,9 @@ namespace PolyVox
|
||||
{
|
||||
//The lower left corner of the volume could be
|
||||
//anywhere, but array indices need to start at zero.
|
||||
uBlockX -= m_regValidRegionInBlocks.getLowerCorner().getX();
|
||||
uBlockY -= m_regValidRegionInBlocks.getLowerCorner().getY();
|
||||
uBlockZ -= m_regValidRegionInBlocks.getLowerCorner().getZ();
|
||||
uBlockX -= m_regValidRegionInBlocks.getLowerX();
|
||||
uBlockY -= m_regValidRegionInBlocks.getLowerY();
|
||||
uBlockZ -= m_regValidRegionInBlocks.getLowerZ();
|
||||
|
||||
POLYVOX_ASSERT(uBlockX >= 0, "Block coordinate must not be negative.");
|
||||
POLYVOX_ASSERT(uBlockY >= 0, "Block coordinate must not be negative.");
|
||||
|
@ -21,12 +21,12 @@ freely, subject to the following restrictions:
|
||||
distribution.
|
||||
*******************************************************************************/
|
||||
|
||||
#define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerX()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerY()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerZ()) && (val % this->mVolume->m_uBlockSideLength != 0))
|
||||
#define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0))
|
||||
|
||||
namespace PolyVox
|
||||
{
|
||||
|
@ -78,13 +78,13 @@ namespace PolyVox
|
||||
template< typename SrcVolumeType, typename DstVolumeType>
|
||||
void VolumeResampler<SrcVolumeType, DstVolumeType>::execute()
|
||||
{
|
||||
int32_t uSrcWidth = m_regSrc.getUpperCorner().getX() - m_regSrc.getLowerCorner().getX() + 1;
|
||||
int32_t uSrcHeight = m_regSrc.getUpperCorner().getY() - m_regSrc.getLowerCorner().getY() + 1;
|
||||
int32_t uSrcDepth = m_regSrc.getUpperCorner().getZ() - m_regSrc.getLowerCorner().getZ() + 1;
|
||||
int32_t uSrcWidth = m_regSrc.getUpperX() - m_regSrc.getLowerX() + 1;
|
||||
int32_t uSrcHeight = m_regSrc.getUpperY() - m_regSrc.getLowerY() + 1;
|
||||
int32_t uSrcDepth = m_regSrc.getUpperZ() - m_regSrc.getLowerZ() + 1;
|
||||
|
||||
int32_t uDstWidth = m_regDst.getUpperCorner().getX() - m_regDst.getLowerCorner().getX() + 1;
|
||||
int32_t uDstHeight = m_regDst.getUpperCorner().getY() - m_regDst.getLowerCorner().getY() + 1;
|
||||
int32_t uDstDepth = m_regDst.getUpperCorner().getZ() - m_regDst.getLowerCorner().getZ() + 1;
|
||||
int32_t uDstWidth = m_regDst.getUpperX() - m_regDst.getLowerX() + 1;
|
||||
int32_t uDstHeight = m_regDst.getUpperY() - m_regDst.getLowerY() + 1;
|
||||
int32_t uDstDepth = m_regDst.getUpperZ() - m_regDst.getLowerZ() + 1;
|
||||
|
||||
/*if((uSrcWidth == uDstWidth) && (uSrcHeight == uDstHeight) && (uSrcDepth == uDstDepth))
|
||||
{
|
||||
@ -101,11 +101,11 @@ namespace PolyVox
|
||||
template< typename SrcVolumeType, typename DstVolumeType>
|
||||
void VolumeResampler<SrcVolumeType, DstVolumeType>::resampleSameSize()
|
||||
{
|
||||
for(int32_t sz = m_regSrc.getLowerCorner().getZ(), dz = m_regDst.getLowerCorner().getZ(); dz <= m_regDst.getUpperCorner().getZ(); sz++, dz++)
|
||||
for(int32_t sz = m_regSrc.getLowerZ(), dz = m_regDst.getLowerZ(); dz <= m_regDst.getUpperZ(); sz++, dz++)
|
||||
{
|
||||
for(int32_t sy = m_regSrc.getLowerCorner().getY(), dy = m_regDst.getLowerCorner().getY(); dy <= m_regDst.getUpperCorner().getY(); sy++, dy++)
|
||||
for(int32_t sy = m_regSrc.getLowerY(), dy = m_regDst.getLowerY(); dy <= m_regDst.getUpperY(); sy++, dy++)
|
||||
{
|
||||
for(int32_t sx = m_regSrc.getLowerCorner().getX(), dx = m_regDst.getLowerCorner().getX(); dx <= m_regDst.getUpperCorner().getX(); sx++,dx++)
|
||||
for(int32_t sx = m_regSrc.getLowerX(), dx = m_regDst.getLowerX(); dx <= m_regDst.getUpperX(); sx++,dx++)
|
||||
{
|
||||
const typename SrcVolumeType::VoxelType& tSrcVoxel = m_pVolSrc->getVoxelAt(sx,sy,sz);
|
||||
const typename DstVolumeType::VoxelType& tDstVoxel = static_cast<typename DstVolumeType::VoxelType>(tSrcVoxel);
|
||||
@ -132,19 +132,19 @@ namespace PolyVox
|
||||
|
||||
typename SrcVolumeType::Sampler sampler(m_pVolSrc);
|
||||
|
||||
for(int32_t dz = m_regDst.getLowerCorner().getZ(); dz <= m_regDst.getUpperCorner().getZ(); dz++)
|
||||
for(int32_t dz = m_regDst.getLowerZ(); dz <= m_regDst.getUpperZ(); dz++)
|
||||
{
|
||||
for(int32_t dy = m_regDst.getLowerCorner().getY(); dy <= m_regDst.getUpperCorner().getY(); dy++)
|
||||
for(int32_t dy = m_regDst.getLowerY(); dy <= m_regDst.getUpperY(); dy++)
|
||||
{
|
||||
for(int32_t dx = m_regDst.getLowerCorner().getX(); dx <= m_regDst.getUpperCorner().getX(); dx++)
|
||||
for(int32_t dx = m_regDst.getLowerX(); dx <= m_regDst.getUpperX(); dx++)
|
||||
{
|
||||
float sx = (dx - m_regDst.getLowerCorner().getX()) * fScaleX;
|
||||
float sy = (dy - m_regDst.getLowerCorner().getY()) * fScaleY;
|
||||
float sz = (dz - m_regDst.getLowerCorner().getZ()) * fScaleZ;
|
||||
float sx = (dx - m_regDst.getLowerX()) * fScaleX;
|
||||
float sy = (dy - m_regDst.getLowerY()) * fScaleY;
|
||||
float sz = (dz - m_regDst.getLowerZ()) * fScaleZ;
|
||||
|
||||
sx += m_regSrc.getLowerCorner().getX();
|
||||
sy += m_regSrc.getLowerCorner().getY();
|
||||
sz += m_regSrc.getLowerCorner().getZ();
|
||||
sx += m_regSrc.getLowerX();
|
||||
sy += m_regSrc.getLowerY();
|
||||
sz += m_regSrc.getLowerZ();
|
||||
|
||||
sampler.setPosition(sx,sy,sz);
|
||||
const typename SrcVolumeType::VoxelType& voxel000 = sampler.peekVoxel0px0py0pz();
|
||||
|
6
library/bindings/Compressor.i
Normal file
6
library/bindings/Compressor.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module Compressor
|
||||
%{
|
||||
#include "Compressor.h"
|
||||
%}
|
||||
|
||||
%include "Compressor.h"
|
6
library/bindings/MinizCompressor.i
Normal file
6
library/bindings/MinizCompressor.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module MinizCompressor
|
||||
%{
|
||||
#include "MinizCompressor.h"
|
||||
%}
|
||||
|
||||
%include "MinizCompressor.h"
|
@ -75,6 +75,9 @@ EXTRACTOR(shortname, LargeVolume)
|
||||
%include "Vector.i"
|
||||
%include "DefaultMarchingCubesController.i"
|
||||
%include "Region.i"
|
||||
%include "Compressor.i"
|
||||
%include "MinizCompressor.i"
|
||||
%include "RLECompressor.i"
|
||||
%include "BaseVolume.i"
|
||||
%include "SimpleVolume.i"
|
||||
%include "RawVolume.i"
|
||||
|
6
library/bindings/RLECompressor.i
Normal file
6
library/bindings/RLECompressor.i
Normal file
@ -0,0 +1,6 @@
|
||||
%module RLECompressor
|
||||
%{
|
||||
#include "RLECompressor.h"
|
||||
%}
|
||||
|
||||
%include "RLECompressor.h"
|
@ -27,7 +27,7 @@ freely, subject to the following restrictions:
|
||||
#include "PolyVoxCore/Material.h"
|
||||
#include "PolyVoxCore/MaterialDensityPair.h"
|
||||
#include "PolyVoxCore/SimpleVolume.h"
|
||||
#include "PolyVoxCore/CubicSurfaceExtractorWithNormals.h"
|
||||
#include "PolyVoxCore/CubicSurfaceExtractor.h"
|
||||
|
||||
#include <QtTest>
|
||||
|
||||
@ -70,13 +70,14 @@ void writeMaterialValueToVoxel(int valueToWrite, MaterialDensityPair88& voxel)
|
||||
|
||||
// Runs the surface extractor for a given type.
|
||||
template <typename VoxelType>
|
||||
void testForType(SurfaceMesh<PositionMaterialNormal>& result)
|
||||
uint32_t testForType(void)
|
||||
{
|
||||
const int32_t uVolumeSideLength = 32;
|
||||
const int32_t uVolumeSideLength = 256;
|
||||
|
||||
//Create empty volume
|
||||
SimpleVolume<VoxelType> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1)));
|
||||
SimpleVolume<VoxelType> volData(Region(Vector3DInt32(0,0,0), Vector3DInt32(uVolumeSideLength-1, uVolumeSideLength-1, uVolumeSideLength-1)), 128);
|
||||
|
||||
//Fill the volume with data
|
||||
for (int32_t z = 0; z < uVolumeSideLength; z++)
|
||||
{
|
||||
for (int32_t y = 0; y < uVolumeSideLength; y++)
|
||||
@ -94,20 +95,43 @@ void testForType(SurfaceMesh<PositionMaterialNormal>& result)
|
||||
}
|
||||
}
|
||||
|
||||
CubicSurfaceExtractorWithNormals< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result);
|
||||
extractor.execute();
|
||||
uint32_t uTotalVertices = 0;
|
||||
uint32_t uTotalIndices = 0;
|
||||
|
||||
//Run the surface extractor a number of times over differnt regions of the volume.
|
||||
const int32_t uRegionSideLength = 64;
|
||||
for (int32_t z = 0; z < uVolumeSideLength; z += uRegionSideLength)
|
||||
{
|
||||
for (int32_t y = 0; y < uVolumeSideLength; y += uRegionSideLength)
|
||||
{
|
||||
for (int32_t x = 0; x < uVolumeSideLength; x += uRegionSideLength)
|
||||
{
|
||||
SurfaceMesh<PositionMaterial> result;
|
||||
Region regionToExtract(x, y, z, x + uRegionSideLength - 1, y + uRegionSideLength - 1, z + uRegionSideLength - 1);
|
||||
CubicSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, regionToExtract, &result);
|
||||
extractor.execute();
|
||||
|
||||
uTotalVertices += result.getNoOfVertices();
|
||||
uTotalIndices += result.getNoOfIndices();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Just some value which is representative of the work we've done. It doesn't
|
||||
// matter what it is, just that it should be the same every time we run the test.
|
||||
return uTotalVertices + uTotalIndices;
|
||||
}
|
||||
|
||||
void TestCubicSurfaceExtractor::testExecute()
|
||||
{
|
||||
const static uint32_t uExpectedVertices = 6624;
|
||||
/*const static uint32_t uExpectedVertices = 6624;
|
||||
const static uint32_t uExpectedIndices = 9936;
|
||||
const static uint32_t uMaterialToCheck = 3000;
|
||||
const static float fExpectedMaterial = 42.0f;
|
||||
const static uint32_t uIndexToCheck = 2000;
|
||||
const static uint32_t uExpectedIndex = 1334;
|
||||
|
||||
SurfaceMesh<PositionMaterialNormal> mesh;
|
||||
SurfaceMesh<PositionMaterialNormal> mesh;*/
|
||||
|
||||
/*testForType<int8_t>(mesh);
|
||||
QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices);
|
||||
@ -154,13 +178,13 @@ void TestCubicSurfaceExtractor::testExecute()
|
||||
QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices);
|
||||
QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fNoMaterial);*/
|
||||
|
||||
const static uint32_t uExpectedSumOfVerticesAndIndices = 704668;
|
||||
//const static uint32_t uExpectedSumOfVerticesAndIndices = 2792332;
|
||||
uint32_t result = 0;
|
||||
QBENCHMARK {
|
||||
testForType<MaterialDensityPair88>(mesh);
|
||||
result = testForType<MaterialDensityPair88>();
|
||||
}
|
||||
QCOMPARE(mesh.getNoOfVertices(), uExpectedVertices);
|
||||
QCOMPARE(mesh.getNoOfIndices(), uExpectedIndices);
|
||||
QCOMPARE(mesh.getVertices()[uMaterialToCheck].getMaterial(), fExpectedMaterial);
|
||||
QCOMPARE(mesh.getIndices()[uIndexToCheck], uExpectedIndex);
|
||||
QCOMPARE(result, uExpectedSumOfVerticesAndIndices);
|
||||
}
|
||||
|
||||
QTEST_MAIN(TestCubicSurfaceExtractor)
|
||||
|
Loading…
x
Reference in New Issue
Block a user