Renderer · class
WaterRenderer
Vertices per side of a bounded body's sheet. A pool is not an ocean.
Explained in Hello world.
class WaterRendererimport { WaterRenderer } from '@driftengine/core';Constructor
new
constructor(gl: WebGL2RenderingContext, resolution?: number, nearExtent?: number, farHalfExtent?: number, reflectionFilterTaps?: import("./renderQuality.ts").WaterReflectionFilterTaps)| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
resolution? | number | cells per side of the wave-bearing near sheet. |
nearExtent? | number | total width of that sheet, in world metres. |
farHalfExtent? | number | how far the flat skirt carries the ocean out. There is
no point setting this far beyond the camera's far plane — geometry past it
is clipped, not drawn — so this only has to outrun the fog. See
buildWaterGrid for why these are two meshes and not one. |
reflectionFilterTaps? | import("./renderQuality.ts").WaterReflectionFilterTaps |
Methods
draw
draw(gl: WebGL2RenderingContext, camera: FrameView, timeSeconds: number, settings: WaterBody, directionalDir: Vec3, directionalColor: Vec3, ambient: Vec3, atmosphere: Atmosphere, underwaterEnabled: boolean, reflection: PlanarReflection | null, lights?: PointLightSet | null, lightFalloff?: 'smooth' | 'inverseSquare', windX?: number, windZ?: number): voidDraw the surface. Call after the sky: water writes depth and is occluded by geometry in front of it, but its far edge fades out, and that fade needs the sky already behind it to blend into.
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | |
camera | FrameView | |
timeSeconds | number | |
settings | WaterBody | |
directionalDir | Vec3 | |
directionalColor | Vec3 | |
ambient | Vec3 | |
atmosphere | Atmosphere | |
underwaterEnabled | boolean | |
reflection | PlanarReflection | null | |
lights? | PointLightSet | null | |
lightFalloff? | 'smooth' | 'inverseSquare' | |
windX? | number | |
windZ? | number |
dispose
dispose(gl: WebGL2RenderingContext): void| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext |