- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgParticle/ExplosionOperator
r12367 r13041 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 Robert Osfield 1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2010 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 */ … … 35 35 _inexp(0.0f), _outexp(0.0f) 36 36 {} 37 37 38 38 ExplosionOperator( const ExplosionOperator& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY ) 39 39 : Operator(copy, copyop), _center(copy._center), _radius(copy._radius), … … 41 41 _inexp(copy._inexp), _outexp(copy._outexp) 42 42 {} 43 43 44 44 META_Object( osgParticle, ExplosionOperator ); 45 45 46 46 /// Set the center of shock wave 47 47 void setCenter( const osg::Vec3& c ) { _center = c; } 48 48 49 49 /// Get the center of shock wave 50 50 const osg::Vec3& getCenter() const { return _center; } 51 51 52 52 /// Set the radius of wave peak 53 53 void setRadius( float r ) { _radius = r; } 54 54 55 55 /// Get the radius of wave peak 56 56 float getRadius() const { return _radius; } 57 57 58 58 /// Set the acceleration scale 59 59 void setMagnitude( float mag ) { _magnitude = mag; } 60 60 61 61 /// Get the acceleration scale 62 62 float getMagnitude() const { return _magnitude; } 63 63 64 64 /// Set the acceleration epsilon 65 65 void setEpsilon( float eps ) { _epsilon = eps; } 66 66 67 67 /// Get the acceleration epsilon 68 68 float getEpsilon() const { return _epsilon; } 69 69 70 70 /// Set broadness of the strength of the wave 71 71 void setSigma( float s ) { _sigma = s; } 72 72 73 73 /// Get broadness of the strength of the wave 74 74 float getSigma() const { return _sigma; } 75 75 76 76 /// Apply the acceleration to a particle. Do not call this method manually. 77 77 inline void operate( Particle* P, double dt ); 78 78 79 79 /// Perform some initializations. Do not call this method manually. 80 80 inline void beginOperate( Program* prg ); 81 81 82 82 protected: 83 83 virtual ~ExplosionOperator() {} 84 84 ExplosionOperator& operator=( const ExplosionOperator& ) { return *this; } 85 85 86 86 osg::Vec3 _center; 87 87 osg::Vec3 _xf_center; … … 116 116 _xf_center = _center; 117 117 } 118 118 119 119 float oneOverSigma = (_sigma!=0.0f ? (1.0f / _sigma) : 1.0f); 120 120 _inexp = -0.5f * oneOverSigma * oneOverSigma;
