K3dColor4.h

Go to the documentation of this file.
00001 
00013 /***************************************************************************
00014  *   Copyright (C) 2007 by Jan Koci   *
00015  *   honza.koci@email.cz   *
00016  *   http://kengine.sourceforge.net/tutorial/
00017  *                                                                         *
00018  *   This program is free software; you can redistribute it and/or modify  *
00019  *   it under the terms of the GNU General Public License as published by  *
00020  *   the Free Software Foundation; either version 2 of the License, or     *
00021  *   (at your option) any later version.                                   *
00022  *                                                                         *
00023  *   This program is distributed in the hope that it will be useful,       *
00024  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00025  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00026  *   GNU General Public License for more details.                          *
00027  *                                                                         *
00028  *   You should have received a copy of the GNU General Public License     *
00029  *   along with this program; if not, write to the                         *
00030  *   Free Software Foundation, Inc.,                                       *
00031  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00032  ***************************************************************************/
00033 
00034 #pragma once
00035 
00036 #include "K3dOpenGL.h"
00037 
00038 class K3dColor4
00039 {
00040                 GLubyte m_aColor[4];
00041                 int m_iId;                              
00042         public:
00043                 K3dColor4();
00044                 ~K3dColor4();
00045 
00047                 void Reset();
00048 
00050                 GLubyte *GetColorArray()
00051                 {
00052                         return m_aColor;
00053                 }
00054 
00056                 int &GetId()
00057                 {
00058                         return m_iId;
00059                 }
00060 
00062                 GLubyte &operator[] ( int i )
00063                 {
00064                         if ( ! ( 0 <= i ) && ( i < 4 ) )
00065                         {
00066                                 cerr << "Error index -- Index must be from 0 to 3" << i <<endl;
00067                                 return m_aColor[0];
00068                         }
00069                         return m_aColor[i];
00070                 }
00071                 GLubyte operator[] ( int i ) const
00072                 {
00073                         if ( ! ( 0 <= i ) && ( i < 4 ) )
00074                         {
00075                                 cerr << "Error index -- Index must be from 0 to 3" << i <<endl;
00076                                 return m_aColor[0];
00077                         }
00078                         return m_aColor[i];
00079                 }
00080 
00082                 GLubyte &GetR()
00083                 {
00084                         return m_aColor[0];
00085                 }
00086 
00088                 GLubyte &GetG()
00089                 {
00090                         return m_aColor[1];
00091                 }
00092 
00094                 GLubyte &GetB()
00095                 {
00096                         return m_aColor[2];
00097                 }
00098 
00100                 GLubyte &GetA()
00101                 {
00102                         return m_aColor[3];
00103                 }
00104 };
00105 

Generated on Thu Aug 16 23:53:26 2007 for K3dEngine by  doxygen 1.5.0