Replace redundant asCullVisitor usage with a type check

This commit is contained in:
Capostrophic 2019-03-15 15:46:58 +03:00
parent da16693b4a
commit 35f256a9a1
2 changed files with 2 additions and 7 deletions

View File

@ -59,12 +59,8 @@ void osgParticle::ParticleProcessor::setParticleSystem(ParticleSystem* ps)
void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv) void osgParticle::ParticleProcessor::traverse(osg::NodeVisitor& nv)
{ {
// typecast the NodeVisitor to CullVisitor
osgUtil::CullVisitor* cv = nv.asCullVisitor();
// continue only if the visitor actually is a cull visitor // continue only if the visitor actually is a cull visitor
if (cv) { if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR) {
// continue only if the particle system is valid // continue only if the particle system is valid
if (_ps.valid()) if (_ps.valid())
{ {

View File

@ -22,8 +22,7 @@ osgParticle::ParticleSystemUpdater::ParticleSystemUpdater(const ParticleSystemUp
void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv) void osgParticle::ParticleSystemUpdater::traverse(osg::NodeVisitor& nv)
{ {
osgUtil::CullVisitor* cv = nv.asCullVisitor(); if (nv.getVisitorType() == osg::NodeVisitor::CULL_VISITOR)
if (cv)
{ {
if (nv.getFrameStamp()) if (nv.getFrameStamp())
{ {