[Bf-blender-cvs] [6ac0a3d83c8] blender-v2.92-release: BLI: add conversion from float2 to float3

Jacques Lucke noreply at git.blender.org
Fri Jan 22 12:17:08 CET 2021


Commit: 6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82
Author: Jacques Lucke
Date:   Fri Jan 22 12:16:53 2021 +0100
Branches: blender-v2.92-release
https://developer.blender.org/rB6ac0a3d83c8e5a39bd5356aa0d68e3166bd91e82

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.

===================================================================

M	source/blender/blenlib/BLI_float2.hh

===================================================================

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);



More information about the Bf-blender-cvs mailing list