VR-Forces 4.8 Class Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DtDropParticle.h
Go to the documentation of this file.
1 /*****************************************************************************
2 * Copyright (c) 2020 MAK Technologies, Inc.
3 * All rights reserved.
4 *****************************************************************************/
5 
6 #pragma once
7 
11 
15 
16 #include <osg/Vec2f>
17 #include <osg/Vec2s>
18 
19 #include <vector>
20 
21 namespace osg
22 {
23  class Image;
24 }
25 
26 namespace makVrv
27 {
30  {
31  public:
33  DtDropParticle(float px, float py, float pMass, double time,
34  DtGridCell grid[][GRID_DIMENSION]);
35 
37  virtual ~DtDropParticle();
38  private:
41 
44 
47  public:
48 
51  virtual void setParent(DtDropParticle *drop);
52  virtual DtDropParticle *parent() const;
53 
55  virtual float mass() const;
56  virtual void setMass(float m);
57 
59  virtual const osg::Vec2f& velocity() const;
60 
62  virtual void affectedCells(std::vector<osg::Vec2s>& cells) const;
63 
65  virtual void computeRadius(double waterOnScreenSize);
66 
68  virtual void update(double time, double elapsedTime,
69  DtGridCell grid[][GRID_DIMENSION],
70  bool& destroyFlag) = 0;
71 
73  virtual void gridPosition(int& gx, int& gy) const;
74 
80  virtual void renderToNormalMap(osg::Image *image);
81 
83  virtual bool mergeable() const;
84 
85  virtual unsigned int precomputedDropletTexel(float x, float y);
86 
88  static void precomputeDroplet();
89  protected:
90 
92  static bool myDropletInitialized;
93 
94  float myX, myY, myRadius, myMass, myV0;
95  double myT0;
98 
99  osg::Vec2f myDirection, myVelocity;
101 
103  };
104 
105 }
double myT0
Definition: DtDropParticle.h:95
virtual void gridPosition(int &gx, int &gy) const
get the grid position
float myX
Definition: DtDropParticle.h:94
virtual const osg::Vec2f & velocity() const
get the velocity
static bool myDropletInitialized
Definition: DtDropParticle.h:92
bool myMergeable
Definition: DtDropParticle.h:102
float myAcceleration
Definition: DtDropParticle.h:96
int myLastGridY
Definition: DtDropParticle.h:100
osg::Vec2f myVelocity
Definition: DtDropParticle.h:99
int myLastGridX
Definition: DtDropParticle.h:100
DtDropParticle()
private default constructor. not allowed.
virtual void renderToNormalMap(osg::Image *image)
Draw the droplet into the normal map for postprocessing.
virtual ~DtDropParticle()
destructor
virtual void update(double time, double elapsedTime, DtGridCell grid[][GRID_DIMENSION], bool &destroyFlag)=0
Update the particle.
float myY
Definition: DtDropParticle.h:94
float myMass
Definition: DtDropParticle.h:94
virtual void computeRadius(double waterOnScreenSize)
compute radius
IMGUI_API void Image(ImTextureID user_texture_id, const ImVec2 &size, const ImVec2 &uv0=ImVec2(0, 0), const ImVec2 &uv1=ImVec2(1, 1), const ImVec4 &tint_col=ImVec4(1, 1, 1, 1), const ImVec4 &border_col=ImVec4(0, 0, 0, 0))
DtDropParticle * myParent
Definition: DtDropParticle.h:97
Internal struct for one cell of our grid of glass properties.
Definition: DtGridCell.h:19
#define GRID_DIMENSION
Definition: DtWaterOnScreenDefines.h:56
Local class for a single drop particle on the screen.
Definition: DtDropParticle.h:29
Contains DLL export macros.
static unsigned int myPrecomputedDroplet[PRECOMPUTED_DIM][PRECOMPUTED_DIM]
Definition: DtDropParticle.h:91
virtual void setMass(float m)
virtual void setParent(DtDropParticle *drop)
If this drop was left behind from wetting from another drop, keep track of the parent drop...
virtual void affectedCells(std::vector< osg::Vec2s > &cells) const
Gets all screen grid cells covered by this drop.
Contains makVrv::DtGridCell struct.
float myV0
Definition: DtDropParticle.h:94
static void precomputeDroplet()
Precompute a normal map for a drop.
virtual unsigned int precomputedDropletTexel(float x, float y)
float myRadius
Definition: DtDropParticle.h:94
DtDropParticle & operator=(const DtDropParticle &)
prevent assignment
#define PRECOMPUTED_DIM
Definition: DtWaterOnScreenDefines.h:42
osg::Vec2f myDirection
Definition: DtDropParticle.h:99
virtual float mass() const
set/get the mass
virtual DtDropParticle * parent() const
virtual bool mergeable() const
can this be merged with another particle?

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)