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 <map>
5 #include <memory>
6 #include <string>
7 
8 #include <osg/ref_ptr>
9 
10 namespace osg
11 {
12  class Group;
13  class Vec3f;
14  class PositionAttitudeTransform;
15 }
16 
17 namespace Resource
18 {
19  class ResourceSystem;
20 }
21 
22 namespace MWRender
23 {
24  class EffectAnimationTime;
25 
26  // Note: effects attached to another object should be managed by MWRender::Animation::addEffect.
27  // This class manages "free" effects, i.e. attached to a dedicated scene node in the world.
29  {
30  public:
31  EffectManager(osg::ref_ptr<osg::Group> parent, Resource::ResourceSystem* resourceSystem);
33 
35  void addEffect (const std::string& model, const std::string& textureOverride, const osg::Vec3f& worldPosition, float scale, bool isMagicVFX = true);
36 
37  void update(float dt);
38 
40  void clear();
41 
42  private:
43  struct Effect
44  {
46  std::shared_ptr<EffectAnimationTime> mAnimTime;
47  };
48 
49  typedef std::map<osg::ref_ptr<osg::PositionAttitudeTransform>, Effect> EffectMap;
51 
52  osg::ref_ptr<osg::Group> mParentNode;
54 
56  void operator=(const EffectManager&);
57  };
58 
59 }
60 
61 #endif
Wrapper class that constructs and provides access to the most commonly used resource subsystems...
Definition: resourcesystem.hpp:30
Definition: effectmanager.hpp:43
float mMaxControllerLength
Definition: effectmanager.hpp:45
Definition: effectmanager.hpp:28
std::map< osg::ref_ptr< osg::PositionAttitudeTransform >, Effect > EffectMap
Definition: effectmanager.hpp:49
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
EffectMap mEffects
Definition: effectmanager.hpp:50
void clear()
Remove all effects.
Definition: effectmanager.cpp:75
~EffectManager()
Definition: effectmanager.cpp:23
Resource::ResourceSystem * mResourceSystem
Definition: effectmanager.hpp:53
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:59
std::shared_ptr< EffectAnimationTime > mAnimTime
Definition: effectmanager.hpp:46
osg::ref_ptr< osg::Group > mParentNode
Definition: effectmanager.hpp:52