Browse Source

Allow to access Int2, Float2 etc. members using [].

legacy
Sam Hocevar sam 14 years ago
parent
commit
dc9b607923
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/matrix.h

+ 2
- 0
src/matrix.h View File

@@ -20,6 +20,7 @@ template <typename T> 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 <typename T> 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; };


Loading…
Cancel
Save