|
@@ -12666,8 +12666,10 @@ var BABYLON;
|
|
|
this._onCanvasPointerOut = function (ev) {
|
|
|
_this.onCanvasPointerOutObservable.notifyObservers(ev);
|
|
|
};
|
|
|
- window.addEventListener("blur", this._onBlur);
|
|
|
- window.addEventListener("focus", this._onFocus);
|
|
|
+ if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
|
+ window.addEventListener("blur", this._onBlur);
|
|
|
+ window.addEventListener("focus", this._onFocus);
|
|
|
+ }
|
|
|
canvas.addEventListener("pointerout", this._onCanvasPointerOut);
|
|
|
// Context lost
|
|
|
if (!this._doNotHandleContextLost) {
|
|
@@ -12711,8 +12713,9 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
// Viewport
|
|
|
- var limitDeviceRatio = options.limitDeviceRatio || window.devicePixelRatio || 1.0;
|
|
|
- this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, window.devicePixelRatio || 1.0) : 1.0;
|
|
|
+ var devicePixelRatio = BABYLON.Tools.IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;
|
|
|
+ var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;
|
|
|
+ this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;
|
|
|
this.resize();
|
|
|
this._isStencilEnable = options.stencil ? true : false;
|
|
|
this._initGLContext();
|
|
@@ -12765,8 +12768,10 @@ var BABYLON;
|
|
|
this._onVRDisplayPointerUnrestricted = function () {
|
|
|
document.exitPointerLock();
|
|
|
};
|
|
|
- window.addEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted, false);
|
|
|
- window.addEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted, false);
|
|
|
+ if (BABYLON.Tools.IsWindowObjectExist()) {
|
|
|
+ window.addEventListener('vrdisplaypointerrestricted', this._onVRDisplayPointerRestricted, false);
|
|
|
+ window.addEventListener('vrdisplaypointerunrestricted', this._onVRDisplayPointerUnrestricted, false);
|
|
|
+ }
|
|
|
}
|
|
|
// Create Audio Engine if needed.
|
|
|
if (!Engine.audioEngine && options.audioEngine && Engine.AudioEngineFactory) {
|
|
@@ -27665,6 +27670,32 @@ var BABYLON;
|
|
|
return animatable;
|
|
|
};
|
|
|
/**
|
|
|
+ * Will start the animation sequence of a given target and its hierarchy
|
|
|
+ * @param target defines the target
|
|
|
+ * @param directDescendantsOnly if true only direct descendants will be used, if false direct and also indirect (children of children, an so on in a recursive manner) descendants will be used.
|
|
|
+ * @param from defines from which frame should animation start
|
|
|
+ * @param to defines until which frame should animation run.
|
|
|
+ * @param loop defines if the animation loops
|
|
|
+ * @param speedRatio defines the speed in which to run the animation (1.0 by default)
|
|
|
+ * @param onAnimationEnd defines the function to be executed when the animation ends
|
|
|
+ * @param animatable defines an animatable object. If not provided a new one will be created from the given params
|
|
|
+ * @param stopCurrent defines if the current animations must be stopped first (true by default)
|
|
|
+ * @param targetMask defines if the target should be animated if animations are present (this is called recursively on descendant animatables regardless of return value)
|
|
|
+ * @returns the animatable object created for this animation
|
|
|
+ */
|
|
|
+ Scene.prototype.beginHierarchyAnimation = function (target, directDescendantsOnly, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask) {
|
|
|
+ if (speedRatio === void 0) { speedRatio = 1.0; }
|
|
|
+ if (stopCurrent === void 0) { stopCurrent = true; }
|
|
|
+ var children = target.getDescendants(directDescendantsOnly);
|
|
|
+ var result = [];
|
|
|
+ result.push(this.beginAnimation(target, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));
|
|
|
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
|
+ var child = children_1[_i];
|
|
|
+ result.push(this.beginAnimation(child, from, to, loop, speedRatio, onAnimationEnd, animatable, stopCurrent, targetMask));
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ };
|
|
|
+ /**
|
|
|
* Begin a new animation on a given node
|
|
|
* @param target defines the target where the animation will take place
|
|
|
* @param animations defines the list of animations to start
|
|
@@ -27698,8 +27729,8 @@ var BABYLON;
|
|
|
var children = target.getDescendants(directDescendantsOnly);
|
|
|
var result = [];
|
|
|
result.push(this.beginDirectAnimation(target, animations, from, to, loop, speedRatio, onAnimationEnd));
|
|
|
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
|
|
|
- var child = children_1[_i];
|
|
|
+ for (var _i = 0, children_2 = children; _i < children_2.length; _i++) {
|
|
|
+ var child = children_2[_i];
|
|
|
result.push(this.beginDirectAnimation(child, animations, from, to, loop, speedRatio, onAnimationEnd));
|
|
|
}
|
|
|
return result;
|
|
@@ -97067,7 +97098,7 @@ var BABYLON;
|
|
|
BABYLON.Tools.Error("No object was provided. A physics object is obligatory");
|
|
|
return;
|
|
|
}
|
|
|
- //legacy support for old syntax.
|
|
|
+ // Legacy support for old syntax.
|
|
|
if (!this._scene && object.getScene) {
|
|
|
this._scene = object.getScene();
|
|
|
}
|
|
@@ -99260,10 +99291,6 @@ var BABYLON;
|
|
|
bodyConfig.pos.push(center.y);
|
|
|
bodyConfig.pos.push(center.z);
|
|
|
bodyConfig.posShape.push(0, 0, 0);
|
|
|
- //tmp solution
|
|
|
- bodyConfig.rot.push(0);
|
|
|
- bodyConfig.rot.push(0);
|
|
|
- bodyConfig.rot.push(0);
|
|
|
bodyConfig.rotShape.push(0, 0, 0);
|
|
|
}
|
|
|
else {
|
|
@@ -99272,10 +99299,6 @@ var BABYLON;
|
|
|
bodyConfig.posShape.push(localPosition.y);
|
|
|
bodyConfig.posShape.push(localPosition.z);
|
|
|
bodyConfig.pos.push(0, 0, 0);
|
|
|
- //tmp solution until https://github.com/lo-th/OIMO.js/pull/37 is merged
|
|
|
- bodyConfig.rot.push(0);
|
|
|
- bodyConfig.rot.push(0);
|
|
|
- bodyConfig.rot.push(0);
|
|
|
bodyConfig.rotShape.push(rot.x * radToDeg);
|
|
|
bodyConfig.rotShape.push(rot.y * radToDeg);
|
|
|
bodyConfig.rotShape.push(rot.z * radToDeg);
|