0.7.0
image.hpp
Go to the documentation of this file.
1 
32 #pragma once
33 
34 #include "./core/storage.hpp"
35 
36 namespace gli
37 {
39  class image
40  {
41  private:
42  friend class texture1D;
43  friend class texture2D;
44  friend class texture3D;
45 
46  public:
47  typedef size_t size_type;
48  typedef gli::format format_type;
49  typedef storage::dim_type dim_type;
50  typedef storage::data_type data_type;
51 
53  image();
54 
56  explicit image(
57  format_type Format,
58  dim_type const & Dimensions);
59 
64  explicit image(
65  image const & Image,
66  format_type Format);
67 
69  bool empty() const;
70 
72  format_type format() const;
73 
75  dim_type dimensions() const;
76 
78  size_type size() const;
79 
82  template <typename genType>
83  size_type size() const;
84 
86  void * data();
87 
89  void const * data() const;
90 
92  template <typename genType>
93  genType * data();
94 
96  template <typename genType>
97  genType const * data() const;
98 
100  void clear();
101 
104  template <typename genType>
105  void clear(genType const & Texel);
106 
110  template <typename genType>
111  genType load(dim_type const & TexelCoord);
112 
116  template <typename genType>
117  void store(dim_type const & TexelCoord, genType const & Data);
118 
119  private:
125  explicit image(
126  std::shared_ptr<storage> Storage,
127  format_type Format,
128  size_type BaseLayer,
129  size_type BaseFace,
130  size_type BaseLevel);
131 
132  std::shared_ptr<storage> Storage;
133  format_type const Format;
134  size_type const BaseLevel;
135  data_type * Data;
136  size_type const Size;
137 
138  data_type * compute_data(size_type BaseLayer, size_type BaseFace, size_type BaseLevel);
139  size_type compute_size(size_type Level) const;
140  };
141 }//namespace gli
142 
143 #include "./core/image.inl"
texture1D
Definition: texture1d.hpp:37
Image.
Definition: image.hpp:39
bool empty() const
Return whether the image instance is empty, no storage or description have been assigned to the insta...
size_type size() const
Return the memory size of an image instance storage in bytes.
format_type format() const
Return the image instance format.
dim_type dimensions() const
Return the dimensions of an image instance: width, height and depth.
void clear()
Clear the entire image storage with zeros.
void * data()
Return a pointer to the beginning of the image instance data.
image()
Create an empty image instance.
OpenGL Image (gli.g-truc.net)
void store(dim_type const &TexelCoord, genType const &Data)
Store the texel located at TexelCoord coordinates.
genType load(dim_type const &TexelCoord)
Load the texel located at TexelCoord coordinates.
texture2D
Definition: texture2d.hpp:37
texture3D
Definition: texture3d.hpp:37