This class is used to draw multi-resolution Animated Rivers as described in Qizhi Yu's Thesis [Models of Animated Rivers for the Interactive Exploration of Landscapes - November 2008]. More...
#include <DrawRiversTask.h>
Classes | |
struct | TerrainInfo |
Information about a terrainNode, such as the corresponding particleProducer, elevation cache, display informations etc. More... | |
Public Member Functions | |
DrawRiversTask (ptr< Program > renderTexProg, ptr< Program > particlesProg, ptr< ParticleProducer > particles, float timeStep=1.0f, bool drawParticles=false, ptr< WaveTile > tex=NULL, ptr< WaveTile > bedTex=NULL, float riverDepth=1.0f, float waveSlopeFactor=1.f, bool useOffscreenDepth=false) | |
Creates a new DrawRiversTask. | |
virtual | ~DrawRiversTask () |
Deletes this DrawRiversTask. | |
virtual ptr< Task > | getTask (ptr< Object > context) |
Returns the task(s) to be executed for this object. | |
ptr< ParticleProducer > | getParticles () const |
Returns particles. | |
Protected Member Functions | |
DrawRiversTask () | |
Creates a n uninitialized DrawRiversTask. | |
void | init (ptr< Program > renderTexProg, ptr< Program > particlesProg, ptr< ParticleProducer > particles, float timeStep=1.0f, bool drawParticles=false, ptr< WaveTile > tex=NULL, ptr< WaveTile > bedTex=NULL, float riverDepth=1.0f, float waveSlopeFactor=1.0f, bool useOffscreenDepth=false) |
Initializes this DrawRiversTask. | |
Private Member Functions | |
void | doDrawParticles (ptr< ParticleProducer > pp) |
Draws particles for a given Particle Producer. | |
void | drawRivers () |
Main method called for drawing rivers. | |
Private Attributes | |
ptr< Uniform1f > | drawModeU |
Draw Mode. | |
ptr< Uniform1f > | displayGridU |
Determines if the particle grid is displayed or not. | |
ptr< Uniform1f > | sunEffectsU |
Whether sun effects are enabled or not. | |
ptr< Uniform1f > | waveSlopeFactorU |
Factor for waves' size. | |
ptr< Uniform1f > | riverDepthU |
River's depth. | |
ptr< Uniform1f > | useBedTexU |
True if the user wants to display a bed texture under the river. | |
ptr< Uniform2f > | screenSizeU |
Screen Size. | |
ptr< Uniform2f > | gridSizeU |
Particles grid size. | |
ptr< UniformSampler > | spriteParamTableU |
Table containing the particles parameters. | |
ptr< UniformSampler > | uniformSpriteGridU |
Indirection table for particles. | |
ptr< UniformSampler > | riverTexU |
The pre-rendered texture. | |
ptr< Uniform1f > | particleSizeU |
Displayed Points' size. | |
ptr< Uniform2f > | sizeU |
Displayed Points' size. | |
vector< TerrainInfo > | terrainInfos |
List of terrains used by the particle manager. | |
ptr< ParticleProducer > | particles |
The TerainParticleManager used to create the flow. | |
ptr< Texture2D > | spTable |
Sprites Param table. | |
ptr< Texture2D > | usGrid |
Uniform Sprite Grid. | |
ptr< FrameBuffer > | frameBuffer |
An offscreen FrameBuffer used to create the advected texture when in pre-advected drawing mode. | |
bool | useOffscreenDepth |
Used to determine if we need to copy the Depth Buffer into a local texture so it will be accessible from GLSL context. | |
ptr< Texture2D > | depthBuffer |
A copy of the Depth Buffer, or the Depth Buffer itself if using an offscreen Depth Buffer. | |
ptr< Texture2D > | advectedTex |
Pre-rendering method resulting texture. | |
SceneManager * | scene |
The SceneManager on which we want to draw rivers. | |
ParticleGrid * | particleGrid |
The ParticleGrid used to store and copy particles to GPU. | |
ptr< LifeCycleParticleLayer > | lifeCycleLayer |
The ParticleLayer that handles particles life cycle data. | |
ptr< ScreenParticleLayer > | screenLayer |
The ParticleLayer that handles particles screen coordinates. | |
ptr< TerrainParticleLayer > | terrainLayer |
The ParticleLayer that handles particles local coordinates. | |
float | timeStep |
Time step at each frame. | |
bool | drawParticles |
Determines whether we draw the particles or not. | |
bool | drawVelocities |
Determines whether we draw the particles velocitiesor not. | |
bool | drawGrid |
Determines if we display the grid or not. | |
bool | sunEffects |
Determines whether we draw sun effects (reflectance. | |
MeshDisplayType | drawMesh |
Determines the way we display the mesh. | |
ptr< Program > | renderTexProg |
The GLSL Program used to draw pre-rendering texture. | |
ptr< Program > | particlesProg |
The GLSL Program used to draw the particles. | |
ptr< WaveTile > | riverTex |
Texture used to render the river. | |
ptr< WaveTile > | bedTex |
Texture used to render the river bed. | |
ptr< Mesh< vec3f, unsigned int > > | mesh |
Mesh used to draw the particles. | |
ptr< Mesh< vecParticle, unsigned int > > | particleMesh |
Mesh used to draw the particles. | |
bool | initialized |
Determines whether we need to recover the list of terrains associated to this Task. | |
float | riverDepth |
River's depth. | |
float | waveSlopeFactor |
Factor for waves' size. |
This class is used to draw multi-resolution Animated Rivers as described in Qizhi Yu's Thesis [Models of Animated Rivers for the Interactive Exploration of Landscapes - November 2008].
See http://www-evasion.imag.fr/Membres/Qizhi.Yu/phd/ for more details about this work. It represents Rivers on 3 different scales :
Known bugs:
proland::DrawRiversTask::DrawRiversTask | ( | ptr< Program > | renderTexProg, | |
ptr< Program > | particlesProg, | |||
ptr< ParticleProducer > | particles, | |||
float | timeStep = 1.0f , |
|||
bool | drawParticles = false , |
|||
ptr< WaveTile > | tex = NULL , |
|||
ptr< WaveTile > | bedTex = NULL , |
|||
float | riverDepth = 1.0f , |
|||
float | waveSlopeFactor = 1.f , |
|||
bool | useOffscreenDepth = false | |||
) |
Creates a new DrawRiversTask.
renderTexProg | the GLSL Program used to draw the pre-rendering texture. | |
particlesProg | the GLSL Program used to draw the particles. | |
particles | the TerrainParticleManager used to create the flow. | |
timeStep | time step at each frame. Changes the speed of the river. | |
drawParticles | determines whether we draw the particles or not. Particles are drawn as colored dots. | |
tex | the texture used to advect normals. | |
bedTex | the texture used to draw the river bed. | |
riverDepth | river's depth. | |
waveSlopeFactor | factor for waves' size. | |
useOffscreenDepth | used to determine if we need to copy the DepthBuffer. |
virtual proland::DrawRiversTask::~DrawRiversTask | ( | ) | [virtual] |
Deletes this DrawRiversTask.
proland::DrawRiversTask::DrawRiversTask | ( | ) | [protected] |
Creates a n uninitialized DrawRiversTask.
void proland::DrawRiversTask::doDrawParticles | ( | ptr< ParticleProducer > | pp | ) | [private] |
Draws particles for a given Particle Producer.
pp | the particle producer to draw. |
void proland::DrawRiversTask::drawRivers | ( | ) | [private] |
Main method called for drawing rivers.
Calls the TerrainParticleManager::timeStep() method to update PM. Updates sprites & sprites parameters tables. Draws Particles if required, and finally draws 3D animated Rivers.
ptr<ParticleProducer> proland::DrawRiversTask::getParticles | ( | ) | const |
Returns particles.
virtual ptr<Task> proland::DrawRiversTask::getTask | ( | ptr< Object > | context | ) | [virtual] |
Returns the task(s) to be executed for this object.
It checks which tiles ParticleProducer needs to produce, depending on the current view, and puts it in the returned TaskGraph. The corresponding TerainParticleManagers will be produced before the run() method call.
context | see Method. |
void proland::DrawRiversTask::init | ( | ptr< Program > | renderTexProg, | |
ptr< Program > | particlesProg, | |||
ptr< ParticleProducer > | particles, | |||
float | timeStep = 1.0f , |
|||
bool | drawParticles = false , |
|||
ptr< WaveTile > | tex = NULL , |
|||
ptr< WaveTile > | bedTex = NULL , |
|||
float | riverDepth = 1.0f , |
|||
float | waveSlopeFactor = 1.0f , |
|||
bool | useOffscreenDepth = false | |||
) | [protected] |
Initializes this DrawRiversTask.
See DrawRiversTask.
ptr<Texture2D> proland::DrawRiversTask::advectedTex [private] |
Pre-rendering method resulting texture.
ptr<WaveTile> proland::DrawRiversTask::bedTex [private] |
Texture used to render the river bed.
See Q. Yu's paper for its requirement's.
ptr<Texture2D> proland::DrawRiversTask::depthBuffer [private] |
A copy of the Depth Buffer, or the Depth Buffer itself if using an offscreen Depth Buffer.
ptr<Uniform1f> proland::DrawRiversTask::displayGridU [private] |
Determines if the particle grid is displayed or not.
bool proland::DrawRiversTask::drawGrid [private] |
Determines if we display the grid or not.
MeshDisplayType proland::DrawRiversTask::drawMesh [private] |
Determines the way we display the mesh.
ptr<Uniform1f> proland::DrawRiversTask::drawModeU [private] |
Draw Mode.
Determines what will be drawn in the shader. Depends on MESH_DISPLAY_TYPE and drawParticles and drawVelocities.
bool proland::DrawRiversTask::drawParticles [private] |
Determines whether we draw the particles or not.
Particles are drawn as colored dots.
bool proland::DrawRiversTask::drawVelocities [private] |
Determines whether we draw the particles velocitiesor not.
ptr<FrameBuffer> proland::DrawRiversTask::frameBuffer [private] |
An offscreen FrameBuffer used to create the advected texture when in pre-advected drawing mode.
ptr<Uniform2f> proland::DrawRiversTask::gridSizeU [private] |
Particles grid size.
bool proland::DrawRiversTask::initialized [private] |
Determines whether we need to recover the list of terrains associated to this Task.
ptr<LifeCycleParticleLayer> proland::DrawRiversTask::lifeCycleLayer [private] |
The ParticleLayer that handles particles life cycle data.
ptr<Mesh<vec3f, unsigned int> > proland::DrawRiversTask::mesh [private] |
Mesh used to draw the particles.
ParticleGrid* proland::DrawRiversTask::particleGrid [private] |
The ParticleGrid used to store and copy particles to GPU.
ptr<Mesh<vecParticle, unsigned int> > proland::DrawRiversTask::particleMesh [private] |
Mesh used to draw the particles.
ptr<ParticleProducer> proland::DrawRiversTask::particles [private] |
The TerainParticleManager used to create the flow.
ptr<Uniform1f> proland::DrawRiversTask::particleSizeU [private] |
Displayed Points' size.
ptr<Program> proland::DrawRiversTask::particlesProg [private] |
The GLSL Program used to draw the particles.
ptr<Program> proland::DrawRiversTask::renderTexProg [private] |
The GLSL Program used to draw pre-rendering texture.
float proland::DrawRiversTask::riverDepth [private] |
River's depth.
ptr<Uniform1f> proland::DrawRiversTask::riverDepthU [private] |
River's depth.
ptr<WaveTile> proland::DrawRiversTask::riverTex [private] |
Texture used to render the river.
See Q. Yu's paper for its requirement's.
ptr<UniformSampler> proland::DrawRiversTask::riverTexU [private] |
The pre-rendered texture.
SceneManager* proland::DrawRiversTask::scene [private] |
The SceneManager on which we want to draw rivers.
ptr<ScreenParticleLayer> proland::DrawRiversTask::screenLayer [private] |
The ParticleLayer that handles particles screen coordinates.
ptr<Uniform2f> proland::DrawRiversTask::screenSizeU [private] |
Screen Size.
ptr<Uniform2f> proland::DrawRiversTask::sizeU [private] |
Displayed Points' size.
ptr<UniformSampler> proland::DrawRiversTask::spriteParamTableU [private] |
Table containing the particles parameters.
ptr<Texture2D> proland::DrawRiversTask::spTable [private] |
Sprites Param table.
bool proland::DrawRiversTask::sunEffects [private] |
Determines whether we draw sun effects (reflectance.
..).
ptr<Uniform1f> proland::DrawRiversTask::sunEffectsU [private] |
Whether sun effects are enabled or not.
vector<TerrainInfo> proland::DrawRiversTask::terrainInfos [private] |
List of terrains used by the particle manager.
ptr<TerrainParticleLayer> proland::DrawRiversTask::terrainLayer [private] |
The ParticleLayer that handles particles local coordinates.
float proland::DrawRiversTask::timeStep [private] |
Time step at each frame.
Changes the speed of the river.
ptr<UniformSampler> proland::DrawRiversTask::uniformSpriteGridU [private] |
Indirection table for particles.
ptr<Uniform1f> proland::DrawRiversTask::useBedTexU [private] |
True if the user wants to display a bed texture under the river.
bool proland::DrawRiversTask::useOffscreenDepth [private] |
Used to determine if we need to copy the Depth Buffer into a local texture so it will be accessible from GLSL context.
ptr<Texture2D> proland::DrawRiversTask::usGrid [private] |
Uniform Sprite Grid.
float proland::DrawRiversTask::waveSlopeFactor [private] |
Factor for waves' size.
ptr<Uniform1f> proland::DrawRiversTask::waveSlopeFactorU [private] |
Factor for waves' size.