Merge branch 'feature/region-enhancements' into develop

This commit is contained in:
David Williams
2012-11-24 12:52:52 +01:00
2 changed files with 62 additions and 1 deletions

View File

@ -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);
@ -115,6 +121,9 @@ namespace PolyVox
void shiftUpperCorner(const Vector3DInt32& amount);
//FIXME - Add dilate and erode functions?
void dilate(int32_t amount);
void erode(int32_t amount);
private:
int32_t m_iLowerX;

View File

@ -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();
@ -276,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;
}
}