MyGUI
3.2.1
|
00001 /* 00002 * This source file is part of MyGUI. For the latest info, see http://mygui.info/ 00003 * Distributed under the MIT License 00004 * (See accompanying file COPYING.MIT or copy at http://opensource.org/licenses/MIT) 00005 */ 00006 00007 #ifndef __MYGUI_RENDER_FORMAT_H__ 00008 #define __MYGUI_RENDER_FORMAT_H__ 00009 00010 #include "MyGUI_Macros.h" 00011 00012 namespace MyGUI 00013 { 00014 00015 struct MYGUI_EXPORT VertexColourType 00016 { 00017 public: 00018 enum Enum 00019 { 00020 ColourARGB, // D3D style compact colour 00021 ColourABGR, // GL style compact colour 00022 MAX 00023 }; 00024 00025 VertexColourType(Enum _value = MAX) : 00026 mValue(_value) 00027 { 00028 } 00029 00030 friend bool operator == (VertexColourType const& a, VertexColourType const& b) 00031 { 00032 return a.mValue == b.mValue; 00033 } 00034 00035 friend bool operator != (VertexColourType const& a, VertexColourType const& b) 00036 { 00037 return a.mValue != b.mValue; 00038 } 00039 00040 int getValue() const 00041 { 00042 return mValue; 00043 } 00044 00045 private: 00046 Enum mValue; 00047 }; 00048 00049 struct MYGUI_EXPORT PixelFormat 00050 { 00051 enum Enum 00052 { 00053 Unknow, 00054 L8, // 1 byte pixel format, 1 byte luminance 00055 L8A8, // 2 byte pixel format, 1 byte luminance, 1 byte alpha 00056 R8G8B8, // 24-bit pixel format, 8 bits for red, green and blue. 00057 R8G8B8A8 // 32-bit pixel format, 8 bits for red, green, blue and alpha. 00058 }; 00059 00060 PixelFormat(Enum _value = Unknow) : 00061 mValue(_value) 00062 { 00063 } 00064 00065 friend bool operator == (PixelFormat const& a, PixelFormat const& b) 00066 { 00067 return a.mValue == b.mValue; 00068 } 00069 00070 friend bool operator != (PixelFormat const& a, PixelFormat const& b) 00071 { 00072 return a.mValue != b.mValue; 00073 } 00074 00075 int getValue() const 00076 { 00077 return mValue; 00078 } 00079 00080 private: 00081 Enum mValue; 00082 }; 00083 00084 struct MYGUI_EXPORT TextureUsage 00085 { 00086 enum Enum 00087 { 00088 Default = MYGUI_FLAG_NONE, 00089 Static = MYGUI_FLAG(0), 00090 Dynamic = MYGUI_FLAG(1), 00091 Stream = MYGUI_FLAG(2), 00092 Read = MYGUI_FLAG(3), 00093 Write = MYGUI_FLAG(4), 00094 RenderTarget = MYGUI_FLAG(5) 00095 }; 00096 00097 TextureUsage(Enum _value = Default) : 00098 mValue(_value) 00099 { 00100 } 00101 00102 friend bool operator == (TextureUsage const& a, TextureUsage const& b) 00103 { 00104 return a.mValue == b.mValue; 00105 } 00106 00107 friend bool operator != (TextureUsage const& a, TextureUsage const& b) 00108 { 00109 return a.mValue != b.mValue; 00110 } 00111 00112 TextureUsage& operator |= (TextureUsage const& _other) 00113 { 00114 mValue = Enum(int(mValue) | int(_other.mValue)); 00115 return *this; 00116 } 00117 00118 friend TextureUsage operator | (Enum const& a, Enum const& b) 00119 { 00120 return TextureUsage(Enum(int(a) | int(b))); 00121 } 00122 00123 friend TextureUsage operator | (TextureUsage const& a, TextureUsage const& b) 00124 { 00125 return TextureUsage(Enum(int(a.mValue) | int(b.mValue))); 00126 } 00127 00128 bool isValue(Enum _value) const 00129 { 00130 return 0 != (mValue & _value); 00131 } 00132 00133 int getValue() const 00134 { 00135 return mValue; 00136 } 00137 00138 private: 00139 Enum mValue; 00140 }; 00141 00142 } // namespace MyGUI 00143 00144 00145 #endif // __MYGUI_RENDER_FORMAT_H__