GLI  0.6.0
storage.hpp
Go to the documentation of this file.
1 
29 #pragma once
30 
31 // STD
32 #include <vector>
33 #include <queue>
34 #include <string>
35 #include <cassert>
36 #include <cmath>
37 #include <cstring>
38 #include <memory>
39 
40 #include "header.hpp"
41 #include "type.hpp"
42 
43 // GLM
44 #include <glm/gtc/round.hpp>
45 #include <glm/gtx/component_wise.hpp>
46 #include <glm/gtx/gradient_paint.hpp>
47 #include <glm/gtx/integer.hpp>
48 #include <glm/gtx/bit.hpp>
49 #include <glm/gtx/raw_data.hpp>
50 #include <glm/gtx/wrap.hpp>
51 
52 static_assert(GLM_VERSION >= 97, "GLI requires at least GLM 0.9.7");
53 
54 namespace gli
55 {
56  class storage
57  {
58  public:
59  typedef dim1_t dim1_type;
60  typedef dim2_t dim2_type;
61  typedef dim3_t dim3_type;
62  typedef dim4_t dim4_type;
63  typedef dim3_type dim_type;
68  typedef size_t size_type;
69  typedef size_t layer_type;
70  typedef size_t level_type;
71  typedef size_t face_type;
73  typedef glm::byte data_type;
74  typedef glm::ivec4 swizzle_type;
75 
76  public:
77  storage();
78 
79  storage(
80  layer_type const & Layers,
81  face_type const & Faces,
82  level_type const & Levels,
83  format_type const & Format,
84  dim_type const & Dimensions);
85 
86  bool empty() const;
87  size_type size() const; // Express is bytes
88  format_type format() const;
89  layer_type layers() const;
90  level_type levels() const;
91  face_type faces() const;
92  swizzle_type swizzle() const;
93 
94  dim_type dimensions(size_type const & Level) const;
95 
96  data_type * data();
97  data_type const * data() const;
98 
99  size_type level_size(
100  level_type const & Level) const;
101  size_type face_size(
102  level_type const & BaseLevel,
103  level_type const & MaxLevel) const;
104  size_type layer_size(
105  face_type const & BaseFace,
106  face_type const & MaxFace,
107  level_type const & BaseLevel,
108  level_type const & MaxLevel) const;
109 
110  private:
111  struct impl
112  {
113  impl();
114 
115  explicit impl(
116  layer_type const & Layers,
117  face_type const & Faces,
118  level_type const & Levels,
119  format_type const & Format,
120  dim_type const & Dimensions);
121 
122  size_type const Layers;
123  size_type const Faces;
124  size_type const Levels;
125  format_type const Format;
126  dim_type const Dimensions;
127  std::vector<data_type> Data;
128  };
129 
130  std::shared_ptr<impl> Impl;
131  };
132 
133 /*
134  storage extractLayers(
135  storage const & Storage,
136  storage::size_type const & Offset,
137  storage::size_type const & Size);
138 */
139 /*
140  storage extractFace(
141  storage const & Storage,
142  face const & Face);
143 */
144 /*
145  storage extractLevels(
146  storage const & Storage,
147  storage::size_type const & Offset,
148  storage::size_type const & Size);
149 */
150 /*
151  void copy_layers(
152  storage const & SourceStorage,
153  storage::size_type const & SourceLayerOffset,
154  storage::size_type const & SourceLayerSize,
155  storage & DestinationStorage,
156  storage::size_type const & DestinationLayerOffset);
157 
158  void copy_faces(
159  storage const & SourceStorage,
160  storage::size_type const & SourceLayerOffset,
161  storage::size_type const & SourceFaceOffset,
162  storage::size_type const & SourceLayerSize,
163  storage & DestinationStorage,
164  storage::size_type const & DestinationLayerOffset,
165  storage::size_type const & DestinationFaceOffset);
166 
167  void copy_levels(
168  storage const & SourceStorage,
169  storage::size_type const & SourceLayerOffset,
170  storage::size_type const & SourceFaceOffset,
171  storage::size_type const & SourceLevelOffset,
172  storage::size_type const & SourceLayerSize,
173  storage & DestinationStorage,
174  storage::size_type const & DestinationLayerOffset,
175  storage::size_type const & DestinationFaceOffset,
176  storage::size_type const & DestinationlevelOffset);
177 */
178 
179 }//namespace gli
180 
181 #include "storage.inl"
size_type size() const
size_t size_type
Definition: storage.hpp:68
glm::ivec4 swizzle_type
Definition: storage.hpp:74
glm::vec3 texcoord3_t
Definition: type.hpp:53
glm::vec4 texcoord4_t
Definition: type.hpp:54
glm::tvec2< size_t > dim2_t
Definition: type.hpp:48
size_t face_type
Definition: storage.hpp:71
glm::tvec1< size_t > dim1_t
Definition: type.hpp:47
glm::tvec4< size_t > dim4_t
Definition: type.hpp:50
glm::vec2 texcoord2_t
Definition: type.hpp:52
texcoord1_t texcoord1_type
Definition: storage.hpp:64
texcoord2_t texcoord2_type
Definition: storage.hpp:65
OpenGL Image (gli.g-truc.net)
face_type faces() const
level_type levels() const
texcoord4_t texcoord4_type
Definition: storage.hpp:67
size_t level_type
Definition: storage.hpp:70
data_type * data()
size_type level_size(level_type const &Level) const
glm::vec1 texcoord1_t
Definition: type.hpp:51
bool empty() const
format_type format() const
OpenGL Image (gli.g-truc.net)
dim_type dimensions(size_type const &Level) const
swizzle_type swizzle() const
gli::format format_type
Definition: storage.hpp:72
dim3_type dim_type
Definition: storage.hpp:63
glm::byte data_type
Definition: storage.hpp:73
glm::tvec3< size_t > dim3_t
Definition: type.hpp:49
texcoord3_t texcoord3_type
Definition: storage.hpp:66
dim4_t dim4_type
Definition: storage.hpp:62
layer_type layers() const
size_type face_size(level_type const &BaseLevel, level_type const &MaxLevel) const
dim2_t dim2_type
Definition: storage.hpp:60
size_type layer_size(face_type const &BaseFace, face_type const &MaxFace, level_type const &BaseLevel, level_type const &MaxLevel) const
dim1_t dim1_type
Definition: storage.hpp:59
size_t layer_type
Definition: storage.hpp:69
dim3_t dim3_type
Definition: storage.hpp:61
format
Definition: format.hpp:33