0.8.0 API documentation
texture_cube.hpp
Go to the documentation of this file.
1 
4 #pragma once
5 
6 #include "texture2d.hpp"
7 
8 namespace gli
9 {
11  class texture_cube : public texture
12  {
13  public:
14  typedef extent2d extent_type;
15 
16  public:
18  texture_cube();
19 
21  explicit texture_cube(
22  format_type Format,
23  extent_type const & Extent,
24  size_type Levels,
25  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
26 
28  explicit texture_cube(
29  format_type Format,
30  extent_type const & Extent,
31  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
32 
34  explicit texture_cube(
35  texture const & Texture);
36 
38  explicit texture_cube(
39  texture const & Texture,
40  format_type Format,
41  size_type BaseLayer, size_type MaxLayer,
42  size_type BaseFace, size_type MaxFace,
43  size_type BaseLevel, size_type MaxLevel,
44  swizzles_type const& Swizzles = swizzles_type(SWIZZLE_RED, SWIZZLE_GREEN, SWIZZLE_BLUE, SWIZZLE_ALPHA));
45 
47  explicit texture_cube(
48  texture_cube const & Texture,
49  size_type BaseFace, size_type MaxFace,
50  size_type BaseLevel, size_type MaxLevel);
51 
53  texture2d operator[](size_type Face) const;
54 
56  extent_type extent(size_type Level = 0) const;
57 
59  template <typename genType>
60  genType load(extent_type const & TexelCoord, size_type Face, size_type Level) const;
61 
63  template <typename genType>
64  void store(extent_type const & TexelCoord, size_type Face, size_type Level, genType const & Texel);
65 
67  void clear();
68 
71  template <typename genType>
72  void clear(genType const & Texel);
73 
75  template <typename genType>
76  void clear(size_type Face, size_type Level, genType const & Texel);
77 
78  private:
79  struct cache
80  {
81  std::uint8_t* Data;
82  extent_type Extent;
83 # ifndef NDEBUG
84  size_type Size;
85 # endif
86  };
87 
88  void build_cache();
89  size_type index_cache(size_type Face, size_type Level) const;
90 
91  std::vector<cache> Caches;
92  };
93 }//namespace gli
94 
95 #include "./core/texture_cube.inl"
Genetic texture class. It can support any target.
Definition: texture.hpp:12
void clear()
Clear the entire texture storage with zeros.
Include to use 2d textures.
void store(extent_type const &TexelCoord, size_type Face, size_type Level, genType const &Texel)
Write a texel to a texture. The texture format must be uncompressed.
texture2d operator[](size_type Face) const
Create a view of the texture identified by Face in the texture cube.
Namespace where all the classes and functions provided by GLI are exposed.
Definition: comparison.hpp:15
texture_cube()
Create an empty texture cube.
extent_type extent(size_type Level=0) const
Return the dimensions of a texture instance: width and height where both should be equal...
format
Texture data format.
Definition: format.hpp:12
2d texture
Definition: texture2d.hpp:13
Cube map texture.
genType load(extent_type const &TexelCoord, size_type Face, size_type Level) const
Fetch a texel from a texture. The texture format must be uncompressed.