00001 /******************************************************************************* 00002 Copyright (c) 2005-2009 David Williams 00003 00004 This software is provided 'as-is', without any express or implied 00005 warranty. In no event will the authors be held liable for any damages 00006 arising from the use of this software. 00007 00008 Permission is granted to anyone to use this software for any purpose, 00009 including commercial applications, and to alter it and redistribute it 00010 freely, subject to the following restrictions: 00011 00012 1. The origin of this software must not be misrepresented; you must not 00013 claim that you wrote the original software. If you use this software 00014 in a product, an acknowledgment in the product documentation would be 00015 appreciated but is not required. 00016 00017 2. Altered source versions must be plainly marked as such, and must not be 00018 misrepresented as being the original software. 00019 00020 3. This notice may not be removed or altered from any source 00021 distribution. 00022 *******************************************************************************/ 00023 00024 #ifndef __PolyVox_GradientEstimators_H__ 00025 #define __PolyVox_GradientEstimators_H__ 00026 00027 #include "PolyVoxCore/Vector.h" 00028 #include "PolyVoxCore/VoxelFilters.h" 00029 00030 #include <vector> 00031 00032 namespace PolyVox 00033 { 00034 enum NormalGenerationMethod 00035 { 00036 SIMPLE, 00037 CENTRAL_DIFFERENCE, 00038 SOBEL, 00039 CENTRAL_DIFFERENCE_SMOOTHED, 00040 SOBEL_SMOOTHED 00041 }; 00042 00043 template< template<typename> class VolumeType, typename VoxelType> 00044 Vector3DFloat computeCentralDifferenceGradient(const typename VolumeType<VoxelType>::Sampler& volIter); 00045 00046 template< template<typename> class VolumeType, typename VoxelType> 00047 Vector3DFloat computeSmoothCentralDifferenceGradient(typename VolumeType<VoxelType>::Sampler& volIter); 00048 00049 template< template<typename> class VolumeType, typename VoxelType> 00050 Vector3DFloat computeDecimatedCentralDifferenceGradient(typename VolumeType<VoxelType>::Sampler& volIter); 00051 00052 template< template<typename> class VolumeType, typename VoxelType> 00053 Vector3DFloat computeSobelGradient(const typename VolumeType<VoxelType>::Sampler& volIter); 00054 00055 template< template<typename> class VolumeType, typename VoxelType> 00056 Vector3DFloat computeSmoothSobelGradient(typename VolumeType<VoxelType>::Sampler& volIter); 00057 00058 //POLYVOX_API void computeNormalsForVertices(VolumeType<uint8_t>* volumeData, SurfaceMesh<PositionMaterialNormal>& mesh, NormalGenerationMethod normalGenerationMethod); 00059 //POLYVOX_API Vector3DFloat computeNormal(VolumeType<uint8_t>* volumeData, const Vector3DFloat& v3dPos, NormalGenerationMethod normalGenerationMethod); 00060 } 00061 00062 #include "PolyVoxCore/GradientEstimators.inl" 00063 00064 #endif //__PolyVox_GradientEstimators_H__