diff options
author | Jacques Lucke <jacques@blender.org> | 2020-07-31 12:17:21 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2020-07-31 12:17:33 +0300 |
commit | f379bb368bf57b97eb6b10a009ecb80cbc57159f (patch) | |
tree | 697b1eddfb2ae199559f0941dedb9f94bf82236f /source/blender/blenlib | |
parent | 585c9c2f23d76ffe29997f2beb149fb363ef35fa (diff) |
BLI: fix float3 in-place operators
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_float3.hh | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenlib/BLI_float3.hh b/source/blender/blenlib/BLI_float3.hh index a0979bc75bd..6acf4716525 100644 --- a/source/blender/blenlib/BLI_float3.hh +++ b/source/blender/blenlib/BLI_float3.hh @@ -63,11 +63,12 @@ struct float3 { return {a.x + b.x, a.y + b.y, a.z + b.z}; } - void operator+=(const float3 &b) + float3 &operator+=(const float3 &b) { this->x += b.x; this->y += b.y; this->z += b.z; + return *this; } friend float3 operator-(const float3 &a, const float3 &b) @@ -80,25 +81,28 @@ struct float3 { return {-a.x, -a.y, -a.z}; } - void operator-=(const float3 &b) + float3 &operator-=(const float3 &b) { this->x -= b.x; this->y -= b.y; this->z -= b.z; + return *this; } - void operator*=(float scalar) + float3 &operator*=(float scalar) { this->x *= scalar; this->y *= scalar; this->z *= scalar; + return *this; } - void operator*=(const float3 &other) + float3 &operator*=(const float3 &other) { this->x *= other.x; this->y *= other.y; this->z *= other.z; + return *this; } friend float3 operator*(const float3 &a, const float3 &b) |