Removed OgrePrerequisites.h from main library.

This commit is contained in:
David Williams 2008-02-07 21:33:11 +00:00
parent 8fbcd99ef8
commit f29af2f8d4
16 changed files with 345 additions and 330 deletions

View File

@ -19,7 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __Block_H__ #ifndef __Block_H__
#define __Block_H__ #define __Block_H__
#include "OgrePrerequisites.h" #include "boost/cstdint.hpp"
#include "Constants.h" #include "Constants.h"
@ -43,13 +43,13 @@ namespace Ogre
//bool isHomogeneous(void); //bool isHomogeneous(void);
uchar getVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition) const; boost::uint8_t getVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition) const;
void setVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, const uchar value); void setVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition, const boost::uint8_t value);
//void fillWithValue(const uchar value); //void fillWithValue(const uint8_t value);
private: private:
uchar mData[OGRE_NO_OF_VOXELS_IN_BLOCK]; boost::uint8_t mData[OGRE_NO_OF_VOXELS_IN_BLOCK];
}; };
} }

View File

@ -1,25 +1,27 @@
#ifndef __Constants_H__ #ifndef __Constants_H__
#define __Constants_H__ #define __Constants_H__
#include "boost/cstdint.hpp"
namespace Ogre namespace Ogre
{ {
//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 unsigned int OGRE_BLOCK_SIDE_LENGTH_POWER = 5; const boost::uint32_t OGRE_BLOCK_SIDE_LENGTH_POWER = 5;
const unsigned int OGRE_BLOCK_SIDE_LENGTH = (0x0001 << OGRE_BLOCK_SIDE_LENGTH_POWER); const boost::uint32_t OGRE_BLOCK_SIDE_LENGTH = (0x0001 << OGRE_BLOCK_SIDE_LENGTH_POWER);
const unsigned int OGRE_NO_OF_VOXELS_IN_BLOCK = (OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH); const boost::uint32_t OGRE_NO_OF_VOXELS_IN_BLOCK = (OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH * OGRE_BLOCK_SIDE_LENGTH);
const unsigned int OGRE_VOLUME_SIDE_LENGTH_POWER = 8; const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_POWER = 8;
const unsigned int OGRE_VOLUME_SIDE_LENGTH = (0x0001 << OGRE_VOLUME_SIDE_LENGTH_POWER); const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH = (0x0001 << OGRE_VOLUME_SIDE_LENGTH_POWER);
const unsigned int OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_BLOCK_SIDE_LENGTH_POWER); const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_IN_BLOCKS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_BLOCK_SIDE_LENGTH_POWER);
const unsigned int 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 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 unsigned int OGRE_NO_OF_VOXELS_IN_VOLUME = (OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH); const boost::uint32_t OGRE_NO_OF_VOXELS_IN_VOLUME = (OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH * OGRE_VOLUME_SIDE_LENGTH);
const unsigned int OGRE_REGION_SIDE_LENGTH_POWER = 4; const boost::uint32_t OGRE_REGION_SIDE_LENGTH_POWER = 4;
const unsigned int OGRE_REGION_SIDE_LENGTH = (0x0001 << OGRE_REGION_SIDE_LENGTH_POWER); const boost::uint32_t OGRE_REGION_SIDE_LENGTH = (0x0001 << OGRE_REGION_SIDE_LENGTH_POWER);
const unsigned int OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_REGION_SIDE_LENGTH_POWER); const boost::uint32_t OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS = (OGRE_VOLUME_SIDE_LENGTH >> OGRE_REGION_SIDE_LENGTH_POWER);
const unsigned int 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 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 unsigned long OGRE_MAX_VOXELS_TO_BURN_PER_FRAME = 1000; const boost::uint32_t OGRE_MAX_VOXELS_TO_BURN_PER_FRAME = 1000;
} }
#endif #endif

View File

@ -1,6 +1,8 @@
#ifndef __IndexedSurfacePatch_H__ #ifndef __IndexedSurfacePatch_H__
#define __IndexedSurfacePatch_H__ #define __IndexedSurfacePatch_H__
#include "boost/cstdint.hpp"
//#include <set> //#include <set>
//#include <list> //#include <list>
@ -21,10 +23,10 @@ namespace Ogre
~IndexedSurfacePatch(); ~IndexedSurfacePatch();
void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2); void addTriangle(const SurfaceVertex& v0,const SurfaceVertex& v1,const SurfaceVertex& v2);
void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<ushort>& vecIndices); void fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<boost::uint16_t>& vecIndices);
//private: //private:
std::vector<uint> 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[OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1][OGRE_REGION_SIDE_LENGTH*2+1];

View File

@ -19,7 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __IntegralVector3_H__ #ifndef __IntegralVector3_H__
#define __IntegralVector3_H__ #define __IntegralVector3_H__
#include <OgrePrerequisites.h> #include "boost/cstdint.hpp"
#include <OgreVector3.h> #include <OgreVector3.h>
namespace Ogre namespace Ogre
@ -104,10 +105,10 @@ namespace Ogre
typedef IntegralVector3<int> IntVector3; typedef IntegralVector3<int> IntVector3;
typedef IntegralVector3<long> LongVector3; typedef IntegralVector3<long> LongVector3;
typedef IntegralVector3<uchar> UCharVector3; typedef IntegralVector3<boost::uint8_t> UCharVector3;
typedef IntegralVector3<ushort> UShortVector3; typedef IntegralVector3<boost::uint16_t> UShortVector3;
typedef IntegralVector3<uint> UIntVector3; typedef IntegralVector3<boost::uint16_t> UIntVector3;
typedef IntegralVector3<ulong> ULongVector3; typedef IntegralVector3<boost::uint32_t> ULongVector3;
} }
#endif #endif

View File

@ -19,7 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __PolyVoxSceneManager_H__ #ifndef __PolyVoxSceneManager_H__
#define __PolyVoxSceneManager_H__ #define __PolyVoxSceneManager_H__
#include "OgrePrerequisites.h" #include "boost/cstdint.hpp"
#include "OgreSceneManager.h" #include "OgreSceneManager.h"
#include "Constants.h" #include "Constants.h"
@ -51,9 +52,9 @@ namespace Ogre
~PolyVoxSceneManager(); ~PolyVoxSceneManager();
//Getters //Getters
uchar getMaterialIndexAt(uint uX, uint uY, uint uZ); boost::uint8_t getMaterialIndexAt(boost::uint16_t uX, boost::uint16_t uY, boost::uint16_t uZ);
const String& getTypeName(void) const; const String& getTypeName(void) const;
uint getSideLength(void); boost::uint16_t getSideLength(void);
//Setters //Setters
@ -63,14 +64,14 @@ namespace Ogre
std::list<RegionGeometry> getChangedRegionGeometry(void); std::list<RegionGeometry> getChangedRegionGeometry(void);
void setAllUpToDateFlagsTo(bool newUpToDateValue); void setAllUpToDateFlagsTo(bool newUpToDateValue);
void createSphereAt(Vector3 centre, Real radius, uchar value, bool painting); void createSphereAt(Vector3 centre, Real radius, boost::uint8_t value, bool painting);
void generateLevelVolume(void); void generateLevelVolume(void);
void generateMeshDataForRegion(uint regionX, uint regionY, uint regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch) const; void generateMeshDataForRegion(boost::uint16_t regionX,boost:: uint16_t regionY, boost::uint16_t regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch) const;
bool containsPoint(Vector3 pos, float boundary); bool containsPoint(Vector3 pos, float boundary);
bool containsPoint(IntVector3 pos, uint boundary); bool containsPoint(IntVector3 pos, boost::uint16_t boundary);
@ -83,14 +84,14 @@ namespace Ogre
Vector3 computeNormal(const Vector3& position, NormalGenerationMethod normalGenerationMethod) const; Vector3 computeNormal(const Vector3& position, NormalGenerationMethod normalGenerationMethod) const;
public: public:
void markVoxelChanged(uint x, uint y, uint z); void markVoxelChanged(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z);
void markRegionChanged(uint firstX, uint firstY, uint firstZ, uint lastX, uint lastY, uint lastZ); void markRegionChanged(boost::uint16_t firstX, boost::uint16_t firstY, boost::uint16_t firstZ, boost::uint16_t lastX, boost::uint16_t lastY, boost::uint16_t lastZ);
static uint fileNo; static boost::uint16_t fileNo;
bool useNormalSmoothing; bool useNormalSmoothing;
uint normalSmoothingFilterSize; boost::uint16_t normalSmoothingFilterSize;
NormalGenerationMethod m_normalGenerationMethod; NormalGenerationMethod m_normalGenerationMethod;

