This page has been translated automatically.
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
Migration
Migrating to UNIGINE 2.0
C++ API Migration
Migrating from UNIGINE 2.0 to UNIGINE 2.1
注意! 这个版本的文档是过时的,因为它描述了一个较老的SDK版本!请切换到最新SDK版本的文档。
注意! 这个版本的文档描述了一个不再受支持的旧SDK版本!请升级到最新的SDK版本。

ObjectWater Class

This class is used to create an infinite water with auto-tessellation and the underwater mode. It is simulated with 4 sine waves. Note that even if peak values of some of the waves are set to 0, all 4 waves will be calculated anyway.

ObjectWater Class

This class inherits from Object

Members


ObjectWater ()

Constructor. Creates a new water object.

int getFieldMask ()

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

Return value

The integer value, each bit of which is used to set a mask.

float getHeight (vec3 position)

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

Arguments

  • vec3 position - Point position coordinates.

Return value

Height offset of the point.

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.

void setFieldMask (int mask)

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

Arguments

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

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