This page has been translated automatically.
Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
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
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

ObjectWaterMesh Class

Inherits:Object

Interface for object water mesh handling. The water mesh can have four sine waves. The object is used to create small water basins such as ponds, lakes and so on. ObjectWaterMesh has physics support, so it can have a body assigned, therefore, it can interact with other scene objects.

ObjectWaterMesh Class

Members


static ObjectWaterMesh()

Constructor. Creates a new water mesh object.

static ObjectWaterMesh(string name)

Constructor. Creates a new water mesh object from a specified file.

Arguments

  • string name - Path to the water mesh.

ObjectWaterMesh cast(Object base)

Casts an ObjectWaterMesh out of the Object instance.

Arguments

  • Object base - Object instance.

Return value

ObjectWaterMesh instance.

ObjectWaterMesh cast(Node node)

Casts an ObjectWaterMesh out of the Node instance.

Arguments

  • Node node - Node instance.

Return value

ObjectWaterMesh instance.

void setFieldMask(int mask)

Sets a field mask specifying the area of the Field node to be applied.

Arguments

  • int mask - An integer value, each bit of which is used to set a mask.

int getFieldMask()

Returns the mask specifying the area of the applied Field node.

Return value

The integer value, each bit of which sets a mask.

float getHeight(Vec3 position)

Returns a height offset of a given point relatively to the water mesh surface.

Arguments

  • Vec3 position - The point position coordinates.

Return value

Height offset of the point.

int setMesh(Mesh mesh)

Permits reinitialization of the water mesh object: copies a given mesh into the current water mesh.

Arguments

  • Mesh mesh - Mesh.

Return value

1 if the mesh is copied successfully; otherwise, 0.

int getMesh(Mesh mesh)

Copies the current water mesh into the received mesh.

Arguments

  • Mesh mesh - Received mesh.

Return value

1 if the mesh is copied successfully; otherwise, 0.

void setMeshName(string name)

Sets a new name for the water mesh.

Arguments

  • string name - A new name to be set for the water mesh.

string getMeshName()

Returns the name of the current water mesh.

Return value

The mesh name.

vec3 getNormal(Vec3 position)

Returns the normal vector of a given point (used to orient objects along the waves normals).

Arguments

  • Vec3 position - The point position coordinates.

Return value

Normal vector.

void setWave(int num, vec4 wave)

Sets parameters for one of four simulated water waves.

Arguments

  • int num - Wave number in range [0;3].
  • vec4 wave - Wave parameters:
    • The X and Y components containing the velocity of the wave.
    • The Z component containing the frequency.
    • The W component containing the amplitude.

vec4 getWave(int num)

Returns parameters of one of four simulated water waves.

Arguments

  • int num - Wave number in range [0;3].

Return value

Wave parameters:
  • The X and Y components containing the velocity of the wave.
  • The Z component containing the frequency.
  • The W component containing the amplitude.

void setWaveAngle(int num, float angle)

Sets direction (angle of spreading) for a given wave:
  • If 0 is specified, the wave spreads along the Y axis and is parallel to the X axis.
  • If a positive value is specified, the wave direction is slanted counterclockwise relative to its initial spread.
  • If a negative value is specified, the wave is rotated clockwise.

Arguments

  • int num - Wave number in range [0;3].
  • float angle - Angle, in degrees. Both positive and negative values are acceptable.

float getWaveAngle(int num)

Returns direction (angle of spreading) of a given wave.

Arguments

  • int num - Wave number in range [0;3].

Return value

Angle, in degrees.

void setWaveHeight(int num, float height)

Sets the distance between the highest and the lowest peaks for the given wave. It sets the wave form along with the setWaveLength()function. The higher the value is, the higher the waves are.

Arguments

  • int num - Wave number in range [0;3].
  • float height - Height, in units.

float getWaveHeight(int num)

Returns the distance between the highest and the lowest peaks for the given wave.

Arguments

  • int num - Wave number in range [0;3].

Return value

Height, in units.

void setWaveLength(int num, float length)

Sets the distance between successive crests for the given wave. The higher the length value is, the broader the waves are.

Arguments

  • int num - Wave number in range [0;3].
  • float length - Length, in units.

float getWaveLength(int num)

Returns the distance between successive crests of the given wave.

Arguments

  • int num - Wave number in range [0;3].

Return value

Length, in units.

void setWaveSpeed(int num, float speed)

Sets a speed for a given wave. The higher the value, the faster waves follow each other.

Arguments

  • int num - Wave number in range [0;3].
  • float speed - Speed, in units per second.

float getWaveSpeed(int num)

Returns the speed of a given wave.

Arguments

  • int num - Wave number in range [0;3].

Return value

Speed, in units per second.

int loadMesh(string name)

Loads a mesh for the current water mesh from the file. This function doesn't change the mesh name.

Arguments

  • string name - The name of the mesh file.

Return value

1 if the mesh is loaded successfully; otherwise, 0.

int saveMesh(string name)

Saves the object water mesh into a file.

Arguments

  • string name - A name of the file.

Return value

1 if the mesh is saved successfully; otherwise, 0.

int type()

Last update: 2017-07-03
Build: ()