|
@@ -4929,6 +4929,21 @@ var BABYLON;
|
|
result._observers = this._observers.slice(0);
|
|
result._observers = this._observers.slice(0);
|
|
return result;
|
|
return result;
|
|
};
|
|
};
|
|
|
|
+ /**
|
|
|
|
+ * Does this observable handles observer registered with a given mask
|
|
|
|
+ * @param {number} trigger - the mask to be tested
|
|
|
|
+ * @return {boolean} whether or not one observer registered with the given mask is handeled
|
|
|
|
+ **/
|
|
|
|
+ Observable.prototype.hasSpecificMask = function (mask) {
|
|
|
|
+ if (mask === void 0) { mask = -1; }
|
|
|
|
+ for (var _i = 0, _a = this._observers; _i < _a.length; _i++) {
|
|
|
|
+ var obs = _a[_i];
|
|
|
|
+ if (obs.mask & mask && obs.mask === mask) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
return Observable;
|
|
return Observable;
|
|
}());
|
|
}());
|
|
BABYLON.Observable = Observable;
|
|
BABYLON.Observable = Observable;
|
|
@@ -16157,7 +16172,7 @@ var BABYLON;
|
|
this._rigCameras[0].getProjectionMatrix = this._getWebVRProjectionMatrix;
|
|
this._rigCameras[0].getProjectionMatrix = this._getWebVRProjectionMatrix;
|
|
this._rigCameras[0]._getViewMatrix = this._getWebVRViewMatrix;
|
|
this._rigCameras[0]._getViewMatrix = this._getWebVRViewMatrix;
|
|
this._rigCameras[0]._isSynchronizedViewMatrix = this._isSynchronizedViewMatrix;
|
|
this._rigCameras[0]._isSynchronizedViewMatrix = this._isSynchronizedViewMatrix;
|
|
- this._rigCameras[0]._updateCameraRotationMatrix = this._updateCameraRotationMatrix;
|
|
|
|
|
|
+ this._rigCameras[0]._updateCameraRotationMatrix = this._updateWebVRCameraRotationMatrix;
|
|
//Right eye
|
|
//Right eye
|
|
this._rigCameras[1].viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
|
|
this._rigCameras[1].viewport = new BABYLON.Viewport(0.5, 0, 0.5, 1.0);
|
|
this._rigCameras[1].setCameraRigParameter('eyeParameters', rightEye);
|
|
this._rigCameras[1].setCameraRigParameter('eyeParameters', rightEye);
|
|
@@ -16167,7 +16182,7 @@ var BABYLON;
|
|
this._rigCameras[1].getProjectionMatrix = this._getWebVRProjectionMatrix;
|
|
this._rigCameras[1].getProjectionMatrix = this._getWebVRProjectionMatrix;
|
|
this._rigCameras[1]._getViewMatrix = this._getWebVRViewMatrix;
|
|
this._rigCameras[1]._getViewMatrix = this._getWebVRViewMatrix;
|
|
this._rigCameras[1]._isSynchronizedViewMatrix = this._isSynchronizedViewMatrix;
|
|
this._rigCameras[1]._isSynchronizedViewMatrix = this._isSynchronizedViewMatrix;
|
|
- this._rigCameras[1]._updateCameraRotationMatrix = this._updateCameraRotationMatrix;
|
|
|
|
|
|
+ this._rigCameras[1]._updateCameraRotationMatrix = this._updateWebVRCameraRotationMatrix;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -16181,7 +16196,10 @@ var BABYLON;
|
|
return this._projectionMatrix;
|
|
return this._projectionMatrix;
|
|
};
|
|
};
|
|
Camera.prototype._updateCameraRotationMatrix = function () {
|
|
Camera.prototype._updateCameraRotationMatrix = function () {
|
|
- // only here for webvr
|
|
|
|
|
|
+ //Here for WebVR
|
|
|
|
+ };
|
|
|
|
+ Camera.prototype._updateWebVRCameraRotationMatrix = function () {
|
|
|
|
+ //Here for WebVR
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* This function MUST be overwritten by the different WebVR cameras available.
|
|
* This function MUST be overwritten by the different WebVR cameras available.
|
|
@@ -19374,6 +19392,55 @@ var BABYLON;
|
|
|
|
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
|
|
+ var ClickInfo = (function () {
|
|
|
|
+ function ClickInfo() {
|
|
|
|
+ this._singleClick = false;
|
|
|
|
+ this._doubleClick = false;
|
|
|
|
+ this._hasSwiped = false;
|
|
|
|
+ this._ignore = false;
|
|
|
|
+ }
|
|
|
|
+ Object.defineProperty(ClickInfo.prototype, "singleClick", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._singleClick;
|
|
|
|
+ },
|
|
|
|
+ set: function (b) {
|
|
|
|
+ this._singleClick = b;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(ClickInfo.prototype, "doubleClick", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._doubleClick;
|
|
|
|
+ },
|
|
|
|
+ set: function (b) {
|
|
|
|
+ this._doubleClick = b;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(ClickInfo.prototype, "hasSwiped", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._hasSwiped;
|
|
|
|
+ },
|
|
|
|
+ set: function (b) {
|
|
|
|
+ this._hasSwiped = b;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(ClickInfo.prototype, "ignore", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return this._ignore;
|
|
|
|
+ },
|
|
|
|
+ set: function (b) {
|
|
|
|
+ this._ignore = b;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ return ClickInfo;
|
|
|
|
+ }());
|
|
var PointerEventTypes = (function () {
|
|
var PointerEventTypes = (function () {
|
|
function PointerEventTypes() {
|
|
function PointerEventTypes() {
|
|
}
|
|
}
|
|
@@ -19412,6 +19479,20 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(PointerEventTypes, "POINTERTAP", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return PointerEventTypes._POINTERTAP;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(PointerEventTypes, "POINTERDOUBLETAP", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return PointerEventTypes._POINTERDOUBLETAP;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
return PointerEventTypes;
|
|
return PointerEventTypes;
|
|
}());
|
|
}());
|
|
PointerEventTypes._POINTERDOWN = 0x01;
|
|
PointerEventTypes._POINTERDOWN = 0x01;
|
|
@@ -19419,6 +19500,8 @@ var BABYLON;
|
|
PointerEventTypes._POINTERMOVE = 0x04;
|
|
PointerEventTypes._POINTERMOVE = 0x04;
|
|
PointerEventTypes._POINTERWHEEL = 0x08;
|
|
PointerEventTypes._POINTERWHEEL = 0x08;
|
|
PointerEventTypes._POINTERPICK = 0x10;
|
|
PointerEventTypes._POINTERPICK = 0x10;
|
|
|
|
+ PointerEventTypes._POINTERTAP = 0x20;
|
|
|
|
+ PointerEventTypes._POINTERDOUBLETAP = 0x40;
|
|
BABYLON.PointerEventTypes = PointerEventTypes;
|
|
BABYLON.PointerEventTypes = PointerEventTypes;
|
|
var PointerInfoBase = (function () {
|
|
var PointerInfoBase = (function () {
|
|
function PointerInfoBase(type, event) {
|
|
function PointerInfoBase(type, event) {
|
|
@@ -19597,9 +19680,17 @@ var BABYLON;
|
|
* Observable event triggered each time an input event is received from the rendering canvas
|
|
* Observable event triggered each time an input event is received from the rendering canvas
|
|
*/
|
|
*/
|
|
this.onPointerObservable = new BABYLON.Observable();
|
|
this.onPointerObservable = new BABYLON.Observable();
|
|
|
|
+ this._meshPickProceed = false;
|
|
|
|
+ this._previousHasSwiped = false;
|
|
|
|
+ this._currentPickResult = null;
|
|
|
|
+ this._previousPickResult = null;
|
|
|
|
+ this._isButtonPressed = false;
|
|
|
|
+ this._doubleClickOccured = false;
|
|
this.cameraToUseForPointers = null; // Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position
|
|
this.cameraToUseForPointers = null; // Define this parameter if you are using multiple cameras and you want to specify which one should be used for pointer position
|
|
this._startingPointerPosition = new BABYLON.Vector2(0, 0);
|
|
this._startingPointerPosition = new BABYLON.Vector2(0, 0);
|
|
|
|
+ this._previousStartingPointerPosition = new BABYLON.Vector2(0, 0);
|
|
this._startingPointerTime = 0;
|
|
this._startingPointerTime = 0;
|
|
|
|
+ this._previousStartingPointerTime = 0;
|
|
// Fog
|
|
// Fog
|
|
/**
|
|
/**
|
|
* is fog enabled on this scene.
|
|
* is fog enabled on this scene.
|
|
@@ -20051,6 +20142,123 @@ var BABYLON;
|
|
if (attachUp === void 0) { attachUp = true; }
|
|
if (attachUp === void 0) { attachUp = true; }
|
|
if (attachDown === void 0) { attachDown = true; }
|
|
if (attachDown === void 0) { attachDown = true; }
|
|
if (attachMove === void 0) { attachMove = true; }
|
|
if (attachMove === void 0) { attachMove = true; }
|
|
|
|
+ this._initActionManager = function (act, clickInfo) {
|
|
|
|
+ if (!_this._meshPickProceed) {
|
|
|
|
+ var pickResult = _this.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, _this.pointerDownPredicate, false, _this.cameraToUseForPointers);
|
|
|
|
+ _this._currentPickResult = pickResult;
|
|
|
|
+ act = (pickResult.hit && pickResult.pickedMesh) ? pickResult.pickedMesh.actionManager : null;
|
|
|
|
+ _this._meshPickProceed = true;
|
|
|
|
+ }
|
|
|
|
+ return act;
|
|
|
|
+ };
|
|
|
|
+ this._delayedSimpleClick = function (btn, clickInfo, cb) {
|
|
|
|
+ // double click delay is over and that no double click has been raised since, or the 2 consecutive keys pressed are different
|
|
|
|
+ if ((new Date().getTime() - _this._previousStartingPointerTime > Scene.DoubleClickDelay && !_this._doubleClickOccured) ||
|
|
|
|
+ btn !== _this._previousButtonPressed) {
|
|
|
|
+ _this._doubleClickOccured = false;
|
|
|
|
+ clickInfo.singleClick = true;
|
|
|
|
+ clickInfo.ignore = false;
|
|
|
|
+ cb(clickInfo, _this._currentPickResult);
|
|
|
|
+ }
|
|
|
|
+ };
|
|
|
|
+ this._initClickEvent = function (obs1, obs2, evt, cb) {
|
|
|
|
+ var clickInfo = new ClickInfo();
|
|
|
|
+ _this._currentPickResult = null;
|
|
|
|
+ var act;
|
|
|
|
+ var checkPicking = obs1.hasSpecificMask(PointerEventTypes.POINTERPICK) || obs2.hasSpecificMask(PointerEventTypes.POINTERPICK)
|
|
|
|
+ || obs1.hasSpecificMask(PointerEventTypes.POINTERTAP) || obs2.hasSpecificMask(PointerEventTypes.POINTERTAP)
|
|
|
|
+ || obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) || obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);
|
|
|
|
+ if (!checkPicking && BABYLON.ActionManager.HasPickTriggers) {
|
|
|
|
+ act = _this._initActionManager(act, clickInfo);
|
|
|
|
+ if (act)
|
|
|
|
+ checkPicking = act.hasPickTriggers;
|
|
|
|
+ }
|
|
|
|
+ if (checkPicking) {
|
|
|
|
+ var btn = evt.button;
|
|
|
|
+ clickInfo.hasSwiped = Math.abs(_this._startingPointerPosition.x - _this._pointerX) > Scene.DragMovementThreshold ||
|
|
|
|
+ Math.abs(_this._startingPointerPosition.y - _this._pointerY) > Scene.DragMovementThreshold;
|
|
|
|
+ if (!clickInfo.hasSwiped) {
|
|
|
|
+ var checkSingleClickImmediately = !Scene.ExclusiveDoubleClickMode;
|
|
|
|
+ if (!checkSingleClickImmediately) {
|
|
|
|
+ checkSingleClickImmediately = !obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) &&
|
|
|
|
+ !obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);
|
|
|
|
+ if (checkSingleClickImmediately && !BABYLON.ActionManager.HasSpecificTrigger(BABYLON.ActionManager.OnDoublePickTrigger)) {
|
|
|
|
+ act = _this._initActionManager(act, clickInfo);
|
|
|
|
+ if (act)
|
|
|
|
+ checkSingleClickImmediately = !act.hasSpecificTrigger(BABYLON.ActionManager.OnDoublePickTrigger);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (checkSingleClickImmediately) {
|
|
|
|
+ // single click detected if double click delay is over or two different successive keys pressed without exclusive double click or no double click required
|
|
|
|
+ if (new Date().getTime() - _this._previousStartingPointerTime > Scene.DoubleClickDelay ||
|
|
|
|
+ btn !== _this._previousButtonPressed) {
|
|
|
|
+ clickInfo.singleClick = true;
|
|
|
|
+ cb(clickInfo, _this._currentPickResult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ // wait that no double click has been raised during the double click delay
|
|
|
|
+ _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;
|
|
|
|
+ _this._delayedSimpleClickTimeout = window.setTimeout(_this._delayedSimpleClick.bind(_this, btn, clickInfo, cb), Scene.DoubleClickDelay);
|
|
|
|
+ }
|
|
|
|
+ var checkDoubleClick = obs1.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP) ||
|
|
|
|
+ obs2.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP);
|
|
|
|
+ if (!checkDoubleClick && BABYLON.ActionManager.HasSpecificTrigger(BABYLON.ActionManager.OnDoublePickTrigger)) {
|
|
|
|
+ act = _this._initActionManager(act, clickInfo);
|
|
|
|
+ if (act)
|
|
|
|
+ checkDoubleClick = act.hasSpecificTrigger(BABYLON.ActionManager.OnDoublePickTrigger);
|
|
|
|
+ }
|
|
|
|
+ if (checkDoubleClick) {
|
|
|
|
+ // two successive keys pressed are equal, double click delay is not over and double click has not just occurred
|
|
|
|
+ if (btn === _this._previousButtonPressed &&
|
|
|
|
+ new Date().getTime() - _this._previousStartingPointerTime < Scene.DoubleClickDelay &&
|
|
|
|
+ !_this._doubleClickOccured) {
|
|
|
|
+ // pointer has not moved for 2 clicks, it's a double click
|
|
|
|
+ if (!clickInfo.hasSwiped &&
|
|
|
|
+ Math.abs(_this._previousStartingPointerPosition.x - _this._startingPointerPosition.x) < Scene.DragMovementThreshold &&
|
|
|
|
+ Math.abs(_this._previousStartingPointerPosition.y - _this._startingPointerPosition.y) < Scene.DragMovementThreshold) {
|
|
|
|
+ _this._previousStartingPointerTime = 0;
|
|
|
|
+ _this._doubleClickOccured = true;
|
|
|
|
+ clickInfo.doubleClick = true;
|
|
|
|
+ clickInfo.ignore = false;
|
|
|
|
+ if (Scene.ExclusiveDoubleClickMode && _this._previousDelayedSimpleClickTimeout && _this._previousDelayedSimpleClickTimeout.clearTimeout)
|
|
|
|
+ _this._previousDelayedSimpleClickTimeout.clearTimeout();
|
|
|
|
+ _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;
|
|
|
|
+ cb(clickInfo, _this._currentPickResult);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this._doubleClickOccured = false;
|
|
|
|
+ _this._previousStartingPointerTime = _this._startingPointerTime;
|
|
|
|
+ _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;
|
|
|
|
+ _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;
|
|
|
|
+ _this._previousButtonPressed = btn;
|
|
|
|
+ _this._previousHasSwiped = clickInfo.hasSwiped;
|
|
|
|
+ if (Scene.ExclusiveDoubleClickMode) {
|
|
|
|
+ if (_this._previousDelayedSimpleClickTimeout && _this._previousDelayedSimpleClickTimeout.clearTimeout) {
|
|
|
|
+ _this._previousDelayedSimpleClickTimeout.clearTimeout();
|
|
|
|
+ }
|
|
|
|
+ _this._previousDelayedSimpleClickTimeout = _this._delayedSimpleClickTimeout;
|
|
|
|
+ cb(clickInfo, _this._previousPickResult);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ cb(clickInfo, _this._currentPickResult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ _this._doubleClickOccured = false;
|
|
|
|
+ _this._previousStartingPointerTime = _this._startingPointerTime;
|
|
|
|
+ _this._previousStartingPointerPosition.x = _this._startingPointerPosition.x;
|
|
|
|
+ _this._previousStartingPointerPosition.y = _this._startingPointerPosition.y;
|
|
|
|
+ _this._previousButtonPressed = btn;
|
|
|
|
+ _this._previousHasSwiped = clickInfo.hasSwiped;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ clickInfo.ignore = true;
|
|
|
|
+ cb(clickInfo, _this._currentPickResult);
|
|
|
|
+ };
|
|
var spritePredicate = function (sprite) {
|
|
var spritePredicate = function (sprite) {
|
|
return sprite.isPickable && sprite.actionManager && sprite.actionManager.hasPointerTriggers;
|
|
return sprite.isPickable && sprite.actionManager && sprite.actionManager.hasPointerTriggers;
|
|
};
|
|
};
|
|
@@ -20118,6 +20326,9 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
this._onPointerDown = function (evt) {
|
|
this._onPointerDown = function (evt) {
|
|
|
|
+ _this._isButtonPressed = true;
|
|
|
|
+ _this._pickedDownMesh = null;
|
|
|
|
+ _this._meshPickProceed = false;
|
|
_this._updatePointerPosition(evt);
|
|
_this._updatePointerPosition(evt);
|
|
// PreObservable support
|
|
// PreObservable support
|
|
if (_this.onPrePointerObservable.hasObservers()) {
|
|
if (_this.onPrePointerObservable.hasObservers()) {
|
|
@@ -20144,36 +20355,36 @@ var BABYLON;
|
|
var pickResult = _this.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, _this.pointerDownPredicate, false, _this.cameraToUseForPointers);
|
|
var pickResult = _this.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, _this.pointerDownPredicate, false, _this.cameraToUseForPointers);
|
|
if (pickResult.hit && pickResult.pickedMesh) {
|
|
if (pickResult.hit && pickResult.pickedMesh) {
|
|
_this._pickedDownMesh = pickResult.pickedMesh;
|
|
_this._pickedDownMesh = pickResult.pickedMesh;
|
|
- if (pickResult.pickedMesh.actionManager) {
|
|
|
|
- if (pickResult.pickedMesh.actionManager.hasPickTriggers) {
|
|
|
|
|
|
+ var actionManager = pickResult.pickedMesh.actionManager;
|
|
|
|
+ if (actionManager) {
|
|
|
|
+ if (actionManager.hasPickTriggers) {
|
|
|
|
+ actionManager.processTrigger(BABYLON.ActionManager.OnPickDownTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
switch (evt.button) {
|
|
switch (evt.button) {
|
|
case 0:
|
|
case 0:
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnLeftPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
|
|
+ actionManager.processTrigger(BABYLON.ActionManager.OnLeftPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
break;
|
|
break;
|
|
case 1:
|
|
case 1:
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnCenterPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
|
|
+ actionManager.processTrigger(BABYLON.ActionManager.OnCenterPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
break;
|
|
break;
|
|
case 2:
|
|
case 2:
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnRightPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
|
|
+ actionManager.processTrigger(BABYLON.ActionManager.OnRightPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- if (pickResult.pickedMesh.actionManager) {
|
|
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickDownTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
- if (pickResult.pickedMesh.actionManager && pickResult.pickedMesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnLongPressTrigger)) {
|
|
|
|
- var that = _this;
|
|
|
|
- window.setTimeout(function () {
|
|
|
|
- var pickResult = that.pick(that._unTranslatedPointerX, that._unTranslatedPointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnLongPressTrigger); }, false, that.cameraToUseForPointers);
|
|
|
|
|
|
+ if (actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnLongPressTrigger)) {
|
|
|
|
+ window.setTimeout((function () {
|
|
|
|
+ var _this = this;
|
|
|
|
+ var pickResult = this.pick(this._unTranslatedPointerX, this._unTranslatedPointerY, function (mesh) { return mesh.isPickable && mesh.isVisible && mesh.isReady() && mesh.actionManager && mesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnLongPressTrigger) && mesh == _this._pickedDownMesh; }, false, this.cameraToUseForPointers);
|
|
if (pickResult.hit && pickResult.pickedMesh) {
|
|
if (pickResult.hit && pickResult.pickedMesh) {
|
|
- if (pickResult.pickedMesh.actionManager) {
|
|
|
|
- if (that._startingPointerTime !== 0 && ((new Date().getTime() - that._startingPointerTime) > BABYLON.ActionManager.LongPressDelay) && (Math.abs(that._startingPointerPosition.x - that._pointerX) < BABYLON.ActionManager.DragMovementThreshold && Math.abs(that._startingPointerPosition.y - that._pointerY) < BABYLON.ActionManager.DragMovementThreshold)) {
|
|
|
|
- that._startingPointerTime = 0;
|
|
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnLongPressTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
- }
|
|
|
|
|
|
+ if (this._isButtonPressed &&
|
|
|
|
+ ((new Date().getTime() - this._startingPointerTime) > Scene.LongPressDelay) &&
|
|
|
|
+ (Math.abs(this._startingPointerPosition.x - this._pointerX) < Scene.DragMovementThreshold &&
|
|
|
|
+ Math.abs(this._startingPointerPosition.y - this._pointerY) < Scene.DragMovementThreshold)) {
|
|
|
|
+ this._startingPointerTime = 0;
|
|
|
|
+ actionManager.processTrigger(BABYLON.ActionManager.OnLongPressTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }, BABYLON.ActionManager.LongPressDelay);
|
|
|
|
|
|
+ }).bind(_this), Scene.LongPressDelay);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -20211,75 +20422,130 @@ var BABYLON;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
this._onPointerUp = function (evt) {
|
|
this._onPointerUp = function (evt) {
|
|
|
|
+ _this._isButtonPressed = false;
|
|
|
|
+ _this._pickedUpMesh = null;
|
|
|
|
+ _this._meshPickProceed = false;
|
|
_this._updatePointerPosition(evt);
|
|
_this._updatePointerPosition(evt);
|
|
- // PreObservable support
|
|
|
|
- if (_this.onPrePointerObservable.hasObservers()) {
|
|
|
|
- var type = PointerEventTypes.POINTERUP;
|
|
|
|
- var pi = new PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- if (!_this.cameraToUseForPointers && !_this.activeCamera) {
|
|
|
|
- return;
|
|
|
|
- }
|
|
|
|
- if (!_this.pointerUpPredicate) {
|
|
|
|
- _this.pointerUpPredicate = function (mesh) {
|
|
|
|
- return mesh.isPickable && mesh.isVisible && mesh.isReady();
|
|
|
|
- };
|
|
|
|
- }
|
|
|
|
- // Meshes
|
|
|
|
- var pickResult = _this.pick(_this._unTranslatedPointerX, _this._unTranslatedPointerY, _this.pointerUpPredicate, false, _this.cameraToUseForPointers);
|
|
|
|
- if (pickResult.hit && pickResult.pickedMesh) {
|
|
|
|
- if (_this._pickedDownMesh != null && pickResult.pickedMesh == _this._pickedDownMesh) {
|
|
|
|
- if (_this.onPointerPick) {
|
|
|
|
- _this.onPointerPick(evt, pickResult);
|
|
|
|
|
|
+ _this._initClickEvent(_this.onPrePointerObservable, _this.onPointerObservable, evt, (function (clickInfo, pickResult) {
|
|
|
|
+ // PreObservable support
|
|
|
|
+ if (this.onPrePointerObservable.hasObservers()) {
|
|
|
|
+ if (!clickInfo.ignore) {
|
|
|
|
+ if (!clickInfo.hasSwiped) {
|
|
|
|
+ if (clickInfo.singleClick && this.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {
|
|
|
|
+ var type = PointerEventTypes.POINTERTAP;
|
|
|
|
+ var pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
|
|
|
|
+ this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
|
+ if (pi.skipOnPointerObservable) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (clickInfo.doubleClick && this.onPrePointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {
|
|
|
|
+ var type = PointerEventTypes.POINTERDOUBLETAP;
|
|
|
|
+ var pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
|
|
|
|
+ this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
|
+ if (pi.skipOnPointerObservable) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (_this.onPointerObservable.hasObservers()) {
|
|
|
|
- var type = PointerEventTypes.POINTERPICK;
|
|
|
|
- var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
- _this.onPointerObservable.notifyObservers(pi, type);
|
|
|
|
|
|
+ else {
|
|
|
|
+ var type = PointerEventTypes.POINTERUP;
|
|
|
|
+ var pi = new PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
|
|
|
|
+ this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
|
+ if (pi.skipOnPointerObservable) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (pickResult.pickedMesh.actionManager) {
|
|
|
|
- pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickUpTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
|
|
+ if (!this.cameraToUseForPointers && !this.activeCamera) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ if (!this.pointerUpPredicate) {
|
|
|
|
+ this.pointerUpPredicate = function (mesh) {
|
|
|
|
+ return mesh.isPickable && mesh.isVisible && mesh.isReady();
|
|
|
|
+ };
|
|
|
|
+ }
|
|
|
|
+ // Meshes
|
|
|
|
+ if (!this._meshPickProceed && BABYLON.ActionManager.HasTriggers) {
|
|
|
|
+ this._initActionManager(null, clickInfo);
|
|
|
|
+ }
|
|
|
|
+ if (!pickResult) {
|
|
|
|
+ pickResult = this._currentPickResult;
|
|
|
|
+ }
|
|
|
|
+ if (pickResult && pickResult.pickedMesh) {
|
|
|
|
+ this._pickedUpMesh = pickResult.pickedMesh;
|
|
|
|
+ if (this._pickedDownMesh === this._pickedUpMesh) {
|
|
|
|
+ if (this.onPointerPick) {
|
|
|
|
+ this.onPointerPick(evt, pickResult);
|
|
|
|
+ }
|
|
|
|
+ if (clickInfo.singleClick && !clickInfo.ignore && this.onPointerObservable.hasObservers()) {
|
|
|
|
+ var type = PointerEventTypes.POINTERPICK;
|
|
|
|
+ var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
+ this.onPointerObservable.notifyObservers(pi, type);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (pickResult.pickedMesh.actionManager) {
|
|
if (pickResult.pickedMesh.actionManager) {
|
|
- if (Math.abs(_this._startingPointerPosition.x - _this._pointerX) < BABYLON.ActionManager.DragMovementThreshold && Math.abs(_this._startingPointerPosition.y - _this._pointerY) < BABYLON.ActionManager.DragMovementThreshold) {
|
|
|
|
|
|
+ if (clickInfo.ignore) {
|
|
|
|
+ pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickUpTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
+ }
|
|
|
|
+ if (!clickInfo.hasSwiped && !clickInfo.ignore && clickInfo.singleClick) {
|
|
pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
}
|
|
}
|
|
|
|
+ if (clickInfo.doubleClick && !clickInfo.ignore && pickResult.pickedMesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnDoublePickTrigger)) {
|
|
|
|
+ pickResult.pickedMesh.actionManager.processTrigger(BABYLON.ActionManager.OnDoublePickTrigger, BABYLON.ActionEvent.CreateNew(pickResult.pickedMesh, evt));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- }
|
|
|
|
- if (_this._pickedDownMesh && _this._pickedDownMesh.actionManager && _this._pickedDownMesh !== pickResult.pickedMesh) {
|
|
|
|
- _this._pickedDownMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickOutTrigger, BABYLON.ActionEvent.CreateNew(_this._pickedDownMesh, evt));
|
|
|
|
- }
|
|
|
|
- if (_this.onPointerUp) {
|
|
|
|
- _this.onPointerUp(evt, pickResult);
|
|
|
|
- }
|
|
|
|
- if (_this.onPointerObservable.hasObservers()) {
|
|
|
|
- var type = PointerEventTypes.POINTERUP;
|
|
|
|
- var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
- _this.onPointerObservable.notifyObservers(pi, type);
|
|
|
|
- }
|
|
|
|
- _this._startingPointerTime = 0;
|
|
|
|
- // Sprites
|
|
|
|
- if (_this.spriteManagers.length > 0) {
|
|
|
|
- pickResult = _this.pickSprite(_this._unTranslatedPointerX, _this._unTranslatedPointerY, spritePredicate, false, _this.cameraToUseForPointers);
|
|
|
|
- if (pickResult.hit && pickResult.pickedSprite) {
|
|
|
|
- if (pickResult.pickedSprite.actionManager) {
|
|
|
|
- pickResult.pickedSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickUpTrigger, BABYLON.ActionEvent.CreateNewFromSprite(pickResult.pickedSprite, _this, evt));
|
|
|
|
- if (pickResult.pickedSprite.actionManager) {
|
|
|
|
- if (Math.abs(_this._startingPointerPosition.x - _this._pointerX) < BABYLON.ActionManager.DragMovementThreshold && Math.abs(_this._startingPointerPosition.y - _this._pointerY) < BABYLON.ActionManager.DragMovementThreshold) {
|
|
|
|
- pickResult.pickedSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionEvent.CreateNewFromSprite(pickResult.pickedSprite, _this, evt));
|
|
|
|
|
|
+ if (this._pickedDownMesh &&
|
|
|
|
+ this._pickedDownMesh.actionManager &&
|
|
|
|
+ this._pickedDownMesh.actionManager.hasSpecificTrigger(BABYLON.ActionManager.OnPickOutTrigger) &&
|
|
|
|
+ this._pickedDownMesh !== this._pickedUpMesh) {
|
|
|
|
+ this._pickedDownMesh.actionManager.processTrigger(BABYLON.ActionManager.OnPickOutTrigger, BABYLON.ActionEvent.CreateNew(this._pickedDownMesh, evt));
|
|
|
|
+ }
|
|
|
|
+ if (this.onPointerUp) {
|
|
|
|
+ this.onPointerUp(evt, pickResult);
|
|
|
|
+ }
|
|
|
|
+ if (this.onPointerObservable.hasObservers()) {
|
|
|
|
+ if (!clickInfo.ignore) {
|
|
|
|
+ if (!clickInfo.hasSwiped) {
|
|
|
|
+ if (clickInfo.singleClick && this.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERTAP)) {
|
|
|
|
+ var type = PointerEventTypes.POINTERTAP;
|
|
|
|
+ var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
+ this.onPointerObservable.notifyObservers(pi, type);
|
|
|
|
+ }
|
|
|
|
+ if (clickInfo.doubleClick && this.onPointerObservable.hasSpecificMask(PointerEventTypes.POINTERDOUBLETAP)) {
|
|
|
|
+ var type = PointerEventTypes.POINTERDOUBLETAP;
|
|
|
|
+ var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
+ this.onPointerObservable.notifyObservers(pi, type);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ var type = PointerEventTypes.POINTERUP;
|
|
|
|
+ var pi = new PointerInfo(type, evt, pickResult);
|
|
|
|
+ this.onPointerObservable.notifyObservers(pi, type);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- if (_this._pickedDownSprite && _this._pickedDownSprite.actionManager && _this._pickedDownSprite !== pickResult.pickedSprite) {
|
|
|
|
- _this._pickedDownSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickOutTrigger, BABYLON.ActionEvent.CreateNewFromSprite(_this._pickedDownSprite, _this, evt));
|
|
|
|
|
|
+ // Sprites
|
|
|
|
+ if (this.spriteManagers.length > 0) {
|
|
|
|
+ pickResult = this.pickSprite(this._unTranslatedPointerX, this._unTranslatedPointerY, spritePredicate, false, this.cameraToUseForPointers);
|
|
|
|
+ if (pickResult.hit && pickResult.pickedSprite) {
|
|
|
|
+ if (pickResult.pickedSprite.actionManager) {
|
|
|
|
+ pickResult.pickedSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickUpTrigger, BABYLON.ActionEvent.CreateNewFromSprite(pickResult.pickedSprite, this, evt));
|
|
|
|
+ if (pickResult.pickedSprite.actionManager) {
|
|
|
|
+ if (Math.abs(this._startingPointerPosition.x - this._pointerX) < Scene.DragMovementThreshold && Math.abs(this._startingPointerPosition.y - this._pointerY) < Scene.DragMovementThreshold) {
|
|
|
|
+ pickResult.pickedSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickTrigger, BABYLON.ActionEvent.CreateNewFromSprite(pickResult.pickedSprite, this, evt));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (this._pickedDownSprite && this._pickedDownSprite.actionManager && this._pickedDownSprite !== pickResult.pickedSprite) {
|
|
|
|
+ this._pickedDownSprite.actionManager.processTrigger(BABYLON.ActionManager.OnPickOutTrigger, BABYLON.ActionEvent.CreateNewFromSprite(this._pickedDownSprite, this, evt));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ this._previousPickResult = this._currentPickResult;
|
|
|
|
+ }).bind(_this));
|
|
};
|
|
};
|
|
this._onKeyDown = function (evt) {
|
|
this._onKeyDown = function (evt) {
|
|
if (_this.actionManager) {
|
|
if (_this.actionManager) {
|
|
@@ -22074,6 +22340,10 @@ var BABYLON;
|
|
Scene._FOGMODE_LINEAR = 3;
|
|
Scene._FOGMODE_LINEAR = 3;
|
|
Scene.MinDeltaTime = 1.0;
|
|
Scene.MinDeltaTime = 1.0;
|
|
Scene.MaxDeltaTime = 1000.0;
|
|
Scene.MaxDeltaTime = 1000.0;
|
|
|
|
+ Scene.DragMovementThreshold = 10; // in pixels
|
|
|
|
+ Scene.LongPressDelay = 500; // in milliseconds
|
|
|
|
+ Scene.DoubleClickDelay = 300; // in milliseconds
|
|
|
|
+ Scene.ExclusiveDoubleClickMode = false; // If you need to check double click without raising a single click at first click, enable this flag
|
|
BABYLON.Scene = Scene;
|
|
BABYLON.Scene = Scene;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|
|
@@ -39838,6 +40108,13 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(ActionManager, "OnDoublePickTrigger", {
|
|
|
|
+ get: function () {
|
|
|
|
+ return ActionManager._OnDoublePickTrigger;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
Object.defineProperty(ActionManager, "OnPickUpTrigger", {
|
|
Object.defineProperty(ActionManager, "OnPickUpTrigger", {
|
|
get: function () {
|
|
get: function () {
|
|
return ActionManager._OnPickUpTrigger;
|
|
return ActionManager._OnPickUpTrigger;
|
|
@@ -39912,6 +40189,13 @@ var BABYLON;
|
|
// Methods
|
|
// Methods
|
|
ActionManager.prototype.dispose = function () {
|
|
ActionManager.prototype.dispose = function () {
|
|
var index = this._scene._actionManagers.indexOf(this);
|
|
var index = this._scene._actionManagers.indexOf(this);
|
|
|
|
+ for (var i = 0; i < this.actions.length; i++) {
|
|
|
|
+ var action = this.actions[i];
|
|
|
|
+ ActionManager.Triggers[action.trigger]--;
|
|
|
|
+ if (ActionManager.Triggers[action.trigger] === 0) {
|
|
|
|
+ delete ActionManager.Triggers[action.trigger];
|
|
|
|
+ }
|
|
|
|
+ }
|
|
if (index > -1) {
|
|
if (index > -1) {
|
|
this._scene._actionManagers.splice(index, 1);
|
|
this._scene._actionManagers.splice(index, 1);
|
|
}
|
|
}
|
|
@@ -39981,6 +40265,57 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ Object.defineProperty(ActionManager, "HasTriggers", {
|
|
|
|
+ /**
|
|
|
|
+ * Does exist one action manager with at least one trigger
|
|
|
|
+ * @return {boolean} whether or not it exists one action manager with one trigger
|
|
|
|
+ **/
|
|
|
|
+ get: function () {
|
|
|
|
+ for (var t in ActionManager.Triggers) {
|
|
|
|
+ if (ActionManager.Triggers.hasOwnProperty(t)) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ Object.defineProperty(ActionManager, "HasPickTriggers", {
|
|
|
|
+ /**
|
|
|
|
+ * Does exist one action manager with at least one pick trigger
|
|
|
|
+ * @return {boolean} whether or not it exists one action manager with one pick trigger
|
|
|
|
+ **/
|
|
|
|
+ get: function () {
|
|
|
|
+ for (var t in ActionManager.Triggers) {
|
|
|
|
+ if (ActionManager.Triggers.hasOwnProperty(t)) {
|
|
|
|
+ var t_int = parseInt(t);
|
|
|
|
+ if (t_int >= ActionManager._OnPickTrigger && t_int <= ActionManager._OnPickUpTrigger) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ },
|
|
|
|
+ enumerable: true,
|
|
|
|
+ configurable: true
|
|
|
|
+ });
|
|
|
|
+ /**
|
|
|
|
+ * Does exist one action manager that handles actions of a given trigger
|
|
|
|
+ * @param {number} trigger - the trigger to be tested
|
|
|
|
+ * @return {boolean} whether the trigger is handeled by at least one action manager
|
|
|
|
+ **/
|
|
|
|
+ ActionManager.HasSpecificTrigger = function (trigger) {
|
|
|
|
+ for (var t in ActionManager.Triggers) {
|
|
|
|
+ if (ActionManager.Triggers.hasOwnProperty(t)) {
|
|
|
|
+ var t_int = parseInt(t);
|
|
|
|
+ if (t_int === trigger) {
|
|
|
|
+ return true;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return false;
|
|
|
|
+ };
|
|
/**
|
|
/**
|
|
* Registers an action to this action manager
|
|
* Registers an action to this action manager
|
|
* @param {BABYLON.Action} action - the action to be registered
|
|
* @param {BABYLON.Action} action - the action to be registered
|
|
@@ -39994,6 +40329,12 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
this.actions.push(action);
|
|
this.actions.push(action);
|
|
|
|
+ if (ActionManager.Triggers[action.trigger]) {
|
|
|
|
+ ActionManager.Triggers[action.trigger]++;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ ActionManager.Triggers[action.trigger] = 1;
|
|
|
|
+ }
|
|
action._actionManager = this;
|
|
action._actionManager = this;
|
|
action._prepare();
|
|
action._prepare();
|
|
return action;
|
|
return action;
|
|
@@ -40252,18 +40593,18 @@ var BABYLON;
|
|
ActionManager._OnRightPickTrigger = 3;
|
|
ActionManager._OnRightPickTrigger = 3;
|
|
ActionManager._OnCenterPickTrigger = 4;
|
|
ActionManager._OnCenterPickTrigger = 4;
|
|
ActionManager._OnPickDownTrigger = 5;
|
|
ActionManager._OnPickDownTrigger = 5;
|
|
- ActionManager._OnPickUpTrigger = 6;
|
|
|
|
- ActionManager._OnLongPressTrigger = 7;
|
|
|
|
- ActionManager._OnPointerOverTrigger = 8;
|
|
|
|
- ActionManager._OnPointerOutTrigger = 9;
|
|
|
|
- ActionManager._OnEveryFrameTrigger = 10;
|
|
|
|
- ActionManager._OnIntersectionEnterTrigger = 11;
|
|
|
|
- ActionManager._OnIntersectionExitTrigger = 12;
|
|
|
|
- ActionManager._OnKeyDownTrigger = 13;
|
|
|
|
- ActionManager._OnKeyUpTrigger = 14;
|
|
|
|
- ActionManager._OnPickOutTrigger = 15;
|
|
|
|
- ActionManager.DragMovementThreshold = 10; // in pixels
|
|
|
|
- ActionManager.LongPressDelay = 500; // in milliseconds
|
|
|
|
|
|
+ ActionManager._OnDoublePickTrigger = 6;
|
|
|
|
+ ActionManager._OnPickUpTrigger = 7;
|
|
|
|
+ ActionManager._OnLongPressTrigger = 8;
|
|
|
|
+ ActionManager._OnPointerOverTrigger = 9;
|
|
|
|
+ ActionManager._OnPointerOutTrigger = 10;
|
|
|
|
+ ActionManager._OnEveryFrameTrigger = 11;
|
|
|
|
+ ActionManager._OnIntersectionEnterTrigger = 12;
|
|
|
|
+ ActionManager._OnIntersectionExitTrigger = 13;
|
|
|
|
+ ActionManager._OnKeyDownTrigger = 14;
|
|
|
|
+ ActionManager._OnKeyUpTrigger = 15;
|
|
|
|
+ ActionManager._OnPickOutTrigger = 16;
|
|
|
|
+ ActionManager.Triggers = {};
|
|
BABYLON.ActionManager = ActionManager;
|
|
BABYLON.ActionManager = ActionManager;
|
|
})(BABYLON || (BABYLON = {}));
|
|
})(BABYLON || (BABYLON = {}));
|
|
|
|
|
|
@@ -44105,9 +44446,9 @@ var BABYLON;
|
|
var BABYLON;
|
|
var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
/**
|
|
/**
|
|
- * This class describe a rectangle that were added to the map.
|
|
|
|
- * You have access to its coordinates either in pixel or normalized (UV)
|
|
|
|
- */
|
|
|
|
|
|
+ * This class describe a rectangle that were added to the map.
|
|
|
|
+ * You have access to its coordinates either in pixel or normalized (UV)
|
|
|
|
+ */
|
|
var PackedRect = (function () {
|
|
var PackedRect = (function () {
|
|
function PackedRect(root, parent, pos, size) {
|
|
function PackedRect(root, parent, pos, size) {
|
|
this._pos = pos;
|
|
this._pos = pos;
|
|
@@ -44140,27 +44481,50 @@ var BABYLON;
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
+ /**
|
|
|
|
+ * Retrieve the inner position (considering the margin) and stores it into the res object
|
|
|
|
+ * @param res must be a valid Vector2 that will contain the inner position after this call
|
|
|
|
+ */
|
|
|
|
+ PackedRect.prototype.getInnerPosToRef = function (res) {
|
|
|
|
+ var m = this._root._margin;
|
|
|
|
+ res.x = this._pos.x + m;
|
|
|
|
+ res.y = this._pos.y + m;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
|
|
+ * Retrieve the inner size (considering the margin) and stores it into the res object
|
|
|
|
+ * @param res must be a valid Size that will contain the inner size after this call
|
|
|
|
+ */
|
|
|
|
+ PackedRect.prototype.getInnerSizeToRef = function (res) {
|
|
|
|
+ var m = this._root._margin;
|
|
|
|
+ res.width = this._contentSize.width - (m * 2);
|
|
|
|
+ res.height = this._contentSize.height - (m * 2);
|
|
|
|
+ };
|
|
Object.defineProperty(PackedRect.prototype, "UVs", {
|
|
Object.defineProperty(PackedRect.prototype, "UVs", {
|
|
/**
|
|
/**
|
|
* Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
|
|
* Compute the UV of the top/left, top/right, bottom/right, bottom/left points of the rectangle this node handles into the map
|
|
* @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
|
|
* @returns And array of 4 Vector2, containing UV coordinates for the four corners of the Rectangle into the map
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
- return this.getUVsForCustomSize(this._root._size);
|
|
|
|
|
|
+ if (!this._contentSize) {
|
|
|
|
+ throw new Error("Can't compute UVs for this object because it's nor allocated");
|
|
|
|
+ }
|
|
|
|
+ return this.getUVsForCustomSize(this._contentSize);
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
});
|
|
});
|
|
/**
|
|
/**
|
|
- * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations) and then using only a part of the PackRect.
|
|
|
|
|
|
+ * You may have allocated the PackedRect using over-provisioning (you allocated more than you need in order to prevent frequent deallocations/reallocations)
|
|
|
|
+ * and then using only a part of the PackRect.
|
|
* This method will return the UVs for this part by given the custom size of what you really use
|
|
* This method will return the UVs for this part by given the custom size of what you really use
|
|
* @param customSize must be less/equal to the allocated size, UV will be compute from this
|
|
* @param customSize must be less/equal to the allocated size, UV will be compute from this
|
|
*/
|
|
*/
|
|
PackedRect.prototype.getUVsForCustomSize = function (customSize) {
|
|
PackedRect.prototype.getUVsForCustomSize = function (customSize) {
|
|
var mainWidth = this._root._size.width;
|
|
var mainWidth = this._root._size.width;
|
|
var mainHeight = this._root._size.height;
|
|
var mainHeight = this._root._size.height;
|
|
- var topLeft = new BABYLON.Vector2(this._pos.x / mainWidth, this._pos.y / mainHeight);
|
|
|
|
- var rightBottom = new BABYLON.Vector2((this._pos.x + customSize.width - 1) / mainWidth, (this._pos.y + customSize.height - 1) / mainHeight);
|
|
|
|
|
|
+ var margin = this._root._margin;
|
|
|
|
+ var topLeft = new BABYLON.Vector2((this._pos.x + margin) / mainWidth, (this._pos.y + margin) / mainHeight);
|
|
|
|
+ var rightBottom = new BABYLON.Vector2((this._pos.x + customSize.width + margin - 1) / mainWidth, (this._pos.y + customSize.height + margin - 1) / mainHeight);
|
|
var uvs = new Array();
|
|
var uvs = new Array();
|
|
uvs.push(topLeft);
|
|
uvs.push(topLeft);
|
|
uvs.push(new BABYLON.Vector2(rightBottom.x, topLeft.y));
|
|
uvs.push(new BABYLON.Vector2(rightBottom.x, topLeft.y));
|
|
@@ -44198,6 +44562,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
PackedRect.prototype.findNode = function (size) {
|
|
PackedRect.prototype.findNode = function (size) {
|
|
var resNode = null;
|
|
var resNode = null;
|
|
|
|
+ var margin = this._root._margin * 2;
|
|
// If this node is used, recurse to each of his subNodes to find an available one in its branch
|
|
// If this node is used, recurse to each of his subNodes to find an available one in its branch
|
|
if (this.isUsed) {
|
|
if (this.isUsed) {
|
|
if (this._leftNode) {
|
|
if (this._leftNode) {
|
|
@@ -44211,33 +44576,38 @@ var BABYLON;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else if (this._initialSize) {
|
|
else if (this._initialSize) {
|
|
- if ((size.width <= this._initialSize.width) && (size.height <= this._initialSize.height)) {
|
|
|
|
|
|
+ if (((size.width + margin) <= this._initialSize.width) && ((size.height + margin) <= this._initialSize.height)) {
|
|
resNode = this;
|
|
resNode = this;
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- else if ((size.width <= this._size.width) && (size.height <= this._size.height)) {
|
|
|
|
|
|
+ else if (((size.width + margin) <= this._size.width) && ((size.height + margin) <= this._size.height)) {
|
|
resNode = this;
|
|
resNode = this;
|
|
}
|
|
}
|
|
return resNode;
|
|
return resNode;
|
|
};
|
|
};
|
|
PackedRect.prototype.splitNode = function (contentSize) {
|
|
PackedRect.prototype.splitNode = function (contentSize) {
|
|
|
|
+ var cs = PackedRect.TpsSize;
|
|
|
|
+ var margin = this._root._margin * 2;
|
|
|
|
+ cs.copyFrom(contentSize);
|
|
|
|
+ cs.width += margin;
|
|
|
|
+ cs.height += margin;
|
|
// If there's no contentSize but an initialSize it means this node were previously allocated, but freed, we need to create a _leftNode as subNode and use to allocate the space we need (and this node will have a right/bottom subNode for the space left as this._initialSize may be greater than contentSize)
|
|
// If there's no contentSize but an initialSize it means this node were previously allocated, but freed, we need to create a _leftNode as subNode and use to allocate the space we need (and this node will have a right/bottom subNode for the space left as this._initialSize may be greater than contentSize)
|
|
if (!this._contentSize && this._initialSize) {
|
|
if (!this._contentSize && this._initialSize) {
|
|
- this._contentSize = contentSize.clone();
|
|
|
|
|
|
+ this._contentSize = cs.clone();
|
|
this._leftNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x, this._pos.y), new BABYLON.Size(this._initialSize.width, this._initialSize.height));
|
|
this._leftNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x, this._pos.y), new BABYLON.Size(this._initialSize.width, this._initialSize.height));
|
|
return this._leftNode.splitNode(contentSize);
|
|
return this._leftNode.splitNode(contentSize);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- this._contentSize = contentSize.clone();
|
|
|
|
- this._initialSize = contentSize.clone();
|
|
|
|
- if (contentSize.width !== this._size.width) {
|
|
|
|
- this._rightNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x + contentSize.width, this._pos.y), new BABYLON.Size(this._size.width - contentSize.width, contentSize.height));
|
|
|
|
|
|
+ this._contentSize = cs.clone();
|
|
|
|
+ this._initialSize = cs.clone();
|
|
|
|
+ if (cs.width !== this._size.width) {
|
|
|
|
+ this._rightNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x + cs.width, this._pos.y), new BABYLON.Size(this._size.width - cs.width, cs.height));
|
|
}
|
|
}
|
|
- if (contentSize.height !== this._size.height) {
|
|
|
|
- this._bottomNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x, this._pos.y + contentSize.height), new BABYLON.Size(this._size.width, this._size.height - contentSize.height));
|
|
|
|
|
|
+ if (cs.height !== this._size.height) {
|
|
|
|
+ this._bottomNode = new PackedRect(this._root, this, new BABYLON.Vector2(this._pos.x, this._pos.y + cs.height), new BABYLON.Size(this._size.width, this._size.height - cs.height));
|
|
}
|
|
}
|
|
return this;
|
|
return this;
|
|
}
|
|
}
|
|
@@ -44265,11 +44635,14 @@ var BABYLON;
|
|
PackedRect.prototype.evalFreeSize = function (size) {
|
|
PackedRect.prototype.evalFreeSize = function (size) {
|
|
var levelSize = 0;
|
|
var levelSize = 0;
|
|
if (!this.isUsed) {
|
|
if (!this.isUsed) {
|
|
- if (this._initialSize) {
|
|
|
|
- levelSize = this._initialSize.surface;
|
|
|
|
|
|
+ var margin = this._root._margin;
|
|
|
|
+ var is = this._initialSize;
|
|
|
|
+ if (is) {
|
|
|
|
+ levelSize = is.surface - (is.width * margin) - (is.height * margin);
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
- levelSize = this._size.surface;
|
|
|
|
|
|
+ var size_1 = this._size;
|
|
|
|
+ levelSize = size_1.surface - (size_1.width * margin) - (size_1.height * margin);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (this._rightNode) {
|
|
if (this._rightNode) {
|
|
@@ -44282,20 +44655,26 @@ var BABYLON;
|
|
};
|
|
};
|
|
return PackedRect;
|
|
return PackedRect;
|
|
}());
|
|
}());
|
|
|
|
+ PackedRect.TpsSize = BABYLON.Size.Zero();
|
|
BABYLON.PackedRect = PackedRect;
|
|
BABYLON.PackedRect = PackedRect;
|
|
/**
|
|
/**
|
|
* The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
|
|
* The purpose of this class is to pack several Rectangles into a big map, while trying to fit everything as optimally as possible.
|
|
* This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
|
|
* This class is typically used to build lightmaps, sprite map or to pack several little textures into a big one.
|
|
* Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
|
|
* Note that this class allows allocated Rectangles to be freed: that is the map is dynamically maintained so you can add/remove rectangle based on their life-cycle.
|
|
|
|
+ * In case you need a margin around the allocated rect, specify the amount in the margin argument during construction.
|
|
|
|
+ * In such case you will have to rely on innerPositionToRef and innerSizeToRef calls to get the proper size
|
|
*/
|
|
*/
|
|
var RectPackingMap = (function (_super) {
|
|
var RectPackingMap = (function (_super) {
|
|
__extends(RectPackingMap, _super);
|
|
__extends(RectPackingMap, _super);
|
|
/**
|
|
/**
|
|
* Create an instance of the object with a dimension using the given size
|
|
* Create an instance of the object with a dimension using the given size
|
|
* @param size The dimension of the rectangle that will contain all the sub ones.
|
|
* @param size The dimension of the rectangle that will contain all the sub ones.
|
|
|
|
+ * @param margin The margin (empty space) created (in pixels) around the allocated Rectangles
|
|
*/
|
|
*/
|
|
- function RectPackingMap(size) {
|
|
|
|
|
|
+ function RectPackingMap(size, margin) {
|
|
|
|
+ if (margin === void 0) { margin = 0; }
|
|
var _this = _super.call(this, null, null, BABYLON.Vector2.Zero(), size) || this;
|
|
var _this = _super.call(this, null, null, BABYLON.Vector2.Zero(), size) || this;
|
|
|
|
+ _this._margin = margin;
|
|
_this._root = _this;
|
|
_this._root = _this;
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
@@ -44661,16 +45040,17 @@ var BABYLON;
|
|
(function (BABYLON) {
|
|
(function (BABYLON) {
|
|
var MapTexture = (function (_super) {
|
|
var MapTexture = (function (_super) {
|
|
__extends(MapTexture, _super);
|
|
__extends(MapTexture, _super);
|
|
- function MapTexture(name, scene, size, samplingMode, useMipMap) {
|
|
|
|
|
|
+ function MapTexture(name, scene, size, samplingMode, useMipMap, margin) {
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
if (samplingMode === void 0) { samplingMode = BABYLON.Texture.TRILINEAR_SAMPLINGMODE; }
|
|
if (useMipMap === void 0) { useMipMap = false; }
|
|
if (useMipMap === void 0) { useMipMap = false; }
|
|
|
|
+ if (margin === void 0) { margin = 0; }
|
|
var _this = _super.call(this, null, scene, !useMipMap, false, samplingMode) || this;
|
|
var _this = _super.call(this, null, scene, !useMipMap, false, samplingMode) || this;
|
|
_this.name = name;
|
|
_this.name = name;
|
|
_this._size = size;
|
|
_this._size = size;
|
|
_this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
_this.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
_this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
_this.wrapV = BABYLON.Texture.CLAMP_ADDRESSMODE;
|
|
// Create the rectPackMap that will allocate portion of the texture
|
|
// Create the rectPackMap that will allocate portion of the texture
|
|
- _this._rectPackingMap = new BABYLON.RectPackingMap(new BABYLON.Size(size.width, size.height));
|
|
|
|
|
|
+ _this._rectPackingMap = new BABYLON.RectPackingMap(new BABYLON.Size(size.width, size.height), margin);
|
|
// Create the texture that will store the content
|
|
// Create the texture that will store the content
|
|
_this._texture = scene.getEngine().createRenderTargetTexture(size, { generateMipMaps: !_this.noMipmap, type: BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT });
|
|
_this._texture = scene.getEngine().createRenderTargetTexture(size, { generateMipMaps: !_this.noMipmap, type: BABYLON.Engine.TEXTURETYPE_UNSIGNED_INT });
|
|
return _this;
|
|
return _this;
|
|
@@ -49360,7 +49740,7 @@ var BABYLON;
|
|
this._positionOffset.addToRef(this._transformedReferencePoint, this._currentTarget);
|
|
this._positionOffset.addToRef(this._transformedReferencePoint, this._currentTarget);
|
|
return this._webvrViewMatrix;
|
|
return this._webvrViewMatrix;
|
|
};
|
|
};
|
|
- WebVRFreeCamera.prototype._updateCameraRotationMatrix = function () {
|
|
|
|
|
|
+ WebVRFreeCamera.prototype._updateWebVRCameraRotationMatrix = function () {
|
|
this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix);
|
|
this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix);
|
|
};
|
|
};
|
|
WebVRFreeCamera.prototype._isSynchronizedViewMatrix = function () {
|
|
WebVRFreeCamera.prototype._isSynchronizedViewMatrix = function () {
|
|
@@ -51517,6 +51897,7 @@ var BABYLON;
|
|
var _this = _super.call(this, vrGamepad.id, vrGamepad.index, vrGamepad) || this;
|
|
var _this = _super.call(this, vrGamepad.id, vrGamepad.index, vrGamepad) || this;
|
|
_this.vrGamepad = vrGamepad;
|
|
_this.vrGamepad = vrGamepad;
|
|
_this.deviceScaleFactor = 1;
|
|
_this.deviceScaleFactor = 1;
|
|
|
|
+ _this._leftHandSystemQuaternion = new BABYLON.Quaternion();
|
|
_this.type = BABYLON.Gamepad.POSE_ENABLED;
|
|
_this.type = BABYLON.Gamepad.POSE_ENABLED;
|
|
_this.controllerType = PoseEnabledControllerType.GENERIC;
|
|
_this.controllerType = PoseEnabledControllerType.GENERIC;
|
|
_this.position = BABYLON.Vector3.Zero();
|
|
_this.position = BABYLON.Vector3.Zero();
|
|
@@ -51525,6 +51906,7 @@ var BABYLON;
|
|
_this.deviceRotationQuaternion = new BABYLON.Quaternion();
|
|
_this.deviceRotationQuaternion = new BABYLON.Quaternion();
|
|
_this._calculatedPosition = BABYLON.Vector3.Zero();
|
|
_this._calculatedPosition = BABYLON.Vector3.Zero();
|
|
_this._calculatedRotation = new BABYLON.Quaternion();
|
|
_this._calculatedRotation = new BABYLON.Quaternion();
|
|
|
|
+ BABYLON.Quaternion.RotationYawPitchRollToRef(Math.PI, 0, 0, _this._leftHandSystemQuaternion);
|
|
return _this;
|
|
return _this;
|
|
}
|
|
}
|
|
PoseEnabledController.prototype.update = function () {
|
|
PoseEnabledController.prototype.update = function () {
|
|
@@ -51555,34 +51937,37 @@ var BABYLON;
|
|
}
|
|
}
|
|
if (poseData.orientation) {
|
|
if (poseData.orientation) {
|
|
this.deviceRotationQuaternion.copyFromFloats(this.rawPose.orientation[0], this.rawPose.orientation[1], -this.rawPose.orientation[2], -this.rawPose.orientation[3]);
|
|
this.deviceRotationQuaternion.copyFromFloats(this.rawPose.orientation[0], this.rawPose.orientation[1], -this.rawPose.orientation[2], -this.rawPose.orientation[3]);
|
|
- if (this._mesh && this._mesh.getScene().useRightHandedSystem) {
|
|
|
|
- this.deviceRotationQuaternion.z *= -1;
|
|
|
|
- this.deviceRotationQuaternion.w *= -1;
|
|
|
|
|
|
+ if (this._mesh) {
|
|
|
|
+ if (this._mesh.getScene().useRightHandedSystem) {
|
|
|
|
+ this.deviceRotationQuaternion.z *= -1;
|
|
|
|
+ this.deviceRotationQuaternion.w *= -1;
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.deviceRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion, this.deviceRotationQuaternion);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
// if the camera is set, rotate to the camera's rotation
|
|
// if the camera is set, rotate to the camera's rotation
|
|
- this.rotationQuaternion.multiplyToRef(this.deviceRotationQuaternion, this._calculatedRotation);
|
|
|
|
- if (this._poseControlledCamera) {
|
|
|
|
- BABYLON.Matrix.ScalingToRef(1, 1, 1, BABYLON.Tmp.Matrix[1]);
|
|
|
|
- this._calculatedRotation.toRotationMatrix(BABYLON.Tmp.Matrix[0]);
|
|
|
|
- BABYLON.Matrix.TranslationToRef(this._calculatedPosition.x, this._calculatedPosition.y, this._calculatedPosition.z, BABYLON.Tmp.Matrix[2]);
|
|
|
|
- //Matrix.Identity().multiplyToRef(Tmp.Matrix[1], Tmp.Matrix[4]);
|
|
|
|
- BABYLON.Tmp.Matrix[1].multiplyToRef(BABYLON.Tmp.Matrix[0], BABYLON.Tmp.Matrix[5]);
|
|
|
|
- this._poseControlledCamera.getWorldMatrix().getTranslationToRef(BABYLON.Tmp.Vector3[0]);
|
|
|
|
- BABYLON.Matrix.ComposeToRef(new BABYLON.Vector3(this.deviceScaleFactor, this.deviceScaleFactor, this.deviceScaleFactor), this._poseControlledCamera.rotationQuaternion, BABYLON.Tmp.Vector3[0], BABYLON.Tmp.Matrix[4]);
|
|
|
|
- BABYLON.Tmp.Matrix[5].multiplyToRef(BABYLON.Tmp.Matrix[2], BABYLON.Tmp.Matrix[1]);
|
|
|
|
- BABYLON.Tmp.Matrix[1].multiplyToRef(BABYLON.Tmp.Matrix[4], BABYLON.Tmp.Matrix[2]);
|
|
|
|
- BABYLON.Tmp.Matrix[2].decompose(BABYLON.Tmp.Vector3[0], this._calculatedRotation, this._calculatedPosition);
|
|
|
|
- }
|
|
|
|
|
|
+ this.deviceRotationQuaternion.multiplyToRef(this.rotationQuaternion, this._calculatedRotation);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
PoseEnabledController.prototype.attachToMesh = function (mesh) {
|
|
PoseEnabledController.prototype.attachToMesh = function (mesh) {
|
|
|
|
+ if (this._mesh) {
|
|
|
|
+ this._mesh.parent = undefined;
|
|
|
|
+ }
|
|
|
|
+ this._mesh = mesh;
|
|
|
|
+ if (this._poseControlledCamera) {
|
|
|
|
+ this._mesh.parent = this._poseControlledCamera;
|
|
|
|
+ }
|
|
if (!this._mesh.rotationQuaternion) {
|
|
if (!this._mesh.rotationQuaternion) {
|
|
this._mesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
this._mesh.rotationQuaternion = new BABYLON.Quaternion();
|
|
}
|
|
}
|
|
};
|
|
};
|
|
PoseEnabledController.prototype.attachToPoseControlledCamera = function (camera) {
|
|
PoseEnabledController.prototype.attachToPoseControlledCamera = function (camera) {
|
|
this._poseControlledCamera = camera;
|
|
this._poseControlledCamera = camera;
|
|
|
|
+ if (this._mesh) {
|
|
|
|
+ this._mesh.parent = this._poseControlledCamera;
|
|
|
|
+ }
|
|
};
|
|
};
|
|
PoseEnabledController.prototype.detachMesh = function () {
|
|
PoseEnabledController.prototype.detachMesh = function () {
|
|
this._mesh = undefined;
|
|
this._mesh = undefined;
|
|
@@ -59377,9 +59762,13 @@ var BABYLON;
|
|
this._scene = scene;
|
|
this._scene = scene;
|
|
}
|
|
}
|
|
/** Creates the inspector window. */
|
|
/** Creates the inspector window. */
|
|
- DebugLayer.prototype._createInspector = function (popup) {
|
|
|
|
|
|
+ DebugLayer.prototype._createInspector = function (config) {
|
|
|
|
+ if (config === void 0) { config = {}; }
|
|
|
|
+ var popup = config.popup || false;
|
|
|
|
+ var initialTab = config.initialTab || 0;
|
|
|
|
+ var parentElement = config.parentElement || null;
|
|
if (!this._inspector) {
|
|
if (!this._inspector) {
|
|
- this._inspector = new INSPECTOR.Inspector(this._scene, popup);
|
|
|
|
|
|
+ this._inspector = new INSPECTOR.Inspector(this._scene, popup, initialTab, parentElement);
|
|
} // else nothing to do,; instance is already existing
|
|
} // else nothing to do,; instance is already existing
|
|
};
|
|
};
|
|
DebugLayer.prototype.isVisible = function () {
|
|
DebugLayer.prototype.isVisible = function () {
|
|
@@ -59394,14 +59783,15 @@ var BABYLON;
|
|
this._inspector = null;
|
|
this._inspector = null;
|
|
}
|
|
}
|
|
};
|
|
};
|
|
- DebugLayer.prototype.show = function (popup) {
|
|
|
|
|
|
+ DebugLayer.prototype.show = function (config) {
|
|
|
|
+ if (config === void 0) { config = {}; }
|
|
if (typeof INSPECTOR == 'undefined') {
|
|
if (typeof INSPECTOR == 'undefined') {
|
|
// Load inspector and add it to the DOM
|
|
// Load inspector and add it to the DOM
|
|
- BABYLON.Tools.LoadScript(DebugLayer.InspectorURL, this._createInspector.bind(this, popup));
|
|
|
|
|
|
+ BABYLON.Tools.LoadScript(DebugLayer.InspectorURL, this._createInspector.bind(this, config));
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
// Otherwise creates the inspector
|
|
// Otherwise creates the inspector
|
|
- this._createInspector(popup);
|
|
|
|
|
|
+ this._createInspector(config);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
return DebugLayer;
|
|
return DebugLayer;
|