ezEngine  Milestone 7
ImageHeader.h
1 #pragma once
2 
4 #include <Foundation/Math/Math.h>
5 #include <Foundation/Math/Color8UNorm.h>
6 
7 #include <CoreUtils/Basics.h>
8 #include <CoreUtils/Image/ImageFormat.h>
9 
14 class EZ_COREUTILS_DLL ezImageHeader
15 {
16 public:
19  m_uiNumMipLevels(1), m_uiNumFaces(1), m_uiNumArrayIndices(1),
20  m_uiWidth(0), m_uiHeight(0), m_uiDepth(1),
21  m_format(ezImageFormat::UNKNOWN)
22  {
23  }
24 
26  void SetImageFormat(const ezImageFormat::Enum& format)
27  {
28  m_format = format;
29  }
30 
32  const ezImageFormat::Enum& GetImageFormat() const
33  {
34  return m_format;
35  }
36 
38  void SetWidth(ezUInt32 uiWidth)
39  {
40  m_uiWidth = uiWidth;
41  }
42 
44  ezUInt32 GetWidth(ezUInt32 uiMipLevel = 0) const
45  {
46  EZ_ASSERT_DEV(uiMipLevel < m_uiNumMipLevels, "Invalid mip level");
47  return ezMath::Max(m_uiWidth >> uiMipLevel, 1U);
48  }
49 
51  void SetHeight(ezUInt32 uiHeight)
52  {
53  m_uiHeight = uiHeight;
54  }
55 
57  ezUInt32 GetHeight(ezUInt32 uiMipLevel = 0) const
58  {
59  EZ_ASSERT_DEV(uiMipLevel < m_uiNumMipLevels, "Invalid mip level");
60  return ezMath::Max(m_uiHeight >> uiMipLevel, 1U);
61  }
62 
64  void SetDepth(ezUInt32 uiDepth)
65  {
66  m_uiDepth = uiDepth;
67  }
68 
70  ezUInt32 GetDepth(ezUInt32 uiMipLevel = 0) const
71  {
72  EZ_ASSERT_DEV(uiMipLevel < m_uiNumMipLevels, "Invalid mip level");
73  return ezMath::Max(m_uiDepth >> uiMipLevel, 1U);
74  }
75 
79  void SetNumMipLevels(ezUInt32 uiNumMipLevels)
80  {
81  m_uiNumMipLevels = uiNumMipLevels;
82  }
83 
85  ezUInt32 GetNumMipLevels() const
86  {
87  return m_uiNumMipLevels;
88  }
89 
93  void SetNumFaces(ezUInt32 uiNumFaces)
94  {
95  m_uiNumFaces = uiNumFaces;
96  }
97 
99  ezUInt32 GetNumFaces() const
100  {
101  return m_uiNumFaces;
102  }
103 
107  void SetNumArrayIndices(ezUInt32 uiNumArrayIndices)
108  {
109  m_uiNumArrayIndices = uiNumArrayIndices;
110  }
111 
113  ezUInt32 GetNumArrayIndices() const
114  {
115  return m_uiNumArrayIndices;
116  }
117 
118 protected:
119  ezUInt32 m_uiNumMipLevels;
120  ezUInt32 m_uiNumFaces;
121  ezUInt32 m_uiNumArrayIndices;
122 
123  ezUInt32 m_uiWidth;
124  ezUInt32 m_uiHeight;
125  ezUInt32 m_uiDepth;
126 
127  ezImageFormat::Enum m_format;
128 };
129