 Timestamp:
 03/21/12 18:36:20 (2 years ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

OpenSceneGraph/trunk/include/osgParticle/MultiSegmentPlacer
r11755 r13041 1 /* *c++* OpenSceneGraph  Copyright (C) 19982006 Robert Osfield 1 /* *c++* OpenSceneGraph  Copyright (C) 19982006 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 number of vertices which define the segments. 44 44 inline int numVertices() const; 45 45 46 46 /// Get a vertex. 47 47 inline const osg::Vec3& getVertex(int i) const; 48 48 49 49 /// Set a vertex. 50 50 inline void setVertex(int i, const osg::Vec3& v); 51 51 52 52 /// Set a vertex. 53 53 inline void setVertex(int i, float x, float y, float z); 54 54 55 55 /// Add a vertex. 56 56 inline void addVertex(const osg::Vec3& v); 57 57 58 58 /// Add a vertex. 59 59 inline void addVertex(float x, float y, float z); 60 60 61 61 /// Remove a vertex. 62 62 inline void removeVertex(int i); 63 63 64 64 /// Place a partice. Called automatically by <CODE>ModularEmitter</CODE>, do not call this method manually. 65 65 void place(Particle* P) const; … … 67 67 /// return the length of the multisegment 68 68 inline float volume() const; 69 69 70 70 /// return the control position 71 71 inline osg::Vec3 getControlPosition() const; … … 73 73 protected: 74 74 virtual ~MultiSegmentPlacer() {} 75 MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; } 75 MultiSegmentPlacer& operator=(const MultiSegmentPlacer&) { return *this; } 76 76 77 77 private: 78 78 typedef std::pair<osg::Vec3, float> Vertex_data; 79 79 typedef std::vector<Vertex_data> Vertex_vector; 80 80 81 81 Vertex_vector _vx; 82 82 float _total_length; 83 83 84 84 void recompute_length(); 85 85 }; 86 86 87 87 // INLINE FUNCTIONS 88 88 89 89 90 90 inline int MultiSegmentPlacer::numVertices() const … … 112 112 inline void MultiSegmentPlacer::addVertex(const osg::Vec3& v) 113 113 { 114 float l = 0; 114 float l = 0; 115 115 if (_vx.size() > 0) { 116 116 l = (v  _vx.back().first).length(); 117 } 117 } 118 118 _total_length += l; 119 _vx.push_back(std::make_pair(v, _total_length)); 119 _vx.push_back(std::make_pair(v, _total_length)); 120 120 } 121 121 … … 130 130 recompute_length(); 131 131 } 132 132 133 133 inline float MultiSegmentPlacer::volume() const 134 134 { 135 135 return _total_length; 136 136 } 137 137 138 138 inline osg::Vec3 MultiSegmentPlacer::getControlPosition() const 139 139 {