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
|
||||
|
||||
Reference in New Issue
Block a user