|
@@ -17680,8 +17680,6 @@ var BABYLON;
|
|
this._parentRenderId = -1;
|
|
this._parentRenderId = -1;
|
|
this._childRenderId = -1;
|
|
this._childRenderId = -1;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
- this._worldMatrixWasUpdated = false;
|
|
|
|
- /** @hidden */
|
|
|
|
this._worldMatrix = BABYLON.Matrix.Zero();
|
|
this._worldMatrix = BABYLON.Matrix.Zero();
|
|
/** @hidden */
|
|
/** @hidden */
|
|
this._worldMatrixDeterminant = 0;
|
|
this._worldMatrixDeterminant = 0;
|
|
@@ -17954,23 +17952,17 @@ var BABYLON;
|
|
return this._parentNode.isSynchronized();
|
|
return this._parentNode.isSynchronized();
|
|
};
|
|
};
|
|
/** @hidden */
|
|
/** @hidden */
|
|
- Node.prototype.isSynchronized = function (useWasUpdatedFlag) {
|
|
|
|
- var check = this.hasNewParent();
|
|
|
|
- if (!useWasUpdatedFlag) {
|
|
|
|
- check = check || !this.isSynchronizedWithParent();
|
|
|
|
|
|
+ Node.prototype.isSynchronized = function () {
|
|
|
|
+ if (this._cache.parent != this._parentNode) {
|
|
|
|
+ this._cache.parent = this._parentNode;
|
|
|
|
+ return false;
|
|
}
|
|
}
|
|
- else if (this._parentNode) {
|
|
|
|
- check = this._parentNode._worldMatrixWasUpdated;
|
|
|
|
|
|
+ if (this._parentNode) {
|
|
|
|
+ if (!this.isSynchronizedWithParent()) {
|
|
|
|
+ return false;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- check = check || !this._isSynchronized();
|
|
|
|
- return !check;
|
|
|
|
- };
|
|
|
|
- /** @hidden */
|
|
|
|
- Node.prototype.hasNewParent = function () {
|
|
|
|
- if (this._cache.parent === this._parentNode)
|
|
|
|
- return false;
|
|
|
|
- this._cache.parent = this._parentNode;
|
|
|
|
- return true;
|
|
|
|
|
|
+ return this._isSynchronized();
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Is this node ready to be used/rendered
|
|
* Is this node ready to be used/rendered
|
|
@@ -18190,10 +18182,9 @@ 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, useWasUpdatedFlag) {
|
|
|
|
|
|
+ Node.prototype.computeWorldMatrix = function (force) {
|
|
if (!this._worldMatrix) {
|
|
if (!this._worldMatrix) {
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
this._worldMatrix = BABYLON.Matrix.Identity();
|
|
}
|
|
}
|
|
@@ -19378,14 +19369,13 @@ 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
|
|
*/
|
|
*/
|
|
- TransformNode.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
|
|
|
|
+ TransformNode.prototype.computeWorldMatrix = function (force) {
|
|
if (this._isWorldMatrixFrozen) {
|
|
if (this._isWorldMatrixFrozen) {
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
- if (!force && this.isSynchronized(useWasUpdatedFlag)) {
|
|
|
|
|
|
+ if (!force && this.isSynchronized()) {
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
@@ -19397,7 +19387,6 @@ 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
|
|
@@ -27521,26 +27510,6 @@ 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;
|
|
@@ -27560,8 +27529,6 @@ 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
|
|
@@ -27575,6 +27542,7 @@ 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);
|
|
@@ -48950,17 +48918,15 @@ 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
|
|
*/
|
|
*/
|
|
- ShadowLight.prototype.computeWorldMatrix = function (force, useWasUpdatedFlag) {
|
|
|
|
- if (!force && this.isSynchronized(useWasUpdatedFlag)) {
|
|
|
|
|
|
+ ShadowLight.prototype.computeWorldMatrix = function (force) {
|
|
|
|
+ if (!force && this.isSynchronized()) {
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
this._currentRenderId = this.getScene().getRenderId();
|
|
return this._worldMatrix;
|
|
return this._worldMatrix;
|
|
}
|
|
}
|
|
this._updateCache();
|
|
this._updateCache();
|
|
this._cache.position.copyFrom(this.position);
|
|
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();
|
|
}
|
|
}
|