This page has been translated automatically.
视频教程
界面
要领
高级
实用建议
基础
专业(SIM)
UnigineEditor
界面概述
资源工作流程
版本控制
设置和首选项
项目开发
调整节点参数
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
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::FieldWeather Class

Header: #include <UnigineFields.h>
Inherits from: Field

This class is used to create and modify a weather field. The field is applied to CloudLayer object and specifies a local weather area. This type of field makes it possible to create local storms or clouds having their own coverage texture as well as to control their movement.

Notice
The number of weather fields on the scene is not limited as their impact on performance is not significant.

Creating a Weather Field

Notice
When creating a FieldWeather node you should specify a coverage texture for it as it doesn't have any default texture.
Source code (C++)
// create a new instance of the FieldWeather class and set its transformation
FieldWeatherPtr weather = FieldWeather::create();
weather->setTransform(Mat4(1));
// set the size of the field
weather->setSize(vec3(4096.0f, 4096.0f, 4096.0f));
// set the coverage texture
weather->setTexturePath("unigine_project/textures/coverage.png");

FieldWeather Class

Members


static FieldWeatherPtr create ( ) #

Constructor. Creates a new empty FieldWeather instance with default properties.

void setAttenuation ( float attenuation ) #

Sets the attenuation factor value. This parameter indicates how much the coverage texture attenuates starting from the center of the FieldWeather to its edges.

Arguments

  • float attenuation - Attenuation factor value within the [0.0f; 1.0f] range. The default value is 1.0f.

float getAttenuation ( ) const#

Returns current attenuation factor value. This parameter indicates how much the coverage texture attenuates starting from the center of the FieldWeather to its edges.

Return value

Attenuation factor value within the [0.0f; 1.0f] range. The default value is 1.0f.

void setAttenuationType ( int type ) #

Sets the type of attenuation shape.

Arguments

  • int type - Attenuation shape type:
    • 0 - sphere.
    • 1 - box.

int getAttenuationType ( ) const#

Returns the current type of attenuation shape.

Return value

Attenuation shape type:
  • 0 - sphere.
  • 1 - box.

void setCloudsAnimationOffset ( const Math::vec3 & offset ) #

Sets the offset of the FieldWeather coverage texture.

Arguments

  • const Math::vec3 & offset - Coverage texture offset. A vec3 vector with components representing the offset values of the coverage texture along the X, Y and Z axes.

Math::vec3 getCloudsAnimationOffset ( ) const#

Sets the offset of the FieldWeather coverage texture.

Return value

Coverage texture offset. A vec3 vector with components representing the offset values of the coverage texture along the X, Y and Z axes.

void setTexture ( const Ptr<Texture> & texture ) #

Sets a given texture as a coverage texture of the FieldWeather.

Arguments

Ptr<Texture> getTexture ( ) const#

Grabs the current coverage texture of the FieldWeather and puts it into the given Texture instance.

Return value

Texture instance to grab the coverage texture into.

int setTextureImage ( const Ptr<Image> & image ) #

Sets the given image as the coverage texture of the FieldWeather.

Arguments

  • const Ptr<Image> & image - Image instance with a coverage texture for the FieldWeather.

Return value

1 if the coverage texture was set successfully; otherwise, 0.

int getTextureImage ( const Ptr<Image> & image ) const#

Grabs the coverage texture of the FieldWeather (already loaded to GPU) and saves it into the given Image instance.

Arguments

  • const Ptr<Image> & image - Image instance into which the current coverage texture will be grabbed.

Return value

1 if the coverage texture was grabbed successfully; otherwise, 0.

void setTexturePath ( const char * path ) #

Sets the new path to the FieldWeather's coverage texture.

Arguments

  • const char * path - Path to the coverage texture.

const char * getTexturePath ( ) const#

Returns the current path to the FieldWeather's coverage texture.

Return value

Path to the coverage texture.

void setIntensity ( float intensity ) #

Sets the intensity of the FieldWeather. This parameter determines the degree of impact of the FieldWeather coverage texture on the clouds.

Arguments

  • float intensity - Intensity value within the [0.0f; 1.0f] range. The default value is 1.0f.

float getIntensity ( ) const#

Returns current intensity of the FieldWeather. This parameter determines the degree of impact of the FieldWeather coverage texture on the clouds.

Return value

Intensity value within the [0.0f; 1.0f] range. The default value is 1.0f.

void setPower ( float power ) #

Sets the power value for the FieldWeather coverage texture. This parameter derermines the contrast of the coverage texture and makes it possible to gradually increase cloudiness without changing the coverage texture.
Notice
For this parameter to work properly, the coverage texture must not contain absolotely black pixels.

Arguments

  • float power - Power value within the [0.0f; 1.0f] range. The default value is 1.0f.

float getPower ( ) const#

Returns the current power value for the FieldWeather coverage texture. This parameter derermines the contrast of the coverage texture and makes it possible to gradually increase cloudiness without changing the coverage texture.

Return value

Power value within the [0.0f; 1.0f] range. The default value is 1.0f.

void setSize ( const Math::vec3 & size ) #

Sets the size of the FieldWeather.

Arguments

  • const Math::vec3 & size - FieldWeather size. A vec3 vector with components representing the sizes along the X, Y and Z axes, in units.

Math::vec3 getSize ( ) const#

Returns the current size of the FieldWeather.

Return value

FieldWeather size. A vec3 vector with components representing the sizes along the X, Y and Z axes, in units.

void setWindEnabled ( int enabled ) #

Enables or disables local wind inside the FieldWeather.

Arguments

  • int enabled - 1 value to enable local wind, 0 to disable it.

int getWindEnabled ( ) const#

Returns a value indicating if local wind inside the FieldWeather is enabled.

Return value

1 if local wind is enabled; otherwise, 0.

void setWindAnimation ( const Math::vec3 & animation ) #

Sets the local wind speed in X, Y and Z directions. The wind along X and Y axes shifts local coverage texture at the specified rates in the corresponding directions. This parameter can be used to animate clouds inside the weather field. The texture shifting is looped inside the field, as the wind affects only its offset.
Notice
Setting wind speed values to 0 does not return the texture to its initial state. In order to return the initial state disable local wind by using the setWindEnabled() method.

Arguments

  • const Math::vec3 & animation - Local wind speed vec3 vector with components representing the wind speed values in the X, Y and Z directions.

Math::vec3 getWindAnimation ( ) const#

Returns the current local wind speed in X, Y and Z directions.

Return value

Local wind speed vec3 vector with components representing the wind speed values in the X, Y and Z directions.

static int type ( ) #

Returns the type of the object.

Return value

FieldWeather type identifier.
Last update: 2024-04-19
Build: ()