Improved raycast unit test so that it exits early if the ray leaves the volume.

This commit is contained in:
David Williams
2012-12-02 17:33:59 +01:00
parent c37997bfe2
commit 47e8f4a86d
3 changed files with 33 additions and 18 deletions

View File

@ -65,6 +65,8 @@ namespace PolyVox
Vector3DInt32 getPosition(void) const;
inline VoxelType getVoxel(void) const;
bool isCurrentPositionValid(void) const;
void setPosition(const Vector3DInt32& v3dNewPos);
void setPosition(int32_t xPos, int32_t yPos, int32_t zPos);
inline bool setVoxel(VoxelType tValue);
@ -110,7 +112,6 @@ namespace PolyVox
protected:
VoxelType getVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos) const;
bool isCurrentPositionValid(void) const;
DerivedVolumeType* mVolume;

View File

@ -60,6 +60,13 @@ namespace PolyVox
return mVolume->getVoxelAt(mXPosInVolume, mYPosInVolume, mZPosInVolume);
}
template <typename VoxelType>
template <typename DerivedVolumeType>
bool inline BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::isCurrentPositionValid(void) const
{
return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
}
template <typename VoxelType>
template <typename DerivedVolumeType>
void BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::setPosition(const Vector3DInt32& v3dNewPos)
@ -374,11 +381,4 @@ namespace PolyVox
}
}
}
template <typename VoxelType>
template <typename DerivedVolumeType>
bool inline BaseVolume<VoxelType>::Sampler<DerivedVolumeType>::isCurrentPositionValid(void) const
{
return m_bIsCurrentPositionValidInX && m_bIsCurrentPositionValidInY && m_bIsCurrentPositionValidInZ;
}
}