Restructuring code.
This commit is contained in:
parent
89508f8b2b
commit
71adc7292c
@ -295,8 +295,6 @@ namespace PolyVox
|
||||
//Information about the region we are currently processing
|
||||
Region m_regSizeInVoxels;
|
||||
Region m_regSizeInCells;
|
||||
Region m_regSlicePrevious;
|
||||
Region m_regSliceCurrent;
|
||||
|
||||
//Used to convert arbitrary voxel types in densities and materials.
|
||||
ControllerType m_controller;
|
||||
|
@ -61,27 +61,10 @@ namespace PolyVox
|
||||
|
||||
Array3DUint8 pBitmask(uArrayWidth, uArrayHeight, uArrayDepth);
|
||||
|
||||
//Create a region corresponding to the first slice
|
||||
m_regSlicePrevious = m_regSizeInVoxels;
|
||||
Vector3DInt32 v3dUpperCorner = m_regSlicePrevious.getUpperCorner();
|
||||
v3dUpperCorner.setZ(m_regSlicePrevious.getLowerZ()); //Set the upper z to the lower z to make it one slice thick.
|
||||
m_regSlicePrevious.setUpperCorner(v3dUpperCorner);
|
||||
m_regSliceCurrent = m_regSlicePrevious;
|
||||
|
||||
computeBitmaskForSlice<true>(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
|
||||
|
||||
m_regSlicePrevious = m_regSliceCurrent;
|
||||
m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
|
||||
|
||||
//Process the other slices (previous slice is available)
|
||||
for(int32_t uSlice = 1; uSlice <= m_regSizeInVoxels.getUpperZ() - m_regSizeInVoxels.getLowerZ(); uSlice++)
|
||||
{
|
||||
generateIndicesForSlice(pBitmask, pIndicesX, pIndicesY, pIndicesZ);
|
||||
|
||||
m_regSlicePrevious = m_regSliceCurrent;
|
||||
m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
|
||||
}
|
||||
|
||||
m_meshCurrent->setOffset(m_regSizeInVoxels.getLowerCorner());
|
||||
|
||||
POLYVOX_LOG_TRACE("Marching cubes surface extraction took ", timer.elapsedTimeInMilliSeconds(),
|
||||
@ -100,15 +83,15 @@ namespace PolyVox
|
||||
const int32_t iMaxYVolSpace = m_regSizeInVoxels.getUpperY();
|
||||
const int32_t iMaxZVolSpace = m_regSizeInVoxels.getUpperZ();
|
||||
|
||||
for (int32_t iZVolSpace = m_regSliceCurrent.getLowerZ(); iZVolSpace <= iMaxZVolSpace; iZVolSpace++)
|
||||
for (int32_t iZVolSpace = m_regSizeInVoxels.getLowerZ(); iZVolSpace <= iMaxZVolSpace; iZVolSpace++)
|
||||
{
|
||||
uint32_t uZRegSpace = iZVolSpace - m_regSizeInVoxels.getLowerZ();
|
||||
|
||||
//Process all remaining elemnents of the slice. In this case, previous x and y values are always available
|
||||
for (int32_t iYVolSpace = m_regSliceCurrent.getLowerY(); iYVolSpace <= iMaxYVolSpace; iYVolSpace++)
|
||||
for (int32_t iYVolSpace = m_regSizeInVoxels.getLowerY(); iYVolSpace <= iMaxYVolSpace; iYVolSpace++)
|
||||
{
|
||||
m_sampVolume.setPosition(m_regSliceCurrent.getLowerX(), iYVolSpace, iZVolSpace);
|
||||
for (int32_t iXVolSpace = m_regSliceCurrent.getLowerX(); iXVolSpace <= iMaxXVolSpace; iXVolSpace++)
|
||||
m_sampVolume.setPosition(m_regSizeInVoxels.getLowerX(), iYVolSpace, iZVolSpace);
|
||||
for (int32_t iXVolSpace = m_regSizeInVoxels.getLowerX(); iXVolSpace <= iMaxXVolSpace; iXVolSpace++)
|
||||
{
|
||||
uint32_t uXRegSpace = iXVolSpace - m_regSizeInVoxels.getLowerX();
|
||||
uint32_t uYRegSpace = iYVolSpace - m_regSizeInVoxels.getLowerY();
|
||||
@ -272,19 +255,15 @@ namespace PolyVox
|
||||
const Array3DInt32& pIndicesX,
|
||||
const Array3DInt32& pIndicesY,
|
||||
const Array3DInt32& pIndicesZ)
|
||||
{
|
||||
for (int32_t iZVolSpace = m_regSizeInVoxels.getLowerZ(); iZVolSpace <= m_regSizeInCells.getUpperZ(); iZVolSpace++)
|
||||
{
|
||||
for (int32_t iYVolSpace = m_regSizeInVoxels.getLowerY(); iYVolSpace <= m_regSizeInCells.getUpperY(); iYVolSpace++)
|
||||
{
|
||||
for (int32_t iXVolSpace = m_regSizeInVoxels.getLowerX(); iXVolSpace <= m_regSizeInCells.getUpperX(); iXVolSpace++)
|
||||
{
|
||||
int32_t indlist[12];
|
||||
for(int i = 0; i < 12; i++)
|
||||
{
|
||||
indlist[i] = -1;
|
||||
}
|
||||
|
||||
const int32_t iZVolSpace = m_regSlicePrevious.getLowerZ();
|
||||
|
||||
for(int32_t iYVolSpace = m_regSlicePrevious.getLowerY(); iYVolSpace <= m_regSizeInCells.getUpperY(); iYVolSpace++)
|
||||
{
|
||||
for(int32_t iXVolSpace = m_regSlicePrevious.getLowerX(); iXVolSpace <= m_regSizeInCells.getUpperX(); iXVolSpace++)
|
||||
{
|
||||
m_sampVolume.setPosition(iXVolSpace, iYVolSpace, iZVolSpace);
|
||||
|
||||
//Current position
|
||||
@ -366,3 +345,4 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user