[Bf-blender-cvs] [249115583cc] soc-2021-adaptive-cloth: adaptive_cloth: AdaptiveMesh: Sizing: overload add and mul ops

ishbosamiya noreply at git.blender.org
Mon Jul 26 08:17:43 CEST 2021


Commit: 249115583cc2e8498e2b7a139c243d292afa19fe
Author: ishbosamiya
Date:   Thu Jul 22 17:27:11 2021 +0530
Branches: soc-2021-adaptive-cloth
https://developer.blender.org/rB249115583cc2e8498e2b7a139c243d292afa19fe

adaptive_cloth: AdaptiveMesh: Sizing: overload add and mul ops

Overload the operators to allow operations on `Sizing` itself. This
will help in case `Sizing` will need to change in the future maybe for
adaptive tearing support.

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

M	source/blender/blenkernel/intern/cloth_remesh.cc

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

diff --git a/source/blender/blenkernel/intern/cloth_remesh.cc b/source/blender/blenkernel/intern/cloth_remesh.cc
index ed6686aa72a..47067ea7cbb 100644
--- a/source/blender/blenkernel/intern/cloth_remesh.cc
+++ b/source/blender/blenkernel/intern/cloth_remesh.cc
@@ -195,6 +195,21 @@ class Sizing {
   {
     return Sizing(this->m.linear_blend(other.get_m(), 0.5));
   }
+
+  friend Sizing operator+(const Sizing &a, const Sizing &b)
+  {
+    return Sizing(a.get_m() + b.get_m());
+  }
+
+  friend Sizing operator*(const Sizing &a, float val)
+  {
+    return Sizing(a.get_m() * val);
+  }
+
+  friend float2 operator*(const Sizing &sizing, const float2 &v)
+  {
+    return sizing.get_m() * v;
+  }
 };
 
 enum VertFlags {



More information about the Bf-blender-cvs mailing list