OVR_Color.h
Go to the documentation of this file.
00001 /************************************************************************************
00002 
00003 PublicHeader:   OVR.h
00004 Filename    :   OVR_Color.h
00005 Content     :   Contains color struct.
00006 Created     :   February 7, 2013
00007 Notes       : 
00008 
00009 Copyright   :   Copyright 2013 Oculus VR, Inc. All Rights reserved.
00010 
00011 Use of this software is subject to the terms of the Oculus license
00012 agreement provided at the time of installation or download, or which
00013 otherwise accompanies this software in either electronic or hard copy form.
00014 
00015 ************************************************************************************/
00016 #ifndef OVR_Color_h
00017 #define OVR_Color_h
00018 
00019 #include "OVR_Types.h"
00020 
00021 namespace OVR {
00022 
00023 struct Color
00024 {
00025     UByte R,G,B,A;
00026 
00027     Color() {}
00028 
00029     // Constructs color by channel. Alpha is set to 0xFF (fully visible)
00030     // if not specified.
00031     Color(unsigned char r,unsigned char g,unsigned char b, unsigned char a = 0xFF)
00032         : R(r), G(g), B(b), A(a) { }
00033 
00034     // 0xAARRGGBB - Common HTML color Hex layout
00035     Color(unsigned c)
00036         : R((unsigned char)(c>>16)), G((unsigned char)(c>>8)),
00037         B((unsigned char)c), A((unsigned char)(c>>24)) { }
00038 
00039     bool operator==(const Color& b) const
00040     {
00041         return R == b.R && G == b.G && B == b.B && A == b.A;
00042     }
00043 
00044     void  GetRGBA(float *r, float *g, float *b, float* a) const
00045     {
00046         *r = R / 255.0f;
00047         *g = G / 255.0f;
00048         *b = B / 255.0f;
00049         *a = A / 255.0f;
00050     }
00051 };
00052 
00053 }
00054 
00055 #endif


oculus_sdk
Author(s):
autogenerated on Mon Oct 6 2014 03:01:18