0.8.0 API documentation
texture3d.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "texture.hpp"
7 #include "image.hpp"
8 #include "index.hpp"
9 
10 namespace gli
11 {
13  class texture3d : public texture
14  {
15  public:
16  typedef extent3d extent_type;
17 
18  public:
20  texture3d();
21 
23  explicit texture3d(
24  format_type Format,
25  extent_type const & Extent,
26  size_type Levels,
27  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
28 
30  explicit texture3d(
31  format_type Format,
32  extent_type const & Extent,
33  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
34 
36  explicit texture3d(
37  texture const & Texture);
38 
40  explicit texture3d(
41  texture const & Texture,
42  format_type Format,
43  size_type BaseLayer, size_type MaxLayer,
44  size_type BaseFace, size_type MaxFace,
45  size_type BaseLevel, size_type MaxLevel,
46  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
47 
49  explicit texture3d(
50  texture3d const & Texture,
51  size_type BaseLevel, size_type MaxLevel);
52 
54  image operator[](size_type Level) const;
55 
57  extent_type extent(size_type Level = 0) const;
58 
60  template <typename genType>
61  genType load(extent_type const & TexelCoord, size_type Level) const;
62 
64  template <typename genType>
65  void store(extent_type const & TexelCoord, size_type Level, genType const & Texel);
66 
68  void clear();
69 
72  template <typename genType>
73  void clear(genType const & Texel);
74 
76  template <typename genType>
77  void clear(size_type Level, genType const & Texel);
78 
79  private:
80  struct cache
81  {
82  std::uint8_t* Data;
83  extent_type Extent;
84 # ifndef NDEBUG
85  size_type Size;
86 # endif
87  };
88 
89  void build_cache();
90  size_type index_cache(size_type Level) const;
91 
92  std::vector<cache> Caches;
93  };
94 }//namespace gli
95 
96 #include "./core/texture3d.inl"
Genetic texture class. It can support any target.
Definition: texture.hpp:12
texture3d()
Create an empty texture 3D.
3d texture
Definition: texture3d.hpp:13
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
Include to compute offset in a texture storage memory.
genType load(extent_type const &TexelCoord, size_type Level) const
Fetch a texel from a texture. The texture format must be uncompressed.
void store(extent_type const &TexelCoord, size_type Level, genType const &Texel)
Write a texel to a texture. The texture format must be uncompressed.
format
Texture data format.
Definition: format.hpp:12
extent_type extent(size_type Level=0) const
Return the dimensions of a texture instance: width, height and depth.
image operator[](size_type Level) const
Create a view of the image identified by Level in the mipmap chain of the texture.
Image, representation for a single texture level.
Definition: image.hpp:11
Include to use images, a representation of a single texture level.
void clear()
Clear the entire texture storage with zeros.
Include to use generic textures which can represent any texture target but they don't have target spe...