jak-project/common/util/FilteredValue.h
water111 a8342aef31
[graphics] TIE extractor (#1026)
* temp

* temp

* wip

* more progress on the instance asm

* first half of tie extraction, up to dma lists

* more tie extraction

* first part figured out maybe

* bp1 loop seems to work, bp2 loop does not

* bp1 and bp2 appear working. sadly ip is needed

* ip1 outline, not working ip2

* just kidding, ip2 seems to work

* extraction seems to work

* basic rendering working

* tie fixes

* performance optimization of tie renderer

* hook up tie to engine

* fix more bugs

* cleanup and perf improvements

* fix tests

* ref tests

* mm256i for gcc

* CLANG

* windows

* more compile fixes

* fix fast time of day

* small fixes

* fix after merge

* clang
2021-12-26 12:33:51 -05:00

17 lines
382 B
C++

#pragma once
template <typename T>
class Filtered {
public:
Filtered(const T& alpha = 0.9) : m_val(T(0)), m_alpha(alpha) {}
Filtered(const T& v, const T& alpha) : m_val(v), m_alpha(alpha) {}
const T& add(const T& v) {
m_val = (m_val * m_alpha) + (v * (T(1) - m_alpha));
return m_val;
}
const T& get() const { return m_val; }
private:
T m_val;
T m_alpha;
};