mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-08 04:21:50 +00:00
add new methods to Heightmap
This commit is contained in:
parent
021e00422b
commit
ab0768be68
2 changed files with 24 additions and 23 deletions
|
|
@ -3,31 +3,26 @@
|
|||
#include <glm/glm.hpp>
|
||||
|
||||
namespace util {
|
||||
template<class T>
|
||||
struct pow {
|
||||
constexpr T operator()(T a, T b) const {
|
||||
return glm::pow(a, b);
|
||||
}
|
||||
template<class T, T (*F)(T, T)>
|
||||
struct binary_op {
|
||||
constexpr T operator()(T a, T b) const { return F(a, b); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct min {
|
||||
constexpr T operator()(T a, T b) const {
|
||||
return glm::min(a, b);
|
||||
}
|
||||
template<class T> using pow = binary_op<T, glm::pow>;
|
||||
template<class T> using min = binary_op<T, glm::min>;
|
||||
template<class T> using max = binary_op<T, glm::max>;
|
||||
|
||||
|
||||
template<class T, T (*F)(T)>
|
||||
struct unary_op {
|
||||
constexpr T operator()(T a) const { return F(a); }
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct max {
|
||||
constexpr T operator()(T a, T b) const {
|
||||
return glm::max(a, b);
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct abs {
|
||||
constexpr T operator()(T a) const {
|
||||
return glm::abs(a);
|
||||
}
|
||||
};
|
||||
template<typename T> using abs = unary_op<T, glm::abs>;
|
||||
template<typename T> using floor = unary_op<T, glm::floor>;
|
||||
template<typename T> using round = unary_op<T, glm::round>;
|
||||
template<typename T> using ceil = unary_op<T, glm::ceil>;
|
||||
template<typename T> using sin = unary_op<T, glm::sin>;
|
||||
template<typename T> using cos = unary_op<T, glm::cos>;
|
||||
template<typename T> using tan = unary_op<T, glm::tan>;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue