Merge branch 'develop' into feature/cubiquity-version
Conflicts: library/PolyVoxCore/include/PolyVoxCore/CubicSurfaceExtractor.h library/PolyVoxCore/include/PolyVoxCore/MarchingCubesSurfaceExtractor.h
This commit is contained in:
		| @@ -69,7 +69,7 @@ namespace PolyVox | |||||||
| 			void setPosition(const Vector3DInt32& v3dNewPos); | 			void setPosition(const Vector3DInt32& v3dNewPos); | ||||||
| 			void setPosition(int32_t xPos, int32_t yPos, int32_t zPos); | 			void setPosition(int32_t xPos, int32_t yPos, int32_t zPos); | ||||||
| 			inline bool setVoxel(VoxelType tValue); | 			inline bool setVoxel(VoxelType tValue); | ||||||
| 			void setWrapMode(WrapMode eWrapMode, VoxelType tBorder = VoxelType(0)); | 			void setWrapMode(WrapMode eWrapMode, VoxelType tBorder = VoxelType()); | ||||||
|  |  | ||||||
| 			void movePositiveX(void); | 			void movePositiveX(void); | ||||||
| 			void movePositiveY(void); | 			void movePositiveY(void); | ||||||
| @@ -156,9 +156,9 @@ namespace PolyVox | |||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | ||||||
| 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
|  |  | ||||||
| 		/// Sets the value used for voxels which are outside the volume | 		/// Sets the value used for voxels which are outside the volume | ||||||
| 		void setBorderValue(const VoxelType& tBorder); | 		void setBorderValue(const VoxelType& tBorder); | ||||||
|   | |||||||
| @@ -31,7 +31,7 @@ namespace PolyVox | |||||||
| 	template <typename VoxelType> | 	template <typename VoxelType> | ||||||
| 	BaseVolume<VoxelType>::BaseVolume(const Region& regValid) | 	BaseVolume<VoxelType>::BaseVolume(const Region& regValid) | ||||||
| 		:m_regValidRegion(regValid) | 		:m_regValidRegion(regValid) | ||||||
| 		,m_tBorderValue(0) | 		,m_tBorderValue() | ||||||
| 	{ | 	{ | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|   | |||||||
| @@ -33,7 +33,7 @@ namespace PolyVox | |||||||
| 		,mYPosInVolume(0) | 		,mYPosInVolume(0) | ||||||
| 		,mZPosInVolume(0) | 		,mZPosInVolume(0) | ||||||
| 		,m_eWrapMode(WrapModes::Border) | 		,m_eWrapMode(WrapModes::Border) | ||||||
| 		,m_tBorder(0) | 		,m_tBorder() | ||||||
| 		,m_bIsCurrentPositionValidInX(false) | 		,m_bIsCurrentPositionValidInX(false) | ||||||
| 		,m_bIsCurrentPositionValidInY(false) | 		,m_bIsCurrentPositionValidInY(false) | ||||||
| 		,m_bIsCurrentPositionValidInZ(false) | 		,m_bIsCurrentPositionValidInZ(false) | ||||||
| @@ -376,7 +376,7 @@ namespace PolyVox | |||||||
| 				{ | 				{ | ||||||
| 					//Should never happen | 					//Should never happen | ||||||
| 					POLYVOX_ASSERT(false, "Invalid case."); | 					POLYVOX_ASSERT(false, "Invalid case."); | ||||||
| 					return VoxelType(0); | 					return VoxelType(); | ||||||
| 				} | 				} | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -113,9 +113,9 @@ namespace PolyVox | |||||||
| 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | ||||||
| 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
| 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial<typename VolumeType::VoxelType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial<typename VolumeType::VoxelType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
| #else | #else | ||||||
| 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial<typename VolumeType::VoxelType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(0), bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterial<typename VolumeType::VoxelType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), bool bMergeQuads = true, IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 		void execute();		 | 		void execute();		 | ||||||
|   | |||||||
| @@ -39,9 +39,9 @@ namespace PolyVox | |||||||
| 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | ||||||
| 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
| 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
| #else | #else | ||||||
| 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(0), IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), IsQuadNeeded isQuadNeeded = IsQuadNeeded()); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 		void execute(); | 		void execute(); | ||||||
|   | |||||||
| @@ -39,9 +39,6 @@ namespace PolyVox | |||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
| 	/// Detailed description... | 	/// Detailed description... | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
|  |  | ||||||
| 	// int32_t template parameter is a dummy, required as the compiler expects to be able to declare an |  | ||||||
| 	// instance of VoxelType::MaterialType without knowing that VoxelType doesn't actually have a material. |  | ||||||
| 	template <typename Type> | 	template <typename Type> | ||||||
| 	class Density | 	class Density | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -275,9 +275,9 @@ namespace PolyVox | |||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | ||||||
| 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
|  |  | ||||||
| 		/// Sets the number of blocks for which uncompressed data is stored | 		/// Sets the number of blocks for which uncompressed data is stored | ||||||
| 		void setMaxNumberOfUncompressedBlocks(uint32_t uMaxNumberOfUncompressedBlocks); | 		void setMaxNumberOfUncompressedBlocks(uint32_t uMaxNumberOfUncompressedBlocks); | ||||||
|   | |||||||
| @@ -229,7 +229,7 @@ namespace PolyVox | |||||||
| 			{ | 			{ | ||||||
| 				//Should never happen | 				//Should never happen | ||||||
| 				POLYVOX_ASSERT(false, "Invlaid case."); | 				POLYVOX_ASSERT(false, "Invlaid case."); | ||||||
| 				return VoxelType(0); | 				return VoxelType(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -41,9 +41,9 @@ namespace PolyVox | |||||||
| 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | 		// This is a bit ugly - it seems that the C++03 syntax is different from the C++11 syntax? See this thread: http://stackoverflow.com/questions/6076015/typename-outside-of-template | ||||||
| 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | 		// Long term we should probably come back to this and if the #ifdef is still needed then maybe it should check for C++11 mode instead of MSVC?  | ||||||
| #if defined(_MSC_VER) | #if defined(_MSC_VER) | ||||||
| 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal<typename Controller::MaterialType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(0), Controller controller = Controller()); | 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal<typename Controller::MaterialType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = VolumeType::VoxelType(), Controller controller = Controller()); | ||||||
| #else | #else | ||||||
| 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal<typename Controller::MaterialType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(0), Controller controller = Controller()); | 		MarchingCubesSurfaceExtractor(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal<typename Controller::MaterialType> >* result, WrapMode eWrapMode = WrapModes::Border, typename VolumeType::VoxelType tBorderValue = typename VolumeType::VoxelType(), Controller controller = Controller()); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| 		void execute(); | 		void execute(); | ||||||
|   | |||||||
| @@ -36,9 +36,6 @@ namespace PolyVox | |||||||
| 	/// | 	/// | ||||||
| 	/// \sa Density, MaterialDensityPair | 	/// \sa Density, MaterialDensityPair | ||||||
| 	//////////////////////////////////////////////////////////////////////////////// | 	//////////////////////////////////////////////////////////////////////////////// | ||||||
|  |  | ||||||
| 	// int32_t template parameter is a dummy, required as the compiler expects to be able to declare an |  | ||||||
| 	// instance of VoxelType::DensityType without knowing that VoxelType doesn't actually have a density. |  | ||||||
| 	template <typename Type> | 	template <typename Type> | ||||||
| 	class Material | 	class Material | ||||||
| 	{ | 	{ | ||||||
|   | |||||||
| @@ -42,10 +42,6 @@ namespace PolyVox | |||||||
| 	{ | 	{ | ||||||
| 	public: | 	public: | ||||||
| 		MaterialDensityPair() : m_uMaterial(0), m_uDensity(0) {} | 		MaterialDensityPair() : m_uMaterial(0), m_uDensity(0) {} | ||||||
|  |  | ||||||
| 		// FIXME - This is a bit odd... we need to allow the MaterialDensityPair to be initialised with a single integer |  | ||||||
| 		// because PolyVox often initialises voxels by calling VoxelType(0). Is there a better way we should handle this? |  | ||||||
| 		MaterialDensityPair(Type tValue) : m_uMaterial(tValue), m_uDensity(tValue) {} |  | ||||||
| 		MaterialDensityPair(Type uMaterial, Type uDensity) : m_uMaterial(uMaterial), m_uDensity(uDensity) {} | 		MaterialDensityPair(Type uMaterial, Type uDensity) : m_uMaterial(uMaterial), m_uDensity(uDensity) {} | ||||||
|  |  | ||||||
| 		bool operator==(const MaterialDensityPair& rhs) const | 		bool operator==(const MaterialDensityPair& rhs) const | ||||||
|   | |||||||
| @@ -125,9 +125,9 @@ namespace PolyVox | |||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | ||||||
| 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
|  |  | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | ||||||
|   | |||||||
| @@ -187,7 +187,7 @@ namespace PolyVox | |||||||
| 			{ | 			{ | ||||||
| 				//Should never happen | 				//Should never happen | ||||||
| 				POLYVOX_ASSERT(false, "Invalid case."); | 				POLYVOX_ASSERT(false, "Invalid case."); | ||||||
| 				return VoxelType(0); | 				return VoxelType(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -164,9 +164,9 @@ namespace PolyVox | |||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | 		VoxelType getVoxelAt(const Vector3DInt32& v3dPos) const; | ||||||
| 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Gets a voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(int32_t uXPos, int32_t uYPos, int32_t uZPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
| 		/// Gets a voxel at the position given by a 3D vector | 		/// Gets a voxel at the position given by a 3D vector | ||||||
| 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType(0)) const; | 		VoxelType getVoxelWithWrapping(const Vector3DInt32& v3dPos, WrapMode eWrapMode = WrapModes::Border, VoxelType tBorder = VoxelType()) const; | ||||||
|  |  | ||||||
| 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | 		/// Sets the voxel at the position given by <tt>x,y,z</tt> coordinates | ||||||
| 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | 		bool setVoxelAt(int32_t uXPos, int32_t uYPos, int32_t uZPos, VoxelType tValue); | ||||||
|   | |||||||
| @@ -187,7 +187,7 @@ namespace PolyVox | |||||||
| 			{ | 			{ | ||||||
| 				//Should never happen | 				//Should never happen | ||||||
| 				POLYVOX_ASSERT(false, "Invalid case."); | 				POLYVOX_ASSERT(false, "Invalid case."); | ||||||
| 				return VoxelType(0); | 				return VoxelType(); | ||||||
| 			} | 			} | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -260,7 +260,7 @@ namespace PolyVox | |||||||
| 						sumOfWeights += weight; | 						sumOfWeights += weight; | ||||||
|  |  | ||||||
| 						//This is wrong! There's no need to do interpolation. Just multiply the sameple by the correct kernel value. | 						//This is wrong! There's no need to do interpolation. Just multiply the sameple by the correct kernel value. | ||||||
| 						Vector<4, float> sample = interpolatedSample(&volDownscaledXAndY, sx, sy, sz, WrapModes::Border, SrcVolumeType::VoxelType(0)); | 						Vector<4, float> sample = interpolatedSample(&volDownscaledXAndY, sx, sy, sz, WrapModes::Border, SrcVolumeType::VoxelType()); | ||||||
|  |  | ||||||
| 						vecSum += (sample * weight); | 						vecSum += (sample * weight); | ||||||
| 					} | 					} | ||||||
|   | |||||||
| @@ -122,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, WrapModes::Border, 0, controller); | 	MarchingCubesSurfaceExtractor< SimpleVolume<VoxelType> > extractor(&volData, volData.getEnclosingRegion(), &result, WrapModes::Border, VoxelType(), controller); | ||||||
| 	extractor.execute(); | 	extractor.execute(); | ||||||
| } | } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user