add vec2 * mat4 multiplication

This commit is contained in:
Konstantin Käfer
2014-05-21 19:23:20 +02:00
parent 53a6992728
commit ab4bc4ae30

View File

@@ -5,6 +5,7 @@
#include <type_traits>
#include <cmath>
#include <cstdint>
#include <array>
namespace llmr {
@@ -47,6 +48,10 @@ struct vec2 {
y *= o;
}
inline vec2<T> operator *(const std::array<float, 16>& matrix) {
return { x * matrix[0] + y * matrix[4] + matrix[12], x * matrix[1] + y * matrix[5] + matrix[13] };
}
template <typename O>
inline typename std::enable_if<std::is_arithmetic<O>::value, vec2>::type
operator-(O o) const {