Water Renderer

class WaterRenderer

The main water rendering class.

Public Functions

WaterRenderer()

Constructor.

virtual ~WaterRenderer()

Destructor.

virtual void RestoreDeviceObjects(platform::crossplatform::RenderPlatform *r)

Platform-dependent function called when initializing the water renderer.

void InvalidateDeviceObjects()

Platform-dependent function called when uninitializing the water renderer.

void SetBaseSkyInterface(simul::sky::BaseSkyInterface *si, simul::sky::AtmosphericScatteringInterface *ai)

Set the sky and atmospherics interface to allow the renderer to use the correct lighting values.

void fillBeaufortScaleConstants()

Static function to set the default values for the beaufort scale.

void updateBeaufortValues(localWaterValues *valuesToUpdate, float scale)

Set the water parameters according the beaufort scale.

void updateTime(float time)

Set the time.

void PreRenderUpdate(platform::crossplatform::GraphicsDeviceContext &deviceContext, float real_time_seconds)

Once per-frame update. Do this before any rendering each frame.

void Render(platform::crossplatform::GraphicsDeviceContext &deviceContext, const platform::crossplatform::Viewport *depthViewports, platform::crossplatform::Texture *depthTexture, platform::crossplatform::Texture *colourTexture, platform::crossplatform::Texture *cubemap, int passNo, int vr = 0)

Main Render function.

void RecompileShaders()

Recompile the shaders asynchronously.

void LoadShaders()

Reload the shaders - for debug purposes.

void RenderTextures(platform::crossplatform::GraphicsDeviceContext &deviceContext, int width, int depth)

Render debug textures.

void RenderFlowRays(platform::crossplatform::GraphicsDeviceContext &deviceContext, int width, int height)

Visualise the path of flow rays.

void updateBoundlessOceanDensity(float height)

Update the ocean surface detail according to how far away from the surface you are.

void enableBoundlessOcean(uint layerDensity, uint noOfLayers, int maxDistance)

Enable the boundless ocean with a certain maximum detail.

void disableBoundlessOcean()

Disable boundless ocean.

void createBoundedWaterObject(uint ID, vec3 dimension, vec3 location)

Create a bounded water object.

void addBoundedWaterObject(BoundedWaterObject *newWaterObject)

Add an existing water object to the renderer.

simul::terrain::BoundedWaterObject *getBoundedWaterObject(uint ID)

Get a pointer to a bounded water object.

void removeBoundedWaterObject(uint ID)

Remove a bounded water object.

simul::terrain::WaterWaveletsSimulator *getWaterWaveletsSimulator()

Get the water wavelets simulator object.

bool addWaterProbe(WaterProbeValues *values)

Create a water probe from the given values.

void updateWaterProbeValues(WaterProbeValues *values)

Update the values of a specific water probe.

vec4 getWaterProbeValues(int ID)

Get the results of a water probe.

void updateWaterProbes(platform::crossplatform::DeviceContext &deviceContext)

Caluculate the water probe results.

void removeWaterProbe(int ID)

Remove a water probe.

bool addWaterBuoyancyObject(WaterMeshObjectValues *newObject)

Create a water buoyancy object.

void updateWaterBuoyancyObjectValues(WaterMeshObjectValues *values)

Update the values of a specific water buoyancy object.

float *getWaterBuoyancyObjectResults(int ID)

Get the results of a water buoyancy object.

void updateWaterBuoyancyObjects(platform::crossplatform::DeviceContext &deviceContext)

Caluculate water buoyancy object vaues.

void removeWaterBuoyancyObject(int ID)

Remove a water buoyancy object.

bool addWaterMaskObject(const waterMaskingObject *newObject)

Create a water masking object.

void updateWaterMaskObjectValues(const waterMaskingObject *values)

Update the values of a specific water buoyancy object.

void removeWaterMaskObject(int ID)

Remove a water masking object.

void setShoreDepthTexture(platform::crossplatform::Texture *texture)

Set the shore depth texture.

shoreTexture *getShoreTextureParams()

Get the shore texture paramaters.

boundlessOceanProperties *getBoundlessOceanProperties()

Get Boundless ocean properties.

WaveGrid *getBoundlessWaveGrid()

Get a pointer to the wave grid used by the boundless ocean.

WaterParticleSimulator *getWaterParticleSimulator()

Get a pointer to the particle generator.

Public Static Functions

static long long GetEnum(const char *n)

Get the enums of water properties. Used mainly for plugin interfacing.

struct beaufortConstants

Struct for holding the beaufort values of a water object.

struct WaterProbeValues

Values of a water probe.

struct waterProbe

Struct for water probes.

struct waterBuoyancyObject

Struct for water buoyancy objects.

struct waterMaskingObject

Struct for water masking objects.