|
@@ -18151,6 +18151,19 @@ var BABYLON;
|
|
|
this.centerWorld = BABYLON.Vector3.Zero();
|
|
|
this._update(BABYLON.Matrix.Identity());
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Scale the current bounding sphere by applying a scale factor
|
|
|
+ * @param factor defines the scale factor to apply
|
|
|
+ * @returns the current bounding box
|
|
|
+ */
|
|
|
+ BoundingSphere.prototype.scale = function (factor) {
|
|
|
+ var newRadius = this.radius * factor;
|
|
|
+ var newRadiusVector = new BABYLON.Vector3(newRadius, newRadius, newRadius);
|
|
|
+ var min = this.center.subtract(newRadiusVector);
|
|
|
+ var max = this.center.add(newRadiusVector);
|
|
|
+ this.reConstruct(min, max);
|
|
|
+ return this;
|
|
|
+ };
|
|
|
// Methods
|
|
|
BoundingSphere.prototype._update = function (world) {
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this.center, world, this.centerWorld);
|
|
@@ -18241,6 +18254,21 @@ var BABYLON;
|
|
|
this.extendSizeWorld = BABYLON.Vector3.Zero();
|
|
|
this._update(this._worldMatrix || BABYLON.Matrix.Identity());
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Scale the current bounding box by applying a scale factor
|
|
|
+ * @param factor defines the scale factor to apply
|
|
|
+ * @returns the current bounding box
|
|
|
+ */
|
|
|
+ BoundingBox.prototype.scale = function (factor) {
|
|
|
+ var diff = this.maximum.subtract(this.minimum);
|
|
|
+ var distance = diff.length() * factor;
|
|
|
+ diff.normalize();
|
|
|
+ var newRadius = diff.scale(distance / 2);
|
|
|
+ var min = this.center.subtract(newRadius);
|
|
|
+ var max = this.center.add(newRadius);
|
|
|
+ this.reConstruct(min, max);
|
|
|
+ return this;
|
|
|
+ };
|
|
|
BoundingBox.prototype.getWorldMatrix = function () {
|
|
|
return this._worldMatrix;
|
|
|
};
|
|
@@ -18411,6 +18439,16 @@ var BABYLON;
|
|
|
this.boundingSphere = new BABYLON.BoundingSphere(this.minimum, this.maximum);
|
|
|
return this;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Scale the current bounding info by applying a scale factor
|
|
|
+ * @param factor defines the scale factor to apply
|
|
|
+ * @returns the current bounding info
|
|
|
+ */
|
|
|
+ BoundingInfo.prototype.scale = function (factor) {
|
|
|
+ this.boundingBox.scale(factor);
|
|
|
+ this.boundingSphere.scale(factor);
|
|
|
+ return this;
|
|
|
+ };
|
|
|
BoundingInfo.prototype.isInFrustum = function (frustumPlanes) {
|
|
|
if (!this.boundingSphere.isInFrustum(frustumPlanes))
|
|
|
return false;
|