Веб-сайт самохостера Lotigara

summaryrefslogtreecommitdiff
path: root/source/core/StarMatrix3.hpp
diff options
context:
space:
mode:
authorKae <80987908+Novaenia@users.noreply.github.com>2024-04-15 17:46:44 +1000
committerKae <80987908+Novaenia@users.noreply.github.com>2024-04-15 17:46:44 +1000
commit63c9e3ec8b51a9d96872a054a0d35e8591b3535d (patch)
tree7d5cfaea0e13eb34cc6db25df6054cae1a04677c /source/core/StarMatrix3.hpp
parent2a4bd826052102a0bb8858355e42b9cba06f2991 (diff)
only round vertices if AA is on
[skip ci]
Diffstat (limited to 'source/core/StarMatrix3.hpp')
-rw-r--r--source/core/StarMatrix3.hpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/source/core/StarMatrix3.hpp b/source/core/StarMatrix3.hpp
index 04d8005..8cdd2d5 100644
--- a/source/core/StarMatrix3.hpp
+++ b/source/core/StarMatrix3.hpp
@@ -110,6 +110,8 @@ public:
template <typename T2>
Vec3 operator*(Vector<T2, 3> const& v) const;
+ template <typename T2>
+ Vec2 operator*(Vector<T2, 2> const& v) const;
private:
Rows m_rows;
};
@@ -304,8 +306,7 @@ void Matrix3<T>::scale(T scale, Vec2 const& point) {
template <typename T>
template <typename T2>
Vector<T2, 2> Matrix3<T>::transformVec2(Vector<T2, 2> const& point) const {
- Vector<T2, 3> res = (*this) * Vector<T2, 3>(point, 1);
- return res.vec2();
+ return (*this) * point;
}
template <typename T>
@@ -413,6 +414,13 @@ auto Matrix3<T>::operator*(const Vector<T2, 3>& u) const -> Vec3 {
}
template <typename T>
+template <typename T2>
+auto Matrix3<T>::operator*(const Vector<T2, 2>& u) const -> Vec2 {
+ return Vec2(m_rows[0][0] * u[0] + m_rows[0][1] * u[1] + m_rows[0][2],
+ m_rows[1][0] * u[0] + m_rows[1][1] * u[1] + m_rows[1][2]);
+}
+
+template <typename T>
Matrix3<T> Matrix3<T>::operator/(const T& s) const {
return Matrix3<T>(m_rows[0] / s, m_rows[1] / s, m_rows[2] / s);
}