Unofficial OpenGL Software Development Kit  0.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
ImageSet.h
Go to the documentation of this file.
1 
2 #ifndef GLIMG_IMAGE_SET_H
3 #define GLIMG_IMAGE_SET_H
4 
11 #include "ImageFormat.h"
12 #include "boost/shared_ptr.hpp"
13 #include "boost/noncopyable.hpp"
14 
15 namespace glimg
16 {
19 
24  struct Dimensions
25  {
27  int width;
28  int height;
29  int depth;
30 
32  int NumLines() const
33  {
34  switch(numDimensions)
35  {
36  case 1:
37  return 1;
38  case 2:
39  return height;
40  case 3:
41  return depth * height;
42  }
43 
44  //Should not be possible.
45  return -1;
46  }
47  };
48 
49  namespace detail
50  {
51  class ImageSetImpl;
52  typedef boost::shared_ptr<const ImageSetImpl> ImageSetImplPtr;
53  }
54 
55  class ImageSet;
56 
67  {
68  public:
70  Dimensions GetDimensions() const;
71 
73  ImageFormat GetFormat() const;
74 
82  const void *GetImageData() const;
83 
85  size_t GetImageByteSize() const;
86 
87  private:
88  detail::ImageSetImplPtr m_pImpl;
89  int m_arrayIx;
90  int m_faceIx;
91  int m_mipmapLevel;
92 
93  friend class detail::ImageSetImpl;
94  friend class ImageSet;
95 
96  SingleImage(detail::ImageSetImplPtr pImpl, int mipmapLevel, int arrayIx, int faceIx);
97  };
98 
118  class ImageSet
119  {
120  public:
124  Dimensions GetDimensions() const;
125 
131  int GetMipmapCount() const;
132 
142  int GetArrayCount() const;
143 
150  int GetFaceCount() const;
151 
155  ImageFormat GetFormat() const;
156 
163  SingleImage GetImage(int mipmapLevel, int arrayIx = 0, int faceIx = 0) const;
164 
173  const void *GetImageArray(int mipmapLevel) const;
174 
175  private:
176  detail::ImageSetImplPtr m_pImpl;
177 
178  explicit ImageSet(detail::ImageSetImplPtr pImpl);
179 
180  friend class ImageCreator;
181  friend void CreateTexture(unsigned int textureName, const ImageSet *pImage, unsigned int forceConvertBits);
182  };
183 
185 }
186 
187 
188 #endif //GLIMG_IMAGE_SET_H