OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
PointPlacer.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 //osgParticle - Copyright (C) 2002 Marco Jez
14 
15 #ifndef OSGPARTICLE_POINT_PLACER
16 #define OSGPARTICLE_POINT_PLACER 1
17 
18 #include <osgParticle/CenteredPlacer>
19 #include <osgParticle/Particle>
20 
21 #include <osg/CopyOp>
22 #include <osg/Object>
23 
24 namespace osgParticle
25 {
26 
31  class PointPlacer: public CenteredPlacer {
32  public:
33  inline PointPlacer();
34  inline PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
35 
37 
42  inline void place(Particle* P) const;
43 
45  inline osg::Vec3 getControlPosition() const;
46 
47  protected:
48  virtual ~PointPlacer() {}
49  PointPlacer& operator=(const PointPlacer&) { return *this; }
50  };
51 
52  // INLINE FUNCTIONS
53 
55  : CenteredPlacer()
56  {
57  }
58 
59  inline PointPlacer::PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop)
60  : CenteredPlacer(copy, copyop)
61  {
62  }
63 
64  inline void PointPlacer::place(Particle* P) const
65  {
66  P->setPosition(getCenter());
67  }
68 
69 
71  {
72  return getCenter();
73  }
74 
75 }
76 
77 
78 #endif
PointPlacer & operator=(const PointPlacer &)
Definition: PointPlacer.h:49
void place(Particle *P) const
Definition: PointPlacer.h:64
osg::Vec3 getControlPosition() const
return the control position
Definition: PointPlacer.h:70
void setPosition(const osg::Vec3 &p)
Set the position vector.
Definition: Particle.h:497
const osg::Vec3 & getCenter() const
Get the center point.
META_Object(osgParticle, PointPlacer)