forked from mirror/openmw-tes3mp
use own inline hash_combine function
This commit is contained in:
parent
fb7479c194
commit
f0b21cca22
1 changed files with 10 additions and 2 deletions
|
@ -209,13 +209,21 @@ namespace SceneUtil
|
||||||
mLights.push_back(l);
|
mLights.push_back(l);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* similar to the boost::hash_combine */
|
||||||
|
template <class T>
|
||||||
|
inline void hash_combine(std::size_t& seed, const T& v)
|
||||||
|
{
|
||||||
|
std::hash<T> hasher;
|
||||||
|
seed ^= hasher(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
|
||||||
|
}
|
||||||
|
|
||||||
osg::ref_ptr<osg::StateSet> LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum)
|
osg::ref_ptr<osg::StateSet> LightManager::getLightListStateSet(const LightList &lightList, unsigned int frameNum)
|
||||||
{
|
{
|
||||||
|
|
||||||
// possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists)
|
// possible optimization: return a StateSet containing all requested lights plus some extra lights (if a suitable one exists)
|
||||||
size_t hash = 0;
|
size_t hash = 0;
|
||||||
for (unsigned int i=0; i<lightList.size();++i)
|
for (unsigned int i=0; i<lightList.size();++i)
|
||||||
hash = hash ^ (lightList[i]->mLightSource->getId() << 1); // or use boost::hash_combine
|
hash_combine(hash, lightList[i]->mLightSource->getId());
|
||||||
// original: boost::hash_combine(hash, lightList[i]->mLightSource->getId());
|
|
||||||
|
|
||||||
LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2];
|
LightStateSetMap& stateSetCache = mStateSetCache[frameNum%2];
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue