diff --git a/src/matrix.h b/src/matrix.h index ff4aa579..767b2e63 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -20,6 +20,7 @@ template struct Vector2 { Vector2() { x = y = 0; } Vector2(T _x, T _y) { x = _x; y = _y; } + T& operator[](int n) { return *(&x + n); } union { T x; T a; T i; }; union { T y; T b; T j; }; @@ -32,6 +33,7 @@ template struct Vector3 { Vector3() { x = y = z = 0; } Vector3(T _x, T _y, T _z) { x = _x; y = _y; z = _z; } + T& operator[](int n) { return *(&x + n); } union { T x; T a; T i; }; union { T y; T b; T j; };