Work on refactoring surface extractor.
This commit is contained in:
parent
f6e1af1828
commit
85829e004f
@ -64,7 +64,7 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
|
||||
Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ);
|
||||
|
||||
//Extract the surface for this region
|
||||
extractSurface(m_volData, 1, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent);
|
||||
extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent);
|
||||
|
||||
//computeNormalsForVertices(m_volData, *ispCurrent, SOBEL_SMOOTHED);
|
||||
//*ispCurrent = getSmoothedSurface(*ispCurrent);
|
||||
|
@ -47,6 +47,7 @@ namespace PolyVox
|
||||
uint16_t getPosY(void) const;
|
||||
uint16_t getPosZ(void) const;
|
||||
VoxelType getSubSampledVoxel(uint8_t uLevel) const;
|
||||
VoxelType getSubSampledVoxelWithBoundsCheck(uint8_t uLevel) const;
|
||||
const Volume<VoxelType>& getVolume(void) const;
|
||||
VoxelType getVoxel(void) const;
|
||||
|
||||
|
@ -163,6 +163,25 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
VoxelType VolumeIterator<VoxelType>::getSubSampledVoxelWithBoundsCheck(uint8_t uLevel) const
|
||||
{
|
||||
const uint8_t uSize = 1 << uLevel;
|
||||
|
||||
if((mXPosInVolume >= 0) && (mXPosInVolume <= mVolume.getWidth() - uSize) &&
|
||||
(mYPosInVolume >= 0) && (mYPosInVolume <= mVolume.getHeight() - uSize) &&
|
||||
(mZPosInVolume >= 0) && (mZPosInVolume <= mVolume.getDepth() - uSize))
|
||||
{
|
||||
return getSubSampledVoxel(uLevel);
|
||||
}
|
||||
else
|
||||
{
|
||||
//If any voxel is outside then it's value will be zero, and so the minimum will be zero.
|
||||
//No need to even look at the rest of the voxels.
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
const Volume<VoxelType>& VolumeIterator<VoxelType>::getVolume(void) const
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user