Merge branch 'feature/wrap-modes' into develop
This commit is contained in:
		| @@ -29,6 +29,7 @@ freely, subject to the following restrictions: | |||||||
| #include "PolyVoxForwardDeclarations.h" | #include "PolyVoxForwardDeclarations.h" | ||||||
|  |  | ||||||
| #include "PolyVoxCore/Array.h" | #include "PolyVoxCore/Array.h" | ||||||
|  | #include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these? | ||||||
| #include "PolyVoxCore/DefaultIsQuadNeeded.h" | #include "PolyVoxCore/DefaultIsQuadNeeded.h" | ||||||
| #include "PolyVoxCore/SurfaceMesh.h" | #include "PolyVoxCore/SurfaceMesh.h" | ||||||
|  |  | ||||||
| @@ -109,7 +110,7 @@ namespace PolyVox | |||||||
| 		}; | 		}; | ||||||
|  |  | ||||||
| 	public: | 	public: | ||||||
| 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial>* result, bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
|  |  | ||||||
|  |  | ||||||
| 		void execute();		 | 		void execute();		 | ||||||
| @@ -145,6 +146,10 @@ namespace PolyVox | |||||||
| 		//This constant defines the maximum number of quads which can share a | 		//This constant defines the maximum number of quads which can share a | ||||||
| 		//vertex in a cubic style mesh. See the initialisation for more details. | 		//vertex in a cubic style mesh. See the initialisation for more details. | ||||||
| 		static const uint32_t MaxVerticesPerPosition; | 		static const uint32_t MaxVerticesPerPosition; | ||||||
|  |  | ||||||
|  | 		//The wrap mode | ||||||
|  | 		WrapMode m_eWrapMode; | ||||||
|  | 		typename VolumeType::VoxelType m_tBorderValue; | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -35,11 +35,13 @@ namespace PolyVox | |||||||
| 	const uint32_t CubicSurfaceExtractor<VolumeType, IsQuadNeeded>::MaxVerticesPerPosition = 6; | 	const uint32_t CubicSurfaceExtractor<VolumeType, IsQuadNeeded>::MaxVerticesPerPosition = 6; | ||||||
|  |  | ||||||
| 	template<typename VolumeType, typename IsQuadNeeded> | 	template<typename VolumeType, typename IsQuadNeeded> | ||||||
| 	CubicSurfaceExtractor<VolumeType, IsQuadNeeded>::CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial>* result, bool bMergeQuads, IsQuadNeeded isQuadNeeded) | 	CubicSurfaceExtractor<VolumeType, IsQuadNeeded>::CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial>* result, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, bool bMergeQuads, IsQuadNeeded isQuadNeeded) | ||||||
| 		:m_volData(volData) | 		:m_volData(volData) | ||||||
| 		,m_regSizeInVoxels(region) | 		,m_regSizeInVoxels(region) | ||||||
| 		,m_meshCurrent(result) | 		,m_meshCurrent(result) | ||||||
| 		,m_bMergeQuads(bMergeQuads) | 		,m_bMergeQuads(bMergeQuads) | ||||||
|  | 		,m_eWrapMode(eWrapMode) | ||||||
|  | 		,m_tBorderValue(tBorderValue) | ||||||
| 	{ | 	{ | ||||||
| 		m_funcIsQuadNeededCallback = isQuadNeeded; | 		m_funcIsQuadNeededCallback = isQuadNeeded; | ||||||
| 	} | 	} | ||||||
| @@ -68,6 +70,7 @@ namespace PolyVox | |||||||
| 		m_vecQuads[PositiveZ].resize(m_regSizeInVoxels.getUpperCorner().getZ() - m_regSizeInVoxels.getLowerCorner().getZ() + 2); | 		m_vecQuads[PositiveZ].resize(m_regSizeInVoxels.getUpperCorner().getZ() - m_regSizeInVoxels.getLowerCorner().getZ() + 2); | ||||||
|  |  | ||||||
| 		typename VolumeType::Sampler volumeSampler(m_volData);	 | 		typename VolumeType::Sampler volumeSampler(m_volData);	 | ||||||
|  | 		volumeSampler.setWrapMode(m_eWrapMode, m_tBorderValue); | ||||||
| 		 | 		 | ||||||
| 		for(int32_t z = m_regSizeInVoxels.getLowerCorner().getZ(); z <= m_regSizeInVoxels.getUpperCorner().getZ(); z++) | 		for(int32_t z = m_regSizeInVoxels.getLowerCorner().getZ(); z <= m_regSizeInVoxels.getUpperCorner().getZ(); z++) | ||||||
| 		{ | 		{ | ||||||
|   | |||||||
| @@ -27,6 +27,7 @@ freely, subject to the following restrictions: | |||||||
| #include "PolyVoxCore/DefaultIsQuadNeeded.h" | #include "PolyVoxCore/DefaultIsQuadNeeded.h" | ||||||
|  |  | ||||||
| #include "PolyVoxCore/Array.h" | #include "PolyVoxCore/Array.h" | ||||||
|  | #include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these? | ||||||
| #include "PolyVoxCore/SurfaceMesh.h" | #include "PolyVoxCore/SurfaceMesh.h" | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| @@ -35,7 +36,7 @@ namespace PolyVox | |||||||
| 	class CubicSurfaceExtractorWithNormals | 	class CubicSurfaceExtractorWithNormals | ||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
|  |  | ||||||
| 		void execute(); | 		void execute(); | ||||||
|  |  | ||||||
| @@ -51,6 +52,10 @@ namespace PolyVox | |||||||
|  |  | ||||||
| 		//Information about the region we are currently processing | 		//Information about the region we are currently processing | ||||||
| 		Region m_regSizeInVoxels; | 		Region m_regSizeInVoxels; | ||||||
|  |  | ||||||
|  | 		//The wrap mode | ||||||
|  | 		WrapMode m_eWrapMode; | ||||||
|  | 		typename VolumeType::VoxelType m_tBorderValue; | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,11 +24,13 @@ freely, subject to the following restrictions: | |||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	template<typename VolumeType, typename IsQuadNeeded> | 	template<typename VolumeType, typename IsQuadNeeded> | ||||||
| 	CubicSurfaceExtractorWithNormals<VolumeType, IsQuadNeeded>::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, IsQuadNeeded isQuadNeeded) | 	CubicSurfaceExtractorWithNormals<VolumeType, IsQuadNeeded>::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, IsQuadNeeded isQuadNeeded) | ||||||
| 		:m_volData(volData) | 		:m_volData(volData) | ||||||
| 		,m_sampVolume(volData) | 		,m_sampVolume(volData) | ||||||
| 		,m_meshCurrent(result) | 		,m_meshCurrent(result) | ||||||
| 		,m_regSizeInVoxels(region) | 		,m_regSizeInVoxels(region) | ||||||
|  | 		,m_eWrapMode(eWrapMode) | ||||||
|  | 		,m_tBorderValue(tBorderValue) | ||||||
| 	{		 | 	{		 | ||||||
| 		m_funcIsQuadNeededCallback = isQuadNeeded; | 		m_funcIsQuadNeededCallback = isQuadNeeded; | ||||||
| 	} | 	} | ||||||
| @@ -51,7 +53,7 @@ namespace PolyVox | |||||||
|  |  | ||||||
| 					uint32_t material = 0; | 					uint32_t material = 0; | ||||||
|  |  | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x,y,z), m_volData->getVoxelAt(x+1,y,z), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x+1,y,z,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(1.0f, 0.0f, 0.0f), static_cast<float>(material))); | ||||||
| @@ -61,7 +63,7 @@ namespace PolyVox | |||||||
| 						m_meshCurrent->addTriangleCubic(v0,v2,v1); | 						m_meshCurrent->addTriangleCubic(v0,v2,v1); | ||||||
| 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | ||||||
| 					} | 					} | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x+1,y,z), m_volData->getVoxelAt(x,y,z), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x+1,y,z,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ - 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX + 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(-1.0f, 0.0f, 0.0f), static_cast<float>(material))); | ||||||
| @@ -72,7 +74,7 @@ namespace PolyVox | |||||||
| 						m_meshCurrent->addTriangleCubic(v1,v3,v2); | 						m_meshCurrent->addTriangleCubic(v1,v3,v2); | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x,y,z), m_volData->getVoxelAt(x,y+1,z), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x,y+1,z,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 1.0f, 0.0f), static_cast<float>(material))); | ||||||
| @@ -82,7 +84,7 @@ namespace PolyVox | |||||||
| 						m_meshCurrent->addTriangleCubic(v0,v1,v2); | 						m_meshCurrent->addTriangleCubic(v0,v1,v2); | ||||||
| 						m_meshCurrent->addTriangleCubic(v1,v3,v2); | 						m_meshCurrent->addTriangleCubic(v1,v3,v2); | ||||||
| 					} | 					} | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x,y+1,z), m_volData->getVoxelAt(x,y,z), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x,y+1,z,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ - 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, -1.0f, 0.0f), static_cast<float>(material))); | ||||||
| @@ -93,7 +95,7 @@ namespace PolyVox | |||||||
| 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | ||||||
| 					} | 					} | ||||||
|  |  | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x,y,z), m_volData->getVoxelAt(x,y,z+1), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x,y,z+1,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, 1.0f), static_cast<float>(material))); | ||||||
| @@ -103,7 +105,7 @@ namespace PolyVox | |||||||
| 						m_meshCurrent->addTriangleCubic(v0,v2,v1); | 						m_meshCurrent->addTriangleCubic(v0,v2,v1); | ||||||
| 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | 						m_meshCurrent->addTriangleCubic(v1,v2,v3); | ||||||
| 					} | 					} | ||||||
| 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelAt(x,y,z+1), m_volData->getVoxelAt(x,y,z), material)) | 					if(m_funcIsQuadNeededCallback(m_volData->getVoxelWithWrapping(x,y,z+1,m_eWrapMode,m_tBorderValue), m_volData->getVoxelWithWrapping(x,y,z,m_eWrapMode,m_tBorderValue), material)) | ||||||
| 					{ | 					{ | ||||||
| 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), static_cast<float>(material))); | 						uint32_t v0 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY - 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), static_cast<float>(material))); | ||||||
| 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), static_cast<float>(material))); | 						uint32_t v1 = m_meshCurrent->addVertex(PositionMaterialNormal(Vector3DFloat(regX - 0.5f, regY + 0.5f, regZ + 0.5f), Vector3DFloat(0.0f, 0.0f, -1.0f), static_cast<float>(material))); | ||||||
|   | |||||||
| @@ -78,8 +78,6 @@ namespace PolyVox | |||||||
| 		 */ | 		 */ | ||||||
| 		DefaultMarchingCubesController(void) | 		DefaultMarchingCubesController(void) | ||||||
| 			:m_tThreshold(((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2) | 			:m_tThreshold(((std::numeric_limits<DensityType>::min)() + (std::numeric_limits<DensityType>::max)()) / 2) | ||||||
| 			,m_eWrapMode(WrapModes::Border) |  | ||||||
| 			,m_tBorder(VoxelType(0)) |  | ||||||
| 		{			 | 		{			 | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| @@ -105,11 +103,6 @@ namespace PolyVox | |||||||
| 			return 1; | 			return 1; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		VoxelType getBorderValue(void) |  | ||||||
| 		{ |  | ||||||
| 			return m_tBorder; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		/** | 		/** | ||||||
| 		 * Returns the density value which was passed to the constructor. | 		 * Returns the density value which was passed to the constructor. | ||||||
| 		 * | 		 * | ||||||
| @@ -122,26 +115,13 @@ namespace PolyVox | |||||||
| 			return m_tThreshold; | 			return m_tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		WrapMode getWrapMode(void) |  | ||||||
| 		{ |  | ||||||
| 			return m_eWrapMode; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		void setThreshold(DensityType tThreshold) | 		void setThreshold(DensityType tThreshold) | ||||||
| 		{ | 		{ | ||||||
| 			m_tThreshold = tThreshold; | 			m_tThreshold = tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		void setWrapMode(WrapMode eWrapMode, VoxelType tBorder = VoxelType(0)) |  | ||||||
| 		{ |  | ||||||
| 			m_eWrapMode = eWrapMode; |  | ||||||
| 			m_tBorder = tBorder; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 	private: | 	private: | ||||||
| 		DensityType m_tThreshold; | 		DensityType m_tThreshold; | ||||||
| 		WrapMode m_eWrapMode; |  | ||||||
| 		VoxelType m_tBorder; |  | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -155,13 +155,11 @@ namespace PolyVox | |||||||
| 		{ | 		{ | ||||||
| 			// Default to a threshold value halfway between the min and max possible values. | 			// Default to a threshold value halfway between the min and max possible values. | ||||||
| 			m_tThreshold = (Density<Type>::getMinDensity() + Density<Type>::getMaxDensity()) / 2; | 			m_tThreshold = (Density<Type>::getMinDensity() + Density<Type>::getMaxDensity()) / 2; | ||||||
| 			m_eWrapMode = WrapModes::Border; |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		DefaultMarchingCubesController(DensityType tThreshold) | 		DefaultMarchingCubesController(DensityType tThreshold) | ||||||
| 		{ | 		{ | ||||||
| 			m_tThreshold = tThreshold; | 			m_tThreshold = tThreshold; | ||||||
| 			m_eWrapMode = WrapModes::Border; |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		DensityType convertToDensity(Density<Type> voxel) | 		DensityType convertToDensity(Density<Type> voxel) | ||||||
| @@ -174,35 +172,18 @@ namespace PolyVox | |||||||
| 			return 1; | 			return 1; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		Density<Type> getBorderValue(void) |  | ||||||
| 		{ |  | ||||||
| 			return m_tBorder; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		DensityType getThreshold(void) | 		DensityType getThreshold(void) | ||||||
| 		{			 | 		{			 | ||||||
| 			return m_tThreshold; | 			return m_tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		WrapMode getWrapMode(void) |  | ||||||
| 		{ |  | ||||||
| 			return m_eWrapMode; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		void setThreshold(DensityType tThreshold) | 		void setThreshold(DensityType tThreshold) | ||||||
| 		{ | 		{ | ||||||
| 			m_tThreshold = tThreshold; | 			m_tThreshold = tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		void setWrapMode(WrapMode eWrapMode) |  | ||||||
| 		{ |  | ||||||
| 			m_eWrapMode = eWrapMode; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 	private: | 	private: | ||||||
| 		DensityType m_tThreshold; | 		DensityType m_tThreshold; | ||||||
| 		WrapMode m_eWrapMode; |  | ||||||
| 		Density<Type> m_tBorder; |  | ||||||
| 	}; | 	}; | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -21,10 +21,12 @@ freely, subject to the following restrictions: | |||||||
|     distribution. 	 |     distribution. 	 | ||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| #define BORDER_LOW(x) ((( x >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != x) | #define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| #define BORDER_HIGH(x) ((( (x+1) >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != (x+1)) | #define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| //#define BORDER_LOW(x) (( x % mVolume->m_uBlockSideLength) != 0) | #define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| //#define BORDER_HIGH(x) (( x % mVolume->m_uBlockSideLength) != mVolume->m_uBlockSideLength - 1) | #define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  | #define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  | #define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| @@ -280,7 +282,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -290,7 +292,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -300,7 +302,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -310,7 +312,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -320,7 +322,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1); | 			return *(mCurrentVoxel - 1); | ||||||
| 		} | 		} | ||||||
| @@ -330,7 +332,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -340,7 +342,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -350,7 +352,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -360,7 +362,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -372,7 +374,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -382,7 +384,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -392,7 +394,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -402,7 +404,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -422,7 +424,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -432,7 +434,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -442,7 +444,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -452,7 +454,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -464,7 +466,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -474,7 +476,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -484,7 +486,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -494,7 +496,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -504,7 +506,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1); | 			return *(mCurrentVoxel + 1); | ||||||
| 		} | 		} | ||||||
| @@ -514,7 +516,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -524,7 +526,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -534,7 +536,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -544,7 +546,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const | 	VoxelType LargeVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -552,5 +554,9 @@ namespace PolyVox | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| #undef BORDER_LOW | #undef CAN_GO_NEG_X | ||||||
| #undef BORDER_HIGH | #undef CAN_GO_POS_X | ||||||
|  | #undef CAN_GO_NEG_Y | ||||||
|  | #undef CAN_GO_POS_Y | ||||||
|  | #undef CAN_GO_NEG_Z | ||||||
|  | #undef CAN_GO_POS_Z | ||||||
|   | |||||||
| @@ -28,6 +28,7 @@ freely, subject to the following restrictions: | |||||||
| #include "Impl/TypeDef.h" | #include "Impl/TypeDef.h" | ||||||
|  |  | ||||||
| #include "PolyVoxCore/Array.h" | #include "PolyVoxCore/Array.h" | ||||||
|  | #include "PolyVoxCore/BaseVolume.h" //For wrap modes... should move these? | ||||||
| #include "PolyVoxCore/SurfaceMesh.h" | #include "PolyVoxCore/SurfaceMesh.h" | ||||||
| #include "PolyVoxCore/DefaultMarchingCubesController.h" | #include "PolyVoxCore/DefaultMarchingCubesController.h" | ||||||
|  |  | ||||||
| @@ -37,7 +38,7 @@ namespace PolyVox | |||||||
| 	class MarchingCubesSurfaceExtractor | 	class MarchingCubesSurfaceExtractor | ||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, Controller controller = Controller()); | 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), Controller controller = Controller()); | ||||||
|  |  | ||||||
| 		void execute(); | 		void execute(); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -24,7 +24,7 @@ freely, subject to the following restrictions: | |||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| 	template<typename VolumeType, typename Controller> | 	template<typename VolumeType, typename Controller> | ||||||
| 	MarchingCubesSurfaceExtractor<VolumeType, Controller>::MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, Controller controller) | 	MarchingCubesSurfaceExtractor<VolumeType, Controller>::MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode, typename VolumeType::VoxelType tBorderValue, Controller controller) | ||||||
| 		:m_volData(volData) | 		:m_volData(volData) | ||||||
| 		,m_sampVolume(volData) | 		,m_sampVolume(volData) | ||||||
| 		,m_meshCurrent(result) | 		,m_meshCurrent(result) | ||||||
| @@ -36,7 +36,7 @@ namespace PolyVox | |||||||
| 		m_regSizeInCells = m_regSizeInVoxels; | 		m_regSizeInCells = m_regSizeInVoxels; | ||||||
| 		m_regSizeInCells.setUpperCorner(m_regSizeInCells.getUpperCorner() - Vector3DInt32(1,1,1)); | 		m_regSizeInCells.setUpperCorner(m_regSizeInCells.getUpperCorner() - Vector3DInt32(1,1,1)); | ||||||
|  |  | ||||||
| 		m_sampVolume.setWrapMode(m_controller.getWrapMode(), m_controller.getBorderValue()); | 		m_sampVolume.setWrapMode(eWrapMode, tBorderValue); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	template<typename VolumeType, typename Controller> | 	template<typename VolumeType, typename Controller> | ||||||
|   | |||||||
| @@ -119,13 +119,11 @@ namespace PolyVox | |||||||
| 		{ | 		{ | ||||||
| 			// Default to a threshold value halfway between the min and max possible values. | 			// Default to a threshold value halfway between the min and max possible values. | ||||||
| 			m_tThreshold = (MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMinDensity() + MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMaxDensity()) / 2; | 			m_tThreshold = (MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMinDensity() + MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits>::getMaxDensity()) / 2; | ||||||
| 			m_eWrapMode = WrapModes::Border; |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		DefaultMarchingCubesController(DensityType tThreshold) | 		DefaultMarchingCubesController(DensityType tThreshold) | ||||||
| 		{ | 		{ | ||||||
| 			m_tThreshold = tThreshold; | 			m_tThreshold = tThreshold; | ||||||
| 			m_eWrapMode = WrapModes::Border; |  | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		DensityType convertToDensity(MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits> voxel) | 		DensityType convertToDensity(MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits> voxel) | ||||||
| @@ -148,25 +146,13 @@ namespace PolyVox | |||||||
| 			return m_tThreshold; | 			return m_tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		WrapMode getWrapMode(void) |  | ||||||
| 		{ |  | ||||||
| 			return m_eWrapMode; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 		void setThreshold(DensityType tThreshold) | 		void setThreshold(DensityType tThreshold) | ||||||
| 		{ | 		{ | ||||||
| 			m_tThreshold = tThreshold; | 			m_tThreshold = tThreshold; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
| 		void setWrapMode(WrapMode eWrapMode) |  | ||||||
| 		{ |  | ||||||
| 			m_eWrapMode = eWrapMode; |  | ||||||
| 		} |  | ||||||
|  |  | ||||||
| 	private: | 	private: | ||||||
| 		DensityType m_tThreshold; | 		DensityType m_tThreshold; | ||||||
| 		WrapMode m_eWrapMode; |  | ||||||
| 		MaterialDensityPair<Type, NoOfMaterialBits, NoOfDensityBits> m_tBorder; |  | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
| 	typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44; | 	typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44; | ||||||
|   | |||||||
| @@ -21,10 +21,12 @@ freely, subject to the following restrictions: | |||||||
|     distribution. 	 |     distribution. 	 | ||||||
| *******************************************************************************/ | *******************************************************************************/ | ||||||
|  |  | ||||||
| #define BORDER_LOW(x) ((( x >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != x) | #define CAN_GO_NEG_X(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getX()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| #define BORDER_HIGH(x) ((( (x+1) >> this->mVolume->m_uBlockSideLengthPower) << this->mVolume->m_uBlockSideLengthPower) != (x+1)) | #define CAN_GO_POS_X(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getX()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| //#define BORDER_LOW(x) (( x % this->mVolume->m_uBlockSideLength) != 0) | #define CAN_GO_NEG_Y(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getY()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
| //#define BORDER_HIGH(x) (( x % this->mVolume->m_uBlockSideLength) != this->mVolume->m_uBlockSideLength - 1) | #define CAN_GO_POS_Y(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getY()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  | #define CAN_GO_NEG_Z(val) ((val > this->mVolume->getEnclosingRegion().getLowerCorner().getZ()) && (val % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  | #define CAN_GO_POS_Z(val) ((val < this->mVolume->getEnclosingRegion().getUpperCorner().getZ()) && ((val + 1) % this->mVolume->m_uBlockSideLength != 0)) | ||||||
|  |  | ||||||
| namespace PolyVox | namespace PolyVox | ||||||
| { | { | ||||||
| @@ -299,7 +301,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -309,7 +311,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -319,7 +321,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -329,7 +331,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && 	BORDER_LOW(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -339,7 +341,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1); | 			return *(mCurrentVoxel - 1); | ||||||
| 		} | 		} | ||||||
| @@ -349,7 +351,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -359,7 +361,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -369,7 +371,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -379,7 +381,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1nx1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -391,7 +393,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -401,7 +403,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -411,7 +413,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -421,7 +423,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) &&  BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -441,7 +443,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -451,7 +453,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -461,7 +463,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -471,7 +473,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel0px1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -483,7 +485,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -493,7 +495,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -503,7 +505,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1ny1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -513,7 +515,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -523,7 +525,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1); | 			return *(mCurrentVoxel + 1); | ||||||
| 		} | 		} | ||||||
| @@ -533,7 +535,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px0py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -543,7 +545,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py1nz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_LOW(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_NEG_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength - this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -553,7 +555,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py0pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -563,7 +565,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const | 	VoxelType SimpleVolume<VoxelType>::Sampler::peekVoxel1px1py1pz(void) const | ||||||
| 	{ | 	{ | ||||||
| 		if((this->isCurrentPositionValid()) && BORDER_HIGH(this->mXPosInVolume) && BORDER_HIGH(this->mYPosInVolume) && BORDER_HIGH(this->mZPosInVolume) ) | 		if((this->isCurrentPositionValid()) && CAN_GO_POS_X(this->mXPosInVolume) && CAN_GO_POS_Y(this->mYPosInVolume) && CAN_GO_POS_Z(this->mZPosInVolume) ) | ||||||
| 		{ | 		{ | ||||||
| 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | 			return *(mCurrentVoxel + 1 + this->mVolume->m_uBlockSideLength + this->mVolume->m_uBlockSideLength*this->mVolume->m_uBlockSideLength); | ||||||
| 		} | 		} | ||||||
| @@ -571,5 +573,9 @@ namespace PolyVox | |||||||
| 	} | 	} | ||||||
| } | } | ||||||
|  |  | ||||||
| #undef BORDER_LOW | #undef CAN_GO_NEG_X | ||||||
| #undef BORDER_HIGH | #undef CAN_GO_POS_X | ||||||
|  | #undef CAN_GO_NEG_Y | ||||||
|  | #undef CAN_GO_POS_Y | ||||||
|  | #undef CAN_GO_NEG_Z | ||||||
|  | #undef CAN_GO_POS_Z | ||||||
|   | |||||||
| @@ -59,16 +59,6 @@ public: | |||||||
| 	{ | 	{ | ||||||
| 		return 50.0f; | 		return 50.0f; | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	WrapMode getWrapMode(void) |  | ||||||
| 	{ |  | ||||||
| 		return WrapModes::Border; |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	float getBorderValue(void) |  | ||||||
| 	{ |  | ||||||
| 		return 0.0f; |  | ||||||
| 	} |  | ||||||
| }; | }; | ||||||
|  |  | ||||||
| // These 'writeDensityValueToVoxel' functions provide a unified interface for writting densities to primative and class voxel types. | // These 'writeDensityValueToVoxel' functions provide a unified interface for writting densities to primative and class voxel types. | ||||||
| @@ -132,7 +122,7 @@ void testForType(SurfaceMesh<PositionMaterialNormal>& result) | |||||||
|  |  | ||||||
| 	DefaultMarchingCubesController<VoxelType> controller; | 	DefaultMarchingCubesController<VoxelType> controller; | ||||||
| 	controller.setThreshold(50); | 	controller.setThreshold(50); | ||||||
| 	MarchingCubesSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result, controller); | 	MarchingCubesSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result, WrapModes::Border, 0, controller); | ||||||
| 	extractor.execute(); | 	extractor.execute(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -156,7 +146,7 @@ void testCustomController(SurfaceMesh<PositionMaterialNormal>& result) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	CustomMarchingCubesController controller; | 	CustomMarchingCubesController controller; | ||||||
| 	MarchingCubesSurfaceExtractor< SimpleVolume<float>, CustomMarchingCubesController > extractor(&volData, volData.getEnclosingRegion(), &result, controller); | 	MarchingCubesSurfaceExtractor< SimpleVolume<float>, CustomMarchingCubesController > extractor(&volData, volData.getEnclosingRegion(), &result, WrapModes::Border, 0, controller); | ||||||
| 	extractor.execute(); | 	extractor.execute(); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -321,33 +321,33 @@ void TestVolume::testSimpleVolumeDirectAccess() | |||||||
|  |  | ||||||
| void TestVolume::testSimpleVolumeSamplers() | void TestVolume::testSimpleVolumeSamplers() | ||||||
| { | { | ||||||
| 	/*int32_t result = 0; | 	int32_t result = 0; | ||||||
| 	QBENCHMARK | 	QBENCHMARK | ||||||
| 	{ | 	{ | ||||||
| 		result = testSamplersWithWrapping(m_pSimpleVolume); | 		result = testSamplersWithWrapping(m_pSimpleVolume); | ||||||
| 	} | 	} | ||||||
| 	QCOMPARE(result, static_cast<int32_t>(-601818385)); //FXME - Wrong value?!*/ | 	QCOMPARE(result, static_cast<int32_t>(-928601007)); | ||||||
| } | } | ||||||
|  |  | ||||||
| void TestVolume::testLargeVolumeDirectAccess() | void TestVolume::testLargeVolumeDirectAccess() | ||||||
| { | { | ||||||
| 	/*int32_t result = 0; | 	int32_t result = 0; | ||||||
| 	QBENCHMARK | 	QBENCHMARK | ||||||
| 	{ | 	{ | ||||||
| 		result = testDirectAccessWithWrapping(m_pLargeVolume); | 		result = testDirectAccessWithWrapping(m_pLargeVolume); | ||||||
| 	} | 	} | ||||||
| 	QCOMPARE(result, static_cast<int32_t>(-601818385)); //FXME - Wrong value?!*/ | 	QCOMPARE(result, static_cast<int32_t>(-928601007)); | ||||||
| } | } | ||||||
|  |  | ||||||
| void TestVolume::testLargeVolumeSamplers() | void TestVolume::testLargeVolumeSamplers() | ||||||
| { | { | ||||||
| 	int32_t result = 0; | 	int32_t result = 0; | ||||||
| 	 | 	 | ||||||
| 	/*QBENCHMARK | 	QBENCHMARK | ||||||
| 	{ | 	{ | ||||||
| 		result = testSamplersWithWrapping(m_pLargeVolume); | 		result = testSamplersWithWrapping(m_pLargeVolume); | ||||||
| 	} | 	} | ||||||
| 	QCOMPARE(result, static_cast<int32_t>(-601818385)); //FXME - Wrong value?!*/ | 	QCOMPARE(result, static_cast<int32_t>(-928601007)); | ||||||
| } | } | ||||||
|  |  | ||||||
| QTEST_MAIN(TestVolume) | QTEST_MAIN(TestVolume) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user