Fixing warnings - Changed Region to use int16 instead of int32.

This commit is contained in:
David Williams 2009-06-06 14:43:28 +00:00
parent e6e66624ea
commit 53cacc9840
6 changed files with 38 additions and 38 deletions

View File

@ -60,8 +60,8 @@ void OpenGLWidget::setVolume(PolyVox::Volume<PolyVox::uint8_t>* volData)
PolyVox::uint16_t regionEndY = regionStartY + m_uRegionSideLength;
PolyVox::uint16_t regionEndZ = regionStartZ + m_uRegionSideLength;
Vector3DInt32 regLowerCorner(regionStartX, regionStartY, regionStartZ);
Vector3DInt32 regUpperCorner(regionEndX, regionEndY, regionEndZ);
Vector3DInt16 regLowerCorner(regionStartX, regionStartY, regionStartZ);
Vector3DInt16 regUpperCorner(regionEndX, regionEndY, regionEndZ);
//Extract the surface for this region
//extractSurface(m_volData, 0, PolyVox::Region(regLowerCorner, regUpperCorner), ispCurrent);

View File

@ -33,28 +33,28 @@ namespace PolyVox
{
public:
Region();
Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner);
Region(const Vector3DInt16& v3dLowerCorner, const Vector3DInt16& v3dUpperCorner);
const Vector3DInt32& getLowerCorner(void) const;
const Vector3DInt32& getUpperCorner(void) const;
const Vector3DInt16& getLowerCorner(void) const;
const Vector3DInt16& getUpperCorner(void) const;
void setLowerCorner(const Vector3DInt32& v3dLowerCorner);
void setUpperCorner(const Vector3DInt32& v3dUpperCorner);
void setLowerCorner(const Vector3DInt16& v3dLowerCorner);
void setUpperCorner(const Vector3DInt16& v3dUpperCorner);
bool containsPoint(const Vector3DFloat& pos, float boundary) const;
bool containsPoint(const Vector3DInt32& pos, uint8_t boundary) const;
bool containsPoint(const Vector3DInt16& pos, uint8_t boundary) const;
void cropTo(const Region& other);
int32_t depth(void) const;
int32_t height(void) const;
void shift(const Vector3DInt32& amount);
void shiftLowerCorner(const Vector3DInt32& amount);
void shiftUpperCorner(const Vector3DInt32& amount);
Vector3DInt32 dimensions(void);
int32_t width(void) const;
int16_t depth(void) const;
int16_t height(void) const;
void shift(const Vector3DInt16& amount);
void shiftLowerCorner(const Vector3DInt16& amount);
void shiftUpperCorner(const Vector3DInt16& amount);
Vector3DInt16 dimensions(void);
int16_t width(void) const;
private:
Vector3DInt32 m_v3dLowerCorner;
Vector3DInt32 m_v3dUpperCorner;
Vector3DInt16 m_v3dLowerCorner;
Vector3DInt16 m_v3dUpperCorner;
};
}

View File

