|
| | Water (Graphics *gfx) |
| |
| | ~Water ()=default |
| |
| | Water (const Water &)=delete |
| |
| Water & | operator= (const Water &)=delete |
| |
| void | createPlane (float sizeX, float sizeZ, int segX, int segZ) |
| | Build a flat XZ plane (Y-up) sized sizeX × sizeZ with UVs in [0,1]².
|
| |
| void | update (float dt) |
| | Advance the animation clock by dt seconds.
|
| |
| void | setTime (float seconds) |
| |
| float | getTime () const |
| |
| void | setWaveSpeed (float speed) |
| |
| float | getWaveSpeed () const |
| |
| void | setWaveAmplitude (float amp) |
| | Amplitude of the shore-edge waves.
|
| |
| float | getWaveAmplitude () const |
| |
| void | setRippleAmplitude (float amp) |
| | Amplitude of the occasional middle drop ripples.
|
| |
| float | getRippleAmplitude () const |
| |
| void | setEdgeFalloff (float edge) |
| | Width (in UV, 0..1) of the edge wave band.
|
| |
| float | getEdgeFalloff () const |
| |
| void | setRippleCount (int count) |
| | How many expanding drop ripples exist.
|
| |
| int | getRippleCount () const |
| |
| void | setRippleInterval (float seconds) |
| | Seconds between drop ripples.
|
| |
| float | getRippleInterval () const |
| |
| void | setWaveScale (float scale) |
| |
| float | getWaveScale () const |
| |
| void | setWaterColor (float r, float g, float b) |
| |
| void | setReflectionTint (float r, float g, float b) |
| |
| void | setReflectionIntensity (float intensity) |
| |
| float | getReflectionIntensity () const |
| |
| void | setSunIntensity (float intensity) |
| |
| float | getSunIntensity () const |
| |
| void | setScreenSpaceReflection (bool enabled, float strength=0.85f) |
| | Optional screen-space reflection overlay. When enabled, the shader samples the SSR pass result (bound via the renderable's height-texture slot, binding 6) at the fragment's screen UV and blends it over the env cubemap reflection. Call setViewport before drawing so screen UVs map.
|
| |
| bool | getScreenSpaceReflection () const |
| |
| float | getScreenSpaceReflectionStrength () const |
| |
| void | setViewport (float width, float height) |
| | Window / target size in pixels, used to compute screen-space UVs.
|
| |
| float | getViewportWidth () const |
| |
| float | getViewportHeight () const |
| |
| void | bindParams () |
| | Upload current params to the shader push constants.
|
| |
| void | draw () |
| | Draw the water plane (uses default mesh3d camera / lighting state).
|
| |
| Shader * | getShader () const |
| |
| Mesh * | getMesh () const |
| |
Dynamic water surface with sky reflection and animated ripples.
A custom Mesh3D fragment shader renders a flat plane as water:
- Reflects the sky via the environment cubemap (binding 3), Fresnel-weighted so grazing angles reflect the sky more strongly.
- Ripples near the water's edge (waves lapping the shore), strongest at the boundary and fading inward.
- Occasional expanding ripple rings in the middle (rain drops / fish / boat), appearing at staggered intervals.
- A sun glint highlight from the primary directional light.
Parameters are packed into the shader push-constant block (data[0..31]); see Water::bindDefaults for the layout. Caller owns Water*; its Mesh / Shader are owned by Graphics.
在文件 Water.h 第 33 行定义.