Merge pull request #288 from eligovision/OpenSceneGraph-3.4_pragmatic

pragma(tic) shader composing fixes in the State
This commit is contained in:
OpenSceneGraph git repository 2017-07-31 12:42:15 +01:00 committed by GitHub
commit 428f4a3804
2 changed files with 17 additions and 20 deletions

View File

@ -2108,7 +2108,7 @@ inline void State::pushDefineList(DefineMap& defineMap,const StateSet::DefineLis
dv.push_back(StateSet::DefinePair(aitr->second.first,aitr->second.second));
// if the back of the stack has changed since the last then mark it as changed.
bool changed = (dv[dv.size()-2].first==dv[dv.size()-1].first);
bool changed = (dv[dv.size()-2] != dv.back());
if (changed)
{
ds.changed = true;
@ -2177,7 +2177,7 @@ inline void State::popDefineList(DefineMap& defineMap,const StateSet::DefineList
if (!dv.empty())
{
// if the stack has less than 2 entries or new back vs old back are different then mark the DefineStack as changed
if ((dv.size()<2) || (dv[dv.size()-2].first!=dv.back().first))
if ((dv.size() < 2) || (dv[dv.size()-2] != dv.back()))
{
ds.changed = true;
defineMap.changed = true;

View File

@ -1828,30 +1828,27 @@ void State::frameCompleted()
bool State::DefineMap::updateCurrentDefines()
{
if (changed)
if (!changed)
return false;
currentDefines.clear();
for(DefineStackMap::const_iterator itr = map.begin();
itr != map.end();
++itr)
{
currentDefines.clear();
for(DefineStackMap::const_iterator itr = map.begin();
itr != map.end();
++itr)
const DefineStack::DefineVec& dv = itr->second.defineVec;
if (!dv.empty())
{
const DefineStack::DefineVec& dv = itr->second.defineVec;
if (!dv.empty())
const StateSet::DefinePair& dp = dv.back();
if (dp.second & osg::StateAttribute::ON)
{
const StateSet::DefinePair& dp = dv.back();
if (dp.second & osg::StateAttribute::ON)
{
currentDefines[itr->first] = dp;
}
currentDefines[itr->first] = dp;
}
}
changed = false;
return true;
}
else
{
return false;
}
changed = false;
return true;
}
std::string State::getDefineString(const osg::ShaderDefines& shaderDefines)