K3dColor3.h

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

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