21 #ifndef CAELUM__PRECIPITATION_CONTROLLER_H 22 #define CAELUM__PRECIPITATION_CONTROLLER_H 33 Ogre::ColourValue Colour;
46 PRECTYPE_SNOWGRAINS = 3,
47 PRECTYPE_ICECRYSTALS = 4,
48 PRECTYPE_ICEPELLETS = 5,
50 PRECTYPE_SMALLHAIL = 7,
66 Ogre::SceneManager *mSceneMgr;
67 Ogre::Vector3 mWindSpeed;
68 Ogre::Real mIntensity;
70 Ogre::ColourValue mColour;
72 Ogre::String mTextureName;
73 Ogre::Vector3 mCameraSpeedScale;
74 Ogre::Vector3 mFallingDirection;
76 Ogre::Real mAutoDisableThreshold;
77 bool mHardDisableCompositor;
79 Ogre::ColourValue mSceneColour;
83 Real mSecondsSinceLastFrame;
84 inline Real getSecondsSinceLastFrame() {
return mSecondsSinceLastFrame; }
112 void setTextureName(
const Ogre::String& textureName);
113 const Ogre::String getTextureName()
const;
116 void setColour(
const Ogre::ColourValue& color);
117 const Ogre::ColourValue getColour()
const;
120 void setSpeed(Real value);
121 Real getSpeed()
const;
124 void setIntensity(Real value);
125 Real getIntensity()
const;
128 void setWindSpeed(
const Ogre::Vector3 &value);
129 const Ogre::Vector3 getWindSpeed()
const;
138 const Ogre::Vector3 getFallingDirection()
const {
return mFallingDirection; }
141 void setManualCameraSpeed(
const Ogre::Vector3 &value);
144 void setAutoCameraSpeed();
152 inline Real getAutoDisableThreshold ()
const {
return mAutoDisableThreshold; }
165 mCameraSpeedScale = value;
167 inline const Ogre::Vector3 getCameraSpeedScale ()
const {
168 return mCameraSpeedScale;
174 setCameraSpeedScale(Ogre::Vector3::UNIT_SCALE * value);
180 void update(Real secondsSinceLastFrame, Ogre::ColourValue colour);
183 Ogre::SceneManager *sceneMgr);
187 typedef std::map<Ogre::Viewport*, PrecipitationInstance*> ViewportInstanceMap;
188 ViewportInstanceMap mViewportInstanceMap;
195 void destroyViewportInstance(Ogre::Viewport* viewport);
201 void destroyAllViewportInstances();
213 Ogre::Viewport* mViewport;
214 Ogre::CompositorInstance* mCompInst;
215 Ogre::Camera* mLastCamera;
216 Ogre::Vector3 mLastCameraPosition;
217 Ogre::Vector3 mCameraSpeed;
218 bool mAutoCameraSpeed;
220 virtual void notifyMaterialSetup(uint pass_id, Ogre::MaterialPtr &mat);
221 virtual void notifyMaterialRender(uint pass_id, Ogre::MaterialPtr &mat);
225 void _updateMaterialParams(
226 const Ogre::MaterialPtr& mat,
227 const Ogre::Camera* cam,
228 const Ogre::Vector3& camSpeed);
231 void createCompositor ();
232 void destroyCompositor ();
235 bool shouldBeEnabled ()
const;
241 inline Ogre::Viewport* getViewport()
const {
return mViewport; }
243 inline Ogre::CompositorInstance* getCompositorInstance()
const {
return mCompInst; }
246 bool getAutoCameraSpeed();
253 void setAutoCameraSpeed();
256 void setManualCameraSpeed(
const Ogre::Vector3& value);
259 const Ogre::Vector3 getCameraSpeed();
266 void setup(Ogre::GpuProgramParametersSharedPtr fpParams);
268 Ogre::GpuProgramParametersSharedPtr fpParams;
283 #endif //CAELUM__PRECIPITATION_CONTROLLER_H void setAutoDisableThreshold(Real value)
Automatically disable compositors when intensity is low.
Compositor-based precipitation controller.
PrecipitationType
An enumeration of the available precipitation presets.
void setCameraSpeedScale(const Ogre::Vector3 &value)
Automatically scale camera speed.
void setFallingDirection(const Ogre::Vector3 &value)
The basic direction for falling precipitation.
Per-viewport instance of precipitation.
static const String MATERIAL_NAME
Name of the compositor material.
An optimized reference to a gpu shared parameter.
Preset parameters for a certain type of precipitation.
void setCameraSpeedScale(Ogre::Real value)
Set an equal camera speed scale in all dimensions.
static const String COMPOSITOR_NAME
Name of the compositor resource.