21 #ifndef CAELUM__CAELUM_SYSTEM_H 22 #define CAELUM__CAELUM_SYSTEM_H 25 #include "UniversalClock.h" 26 #include "ImageStarfield.h" 27 #include "PointStarfield.h" 31 #include "CloudSystem.h" 33 #include "DepthComposer.h" 34 #include "PrecipitationController.h" 35 #include "GroundFog.h" 36 #include "PrivatePtr.h" 114 public Ogre::FrameListener,
115 public Ogre::RenderTargetListener
119 Ogre::Root *mOgreRoot;
122 Ogre::SceneManager *mSceneMgr;
134 bool mAutoMoveCameraNode;
137 bool mAutoNotifyCameraChanged;
140 bool mAutoAttachViewportsToComponents;
143 bool mAutoViewportBackground;
146 Ogre::FogMode mManageSceneFogMode;
149 Ogre::Real mManageSceneFogFromDistance, mManageSceneFogToDistance;
151 Real mGlobalFogDensityMultiplier;
152 Ogre::ColourValue mGlobalFogColourMultiplier;
154 Real mSceneFogDensityMultiplier;
155 Ogre::ColourValue mSceneFogColourMultiplier;
157 Real mGroundFogDensityMultiplier;
158 Ogre::ColourValue mGroundFogColourMultiplier;
161 bool mManageAmbientLight;
164 Ogre::ColourValue mMinimumAmbientLight;
167 bool mEnsureSingleLightSource;
170 bool mEnsureSingleShadowSource;
173 std::auto_ptr<Ogre::Image> mSkyGradientsImage;
176 std::auto_ptr<Ogre::Image> mSunColoursImage;
179 Ogre::Degree mObserverLatitude;
181 Ogre::Degree mObserverLongitude;
183 static const Ogre::Vector3 makeDirection (
184 Ogre::Degree azimuth, Ogre::Degree altitude);
187 std::auto_ptr<UniversalClock> mUniversalClock;
188 std::auto_ptr<SkyDome> mSkyDome;
189 std::auto_ptr<BaseSkyLight> mSun;
190 std::auto_ptr<Moon> mMoon;
191 std::auto_ptr<ImageStarfield> mImageStarfield;
192 std::auto_ptr<PointStarfield> mPointStarfield;
193 std::auto_ptr<GroundFog> mGroundFog;
194 std::auto_ptr<CloudSystem> mCloudSystem;
195 std::auto_ptr<PrecipitationController> mPrecipitationController;
196 std::auto_ptr<DepthComposer> mDepthComposer;
199 typedef std::set<Ogre::Viewport*> AttachedViewportSet;
202 AttachedViewportSet mAttachedViewports;
220 CAELUM_COMPONENT_SKY_DOME = 1 << 1,
221 CAELUM_COMPONENT_MOON = 1 << 3,
222 CAELUM_COMPONENT_SUN = 1 << 4,
223 CAELUM_COMPONENT_IMAGE_STARFIELD = 1 << 5,
224 CAELUM_COMPONENT_POINT_STARFIELD = 1 << 6,
225 CAELUM_COMPONENT_CLOUDS = 1 << 7,
226 CAELUM_COMPONENT_PRECIPITATION = 1 << 8,
227 CAELUM_COMPONENT_SCREEN_SPACE_FOG = 1 << 9,
230 CAELUM_COMPONENT_GROUND_FOG = 1 << (16 + 0),
233 CAELUM_COMPONENTS_NONE = 0,
234 CAELUM_COMPONENTS_DEFAULT = 0
235 | CAELUM_COMPONENT_SKY_DOME
236 | CAELUM_COMPONENT_MOON
237 | CAELUM_COMPONENT_SUN
238 | CAELUM_COMPONENT_POINT_STARFIELD
239 | CAELUM_COMPONENT_CLOUDS,
240 CAELUM_COMPONENTS_ALL = 0
241 | CAELUM_COMPONENTS_DEFAULT
242 | CAELUM_COMPONENT_PRECIPITATION
243 | CAELUM_COMPONENT_SCREEN_SPACE_FOG
244 | CAELUM_COMPONENT_GROUND_FOG,
247 static const String DEFAULT_SKY_GRADIENTS_IMAGE;
248 static const String DEFAULT_SUN_COLOURS_IMAGE;
259 Ogre::SceneManager *sceneMgr,
290 void shutdown (
bool cleanup);
298 void updateSubcomponents (Real timeSinceLastFrame);
309 void notifyCameraChanged(Ogre::Camera* cam);
314 inline Ogre::SceneManager*
getSceneMgr()
const {
return mSceneMgr; }
377 inline LongReal getJulianDay ()
const {
return mUniversalClock->getJulianDay (); }
378 inline void setJulianDay (LongReal value) { mUniversalClock->setJulianDay (value); }
379 inline Real getTimeScale ()
const {
return mUniversalClock->getTimeScale (); }
380 inline void setTimeScale (Real value) { mUniversalClock->setTimeScale (value); }
391 void attachViewport (Ogre::Viewport* rt);
398 void detachViewport (Ogre::Viewport* rt);
402 bool isViewportAttached (Ogre::Viewport* vp)
const;
406 void detachAllViewports ();
413 void attachViewportImpl (Ogre::Viewport* rt);
414 void detachViewportImpl (Ogre::Viewport* rt);
423 void setSkyDome (
SkyDome *obj);
433 void setMoon (
Moon* obj);
477 void setManageSceneFog (Ogre::FogMode f);
478 void disableFogMangement();
483 Ogre::FogMode getManageSceneFog ()
const;
485 void setManageSceneFogStart (Ogre::Real from);
486 void setManageSceneFogEnd (Ogre::Real to);
487 Ogre::Real getManageSceneFogStart()
const;
488 Ogre::Real getManageSceneFogEnd()
const;
497 void setSceneFogDensityMultiplier (Real value);
501 Real getSceneFogDensityMultiplier ()
const;
517 void setGroundFogDensityMultiplier (Real value);
521 Real getGroundFogDensityMultiplier ()
const;
537 void setGlobalFogDensityMultiplier (Real value);
541 Real getGlobalFogDensityMultiplier ()
const;
594 Ogre::ColourValue getFogColour (Real time,
const Ogre::Vector3 &sunDir);
601 Real getFogDensity (Real time,
const Ogre::Vector3 &sunDir);
607 Ogre::ColourValue getSunSphereColour (Real time,
const Ogre::Vector3 &sunDir);
613 Ogre::ColourValue getSunLightColour (Real time,
const Ogre::Vector3 &sunDir);
616 Ogre::ColourValue getMoonBodyColour (
const Ogre::Vector3 &moonDir);
619 Ogre::ColourValue getMoonLightColour (
const Ogre::Vector3 &moonDir);
622 void setSkyGradientsImage (
const Ogre::String &filename = DEFAULT_SKY_GRADIENTS_IMAGE);
626 void setSunColoursImage (
const Ogre::String &filename = DEFAULT_SUN_COLOURS_IMAGE);
632 const Ogre::Vector3 getSunDirection (LongReal jday);
637 const Ogre::Vector3 getMoonDirection (LongReal jday);
643 const Ogre::Real getMoonPhase (LongReal jday);
649 const Ogre::Vector3 getEclipticNorthPoleDirection (LongReal jday);
656 virtual bool frameStarted (
const Ogre::FrameEvent &e);
661 virtual void preViewportUpdate (
const Ogre::RenderTargetViewportEvent &e);
666 void destroySubcomponents (
bool everything);
677 void forceSubcomponentQueryFlags (uint mask);
681 void forceSubcomponentVisibilityFlags (uint mask);
685 #endif // CAELUM__CAELUM_SYSTEM_H Moon * getMoon() const
Gets the current moon, or null if disabled.
Image-based starfield class.
void setAutoAttachViewportsToComponents(bool value)
If true; automatically attach viewports to subcomponents.
void setAutoNotifyCameraChanged(bool value)
If true; listen to preViewportUpdate and automatically notifyCameraChanged();.
Compositor-based precipitation controller.
const AttachedViewportSet & _getAttachedViewportSet()
Get a reference to the set of attached viewports.
void setObserverLongitude(Ogre::Degree value)
Set the observer's longitude. East is positive, west is negative.
void setEnsureSingleShadowSource(bool value)
Ensure only one of caelum's light sources casts shadows (the brightest).
Ogre::SceneManager * getSceneMgr() const
Get the scene manager for this caelum system.
ImageStarfield * getImageStarfield() const
Gets the current image starfield, or null if disabled.
void setMinimumAmbientLight(const Ogre::ColourValue &value)
Set the minimum value for scene ambient lighting, This is only used if getManageAmbientLight() is tru...
const Ogre::ColourValue getGroundFogColourMultiplier() const
See setGroundFogColourMultiplier.
Compositor-based precipitation controller.
void setAutoMoveCameraNode(bool value)
If true (default); automatically move the camera node in notifyCameraChanged.
Ogre::SceneNode * getCaelumGroundNode(void) const
Gets root scene node for ground-bound elements.
const Ogre::ColourValue getGlobalFogColourMultiplier() const
See setGlobalFogColourMultiplier.
BaseSkyLight * getSun() const
Gets the current sun, or null if disabled.
Base class for sky lights (sun and moon).
bool getManageAmbientLight() const
Check if CaelumSystem is managing ambient lighting.
void setGroundFogColourMultiplier(const Ogre::ColourValue &value)
Set an additional multiplier for ground fog colour as it comes from SkyColourModel.
bool getAutoMoveCameraNode()
PrecipitationController * getPrecipitationController()
Get precipitation controller; or null if disabled.
void setSceneFogColourMultiplier(const Ogre::ColourValue &value)
Set an additional multiplier for fog colour as it comes from SkyColourModel.
void setObserverLatitude(Ogre::Degree value)
Set the observer's latitude. North is positive, south is negative.
PointStarfield * getPointStarfield() const
Gets the current point starfield, or null if disabled.
Exponential ground fog system implementation.
const Ogre::Degree getObserverLatitude() const
Get the observer's latitude. North is positive, south is negative.
CloudSystem * getCloudSystem()
Get cloud system; or null if disabled.
const Ogre::ColourValue getMinimumAmbientLight() const
void setGlobalFogColourMultiplier(const Ogre::ColourValue &value)
Set an additional multiplier for fog colour.
The system's time model.
This is the "root class" of caelum.
GroundFog * getGroundFog()
Get ground fog; if enabled.
const Ogre::ColourValue getSceneFogColourMultiplier() const
See setSceneFogColourMultiplier.
SkyDome * getSkyDome() const
Get the current sky dome, or null if disabled.
void setManageAmbientLight(bool value)
Set this to true to have CaelumSystem manage the scene's ambient light.
A cloud system is implemented by a number of cloud layers.
bool getAutoAttachViewportsToComponents() const
Ogre::SceneNode * getCaelumCameraNode(void) const
Gets root scene node for camera-bound elements.
UniversalClock * getUniversalClock() const
Gets the universal clock.
CaelumComponent
Flags enumeration for caelum components.
bool getEnsureSingleShadowSource() const
See setEnsureSingleShadowSource.
bool getEnsureSingleLightSource() const
See setEnsureSingleLightSource.
const Ogre::Degree getObserverLongitude() const
Get the observer's longitude. East is positive, west is negative.
DepthComposer * getDepthComposer()
Get depth composer; or null if disabled.
Class representing the moon.
bool getAutoNotifyCameraChanged() const
void setEnsureSingleLightSource(bool value)
Ensure only one of caelum's light sources is active at a time (the brightest).
void setAutoViewportBackground(bool value)
If true; automatically set the viewport color to black.
bool getAutoViewportBackground() const