diff --git a/apps/openmw/mwrender/renderingmanager.cpp b/apps/openmw/mwrender/renderingmanager.cpp index 5baa8e7cc..c9f7603be 100644 --- a/apps/openmw/mwrender/renderingmanager.cpp +++ b/apps/openmw/mwrender/renderingmanager.cpp @@ -376,7 +376,7 @@ void RenderingManager::update (float duration, bool paused) float *fpos = data.getPosition().pos; // only for LocalMap::updatePlayer() - Ogre::Vector3 pos(fpos[0], -fpos[2], -fpos[1]); + Ogre::Vector3 pos(fpos[0], fpos[2], -fpos[1]); Ogre::SceneNode *node = data.getBaseNode(); Ogre::Quaternion orient = diff --git a/apps/openmw/mwrender/ripplesimulation.cpp b/apps/openmw/mwrender/ripplesimulation.cpp index 249397005..6c9264b60 100644 --- a/apps/openmw/mwrender/ripplesimulation.cpp +++ b/apps/openmw/mwrender/ripplesimulation.cpp @@ -21,7 +21,8 @@ RippleSimulation::RippleSimulation(Ogre::SceneManager* mainSceneManager) mRippleAreaLength(1000), mImpulseSize(20), mTexelOffset(0,0), - mFirstUpdate(true) + mFirstUpdate(true), + mLastPos(0,0) { Ogre::AxisAlignedBox aabInf; aabInf.setInfinite(); @@ -141,8 +142,16 @@ void RippleSimulation::update(float dt, Ogre::Vector2 position) new sh::Vector3(mRippleCenter.x + mTexelOffset.x, mRippleCenter.y + mTexelOffset.y, 0))); } -void RippleSimulation::addImpulse(Ogre::Vector2 position) +void RippleSimulation::addImpulse(Ogre::Vector2 position, float scale, float force) { + // don't emit if there wasn't enough movement + /// \todo this should be done somewhere else, otherwise multiple emitters cannot be supported + if ((position - mLastPos).length () <= 2) + return; + + mLastPos = position; + + /// \todo scale, force mImpulses.push(position); } diff --git a/apps/openmw/mwrender/ripplesimulation.hpp b/apps/openmw/mwrender/ripplesimulation.hpp index c792a3214..2f8cae24f 100644 --- a/apps/openmw/mwrender/ripplesimulation.hpp +++ b/apps/openmw/mwrender/ripplesimulation.hpp @@ -24,7 +24,7 @@ public: void update(float dt, Ogre::Vector2 position); - void addImpulse (Ogre::Vector2 position); + void addImpulse (Ogre::Vector2 position, float scale = 1.f, float force = 1.f); private: Ogre::RenderTexture* mRenderTargets[4]; @@ -34,6 +34,8 @@ private: float mRippleAreaLength; float mImpulseSize; + Ogre::Vector2 mLastPos; + bool mFirstUpdate; Ogre::Camera* mCamera; diff --git a/apps/openmw/mwrender/water.cpp b/apps/openmw/mwrender/water.cpp index f0680f208..33b6733ba 100644 --- a/apps/openmw/mwrender/water.cpp +++ b/apps/openmw/mwrender/water.cpp @@ -499,4 +499,10 @@ void Water::createdConfiguration (sh::MaterialInstance* m, const std::string& co } } +void Water::addImpulse (Vector2 position, float scale, float force) +{ + if (mSimulation) + mSimulation->addImpulse (position, scale, force); +} + } // namespace diff --git a/apps/openmw/mwrender/water.hpp b/apps/openmw/mwrender/water.hpp index 6100b7cfd..eb7d98f5d 100644 --- a/apps/openmw/mwrender/water.hpp +++ b/apps/openmw/mwrender/water.hpp @@ -146,6 +146,8 @@ namespace MWRender { void toggle(); void update(float dt, Ogre::Vector3 player); + void addImpulse (Ogre::Vector2 position, float scale = 1.f, float force = 1.f); + void setViewportBackground(const Ogre::ColourValue& bg); void processChangedSettings(const Settings::CategorySettingVector& settings); diff --git a/files/materials/watersim_heightmap.shader b/files/materials/watersim_heightmap.shader index e19270d39..50d375efe 100644 --- a/files/materials/watersim_heightmap.shader +++ b/files/materials/watersim_heightmap.shader @@ -1,6 +1,6 @@ #include "core.h" -#define DAMPING 0.92 +#define DAMPING 0.95 #include "watersim_common.h"