Changeset 13041 for OpenSceneGraph/trunk/include/osgParticle/RadialShooter
- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/include/osgParticle/RadialShooter
r5328 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 */ … … 43 43 /// Get the range of possible values for <B>theta</B> angle. 44 44 inline const rangef& getThetaRange() const; 45 45 46 46 /// Set the range of possible values for <B>theta</B> angle. 47 47 inline void setThetaRange(const rangef& r); 48 48 49 49 /// Set the range of possible values for <B>theta</B> angle. 50 50 inline void setThetaRange(float r1, float r2); 51 51 52 52 /// Get the range of possible values for <B>phi</B> angle. 53 53 inline const rangef& getPhiRange() const; 54 54 55 55 /// Set the range of possible values for <B>phi</B> angle. 56 56 inline void setPhiRange(const rangef& r); 57 57 58 58 /// Set the range of possible values for <B>phi</B> angle. 59 59 inline void setPhiRange(float r1, float r2); 60 60 61 61 /// Get the range of possible values for initial speed of particles. 62 inline const rangef& getInitialSpeedRange() const; 63 62 inline const rangef& getInitialSpeedRange() const; 63 64 64 /// Set the range of possible values for initial speed of particles. 65 65 inline void setInitialSpeedRange(const rangef& r); 66 66 67 67 /// Set the range of possible values for initial speed of particles. 68 68 inline void setInitialSpeedRange(float r1, float r2); 69 69 70 70 /// Get the range of possible values for initial rotational speed of particles. 71 inline const rangev3& getInitialRotationalSpeedRange() const; 72 71 inline const rangev3& getInitialRotationalSpeedRange() const; 72 73 73 /// Set the range of possible values for initial rotational speed of particles. 74 74 inline void setInitialRotationalSpeedRange(const rangev3& r); 75 75 76 76 /// Set the range of possible values for initial rotational speed of particles. 77 77 inline void setInitialRotationalSpeedRange(const osg::Vec3& r1, const osg::Vec3& r2); … … 94 94 95 95 inline RadialShooter::RadialShooter() 96 : Shooter(), 97 _theta_range(0, 0.5f*osg::PI_4), 98 _phi_range(0, 2*osg::PI), 96 : Shooter(), 97 _theta_range(0, 0.5f*osg::PI_4), 98 _phi_range(0, 2*osg::PI), 99 99 _speed_range(10, 10), 100 100 _rot_speed_range(osg::Vec3(0,0,0), osg::Vec3(0,0,0)) … … 103 103 104 104 inline RadialShooter::RadialShooter(const RadialShooter& copy, const osg::CopyOp& copyop) 105 : Shooter(copy, copyop), 106 _theta_range(copy._theta_range), 107 _phi_range(copy._phi_range), 105 : Shooter(copy, copyop), 106 _theta_range(copy._theta_range), 107 _phi_range(copy._phi_range), 108 108 _speed_range(copy._speed_range), 109 109 _rot_speed_range(copy._rot_speed_range) 110 110 { 111 111 } 112 112 113 113 inline const rangef& RadialShooter::getThetaRange() const 114 114 { … … 181 181 float speed = _speed_range.get_random(); 182 182 osg::Vec3 rot_speed = _rot_speed_range.get_random(); 183 183 184 184 P->setVelocity(osg::Vec3( 185 185 speed * sinf(theta) * cosf(phi), … … 187 187 speed * cosf(theta) 188 188 )); 189 189 190 190 P->setAngularVelocity(rot_speed); 191 191 }
