1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-30 21:32:42 +00:00
OpenMW/apps/openmw/mwrender/effectmanager.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

61 lines
1.5 KiB
C++
Raw Normal View History

2014-01-17 10:52:44 +01:00
#ifndef OPENMW_MWRENDER_EFFECTMANAGER_H
#define OPENMW_MWRENDER_EFFECTMANAGER_H
#include <memory>
#include <string>
2022-06-09 20:43:53 +00:00
#include <vector>
2014-01-17 10:52:44 +01:00
2015-04-19 17:55:56 +02:00
#include <osg/ref_ptr>
2015-04-19 17:55:56 +02:00
namespace osg
{
class Group;
class Vec3f;
class PositionAttitudeTransform;
}
2015-04-19 17:55:56 +02:00
namespace Resource
{
class ResourceSystem;
}
namespace MWRender
{
class EffectAnimationTime;
2014-01-17 10:52:44 +01:00
// Note: effects attached to another object should be managed by MWRender::Animation::addEffect.
// This class manages "free" effects, i.e. attached to a dedicated scene node in the world.
class EffectManager
{
public:
2015-04-19 17:55:56 +02:00
EffectManager(osg::ref_ptr<osg::Group> parent, Resource::ResourceSystem* resourceSystem);
2022-06-09 20:43:53 +00:00
EffectManager(const EffectManager&) = delete;
2015-04-19 17:55:56 +02:00
~EffectManager();
2014-01-17 10:52:44 +01:00
/// Add an effect. When it's finished playing, it will be removed automatically.
2022-08-28 17:20:49 +02:00
void addEffect(const std::string& model, std::string_view textureOverride, const osg::Vec3f& worldPosition,
float scale, bool isMagicVFX = true);
2014-01-17 10:52:44 +01:00
2015-04-19 17:55:56 +02:00
void update(float dt);
2014-01-17 10:52:44 +01:00
/// Remove all effects
void clear();
private:
2015-04-19 17:55:56 +02:00
struct Effect
{
float mMaxControllerLength;
std::shared_ptr<EffectAnimationTime> mAnimTime;
2022-06-09 20:43:53 +00:00
osg::ref_ptr<osg::PositionAttitudeTransform> mTransform;
2015-04-19 17:55:56 +02:00
};
2022-06-09 20:43:53 +00:00
std::vector<Effect> mEffects;
2015-04-19 17:55:56 +02:00
osg::ref_ptr<osg::Group> mParentNode;
Resource::ResourceSystem* mResourceSystem;
2014-01-17 10:52:44 +01:00
};
}
#endif