|
@@ -4134,6 +4134,14 @@ var BABYLON;
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
|
+ * Determines equality between Color4 objects
|
|
|
+ * @param otherColor defines the second operand
|
|
|
+ * @returns true if the rgba values are equal to the given ones
|
|
|
+ */
|
|
|
+ Color4.prototype.equals = function (otherColor) {
|
|
|
+ return otherColor && this.r === otherColor.r && this.g === otherColor.g && this.b === otherColor.b && this.a === otherColor.a;
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Creates a new Color4 set with the added values of the current Color4 and of the given one
|
|
|
* @param right defines the second operand
|
|
|
* @returns a new Color4 object
|
|
@@ -12945,7 +12953,7 @@ var BABYLON;
|
|
|
* Returns the current version of the framework
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return "4.0.0-alpha.8";
|
|
|
+ return "4.0.0-alpha.9";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -18819,6 +18827,10 @@ var BABYLON;
|
|
|
*/
|
|
|
this.metadata = null;
|
|
|
/**
|
|
|
+ * For internal use only. Please do not use.
|
|
|
+ */
|
|
|
+ this.reservedDataStore = null;
|
|
|
+ /**
|
|
|
* Gets or sets a boolean used to define if the node must be serialized
|
|
|
*/
|
|
|
this.doNotSerialize = false;
|
|
@@ -18906,7 +18918,7 @@ var BABYLON;
|
|
|
if (index !== -1) {
|
|
|
this._parentNode._children.splice(index, 1);
|
|
|
}
|
|
|
- if (!parent) {
|
|
|
+ if (!parent && !this._isDisposed) {
|
|
|
this.addToSceneRootNodes();
|
|
|
}
|
|
|
}
|
|
@@ -19378,6 +19390,7 @@ var BABYLON;
|
|
|
*/
|
|
|
Node.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
|
+ this._isDisposed = true;
|
|
|
if (!doNotRecurse) {
|
|
|
var nodes = this.getDescendants(true);
|
|
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
@@ -19408,7 +19421,6 @@ var BABYLON;
|
|
|
behavior.detach();
|
|
|
}
|
|
|
this._behaviors = [];
|
|
|
- this._isDisposed = true;
|
|
|
};
|
|
|
/**
|
|
|
* Parse animation range data from a serialization object and store them into a given node
|
|
@@ -20151,7 +20163,8 @@ var BABYLON;
|
|
|
* By default the system will update normals to compensate
|
|
|
*/
|
|
|
_this.ignoreNonUniformScaling = false;
|
|
|
- _this._localWorld = BABYLON.Matrix.Zero();
|
|
|
+ /** @hidden */
|
|
|
+ _this._localMatrix = BABYLON.Matrix.Zero();
|
|
|
_this._absolutePosition = BABYLON.Vector3.Zero();
|
|
|
_this._pivotMatrix = BABYLON.Matrix.Identity();
|
|
|
_this._postMultiplyPivotMatrix = false;
|
|
@@ -20293,7 +20306,7 @@ var BABYLON;
|
|
|
if (this._cache.pivotMatrixUpdated) {
|
|
|
return false;
|
|
|
}
|
|
|
- if (this.infiniteDistance !== this._cache.infiniteDistance) {
|
|
|
+ if (this.infiniteDistance) {
|
|
|
return false;
|
|
|
}
|
|
|
if (!this._cache.position.equals(this._position)) {
|
|
@@ -20465,7 +20478,7 @@ var BABYLON;
|
|
|
*/
|
|
|
TransformNode.prototype.setPositionWithLocalVector = function (vector3) {
|
|
|
this.computeWorldMatrix();
|
|
|
- this.position = BABYLON.Vector3.TransformNormal(vector3, this._localWorld);
|
|
|
+ this.position = BABYLON.Vector3.TransformNormal(vector3, this._localMatrix);
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -20475,7 +20488,7 @@ var BABYLON;
|
|
|
TransformNode.prototype.getPositionExpressedInLocalSpace = function () {
|
|
|
this.computeWorldMatrix();
|
|
|
var invLocalWorldMatrix = BABYLON.Tmp.Matrix[0];
|
|
|
- this._localWorld.invertToRef(invLocalWorldMatrix);
|
|
|
+ this._localMatrix.invertToRef(invLocalWorldMatrix);
|
|
|
return BABYLON.Vector3.TransformNormal(this.position, invLocalWorldMatrix);
|
|
|
};
|
|
|
/**
|
|
@@ -20485,7 +20498,7 @@ var BABYLON;
|
|
|
*/
|
|
|
TransformNode.prototype.locallyTranslate = function (vector3) {
|
|
|
this.computeWorldMatrix(true);
|
|
|
- this.position = BABYLON.Vector3.TransformCoordinates(vector3, this._localWorld);
|
|
|
+ this.position = BABYLON.Vector3.TransformCoordinates(vector3, this._localMatrix);
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
@@ -20505,17 +20518,7 @@ var BABYLON;
|
|
|
var dv = TransformNode._lookAtVectorCache;
|
|
|
var pos = space === BABYLON.Space.LOCAL ? this.position : this.getAbsolutePosition();
|
|
|
targetPoint.subtractToRef(pos, dv);
|
|
|
- var yaw = -Math.atan2(dv.z, dv.x) - Math.PI / 2;
|
|
|
- var len = Math.sqrt(dv.x * dv.x + dv.z * dv.z);
|
|
|
- var pitch = Math.atan2(dv.y, len);
|
|
|
- if (this.rotationQuaternion) {
|
|
|
- BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
|
- }
|
|
|
- else {
|
|
|
- this.rotation.x = pitch + pitchCor;
|
|
|
- this.rotation.y = yaw + yawCor;
|
|
|
- this.rotation.z = rollCor;
|
|
|
- }
|
|
|
+ this.setDirection(dv, yawCor, pitchCor, rollCor);
|
|
|
// Correct for parent's rotation offset
|
|
|
if (space === BABYLON.Space.WORLD && this.parent) {
|
|
|
if (this.rotationQuaternion) {
|
|
@@ -20570,6 +20573,31 @@ var BABYLON;
|
|
|
return this;
|
|
|
};
|
|
|
/**
|
|
|
+ * Sets this transform node rotation to the given local axis.
|
|
|
+ * @param localAxis the axis in local space
|
|
|
+ * @param yawCor optional yaw (y-axis) correction in radians
|
|
|
+ * @param pitchCor optional pitch (x-axis) correction in radians
|
|
|
+ * @param rollCor optional roll (z-axis) correction in radians
|
|
|
+ * @returns this TransformNode
|
|
|
+ */
|
|
|
+ TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {
|
|
|
+ if (yawCor === void 0) { yawCor = 0; }
|
|
|
+ if (pitchCor === void 0) { pitchCor = 0; }
|
|
|
+ if (rollCor === void 0) { rollCor = 0; }
|
|
|
+ var yaw = -Math.atan2(localAxis.z, localAxis.x) - Math.PI / 2;
|
|
|
+ var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
|
+ var pitch = Math.atan2(localAxis.y, len);
|
|
|
+ if (this.rotationQuaternion) {
|
|
|
+ BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this.rotation.x = pitch + pitchCor;
|
|
|
+ this.rotation.y = yaw + yawCor;
|
|
|
+ this.rotation.z = rollCor;
|
|
|
+ }
|
|
|
+ return this;
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Sets a new pivot point to the current node
|
|
|
* @param point defines the new pivot point to use
|
|
|
* @param space defines if the point is in world or local space (local by default)
|
|
@@ -20934,7 +20962,7 @@ var BABYLON;
|
|
|
BABYLON.Tmp.Matrix[5].multiplyToRef(this._pivotMatrixInverse, BABYLON.Tmp.Matrix[5]);
|
|
|
}
|
|
|
// Local world
|
|
|
- BABYLON.Tmp.Matrix[5].multiplyToRef(BABYLON.Tmp.Matrix[2], this._localWorld);
|
|
|
+ BABYLON.Tmp.Matrix[5].multiplyToRef(BABYLON.Tmp.Matrix[2], this._localMatrix);
|
|
|
// Parent
|
|
|
if (this.parent && this.parent.getWorldMatrix) {
|
|
|
if (this.billboardMode !== TransformNode.BILLBOARDMODE_NONE) {
|
|
@@ -20945,24 +20973,24 @@ var BABYLON;
|
|
|
else {
|
|
|
BABYLON.Tmp.Matrix[5].copyFrom(this.parent.getWorldMatrix());
|
|
|
}
|
|
|
- this._localWorld.getTranslationToRef(BABYLON.Tmp.Vector3[5]);
|
|
|
+ this._localMatrix.getTranslationToRef(BABYLON.Tmp.Vector3[5]);
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(BABYLON.Tmp.Vector3[5], BABYLON.Tmp.Matrix[5], BABYLON.Tmp.Vector3[5]);
|
|
|
- this._worldMatrix.copyFrom(this._localWorld);
|
|
|
+ this._worldMatrix.copyFrom(this._localMatrix);
|
|
|
this._worldMatrix.setTranslation(BABYLON.Tmp.Vector3[5]);
|
|
|
}
|
|
|
else {
|
|
|
if (this._transformToBoneReferal) {
|
|
|
- this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), BABYLON.Tmp.Matrix[6]);
|
|
|
+ this._localMatrix.multiplyToRef(this.parent.getWorldMatrix(), BABYLON.Tmp.Matrix[6]);
|
|
|
BABYLON.Tmp.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(), this._worldMatrix);
|
|
|
}
|
|
|
else {
|
|
|
- this._localWorld.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
+ this._localMatrix.multiplyToRef(this.parent.getWorldMatrix(), this._worldMatrix);
|
|
|
}
|
|
|
}
|
|
|
this._markSyncedWithParent();
|
|
|
}
|
|
|
else {
|
|
|
- this._worldMatrix.copyFrom(this._localWorld);
|
|
|
+ this._worldMatrix.copyFrom(this._localMatrix);
|
|
|
}
|
|
|
// Normal matrix
|
|
|
if (!this.ignoreNonUniformScaling) {
|
|
@@ -22241,13 +22269,14 @@ var BABYLON;
|
|
|
};
|
|
|
/** @hidden */
|
|
|
AbstractMesh.prototype._updateBoundingInfo = function () {
|
|
|
+ var effectiveMesh = (this.skeleton && this.skeleton.overrideMesh) || this;
|
|
|
if (this._boundingInfo) {
|
|
|
- this._boundingInfo.update(this.worldMatrixFromCache);
|
|
|
+ this._boundingInfo.update(effectiveMesh.worldMatrixFromCache);
|
|
|
}
|
|
|
else {
|
|
|
- this._boundingInfo = new BABYLON.BoundingInfo(this.absolutePosition, this.absolutePosition, this.worldMatrixFromCache);
|
|
|
+ this._boundingInfo = new BABYLON.BoundingInfo(this.absolutePosition, this.absolutePosition, effectiveMesh.worldMatrixFromCache);
|
|
|
}
|
|
|
- this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache);
|
|
|
+ this._updateSubMeshesBoundingInfo(effectiveMesh.worldMatrixFromCache);
|
|
|
return this;
|
|
|
};
|
|
|
/** @hidden */
|
|
@@ -24604,6 +24633,7 @@ var BABYLON;
|
|
|
this._rigCameras[i].minZ = this.minZ;
|
|
|
this._rigCameras[i].maxZ = this.maxZ;
|
|
|
this._rigCameras[i].fov = this.fov;
|
|
|
+ this._rigCameras[i].upVector.copyFrom(this.upVector);
|
|
|
}
|
|
|
// only update viewport when ANAGLYPH
|
|
|
if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
|
|
@@ -25834,6 +25864,10 @@ var BABYLON;
|
|
|
*/
|
|
|
_this.metadata = null;
|
|
|
/**
|
|
|
+ * For internal use only. Please do not use.
|
|
|
+ */
|
|
|
+ _this.reservedDataStore = null;
|
|
|
+ /**
|
|
|
* Use this array to add regular expressions used to disable offline support for specific urls
|
|
|
*/
|
|
|
_this.disableOfflineSupportExceptionRules = new Array();
|
|
@@ -31648,6 +31682,10 @@ var BABYLON;
|
|
|
* Gets or sets an object used to store user defined information.
|
|
|
*/
|
|
|
this.metadata = null;
|
|
|
+ /**
|
|
|
+ * For internal use only. Please do not use.
|
|
|
+ */
|
|
|
+ this.reservedDataStore = null;
|
|
|
this._hasAlpha = false;
|
|
|
/**
|
|
|
* Defines if the alpha value should be determined via the rgb values.
|
|
@@ -31736,8 +31774,8 @@ var BABYLON;
|
|
|
this._cachedSize = BABYLON.Size.Zero();
|
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
|
if (this._scene) {
|
|
|
- this._scene.addTexture(this);
|
|
|
this.uniqueId = this._scene.getUniqueId();
|
|
|
+ this._scene.addTexture(this);
|
|
|
}
|
|
|
this._uid = null;
|
|
|
}
|
|
@@ -34267,10 +34305,11 @@ var BABYLON;
|
|
|
if (!effect) {
|
|
|
return this;
|
|
|
}
|
|
|
+ var effectiveMesh = (this.skeleton && this.skeleton.overrideMesh) || this;
|
|
|
var sideOrientation = this.overrideMaterialSideOrientation;
|
|
|
if (sideOrientation == null) {
|
|
|
sideOrientation = this._effectiveMaterial.sideOrientation;
|
|
|
- if (this._getWorldMatrixDeterminant() < 0) {
|
|
|
+ if (effectiveMesh._getWorldMatrixDeterminant() < 0) {
|
|
|
sideOrientation = (sideOrientation === BABYLON.Material.ClockWiseSideOrientation ? BABYLON.Material.CounterClockWiseSideOrientation : BABYLON.Material.ClockWiseSideOrientation);
|
|
|
}
|
|
|
}
|
|
@@ -34283,7 +34322,7 @@ var BABYLON;
|
|
|
if (!hardwareInstancedRendering) { // Binding will be done later because we need to add more info to the VB
|
|
|
this._bind(subMesh, effect, fillMode);
|
|
|
}
|
|
|
- var world = this.getWorldMatrix();
|
|
|
+ var world = effectiveMesh.getWorldMatrix();
|
|
|
if (this._effectiveMaterial._storeEffectOnSubMeshes) {
|
|
|
this._effectiveMaterial.bindForSubMesh(world, this, subMesh);
|
|
|
}
|
|
@@ -36948,6 +36987,10 @@ var BABYLON;
|
|
|
*/
|
|
|
this.metadata = null;
|
|
|
/**
|
|
|
+ * For internal use only. Please do not use.
|
|
|
+ */
|
|
|
+ this.reservedDataStore = null;
|
|
|
+ /**
|
|
|
* Specifies if the ready state should be checked on each call
|
|
|
*/
|
|
|
this.checkReadyOnEveryCall = false;
|
|
@@ -49044,6 +49087,8 @@ var BABYLON;
|
|
|
/** @hidden */
|
|
|
_this._currentTarget = BABYLON.Vector3.Zero();
|
|
|
/** @hidden */
|
|
|
+ _this._initialFocalDistance = 1;
|
|
|
+ /** @hidden */
|
|
|
_this._viewMatrix = BABYLON.Matrix.Zero();
|
|
|
/** @hidden */
|
|
|
_this._camMatrix = BABYLON.Matrix.Zero();
|
|
@@ -49163,6 +49208,7 @@ var BABYLON;
|
|
|
/** @hidden */
|
|
|
TargetCamera.prototype.setTarget = function (target) {
|
|
|
this.upVector.normalize();
|
|
|
+ this._initialFocalDistance = target.subtract(this.position).length();
|
|
|
if (this.position.z === target.z) {
|
|
|
this.position.z += BABYLON.Epsilon;
|
|
|
}
|
|
@@ -49363,10 +49409,8 @@ var BABYLON;
|
|
|
//provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
|
|
|
var leftSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;
|
|
|
var rightSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;
|
|
|
- this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft.position);
|
|
|
- this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * rightSign, camRight.position);
|
|
|
- camLeft.setTarget(this.getTarget());
|
|
|
- camRight.setTarget(this.getTarget());
|
|
|
+ this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);
|
|
|
+ this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);
|
|
|
break;
|
|
|
case BABYLON.Camera.RIG_MODE_VR:
|
|
|
if (camLeft.rotationQuaternion) {
|
|
@@ -49383,13 +49427,17 @@ var BABYLON;
|
|
|
}
|
|
|
_super.prototype._updateRigCameras.call(this);
|
|
|
};
|
|
|
- TargetCamera.prototype._getRigCamPosition = function (halfSpace, result) {
|
|
|
+ TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {
|
|
|
var target = this.getTarget();
|
|
|
- BABYLON.Matrix.TranslationToRef(-target.x, -target.y, -target.z, TargetCamera._TargetTransformMatrix);
|
|
|
+ target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);
|
|
|
+ TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);
|
|
|
+ var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);
|
|
|
+ BABYLON.Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);
|
|
|
TargetCamera._TargetTransformMatrix.multiplyToRef(BABYLON.Matrix.RotationY(halfSpace), TargetCamera._RigCamTransformMatrix);
|
|
|
- BABYLON.Matrix.TranslationToRef(target.x, target.y, target.z, TargetCamera._TargetTransformMatrix);
|
|
|
+ BABYLON.Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);
|
|
|
TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);
|
|
|
- BABYLON.Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, result);
|
|
|
+ BABYLON.Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);
|
|
|
+ rigCamera.setTarget(newFocalTarget);
|
|
|
};
|
|
|
/**
|
|
|
* Gets the current object class name.
|
|
@@ -49400,6 +49448,7 @@ var BABYLON;
|
|
|
};
|
|
|
TargetCamera._RigCamTransformMatrix = new BABYLON.Matrix();
|
|
|
TargetCamera._TargetTransformMatrix = new BABYLON.Matrix();
|
|
|
+ TargetCamera._TargetFocalPoint = new BABYLON.Vector3();
|
|
|
__decorate([
|
|
|
BABYLON.serializeAsVector3()
|
|
|
], TargetCamera.prototype, "rotation", void 0);
|
|
@@ -66376,7 +66425,6 @@ var BABYLON;
|
|
|
* @param scene defines the hosting scene
|
|
|
* @param autoUpdateBonesMatrices defines a boolean indicating if bones matrices must be forced to update before rendering (true by default)
|
|
|
* @param renderingGroupId defines the rendering group id to use with the viewer
|
|
|
- * @param utilityLayerRenderer defines an optional utility layer to render the helper on
|
|
|
*/
|
|
|
function SkeletonViewer(
|
|
|
/** defines the skeleton to render */
|
|
@@ -66386,21 +66434,21 @@ var BABYLON;
|
|
|
/** defines a boolean indicating if bones matrices must be forced to update before rendering (true by default) */
|
|
|
autoUpdateBonesMatrices,
|
|
|
/** defines the rendering group id to use with the viewer */
|
|
|
- renderingGroupId,
|
|
|
- /** defines an optional utility layer to render the helper on */
|
|
|
- utilityLayerRenderer) {
|
|
|
+ renderingGroupId) {
|
|
|
if (autoUpdateBonesMatrices === void 0) { autoUpdateBonesMatrices = true; }
|
|
|
if (renderingGroupId === void 0) { renderingGroupId = 1; }
|
|
|
this.skeleton = skeleton;
|
|
|
this.mesh = mesh;
|
|
|
this.autoUpdateBonesMatrices = autoUpdateBonesMatrices;
|
|
|
this.renderingGroupId = renderingGroupId;
|
|
|
- this.utilityLayerRenderer = utilityLayerRenderer;
|
|
|
/** Gets or sets the color used to render the skeleton */
|
|
|
this.color = BABYLON.Color3.White();
|
|
|
this._debugLines = new Array();
|
|
|
this._isEnabled = false;
|
|
|
this._scene = scene;
|
|
|
+ this._utilityLayer = new BABYLON.UtilityLayerRenderer(this._scene, false);
|
|
|
+ this._utilityLayer.pickUtilitySceneFirst = false;
|
|
|
+ this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;
|
|
|
this.update();
|
|
|
this._renderFunction = this.update.bind(this);
|
|
|
}
|
|
@@ -66495,6 +66543,9 @@ var BABYLON;
|
|
|
};
|
|
|
/** Update the viewer to sync with current skeleton state */
|
|
|
SkeletonViewer.prototype.update = function () {
|
|
|
+ if (!this._utilityLayer) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (this.autoUpdateBonesMatrices) {
|
|
|
this.skeleton.computeAbsoluteTransforms();
|
|
|
}
|
|
@@ -66504,7 +66555,7 @@ var BABYLON;
|
|
|
else {
|
|
|
this._getLinesForBonesWithLength(this.skeleton.bones, this.mesh.getWorldMatrix());
|
|
|
}
|
|
|
- var targetScene = this.utilityLayerRenderer ? this.utilityLayerRenderer.utilityLayerScene : this._scene;
|
|
|
+ var targetScene = this._utilityLayer.utilityLayerScene;
|
|
|
if (!this._debugMesh) {
|
|
|
this._debugMesh = BABYLON.MeshBuilder.CreateLineSystem("", { lines: this._debugLines, updatable: true, instance: null }, targetScene);
|
|
|
this._debugMesh.renderingGroupId = this.renderingGroupId;
|
|
@@ -66517,11 +66568,16 @@ var BABYLON;
|
|
|
};
|
|
|
/** Release associated resources */
|
|
|
SkeletonViewer.prototype.dispose = function () {
|
|
|
+ this.isEnabled = false;
|
|
|
if (this._debugMesh) {
|
|
|
this.isEnabled = false;
|
|
|
this._debugMesh.dispose();
|
|
|
this._debugMesh = null;
|
|
|
}
|
|
|
+ if (this._utilityLayer) {
|
|
|
+ this._utilityLayer.dispose();
|
|
|
+ this._utilityLayer = null;
|
|
|
+ }
|
|
|
};
|
|
|
return SkeletonViewer;
|
|
|
}());
|
|
@@ -66549,6 +66605,8 @@ var BABYLON;
|
|
|
*/
|
|
|
function AxesViewer(scene, scaleLines) {
|
|
|
if (scaleLines === void 0) { scaleLines = 1; }
|
|
|
+ this._tmpVector = new BABYLON.Vector3();
|
|
|
+ this._scaleLinesFactor = 4;
|
|
|
/**
|
|
|
* Gets or sets a number used to scale line length
|
|
|
*/
|
|
@@ -66567,11 +66625,11 @@ var BABYLON;
|
|
|
this._ymesh = BABYLON.AxisDragGizmo._CreateArrow(scene, greenColoredMaterial);
|
|
|
this._zmesh = BABYLON.AxisDragGizmo._CreateArrow(scene, blueColoredMaterial);
|
|
|
this._xmesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
- this._xmesh.scaling.scaleInPlace(4);
|
|
|
+ this._xmesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
this._ymesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
- this._ymesh.scaling.scaleInPlace(4);
|
|
|
+ this._ymesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
this._zmesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
- this._zmesh.scaling.scaleInPlace(4);
|
|
|
+ this._zmesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
AxesViewer._recursiveChangeRenderingGroupId(this._xmesh, 2);
|
|
|
AxesViewer._recursiveChangeRenderingGroupId(this._ymesh, 2);
|
|
|
AxesViewer._recursiveChangeRenderingGroupId(this._zmesh, 2);
|
|
@@ -66618,21 +66676,21 @@ var BABYLON;
|
|
|
AxesViewer.prototype.update = function (position, xaxis, yaxis, zaxis) {
|
|
|
if (this._xmesh) {
|
|
|
this._xmesh.position.copyFrom(position);
|
|
|
- var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), xaxis);
|
|
|
- this._xmesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), xaxis));
|
|
|
- this._xmesh.rotationQuaternion.normalize();
|
|
|
+ xaxis.scaleToRef(-1, this._tmpVector);
|
|
|
+ this._xmesh.setDirection(this._tmpVector);
|
|
|
+ this._xmesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
}
|
|
|
if (this._ymesh) {
|
|
|
this._ymesh.position.copyFrom(position);
|
|
|
- var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), yaxis);
|
|
|
- this._ymesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), yaxis));
|
|
|
- this._ymesh.rotationQuaternion.normalize();
|
|
|
+ yaxis.scaleToRef(-1, this._tmpVector);
|
|
|
+ this._ymesh.setDirection(this._tmpVector);
|
|
|
+ this._ymesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
}
|
|
|
if (this._zmesh) {
|
|
|
this._zmesh.position.copyFrom(position);
|
|
|
- var cross = BABYLON.Vector3.Cross(BABYLON.Vector3.Forward(), zaxis);
|
|
|
- this._zmesh.rotationQuaternion.set(cross.x, cross.y, cross.z, 1 + BABYLON.Vector3.Dot(BABYLON.Vector3.Forward(), zaxis));
|
|
|
- this._zmesh.rotationQuaternion.normalize();
|
|
|
+ zaxis.scaleToRef(-1, this._tmpVector);
|
|
|
+ this._zmesh.setDirection(this._tmpVector);
|
|
|
+ this._zmesh.scaling.setAll(this.scaleLines * this._scaleLinesFactor);
|
|
|
}
|
|
|
};
|
|
|
/** Releases resources */
|
|
@@ -66946,7 +67004,7 @@ var BABYLON;
|
|
|
* @returns true if visible otherwise, false
|
|
|
*/
|
|
|
DebugLayer.prototype.isVisible = function () {
|
|
|
- return this.BJSINSPECTOR.Inspector.IsVisible;
|
|
|
+ return this.BJSINSPECTOR && this.BJSINSPECTOR.Inspector.IsVisible;
|
|
|
};
|
|
|
/**
|
|
|
* Hide the inspector and close its window.
|
|
@@ -67005,6 +67063,9 @@ var BABYLON;
|
|
|
if (physicEngine) {
|
|
|
this._physicsEnginePlugin = physicEngine.getPhysicsPlugin();
|
|
|
}
|
|
|
+ this._utilityLayer = new BABYLON.UtilityLayerRenderer(this._scene, false);
|
|
|
+ this._utilityLayer.pickUtilitySceneFirst = false;
|
|
|
+ this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil = true;
|
|
|
}
|
|
|
/** @hidden */
|
|
|
PhysicsViewer.prototype._updateDebugMeshes = function () {
|
|
@@ -67039,7 +67100,7 @@ var BABYLON;
|
|
|
return null;
|
|
|
}
|
|
|
}
|
|
|
- var debugMesh = this._getDebugMesh(impostor, this._scene);
|
|
|
+ var debugMesh = this._getDebugMesh(impostor);
|
|
|
if (debugMesh) {
|
|
|
this._impostors[this._numMeshes] = impostor;
|
|
|
this._meshes[this._numMeshes] = debugMesh;
|
|
@@ -67056,17 +67117,18 @@ var BABYLON;
|
|
|
* @param impostor defines the impostor to hide
|
|
|
*/
|
|
|
PhysicsViewer.prototype.hideImpostor = function (impostor) {
|
|
|
- if (!impostor || !this._scene) {
|
|
|
+ if (!impostor || !this._scene || !this._utilityLayer) {
|
|
|
return;
|
|
|
}
|
|
|
var removed = false;
|
|
|
+ var utilityLayerScene = this._utilityLayer.utilityLayerScene;
|
|
|
for (var i = 0; i < this._numMeshes; i++) {
|
|
|
if (this._impostors[i] == impostor) {
|
|
|
var mesh = this._meshes[i];
|
|
|
if (!mesh) {
|
|
|
continue;
|
|
|
}
|
|
|
- this._scene.removeMesh(mesh);
|
|
|
+ utilityLayerScene.removeMesh(mesh);
|
|
|
mesh.dispose();
|
|
|
this._numMeshes--;
|
|
|
if (this._numMeshes > 0) {
|
|
@@ -67091,37 +67153,39 @@ var BABYLON;
|
|
|
if (!this._debugMaterial) {
|
|
|
this._debugMaterial = new BABYLON.StandardMaterial('', scene);
|
|
|
this._debugMaterial.wireframe = true;
|
|
|
+ this._debugMaterial.emissiveColor = BABYLON.Color3.White();
|
|
|
+ this._debugMaterial.disableLighting = true;
|
|
|
}
|
|
|
return this._debugMaterial;
|
|
|
};
|
|
|
PhysicsViewer.prototype._getDebugBoxMesh = function (scene) {
|
|
|
if (!this._debugBoxMesh) {
|
|
|
this._debugBoxMesh = BABYLON.MeshBuilder.CreateBox('physicsBodyBoxViewMesh', { size: 1 }, scene);
|
|
|
- this._debugBoxMesh.renderingGroupId = 1;
|
|
|
this._debugBoxMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
|
|
|
this._debugBoxMesh.material = this._getDebugMaterial(scene);
|
|
|
- scene.removeMesh(this._debugBoxMesh);
|
|
|
}
|
|
|
return this._debugBoxMesh.createInstance('physicsBodyBoxViewInstance');
|
|
|
};
|
|
|
PhysicsViewer.prototype._getDebugSphereMesh = function (scene) {
|
|
|
if (!this._debugSphereMesh) {
|
|
|
this._debugSphereMesh = BABYLON.MeshBuilder.CreateSphere('physicsBodySphereViewMesh', { diameter: 1 }, scene);
|
|
|
- this._debugSphereMesh.renderingGroupId = 1;
|
|
|
this._debugSphereMesh.rotationQuaternion = BABYLON.Quaternion.Identity();
|
|
|
this._debugSphereMesh.material = this._getDebugMaterial(scene);
|
|
|
- scene.removeMesh(this._debugSphereMesh);
|
|
|
}
|
|
|
return this._debugSphereMesh.createInstance('physicsBodyBoxViewInstance');
|
|
|
};
|
|
|
- PhysicsViewer.prototype._getDebugMesh = function (impostor, scene) {
|
|
|
+ PhysicsViewer.prototype._getDebugMesh = function (impostor) {
|
|
|
+ if (!this._utilityLayer) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
var mesh = null;
|
|
|
+ var utilityLayerScene = this._utilityLayer.utilityLayerScene;
|
|
|
if (impostor.type == BABYLON.PhysicsImpostor.BoxImpostor) {
|
|
|
- mesh = this._getDebugBoxMesh(scene);
|
|
|
+ mesh = this._getDebugBoxMesh(utilityLayerScene);
|
|
|
impostor.getBoxSizeToRef(mesh.scaling);
|
|
|
}
|
|
|
else if (impostor.type == BABYLON.PhysicsImpostor.SphereImpostor) {
|
|
|
- mesh = this._getDebugSphereMesh(scene);
|
|
|
+ mesh = this._getDebugSphereMesh(utilityLayerScene);
|
|
|
var radius = impostor.getRadius();
|
|
|
mesh.scaling.x = radius * 2;
|
|
|
mesh.scaling.y = radius * 2;
|
|
@@ -67146,6 +67210,10 @@ var BABYLON;
|
|
|
this._impostors.length = 0;
|
|
|
this._scene = null;
|
|
|
this._physicsEnginePlugin = null;
|
|
|
+ if (this._utilityLayer) {
|
|
|
+ this._utilityLayer.dispose();
|
|
|
+ this._utilityLayer = null;
|
|
|
+ }
|
|
|
};
|
|
|
return PhysicsViewer;
|
|
|
}());
|
|
@@ -70632,9 +70700,7 @@ var BABYLON;
|
|
|
vertexData.applyToMesh(plane, options.updatable);
|
|
|
if (options.sourcePlane) {
|
|
|
plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
|
|
|
- var dot = BABYLON.Vector3.Dot(plane.position, options.sourcePlane.normal);
|
|
|
- var flip = dot >= 0;
|
|
|
- plane.lookAt(BABYLON.Vector3.Zero(), 0, flip ? Math.PI : 0, 0);
|
|
|
+ plane.setDirection(options.sourcePlane.normal);
|
|
|
}
|
|
|
return plane;
|
|
|
};
|
|
@@ -79883,9 +79949,11 @@ var BABYLON;
|
|
|
}
|
|
|
// Environment texture
|
|
|
if (parsedData.environmentTexture !== undefined && parsedData.environmentTexture !== null) {
|
|
|
+ // PBR needed for both HDR texture (gamma space) & a sky box
|
|
|
+ var isPBR = parsedData.isPBR !== undefined ? parsedData.isPBR : true;
|
|
|
if (parsedData.environmentTextureType && parsedData.environmentTextureType === "BABYLON.HDRCubeTexture") {
|
|
|
var hdrSize = (parsedData.environmentTextureSize) ? parsedData.environmentTextureSize : 128;
|
|
|
- var hdrTexture = new BABYLON.HDRCubeTexture(rootUrl + parsedData.environmentTexture, scene, hdrSize);
|
|
|
+ var hdrTexture = new BABYLON.HDRCubeTexture(rootUrl + parsedData.environmentTexture, scene, hdrSize, true, !isPBR);
|
|
|
if (parsedData.environmentTextureRotationY) {
|
|
|
hdrTexture.rotationY = parsedData.environmentTextureRotationY;
|
|
|
}
|
|
@@ -79901,8 +79969,7 @@ var BABYLON;
|
|
|
if (parsedData.createDefaultSkybox === true) {
|
|
|
var skyboxScale = (scene.activeCamera !== undefined && scene.activeCamera !== null) ? (scene.activeCamera.maxZ - scene.activeCamera.minZ) / 2 : 1000;
|
|
|
var skyboxBlurLevel = parsedData.skyboxBlurLevel || 0;
|
|
|
- var skyboxIsPBR = parsedData.skyboxIsPBR !== undefined ? parsedData.skyboxIsPBR : true;
|
|
|
- scene.createDefaultSkybox(scene.environmentTexture, skyboxIsPBR, skyboxScale, skyboxBlurLevel);
|
|
|
+ scene.createDefaultSkybox(scene.environmentTexture, isPBR, skyboxScale, skyboxBlurLevel);
|
|
|
}
|
|
|
}
|
|
|
// Finish
|
|
@@ -90568,6 +90635,9 @@ var BABYLON;
|
|
|
case ImageProcessingConfiguration.TONEMAPPING_ACES:
|
|
|
defines.TONEMAPPING_ACES = true;
|
|
|
break;
|
|
|
+ default:
|
|
|
+ defines.TONEMAPPING_ACES = false;
|
|
|
+ break;
|
|
|
}
|
|
|
defines.CONTRAST = (this.contrast !== 1.0);
|
|
|
defines.EXPOSURE = (this.exposure !== 1.0);
|
|
@@ -92902,6 +92972,8 @@ var BABYLON;
|
|
|
_this._worldTransform = new BABYLON.Matrix();
|
|
|
_this._needToDecompose = true;
|
|
|
_this._needToCompose = false;
|
|
|
+ /** @hidden */
|
|
|
+ _this._linkedTransformNode = null;
|
|
|
_this._skeleton = skeleton;
|
|
|
_this._localMatrix = localMatrix ? localMatrix.clone() : BABYLON.Matrix.Identity();
|
|
|
_this._restPose = restPose ? restPose : _this._localMatrix.clone();
|
|
@@ -93017,6 +93089,20 @@ var BABYLON;
|
|
|
Bone.prototype.getAbsoluteTransform = function () {
|
|
|
return this._absoluteTransform;
|
|
|
};
|
|
|
+ /**
|
|
|
+ * Links with the given transform node.
|
|
|
+ * The local matrix of this bone is copied from the transform node every frame.
|
|
|
+ * @param transformNode defines the transform node to link to
|
|
|
+ */
|
|
|
+ Bone.prototype.linkTransformNode = function (transformNode) {
|
|
|
+ if (this._linkedTransformNode) {
|
|
|
+ this._skeleton._numBonesWithLinkedTransformNode--;
|
|
|
+ }
|
|
|
+ this._linkedTransformNode = transformNode;
|
|
|
+ if (this._linkedTransformNode) {
|
|
|
+ this._skeleton._numBonesWithLinkedTransformNode++;
|
|
|
+ }
|
|
|
+ };
|
|
|
Object.defineProperty(Bone.prototype, "position", {
|
|
|
// Properties (matches AbstractMesh properties)
|
|
|
/** Gets or sets current position (in local space) */
|
|
@@ -94562,19 +94648,25 @@ var BABYLON;
|
|
|
this.name = name;
|
|
|
this.id = id;
|
|
|
/**
|
|
|
- * Gets the list of child bones
|
|
|
+ * Defines the list of child bones
|
|
|
*/
|
|
|
this.bones = new Array();
|
|
|
/**
|
|
|
- * Gets a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)
|
|
|
+ * Defines a boolean indicating if the root matrix is provided by meshes or by the current skeleton (this is the default value)
|
|
|
*/
|
|
|
this.needInitialSkinMatrix = false;
|
|
|
+ /**
|
|
|
+ * Defines a mesh that override the matrix used to get the world matrix (null by default).
|
|
|
+ */
|
|
|
+ this.overrideMesh = null;
|
|
|
this._isDirty = true;
|
|
|
this._meshesWithPoseMatrix = new Array();
|
|
|
this._identity = BABYLON.Matrix.Identity();
|
|
|
this._ranges = {};
|
|
|
this._lastAbsoluteTransformsUpdateId = -1;
|
|
|
this._canUseTextureForBones = false;
|
|
|
+ /** @hidden */
|
|
|
+ this._numBonesWithLinkedTransformNode = 0;
|
|
|
/**
|
|
|
* Specifies if the skeleton should be serialized
|
|
|
*/
|
|
@@ -94865,6 +94957,18 @@ var BABYLON;
|
|
|
* Build all resources required to render a skeleton
|
|
|
*/
|
|
|
Skeleton.prototype.prepare = function () {
|
|
|
+ // Update the local matrix of bones with linked transform nodes.
|
|
|
+ if (this._numBonesWithLinkedTransformNode > 0) {
|
|
|
+ for (var _i = 0, _a = this.bones; _i < _a.length; _i++) {
|
|
|
+ var bone_1 = _a[_i];
|
|
|
+ if (bone_1._linkedTransformNode) {
|
|
|
+ // Computing the world matrix also computes the local matrix.
|
|
|
+ bone_1._linkedTransformNode.computeWorldMatrix();
|
|
|
+ bone_1._matrix = bone_1._linkedTransformNode._localMatrix;
|
|
|
+ bone_1.markAsDirty();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
if (!this._isDirty) {
|
|
|
return;
|
|
|
}
|
|
@@ -98926,6 +99030,7 @@ var BABYLON;
|
|
|
this._originDirection = this._origin.subtract(this._originTop).normalize();
|
|
|
}
|
|
|
this._tickCallback = this._tick.bind(this);
|
|
|
+ this._prepareCylinder();
|
|
|
}
|
|
|
/**
|
|
|
* Returns the data related to the updraft event (cylinder).
|
|
@@ -98957,6 +99062,9 @@ var BABYLON;
|
|
|
PhysicsUpdraftEvent.prototype.dispose = function (force) {
|
|
|
var _this = this;
|
|
|
if (force === void 0) { force = true; }
|
|
|
+ if (!this._cylinder) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (force) {
|
|
|
this._cylinder.dispose();
|
|
|
}
|
|
@@ -99008,7 +99116,6 @@ var BABYLON;
|
|
|
};
|
|
|
PhysicsUpdraftEvent.prototype._intersectsWithCylinder = function (impostor) {
|
|
|
var impostorObject = impostor.object;
|
|
|
- this._prepareCylinder();
|
|
|
this._cylinder.position = this._cylinderPosition;
|
|
|
return this._cylinder.intersectsMesh(impostorObject, true);
|
|
|
};
|
|
@@ -99043,6 +99150,7 @@ var BABYLON;
|
|
|
this._origin.addToRef(new BABYLON.Vector3(0, this._height / 2, 0), this._cylinderPosition);
|
|
|
this._origin.addToRef(new BABYLON.Vector3(0, this._height, 0), this._originTop);
|
|
|
this._tickCallback = this._tick.bind(this);
|
|
|
+ this._prepareCylinder();
|
|
|
}
|
|
|
/**
|
|
|
* Returns the data related to the vortex event (cylinder).
|
|
@@ -99147,7 +99255,6 @@ var BABYLON;
|
|
|
};
|
|
|
PhysicsVortexEvent.prototype._intersectsWithCylinder = function (impostor) {
|
|
|
var impostorObject = impostor.object;
|
|
|
- this._prepareCylinder();
|
|
|
this._cylinder.position = this._cylinderPosition;
|
|
|
return this._cylinder.intersectsMesh(impostorObject, true);
|
|
|
};
|
|
@@ -102136,10 +102243,12 @@ var BABYLON;
|
|
|
/**
|
|
|
* Instantiates a UtilityLayerRenderer
|
|
|
* @param originalScene the original scene that will be rendered on top of
|
|
|
+ * @param handleEvents boolean indicating if the utility layer should handle events
|
|
|
*/
|
|
|
function UtilityLayerRenderer(
|
|
|
/** the original scene that will be rendered on top of */
|
|
|
- originalScene) {
|
|
|
+ originalScene, handleEvents) {
|
|
|
+ if (handleEvents === void 0) { handleEvents = true; }
|
|
|
var _this = this;
|
|
|
this.originalScene = originalScene;
|
|
|
this._pointerCaptures = {};
|
|
@@ -102171,92 +102280,94 @@ var BABYLON;
|
|
|
originalScene.getEngine().scenes.pop();
|
|
|
// Detach controls on utility scene, events will be fired by logic below to handle picking priority
|
|
|
this.utilityLayerScene.detachControl();
|
|
|
- this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
|
|
|
- if (!_this.processAllEvents) {
|
|
|
- if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
|
|
|
- && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
|
|
|
- && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
- var pointerEvent = (prePointerInfo.event);
|
|
|
- if (originalScene.isPointerCaptured(pointerEvent.pointerId)) {
|
|
|
- _this._pointerCaptures[pointerEvent.pointerId] = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- var utilityScenePick = prePointerInfo.ray ? _this.utilityLayerScene.pickWithRay(prePointerInfo.ray) : _this.utilityLayerScene.pick(originalScene.pointerX, originalScene.pointerY);
|
|
|
- if (!prePointerInfo.ray && utilityScenePick) {
|
|
|
- prePointerInfo.ray = utilityScenePick.ray;
|
|
|
- }
|
|
|
- // always fire the prepointer oversvable
|
|
|
- _this.utilityLayerScene.onPrePointerObservable.notifyObservers(prePointerInfo);
|
|
|
- // allow every non pointer down event to flow to the utility layer
|
|
|
- if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
- if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
- _this.utilityLayerScene.onPointerObservable.notifyObservers(new BABYLON.PointerInfo(prePointerInfo.type, prePointerInfo.event, utilityScenePick));
|
|
|
+ if (handleEvents) {
|
|
|
+ this._originalPointerObserver = originalScene.onPrePointerObservable.add(function (prePointerInfo, eventState) {
|
|
|
+ if (!_this.processAllEvents) {
|
|
|
+ if (prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERMOVE
|
|
|
+ && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERUP
|
|
|
+ && prePointerInfo.type !== BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
}
|
|
|
- if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {
|
|
|
+ var pointerEvent = (prePointerInfo.event);
|
|
|
+ if (originalScene.isPointerCaptured(pointerEvent.pointerId)) {
|
|
|
_this._pointerCaptures[pointerEvent.pointerId] = false;
|
|
|
+ return;
|
|
|
}
|
|
|
- return;
|
|
|
- }
|
|
|
- if (_this.utilityLayerScene.autoClearDepthAndStencil || _this.pickUtilitySceneFirst) {
|
|
|
- // If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
|
|
|
- if (utilityScenePick && utilityScenePick.hit) {
|
|
|
+ var utilityScenePick = prePointerInfo.ray ? _this.utilityLayerScene.pickWithRay(prePointerInfo.ray) : _this.utilityLayerScene.pick(originalScene.pointerX, originalScene.pointerY);
|
|
|
+ if (!prePointerInfo.ray && utilityScenePick) {
|
|
|
+ prePointerInfo.ray = utilityScenePick.ray;
|
|
|
+ }
|
|
|
+ // always fire the prepointer oversvable
|
|
|
+ _this.utilityLayerScene.onPrePointerObservable.notifyObservers(prePointerInfo);
|
|
|
+ // allow every non pointer down event to flow to the utility layer
|
|
|
+ if (_this.onlyCheckPointerDownEvents && prePointerInfo.type != BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
_this.utilityLayerScene.onPointerObservable.notifyObservers(new BABYLON.PointerInfo(prePointerInfo.type, prePointerInfo.event, utilityScenePick));
|
|
|
}
|
|
|
- prePointerInfo.skipOnPointerObservable = true;
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- var originalScenePick = prePointerInfo.ray ? originalScene.pickWithRay(prePointerInfo.ray) : originalScene.pick(originalScene.pointerX, originalScene.pointerY);
|
|
|
- var pointerEvent_1 = (prePointerInfo.event);
|
|
|
- // If the layer can be occluded by the original scene, only fire pointer events to the first layer that hit they ray
|
|
|
- if (originalScenePick && utilityScenePick) {
|
|
|
- // No pick in utility scene
|
|
|
- if (utilityScenePick.distance === 0 && originalScenePick.pickedMesh) {
|
|
|
- if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {
|
|
|
- // We touched an utility mesh present in the main scene
|
|
|
- _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);
|
|
|
- prePointerInfo.skipOnPointerObservable = true;
|
|
|
- }
|
|
|
- else if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
- _this._pointerCaptures[pointerEvent_1.pointerId] = true;
|
|
|
- }
|
|
|
- else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {
|
|
|
- // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete
|
|
|
- _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);
|
|
|
- delete _this._lastPointerEvents[pointerEvent_1.pointerId];
|
|
|
- }
|
|
|
+ if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERUP && _this._pointerCaptures[pointerEvent.pointerId]) {
|
|
|
+ _this._pointerCaptures[pointerEvent.pointerId] = false;
|
|
|
}
|
|
|
- else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance < originalScenePick.distance || originalScenePick.distance === 0)) {
|
|
|
- // We pick something in utility scene or the pick in utility is closer than the one in main scene
|
|
|
- _this._notifyObservers(prePointerInfo, utilityScenePick, pointerEvent_1);
|
|
|
- // If a previous utility layer set this, do not unset this
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ if (_this.utilityLayerScene.autoClearDepthAndStencil || _this.pickUtilitySceneFirst) {
|
|
|
+ // If this layer is an overlay, check if this layer was hit and if so, skip pointer events for the main scene
|
|
|
+ if (utilityScenePick && utilityScenePick.hit) {
|
|
|
if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
- prePointerInfo.skipOnPointerObservable = utilityScenePick.distance > 0;
|
|
|
+ _this.utilityLayerScene.onPointerObservable.notifyObservers(new BABYLON.PointerInfo(prePointerInfo.type, prePointerInfo.event, utilityScenePick));
|
|
|
}
|
|
|
+ prePointerInfo.skipOnPointerObservable = true;
|
|
|
}
|
|
|
- else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance > originalScenePick.distance)) {
|
|
|
- // We have a pick in both scenes but main is closer than utility
|
|
|
- // We touched an utility mesh present in the main scene
|
|
|
- if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {
|
|
|
- _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);
|
|
|
- prePointerInfo.skipOnPointerObservable = true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ var originalScenePick = prePointerInfo.ray ? originalScene.pickWithRay(prePointerInfo.ray) : originalScene.pick(originalScene.pointerX, originalScene.pointerY);
|
|
|
+ var pointerEvent_1 = (prePointerInfo.event);
|
|
|
+ // If the layer can be occluded by the original scene, only fire pointer events to the first layer that hit they ray
|
|
|
+ if (originalScenePick && utilityScenePick) {
|
|
|
+ // No pick in utility scene
|
|
|
+ if (utilityScenePick.distance === 0 && originalScenePick.pickedMesh) {
|
|
|
+ if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {
|
|
|
+ // We touched an utility mesh present in the main scene
|
|
|
+ _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);
|
|
|
+ prePointerInfo.skipOnPointerObservable = true;
|
|
|
+ }
|
|
|
+ else if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERDOWN) {
|
|
|
+ _this._pointerCaptures[pointerEvent_1.pointerId] = true;
|
|
|
+ }
|
|
|
+ else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {
|
|
|
+ // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete
|
|
|
+ _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);
|
|
|
+ delete _this._lastPointerEvents[pointerEvent_1.pointerId];
|
|
|
+ }
|
|
|
}
|
|
|
- else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {
|
|
|
- // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete
|
|
|
- _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);
|
|
|
- delete _this._lastPointerEvents[pointerEvent_1.pointerId];
|
|
|
+ else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance < originalScenePick.distance || originalScenePick.distance === 0)) {
|
|
|
+ // We pick something in utility scene or the pick in utility is closer than the one in main scene
|
|
|
+ _this._notifyObservers(prePointerInfo, utilityScenePick, pointerEvent_1);
|
|
|
+ // If a previous utility layer set this, do not unset this
|
|
|
+ if (!prePointerInfo.skipOnPointerObservable) {
|
|
|
+ prePointerInfo.skipOnPointerObservable = utilityScenePick.distance > 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if (!_this._pointerCaptures[pointerEvent_1.pointerId] && (utilityScenePick.distance > originalScenePick.distance)) {
|
|
|
+ // We have a pick in both scenes but main is closer than utility
|
|
|
+ // We touched an utility mesh present in the main scene
|
|
|
+ if (_this.mainSceneTrackerPredicate && _this.mainSceneTrackerPredicate(originalScenePick.pickedMesh)) {
|
|
|
+ _this._notifyObservers(prePointerInfo, originalScenePick, pointerEvent_1);
|
|
|
+ prePointerInfo.skipOnPointerObservable = true;
|
|
|
+ }
|
|
|
+ else if (_this._lastPointerEvents[pointerEvent_1.pointerId]) {
|
|
|
+ // We need to send a last pointerup to the utilityLayerScene to make sure animations can complete
|
|
|
+ _this.onPointerOutObservable.notifyObservers(pointerEvent_1.pointerId);
|
|
|
+ delete _this._lastPointerEvents[pointerEvent_1.pointerId];
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERUP && _this._pointerCaptures[pointerEvent_1.pointerId]) {
|
|
|
+ _this._pointerCaptures[pointerEvent_1.pointerId] = false;
|
|
|
}
|
|
|
- }
|
|
|
- if (prePointerInfo.type === BABYLON.PointerEventTypes.POINTERUP && _this._pointerCaptures[pointerEvent_1.pointerId]) {
|
|
|
- _this._pointerCaptures[pointerEvent_1.pointerId] = false;
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
+ });
|
|
|
+ }
|
|
|
// Render directly on top of existing scene without clearing
|
|
|
this.utilityLayerScene.autoClear = false;
|
|
|
this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
|
|
@@ -109334,6 +109445,7 @@ var BABYLON;
|
|
|
newCamera.minZ = 0;
|
|
|
newCamera.parent = this;
|
|
|
newCamera.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
+ newCamera.updateUpVectorFromRotation = true;
|
|
|
this.rigCameras.push(newCamera);
|
|
|
}
|
|
|
while (this.rigCameras.length > viewCount) {
|
|
@@ -121118,6 +121230,7 @@ var BABYLON;
|
|
|
hdrSkybox.infiniteDistance = true;
|
|
|
hdrSkybox.material = skyboxMaterial;
|
|
|
}
|
|
|
+ hdrSkybox.isPickable = false;
|
|
|
return hdrSkybox;
|
|
|
};
|
|
|
BABYLON.Scene.prototype.createDefaultEnvironment = function (options) {
|