# 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
    00244         void setSpotlightRange(const Radian& innerAngle, const Radian& outerAngle, Real falloff = 1.0);
    00245 #ifndef OGRE_FORCE_ANGLE_TYPES
    00246         inline void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0) {
    00247             setSpotlightRange ( Angle(innerAngle), Angle(outerAngle), falloff );
    00248         }
    00249 #endif//OGRE_FORCE_ANGLE_TYPES
    00250
    00253         const Radian& getSpotlightInnerAngle(void) const;
    00254
    00257         const Radian& getSpotlightOuterAngle(void) const;
    00258
    00261         Real getSpotlightFalloff(void) const;
    00262
    00264         void _notifyCurrentCamera(Camera* cam);
    00265
    00267         const AxisAlignedBox& getBoundingBox(void) const;
    00268
    00270         void _updateRenderQueue(RenderQueue* queue);
    00271
    00273         const String& getMovableType(void) const;
    00274
    00276         const Vector3& getDerivedPosition(void) const;
    00277
    00279         const Vector3& getDerivedDirection(void) const;
    00280
    00286         void setVisible(bool visible);
    00287
    00289         Real getBoundingRadius(void) const { return 0; /* not visible */ }
    00290
    00299         Vector4 getAs4DVector(void) const;
    00300
    00310         const PlaneBoundedVolume& _getNearClipVolume(const Camera* const cam) const;
    00311
    00318         const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* const cam) const;
    00319
    00320
    00321
    00322     private:
    00324         void update(void) const;
    00325         String mName;
    00326
    00327         LightTypes mLightType;
    00328         Vector3 mPosition;
    00329         ColourValue mDiffuse;
    00330         ColourValue mSpecular;
    00331
    00332         Vector3 mDirection;
    00333
    00334         Radian mSpotOuter;
    00335         Radian mSpotInner;
    00336         Real mSpotFalloff;
    00337         Real mRange;
    00338         Real mAttenuationConst;
    00339         Real mAttenuationLinear;
    00340         Real mAttenuationQuad;
    00341
    00342         mutable Vector3 mDerivedPosition;
    00343         mutable Vector3 mDerivedDirection;
    00345         mutable Quaternion mLastParentOrientation;
    00346         mutable Vector3 mLastParentPosition;
    00347
    00349         static String msMovableType;
    00350
    00351         mutable PlaneBoundedVolume mNearClipVolume;
    00352         mutable PlaneBoundedVolumeList mFrustumClipVolumes;
    00354         mutable bool mLocalTransformDirty;
    00355
    00356
    00357
    00358     };
    00359 } // Namespace
    00360 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:36:01 2005