diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-05-13 15:05:52 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-05-13 15:05:52 +0400 |
commit | 305d341ec2c2c5c6485ad6cd719e9472e4bb460d (patch) | |
tree | fa4c658ad417869a0ed2e7ef5f37ca94adb2cc3b /source/blender/blenlib | |
parent | 13bbf1cc7b0a620173475172278d2f8eb9593ccd (diff) |
code cleanup: use vector math function minmax_v3v3_v3() and other minor vector function edits.
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_vector.h | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_geom.c | 2 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_vector_inline.c | 8 | ||||
-rw-r--r-- | source/blender/blenlib/intern/pbvh.c | 7 |
4 files changed, 13 insertions, 6 deletions
diff --git a/source/blender/blenlib/BLI_math_vector.h b/source/blender/blenlib/BLI_math_vector.h index d0f883e1c99..374da46a686 100644 --- a/source/blender/blenlib/BLI_math_vector.h +++ b/source/blender/blenlib/BLI_math_vector.h @@ -118,6 +118,8 @@ MINLINE void negate_v3_v3(float r[3], const float a[3]); MINLINE void negate_v4(float r[4]); MINLINE void negate_v4_v4(float r[4], const float a[3]); +MINLINE void negate_v3_short(short r[3]); + MINLINE float dot_v2v2(const float a[2], const float b[2]); MINLINE float dot_v3v3(const float a[3], const float b[3]); diff --git a/source/blender/blenlib/intern/math_geom.c b/source/blender/blenlib/intern/math_geom.c index 5f5321162c9..3962f53862d 100644 --- a/source/blender/blenlib/intern/math_geom.c +++ b/source/blender/blenlib/intern/math_geom.c @@ -2323,7 +2323,7 @@ void box_minmax_bounds_m4(float min[3], float max[3], float boundbox[2][3], floa vec[2] = (a & 4) ? boundbox[0][2] : boundbox[1][2]; mul_m4_v3(mat, vec); - DO_MINMAX(vec, mn, mx); + minmax_v3v3_v3(mn, mx, vec); } copy_v3_v3(min, mn); diff --git a/source/blender/blenlib/intern/math_vector_inline.c b/source/blender/blenlib/intern/math_vector_inline.c index ef8f26e3780..56188048c02 100644 --- a/source/blender/blenlib/intern/math_vector_inline.c +++ b/source/blender/blenlib/intern/math_vector_inline.c @@ -458,6 +458,14 @@ MINLINE void negate_v4_v4(float r[4], const float a[4]) r[3] = -a[3]; } +/* could add more... */ +MINLINE void negate_v3_short(short r[3]) +{ + r[0] = -r[0]; + r[1] = -r[1]; + r[2] = -r[2]; +} + MINLINE float dot_v2v2(const float a[2], const float b[2]) { return a[0] * b[0] + a[1] * b[1]; diff --git a/source/blender/blenlib/intern/pbvh.c b/source/blender/blenlib/intern/pbvh.c index d80f90ec41a..73a90fa53a0 100644 --- a/source/blender/blenlib/intern/pbvh.c +++ b/source/blender/blenlib/intern/pbvh.c @@ -1090,11 +1090,8 @@ static void pbvh_update_normals(PBVH *bvh, PBVHNode **nodes, copy_v3_v3(no, vnor[v]); normalize_v3(no); - - mvert->no[0] = (short)(no[0] * 32767.0f); - mvert->no[1] = (short)(no[1] * 32767.0f); - mvert->no[2] = (short)(no[2] * 32767.0f); - + normal_float_to_short_v3(mvert->no, no); + mvert->flag &= ~ME_VERT_PBVH_UPDATE; } } |