UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes

IG::IMeteo Class

Header: #include <plugins/IGInterface.h>

This class is used to manage global meteo conditions for the IG (visibility range, wind speed and direction).

Notice
IG plugin must be loaded.

IMeteo 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.

IRegion * addRegion ( int bound_type ) #

Adds a new weather region/layer to the simulation. Regions are used to represent atmospheric layers and regional weather.

Arguments

  • int bound_type - ID of the articulated part.

Return value

Weather region interface.

IRegion * getRegion ( size_t index ) #

Returns a weather region/layer by its index.

Arguments

Return value

Weather region interface.

size_t getNumRegions ( ) #

Returns the total number of weather regions and layers.

Return value

Total number of weather regions and layers.

void removeRegion ( size_t index ) #

Removes a weather region/layer with a given index.

Arguments

  • size_t index - Index of the weather region/layer to be removed within the range from 0 to the total number of regions.

void removeRegion ( IRegion * region ) #

Removes the specified weather region/layer.

Arguments

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.
Notice
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.
Notice
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.
Notice
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.
Notice
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, CallbackBase * callback ) #

Adds a callback on changing global meteo conditions.
Source code (C++)
/// 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);
}

// ...
// somwhere 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.
  • 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: 2019-07-18