OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CenteredPlacer.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_CENTERED_PLACER
16 #define OSGPARTICLE_CENTERED_PLACER 1
17 
18 #include <osgParticle/Placer>
19 
20 #include <osg/CopyOp>
21 #include <osg/Object>
22 #include <osg/Vec3>
23 
24 namespace osgParticle
25 {
26 
29  class CenteredPlacer: public Placer {
30  public:
31  inline CenteredPlacer();
32  inline CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
33 
34  virtual const char* libraryName() const { return "osgParticle"; }
35  virtual const char* className() const { return "CenteredPlacer"; }
36  virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Placer* >(obj) != 0; }
37 
39  inline const osg::Vec3& getCenter() const;
40 
42  inline void setCenter(const osg::Vec3& v);
43 
45  inline void setCenter(float x, float y, float z);
46 
47  protected:
48  virtual ~CenteredPlacer() {}
49 
50  private:
51  osg::Vec3 center_;
52  };
53 
54  // INLINE FUNCTIONS
55 
57  : Placer(), center_(0, 0, 0)
58  {
59  }
60 
61  inline CenteredPlacer::CenteredPlacer(const CenteredPlacer& copy, const osg::CopyOp& copyop)
62  : Placer(copy, copyop), center_(copy.center_)
63  {
64  }
65 
66  inline const osg::Vec3& CenteredPlacer::getCenter() const
67  {
68  return center_;
69  }
70 
71  inline void CenteredPlacer::setCenter(const osg::Vec3& v)
72  {
73  center_ = v;
74  }
75 
76  inline void CenteredPlacer::setCenter(float x, float y, float z)
77  {
78  center_.set(x, y, z);
79  }
80 
81 }
82 
83 
84 #endif
virtual bool isSameKindAs(const osg::Object *obj) const
virtual const char * className() const
virtual const char * libraryName() const
void set(value_type x, value_type y, value_type z)
Definition: Vec3f.h:67
const osg::Vec3 & getCenter() const
Get the center point.
void setCenter(const osg::Vec3 &v)
Set the center point.