oculus1

annotate libovr/Src/Kernel/OVR_Color.h @ 1:e2f9e4603129

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