Removed getWidth(), getHeight(), getDepth() and width(), height(), depth() remain deprecated. These functions seem ambiguous, so users have to calculate these values themselves when they want them.
This commit is contained in:
parent
f887565e35
commit
ef185d79a0
@ -55,7 +55,6 @@ namespace PolyVox
|
||||
|
||||
//Information about the region we are currently processing
|
||||
Region m_regSizeInVoxels;
|
||||
Region m_regSizeInCells;
|
||||
|
||||
//The surface patch we are currently filling.
|
||||
SurfaceMesh<PositionMaterial>* m_meshCurrent;
|
||||
|
@ -39,16 +39,15 @@ namespace PolyVox
|
||||
,m_regSizeInVoxels(region)
|
||||
,m_meshCurrent(result)
|
||||
{
|
||||
m_regSizeInCells = m_regSizeInVoxels;
|
||||
m_regSizeInCells.setUpperCorner(m_regSizeInCells.getUpperCorner() - Vector3DInt32(1,1,1));
|
||||
|
||||
m_meshCurrent->clear();
|
||||
}
|
||||
|
||||
template <typename VoxelType>
|
||||
void CubicSurfaceExtractor<VoxelType>::execute()
|
||||
{
|
||||
uint32_t arraySize[3]= {m_regSizeInVoxels.getWidth()+2, m_regSizeInVoxels.getHeight()+2, MaxQuadsSharingVertex};
|
||||
uint32_t uArrayWidth = m_regSizeInVoxels.getUpperCorner().getX() - m_regSizeInVoxels.getLowerCorner().getX() + 2;
|
||||
uint32_t uArrayHeight = m_regSizeInVoxels.getUpperCorner().getY() - m_regSizeInVoxels.getLowerCorner().getY() + 2;
|
||||
uint32_t arraySize[3]= {uArrayWidth, uArrayHeight, MaxQuadsSharingVertex};
|
||||
m_previousSliceVertices.resize(arraySize);
|
||||
m_currentSliceVertices.resize(arraySize);
|
||||
memset(m_previousSliceVertices.getRawData(), 0xff, m_previousSliceVertices.getNoOfElements() * sizeof(IndexAndMaterial));
|
||||
|
@ -49,7 +49,6 @@ namespace PolyVox
|
||||
|
||||
//Information about the region we are currently processing
|
||||
Region m_regSizeInVoxels;
|
||||
Region m_regSizeInCells;
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -36,9 +36,6 @@ namespace PolyVox
|
||||
,m_regSizeInVoxels(region)
|
||||
,m_meshCurrent(result)
|
||||
{
|
||||
m_regSizeInCells = m_regSizeInVoxels;
|
||||
m_regSizeInCells.setUpperCorner(m_regSizeInCells.getUpperCorner() - Vector3DInt32(1,1,1));
|
||||
|
||||
m_meshCurrent->clear();
|
||||
}
|
||||
|
||||
|
@ -7,13 +7,16 @@ namespace PolyVox
|
||||
{
|
||||
Region croppedRegion = regionToSmooth;
|
||||
|
||||
Array<3, uint16_t> temp(ArraySizes(croppedRegion.getWidth())(croppedRegion.getHeight())(croppedRegion.getDepth()));
|
||||
uint32_t uArrayWidth = croppedRegion.getUpperCorner().getX() - croppedRegion.getLowerCorner().getX() + 1;
|
||||
uint32_t uArrayHeight = croppedRegion.getUpperCorner().getY() - croppedRegion.getLowerCorner().getY() + 1;
|
||||
uint32_t uArrayDepth = croppedRegion.getUpperCorner().getZ() - croppedRegion.getLowerCorner().getZ() + 1;
|
||||
Array<3, uint16_t> temp(ArraySizes(uArrayWidth)(uArrayHeight)(uArrayDepth));
|
||||
|
||||
for (int z = croppedRegion.getLowerCorner().getZ(); z < croppedRegion.getUpperCorner().getZ(); z++)
|
||||
for (int32_t z = croppedRegion.getLowerCorner().getZ(); z <= croppedRegion.getUpperCorner().getZ(); z++)
|
||||
{
|
||||
for (int y = croppedRegion.getLowerCorner().getY(); y < croppedRegion.getUpperCorner().getY(); y++)
|
||||
for (int32_t y = croppedRegion.getLowerCorner().getY(); y <= croppedRegion.getUpperCorner().getY(); y++)
|
||||
{
|
||||
for (int x = croppedRegion.getLowerCorner().getX(); x < croppedRegion.getUpperCorner().getX(); x++)
|
||||
for (int32_t x = croppedRegion.getLowerCorner().getX(); x <= croppedRegion.getUpperCorner().getX(); x++)
|
||||
{
|
||||
uint16_t& uDensity = temp[x-croppedRegion.getLowerCorner().getX()][y-croppedRegion.getLowerCorner().getY()][z-croppedRegion.getLowerCorner().getZ()];
|
||||
|
||||
@ -52,11 +55,11 @@ namespace PolyVox
|
||||
}
|
||||
}
|
||||
|
||||
for (int z = croppedRegion.getLowerCorner().getZ(); z < croppedRegion.getUpperCorner().getZ(); z++)
|
||||
for (int32_t z = croppedRegion.getLowerCorner().getZ(); z < croppedRegion.getUpperCorner().getZ(); z++)
|
||||
{
|
||||
for (int y = croppedRegion.getLowerCorner().getY(); y < croppedRegion.getUpperCorner().getY(); y++)
|
||||
for (int32_t y = croppedRegion.getLowerCorner().getY(); y < croppedRegion.getUpperCorner().getY(); y++)
|
||||
{
|
||||
for (int x = croppedRegion.getLowerCorner().getX(); x < croppedRegion.getUpperCorner().getX(); x++)
|
||||
for (int32_t x = croppedRegion.getLowerCorner().getX(); x < croppedRegion.getUpperCorner().getX(); x++)
|
||||
{
|
||||
uint16_t& uDensity = temp[x-croppedRegion.getLowerCorner().getX()][y-croppedRegion.getLowerCorner().getY()][z-croppedRegion.getLowerCorner().getZ()];
|
||||
|
||||
|
@ -42,12 +42,9 @@ namespace PolyVox
|
||||
Region();
|
||||
Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner);
|
||||
|
||||
uint32_t getDepth(void) const;
|
||||
Vector3DUint32 getDimensions(void);
|
||||
uint32_t getHeight(void) const;
|
||||
const Vector3DInt32& getLowerCorner(void) const;
|
||||
const Vector3DInt32& getUpperCorner(void) const;
|
||||
uint32_t getWidth(void) const;
|
||||
|
||||
void setLowerCorner(const Vector3DInt32& v3dLowerCorner);
|
||||
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
|
||||
@ -55,16 +52,16 @@ namespace PolyVox
|
||||
bool containsPoint(const Vector3DFloat& pos, float boundary = 0.0f) const;
|
||||
bool containsPoint(const Vector3DInt32& pos, uint8_t boundary = 0) const;
|
||||
void cropTo(const Region& other);
|
||||
/// Deprecated and wrong by 1 - use getDepth() instead.
|
||||
/// Deprecated and misleading
|
||||
int32_t depth(void) const;
|
||||
/// Deprecated and wrong by 1 - use getHeight() instead.
|
||||
/// Deprecated and misleading
|
||||
int32_t height(void) const;
|
||||
void shift(const Vector3DInt32& amount);
|
||||
void shiftLowerCorner(const Vector3DInt32& amount);
|
||||
void shiftUpperCorner(const Vector3DInt32& amount);
|
||||
/// Deprecated and wrong by 1 - use getDimensions() instead.
|
||||
/// Deprecated and misleading
|
||||
Vector3DInt32 dimensions(void);
|
||||
/// Deprecated and wrong by 1 - use getWidth() instead.
|
||||
/// Deprecated and misleading
|
||||
int32_t width(void) const;
|
||||
|
||||
private:
|
||||
|
@ -46,7 +46,9 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
void SurfaceExtractor<VoxelType>::execute()
|
||||
{
|
||||
uint32_t arraySizes[2]= {m_regSizeInVoxels.getWidth(), m_regSizeInVoxels.getHeight()}; // Array dimensions
|
||||
uint32_t uArrayWidth = m_regSizeInVoxels.getUpperCorner().getX() - m_regSizeInVoxels.getLowerCorner().getX() + 1;
|
||||
uint32_t uArrayHeight = m_regSizeInVoxels.getUpperCorner().getY() - m_regSizeInVoxels.getLowerCorner().getY() + 1;
|
||||
uint32_t arraySizes[2]= {uArrayWidth, uArrayHeight}; // Array dimensions
|
||||
|
||||
//For edge indices
|
||||
Array2DInt32 m_pPreviousVertexIndicesX(arraySizes);
|
||||
@ -91,7 +93,7 @@ namespace PolyVox
|
||||
m_regSliceCurrent.shift(Vector3DInt32(0,0,1));
|
||||
|
||||
//Process the other slices (previous slice is available)
|
||||
for(int32_t uSlice = 1; uSlice <= m_regSizeInVoxels.getDepth()-1; uSlice++)
|
||||
for(int32_t uSlice = 1; uSlice <= m_regSizeInVoxels.getUpperCorner().getZ() - m_regSizeInVoxels.getLowerCorner().getZ(); uSlice++)
|
||||
{
|
||||
computeBitmaskForSlice<true>(pPreviousBitmask, pCurrentBitmask);
|
||||
uNoOfNonEmptyCellsForSlice1 = m_uNoOfOccupiedCells;
|
||||
|
@ -135,7 +135,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t Volume<VoxelType>::getWidth(void) const
|
||||
{
|
||||
return m_regValidRegion.getWidth();
|
||||
return m_regValidRegion.getUpperCorner().getX() - m_regValidRegion.getLowerCorner().getX() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -145,7 +145,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t Volume<VoxelType>::getHeight(void) const
|
||||
{
|
||||
return m_regValidRegion.getHeight();
|
||||
return m_regValidRegion.getUpperCorner().getY() - m_regValidRegion.getLowerCorner().getY() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
@ -155,7 +155,7 @@ namespace PolyVox
|
||||
template <typename VoxelType>
|
||||
int32_t Volume<VoxelType>::getDepth(void) const
|
||||
{
|
||||
return m_regValidRegion.getDepth();
|
||||
return m_regValidRegion.getUpperCorner().getZ() - m_regValidRegion.getLowerCorner().getZ() + 1;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -50,14 +50,6 @@ namespace PolyVox
|
||||
assert(m_v3dUpperCorner.getZ() >= m_v3dLowerCorner.getZ());
|
||||
}
|
||||
|
||||
uint32_t Region::getDepth(void) const
|
||||
{
|
||||
//We're returning the result as unsigned, so ensure that
|
||||
//the upper value is at least as big as the lower value.
|
||||
assert(m_v3dUpperCorner.getZ() >= m_v3dLowerCorner.getZ());
|
||||
return m_v3dUpperCorner.getZ() - m_v3dLowerCorner.getZ() + 1;
|
||||
}
|
||||
|
||||
Vector3DUint32 Region::getDimensions(void)
|
||||
{
|
||||
//We're returning the result as unsigned, so ensure that
|
||||
@ -68,14 +60,6 @@ namespace PolyVox
|
||||
return static_cast<Vector3DUint32>(m_v3dUpperCorner - m_v3dLowerCorner) + Vector3DUint32(1,1,1);
|
||||
}
|
||||
|
||||
uint32_t Region::getHeight(void) const
|
||||
{
|
||||
//We're returning the result as unsigned, so ensure that
|
||||
//the upper value is at least as big as the lower value.
|
||||
assert(m_v3dUpperCorner.getY() >= m_v3dLowerCorner.getY());
|
||||
return m_v3dUpperCorner.getY() - m_v3dLowerCorner.getY() + 1;
|
||||
}
|
||||
|
||||
const Vector3DInt32& Region::getLowerCorner(void) const
|
||||
{
|
||||
return m_v3dLowerCorner;
|
||||
@ -86,14 +70,6 @@ namespace PolyVox
|
||||
return m_v3dUpperCorner;
|
||||
}
|
||||
|
||||
uint32_t Region::getWidth(void) const
|
||||
{
|
||||
//We're returning the result as unsigned, so ensure that
|
||||
//the upper value is at least as big as the lower value.
|
||||
assert(m_v3dUpperCorner.getX() >= m_v3dLowerCorner.getX());
|
||||
return m_v3dUpperCorner.getX() - m_v3dLowerCorner.getX() + 1;
|
||||
}
|
||||
|
||||
void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner)
|
||||
{
|
||||
m_v3dLowerCorner = v3dLowerCorner;
|
||||
|
@ -35,8 +35,7 @@ void TestArray::testReadWrite()
|
||||
int height = 10;
|
||||
int depth = 20;
|
||||
|
||||
uint32_t dimensions[3] = {width, height, depth}; // Array dimensions
|
||||
Array<3, int> myArray(dimensions);
|
||||
Array<3, int> myArray(ArraySizes(width)(height)(depth));
|
||||
|
||||
int ct = 1;
|
||||
int expectedTotal = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user