Removed unneeded variable.

This commit is contained in:
David Williams 2015-05-14 07:42:04 +02:00
parent c4ce66dec5
commit 13fc8c5ba9
2 changed files with 5 additions and 45 deletions

View File

@ -160,7 +160,7 @@ namespace PolyVox
private: private:
//Compute the cell bitmask for a particular slice in z. //Compute the cell bitmask for a particular slice in z.
template<bool isPrevZAvail> template<bool isPrevZAvail>
uint32_t computeBitmaskForSlice(Array3DUint8& pBitmask); void computeBitmaskForSlice(Array3DUint8& pBitmask);
//Use the cell bitmasks to generate all the vertices needed for that slice //Use the cell bitmasks to generate all the vertices needed for that slice
void generateVerticesForSlice(const Array3DUint8& pBitmask, void generateVerticesForSlice(const Array3DUint8& pBitmask,
@ -292,18 +292,12 @@ namespace PolyVox
VolumeType* m_volData; VolumeType* m_volData;
typename VolumeType::Sampler m_sampVolume; typename VolumeType::Sampler m_sampVolume;
//Used to return the number of cells in a slice which contain triangles.
uint32_t m_uNoOfOccupiedCells;
//The surface patch we are currently filling. //The surface patch we are currently filling.
MeshType* m_meshCurrent; MeshType* m_meshCurrent;
//Information about the region we are currently processing //Information about the region we are currently processing
Region m_regSizeInVoxels; Region m_regSizeInVoxels;
Region m_regSizeInCells; Region m_regSizeInCells;
/*Region m_regSizeInVoxelsCropped;
Region m_regSizeInVoxelsUncropped;
Region m_regVolumeCropped;*/
Region m_regSlicePrevious; Region m_regSlicePrevious;
Region m_regSliceCurrent; Region m_regSliceCurrent;

View File

@ -51,9 +51,6 @@ namespace PolyVox
const uint32_t uArrayDepth = m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ() + 1; const uint32_t uArrayDepth = m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ() + 1;
//For edge indices //For edge indices
//Array3DInt32 m_pPreviousVertexIndicesX(uArrayWidth, uArrayHeight, uArrayDepth);
//Array3DInt32 m_pPreviousVertexIndicesY(uArrayWidth, uArrayHeight, uArrayDepth);
//Array3DInt32 m_pPreviousVertexIndicesZ(uArrayWidth, uArrayHeight, uArrayDepth);
Array3DInt32 pIndicesX(uArrayWidth, uArrayHeight, uArrayDepth); Array3DInt32 pIndicesX(uArrayWidth, uArrayHeight, uArrayDepth);
Array3DInt32 pIndicesY(uArrayWidth, uArrayHeight, uArrayDepth); Array3DInt32 pIndicesY(uArrayWidth, uArrayHeight, uArrayDepth);
Array3DInt32 pIndicesZ(uArrayWidth, uArrayHeight, uArrayDepth); Array3DInt32 pIndicesZ(uArrayWidth, uArrayHeight, uArrayDepth);
@ -62,8 +59,6 @@ namespace PolyVox
memset(pIndicesY.getRawData(), 0xff, pIndicesY.getNoOfElements() * 4); memset(pIndicesY.getRawData(), 0xff, pIndicesY.getNoOfElements() * 4);
memset(pIndicesZ.getRawData(), 0xff, pIndicesZ.getNoOfElements() * 4); memset(pIndicesZ.getRawData(), 0xff, pIndicesZ.getNoOfElements() * 4);
//Array2DUint8 pPreviousBitmask(uArrayWidth, uArrayHeight);
//Array2DUint8 pCurrentBitmask(uArrayWidth, uArrayHeight);
Array3DUint8 pBitmask(uArrayWidth, uArrayHeight, uArrayDepth); Array3DUint8 pBitmask(uArrayWidth, uArrayHeight, uArrayDepth);
//Create a region corresponding to the first slice //Create a region corresponding to the first slice
@ -73,20 +68,10 @@ namespace PolyVox
m_regSlicePrevious.setUpperCorner(v3dUpperCorner); m_regSlicePrevious.setUpperCorner(v3dUpperCorner);
m_regSliceCurrent = m_regSlicePrevious; m_regSliceCurrent = m_regSlicePrevious;
uint32_t uNoOfNonEmptyCellsForSlice0 = 0;
uint32_t uNoOfNonEmptyCellsForSlice1 = 0;
//Process the first slice (previous slice not available) //Process the first slice (previous slice not available)
computeBitmaskForSlice<false>(pBitmask); computeBitmaskForSlice<false>(pBitmask);
uNoOfNonEmptyCellsForSlice1 = m_uNoOfOccupiedCells;
if(uNoOfNonEmptyCellsForSlice1 != 0) generateVerticesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
{
generateVerticesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
}
std::swap(uNoOfNonEmptyCellsForSlice0, uNoOfNonEmptyCellsForSlice1);
//pPreviousBitmask.swap(pCurrentBitmask);
m_regSlicePrevious = m_regSliceCurrent; m_regSlicePrevious = m_regSliceCurrent;
m_regSliceCurrent.shift(Vector3DInt32(0,0,1)); m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
@ -95,20 +80,10 @@ namespace PolyVox
for(int32_t uSlice = 1; uSlice <= m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ(); uSlice++) for(int32_t uSlice = 1; uSlice <= m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ(); uSlice++)
{ {
computeBitmaskForSlice<true>(pBitmask); computeBitmaskForSlice<true>(pBitmask);
uNoOfNonEmptyCellsForSlice1 = m_uNoOfOccupiedCells;
if(uNoOfNonEmptyCellsForSlice1 != 0) generateVerticesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
{
generateVerticesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
}
if((uNoOfNonEmptyCellsForSlice0 != 0) || (uNoOfNonEmptyCellsForSlice1 != 0)) generateIndicesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
{
generateIndicesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
}
std::swap(uNoOfNonEmptyCellsForSlice0, uNoOfNonEmptyCellsForSlice1);
//pPreviousBitmask.swap(pCurrentBitmask);
m_regSlicePrevious = m_regSliceCurrent; m_regSlicePrevious = m_regSliceCurrent;
m_regSliceCurrent.shift(Vector3DInt32(0,0,1)); m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
@ -123,10 +98,8 @@ namespace PolyVox
template<typename VolumeType, typename MeshType, typename ControllerType> template<typename VolumeType, typename MeshType, typename ControllerType>
template<bool isPrevZAvail> template<bool isPrevZAvail>
uint32_t MarchingCubesSurfaceExtractor<VolumeType, MeshType, ControllerType>::computeBitmaskForSlice(Array3DUint8& pBitmask) void MarchingCubesSurfaceExtractor<VolumeType, MeshType, ControllerType>::computeBitmaskForSlice(Array3DUint8& pBitmask)
{ {
m_uNoOfOccupiedCells = 0;
const int32_t iMaxXVolSpace = m_regSliceCurrent.getUpperX(); const int32_t iMaxXVolSpace = m_regSliceCurrent.getUpperX();
const int32_t iMaxYVolSpace = m_regSliceCurrent.getUpperY(); const int32_t iMaxYVolSpace = m_regSliceCurrent.getUpperY();
@ -185,15 +158,8 @@ namespace PolyVox
//Save the bitmask //Save the bitmask
pBitmask(uXRegSpace, uYRegSpace, uZRegSpace) = iCubeIndex; pBitmask(uXRegSpace, uYRegSpace, uZRegSpace) = iCubeIndex;
if (edgeTable[iCubeIndex] != 0)
{
++m_uNoOfOccupiedCells;
}
} }
} }
return m_uNoOfOccupiedCells;
} }
template<typename VolumeType, typename MeshType, typename ControllerType> template<typename VolumeType, typename MeshType, typename ControllerType>