This page has been translated automatically.
Видеоуроки
Интерфейс
Основы
Продвинутый уровень
Подсказки и советы
Основы
Программирование на C#
Рендеринг
Профессиональный уровень (SIM)
Принципы работы
Свойства (properties)
Компонентная Система
Рендер
Режимы вывода изображения
Физика
Браузер SDK 2
Лицензирование и типы лицензий
Дополнения (Add-Ons)
Демонстрационные проекты
API Samples
Редактор UnigineEditor
Обзор интерфейса
Работа с ассетами
Контроль версий
Настройки и предпочтения
Работа с проектами
Настройка параметров ноды
Setting Up Materials
Настройка свойств
Освещение
Sandworm
Использование инструментов редактора для конкретных задач
Расширение функционала редактора
Встроенные объекты
Ноды (Nodes)
Объекты (Objects)
Эффекты
Декали
Источники света
Geodetics
World-ноды
Звуковые объекты
Объекты поиска пути
Player-ноды
Программирование
Основы
Настройка среды разработки
Примеры использования
C++
C#
UnigineScript
Унифицированный язык шейдеров UUSL (Unified UNIGINE Shader Language)
Плагины
Форматы файлов
Материалы и шейдеры
Rebuilding the Engine Tools
Интерфейс пользователя (GUI)
Двойная точность координат
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
Работа с контентом
Оптимизация контента
Материалы
Визуальный редактор материалов
Material Nodes Library
Miscellaneous
Input
Math
Matrix
Textures
Art Samples
Учебные материалы

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