|
@@ -17651,6 +17651,12 @@ var BABYLON;
|
|
this._currentRenderId = -1;
|
|
this._currentRenderId = -1;
|
|
this._parentRenderId = -1;
|
|
this._parentRenderId = -1;
|
|
this._childRenderId = -1;
|
|
this._childRenderId = -1;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._worldMatrixWasUpdated = false;
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._worldMatrix = BABYLON.Matrix.Zero();
|
|
|
|
+ /** @hidden */
|
|
|
|
+ this._worldMatrixDeterminant = 0;
|
|
this._animationPropertiesOverride = null;
|
|
this._animationPropertiesOverride = null;
|
|
/**
|
|
/**
|
|
* An event triggered when the mesh is disposed
|
|
* An event triggered when the mesh is disposed
|
|
@@ -17855,16 +17861,30 @@ var BABYLON;
|
|
return null;
|
|
return null;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Returns the world matrix of the node
|
|
|
|
- * @returns a matrix containing the node's world matrix
|
|
|
|
|
|
+ * Returns the latest update of the World matrix
|
|
|
|
+ * @returns a Matrix
|
|
*/
|
|
*/
|
|
Node.prototype.getWorldMatrix = function () {
|
|
Node.prototype.getWorldMatrix = function () {
|
|
- return BABYLON.Matrix.Identity();
|
|
|
|
|
|
+ if (this._currentRenderId !== this.getScene().getRenderId()) {
|
|
|
|
+ this.computeWorldMatrix();
|
|
|
|
+ }
|
|
|
|
+ return this._worldMatrix;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
Node.prototype._getWorldMatrixDeterminant = function () {
|
|
Node.prototype._getWorldMatrixDeterminant = function () {
|
|
- return 1;
|
|
|
|
|
|
+ return this._worldMatrixDeterminant;
|
|
};
|
|
};
|
|
|
|
+ Object.defineProperty(Node.prototype, "worldMatrixFromCache", {
|
|
|
|
+ /**
|
|
|
|
+ * Returns directly the latest state of the mesh World matrix.
|
|
|
|
+ * A Matrix is returned.
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._worldMatrix;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
// override it in derived class if you add new variables to the cache
|
|
// override it in derived class if you add new variables to the cache
|
|
// and call the parent class method
|
|
// and call the parent class method
|
|
/** @hidden */
|
|
/** @hidden */
|
|
@@ -17891,34 +17911,37 @@ var BABYLON;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
Node.prototype._markSyncedWithParent = function () {
|
|
Node.prototype._markSyncedWithParent = function () {
|
|
- if (this.parent) {
|
|
|
|
- this._parentRenderId = this.parent._childRenderId;
|
|
|
|
|
|
+ if (this._parentNode) {
|
|
|
|
+ this._parentRenderId = this._parentNode._childRenderId;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
Node.prototype.isSynchronizedWithParent = function () {
|
|
Node.prototype.isSynchronizedWithParent = function () {
|
|
- if (!this.parent) {
|
|
|
|
|
|
+ if (!this._parentNode) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
- if (this._parentRenderId !== this.parent._childRenderId) {
|
|
|
|
|
|
+ if (this._parentRenderId !== this._parentNode._childRenderId) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- return this.parent.isSynchronized();
|
|
|
|
|
|
+ return this._parentNode.isSynchronized();
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
- Node.prototype.isSynchronized = function (updateCache) {
|
|
|
|
|
|
+ Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
|
|
var check = this.hasNewParent();
|
|
var check = this.hasNewParent();
|
|
- check = check || !this.isSynchronizedWithParent();
|
|
|
|
|
|
+ if (!useWasUpdatedFlag) {
|
|
|
|
+ check = check || !this.isSynchronizedWithParent();
|
|
|
|
+ }
|
|
|
|
+ else if (this._parentNode) {
|
|
|
|
+ check = this._parentNode._worldMatrixWasUpdated;
|
|
|
|
+ }
|
|
check = check || !this._isSynchronized();
|
|
check = check || !this._isSynchronized();
|
|
- if (updateCache)
|
|
|
|
- this.updateCache(true);
|
|
|
|
return !check;
|
|
return !check;
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
Node.prototype.hasNewParent = function () {
|
|
Node.prototype.hasNewParent = function () {
|
|
- if (this._cache.parent === this.parent)
|
|
|
|
|
|
+ if (this._cache.parent === this._parentNode)
|
|
return false;
|
|
return false;
|
|
- this._cache.parent = this.parent;
|
|
|
|
|
|
+ this._cache.parent = this._parentNode;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
@@ -17944,8 +17967,8 @@ var BABYLON;
|
|
if (this._isEnabled === false) {
|
|
if (this._isEnabled === false) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (this.parent !== undefined && this.parent !== null) {
|
|
|
|
- return this.parent.isEnabled(checkAncestors);
|
|
|
|
|
|
+ if (this._parentNode !== undefined && this._parentNode !== null) {
|
|
|
|
+ return this._parentNode.isEnabled(checkAncestors);
|
|
}
|
|
}
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
@@ -18139,10 +18162,14 @@ var BABYLON;
|
|
/**
|
|
/**
|
|
* Computes the world matrix of the node
|
|
* Computes the world matrix of the node
|
|
* @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
* @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
|
|
+ * @param useWasUpdatedFlag defines a reserved property
|
|
* @returns the world matrix
|
|
* @returns the world matrix
|
|
*/
|
|
*/
|
|
- Node.prototype.computeWorldMatrix = function (force) {
|
|
|
|
- return BABYLON.Matrix.Identity();
|
|
|
|
|
|
+ Node.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
|
|
+ if (!this._worldMatrix) {
|
|
|
|
+ this._worldMatrix = BABYLON.Matrix.Identity();
|
|
|
|
+ }
|
|
|
|
+ return this._worldMatrix;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Releases resources associated with this node.
|
|
* Releases resources associated with this node.
|
|
@@ -18671,6 +18698,7 @@ var BABYLON;
|
|
_this._right = new BABYLON.Vector3(1, 0, 0);
|
|
_this._right = new BABYLON.Vector3(1, 0, 0);
|
|
_this._rightInverted = new BABYLON.Vector3(-1, 0, 0);
|
|
_this._rightInverted = new BABYLON.Vector3(-1, 0, 0);
|
|
// Properties
|
|
// Properties
|
|
|
|
+ _this._position = BABYLON.Vector3.Zero();
|
|
_this._rotation = BABYLON.Vector3.Zero();
|
|
_this._rotation = BABYLON.Vector3.Zero();
|
|
_this._scaling = BABYLON.Vector3.One();
|
|
_this._scaling = BABYLON.Vector3.One();
|
|
_this._isDirty = false;
|
|
_this._isDirty = false;
|
|
@@ -18694,12 +18722,7 @@ var BABYLON;
|
|
* By default the system will update normals to compensate
|
|
* By default the system will update normals to compensate
|
|
*/
|
|
*/
|
|
_this.ignoreNonUniformScaling = false;
|
|
_this.ignoreNonUniformScaling = false;
|
|
- _this.position = BABYLON.Vector3.Zero();
|
|
|
|
_this._localWorld = BABYLON.Matrix.Zero();
|
|
_this._localWorld = BABYLON.Matrix.Zero();
|
|
- /** @hidden */
|
|
|
|
- _this._worldMatrix = BABYLON.Matrix.Zero();
|
|
|
|
- /** @hidden */
|
|
|
|
- _this._worldMatrixDeterminant = 0;
|
|
|
|
_this._absolutePosition = BABYLON.Vector3.Zero();
|
|
_this._absolutePosition = BABYLON.Vector3.Zero();
|
|
_this._pivotMatrix = BABYLON.Matrix.Identity();
|
|
_this._pivotMatrix = BABYLON.Matrix.Identity();
|
|
_this._postMultiplyPivotMatrix = false;
|
|
_this._postMultiplyPivotMatrix = false;
|
|
@@ -18721,44 +18744,53 @@ var BABYLON;
|
|
TransformNode.prototype.getClassName = function () {
|
|
TransformNode.prototype.getClassName = function () {
|
|
return "TransformNode";
|
|
return "TransformNode";
|
|
};
|
|
};
|
|
|
|
+ Object.defineProperty(TransformNode.prototype, "position", {
|
|
|
|
+ /**
|
|
|
|
+ * Gets or set the node position (default is (0.0, 0.0, 0.0))
|
|
|
|
+ */
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._position;
|
|
|
|
+ },
|
|
|
|
+ set: function (newPosition) {
|
|
|
|
+ this._position = newPosition;
|
|
|
|
+ this._isDirty = true;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(TransformNode.prototype, "rotation", {
|
|
Object.defineProperty(TransformNode.prototype, "rotation", {
|
|
/**
|
|
/**
|
|
- * Rotation property : a Vector3 depicting the rotation value in radians around each local axis X, Y, Z.
|
|
|
|
- * If rotation quaternion is set, this Vector3 will (almost always) be the Zero vector!
|
|
|
|
- * Default : (0.0, 0.0, 0.0)
|
|
|
|
|
|
+ * Gets or sets the rotation property : a Vector3 defining the rotation value in radians around each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
|
|
|
|
+ * If rotation quaternion is set, this Vector3 will be ignored and copy from the quaternion
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
return this._rotation;
|
|
return this._rotation;
|
|
},
|
|
},
|
|
set: function (newRotation) {
|
|
set: function (newRotation) {
|
|
this._rotation = newRotation;
|
|
this._rotation = newRotation;
|
|
|
|
+ this._isDirty = true;
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
Object.defineProperty(TransformNode.prototype, "scaling", {
|
|
Object.defineProperty(TransformNode.prototype, "scaling", {
|
|
/**
|
|
/**
|
|
- * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
|
|
|
|
- * Default : (1.0, 1.0, 1.0)
|
|
|
|
|
|
+ * Gets or sets the scaling property : a Vector3 defining the node scaling along each local axis X, Y, Z (default is (0.0, 0.0, 0.0)).
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
return this._scaling;
|
|
return this._scaling;
|
|
},
|
|
},
|
|
- /**
|
|
|
|
- * Scaling property : a Vector3 depicting the mesh scaling along each local axis X, Y, Z.
|
|
|
|
- * Default : (1.0, 1.0, 1.0)
|
|
|
|
- */
|
|
|
|
set: function (newScaling) {
|
|
set: function (newScaling) {
|
|
this._scaling = newScaling;
|
|
this._scaling = newScaling;
|
|
|
|
+ this._isDirty = true;
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
Object.defineProperty(TransformNode.prototype, "rotationQuaternion", {
|
|
Object.defineProperty(TransformNode.prototype, "rotationQuaternion", {
|
|
/**
|
|
/**
|
|
- * Rotation Quaternion property : this a Quaternion object depicting the mesh rotation by using a unit quaternion.
|
|
|
|
- * It's null by default.
|
|
|
|
- * If set, only the rotationQuaternion is then used to compute the mesh rotation and its property `.rotation\ is then ignored and set to (0.0, 0.0, 0.0)
|
|
|
|
|
|
+ * Gets or sets the rotation Quaternion property : this a Quaternion object defining the node rotation by using a unit quaternion (null by default).
|
|
|
|
+ * If set, only the rotationQuaternion is then used to compute the node rotation (ie. node.rotation will be ignored)
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
return this._rotationQuaternion;
|
|
return this._rotationQuaternion;
|
|
@@ -18804,31 +18836,6 @@ var BABYLON;
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
/**
|
|
/**
|
|
- * Returns the latest update of the World matrix
|
|
|
|
- * Returns a Matrix.
|
|
|
|
- */
|
|
|
|
- TransformNode.prototype.getWorldMatrix = function () {
|
|
|
|
- if (this._currentRenderId !== this.getScene().getRenderId()) {
|
|
|
|
- this.computeWorldMatrix();
|
|
|
|
- }
|
|
|
|
- return this._worldMatrix;
|
|
|
|
- };
|
|
|
|
- /** @hidden */
|
|
|
|
- TransformNode.prototype._getWorldMatrixDeterminant = function () {
|
|
|
|
- return this._worldMatrixDeterminant;
|
|
|
|
- };
|
|
|
|
- Object.defineProperty(TransformNode.prototype, "worldMatrixFromCache", {
|
|
|
|
- /**
|
|
|
|
- * Returns directly the latest state of the mesh World matrix.
|
|
|
|
- * A Matrix is returned.
|
|
|
|
- */
|
|
|
|
- get: function () {
|
|
|
|
- return this._worldMatrix;
|
|
|
|
- },
|
|
|
|
- enumerable: true,
|
|
|
|
- configurable: true
|
|
|
|
- });
|
|
|
|
- /**
|
|
|
|
* Copies the parameter passed Matrix into the mesh Pose matrix.
|
|
* Copies the parameter passed Matrix into the mesh Pose matrix.
|
|
* Returns the TransformNode.
|
|
* Returns the TransformNode.
|
|
*/
|
|
*/
|
|
@@ -18856,15 +18863,15 @@ var BABYLON;
|
|
if (this.infiniteDistance) {
|
|
if (this.infiniteDistance) {
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (!this._cache.position.equals(this.position))
|
|
|
|
|
|
+ if (!this._cache.position.equals(this._position))
|
|
return false;
|
|
return false;
|
|
if (this._rotationQuaternion) {
|
|
if (this._rotationQuaternion) {
|
|
if (!this._cache.rotationQuaternion.equals(this._rotationQuaternion))
|
|
if (!this._cache.rotationQuaternion.equals(this._rotationQuaternion))
|
|
return false;
|
|
return false;
|
|
}
|
|
}
|
|
- if (!this._cache.rotation.equals(this.rotation))
|
|
|
|
|
|
+ if (!this._cache.rotation.equals(this._rotation))
|
|
return false;
|
|
return false;
|
|
- if (!this._cache.scaling.equals(this.scaling))
|
|
|
|
|
|
+ if (!this._cache.scaling.equals(this._scaling))
|
|
return false;
|
|
return false;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
@@ -19341,20 +19348,20 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Computes the mesh World matrix and returns it.
|
|
|
|
- * If the mesh world matrix is frozen, this computation does nothing more than returning the last frozen values.
|
|
|
|
- * If the parameter `force` is let to `false` (default), the current cached World matrix is returned.
|
|
|
|
- * If the parameter `force`is set to `true`, the actual computation is done.
|
|
|
|
- * Returns the mesh World Matrix.
|
|
|
|
|
|
+ * Computes the world matrix of the node
|
|
|
|
+ * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
|
|
+ * @param useWasUpdatedFlag defines a reserved property
|
|
|
|
+ * @returns the world matrix
|
|
*/
|
|
*/
|
|
- TransformNode.prototype.computeWorldMatrix = function (force) {
|
|
|
|
|
|
+ TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
if (this._isWorldMatrixFrozen) {
|
|
if (this._isWorldMatrixFrozen) {
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
- if (!force && this.isSynchronized(true)) {
|
|
|
|
|
|
+ if (!force && this.isSynchronized(useWasUpdatedFlag)) {
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
|
|
+ this._updateCache();
|
|
this._cache.position.copyFrom(this.position);
|
|
this._cache.position.copyFrom(this.position);
|
|
this._cache.scaling.copyFrom(this.scaling);
|
|
this._cache.scaling.copyFrom(this.scaling);
|
|
this._cache.pivotMatrixUpdated = false;
|
|
this._cache.pivotMatrixUpdated = false;
|
|
@@ -19362,6 +19369,7 @@ var BABYLON;
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._childRenderId = this.getScene().getRenderId();
|
|
this._childRenderId = this.getScene().getRenderId();
|
|
this._isDirty = false;
|
|
this._isDirty = false;
|
|
|
|
+ this._worldMatrixWasUpdated = true;
|
|
// Scaling
|
|
// Scaling
|
|
BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
|
|
BABYLON.Matrix.ScalingToRef(this.scaling.x * this.scalingDeterminant, this.scaling.y * this.scalingDeterminant, this.scaling.z * this.scalingDeterminant, BABYLON.Tmp.Matrix[1]);
|
|
// Rotation
|
|
// Rotation
|
|
@@ -19606,13 +19614,16 @@ var BABYLON;
|
|
TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
|
|
TransformNode._lookAtVectorCache = new BABYLON.Vector3(0, 0, 0);
|
|
TransformNode._rotationAxisCache = new BABYLON.Quaternion();
|
|
TransformNode._rotationAxisCache = new BABYLON.Quaternion();
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.serializeAsVector3()
|
|
|
|
|
|
+ BABYLON.serializeAsVector3("position")
|
|
|
|
+ ], TransformNode.prototype, "_position", void 0);
|
|
|
|
+ __decorate([
|
|
|
|
+ BABYLON.serializeAsVector3("rotation")
|
|
], TransformNode.prototype, "_rotation", void 0);
|
|
], TransformNode.prototype, "_rotation", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.serializeAsQuaternion()
|
|
|
|
|
|
+ BABYLON.serializeAsQuaternion("rotationQuaternion")
|
|
], TransformNode.prototype, "_rotationQuaternion", void 0);
|
|
], TransformNode.prototype, "_rotationQuaternion", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
- BABYLON.serializeAsVector3()
|
|
|
|
|
|
+ BABYLON.serializeAsVector3("scaling")
|
|
], TransformNode.prototype, "_scaling", void 0);
|
|
], TransformNode.prototype, "_scaling", void 0);
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize()
|
|
BABYLON.serialize()
|
|
@@ -19626,9 +19637,6 @@ var BABYLON;
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serialize()
|
|
BABYLON.serialize()
|
|
], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
|
|
], TransformNode.prototype, "ignoreNonUniformScaling", void 0);
|
|
- __decorate([
|
|
|
|
- BABYLON.serializeAsVector3()
|
|
|
|
- ], TransformNode.prototype, "position", void 0);
|
|
|
|
return TransformNode;
|
|
return TransformNode;
|
|
}(BABYLON.Node));
|
|
}(BABYLON.Node));
|
|
BABYLON.TransformNode = TransformNode;
|
|
BABYLON.TransformNode = TransformNode;
|
|
@@ -21826,24 +21834,6 @@ var BABYLON;
|
|
return true;
|
|
return true;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * Computes and Returns the light World matrix.
|
|
|
|
- * @returns the world matrix
|
|
|
|
- */
|
|
|
|
- Light.prototype.getWorldMatrix = function () {
|
|
|
|
- this._currentRenderId = this.getScene().getRenderId();
|
|
|
|
- this._childRenderId = this._currentRenderId;
|
|
|
|
- var worldMatrix = this._getWorldMatrix();
|
|
|
|
- if (this.parent && this.parent.getWorldMatrix) {
|
|
|
|
- if (!this._parentedWorldMatrix) {
|
|
|
|
- this._parentedWorldMatrix = BABYLON.Matrix.Identity();
|
|
|
|
- }
|
|
|
|
- worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._parentedWorldMatrix);
|
|
|
|
- this._markSyncedWithParent();
|
|
|
|
- return this._parentedWorldMatrix;
|
|
|
|
- }
|
|
|
|
- return worldMatrix;
|
|
|
|
- };
|
|
|
|
- /**
|
|
|
|
* Sort function to order lights for rendering.
|
|
* Sort function to order lights for rendering.
|
|
* @param a First Light object to compare to second.
|
|
* @param a First Light object to compare to second.
|
|
* @param b Second Light object to compare first.
|
|
* @param b Second Light object to compare first.
|
|
@@ -22311,7 +22301,6 @@ var BABYLON;
|
|
_this._computedViewMatrix = BABYLON.Matrix.Identity();
|
|
_this._computedViewMatrix = BABYLON.Matrix.Identity();
|
|
_this._projectionMatrix = new BABYLON.Matrix();
|
|
_this._projectionMatrix = new BABYLON.Matrix();
|
|
_this._doNotComputeProjectionMatrix = false;
|
|
_this._doNotComputeProjectionMatrix = false;
|
|
- _this._worldMatrix = BABYLON.Matrix.Identity();
|
|
|
|
_this._postProcesses = new Array();
|
|
_this._postProcesses = new Array();
|
|
_this._transformMatrix = BABYLON.Matrix.Zero();
|
|
_this._transformMatrix = BABYLON.Matrix.Zero();
|
|
_this._activeMeshes = new BABYLON.SmartArray(256);
|
|
_this._activeMeshes = new BABYLON.SmartArray(256);
|
|
@@ -27504,6 +27493,26 @@ var BABYLON;
|
|
this._activeMeshesFrozen = false;
|
|
this._activeMeshesFrozen = false;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
|
|
+ Scene.prototype._computeAllWorldMatricesforBranch = function (node) {
|
|
|
|
+ node.computeWorldMatrix(false, true);
|
|
|
|
+ var children = node.getChildren();
|
|
|
|
+ if (children) {
|
|
|
|
+ for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
|
|
|
|
+ var child = children_2[_i];
|
|
|
|
+ this._computeAllWorldMatricesforBranch(child);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ node._worldMatrixWasUpdated = false;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * This function will traverse the scene graph and makes sure that all worldMatrix are up to date
|
|
|
|
+ */
|
|
|
|
+ Scene.prototype.computeAllWorldMatrices = function () {
|
|
|
|
+ for (var _i = 0, _a = this.rootNodes; _i < _a.length; _i++) {
|
|
|
|
+ var node = _a[_i];
|
|
|
|
+ this._computeAllWorldMatricesforBranch(node);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
Scene.prototype._evaluateActiveMeshes = function () {
|
|
Scene.prototype._evaluateActiveMeshes = function () {
|
|
if (this._activeMeshesFrozen && this._activeMeshes.length) {
|
|
if (this._activeMeshesFrozen && this._activeMeshes.length) {
|
|
return;
|
|
return;
|
|
@@ -27523,6 +27532,8 @@ var BABYLON;
|
|
var step = _a[_i];
|
|
var step = _a[_i];
|
|
step.action();
|
|
step.action();
|
|
}
|
|
}
|
|
|
|
+ // World matrices
|
|
|
|
+ this.computeAllWorldMatrices();
|
|
// Determine mesh candidates
|
|
// Determine mesh candidates
|
|
var meshes = this.getActiveMeshCandidates();
|
|
var meshes = this.getActiveMeshCandidates();
|
|
// Check each mesh
|
|
// Check each mesh
|
|
@@ -27536,7 +27547,6 @@ var BABYLON;
|
|
if (!mesh.isReady() || !mesh.isEnabled()) {
|
|
if (!mesh.isReady() || !mesh.isEnabled()) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
- mesh.computeWorldMatrix();
|
|
|
|
// Intersections
|
|
// Intersections
|
|
if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
|
|
if (mesh.actionManager && mesh.actionManager.hasSpecificTriggers2(BABYLON.ActionManager.OnIntersectionEnterTrigger, BABYLON.ActionManager.OnIntersectionExitTrigger)) {
|
|
this._meshesForIntersections.pushNoDuplicate(mesh);
|
|
this._meshesForIntersections.pushNoDuplicate(mesh);
|
|
@@ -34108,7 +34118,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
Object.defineProperty(SubMesh.prototype, "IsGlobal", {
|
|
Object.defineProperty(SubMesh.prototype, "IsGlobal", {
|
|
get: function () {
|
|
get: function () {
|
|
- return (this.verticesStart === 0 && this.verticesCount == this._mesh.getTotalVertices());
|
|
|
|
|
|
+ return (this.verticesStart === 0 && this.verticesCount === this._mesh.getTotalVertices());
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -48682,9 +48692,12 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
- * @hidden internal use only.
|
|
|
|
|
|
+ * Computes the world matrix of the node
|
|
|
|
+ * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
|
|
+ * @param useWasUpdatedFlag defines a reserved property
|
|
|
|
+ * @returns the world matrix
|
|
*/
|
|
*/
|
|
- HemisphericLight.prototype._getWorldMatrix = function () {
|
|
|
|
|
|
+ HemisphericLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
if (!this._worldMatrix) {
|
|
if (!this._worldMatrix) {
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
}
|
|
}
|
|
@@ -48895,15 +48908,41 @@ var BABYLON;
|
|
ShadowLight.prototype.forceProjectionMatrixCompute = function () {
|
|
ShadowLight.prototype.forceProjectionMatrixCompute = function () {
|
|
this._needProjectionMatrixCompute = true;
|
|
this._needProjectionMatrixCompute = true;
|
|
};
|
|
};
|
|
|
|
+ /** @hidden */
|
|
|
|
+ ShadowLight.prototype._initCache = function () {
|
|
|
|
+ _super.prototype._initCache.call(this);
|
|
|
|
+ this._cache.position = BABYLON.Vector3.Zero();
|
|
|
|
+ };
|
|
|
|
+ /** @hidden */
|
|
|
|
+ ShadowLight.prototype._isSynchronized = function () {
|
|
|
|
+ if (!this._cache.position.equals(this.position))
|
|
|
|
+ return false;
|
|
|
|
+ return true;
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
- * Get the world matrix of the sahdow lights.
|
|
|
|
- * @hidden Internal Use Only
|
|
|
|
|
|
+ * Computes the world matrix of the node
|
|
|
|
+ * @param force defines if the cache version should be invalidated forcing the world matrix to be created from scratch
|
|
|
|
+ * @param useWasUpdatedFlag defines a reserved property
|
|
|
|
+ * @returns the world matrix
|
|
*/
|
|
*/
|
|
- ShadowLight.prototype._getWorldMatrix = function () {
|
|
|
|
|
|
+ ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
|
|
+ if (!force && this.isSynchronized(useWasUpdatedFlag)) {
|
|
|
|
+ this._currentRenderId = this.getScene().getRenderId();
|
|
|
|
+ return this._worldMatrix;
|
|
|
|
+ }
|
|
|
|
+ this._updateCache();
|
|
|
|
+ this._cache.position.copyFrom(this.position);
|
|
|
|
+ this._worldMatrixWasUpdated = true;
|
|
if (!this._worldMatrix) {
|
|
if (!this._worldMatrix) {
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
}
|
|
}
|
|
BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
|
|
BABYLON.Matrix.TranslationToRef(this.position.x, this.position.y, this.position.z, this._worldMatrix);
|
|
|
|
+ if (this.parent && this.parent.getWorldMatrix) {
|
|
|
|
+ this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
|
+ this._markSyncedWithParent();
|
|
|
|
+ }
|
|
|
|
+ // Cache the determinant
|
|
|
|
+ this._worldMatrixDeterminant = this._worldMatrix.determinant();
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
@@ -109784,12 +109823,16 @@ var BABYLON;
|
|
};
|
|
};
|
|
// We also need to update AbstractMesh as there is a portion of the code there
|
|
// We also need to update AbstractMesh as there is a portion of the code there
|
|
BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
BABYLON.AbstractMesh.prototype._checkOcclusionQuery = function () {
|
|
|
|
+ if (this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
|
|
|
|
+ this._isOccluded = false;
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
var engine = this.getEngine();
|
|
var engine = this.getEngine();
|
|
- if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
|
|
|
|
|
|
+ if (engine.webGLVersion < 2) {
|
|
this._isOccluded = false;
|
|
this._isOccluded = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- if (engine.webGLVersion < 2 || this.occlusionType === BABYLON.AbstractMesh.OCCLUSION_TYPE_NONE) {
|
|
|
|
|
|
+ if (!engine.isQueryResultAvailable) { // Occlusion query where not referenced
|
|
this._isOccluded = false;
|
|
this._isOccluded = false;
|
|
return;
|
|
return;
|
|
}
|
|
}
|