Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

glbase.h

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002 
00003    this file is part of rcssserver3D
00004    Fri May 9 2003
00005    Copyright (C) 2002,2003 Koblenz University
00006    Copyright (C) 2003 RoboCup Soccer Server 3D Maintenance Group
00007    $Id: glbase.h,v 1.2 2004/04/28 14:42:17 rollmark Exp $
00008 
00009    This program is free software; you can redistribute it and/or modify
00010    it under the terms of the GNU General Public License as published by
00011    the Free Software Foundation; version 2 of the License.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00021 */
00022 #ifndef KEROSIN_GLBASE_H
00023 #define KEROSIN_GLBASE_H
00024 
00025 namespace kerosin
00026 {
00027 class RGBA
00028 {
00029 public:
00030     union
00031     {
00032         float v[4];
00033         struct
00034         {
00035             float r;
00036             float g;
00037             float b;
00038             float a;
00039         } c;
00040     } data;
00041 
00042 public:
00043     RGBA()
00044     {
00045         data.c.r = 1.0f;
00046         data.c.g = 1.0f;
00047         data.c.b = 1.0f;
00048         data.c.a = 1.0f;
00049     }
00050 
00051     RGBA(float rr, float gg, float bb, float aa)
00052     {
00053         data.c.r = rr;
00054         data.c.g = gg;
00055         data.c.b = bb;
00056         data.c.a = aa;
00057     }
00058 
00059     float& r() { return data.c.r; }
00060     float& g() { return data.c.g; }
00061     float& b() { return data.c.b; }
00062     float& a() { return data.c.a; }
00063 
00064     const float& r() const { return data.c.r; }
00065     const float& g() const { return data.c.g; }
00066     const float& b() const { return data.c.b; }
00067     const float& a() const { return data.c.a; }
00068 
00069     float* v() { return data.v; }
00070     const float* v() const { return data.v; }
00071 
00072     operator float* () { return data.v; }
00073     operator const float*() const { return data.v; }
00074 };
00075 
00076 };
00077 
00078 #endif // KEROSIN_GLBASE_H

Generated on Thu Apr 6 15:25:38 2006 for rcssserver3d by  doxygen 1.4.4