8#include "ecs/component/render/ocean.h"
10namespace Vkm::Engine {
13constexpr double JONSWAP_GAMMA = 3.3;
14constexpr double JONSWAP_SIGMA_BELOW = 0.07;
15constexpr double JONSWAP_SIGMA_ABOVE = 0.09;
31 glm::vec3 normal = {0.0f, 1.0f, 0.0f};
57 std::array<GerstnerWave, Ocean::MAX_WAVES> waves{};
60 std::array<OceanSurge, Ocean::MAX_SURGES>
surges{};
62 float calmRadius = 0.0f;
63 float stillRadius = 0.0f;
81 float reach(
const glm::vec2& rest)
const;
90 glm::vec3
normalAt(
const glm::vec2& point)
const;
117 static constexpr double LOOP = 256.0;
124 float heightScale = 1.0f;
One wave of an ocean's sum, at the surface's moment.
Definition ocean_surface.h:18
glm::vec2 direction
Unit, on the XZ plane: the way it rolls.
Definition ocean_surface.h:19
float wavenumber
Radians a metre: 2 pi over its length.
Definition ocean_surface.h:20
float amplitude
Definition ocean_surface.h:22
float frequency
Radians a second, by the dispersion at the ocean's depth.
Definition ocean_surface.h:21
float phase
Radians at the rest point's origin and this moment, in [0, 2 pi).
Definition ocean_surface.h:25
float steepness
How far a crest draws the water toward it, in amplitudes; the sum never folds over.
Definition ocean_surface.h:24
An ocean's ripples at one moment: its spectrum on below minWavelength, down to shortestRipple,...
Definition ocean_surface.h:114
static constexpr double LOOP
Definition ocean_surface.h:117
glm::vec2 wind
Unit, on the XZ plane: the way the waves roll.
Definition ocean_surface.h:126
static OceanRipples at(const Ocean &ocean, double time)
The ripples of ocean, time seconds in: none for a windless ocean.
float slopeVariance(float from, float to) const
The variance of the slope the ripples between wavenumbers from and to raise.
float alpha
Its scale, Phillips' alpha times g squared.
Definition ocean_surface.h:122
float spreadPower
s, in the spread's cos^2s of half the angle off the wind.
Definition ocean_surface.h:127
float cycle
How far through LOOP, 0..1.
Definition ocean_surface.h:130
float longest
The band's lowest wavenumber, radians a metre: the shortest wave's.
Definition ocean_surface.h:119
float density(const glm::vec2 &k) const
Height variance a square radian a metre of wavenumber k holds: what the grids draw.
float peak
JONSWAP's peak frequency, radians a second.
Definition ocean_surface.h:121
float spreadScale
What makes the spread one round the circle.
Definition ocean_surface.h:128
float shortest
Its highest; no ripples unless above longest.
Definition ocean_surface.h:120
bool any() const
Whether there are any: wind, and a band.
Definition ocean_surface.h:142
float choppiness
How far a crest squeezes the surface, as the waves'.
Definition ocean_surface.h:125
float depth
Metres; 0 deep.
Definition ocean_surface.h:123
The water over a world point: its height above the surface's rest, and the surface's normal.
Definition ocean_surface.h:29
An ocean's surface at one moment: the waves the spectrum gives, and what they do.
Definition ocean_surface.h:46
static OceanSurface at(const Ocean &ocean, const glm::vec3 ¢re, double time)
The surface of ocean, centred at centre, time seconds in.
float reach(const glm::vec2 &rest) const
How much of the waves reach rest: 1 inside calmRadius, 0 from stillRadius out.
glm::vec3 normalAt(const glm::vec2 &point) const
The surface's unit normal over the world point point.
glm::vec2 centre
Where the waves are whole.
Definition ocean_surface.h:61
OceanSurface withoutSurges() const
The same surface without its surges: the wind's sea alone.
std::array< OceanSurge, Ocean::MAX_SURGES > surges
The ocean's, as they stand this moment, each direction unit; one with none is left out.
Definition ocean_surface.h:60
static constexpr uint32_t INVERSE_STEPS
Definition ocean_surface.h:55
glm::vec3 displacement(const glm::vec2 &rest) const
Where the water resting at rest has been carried: X and Z across, Y up.
static constexpr double GRAVITY
Metres a second squared: what pulls every wave back, and sets how fast each rolls.
Definition ocean_surface.h:48
OceanSample sampleAt(const glm::vec2 &point) const
Both, for the price of finding the water over point once: what floating things ask.
float significantHeight() const
Spectral significant wave height, 4 sqrt(m0): the mean of the highest third of the waves.
static constexpr float SURGE_WHOLE
Of a surge's length, the share in the middle at its full height; past it each end tapers away.
Definition ocean_surface.h:51
glm::vec2 farthestReach() const
float heightAt(const glm::vec2 &point) const
The water's height over the world point point, above the surface's rest.
The scene's sea: wind-driven waves moving every surface whose material is waves.
Definition ocean.h:40