KeosLight.h

Go to the documentation of this file.
00001 /*
00002  * This source file is part of KEOS (Free 3D Engine)
00003  * For the latest info, see http://www.keosengine.org/
00004  * E-mails : thierry.vouriot@keosengine.org, yeri@keosengine.org
00005  *
00006  * This program is free software; you can redistribute it and/or modify it under
00007  * the terms of the GNU Lesser General Public License as published by the Free Software
00008  * Foundation; either version 2 of the License, or (at your option) any later
00009  * version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but WITHOUT
00012  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00013  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License along with
00016  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00017  * Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00018  * http://www.gnu.org/copyleft/lesser.txt.
00019  *
00020  */
00021 
00022 #ifndef KEOS_LIGHT_H
00023 #define KEOS_LIGHT_H
00024 
00025 #include "KeosPrerequisites.h"
00026 #include "KeosColor.h"
00027 #include "KeosMath.h"
00028 
00029 namespace Keos
00030 {
00031   //-----------------------------------------------------------------------
00034   class KEOS_EXPORT CLight
00035   {
00036   public:
00037 
00039     enum TLightType
00040     {
00042       LT_POINT,
00044       LT_DIRECTIONAL,
00046       LT_SPOT
00047     };
00048 
00051     CLight();
00052 
00055     ~CLight();
00056 
00059     void SetType(TLightType nType);
00060 
00063     TLightType GetType(void) const;
00064 
00067     void SetDiffuseColor(float fRed, float fGreen, float fBlue);
00068 
00071     void SetDiffuseColor(const CColor& Color);
00072 
00075     const CColor& GetDiffuseColor(void) const;
00076 
00079     void SetSpecularColor(float fRed, float fGreen, float fBlue);
00080 
00083     void SetSpecularColor(const CColor& Color);
00084 
00087     const CColor& GetSpecularColor(void) const;
00088 
00095     void SetAttenuation(Real range, Real constant, Real linear, Real quadratic);
00096 
00099     Real GetAttenuationRange(void) const;
00100 
00103     Real GetAttenuationConstant(void) const;
00104 
00107     Real GetAttenuationLinear(void) const;
00108 
00111     Real GetAttenuationQuadric(void) const;
00112 
00119     void SetSpotRange(const CRadian& innerAngle, const CRadian& outerAngle, Real falloff = 1.0);
00120 
00123     const CRadian& GetSpotInnerAngle(void) const;
00124 
00127     const CRadian& GetSpotOuterAngle(void) const;
00128 
00131     Real GetSpotFalloff(void) const;
00132 
00135     void SetSpotInnerAngle(const CRadian& val);
00136 
00139     void SetSpotOuterAngle(const CRadian& val);
00140 
00143     void SetSpotFalloff(Real val);
00144 
00145 
00149     void SetPosition(float x, float y, float z);
00150 
00154     void SetPosition(const TVector3F& Vec);
00155 
00158     const TVector3F& GetPosition(void) const;
00159 
00163     void SetDirection(float x, float y, float z);
00164 
00168     void SetDirection(const TVector3F& Vec);
00169 
00172     const TVector3F& GetDirection(void) const;
00173 
00174   private:
00175 
00176     TLightType m_nLightType;
00177     TVector3F m_Position;
00178     CColor m_Diffuse;
00179     CColor m_Specular;
00180 
00181     TVector3F m_Direction;
00182 
00183     CRadian m_SpotOuter;
00184     CRadian m_SpotInner;
00185     Real m_SpotFalloff;
00186 
00187     Real m_Range;
00188     Real m_AttenuationConst;
00189     Real m_AttenuationLinear;
00190     Real m_AttenuationQuad;
00191   };
00192 
00194   typedef CSmartPtr<CLight, CRefCount> TLightPtr;
00195 
00196 } // namespace Keos
00197 
00198 #endif // KEOS_LIGHT_H

Generated on Fri Mar 9 14:29:02 2007 for Keos by  doxygen 1.5.1-p1