mirror of
				https://github.com/TES3MP/openmw-tes3mp.git
				synced 2025-11-03 23:56:47 +00:00 
			
		
		
		
	Enable culling for particle emitters & programs
Big speedup, though might cause timing inconsistencies that we should fix at some point.
This commit is contained in:
		
							parent
							
								
									0b77ae43a4
								
							
						
					
					
						commit
						8b206e0aed
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
				
			
			@ -954,6 +954,7 @@ namespace NifOsg
 | 
			
		|||
            attachTo->addChild(program);
 | 
			
		||||
            program->setParticleSystem(partsys);
 | 
			
		||||
            program->setReferenceFrame(rf);
 | 
			
		||||
            program->setCullingActive(true);
 | 
			
		||||
            for (; !affectors.empty(); affectors = affectors->extra)
 | 
			
		||||
            {
 | 
			
		||||
                if (affectors->recType == Nif::RC_NiParticleGrowFade)
 | 
			
		||||
| 
						 | 
				
			
			@ -1100,6 +1101,7 @@ namespace NifOsg
 | 
			
		|||
            osg::ref_ptr<Emitter> emitter = handleParticleEmitter(partctrl);
 | 
			
		||||
            emitter->setParticleSystem(partsys);
 | 
			
		||||
            emitter->setReferenceFrame(osgParticle::ParticleProcessor::RELATIVE_RF);
 | 
			
		||||
            emitter->setCullingActive(true);
 | 
			
		||||
 | 
			
		||||
            // Note: we assume that the Emitter node is placed *before* the Particle node in the scene graph.
 | 
			
		||||
            // This seems to be true for all NIF files in the game that I've checked, suggesting that NIFs work similar to OSG with regards to update order.
 | 
			
		||||
| 
						 | 
				
			
			@ -1140,6 +1142,7 @@ namespace NifOsg
 | 
			
		|||
            // particle system updater (after the emitters and affectors in the scene graph)
 | 
			
		||||
            // I think for correct culling needs to be *before* the ParticleSystem, though osg examples do it the other way
 | 
			
		||||
            osg::ref_ptr<osgParticle::ParticleSystemUpdater> updater = new osgParticle::ParticleSystemUpdater;
 | 
			
		||||
            updater->setCullingActive(true);
 | 
			
		||||
            updater->addParticleSystem(partsys);
 | 
			
		||||
            parentNode->addChild(updater);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue