summaryrefslogtreecommitdiff
path: root/Runtime/mecanim/animation/damp.cpp
blob: c7691087a6414e64d5939f6408bc935b01673a90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "UnityPrefix.h"
#include "Runtime/Math/Simd/math.h"
#include "Runtime/mecanim/animation/damp.h"

namespace mecanim
{

namespace dynamics
{
	void ScalDamp::Evaluate(float value, float deltaTime)
	{
		m_Value = math::cond(m_DampTime > 0, m_Value + (value - m_Value) * math::abs(deltaTime) / (m_DampTime + math::abs(deltaTime)), value);
	}

	void VectorDamp::Evaluate(math::float4 const& value, float deltaTime)
	{
		math::float1 dt(deltaTime);
		math::float1 dampTime(m_DampTime);

		m_Value = math::cond( math::bool4(m_DampTime > 0), m_Value + (value - m_Value) * math::abs(dt) / (dampTime + math::abs(dt)), value);
	}
}

}