diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 17:00:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-05-08 17:00:52 +0400 |
commit | 562ed2b42e7ad8298bd5f041124ed2208c3a7a7c (patch) | |
tree | c006fdb389d4596ffa6eddb6ac0ffc670cb192bf /source/blender/blenlib/BLI_math_base.h | |
parent | a4634bfe6725be8c1d56588d2f1660ee08cb11ad (diff) |
add in asserts when rv3d->viewmatob, rv3d->persmatob are not initialized.
This is often hard to spot since in many cases it works correctly even
when not initialized but may still fail in other situations.
Diffstat (limited to 'source/blender/blenlib/BLI_math_base.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index 04cf0b9d275..4b71babdba1 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -245,9 +245,19 @@ double double_round(double x, int ndigits); BLI_assert((fabsf(_test_unit - 1.0f) < BLI_ASSERT_UNIT_EPSILON) || \ (fabsf(_test_unit) < BLI_ASSERT_UNIT_EPSILON)); \ } (void)0 + +# define BLI_ASSERT_ZERO_M3(m) { \ + BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 9) != 0.0); \ +} (void)0 + +# define BLI_ASSERT_ZERO_M4(m) { \ + BLI_assert(dot_vn_vn((const float *)m, (const float *)m, 16) != 0.0); \ +} (void)0 #else -# define BLI_ASSERT_UNIT_V2(v) (void)0 -# define BLI_ASSERT_UNIT_V3(v) (void)0 +# define BLI_ASSERT_UNIT_V2(v) (void)(v) +# define BLI_ASSERT_UNIT_V3(v) (void)(v) +# define BLI_ASSERT_ZERO_M3(m) (void)(m) +# define BLI_ASSERT_ZERO_M4(m) (void)(m) #endif #endif /* __BLI_MATH_BASE_H__ */ |