VR-Forces Developer's Guide
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Classes | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Member Functions
makVrv::DtWaterOnScreen Class Reference

This class provides an OSG-specific implementation of water drops on the screen.

Inheritance diagram for makVrv::DtWaterOnScreen:
Inheritance graph
[legend]

Classes

struct  GridCell
 

Public Member Functions

 DtWaterOnScreen (DtDe &de, const std::string &postProcessType, bool handles2D)
 
virtual ~DtWaterOnScreen ()
 
virtual void activateRaindrops (bool on)
 
virtual void activateSplashes (bool on)
 
virtual void activateSpray (bool on)
 
virtual void setIsUnderwater (bool underwater)
 
virtual void addRainDrop (float x, float y, float radius)
 
virtual void addOceanSplash (float intensity)
 
virtual void setSplashIntensity (float intensity)
 
virtual void setSprayIntensity (float intensity)
 
virtual bool update (DtChannel *channel)
 
virtual int numActiveDrops () const
 
virtual void setWaterOnScreenSize (double size)
 
virtual void addSplashEffects (const DtObserverObject *observer, bool hasWaveSplashEffect)
 
virtual void addSprayEffects (const DtObserverObject *observer, bool hasOceanSprayEffect)
 
virtual bool prepForDrawableRender ()
 
- Public Member Functions inherited from makVrv::DtPostProcessor
 DtPostProcessor (DtDe &de, const std::string &postProcessType, bool handles2D)
 
virtual ~DtPostProcessor ()
 
virtual void setFragmentShaderSource (const char *source)
 
virtual void setVertexShaderSource (const char *source)
 
virtual void setFragmentShaderFile (const std::string &fileName)
 
virtual void setVertexShaderFile (const std::string &fileName)
 
virtual void setInputTexture (const DtChannel *channel, osg::Texture *texture)
 
virtual osg::Texture * outputTexture ()
 
virtual void setIsFinalEffect (const DtChannel *channel, bool final)
 
virtual osg::Camera * cameraForChannel (const DtChannel *channel)
 
virtual void slot_releaseResources ()
 
virtual bool hasEffect (const std::string &effect)
 
virtual bool effectEnabled (const std::string &effect)
 
virtual bool anyEffectEnabled ()
 
virtual std::list< std::string > supportedEffects ()
 
virtual bool handles2D () const
 
virtual const std::string & type () const
 
virtual bool postProcessorEnabled ()
 
virtual bool needsOcclusionTexture () const
 
virtual bool enableEffect (const std::string &effect)
 
virtual bool disableEffect (const std::string &effect)
 
virtual void enablePostProcessor ()
 
virtual void disablePostProcessor ()
 

Static Public Member Functions

static double waterOnScreenSize ()
 

Static Public Attributes

static double theWaterOnScreenSize
 

Protected Member Functions

virtual void initialize ()
 
virtual void clearNormalMap ()
 
virtual void updateDrops (double elapsedTime)
 
virtual bool drawDrops ()
 
virtual bool finalizeNormalMap ()
 
virtual void addRaindrops (double time, float heading, float observerVelocity, const DtVector &observerLocation)
 
virtual void addSpray (double time, float heading)
 
virtual void clearDrops ()
 
virtual void reset ()
 
virtual void setActiveStatus ()
 
virtual void slot_waterOnScreenSizeChanged (double value)
 
virtual void slot_reloadShaders ()
 
virtual void releaseGLObjects () override
 
virtual void cleanupGpuMemory (void)
 
virtual void createNormalMapIfNecessary (void)
 
virtual void createNormalMapCombineProgramIfNecessary (void)
 
virtual void createNormalMapFinalizeProgramIfNecessary (void)
 
virtual void initZeroNormals (void)
 
- Protected Member Functions inherited from makVrv::DtPostProcessor
virtual bool effectItrEnabled (const EffectMap::iterator &effect) const
 
virtual void addEffect (std::string effect)
 
virtual void setEnablePostProcessor (bool enabled)
 

Protected Attributes

double myLastUpdateTime
 
double myLastDropEmissionTime
 
double myLastSprayEmissionTime
 
bool myRaindropsActiveFlag
 
