00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00035 #ifndef __SO3SKY_H__
00036 #define __SO3SKY_H__
00037
00038 #include "../SCOLBasic/SO3Std.h"
00039 #include "SO3EnvironmentComponent.h"
00040 #include "../SCOLBasic/SO3DataScol.h"
00041 #include "SkyX/SkyX.h"
00042
00043 namespace SO3
00044 {
00045
00046 class _SO3_Export SSky : public SEnvironmentComponent
00047 {
00048 public:
00051 enum SkyComponentType
00052 {
00053 SO3_SKY_COMPONENT_NONE,
00054 SO3_SKY_COMPONENT_LAYERER_CLOUD,
00055 SO3_SKY_COMPONENT_VOLUMETRIC_CLOUD
00056 };
00057
00062 class SkyComponent
00063 {
00064 public:
00065 protected:
00066 SSky* parentSky;
00067 SkyX::SkyX* skyxManager;
00068 private:
00069 bool skyComponentEnable;
00070 const SkyComponentType componentType;
00071
00072 public:
00075 SkyComponent(SSky* parentSkyInstance, SkyComponentType component);
00076
00079 ~SkyComponent();
00080
00084 bool GetEnabled();
00085
00089 void SetEnabled(bool enable);
00090
00093 SkyComponentType GetType();
00094
00097 virtual void Update(Ogre::Real updateTime)=0;
00098 protected:
00099 private:
00103 SkyComponent();
00104 };
00105
00109 class CloudLayered : public SkyComponent
00110 {
00111 public:
00112 protected:
00113 private:
00114 typedef std::map<unsigned int, SkyX::CloudLayer*> CloudLayerMap;
00115 CloudLayerMap cloudLayerMap;
00116
00117 public:
00120 CloudLayered(SSky* parentSkyInstance);
00121
00124 ~CloudLayered();
00125
00128 virtual void Update(Ogre::Real updateTime);
00129
00133 unsigned int AddLayer(Ogre::Real heightFromCloudCeiling=0.0f, Ogre::Real scale=0.001f, Ogre::Real distanceAttenuation=0.05f, Ogre::Real detailAttenuation=1.0f, Ogre::Real normalMultiplier=2.0f, Ogre::Real heightVolume=0.25f, Ogre::Real volumetricDisplacement=0.01f);
00134
00138 void RemoveLayer(unsigned int index);
00139
00142 void RemoveAllLayers();
00143
00146 std::vector<int> GetLayerIndexes();
00147
00150 void SetParameters(unsigned int index, float heightFromCloudCeiling, float scale, float attenuationDistance, float attenuationDetail, float normalMultiplier, float heightVolume, float volumetricDisplacement);
00151
00154 Ogre::Real GetHeightFromCloudCeiling(unsigned int index);
00155
00158 void SetHeightFromCloudCeiling(unsigned int index, Ogre::Real newHeightFromCloudCeiling);
00159
00162 Ogre::Real GetScale(unsigned int index);
00163
00166 void SetScale(unsigned int index, Ogre::Real newScale);
00167
00170 Ogre::Real GetAttenuationDistance(unsigned int index);
00171
00174 void SetAttenuationDistance(unsigned int index, Ogre::Real newAttenuationDistance);
00175
00178 Ogre::Real GetAttenuationDetail(unsigned int index);
00179
00182 void SetAttenuationDetail(unsigned int index, Ogre::Real newAttenuationDetail);
00183
00186 Ogre::Real GetNormalMultiplier(unsigned int index);
00187
00190 void SetNormalMultiplier(unsigned int index, Ogre::Real newNormalMultiplier);
00191
00194 Ogre::Real GetHeightVolume(unsigned int index);
00195
00198 void SetHeightVolume(unsigned int index, Ogre::Real newHeightVolume);
00199
00202 Ogre::Real GetVolumetricDisplacement(unsigned int index);
00203
00206 void SetVolumetricDisplacement(unsigned int index, Ogre::Real newVolumetricDisplacement);
00207 protected:
00208 private:
00212 CloudLayered();
00213
00217 SkyX::CloudLayer* GetLayer(unsigned int index);
00218 };
00219
00223 class CloudVolumetric : public SkyComponent
00224 {
00225 public:
00226 protected:
00227 private:
00228
00229 public:
00232 CloudVolumetric(SSky* parentSkyInstance);
00233
00236 virtual void Update(Ogre::Real updateTime);
00237 protected:
00238 private:
00242 CloudVolumetric();
00243 };
00244 protected:
00245 private:
00246 SScene* parentScene;
00247 SkyX::SkyX* skyxManager;
00248 SkyX::AtmosphereManager::Options skyxOptions;
00249 SSkyAstronomicalModel* astronomicalModel;
00250 CloudVolumetric* volumetricClouds;
00251 CloudLayered* layeredClouds;
00252 float cloudsAnimationSpeed;
00253 float cloudsCeilingHeight;
00254 std::string cachedMoonTextureName;
00255
00256 public:
00259 SSky(SEnvironment* parent, std::string skyName);
00260
00264 ~SSky();
00265
00268 void RegisterViewport(SViewPort* viewport);
00269
00273 SkyX::SkyX* GetSkyX();
00274
00277 SSky::CloudVolumetric* GetCloudVolumetric();
00278
00281 SkyComponent* GetComponent(SkyComponentType componentType);
00282
00285 SSky::CloudLayered* GetCloudLayered();
00286
00290 virtual void Update(Ogre::Real updateTime);
00291
00295 float GetAnimationSpeed();
00296
00300 void SetAnimationSpeed(float animationSpeed);
00301
00304 float GetCloudCeiling();
00305
00308 void SetCloudCeiling(float newCloudCeiling);
00309
00312 bool GetHDREnable();
00313
00316 void SetHDREnable(bool enable);
00317 protected:
00318 private:
00322 SSky();
00323 };
00324
00325 }
00326
00327 #endif