From 562ed2b42e7ad8298bd5f041124ed2208c3a7a7c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 May 2013 13:00:52 +0000 Subject: 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. --- source/blender/blenlib/BLI_math_base.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'source/blender/blenlib/BLI_math_base.h') 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__ */ -- cgit v1.2.3