ObjectWater Class
This class is used to create an infinite water with auto-tessellation. It is simulated with four sine waves. Note that even if peak values of some of the waves are set to zero, all four waves will be calculated anyway.
ObjectWater Class
This class inherits from ObjectMembers
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
Integer, each bit of which is 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 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.
void setFieldMask (int mask)
Sets a mask specifying the area of the Field node to be applied to the water.Arguments
- int mask - Integer, each bit of which is 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 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
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)