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