Thermal erosion on the GPU, on a single layer heightfield.
More...
#include <gputerrainsimu.h>
|
| GPUThermalErosion () |
| Default constructor. Does not call OpenGL because context might not have been initialized yet.
|
|
| ~GPUThermalErosion () |
| Destructor. Destroys the OpenGl buffers and shader program.
|
|
void | Init (const HeightField &) |
| Init function from a monolayer heightfield. OpenGL buffers are also initialized here.
|
|
void | Init (const ScalarField2 &, const ScalarField2 &) |
| Init function from a bilayer heightfield (bedrock + sediments). OpenGL buffers are also initialized here.
|
|
void | Step (int) |
| Simulate n step of thermal erosion. This function doesn't get any data back on the CPU.
|
|
void | Step (int, const Vector2 &, double) |
| Simulate n step of thermal erosion locally in a circular domain. This function doesn't get any data back on the CPU.
|
|
void | SetUniforms (float eps, float tanThresholdAngle, bool noisifiedAngle, float noiseWavelength) |
| Set the uniforms for the shader.
|
|
void | GetData (ScalarField2 &hf) |
| Reads back newest bedrock from the GPU into an initialized scalarfield.
|
|
void | GetData (ScalarField2 &bedrock, ScalarField2 &sediments) |
| Reads back newest bedrock from the GPU into an initialized scalarfield.
|
|
GLuint | GetData () const |
| Get the latest sediment elevation data buffer with no transfer back on the CPU. For monolayer heightfield, the buffer contains the full height.
|
|
double | GetLastStepElevationDifference () |
| Computes the difference of elevation for the last simulation step. Useful for knowing if the simulation has reached steady-state.
|
|
|
GLShader | simulationShader |
| Compute shader.
|
|
GLBuffer | bedrockBuffer |
| Bedrock elevation buffer.
|
|
GLBuffer | sedimentBuffer |
| Sediment elevation buffer.
|
|
GLBuffer | outSedimentBuffer |
| Output sediment elevation buffer.
|
|
int | totalBufferSize |
| Total buffer size defined as nx * ny.
|
|
int | dispatchSize |
| Single dispatch size.
|
|
std::vector< float > | tmpData |
| Temporary array for retreiving GPU data.
|
|
Thermal erosion on the GPU, on a single layer heightfield.
◆ SetUniforms()
void GPUThermalErosion::SetUniforms |
( |
float | eps, |
|
|
float | tanThresholdAngle, |
|
|
bool | noisifiedAngle, |
|
|
float | noiseWavelength ) |
Set the uniforms for the shader.
- Parameters
-
eps | quantity to move downhill. Default is 1.0f. |
tanThresholdAngle | tangent of the threshold angle of the material. Default is 0.57 (~30°). |
noisifiedAngle | flag for procedural threshold angle from a 3D noise distribution. |
noiseWavelength | wavelength of the 3D noise. Default is 0.00023. |
◆ Step() [1/2]
void GPUThermalErosion::Step |
( |
int | n | ) |
|
Simulate n step of thermal erosion. This function doesn't get any data back on the CPU.
- Parameters
-
◆ Step() [2/2]
void GPUThermalErosion::Step |
( |
int | n, |
|
|
const Vector2 & | c, |
|
|
double | r ) |
Simulate n step of thermal erosion locally in a circular domain. This function doesn't get any data back on the CPU.
- Parameters
-
n | number of step |
c | center of the domain |
r | radius of the domain |