eulerjs API / @eulerjs/marine / WaterMesh
WaterMesh
Defined in: packages/marine/src/three/WaterMesh.ts:83
Renders a SumOfSines ocean: a grid of chunks around the follow target, displaced on the GPU by exactly the waves the physics uses. The centre chunks resolve the same waves as the physics (both use waves.sampleSpacing); farther chunks drop the shortest waves from the geometry and keep them only in the per-pixel normal.
Extends
BatchedMesh
Constructors
Constructor
new WaterMesh(source, options?): WaterMesh;Defined in: packages/marine/src/three/WaterMesh.ts:93
Renders an Ocean's surface, or a SumOfSines directly.
Parameters
| Parameter | Type |
|---|---|
source | | SumOfSines | Ocean<SumOfSines> |
options? | WaterMeshOptions |
Returns
WaterMesh
Overrides
BatchedMesh.constructorProperties
| Property | Modifier | Type | Default value | Description | Overrides | Defined in |
|---|---|---|---|---|---|---|
chunkSize | readonly | number | undefined | - | - | packages/marine/src/three/WaterMesh.ts:86 |
follow | public | Object3D<Object3DEventMap> | undefined | undefined | - | - | packages/marine/src/three/WaterMesh.ts:88 |
lod | readonly | WaterLod | undefined | - | - | packages/marine/src/three/WaterMesh.ts:85 |
material | public | MeshPhysicalMaterial | THREE.MeshBasicMaterial | new THREE.MeshBasicMaterial(). | An instance of material derived from the THREE.Material | Material base class or an array of materials, defining the object's appearance. | BatchedMesh.material | packages/marine/src/three/WaterMesh.ts:90 |
uniforms | readonly | WaterUniforms | undefined | - | - | packages/marine/src/three/WaterMesh.ts:87 |
waves | readonly | SumOfSines | undefined | - | - | packages/marine/src/three/WaterMesh.ts:84 |
world | public | World | undefined | undefined | - | - | packages/marine/src/three/WaterMesh.ts:89 |
Methods
onBeforeRender()
onBeforeRender(...renderArguments): void;Defined in: packages/marine/src/three/WaterMesh.ts:152
An optional callback that is executed immediately before a 3D object is rendered.
Parameters
| Parameter | Type |
|---|---|
...renderArguments | [renderer: WebGLRenderer, scene: Scene<Object3DEventMap>, camera: Camera, geometry: BufferGeometry<NormalBufferAttributes, BufferGeometryEventMap>, material: Material<MaterialEventMap>, group: Group<Object3DEventMap>] |
Returns
void
Remarks
This function is called with the following parameters: renderer, scene, camera, geometry, material, group. Please notice that this callback is only executed for renderable 3D objects. Meaning 3D objects which define their visual appearance with geometries and materials like instances of Mesh, Line, Points or Sprite. Instances of Object3D, Group or Bone are not renderable and thus this callback is not executed for such objects.
Overrides
BatchedMesh.onBeforeRenderupdate()
update(time?): void;Defined in: packages/marine/src/three/WaterMesh.ts:140
Moves the mesh under the follow target and advances the waves to time (simulation seconds, by default the world's render time). Only needed without the world option.
Parameters
| Parameter | Type |
|---|---|
time? | number |
Returns
void
