Added new shell of new class ConnectedParticleSystem, which will be used

for managing connect particle system for the purpose of doing missile trails etc.
This commit is contained in:
Robert Osfield 2005-10-11 09:47:28 +00:00
parent b7fd3bfdc4
commit 540e676dae
6 changed files with 131 additions and 1 deletions

View File

@ -147,6 +147,10 @@ SOURCE=..\..\src\osgParticle\ParticleSystem.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\osgParticle\ConnectedParticleSystem.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\osgParticle\ParticleSystemUpdater.cpp
# End Source File
# Begin Source File
@ -255,6 +259,10 @@ SOURCE=..\..\include\osgParticle\ParticleSystem
# End Source File
# Begin Source File
SOURCE=..\..\include\osgParticle\ConnectedParticleSystem
# End Source File
# Begin Source File
SOURCE=..\..\include\osgParticle\ParticleSystemUpdater
# End Source File
# Begin Source File

View File

@ -0,0 +1,58 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 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_CONNECTEDPARTICLESYSTEM
#define OSGPARTICLE_CONNECTEDPARTICLESYSTEM 1
#include <osgParticle/ParticleSystem>
namespace osgParticle
{
/** ConnectConnectedParticleSystem is a specialise ConnectedParticleSystem for effects
* like missle trails, where the individual particles are rendered as
* single ribbon.
*/
class OSGPARTICLE_EXPORT ConnectedParticleSystem: public osgParticle::ParticleSystem
{
public:
ConnectedParticleSystem();
ConnectedParticleSystem(const ConnectedParticleSystem& copy, const osg::CopyOp& copyop = osg::CopyOp::SHALLOW_COPY);
META_Object(osgParticle, ConnectedParticleSystem);
/// Create a new particle from the specified template (or the default one if <CODE>ptemplate</CODE> is null).
virtual Particle* createParticle(const Particle* ptemplate);
/// Destroy the i-th particle.
virtual void destroyParticle(int i);
/// Update the particles. Don't call this directly, use a <CODE>ConnectedParticleSystemUpdater</CODE> instead.
virtual void update(double dt);
virtual void drawImplementation(osg::State& state) const;
protected:
virtual ~ConnectedParticleSystem();
ConnectedParticleSystem& operator=(const ConnectedParticleSystem&) { return *this; }
Particle* _startParticle;
Particle* _lastParticleCreated;
};
}
#endif

View File

@ -257,6 +257,10 @@ namespace osgParticle
int _cur_tile;
float _s_coord;
float _t_coord;
// previous and next Particles are only used in ConnectedParticleSystems
Particle* _previousParticle;
Particle* _nextParticle;
};
// INLINE FUNCTIONS

View File

@ -0,0 +1,57 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2005 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.
*/
#include <osg/Notify>
#include <osgParticle/ConnectedParticleSystem>
using namespace osgParticle;
ConnectedParticleSystem::ConnectedParticleSystem():
_startParticle(0),
_lastParticleCreated(0)
{
}
ConnectedParticleSystem::ConnectedParticleSystem(const ConnectedParticleSystem& copy, const osg::CopyOp& copyop):
ParticleSystem(copy,copyop),
_startParticle(0),
_lastParticleCreated(0)
{
// need to think about how to copy _startParticle and _lastParticleCreated...
// should we just use indices? Should we compute offsets into the particle system?
osg::notify(osg::NOTICE)<<"Warning: ConnectedParticleSystem copy constructor incomplete."<<std::endl;
}
ConnectedParticleSystem::~ConnectedParticleSystem()
{
}
Particle* ConnectedParticleSystem::createParticle(const Particle* ptemplate)
{
return ParticleSystem::createParticle(ptemplate);
}
void ConnectedParticleSystem::destroyParticle(int i)
{
return ParticleSystem::destroyParticle(i);
}
void ConnectedParticleSystem::update(double dt)
{
ParticleSystem::update(dt);
}
void ConnectedParticleSystem::drawImplementation(osg::State& state) const
{
ParticleSystem::drawImplementation(state);
}

View File

@ -16,6 +16,7 @@ CXXFILES =\
ParticleEffect.cpp\
ParticleProcessor.cpp\
ParticleSystem.cpp\
ConnectedParticleSystem.cpp\
ParticleSystemUpdater.cpp\
Program.cpp\
Version.cpp\

View File

@ -47,7 +47,9 @@ osgParticle::Particle::Particle()
_num_tile(1),
_cur_tile(-1),
_s_coord(0.0f),
_t_coord(0.0f)
_t_coord(0.0f),
_previousParticle(0),
_nextParticle(0)
{
}