View File

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SurfaceEdge_H__ #ifndef __SurfaceEdge_H__
#define __SurfaceEdge_H__ #define __SurfaceEdge_H__
#include "OgrePrerequisites.h"
#include "SurfaceTypes.h" #include "SurfaceTypes.h"
namespace Ogre namespace Ogre

View File

@ -20,7 +20,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __SurfaceTriangle_H__ #ifndef __SurfaceTriangle_H__
#define __SurfaceTriangle_H__ #define __SurfaceTriangle_H__
#include "OgrePrerequisites.h"
#include "SurfaceTypes.h" #include "SurfaceTypes.h"
namespace Ogre namespace Ogre

View File

@ -22,7 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "TypeDef.h" #include "TypeDef.h"
#include "OgrePrerequisites.h"
#include "OgreVector3.h" #include "OgreVector3.h"
#include "IntegralVector3.h" #include "IntegralVector3.h"

View File

@ -19,7 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __Volume_H__ #ifndef __Volume_H__
#define __Volume_H__ #define __Volume_H__
#include "OgrePrerequisites.h" #include "boost/cstdint.hpp"
#include "Block.h" #include "Block.h"
#include "Constants.h" #include "Constants.h"
@ -41,15 +42,15 @@ namespace Ogre
Volume& operator=(const Volume& rhs); Volume& operator=(const Volume& rhs);
Block* getBlock(uint index); Block* getBlock(boost::uint16_t index);
bool containsPoint(Vector3 pos, float boundary); bool containsPoint(Vector3 pos, float boundary);
bool containsPoint(IntVector3 pos, uint boundary); bool containsPoint(IntVector3 pos, boost::uint16_t boundary);
bool loadFromFile(const std::string& sFilename); bool loadFromFile(const std::string& sFilename);
bool saveToFile(const std::string& sFilename); bool saveToFile(const std::string& sFilename);
void regionGrow(uint xStart, uint yStart, uint zStart, uchar value); void regionGrow(boost::uint16_t xStart, boost::uint16_t yStart, boost::uint16_t zStart, boost::uint8_t value);
void tidy(void); void tidy(void);
private: private:

View File

@ -19,7 +19,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#ifndef __VolumeIterator_H__ #ifndef __VolumeIterator_H__
#define __VolumeIterator_H__ #define __VolumeIterator_H__
#include "OgrePrerequisites.h" #include "boost/cstdint.hpp"
#include "TypeDef.h" #include "TypeDef.h"
@ -33,96 +34,96 @@ namespace Ogre
VolumeIterator(Volume& volume); VolumeIterator(Volume& volume);
~VolumeIterator(); ~VolumeIterator();
void setVoxel(uchar value); void setVoxel(boost::uint8_t value);
uchar getVoxel(void); boost::uint8_t getVoxel(void);
uchar getVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition) const; boost::uint8_t getVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition) const;
void setVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, const uchar value); void setVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition, const boost::uint8_t value);
float getAveragedVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, uint size) const; float getAveragedVoxelAt(const boost::uint16_t xPosition, const boost::uint16_t yPosition, const boost::uint16_t zPosition, boost::uint16_t size) const;
//FIXME - this shouldn't return float vector //FIXME - this shouldn't return float vector
Vector3 getCentralDifferenceGradient(void) const; Vector3 getCentralDifferenceGradient(void) const;
Vector3 getAveragedCentralDifferenceGradient(void) const; Vector3 getAveragedCentralDifferenceGradient(void) const;
Vector3 getSobelGradient(void) const; Vector3 getSobelGradient(void) const;
uint getPosX(void); boost::uint16_t getPosX(void);
uint getPosY(void); boost::uint16_t getPosY(void);
uint getPosZ(void); boost::uint16_t getPosZ(void);
void setPosition(uint xPos, uint yPos, uint zPos); void setPosition(boost::uint16_t xPos, boost::uint16_t yPos, boost::uint16_t zPos);
void setValidRegion(uint xFirst, uint yFirst, uint zFirst, uint xLast, uint yLast, uint zLast); void setValidRegion(boost::uint16_t xFirst, boost::uint16_t yFirst, boost::uint16_t zFirst, boost::uint16_t xLast, boost::uint16_t yLast, boost::uint16_t zLast);
void moveForwardInRegion(void); void moveForwardInRegion(void);
bool isValidForRegion(void); bool isValidForRegion(void);
uchar peekVoxel1nx1ny1nz(void) const; boost::uint8_t peekVoxel1nx1ny1nz(void) const;
uchar peekVoxel1nx1ny0pz(void) const; boost::uint8_t peekVoxel1nx1ny0pz(void) const;
uchar peekVoxel1nx1ny1pz(void) const; boost::uint8_t peekVoxel1nx1ny1pz(void) const;
uchar peekVoxel1nx0py1nz(void) const; boost::uint8_t peekVoxel1nx0py1nz(void) const;
uchar peekVoxel1nx0py0pz(void) const; boost::uint8_t peekVoxel1nx0py0pz(void) const;
uchar peekVoxel1nx0py1pz(void) const; boost::uint8_t peekVoxel1nx0py1pz(void) const;
uchar peekVoxel1nx1py1nz(void) const; boost::uint8_t peekVoxel1nx1py1nz(void) const;
uchar peekVoxel1nx1py0pz(void) const; boost::uint8_t peekVoxel1nx1py0pz(void) const;
uchar peekVoxel1nx1py1pz(void) const; boost::uint8_t peekVoxel1nx1py1pz(void) const;
uchar peekVoxel0px1ny1nz(void) const; boost::uint8_t peekVoxel0px1ny1nz(void) const;
uchar peekVoxel0px1ny0pz(void) const; boost::uint8_t peekVoxel0px1ny0pz(void) const;
uchar peekVoxel0px1ny1pz(void) const; boost::uint8_t peekVoxel0px1ny1pz(void) const;
uchar peekVoxel0px0py1nz(void) const; boost::uint8_t peekVoxel0px0py1nz(void) const;
uchar peekVoxel0px0py0pz(void) const; boost::uint8_t peekVoxel0px0py0pz(void) const;
uchar peekVoxel0px0py1pz(void) const; boost::uint8_t peekVoxel0px0py1pz(void) const;
uchar peekVoxel0px1py1nz(void) const; boost::uint8_t peekVoxel0px1py1nz(void) const;
uchar peekVoxel0px1py0pz(void) const; boost::uint8_t peekVoxel0px1py0pz(void) const;
uchar peekVoxel0px1py1pz(void) const; boost::uint8_t peekVoxel0px1py1pz(void) const;
uchar peekVoxel1px1ny1nz(void) const; boost::uint8_t peekVoxel1px1ny1nz(void) const;
uchar peekVoxel1px1ny0pz(void) const; boost::uint8_t peekVoxel1px1ny0pz(void) const;
uchar peekVoxel1px1ny1pz(void) const; boost::uint8_t peekVoxel1px1ny1pz(void) const;
uchar peekVoxel1px0py1nz(void) const; boost::uint8_t peekVoxel1px0py1nz(void) const;
uchar peekVoxel1px0py0pz(void) const; boost::uint8_t peekVoxel1px0py0pz(void) const;
uchar peekVoxel1px0py1pz(void) const; boost::uint8_t peekVoxel1px0py1pz(void) const;
uchar peekVoxel1px1py1nz(void) const; boost::uint8_t peekVoxel1px1py1nz(void) const;
uchar peekVoxel1px1py0pz(void) const; boost::uint8_t peekVoxel1px1py0pz(void) const;
uchar peekVoxel1px1py1pz(void) const; boost::uint8_t peekVoxel1px1py1pz(void) const;
private: private:
//The current volume //The current volume
Volume& mVolume; Volume& mVolume;
//The current position in the volume //The current position in the volume
uint mXPosInVolume; boost::uint16_t mXPosInVolume;
uint mYPosInVolume; boost::uint16_t mYPosInVolume;
uint mZPosInVolume; boost::uint16_t mZPosInVolume;
//The position of the current block //The position of the current block
uint mXBlock; boost::uint16_t mXBlock;
uint mYBlock; boost::uint16_t mYBlock;
uint mZBlock; boost::uint16_t mZBlock;
//The offset into the current block //The offset into the current block
uint mXPosInBlock; boost::uint16_t mXPosInBlock;
uint mYPosInBlock; boost::uint16_t mYPosInBlock;
uint mZPosInBlock; boost::uint16_t mZPosInBlock;
//Other current position information //Other current position information
uchar* mCurrentVoxel; boost::uint8_t* mCurrentVoxel;
ulong mBlockIndexInVolume; boost::uint32_t mBlockIndexInVolume;
ulong mVoxelIndexInBlock; boost::uint32_t mVoxelIndexInBlock;
uint mXRegionFirst; boost::uint16_t mXRegionFirst;
uint mYRegionFirst; boost::uint16_t mYRegionFirst;
uint mZRegionFirst; boost::uint16_t mZRegionFirst;
uint mXRegionLast; boost::uint16_t mXRegionLast;
uint mYRegionLast; boost::uint16_t mYRegionLast;
uint mZRegionLast; boost::uint16_t mZRegionLast;
uint mXRegionFirstBlock; boost::uint16_t mXRegionFirstBlock;
uint mYRegionFirstBlock; boost::uint16_t mYRegionFirstBlock;
uint mZRegionFirstBlock; boost::uint16_t mZRegionFirstBlock;
uint mXRegionLastBlock; boost::uint16_t mXRegionLastBlock;
uint mYRegionLastBlock; boost::uint16_t mYRegionLastBlock;
uint mZRegionLastBlock; boost::uint16_t mZRegionLastBlock;
bool mIsValidForRegion; bool mIsValidForRegion;
}; };

