Changeset 13041 for OpenSceneGraph/trunk/include/osgParticle/FluidProgram
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgParticle/FluidProgram
r7101 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield 2 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 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 5 * (at your option) any later version. The full license is in LICENSE file 6 6 * included with this distribution, and on the openscenegraph.org website. 7 * 7 * 8 8 * This library is distributed in the hope that it will be useful, 9 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 11 * OpenSceneGraph Public License for more details. 12 12 */ … … 27 27 28 28 /** A program class for performing operations on particles using a sequence of <I>operators</I>. 29 To use a <CODE>FluidProgram</CODE> you have to create some <CODE>Operator</CODE> objects and 29 To use a <CODE>FluidProgram</CODE> you have to create some <CODE>Operator</CODE> objects and 30 30 add them to the program. 31 31 All operators will be applied to each particle in the same order they've been added to the program. 32 */ 32 */ 33 33 class OSGPARTICLE_EXPORT FluidProgram: public Program { 34 34 public: 35 35 FluidProgram(); 36 36 FluidProgram(const FluidProgram& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY); 37 37 38 38 META_Node(osgParticle,FluidProgram); 39 39 40 40 /// Set the viscosity of the fluid. 41 41 inline void setFluidViscosity(float v) … … 44 44 _viscosityCoefficient = 6 * osg::PI * _viscosity; 45 45 } 46 46 47 47 /// Get the viscosity of the fluid. 48 48 inline float getFluidViscosity() const { return _viscosity; } … … 57 57 /// Get the density of the fluid. 58 58 inline float getFluidDensity() const { return _density; } 59 60 59 60 61 61 /// Set the wind vector. 62 62 inline void setWind(const osg::Vec3& wind) { _wind = wind; } 63 63 64 64 /// Get the wind vector. 65 65 inline const osg::Vec3& getWind() const { return _wind; } 66 66 67 67 /// Set the acceleration vector. 68 68 inline void setAcceleration(const osg::Vec3& v) { _acceleration = v; } 69 69 70 70 /// Get the acceleration vector. 71 71 inline const osg::Vec3& getAcceleration() const { return _acceleration; } … … 83 83 setFluidViscosity(1.8e-5f); 84 84 } 85 85 86 86 /// Set the fluid parameters as for pure water (20°C temperature). 87 87 inline void setFluidToWater() … … 91 91 setFluidViscosity(1.002e-3f); 92 92 } 93 93 94 94 95 95 protected: … … 97 97 virtual ~FluidProgram() {} 98 98 FluidProgram& operator=(const FluidProgram&) { return *this; } 99 99 100 100 virtual void execute(double dt); 101 101 … … 108 108 float _densityCoefficient; 109 109 }; 110 110 111 111 112 112 }
