Merge pull request #1101 from MiroslavR/ignored-light-sources-fix

Ignored light sources fix
pull/75/head
scrawl 8 years ago committed by GitHub
commit 15046c961b

@ -19,6 +19,7 @@
#include "../mwworld/ptr.hpp" #include "../mwworld/ptr.hpp"
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/cellstore.hpp" #include "../mwworld/cellstore.hpp"
#include "../mwmechanics/actorutil.hpp"
#include "vismask.hpp" #include "vismask.hpp"
@ -104,8 +105,8 @@ void ActorAnimation::addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM
mInsert->addChild(lightSource); mInsert->addChild(lightSource);
if (SceneUtil::LightListCallback* callback = mLightListCallback) if (mLightListCallback && mPtr == MWMechanics::getPlayer())
callback->getIgnoredLightSources().insert(lightSource.get()); mLightListCallback->getIgnoredLightSources().insert(lightSource.get());
mItemLights.insert(std::make_pair(item, lightSource)); mItemLights.insert(std::make_pair(item, lightSource));
} }
@ -116,11 +117,11 @@ void ActorAnimation::removeHiddenItemLight(const MWWorld::ConstPtr& item)
if (iter == mItemLights.end()) if (iter == mItemLights.end())
return; return;
if (SceneUtil::LightListCallback* callback = mLightListCallback) if (mLightListCallback && mPtr == MWMechanics::getPlayer())
{ {
std::set<SceneUtil::LightSource*>::iterator ignoredIter = callback->getIgnoredLightSources().find(iter->second.get()); std::set<SceneUtil::LightSource*>::iterator ignoredIter = mLightListCallback->getIgnoredLightSources().find(iter->second.get());
if (ignoredIter != callback->getIgnoredLightSources().end()) if (ignoredIter != mLightListCallback->getIgnoredLightSources().end())
callback->getIgnoredLightSources().erase(ignoredIter); mLightListCallback->getIgnoredLightSources().erase(ignoredIter);
} }
mInsert->removeChild(iter->second); mInsert->removeChild(iter->second);

@ -1157,8 +1157,6 @@ namespace MWRender
if (!mLightListCallback) if (!mLightListCallback)
mLightListCallback = new SceneUtil::LightListCallback; mLightListCallback = new SceneUtil::LightListCallback;
mObjectRoot->addCullCallback(mLightListCallback); mObjectRoot->addCullCallback(mLightListCallback);
objectRootReset();
} }
osg::Group* Animation::getObjectRoot() osg::Group* Animation::getObjectRoot()

@ -310,8 +310,6 @@ protected:
*/ */
void setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature); void setObjectRoot(const std::string &model, bool forceskeleton, bool baseonly, bool isCreature);
virtual void objectRootReset() {}
/** Adds the keyframe controllers in the specified model as a new animation source. Note that the .nif /** Adds the keyframe controllers in the specified model as a new animation source. Note that the .nif
* file extension will be replaced with .kf. * file extension will be replaced with .kf.
* @note Later added animation sources have the highest priority when it comes to finding a particular animation. * @note Later added animation sources have the highest priority when it comes to finding a particular animation.

Loading…
Cancel
Save