Просмотр исходного кода

Merge pull request #5218 from barroij/setBoundingBiasPerfIssue

Geometry.BoundingBias setter per issue
David Catuhe 7 лет назад
Родитель
Сommit
a0ac9b9002
1 измененных файлов с 8 добавлено и 4 удалено
  1. 8 4
      src/Mesh/babylon.geometry.ts

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

@@ -61,11 +61,15 @@
          *  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
          *  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) {
         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);
             this._updateBoundingInfo(true, null);
         }
         }