vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::Ocean Struct Reference

The scene's sea: wind-driven waves moving every surface whose material is waves. More...

#include <ocean.h>

Public Attributes

float windSpeed = 8.0f
 m/s, ten metres up: the waves' energy grows nearly with its square.
float windDirection = 0.0f
 Degrees round from +Z toward +X: the way the waves roll.
float fetch = 100.0f
float depth = 0.0f
 Metres of water under the waves: shallower slows them and flattens the long ones. 0 is deep.
float spread = 0.5f
 0 every wave rolls with the wind; 1 they come from all ahead of it.
float choppiness = 0.7f
 0 round swells; 1 crests drawn to a point.
float heightScale = 1.0f
 On the heights the spectrum gives.
float minWavelength = 2.0f
 Metres; shorter are ripples, per pixel.
float maxWavelength = 200.0f
 Metres.
uint32_t waveCount = 32
 Waves summed, up to MAX_WAVES.
uint32_t seed = 1
float shortestRipple = 0.03f
float calmRadius = 0.0f
 Metres from the Transform where the waves begin to fade.
float stillRadius = 0.0f
 Where they are gone; at or inside calmRadius they never fade.
float foam = 0.5f
float waterlineFoam = 0.6f
glm::vec3 foamColor = glm::vec3(0.9f, 0.94f, 0.96f)
float detailScale = 8.0f
 Metres across one repeat of the material's maps, laid over the water and drifting with the wind.
std::array< OceanSurge, MAX_SURGES > surges {}

Static Public Attributes

static constexpr float WATERLINE_SQUARE = 128.0f
 Metres across the square of sea ahead of the eye where the water meets what stands in it.

Detailed Description

The scene's sea: wind-driven waves moving every surface whose material is waves.

The waves are drawn from an ocean wave spectrum - JONSWAP, shortened by TMA's correction where depth is set (Horvath 2015) - as a sum of Gerstner waves, moved per vertex on the GPU and, by the same sum, by OceanSurface for gameplay that floats things on it. A scene uses one: findOcean picks it. Its Transform is where the waves are whole - past calmRadius from it they die away, gone at stillRadius - and the height its water rests at, which its waves surfaces should share: what breaks the water foams by it.

Member Data Documentation

◆ fetch

float Vkm::Engine::Ocean::fetch = 100.0f

Kilometres of open water the wind has blown over.

◆ seed

uint32_t Vkm::Engine::Ocean::seed = 1

Which waves and ripples: their directions and phases.

◆ shortestRipple

float Vkm::Engine::Ocean::shortestRipple = 0.03f

Metres: the spectrum on below minWavelength, down to this, are ripples - every one of them, for the surface's light and foam alone, too short to move a vertex or anything afloat.

◆ foam

float Vkm::Engine::Ocean::foam = 0.5f

How readily a squeezed crest whitens: 0 never, 1 at the least squeeze.

◆ waterlineFoam

float Vkm::Engine::Ocean::waterlineFoam = 0.6f

Metres of foam where the water meets anything standing in it, over WATERLINE_SQUARE ahead of the eye: 0 none.

◆ foamColor

glm::vec3 Vkm::Engine::Ocean::foamColor = glm::vec3(0.9f, 0.94f, 0.96f)

Linear.

◆ surges

std::array<OceanSurge, MAX_SURGES> Vkm::Engine::Ocean::surges {}

The surges rolling now, set by gameplay as it runs: session state, not saved with the scene, so it is not reflected. An unused one has height 0.


The documentation for this struct was generated from the following file: