UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
Content Creation
Materials
Unigine Material Library
Tutorials

ObjectWaterMesh Class

This class is used to create limited mesh tessellation-based water basin. Like the ObjectWater, four sine waves are simulated for it. At the same time it does not provide an underwater mode and, therefore, should be used for shallower water bodies like puddles or not too deep basins.

ObjectWaterMesh Class

This class inherits from Object

Members


ObjectWaterMesh ()

Constructor. Creates a new water mesh object.

ObjectWaterMesh (string name)

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

Arguments

  • string name - Path to the water mesh.

int getFieldMask ()

Returns a mask specifying the area of the Field node to be applied to the water mesh.

Return value

Integer, each bit of which is a mask.

float getHeight (vec3 position)

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

Arguments

  • vec3 position - Point position coordinates.

Return value

Height offset of the point.

int getMesh (ObjectMesh mesh)

Allows to receive a mesh node as an argument.

Arguments

  • ObjectMesh mesh - Name of the mesh.

Return value

Mesh node.

vec3 getNormal (vec3 position)

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

Arguments

  • vec3 position - Point position coordinates.

Return value

Normal vector.

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.

float getWaveHeight (int num)

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

Arguments

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

Return value

Height in units.

float getWaveLength (int num)

Returns the distance between successive crests of the wave..

Arguments

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

Return value

Length in units.

float getWaveSpeed (int num)

Returns velocity of a given wave.

Arguments

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

Return value

Speed in units per second.

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 contain the velocity of the wave.
  • The z component contains the frequency.
  • The w component contains the amplitude.

int load (string name)

Loads water mesh from a specified file.

Arguments

  • string name - Mesh name.

Return value

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

int save (string name)

Saves water mesh into a specified file.

Arguments

  • string name - Mesh name.

Return value

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

void setFieldMask (int mask)

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

Arguments

  • int mask - Integer, each bit of which is a mask.

int setMesh (ObjectMesh mesh)

Allows to reinitialize the ObjectWaterMesh.

Arguments

  • ObjectMesh mesh - Name of the mesh node.

Return value

1 if the mesh node is successfully set, otherwise - 0.

void setWaveAngle (int num, float angle)

Sets direction (angle of spreading) for a given wave.

Arguments

  • int num - Wave number in range [0;3].
  • float angle - Angle in degrees.

void setWaveHeight (int num, float height)

Sets the distance between the highest and the lowest wave peaks.

Arguments

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

void setWaveLength (int num, float length)

Sets the distance between successive crests of the wave.

Arguments

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

void setWaveSpeed (int num, float speed)

Sets velocity of a given wave.

Arguments

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

void setWave (int num, vec4 wave)

Sets parameters of one of four simulated water waves.

Arguments

  • int num - Wave number in range [0;3].
  • vec4 wave - Wave parameters:
    • The x and y components contain the velocity of the wave.
    • The z component contains the frequency.
    • The w component contains the amplitude.
Last update: 2017-07-03