0.6.1
addressing.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 #include "storage.hpp"
32 
33 namespace gli{
34 namespace detail
35 {
36  size_t imageAddressing(
37  storage const & Storage,
38  size_t const & LayerOffset,
39  size_t const & FaceOffset,
40  size_t const & LevelOffset);
41 
42  size_t texelLinearAdressing(
43  dim1_t const & Dimensions,
44  dim1_t const & TexelCoord);
45 
46  size_t texelLinearAdressing(
47  dim2_t const & Dimensions,
48  dim2_t const & TexelCoord);
49 
50  size_t texelLinearAdressing(
51  dim3_t const & Dimensions,
52  dim3_t const & TexelCoord);
53 
54  size_t texelMortonAdressing(
55  dim1_t const & Dimensions,
56  dim1_t const & TexelCoord);
57 
58  size_t texelMortonAdressing(
59  dim2_t const & Dimensions,
60  dim2_t const & TexelCoord);
61 
62  size_t texelMortonAdressing(
63  dim3_t const & Dimensions,
64  dim3_t const & TexelCoord);
65 
66 }//namespace detail
67 /*
68  template <typename texture>
69  class sampler
70  {
71  enum wrap
72  {
73  MIRROR,
74  CLAMP_TO_EDGE
75  };
76 
77  enum filter
78  {
79  NEAREST,
80  LINEAR,
81  CUBIC
82  };
83 
84  public:
85  sampler(texture const & Texture)
86  {
87  switch(Texture.format())
88  {
89  default:
90  break;
91  case RGB_DXT1:
92  Impl.reset(new impl_fetch_dxt1());
93  break;
94  }
95  }
96 
97  template <typename genType>
98  genType operator() (texture::dimension_type const & Dimensions) const
99 
100  private:
101  struct impl
102  {
103  virtual ~impl(){}
104 
105  template <typename genType>
106  virtual genType operator() (texture::dimension_type const & Dimensions) const = 0;
107  };
108 
109  class impl_fetch_color : public impl
110  {
111  public:
112  impl_fetch_color(){}
113 
114  template <typename genType>
115  virtual genType operator() (
116  texture const & Texture,
117  texture::texcoord_type const & Texcoord) const;
118 
119  private:
120 
121  };
122 
123  class impl_fetch_dxt1 : public impl
124  {
125  public:
126  impl_fetch_dxt1(){}
127 
128  template <typename genType>
129  virtual genType operator() (texture::dimension_type const & Dimensions) const;
130 
131  private:
132 
133  };
134 
135  shared_ptr<impl> Impl;
136  };
137 */
138 }//namespace gli
139 
140 #include "addressing.inl"
glm::tvec2< size_t > dim2_t
Definition: type.hpp:48
size_t imageAddressing(storage const &Storage, size_t const &LayerOffset, size_t const &FaceOffset, size_t const &LevelOffset)
OpenGL Image (gli.g-truc.net)
glm::tvec3< size_t > dim3_t
Definition: type.hpp:49
size_t texelMortonAdressing(dim1_t const &Dimensions, dim1_t const &TexelCoord)
glm::tvec1< size_t > dim1_t
Definition: type.hpp:47
size_t texelLinearAdressing(dim1_t const &Dimensions, dim1_t const &TexelCoord)