IG::Meteo Class
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to- Sim
SDK edition to use it.
You should upgrade to
Header: | #include <plugins/UnigineIG.h> |
This class is used to manage global meteo conditions for the IG (visibility range, wind speed and direction).
IG plugin must be loaded.
Meteo Class
Members
void refresh ( ) #
Refreshes global meteo conditions according to current settings. This method should be called after setting global meteo conditions to apply them. Weather change callbacks are called on refresh.Region * getRegion ( int64_t id ) #
Returns the interface of a weather region/layer by its identifier. If no weather region/layer with such id exists, it will be created.Arguments
- int64_t id - Weather region identifier.
Return value
Weather region interface.Vector < IG::Region * > getRegions ( ) #
Returns the list of all weather regions/layers.void removeRegion ( int64_t id ) #
Removes a weather region/layer with a given identifier.Arguments
- int64_t id - Identifier of the weather region/layer to be removed.
void clearRegions ( ) #
Removes all weather regions and layers.vec3 getMeanWindSpeed ( const dvec3 & world_pos ) #
Returns an average wind speed at the specified geographic location. This method combines wind parameter of all weather regions and layers affecting this point.Arguments
- const dvec3 & world_pos - Geographic coordinates of a point (lat, lon, alt), for which an average wind speed and direction are to be calculated.
Return value
Vector defining average wind speed (in meters per second) in all directions for the given location.void setWindSpeed ( const vec3 & wind_speed ) #
Sets the global wind speed and direction.Arguments
- const vec3 & wind_speed - Vector defining wind speed in all directions, in meters per second.
void setVisibilityDistance ( float visibility_distance ) #
Sets the global visibility range through the atmosphere.Arguments
- float visibility_distance - Global visibility range, in meters.
void setMaxPrecipitationAltitude ( double max_precipitation_altitude ) #
Sets the upper height limit for precipitation. There is no precipitation observed above this level.Arguments
- double max_precipitation_altitude - Upper height limit for precipitation, in meters.
double getMaxPrecipitationAltitude ( ) #
Returns the current upper height limit for precipitation. There is no precipitation observed above this level.Return value
Current upper height limit for precipitation, in meters.double getLowerCloudAltitude ( ) #
Returns the current lower altitude for clouds.Return value
Lower altitude for clouds, in meters.void setCloudsOptimization ( int enable ) #
Enables or disables simplified rendering mode for clouds.When clouds are viewed from the ground (at significant distance) and the viewer's velocity is less than 200 units per second, enabling this parameter can provide a significant gain in performance.
Arguments
- int enable - 1 to enable simplified rendering for clouds; 0 - to disable it.
void setVisibilityTransitionTime ( float time ) #
Sets the time period for gradual change of visibility range.This parameter can also be specified via the configuration file (ig_config.xml).
Arguments
- float time - Time, in seconds, for gradual change of visibility range.
void setPrecipitationsTransitionTime ( float time ) #
Sets the time period for gradual change of precipitation.This parameter can also be specified via the configuration file (ig_config.xml).
Arguments
- float time - Time, in seconds, for gradual change of precipitation.
void setCloudTransitionTime ( float time ) #
Sets the time period for gradual change of cloudiness.This parameter can also be specified via the configuration file (ig_config.xml).
Arguments
- float time - Time, in seconds, for gradual change of cloudiness.
void addCallbackMeteoChanged ( void * subscriber, Unigine::CallbackBase * callback ) #
Adds a callback on changing global meteo conditions./// callback function to be called when weather conditions change
void SomeClass::my_weather_callback()
{
// setting orientation of the vane downwind
vec3 wind_direction = ig_manager->getMeteo()->getMeanWindSpeed(vane_node->getWorldPosition());
vane_node->setWorldDirection(wind_direction, vec3_up);
}
// ...
// somewhere in code
void SomeClass::init()
{
// adding "my_weather_callback" to be called on changing weather conditions
ig_manager->getMeteo()->addCallbackMeteoChanged(this, Unigine::MakeCallback(this, &SomeClass::my_weather_callback );
}
Arguments
- void * subscriber - Callback subscriber ID. This ID can be used to remove this callback when necessary.
- Unigine::CallbackBase * callback - Callback pointer.
void removeCallbackMeteoChanged ( void * subscriber ) #
Removes a callback on changing global meteo conditions for the specified subscriber.Arguments
- void * subscriber - Callback subscriber ID specified when adding it.
Last update:
2020-06-01
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)