mirror of
				https://github.com/OpenMW/openmw.git
				synced 2025-11-04 06:56:39 +00:00 
			
		
		
		
	Do not update map texture if it did not change
This commit is contained in:
		
							parent
							
								
									231e629e66
								
							
						
					
					
						commit
						1143985bc7
					
				
					 1 changed files with 14 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -613,7 +613,8 @@ void LocalMap::updatePlayer (const osg::Vec3f& position, const osg::Quat& orient
 | 
			
		|||
            if (!segment.mFogOfWarImage || !segment.mMapTexture)
 | 
			
		||||
                continue;
 | 
			
		||||
 | 
			
		||||
            unsigned char* data = segment.mFogOfWarImage->data();
 | 
			
		||||
            uint32_t* data = (uint32_t*)segment.mFogOfWarImage->data();
 | 
			
		||||
            bool changed = false;
 | 
			
		||||
            for (int texV = 0; texV<sFogOfWarResolution; ++texV)
 | 
			
		||||
            {
 | 
			
		||||
                for (int texU = 0; texU<sFogOfWarResolution; ++texU)
 | 
			
		||||
| 
						 | 
				
			
			@ -625,16 +626,24 @@ void LocalMap::updatePlayer (const osg::Vec3f& position, const osg::Quat& orient
 | 
			
		|||
                    uint8_t alpha = (clr >> 24);
 | 
			
		||||
 | 
			
		||||
                    alpha = std::min( alpha, (uint8_t) (std::max(0.f, std::min(1.f, (sqrDist/sqrExploreRadius)))*255) );
 | 
			
		||||
                    *(uint32_t*)data = (uint32_t) (alpha << 24);
 | 
			
		||||
                    uint32_t val = (uint32_t) (alpha << 24);
 | 
			
		||||
                    if ( *data != val)
 | 
			
		||||
                    {
 | 
			
		||||
                        *data = val;
 | 
			
		||||
                        changed = true;
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    data += 4;
 | 
			
		||||
                    ++data;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            if (changed)
 | 
			
		||||
            {
 | 
			
		||||
                segment.mHasFogState = true;
 | 
			
		||||
                segment.mFogOfWarImage->dirty();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
LocalMap::MapSegment::MapSegment()
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in a new issue