Skip to content

Commit

Permalink
Bugfix: Added submitted patch. Area lights are not guaranteed to be i…
Browse files Browse the repository at this point in the history
…n order sequentually when light lists are built multithreaded, thus it was causing asserts when Approx Area lights were present.
  • Loading branch information
darksylinc committed Jun 16, 2018
1 parent 98616f8 commit b4c4fa7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Components/Hlms/Pbs/src/OgreHlmsPbs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1511,11 +1511,15 @@ namespace Ogre
mAreaLights.reserve( numAreaApproxLights );
mAreaLights.clear();
const LightListInfo &globalLightList = sceneManager->getGlobalLightList();
for( size_t i=0; i<realNumAreaLights; ++i )
{
const size_t idx = mAreaLightsGlobalLightListStart + i;
assert( globalLightList.lights[idx]->getType() == Light::LT_AREA_APPROX );
mAreaLights.push_back( globalLightList.lights[idx] );
size_t areaLightNumber = 0;
for( size_t idx = mAreaLightsGlobalLightListStart;
idx<globalLightList.lights.size() && areaLightNumber < realNumAreaLights; ++idx )
{
if( globalLightList.lights[idx]->getType() == Light::LT_AREA_APPROX )
{
mAreaLights.push_back( globalLightList.lights[idx] );
areaLightNumber++;
}
}

std::sort( mAreaLights.begin(), mAreaLights.end(), SortByTextureLightMaskIdx );
Expand Down

0 comments on commit b4c4fa7

Please sign in to comment.