OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
effectmanager.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_MWRENDER_EFFECTMANAGER_H
2 #define OPENMW_MWRENDER_EFFECTMANAGER_H
3 
4 #include <string>
5 #include <map>
6 
7 #include <osg/ref_ptr>
8 
9 #include <boost/shared_ptr.hpp>
10 
11 namespace osg
12 {
13  class Group;
14  class Vec3f;
15  class PositionAttitudeTransform;
16 }
17 
18 namespace Resource
19 {
20  class ResourceSystem;
21 }
22 
23 namespace MWRender
24 {
25  class EffectAnimationTime;
26 
27  // Note: effects attached to another object should be managed by MWRender::Animation::addEffect.
28  // This class manages "free" effects, i.e. attached to a dedicated scene node in the world.
30  {
31  public:
32  EffectManager(osg::ref_ptr<osg::Group> parent, Resource::ResourceSystem* resourceSystem);
34 
36  void addEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPosition, float scale, bool isMagicVFX = true);
37 
38  void update(float dt);
39 
41  void clear();
42 
43  private:
44  struct Effect
45  {
47  boost::shared_ptr<EffectAnimationTime> mAnimTime;
48  };
49 
50  typedef std::map<osg::ref_ptr<osg::PositionAttitudeTransform>, Effect> EffectMap;
52 
53  osg::ref_ptr<osg::Group> mParentNode;
55 
57  void operator=(const EffectManager&);
58  };
59 
60 }
61 
62 #endif
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:24
Definition: effectmanager.hpp:44
float mMaxControllerLength
Definition: effectmanager.hpp:46
Definition: effectmanager.hpp:29
std::map< osg::ref_ptr< osg::PositionAttitudeTransform >, Effect > EffectMap
Definition: effectmanager.hpp:50
void addEffect(const std::string &model, const std::string &textureOverride, const osg::Vec3f &worldPosition, float scale, bool isMagicVFX=true)
Add an effect. When it's finished playing, it will be removed automatically.
Definition: effectmanager.cpp:28
boost::shared_ptr< EffectAnimationTime > mAnimTime
Definition: effectmanager.hpp:47
EffectMap mEffects
Definition: effectmanager.hpp:51
void clear()
Remove all effects.
Definition: effectmanager.cpp:76
~EffectManager()
Definition: effectmanager.cpp:23
Resource::ResourceSystem * mResourceSystem
Definition: effectmanager.hpp:54
EffectManager(osg::ref_ptr< osg::Group > parent, Resource::ResourceSystem *resourceSystem)
Definition: effectmanager.cpp:17
void operator=(const EffectManager &)
void update(float dt)
Definition: effectmanager.cpp:60
osg::ref_ptr< osg::Group > mParentNode
Definition: effectmanager.hpp:53