FieldShoreline Class
Inherits: | Field |
This class is used to create and modify a field shoreline. The field is applied to global water and helps to create swashes near the shores and applies the wetness effect on objects near the shoreline.
A field shoreline object will affect water only if the FieldShoreline interaction option is enabled on the States tab of the water_global_base material.
Creating a Shoreline Field
When creating a FieldShoreline object you should specify a shoreline texture for it as this object doesn't have any default texture.
// create a new instance of the FieldShoreline class and set its transformation
FieldShoreline shoreline = new FieldShoreline();
shoreline.setTransform(Mat4("1 0 0 0 0 1 0 0 0 0 1 0 1878 2734 0 1"));
// set the size of the field
shoreline.setSize(vec3(4096.0f,4096.0f,512.0f));
// set the path to the shoreline texture
shoreline.setImageTextureName("unigine_project/textures/shorelines/shoreline_0.dds");
// release script ownership of the FieldShoreline
node_remove(shoreline);
// add the FieldShoreline to the list of editor nodes
engine.editor.addNode(shoreline);
FieldShoreline Class
Members
static FieldShoreline()
Default constructor. Creates a FieldShoreline instance with the default size vec3(512.0f, 512.0f, 512.0f).By default, a shoreline texture is empty. Specify it after creating the FieldShoreline by using an apropriate function.
FieldShoreline cast(Node node)
Casts the FieldShoreline out of the Node instance.Arguments
- Node node - Node class instance
Return value
FieldShoreline class instance.FieldShoreline cast(Field base)
Casts the FieldShoreline out of the Field instance.Arguments
- Field base - Field class instance
Return value
FieldShoreline class instance.void setImageTexture(Texture texture)
Sets the given texture from the Texture instance for the FieldShoreline.Arguments
- Texture texture - Texture instance.
Texture getImageTexture()
Returns the shoreline texture (from GPU) and saves it into the given Texture instance.Return value
int setImageTextureImage(Image image)
Sets the given image as the shoreline texture of the FieldShorelineArguments
- Image image - Image instance with a shoreline texture for the FieldShoreline.
int getImageTextureImage(Image image)
Grabs the texture for the FieldShoreline (already loaded to GPU) and saves it into the given Image instance.Arguments
- Image image - Image instance into which the texture will be saved.
Return value
1 if the texture has been grabbed successfully; otherwise, 0.void setImageTextureName(string name)
Sets the path to the FieldShoreline's shoreline texture.Arguments
- string name - Path to the shoreline texture.
string getImageTextureName()
Returns the path to the FieldShoreline's shoreline texture.Return value
Path to the shoreline texture.void setSize(vec3 size)
Sets the vec3 size vector of the FieldShoreline.The default value is (512.0f, 512.0f, 512.0f).
Arguments
- vec3 size - Size vector (x,y,z), where:
- x value is length of the FieldShoreline along X axis (in units),
- y value is length of the FieldShoreline along Y axis (in units),
- z value is length of the FieldShoreline along Z axis (in units).
vec3 getSize()
Returns the vec3 size vector of the FieldShoreline.The default value is (512.0f, 512.0f, 512.0f).
Return value
Size vector (x,y,z), where:- x value is length of the FieldShoreline along X axis (in units),
- y value is length of the FieldShoreline along Y axis (in units),
- z value is length of the FieldShoreline along Z axis (in units).
int type()
Returns the type of the object.Return value
FieldShoreline type identifier.Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)