Regeneration of regions can now be prioritised, for example by distance to camera.

This commit is contained in:
David Williams 2009-06-10 20:57:47 +00:00
parent 530a53b4fe
commit b4d9351f1b
2 changed files with 8 additions and 0 deletions

View File

@ -37,6 +37,7 @@ namespace PolyVox
const Vector3DInt16& getLowerCorner(void) const;
const Vector3DInt16& getUpperCorner(void) const;
const Vector3DInt16& getCentre(void) const;
void setLowerCorner(const Vector3DInt16& v3dLowerCorner);
void setUpperCorner(const Vector3DInt16& v3dUpperCorner);

View File

@ -24,6 +24,13 @@ namespace PolyVox
return m_v3dUpperCorner;
}
const Vector3DInt16& Region::getCentre(void) const
{
Vector3DInt32 v3dMidpoint = static_cast<Vector3DInt32>(m_v3dLowerCorner) + static_cast<Vector3DInt32>(m_v3dUpperCorner);
v3dMidpoint = v3dMidpoint / static_cast<int32_t>(2);
return m_v3dLowerCorner + static_cast<Vector3DInt16>(v3dMidpoint);
}
void Region::setLowerCorner(const Vector3DInt16& v3dLowerCorner)
{
m_v3dLowerCorner = v3dLowerCorner;