From 53cacc98408b5e7ac4e5958e6c285c980344b222 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 6 Jun 2009 14:43:28 +0000 Subject: [PATCH] Fixing warnings - Changed Region to use int16 instead of int32. --- examples/OpenGL/OpenGLWidget.cpp | 4 +-- library/PolyVoxCore/include/Region.h | 30 +++++++++---------- library/PolyVoxCore/include/Volume.inl | 2 +- .../PolyVoxCore/source/GradientEstimators.cpp | 4 +-- library/PolyVoxCore/source/Region.cpp | 26 ++++++++-------- .../PolyVoxCore/source/SurfaceExtractor.cpp | 10 +++---- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/examples/OpenGL/OpenGLWidget.cpp b/examples/OpenGL/OpenGLWidget.cpp index 42023770..8d6c7ac4 100644 --- a/examples/OpenGL/OpenGLWidget.cpp +++ b/examples/OpenGL/OpenGLWidget.cpp @@ -60,8 +60,8 @@ void OpenGLWidget::setVolume(PolyVox::Volume* 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); diff --git a/library/PolyVoxCore/include/Region.h b/library/PolyVoxCore/include/Region.h index 776ebafa..855cf550 100644 --- a/library/PolyVoxCore/include/Region.h +++ b/library/PolyVoxCore/include/Region.h @@ -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; }; } diff --git a/library/PolyVoxCore/include/Volume.inl b/library/PolyVoxCore/include/Volume.inl index c74f87e1..2fe961ff 100644 --- a/library/PolyVoxCore/include/Volume.inl +++ b/library/PolyVoxCore/include/Volume.inl @@ -152,7 +152,7 @@ namespace PolyVox template Region Volume::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)); } //////////////////////////////////////////////////////////////////////////////// diff --git a/library/PolyVoxCore/source/GradientEstimators.cpp b/library/PolyVoxCore/source/GradientEstimators.cpp index a6c81d0b..1d151a42 100644 --- a/library/PolyVoxCore/source/GradientEstimators.cpp +++ b/library/PolyVoxCore/source/GradientEstimators.cpp @@ -14,13 +14,13 @@ namespace PolyVox while(iterSurfaceVertex != vecVertices.end()) { const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast(isp.m_Region.getLowerCorner()); - const Vector3DInt32 v3dFloor = static_cast(v3dPos); + const Vector3DInt16 v3dFloor = static_cast(v3dPos); VolumeSampler 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 { diff --git a/library/PolyVoxCore/source/Region.cpp b/library/PolyVoxCore/source/Region.cpp index 626aa680..32641dd1 100644 --- a/library/PolyVoxCore/source/Region.cpp +++ b/library/PolyVoxCore/source/Region.cpp @@ -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(); } diff --git a/library/PolyVoxCore/source/SurfaceExtractor.cpp b/library/PolyVoxCore/source/SurfaceExtractor.cpp index 871d8f50..5469d586 100644 --- a/library/PolyVoxCore/source/SurfaceExtractor.cpp +++ b/library/PolyVoxCore/source/SurfaceExtractor.cpp @@ -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);