Skip to content

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 ​

ts
new SpectralWater(waves, options?): SpectralWater;

Defined in: packages/marine/src/webgpu/SpectralWater.ts:32

Parameters ​

ParameterType
wavesSpectralWaves
options?SpectralWaterOptions

Returns ​

SpectralWater

Overrides ​

ts
Group.constructor

Properties ​

PropertyModifierTypeDefined in
fieldsreadonlyGpuWaveFieldspackages/marine/src/webgpu/SpectralWater.ts:29
lodreadonlyQuadtreeLod | RingLodpackages/marine/src/webgpu/SpectralWater.ts:30
wavesreadonlySpectralWavespackages/marine/src/webgpu/SpectralWater.ts:28

Methods ​

dispose() ​

ts
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 ​

ts
Group.dispose

update() ​

ts
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 ​

ParameterType
rendererRenderer
timenumber
centreVector3
camera?Camera

Returns ​

void

Released under the MIT License.