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