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

An ocean's ripples at one moment: its spectrum on below minWavelength, down to shortestRipple, as a density over wavenumber. More...

#include <ocean_surface.h>

Public Member Functions

bool any () const
 Whether there are any: wind, and a band.
float density (const glm::vec2 &k) const
 Height variance a square radian a metre of wavenumber k holds: what the grids draw.
float slopeVariance (float from, float to) const
 The variance of the slope the ripples between wavenumbers from and to raise.

Static Public Member Functions

static OceanRipples at (const Ocean &ocean, double time)
 The ripples of ocean, time seconds in: none for a windless ocean.

Public Attributes

float longest = 0.0f
 The band's lowest wavenumber, radians a metre: the shortest wave's.
float shortest = 0.0f
 Its highest; no ripples unless above longest.
float peak = 0.0f
 JONSWAP's peak frequency, radians a second.
float alpha = 0.0f
 Its scale, Phillips' alpha times g squared.
float depth = 0.0f
 Metres; 0 deep.
float choppiness = 0.0f
 How far a crest squeezes the surface, as the waves'.
glm::vec2 wind = {0.0f, 1.0f}
 Unit, on the XZ plane: the way the waves roll.
float spreadPower = 1.0f
 s, in the spread's cos^2s of half the angle off the wind.
float spreadScale = 0.0f
 What makes the spread one round the circle.
float cycle = 0.0f
 How far through LOOP, 0..1.

Static Public Attributes

static constexpr double LOOP = 256.0

Detailed Description

An ocean's ripples at one moment: its spectrum on below minWavelength, down to shortestRipple, as a density over wavenumber.

Too short to move a vertex or anything afloat, so only the renderer reads them, for the water's light and foam (rendering.md, "The ocean"). density() is stated again in shaders/ocean_ripples.glsl; the renderer's tests hold the two to each other.

Member Function Documentation

◆ at()

OceanRipples Vkm::Engine::OceanRipples::at ( const Ocean & ocean,
double time )
static

The ripples of ocean, time seconds in: none for a windless ocean.

Parameters
oceanThe authored sea.
timeSeconds, as NetSession::worldTime gives them.
Returns
Its ripples; adding them moves no wave.

Member Data Documentation

◆ LOOP

double Vkm::Engine::OceanRipples::LOOP = 256.0
staticconstexpr

Seconds before the ripples repeat: each rolls a whole number of times a loop, so the GPU's phases stay exact in float however long the sea has run (Tessendorf's looping).


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