forked from mirror/openmw-tes3mp
Don't emit if there wasn't enough movement
This commit is contained in:
parent
5b099393fa
commit
01102f9c73
6 changed files with 24 additions and 5 deletions
|
@ -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 =
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "core.h"
|
||||
|
||||
#define DAMPING 0.92
|
||||
#define DAMPING 0.95
|
||||
|
||||
#include "watersim_common.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue