2005-04-15 05:41:28 +08:00
|
|
|
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 Robert Osfield
|
2003-01-22 00:45:36 +08:00
|
|
|
*
|
|
|
|
* This library is open source and may be redistributed and/or modified under
|
|
|
|
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
|
|
|
* (at your option) any later version. The full license is in LICENSE file
|
|
|
|
* included with this distribution, and on the openscenegraph.org website.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* OpenSceneGraph Public License for more details.
|
|
|
|
*/
|
2002-06-05 20:44:55 +08:00
|
|
|
//osgParticle - Copyright (C) 2002 Marco Jez
|
|
|
|
|
2005-04-29 17:47:57 +08:00
|
|
|
#ifndef OSGPARTICLE_POINT_PLACER
|
|
|
|
#define OSGPARTICLE_POINT_PLACER 1
|
2002-06-05 20:44:55 +08:00
|
|
|
|
|
|
|
#include <osgParticle/CenteredPlacer>
|
|
|
|
#include <osgParticle/Particle>
|
|
|
|
|
|
|
|
#include <osg/CopyOp>
|
|
|
|
#include <osg/Object>
|
|
|
|
|
|
|
|
namespace osgParticle
|
|
|
|
{
|
|
|
|
|
|
|
|
/** A point-shaped particle placer.
|
|
|
|
This placer class uses the center point defined in its base class <CODE>CenteredPlacer</CODE>
|
|
|
|
to place there all incoming particles.
|
|
|
|
*/
|
|
|
|
class PointPlacer: public CenteredPlacer {
|
|
|
|
public:
|
|
|
|
inline PointPlacer();
|
2005-04-29 17:47:57 +08:00
|
|
|
inline PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
|
2002-06-05 20:44:55 +08:00
|
|
|
|
2002-06-06 21:25:36 +08:00
|
|
|
META_Object(osgParticle, PointPlacer);
|
2002-06-05 20:44:55 +08:00
|
|
|
|
|
|
|
/** Place a particle.
|
|
|
|
This method is called automatically by <CODE>ModularEmitter</CODE> and should not be called
|
|
|
|
manually.
|
|
|
|
*/
|
2005-04-29 17:47:57 +08:00
|
|
|
inline void place(Particle* P) const;
|
2002-06-05 20:44:55 +08:00
|
|
|
|
2005-08-25 22:12:08 +08:00
|
|
|
/// return the control position
|
|
|
|
inline osg::Vec3 getControlPosition() const;
|
|
|
|
|
2002-06-05 20:44:55 +08:00
|
|
|
protected:
|
|
|
|
virtual ~PointPlacer() {}
|
2005-04-29 17:47:57 +08:00
|
|
|
PointPlacer& operator=(const PointPlacer&) { return *this; }
|
2002-06-05 20:44:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// INLINE FUNCTIONS
|
|
|
|
|
|
|
|
inline PointPlacer::PointPlacer()
|
|
|
|
: CenteredPlacer()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-04-29 17:47:57 +08:00
|
|
|
inline PointPlacer::PointPlacer(const PointPlacer& copy, const osg::CopyOp& copyop)
|
2002-06-05 20:44:55 +08:00
|
|
|
: CenteredPlacer(copy, copyop)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-04-29 17:47:57 +08:00
|
|
|
inline void PointPlacer::place(Particle* P) const
|
2002-06-05 20:44:55 +08:00
|
|
|
{
|
|
|
|
P->setPosition(getCenter());
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-25 22:12:08 +08:00
|
|
|
inline osg::Vec3 PointPlacer::getControlPosition() const
|
|
|
|
{
|
|
|
|
return getCenter();
|
|
|
|
}
|
|
|
|
|
2002-06-05 20:44:55 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|