Unigine.FieldWeather Class
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.
The number of weather fields on the scene is not limited as their impact on performance is not significant.
Creating a Weather Field
When creating a FieldWeather node you should specify a coverage texture for it as it doesn't have any default texture.
// create a new instance of the FieldWeather class and set its transformation
FieldWeather weather = new FieldWeather();
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
Properties
vec3 CloudsAnimationOffset#
Sets the offset of the FieldWeather coverage texture.
set
Sets the offset of the FieldWeather coverage texture.
set value -
Coverage texture offset. A vec3 vector with components representing the offset values of the coverage texture along the X, Y and Z axes.
int WindEnabled#
A value indicating if local wind inside the fieldweather is enabled.
set
Enables or disables local wind inside the FieldWeather.
set value -
1 value to enable local wind, 0 to disable it.
vec3 WindAnimation#
The current local wind speed in X, Y and Z directions.
set
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.
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.
set value -
Local wind speed vec3 vector with components representing the wind speed values in the X, Y and Z directions.
Texture Texture#
Grabs the current coverage texture of the FieldWeather and puts it into the given Texture instance.
set
Sets a given texture as a coverage texture of the FieldWeather.
set value -
Texture instance.
string TexturePath#
The current path to the fieldweather's coverage texture.
set
Sets the new path to the FieldWeather's coverage texture.
set value -
Path to the coverage texture.
float Intensity#
Current intensity of the fieldweather. this parameter determines the degree of impact of the fieldweather coverage texture on the clouds.
set
Sets the intensity of the FieldWeather. This parameter determines the degree of impact of the FieldWeather coverage texture on the clouds.
set value -
Intensity value within the [0.0f; 1.0f] range. The default value is 1.0f.
float Power#
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.
set
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.
For this parameter to work properly, the coverage texture must not contain absolotely black pixels.
set value -
Power value within the [0.0f; 1.0f] range. The default value is 1.0f.
float Attenuation#
Current attenuation factor value. this parameter indicates how much the coverage texture attenuates starting from the center of the fieldweather to its edges.
set
Sets the attenuation factor value. This parameter indicates how much the coverage texture attenuates starting from the center of the FieldWeather to its edges.
set value -
Attenuation factor value within the [0.0f; 1.0f] range. The default value is 1.0f.
int AttenuationType#
The current type of attenuation shape.
set
Sets the type of attenuation shape.
set value -
Attenuation shape type:
- 0 - sphere.
- 1 - box.
vec3 Size#
The current size of the fieldweather.
set
Sets the size of the FieldWeather.
set value -
FieldWeather size. A vec3 vector with components representing the sizes along the X, Y and Z axes, in units.
Members
static FieldWeather ( ) #
Constructor. Creates a new empty FieldWeather instance with default properties.int SetTextureImage ( Image image ) #
Sets the given image as the coverage texture of the FieldWeather.Arguments
- 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 ( Image image ) #
Grabs the coverage texture of the FieldWeather (already loaded to GPU) and saves it into the given Image instance.Arguments
- 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.static int type ( ) #
Returns the type of the object.Return value
FieldWeather type identifier.Last update:
2020-07-31
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)