This page has been translated automatically.
Getting Started
Migrating to UNIGINE 2.0
C++ API Migration
UnigineScript
The Language
Core Library
Engine Library
Node-Related Classes
GUI-Related Classes
Plugins Library
High-Level Systems
Samples
Usage Examples
C++ API
API Reference
Integration Samples
Usage Examples
C++ Plugins
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

ObjectWaterMesh Class

This class is used to create limited mesh tessellation-based water basin. Like the ObjectWater, four sine waves are simulated for it. However, this object does not provide the underwater mode. It can be used to create small water basins such as ponds, lakes and so on.

Notice
In contrast to ObjectWater, ObjectWaterMesh can have a body assigned, therefore, it can interact with other scene objects.

See Also

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.

string getMeshName ()

Returns the name of of the mesh.

Return value

Mesh name.

int getMesh (Mesh mesh)

Copies the current water mesh into the received mesh.

Arguments

  • Mesh mesh - Mesh.

Return value

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

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 radians.

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 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 - Mesh file name.

Return value

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

int saveMesh (string name)

Saves the water mesh into a file.

Arguments

  • string name - Mesh file name.

Return value

1 if the mesh is saved successfully; 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.

void setMeshName (string name)

Sets a new name for the water mesh.

Arguments

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

int setMesh (Mesh mesh)

Allows for reinitialization of the water mesh object: it copies a given mesh into the current water mesh.

Arguments

  • Mesh mesh - Mesh.

Return value

1 if the mesh is copied successfully; 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 radians.

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
Build: ()