VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions
makVrv::DtDropParticle Class Referenceabstract

Local class for a single drop particle on the screen. More...

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

Public Member Functions

 DtDropParticle (float px, float py, float pMass, double time, DtGridCell grid[][GRID_DIMENSION])
 constructor More...
 
virtual ~DtDropParticle ()
 destructor More...
 
virtual void setParent (DtDropParticle *drop)
 If this drop was left behind from wetting from another drop, keep track of the parent drop. More...
 
virtual DtDropParticleparent () const
 
virtual float mass () const
 set/get the mass More...
 
virtual void setMass (float m)
 
virtual const osg::Vec2f & velocity () const
 get the velocity More...
 
virtual void affectedCells (std::vector< osg::Vec2s > &cells) const
 Gets all screen grid cells covered by this drop. More...
 
virtual void computeRadius (double waterOnScreenSize)
 compute radius More...
 
virtual void update (double time, double elapsedTime, DtGridCell grid[][GRID_DIMENSION], bool &destroyFlag)=0
 Update the particle. More...
 
virtual void gridPosition (int &gx, int &gy) const
 get the grid position More...
 
virtual void renderToNormalMap (osg::Image *image)
 Draw the droplet into the normal map for postprocessing. More...
 
virtual bool mergeable () const
 can this be merged with another particle? More...
 
virtual unsigned int precomputedDropletTexel (float x, float y)
 

Static Public Member Functions

static void precomputeDroplet ()
 Precompute a normal map for a drop. More...
 

Protected Attributes

float myX
 
float myY
 
float myRadius
 
float myMass
 
float myV0
 
double myT0
 
float myAcceleration
 
DtDropParticlemyParent
 
osg::Vec2f myDirection
 
osg::Vec2f myVelocity
 
int myLastGridX
 
int myLastGridY
 
bool myMergeable
 

Static Protected Attributes

static unsigned int myPrecomputedDroplet [PRECOMPUTED_DIM][PRECOMPUTED_DIM]
 
static bool myDropletInitialized
 

Private Member Functions

 DtDropParticle ()
 private default constructor. not allowed. More...
 
 DtDropParticle (const DtDropParticle &)
 prevent copy-construction More...
 
DtDropParticleoperator= (const DtDropParticle &)
 prevent assignment More...
 

Detailed Description

Local class for a single drop particle on the screen.

Constructor & Destructor Documentation

makVrv::DtDropParticle::DtDropParticle ( float  px,
float  py,
float  pMass,
double  time,
DtGridCell  grid[][GRID_DIMENSION] 
)

constructor

virtual makVrv::DtDropParticle::~DtDropParticle ( )
virtual

destructor

makVrv::DtDropParticle::DtDropParticle ( )
private

private default constructor. not allowed.

makVrv::DtDropParticle::DtDropParticle ( const DtDropParticle )
private

prevent copy-construction

Member Function Documentation

DtDropParticle& makVrv::DtDropParticle::operator= ( const DtDropParticle )
private

prevent assignment

virtual void makVrv::DtDropParticle::setParent ( DtDropParticle drop)
virtual

If this drop was left behind from wetting from another drop, keep track of the parent drop.

virtual DtDropParticle* makVrv::DtDropParticle::parent ( ) const
virtual
virtual float makVrv::DtDropParticle::mass ( ) const
virtual

set/get the mass

virtual void makVrv::DtDropParticle::setMass ( float  m)
virtual
virtual const osg::Vec2f& makVrv::DtDropParticle::velocity ( ) const
virtual

get the velocity

virtual void makVrv::DtDropParticle::affectedCells ( std::vector< osg::Vec2s > &  cells) const
virtual

Gets all screen grid cells covered by this drop.

virtual void makVrv::DtDropParticle::computeRadius ( double  waterOnScreenSize)
virtual

compute radius

virtual void makVrv::DtDropParticle::update ( double  time,
double  elapsedTime,
DtGridCell  grid[][GRID_DIMENSION],
bool destroyFlag 
)
pure virtual

Update the particle.

Implemented in makVrv::DtSplashParticle, and makVrv::DtRaindropParticle.

virtual void makVrv::DtDropParticle::gridPosition ( int gx,
int gy 
) const
virtual

get the grid position

virtual void makVrv::DtDropParticle::renderToNormalMap ( osg::Image *  image)
virtual

Draw the droplet into the normal map for postprocessing.

This is where most of the time is spent. If further optimization is needed, we could only redraw drops that have moved instead of drawing every drop every frame. Or, we could render the drops using hardware and render to texture. Note this is a lot faster in release builds.

Reimplemented in makVrv::DtSplashParticle.

virtual bool makVrv::DtDropParticle::mergeable ( ) const
virtual

can this be merged with another particle?

virtual unsigned int makVrv::DtDropParticle::precomputedDropletTexel ( float  x,
float  y 
)
virtual
static void makVrv::DtDropParticle::precomputeDroplet ( )
static

Precompute a normal map for a drop.

Member Data Documentation

unsigned int makVrv::DtDropParticle::myPrecomputedDroplet[PRECOMPUTED_DIM][PRECOMPUTED_DIM]
staticprotected
bool makVrv::DtDropParticle::myDropletInitialized
staticprotected
float makVrv::DtDropParticle::myX
protected
float makVrv::DtDropParticle::myY
protected
float makVrv::DtDropParticle::myRadius
protected
float makVrv::DtDropParticle::myMass
protected
float makVrv::DtDropParticle::myV0
protected
double makVrv::DtDropParticle::myT0
protected
float makVrv::DtDropParticle::myAcceleration
protected
DtDropParticle* makVrv::DtDropParticle::myParent
protected
osg::Vec2f makVrv::DtDropParticle::myDirection
protected
osg::Vec2f makVrv::DtDropParticle::myVelocity
protected
int makVrv::DtDropParticle::myLastGridX
protected
int makVrv::DtDropParticle::myLastGridY
protected
bool makVrv::DtDropParticle::myMergeable
protected

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

Document ID: Generated on Thu Aug 27 10:56:05 EDT 2020 from SVN revision 217100
Copyright © 2005-2020 MAK Technologies. All Rights Reserved (www.mak.com)