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::Region Class

Header: #include <plugins/Unigine/IG/UnigineIG.h>

This class is used to manage weather regions for the IG. Each region contains one or multiple layers each comprising a vertical profile. The main layer always exists in the region and cannot be deleted. It is a base layer used to define weather parameters for the region, such as visibility range, temperature, humidity, etc.

Notice
IG plugin must be loaded.

There are three types of weather regions available:

  • Global - representing atmospheric layers, which have no distinct horizontal boundaries. Atmospheric effects are observed anywhere within the vertical range.
  • Local Rectangle - they have the same set of parameters (visibility, coverage, wind) as Global ones but atmospheric effects for them are restricted to a certain area defined by a rectangle.
  • Local Polygon - they have the same set of parameters (visibility, coverage, wind) as Global ones but atmospheric effects for them are restricted to a certain area defined by a polygon.

Global meteo conditions are managed via the Meteo class.

Region Class

枚举

REGION_TYPE#

Name描述
REGION_TYPE_GLOBAL = 0Global region type (atmospheric layers, which have no distinct horizontal boundaries).
REGION_TYPE_RECTANGLE = 1Local rectangle region type: regional weather with atmospheric effects restricted to a certain area defined by a rectangle.
REGION_TYPE_POLYGON = 2Local polygon region type: regional weather with atmospheric effects restricted to a certain area defined by a polygon.

Members


void setEnabled ( bool v ) #

Enables or disables the weather region.

Arguments

  • bool v - true to enable the weather region; false - to disable it.

bool isEnabled ( ) const#

Returns a value indicating if the weather region is currently enabled.

Return value

true if the weather region is currently enabled; otherwise, false.

long long getID ( ) const#

Returns the ID of the region.

Return value

Region ID.

WeatherLayer * createLayer ( long long layer_id, WeatherLayerType type ) #

Creates a new weather layer for the region. In case a layer with the specified ID exists and has a different type, it will be replaced with the new one.

Arguments

  • long long layer_id - ID of the layer to be created.
  • WeatherLayerType type - Type of the layer to be created, one of the following values:
    • Plugins::IG::WeatherLayerType::LAYER_BASE - base layer.
    • Plugins::IG::WeatherLayerType::LAYER_CLOUD - cloud layer.
    • Plugins::IG::WeatherLayerType::LAYER_PRECIPITATION - precipitation layer.

Return value

New weather layer if it is created successfully; otherwise, nullptr.

WeatherLayer * getLayer ( long long layer_id ) #

Returns a weather layer by its ID.

Arguments

  • long long layer_id - Weather layer ID.

Return value

Weather layer with the specified ID if it exists, otherwise nullptr.

bool removeLayer ( long long layer_id ) #

Removes a weather layer with the specified ID.

Arguments

  • long long layer_id - Weather layer ID.

Return value

true if the weather layer is created successfully; otherwise, false.

WeatherLayer * getMainLayer ( ) const#

Returns the main weather layer of the region. It is a base layer, that is used to define weather parameters, such as visibility range, temperature, humidity, etc. The main layer always exists in the region and cannot be deleted.

Return value

Main weather layer of the region.

void getLayers ( Vector<WeatherLayer*>& vec ) const#

Returns the list of all layers (base, clouds, precipitation) contained in the weather region.

Arguments

  • Vector<WeatherLayer*>& vec - The list of all layers in the weather region.

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

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

Arguments

  • const Math::Vec3& geo_pos - Geocoordinates of the point for which all affecting layers 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).

bool setShapeAsRectangle ( const Math::dvec2& size, double corner_radius = 0 ) #

Sets the shape of a rectangle weather region using the specified width, height, and corner radius.

Arguments

  • const Math::dvec2& size - Vector combining width and height of the rectangle, in units (W, H).
  • double corner_radius - Corner radius of the rectangle, in units. This parameter enables you to create a rounded rectangle.
    Notice
    This value cannot be greater than half size.

Return value

true if the shape of the region is set successfully; otherwise, false.