bool mySplashesActiveFlag
 
bool mySprayActiveFlag
 
bool myActiveFlag
 
bool myUnderwaterFlag
 
float mySplashIntensity
 
float mySprayIntensity
 
int myNumActiveDrops
 
DtGridCell myGrid [GRID_DIMENSION][GRID_DIMENSION]
 
DtGlProgrammyNormalMapCombineProgram
 
bool myNormalMapCombineProgramTriedOnce
 
DtGlProgrammyNormalMapFinalizeProgram
 
bool myNormalMapFinalizeProgramTriedOnce
 
DtGlTexturemyNormalMap
 
DtGlBuffermyNormalMapBuffer
 
DtGlBuffermyPrecomputedDropletNormalsBuffer
 
bool myPrecomputedDropletNormalsBufferDirty
 
DtGlBuffermyPrecomputedSplashNormalsBuffer
 
bool myPrecomputedSplashNormalsBufferDirty
 
GridCell myGridCells [GRID_DIMENSION][GRID_DIMENSION]
 
DtGlBuffermyCellsBuffer
 
DtVector4< unsigned intmyZeroNormals [TEXSIZE][TEXSIZE]
 
osg::ref_ptr
< DtWaterOnScreenDrawable
myWaterOnScreenDrawable
 
bool myDropsStagingDirty
 
bool myNormalMapDirty
 
- Protected Attributes inherited from makVrv::DtPostProcessor
osg::ref_ptr< osg::Texture > myOutputTexture
 
osg::ref_ptr< osg::Texture > myInputTexture
 
osg::ref_ptr< osg::Program > myProgram
 
osg::ref_ptr< osg::Shader > myFragmentShader
 
osg::ref_ptr< osg::Shader > myVertexShader
 
osg::ref_ptr< osg::Geode > myQuad
 
CameraMap myCameraMap
 
bool myHandles2DFlag
 
bool myEnabledFlag
 
std::string myType
 
EffectMap myEffects
 
CallbackMap myCullCallbackMap
 
DtDemyDe
 
DtSignalConnectionManager mySignals
 

Private Member Functions

 DtWaterOnScreen ()=delete
 
 DtWaterOnScreen (const DtWaterOnScreen &)=delete
 
DtWaterOnScreenoperator= (const DtWaterOnScreen &)=delete
 

Additional Inherited Members

- Protected Types inherited from makVrv::DtPostProcessor
typedef boost::unordered_map
< std::string, bool
EffectMap
 
typedef std::map< const
DtChannel *, osg::ref_ptr
< osg::Camera > > 
CameraMap
 
typedef osg::ref_ptr
< DtPostProcessorCullVistorCallback
CallbackRefPtr
 
typedef std::map< const
DtChannel *, CallbackRefPtr
CallbackMap
 

Constructor & Destructor Documentation

makVrv::DtWaterOnScreen::DtWaterOnScreen ( DtDe de,
const std::string &  postProcessType,
bool  handles2D 
)

Constructor.

virtual makVrv::DtWaterOnScreen::~DtWaterOnScreen ( )
virtual

Destructor.

makVrv::DtWaterOnScreen::DtWaterOnScreen ( )
privatedelete

private default constructor. not allowed.

makVrv::DtWaterOnScreen::DtWaterOnScreen ( const DtWaterOnScreen )
privatedelete

prevent copy-construction

Member Function Documentation

DtWaterOnScreen& makVrv::DtWaterOnScreen::operator= ( const DtWaterOnScreen )
privatedelete

prevent assignment

virtual void makVrv::DtWaterOnScreen::activateRaindrops ( bool  on)
virtual

Activates or deactivates the raindrops-on-screen effect.

virtual void makVrv::DtWaterOnScreen::activateSplashes ( bool  on)
virtual

Activates or deactivates the splashes on screen effect. (From a submerging observer.)

virtual void makVrv::DtWaterOnScreen::activateSpray ( bool  on)
virtual

Activates or deactivates ocean spray on screen effect.

virtual void makVrv::DtWaterOnScreen::setIsUnderwater ( bool  underwater)
virtual

Tells effect we are underwater, and no screen effects should exist.

