oculus1

view libovr/Src/Kernel/OVR_Color.h @ 18:1b107de821c1

fixed the test to work with non-pow2 textures
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 26 Sep 2013 10:33:08 +0300
parents e2f9e4603129
children
line source
1 /************************************************************************************
3 PublicHeader: OVR.h
4 Filename : OVR_Color.h
5 Content : Contains color struct.
6 Created : February 7, 2013
7 Notes :
9 Copyright : Copyright 2013 Oculus VR, Inc. All Rights reserved.
11 Use of this software is subject to the terms of the Oculus license
12 agreement provided at the time of installation or download, or which
13 otherwise accompanies this software in either electronic or hard copy form.
15 ************************************************************************************/
16 #ifndef OVR_Color_h
17 #define OVR_Color_h
19 #include "OVR_Types.h"
21 namespace OVR {
23 struct Color
24 {
25 UByte R,G,B,A;
27 Color() {}
29 // Constructs color by channel. Alpha is set to 0xFF (fully visible)
30 // if not specified.
31 Color(unsigned char r,unsigned char g,unsigned char b, unsigned char a = 0xFF)
32 : R(r), G(g), B(b), A(a) { }
34 // 0xAARRGGBB - Common HTML color Hex layout
35 Color(unsigned c)
36 : R((unsigned char)(c>>16)), G((unsigned char)(c>>8)),
37 B((unsigned char)c), A((unsigned char)(c>>24)) { }
39 bool operator==(const Color& b) const
40 {
41 return R == b.R && G == b.G && B == b.B && A == b.A;
42 }
44 void GetRGBA(float *r, float *g, float *b, float* a) const
45 {
46 *r = R / 255.0f;
47 *g = G / 255.0f;
48 *b = B / 255.0f;
49 *a = A / 255.0f;
50 }
51 };
53 }
55 #endif