Removing more calls to getVoxelAt()...

This commit is contained in:
Daviw Williams 2013-06-12 15:41:45 +02:00
parent efb6d12fc8
commit 3249562d97
3 changed files with 8 additions and 15 deletions

View File

@ -55,15 +55,8 @@ void createSphereInVolume(SimpleVolume<uint8_t>& volData, float fRadius)
if(fDistToCenter <= fRadius) if(fDistToCenter <= fRadius)
{ {
//Our new density value //Our new density value
//uint8_t uDensity = Density8::getmaxDensity()();
uint8_t uDensity = std::numeric_limits<uint8_t>::max(); uint8_t uDensity = std::numeric_limits<uint8_t>::max();
//Get the old voxel
//uint8_t voxel = volData.getVoxelAt(x,y,z);
//Modify the density
//voxel.setDensity(uDensity);
//Wrte the voxel value into the volume //Wrte the voxel value into the volume
volData.setVoxelAt(x, y, z, uDensity); volData.setVoxelAt(x, y, z, uDensity);
} }

View File

@ -39,14 +39,14 @@ namespace PolyVox
{ {
// PolyVox does not throw an exception when a voxel is out of range. Please see 'Error Handling' in the User Manual. // PolyVox does not throw an exception when a voxel is out of range. Please see 'Error Handling' in the User Manual.
POLYVOX_ASSERT(m_regValid.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)), "Position is outside valid region"); POLYVOX_ASSERT(m_regValid.containsPoint(Vector3DInt32(uXPos, uYPos, uZPos)), "Position is outside valid region");
return m_pVolume.getVoxelAt(uXPos, uYPos, uZPos); return m_pVolume.getVoxel<WrapModes::DontCheck>(uXPos, uYPos, uZPos);
} }
VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const
{ {
// PolyVox does not throw an exception when a voxel is out of range. Please see 'Error Handling' in the User Manual. // PolyVox does not throw an exception when a voxel is out of range. Please see 'Error Handling' in the User Manual.
POLYVOX_ASSERT(m_regValid.containsPoint(v3dPos), "Position is outside valid region"); POLYVOX_ASSERT(m_regValid.containsPoint(v3dPos), "Position is outside valid region");
return getVoxelAt(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ()); return getVoxel<WrapModes::DontCheck>(v3dPos.getX(), v3dPos.getY(), v3dPos.getZ());
} }
void setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const void setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue) const

View File

@ -52,14 +52,14 @@ namespace PolyVox
const int32_t z = volIter.getPosition().getZ(); const int32_t z = volIter.getPosition().getZ();
//FIXME - bitwise way of doing this? //FIXME - bitwise way of doing this?
typename VolumeType::VoxelType voxel1nx = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1nx = volIter.getVoxel(x-2, y ,z ) > 0 ? 1: 0;
typename VolumeType::VoxelType voxel1px = volIter.getVoxelAt(x-2, y ,z ) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1px = volIter.getVoxel(x-2, y ,z ) > 0 ? 1: 0;
typename VolumeType::VoxelType voxel1ny = volIter.getVoxelAt(x , y-2,z ) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1ny = volIter.getVoxel(x , y-2,z ) > 0 ? 1: 0;
typename VolumeType::VoxelType voxel1py = volIter.getVoxelAt(x , y-2,z ) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1py = volIter.getVoxel(x , y-2,z ) > 0 ? 1: 0;
typename VolumeType::VoxelType voxel1nz = volIter.getVoxelAt(x , y ,z-2) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1nz = volIter.getVoxel(x , y ,z-2) > 0 ? 1: 0;
typename VolumeType::VoxelType voxel1pz = volIter.getVoxelAt(x , y ,z-2) > 0 ? 1: 0; typename VolumeType::VoxelType voxel1pz = volIter.getVoxel(x , y ,z-2) > 0 ? 1: 0;
return Vector3DFloat return Vector3DFloat
( (