From 15740faf9fe9fe4be08965098bbf2947e096aeeb Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 14 Aug 2019 22:50:43 +0800 Subject: +Unity Runtime code --- Runtime/mecanim/animation/damp.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Runtime/mecanim/animation/damp.cpp (limited to 'Runtime/mecanim/animation/damp.cpp') diff --git a/Runtime/mecanim/animation/damp.cpp b/Runtime/mecanim/animation/damp.cpp new file mode 100644 index 0000000..c769108 --- /dev/null +++ b/Runtime/mecanim/animation/damp.cpp @@ -0,0 +1,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); + } +} + +} -- cgit v1.1-26-g67d0