diff --git a/include/PolyVox/MarchingCubesSurfaceExtractor.h b/include/PolyVox/MarchingCubesSurfaceExtractor.h index 3a14afa1..1a854930 100644 --- a/include/PolyVox/MarchingCubesSurfaceExtractor.h +++ b/include/PolyVox/MarchingCubesSurfaceExtractor.h @@ -159,11 +159,7 @@ namespace PolyVox private: //Compute the cell bitmask for a particular slice in z. - template - void computeBitmaskForSlice(Array3DUint8& pBitmask, - Array3DInt32& pIndicesX, - Array3DInt32& pIndicesY, - Array3DInt32& pIndicesZ); + void computeBitmaskForSlice(); //////////////////////////////////////////////////////////////////////////////// // NOTE: These two functions are in the .h file rather than the .inl due to an apparent bug in VC2010. diff --git a/include/PolyVox/MarchingCubesSurfaceExtractor.inl b/include/PolyVox/MarchingCubesSurfaceExtractor.inl index e11dd42d..06a03bb9 100644 --- a/include/PolyVox/MarchingCubesSurfaceExtractor.inl +++ b/include/PolyVox/MarchingCubesSurfaceExtractor.inl @@ -43,6 +43,18 @@ namespace PolyVox Timer timer; m_meshCurrent->clear(); + computeBitmaskForSlice(); + + m_meshCurrent->setOffset(m_regSizeInVoxels.getLowerCorner()); + + POLYVOX_LOG_TRACE("Marching cubes surface extraction took ", timer.elapsedTimeInMilliSeconds(), + "ms (Region size = ", m_regSizeInVoxels.getWidthInVoxels(), "x", m_regSizeInVoxels.getHeightInVoxels(), + "x", m_regSizeInVoxels.getDepthInVoxels(), ")"); + } + + template + void MarchingCubesSurfaceExtractor::computeBitmaskForSlice() + { const uint32_t uArrayWidth = m_regSizeInVoxels.getUpperX() - m_regSizeInVoxels.getLowerX() + 2; const uint32_t uArrayHeight = m_regSizeInVoxels.getUpperY() - m_regSizeInVoxels.getLowerY() + 2; const uint32_t uArrayDepth = m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ() + 2; @@ -59,22 +71,6 @@ namespace PolyVox Array3DUint8 pBitmask(uArrayWidth, uArrayHeight, uArrayDepth); memset(pBitmask.getRawData(), 0x00, pBitmask.getNoOfElements()); - computeBitmaskForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ); - - m_meshCurrent->setOffset(m_regSizeInVoxels.getLowerCorner()); - - POLYVOX_LOG_TRACE("Marching cubes surface extraction took ", timer.elapsedTimeInMilliSeconds(), - "ms (Region size = ", m_regSizeInVoxels.getWidthInVoxels(), "x", m_regSizeInVoxels.getHeightInVoxels(), - "x", m_regSizeInVoxels.getDepthInVoxels(), ")"); - } - - template - template - void MarchingCubesSurfaceExtractor::computeBitmaskForSlice(Array3DUint8& pBitmask, - Array3DInt32& pIndicesX, - Array3DInt32& pIndicesY, - Array3DInt32& pIndicesZ) - { for (int32_t iZVolSpace = m_regSizeInVoxels.getLowerZ(); iZVolSpace <= m_regSizeInVoxels.getUpperZ(); iZVolSpace++) { const uint32_t uZRegSpace = iZVolSpace - m_regSizeInVoxels.getLowerZ();