OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
BounceOperator.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 // Written by Wang Rui, (C) 2010
14 
15 #ifndef OSGPARTICLE_BOUNCEOPERATOR
16 #define OSGPARTICLE_BOUNCEOPERATOR
17 
18 #include <osgParticle/Particle>
19 #include <osgParticle/DomainOperator>
20 
21 namespace osgParticle
22 {
23 
24 
29 {
30 public:
32  : DomainOperator(), _friction(1.0f), _resilience(0.0f), _cutoff(0.0f)
33  {}
34 
36  : DomainOperator(copy, copyop),
37  _friction(copy._friction), _resilience(copy._resilience), _cutoff(copy._cutoff)
38  {}
39 
41 
43  void setFriction( float f ) { _friction = f; }
44 
46  float getFriction() const { return _friction; }
47 
49  void setResilience( float r ) { _resilience = r; }
50 
52  float getResilience() const { return _resilience; }
53 
55  void setCutoff( float v ) { _cutoff = v; }
56 
58  float getCutoff() const { return _cutoff; }
59 
60 protected:
61  virtual ~BounceOperator() {}
62  BounceOperator& operator=( const BounceOperator& ) { return *this; }
63 
64  virtual void handleTriangle( const Domain& domain, Particle* P, double dt );
65  virtual void handleRectangle( const Domain& domain, Particle* P, double dt );
66  virtual void handlePlane( const Domain& domain, Particle* P, double dt );
67  virtual void handleSphere( const Domain& domain, Particle* P, double dt );
68  virtual void handleDisk( const Domain& domain, Particle* P, double dt );
69 
70  float _friction;
71  float _resilience;
72  float _cutoff;
73 };
74 
75 
76 }
77 
78 #endif
void setResilience(float r)
Set the resilience.
float getCutoff() const
Get the velocity cutoff factor.
void setFriction(float f)
Set the friction.
float getFriction() const
Get the friction.
#define OSGPARTICLE_EXPORT
Definition: Export.h:40
BounceOperator(const BounceOperator &copy, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
#define META_Object(library, name)
Definition: Object.h:42
void setCutoff(float v)
Set the velocity cutoff factor.
float getResilience() const
Get the velocity cutoff factor.
BounceOperator & operator=(const BounceOperator &)