| 0.8.0 API documentation

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

texture.hpp
Go to the documentation of this file.
1
4 #pragma once
5
6 #include "image.hpp"
7 #include "target.hpp"
8
9 namespace gli
10 {
12 class texture
13 {
14 public:
15 typedef size_t size_type;
16 typedef gli::target target_type;
17 typedef gli::format format_type;
18 typedef gli::swizzles swizzles_type;
19 typedef storage::data_type data_type;
20 typedef storage::extent_type extent_type;
21
23 texture();
24
33 texture(
34 target_type Target,
35 format_type Format,
36 extent_type const& Extent,
37 size_type Layers,
38 size_type Faces,
39 size_type Levels,
40 swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
41
47 texture(
48 texture const& Texture,
49 target_type Target,
50 format_type Format,
51 size_type BaseLayer, size_type MaxLayer,
52 size_type BaseFace, size_type MaxFace,
53 size_type BaseLevel, size_type MaxLevel,
54 swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
55
59 texture(
60 texture const& Texture,
61 target_type Target,
62 format_type Format,
63 swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
64
65 virtual ~texture(){}
66
68 bool empty() const;
69
71 target_type target() const{return this->Target;}
72
74 format_type format() const;
75
76 swizzles_type swizzles() const;
77
79 size_type base_layer() const;
80
82 size_type max_layer() const;
83
85 size_type layers() const;
86
88 size_type base_face() const;
89
91 size_type max_face() const;
92
94 size_type faces() const;
95
97 size_type base_level() const;
98
100 size_type max_level() const;
101
103 size_type levels() const;
104
106 extent_type extent(size_type Level = 0) const;
107
109 size_type size() const;
110
113 template <typename genType>
114 size_type size() const;
115
117 size_type size(size_type Level) const;
118
121 template <typename genType>
122 size_type size(size_type Level) const;
123
125 void* data();
126
128 template <typename genType>
129 genType* data();
130
132 void const* data() const;
133
135 template <typename genType>
136 genType const* data() const;
137
139 void* data(size_type Layer, size_type Face, size_type Level);
140
142 void const* data(size_type Layer, size_type Face, size_type Level) const;
143
145 template <typename genType>
146 genType* data(size_type Layer, size_type Face, size_type Level);
147
149 template <typename genType>
150 genType const* data(size_type Layer, size_type Face, size_type Level) const;
151
153 void clear();
154
157 template <typename genType>
158 void clear(genType const & Texel);
159
161 template <typename genType>
162 void clear(size_type Layer, size_type Face, size_type Level, genType const & Texel);
163
165 template <typename genType>
166 void swizzle(gli::swizzles const & Swizzles);
167
168 protected:
170 size_type base_offset(size_type Layer, size_type Face, size_type Level) const;
171
172 struct cache
173 {
174 data_type* Data;
175 size_type Size;
176 };
177
178 std::shared_ptr<storage> Storage;
179 target_type const Target;
180 format_type const Format;
181 size_type const BaseLayer;
182 size_type const MaxLayer;
183 size_type const BaseFace;
184 size_type const MaxFace;
185 size_type const BaseLevel;
186 size_type const MaxLevel;
187 swizzles_type const Swizzles;
188 cache Cache;
189
190 private:
191 void build_cache();
192 };
193
194 }//namespace gli
195
196 #include "./core/texture.inl"
197
gli::texture::format
format_type format() const
Return the texture instance format.
gli::texture
Genetic texture class. It can support any target.
Definition: texture.hpp:12
gli
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
target.hpp
Include to use the target enum and query properties of targets.
gli::texture::layers
size_type layers() const
Return max_layer() - base_layer() + 1.
gli::target
target
Texture target: type/shape of the texture storage.
Definition: target.hpp:9
gli::texture::size
size_type size() const
Return the memory size of a texture instance storage in bytes.
gli::texture::swizzle
void swizzle(gli::swizzles const &Swizzles)
Reorder the component in texture memory.
gli::texture::base_face
size_type base_face() const
Return the base face of the texture instance, effectively a memory offset in the actual texture stora...
gli::texture::faces
size_type faces() const
Return max_face() - base_face() + 1.
gli::texture::levels
size_type levels() const
Return max_level() - base_level() + 1.
gli::texture::extent
extent_type extent(size_type Level=0) const
Return the size of a texture instance: width, height and depth.
gli::texture::target
target_type target() const
Return the target of a texture instance.
Definition: texture.hpp:71
gli::texture::clear
void clear()
Clear the entire texture storage with zeros.
gli::format
format
Texture data format.
Definition: format.hpp:12
gli::texture::base_offset
size_type base_offset(size_type Layer, size_type Face, size_type Level) const
Compute the relative memory offset to access the data for a specific layer, face and level...
gli::texture::base_layer
size_type base_layer() const
Return the base layer of the texture instance, effectively a memory offset in the actual texture stor...
gli::texture::base_level
size_type base_level() const
Return the base level of the texture instance, effectively a memory offset in the actual texture stor...
gli::texture::empty
bool empty() const
Return whether the texture instance is empty, no storage or description have been assigned to the ins...
image.hpp
Include to use images, a representation of a single texture level.
gli::texture::max_layer
size_type max_layer() const
Return the max layer of the texture instance, effectively a memory offset to the beginning of the las...
gli::texture::max_face
size_type max_face() const
Return the max face of the texture instance, effectively a memory offset to the beginning of the last...
gli::texture::texture
texture()
Create an empty texture instance.
gli::texture::max_level
size_type max_level() const
Return the max level of the texture instance, effectively a memory offset to the beginning of the las...
gli::texture::data
void * data()
Return a pointer to the beginning of the texture instance data.