This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
Basics
Rendering
Professional (SIM)
UnigineEditor
Interface Overview
Assets Workflow
Version Control
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Lighting
Sandworm
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Built-in Node Types
Nodes
Objects
Effects
Decals
Light Sources
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
C++
C#
UnigineScript
UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
Materials and Shaders
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Animations-Related Classes
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
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
VR-Related Classes
Content Creation
Content Optimization
Materials
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine::Plugins::IG::WeatherLayer Class

Warning
The functionality described in this article is not available in the Community SDK edition.
You should upgrade to Sim SDK edition to use it.
Header: #include <plugins/Unigine/IG/UnigineIG.h>

This is a base class for weather layers. Layers comprise a vertical profile of the weather region. Different cloud or precipitation layers may exist at various heights. There are three types of layers available:

WeatherLayer Class

Enums

WEATHER_LAYER_TYPE#

NameDescription
WEATHER_LAYER_TYPE_BASE = 0Base Layer - layer with no visual representation, it defines weather parameters such as visibility range, temperature, humidity.
WEATHER_LAYER_TYPE_CLOUD = 1Cloud Layer - layer that controls clouds within the region (via the WeatherLayerCloud class).
WEATHER_LAYER_TYPE_PRECIPITATION = 2Precipitation Layer - layer that controls precipitation within the region (via the WeatherLayerPrecipitation class).

Members


long long getID ( ) const#

Returns the ID of the weather layer.

Return value

ID of the weather layer.

long long getRegionID ( ) const#

Returns the ID of the weather region to which the layer belongs.

Return value

ID of the weather region to which the layer belongs.

WeatherLayer::WEATHER_LAYER_TYPE getLayerType ( ) const#

Returns the type of the weather layer.

Return value

Weather layer type, one of the following values:
  • Plugins::IG::WEATHER_LAYER_TYPE_BASE - base layer.
  • Plugins::IG::WEATHER_LAYER_TYPE_CLOUD - cloud layer.
  • Plugins::IG::WEATHER_LAYER_TYPE_PRECIPITATION - precipitation layer.

void setEnabled ( bool v ) #

Sets a value indicating if the weather layer is enabled. The layer change callback is called.

Arguments

  • bool v - true to enable the weather layer, false - to disable it.

bool isEnabled ( ) const#

Returns a value indicating if the weather layer and the region it belongs to are enabled.

Return value

true if the layer and the region it belongs to are both enabled; otherwise, false.

bool isEnabledSelf ( ) const#

Returns a value indicating if the weather layer itself is enabled. Use isEnabled() to check whether the region this layer belongs to is enabled as well.

Return value

true if the layer itself is enabled; otherwise, false.

bool isGlobal ( ) const#

Returns a value indicating whether the weather layer is global (has no distinct horizontal boundaries) or not.

Return value

true if the weather layer is global (has no distinct horizontal boundaries); false - atmospheric effects of the layer are restricted to a certain area.

void setElevation ( double value ) #

Sets the base altitude for the weather layer above the sea level (distance from the sea level to the lower border of the layer).

Arguments

  • double value - New base altitude for the weather layer, in meters.

double getElevation ( ) const#

Returns the current base altitude for the weather layer above the sea level (distance from the sea level to the lower border of the layer).

Return value

Current base altitude for the weather layer, in meters.

void setElevationSmoothBySpeed ( double unit_per_sec ) #

Sets the mode of smooth gradual change of the weather layer elevation by the specified rate (in units per second). The weather layer elevation changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setElevationSmoothByTime().

Arguments

  • double unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target.

void setElevationSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the weather layer elevation by the specified time interval. The weather layer elevation changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setElevationSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setThickness ( double value ) #

Sets the thickness of the weather layer.

Arguments

  • double value - New thickness of the weather layer, in meters.

double getThickness ( ) const#

Returns the current thickness of the weather layer.

Return value

Current thickness of the weather layer, in meters.

void setThicknessSmoothBySpeed ( double unit_per_sec ) #

Sets the mode of smooth gradual change of the weather layer thickness by the specified rate (in units per second). The weather layer thickness changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setThicknessSmoothByTime().

Arguments

  • double unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target.

void setThicknessSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the weather layer thickness by the specified time interval. The weather layer thickness changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setThicknessSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setVerticalTransition ( const Math::vec2& value ) #

Sets new vertical sizes of transition areas at the bottom and the top of the weather layer. The effects of the layer fade out gradually within these areas downwards and upwards.

Arguments

  • const Math::vec2& value - Vector containing new vertical sizes (widths in meters) of transition areas at the bottom and the top of the layer (bottom_width, top_width).

const Math::vec2& getVerticalTransition ( ) const#

Returns the vertical sizes of transition areas at the bottom and the top of the weather layer. The effects of the layer fade out gradually within these areas downwards and upwards.

Return value

Vector containing the current vertical sizes (widths in meters) of transition areas at the bottom and the top of the layer (bottom_width, top_width).

void setVerticalTransitionSmoothBySpeed ( const Math::vec2& unit_per_sec ) #

Sets the mode of smooth gradual change of transition areas at the bottom and the top of the weather layer by the specified rate (in units per second). The transition areas at the bottom and the top of the weather layer in all directions changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setVerticalTransitionSmoothByTime().

Arguments

  • const Math::vec2& unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target. Vector components specify rates for transition areas at the bottom and the top of the layer (bottom_width, top_width).

void setVerticalTransitionSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the sizes of transition areas at the bottom and the top of the weather layer by the specified time interval. The sizes of transition areas at the bottom and the top of the weather layer change gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setVerticalTransitionSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setWind ( const Math::vec3& value ) #

Sets the wind speed and direction for the weather layer.

Arguments

  • const Math::vec3& value - Vector defining wind speed in all directions, in meters per second.

const Math::vec3& getWind ( ) const#

Returns the current wind speed and direction for the weather layer.

Return value

Vector defining new wind speed in all directions, in meters per second.

void setWindSmoothBySpeed ( const Math::vec3& unit_per_sec ) #

Sets the mode of smooth gradual change of the wind speed in all directions by the specified rate (in units per second). The wind speed in all directions changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setWindSmoothByTime().

Arguments

  • const Math::vec3& unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target (each vector component specifies the rate for the corresponding coordinate).

void setWindSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the wind speed in all directions by the specified time interval. The wind speed in all directions changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setWindSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setCoverage ( float value ) #

Sets the cloud coverage intensity value for the weater layer.

Arguments

  • float value - Current cloud coverage intensity value for the weater layer, in the [0; 1] range (from zero to maximum cloudiness).

float getCoverage ( ) const#

Returns the current cloud coverage intensity value for the weater layer.

Return value

Current cloud coverage intensity value for the weater layer, in the [0; 1] range (from zero to maximum cloudiness).

void setCoverageSmoothBySpeed ( float unit_per_sec ) #

Sets the mode of smooth gradual change of the cloud coverage intensity by the specified rate (in units per second). The cloud coverage intensity changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setCoverageSmoothByTime().

Arguments

  • float unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target.

void setCoverageSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the cloud coverage intensity by the specified time interval. The cloud coverage intensity changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setCoverageSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setVisibility ( float value ) #

Sets the visibility range within the weather layer. Objects beyond this range are not visible inside the layer.

Arguments

  • float value - New visibility range within the weather layer, in meters.

float getVisibility ( ) const#

Returns the current visibility range within the weather layer. Objects beyond this range are not visible inside the layer.

Return value

Visibility range within the weather layer, in meters.

void setVisibilitySmoothBySpeed ( float unit_per_sec ) #

Sets the mode of smooth gradual change of the visibility by the specified rate (in units per second). The visibility changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setVisibilitySmoothByTime().

Arguments

  • float unit_per_sec - Constant rate (in units per second) with which the value gradually changes from the current to target.

void setVisibilitySmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the visibility by the specified time interval. The visibility changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setVisibilitySmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setHumidity ( float value ) #

Sets the humidity value for the weather layer.

Arguments

  • float value - New humidity value for the weather layer, in %.

float getHumidity ( ) const#

Returns the current humidity value for the weather layer.

Return value

Current humidity value for the weather layer, in %.

void setHumiditySmoothBySpeed ( float unit_per_sec ) #

