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         void setType(LightTypes type);
00094 
00097         LightTypes getType(void) const;
00098 
00108         void setDiffuseColour(Real red, Real green, Real blue);
00109 
00119         void setDiffuseColour(const ColourValue& colour);
00120 
00123         const ColourValue& getDiffuseColour(void) const;
00124 
00134         void setSpecularColour(Real red, Real green, Real blue);
00135 
00145         void setSpecularColour(const ColourValue& colour);
00146 
00149         const ColourValue& getSpecularColour(void) const;
00150 
00170         void setAttenuation(Real range, Real constant, Real linear, Real quadratic);
00171 
00174         Real getAttenuationRange(void) const;
00175 
00178         Real getAttenuationConstant(void) const;
00179 
00182         Real getAttenuationLinear(void) const;
00183 
00186         Real getAttenuationQuadric(void) const;
00187 
00194         void setPosition(Real x, Real y, Real z);
00195 
00202         void setPosition(const Vector3& vec);
00203 
00208         const Vector3& getPosition(void) const;
00209 
00216         void setDirection(Real x, Real y, Real z);
00217 
00224         void setDirection(const Vector3& vec);
00225 
00230         const Vector3& getDirection(void) const;
00231 
00242         void setSpotlightRange(const Radian& innerAngle, const Radian& outerAngle, Real falloff = 1.0);
00243 #ifndef OGRE_FORCE_ANGLE_TYPES
00244         inline void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0) {
00245             setSpotlightRange ( Angle(innerAngle), Angle(outerAngle), falloff );
00246         }
00247 #endif//OGRE_FORCE_ANGLE_TYPES
00248 
00251         const Radian& getSpotlightInnerAngle(void) const;
00252 
00255         const Radian& getSpotlightOuterAngle(void) const;
00256 
00259         Real getSpotlightFalloff(void) const;
00260 
00263         void setSpotlightInnerAngle(const Radian& val);
00264 
00267         void setSpotlightOuterAngle(const Radian& val);
00268 
00271         void setSpotlightFalloff(Real val);
00272 
00280         void setPowerScale(Real power);
00281 
00285         Real getPowerScale(void) const;
00286 
00288         const AxisAlignedBox& getBoundingBox(void) const;
00289 
00291         void _updateRenderQueue(RenderQueue* queue);
00292 
00294         const String& getMovableType(void) const;
00295 
00297         const Vector3& getDerivedPosition(void) const;
00298 
00300         const Vector3& getDerivedDirection(void) const;
00301 
00307         void setVisible(bool visible);
00308 
00310         Real getBoundingRadius(void) const { return 0; /* not visible */ }
00311 
00320         Vector4 getAs4DVector(void) const;
00321 
00331         virtual const PlaneBoundedVolume& _getNearClipVolume(const Camera* const cam) const;
00332 
00339         virtual const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* const cam) const;
00340 
00342         uint32 getTypeFlags(void) const;
00343 
00345         AnimableValuePtr createAnimableValue(const String& valueName);
00346 
00347     protected:
00349         virtual void update(void) const;
00350 
00352         const String& getAnimableDictionaryName(void) const;
00354         void initialiseAnimableDictionary(StringVector& vec) const;
00355 
00356         LightTypes mLightType;
00357         Vector3 mPosition;
00358         ColourValue mDiffuse;
00359         ColourValue mSpecular;
00360 
00361         Vector3 mDirection;
00362 
00363         Radian mSpotOuter;
00364         Radian mSpotInner;
00365         Real mSpotFalloff;
00366         Real mRange;
00367         Real mAttenuationConst;
00368         Real mAttenuationLinear;
00369         Real mAttenuationQuad;
00370         Real mPowerScale;
00371 
00372         mutable Vector3 mDerivedPosition;
00373         mutable Vector3 mDerivedDirection;
00375         mutable Quaternion mLastParentOrientation;
00376         mutable Vector3 mLastParentPosition;
00377 
00379         static String msMovableType;
00380 
00381         mutable PlaneBoundedVolume mNearClipVolume;
00382         mutable PlaneBoundedVolumeList mFrustumClipVolumes;
00384         mutable bool mLocalTransformDirty;
00385 
00386 
00387 
00388     };
00389 
00391     class _OgreExport LightFactory : public MovableObjectFactory
00392     {
00393     protected:
00394         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
00395     public:
00396         LightFactory() {}
00397         ~LightFactory() {}
00398 
00399         static String FACTORY_TYPE_NAME;
00400 
00401         const String& getType(void) const;
00402         void destroyInstance( MovableObject* obj);  
00403 
00404     };
00405 
00406 } // Namespace
00407 #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 Mar 12 14:37:43 2006