This page has been translated automatically.
Video Tutorials
Interface
Essentials
Advanced
How To
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
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
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::Meteo 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 class is used to manage global meteo conditions for the IG (visibility range, wind speed and direction).

Notice
IG plugin must be loaded.

Meteo Class

Members


Region * getRegion ( long long id, bool auto_create ) #

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

  • long long id - Weather region identifier .
  • bool auto_create - true to automatically create the region with the specified ID if it doesn't exist yet; false - to return nullptr in case the region doesn't exist.

Return value

Weather region interface if it exists; otherwise - nullptr.

bool removeRegion ( long long id ) #

Removes a weather region with a given identifier.

Arguments

  • long long id - Identifier of the weather region to be removed .

Return value

true if a region with a given identifier is removed successfully; otherwise, false.

void clearRegions ( ) #

Removes all weather regions and layers.

Math::vec3 getMeanWindSpeed ( const Math::dvec3& geo_pos ) const#

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 Math::dvec3& geo_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 * addOnCreateRegionCallback ( Unigine::CallbackBase1 < Unigine::Plugins::IG::Region >* func ) #

Sets a callback function to be fired when a new weather region is created.

Arguments

  • Unigine::CallbackBase1 < Unigine::Plugins::IG::Region >* func - Callback pointer. The callback function must have the following signature:
    (Unigine::Plugins::IG::Region *region)

Return value

ID of the last added Create Region callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeOnCreateRegionCallback ( void * id ) #

Removes the specified callback from the list of Create Region callbacks.

Arguments

  • void * id - Create Region callback ID obtained when adding it.

Return value

true if the Create Region callback with the given ID was removed successfully; otherwise false.

void clearOnCreateRegionCallbacks ( ) #

Clears all added Create Region callbacks.

void * addOnRemoveRegionCallback ( Unigine::CallbackBase1 < Unigine::Plugins::IG::Region >* func ) #

Sets a callback function to be fired when a weather region is removed.

Arguments

  • Unigine::CallbackBase1 < Unigine::Plugins::IG::Region >* func - Callback pointer. The callback function must have the following signature:
    (Unigine::Plugins::IG::Region *region)

Return value

ID of the last added Remove Region callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeOnRemoveRegionCallback ( void * id ) #

Removes the specified callback from the list of Remove Region callbacks.

Arguments

  • void * id - Remove Region callback ID obtained when adding it.

Return value

true if the Remove Region callback with the given ID was removed successfully; otherwise false.

void clearOnRemoveRegionCallbacks ( ) #

Clears all added Remove Region callbacks.

void * addOnLightningStrikeCallback ( Unigine::CallbackBase2 < Unigine:: Math::Vec3, int > * func ) #

Sets a callback function to be fired when a lightning strikes.

Arguments

  • Unigine::CallbackBase2 < Unigine:: Math::Vec3, int > * func - Callback pointer. The callback function must have the following signature:
    (Unigine::Math::Vec3 geo_pos, int type)

Return value

ID of the last added Lightning Strike callback, if the callback was added successfully; otherwise, nullptr. This ID can be used to remove this callback when necessary.

bool removeOnLightningStrikeCallback ( void * id ) #

Removes the specified callback from the list of Lightning Strike callbacks.

Arguments

  • void * id - Lightning Strike callback ID obtained when adding it.

Return value

true if the Lightning Strike callback with the given ID was removed successfully; otherwise false.

void clearOnLightningStrikeCallbacks ( ) #

Clears all added Lightning Strike callbacks.

void * addOnMeteoChangedCallback ( 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);
}

// ...
// somewhere in code
void SomeClass::init()
{
	// adding "my_weather_callback" to be called on changing weather conditions
	ig_manager->getMeteo()->addOnMeteoChangedCallback(this, Unigine::MakeCallback(this, &SomeClass::my_weather_callback );
}

Arguments

Return value

Callback subscriber ID. This ID can be used to remove this callback when necessary.

void removeOnMeteoChangedCallback ( void * subscriber ) #

Removes a callback on changing global meteo conditions for the specified subscriber.

Arguments

  • void * subscriber - Callback subscriber ID specified when adding it.

void clearOnMeteoChangedCallbacks ( ) #

Clears all added callbacks on changing global meteo conditions.

Region * getGlobalRegion ( ) const#

Returns the main global weather region.

Return value

Main global weather region.

MeteoCameraEffects * getCameraEffects ( ) const#

Returns the camera effects instance used to create dynamic effects for precipitation rendering when changing camera position and speed.

Return value

Returns the camera effects instance.

void findWeatherLayers ( const Vec3& geo_pos, Vector<MeteoPositionParam>& vector ) const#

Returns the list of all weather layers (base, clouds, precipitation) of all weather regions containing the specified position (and thus affecting it) along with their corresponding impact factors (as MeteoPositionParam structure).

Arguments

  • const Vec3& geo_pos - Geocoordinates of the point for which all affecting layers of all regions are to be found.
  • Vector<MeteoPositionParam>& vector - The list of all layers in the weather region containing the specified position (and thus affecting it) along with their corresponding impact factors (as MeteoPositionParam structure).

void lightningStrike ( const Math::dvec3& geo_pos, int type = -1 ) #

Generates a lightning strike effect at the specified location.

Arguments

  • const Math::dvec3& geo_pos - Geocoordinates of the lightning strike location.
  • int type

int getNumRegions ( ) const#

Returns the total number of weather regions.

Return value

Total number of weather regions.

Region * getRegionByIndex ( int index ) #

Returns a weather region by its index.

Arguments

Return value

Weather region with the specified index if it exists, otherwise nullptr.

double getCloudBottom ( ) const#

Returns the height of the bottom (lower bound) of the lowest cloud layer among all weather regions.

Return value

Height of the bottom (lower bound) of the lowest cloud layer among all weather regions.
Last update: 2023-06-23
Build: ()