summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-11-18 20:39:54 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2022-11-18 20:39:54 +0000
commitba770a85b2b0ff9222e2867689c693ebee841e55 (patch)
tree179908c62b1ca5d18c9d7c33a3aa641002b479e8 /lib
parentSimplified texture save (diff)
downloadilt-ba770a85b2b0ff9222e2867689c693ebee841e55.tar.bz2
ilt-ba770a85b2b0ff9222e2867689c693ebee841e55.tar.xz
ilt-ba770a85b2b0ff9222e2867689c693ebee841e55.zip
Rename rdiv to ratio and add a vec2 override
Diffstat (limited to 'lib')
-rw-r--r--lib/maths.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/maths.h b/lib/maths.h
index 514a5ad..1c07baa 100644
--- a/lib/maths.h
+++ b/lib/maths.h
@@ -67,11 +67,18 @@ sq(T v)
template<typename R = float, typename Ta, typename Tb>
inline constexpr auto
-rdiv(Ta a, Tb b)
+ratio(Ta a, Tb b)
{
return (static_cast<R>(a) / static_cast<R>(b));
}
+template<typename R = float, typename T, glm::qualifier Q>
+inline constexpr auto
+ratio(glm::vec<2, T, Q> v)
+{
+ return ratio<R>(v.x, v.y);
+}
+
constexpr inline glm::vec2
operator!(const glm::vec3 & v)
{