Added comments.
This commit is contained in:
parent
b353cd1ce8
commit
e0ce93acb1
@ -97,23 +97,32 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t iCubeIndex = 0;
|
uint8_t iCubeIndex = 0;
|
||||||
|
|
||||||
uint8_t iPreviousCubeIndexX = uPreviousCell;
|
// Four bits of our cube index are obtained by looking at the cube index for
|
||||||
iPreviousCubeIndexX &= 170; //170 = 128+32+8+2
|
// the previous slice and copying four of those bits into their new positions.
|
||||||
iPreviousCubeIndexX >>= 1;
|
uint8_t iPreviousCubeIndexZ = pPreviousSliceBitmask(uXRegSpace, uYRegSpace);
|
||||||
iCubeIndex |= iPreviousCubeIndexX;
|
iPreviousCubeIndexZ >>= 4;
|
||||||
|
iCubeIndex |= iPreviousCubeIndexZ;
|
||||||
|
|
||||||
|
// Two bits of our cube index are obtained by looking at the cube index for
|
||||||
|
// the previous row and copying two of those bits into their new positions.
|
||||||
uint8_t iPreviousCubeIndexY = pPreviousRowBitmask(uXRegSpace);
|
uint8_t iPreviousCubeIndexY = pPreviousRowBitmask(uXRegSpace);
|
||||||
iPreviousCubeIndexY &= 204; //204 = 128+64+8+4
|
iPreviousCubeIndexY &= 204; //204 = 128+64+8+4
|
||||||
iPreviousCubeIndexY >>= 2;
|
iPreviousCubeIndexY >>= 2;
|
||||||
iCubeIndex |= iPreviousCubeIndexY;
|
iCubeIndex |= iPreviousCubeIndexY;
|
||||||
|
|
||||||
uint8_t iPreviousCubeIndexZ = pPreviousSliceBitmask(uXRegSpace, uYRegSpace);
|
// One bit of our cube index are obtained by looking at the cube index for
|
||||||
iPreviousCubeIndexZ >>= 4;
|
// the previous cell and copying one of those bits into it's new position.
|
||||||
iCubeIndex |= iPreviousCubeIndexZ;
|
uint8_t iPreviousCubeIndexX = uPreviousCell;
|
||||||
|
iPreviousCubeIndexX &= 170; //170 = 128+32+8+2
|
||||||
|
iPreviousCubeIndexX >>= 1;
|
||||||
|
iCubeIndex |= iPreviousCubeIndexX;
|
||||||
|
|
||||||
typename VolumeType::VoxelType v111 = sampler.peekVoxel0px0py0pz();
|
// The last bit of our cube index is obtained by looking
|
||||||
|
// at the relevant voxel and comparing it to the threshold
|
||||||
|
typename VolumeType::VoxelType v111 = sampler.getVoxel();
|
||||||
if (m_controller.convertToDensity(v111) < m_tThreshold) iCubeIndex |= 128;
|
if (m_controller.convertToDensity(v111) < m_tThreshold) iCubeIndex |= 128;
|
||||||
|
|
||||||
|
// The current value becomes the previous value, ready for the next iteration.
|
||||||
uPreviousCell = iCubeIndex;
|
uPreviousCell = iCubeIndex;
|
||||||
pPreviousRowBitmask(uXRegSpace) = iCubeIndex;
|
pPreviousRowBitmask(uXRegSpace) = iCubeIndex;
|
||||||
pPreviousSliceBitmask(uXRegSpace, uYRegSpace) = iCubeIndex;
|
pPreviousSliceBitmask(uXRegSpace, uYRegSpace) = iCubeIndex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user