Class: GpuHeightFieldSurfaceWater

SKUNAMI. GpuHeightFieldSurfaceWater

<virtual> new GpuHeightFieldSurfaceWater()

Abstract base class for GPU height field surface water simulations
Source:

Extends

Methods

addCallback(type, callbackFn)

Adds callback function that is executed at specific times
Parameters:
Name Type Description
type string Type of callback: 'exertForce' (only choice available now)
callbackFn function Callback function
Inherited From:
Source:

addDynamicObstacle(mesh, mass)

Adds a dynamic obstacle into the system
Parameters:
Name Type Description
mesh THREE.Mesh Mesh to use as a dynamic obstacle
mass number Mass of the dynamic obstacle
Inherited From:
Source:

addStaticObstacle(mesh)

Adds a static obstacle into the system
Parameters:
Name Type Description
mesh THREE.Mesh Mesh to use as a static obstacle
Inherited From:
Source:

disturb(position, amount, radius)

Disturbs the water, causing ripples on the water surface
Parameters:
Name Type Description
position THREE.Vector3 World-space position to disturb at
amount number Amount of water to disturb
radius number Radius of disturb
Inherited From:
Source:

flood(volume)

Floods the scene by the given volume
Parameters:
Name Type Description
volume number Volume of water to flood the scene with, in cubic scene units
Source:

getMeanHeight() → {number}

Gets mean height
Source:
Returns:
Mean height
Type
number

getObstaclesDisplayTexture() → {THREE.WebGLRenderTarget}

Gets the obstacle texture
Inherited From:
Source:
Returns:
Obstacles texture
Type
THREE.WebGLRenderTarget

getPixelFloatData() → {Float32Array}

Returns the pixel float data for the water textures
NOTE: This is an expensive operation.
Inherited From:
Source:
Returns:
Float data of the water texture
Type
Float32Array

getShouldDisplayObstaclesTexture() → {boolean}

Gets whether the obstacles texture should be displayed
Inherited From:
Source:
Returns:
Whether the obstacles texture should be displayed
Type
boolean

getShouldDisplayWaterTexture() → {boolean}

Gets whether the water texture should be displayed
Inherited From:
Source:
Returns:
Whether the water texture should be displayed
Type
boolean

getWaterDisplayTexture() → {THREE.WebGLRenderTarget}

Gets the water texture that is used for displacement of mesh
Inherited From:
Source:
Returns:
Water texture that is used for displacement of mesh
Type
THREE.WebGLRenderTarget

removeObstacle(mesh)

Removes obstacle from the system
Parameters:
Name Type Description
mesh THREE.Mesh Mesh of the obstacle to remove
Inherited From:
Source:

reset()

Resets the simulation
Inherited From:
Source:

setMeanHeight(value)

Sets mean height
Parameters:
Name Type Description
value number Mean height
Source:

setShouldDisplayObstaclesTexture(value)

Sets whether the obstacles texture should be displayed
Parameters:
Name Type Description
value boolean Whether the obstacles texture should be displayed
Inherited From:
Source:

setShouldDisplayWaterTexture(value)

Sets whether the water texture should be displayed
Parameters:
Name Type Description
value boolean Whether the water texture should be displayed
Inherited From:
Source:

update(dt)

Updates the water simulation
NOTE: This needs to be called every frame, after renderer.clear() and before renderer.render(...)
Parameters:
Name Type Description
dt number Elapsed time since previous frame
Inherited From:
Source: