This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
FAQ
编程
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
应用程序接口
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Math Functionality
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
CIGI Client Plugin
Rendering-Related Classes
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

Unigine::FieldWeather Class

Header:#include <UnigineFields.h>
Inherits: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");
To add the FieldWeather node to UnigineEditor, add the following code:
Source code (C++)
// release ownership of the FieldWeather class
weather->release();
// add the FieldWeather to the list of editor nodes
Editor *editor = Editor::get();
editor->addNode(weather->getNode());

FieldWeather Class

Members


static FieldWeatherPtr create()

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

static Ptr<FieldWeather> cast(const Ptr<Field> & base)

Casts a FieldWeather out of the Field instance.

Arguments

  • const Ptr<Field> & base - Pointer to Field.

Return value

Pointer to FieldWeather.

static Ptr<FieldWeather> cast(const Ptr<Node> & node)

Casts a FieldWeather out of the Node instance.

Arguments

  • const Ptr<Node> & node - Pointer to Node.

Return value

Pointer to FieldWeather.

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()

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()

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()

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

  • const Ptr<Texture> & texture - Texture instance.

Ptr<Texture> getTexture()

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)

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 * name)

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

Arguments

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

const char * getTexturePath()

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()

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()

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()

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()

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()

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: 2018-08-10
Build: ()