GLI  0.5.0
storage.hpp
Go to the documentation of this file.
1 
29 #ifndef GLI_CORE_STORAGE_INCLUDED
30 #define GLI_CORE_STORAGE_INCLUDED
31 
32 // STD
33 #include <vector>
34 #include <queue>
35 #include <string>
36 #include <cassert>
37 #include <cmath>
38 #include <cstring>
39 
40 // GLM
41 #include <glm/glm.hpp>
42 #include <glm/gtx/component_wise.hpp>
43 #include <glm/gtx/gradient_paint.hpp>
44 #include <glm/gtx/integer.hpp>
45 #include <glm/gtx/multiple.hpp>
46 #include <glm/gtx/number_precision.hpp>
47 #include <glm/gtx/raw_data.hpp>
48 #include <glm/gtx/scalar_relational.hpp>
49 
50 #include "shared_ptr.hpp"
51 #include "header.hpp"
52 #include "format.hpp"
53 
54 namespace gli
55 {
56  class storage
57  {
58  public:
59  typedef glm::uint dimensions1_type;
60  typedef glm::uvec2 dimensions2_type;
61  typedef glm::uvec3 dimensions3_type;
62  typedef glm::uvec4 dimensions4_type;
64  typedef float texcoord1_type;
65  typedef glm::vec2 texcoord2_type;
66  typedef glm::vec3 texcoord3_type;
67  typedef glm::vec4 texcoord4_type;
68  typedef std::size_t size_type;
70 
71  public:
72  storage();
73 
74  storage(
75  size_type const & Layers,
76  size_type const & Faces,
77  size_type const & Levels,
78  format_type const & Format,
79  dimensions_type const & Dimensions);
80 
81  storage(
82  size_type const & Layers,
83  size_type const & Faces,
84  size_type const & Levels,
85  dimensions_type const & Dimensions,
86  format_type const & Format,
87  size_type const & BlockSize,
88  dimensions_type const & BlockDimensions);
89 
90  bool empty() const;
91  size_type size() const; // Express is bytes
92  format_type format() const;
93  size_type layers() const;
94  size_type faces() const;
95  size_type levels() const;
96 
97  size_type blockSize() const; // Express is bytes
98  dimensions_type blockDimensions() const; // Express is bytes
99  dimensions_type dimensions(size_type const & Level) const;
100 
101  glm::byte * data();
102  glm::byte const * data() const;
103 
105  size_type const & Level) const;
107  size_type const & BaseLevel,
108  size_type const & MaxLevel) const;
110  size_type const & BaseFace,
111  size_type const & MaxFace,
112  size_type const & BaseLevel,
113  size_type const & MaxLevel) const;
114 
115  private:
116  struct impl
117  {
118  impl();
119 
120  explicit impl(
121  size_type const & Layers,
122  size_type const & Faces,
123  size_type const & Levels,
124  format_type const & Format,
125  dimensions_type const & Dimensions,
126  size_type const & BlockSize,
127  dimensions_type const & BlockDimensions);
128 
129  size_type const Layers;
130  size_type const Faces;
131  size_type const Levels;
132  format_type const Format;
133  dimensions_type const Dimensions;
134  size_type const BlockSize;
135  dimensions_type const BlockDimensions;
136  std::vector<glm::byte> Data;
137  };
138 
139  shared_ptr<impl> Impl;
140  };
141 
142 /*
143  storage extractLayers(
144  storage const & Storage,
145  storage::size_type const & Offset,
146  storage::size_type const & Size);
147 */
148 /*
149  storage extractFace(
150  storage const & Storage,
151  face const & Face);
152 */
153 /*
154  storage extractLevels(
155  storage const & Storage,
156  storage::size_type const & Offset,
157  storage::size_type const & Size);
158 */
159 /*
160  void copy_layers(
161  storage const & SourceStorage,
162  storage::size_type const & SourceLayerOffset,
163  storage::size_type const & SourceLayerSize,
164  storage & DestinationStorage,
165  storage::size_type const & DestinationLayerOffset);
166 
167  void copy_faces(
168  storage const & SourceStorage,
169  storage::size_type const & SourceLayerOffset,
170  storage::size_type const & SourceFaceOffset,
171  storage::size_type const & SourceLayerSize,
172  storage & DestinationStorage,
173  storage::size_type const & DestinationLayerOffset,
174  storage::size_type const & DestinationFaceOffset);
175 
176  void copy_levels(
177  storage const & SourceStorage,
178  storage::size_type const & SourceLayerOffset,
179  storage::size_type const & SourceFaceOffset,
180  storage::size_type const & SourceLevelOffset,
181  storage::size_type const & SourceLayerSize,
182  storage & DestinationStorage,
183  storage::size_type const & DestinationLayerOffset,
184  storage::size_type const & DestinationFaceOffset,
185  storage::size_type const & DestinationlevelOffset);
186 */
187 
188  std::size_t block_size(format const & Format);
189  glm::uvec3 block_dimensions(format const & Format);
190  std::size_t component_count(format const & Format);
191  bool is_compressed(format const & Format);
192 }//namespace gli
193 
194 #include "storage.inl"
195 
196 #endif//GLI_CORE_STORAGE_INCLUDED
float texcoord1_type
Definition: storage.hpp:64
size_type size() const
glm::uvec4 dimensions4_type
Definition: storage.hpp:62
size_type layers() const
std::size_t component_count(format const &Format)
glm::uint dimensions1_type
Definition: storage.hpp:59
glm::uvec2 dimensions2_type
Definition: storage.hpp:60
glm::byte * data()
size_type blockSize() const
glm::vec4 texcoord4_type
Definition: storage.hpp:67
OpenGL Image (gli.g-truc.net)
size_type faceSize(size_type const &BaseLevel, size_type const &MaxLevel) const
dimensions_type dimensions(size_type const &Level) const
std::size_t size_type
Definition: storage.hpp:68
size_type faces() const
bool empty() const
OpenGL Image (gli.g-truc.net)
bool is_compressed(format const &Format)
format_type format() const
OpenGL Image (gli.g-truc.net)
gli::format format_type
Definition: storage.hpp:69
dimensions_type blockDimensions() const
glm::vec2 texcoord2_type
Definition: storage.hpp:65
glm::uvec3 block_dimensions(format const &Format)
glm::uvec3 dimensions3_type
Definition: storage.hpp:61
size_type layerSize(size_type const &BaseFace, size_type const &MaxFace, size_type const &BaseLevel, size_type const &MaxLevel) const
dimensions3_type dimensions_type
Definition: storage.hpp:63
size_type levels() const
size_type levelSize(size_type const &Level) const
glm::vec3 texcoord3_type
Definition: storage.hpp:66
std::size_t block_size(format const &Format)
format
Definition: format.hpp:34