glc_light.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 2.0.0 Beta 1, packaged on April 2010.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib 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; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_LIGHT_H_
00028 #define GLC_LIGHT_H_
00029 
00030 #include <QColor>
00031 #include "../glc_object.h"
00032 #include "../maths/glc_vector3d.h"
00033 
00034 #include "../glc_config.h"
00035 
00038 
00042 
00043 
00044 class GLC_LIB_EXPORT GLC_Light :
00045         public GLC_Object
00046 {
00048 
00050 
00051 public:
00053 
00054         GLC_Light();
00055         //* Construct GLC_Light with specified diffuse color
00056         GLC_Light(const QColor& );
00057 
00059         virtual ~GLC_Light(void);
00061 
00063 
00065 
00066 public:
00068         inline GLC_Point3d position(void) const {return m_Position;}
00069 
00071         inline QColor ambientColor() {return m_AmbientColor;}
00072 
00074         inline QColor diffuseColor() { return m_DiffuseColor;}
00075 
00077         inline QColor specularColor() {return m_SpecularColor;}
00078 
00080         inline bool isTwoSided() const {return m_TwoSided;}
00082 
00084 
00086 
00087 public:
00089         void setPosition(const GLC_Point3d &);
00090 
00092         void setPosition(GLfloat, GLfloat, GLfloat);
00093 
00095         void setAmbientColor(const QColor &);
00096 
00098         void setDiffuseColor(const QColor &);
00099 
00101         void setSpecularColor(const QColor &);
00102 
00104         inline void setTwoSided(const bool mode)
00105         {
00106                 m_TwoSided= mode;
00107                 m_ListIsValid = false;
00108         }
00110 
00112 
00114 
00115 public:
00117         inline void enable(void)
00118         {glEnable(m_LightID);}
00119 
00120         // Disable the light
00121         inline void disable(void)
00122         {glDisable(m_LightID);}
00123 
00125         virtual void glExecute(GLenum Mode= GL_COMPILE_AND_EXECUTE);
00127 
00129 
00131 
00132 
00133 private:
00135         void glDraw(void);
00136 
00138         void creationList(GLenum Mode);
00139 
00140 private:
00141 
00143         void deleteList(void);
00144 
00146 
00148 // Private Members
00150 
00151 private:
00153         GLenum m_LightID;
00154 
00156         GLuint m_ListID;
00157 
00159         bool m_ListIsValid;
00160 
00162         QColor m_AmbientColor;
00164         QColor m_DiffuseColor;
00166         QColor m_SpecularColor;
00167 
00169         GLC_Point3d m_Position;
00170 
00172         bool m_TwoSided;
00173 
00174 };
00175 #endif //GLC_LIGHT_H_

SourceForge.net Logo

©2005 Laurent Ribon