Selaa lähdekoodia

prevent useless Vector2 creation in Geometry.boundingBias setter

Julien Barrois 7 vuotta sitten
vanhempi
commit
7f3d6fb1ad
1 muutettua tiedostoa jossa 7 lisäystä ja 4 poistoa
  1. 7 4
      src/Mesh/babylon.geometry.ts

+ 7 - 4
src/Mesh/babylon.geometry.ts

@@ -61,11 +61,14 @@
          *  Gets or sets the Bias Vector to apply on the bounding elements (box/sphere), the max extend is computed as v += v * bias.x + bias.y, the min is computed as v -= v * bias.x + bias.y
          */
         public set boundingBias(value: Vector2) {
-            if (this._boundingBias && this._boundingBias.equals(value)) {
-                return;
+            if (this._boundingBias) {
+                if (this._boundingBias.equals(value))
+                    return;
+                this._boundingBias.copyFrom(value);
+            }
+            else {
+                this._boundingBias = value.clone();
             }
-
-            this._boundingBias = value.clone();
 
             this._updateBoundingInfo(true, null);
         }