From 3c178f9aeaf9117f1f90ed5e6c480d026bd5d4a4 Mon Sep 17 00:00:00 2001 From: Ludovic 'Archivist' Lagouardette Date: Mon, 11 May 2020 02:16:56 +0200 Subject: [PATCH] rendering vectors now with colors --- include/gp/math.hpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/include/gp/math.hpp b/include/gp/math.hpp index 497cd93..93af11a 100644 --- a/include/gp/math.hpp +++ b/include/gp/math.hpp @@ -109,6 +109,16 @@ namespace gp { T y; T z; + T& r(){ + return x; + } + T& g(){ + return y; + } + T& b(){ + return z; + } + vec3_g() : x{} , y{} @@ -174,6 +184,19 @@ namespace gp { T z; T w; + T& r(){ + return x; + } + T& g(){ + return y; + } + T& b(){ + return z; + } + T& a(){ + return w; + } + vec4_g() : x{} , y{} @@ -268,4 +291,7 @@ namespace gp { vec4_g operator*(T v, vec4_g p) { return p*v; } -} \ No newline at end of file +} + +static_assert(sizeof(gp::vec3_g) == sizeof(int)*3, "vec3_g has strange alignment"); +static_assert(sizeof(gp::vec4_g) == sizeof(int)*4, "vec4_g has strange alignment"); \ No newline at end of file