/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield 
 *
 * 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.
*/

#ifndef OSGPARTICLE_PARTICLEEFFECT
#define OSGPARTICLE_PARTICLEEFFECT

#include <osgParticle/Emitter>
#include <osgParticle/Program>

namespace osgParticle
{

    class OSGPARTICLE_EXPORT ParticleEffect : public osg::Group
    {
    public:
    
        ParticleEffect() {}
        
        ParticleEffect(const ParticleEffect& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);

        virtual const char *libraryName() const { return "osgParticle"; }
        virtual const char *className() const { return "ParticleEffect"; }
        virtual bool isSameKindAs(const osg::Object *obj) const { return dynamic_cast<const ParticleEffect*>(obj) != 0; }
        virtual void accept(osg::NodeVisitor& nv) { if (nv.validNodeMask(*this)) { nv.pushOntoNodePath(this); nv.apply(*this); nv.popFromNodePath(); } }

        void setEmitter(Emitter* emitter) { _emitter = emitter; }
        Emitter* getEmitter() { return _emitter.get(); }
        const Emitter* getEmitter() const { return _emitter.get(); }

        void setProgram(Program* program) { _program = program; }
        Program* getProgram() { return _program.get(); }
        const Program* getProgram() const { return _program.get(); }
        
        void setParticleSystem(ParticleSystem* ps) { _particleSystem = ps; }
        ParticleSystem* getParticleSystem() { return _particleSystem.get(); }
        const ParticleSystem* getParticleSystem() const { return _particleSystem.get(); }

        virtual void buildEffect() = 0;

    protected:
    
        osg::ref_ptr<Emitter>           _emitter;
        osg::ref_ptr<Program>           _program;
        osg::ref_ptr<ParticleSystem>    _particleSystem;

    };

}

#endif
