1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 12:42:11 +00:00
OpenMW/apps/openmw/mwrender/actoranimation.hpp
scrawl 1893617ec9 Improvements to ignored light list setting
The pointer to the LightListCallback is now stored in the Animation, which eliminates the need for dynamic_cast. Also, when the object root is recreated, the previously used LightListCallback will be reused, so we no longer need the objectRootReset() notifier.

Finally, there was a bug when saving and reloading the game, the getIgnoredLightSources() were not being set, as the ActorAnimation constructor completes before the NpcAnimation sets the ObjectRoot. This was solved by creating the LightListCallback in advance in the Animation constructor.
2016-10-08 23:59:28 +02:00

54 lines
1.1 KiB
C++

#ifndef GAME_RENDER_ACTORANIMATION_H
#define GAME_RENDER_ACTORANIMATION_H
#include <map>
#include <osg/ref_ptr>
#include "../mwworld/containerstore.hpp"
#include "animation.hpp"
namespace osg
{
class Node;
}
namespace MWWorld
{
class ConstPtr;
}
namespace SceneUtil
{
class LightSource;
class LightListCallback;
}
namespace MWRender
{
class ActorAnimation : public Animation, public MWWorld::ContainerStoreListener
{
public:
ActorAnimation(const MWWorld::Ptr &ptr, osg::ref_ptr<osg::Group> parentNode, Resource::ResourceSystem* resourceSystem,
bool disableListener=false);
virtual ~ActorAnimation();
virtual void itemAdded(const MWWorld::ConstPtr& item, int count);
virtual void itemRemoved(const MWWorld::ConstPtr& item, int count);
private:
void addHiddenItemLight(const MWWorld::ConstPtr& item, const ESM::Light* esmLight);
void removeHiddenItemLight(const MWWorld::ConstPtr& item);
typedef std::map<MWWorld::ConstPtr, osg::ref_ptr<SceneUtil::LightSource> > ItemLightMap;
ItemLightMap mItemLights;
bool mListenerDisabled;
};
}
#endif