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 © 2000-2002 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 "OgreString.h" 00033 #include "OgreMovableObject.h" 00034 00035 namespace Ogre { 00036 00037 00060 class _OgreExport Light : public MovableObject 00061 { 00062 public: 00064 Real tempSquareDist; 00065 00067 enum LightTypes 00068 { 00070 LT_POINT, 00072 LT_DIRECTIONAL, 00074 LT_SPOTLIGHT 00075 }; 00076 00079 Light(); 00080 00083 Light(const String& name); 00084 00087 ~Light(); 00088 00091 const String& getName(void) const; 00092 00095 void setType(LightTypes type); 00096 00099 LightTypes getType(void) const; 00100 00110 void setDiffuseColour(Real red, Real green, Real blue); 00111 00121 void setDiffuseColour(const ColourValue& colour); 00122 00125 const ColourValue& getDiffuseColour(void) const; 00126 00136 void setSpecularColour(Real red, Real green, Real blue); 00137 00147 void setSpecularColour(const ColourValue& colour); 00148 00151 const ColourValue& getSpecularColour(void) const; 00152 00172 void setAttenuation(Real range, Real constant, Real linear, Real quadratic); 00173 00176 Real getAttenuationRange(void) const; 00177 00180 Real getAttenuationConstant(void) const; 00181 00184 Real getAttenuationLinear(void) const; 00185 00188 Real getAttenuationQuadric(void) const; 00189 00196 void setPosition(Real x, Real y, Real z); 00197 00204 void setPosition(const Vector3& vec); 00205 00210 const Vector3& getPosition(void) const; 00211 00218 void setDirection(Real x, Real y, Real z); 00219 00226 void setDirection(const Vector3& vec); 00227 00232 const Vector3& getDirection(void) const; 00233 00242 void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0); 00243 00246 Real getSpotlightInnerAngle(void) const; 00247 00250 Real getSpotlightOuterAngle(void) const; 00251 00254 Real getSpotlightFalloff(void) const; 00255 00257 void _notifyCurrentCamera(Camera* cam); 00258 00260 const AxisAlignedBox& getBoundingBox(void) const; 00261 00263 void _updateRenderQueue(RenderQueue* queue); 00264 00266 const String& getMovableType(void) const; 00267 00269 const Vector3& getDerivedPosition(void) const; 00270 00272 const Vector3& getDerivedDirection(void) const; 00273 00279 void setVisible(bool visible); 00280 00282 Real getBoundingRadius(void) const { return 0; /* not visible */ } 00283 00284 00285 private: 00287 void update(void) const; 00288 String mName; 00289 00290 LightTypes mLightType; 00291 Vector3 mPosition; 00292 ColourValue mDiffuse; 00293 ColourValue mSpecular; 00294 00295 Vector3 mDirection; 00296 00297 Real mSpotOuter; 00298 Real mSpotInner; 00299 Real mSpotFalloff; 00300 Real mRange; 00301 Real mAttenuationConst; 00302 Real mAttenuationLinear; 00303 Real mAttenuationQuad; 00304 00305 mutable Vector3 mDerivedPosition; 00306 mutable Vector3 mDerivedDirection; 00308 mutable Quaternion mLastParentOrientation; 00309 mutable Vector3 mLastParentPosition; 00310 00312 static String msMovableType; 00313 00314 00315 00316 }; 00317 } // Namespace 00318 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Wed Jan 21 00:10:14 2004