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

Unigine::ObjectWaterMesh Class

Interface for object water mesh handling.

To use this class, include the UnigineObjectWaterMesh.h file.

Unigine::ObjectWaterMesh Class

Members


static int type ()

ObjectWaterMesh type.

Return value

ObjectWaterMesh type identifier.

static Ptr< ObjectWaterMesh > create (const NodePtr & node)

ObjectWaterMesh constructor.

Arguments

  • const NodePtr & node - Node smart pointer.

static Ptr< ObjectWaterMesh > create (const ObjectPtr & object)

ObjectWaterMesh constructor.

Arguments

  • const ObjectPtr & object - Object smart pointer.

static Ptr< ObjectWaterMesh > create (const MeshPtr & mesh)

ObjectWaterMesh constructor.

Arguments

  • const MeshPtr & mesh - The pointer to the mesh to be used as a base for a object.

static Ptr< ObjectWaterMesh > create (const char * name)

ObjectWaterMesh constructor.

Arguments

  • const char * name - The name of the mesh to be used as a base for a object.

virtual int loadMesh (const char * name) const =0

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

Arguments

  • const char * name - The name of the mesh file.

Return value

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

virtual int saveMesh (const char * name) const =0

Saves the object deferred mesh into a file.

Arguments

  • const char * name - A name of the mesh file.

Return value

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

virtual int setMesh (const MeshPtr & mesh) const =0

Copies a given mesh into the current object deferred mesh.

Arguments

  • const MeshPtr & mesh - The mesh smart pointer.

Return value

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

virtual int getMesh (const MeshPtr & mesh) const =0

Copies the current object deferred mesh into the received mesh.

Arguments

  • const MeshPtr & mesh - The mesh smart pointer.

Return value

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

virtual void setMeshName (const char * name) const =0

Sets a new name for the mesh.

Arguments

  • const char * name - A new name to be set for the mesh.

virtual const char * getMeshName () const =0

Returns the name of the mesh used as a base for the object.

Return value

The mesh name.

virtual void setFieldMask (int mask) const =0

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.

virtual int getFieldMask () const =0

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

Return value

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

virtual void setWave (int num, const vec4 & wave) const =0

Sets parameters of one of four simulated water waves.

Arguments

  • int num - Wave number in range [0;3].
  • const 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.

virtual vec4 getWave (int num) const =0

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.

virtual void setWaveAngle (int num, float angle) const =0

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.

virtual float getWaveAngle (int num) const =0

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

Arguments

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

Return value

Angle in degrees.

virtual void setWaveSpeed (int num, float speed) const =0

Sets a speed of 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.

virtual float getWaveSpeed (int num) const =0

Returns the speed of a given wave. The higher the value, the faster waves follow each other.

Arguments

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

Return value

Speed in units per second.

virtual void setWaveLength (int num, float length) const =0

Sets the distance between successive crests of the 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.

virtual float getWaveLength (int num) const =0

Returns the distance between successive crests of the wave. The higher the length value is, the broader the waves are.

Arguments

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

Return value

Length in units.

virtual void setWaveHeight (int num, float height) const =0

Sets the distance between the highest and the lowest wave peaks. It sets the wave form together with the ObjectWaterMesh::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.

virtual float getWaveHeight (int num) const =0

Returns the distance between the highest and the lowest wave peaks. The higher the value is, the higher the waves are.

Arguments

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

Return value

Height in units.

virtual float getHeight (const UNIGINE_VEC3 & position) const =0

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

Arguments

  • const UNIGINE_VEC3 & position - Point position coordinates.

Return value

Height offset of the point.

virtual vec3 getNormal (const UNIGINE_VEC3 & position) const =0

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

Arguments

  • const UNIGINE_VEC3 & position - Point position coordinates.

Return value

Normal vector.
Last update: 2017-07-03