Browse Source

math: make swizzling parameters readable in base 10 so that we understand

what's going on in the debugger.
undefined
Sam Hocevar 10 years ago
parent
commit
29dd656a78
3 changed files with 497 additions and 491 deletions
  1. +1
    -2
      src/lol/base/types.h
  2. +491
    -489
      src/lol/math/vector.h
  3. +5
    -0
      test/unit/vector.cpp

+ 1
- 2
src/lol/base/types.h View File

@@ -31,8 +31,7 @@ class half;
* Forward declaration of vec_t, mat_t, cmplx_t, quat_t
*/

int const FULL_SWIZZLE = 0xaaaa;
int const NO_SWIZZLE = 0xbbbb;
int const FULL_SWIZZLE = 0;

template<typename T, int N, int SWIZZLE = FULL_SWIZZLE> struct vec_t;
template<typename T, int COLS, int ROWS> struct mat_t;


+ 491
- 489
src/lol/math/vector.h
File diff suppressed because it is too large
View File


+ 5
- 0
test/unit/vector.cpp View File

@@ -138,6 +138,11 @@ LOLUNIT_FIXTURE(VectorTest)
LOLUNIT_ASSERT_EQUAL(c.y, 2.0f);
LOLUNIT_ASSERT_EQUAL(c.z, 3.0f);

c = a.zyx;
LOLUNIT_ASSERT_EQUAL(c.x, 3.0f);
LOLUNIT_ASSERT_EQUAL(c.y, 2.0f);
LOLUNIT_ASSERT_EQUAL(c.z, 1.0f);

#if 0 /* Visual Studio doesn't support these yet. */
c = a;
c.xy = b.yz;


Loading…
Cancel
Save