Exposed 'VoxelType' in BaseVolume.
This commit is contained in:
		| @@ -38,10 +38,12 @@ namespace PolyVox | ||||
| 	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
| 	/// More details to come... | ||||
| 	//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||||
| 	template <typename VoxelType> | ||||
| 	template <typename _VoxelType> | ||||
| 	class BaseVolume | ||||
| 	{ | ||||
| 	public: | ||||
| 		typedef _VoxelType VoxelType; | ||||
|  | ||||
| 		#ifndef SWIG | ||||
| 		template <typename DerivedVolumeType> | ||||
| 		class Sampler | ||||
|   | ||||
| @@ -31,6 +31,8 @@ freely, subject to the following restrictions: | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
|  | ||||
| 	//FIXME - Make this a member of CubicSurfaceExtractorWithNormals? | ||||
| 	template<typename VoxelType> | ||||
| 	bool defaultIsQuadNeeded(VoxelType from, VoxelType to, float& materialToUse) | ||||
| 	{ | ||||
| @@ -45,20 +47,20 @@ namespace PolyVox | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	template< template<typename> class VolumeType, typename VoxelType> | ||||
| 	template<typename VolumeType> | ||||
| 	class CubicSurfaceExtractorWithNormals | ||||
| 	{ | ||||
| 	public: | ||||
| 		CubicSurfaceExtractorWithNormals(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, polyvox_function<bool(VoxelType from, VoxelType to, float& materialToUse)> funcIsQuadNeededCallback = defaultIsQuadNeeded<VoxelType>); | ||||
| 		CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, polyvox_function<bool(typename VolumeType::VoxelType from, typename VolumeType::VoxelType to, float& materialToUse)> funcIsQuadNeededCallback = defaultIsQuadNeeded<VolumeType::VoxelType>); | ||||
|  | ||||
| 		void execute(); | ||||
|  | ||||
| 	private: | ||||
| 		polyvox_function<bool(VoxelType voxel0, VoxelType voxel1, float& materialToUse)> m_funcIsQuadNeededCallback; | ||||
| 		polyvox_function<bool(typename VolumeType::VoxelType voxel0, typename VolumeType::VoxelType voxel1, float& materialToUse)> m_funcIsQuadNeededCallback; | ||||
|  | ||||
| 		//The volume data and a sampler to access it. | ||||
| 		VolumeType<VoxelType>* m_volData; | ||||
| 		typename VolumeType<VoxelType>::Sampler m_sampVolume; | ||||
| 		VolumeType* m_volData; | ||||
| 		typename VolumeType::Sampler m_sampVolume; | ||||
|  | ||||
| 		//The surface patch we are currently filling. | ||||
| 		SurfaceMesh<PositionMaterialNormal>* m_meshCurrent; | ||||
|   | ||||
| @@ -23,8 +23,8 @@ freely, subject to the following restrictions: | ||||
|  | ||||
| namespace PolyVox | ||||
| { | ||||
| 	template< template<typename> class VolumeType, typename VoxelType> | ||||
| 	CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::CubicSurfaceExtractorWithNormals(VolumeType<VoxelType>* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, polyvox_function<bool(VoxelType from, VoxelType to, float& materialToUse)> funcIsQuadNeededCallback) | ||||
| 	template<typename VolumeType> | ||||
| 	CubicSurfaceExtractorWithNormals<VolumeType>::CubicSurfaceExtractorWithNormals(VolumeType* volData, Region region, SurfaceMesh<PositionMaterialNormal>* result, polyvox_function<bool(typename VolumeType::VoxelType from, typename VolumeType::VoxelType to, float& materialToUse)> funcIsQuadNeededCallback) | ||||
| 		:m_volData(volData) | ||||
| 		,m_sampVolume(volData) | ||||
| 		,m_meshCurrent(result) | ||||
| @@ -34,8 +34,8 @@ namespace PolyVox | ||||
| 		assert(m_funcIsQuadNeededCallback); | ||||
| 	} | ||||
|  | ||||
| 	template< template<typename> class VolumeType, typename VoxelType> | ||||
| 	void CubicSurfaceExtractorWithNormals<VolumeType, VoxelType>::execute() | ||||
| 	template<typename VolumeType> | ||||
| 	void CubicSurfaceExtractorWithNormals<VolumeType>::execute() | ||||
| 	{		 | ||||
| 		m_meshCurrent->clear(); | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user