Waterflow
Visualize water in terrain
ShallowGPU Class Reference

Handles the shallow water testcase simulation. More...

#include <shallowGPU.h>

List of all members.

Public Member Functions

 ShallowGPU (DataHandler *t, std::vector< Flood_Fill_data * > FFDataIn)
 Constructor for shallowGPU.
void cycleBuffer ()
 change output buffer
void initGPU ()
 Initializes GPU for simulation.
void runSimGPU (GLfloat dt=1.0f/30.0f)
 Runs the simulation one timestep.

Public Attributes

GLuint addProgram
 shader used for simulation
GLuint advectVelocityXProgram
 shader used for simulation
GLuint advectVelocityYProgram
 shader used for simulation
GLuint advectWaterProgram
 shader used for simulation
GLuint shallowBuffers [9]
 Buffers used for passing data between shaders.
GLuint updateHeightProgram
 shader used for simulation
GLuint updateVelocityProgram
 shader used for simulation

Private Member Functions

int clip (int n, int lower, int upper)
 clamps the int value
float clipf (GLfloat n, GLfloat lower, GLfloat upper)
 clamps the float value
void floodFill (float *u, int x, int z, float height)
 Floodfills point x,z to height and saves in heightmap u.
void initFloodFill (float *u)
 Runs the floodfill algorithms.
void Print (GLuint bID, std::string msg, int iter) const
 Prints debug info for buffer at bID.
void PrintHelper (std::string start_end, std::string msg, int iter) const
 helper function for print.
void PrintNumber (float value) const
 helper function for print.

Private Attributes

GLuint bufferOut
 Out buffer to be rendered.
GLuint cycle
 Cycle used for selecting render output.
std::vector< Flood_Fill_data * > flood
 Floodfill data structure.
float * flow
 Array of added flow per iteration.
DataHandlerterr
 Handle to terrain.
GLint texHeight
 height of simulation area
GLint texWidth
 width of simulation area
GLfloat totTime
 Variable for time measurements.

Static Private Attributes

static bool DEBUG = false
 Print debug information (should be static member instead)

Detailed Description

Handles the shallow water testcase simulation.

Definition at line 15 of file shallowGPU.h.


Constructor & Destructor Documentation

ShallowGPU::ShallowGPU ( DataHandler t,
std::vector< Flood_Fill_data * >  FFDataIn 
) [inline]

Constructor for shallowGPU.

Must take handle to terrain and a floodfill data vector

Definition at line 86 of file shallowGPU.h.


Member Function Documentation

int ShallowGPU::clip ( int  n,
int  lower,
int  upper 
) [private]

clamps the int value

Clamps the int value n, between lower and upper.

Definition at line 64 of file shallowGPU.cpp.

GLfloat ShallowGPU::clipf ( GLfloat  n,
GLfloat  lower,
GLfloat  upper 
) [private]

clamps the float value

Clamps the float value n, between lower and upper.

Definition at line 68 of file shallowGPU.cpp.

void ShallowGPU::floodFill ( float *  u,
int  x,
int  z,
float  height 
) [private]

Floodfills point x,z to height and saves in heightmap u.

Data is provided for floodpoints at construction.

Definition at line 25 of file shallowGPU.cpp.

void ShallowGPU::initFloodFill ( float *  u) [private]

Runs the floodfill algorithms.

Data is provided for floodpoints at construction.

Definition at line 244 of file shallowGPU.cpp.

void ShallowGPU::Print ( GLuint  bID,
std::string  msg,
int  iter 
) const [private]

Prints debug info for buffer at bID.

Prints the message and the iteration aswell.

Definition at line 360 of file shallowGPU.cpp.

void ShallowGPU::runSimGPU ( GLfloat  dt = 1.0f/30.0f)

Runs the simulation one timestep.

Definition at line 252 of file shallowGPU.cpp.


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations