Updates from Geoff Michel to geo loader and demo.
This commit is contained in:
@@ -39,7 +39,9 @@ osgParticle::ParticleProcessor::ParticleProcessor(const ParticleProcessor ©,
|
||||
void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor &nv)
|
||||
{
|
||||
// continue only if enabled
|
||||
if (enabled_) {
|
||||
if (enabled_ )
|
||||
{
|
||||
|
||||
|
||||
// typecast the NodeVisitor to CullVisitor
|
||||
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
|
||||
@@ -48,35 +50,45 @@ void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor &nv)
|
||||
if (cv) {
|
||||
|
||||
// continue only if the particle system is valid
|
||||
if (ps_.valid()) {
|
||||
if (ps_.valid())
|
||||
{
|
||||
|
||||
// retrieve the current time
|
||||
double t = nv.getFrameStamp()->getReferenceTime();
|
||||
if (nv.getFrameStamp())
|
||||
{
|
||||
|
||||
// skip if we haven't initialized t0_ yet
|
||||
if (t0_ != -1) {
|
||||
// retrieve the current time
|
||||
double t = nv.getFrameStamp()->getReferenceTime();
|
||||
|
||||
// check whether the particle system is frozen/culled
|
||||
if (!ps_->isFrozen() && (ps_->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps_->getFreezeOnCull())) {
|
||||
// skip if we haven't initialized t0_ yet
|
||||
if (t0_ != -1) {
|
||||
|
||||
// initialize matrix flags
|
||||
need_ltw_matrix_ = true;
|
||||
need_wtl_matrix_ = true;
|
||||
current_nodevisitor_ = &nv;
|
||||
// check whether the particle system is frozen/culled
|
||||
if (!ps_->isFrozen() && (ps_->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !ps_->getFreezeOnCull())) {
|
||||
|
||||
// do some process (unimplemented in this base class)
|
||||
process(t - t0_);
|
||||
// initialize matrix flags
|
||||
need_ltw_matrix_ = true;
|
||||
need_wtl_matrix_ = true;
|
||||
current_nodevisitor_ = &nv;
|
||||
|
||||
// do some process (unimplemented in this base class)
|
||||
process(t - t0_);
|
||||
}
|
||||
}
|
||||
|
||||
// update t0_
|
||||
t0_ = t;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
osg::notify(osg::WARN) << "osgParticle::ParticleProcessor::traverse(NodeVisitor&) requires a valid FrameStamp to function, particles not updated.\n";
|
||||
}
|
||||
|
||||
// update t0_
|
||||
t0_ = t;
|
||||
|
||||
} else {
|
||||
} else
|
||||
{
|
||||
osg::notify(osg::WARN) << "ParticleProcessor \"" << getName() << "\": invalid particle system\n";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// call the inherited method
|
||||
|
||||
@@ -24,16 +24,27 @@ void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor &nv)
|
||||
{
|
||||
osgUtil::CullVisitor *cv = dynamic_cast<osgUtil::CullVisitor *>(&nv);
|
||||
if (cv) {
|
||||
double t = nv.getFrameStamp()->getReferenceTime();
|
||||
if (t0_ != -1) {
|
||||
ParticleSystem_Vector::iterator i;
|
||||
for (i=psv_.begin(); i!=psv_.end(); ++i) {
|
||||
if (!i->get()->isFrozen() && (i->get()->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !i->get()->getFreezeOnCull())) {
|
||||
i->get()->update(t - t0_);
|
||||
if (nv.getFrameStamp())
|
||||
{
|
||||
double t = nv.getFrameStamp()->getReferenceTime();
|
||||
if (t0_ != -1)
|
||||
{
|
||||
ParticleSystem_Vector::iterator i;
|
||||
for (i=psv_.begin(); i!=psv_.end(); ++i)
|
||||
{
|
||||
if (!i->get()->isFrozen() && (i->get()->getLastFrameNumber() >= (nv.getFrameStamp()->getFrameNumber() - 1) || !i->get()->getFreezeOnCull()))
|
||||
{
|
||||
i->get()->update(t - t0_);
|
||||
}
|
||||
}
|
||||
}
|
||||
t0_ = t;
|
||||
}
|
||||
t0_ = t;
|
||||
else
|
||||
{
|
||||
osg::notify(osg::WARN) << "osgParticle::ParticleSystemUpdater::traverse(NodeVisitor&) requires a valid FrameStamp to function, particles not updated.\n";
|
||||
}
|
||||
|
||||
}
|
||||
Node::traverse(nv);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user