Waterflow
Visualize water in terrain
src/shaders/fieldShader.comp File Reference

Shader for heightfield simulation. More...

Go to the source code of this file.

Functions

float getHeight (int i, int j, float ourTot, float ourTerr)
 gets modified contribution of point i,j
 layout (local_size_x=16, local_size_y=16) in
 This should be a nxn, where n is power of 2, however next step would result in 32x32, 1024 threads which is not always supported.
 layout (std430, binding=4) readonly buffer height0
 < Read buffer for heights
void main ()
 HeightField simulation kernel.

Variables

uniform float dt
 timestep for simulation.
uniform ivec2 size
 width and height of the arrays

Detailed Description

Shader for heightfield simulation.

Definition in file fieldShader.comp.


Function Documentation

float getHeight ( int  i,
int  j,
float  ourTot,
float  ourTerr 
)

gets modified contribution of point i,j

Gives the contribution of water difference for i,j, clamped to the available water.

Definition at line 36 of file fieldShader.comp.

layout ( std430  ,
binding  = 4 
)

< Read buffer for heights

< Read buffer for terrainHeight

< Read/write buffer for velocity

< Write buffer for heights

Definition at line 7 of file fieldShader.comp.

void main ( void  )

HeightField simulation kernel.

@ Simulation based on height field described by Matthias Müller-Fischer

Definition at line 55 of file fieldShader.comp.

 All Classes Files Functions Variables Enumerations