mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-10-31 17:56:42 +00:00 
			
		
		
		
	OSG 3.4 adds the ability to place Drawables directly in the scene graph, without a Geode decorating them. Leveraging this should give a small performance boost, because the redundant Geodes increase culling overhead. There is still an oustanding issue with the RemoveDrawableVisitor no longer working correctly, because Drawables can have multiple parents.
		
			
				
	
	
		
			34 lines
		
	
	
	
		
			788 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			34 lines
		
	
	
	
		
			788 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #include "visitor.hpp"
 | |
| 
 | |
| #include <osg/Geode>
 | |
| 
 | |
| #include <osgParticle/ParticleSystem>
 | |
| 
 | |
| #include <components/misc/stringops.hpp>
 | |
| 
 | |
| namespace SceneUtil
 | |
| {
 | |
| 
 | |
|     void FindByNameVisitor::apply(osg::Group &group)
 | |
|     {
 | |
|         if (Misc::StringUtils::ciEqual(group.getName(), mNameToFind))
 | |
|         {
 | |
|             mFoundNode = &group;
 | |
|             return;
 | |
|         }
 | |
|         traverse(group);
 | |
|     }
 | |
| 
 | |
|     void DisableFreezeOnCullVisitor::apply(osg::Geode &geode)
 | |
|     {
 | |
|         for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
 | |
|             apply(*geode.getDrawable(i));
 | |
|     }
 | |
| 
 | |
|     void DisableFreezeOnCullVisitor::apply(osg::Drawable& drw)
 | |
|     {
 | |
|         if (osgParticle::ParticleSystem* partsys = dynamic_cast<osgParticle::ParticleSystem*>(&drw))
 | |
|             partsys->setFreezeOnCull(false);
 | |
|     }
 | |
| 
 | |
| }
 |