This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
Version Control
设置和首选项
项目开发
调整节点参数
Setting Up Materials
设置属性
照明
Sandworm
使用编辑器工具执行特定任务
如何擴展編輯器功能
嵌入式节点类型
Nodes
Objects
Effects
Decals
光源
Geodetics
World Nodes
Sound Objects
Pathfinding Objects
Players
编程
基本原理
搭建开发环境
使用范例
C++
C#
UnigineScript
统一的Unigine着色器语言 UUSL (Unified UNIGINE Shader Language)
Plugins
File Formats
材质和着色器
Rebuilding the Engine Tools
GUI
双精度坐标
应用程序接口
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
创建内容
内容优化
材质
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Tutorials

Unigine::Plugins::IG::Meteo Class

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-03-15
Build: ()