| 0.8.2 API documentation

- Main Page
- Namespaces
- Classes
- Files

- File List

storage_linear.hpp
1 #pragma once
2
3 // STD
4 #include <vector>
5 #include <queue>
6 #include <string>
7 #include <cassert>
8 #include <cmath>
9 #include <cstring>
10 #include <memory>
11
12 #include "../type.hpp"
13 #include "../format.hpp"
14
15 // GLM
16 #include <glm/gtc/round.hpp>
17 #include <glm/gtx/component_wise.hpp>
18 #include <glm/gtx/integer.hpp>
19 #include <glm/gtx/bit.hpp>
20 #include <glm/gtx/raw_data.hpp>
21 #include <glm/gtx/wrap.hpp>
22
23 static_assert(GLM_VERSION >= 97, "GLI requires at least GLM 0.9.7");
24
25 namespace gli
26 {
27 class storage_linear
28 {
29 public:
30 typedef extent3d extent_type;
31 typedef size_t size_type;
32 typedef gli::format format_type;
33 typedef glm::byte data_type;
34
35 public:
36 storage_linear();
37
38 storage_linear(
39 format_type Format,
40 extent_type const & Extent,
41 size_type Layers,
42 size_type Faces,
43 size_type Levels);
44
45 bool empty() const;
46 size_type size() const; // Express is bytes
47 size_type layers() const;
48 size_type levels() const;
49 size_type faces() const;
50
51 size_type block_size() const;
52 extent_type block_extent() const;
53 extent_type block_count(size_type Level) const;
54 extent_type extent(size_type Level) const;
55
56 data_type* data();
57 data_type const* const data() const;
58
60 size_type base_offset(
61 size_type Layer,
62 size_type Face,
63 size_type Level) const;
64
65 size_type image_offset(extent1d const& Coord, extent1d const& Extent) const;
66
67 size_type image_offset(extent2d const& Coord, extent2d const& Extent) const;
68
69 size_type image_offset(extent3d const& Coord, extent3d const& Extent) const;
70
72 void copy(
73 storage_linear const& StorageSrc,
74 size_t LayerSrc, size_t FaceSrc, size_t LevelSrc, extent_type const& BlockIndexSrc,
75 size_t LayerDst, size_t FaceDst, size_t LevelDst, extent_type const& BlockIndexDst,
76 extent_type const& BlockCount);
77
78 size_type level_size(
79 size_type Level) const;
80 size_type face_size(
81 size_type BaseLevel, size_type MaxLevel) const;
82 size_type layer_size(
83 size_type BaseFace, size_type MaxFace,
84 size_type BaseLevel, size_type MaxLevel) const;
85
86 private:
87 size_type const Layers;
88 size_type const Faces;
89 size_type const Levels;
90 size_type const BlockSize;
91 extent_type const BlockCount;
92 extent_type const BlockExtent;
93 extent_type const Extent;
94 std::vector<data_type> Data;
95 };
96 }//namespace gli
97
98 #include "storage_linear.inl"
gli::block_extent
ivec3 block_extent(format Format)
Return the dimensions in texels of the block for a format.
gli::format
format
Texture data format.
Definition: format.hpp:12
gli::copy
void copy(texture_src_type const &TextureSrc, size_t LayerSrc, size_t FaceSrc, size_t LevelSrc, texture_dst_type &TextureDst, size_t LayerDst, size_t FaceDst, size_t LevelDst)
Copy a specific image of a texture.
gli
Namespace where all the classes and functions provided by GLI are exposed.
Definition: clear.hpp:6
gli::block_size
size_t block_size(format Format)
Return the size in bytes of a block for a format.
gli::levels
T levels(vecType< T, P > const &Extent)
Compute the number of mipmaps levels necessary to create a mipmap complete texture.