Heightfield 1.0
|
A heightfield stored on the GPU. More...
#include <gpuheightfield.h>
Public Member Functions | |
GPUHeightField (const HeightField &) | |
Constructor from a heightfield. | |
GPUHeightField (GLuint buffer, const Box2 &, int, int) | |
Constructor from an existing opengl buffer. | |
void | Destroy () |
Release the GPU data. | |
void | GetData (HeightField &) const |
Get the elevation data back on the CPU into a heightfield. | |
GLBuffer | GetInBuffer () const |
Get the input GPU elevation buffer. | |
GLBuffer | GetOutBuffer () const |
Get the output GPU elevation buffer. | |
Protected Attributes | |
GLBuffer | inBuffer = 0 |
Input data. | |
GLBuffer | outBuffer = 0 |
Output data. | |
bool | owner = true |
Boolean for testing if the instance holds GPU data ownership. | |
A heightfield stored on the GPU.
This class is a work in progress. There are several open questions: => Use double, or float ? Most of the time on the GPU we only use float, but sometimes we need precision, or we work on large terrains which require lots of precision. Ideally, this class should allow to switch between single and double precision, but then this means that the simulation shaders should be adapted accordingly. And what happens when we work on double precision for the rendering ? The buffers cannot be shared between the widget and the simulation/analysis.
=> Most of the time we work with multiple layer, which means that we might need a GPULayerField class ? With at least bedrock, sediment, and maybe water as layers.
|
explicit |
Constructor from a heightfield.
hf | Heightfield. |
GPUHeightField::GPUHeightField | ( | GLuint | buffer, |
const Box2 & | box, | ||
int | nx, | ||
int | ny ) |
Constructor from an existing opengl buffer.
Ownership is set to false.
void GPUHeightField::GetData | ( | HeightField & | hf | ) | const |
Get the elevation data back on the CPU into a heightfield.
hf | The heightfield, should be initialized to the correct size. |