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.
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
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
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
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.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.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:
2021-12-13
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)