Removed boost dependency.
This commit is contained in:
		| @@ -3,13 +3,13 @@ | ||||
| #include "RegionGeometry.h" | ||||
| #include "SurfaceVertex.h" | ||||
|  | ||||
| #include "boost/cstdint.hpp" | ||||
| #include "PolyVoxCStdInt.h" | ||||
|  | ||||
| using namespace boost; | ||||
| using namespace std; | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	POLYVOX_API void computeNormalsForVertices(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod) | ||||
| 	POLYVOX_API void computeNormalsForVertices(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom, NormalGenerationMethod normalGenerationMethod) | ||||
| 	{ | ||||
| 		std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices; | ||||
| 		std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin(); | ||||
| @@ -18,7 +18,7 @@ namespace PolyVox | ||||
| 			const Vector3DFloat& v3dPos = iterSurfaceVertex->getPosition() + static_cast<Vector3DFloat>(regGeom.m_v3dRegionPosition); | ||||
| 			const Vector3DInt32 v3dFloor = static_cast<Vector3DInt32>(v3dPos); | ||||
|  | ||||
| 			BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); | ||||
| 			BlockVolumeIterator<std::uint8_t> volIter(*volumeData); | ||||
|  | ||||
| 			//Check all corners are within the volume, allowing a boundary for gradient estimation | ||||
| 			bool lowerCornerInside = volumeData->containsPoint(v3dFloor,1); | ||||
| @@ -98,7 +98,7 @@ namespace PolyVox | ||||
|  | ||||
| 		Vector3DFloat result; | ||||
|  | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create? | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create? | ||||
|  | ||||
|  | ||||
| 		if(normalGenerationMethod == SOBEL) | ||||
|   | ||||
| @@ -21,7 +21,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
|  | ||||
| #include "IndexedSurfacePatch.h" | ||||
|  | ||||
| using namespace boost; | ||||
| using namespace std; | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| @@ -120,7 +120,7 @@ namespace PolyVox | ||||
| 		}*/ | ||||
| 	} | ||||
|  | ||||
| 	boost::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos) | ||||
| 	std::int32_t IndexedSurfacePatch::getIndexFor(const Vector3DFloat& pos) | ||||
| 	{ | ||||
| 		assert(pos.getX() >= 0.0f); | ||||
| 		assert(pos.getY() >= 0.0f); | ||||
| @@ -152,7 +152,7 @@ namespace PolyVox | ||||
| 		while(true); | ||||
| 	} | ||||
|  | ||||
| 	void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, boost::int32_t newIndex) | ||||
| 	void IndexedSurfacePatch::setIndexFor(const Vector3DFloat& pos, std::int32_t newIndex) | ||||
| 	{ | ||||
| 		assert(pos.getX() >= 0.0f); | ||||
| 		assert(pos.getY() >= 0.0f); | ||||
| @@ -195,7 +195,7 @@ namespace PolyVox | ||||
| 		return m_vecVertices; | ||||
| 	} | ||||
|  | ||||
| 	const std::vector<boost::uint32_t>& IndexedSurfacePatch::getIndices(void) const | ||||
| 	const std::vector<std::uint32_t>& IndexedSurfacePatch::getIndices(void) const | ||||
| 	{ | ||||
| 		return m_vecTriangleIndices; | ||||
| 	} | ||||
|   | ||||
| @@ -44,7 +44,7 @@ namespace PolyVox | ||||
| 			&& (pos.getZ() >= m_v3dLowerCorner.getZ() + boundary); | ||||
| 	} | ||||
|  | ||||
| 	bool Region::containsPoint(const Vector3DInt32& pos, boost::uint8_t boundary) const | ||||
| 	bool Region::containsPoint(const Vector3DInt32& pos, std::uint8_t boundary) const | ||||
| 	{ | ||||
| 		return (pos.getX() <= m_v3dUpperCorner.getX() - boundary) | ||||
| 			&& (pos.getY() <= m_v3dUpperCorner.getY() - boundary)  | ||||
|   | ||||
| @@ -11,12 +11,12 @@ | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	void smoothRegionGeometry(BlockVolume<boost::uint8_t>* volumeData, RegionGeometry& regGeom) | ||||
| 	void smoothRegionGeometry(BlockVolume<std::uint8_t>* volumeData, RegionGeometry& regGeom) | ||||
| 	{ | ||||
| 		const boost::uint8_t uSmoothingFactor = 2; | ||||
| 		const std::uint8_t uSmoothingFactor = 2; | ||||
| 		const float fThreshold = 0.5f; | ||||
|  | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); | ||||
|  | ||||
| 		std::vector<SurfaceVertex>& vecVertices = regGeom.m_patchSingleMaterial->m_vecVertices; | ||||
| 		std::vector<SurfaceVertex>::iterator iterSurfaceVertex = vecVertices.begin(); | ||||
|   | ||||
| @@ -13,7 +13,7 @@ | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| using namespace boost; | ||||
| using namespace std; | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| @@ -55,7 +55,7 @@ namespace PolyVox | ||||
| 		return listChangedRegionGeometry; | ||||
| 	} | ||||
|  | ||||
| 	boost::uint32_t getIndex(boost::uint32_t x, boost::uint32_t y) | ||||
| 	std::uint32_t getIndex(std::uint32_t x, std::uint32_t y) | ||||
| 	{ | ||||
| 		return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1)); | ||||
| 	} | ||||
| @@ -66,16 +66,16 @@ namespace PolyVox | ||||
| 		singleMaterialPatch->m_vecTriangleIndices.clear(); | ||||
|  | ||||
| 		//For edge indices | ||||
| 		boost::int32_t* vertexIndicesX0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesY0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesZ0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesX1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesY1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesZ1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesX0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesY0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesZ0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesX1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesY1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesZ1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
|  | ||||
| 		//Cell bitmasks | ||||
| 		boost::uint8_t* bitmask0 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::uint8_t* bitmask1 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::uint8_t* bitmask0 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::uint8_t* bitmask1 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
|  | ||||
| 		//When generating the mesh for a region we actually look one voxel outside it in the | ||||
| 		// back, bottom, right direction. Protect against access violations by cropping region here | ||||
| @@ -91,22 +91,22 @@ namespace PolyVox | ||||
| 		regSlice0.setUpperCorner(Vector3DInt32(regSlice0.getUpperCorner().getX(),regSlice0.getUpperCorner().getY(),regSlice0.getLowerCorner().getZ())); | ||||
| 		 | ||||
| 		//Iterator to access the volume data | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);		 | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData);		 | ||||
|  | ||||
| 		//Compute bitmask for initial slice | ||||
| 		boost::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);		 | ||||
| 		std::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialRoughBitmaskForSlice(volIter, regSlice0, offset, bitmask0);		 | ||||
| 		if(uNoOfNonEmptyCellsForSlice0 != 0) | ||||
| 		{ | ||||
| 			//If there were some non-empty cells then generate initial slice vertices for them | ||||
| 			generateRoughVerticesForSlice(volIter,regSlice0, offset, bitmask0, singleMaterialPatch, vertexIndicesX0, vertexIndicesY0, vertexIndicesZ0); | ||||
| 		} | ||||
|  | ||||
| 		for(boost::uint32_t uSlice = 0; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH-1) && (uSlice + offset.getZ() < region.getUpperCorner().getZ())); ++uSlice) | ||||
| 		for(std::uint32_t uSlice = 0; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH-1) && (uSlice + offset.getZ() < region.getUpperCorner().getZ())); ++uSlice) | ||||
| 		{ | ||||
| 			Region regSlice1(regSlice0); | ||||
| 			regSlice1.shift(Vector3DInt32(0,0,1)); | ||||
|  | ||||
| 			boost::uint32_t uNoOfNonEmptyCellsForSlice1 = computeRoughBitmaskForSliceFromPrevious(volIter, regSlice1, offset, bitmask1, bitmask0); | ||||
| 			std::uint32_t uNoOfNonEmptyCellsForSlice1 = computeRoughBitmaskForSliceFromPrevious(volIter, regSlice1, offset, bitmask1, bitmask0); | ||||
|  | ||||
| 			if(uNoOfNonEmptyCellsForSlice1 != 0) | ||||
| 			{ | ||||
| @@ -137,9 +137,9 @@ namespace PolyVox | ||||
| 		delete[] vertexIndicesZ1; | ||||
| 	} | ||||
|  | ||||
| 	boost::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask) | ||||
| 	std::uint32_t computeInitialRoughBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask) | ||||
| 	{ | ||||
| 		boost::uint32_t uNoOfNonEmptyCells = 0; | ||||
| 		std::uint32_t uNoOfNonEmptyCells = 0; | ||||
|  | ||||
| 		//Iterate over each cell in the region | ||||
| 		volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ()); | ||||
| @@ -287,9 +287,9 @@ namespace PolyVox | ||||
| 		return uNoOfNonEmptyCells; | ||||
| 	} | ||||
|  | ||||
| 	boost::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask) | ||||
| 	std::uint32_t computeRoughBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask) | ||||
| 	{ | ||||
| 		boost::uint32_t uNoOfNonEmptyCells = 0; | ||||
| 		std::uint32_t uNoOfNonEmptyCells = 0; | ||||
|  | ||||
| 		//Iterate over each cell in the region | ||||
| 		volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ()); | ||||
| @@ -403,7 +403,7 @@ namespace PolyVox | ||||
| 		return uNoOfNonEmptyCells; | ||||
| 	} | ||||
|  | ||||
| 	void generateRoughVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[]) | ||||
| 	void generateRoughVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]) | ||||
| 	{ | ||||
| 		//Iterate over each cell in the region | ||||
| 		volIter.setPosition(regSlice.getLowerCorner().getX(),regSlice.getLowerCorner().getY(), regSlice.getLowerCorner().getZ()); | ||||
| @@ -470,9 +470,9 @@ namespace PolyVox | ||||
| 		}while(volIter.moveForwardInRegionXYZ());//For each cell | ||||
| 	} | ||||
|  | ||||
| 	void generateRoughIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[]) | ||||
| 	void generateRoughIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, std::int32_t vertexIndicesX0[],std::int32_t vertexIndicesY0[],std::int32_t vertexIndicesZ0[], std::int32_t vertexIndicesX1[],std::int32_t vertexIndicesY1[],std::int32_t vertexIndicesZ1[]) | ||||
| 	{ | ||||
| 		boost::uint32_t indlist[12]; | ||||
| 		std::uint32_t indlist[12]; | ||||
|  | ||||
| 		Region regCroppedSlice(regSlice);		 | ||||
| 		regCroppedSlice.setUpperCorner(regCroppedSlice.getUpperCorner() - Vector3DInt32(1,1,0)); | ||||
| @@ -559,9 +559,9 @@ namespace PolyVox | ||||
|  | ||||
| 			for (int i=0;triTable[iCubeIndex][i]!=-1;i+=3) | ||||
| 			{ | ||||
| 				boost::uint32_t ind0 = indlist[triTable[iCubeIndex][i  ]]; | ||||
| 				boost::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]]; | ||||
| 				boost::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]]; | ||||
| 				std::uint32_t ind0 = indlist[triTable[iCubeIndex][i  ]]; | ||||
| 				std::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]]; | ||||
| 				std::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]]; | ||||
|  | ||||
| 				singleMaterialPatch->m_vecTriangleIndices.push_back(ind0); | ||||
| 				singleMaterialPatch->m_vecTriangleIndices.push_back(ind1); | ||||
| @@ -584,7 +584,7 @@ namespace PolyVox | ||||
|  | ||||
| 		Vector3DFloat vertlist[12]; | ||||
| 		uint8_t vertMaterials[12]; | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); | ||||
| 		volIter.setValidRegion(region); | ||||
|  | ||||
| 		////////////////////////////////////////////////////////////////////////// | ||||
|   | ||||
| @@ -11,11 +11,11 @@ | ||||
|  | ||||
| #include <algorithm> | ||||
|  | ||||
| using namespace boost; | ||||
| using namespace std; | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	boost::uint32_t getDecimatedIndex(boost::uint32_t x, boost::uint32_t y) | ||||
| 	std::uint32_t getDecimatedIndex(std::uint32_t x, std::uint32_t y) | ||||
| 	{ | ||||
| 		return x + (y * (POLYVOX_REGION_SIDE_LENGTH+1)); | ||||
| 	} | ||||
| @@ -26,16 +26,16 @@ namespace PolyVox | ||||
| 		singleMaterialPatch->m_vecTriangleIndices.clear(); | ||||
|  | ||||
| 		//For edge indices | ||||
| 		boost::int32_t* vertexIndicesX0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesY0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesZ0 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesX1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesY1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::int32_t* vertexIndicesZ1 = new boost::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesX0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesY0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesZ0 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesX1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesY1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::int32_t* vertexIndicesZ1 = new std::int32_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
|  | ||||
| 		//Cell bitmasks | ||||
| 		boost::uint8_t* bitmask0 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		boost::uint8_t* bitmask1 = new boost::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::uint8_t* bitmask0 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
| 		std::uint8_t* bitmask1 = new std::uint8_t[(POLYVOX_REGION_SIDE_LENGTH+1) * (POLYVOX_REGION_SIDE_LENGTH+1)]; | ||||
|  | ||||
| 		const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel; | ||||
|  | ||||
| @@ -55,22 +55,22 @@ namespace PolyVox | ||||
| 		regSlice0.setUpperCorner(v3dUpperCorner); | ||||
| 		 | ||||
| 		//Iterator to access the volume data | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData);		 | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData);		 | ||||
|  | ||||
| 		//Compute bitmask for initial slice | ||||
| 		boost::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);		 | ||||
| 		std::uint32_t uNoOfNonEmptyCellsForSlice0 = computeInitialDecimatedBitmaskForSlice(volIter, uLevel, regSlice0, offset, bitmask0);		 | ||||
| 		if(uNoOfNonEmptyCellsForSlice0 != 0) | ||||
| 		{ | ||||
| 			//If there were some non-empty cells then generate initial slice vertices for them | ||||
| 			generateDecimatedVerticesForSlice(volIter, uLevel, regSlice0, offset, bitmask0, singleMaterialPatch, vertexIndicesX0, vertexIndicesY0, vertexIndicesZ0); | ||||
| 		} | ||||
|  | ||||
| 		for(boost::uint32_t uSlice = 1; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH) && (uSlice + offset.getZ() <= regVolume.getUpperCorner().getZ())); uSlice += uStepSize) | ||||
| 		for(std::uint32_t uSlice = 1; ((uSlice <= POLYVOX_REGION_SIDE_LENGTH) && (uSlice + offset.getZ() <= regVolume.getUpperCorner().getZ())); uSlice += uStepSize) | ||||
| 		{ | ||||
| 			Region regSlice1(regSlice0); | ||||
| 			regSlice1.shift(Vector3DInt32(0,0,uStepSize)); | ||||
|  | ||||
| 			boost::uint32_t uNoOfNonEmptyCellsForSlice1 = computeDecimatedBitmaskForSliceFromPrevious(volIter, uLevel, regSlice1, offset, bitmask1, bitmask0); | ||||
| 			std::uint32_t uNoOfNonEmptyCellsForSlice1 = computeDecimatedBitmaskForSliceFromPrevious(volIter, uLevel, regSlice1, offset, bitmask1, bitmask0); | ||||
|  | ||||
| 			if(uNoOfNonEmptyCellsForSlice1 != 0) | ||||
| 			{ | ||||
| @@ -110,10 +110,10 @@ namespace PolyVox | ||||
| 		}*/ | ||||
| 	} | ||||
|  | ||||
| 	boost::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel,  const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask) | ||||
| 	std::uint32_t computeInitialDecimatedBitmaskForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel,  const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask) | ||||
| 	{ | ||||
| 		const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel; | ||||
| 		boost::uint32_t uNoOfNonEmptyCells = 0; | ||||
| 		std::uint32_t uNoOfNonEmptyCells = 0; | ||||
|  | ||||
| 		//Iterate over each cell in the region | ||||
| 		for(uint16_t y = regSlice.getLowerCorner().getY(); y <= regSlice.getUpperCorner().getY(); y += uStepSize) | ||||
| @@ -279,10 +279,10 @@ namespace PolyVox | ||||
| 		return uNoOfNonEmptyCells; | ||||
| 	} | ||||
|  | ||||
| 	boost::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask) | ||||
| 	std::uint32_t computeDecimatedBitmaskForSliceFromPrevious(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, uint8_t* previousBitmask) | ||||
| 	{ | ||||
| 		const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel; | ||||
| 		boost::uint32_t uNoOfNonEmptyCells = 0; | ||||
| 		std::uint32_t uNoOfNonEmptyCells = 0; | ||||
|  | ||||
| 		//Iterate over each cell in the region | ||||
| 		for(uint16_t y = regSlice.getLowerCorner().getY(); y <= regSlice.getUpperCorner().getY(); y += uStepSize) | ||||
| @@ -405,7 +405,7 @@ namespace PolyVox | ||||
| 		return uNoOfNonEmptyCells; | ||||
| 	} | ||||
|  | ||||
| 	void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,boost::int32_t vertexIndicesX[],boost::int32_t vertexIndicesY[],boost::int32_t vertexIndicesZ[]) | ||||
| 	void generateDecimatedVerticesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, Region& regSlice, const Vector3DFloat& offset, uint8_t* bitmask, IndexedSurfacePatch* singleMaterialPatch,std::int32_t vertexIndicesX[],std::int32_t vertexIndicesY[],std::int32_t vertexIndicesZ[]) | ||||
| 	{ | ||||
| 		const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel; | ||||
|  | ||||
| @@ -476,10 +476,10 @@ namespace PolyVox | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, boost::int32_t vertexIndicesX0[],boost::int32_t vertexIndicesY0[],boost::int32_t vertexIndicesZ0[], boost::int32_t vertexIndicesX1[],boost::int32_t vertexIndicesY1[],boost::int32_t vertexIndicesZ1[]) | ||||
| 	void generateDecimatedIndicesForSlice(BlockVolumeIterator<uint8_t>& volIter, uint8_t uLevel, const Region& regSlice, IndexedSurfacePatch* singleMaterialPatch, const Vector3DFloat& offset, uint8_t* bitmask0, uint8_t* bitmask1, std::int32_t vertexIndicesX0[],std::int32_t vertexIndicesY0[],std::int32_t vertexIndicesZ0[], std::int32_t vertexIndicesX1[],std::int32_t vertexIndicesY1[],std::int32_t vertexIndicesZ1[]) | ||||
| 	{ | ||||
| 		const uint8_t uStepSize = uLevel == 0 ? 1 : 1 << uLevel; | ||||
| 		boost::uint32_t indlist[12]; | ||||
| 		std::uint32_t indlist[12]; | ||||
|  | ||||
| 		for(uint16_t y = regSlice.getLowerCorner().getY() - offset.getY(); y < regSlice.getUpperCorner().getY() - offset.getY(); y += uStepSize) | ||||
| 		{ | ||||
| @@ -561,9 +561,9 @@ namespace PolyVox | ||||
|  | ||||
| 				for (int i=0;triTable[iCubeIndex][i]!=-1;i+=3) | ||||
| 				{ | ||||
| 					boost::uint32_t ind0 = indlist[triTable[iCubeIndex][i  ]]; | ||||
| 					boost::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]]; | ||||
| 					boost::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]]; | ||||
| 					std::uint32_t ind0 = indlist[triTable[iCubeIndex][i  ]]; | ||||
| 					std::uint32_t ind1 = indlist[triTable[iCubeIndex][i+1]]; | ||||
| 					std::uint32_t ind2 = indlist[triTable[iCubeIndex][i+2]]; | ||||
|  | ||||
| 					singleMaterialPatch->m_vecTriangleIndices.push_back(ind0); | ||||
| 					singleMaterialPatch->m_vecTriangleIndices.push_back(ind1); | ||||
| @@ -588,7 +588,7 @@ namespace PolyVox | ||||
| 		Vector3DFloat vertlist[12]; | ||||
| 		Vector3DFloat normlist[12]; | ||||
| 		uint8_t vertMaterials[12]; | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); | ||||
| 		volIter.setValidRegion(region); | ||||
|  | ||||
| 		////////////////////////////////////////////////////////////////////////// | ||||
| @@ -817,7 +817,7 @@ namespace PolyVox | ||||
|  | ||||
| 		Vector3DFloat result; | ||||
|  | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create? | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); //FIXME - save this somewhere - could be expensive to create? | ||||
|  | ||||
|  | ||||
| 		if(normalGenerationMethod == SOBEL) | ||||
|   | ||||
| @@ -27,21 +27,21 @@ namespace PolyVox | ||||
| { | ||||
| 	//Note: this function only works for inputs which are a power of two and not zero | ||||
| 	//If this is not the case then the output is undefined. | ||||
| 	boost::uint8_t logBase2(boost::uint32_t uInput) | ||||
| 	std::uint8_t logBase2(std::uint32_t uInput) | ||||
| 	{ | ||||
| 		assert(uInput != 0); | ||||
| 		assert(isPowerOf2(uInput)); | ||||
|  | ||||
| 		boost::uint32_t uResult = 0; | ||||
| 		std::uint32_t uResult = 0; | ||||
| 		while( (uInput >> uResult) != 0) | ||||
| 		{ | ||||
| 			++uResult; | ||||
| 		} | ||||
| 		return static_cast<boost::uint8_t>(uResult-1); | ||||
| 		return static_cast<std::uint8_t>(uResult-1); | ||||
| 	} | ||||
|  | ||||
|  | ||||
| 	bool isPowerOf2(boost::uint32_t uInput) | ||||
| 	bool isPowerOf2(std::uint32_t uInput) | ||||
| 	{ | ||||
| 		if(uInput == 0) | ||||
| 			return false; | ||||
|   | ||||
| @@ -32,7 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. | ||||
| #include "BlockVolume.h" | ||||
| #include "BlockVolumeIterator.h" | ||||
|  | ||||
| using namespace boost; | ||||
| using namespace std; | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| @@ -50,7 +50,7 @@ namespace PolyVox | ||||
| 	{ | ||||
| 	} | ||||
|  | ||||
| 	void VolumeChangeTracker::setVolumeData(BlockVolume<boost::uint8_t>* volumeDataToSet) | ||||
| 	void VolumeChangeTracker::setVolumeData(BlockVolume<std::uint8_t>* volumeDataToSet) | ||||
| 	{ | ||||
| 		volumeData = volumeDataToSet; | ||||
| 		volRegionUpToDate = new LinearVolume<bool>(PolyVox::logBase2(POLYVOX_VOLUME_SIDE_LENGTH_IN_REGIONS)); | ||||
| @@ -124,20 +124,20 @@ namespace PolyVox | ||||
| 		assert(uY < volumeData->getSideLength()); | ||||
| 		assert(uZ < volumeData->getSideLength()); | ||||
|  | ||||
| 		BlockVolumeIterator<boost::uint8_t> volIter(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> volIter(*volumeData); | ||||
| 		volIter.setPosition(uX,uY,uZ); | ||||
| 		return volIter.getVoxel(); | ||||
| 	} | ||||
|  | ||||
| 	BlockVolume<boost::uint8_t>* VolumeChangeTracker::getVolumeData(void) const | ||||
| 	BlockVolume<std::uint8_t>* VolumeChangeTracker::getVolumeData(void) const | ||||
| 	{ | ||||
| 		return volumeData; | ||||
| 	} | ||||
|  | ||||
| 	void VolumeChangeTracker::setVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value) | ||||
| 	void VolumeChangeTracker::setVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value) | ||||
| 	{ | ||||
| 		//FIXME - rather than creating a iterator each time we should have one stored | ||||
| 		BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> iterVol(*volumeData); | ||||
| 		iterVol.setPosition(x,y,z); | ||||
| 		iterVol.setVoxel(value); | ||||
| 		 | ||||
| @@ -178,12 +178,12 @@ namespace PolyVox | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	void VolumeChangeTracker::setLockedVoxelAt(boost::uint16_t x, boost::uint16_t y, boost::uint16_t z, boost::uint8_t value) | ||||
| 	void VolumeChangeTracker::setLockedVoxelAt(std::uint16_t x, std::uint16_t y, std::uint16_t z, std::uint8_t value) | ||||
| 	{ | ||||
| 		assert(m_bIsLocked); | ||||
|  | ||||
| 		//FIXME - rather than creating a iterator each time we should have one stored | ||||
| 		BlockVolumeIterator<boost::uint8_t> iterVol(*volumeData); | ||||
| 		BlockVolumeIterator<std::uint8_t> iterVol(*volumeData); | ||||
| 		iterVol.setPosition(x,y,z); | ||||
| 		iterVol.setVoxel(value); | ||||
| 	} | ||||
|   | ||||
| @@ -4,7 +4,7 @@ | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	float computeSmoothedVoxel(BlockVolumeIterator<boost::uint8_t>& volIter) | ||||
| 	float computeSmoothedVoxel(BlockVolumeIterator<std::uint8_t>& volIter) | ||||
| 	{ | ||||
| 		assert(volIter.getPosX() >= 1); | ||||
| 		assert(volIter.getPosY() >= 1); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user