diff options
author | Jacques Lucke <jacques@blender.org> | 2021-01-22 14:16:53 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-01-22 14:16:53 +0300 |
commit | 6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82 (patch) | |
tree | 6f427ec6a2f101a7c728687ea43a5e909a5fc07b /source/blender/blenlib/BLI_float2.hh | |
parent | cd8893d4463ab8e076adcb2085d7f3eab8c3c926 (diff) |
BLI: add conversion from float2 to float3
Previously float2 was converted to float3 by implicitly converting to a
float pointer first, which was then passed to the float3 constructor.
This leads to uninitialized memory in the z component of the new float3.
Diffstat (limited to 'source/blender/blenlib/BLI_float2.hh')
-rw-r--r-- | source/blender/blenlib/BLI_float2.hh | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_float2.hh b/source/blender/blenlib/BLI_float2.hh index 2a5320e4c35..697721db8c7 100644 --- a/source/blender/blenlib/BLI_float2.hh +++ b/source/blender/blenlib/BLI_float2.hh @@ -47,6 +47,11 @@ struct float2 { return &x; } + operator float3() const + { + return float3(x, y, 0.0f); + } + float length() const { return len_v2(*this); |