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 "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(Real innerAngle, Real outerAngle, Real falloff = 1.0); 00245 00248 Real getSpotlightInnerAngle(void) const; 00249 00252 Real getSpotlightOuterAngle(void) const; 00253 00256 Real getSpotlightFalloff(void) const; 00257 00259 void _notifyCurrentCamera(Camera* cam); 00260 00262 const AxisAlignedBox& getBoundingBox(void) const; 00263 00265 void _updateRenderQueue(RenderQueue* queue); 00266 00268 const String& getMovableType(void) const; 00269 00271 const Vector3& getDerivedPosition(void) const; 00272 00274 const Vector3& getDerivedDirection(void) const; 00275 00281 void setVisible(bool visible); 00282 00284 Real getBoundingRadius(void) const { return 0; /* not visible */ } 00285 00294 Vector4 getAs4DVector(void) const; 00295 00305 const PlaneBoundedVolume& _getNearClipVolume(const Camera* cam) const; 00306 00313 const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* cam) const; 00314 00315 00316 00317 private: 00319 void update(void) const; 00320 String mName; 00321 00322 LightTypes mLightType; 00323 Vector3 mPosition; 00324 ColourValue mDiffuse; 00325 ColourValue mSpecular; 00326 00327 Vector3 mDirection; 00328 00329 Real mSpotOuter; 00330 Real mSpotInner; 00331 Real mSpotFalloff; 00332 Real mRange; 00333 Real mAttenuationConst; 00334 Real mAttenuationLinear; 00335 Real mAttenuationQuad; 00336 00337 mutable Vector3 mDerivedPosition; 00338 mutable Vector3 mDerivedDirection; 00340 mutable Quaternion mLastParentOrientation; 00341 mutable Vector3 mLastParentPosition; 00342 00344 static String msMovableType; 00345 00346 mutable PlaneBoundedVolume mNearClipVolume; 00347 mutable PlaneBoundedVolumeList mFrustumClipVolumes; 00348 00349 00350 00351 }; 00352 } // Namespace 00353 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:22:19 2004