Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | 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-2006 Torus Knot Software Ltd
    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 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef _LIGHT_H__
    00030 #define _LIGHT_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033
    00034 #include "OgreColourValue.h"
    00035 #include "OgreVector3.h"
    00036 #include "OgreVector4.h"
    00037 #include "OgreString.h"
    00038 #include "OgreMovableObject.h"
    00039 #include "OgrePlaneBoundedVolume.h"
    00040 #include "OgreShadowCameraSetup.h"
    00041
    00042 namespace Ogre {
    00043
    00044
    00067     class _OgreExport Light : public MovableObject
    00068     {
    00069     public:
    00071         Real tempSquareDist;
    00073         void _calcTempSquareDist(const Vector3& worldPos);
    00074
    00076         enum LightTypes
    00077         {
    00079             LT_POINT,
    00081             LT_DIRECTIONAL,
    00083             LT_SPOTLIGHT
    00084         };
    00085
    00088         Light();
    00089
    00092         Light(const String& name);
    00093
    00096         ~Light();
    00097
    00100         void setType(LightTypes type);
    00101
    00104         LightTypes getType(void) const;
    00105
    00115         void setDiffuseColour(Real red, Real green, Real blue);
    00116
    00126         void setDiffuseColour(const ColourValue& colour);
    00127
    00130         const ColourValue& getDiffuseColour(void) const;
    00131
    00141         void setSpecularColour(Real red, Real green, Real blue);
    00142
    00152         void setSpecularColour(const ColourValue& colour);
    00153
    00156         const ColourValue& getSpecularColour(void) const;
    00157
    00177         void setAttenuation(Real range, Real constant, Real linear, Real quadratic);
    00178
    00181         Real getAttenuationRange(void) const;
    00182
    00185         Real getAttenuationConstant(void) const;
    00186
    00189         Real getAttenuationLinear(void) const;
    00190
    00193         Real getAttenuationQuadric(void) const;
    00194
    00201         void setPosition(Real x, Real y, Real z);
    00202
    00209         void setPosition(const Vector3& vec);
    00210
    00215         const Vector3& getPosition(void) const;
    00216
    00223         void setDirection(Real x, Real y, Real z);
    00224
    00231         void setDirection(const Vector3& vec);
    00232
    00237         const Vector3& getDirection(void) const;
    00238
    00249         void setSpotlightRange(const Radian& innerAngle, const Radian& outerAngle, Real falloff = 1.0);
    00250 #ifndef OGRE_FORCE_ANGLE_TYPES
    00251         inline void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0) {
    00252             setSpotlightRange ( Angle(innerAngle), Angle(outerAngle), falloff );
    00253         }
    00254 #endif//OGRE_FORCE_ANGLE_TYPES
    00255
    00258         const Radian& getSpotlightInnerAngle(void) const;
    00259
    00262         const Radian& getSpotlightOuterAngle(void) const;
    00263
    00266         Real getSpotlightFalloff(void) const;
    00267
    00270         void setSpotlightInnerAngle(const Radian& val);
    00271
    00274         void setSpotlightOuterAngle(const Radian& val);
    00275
    00278         void setSpotlightFalloff(Real val);
    00279
    00287         void setPowerScale(Real power);
    00288
    00292         Real getPowerScale(void) const;
    00293
    00295         void _notifyAttached(Node* parent, bool isTagPoint = false);
    00296
    00298         void _notifyMoved(void);
    00299
    00301         const AxisAlignedBox& getBoundingBox(void) const;
    00302
    00304         void _updateRenderQueue(RenderQueue* queue);
    00305
    00307         const String& getMovableType(void) const;
    00308
    00310         const Vector3& getDerivedPosition(void) const;
    00311
    00313         const Vector3& getDerivedDirection(void) const;
    00314
    00320         void setVisible(bool visible);
    00321
    00323         Real getBoundingRadius(void) const { return 0; /* not visible */ }
    00324
    00333         Vector4 getAs4DVector(void) const;
    00334
    00344         virtual const PlaneBoundedVolume& _getNearClipVolume(const Camera* const cam) const;
    00345
    00352         virtual const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* const cam) const;
    00353
    00355         uint32 getTypeFlags(void) const;
    00356
    00358         AnimableValuePtr createAnimableValue(const String& valueName);
    00359
    00366         void setCustomShadowCameraSetup(const ShadowCameraSetupPtr& customShadowSetup);
    00367
    00371         void resetCustomShadowCameraSetup(void);
    00372
    00374         const ShadowCameraSetupPtr& getCustomShadowCameraSetup(void) const;
    00375
    00376     protected:
    00378         virtual void update(void) const;
    00379
    00381         const String& getAnimableDictionaryName(void) const;
    00383         void initialiseAnimableDictionary(StringVector& vec) const;
    00384
    00385         LightTypes mLightType;
    00386         Vector3 mPosition;
    00387         ColourValue mDiffuse;
    00388         ColourValue mSpecular;
    00389
    00390         Vector3 mDirection;
    00391
    00392         Radian mSpotOuter;
    00393         Radian mSpotInner;
    00394         Real mSpotFalloff;
    00395         Real mRange;
    00396         Real mAttenuationConst;
    00397         Real mAttenuationLinear;
    00398         Real mAttenuationQuad;
    00399         Real mPowerScale;
    00400
    00401
    00402         mutable Vector3 mDerivedPosition;
    00403         mutable Vector3 mDerivedDirection;
    00404
    00406         static String msMovableType;
    00407
    00408         mutable PlaneBoundedVolume mNearClipVolume;
    00409         mutable PlaneBoundedVolumeList mFrustumClipVolumes;
    00411         mutable bool mDerivedTransformDirty;
    00412
    00414         mutable ShadowCameraSetupPtr mCustomShadowCameraSetup;
    00415
    00416     };
    00417
    00419     class _OgreExport LightFactory : public MovableObjectFactory
    00420     {
    00421     protected:
    00422         MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
    00423     public:
    00424         LightFactory() {}
    00425         ~LightFactory() {}
    00426
    00427         static String FACTORY_TYPE_NAME;
    00428
    00429         const String& getType(void) const;
    00430         void destroyInstance( MovableObject* obj);
    00431
    00432     };
    00433
    00434 } // Namespace
    00435 #endif

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:25 2008