MyGUI  3.2.0
MyGUI_RenderFormat.h
Go to the documentation of this file.
1 
6 /*
7  This file is part of MyGUI.
8 
9  MyGUI is free software: you can redistribute it and/or modify
10  it under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  (at your option) any later version.
13 
14  MyGUI is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU Lesser General Public License for more details.
18 
19  You should have received a copy of the GNU Lesser General Public License
20  along with MyGUI. If not, see <http://www.gnu.org/licenses/>.
21 */
22 #ifndef __MYGUI_RENDER_FORMAT_H__
23 #define __MYGUI_RENDER_FORMAT_H__
24 
25 #include "MyGUI_Macros.h"
26 
27 namespace MyGUI
28 {
29 
31  {
32  public:
33  enum Enum
34  {
35  ColourARGB, // D3D style compact colour
36  ColourABGR, // GL style compact colour
37  MAX
38  };
39 
40  VertexColourType(Enum _value = MAX) :
41  value(_value)
42  {
43  }
44 
45  friend bool operator == (VertexColourType const& a, VertexColourType const& b)
46  {
47  return a.value == b.value;
48  }
49 
50  friend bool operator != (VertexColourType const& a, VertexColourType const& b)
51  {
52  return a.value != b.value;
53  }
54 
55  private:
56  Enum value;
57  };
58 
60  {
61  enum Enum
62  {
64  L8, // 1 byte pixel format, 1 byte luminance
65  L8A8, // 2 byte pixel format, 1 byte luminance, 1 byte alpha
66  R8G8B8, // 24-bit pixel format, 8 bits for red, green and blue.
67  R8G8B8A8 // 32-bit pixel format, 8 bits for red, green, blue and alpha.
68  };
69 
70  PixelFormat(Enum _value = Unknow) :
71  value(_value)
72  {
73  }
74 
75  friend bool operator == (PixelFormat const& a, PixelFormat const& b)
76  {
77  return a.value == b.value;
78  }
79 
80  friend bool operator != (PixelFormat const& a, PixelFormat const& b)
81  {
82  return a.value != b.value;
83  }
84 
85  private:
86  Enum value;
87  };
88 
90  {
91  enum Enum
92  {
93  Default = MYGUI_FLAG_NONE,
94  Static = MYGUI_FLAG(0),
95  Dynamic = MYGUI_FLAG(1),
96  Stream = MYGUI_FLAG(2),
97  Read = MYGUI_FLAG(3),
98  Write = MYGUI_FLAG(4),
99  RenderTarget = MYGUI_FLAG(5)
100  };
101 
102  TextureUsage(Enum _value = Default) :
103  value(_value)
104  {
105  }
106 
107  friend bool operator == (TextureUsage const& a, TextureUsage const& b)
108  {
109  return a.value == b.value;
110  }
111 
112  friend bool operator != (TextureUsage const& a, TextureUsage const& b)
113  {
114  return a.value != b.value;
115  }
116 
117  TextureUsage& operator |= (TextureUsage const& _other)
118  {
119  value = Enum(int(value) | int(_other.value));
120  return *this;
121  }
122 
123  friend TextureUsage operator | (Enum const& a, Enum const& b)
124  {
125  return TextureUsage(Enum(int(a) | int(b)));
126  }
127 
128  friend TextureUsage operator | (TextureUsage const& a, TextureUsage const& b)
129  {
130  return TextureUsage(Enum(int(a.value) | int(b.value)));
131  }
132 
133  bool isValue(Enum _value) const
134  {
135  return 0 != (value & _value);
136  }
137 
138  private:
139  Enum value;
140  };
141 
142 } // namespace MyGUI
143 
144 
145 #endif // __MYGUI_RENDER_FORMAT_H__