MyGUI 3.0.1
MyGUI_RenderFormat.h
Go to the documentation of this file.
00001 
00007 /*
00008     This file is part of MyGUI.
00009 
00010     MyGUI is free software: you can redistribute it and/or modify
00011     it under the terms of the GNU Lesser General Public License as published by
00012     the Free Software Foundation, either version 3 of the License, or
00013     (at your option) any later version.
00014 
00015     MyGUI is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU Lesser General Public License for more details.
00019 
00020     You should have received a copy of the GNU Lesser General Public License
00021     along with MyGUI.  If not, see <http://www.gnu.org/licenses/>.
00022 */
00023 #ifndef __MYGUI_RENDER_FORMAT_H__
00024 #define __MYGUI_RENDER_FORMAT_H__
00025 
00026 #include "MyGUI_Macros.h"
00027 
00028 namespace MyGUI
00029 {
00030 
00031     struct MYGUI_EXPORT VertexColourType
00032     {
00033         enum Enum
00034         {
00035             ColourARGB, // D3D style compact colour
00036             ColourABGR, // GL style compact colour
00037             MAX
00038         };
00039 
00040         VertexColourType(Enum _value = MAX) : value(_value) { }
00041 
00042         friend bool operator == (VertexColourType const& a, VertexColourType const& b) { return a.value == b.value; }
00043         friend bool operator != (VertexColourType const& a, VertexColourType const& b) { return a.value != b.value; }
00044 
00045     private:
00046         Enum value;
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) : value(_value) { }
00061 
00062         friend bool operator == (PixelFormat const& a, PixelFormat const& b) { return a.value == b.value; }
00063         friend bool operator != (PixelFormat const& a, PixelFormat const& b) { return a.value != b.value; }
00064 
00065     private:
00066         Enum value;
00067     };
00068 
00069     struct MYGUI_EXPORT TextureUsage
00070     {
00071         enum Enum
00072         {
00073             Default = MYGUI_FLAG_NONE,
00074             Static = MYGUI_FLAG(0),
00075             Dynamic = MYGUI_FLAG(1),
00076             Stream = MYGUI_FLAG(2),
00077             Read = MYGUI_FLAG(3),
00078             Write = MYGUI_FLAG(4),
00079             RenderTarget = MYGUI_FLAG(5)
00080         };
00081 
00082         TextureUsage(Enum _value = Default) : value(_value) { }
00083 
00084         friend bool operator == (TextureUsage const& a, TextureUsage const& b) { return a.value == b.value; }
00085         friend bool operator != (TextureUsage const& a, TextureUsage const& b) { return a.value != b.value; }
00086 
00087         TextureUsage& operator |= (TextureUsage const& _other) { value = Enum(int(value) | int(_other.value)); return *this; }
00088         friend TextureUsage operator | (Enum const& a, Enum const& b) { return TextureUsage(Enum(int(a) | int(b))); }
00089         friend TextureUsage operator | (TextureUsage const& a, TextureUsage const& b) { return TextureUsage(Enum(int(a.value) | int(b.value))); }
00090 
00091         bool isValue(Enum _value) { return 0 != (value & _value); }
00092 
00093     private:
00094         Enum value;
00095     };
00096 
00097 } // namespace MyGUI
00098 
00099 
00100 #endif // __MYGUI_RENDER_FORMAT_H__