View File

@ -23,6 +23,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "Block.h" #include "Block.h"
using namespace boost;
namespace Ogre { namespace Ogre {
Block::Block() Block::Block()
@ -50,7 +52,7 @@ namespace Ogre {
return *this; return *this;
} }
uchar Block::getVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition) const uint8_t Block::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
{ {
return mData return mData
[ [
@ -60,7 +62,7 @@ namespace Ogre {
]; ];
} }
void Block::setVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, const uchar value) void Block::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
{ {
mData mData
[ [
@ -70,15 +72,15 @@ namespace Ogre {
] = value; ] = value;
} }
/*void Block::fillWithValue(const uchar value) /*void Block::fillWithValue(const uint8_t value)
{ {
memset(mData,value,OGRE_NO_OF_VOXELS_IN_BLOCK); memset(mData,value,OGRE_NO_OF_VOXELS_IN_BLOCK);
}*/ }*/
/*bool Block::isHomogeneous(void) /*bool Block::isHomogeneous(void)
{ {
uchar uFirstVoxel = mData[0]; uint8_t uFirstVoxel = mData[0];
for(ulong ct = 1; ct < OGRE_NO_OF_VOXELS_IN_BLOCK; ++ct) for(uint32_t ct = 1; ct < OGRE_NO_OF_VOXELS_IN_BLOCK; ++ct)
{ {
if(mData[ct] != uFirstVoxel) if(mData[ct] != uFirstVoxel)
{ {

View File

@ -1,5 +1,7 @@
#include "IndexedSurfacePatch.h" #include "IndexedSurfacePatch.h"
using namespace boost;
namespace Ogre namespace Ogre
{ {
long int IndexedSurfacePatch::noOfVerticesSubmitted = 0; long int IndexedSurfacePatch::noOfVerticesSubmitted = 0;
@ -77,7 +79,7 @@ namespace Ogre
} }
} }
void IndexedSurfacePatch::fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<ushort>& vecIndices) void IndexedSurfacePatch::fillVertexAndIndexData(std::vector<SurfaceVertex>& vecVertices, std::vector<uint16_t>& vecIndices)
{ {
vecVertices.resize(m_vecVertices.size()); vecVertices.resize(m_vecVertices.size());
std::copy(m_vecVertices.begin(), m_vecVertices.end(), vecVertices.begin()); std::copy(m_vecVertices.begin(), m_vecVertices.end(), vecVertices.begin());

View File

@ -29,6 +29,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <list> #include <list>
using namespace boost;
namespace Ogre namespace Ogre
{ {
@ -54,13 +56,13 @@ namespace Ogre
std::list<RegionGeometry> listChangedRegionGeometry; std::list<RegionGeometry> listChangedRegionGeometry;
//Regenerate meshes. //Regenerate meshes.
for(uint regionZ = 0; regionZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ) for(uint16_t regionZ = 0; regionZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionZ)
{ {
//LogManager::getSingleton().logMessage("regionZ = " + StringConverter::toString(regionZ)); //LogManager::getSingleton().logMessage("regionZ = " + StringConverter::toString(regionZ));
for(uint regionY = 0; regionY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY) for(uint16_t regionY = 0; regionY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionY)
{ {
//LogManager::getSingleton().logMessage("regionY = " + StringConverter::toString(regionY)); //LogManager::getSingleton().logMessage("regionY = " + StringConverter::toString(regionY));
for(uint regionX = 0; regionX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX) for(uint16_t regionX = 0; regionX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++regionX)
{ {
//LogManager::getSingleton().logMessage("regionX = " + StringConverter::toString(regionX)); //LogManager::getSingleton().logMessage("regionX = " + StringConverter::toString(regionX));
if(surfaceUpToDate[regionX][regionY][regionZ] == false) if(surfaceUpToDate[regionX][regionY][regionZ] == false)
@ -88,11 +90,11 @@ namespace Ogre
void PolyVoxSceneManager::setAllUpToDateFlagsTo(bool newUpToDateValue) void PolyVoxSceneManager::setAllUpToDateFlagsTo(bool newUpToDateValue)
{ {
for(uint blockZ = 0; blockZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockZ) for(uint16_t blockZ = 0; blockZ < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockZ)
{ {
for(uint blockY = 0; blockY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockY) for(uint16_t blockY = 0; blockY < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockY)
{ {
for(uint blockX = 0; blockX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockX) for(uint16_t blockX = 0; blockX < OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS; ++blockX)
{ {
surfaceUpToDate[blockX][blockY][blockZ] = newUpToDateValue; surfaceUpToDate[blockX][blockY][blockZ] = newUpToDateValue;
} }
@ -100,7 +102,7 @@ namespace Ogre
} }
} }
void PolyVoxSceneManager::createSphereAt(Vector3 centre, Real radius, uchar value, bool painting) void PolyVoxSceneManager::createSphereAt(Vector3 centre, Real radius, uint8_t value, bool painting)
{ {
int firstX = static_cast<int>(std::floor(centre.x - radius)); int firstX = static_cast<int>(std::floor(centre.x - radius));
int firstY = static_cast<int>(std::floor(centre.y - radius)); int firstY = static_cast<int>(std::floor(centre.y - radius));
@ -154,11 +156,11 @@ namespace Ogre
//volumeData = VolumePtr(new Volume); //volumeData = VolumePtr(new Volume);
volumeData = new Volume(); volumeData = new Volume();
VolumeIterator volIter(*volumeData); VolumeIterator volIter(*volumeData);
for(uint z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z) for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
{ {
for(uint y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y) for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
{ {
for(uint x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x) for(uint16_t x = 0; x < OGRE_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);
@ -168,11 +170,11 @@ namespace Ogre
} }
} }
for(uint z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z) for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
{ {
for(uint y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y) for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
{ {
for(uint x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x) for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
{ {
if( if(
(z<62)|| (z<62)||
@ -193,26 +195,26 @@ namespace Ogre
Vector3 centre(128,128,128); Vector3 centre(128,128,128);
Vector3 v3dSize(192,96,128); Vector3 v3dSize(192,96,128);
uint uHalfX = static_cast<uint>(v3dSize.x / 2); uint16_t uHalfX = static_cast<uint16_t>(v3dSize.x / 2);
uint uHalfY = static_cast<uint>(v3dSize.y / 2); uint16_t uHalfY = static_cast<uint16_t>(v3dSize.y / 2);
uint uHalfZ = static_cast<uint>(v3dSize.z / 2); uint16_t uHalfZ = static_cast<uint16_t>(v3dSize.z / 2);
for(uint z = static_cast<uint>(centre.z) - uHalfZ; z < static_cast<uint>(centre.z) + uHalfZ; z++) for(uint16_t z = static_cast<uint16_t>(centre.z) - uHalfZ; z < static_cast<uint16_t>(centre.z) + uHalfZ; z++)
{ {
for(uint y = static_cast<uint>(centre.y) - uHalfY; y < static_cast<uint>(centre.y) + uHalfY; y++) for(uint16_t y = static_cast<uint16_t>(centre.y) - uHalfY; y < static_cast<uint16_t>(centre.y) + uHalfY; y++)
{ {
for(uint x = static_cast<uint>(centre.x) - uHalfX; x < static_cast<uint>(centre.x) + uHalfX; x++) for(uint16_t x = static_cast<uint16_t>(centre.x) - uHalfX; x < static_cast<uint16_t>(centre.x) + uHalfX; x++)
{ {
volIter.setVoxelAt(x,y,z,0); volIter.setVoxelAt(x,y,z,0);
} }
} }
} }
for(uint z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z) for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
{ {
for(uint y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y) for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
{ {
for(uint x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x) for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
{ {
if( if(
(x%64 < 8) && (x%64 < 8) &&
@ -232,24 +234,24 @@ namespace Ogre
} }
} }
void PolyVoxSceneManager::generateMeshDataForRegion(const uint regionX, const uint regionY, const uint regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch) const void PolyVoxSceneManager::generateMeshDataForRegion(const uint16_t regionX, const uint16_t regionY, const uint16_t regionZ, IndexedSurfacePatch* singleMaterialPatch, IndexedSurfacePatch* multiMaterialPatch) const
{ {
//IndexedSurfacePatch* surfacePatchResult = new IndexedSurfacePatch; //IndexedSurfacePatch* surfacePatchResult = new IndexedSurfacePatch;
//LogManager::getSingleton().logMessage("Generating Mesh Data"); //LogManager::getSingleton().logMessage("Generating Mesh Data");
//First and last voxels in the region //First and last voxels in the region
const uint firstX = regionX * OGRE_REGION_SIDE_LENGTH; const uint16_t firstX = regionX * OGRE_REGION_SIDE_LENGTH;
const uint firstY = regionY * OGRE_REGION_SIDE_LENGTH; const uint16_t firstY = regionY * OGRE_REGION_SIDE_LENGTH;
const uint firstZ = regionZ * OGRE_REGION_SIDE_LENGTH; const uint16_t firstZ = regionZ * OGRE_REGION_SIDE_LENGTH;
const uint lastX = (std::min)(firstX + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint>(OGRE_VOLUME_SIDE_LENGTH-2)); const uint16_t lastX = (std::min)(firstX + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint32_t>(OGRE_VOLUME_SIDE_LENGTH-2));
const uint lastY = (std::min)(firstY + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint>(OGRE_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 uint lastZ = (std::min)(firstZ + OGRE_REGION_SIDE_LENGTH-1,static_cast<uint>(OGRE_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));
//Offset from lower block corner //Offset from lower block corner
const UIntVector3 offset(firstX*2,firstY*2,firstZ*2); const UIntVector3 offset(firstX*2,firstY*2,firstZ*2);
UIntVector3 vertlist[12]; UIntVector3 vertlist[12];
uchar vertMaterials[12]; uint8_t vertMaterials[12];
VolumeIterator volIter(*volumeData); VolumeIterator volIter(*volumeData);
volIter.setValidRegion(firstX,firstY,firstZ,lastX,lastY,lastZ); volIter.setValidRegion(firstX,firstY,firstZ,lastX,lastY,lastZ);
@ -261,24 +263,24 @@ namespace Ogre
for(volIter.setPosition(firstX,firstY,firstZ);volIter.isValidForRegion();volIter.moveForwardInRegion()) for(volIter.setPosition(firstX,firstY,firstZ);volIter.isValidForRegion();volIter.moveForwardInRegion())
{ {
//Current position //Current position
const uint x = volIter.getPosX(); const uint16_t x = volIter.getPosX();
const uint y = volIter.getPosY(); const uint16_t y = volIter.getPosY();
const uint z = volIter.getPosZ(); const uint16_t z = volIter.getPosZ();
//LogManager::getSingleton().logMessage("x = " + StringConverter::toString(int(x)) + " y = " + StringConverter::toString(int(y)) + " z = " + StringConverter::toString(int(z))); //LogManager::getSingleton().logMessage("x = " + StringConverter::toString(int(x)) + " y = " + StringConverter::toString(int(y)) + " z = " + StringConverter::toString(int(z)));
//Voxels values //Voxels values
const uchar v000 = volIter.getVoxel(); const uint8_t v000 = volIter.getVoxel();
const uchar v100 = volIter.peekVoxel1px0py0pz(); const uint8_t v100 = volIter.peekVoxel1px0py0pz();
const uchar v010 = volIter.peekVoxel0px1py0pz(); const uint8_t v010 = volIter.peekVoxel0px1py0pz();
const uchar v110 = volIter.peekVoxel1px1py0pz(); const uint8_t v110 = volIter.peekVoxel1px1py0pz();
const uchar v001 = volIter.peekVoxel0px0py1pz(); const uint8_t v001 = volIter.peekVoxel0px0py1pz();
const uchar v101 = volIter.peekVoxel1px0py1pz(); const uint8_t v101 = volIter.peekVoxel1px0py1pz();
const uchar v011 = volIter.peekVoxel0px1py1pz(); const uint8_t v011 = volIter.peekVoxel0px1py1pz();
const uchar v111 = volIter.peekVoxel1px1py1pz(); const uint8_t v111 = volIter.peekVoxel1px1py1pz();
//Determine the index into the edge table which tells us which vertices are inside of the surface //Determine the index into the edge table which tells us which vertices are inside of the surface
uchar iCubeIndex = 0; uint8_t iCubeIndex = 0;
if (v000 == 0) iCubeIndex |= 1; if (v000 == 0) iCubeIndex |= 1;
if (v100 == 0) iCubeIndex |= 2; if (v100 == 0) iCubeIndex |= 2;
@ -388,9 +390,9 @@ namespace Ogre
const UIntVector3 vertex1 = vertlist[triTable[iCubeIndex][i+1]] - offset; const UIntVector3 vertex1 = vertlist[triTable[iCubeIndex][i+1]] - offset;
const UIntVector3 vertex2 = vertlist[triTable[iCubeIndex][i+2]] - offset; const UIntVector3 vertex2 = vertlist[triTable[iCubeIndex][i+2]] - offset;
const uchar material0 = vertMaterials[triTable[iCubeIndex][i ]]; const uint8_t material0 = vertMaterials[triTable[iCubeIndex][i ]];
const uchar material1 = vertMaterials[triTable[iCubeIndex][i+1]]; const uint8_t material1 = vertMaterials[triTable[iCubeIndex][i+1]];
const uchar material2 = vertMaterials[triTable[iCubeIndex][i+2]]; const uint8_t material2 = vertMaterials[triTable[iCubeIndex][i+2]];
//If all the materials are the same, we just need one triangle for that material with all the alphas set high. //If all the materials are the same, we just need one triangle for that material with all the alphas set high.
@ -508,7 +510,7 @@ namespace Ogre
//FIXME - can it happen that we have no vertices or triangles? Should exit early? //FIXME - can it happen that we have no vertices or triangles? Should exit early?
//for(std::map<uchar, IndexedSurfacePatch*>::iterator iterPatch = surfacePatchMapResult.begin(); iterPatch != surfacePatchMapResult.end(); ++iterPatch) //for(std::map<uint8_t, IndexedSurfacePatch*>::iterator iterPatch = surfacePatchMapResult.begin(); iterPatch != surfacePatchMapResult.end(); ++iterPatch)
{ {
std::vector<SurfaceVertex>::iterator iterSurfaceVertex = singleMaterialPatch->m_vecVertices.begin(); std::vector<SurfaceVertex>::iterator iterSurfaceVertex = singleMaterialPatch->m_vecVertices.begin();
@ -527,7 +529,7 @@ namespace Ogre
++iterSurfaceVertex; ++iterSurfaceVertex;
} }
uint noOfRemovedVertices = 0; uint16_t noOfRemovedVertices = 0;
//do //do
{ {
//noOfRemovedVertices = iterPatch->second.decimate(); //noOfRemovedVertices = iterPatch->second.decimate();
@ -549,28 +551,28 @@ namespace Ogre
const float posY = position.y; const float posY = position.y;
const float posZ = position.z; const float posZ = position.z;
const uint floorX = static_cast<uint>(posX); const uint16_t floorX = static_cast<uint16_t>(posX);
const uint floorY = static_cast<uint>(posY); const uint16_t floorY = static_cast<uint16_t>(posY);
const uint floorZ = static_cast<uint>(posZ); const uint16_t floorZ = static_cast<uint16_t>(posZ);
Vector3 result; Vector3 result;
if(normalGenerationMethod == SOBEL) if(normalGenerationMethod == SOBEL)
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ));
const Vector3 gradFloor = volIter.getSobelGradient(); const Vector3 gradFloor = volIter.getSobelGradient();
if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5 if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX+1.0),static_cast<uint>(posY),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX+1.0),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ));
} }
if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5 if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY+1.0),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY+1.0),static_cast<uint16_t>(posZ));
} }
if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5 if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY),static_cast<uint>(posZ+1.0)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ+1.0));
} }
const Vector3 gradCeil = volIter.getSobelGradient(); const Vector3 gradCeil = volIter.getSobelGradient();
result = ((gradFloor + gradCeil) * -1.0); result = ((gradFloor + gradCeil) * -1.0);
@ -582,19 +584,19 @@ namespace Ogre
} }
if(normalGenerationMethod == CENTRAL_DIFFERENCE) if(normalGenerationMethod == CENTRAL_DIFFERENCE)
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ));
const Vector3 gradFloor = volIter.getCentralDifferenceGradient(); const Vector3 gradFloor = volIter.getCentralDifferenceGradient();
if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5 if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX+1.0),static_cast<uint>(posY),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX+1.0),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ));
} }
if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5 if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY+1.0),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY+1.0),static_cast<uint16_t>(posZ));
} }
if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5 if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY),static_cast<uint>(posZ+1.0)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ+1.0));
} }
const Vector3 gradCeil = volIter.getCentralDifferenceGradient(); const Vector3 gradCeil = volIter.getCentralDifferenceGradient();
result = ((gradFloor + gradCeil) * -1.0); result = ((gradFloor + gradCeil) * -1.0);
@ -606,28 +608,28 @@ namespace Ogre
} }
if(normalGenerationMethod == SIMPLE) if(normalGenerationMethod == SIMPLE)
{ {
volIter.setPosition(static_cast<uint>(posX),static_cast<uint>(posY),static_cast<uint>(posZ)); volIter.setPosition(static_cast<uint16_t>(posX),static_cast<uint16_t>(posY),static_cast<uint16_t>(posZ));
const uchar uFloor = volIter.getVoxel() > 0 ? 1 : 0; const uint8_t uFloor = volIter.getVoxel() > 0 ? 1 : 0;
if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5 if((posX - floorX) > 0.25) //The result should be 0.0 or 0.5
{ {
uchar uCeil = volIter.peekVoxel1px0py0pz() > 0 ? 1 : 0; uint8_t uCeil = volIter.peekVoxel1px0py0pz() > 0 ? 1 : 0;
result = Vector3(uFloor - uCeil,0.0,0.0); result = Vector3(uFloor - uCeil,0.0,0.0);
} }
else if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5 else if((posY - floorY) > 0.25) //The result should be 0.0 or 0.5
{ {
uchar uCeil = volIter.peekVoxel0px1py0pz() > 0 ? 1 : 0; uint8_t uCeil = volIter.peekVoxel0px1py0pz() > 0 ? 1 : 0;
result = Vector3(0.0,uFloor - uCeil,0.0); result = Vector3(0.0,uFloor - uCeil,0.0);
} }
else if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5 else if((posZ - floorZ) > 0.25) //The result should be 0.0 or 0.5
{ {
uchar uCeil = volIter.peekVoxel0px0py1pz() > 0 ? 1 : 0; uint8_t uCeil = volIter.peekVoxel0px0py1pz() > 0 ? 1 : 0;
result = Vector3(0.0, 0.0,uFloor - uCeil); result = Vector3(0.0, 0.0,uFloor - uCeil);
} }
} }
return result; return result;
} }
void PolyVoxSceneManager::markVoxelChanged(uint x, uint y, uint 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 % OGRE_REGION_SIDE_LENGTH != 0) &&
@ -641,23 +643,23 @@ namespace Ogre
} }
else //Mark surrounding block as well else //Mark surrounding block as well
{ {
const uint regionX = x >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t regionX = x >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint regionY = y >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t regionY = y >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint regionZ = z >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t regionZ = z >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint minRegionX = (std::max)(uint(0),regionX-1); const uint16_t minRegionX = (std::max)(uint16_t(0),uint16_t(regionX-1));
const uint minRegionY = (std::max)(uint(0),regionY-1); const uint16_t minRegionY = (std::max)(uint16_t(0),uint16_t(regionY-1));
const uint minRegionZ = (std::max)(uint(0),regionZ-1); const uint16_t minRegionZ = (std::max)(uint16_t(0),uint16_t(regionZ-1));
const uint maxRegionX = (std::min)(uint(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),regionX+1); const uint16_t maxRegionX = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionX+1));
const uint maxRegionY = (std::min)(uint(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),regionY+1); const uint16_t maxRegionY = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionY+1));
const uint maxRegionZ = (std::min)(uint(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),regionZ+1); const uint16_t maxRegionZ = (std::min)(uint16_t(OGRE_VOLUME_SIDE_LENGTH_IN_REGIONS-1),uint16_t(regionZ+1));
for(uint zCt = minRegionZ; zCt <= maxRegionZ; zCt++) for(uint16_t zCt = minRegionZ; zCt <= maxRegionZ; zCt++)
{ {
for(uint yCt = minRegionY; yCt <= maxRegionY; yCt++) for(uint16_t yCt = minRegionY; yCt <= maxRegionY; yCt++)
{ {
for(uint xCt = minRegionX; xCt <= maxRegionX; xCt++) for(uint16_t xCt = minRegionX; xCt <= maxRegionX; xCt++)
{ {
surfaceUpToDate[xCt][yCt][zCt] = false; surfaceUpToDate[xCt][yCt][zCt] = false;
} }
@ -666,21 +668,21 @@ namespace Ogre
} }
} }
void PolyVoxSceneManager::markRegionChanged(uint firstX, uint firstY, uint firstZ, uint lastX, uint lastY, uint lastZ) void PolyVoxSceneManager::markRegionChanged(uint16_t firstX, uint16_t firstY, uint16_t firstZ, uint16_t lastX, uint16_t lastY, uint16_t lastZ)
{ {
const uint firstRegionX = firstX >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t firstRegionX = firstX >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint firstRegionY = firstY >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t firstRegionY = firstY >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint firstRegionZ = firstZ >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t firstRegionZ = firstZ >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint lastRegionX = lastX >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t lastRegionX = lastX >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint lastRegionY = lastY >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t lastRegionY = lastY >> OGRE_REGION_SIDE_LENGTH_POWER;
const uint lastRegionZ = lastZ >> OGRE_REGION_SIDE_LENGTH_POWER; const uint16_t lastRegionZ = lastZ >> OGRE_REGION_SIDE_LENGTH_POWER;
for(uint zCt = firstRegionZ; zCt <= lastRegionZ; zCt++) for(uint16_t zCt = firstRegionZ; zCt <= lastRegionZ; zCt++)
{ {
for(uint yCt = firstRegionY; yCt <= lastRegionY; yCt++) for(uint16_t yCt = firstRegionY; yCt <= lastRegionY; yCt++)
{ {
for(uint xCt = firstRegionX; xCt <= lastRegionX; xCt++) for(uint16_t xCt = firstRegionX; xCt <= lastRegionX; xCt++)
{ {
surfaceUpToDate[xCt][yCt][zCt] = false; surfaceUpToDate[xCt][yCt][zCt] = false;
} }
@ -688,12 +690,12 @@ namespace Ogre
} }
} }
uint PolyVoxSceneManager::getSideLength(void) uint16_t PolyVoxSceneManager::getSideLength(void)
{ {
return OGRE_VOLUME_SIDE_LENGTH; return OGRE_VOLUME_SIDE_LENGTH;
} }
uchar PolyVoxSceneManager::getMaterialIndexAt(uint uX, uint uY, uint uZ) uint8_t PolyVoxSceneManager::getMaterialIndexAt(uint16_t uX, uint16_t uY, uint16_t uZ)
{ {
if(volumeData->containsPoint(IntVector3(uX,uY,uZ),0)) if(volumeData->containsPoint(IntVector3(uX,uY,uZ),0))
{ {
@ -716,7 +718,7 @@ namespace Ogre
return volumeData->containsPoint(pos, boundary); return volumeData->containsPoint(pos, boundary);
} }
bool PolyVoxSceneManager::containsPoint(IntVector3 pos, uint boundary) bool PolyVoxSceneManager::containsPoint(IntVector3 pos, uint16_t boundary)
{ {
return volumeData->containsPoint(pos, boundary); return volumeData->containsPoint(pos, boundary);
} }

View File

@ -22,7 +22,7 @@ namespace Ogre
{ {
std::stringstream ss; std::stringstream ss;
uint ct = 0; uint16_t ct = 0;
SurfaceEdgeIterator edgeIter = edge; SurfaceEdgeIterator edgeIter = edge;
ss << "SurfaceTriangle:"; ss << "SurfaceTriangle:";
do do

View File

@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include <iostream> //FIXME - remove this... #include <iostream> //FIXME - remove this...
using namespace boost;
namespace Ogre namespace Ogre
{ {
@ -40,12 +42,12 @@ namespace Ogre
homogeneousBlock->fillWithValue(0); homogeneousBlock->fillWithValue(0);
}*/ }*/
/*for(uint i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i) /*for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
{ {
mBlocks[i] = mHomogeneousBlocks[0]; mBlocks[i] = mHomogeneousBlocks[0];
}*/ }*/
for(uint i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i) for(uint16_t i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i)
{ {
mBlocks[i] = new Block; mBlocks[i] = new Block;
} }
@ -69,13 +71,13 @@ namespace Ogre
return *this; return *this;
} }
/*for(uint i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i) /*for(uint16_t i = 0; i < OGRE_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(uint i = 0; i < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++i) for(uint16_t i = 0; i < OGRE_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.
@ -93,15 +95,15 @@ namespace Ogre
return *this; return *this;
} }
/*uchar Volume::getVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition) const /*uint8_t Volume::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
{ {
const uint blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
Block* block = mBlocks Block* block = mBlocks
[ [
@ -113,15 +115,15 @@ namespace Ogre
return block->getVoxelAt(xOffset,yOffset,zOffset); return block->getVoxelAt(xOffset,yOffset,zOffset);
}*/ }*/
/*void Volume::setVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, const uchar value) /*void Volume::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
{ {
const uint blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
Block* block = mBlocks Block* block = mBlocks
[ [
@ -133,7 +135,7 @@ namespace Ogre
block->setVoxelAt(xOffset,yOffset,zOffset, value); block->setVoxelAt(xOffset,yOffset,zOffset, value);
}*/ }*/
Block* Volume::getBlock(uint index) Block* Volume::getBlock(uint16_t index)
{ {
return mBlocks[index]; return mBlocks[index];
} }
@ -148,7 +150,7 @@ namespace Ogre
&& (pos.z > boundary); && (pos.z > boundary);
} }
bool Volume::containsPoint(IntVector3 pos, uint boundary) bool Volume::containsPoint(IntVector3 pos, uint16_t boundary)
{ {
return (pos.x < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary) return (pos.x < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
&& (pos.y < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary) && (pos.y < OGRE_VOLUME_SIDE_LENGTH - 1 - boundary)
@ -170,9 +172,9 @@ namespace Ogre
} }
//Read volume dimensions //Read volume dimensions
uchar volumeWidth = 0; uint8_t volumeWidth = 0;
uchar volumeHeight = 0; uint8_t volumeHeight = 0;
uchar volumeDepth = 0; uint8_t volumeDepth = 0;
file.read(reinterpret_cast<char*>(&volumeWidth), sizeof(volumeWidth)); file.read(reinterpret_cast<char*>(&volumeWidth), sizeof(volumeWidth));
file.read(reinterpret_cast<char*>(&volumeHeight), sizeof(volumeHeight)); file.read(reinterpret_cast<char*>(&volumeHeight), sizeof(volumeHeight));
file.read(reinterpret_cast<char*>(&volumeDepth), sizeof(volumeDepth)); file.read(reinterpret_cast<char*>(&volumeDepth), sizeof(volumeDepth));
@ -184,13 +186,13 @@ namespace Ogre
//Read data //Read data
VolumeIterator volIter(*this); VolumeIterator volIter(*this);
for(uint z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z) for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
{ {
for(uint y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y) for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
{ {
for(uint x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x) for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
{ {
uchar 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
volIter.setVoxelAt(x,y,z,value); volIter.setVoxelAt(x,y,z,value);
} }
@ -218,9 +220,9 @@ namespace Ogre
} }
//Read volume dimensions //Read volume dimensions
uchar volumeWidth = 0; uint8_t volumeWidth = 0;
uchar volumeHeight = 0; uint8_t volumeHeight = 0;
uchar volumeDepth = 0; uint8_t volumeDepth = 0;
file.write(reinterpret_cast<char*>(&volumeWidth), sizeof(volumeWidth)); file.write(reinterpret_cast<char*>(&volumeWidth), sizeof(volumeWidth));
file.write(reinterpret_cast<char*>(&volumeHeight), sizeof(volumeHeight)); file.write(reinterpret_cast<char*>(&volumeHeight), sizeof(volumeHeight));
file.write(reinterpret_cast<char*>(&volumeDepth), sizeof(volumeDepth)); file.write(reinterpret_cast<char*>(&volumeDepth), sizeof(volumeDepth));
@ -232,13 +234,13 @@ namespace Ogre
//Write data //Write data
VolumeIterator volIter(*this); VolumeIterator volIter(*this);
for(uint z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z) for(uint16_t z = 0; z < OGRE_VOLUME_SIDE_LENGTH; ++z)
{ {
for(uint y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y) for(uint16_t y = 0; y < OGRE_VOLUME_SIDE_LENGTH; ++y)
{ {
for(uint x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x) for(uint16_t x = 0; x < OGRE_VOLUME_SIDE_LENGTH; ++x)
{ {
uchar 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
} }
} }
@ -246,7 +248,7 @@ namespace Ogre
return true; return true;
} }
void Volume::regionGrow(uint xStart, uint yStart, uint zStart, uchar 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 > OGRE_VOLUME_SIDE_LENGTH-1) || (yStart > OGRE_VOLUME_SIDE_LENGTH-1) || (zStart > OGRE_VOLUME_SIDE_LENGTH-1)
@ -257,7 +259,7 @@ namespace Ogre
} }
VolumeIterator volIter(*this); VolumeIterator volIter(*this);
const uchar uSeedValue = volIter.getVoxelAt(xStart,yStart,zStart); const uint8_t uSeedValue = volIter.getVoxelAt(xStart,yStart,zStart);
if(value == uSeedValue) if(value == uSeedValue)
{ {
@ -322,13 +324,13 @@ namespace Ogre
void Volume::tidy(void) void Volume::tidy(void)
{ {
//Check for homogeneous blocks //Check for homogeneous blocks
/*for(ulong ct = 0; ct < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++ct) /*for(uint32_t ct = 0; ct < OGRE_NO_OF_BLOCKS_IN_VOLUME; ++ct)
{ {
if(mBlocks[ct]->isHomogeneous()) if(mBlocks[ct]->isHomogeneous())
{ {
//LogManager::getSingleton().logMessage("Got homogeneous block with value " + StringConverter::toString(mBlocks[ct]->getVoxelAt(0,0,0))); //LogManager::getSingleton().logMessage("Got homogeneous block with value " + StringConverter::toString(mBlocks[ct]->getVoxelAt(0,0,0)));
const uchar homogeneousValue = mBlocks[ct]->getVoxelAt(0,0,0); const uint8_t homogeneousValue = mBlocks[ct]->getVoxelAt(0,0,0);
SharedPtr<Block>& homogeneousBlock = mHomogeneousBlocks[homogeneousValue]; SharedPtr<Block>& homogeneousBlock = mHomogeneousBlocks[homogeneousValue];
if(homogeneousBlock.isNull()) if(homogeneousBlock.isNull())
{ {

View File

@ -24,6 +24,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#include "OgreStringConverter.h" #include "OgreStringConverter.h"
#include "OgreVector3.h" #include "OgreVector3.h"
using namespace boost;
namespace Ogre namespace Ogre
{ {
VolumeIterator::VolumeIterator(Volume& volume) VolumeIterator::VolumeIterator(Volume& volume)
@ -61,7 +63,7 @@ namespace Ogre
{ {
} }
void VolumeIterator::setVoxel(uchar value) void VolumeIterator::setVoxel(uint8_t value)
{ {
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume]; Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
@ -77,21 +79,21 @@ namespace Ogre
*mCurrentVoxel = value; *mCurrentVoxel = value;
} }
uchar VolumeIterator::getVoxel(void) uint8_t VolumeIterator::getVoxel(void)
{ {
//return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume); //return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume);
return *mCurrentVoxel; return *mCurrentVoxel;
} }
uchar VolumeIterator::getVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition) const uint8_t VolumeIterator::getVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition) const
{ {
const uint blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
const Block* block = mVolume.mBlocks const Block* block = mVolume.mBlocks
[ [
@ -103,14 +105,14 @@ namespace Ogre
return block->getVoxelAt(xOffset,yOffset,zOffset); return block->getVoxelAt(xOffset,yOffset,zOffset);
} }
float VolumeIterator::getAveragedVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, uint size) const float VolumeIterator::getAveragedVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, uint16_t size) const
{ {
float sum = 0.0; float sum = 0.0;
for(uint z = zPosition-size; z <= zPosition+size; ++z) for(uint16_t z = zPosition-size; z <= zPosition+size; ++z)
{ {
for(uint y = yPosition-size; y <= yPosition+size; ++y) for(uint16_t y = yPosition-size; y <= yPosition+size; ++y)
{ {
for(uint x = xPosition-size; x <= xPosition+size; ++x) for(uint16_t x = xPosition-size; x <= xPosition+size; ++x)
{ {
if(getVoxelAt(x,y,z) != 0) if(getVoxelAt(x,y,z) != 0)
{ {
@ -120,22 +122,22 @@ namespace Ogre
} }
} }
uint kernelSideLength = size * 2 + 1; uint16_t kernelSideLength = size * 2 + 1;
uint kernelVolume = kernelSideLength * kernelSideLength * kernelSideLength; uint16_t kernelVolume = kernelSideLength * kernelSideLength * kernelSideLength;
sum /= static_cast<float>(kernelVolume); sum /= static_cast<float>(kernelVolume);
return sum; return sum;
} }
void VolumeIterator::setVoxelAt(const uint xPosition, const uint yPosition, const uint zPosition, const uchar value) void VolumeIterator::setVoxelAt(const uint16_t xPosition, const uint16_t yPosition, const uint16_t zPosition, const uint8_t value)
{ {
const uint blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockX = xPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockY = yPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER; const uint16_t blockZ = zPosition >> OGRE_BLOCK_SIDE_LENGTH_POWER;
const uint xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t xOffset = xPosition - (blockX << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t yOffset = yPosition - (blockY << OGRE_BLOCK_SIDE_LENGTH_POWER);
const uint zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER); const uint16_t zOffset = zPosition - (blockZ << OGRE_BLOCK_SIDE_LENGTH_POWER);
Block* block = mVolume.mBlocks Block* block = mVolume.mBlocks
[ [
@ -168,14 +170,14 @@ namespace Ogre
} }
//FIXME - bitwise way of doing this? //FIXME - bitwise way of doing this?
uchar voxel1nx = peekVoxel1nx0py0pz() > 0 ? 1: 0; uint8_t voxel1nx = peekVoxel1nx0py0pz() > 0 ? 1: 0;
uchar voxel1px = peekVoxel1px0py0pz() > 0 ? 1: 0; uint8_t voxel1px = peekVoxel1px0py0pz() > 0 ? 1: 0;
uchar voxel1ny = peekVoxel0px1ny0pz() > 0 ? 1: 0; uint8_t voxel1ny = peekVoxel0px1ny0pz() > 0 ? 1: 0;
uchar voxel1py = peekVoxel0px1py0pz() > 0 ? 1: 0; uint8_t voxel1py = peekVoxel0px1py0pz() > 0 ? 1: 0;
uchar voxel1nz = peekVoxel0px0py1nz() > 0 ? 1: 0; uint8_t voxel1nz = peekVoxel0px0py1nz() > 0 ? 1: 0;
uchar voxel1pz = peekVoxel0px0py1pz() > 0 ? 1: 0; uint8_t voxel1pz = peekVoxel0px0py1pz() > 0 ? 1: 0;
return Vector3(int(voxel1px) - int(voxel1nx),int(voxel1py) - int(voxel1ny),int(voxel1pz) - int(voxel1nz)); return Vector3(int(voxel1px) - int(voxel1nx),int(voxel1py) - int(voxel1ny),int(voxel1pz) - int(voxel1nz));
} }
@ -218,35 +220,35 @@ namespace Ogre
static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, { static const int weights[3][3][3] = { { {2,3,2}, {3,6,3}, {2,3,2} }, {
{3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } }; {3,6,3}, {6,0,6}, {3,6,3} }, { {2,3,2}, {3,6,3}, {2,3,2} } };
const uchar pVoxel1nx1ny1nz = peekVoxel1nx1ny1nz() > 0 ? 1: 0; const uint8_t pVoxel1nx1ny1nz = peekVoxel1nx1ny1nz() > 0 ? 1: 0;
const uchar pVoxel1nx1ny0pz = peekVoxel1nx1ny0pz() > 0 ? 1: 0; const uint8_t pVoxel1nx1ny0pz = peekVoxel1nx1ny0pz() > 0 ? 1: 0;
const uchar pVoxel1nx1ny1pz = peekVoxel1nx1ny1pz() > 0 ? 1: 0; const uint8_t pVoxel1nx1ny1pz = peekVoxel1nx1ny1pz() > 0 ? 1: 0;
const uchar pVoxel1nx0py1nz = peekVoxel1nx0py1nz() > 0 ? 1: 0; const uint8_t pVoxel1nx0py1nz = peekVoxel1nx0py1nz() > 0 ? 1: 0;
const uchar pVoxel1nx0py0pz = peekVoxel1nx0py0pz() > 0 ? 1: 0; const uint8_t pVoxel1nx0py0pz = peekVoxel1nx0py0pz() > 0 ? 1: 0;
const uchar pVoxel1nx0py1pz = peekVoxel1nx0py1pz() > 0 ? 1: 0; const uint8_t pVoxel1nx0py1pz = peekVoxel1nx0py1pz() > 0 ? 1: 0;
const uchar pVoxel1nx1py1nz = peekVoxel1nx1py1nz() > 0 ? 1: 0; const uint8_t pVoxel1nx1py1nz = peekVoxel1nx1py1nz() > 0 ? 1: 0;
const uchar pVoxel1nx1py0pz = peekVoxel1nx1py0pz() > 0 ? 1: 0; const uint8_t pVoxel1nx1py0pz = peekVoxel1nx1py0pz() > 0 ? 1: 0;
const uchar pVoxel1nx1py1pz = peekVoxel1nx1py1pz() > 0 ? 1: 0; const uint8_t pVoxel1nx1py1pz = peekVoxel1nx1py1pz() > 0 ? 1: 0;
const uchar pVoxel0px1ny1nz = peekVoxel0px1ny1nz() > 0 ? 1: 0; const uint8_t pVoxel0px1ny1nz = peekVoxel0px1ny1nz() > 0 ? 1: 0;
const uchar pVoxel0px1ny0pz = peekVoxel0px1ny0pz() > 0 ? 1: 0; const uint8_t pVoxel0px1ny0pz = peekVoxel0px1ny0pz() > 0 ? 1: 0;
const uchar pVoxel0px1ny1pz = peekVoxel0px1ny1pz() > 0 ? 1: 0; const uint8_t pVoxel0px1ny1pz = peekVoxel0px1ny1pz() > 0 ? 1: 0;
const uchar pVoxel0px0py1nz = peekVoxel0px0py1nz() > 0 ? 1: 0; const uint8_t pVoxel0px0py1nz = peekVoxel0px0py1nz() > 0 ? 1: 0;
//const uchar pVoxel0px0py0pz = peekVoxel0px0py0pz() > 0 ? 1: 0; //const uint8_t pVoxel0px0py0pz = peekVoxel0px0py0pz() > 0 ? 1: 0;
const uchar pVoxel0px0py1pz = peekVoxel0px0py1pz() > 0 ? 1: 0; const uint8_t pVoxel0px0py1pz = peekVoxel0px0py1pz() > 0 ? 1: 0;
const uchar pVoxel0px1py1nz = peekVoxel0px1py1nz() > 0 ? 1: 0; const uint8_t pVoxel0px1py1nz = peekVoxel0px1py1nz() > 0 ? 1: 0;
const uchar pVoxel0px1py0pz = peekVoxel0px1py0pz() > 0 ? 1: 0; const uint8_t pVoxel0px1py0pz = peekVoxel0px1py0pz() > 0 ? 1: 0;
const uchar pVoxel0px1py1pz = peekVoxel0px1py1pz() > 0 ? 1: 0; const uint8_t pVoxel0px1py1pz = peekVoxel0px1py1pz() > 0 ? 1: 0;
const uchar pVoxel1px1ny1nz = peekVoxel1px1ny1nz() > 0 ? 1: 0; const uint8_t pVoxel1px1ny1nz = peekVoxel1px1ny1nz() > 0 ? 1: 0;
const uchar pVoxel1px1ny0pz = peekVoxel1px1ny0pz() > 0 ? 1: 0; const uint8_t pVoxel1px1ny0pz = peekVoxel1px1ny0pz() > 0 ? 1: 0;
const uchar pVoxel1px1ny1pz = peekVoxel1px1ny1pz() > 0 ? 1: 0; const uint8_t pVoxel1px1ny1pz = peekVoxel1px1ny1pz() > 0 ? 1: 0;
const uchar pVoxel1px0py1nz = peekVoxel1px0py1nz() > 0 ? 1: 0; const uint8_t pVoxel1px0py1nz = peekVoxel1px0py1nz() > 0 ? 1: 0;
const uchar pVoxel1px0py0pz = peekVoxel1px0py0pz() > 0 ? 1: 0; const uint8_t pVoxel1px0py0pz = peekVoxel1px0py0pz() > 0 ? 1: 0;
const uchar pVoxel1px0py1pz = peekVoxel1px0py1pz() > 0 ? 1: 0; const uint8_t pVoxel1px0py1pz = peekVoxel1px0py1pz() > 0 ? 1: 0;
const uchar pVoxel1px1py1nz = peekVoxel1px1py1nz() > 0 ? 1: 0; const uint8_t pVoxel1px1py1nz = peekVoxel1px1py1nz() > 0 ? 1: 0;
const uchar pVoxel1px1py0pz = peekVoxel1px1py0pz() > 0 ? 1: 0; const uint8_t pVoxel1px1py0pz = peekVoxel1px1py0pz() > 0 ? 1: 0;
const uchar pVoxel1px1py1pz = peekVoxel1px1py1pz() > 0 ? 1: 0; const uint8_t pVoxel1px1py1pz = peekVoxel1px1py1pz() > 0 ? 1: 0;
@ -295,22 +297,22 @@ namespace Ogre
return Vector3(xGrad,yGrad,zGrad); return Vector3(xGrad,yGrad,zGrad);
} }
uint VolumeIterator::getPosX(void) uint16_t VolumeIterator::getPosX(void)
{ {
return mXPosInVolume; return mXPosInVolume;
} }
uint VolumeIterator::getPosY(void) uint16_t VolumeIterator::getPosY(void)
{ {
return mYPosInVolume; return mYPosInVolume;
} }
uint VolumeIterator::getPosZ(void) uint16_t VolumeIterator::getPosZ(void)
{ {
return mZPosInVolume; return mZPosInVolume;
} }
void VolumeIterator::setPosition(uint xPos, uint yPos, uint zPos) void VolumeIterator::setPosition(uint16_t xPos, uint16_t yPos, uint16_t zPos)
{ {
mXPosInVolume = xPos; mXPosInVolume = xPos;
mYPosInVolume = yPos; mYPosInVolume = yPos;
@ -336,7 +338,7 @@ namespace Ogre
mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock; mCurrentVoxel = currentBlock->mData + mVoxelIndexInBlock;
} }
void VolumeIterator::setValidRegion(uint xFirst, uint yFirst, uint zFirst, uint xLast, uint yLast, uint zLast) void VolumeIterator::setValidRegion(uint16_t xFirst, uint16_t yFirst, uint16_t zFirst, uint16_t xLast, uint16_t yLast, uint16_t zLast)
{ {
mXRegionFirst = xFirst; mXRegionFirst = xFirst;
mYRegionFirst = yFirst; mYRegionFirst = yFirst;
@ -370,7 +372,7 @@ namespace Ogre
mXPosInVolume++; mXPosInVolume++;
if((mXPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mXPosInVolume > mXRegionLast)) if((mXPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mXPosInVolume > mXRegionLast))
{ {
mXPosInVolume = (std::max)(mXRegionFirst,mXBlock * OGRE_BLOCK_SIDE_LENGTH); mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * OGRE_BLOCK_SIDE_LENGTH));
mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER); mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
mVoxelIndexInBlock = mXPosInBlock + mVoxelIndexInBlock = mXPosInBlock +
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH + mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
@ -383,7 +385,7 @@ namespace Ogre
mCurrentVoxel += OGRE_BLOCK_SIDE_LENGTH; mCurrentVoxel += OGRE_BLOCK_SIDE_LENGTH;
if((mYPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mYPosInVolume > mYRegionLast)) if((mYPosInBlock == OGRE_BLOCK_SIDE_LENGTH) || (mYPosInVolume > mYRegionLast))
{ {
mYPosInVolume = (std::max)(mYRegionFirst,mYBlock * OGRE_BLOCK_SIDE_LENGTH); mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * OGRE_BLOCK_SIDE_LENGTH));
mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER); mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
mVoxelIndexInBlock = mXPosInBlock + mVoxelIndexInBlock = mXPosInBlock +
mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH + mYPosInBlock * OGRE_BLOCK_SIDE_LENGTH +
@ -430,9 +432,9 @@ namespace Ogre
Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume]; Block* currentBlock = mVolume.mBlocks[mBlockIndexInVolume];
//mCurrentBlock = mVolume->mBlocks[mBlockIndexInVolume]; //mCurrentBlock = mVolume->mBlocks[mBlockIndexInVolume];
mXPosInVolume = (std::max)(mXRegionFirst,mXBlock * OGRE_BLOCK_SIDE_LENGTH); mXPosInVolume = (std::max)(mXRegionFirst,uint16_t(mXBlock * OGRE_BLOCK_SIDE_LENGTH));
mYPosInVolume = (std::max)(mYRegionFirst,mYBlock * OGRE_BLOCK_SIDE_LENGTH); mYPosInVolume = (std::max)(mYRegionFirst,uint16_t(mYBlock * OGRE_BLOCK_SIDE_LENGTH));
mZPosInVolume = (std::max)(mZRegionFirst,mZBlock * OGRE_BLOCK_SIDE_LENGTH); mZPosInVolume = (std::max)(mZRegionFirst,uint16_t(mZBlock * OGRE_BLOCK_SIDE_LENGTH));
mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER); mXPosInBlock = mXPosInVolume - (mXBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER); mYPosInBlock = mYPosInVolume - (mYBlock << OGRE_BLOCK_SIDE_LENGTH_POWER);
@ -453,7 +455,7 @@ namespace Ogre
return mIsValidForRegion; return mIsValidForRegion;
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -462,7 +464,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume-1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -471,7 +473,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume); return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -480,7 +482,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume+1); return getVoxelAt(mXPosInVolume-1,mYPosInVolume-1,mZPosInVolume+1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -489,7 +491,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume-1); return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume-1);
} }
uchar VolumeIterator::peekVoxel1nx0py0pz(void) const uint8_t VolumeIterator::peekVoxel1nx0py0pz(void) const
{ {
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0)) if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -498,7 +500,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume); return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -507,7 +509,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume+1); return getVoxelAt(mXPosInVolume-1,mYPosInVolume,mZPosInVolume+1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -516,7 +518,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume-1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -525,7 +527,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume); return getVoxelAt(mXPosInVolume-1,mYPosInVolume+1,mZPosInVolume);
} }
uchar 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%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))
{ {
@ -536,7 +538,7 @@ namespace Ogre
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -545,7 +547,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume-1);
} }
uchar VolumeIterator::peekVoxel0px1ny0pz(void) const uint8_t VolumeIterator::peekVoxel0px1ny0pz(void) const
{ {
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0)) if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -554,7 +556,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume); return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -563,7 +565,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume+1); return getVoxelAt(mXPosInVolume,mYPosInVolume-1,mZPosInVolume+1);
} }
uchar VolumeIterator::peekVoxel0px0py1nz(void) const uint8_t VolumeIterator::peekVoxel0px0py1nz(void) const
{ {
if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0)) if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -572,12 +574,12 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume-1); return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume-1);
} }
uchar VolumeIterator::peekVoxel0px0py0pz(void) const uint8_t VolumeIterator::peekVoxel0px0py0pz(void) const
{ {
return *mCurrentVoxel; return *mCurrentVoxel;
} }
uchar VolumeIterator::peekVoxel0px0py1pz(void) const uint8_t VolumeIterator::peekVoxel0px0py1pz(void) const
{ {
if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1)) if((mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -586,7 +588,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume+1); return getVoxelAt(mXPosInVolume,mYPosInVolume,mZPosInVolume+1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -595,7 +597,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume-1);
} }
uchar VolumeIterator::peekVoxel0px1py0pz(void) const uint8_t VolumeIterator::peekVoxel0px1py0pz(void) const
{ {
if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1)) if((mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -604,7 +606,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume); return getVoxelAt(mXPosInVolume,mYPosInVolume+1,mZPosInVolume);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -615,7 +617,7 @@ namespace Ogre
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -624,7 +626,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume-1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -633,7 +635,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume); return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume);
} }
uchar 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%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))
{ {
@ -642,7 +644,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume+1); return getVoxelAt(mXPosInVolume+1,mYPosInVolume-1,mZPosInVolume+1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != 0))
{ {
@ -651,7 +653,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume-1); return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume-1);
} }
uchar VolumeIterator::peekVoxel1px0py0pz(void) const uint8_t VolumeIterator::peekVoxel1px0py0pz(void) const
{ {
if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1)) if((mXPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -660,7 +662,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume); return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mZPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -669,7 +671,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume+1); return getVoxelAt(mXPosInVolume+1,mYPosInVolume,mZPosInVolume+1);
} }
uchar 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%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))
{ {
@ -678,7 +680,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume-1); return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume-1);
} }
uchar 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%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1) && (mYPosInVolume%OGRE_BLOCK_SIDE_LENGTH != OGRE_BLOCK_SIDE_LENGTH-1))
{ {
@ -687,7 +689,7 @@ namespace Ogre
return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume); return getVoxelAt(mXPosInVolume+1,mYPosInVolume+1,mZPosInVolume);
} }
uchar 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%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))
{ {