diff --git a/src/logic/scripting/lua/usertypes/lua_type_heightmap.cpp b/src/logic/scripting/lua/usertypes/lua_type_heightmap.cpp index 9286467d3..df2af6106 100644 --- a/src/logic/scripting/lua/usertypes/lua_type_heightmap.cpp +++ b/src/logic/scripting/lua/usertypes/lua_type_heightmap.cpp @@ -264,6 +264,12 @@ static std::unordered_map methods { {"min", lua::wrap>}, {"max", lua::wrap>}, {"abs", lua::wrap>}, + {"floor", lua::wrap>}, + {"round", lua::wrap>}, + {"ceil", lua::wrap>}, + {"sin", lua::wrap>}, + {"cos", lua::wrap>}, + {"tan", lua::wrap>}, {"resize", lua::wrap}, {"crop", lua::wrap}, {"at", lua::wrap}, diff --git a/src/util/functional_util.hpp b/src/util/functional_util.hpp index 2672c4fcf..874cc6709 100644 --- a/src/util/functional_util.hpp +++ b/src/util/functional_util.hpp @@ -3,31 +3,26 @@ #include namespace util { - template - struct pow { - constexpr T operator()(T a, T b) const { - return glm::pow(a, b); - } + template + struct binary_op { + constexpr T operator()(T a, T b) const { return F(a, b); } }; - template - struct min { - constexpr T operator()(T a, T b) const { - return glm::min(a, b); - } + template using pow = binary_op; + template using min = binary_op; + template using max = binary_op; + + + template + struct unary_op { + constexpr T operator()(T a) const { return F(a); } }; - template - struct max { - constexpr T operator()(T a, T b) const { - return glm::max(a, b); - } - }; - - template - struct abs { - constexpr T operator()(T a) const { - return glm::abs(a); - } - }; + template using abs = unary_op; + template using floor = unary_op; + template using round = unary_op; + template using ceil = unary_op; + template using sin = unary_op; + template using cos = unary_op; + template using tan = unary_op; }