Fixed bug with RawVolume always starting coordinates at (0,0,0).

Removed Filters.h/.inl
Added Summed Area Table support to LowPassFilter.
Added test for low pass filter.
This commit is contained in:
David Williams
2011-08-13 08:57:45 +01:00
parent 03e340e7dd
commit c73b45b721
14 changed files with 308 additions and 144 deletions

View File

@@ -49,6 +49,8 @@ namespace PolyVox
)
:Volume<VoxelType>(regValid)
{
setBorderValue(VoxelType());
//Create a volume of the right size.
resize(regValid);
}
@@ -85,11 +87,16 @@ namespace PolyVox
{
if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)))
{
const Vector3DInt32& v3dLowerCorner = m_regValidRegion.getLowerCorner();
int32_t iLocalXPos = uXPos - v3dLowerCorner.getX();
int32_t iLocalYPos = uYPos - v3dLowerCorner.getY();
int32_t iLocalZPos = uZPos - v3dLowerCorner.getZ();
return m_pData
[
uXPos +
uYPos * this->getWidth() +
uZPos * this->getWidth() * this->getHeight()
iLocalXPos +
iLocalYPos * this->getWidth() +
iLocalZPos * this->getWidth() * this->getHeight()
];
}
else
@@ -127,17 +134,27 @@ namespace PolyVox
template <typename VoxelType>
bool RawVolume<VoxelType>::setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue)
{
assert(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)));
if(this->m_regValidRegion.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)))
{
const Vector3DInt32& v3dLowerCorner = m_regValidRegion.getLowerCorner();
int32_t iLocalXPos = uXPos - v3dLowerCorner.getX();
int32_t iLocalYPos = uYPos - v3dLowerCorner.getY();
int32_t iLocalZPos = uZPos - v3dLowerCorner.getZ();
m_pData
[
uXPos +
uYPos * this->getWidth() +
uZPos * this->getWidth() * this->getHeight()
] = tValue;
m_pData
[
iLocalXPos +
iLocalYPos * this->getWidth() +
iLocalZPos * this->getWidth() * this->getHeight()
] = tValue;
//Return true to indicate that we modified a voxel.
return true;
//Return true to indicate that we modified a voxel.
return true;
}
else
{
return false;
}
}
////////////////////////////////////////////////////////////////////////////////