Sets the mode of smooth gradual change of the humidity by the specified rate (in % per second). The humidity changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setHumiditySmoothByTime().

Arguments

  • float unit_per_sec - Constant rate (in % per second) with which the value gradually changes from the current to target.

void setHumiditySmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the humidity by the specified time interval. The humidity changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setHumiditySmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setTemperature ( float value ) #

Sets the temperature value for the weather layer.

Arguments

  • float value - New temperature value to be set, in degrees Celcius.

float getTemperature ( ) const#

Returns the current temperature value for the weather layer.

Return value

Current temperature value, in degrees Celcius.

void setTemperatureSmoothBySpeed ( float unit_per_sec ) #

Sets the mode of smooth gradual change of the temperature by the specified rate (in degrees Celcius per second). The temperature changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setTemperatureSmoothByTime().

Arguments

  • float unit_per_sec - Constant rate (in degrees Celcius per second) with which the value gradually changes from the current to target.

void setTemperatureSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the temperature by the specified time interval. The temperature changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setTemperatureSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setBarometric ( float value ) #

Sets the barometric pressure value for the weather layer.

Arguments

  • float value - New barometric pressure value to be set, in mmHg.

float getBarometric ( ) const#

Returns the current barometric pressure value for the weather layer.

Return value

Current barometric pressure value, in mmHg.

void setBarometricSmoothBySpeed ( float unit_per_sec ) #

Sets the mode of smooth gradual change of the barometric pressure by the specified rate (in mmHg per second). The barometric pressure changes gradually from the current to target value by the specified value during each second, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). This method fits best when the difference between the target and current value is either too big (e.g. visibility distance change from 10m to 1km) or too small (e.g. from 1m to 1.05m), avoiding too fast or too slow changes. For other cases you can also choose another mode "by time" to change the value from the current to target during the specified time interval via the setBarometricSmoothByTime().

Arguments

  • float unit_per_sec - Constant rate (in mmHg per second) with which the value gradually changes from the current to target.

void setBarometricSmoothByTime ( float sec ) #

Sets the mode of smooth gradual change of the barometric pressure by the specified time interval. The barometric pressure changes gradually from the current to target value during this interval, such smoothing is performed to make changes more realistic. Moreover, each value can be changed with its own rate (the rain starting fast with a slowly changing cloud coverage). When the value of 0 is set, the value changes instantly. If the difference between the target and current value is too big (e.g. visibility distance change from 10m to 1km), the changes in this mode may be too fast and too noticeable, or on the contrary they might be too slow if the difference is too small (e.g. from 1m to 1.05m). In this case you can choose another mode to change the value with a specified rate via the setBarometricSmoothBySpeed().

Arguments

  • float sec - Time interval (in seconds) during which the value changes from the current to target.

void setLightning ( float freq ) #

Sets a new lightning frequency value for the weather layer. This value defines how often the lightning is observed.

Arguments

  • float freq - Lightning frequency within the [0; 1] range. By the value of 0 there'll be no lighting at all, while 1 - corresponds to maximum frequency.

float getLightning ( ) const#

Returns the current lightning frequency value for the weather layer. This value defines how often the lightning is observed.

Return value

Lightning frequency within the [0; 1] range. By the value of 0 there is no lighting at all, while 1 - corresponds to maximum frequency.

float getImpact ( double altitude ) const#

Returns a value indicating the degree of impact of the layer at the specified altitude depending on whether it is completely inside, outside, or somewhere within the transition area.

Arguments

  • double altitude - Altitude value to be checked.

Return value

Value indicating the degree of impact of the layer at the specified altitude:
  • 0 - completely outside the layer (and transition area)
  • 1 - inside the layer
  • (0 < x < 1) - within the transition area

float getDensity ( const Math::dvec3& world_pos ) const#

Returns the current density of clouds/precipitation intensity at the specified point. This method can be used to implement a meteoradar.

Arguments

  • const Math::dvec3& world_pos - Coordinates of the point at which the density of clouds or precipitation intensity is to be obtained.

Return value

Density of clouds for a cloud layer or precipitation intensity for a precipitation layer.
Last update: 2024-04-19
Build: ()