bool setShapeAsPolygon ( const Vector< Math::vec2 > & points, const Vector< unsigned short > & indices ) #

Sets the shape of a polygon weather region using the specified sets of vertex coordinates and their indices.

Arguments

  • const Vector< Math::vec2 > & points - Array of polygon vertex coordinates.
  • const Vector< unsigned short > & indices - Array of vertex indices defining a polygon.

Return value

true if the shape of the region is set successfully; otherwise, false.

bool setShapeAsPolygon ( const Vector< Math::dvec2 > & geo_points ) #

Sets the shape of a polygon weather region as a set of geocoordinates of points.

Arguments

  • const Vector< Math::dvec2 > & geo_points - Array of geocoordinates of points forming a polygon.

Return value

true if the shape of the region is set successfully; otherwise, false.

Region::REGION_TYPE getRegionType ( ) const#

Sets the type of the weather region's shape.

Return value

Weather region type, one of the following:
  • GLOBAL - global (atmospheric layers, which have no distinct horizontal boundaries)
  • RECTANGLE - local (regional weather with atmospheric effects restricted to a certain area defined by a rectangle)
  • POLYGON - local (regional weather with atmospheric effects restricted to a certain area defined by a polygon)

Math::dvec2 getShapeSize ( ) const#

Returns the size of the rectangle that defines or encloses the shape of the weather region as a two-component vector.

Return value

Two-component vector (W, L) containing width and length of the rectangle (in meters) that defines or encloses the shape of the weather region depending on its type:
  • Global - (inf, inf)
  • Rectangle - (rectangle_width, rectangle_length)
  • Polygon - (boundbox_width, boundbox_length)

double getShapeRectangleRadius ( ) const#

Returns the current corner radius of the rectangle. This parameter defines the shape of a rounded rectangle.

Return value

Current corner radius of the rectangle, in units.

void setTransitionSize ( double width ) #

Sets the width of the transition area around the borders of the weather region. The effects of the region fade out gradually within this area.

Arguments

  • double width - New width of the transition area around the borders of the weather region to be set, in meters.

double getTransitionSize ( ) const#

Returns the current width of the transition area around the borders of the weather region. The effects of the region fade out gradually within this area.

Return value

Current width of the transition area around the borders of the weather region, in meters.

void setWorldPosition ( const Math::dvec2& world_pos ) #

Sets new world coordinates for the weather region's position.

Arguments

  • const Math::dvec2& world_pos - New Cartesian coordinates to be set for the weather region's position (X, Y).

const Math::dvec2& getWorldPosition ( ) const#

Returns the current world coordinates of the weather region's position.

Return value

Current Cartesian coordinates of the weather region's position (X, Y).

void setGeoPosition ( const Math::dvec2& geo_pos ) #

Sets new geocoordinates for the weather region's position.

Arguments

  • const Math::dvec2& geo_pos - Geocoordinates of the weather region's position (Lat, Lon).

void setRotation ( float angle_deg ) #

Rotates the weather region around the Z axis by the specified angle.

Arguments

  • float angle_deg - Rotation angle to be set, in degrees within the [-360; 360] range.

float getRotation ( ) const#

Returns the current angle of rotation of the weather region around the Z axis.

Return value

Current rotation angle, in degrees within the [-360; 360] range.

float getImpact ( const Math::dvec2& world_pos ) const#

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

Arguments

  • const Math::dvec2& world_pos - World coordinates (Cartesian) of the point to be ckecked.

Return value

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

void * addOnChangedCallback ( CallbackBase * callback ) #

Adds a callback on changing region parameters.
Source code (C++)
/// callback function to be called when region parameters change
void SomeClass::my_region_callback()
{
	// actions to be performed on changing region parameters
}

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

Arguments

Return value

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

bool removeOnChangedCallback ( void * id ) #

Removes a callback on changing region parameters for the specified subscriber.

Arguments

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

Return value

true if the callback for the specified subscriber is removed successfully; otherwise, false.

int getNumLayers ( ) const#

Returns the total number of layers of the region.

Return value

Total number of layers.
Last update: 2023-03-15
Build: ()