GLI 0.5.1

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

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