FieldWeather Class
The scope of applications for UnigineScript is limited to implementing materials-related logic (material expressions, scriptable materials, brush materials). Do not use UnigineScript as a language for application logic, please consider C#/C++ instead, as these APIs are the preferred ones. Availability of new Engine features in UnigineScript (beyond its scope of applications) is not guaranteed, as the current level of support assumes only fixing critical issues.
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.
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
Members
static FieldWeather ( ) #
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 ( ) #
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 ( vec3 offset ) #
Sets the offset of the FieldWeather coverage texture.Arguments
- 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.
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 ( Texture texture ) #
Sets a given texture as a coverage texture of the FieldWeather.Arguments
- Texture texture - Texture instance.
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 ( 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.void setTexturePath ( string path ) #
Sets the new path to the FieldWeather's coverage texture.Arguments
- string path - Path to the coverage texture.
string 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.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 ( vec3 size ) #
Sets the size of the FieldWeather.Arguments
- vec3 size - FieldWeather size. A vec3 vector with components representing the sizes along the X, Y and Z axes, in units.
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 ( 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.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
- vec3 animation - Local wind speed vec3 vector with components representing the wind speed values in the X, Y and Z directions.
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:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)