Renamed some constants.
This commit is contained in:
parent
cc4902b4d7
commit
d8dacdadc3
@ -22,14 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|||||||
#ifndef __Block_H__
|
#ifndef __Block_H__
|
||||||
#define __Block_H__
|
#define __Block_H__
|
||||||
|
|
||||||
#pragma region Standard Headers
|
#pragma region Headers
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#pragma region Boost Headers
|
|
||||||
#include "boost/cstdint.hpp"
|
#include "boost/cstdint.hpp"
|
||||||
#pragma endregion
|
|
||||||
|
|
||||||
#pragma region PolyVox Headers
|
|
||||||
#include "Constants.h"
|
#include "Constants.h"
|
||||||
#include "TypeDef.h"
|
#include "TypeDef.h"
|
||||||
#pragma endregion
|
#pragma endregion
|
||||||
@ -57,7 +52,7 @@ namespace PolyVox
|
|||||||
//void fillWithValue(const uint8_t value);
|
//void fillWithValue(const uint8_t value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
boost::uint8_t mData[OGRE_NO_OF_VOXELS_IN_BLOCK];
|
boost::uint8_t mData[POLYVOX_NO_OF_VOXELS_IN_BLOCK];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,22 +6,22 @@
|
|||||||
namespace PolyVox
|
namespace PolyVox
|
||||||
{
|
{
|
||||||
//FIXME - i think we can define mod using a bitmask which flattens the upper bits. Should define that here.
|
//FIXME - i think we can define mod using a bitmask which flattens the upper bits. Should define that here.
|
||||||
const boost::uint32_t OGRE_BLOCK_SIDE_LENGTH_POWER = 5;
|
const boost::uint32_t POLYVOX_BLOCK_SIDE_LENGTH_POWER = 5;
|
||||||
const boost::uint32_t OGRE_BLOCK_SIDE_LENGTH = (0x0001 << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const boost::uint32_t POLYVOX_BLOCK_SIDE_LENGTH = (0x0001 << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const boost::uint32_t OGRE_NO_OF_VOXELS_IN_BLOCK = (OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH);
|
const boost::uint32_t POLYVOX_NO_OF_VOXELS_IN_BLOCK = (POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
|
|
||||||
const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_POWER = 8;
|
const boost::uint32_t POLYVOX_VOLUME_SIDE_LENGTH_POWER = 8;
|
||||||
const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH = (0x0001 << OGRE_VOLUME_SIDE_LENGTH_POWER);
|
const boost::uint32_t POLYVOX_VOLUME_SIDE_LENGTH = (0x0001 << POLYVOX_VOLUME_SIDE_LENGTH_POWER);
|
||||||
const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const boost::uint32_t POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const boost::uint32_t OGRE_NO_OF_BLOCKS_IN_VOLUME = (OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS);
|
const boost::uint32_t POLYVOX_NO_OF_BLOCKS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS);
|
||||||
const boost::uint32_t OGRE_NO_OF_VOXELS_IN_VOLUME = (OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH);
|
const boost::uint32_t POLYVOX_NO_OF_VOXELS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH * POLYVOX_VOLUME_SIDE_LENGTH);
|
||||||
|
|
||||||
const boost::uint32_t OGRE_REGION_SIDE_LENGTH_POWER = 4;
|
const boost::uint32_t POLYVOX_REGION_SIDE_LENGTH_POWER = 4;
|
||||||
const boost::uint32_t OGRE_REGION_SIDE_LENGTH = (0x0001 << OGRE_REGION_SIDE_LENGTH_POWER);
|
const boost::uint32_t POLYVOX_REGION_SIDE_LENGTH = (0x0001 << POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||||
const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_REGION_SIDE_LENGTH_POWER);
|
const boost::uint32_t POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS = (POLYVOX_VOLUME_SIDE_LENGTH >> POLYVOX_REGION_SIDE_LENGTH_POWER);
|
||||||
const boost::uint32_t OGRE_NO_OF_REGIONS_IN_VOLUME = (OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS * OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS * OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS);
|
const boost::uint32_t POLYVOX_NO_OF_REGIONS_IN_VOLUME = (POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS * POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS * POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS);
|
||||||
|
|
||||||
const boost::uint32_t OGRE_MAX_VOXELS_TO_BURN_PER_FRAME = 1000;
|
const boost::uint32_t POLYVOX_MAX_VOXELS_TO_BURN_PER_FRAME = 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -30,7 +30,7 @@ namespace PolyVox
|
|||||||
std::vector<boost::uint16_t> m_vecTriangleIndices;
|
std::vector<boost::uint16_t> m_vecTriangleIndices;
|
||||||
std::vector<SurfaceVertex> m_vecVertices;
|
std::vector<SurfaceVertex> m_vecVertices;
|
||||||
|
|
||||||
long int vertexIndices[OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1];
|
long int vertexIndices[POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1][POLYVOX_REGION_SIDE_LENGTH*2+1];
|
||||||
|
|
||||||
static long int noOfVerticesSubmitted;
|
static long int noOfVerticesSubmitted;
|
||||||
static long int noOfVerticesAccepted;
|
static long int noOfVerticesAccepted;
|
||||||
|
@ -77,11 +77,11 @@ namespace PolyVox
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool surfaceUpToDate[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
bool surfaceUpToDate[POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
bool regionIsHomogenous[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
bool regionIsHomogenous[POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
|
|
||||||
//SurfacePatchRenderable* m_singleMaterialSurfaces[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
//SurfacePatchRenderable* m_singleMaterialSurfaces[POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
//SurfacePatchRenderable* m_multiMaterialSurfaces[OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS][OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
//SurfacePatchRenderable* m_multiMaterialSurfaces[POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS][POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS];
|
||||||
|
|
||||||
Vector3DFloat computeNormal(const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod) const;
|
Vector3DFloat computeNormal(const Vector3DFloat& position, NormalGenerationMethod normalGenerationMethod) const;
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ namespace PolyVox
|
|||||||
void tidy(void);
|
void tidy(void);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Block* mBlocks[OGRE_NO_OF_BLOCKS_IN_VOLUME];
|
Block* mBlocks[POLYVOX_NO_OF_BLOCKS_IN_VOLUME];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ namespace PolyVox {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(mData,rhs.mData,OGRE_NO_OF_VOXELS_IN_BLOCK);
|
memcpy(mData,rhs.mData,POLYVOX_NO_OF_VOXELS_IN_BLOCK);
|
||||||
|
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
@ -53,8 +53,8 @@ namespace PolyVox {
|
|||||||
return mData
|
return mData
|
||||||
[
|
[
|
||||||
xPosition +
|
xPosition +
|
||||||
yPosition * OGRE_BLOCK_SIDE_LENGTH +
|
yPosition * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
zPosition * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH
|
zPosition * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,20 +63,20 @@ namespace PolyVox {
|
|||||||
mData
|
mData
|
||||||
[
|
[
|
||||||
xPosition +
|
xPosition +
|
||||||
yPosition * OGRE_BLOCK_SIDE_LENGTH +
|
yPosition * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
zPosition * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH
|
zPosition * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH
|
||||||
] = value;
|
] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*void Block::fillWithValue(const uint8_t value)
|
/*void Block::fillWithValue(const uint8_t value)
|
||||||
{
|
{
|
||||||
memset(mData,value,OGRE_NO_OF_VOXELS_IN_BLOCK);
|
memset(mData,value,POLYVOX_NO_OF_VOXELS_IN_BLOCK);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*bool Block::isHomogeneous(void)
|
/*bool Block::isHomogeneous(void)
|
||||||
{
|
{
|
||||||
uint8_t uFirstVoxel = mData[0];
|
uint8_t uFirstVoxel = mData[0];
|
||||||
for(uint32_t ct = 1; ct < OGRE_NO_OF_VOXELS_IN_BLOCK; ++ct)
|
for(uint32_t ct = 1; ct < POLYVOX_NO_OF_VOXELS_IN_BLOCK; ++ct)
|
||||||
{
|
{
|
||||||
if(mData[ct] != uFirstVoxel)
|
if(mData[ct] != uFirstVoxel)
|
||||||
{
|
{
|
||||||
|
@ -53,11 +53,11 @@ namespace PolyVox
|
|||||||
std::list<RegionGeometry> listChangedRegionGeometry;
|
std::list<RegionGeometry> listChangedRegionGeometry;
|
||||||
|
|
||||||
//Regenerate meshes.
|
//Regenerate meshes.
|
||||||
for(uint16_t regionZ = 0; regionZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
|
for(uint16_t regionZ = 0; regionZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
|
||||||
{
|
{
|
||||||
for(uint16_t regionY = 0; regionY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)
|
for(uint16_t regionY = 0; regionY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)
|
||||||
{
|
{
|
||||||
for(uint16_t regionX = 0; regionX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX)
|
for(uint16_t regionX = 0; regionX < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX)
|
||||||
{
|
{
|
||||||
if(surfaceUpToDate[regionX][regionY][regionZ] == false)
|
if(surfaceUpToDate[regionX][regionY][regionZ] == false)
|
||||||
{
|
{
|
||||||
@ -84,11 +84,11 @@ namespace PolyVox
|
|||||||
|
|
||||||
void PolyVoxSceneManager::setAllUpToDateFlagsTo(bool newUpToDateValue)
|
void PolyVoxSceneManager::setAllUpToDateFlagsTo(bool newUpToDateValue)
|
||||||
{
|
{
|
||||||
for(uint16_t blockZ = 0; blockZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockZ)
|
for(uint16_t blockZ = 0; blockZ < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockZ)
|
||||||
{
|
{
|
||||||
for(uint16_t blockY = 0; blockY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockY)
|
for(uint16_t blockY = 0; blockY < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockY)
|
||||||
{
|
{
|
||||||
for(uint16_t blockX = 0; blockX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockX)
|
for(uint16_t blockX = 0; blockX < POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockX)
|
||||||
{
|
{
|
||||||
surfaceUpToDate[blockX][blockY][blockZ] = newUpToDateValue;
|
surfaceUpToDate[blockX][blockY][blockZ] = newUpToDateValue;
|
||||||
}
|
}
|
||||||
@ -113,9 +113,9 @@ namespace PolyVox
|
|||||||
firstY = std::max(firstY,0);
|
firstY = std::max(firstY,0);
|
||||||
firstZ = std::max(firstZ,0);
|
firstZ = std::max(firstZ,0);
|
||||||
|
|
||||||
lastX = std::min(lastX,int(OGRE_VOLUME_SIDE_LENGTH-1));
|
lastX = std::min(lastX,int(POLYVOX_VOLUME_SIDE_LENGTH-1));
|
||||||
lastY = std::min(lastY,int(OGRE_VOLUME_SIDE_LENGTH-1));
|
lastY = std::min(lastY,int(POLYVOX_VOLUME_SIDE_LENGTH-1));
|
||||||
lastZ = std::min(lastZ,int(OGRE_VOLUME_SIDE_LENGTH-1));
|
lastZ = std::min(lastZ,int(POLYVOX_VOLUME_SIDE_LENGTH-1));
|
||||||
|
|
||||||
VolumeIterator volIter(*volumeData);
|
VolumeIterator volIter(*volumeData);
|
||||||
volIter.setValidRegion(firstX,firstY,firstZ,lastX,lastY,lastZ);
|
volIter.setValidRegion(firstX,firstY,firstZ,lastX,lastY,lastZ);
|
||||||
@ -150,11 +150,11 @@ namespace PolyVox
|
|||||||
//volumeData = VolumePtr(new Volume);
|
//volumeData = VolumePtr(new Volume);
|
||||||
volumeData = new Volume();
|
volumeData = new Volume();
|
||||||
VolumeIterator volIter(*volumeData);
|
VolumeIterator volIter(*volumeData);
|
||||||
for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
|
for(uint16_t z = 0; z < POLYVOX_VOLUME_SIDE_LENGTH; ++z)
|
||||||
{
|
{
|
||||||
for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
|
for(uint16_t y = 0; y < POLYVOX_VOLUME_SIDE_LENGTH; ++y)
|
||||||
{
|
{
|
||||||
for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
|
for(uint16_t x = 0; x < POLYVOX_VOLUME_SIDE_LENGTH; ++x)
|
||||||
{
|
{
|
||||||
if((x/16+y/16+z/16)%2 == 0)
|
if((x/16+y/16+z/16)%2 == 0)
|
||||||
volIter.setVoxelAt(x,y,z,4);
|
volIter.setVoxelAt(x,y,z,4);
|
||||||
@ -164,11 +164,11 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
|
for(uint16_t z = 0; z < POLYVOX_VOLUME_SIDE_LENGTH; ++z)
|
||||||
{
|
{
|
||||||
for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
|
for(uint16_t y = 0; y < POLYVOX_VOLUME_SIDE_LENGTH; ++y)
|
||||||
{
|
{
|
||||||
for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
|
for(uint16_t x = 0; x < POLYVOX_VOLUME_SIDE_LENGTH; ++x)
|
||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
(z<62)||
|
(z<62)||
|
||||||
@ -204,11 +204,11 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
|
for(uint16_t z = 0; z < POLYVOX_VOLUME_SIDE_LENGTH; ++z)
|
||||||
{
|
{
|
||||||
for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
|
for(uint16_t y = 0; y < POLYVOX_VOLUME_SIDE_LENGTH; ++y)
|
||||||
{
|
{
|
||||||
for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
|
for(uint16_t x = 0; x < POLYVOX_VOLUME_SIDE_LENGTH; ++x)
|
||||||
{
|
{
|
||||||
if(
|
if(
|
||||||
(x%64 < 8) &&
|
(x%64 < 8) &&
|
||||||
@ -233,12 +233,12 @@ namespace PolyVox
|
|||||||
//IndexedSurfacePatch* surfacePatchResult = new IndexedSurfacePatch;
|
//IndexedSurfacePatch* surfacePatchResult = new IndexedSurfacePatch;
|
||||||
|
|
||||||
//First and last voxels in the region
|
//First and last voxels in the region
|
||||||
const uint16_t firstX = regionX * OGRE_REGION_SIDE_LENGTH;
|
const uint16_t firstX = regionX * POLYVOX_REGION_SIDE_LENGTH;
|
||||||
const uint16_t firstY = regionY * OGRE_REGION_SIDE_LENGTH;
|
const uint16_t firstY = regionY * POLYVOX_REGION_SIDE_LENGTH;
|
||||||
const uint16_t firstZ = regionZ * OGRE_REGION_SIDE_LENGTH;
|
const uint16_t firstZ = regionZ * POLYVOX_REGION_SIDE_LENGTH;
|
||||||
const uint16_t lastX = (std::min)(firstX + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(OGRE_VOLUME_SIDE_LENGTH-2));
|
const uint16_t lastX = (std::min)(firstX + POLYVOX_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(POLYVOX_VOLUME_SIDE_LENGTH-2));
|
||||||
const uint16_t lastY = (std::min)(firstY + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(OGRE_VOLUME_SIDE_LENGTH-2));
|
const uint16_t lastY = (std::min)(firstY + POLYVOX_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(POLYVOX_VOLUME_SIDE_LENGTH-2));
|
||||||
const uint16_t lastZ = (std::min)(firstZ + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(OGRE_VOLUME_SIDE_LENGTH-2));
|
const uint16_t lastZ = (std::min)(firstZ + POLYVOX_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(POLYVOX_VOLUME_SIDE_LENGTH-2));
|
||||||
|
|
||||||
//Offset from lower block corner
|
//Offset from lower block corner
|
||||||
const Vector3DUint32 offset(firstX*2,firstY*2,firstZ*2);
|
const Vector3DUint32 offset(firstX*2,firstY*2,firstZ*2);
|
||||||
@ -620,28 +620,28 @@ namespace PolyVox
|
|||||||
void PolyVoxSceneManager::markVoxelChanged(uint16_t x, uint16_t y, uint16_t z)
|
void PolyVoxSceneManager::markVoxelChanged(uint16_t x, uint16_t y, uint16_t z)
|
||||||
{
|
{
|
||||||
//If we are not on a boundary, just mark one region.
|
//If we are not on a boundary, just mark one region.
|
||||||
if((x % OGRE_REGION_SIDE_LENGTH != 0) &&
|
if((x % POLYVOX_REGION_SIDE_LENGTH != 0) &&
|
||||||
(x % OGRE_REGION_SIDE_LENGTH != OGRE_REGION_SIDE_LENGTH-1) &&
|
(x % POLYVOX_REGION_SIDE_LENGTH != POLYVOX_REGION_SIDE_LENGTH-1) &&
|
||||||
(y % OGRE_REGION_SIDE_LENGTH != 0) &&
|
(y % POLYVOX_REGION_SIDE_LENGTH != 0) &&
|
||||||
(y % OGRE_REGION_SIDE_LENGTH != OGRE_REGION_SIDE_LENGTH-1) &&
|
(y % POLYVOX_REGION_SIDE_LENGTH != POLYVOX_REGION_SIDE_LENGTH-1) &&
|
||||||
(z % OGRE_REGION_SIDE_LENGTH != 0) &&
|
(z % POLYVOX_REGION_SIDE_LENGTH != 0) &&
|
||||||
(z % OGRE_REGION_SIDE_LENGTH != OGRE_REGION_SIDE_LENGTH-1))
|
(z % POLYVOX_REGION_SIDE_LENGTH != POLYVOX_REGION_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
surfaceUpToDate[x >> OGRE_REGION_SIDE_LENGTH_POWER][y >> OGRE_REGION_SIDE_LENGTH_POWER][z >> OGRE_REGION_SIDE_LENGTH_POWER] = false;
|
surfaceUpToDate[x >> POLYVOX_REGION_SIDE_LENGTH_POWER][y >> POLYVOX_REGION_SIDE_LENGTH_POWER][z >> POLYVOX_REGION_SIDE_LENGTH_POWER] = false;
|
||||||
}
|
}
|
||||||
else //Mark surrounding block as well
|
else //Mark surrounding block as well
|
||||||
{
|
{
|
||||||
const uint16_t regionX = x >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t regionX = x >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t regionY = y >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t regionY = y >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t regionZ = z >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t regionZ = z >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t minRegionX = (std::max)(uint16_t(0),uint16_t(regionX-1));
|
const uint16_t minRegionX = (std::max)(uint16_t(0),uint16_t(regionX-1));
|
||||||
const uint16_t minRegionY = (std::max)(uint16_t(0),uint16_t(regionY-1));
|
const uint16_t minRegionY = (std::max)(uint16_t(0),uint16_t(regionY-1));
|
||||||
const uint16_t minRegionZ = (std::max)(uint16_t(0),uint16_t(regionZ-1));
|
const uint16_t minRegionZ = (std::max)(uint16_t(0),uint16_t(regionZ-1));
|
||||||
|
|
||||||
const uint16_t maxRegionX = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionX+1));
|
const uint16_t maxRegionX = (std::min)(uint16_t(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionX+1));
|
||||||
const uint16_t maxRegionY = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionY+1));
|
const uint16_t maxRegionY = (std::min)(uint16_t(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionY+1));
|
||||||
const uint16_t maxRegionZ = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionZ+1));
|
const uint16_t maxRegionZ = (std::min)(uint16_t(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionZ+1));
|
||||||
|
|
||||||
for(uint16_t zCt = minRegionZ; zCt <= maxRegionZ; zCt++)
|
for(uint16_t zCt = minRegionZ; zCt <= maxRegionZ; zCt++)
|
||||||
{
|
{
|
||||||
@ -658,13 +658,13 @@ namespace PolyVox
|
|||||||
|
|
||||||
void PolyVoxSceneManager::markRegionChanged(uint16_t firstX, uint16_t firstY, uint16_t firstZ, uint16_t lastX, uint16_t lastY, uint16_t lastZ)
|
void PolyVoxSceneManager::markRegionChanged(uint16_t firstX, uint16_t firstY, uint16_t firstZ, uint16_t lastX, uint16_t lastY, uint16_t lastZ)
|
||||||
{
|
{
|
||||||
const uint16_t firstRegionX = firstX >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t firstRegionX = firstX >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t firstRegionY = firstY >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t firstRegionY = firstY >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t firstRegionZ = firstZ >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t firstRegionZ = firstZ >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t lastRegionX = lastX >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t lastRegionX = lastX >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t lastRegionY = lastY >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t lastRegionY = lastY >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
const uint16_t lastRegionZ = lastZ >> OGRE_REGION_SIDE_LENGTH_POWER;
|
const uint16_t lastRegionZ = lastZ >> POLYVOX_REGION_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
for(uint16_t zCt = firstRegionZ; zCt <= lastRegionZ; zCt++)
|
for(uint16_t zCt = firstRegionZ; zCt <= lastRegionZ; zCt++)
|
||||||
{
|
{
|
||||||
@ -680,7 +680,7 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint16_t PolyVoxSceneManager::getSideLength(void)
|
uint16_t PolyVoxSceneManager::getSideLength(void)
|
||||||
{
|
{
|
||||||
return OGRE_VOLUME_SIDE_LENGTH;
|
return POLYVOX_VOLUME_SIDE_LENGTH;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t PolyVoxSceneManager::getMaterialIndexAt(uint16_t uX, uint16_t uY, uint16_t uZ)
|
uint8_t PolyVoxSceneManager::getMaterialIndexAt(uint16_t uX, uint16_t uY, uint16_t uZ)
|
||||||
|
@ -15,7 +15,7 @@ namespace PolyVox
|
|||||||
:material(materialToSet)
|
:material(materialToSet)
|
||||||
,alpha(alphaToSet)
|
,alpha(alphaToSet)
|
||||||
,position(positionToSet)
|
,position(positionToSet)
|
||||||
,m_uHash((position.x()*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.y()*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.z()))
|
,m_uHash((position.x()*(POLYVOX_REGION_SIDE_LENGTH*2+1)*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.y()*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.z()))
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -24,7 +24,7 @@ namespace PolyVox
|
|||||||
:position(positionToSet)
|
:position(positionToSet)
|
||||||
,normal(normalToSet)
|
,normal(normalToSet)
|
||||||
{
|
{
|
||||||
m_uHash = (position.x()*(OGRE_REGION_SIDE_LENGTH*2+1)*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.y()*(OGRE_REGION_SIDE_LENGTH*2+1)) + (position.z());
|
m_uHash = (position.x()*(POLYVOX_REGION_SIDE_LENGTH*2+1)*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.y()*(POLYVOX_REGION_SIDE_LENGTH*2+1)) + (position.z());
|
||||||
}
|
}
|
||||||
|
|
||||||
float SurfaceVertex::getAlpha(void) const
|
float SurfaceVertex::getAlpha(void) const
|
||||||
|
@ -39,12 +39,12 @@ namespace PolyVox
|
|||||||
homogeneousBlock->fillWithValue(0);
|
homogeneousBlock->fillWithValue(0);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
/*for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
/*for(uint16_t i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||||
{
|
{
|
||||||
mBlocks[i] = mHomogeneousBlocks[0];
|
mBlocks[i] = mHomogeneousBlocks[0];
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
for(uint16_t i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||||
{
|
{
|
||||||
mBlocks[i] = new Block;
|
mBlocks[i] = new Block;
|
||||||
}
|
}
|
||||||
@ -68,13 +68,13 @@ namespace PolyVox
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
/*for(uint16_t i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||||
{
|
{
|
||||||
//FIXME - Add checking...
|
//FIXME - Add checking...
|
||||||
mBlocks[i] = SharedPtr<Block>(new Block);
|
mBlocks[i] = SharedPtr<Block>(new Block);
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
for(uint16_t i = 0; i < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++i)
|
||||||
{
|
{
|
||||||
//I think this is OK... If a block is in the homogeneous array it's ref count will be greater
|
//I think this is OK... If a block is in the homogeneous array it's ref count will be greater
|
||||||
//than 1 as there will be the pointer in the volume and the pointer in the static homogeneous array.
|
//than 1 as there will be the pointer in the volume and the pointer in the static homogeneous array.
|
||||||
@ -94,19 +94,19 @@ namespace PolyVox
|
|||||||
|
|
||||||
/*uint8_t Volume::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
|
/*uint8_t Volume::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
|
||||||
{
|
{
|
||||||
const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockX = xPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockY = yPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockZ = zPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t xOffset = xPosition - (blockX << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t yOffset = yPosition - (blockY << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t zOffset = zPosition - (blockZ << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
Block* block = mBlocks
|
Block* block = mBlocks
|
||||||
[
|
[
|
||||||
blockX +
|
blockX +
|
||||||
blockY * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
blockY * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
blockZ * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
blockZ * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
||||||
];
|
];
|
||||||
|
|
||||||
return block->getVoxelAt(xOffset,yOffset,zOffset);
|
return block->getVoxelAt(xOffset,yOffset,zOffset);
|
||||||
@ -114,19 +114,19 @@ namespace PolyVox
|
|||||||
|
|
||||||
/*void Volume::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
|
/*void Volume::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
|
||||||
{
|
{
|
||||||
const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockX = xPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockY = yPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockZ = zPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t xOffset = xPosition - (blockX << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t yOffset = yPosition - (blockY << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t zOffset = zPosition - (blockZ << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
Block* block = mBlocks
|
Block* block = mBlocks
|
||||||
[
|
[
|
||||||
blockX +
|
blockX +
|
||||||
blockY * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
blockY * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
blockZ * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
blockZ * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
||||||
];
|
];
|
||||||
|
|
||||||
block->setVoxelAt(xOffset,yOffset,zOffset, value);
|
block->setVoxelAt(xOffset,yOffset,zOffset, value);
|
||||||
@ -139,9 +139,9 @@ namespace PolyVox
|
|||||||
|
|
||||||
bool Volume::containsPoint(Vector3DFloat pos, float boundary)
|
bool Volume::containsPoint(Vector3DFloat pos, float boundary)
|
||||||
{
|
{
|
||||||
return (pos.x() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
return (pos.x() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.y() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
&& (pos.y() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.z() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
&& (pos.z() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.x() > boundary)
|
&& (pos.x() > boundary)
|
||||||
&& (pos.y() > boundary)
|
&& (pos.y() > boundary)
|
||||||
&& (pos.z() > boundary);
|
&& (pos.z() > boundary);
|
||||||
@ -149,9 +149,9 @@ namespace PolyVox
|
|||||||
|
|
||||||
bool Volume::containsPoint(Vector3DInt32 pos, uint16_t boundary)
|
bool Volume::containsPoint(Vector3DInt32 pos, uint16_t boundary)
|
||||||
{
|
{
|
||||||
return (pos.x() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
return (pos.x() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.y() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
&& (pos.y() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.z() < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
|
&& (pos.z() < POLYVOX_VOLUME_SIDE_LENGTH - 1 - boundary)
|
||||||
&& (pos.x() > boundary)
|
&& (pos.x() > boundary)
|
||||||
&& (pos.y() > boundary)
|
&& (pos.y() > boundary)
|
||||||
&& (pos.z() > boundary);
|
&& (pos.z() > boundary);
|
||||||
@ -183,11 +183,11 @@ namespace PolyVox
|
|||||||
|
|
||||||
//Read data
|
//Read data
|
||||||
VolumeIterator volIter(*this);
|
VolumeIterator volIter(*this);
|
||||||
for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
|
for(uint16_t z = 0; z < POLYVOX_VOLUME_SIDE_LENGTH; ++z)
|
||||||
{
|
{
|
||||||
for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
|
for(uint16_t y = 0; y < POLYVOX_VOLUME_SIDE_LENGTH; ++y)
|
||||||
{
|
{
|
||||||
for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
|
for(uint16_t x = 0; x < POLYVOX_VOLUME_SIDE_LENGTH; ++x)
|
||||||
{
|
{
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
file.read(reinterpret_cast<char*>(&value), sizeof(value)); //FIXME - check for error here
|
file.read(reinterpret_cast<char*>(&value), sizeof(value)); //FIXME - check for error here
|
||||||
@ -196,7 +196,7 @@ namespace PolyVox
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Periodically see if we can tidy the memory to avoid excessive usage during loading.
|
//Periodically see if we can tidy the memory to avoid excessive usage during loading.
|
||||||
if(z%OGRE_BLOCK_SIDE_LENGTH == OGRE_BLOCK_SIDE_LENGTH-1)
|
if(z%POLYVOX_BLOCK_SIDE_LENGTH == POLYVOX_BLOCK_SIDE_LENGTH-1)
|
||||||
{
|
{
|
||||||
tidy(); //FIXME - we don't actually have to tidy the whole volume here - just the part we loaded since the last call to tidy.
|
tidy(); //FIXME - we don't actually have to tidy the whole volume here - just the part we loaded since the last call to tidy.
|
||||||
}
|
}
|
||||||
@ -231,11 +231,11 @@ namespace PolyVox
|
|||||||
|
|
||||||
//Write data
|
//Write data
|
||||||
VolumeIterator volIter(*this);
|
VolumeIterator volIter(*this);
|
||||||
for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
|
for(uint16_t z = 0; z < POLYVOX_VOLUME_SIDE_LENGTH; ++z)
|
||||||
{
|
{
|
||||||
for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
|
for(uint16_t y = 0; y < POLYVOX_VOLUME_SIDE_LENGTH; ++y)
|
||||||
{
|
{
|
||||||
for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
|
for(uint16_t x = 0; x < POLYVOX_VOLUME_SIDE_LENGTH; ++x)
|
||||||
{
|
{
|
||||||
uint8_t value = volIter.getVoxelAt(x,y,z);
|
uint8_t value = volIter.getVoxelAt(x,y,z);
|
||||||
file.write(reinterpret_cast<char*>(&value), sizeof(value)); //FIXME - check for error here
|
file.write(reinterpret_cast<char*>(&value), sizeof(value)); //FIXME - check for error here
|
||||||
@ -248,7 +248,7 @@ namespace PolyVox
|
|||||||
void Volume::regionGrow(uint16_t xStart, uint16_t yStart, uint16_t zStart, uint8_t value)
|
void Volume::regionGrow(uint16_t xStart, uint16_t yStart, uint16_t zStart, uint8_t value)
|
||||||
{
|
{
|
||||||
//FIXME - introduce integrer 'isInVolume' function
|
//FIXME - introduce integrer 'isInVolume' function
|
||||||
if((xStart > OGRE_VOLUME_SIDE_LENGTH-1) || (yStart > OGRE_VOLUME_SIDE_LENGTH-1) || (zStart > OGRE_VOLUME_SIDE_LENGTH-1)
|
if((xStart > POLYVOX_VOLUME_SIDE_LENGTH-1) || (yStart > POLYVOX_VOLUME_SIDE_LENGTH-1) || (zStart > POLYVOX_VOLUME_SIDE_LENGTH-1)
|
||||||
|| (xStart < 0) || (yStart < 0) || (zStart < 0))
|
|| (xStart < 0) || (yStart < 0) || (zStart < 0))
|
||||||
{
|
{
|
||||||
//FIXME - error message..
|
//FIXME - error message..
|
||||||
@ -274,7 +274,7 @@ namespace PolyVox
|
|||||||
//std::cout << "x = " << currentSeed.x << " y = " << currentSeed.y << " z = " << currentSeed.z << std::endl;
|
//std::cout << "x = " << currentSeed.x << " y = " << currentSeed.y << " z = " << currentSeed.z << std::endl;
|
||||||
|
|
||||||
//FIXME - introduce 'safe' function which tests this?
|
//FIXME - introduce 'safe' function which tests this?
|
||||||
if((currentSeed.x() > OGRE_VOLUME_SIDE_LENGTH-2) || (currentSeed.y() > OGRE_VOLUME_SIDE_LENGTH-2) || (currentSeed.z() > OGRE_VOLUME_SIDE_LENGTH-2)
|
if((currentSeed.x() > POLYVOX_VOLUME_SIDE_LENGTH-2) || (currentSeed.y() > POLYVOX_VOLUME_SIDE_LENGTH-2) || (currentSeed.z() > POLYVOX_VOLUME_SIDE_LENGTH-2)
|
||||||
|| (currentSeed.x() < 1) || (currentSeed.y() < 1) || (currentSeed.z() < 1))
|
|| (currentSeed.x() < 1) || (currentSeed.y() < 1) || (currentSeed.z() < 1))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
@ -321,7 +321,7 @@ namespace PolyVox
|
|||||||
void Volume::tidy(void)
|
void Volume::tidy(void)
|
||||||
{
|
{
|
||||||
//Check for homogeneous blocks
|
//Check for homogeneous blocks
|
||||||
/*for(uint32_t ct = 0; ct < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++ct)
|
/*for(uint32_t ct = 0; ct < POLYVOX_NO_OF_BLOCKS_IN_VOLUME; ++ct)
|
||||||
{
|
{
|
||||||
if(mBlocks[ct]->isHomogeneous())
|
if(mBlocks[ct]->isHomogeneous())
|
||||||
{
|
{
|
||||||
|
@ -29,15 +29,15 @@ namespace PolyVox
|
|||||||
,mXRegionFirst(0)
|
,mXRegionFirst(0)
|
||||||
,mYRegionFirst(0)
|
,mYRegionFirst(0)
|
||||||
,mZRegionFirst(0)
|
,mZRegionFirst(0)
|
||||||
,mXRegionLast(OGRE_VOLUME_SIDE_LENGTH-1)
|
,mXRegionLast(POLYVOX_VOLUME_SIDE_LENGTH-1)
|
||||||
,mYRegionLast(OGRE_VOLUME_SIDE_LENGTH-1)
|
,mYRegionLast(POLYVOX_VOLUME_SIDE_LENGTH-1)
|
||||||
,mZRegionLast(OGRE_VOLUME_SIDE_LENGTH-1)
|
,mZRegionLast(POLYVOX_VOLUME_SIDE_LENGTH-1)
|
||||||
,mXRegionFirstBlock(0)
|
,mXRegionFirstBlock(0)
|
||||||
,mYRegionFirstBlock(0)
|
,mYRegionFirstBlock(0)
|
||||||
,mZRegionFirstBlock(0)
|
,mZRegionFirstBlock(0)
|
||||||
,mXRegionLastBlock(OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
,mXRegionLastBlock(POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
||||||
,mYRegionLastBlock(OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
,mYRegionLastBlock(POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
||||||
,mZRegionLastBlock(OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
,mZRegionLastBlock(POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS-1)
|
||||||
,mXPosInVolume(0)
|
,mXPosInVolume(0)
|
||||||
,mYPosInVolume(0)
|
,mYPosInVolume(0)
|
||||||
,mZPosInVolume(0)
|
,mZPosInVolume(0)
|
||||||
@ -82,19 +82,19 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
|
uint8_t VolumeIterator::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
|
||||||
{
|
{
|
||||||
const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockX = xPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockY = yPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockZ = zPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t xOffset = xPosition - (blockX << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t yOffset = yPosition - (blockY << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t zOffset = zPosition - (blockZ << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
const Block* block = mVolume.mBlocks
|
const Block* block = mVolume.mBlocks
|
||||||
[
|
[
|
||||||
blockX +
|
blockX +
|
||||||
blockY * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
blockY * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
blockZ * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
blockZ * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
||||||
];
|
];
|
||||||
|
|
||||||
return block->getVoxelAt(xOffset,yOffset,zOffset);
|
return block->getVoxelAt(xOffset,yOffset,zOffset);
|
||||||
@ -126,19 +126,19 @@ namespace PolyVox
|
|||||||
|
|
||||||
void VolumeIterator::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
|
void VolumeIterator::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
|
||||||
{
|
{
|
||||||
const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockX = xPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockY = yPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
const uint16_t blockZ = zPosition >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t xOffset = xPosition - (blockX << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t yOffset = yPosition - (blockY << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
const uint16_t zOffset = zPosition - (blockZ << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
Block* block = mVolume.mBlocks
|
Block* block = mVolume.mBlocks
|
||||||
[
|
[
|
||||||
blockX +
|
blockX +
|
||||||
blockY * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
blockY * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
blockZ * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
blockZ * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS
|
||||||
];
|
];
|
||||||
|
|
||||||
/*if(!block.unique())
|
/*if(!block.unique())
|
||||||
@ -155,9 +155,9 @@ namespace PolyVox
|
|||||||
Vector3DFloat VolumeIterator::getCentralDifferenceGradient(void) const
|
Vector3DFloat VolumeIterator::getCentralDifferenceGradient(void) const
|
||||||
{
|
{
|
||||||
//FIXME - should this test be here?
|
//FIXME - should this test be here?
|
||||||
if((mXPosInVolume < 1) || (mXPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2) ||
|
if((mXPosInVolume < 1) || (mXPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2) ||
|
||||||
(mYPosInVolume < 1) || (mYPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2) ||
|
(mYPosInVolume < 1) || (mYPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2) ||
|
||||||
(mZPosInVolume < 1) || (mZPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2))
|
(mZPosInVolume < 1) || (mZPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2))
|
||||||
{
|
{
|
||||||
//LogManager::getSingleton().logMessage("Out of range");
|
//LogManager::getSingleton().logMessage("Out of range");
|
||||||
return Vector3DFloat(0.0,0.0,0.0);
|
return Vector3DFloat(0.0,0.0,0.0);
|
||||||
@ -179,9 +179,9 @@ namespace PolyVox
|
|||||||
Vector3DFloat VolumeIterator::getAveragedCentralDifferenceGradient(void) const
|
Vector3DFloat VolumeIterator::getAveragedCentralDifferenceGradient(void) const
|
||||||
{
|
{
|
||||||
//FIXME - should this test be here?
|
//FIXME - should this test be here?
|
||||||
if((mXPosInVolume < 2) || (mXPosInVolume > OGRE_VOLUME_SIDE_LENGTH-3) ||
|
if((mXPosInVolume < 2) || (mXPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-3) ||
|
||||||
(mYPosInVolume < 2) || (mYPosInVolume > OGRE_VOLUME_SIDE_LENGTH-3) ||
|
(mYPosInVolume < 2) || (mYPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-3) ||
|
||||||
(mZPosInVolume < 2) || (mZPosInVolume > OGRE_VOLUME_SIDE_LENGTH-3))
|
(mZPosInVolume < 2) || (mZPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-3))
|
||||||
{
|
{
|
||||||
//LogManager::getSingleton().logMessage("Out of range");
|
//LogManager::getSingleton().logMessage("Out of range");
|
||||||
return Vector3DFloat(0.0,0.0,0.0);
|
return Vector3DFloat(0.0,0.0,0.0);
|
||||||
@ -203,9 +203,9 @@ namespace PolyVox
|
|||||||
Vector3DFloat VolumeIterator::getSobelGradient(void) const
|
Vector3DFloat VolumeIterator::getSobelGradient(void) const
|
||||||
{
|
{
|
||||||
//FIXME - should this test be here?
|
//FIXME - should this test be here?
|
||||||
if((mXPosInVolume < 1) || (mXPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2) ||
|
if((mXPosInVolume < 1) || (mXPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2) ||
|
||||||
(mYPosInVolume < 1) || (mYPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2) ||
|
(mYPosInVolume < 1) || (mYPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2) ||
|
||||||
(mZPosInVolume < 1) || (mZPosInVolume > OGRE_VOLUME_SIDE_LENGTH-2))
|
(mZPosInVolume < 1) || (mZPosInVolume > POLYVOX_VOLUME_SIDE_LENGTH-2))
|
||||||
{
|
{
|
||||||
//LogManager::getSingleton().logMessage("Out of range");
|
//LogManager::getSingleton().logMessage("Out of range");
|
||||||
return Vector3DFloat(0.0,0.0,0.0);
|
return Vector3DFloat(0.0,0.0,0.0);
|
||||||
@ -312,22 +312,22 @@ namespace PolyVox
|
|||||||
mYPosInVolume = yPos;
|
mYPosInVolume = yPos;
|
||||||
mZPosInVolume = zPos;
|
mZPosInVolume = zPos;
|
||||||
|
|
||||||
mXBlock = mXPosInVolume >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mXBlock = mXPosInVolume >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mYBlock = mYPosInVolume >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mYBlock = mYPosInVolume >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mZBlock = mZPosInVolume >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mZBlock = mZPosInVolume >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mXPosInBlock = mXPosInVolume - (mXBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mYPosInBlock = mYPosInVolume - (mYBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mZPosInBlock = mZPosInVolume - (mZBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mZPosInBlock = mZPosInVolume - (mZBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
mBlockIndexInVolume = mXBlock +
|
mBlockIndexInVolume = mXBlock +
|
||||||
mYBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
mYBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
mZBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
mZBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
||||||
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
||||||
|
|
||||||
mVoxelIndexInBlock = mXPosInBlock +
|
mVoxelIndexInBlock = mXPosInBlock +
|
||||||
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
|
mYPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
mZPosInBlock * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH;
|
mZPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
|
|
||||||
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
||||||
}
|
}
|
||||||
@ -346,17 +346,17 @@ namespace PolyVox
|
|||||||
mYRegionFirst = (std::max)(0,yFirst);
|
mYRegionFirst = (std::max)(0,yFirst);
|
||||||
mZRegionFirst = (std::max)(0,zFirst);
|
mZRegionFirst = (std::max)(0,zFirst);
|
||||||
|
|
||||||
mXRegionLast = (std::min)(OGRE_VOLUME_SIDE_LENGTH-1, xLast);
|
mXRegionLast = (std::min)(POLYVOX_VOLUME_SIDE_LENGTH-1, xLast);
|
||||||
mYRegionLast = (std::min)(OGRE_VOLUME_SIDE_LENGTH-1, yLast);
|
mYRegionLast = (std::min)(POLYVOX_VOLUME_SIDE_LENGTH-1, yLast);
|
||||||
mZRegionLast = (std::min)(OGRE_VOLUME_SIDE_LENGTH-1, zLast);*/
|
mZRegionLast = (std::min)(POLYVOX_VOLUME_SIDE_LENGTH-1, zLast);*/
|
||||||
|
|
||||||
mXRegionFirstBlock = mXRegionFirst >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mXRegionFirstBlock = mXRegionFirst >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mYRegionFirstBlock = mYRegionFirst >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mYRegionFirstBlock = mYRegionFirst >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mZRegionFirstBlock = mZRegionFirst >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mZRegionFirstBlock = mZRegionFirst >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
|
|
||||||
mXRegionLastBlock = mXRegionLast >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mXRegionLastBlock = mXRegionLast >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mYRegionLastBlock = mYRegionLast >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mYRegionLastBlock = mYRegionLast >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
mZRegionLastBlock = mZRegionLast >> OGRE_BLOCK_SIDE_LENGTH_POWER;
|
mZRegionLastBlock = mZRegionLast >> POLYVOX_BLOCK_SIDE_LENGTH_POWER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VolumeIterator::moveForwardInRegion(void)
|
void VolumeIterator::moveForwardInRegion(void)
|
||||||
@ -364,34 +364,34 @@ namespace PolyVox
|
|||||||
mXPosInBlock++;
|
mXPosInBlock++;
|
||||||
mCurrentVoxel++;
|
mCurrentVoxel++;
|
||||||
mXPosInVolume++;
|
mXPosInVolume++;
|
||||||
if((mXPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mXPosInVolume > mXRegionLast))
|
if((mXPosInBlock == POLYVOX_BLOCK_SIDE_LENGTH) || (mXPosInVolume > mXRegionLast))
|
||||||
{
|
{
|
||||||
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * OGRE_BLOCK_SIDE_LENGTH));
|
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * POLYVOX_BLOCK_SIDE_LENGTH));
|
||||||
mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mXPosInBlock = mXPosInVolume - (mXBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mVoxelIndexInBlock = mXPosInBlock +
|
mVoxelIndexInBlock = mXPosInBlock +
|
||||||
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
|
mYPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
mZPosInBlock * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH;
|
mZPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
||||||
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
||||||
|
|
||||||
mYPosInBlock++;
|
mYPosInBlock++;
|
||||||
mYPosInVolume++;
|
mYPosInVolume++;
|
||||||
mCurrentVoxel += OGRE_BLOCK_SIDE_LENGTH;
|
mCurrentVoxel += POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
if((mYPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mYPosInVolume > mYRegionLast))
|
if((mYPosInBlock == POLYVOX_BLOCK_SIDE_LENGTH) || (mYPosInVolume > mYRegionLast))
|
||||||
{
|
{
|
||||||
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * OGRE_BLOCK_SIDE_LENGTH));
|
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * POLYVOX_BLOCK_SIDE_LENGTH));
|
||||||
mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mYPosInBlock = mYPosInVolume - (mYBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mVoxelIndexInBlock = mXPosInBlock +
|
mVoxelIndexInBlock = mXPosInBlock +
|
||||||
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
|
mYPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
mZPosInBlock * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH;
|
mZPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
||||||
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
||||||
|
|
||||||
mZPosInBlock++;
|
mZPosInBlock++;
|
||||||
mZPosInVolume++;
|
mZPosInVolume++;
|
||||||
mCurrentVoxel += OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH;
|
mCurrentVoxel += POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
|
|
||||||
if((mZPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mZPosInVolume > mZRegionLast))
|
if((mZPosInBlock == POLYVOX_BLOCK_SIDE_LENGTH) || (mZPosInVolume > mZRegionLast))
|
||||||
{
|
{
|
||||||
//At this point we've left the current block. Find a new one...
|
//At this point we've left the current block. Find a new one...
|
||||||
|
|
||||||
@ -401,20 +401,20 @@ namespace PolyVox
|
|||||||
{
|
{
|
||||||
mXBlock = mXRegionFirstBlock;
|
mXBlock = mXRegionFirstBlock;
|
||||||
mBlockIndexInVolume = mXBlock +
|
mBlockIndexInVolume = mXBlock +
|
||||||
mYBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
mYBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
mZBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
mZBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
||||||
|
|
||||||
++mYBlock;
|
++mYBlock;
|
||||||
mBlockIndexInVolume += OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
mBlockIndexInVolume += POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
||||||
if(mYBlock > mYRegionLastBlock)
|
if(mYBlock > mYRegionLastBlock)
|
||||||
{
|
{
|
||||||
mYBlock = mYRegionFirstBlock;
|
mYBlock = mYRegionFirstBlock;
|
||||||
mBlockIndexInVolume = mXBlock +
|
mBlockIndexInVolume = mXBlock +
|
||||||
mYBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
mYBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS +
|
||||||
mZBlock * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
mZBlock * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
||||||
|
|
||||||
++mZBlock;
|
++mZBlock;
|
||||||
mBlockIndexInVolume += OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS * OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
mBlockIndexInVolume += POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS * POLYVOX_VOLUME_SIDE_LENGTH_IN_BLOCKS;
|
||||||
if(mZBlock > mZRegionLastBlock)
|
if(mZBlock > mZRegionLastBlock)
|
||||||
{
|
{
|
||||||
mIsValidForRegion = false;
|
mIsValidForRegion = false;
|
||||||
@ -426,17 +426,17 @@ namespace PolyVox
|
|||||||
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
|
||||||
//mCurrentBlock = mVolume->mBlocks[mBlockIndexInVolume];
|
//mCurrentBlock = mVolume->mBlocks[mBlockIndexInVolume];
|
||||||
|
|
||||||
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * OGRE_BLOCK_SIDE_LENGTH));
|
mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * POLYVOX_BLOCK_SIDE_LENGTH));
|
||||||
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * OGRE_BLOCK_SIDE_LENGTH));
|
mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * POLYVOX_BLOCK_SIDE_LENGTH));
|
||||||
mZPosInVolume = (std::max)(mZRegionFirst,uint16_t(mZBlock * OGRE_BLOCK_SIDE_LENGTH));
|
mZPosInVolume = (std::max)(mZRegionFirst,uint16_t(mZBlock * POLYVOX_BLOCK_SIDE_LENGTH));
|
||||||
|
|
||||||
mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mXPosInBlock = mXPosInVolume - (mXBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mYPosInBlock = mYPosInVolume - (mYBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
mZPosInBlock = mZPosInVolume - (mZBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
|
mZPosInBlock = mZPosInVolume - (mZBlock << POLYVOX_BLOCK_SIDE_LENGTH_POWER);
|
||||||
|
|
||||||
mVoxelIndexInBlock = mXPosInBlock +
|
mVoxelIndexInBlock = mXPosInBlock +
|
||||||
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
|
mYPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH +
|
||||||
mZPosInBlock * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH;
|
mZPosInBlock * POLYVOX_BLOCK_SIDE_LENGTH * POLYVOX_BLOCK_SIDE_LENGTH;
|
||||||
|
|
||||||
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
|
||||||
}
|
}
|
||||||
@ -451,43 +451,43 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1ny1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 - POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1ny0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 - POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1ny1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 - POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx0py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx0py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx0py0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx0py0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1);
|
return *(mCurrentVoxel - 1);
|
||||||
}
|
}
|
||||||
@ -496,36 +496,36 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx0py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx0py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 + POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1py0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1py0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 + POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1nx1py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1nx1py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - 1 + OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - 1 + POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
@ -534,36 +534,36 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1ny1nz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1ny0pz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1ny1pz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px0py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel0px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
@ -575,36 +575,36 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px0py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel0px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1py0pz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel0px1py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel0px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
@ -613,43 +613,43 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1ny1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1ny1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 - POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1ny0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1ny0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 - POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1ny1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1ny1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 - POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px0py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1px0py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px0py0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px0py0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1);
|
return *(mCurrentVoxel + 1);
|
||||||
}
|
}
|
||||||
@ -658,36 +658,36 @@ namespace PolyVox
|
|||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px0py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px0py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1py1nz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1py1nz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != 0))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + OGRE_BLOCK_SIDE_LENGTH - OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 + POLYVOX_BLOCK_SIDE_LENGTH - POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume-1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1py0pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1py0pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 + POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t VolumeIterator::peekVoxel1px1py1pz(void) const
|
uint8_t VolumeIterator::peekVoxel1px1py1pz(void) const
|
||||||
{
|
{
|
||||||
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
|
if((mXPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%POLYVOX_BLOCK_SIDE_LENGTH != POLYVOX_BLOCK_SIDE_LENGTH-1))
|
||||||
{
|
{
|
||||||
return *(mCurrentVoxel + 1 + OGRE_BLOCK_SIDE_LENGTH + OGRE_BLOCK_SIDE_LENGTH*OGRE_BLOCK_SIDE_LENGTH);
|
return *(mCurrentVoxel + 1 + POLYVOX_BLOCK_SIDE_LENGTH + POLYVOX_BLOCK_SIDE_LENGTH*POLYVOX_BLOCK_SIDE_LENGTH);
|
||||||
}
|
}
|
||||||
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume+1);
|
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume+1);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user