From 9671f19444b001190c4864bc120a8df17bd3384d Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 24 Nov 2012 12:42:45 +0100 Subject: [PATCH 1/2] Added setters to region. --- .../PolyVoxCore/include/PolyVoxCore/Region.h | 8 ++++- library/PolyVoxCore/source/Region.cpp | 30 +++++++++++++++++++ 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Region.h b/library/PolyVoxCore/include/PolyVoxCore/Region.h index 1e20f5b7..c5ef4335 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Region.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Region.h @@ -68,7 +68,6 @@ namespace PolyVox int32_t getLowerX(void) const; int32_t getLowerY(void) const; int32_t getLowerZ(void) const; - int32_t getUpperX(void) const; int32_t getUpperY(void) const; int32_t getUpperZ(void) const; @@ -96,6 +95,13 @@ namespace PolyVox bool isValid(void); + void setLowerX(int32_t iX); + void setLowerY(int32_t iY); + void setLowerZ(int32_t iZ); + void setUpperX(int32_t iX); + void setUpperY(int32_t iY); + void setUpperZ(int32_t iZ); + void setLowerCorner(const Vector3DInt32& v3dLowerCorner); void setUpperCorner(const Vector3DInt32& v3dUpperCorner); diff --git a/library/PolyVoxCore/source/Region.cpp b/library/PolyVoxCore/source/Region.cpp index aa6bb957..82cae19e 100644 --- a/library/PolyVoxCore/source/Region.cpp +++ b/library/PolyVoxCore/source/Region.cpp @@ -177,6 +177,36 @@ namespace PolyVox return (m_iUpperX >= m_iLowerX) && (m_iUpperY >= m_iLowerY) && (m_iUpperZ >= m_iLowerZ); } + void Region::setLowerX(int32_t iX) + { + m_iLowerX = iX; + } + + void Region::setLowerY(int32_t iY) + { + m_iLowerY = iY; + } + + void Region::setLowerZ(int32_t iZ) + { + m_iLowerZ = iZ; + } + + void Region::setUpperX(int32_t iX) + { + m_iUpperX = iX; + } + + void Region::setUpperY(int32_t iY) + { + m_iUpperY = iY; + } + + void Region::setUpperZ(int32_t iZ) + { + m_iUpperZ = iZ; + } + void Region::setLowerCorner(const Vector3DInt32& v3dLowerCorner) { m_iLowerX = v3dLowerCorner.getX(); From cbddc9cba4b34f00009de42e58994b67e01295a1 Mon Sep 17 00:00:00 2001 From: David Williams Date: Sat, 24 Nov 2012 12:52:37 +0100 Subject: [PATCH 2/2] Added basic dilation and erosion functions. --- .../PolyVoxCore/include/PolyVoxCore/Region.h | 3 +++ library/PolyVoxCore/source/Region.cpp | 22 +++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/library/PolyVoxCore/include/PolyVoxCore/Region.h b/library/PolyVoxCore/include/PolyVoxCore/Region.h index c5ef4335..3c937ca5 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/Region.h +++ b/library/PolyVoxCore/include/PolyVoxCore/Region.h @@ -120,6 +120,9 @@ namespace PolyVox void shiftLowerCorner(const Vector3DInt32& amount); void shiftUpperCorner(const Vector3DInt32& amount); //FIXME - Add dilate and erode functions? + + void dilate(int32_t amount); + void erode(int32_t amount); private: diff --git a/library/PolyVoxCore/source/Region.cpp b/library/PolyVoxCore/source/Region.cpp index 82cae19e..e3c9a4ba 100644 --- a/library/PolyVoxCore/source/Region.cpp +++ b/library/PolyVoxCore/source/Region.cpp @@ -306,4 +306,26 @@ namespace PolyVox m_iUpperY += amount.getY(); m_iUpperZ += amount.getZ(); } + + void Region::dilate(int32_t amount) + { + m_iLowerX -= amount; + m_iLowerY -= amount; + m_iLowerZ -= amount; + + m_iUpperX += amount; + m_iUpperY += amount; + m_iUpperZ += amount; + } + + void Region::erode(int32_t amount) + { + m_iLowerX += amount; + m_iLowerY += amount; + m_iLowerZ += amount; + + m_iUpperX -= amount; + m_iUpperY -= amount; + m_iUpperZ -= amount; + } }