virtual void makVrv::DtWaterOnScreen::addRainDrop ( float  x,
float  y,
float  radius 
)
virtual

Add a single raindrop. All parameters are normalized against the viewport dimensions (0-1)

virtual void makVrv::DtWaterOnScreen::addOceanSplash ( float  intensity)
virtual

Adds one frame's worth of large splashes on the screen, in response to a submerging or surfacing viewpoint.

virtual void makVrv::DtWaterOnScreen::setSplashIntensity ( float  intensity)
virtual

Sets the overall intensity of the splash effect (0-1)

virtual void makVrv::DtWaterOnScreen::setSprayIntensity ( float  intensity)
virtual

Sets the overall intensity of the spray effect (0-1)

virtual bool makVrv::DtWaterOnScreen::update ( DtChannel channel)
virtual

Called once per frame from the DtPostProcessManager.

Implements makVrv::DtPostProcessor.

virtual int makVrv::DtWaterOnScreen::numActiveDrops ( ) const
virtual

How many drops are currently on the screen.

virtual void makVrv::DtWaterOnScreen::setWaterOnScreenSize ( double  size)
virtual

Set the size of the water on screen effect(Rain Splash / Ocean Spray / Wave Splash) in percentage, default is 100(%)

virtual void makVrv::DtWaterOnScreen::addSplashEffects ( const DtObserverObject observer,
bool  hasWaveSplashEffect 
)
virtual

Query the DtOsgSkyObject, DtTritonManager, and channel observer to determine whether to draw screen space ocean splash effects.

virtual void makVrv::DtWaterOnScreen::addSprayEffects ( const DtObserverObject observer,
bool  hasOceanSprayEffect 
)
virtual

Query the DtOsgSkyObject, DtTritonManager, and channel observer to determine whether to draw screen space ocean spray effects (when near the surface of the ocean)

virtual bool makVrv::DtWaterOnScreen::prepForDrawableRender ( )
virtual

If required, transfers the staging buffers to the GPU, runs compute shaders, updates prepped items for the drawable. returns true if successful.

static double makVrv::DtWaterOnScreen::waterOnScreenSize ( )
static

Get the size of the water on screen effect(Rain Splash / Ocean Spray / Wave Splash) in percentage, default is 100(%)

virtual void makVrv::DtWaterOnScreen::initialize ( )
protectedvirtual

initialize

Reimplemented from makVrv::DtPostProcessor.

virtual void makVrv::DtWaterOnScreen::clearNormalMap ( )
protectedvirtual

clear the normal map to 0

virtual void makVrv::DtWaterOnScreen::updateDrops ( double  elapsedTime)
protectedvirtual

generate drops in the staging bufffer

virtual bool makVrv::DtWaterOnScreen::drawDrops ( )
protectedvirtual

generate the normal map by drawing all the active drops into it returns true if successful

virtual bool makVrv::DtWaterOnScreen::finalizeNormalMap ( )
protectedvirtual

finalize the normal map (make a rgb float texture from the int normal map) returns true if successful

virtual void makVrv::DtWaterOnScreen::addRaindrops ( double  time,
float  heading,
float  observerVelocity,
const DtVector &  observerLocation 
)
protectedvirtual

add a rain drop

virtual void makVrv::DtWaterOnScreen::addSpray ( double  time,
float  heading 
)
protectedvirtual

add a spray particle

virtual void makVrv::DtWaterOnScreen::clearDrops ( )
protectedvirtual

clear the drops

virtual void makVrv::DtWaterOnScreen::reset ( )
protectedvirtual

reset

virtual void makVrv::DtWaterOnScreen::setActiveStatus ( )
protectedvirtual

set active

virtual void makVrv::DtWaterOnScreen::slot_waterOnScreenSizeChanged ( double  value)
protectedvirtual

slot for when water on screen size changes

virtual void makVrv::DtWaterOnScreen::slot_reloadShaders ( )
protectedvirtual
virtual void makVrv::DtWaterOnScreen::releaseGLObjects ( )
overrideprotectedvirtual

cleanup graphics related objects

Reimplemented from makVrv::DtPostProcessor.

