1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
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.
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.
13//osgParticle - Copyright (C) 2002 Marco Jez
15#ifndef OSGPARTICLE_PLACER
16#define OSGPARTICLE_PLACER 1
27 /** An abstract base class for implementing <I>particle placers</I>. A placer is an object which take
28 a particle as input, and places it somewhere by setting its position vector. Placer objects are
29 used by the <CODE>ModularEmitter</CODE> class as part of the particle emission process.
31 class Placer: public osg::Object {
34 inline Placer(const Placer& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
36 virtual const char* libraryName() const { return "osgParticle"; }
37 virtual const char* className() const { return "Placer"; }
38 virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const Placer *>(obj) != 0; }
40 /// Place a particle. Must be implemented in descendant classes.
41 virtual void place(Particle* P) const = 0;
43 /// Volume of the placer. Can be implemented in descendant classes.
44 virtual float volume() const { return 1.0f; }
46 /// Return the control position of particles that placer will generate. Must be implemented in descendant classes.
47 virtual osg::Vec3 getControlPosition() const = 0;
51 Placer& operator=(const Placer& ) { return *this; }
56 inline Placer::Placer()
61 inline Placer::Placer(const Placer& copy, const osg::CopyOp& copyop)
62 : osg::Object(copy, copyop)