|
@@ -1468,6 +1468,10 @@ var BABYLON;
|
|
|
__extends(PointerInfoPre, _super);
|
|
|
function PointerInfoPre(type, event, localX, localY) {
|
|
|
var _this = _super.call(this, type, event) || this;
|
|
|
+ /**
|
|
|
+ * Ray from a pointer if availible (eg. 6dof controller)
|
|
|
+ */
|
|
|
+ _this.ray = null;
|
|
|
_this.skipOnPointerObservable = false;
|
|
|
_this.localPosition = new BABYLON.Vector2(localX, localY);
|
|
|
return _this;
|
|
@@ -25139,6 +25143,9 @@ var BABYLON;
|
|
|
*/
|
|
|
Scene.prototype.simulatePointerMove = function (pickResult, pointerEventInit) {
|
|
|
var evt = new PointerEvent("pointermove", pointerEventInit);
|
|
|
+ if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERMOVE)) {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
return this._processPointerMove(pickResult, evt);
|
|
|
};
|
|
|
Scene.prototype._processPointerMove = function (pickResult, evt) {
|
|
@@ -25193,6 +25200,19 @@ var BABYLON;
|
|
|
}
|
|
|
return this;
|
|
|
};
|
|
|
+ Scene.prototype._checkPrePointerObservable = function (pickResult, evt, type) {
|
|
|
+ var pi = new BABYLON.PointerInfoPre(type, evt, this._unTranslatedPointerX, this._unTranslatedPointerY);
|
|
|
+ if (pickResult) {
|
|
|
+ pi.ray = pickResult.ray;
|
|
|
+ }
|
|
|
+ this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
+ if (pi.skipOnPointerObservable) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ };
|
|
|
/**
|
|
|
* Use this method to simulate a pointer down on a mesh
|
|
|
* The pickResult parameter can be obtained from a scene.pick or scene.pickWithRay
|
|
@@ -25202,6 +25222,9 @@ var BABYLON;
|
|
|
*/
|
|
|
Scene.prototype.simulatePointerDown = function (pickResult, pointerEventInit) {
|
|
|
var evt = new PointerEvent("pointerdown", pointerEventInit);
|
|
|
+ if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
return this._processPointerDown(pickResult, evt);
|
|
|
};
|
|
|
Scene.prototype._processPointerDown = function (pickResult, evt) {
|
|
@@ -25265,6 +25288,9 @@ var BABYLON;
|
|
|
var clickInfo = new ClickInfo();
|
|
|
clickInfo.singleClick = true;
|
|
|
clickInfo.ignore = true;
|
|
|
+ if (this._checkPrePointerObservable(pickResult, evt, BABYLON.PointerEventTypes.POINTERUP)) {
|
|
|
+ return this;
|
|
|
+ }
|
|
|
return this._processPointerUp(pickResult, evt, clickInfo);
|
|
|
};
|
|
|
Scene.prototype._processPointerUp = function (pickResult, evt, clickInfo) {
|
|
@@ -25475,13 +25501,8 @@ var BABYLON;
|
|
|
this._onPointerMove = function (evt) {
|
|
|
_this._updatePointerPosition(evt);
|
|
|
// PreObservable support
|
|
|
- if (_this.onPrePointerObservable.hasObservers() && !_this._pointerCaptures[evt.pointerId]) {
|
|
|
- var type = evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE;
|
|
|
- var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (_this._checkPrePointerObservable(null, evt, evt.type === "mousewheel" || evt.type === "DOMMouseScroll" ? BABYLON.PointerEventTypes.POINTERWHEEL : BABYLON.PointerEventTypes.POINTERMOVE)) {
|
|
|
+ return;
|
|
|
}
|
|
|
if (!_this.cameraToUseForPointers && !_this.activeCamera) {
|
|
|
return;
|
|
@@ -25503,13 +25524,8 @@ var BABYLON;
|
|
|
canvas.focus();
|
|
|
}
|
|
|
// PreObservable support
|
|
|
- if (_this.onPrePointerObservable.hasObservers()) {
|
|
|
- var type = BABYLON.PointerEventTypes.POINTERDOWN;
|
|
|
- var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOWN)) {
|
|
|
+ return;
|
|
|
}
|
|
|
if (!_this.cameraToUseForPointers && !_this.activeCamera) {
|
|
|
return;
|
|
@@ -25566,28 +25582,19 @@ var BABYLON;
|
|
|
if (!clickInfo.ignore) {
|
|
|
if (!clickInfo.hasSwiped) {
|
|
|
if (clickInfo.singleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERTAP)) {
|
|
|
- var type = BABYLON.PointerEventTypes.POINTERTAP;
|
|
|
- var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
+ if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERTAP)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
if (clickInfo.doubleClick && _this.onPrePointerObservable.hasSpecificMask(BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
|
|
|
- var type = BABYLON.PointerEventTypes.POINTERDOUBLETAP;
|
|
|
- var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
+ if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERDOUBLETAP)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- var type = BABYLON.PointerEventTypes.POINTERUP;
|
|
|
- var pi = new BABYLON.PointerInfoPre(type, evt, _this._unTranslatedPointerX, _this._unTranslatedPointerY);
|
|
|
- _this.onPrePointerObservable.notifyObservers(pi, type);
|
|
|
- if (pi.skipOnPointerObservable) {
|
|
|
+ if (_this._checkPrePointerObservable(null, evt, BABYLON.PointerEventTypes.POINTERUP)) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
@@ -27827,8 +27834,10 @@ var BABYLON;
|
|
|
};
|
|
|
/**
|
|
|
* Render the scene
|
|
|
+ * @param updateCameras defines a boolean indicating if cameras must update according to their inputs (true by default)
|
|
|
*/
|
|
|
- Scene.prototype.render = function () {
|
|
|
+ Scene.prototype.render = function (updateCameras) {
|
|
|
+ if (updateCameras === void 0) { updateCameras = true; }
|
|
|
if (this.isDisposed) {
|
|
|
return;
|
|
|
}
|
|
@@ -27895,24 +27904,26 @@ var BABYLON;
|
|
|
this._gamepadManager._checkGamepadsStatus();
|
|
|
}
|
|
|
// Update Cameras
|
|
|
- if (this.activeCameras.length > 0) {
|
|
|
- for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
|
|
|
- var camera = this.activeCameras[cameraIndex];
|
|
|
- camera.update();
|
|
|
- if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
|
|
|
- // rig cameras
|
|
|
- for (var index = 0; index < camera._rigCameras.length; index++) {
|
|
|
- camera._rigCameras[index].update();
|
|
|
+ if (updateCameras) {
|
|
|
+ if (this.activeCameras.length > 0) {
|
|
|
+ for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
|
|
|
+ var camera = this.activeCameras[cameraIndex];
|
|
|
+ camera.update();
|
|
|
+ if (camera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
|
|
|
+ // rig cameras
|
|
|
+ for (var index = 0; index < camera._rigCameras.length; index++) {
|
|
|
+ camera._rigCameras[index].update();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- else if (this.activeCamera) {
|
|
|
- this.activeCamera.update();
|
|
|
- if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
|
|
|
- // rig cameras
|
|
|
- for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
|
|
|
- this.activeCamera._rigCameras[index].update();
|
|
|
+ else if (this.activeCamera) {
|
|
|
+ this.activeCamera.update();
|
|
|
+ if (this.activeCamera.cameraRigMode !== BABYLON.Camera.RIG_MODE_NONE) {
|
|
|
+ // rig cameras
|
|
|
+ for (var index = 0; index < this.activeCamera._rigCameras.length; index++) {
|
|
|
+ this.activeCamera._rigCameras[index].update();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -86891,7 +86902,6 @@ var BABYLON;
|
|
|
this.utilityLayerScene = new BABYLON.Scene(originalScene.getEngine());
|
|
|
originalScene.getEngine().scenes.pop();
|
|
|
// Render directly on top of existing scene without clearing
|
|
|
- this.utilityLayerScene.clearColor = new BABYLON.Color4(0, 0, 0, 0);
|
|
|
this.utilityLayerScene.autoClear = false;
|
|
|
this._afterRenderObserver = this.originalScene.onAfterRenderObservable.add(function () {
|
|
|
if (_this.shouldRender) {
|
|
@@ -86907,7 +86917,7 @@ var BABYLON;
|
|
|
*/
|
|
|
UtilityLayerRenderer.prototype.render = function () {
|
|
|
this._updateCamera();
|
|
|
- this.utilityLayerScene.render();
|
|
|
+ this.utilityLayerScene.render(false);
|
|
|
};
|
|
|
/**
|
|
|
* Disposes of the renderer
|
|
@@ -108622,6 +108632,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
this._mainColor = babylonjs_1.Color3.White();
|
|
|
this._reflectionColor = babylonjs_1.Color3.White();
|
|
|
this._white = babylonjs_1.Color3.White();
|
|
|
+ this._forceShadowUpdate = false;
|
|
|
this._processShadows = true;
|
|
|
this._groundEnabled = true;
|
|
|
this._groundMirrorEnabled = true;
|
|
@@ -108640,6 +108651,10 @@ var SceneManager = /** @class */ (function () {
|
|
|
_this.camera.alpha = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.alpha) || _this.camera.alpha;
|
|
|
_this.camera.beta = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.beta) || _this.camera.beta;
|
|
|
_this.camera.radius = (_this._viewer.configuration.camera && _this._viewer.configuration.camera.radius) || _this.camera.radius;
|
|
|
+ /*this.scene.lights.filter(light => light instanceof ShadowLight).forEach(light => {
|
|
|
+ // casting ais safe, due to the constraints tested before
|
|
|
+ (<ShadowLight>light).setDirectionToTarget(center);
|
|
|
+ });*/
|
|
|
};
|
|
|
this._cameraBehaviorMapping = {};
|
|
|
this.models = [];
|
|
@@ -108669,9 +108684,10 @@ var SceneManager = /** @class */ (function () {
|
|
|
}
|
|
|
};
|
|
|
scene.registerBeforeRender(function () {
|
|
|
- if (scene.animatables && scene.animatables.length > 0) {
|
|
|
+ if (_this._forceShadowUpdate || (scene.animatables && scene.animatables.length > 0)) {
|
|
|
// make sure all models are loaded
|
|
|
updateShadows();
|
|
|
+ _this._forceShadowUpdate = false;
|
|
|
}
|
|
|
else if (!(_this.models.every(function (model) {
|
|
|
if (!model.shadowsRenderedAfterLoad) {
|
|
@@ -108958,6 +108974,14 @@ var SceneManager = /** @class */ (function () {
|
|
|
var mainColor = new babylonjs_1.Color3().copyFrom(newConfiguration.lab.environmentMainColor);
|
|
|
this.environmentHelper.setMainColor(mainColor);
|
|
|
}
|
|
|
+ if (newConfiguration.lab.globalLightRotation !== undefined) {
|
|
|
+ // rotate all lights that are shadow lights
|
|
|
+ this.scene.lights.filter(function (light) { return light instanceof babylonjs_1.ShadowLight; }).forEach(function (light) {
|
|
|
+ // casting and '!' are safe, due to the constraints tested before
|
|
|
+ _this.labs.rotateShadowLight(light, newConfiguration.lab.globalLightRotation);
|
|
|
+ });
|
|
|
+ this._forceShadowUpdate = true;
|
|
|
+ }
|
|
|
}
|
|
|
if (this._defaultRenderingPipeline && this._defaultRenderingPipeline.imageProcessing) {
|
|
|
this._defaultRenderingPipeline.imageProcessing.fromLinearSpace = true;
|
|
@@ -109282,7 +109306,7 @@ var SceneManager = /** @class */ (function () {
|
|
|
if (this.scene.imageProcessingConfiguration) {
|
|
|
this.scene.imageProcessingConfiguration.colorCurvesEnabled = true;
|
|
|
this.scene.imageProcessingConfiguration.vignetteEnabled = true;
|
|
|
- this.scene.imageProcessingConfiguration.toneMappingEnabled = !!cameraConfig.toneMappingEnabled;
|
|
|
+ this.scene.imageProcessingConfiguration.toneMappingEnabled = !!configuration_1.getConfigurationKey("camera.toneMappingEnabled", this._viewer.configuration);
|
|
|
}
|
|
|
helper_1.extendClassWithConfig(this.camera, cameraConfig);
|
|
|
this.onCameraConfiguredObservable.notifyObservers({
|
|
@@ -109452,7 +109476,8 @@ var SceneManager = /** @class */ (function () {
|
|
|
var _this = this;
|
|
|
if (lightsConfiguration === void 0) { lightsConfiguration = {}; }
|
|
|
// sanity check!
|
|
|
- if (!Object.keys(lightsConfiguration).length) {
|
|
|
+ var lightKeys = Object.keys(lightsConfiguration).filter(function (name) { return name !== 'globalRotation'; });
|
|
|
+ if (!lightKeys.length) {
|
|
|
if (!this.scene.lights.length)
|
|
|
this.scene.createDefaultLight(true);
|
|
|
}
|
|
@@ -109467,11 +109492,14 @@ var SceneManager = /** @class */ (function () {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- Object.keys(lightsConfiguration).forEach(function (name, idx) {
|
|
|
+ lightKeys.forEach(function (name, idx) {
|
|
|
var lightConfig = { type: 0 };
|
|
|
if (typeof lightsConfiguration[name] === 'object') {
|
|
|
lightConfig = lightsConfiguration[name];
|
|
|
}
|
|
|
+ if (typeof lightsConfiguration[name] === 'number') {
|
|
|
+ lightConfig.type = lightsConfiguration[name];
|
|
|
+ }
|
|
|
lightConfig.name = name;
|
|
|
var light;
|
|
|
// light is not already available
|
|
@@ -109484,6 +109512,9 @@ var SceneManager = /** @class */ (function () {
|
|
|
else {
|
|
|
// available? get it from the scene
|
|
|
light = _this.scene.getLightByName(name);
|
|
|
+ if (typeof lightsConfiguration[name] === 'boolean') {
|
|
|
+ lightConfig.type = light.getTypeID();
|
|
|
+ }
|
|
|
lightsAvailable_1 = lightsAvailable_1.filter(function (ln) { return ln !== name; });
|
|
|
if (lightConfig.type !== undefined && light.getTypeID() !== lightConfig.type) {
|
|
|
light.dispose();
|
|
@@ -110043,15 +110074,15 @@ var ViewerLabs = /** @class */ (function () {
|
|
|
this.environment = {
|
|
|
//irradiance
|
|
|
irradiancePolynomialCoefficients: {
|
|
|
- x: new BABYLON.Vector3(0, 0, 0),
|
|
|
- y: new BABYLON.Vector3(0, 0, 0),
|
|
|
- z: new BABYLON.Vector3(0, 0, 0),
|
|
|
- xx: new BABYLON.Vector3(0, 0, 0),
|
|
|
- yy: new BABYLON.Vector3(0, 0, 0),
|
|
|
- zz: new BABYLON.Vector3(0, 0, 0),
|
|
|
- yz: new BABYLON.Vector3(0, 0, 0),
|
|
|
- zx: new BABYLON.Vector3(0, 0, 0),
|
|
|
- xy: new BABYLON.Vector3(0, 0, 0)
|
|
|
+ x: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ y: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ z: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ xx: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ yy: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ zz: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ yz: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ zx: new babylonjs_1.Vector3(0, 0, 0),
|
|
|
+ xy: new babylonjs_1.Vector3(0, 0, 0)
|
|
|
},
|
|
|
textureIntensityScale: 1.0
|
|
|
};
|
|
@@ -110092,7 +110123,7 @@ var ViewerLabs = /** @class */ (function () {
|
|
|
if (!this.environment)
|
|
|
return;
|
|
|
//set orientation
|
|
|
- var rotatquatRotationionY = babylonjs_1.Quaternion.RotationAxis(BABYLON.Axis.Y, rotationY || 0);
|
|
|
+ var rotatquatRotationionY = babylonjs_1.Quaternion.RotationAxis(babylonjs_1.Axis.Y, rotationY || 0);
|
|
|
// Add env texture to the scene.
|
|
|
if (this.environment.specularTexture) {
|
|
|
// IE crashes when disposing the old texture and setting a new one
|
|
@@ -110103,7 +110134,7 @@ var ViewerLabs = /** @class */ (function () {
|
|
|
this._sceneManager.scene.environmentTexture.level = this.environment.textureIntensityScale;
|
|
|
this._sceneManager.scene.environmentTexture.invertZ = true;
|
|
|
this._sceneManager.scene.environmentTexture.lodLevelInAlpha = true;
|
|
|
- var poly = this._sceneManager.scene.environmentTexture.sphericalPolynomial || new BABYLON.SphericalPolynomial();
|
|
|
+ var poly = this._sceneManager.scene.environmentTexture.sphericalPolynomial || new babylonjs_1.SphericalPolynomial();
|
|
|
poly.x = this.environment.irradiancePolynomialCoefficients.x;
|
|
|
poly.y = this.environment.irradiancePolynomialCoefficients.y;
|
|
|
poly.z = this.environment.irradiancePolynomialCoefficients.z;
|
|
@@ -110115,7 +110146,7 @@ var ViewerLabs = /** @class */ (function () {
|
|
|
poly.zz = this.environment.irradiancePolynomialCoefficients.zz;
|
|
|
this._sceneManager.scene.environmentTexture.sphericalPolynomial = poly;
|
|
|
//set orientation
|
|
|
- BABYLON.Matrix.FromQuaternionToRef(rotatquatRotationionY, this._sceneManager.scene.environmentTexture.getReflectionTextureMatrix());
|
|
|
+ babylonjs_1.Matrix.FromQuaternionToRef(rotatquatRotationionY, this._sceneManager.scene.environmentTexture.getReflectionTextureMatrix());
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -110135,6 +110166,21 @@ var ViewerLabs = /** @class */ (function () {
|
|
|
}
|
|
|
return returnUrl;
|
|
|
};
|
|
|
+ ViewerLabs.prototype.rotateShadowLight = function (shadowLight, amount, point, axis, target) {
|
|
|
+ if (point === void 0) { point = babylonjs_1.Vector3.Zero(); }
|
|
|
+ if (axis === void 0) { axis = babylonjs_1.Axis.Y; }
|
|
|
+ if (target === void 0) { target = babylonjs_1.Vector3.Zero(); }
|
|
|
+ axis.normalize();
|
|
|
+ point.subtractToRef(shadowLight.position, babylonjs_1.Tmp.Vector3[0]);
|
|
|
+ babylonjs_1.Matrix.TranslationToRef(babylonjs_1.Tmp.Vector3[0].x, babylonjs_1.Tmp.Vector3[0].y, babylonjs_1.Tmp.Vector3[0].z, babylonjs_1.Tmp.Matrix[0]);
|
|
|
+ babylonjs_1.Tmp.Matrix[0].invertToRef(babylonjs_1.Tmp.Matrix[2]);
|
|
|
+ babylonjs_1.Matrix.RotationAxisToRef(axis, amount, babylonjs_1.Tmp.Matrix[1]);
|
|
|
+ babylonjs_1.Tmp.Matrix[2].multiplyToRef(babylonjs_1.Tmp.Matrix[1], babylonjs_1.Tmp.Matrix[2]);
|
|
|
+ babylonjs_1.Tmp.Matrix[2].multiplyToRef(babylonjs_1.Tmp.Matrix[0], babylonjs_1.Tmp.Matrix[2]);
|
|
|
+ babylonjs_1.Tmp.Matrix[2].decompose(babylonjs_1.Tmp.Vector3[0], babylonjs_1.Tmp.Quaternion[0], babylonjs_1.Tmp.Vector3[1]);
|
|
|
+ shadowLight.position.addInPlace(babylonjs_1.Tmp.Vector3[1]);
|
|
|
+ shadowLight.setDirectionToTarget(target);
|
|
|
+ };
|
|
|
return ViewerLabs;
|
|
|
}());
|
|
|
exports.ViewerLabs = ViewerLabs;
|