virtual void makVrv::DtWaterOnScreen::cleanupGpuMemory ( void  )
protectedvirtual

clean the gpu memory

virtual void makVrv::DtWaterOnScreen::createNormalMapIfNecessary ( void  )
protectedvirtual

create normal and initialize, if not already

virtual void makVrv::DtWaterOnScreen::createNormalMapCombineProgramIfNecessary ( void  )
protectedvirtual

create normal combine program and initialize, if not already

virtual void makVrv::DtWaterOnScreen::createNormalMapFinalizeProgramIfNecessary ( void  )
protectedvirtual

create normal finalize program and initialize, if not already

virtual void makVrv::DtWaterOnScreen::initZeroNormals ( void  )
protectedvirtual

init the vector of zero normals that are used to clear out the normal map

Member Data Documentation

double makVrv::DtWaterOnScreen::myLastUpdateTime
protected
double makVrv::DtWaterOnScreen::myLastDropEmissionTime
protected
double makVrv::DtWaterOnScreen::myLastSprayEmissionTime
protected
bool makVrv::DtWaterOnScreen::myRaindropsActiveFlag
protected
bool makVrv::DtWaterOnScreen::mySplashesActiveFlag
protected
bool makVrv::DtWaterOnScreen::mySprayActiveFlag
protected
bool makVrv::DtWaterOnScreen::myActiveFlag
protected
bool makVrv::DtWaterOnScreen::myUnderwaterFlag
protected
float makVrv::DtWaterOnScreen::mySplashIntensity
protected
float makVrv::DtWaterOnScreen::mySprayIntensity
protected
int makVrv::DtWaterOnScreen::myNumActiveDrops
protected
DtGridCell makVrv::DtWaterOnScreen::myGrid[GRID_DIMENSION][GRID_DIMENSION]
protected
DtGlProgram* makVrv::DtWaterOnScreen::myNormalMapCombineProgram
protected

The various normal map mod programs.

bool makVrv::DtWaterOnScreen::myNormalMapCombineProgramTriedOnce
protected
DtGlProgram* makVrv::DtWaterOnScreen::myNormalMapFinalizeProgram
protected
bool makVrv::DtWaterOnScreen::myNormalMapFinalizeProgramTriedOnce
protected
DtGlTexture* makVrv::DtWaterOnScreen::myNormalMap
protected

The generated normal map texture.

DtGlBuffer* makVrv::DtWaterOnScreen::myNormalMapBuffer
protected

The gpu buffer representing the interim normal map (ssbo)

DtGlBuffer* makVrv::DtWaterOnScreen::myPrecomputedDropletNormalsBuffer
protected

The gpu buffer representing the constant pre-computed droplet normals.

bool makVrv::DtWaterOnScreen::myPrecomputedDropletNormalsBufferDirty
protected
DtGlBuffer* makVrv::DtWaterOnScreen::myPrecomputedSplashNormalsBuffer
protected

The gpu buffer representing the constant pre-computed splash normals.

bool makVrv::DtWaterOnScreen::myPrecomputedSplashNormalsBufferDirty
protected
GridCell makVrv::DtWaterOnScreen::myGridCells[GRID_DIMENSION][GRID_DIMENSION]
protected

The grid cells that end up into the gpu buffer next.

DtGlBuffer* makVrv::DtWaterOnScreen::myCellsBuffer
protected

The cells' buffer on the gpu (ssbo)

DtVector4<unsigned int> makVrv::DtWaterOnScreen::myZeroNormals[TEXSIZE][TEXSIZE]
protected

The zero normals buffer (used to clear the normal map to zero)

osg::ref_ptr<DtWaterOnScreenDrawable> makVrv::DtWaterOnScreen::myWaterOnScreenDrawable
protected
bool makVrv::DtWaterOnScreen::myDropsStagingDirty
protected
bool makVrv::DtWaterOnScreen::myNormalMapDirty
protected
double makVrv::DtWaterOnScreen::theWaterOnScreenSize
static

The documentation for this class was generated from the following file:

Document ID: Generated on Thu Oct 23 22:29:17 EDT 2025 from SVN revision 280951
Copyright © 2005-2024 MAK Technologies. All Rights Reserved (www.mak.com)