eulerjs API / @eulerjs/marine/webgpu / SpectralWater
SpectralWater
Defined in: packages/marine/src/webgpu/SpectralWater.ts:27
A SpectralWaves sea drawn to the horizon with three's WebGPURenderer, on WebGPU or its WebGL 2 fallback: every wave of every patch on the GPU, the same sea the physics floats bodies on. For WebGLRenderer, draw a SumOfSines sea with WaterMesh instead.
const water = new SpectralWater(waves);
scene.add(water);
// each frame, with the time the physics was last stepped to (world.renderTime) and the viewer:
water.update(renderer, world.renderTime, camera.position, camera);
Extends
Group
Constructors
Constructor
new SpectralWater(waves, options?): SpectralWater;Defined in: packages/marine/src/webgpu/SpectralWater.ts:32
Parameters
| Parameter | Type |
|---|---|
waves | SpectralWaves |
options? | SpectralWaterOptions |
Returns
SpectralWater
Overrides
Group.constructorProperties
| Property | Modifier | Type | Defined in |
|---|---|---|---|
fields | readonly | GpuWaveFields | packages/marine/src/webgpu/SpectralWater.ts:29 |
lod | readonly | QuadtreeLod | RingLod | packages/marine/src/webgpu/SpectralWater.ts:30 |
waves | readonly | SpectralWaves | packages/marine/src/webgpu/SpectralWater.ts:28 |
Methods
dispose()
dispose(): void;Defined in: packages/marine/src/webgpu/SpectralWater.ts:53
Frees the GPU-related resources allocated by this instance.
Returns
void
Remarks
Call this method whenever this instance is no longer used in your app. Geometries, materials and textures are potentially shared with other 3D objects and must be disposed of separately.
Overrides
Group.disposeupdate()
update(
renderer,
time,
centre,
camera?
): void;Defined in: packages/marine/src/webgpu/SpectralWater.ts:44
Evaluates the waves at time and lays the surface out around centre, the point it is finest at: usually the camera's position. With camera, a quadtree leaves out what it can't see.
Parameters
| Parameter | Type |
|---|---|
renderer | Renderer |
time | number |
centre | Vector3 |
camera? | Camera |
Returns
void
