diff --git a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl index 0063ed79..a6b5d95e 100644 --- a/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl +++ b/library/PolyVoxCore/include/PolyVoxCore/RawVolumeSampler.inl @@ -23,12 +23,12 @@ freely, subject to the following restrictions: #include "PolyVoxCore\Impl\Utility.h" -#define BORDER_LOWX(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) -#define BORDER_HIGHX(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) -#define BORDER_LOWY(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) -#define BORDER_HIGHY(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) -#define BORDER_LOWZ(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) -#define BORDER_HIGHZ(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) +#define CAN_GO_NEG_X(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) +#define CAN_GO_POS_X(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) +#define CAN_GO_NEG_Y(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) +#define CAN_GO_POS_Y(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) +#define CAN_GO_NEG_Z(val) (val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) +#define CAN_GO_POS_Z(val) (val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) namespace PolyVox { @@ -155,7 +155,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1ny1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -165,7 +165,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1ny0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel - 1 - this->mVolume->getWidth()); } @@ -175,7 +175,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1ny1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -185,7 +185,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx0py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -195,7 +195,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx0py0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) ) { return *(mCurrentVoxel - 1); } @@ -205,7 +205,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx0py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -215,7 +215,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -225,7 +225,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1py0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel - 1 + this->mVolume->getWidth()); } @@ -235,7 +235,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1nx1py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -247,7 +247,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1ny1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -257,7 +257,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1ny0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel - this->mVolume->getWidth()); } @@ -267,7 +267,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1ny1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -277,7 +277,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px0py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -297,7 +297,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px0py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -307,7 +307,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -317,7 +317,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1py0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel + this->mVolume->getWidth()); } @@ -327,7 +327,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel0px1py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -339,7 +339,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1ny1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 - this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -349,7 +349,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1ny0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel + 1 - this->mVolume->getWidth()); } @@ -359,7 +359,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1ny1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 - this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -369,7 +369,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px0py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -379,7 +379,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px0py0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) ) { return *(mCurrentVoxel + 1); } @@ -389,7 +389,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px0py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -399,7 +399,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1py1nz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_LOWZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 + this->mVolume->getWidth() - this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -409,7 +409,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1py0pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) { return *(mCurrentVoxel + 1 + this->mVolume->getWidth()); } @@ -419,7 +419,7 @@ namespace PolyVox template VoxelType RawVolume::Sampler::peekVoxel1px1py1pz(void) const { - if((this->isCurrentPositionValid()) && BORDER_HIGHX(this->mXPosInVolume) && BORDER_HIGHY(this->mYPosInVolume) && BORDER_HIGHZ(this->mZPosInVolume) ) + if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) { return *(mCurrentVoxel + 1 + this->mVolume->getWidth() + this->mVolume->getWidth() * this->mVolume->getHeight()); } @@ -471,9 +471,9 @@ namespace PolyVox } } -#undef BORDER_LOWX -#undef BORDER_HIGHX -#undef BORDER_LOWY -#undef BORDER_HIGHY -#undef BORDER_LOWZ -#undef BORDER_HIGHZ +#undef CAN_GO_NEG_X +#undef CAN_GO_POS_X +#undef CAN_GO_NEG_Y +#undef CAN_GO_POS_Y +#undef CAN_GO_NEG_Z +#undef CAN_GO_POS_Z