|
@@ -8396,8 +8396,8 @@ var BABYLON;
|
|
|
* @param result defines the target matrix
|
|
|
*/
|
|
|
Matrix.RotationYawPitchRollToRef = function (yaw, pitch, roll, result) {
|
|
|
- Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, this._tempQuaternion);
|
|
|
- this._tempQuaternion.toRotationMatrix(result);
|
|
|
+ Quaternion.RotationYawPitchRollToRef(yaw, pitch, roll, MathTmp.Quaternion[0]);
|
|
|
+ MathTmp.Quaternion[0].toRotationMatrix(result);
|
|
|
};
|
|
|
/**
|
|
|
* Creates a scaling matrix
|
|
@@ -8997,7 +8997,6 @@ var BABYLON;
|
|
|
result.m[15] = 1.0;
|
|
|
result._markAsUpdated();
|
|
|
};
|
|
|
- Matrix._tempQuaternion = new Quaternion();
|
|
|
Matrix._xAxis = Vector3.Zero();
|
|
|
Matrix._yAxis = Vector3.Zero();
|
|
|
Matrix._zAxis = Vector3.Zero();
|
|
@@ -19274,7 +19273,7 @@ var BABYLON;
|
|
|
this.reConstruct(min, max, worldMatrix);
|
|
|
}
|
|
|
/**
|
|
|
- * Recreates the entire bounding sphere from scratch
|
|
|
+ * Recreates the entire bounding sphere from scratch as if we call the constructor in place
|
|
|
* @param min defines the new minimum vector (in local space)
|
|
|
* @param max defines the new maximum vector (in local space)
|
|
|
* @param worldMatrix defines the new world matrix
|
|
@@ -19298,9 +19297,16 @@ var BABYLON;
|
|
|
var tempRadiusVector = tmpVectors[0].setAll(newRadius);
|
|
|
var min = this.center.subtractToRef(tempRadiusVector, tmpVectors[1]);
|
|
|
var max = this.center.addToRef(tempRadiusVector, tmpVectors[2]);
|
|
|
- this.reConstruct(min, max);
|
|
|
+ this.reConstruct(min, max, this._worldMatrix);
|
|
|
return this;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Gets the world matrix of the bounding box
|
|
|
+ * @returns a matrix
|
|
|
+ */
|
|
|
+ BoundingSphere.prototype.getWorldMatrix = function () {
|
|
|
+ return this._worldMatrix;
|
|
|
+ };
|
|
|
// Methods
|
|
|
/** @hidden */
|
|
|
BoundingSphere.prototype._update = function (worldMatrix) {
|
|
@@ -19424,7 +19430,7 @@ var BABYLON;
|
|
|
}
|
|
|
// Methods
|
|
|
/**
|
|
|
- * Recreates the entire bounding box from scratch
|
|
|
+ * Recreates the entire bounding box from scratch as if we call the constructor in place
|
|
|
* @param min defines the new minimum vector (in local space)
|
|
|
* @param max defines the new maximum vector (in local space)
|
|
|
* @param worldMatrix defines the new world matrix
|
|
@@ -19445,7 +19451,7 @@ var BABYLON;
|
|
|
// OBB
|
|
|
max.addToRef(min, this.center).scaleInPlace(0.5);
|
|
|
max.subtractToRef(min, this.extendSize).scaleInPlace(0.5);
|
|
|
- this._update(worldMatrix || this._worldMatrix || BABYLON.Matrix.Identity());
|
|
|
+ this._update(worldMatrix || BABYLON.Matrix.IdentityReadOnly);
|
|
|
};
|
|
|
/**
|
|
|
* Scale the current bounding box by applying a scale factor
|
|
@@ -19461,7 +19467,7 @@ var BABYLON;
|
|
|
var newRadius = diff.scaleInPlace(distance * 0.5);
|
|
|
var min = this.center.subtractToRef(newRadius, tmpVectors[1]);
|
|
|
var max = this.center.addToRef(newRadius, tmpVectors[2]);
|
|
|
- this.reConstruct(min, max);
|
|
|
+ this.reConstruct(min, max, this._worldMatrix);
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -19471,15 +19477,6 @@ var BABYLON;
|
|
|
BoundingBox.prototype.getWorldMatrix = function () {
|
|
|
return this._worldMatrix;
|
|
|
};
|
|
|
- /**
|
|
|
- * Sets the world matrix stored in the bounding box
|
|
|
- * @param matrix defines the matrix to store
|
|
|
- * @returns current bounding box
|
|
|
- */
|
|
|
- BoundingBox.prototype.setWorldMatrix = function (matrix) {
|
|
|
- this._worldMatrix.copyFrom(matrix);
|
|
|
- return this;
|
|
|
- };
|
|
|
/** @hidden */
|
|
|
BoundingBox.prototype._update = function (world) {
|
|
|
var minWorld = this.minimumWorld;
|
|
@@ -19655,22 +19652,21 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
- var computeBoxExtents = function (axis, box) {
|
|
|
+ var _result0 = { min: 0, max: 0 };
|
|
|
+ var _result1 = { min: 0, max: 0 };
|
|
|
+ var computeBoxExtents = function (axis, box, result) {
|
|
|
var p = BABYLON.Vector3.Dot(box.centerWorld, axis);
|
|
|
var r0 = Math.abs(BABYLON.Vector3.Dot(box.directions[0], axis)) * box.extendSize.x;
|
|
|
var r1 = Math.abs(BABYLON.Vector3.Dot(box.directions[1], axis)) * box.extendSize.y;
|
|
|
var r2 = Math.abs(BABYLON.Vector3.Dot(box.directions[2], axis)) * box.extendSize.z;
|
|
|
var r = r0 + r1 + r2;
|
|
|
- return {
|
|
|
- min: p - r,
|
|
|
- max: p + r
|
|
|
- };
|
|
|
+ result.min = p - r;
|
|
|
+ result.max = p + r;
|
|
|
};
|
|
|
- var extentsOverlap = function (min0, max0, min1, max1) { return !(min0 > max1 || min1 > max0); };
|
|
|
var axisOverlap = function (axis, box0, box1) {
|
|
|
- var result0 = computeBoxExtents(axis, box0);
|
|
|
- var result1 = computeBoxExtents(axis, box1);
|
|
|
- return extentsOverlap(result0.min, result0.max, result1.min, result1.max);
|
|
|
+ computeBoxExtents(axis, box0, _result0);
|
|
|
+ computeBoxExtents(axis, box1, _result1);
|
|
|
+ return !(_result0.min > _result1.max || _result1.min > _result0.max);
|
|
|
};
|
|
|
/**
|
|
|
* Info for a bounding data of a mesh
|
|
@@ -19688,7 +19684,7 @@ var BABYLON;
|
|
|
this.boundingSphere = new BABYLON.BoundingSphere(minimum, maximum, worldMatrix);
|
|
|
}
|
|
|
/**
|
|
|
- * Recreates the entire bounding info from scratch
|
|
|
+ * Recreates the entire bounding info from scratch as if we call the constructor in place
|
|
|
* @param min defines the new minimum vector (in local space)
|
|
|
* @param max defines the new maximum vector (in local space)
|
|
|
* @param worldMatrix defines the new world matrix
|
|
@@ -19751,8 +19747,8 @@ var BABYLON;
|
|
|
BoundingInfo.prototype.centerOn = function (center, extend) {
|
|
|
var minimum = BoundingInfo.TmpVector3[0].copyFrom(center).subtractInPlace(extend);
|
|
|
var maximum = BoundingInfo.TmpVector3[1].copyFrom(center).addInPlace(extend);
|
|
|
- this.boundingBox.reConstruct(minimum, maximum);
|
|
|
- this.boundingSphere.reConstruct(minimum, maximum);
|
|
|
+ this.boundingBox.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
|
|
|
+ this.boundingSphere.reConstruct(minimum, maximum, this.boundingBox.getWorldMatrix());
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -19832,9 +19828,6 @@ var BABYLON;
|
|
|
* @returns if the bounding info intersects
|
|
|
*/
|
|
|
BoundingInfo.prototype.intersects = function (boundingInfo, precise) {
|
|
|
- if (!this.boundingSphere.centerWorld || !boundingInfo.boundingSphere.centerWorld) {
|
|
|
- return false;
|
|
|
- }
|
|
|
if (!BABYLON.BoundingSphere.Intersects(this.boundingSphere, boundingInfo.boundingSphere)) {
|
|
|
return false;
|
|
|
}
|
|
@@ -27134,6 +27127,9 @@ var BABYLON;
|
|
|
evt.preventDefault();
|
|
|
canvas.focus();
|
|
|
}
|
|
|
+ _this._startingPointerPosition.x = _this._pointerX;
|
|
|
+ _this._startingPointerPosition.y = _this._pointerY;
|
|
|
+ _this._startingPointerTime = Date.now();
|
|
|
// PreObservable support
|
|
|
if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
|
|
|
return;
|
|
@@ -27142,9 +27138,6 @@ var BABYLON;
|
|
|
return;
|
|
|
}
|
|
|
_this._pointerCaptures[evt.pointerId] = true;
|
|
|
- _this._startingPointerPosition.x = _this._pointerX;
|
|
|
- _this._startingPointerPosition.y = _this._pointerY;
|
|
|
- _this._startingPointerTime = Date.now();
|
|
|
if (!_this.pointerDownPredicate) {
|
|
|
_this.pointerDownPredicate = function (mesh) {
|
|
|
return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.isEnabled();
|