Go to the documentation of this file.00001 #ifndef OPENTISSUE_GPU_TEXTURE_TEXTURE_CREATE_TEXTURE3D_H
00002 #define OPENTISSUE_GPU_TEXTURE_TEXTURE_CREATE_TEXTURE3D_H
00003
00004
00005
00006
00007
00008
00009
00010 #include <OpenTissue/configuration.h>
00011
00012 #include <OpenTissue/gpu/texture/texture_texture3D.h>
00013 #include <OpenTissue/gpu/texture/texture_types.h>
00014
00015 namespace OpenTissue
00016 {
00017 namespace texture
00018 {
00027 template<typename grid_type>
00028 inline texture3D_pointer create_texture3D_from_grid( grid_type & grid )
00029 {
00030 typedef typename grid_type::value_type T;
00031 unsigned int channels = 1;
00032 unsigned int int_format = internal_format<T>( channels );
00033 unsigned int ext_format = external_format( channels );
00034 unsigned int ext_type = external_type<T>();
00035 bool cubic = false;
00036 float scale = 16.0;
00037 texture3D_pointer tex(
00038 new Texture3D(
00039 int_format
00040 , grid.I()
00041 , grid.J()
00042 , grid.K()
00043 , ext_format
00044 , ext_type
00045 , grid.data()
00046 , cubic
00047 , scale
00048 )
00049 );
00050 return tex;
00051 }
00052
00053
00066 template<typename T>
00067 inline texture3D_pointer create_texture3D( int texture_size_i, int texture_size_j, int texture_size_k );
00068
00069 template<>
00070 inline texture3D_pointer create_texture3D<unsigned short>( int texture_size_i, int texture_size_j, int texture_size_k )
00071 {
00072 typedef unsigned short T;
00073 unsigned int channels = 1;
00074 unsigned int int_format = internal_format<T>( channels );
00075 unsigned int ext_format = external_format( channels );
00076 unsigned int ext_type = external_type<T>();
00077
00078 bool cubic = false;
00079 float scale = 16.0;
00080 texture3D_pointer tex(
00081 new Texture3D(
00082 int_format
00083 , texture_size_i
00084 , texture_size_j
00085 , texture_size_k
00086 , ext_format
00087 , ext_type
00088 , 0
00089 , cubic
00090 , scale
00091 )
00092 );
00093 return tex;
00094 }
00095
00096 }
00097 }
00098
00099
00100 #endif