[Bf-blender-cvs] [b34235a2ebf] soc-2021-adaptive-cloth: bli: float2x2: multiply matrix with float

ishbosamiya noreply at git.blender.org
Mon Jul 19 17:35:44 CEST 2021


Commit: b34235a2ebfe232c2281d83e7e6c1aba264c5833
Author: ishbosamiya
Date:   Fri Jul 16 20:52:23 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rBb34235a2ebfe232c2281d83e7e6c1aba264c5833

bli: float2x2: multiply matrix with float

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

M	source/blender/blenlib/BLI_float2x2.hh

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

diff --git a/source/blender/blenlib/BLI_float2x2.hh b/source/blender/blenlib/BLI_float2x2.hh
index b79adeb9af5..70090ea44ad 100644
--- a/source/blender/blenlib/BLI_float2x2.hh
+++ b/source/blender/blenlib/BLI_float2x2.hh
@@ -82,6 +82,21 @@ struct float2x2 {
     return m * float2(v);
   }
 
+  /**
+   * Multiplies all the elements of `m` with `val`
+   */
+  friend float2x2 operator*(const float2x2 &m, const float val)
+  {
+    float2x2 res;
+
+    res.ptr()[0][0] = m.ptr()[0][0] * val;
+    res.ptr()[0][1] = m.ptr()[0][1] * val;
+    res.ptr()[1][0] = m.ptr()[1][0] * val;
+    res.ptr()[1][1] = m.ptr()[1][1] * val;
+
+    return res;
+  }
+
   friend float2x2 operator+(const float2x2 &m1, const float2x2 &m2)
   {
     float2x2 res;



More information about the Bf-blender-cvs mailing list