0.7.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 "../type.hpp"
41 #include "../format.hpp"
42 
43 // GLM
44 #include <glm/gtc/round.hpp>
45 #include <glm/gtx/component_wise.hpp>
46 #include <glm/gtx/integer.hpp>
47 #include <glm/gtx/bit.hpp>
48 #include <glm/gtx/raw_data.hpp>
49 #include <glm/gtx/wrap.hpp>
50 
51 static_assert(GLM_VERSION >= 97, "GLI requires at least GLM 0.9.7");
52 
53 namespace gli
54 {
55  class storage
56  {
57  public:
58  typedef dim3_t dim_type;
59  typedef size_t size_type;
60  typedef gli::format format_type;
61  typedef glm::byte data_type;
62 
63  public:
64  storage();
65 
66  storage(
67  format_type Format,
68  dim_type const & Dimensions,
69  size_type Layers,
70  size_type Faces,
71  size_type Levels);
72 
73  bool empty() const;
74  size_type size() const; // Express is bytes
75  size_type layers() const;
76  size_type levels() const;
77  size_type faces() const;
78 
79  size_type block_size() const;
80  dim_type block_count(size_type Level) const;
81  dim_type dimensions(size_type Level) const;
82 
83  data_type * data();
84 
86  size_type offset(
87  size_type Layer,
88  size_type Face,
89  size_type Level) const;
90 
91  size_type level_size(
92  size_type Level) const;
93  size_type face_size(
94  size_type BaseLevel, size_type MaxLevel) const;
95  size_type layer_size(
96  size_type BaseFace, size_type MaxFace,
97  size_type BaseLevel, size_type MaxLevel) const;
98 
99  private:
100  size_type const Layers;
101  size_type const Faces;
102  size_type const Levels;
103  size_type const BlockSize;
104  dim_type const BlockCount;
105  dim_type const Dimensions;
106  std::vector<data_type> Data;
107  };
108 
109 /*
110  storage extractLayers(
111  storage const & Storage,
112  storage::size_type const & Offset,
113  storage::size_type const & Size);
114 */
115 /*
116  storage extractFace(
117  storage const & Storage,
118  face const & Face);
119 */
120 /*
121  storage extractLevels(
122  storage const & Storage,
123  storage::size_type const & Offset,
124  storage::size_type const & Size);
125 */
126 /*
127  void copy_layers(
128  storage const & SourceStorage,
129  storage::size_type const & SourceLayerOffset,
130  storage::size_type const & SourceLayerSize,
131  storage & DestinationStorage,
132  storage::size_type const & DestinationLayerOffset);
133 
134  void copy_faces(
135  storage const & SourceStorage,
136  storage::size_type const & SourceLayerOffset,
137  storage::size_type const & SourceFaceOffset,
138  storage::size_type const & SourceLayerSize,
139  storage & DestinationStorage,
140  storage::size_type const & DestinationLayerOffset,
141  storage::size_type const & DestinationFaceOffset);
142 
143  void copy_levels(
144  storage const & SourceStorage,
145  storage::size_type const & SourceLayerOffset,
146  storage::size_type const & SourceFaceOffset,
147  storage::size_type const & SourceLevelOffset,
148  storage::size_type const & SourceLayerSize,
149  storage & DestinationStorage,
150  storage::size_type const & DestinationLayerOffset,
151  storage::size_type const & DestinationFaceOffset,
152  storage::size_type const & DestinationlevelOffset);
153 */
154 
155 }//namespace gli
156 
157 #include "storage.inl"