You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and dots ('.'), can be up to 35 characters long. Letters must be lowercase.
		
		
		
		
		
			
		
			
				
					
					
						
							71 lines
						
					
					
						
							2.6 KiB
						
					
					
				
			
		
		
	
	
							71 lines
						
					
					
						
							2.6 KiB
						
					
					
				/// @brief Include to sample 3d textures. | 
						|
/// @file gli/sampler3d.hpp | 
						|
 | 
						|
#pragma once | 
						|
 | 
						|
#include "sampler.hpp" | 
						|
#include "texture3d.hpp" | 
						|
#include "core/mipmaps_compute.hpp" | 
						|
#include "core/convert_func.hpp" | 
						|
 | 
						|
namespace gli | 
						|
{ | 
						|
	/// 3d texture sampler | 
						|
	/// @tparam T Sampler can fetch, write and interpret any texture format but will expose and process the data through type T conversions. | 
						|
	/// @tparam P Precision in term of ULPs | 
						|
	template <typename T, precision P = defaultp> | 
						|
	class sampler3d : public sampler | 
						|
	{ | 
						|
	private: | 
						|
		typedef typename detail::interpolate<T>::type interpolate_type; | 
						|
 | 
						|
	public: | 
						|
		typedef texture3d texture_type; | 
						|
		typedef typename texture_type::size_type size_type; | 
						|
		typedef typename texture_type::extent_type extent_type; | 
						|
		typedef interpolate_type level_type; | 
						|
		typedef vec<3, interpolate_type, P> normalized_type; | 
						|
		typedef vec<4, T, P> texel_type; | 
						|
 | 
						|
		sampler3d(texture_type const& Texture, wrap Wrap, filter Mip = FILTER_NEAREST, filter Min = FILTER_NEAREST, texel_type const& BorderColor = texel_type(0, 0, 0, 1)); | 
						|
 | 
						|
		/// Access the sampler texture object | 
						|
		texture_type const& operator()() const; | 
						|
 | 
						|
		/// Fetch a texel from the sampler texture | 
						|
		texel_type texel_fetch(extent_type const& TexelCoord, size_type const& Level) const; | 
						|
 | 
						|
		/// Write a texel in the sampler texture | 
						|
		void texel_write(extent_type const& TexelCoord, size_type const & Level, texel_type const& Texel); | 
						|
 | 
						|
		/// Clear the sampler texture with a uniform texel | 
						|
		void clear(texel_type const& Texel); | 
						|
 | 
						|
		/// Sample the sampler texture at a specific level | 
						|
		texel_type texture_lod(normalized_type const& SampleCoord, level_type Level) const; | 
						|
 | 
						|
		/// Generate all the mipmaps of the sampler texture from the texture base level | 
						|
		void generate_mipmaps(filter Minification); | 
						|
 | 
						|
		/// Generate the mipmaps of the sampler texture from the texture base level to the texture max level included | 
						|
		void generate_mipmaps(size_type BaseLevel, size_type MaxLevel, filter Minification); | 
						|
 | 
						|
	private: | 
						|
		typedef typename detail::convert<texture_type, T, P>::func convert_type; | 
						|
		typedef typename detail::convert<texture_type, T, P>::fetchFunc fetch_type; | 
						|
		typedef typename detail::convert<texture_type, T, P>::writeFunc write_type; | 
						|
		typedef typename detail::filterBase<detail::DIMENSION_3D, texture_type, interpolate_type, normalized_type, fetch_type, texel_type>::filterFunc filter_type; | 
						|
 | 
						|
		texture_type Texture; | 
						|
		convert_type Convert; | 
						|
		texel_type BorderColor; | 
						|
		filter_type Filter; | 
						|
	}; | 
						|
 | 
						|
	typedef sampler3d<float> fsampler3D; | 
						|
	typedef sampler3d<double> dsampler3D; | 
						|
	typedef sampler3d<unsigned int> usampler3D; | 
						|
	typedef sampler3d<int> isampler3D; | 
						|
}//namespace gli | 
						|
 | 
						|
#include "./core/sampler3d.inl"
 | 
						|
 |