Ion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cubemaptexture.h
Go to the documentation of this file.
1 
18 #ifndef ION_GFX_CUBEMAPTEXTURE_H_
19 #define ION_GFX_CUBEMAPTEXTURE_H_
20 
21 #include "ion/gfx/texture.h"
22 
23 namespace ion {
24 namespace gfx {
25 
28 class ION_API CubeMapTexture : public TextureBase {
29  public:
31  enum Changes {
32  kNegativeXSubImageChanged = TextureBase::kNumChanges,
40  kNegativeYMipmapChanged = kNegativeXMipmapChanged + kMipmapSlotCount,
41  kNegativeZMipmapChanged = kNegativeYMipmapChanged + kMipmapSlotCount,
42  kPositiveXMipmapChanged = kNegativeZMipmapChanged + kMipmapSlotCount,
43  kPositiveYMipmapChanged = kPositiveXMipmapChanged + kMipmapSlotCount,
44  kPositiveZMipmapChanged = kPositiveYMipmapChanged + kMipmapSlotCount,
45  kNumChanges = kPositiveZMipmapChanged + kMipmapSlotCount
46  };
47 
49  enum CubeFace {
56  };
57 
59 
61  void SetImage(CubeFace face, size_t level, const ImagePtr& image) {
62  if (GetImmutableImage().Get())
63  LOG(ERROR) << "ION: SetImage() called on immutable texture \""
64  << GetLabel()
65  << "\". Use SetSubImage() to update an immutable texture.";
66  else
67  faces_[face].SetImage(level, image, this);
68  }
69  bool HasImage(CubeFace face, size_t level) const {
70  return faces_[face].HasImage(level);
71  }
72  const ImagePtr GetImage(CubeFace face, size_t level) const {
73  return faces_[face].GetImage(level);
74  }
75  size_t GetImageCount(CubeFace face) const {
76  return faces_[face].GetImageCount();
77  }
78  void SetSubImage(CubeFace face, size_t level, const math::Point2ui offset,
79  const ImagePtr& image) {
80  faces_[face].SetSubImage(level, offset, image);
81  }
82  void SetSubImage(CubeFace face, size_t level, const math::Point3ui offset,
83  const ImagePtr& image) {
84  faces_[face].SetSubImage(level, offset, image);
85  }
87  return faces_[face].GetSubImages();
88  }
89  void ClearSubImages(CubeFace face) const {
90  faces_[face].ClearSubImages();
91  }
92 
93  protected:
96  ~CubeMapTexture() override;
97 
98  private:
100  void OnNotify(const base::Notifier* notifier) override;
101 
103  Face* faces_;
106  Face facenx_;
107  Face faceny_;
108  Face facenz_;
109  Face facepx_;
110  Face facepy_;
111  Face facepz_;
112 };
113 
116 
117 } // namespace gfx
118 } // namespace ion
119 
120 #endif // ION_GFX_CUBEMAPTEXTURE_H_
int level
const base::AllocVector< SubImage > & GetSubImages(CubeFace face) const
#define LOG(severity)
Logs the streamed message unconditionally with a severity of severity.
Definition: logging.h:216
A Notifier both sends notifications to and receives notifications from other Notifiers.
Definition: notifier.h:35
base::ReferentPtr< CubeMapTexture >::Type CubeMapTexturePtr
Convenience typedef for shared pointer to a CubeMapTexture.
CubeFace
The names of faces of the cube map.
Changes
Changes that affect this resource.
uint32 offset
void SetSubImage(CubeFace face, size_t level, const math::Point3ui offset, const ImagePtr &image)
void ClearSubImages(CubeFace face) const
const Grid & image
The original monochrome image data, as doubles (0 - 1).
Definition: sdfutils.cc:90
size_t GetImageCount(CubeFace face) const
void SetImage(CubeFace face, size_t level, const ImagePtr &image)
See comments in TextureBase::Face.
void SetSubImage(CubeFace face, size_t level, const math::Point2ui offset, const ImagePtr &image)
This is an internal base class for all texture types.
Definition: texture.h:41
A CubeMapTexture object represents the image data and mipmaps associated with the six faces of a cube...
bool HasImage(CubeFace face, size_t level) const
A SharedPtr is a smart shared pointer to an instance of some class that implements reference counting...
Definition: sharedptr.h:60
This class can be used in place of std::vector to allow an Ion Allocator to be used for memory alloca...
Definition: allocvector.h:50
const ImagePtr GetImage(CubeFace face, size_t level) const