From 9e5d905b0500b6ca3a00f2f420b3fea2657928ea Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 4 Apr 2005 20:25:57 +0000 Subject: [PATCH] Renamed _A and _B to make them more meanigful --- include/osgParticle/FluidProgram | 16 ++++++++-------- src/osgParticle/FluidProgram.cpp | 10 +++++----- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/osgParticle/FluidProgram b/include/osgParticle/FluidProgram index 6ffc75244..9a65f88b0 100644 --- a/include/osgParticle/FluidProgram +++ b/include/osgParticle/FluidProgram @@ -41,7 +41,7 @@ namespace osgParticle inline void setFluidViscosity(float v) { _viscosity = v; - _A = 6 * osg::PI * _viscosity; + _viscosityCoefficient = 6 * osg::PI * _viscosity; } /// Get the viscosity of the fluid. @@ -51,7 +51,7 @@ namespace osgParticle inline void setFluidDensity(float d) { _density = d; - _B = 0.2f * osg::PI * _density; + _densityCoefficeint = 0.2f * osg::PI * _density; } /// Get the density of the fluid. @@ -65,15 +65,15 @@ namespace osgParticle inline const osg::Vec3& getWind() const { return _wind; } /// Set the acceleration vector. - inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; } + inline void setAcceleration(const osg::Vec3& v) { _viscosityCoefficientcceleration = v; } /// Get the acceleration vector. - inline const osg::Vec3& getAcceleration() const { return _acceleration; } + inline const osg::Vec3& getAcceleration() const { return _viscosityCoefficientcceleration; } /** Set the acceleration vector to the gravity on earth (0, 0, -9.81). The acceleration will be multiplied by the scale parameter. */ - inline void setToGravity(float scale = 1.0f) { _acceleration.set(0, 0, -9.81f*scale); } + inline void setToGravity(float scale = 1.0f) { _viscosityCoefficientcceleration.set(0, 0, -9.81f*scale); } /// Set the fluid parameters as for air (20°C temperature). inline void setFluidToAir() @@ -99,13 +99,13 @@ namespace osgParticle virtual void execute(double dt); - osg::Vec3 _acceleration; + osg::Vec3 _viscosityCoefficientcceleration; float _viscosity; float _density; osg::Vec3 _wind; - float _A; - float _B; + float _viscosityCoefficient; + float _densityCoefficeint; }; diff --git a/src/osgParticle/FluidProgram.cpp b/src/osgParticle/FluidProgram.cpp index 54887e9b7..5fabb9ebd 100644 --- a/src/osgParticle/FluidProgram.cpp +++ b/src/osgParticle/FluidProgram.cpp @@ -8,12 +8,12 @@ osgParticle::FluidProgram::FluidProgram(): osgParticle::FluidProgram::FluidProgram(const FluidProgram& copy, const osg::CopyOp& copyop): Program(copy, copyop), - _acceleration(copy._acceleration), + _viscosityCoefficientcceleration(copy._viscosityCoefficientcceleration), _viscosity(copy._viscosity), _density(copy._density), _wind(copy._wind), - _A(copy._A), - _B(copy._B) + _viscosityCoefficient(copy._viscosityCoefficient), + _densityCoefficeint(copy._densityCoefficeint) { } @@ -32,11 +32,11 @@ void osgParticle::FluidProgram::execute(double dt) float Volume = Area*radius*four_over_three; // compute force due to gravity + boyancy of displacing the fluid that the particle is emersed in. - osg::Vec3 force = _acceleration * (particle->getMass() - _density*Volume); + osg::Vec3 force = _viscosityCoefficientcceleration * (particle->getMass() - _density*Volume); // compute force due to friction osg::Vec3 relative_wind = particle->getVelocity()-_wind; - force -= relative_wind * Area * (_A + _B*relative_wind.length()); + force -= relative_wind * Area * (_viscosityCoefficient + _densityCoefficeint*relative_wind.length()); // divide force by mass to get acceleration. force *= particle->getMassInv()*dt;