summaryrefslogtreecommitdiff
path: root/Runtime/mecanim/animation/damp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/mecanim/animation/damp.cpp')
-rw-r--r--Runtime/mecanim/animation/damp.cpp24
1 files changed, 24 insertions, 0 deletions
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);
+ }
+}
+
+}