0.6.1
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 dim3_t dim_type;
60  typedef size_t size_type;
62  typedef glm::byte data_type;
64 
65  public:
66  storage();
67 
68  storage(
69  size_type const & Layers,
70  size_type const & Faces,
71  size_type const & Levels,
72  format_type const & Format,
73  dim_type const & Dimensions);
74 
75  bool empty() const;
76  size_type size() const; // Express is bytes
77  format_type format() const;
78  size_type layers() const;
79  size_type levels() const;
80  size_type faces() const;
81  swizzle_type swizzle() const;
82 
83  dim_type dimensions(size_type const & Level) const;
84 
85  data_type * data();
86  data_type const * data() const;
87 
88  size_type level_size(
89  size_type const & Level) const;
90  size_type face_size(
91  size_type const & BaseLevel,
92  size_type const & MaxLevel) const;
93  size_type layer_size(
94  size_type const & BaseFace,
95  size_type const & MaxFace,
96  size_type const & BaseLevel,
97  size_type const & MaxLevel) const;
98 
99  private:
100  struct impl
101  {
102  impl();
103 
104  explicit impl(
105  size_type const & Layers,
106  size_type const & Faces,
107  size_type const & Levels,
108  format_type const & Format,
109  dim_type const & Dimensions);
110 
111  size_type const Layers;
112  size_type const Faces;
113  size_type const Levels;
114  format_type const Format;
115  dim_type const Dimensions;
116  std::vector<data_type> Data;
117  };
118 
119  std::shared_ptr<impl> Impl;
120  };
121 
122 /*
123  storage extractLayers(
124  storage const & Storage,
125  storage::size_type const & Offset,
126  storage::size_type const & Size);
127 */
128 /*
129  storage extractFace(
130  storage const & Storage,
131  face const & Face);
132 */
133 /*
134  storage extractLevels(
135  storage const & Storage,
136  storage::size_type const & Offset,
137  storage::size_type const & Size);
138 */
139 /*
140  void copy_layers(
141  storage const & SourceStorage,
142  storage::size_type const & SourceLayerOffset,
143  storage::size_type const & SourceLayerSize,
144  storage & DestinationStorage,
145  storage::size_type const & DestinationLayerOffset);
146 
147  void copy_faces(
148  storage const & SourceStorage,
149  storage::size_type const & SourceLayerOffset,
150  storage::size_type const & SourceFaceOffset,
151  storage::size_type const & SourceLayerSize,
152  storage & DestinationStorage,
153  storage::size_type const & DestinationLayerOffset,
154  storage::size_type const & DestinationFaceOffset);
155 
156  void copy_levels(
157  storage const & SourceStorage,
158  storage::size_type const & SourceLayerOffset,
159  storage::size_type const & SourceFaceOffset,
160  storage::size_type const & SourceLevelOffset,
161  storage::size_type const & SourceLayerSize,
162  storage & DestinationStorage,
163  storage::size_type const & DestinationLayerOffset,
164  storage::size_type const & DestinationFaceOffset,
165  storage::size_type const & DestinationlevelOffset);
166 */
167 
168 }//namespace gli
169 
170 #include "storage.inl"
size_type size() const
size_type layers() const
size_t size_type
Definition: storage.hpp:60
glm::ivec4 swizzle_type
Definition: storage.hpp:63
dim3_t dim_type
Definition: storage.hpp:59
format
Definition: format.hpp:33
glm::ivec4 ivec4
Definition: type.hpp:56
size_type layer_size(size_type const &BaseFace, size_type const &MaxFace, size_type const &BaseLevel, size_type const &MaxLevel) const
OpenGL Image (gli.g-truc.net)
size_type face_size(size_type const &BaseLevel, size_type const &MaxLevel) const
OpenGL Image (gli.g-truc.net)
size_type level_size(size_type const &Level) const
data_type * data()
size_type faces() const
bool empty() const
glm::tvec3< size_t > dim3_t
Definition: type.hpp:49
format_type format() const
dim_type dimensions(size_type const &Level) const
swizzle_type swizzle() const
gli::format format_type
Definition: storage.hpp:61
glm::byte data_type
Definition: storage.hpp:62
size_type levels() const