00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef LAYEREDCLOUDS_H
00022 #define LAYEREDCLOUDS_H
00023
00024 #include "CaelumPrerequisites.h"
00025 #include "CameraBoundElement.h"
00026
00027 namespace caelum {
00028
00038 class CAELUM_EXPORT LayeredClouds: public CameraBoundElement {
00039 public:
00046 LayeredClouds (
00047 Ogre::SceneManager* scene,
00048 Ogre::SceneNode *caelumRootNode,
00049 const Ogre::String &resourceGroupName="Caelum",
00050 const Ogre::String &materialName="CaelumLayeredClouds",
00051 const Ogre::String &meshName="CaelumLayeredClouds",
00052 const Ogre::String &entityName="CaelumLayeredClouds");
00053
00054 ~LayeredClouds ();
00055
00061 void update (
00062 Ogre::Real timePassed,
00063 const Ogre::Vector3& sunDirection,
00064 const Ogre::ColourValue& sunColour,
00065 const Ogre::ColourValue& fogColour);
00066
00070 void setCloudCover (const Ogre::Real cloudCover);
00071
00075 Ogre::Real getCloudCover () const;
00076
00089 void setCloudCoverLookup (const Ogre::String& fileName);
00090
00094 void disableCloudCoverLookup ();
00095
00096
00099 void setCloudMassBlend (const Ogre::Real cloudCover);
00100
00103 Ogre::Real getCloudMassBlend () const;
00104
00107 void setCloudMassOffset (const Ogre::Vector2 &cloudMassOffset);
00108
00111 Ogre::Vector2 getCloudMassOffset () const;
00112
00115 void setCloudDetailOffset (const Ogre::Vector2 &cloudMassOffset);
00116
00119 Ogre::Vector2 getCloudDetailOffset () const;
00120
00121
00126 bool isAnimating () const;
00127
00130 void setAnimating (bool animating);
00131
00135 void setCloudSpeed (const Ogre::Vector2 &cloudSpeed);
00136
00140 Ogre::Vector2 getCloudSpeed () const;
00141
00145 void setCloudBlendTime (const Ogre::Real cloudBlendTime);
00146
00150 Ogre::Real getCloudBlendTime () const;
00151
00152 private:
00154 Ogre::GpuProgramParametersSharedPtr getFpParams();
00155
00157 Ogre::GpuProgramParametersSharedPtr getVpParams();
00158
00160 Ogre::TextureUnitState* getTUS(unsigned short num);
00161
00163 void setSunDirection(const Ogre::Vector3 &sunDirection);
00164
00166 void setSunColour(const Ogre::ColourValue &sunColour);
00167
00169 void setFogColour(const Ogre::ColourValue &fogColour);
00170
00172 void setInvHazeHeight (const Ogre::Real invHazeHeight);
00173
00175 Ogre::Real mCloudCover;
00176
00178 Ogre::Real mCloudMassBlend;
00179
00181 Ogre::Vector2 mCloudMassOffset;
00182
00184 Ogre::Vector2 mCloudDetailOffset;
00185
00188 std::auto_ptr<Ogre::Image> mCloudCoverLookup;
00189
00190
00192 bool mAnimating;
00193
00195 Ogre::Real mCloudBlendTime;
00196
00200 bool mCloudBlendAnimationDirection;
00201
00203 Ogre::Vector2 mCloudSpeed;
00204
00205
00207 Ogre::MaterialPtr mMaterial;
00208
00210 bool mShadersEnabled;
00211
00213 Ogre::SceneNode *mNode;
00214
00216 Ogre::Entity *mEntity;
00217
00219 Ogre::SceneManager *mSceneMgr;
00220
00221 public:
00223 virtual void notifyCameraChanged (Ogre::Camera *cam);
00224
00225 protected:
00227 virtual void setFarRadius (Ogre::Real radius);
00228 };
00229 }
00230
00231 #endif // LAYEREDCLOUDS_H