1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-16 07:49:56 +00:00
openmw-tes3mp/apps/openmw/mwrender/ripplesimulation.hpp

65 lines
1.3 KiB
C++
Raw Normal View History

2013-02-01 22:43:23 +00:00
#ifndef RIPPLE_SIMULATION_H
#define RIPPLE_SIMULATION_H
2013-02-27 08:20:42 +00:00
#include <OgreVector3.h>
#include "../mwworld/ptr.hpp"
2013-02-01 22:43:23 +00:00
namespace Ogre
{
class SceneManager;
class ParticleSystem;
}
namespace MWWorld
{
class Fallback;
2013-02-01 22:43:23 +00:00
}
namespace MWRender
{
2013-02-27 08:20:42 +00:00
struct Emitter
{
MWWorld::Ptr mPtr;
Ogre::Vector3 mLastEmitPosition;
float mScale;
float mForce;
};
2013-02-01 22:43:23 +00:00
class RippleSimulation
{
public:
RippleSimulation(Ogre::SceneManager* mainSceneManager, const MWWorld::Fallback* fallback);
2013-02-01 22:43:23 +00:00
~RippleSimulation();
/// @param dt Time since the last frame
/// @param position Position of the player
2013-02-01 22:43:23 +00:00
void update(float dt, Ogre::Vector2 position);
2013-02-27 08:20:42 +00:00
/// adds an emitter, position will be tracked automatically
void addEmitter (const MWWorld::Ptr& ptr, float scale = 1.f, float force = 1.f);
void removeEmitter (const MWWorld::Ptr& ptr);
void updateEmitterPtr (const MWWorld::Ptr& old, const MWWorld::Ptr& ptr);
2013-02-01 22:43:23 +00:00
/// Change the height of the water surface, thus moving all ripples with it
void setWaterHeight(float height);
/// Remove all active ripples
void clear();
2013-02-01 22:43:23 +00:00
private:
2013-02-01 22:43:23 +00:00
Ogre::SceneManager* mSceneMgr;
Ogre::ParticleSystem* mParticleSystem;
Ogre::SceneNode* mSceneNode;
2013-02-01 22:43:23 +00:00
std::vector<Emitter> mEmitters;
2013-02-01 22:43:23 +00:00
float mRippleLifeTime;
float mRippleRotSpeed;
2013-02-01 22:43:23 +00:00
};
}
#endif