Removed remaining use of VoxelTypeTraits.
This commit is contained in:
		| @@ -101,16 +101,6 @@ namespace PolyVox | ||||
| 	// These are the predefined density types. The 8-bit types are sufficient for many purposes (including | ||||
| 	// most games) but 16-bit and float types do have uses particularly in medical/scientific visualisation. | ||||
| 	typedef Density<uint8_t> Density8; | ||||
| 	 | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< Density8 >	 | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
| 		static Density8::DensityType minDensity() { return std::numeric_limits<Density8::DensityType>::min(); } | ||||
| 		static Density8::DensityType maxDensity() { return std::numeric_limits<Density8::DensityType>::max(); } | ||||
| 	}; | ||||
|  | ||||
| 	template <typename Type> | ||||
| 	class SurfaceExtractionController< Density<Type> > | ||||
|   | ||||
| @@ -94,25 +94,6 @@ namespace PolyVox | ||||
|  | ||||
| 	typedef Material<uint8_t> Material8; | ||||
| 	typedef Material<uint16_t> Material16; | ||||
|  | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< Material8 > | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
| 		static int minDensity() { assert(false); return 0; } | ||||
| 		static int maxDensity() { assert(false); return 0; } | ||||
| 	}; | ||||
|  | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< Material16 > | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		static int minDensity() { assert(false); return 0; } | ||||
| 		static int maxDensity() { assert(false); return 0; } | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| #endif //__PolyVox_Material_H__ | ||||
|   | ||||
| @@ -140,26 +140,6 @@ namespace PolyVox | ||||
|  | ||||
| 	typedef MaterialDensityPair<uint8_t, 4, 4> MaterialDensityPair44; | ||||
| 	typedef MaterialDensityPair<uint16_t, 8, 8> MaterialDensityPair88; | ||||
| 	 | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< MaterialDensityPair44 > | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
| 		static MaterialDensityPair44::DensityType minDensity() { return 0; } | ||||
| 		static MaterialDensityPair44::DensityType maxDensity() { return 15; } | ||||
| 	}; | ||||
| 	 | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< MaterialDensityPair88 > | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
| 		static MaterialDensityPair88::DensityType minDensity() { return 0; } | ||||
| 		static MaterialDensityPair88::DensityType maxDensity() { return 255; } | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| #endif | ||||
|   | ||||
| @@ -33,16 +33,6 @@ freely, subject to the following restrictions: | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	template<> | ||||
| 	class VoxelTypeTraits< uint8_t >	 | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
| 		static uint8_t minDensity() { return 0; } | ||||
| 		static uint8_t maxDensity() { return 255; } | ||||
| 	}; | ||||
|  | ||||
| 	template< typename VolumeType> | ||||
| 	class SurfaceExtractor | ||||
| 	{ | ||||
| @@ -218,7 +208,8 @@ namespace PolyVox | ||||
| 		Region m_regSliceCurrent; | ||||
|  | ||||
| 		//Our threshold value | ||||
| 		typename VoxelTypeTraits<typename VolumeType::VoxelType>::DensityType m_tThreshold; | ||||
| 		//typename VoxelTypeTraits<typename VolumeType::VoxelType>::DensityType m_tThreshold; | ||||
| 		typename SurfaceExtractionController<typename VolumeType::VoxelType>::DensityType m_tThreshold; | ||||
|  | ||||
| 		//Used to convert arbitrary voxel types in densities and materials. | ||||
| 		SurfaceExtractionController<typename VolumeType::VoxelType> m_controller; | ||||
|   | ||||
| @@ -1,61 +0,0 @@ | ||||
| /******************************************************************************* | ||||
| Copyright (c) 2005-2009 David Williams | ||||
|  | ||||
| This software is provided 'as-is', without any express or implied | ||||
| warranty. In no event will the authors be held liable for any damages | ||||
| arising from the use of this software. | ||||
|  | ||||
| Permission is granted to anyone to use this software for any purpose, | ||||
| including commercial applications, and to alter it and redistribute it | ||||
| freely, subject to the following restrictions: | ||||
|  | ||||
|     1. The origin of this software must not be misrepresented; you must not | ||||
|     claim that you wrote the original software. If you use this software | ||||
|     in a product, an acknowledgment in the product documentation would be | ||||
|     appreciated but is not required. | ||||
|  | ||||
|     2. Altered source versions must be plainly marked as such, and must not be | ||||
|     misrepresented as being the original software. | ||||
|  | ||||
|     3. This notice may not be removed or altered from any source | ||||
|     distribution. 	 | ||||
| *******************************************************************************/ | ||||
|  | ||||
| #ifndef __PolyVox_Voxel_H__ | ||||
| #define __PolyVox_Voxel_H__ | ||||
|  | ||||
| #include "PolyVoxImpl/TypeDef.h" | ||||
|  | ||||
| #include <cassert> | ||||
| #include <limits> | ||||
|  | ||||
| namespace PolyVox | ||||
| {	 | ||||
| 	// Various properties of the voxel types can be expressed via types traits, similar to the way std::numeric_limits is implemented. | ||||
| 	// This has some advantages compared to storing the properties directly in the voxel class. For example, by using traits it is possible | ||||
| 	// to also apply these properties to primative types which might be desirable (the Volume classes do accept primative types as template | ||||
| 	// parameters). Also, properties such as minDensity() and maxDensity() would be difficult to represent though class members because they | ||||
| 	// depend ont the type (float has a very different range from int8_t for example). | ||||
| 	// | ||||
| 	// The properties are currently exposed as constants because we need access to them at compile time. Ideally we would like to make them | ||||
| 	// functions flagged with 'constexpr' as we could then make use of the max() and min() functions in std::numeric_limits, but this is not | ||||
| 	// widely supported by compilers yet. We may change this in the future. | ||||
| 	// | ||||
| 	// Syntax for templatised traits classes: http://stackoverflow.com/q/8606302/849083 | ||||
| 	template <typename Type> | ||||
| 	class VoxelTypeTraits | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef uint8_t DensityType; | ||||
| 		typedef uint8_t MaterialType; | ||||
|  | ||||
| 		// These default implementations return an int32_t rather than void so that the result can be | ||||
| 		// assigned to a variable for all voxel types (even those without density components). Calls | ||||
| 		// to these functions should be protected by calls to hasDensity(), but the compiler still | ||||
| 		// needs to ensure the assignment is compilable even if hasDensity() returns false. | ||||
| 		static int32_t minDensity() { assert(false); return 0; }  | ||||
| 		static int32_t maxDensity() { assert(false); return 0; } | ||||
| 	}; | ||||
| } | ||||
|  | ||||
| #endif //__PolyVox_Voxel_H__ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user