Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreLight.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of OGRE
00004     (Object-oriented Graphics Rendering Engine)
00005 For the latest info, see http://www.ogre3d.org/
00006 
00007 Copyright (c) 2000-2005 The OGRE Team
00008 Also see acknowledgements in Readme.html
00009 
00010 This program is free software; you can redistribute it and/or modify it under
00011 the terms of the GNU Lesser General Public License as published by the Free Software
00012 Foundation; either version 2 of the License, or (at your option) any later
00013 version.
00014 
00015 This program is distributed in the hope that it will be useful, but WITHOUT
00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00018 
00019 You should have received a copy of the GNU Lesser General Public License along with
00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00022 http://www.gnu.org/copyleft/lesser.txt.
00023 -----------------------------------------------------------------------------
00024 */
00025 #ifndef _LIGHT_H__
00026 #define _LIGHT_H__
00027 
00028 #include "OgrePrerequisites.h"
00029 
00030 #include "OgreColourValue.h"
00031 #include "OgreVector3.h"
00032 #include "OgreVector4.h"
00033 #include "OgreString.h"
00034 #include "OgreMovableObject.h"
00035 #include "OgrePlaneBoundedVolume.h"
00036 
00037 namespace Ogre {
00038 
00039 
00062     class _OgreExport Light : public MovableObject
00063     {
00064     public:
00066         Real tempSquareDist;
00067 
00069         enum LightTypes
00070         {
00072             LT_POINT,
00074             LT_DIRECTIONAL,
00076             LT_SPOTLIGHT
00077         };
00078 
00081         Light();
00082 
00085         Light(const String& name);
00086 
00089         ~Light();
00090 
00093         const String& getName(void) const;
00094 
00097         void setType(LightTypes type);
00098 
00101         LightTypes getType(void) const;
00102 
00112         void setDiffuseColour(Real red, Real green, Real blue);
00113 
00123         void setDiffuseColour(const ColourValue& colour);
00124 
00127         const ColourValue& getDiffuseColour(void) const;
00128 
00138         void setSpecularColour(Real red, Real green, Real blue);
00139 
00149         void setSpecularColour(const ColourValue& colour);
00150 
00153         const ColourValue& getSpecularColour(void) const;
00154 
00174         void setAttenuation(Real range, Real constant, Real linear, Real quadratic);
00175 
00178         Real getAttenuationRange(void) const;
00179 
00182         Real getAttenuationConstant(void) const;
00183 
00186         Real getAttenuationLinear(void) const;
00187 
00190         Real getAttenuationQuadric(void) const;
00191 
00198         void setPosition(Real x, Real y, Real z);
00199 
00206         void setPosition(const Vector3& vec);
00207 
00212         const Vector3& getPosition(void) const;
00213 
00220         void setDirection(Real x, Real y, Real z);
00221 
00228         void setDirection(const Vector3& vec);
00229 
00234         const Vector3& getDirection(void) const;
00235 
00246         void setSpotlightRange(const Radian& innerAngle, const Radian& outerAngle, Real falloff = 1.0);
00247 #ifndef OGRE_FORCE_ANGLE_TYPES
00248         inline void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0) {
00249             setSpotlightRange ( Angle(innerAngle), Angle(outerAngle), falloff );
00250         }
00251 #endif//OGRE_FORCE_ANGLE_TYPES
00252 
00255         const Radian& getSpotlightInnerAngle(void) const;
00256 
00259         const Radian& getSpotlightOuterAngle(void) const;
00260 
00263         Real getSpotlightFalloff(void) const;
00264 
00266         void _notifyCurrentCamera(Camera* cam);
00267 
00269         const AxisAlignedBox& getBoundingBox(void) const;
00270 
00272         void _updateRenderQueue(RenderQueue* queue);
00273 
00275         const String& getMovableType(void) const;
00276 
00278         const Vector3& getDerivedPosition(void) const;
00279 
00281         const Vector3& getDerivedDirection(void) const;
00282 
00288         void setVisible(bool visible);
00289 
00291         Real getBoundingRadius(void) const { return 0; /* not visible */ }
00292 
00301         Vector4 getAs4DVector(void) const;
00302 
00312         const PlaneBoundedVolume& _getNearClipVolume(const Camera* const cam) const;
00313 
00320         const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* const cam) const;
00321 
00322 
00323 
00324     private:
00326         void update(void) const;
00327         String mName;
00328 
00329         LightTypes mLightType;
00330         Vector3 mPosition;
00331         ColourValue mDiffuse;
00332         ColourValue mSpecular;
00333 
00334         Vector3 mDirection;
00335 
00336         Radian mSpotOuter;
00337         Radian mSpotInner;
00338         Real mSpotFalloff;
00339         Real mRange;
00340         Real mAttenuationConst;
00341         Real mAttenuationLinear;
00342         Real mAttenuationQuad;
00343 
00344         mutable Vector3 mDerivedPosition;
00345         mutable Vector3 mDerivedDirection;
00347         mutable Quaternion mLastParentOrientation;
00348         mutable Vector3 mLastParentPosition;
00349 
00351         static String msMovableType;
00352 
00353         mutable PlaneBoundedVolume mNearClipVolume;
00354         mutable PlaneBoundedVolumeList mFrustumClipVolumes;
00356         mutable bool mLocalTransformDirty;
00357 
00358 
00359 
00360     };
00361 } // Namespace
00362 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Feb 12 12:59:47 2006