00001 /* 00002 This file is part of Caelum. 00003 See http://www.ogre3d.org/wiki/index.php/Caelum 00004 00005 Copyright (c) 2008 Caelum team. See Contributors.txt for details. 00006 00007 Caelum is free software: you can redistribute it and/or modify 00008 it under the terms of the GNU Lesser General Public License as published 00009 by the Free Software Foundation, either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 Caelum is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU Lesser General Public License for more details. 00016 00017 You should have received a copy of the GNU Lesser General Public License 00018 along with Caelum. If not, see <http://www.gnu.org/licenses/>. 00019 */ 00020 00021 #ifndef CAELUM__SKYLIGHT_H 00022 #define CAELUM__SKYLIGHT_H 00023 00024 #include "CameraBoundElement.h" 00025 00026 namespace Caelum 00027 { 00031 class CAELUM_EXPORT BaseSkyLight : public CameraBoundElement 00032 { 00033 protected: 00035 Ogre::Light *mMainLight; 00036 00038 Ogre::SceneNode *mNode; 00039 00041 float mRadius; 00042 00044 Ogre::Vector3 mDirection; 00045 00047 Ogre::ColourValue mBodyColour; 00048 00050 Ogre::ColourValue mLightColour; 00051 00053 Ogre::ColourValue mDiffuseMultiplier; 00054 00056 Ogre::ColourValue mSpecularMultiplier; 00057 00061 Ogre::ColourValue mAmbientMultiplier; 00062 00064 bool mAutoDisableLight; 00065 00067 Ogre::Real mAutoDisableThreshold; 00068 00070 bool mForceDisableLight; 00071 00072 public: 00077 BaseSkyLight ( 00078 Ogre::SceneManager *sceneMgr, 00079 Ogre::SceneNode *caelumRootNode); 00080 00082 virtual ~BaseSkyLight () = 0; 00083 00089 virtual void update ( 00090 const Ogre::Vector3& direction, 00091 const Ogre::ColourValue &lightColour, 00092 const Ogre::ColourValue &bodyColour); 00093 00095 const Ogre::Vector3 getLightDirection () const; 00096 00098 virtual void setLightDirection (const Ogre::Vector3 &dir); 00099 00101 const Ogre::ColourValue getBodyColour () const; 00102 00104 virtual void setBodyColour (const Ogre::ColourValue &colour); 00105 00107 const Ogre::ColourValue getLightColour () const; 00108 00110 virtual void setLightColour (const Ogre::ColourValue &colour); 00111 00113 void setDiffuseMultiplier (const Ogre::ColourValue &diffuse); 00114 00116 const Ogre::ColourValue getDiffuseMultiplier () const; 00117 00119 void setSpecularMultiplier (const Ogre::ColourValue &specular); 00120 00122 const Ogre::ColourValue getSpecularMultiplier () const; 00123 00127 void setAmbientMultiplier (const Ogre::ColourValue &ambient); 00128 00130 const Ogre::ColourValue getAmbientMultiplier () const; 00131 00133 Ogre::Light* getMainLight() const; 00134 00136 inline bool getAutoDisable() const { return mAutoDisableLight; } 00137 00143 inline void setAutoDisable(bool value) { mAutoDisableLight = value; } 00144 00146 inline Ogre::Real getAutoDisableThreshold() const { return mAutoDisableThreshold; } 00147 00149 inline void setAutoDisableThreshold(Ogre::Real value) { mAutoDisableThreshold = value; } 00150 00151 static const Ogre::Real DEFAULT_AUTO_DISABLE_THRESHOLD; 00152 00154 inline void setForceDisable(bool value) { mForceDisableLight = value; } 00155 inline bool getForceDisable() const { return mForceDisableLight; } 00156 00157 virtual void setQueryFlags (uint flags) = 0; 00158 virtual uint getQueryFlags () const = 0; 00159 virtual void setVisibilityFlags (uint flags) = 0; 00160 virtual uint getVisibilityFlags () const = 0; 00161 00162 protected: 00164 virtual void setFarRadius (Ogre::Real radius); 00165 00167 void setMainLightColour(const Ogre::ColourValue &colour); 00168 00171 bool shouldEnableLight(const Ogre::ColourValue &colour); 00172 }; 00173 } 00174 00175 #endif // CAELUM__SKYLIGHT_H