@ -152,7 +152,7 @@ namespace PolyVox
template <typename VoxelType>
Region Volume<VoxelType>::getEnclosingRegion(void) const
{
return Region(Vector3DInt32(0,0,0), Vector3DInt32(m_uWidth-1,m_uHeight-1,m_uDepth-1));
return Region(Vector3DInt16(0,0,0), Vector3DInt16(m_uWidth-1,m_uHeight-1,m_uDepth-1));
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -14,13 +14,13 @@ namespace PolyVox
while(iterSurfaceVertex != vecVertices.end())
{
const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(isp.m_Region.getLowerCorner());
const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos);
const Vector3DInt16 v3dFloor = static_cast<Vector3DInt16>(v3dPos);
VolumeSampler<uint8_t> volIter(*volumeData);
//Check all corners are within the volume, allowing a boundary for gradient estimation
bool lowerCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor,2);
bool upperCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor+Vector3DInt32(1,1,1),2);
bool upperCornerInside = volumeData->getEnclosingRegion().containsPoint(v3dFloor+Vector3DInt16(1,1,1),2);
if(lowerCornerInside && upperCornerInside) //If this test fails the vertex will be left as it was
{

View File

@ -8,28 +8,28 @@ namespace PolyVox
{
}
Region::Region(const Vector3DInt32& v3dLowerCorner, const Vector3DInt32& v3dUpperCorner)
Region::Region(const Vector3DInt16& v3dLowerCorner, const Vector3DInt16& v3dUpperCorner)
:m_v3dLowerCorner(v3dLowerCorner)
,m_v3dUpperCorner(v3dUpperCorner)
{
}
const Vector3DInt32& Region::getLowerCorner(void) const
const Vector3DInt16& Region::getLowerCorner(void) const
{
return m_v3dLowerCorner;
}
const Vector3DInt32& Region::getUpperCorner(void) const
const Vector3DInt16& Region::getUpperCorner(void) const
{
return m_v3dUpperCorner;
}
void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner)
void Region::setLowerCorner(const Vector3DInt16& v3dLowerCorner)
{
m_v3dLowerCorner = v3dLowerCorner;
}
void Region::setUpperCorner(const Vector3DInt32& v3dUpperCorner)
void Region::setUpperCorner(const Vector3DInt16& v3dUpperCorner)
{
m_v3dUpperCorner = v3dUpperCorner;
}
@ -44,7 +44,7 @@ namespace PolyVox
&& (pos.getZ() >= m_v3dLowerCorner.getZ() + boundary);
}
bool Region::containsPoint(const Vector3DInt32& pos, uint8_t boundary) const
bool Region::containsPoint(const Vector3DInt16& pos, uint8_t boundary) const
{
return (pos.getX() <= m_v3dUpperCorner.getX() - boundary)
&& (pos.getY() <= m_v3dUpperCorner.getY() - boundary)
@ -64,38 +64,38 @@ namespace PolyVox
m_v3dUpperCorner.setZ((std::min)(m_v3dUpperCorner.getZ(), other.m_v3dUpperCorner.getZ()));
}
int32_t Region::depth(void) const
int16_t Region::depth(void) const
{
return m_v3dUpperCorner.getZ() - m_v3dLowerCorner.getZ();
}
int32_t Region::height(void) const
int16_t Region::height(void) const
{
return m_v3dUpperCorner.getY() - m_v3dLowerCorner.getY();
}
void Region::shift(const Vector3DInt32& amount)
void Region::shift(const Vector3DInt16& amount)
{
m_v3dLowerCorner += amount;
m_v3dUpperCorner += amount;
}
void Region::shiftLowerCorner(const Vector3DInt32& amount)
void Region::shiftLowerCorner(const Vector3DInt16& amount)
{
m_v3dLowerCorner += amount;
}
void Region::shiftUpperCorner(const Vector3DInt32& amount)
void Region::shiftUpperCorner(const Vector3DInt16& amount)
{
m_v3dUpperCorner += amount;
}
Vector3DInt32 Region::dimensions(void)
Vector3DInt16 Region::dimensions(void)
{
return m_v3dUpperCorner - m_v3dLowerCorner;
}
int32_t Region::width(void) const
int16_t Region::width(void) const
{
return m_v3dUpperCorner.getX() - m_v3dLowerCorner.getX();
}

View File

@ -34,7 +34,7 @@ namespace PolyVox
// back, bottom, right direction. Protect against access violations by cropping region here
m_regVolumeCropped = m_volData.getEnclosingRegion();
m_regInputUncropped.cropTo(m_regVolumeCropped);
m_regVolumeCropped.setUpperCorner(m_regVolumeCropped.getUpperCorner() - Vector3DInt32(2*m_uStepSize-1,2*m_uStepSize-1,2*m_uStepSize-1));
m_regVolumeCropped.setUpperCorner(m_regVolumeCropped.getUpperCorner() - Vector3DInt16(2*m_uStepSize-1,2*m_uStepSize-1,2*m_uStepSize-1));
m_regInputCropped = region;
m_regInputCropped.cropTo(m_regVolumeCropped);
@ -64,7 +64,7 @@ namespace PolyVox
//Create a region corresponding to the first slice
m_regSlicePrevious = m_regInputCropped;
Vector3DInt32 v3dUpperCorner = m_regSlicePrevious.getUpperCorner();
Vector3DInt16 v3dUpperCorner = m_regSlicePrevious.getUpperCorner();
v3dUpperCorner.setZ(m_regSlicePrevious.getLowerCorner().getZ()); //Set the upper z to the lower z to make it one slice thick.
m_regSlicePrevious.setUpperCorner(v3dUpperCorner);
m_regSliceCurrent = m_regSlicePrevious;
@ -121,7 +121,7 @@ namespace PolyVox
std::swap(m_pPreviousVertexIndicesZ, m_pCurrentVertexIndicesZ);
m_regSlicePrevious = m_regSliceCurrent;
m_regSliceCurrent.shift(Vector3DInt32(0,0,m_uStepSize));
m_regSliceCurrent.shift(Vector3DInt16(0,0,m_uStepSize));
//Process the other slices (previous slice is available)
for(uint32_t uSlice = 1; uSlice <= m_regInputCropped.depth(); uSlice += m_uStepSize)
@ -149,11 +149,11 @@ namespace PolyVox
std::swap(m_pPreviousVertexIndicesZ, m_pCurrentVertexIndicesZ);
m_regSlicePrevious = m_regSliceCurrent;
m_regSliceCurrent.shift(Vector3DInt32(0,0,m_uStepSize));
m_regSliceCurrent.shift(Vector3DInt16(0,0,m_uStepSize));
}
//A final slice just to close of the volume
m_regSliceCurrent.shift(Vector3DInt32(0,0,-m_uStepSize));
m_regSliceCurrent.shift(Vector3DInt16(0,0,-m_uStepSize));
if(m_regSliceCurrent.getLowerCorner().getZ() == m_regVolumeCropped.getUpperCorner().getZ())
{
memset(m_pCurrentVertexIndicesX, 0xff, m_uScratchPadWidth * m_uScratchPadHeight * 4);