|
@@ -24520,8 +24520,6 @@ var BABYLON;
|
|
|
if (this._gamepadManager && this._gamepadManager._isMonitoring) {
|
|
|
this._gamepadManager._checkGamepadsStatus();
|
|
|
}
|
|
|
- // Before render
|
|
|
- this.onBeforeRenderObservable.notifyObservers(this);
|
|
|
// Update Cameras
|
|
|
if (this.activeCameras.length > 0) {
|
|
|
for (var cameraIndex = 0; cameraIndex < this.activeCameras.length; cameraIndex++) {
|
|
@@ -24544,6 +24542,8 @@ var BABYLON;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ // Before render
|
|
|
+ this.onBeforeRenderObservable.notifyObservers(this);
|
|
|
// Customs render targets
|
|
|
this.OnBeforeRenderTargetsRenderObservable.notifyObservers(this);
|
|
|
var engine = this.getEngine();
|
|
@@ -44789,6 +44789,7 @@ var BABYLON;
|
|
|
_this._previousPosition = BABYLON.Vector3.Zero();
|
|
|
_this._collisionVelocity = BABYLON.Vector3.Zero();
|
|
|
_this._newPosition = BABYLON.Vector3.Zero();
|
|
|
+ _this._computationVector = BABYLON.Vector3.Zero();
|
|
|
_this._onCollisionPositionChange = function (collisionId, newPosition, collidedMesh) {
|
|
|
if (collidedMesh === void 0) { collidedMesh = null; }
|
|
|
if (_this.getScene().workerCollisions && _this.checkCollisions) {
|
|
@@ -44812,7 +44813,8 @@ var BABYLON;
|
|
|
sinb = 0.0001;
|
|
|
}
|
|
|
var target = _this._getTargetPosition();
|
|
|
- target.addToRef(new BABYLON.Vector3(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb), _this._newPosition);
|
|
|
+ _this._computationVector.copyFromFloats(_this.radius * cosa * sinb, _this.radius * cosb, _this.radius * sina * sinb);
|
|
|
+ target.addToRef(_this._computationVector, _this._newPosition);
|
|
|
_this.position.copyFrom(_this._newPosition);
|
|
|
var up = _this.upVector;
|
|
|
if (_this.allowUpsideDown && _this.beta < 0) {
|
|
@@ -45288,18 +45290,18 @@ var BABYLON;
|
|
|
}
|
|
|
};
|
|
|
ArcRotateCamera.prototype.rebuildAnglesAndRadius = function () {
|
|
|
- var radiusv3 = this.position.subtract(this._getTargetPosition());
|
|
|
- this.radius = radiusv3.length();
|
|
|
+ this.position.subtractToRef(this._getTargetPosition(), this._computationVector);
|
|
|
+ this.radius = this._computationVector.length();
|
|
|
if (this.radius === 0) {
|
|
|
this.radius = 0.0001; // Just to avoid division by zero
|
|
|
}
|
|
|
// Alpha
|
|
|
- this.alpha = Math.acos(radiusv3.x / Math.sqrt(Math.pow(radiusv3.x, 2) + Math.pow(radiusv3.z, 2)));
|
|
|
- if (radiusv3.z < 0) {
|
|
|
+ this.alpha = Math.acos(this._computationVector.x / Math.sqrt(Math.pow(this._computationVector.x, 2) + Math.pow(this._computationVector.z, 2)));
|
|
|
+ if (this._computationVector.z < 0) {
|
|
|
this.alpha = 2 * Math.PI - this.alpha;
|
|
|
}
|
|
|
// Beta
|
|
|
- this.beta = Math.acos(radiusv3.y / this.radius);
|
|
|
+ this.beta = Math.acos(this._computationVector.y / this.radius);
|
|
|
this._checkLimits();
|
|
|
};
|
|
|
ArcRotateCamera.prototype.setPosition = function (position) {
|
|
@@ -45346,7 +45348,8 @@ var BABYLON;
|
|
|
sinb = 0.0001;
|
|
|
}
|
|
|
var target = this._getTargetPosition();
|
|
|
- target.addToRef(new BABYLON.Vector3(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb), this._newPosition);
|
|
|
+ this._computationVector.copyFromFloats(this.radius * cosa * sinb, this.radius * cosb, this.radius * sina * sinb);
|
|
|
+ target.addToRef(this._computationVector, this._newPosition);
|
|
|
if (this.getScene().collisionsEnabled && this.checkCollisions) {
|
|
|
if (!this._collider) {
|
|
|
this._collider = new BABYLON.Collider();
|
|
@@ -60485,6 +60488,8 @@ var BABYLON;
|
|
|
this._viewMatrix = BABYLON.Matrix.Zero();
|
|
|
this._projectionMatrix = BABYLON.Matrix.Zero();
|
|
|
this._transformMatrix = BABYLON.Matrix.Zero();
|
|
|
+ this._cachedPosition = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
|
+ this._cachedDirection = new BABYLON.Vector3(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
|
this._currentFaceIndex = 0;
|
|
|
this._currentFaceIndexCache = 0;
|
|
|
this._defaultTextureMatrix = BABYLON.Matrix.Identity();
|
|
@@ -61010,12 +61015,14 @@ var BABYLON;
|
|
|
}
|
|
|
});
|
|
|
// Clear according to the chosen filter.
|
|
|
+ var zero = new BABYLON.Color4(0, 0, 0, 0);
|
|
|
+ var one = new BABYLON.Color4(1.0, 1.0, 1.0, 1.0);
|
|
|
this._shadowMap.onClearObservable.add(function (engine) {
|
|
|
if (_this.useExponentialShadowMap || _this.useBlurExponentialShadowMap) {
|
|
|
- engine.clear(new BABYLON.Color4(0, 0, 0, 0), true, true, true);
|
|
|
+ engine.clear(zero, true, true, true);
|
|
|
}
|
|
|
else {
|
|
|
- engine.clear(new BABYLON.Color4(1.0, 1.0, 1.0, 1.0), true, true, true);
|
|
|
+ engine.clear(one, true, true, true);
|
|
|
}
|
|
|
});
|
|
|
};
|
|
@@ -61360,8 +61367,8 @@ var BABYLON;
|
|
|
this._lightDirection.z = 0.0000000000001; // Required to avoid perfectly perpendicular light
|
|
|
}
|
|
|
if (this._light.needProjectionMatrixCompute() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {
|
|
|
- this._cachedPosition = lightPosition.clone();
|
|
|
- this._cachedDirection = this._lightDirection.clone();
|
|
|
+ this._cachedPosition.copyFrom(lightPosition);
|
|
|
+ this._cachedDirection.copyFrom(this._lightDirection);
|
|
|
BABYLON.Matrix.LookAtLHToRef(lightPosition, lightPosition.add(this._lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
|
|
|
var shadowMap = this.getShadowMap();
|
|
|
if (shadowMap) {
|
|
@@ -81951,6 +81958,7 @@ var BABYLON;
|
|
|
};
|
|
|
makeNotPick(mesh);
|
|
|
var childMeshes = mesh.getChildMeshes();
|
|
|
+ this.webVRController._pointingPoseNode = null;
|
|
|
for (var i = 0; i < childMeshes.length; i++) {
|
|
|
if (childMeshes[i].name && childMeshes[i].name.indexOf(BABYLON.PoseEnabledController.POINTING_POSE) >= 0) {
|
|
|
mesh = childMeshes[i];
|
|
@@ -88650,6 +88658,7 @@ var BABYLON;
|
|
|
this._radiusTransition = BABYLON.Animation.CreateAnimation("radius", BABYLON.Animation.ANIMATIONTYPE_FLOAT, 60, FramingBehavior.EasingFunction);
|
|
|
}
|
|
|
animatable = BABYLON.Animation.TransitionTo("radius", radius, this._attachedCamera, this._attachedCamera.getScene(), 60, this._radiusTransition, this._framingTime, function () {
|
|
|
+ _this.stopAllAnimations();
|
|
|
if (onAnimationEnd) {
|
|
|
onAnimationEnd();
|
|
|
}
|
|
@@ -92177,7 +92186,7 @@ var DefaultViewer = (function (_super) {
|
|
|
console.log(error);
|
|
|
_this.hideLoadingScreen();
|
|
|
_this.showOverlayScreen('error');
|
|
|
- return _this.scene;
|
|
|
+ return Promise.reject(error);
|
|
|
});
|
|
|
};
|
|
|
DefaultViewer.prototype.showOverlayScreen = function (subScreen) {
|
|
@@ -92836,7 +92845,7 @@ var AbstractViewer = (function () {
|
|
|
return _this.onEngineInitObservable.notifyObserversWithPromise(engine);
|
|
|
}).then(function () {
|
|
|
if (autoLoadModel) {
|
|
|
- return _this.loadModel();
|
|
|
+ return _this.loadModel().then(function () { return _this.scene; });
|
|
|
}
|
|
|
else {
|
|
|
return _this.scene || _this.initScene();
|
|
@@ -92845,8 +92854,6 @@ var AbstractViewer = (function () {
|
|
|
return _this.onSceneInitObservable.notifyObserversWithPromise(scene);
|
|
|
}).then(function () {
|
|
|
return _this.onInitDoneObservable.notifyObserversWithPromise(_this);
|
|
|
- }).then(function () {
|
|
|
- return _this;
|
|
|
});
|
|
|
});
|
|
|
};
|
|
@@ -92890,14 +92897,10 @@ var AbstractViewer = (function () {
|
|
|
if (clearScene === void 0) { clearScene = true; }
|
|
|
var modelUrl = (typeof modelConfig === 'string') ? modelConfig : modelConfig.url;
|
|
|
if (!modelUrl) {
|
|
|
- return Promise.resolve(this.scene);
|
|
|
+ return Promise.reject("no model configuration found");
|
|
|
}
|
|
|
if (this.isLoading) {
|
|
|
- this.nextLoading = function () {
|
|
|
- delete _this.nextLoading;
|
|
|
- _this.loadModel(modelConfig, clearScene);
|
|
|
- };
|
|
|
- return Promise.resolve(this.scene);
|
|
|
+ return Promise.reject("sanother model is curently being loaded.");
|
|
|
}
|
|
|
this.isLoading = true;
|
|
|
if ((typeof modelConfig === 'string')) {
|
|
@@ -92947,18 +92950,14 @@ var AbstractViewer = (function () {
|
|
|
if (_this.configuration.camera) {
|
|
|
_this.configureCamera(_this.configuration.camera, model);
|
|
|
}
|
|
|
- return _this.initEnvironment(model.meshes);
|
|
|
+ return _this.initEnvironment(model);
|
|
|
}).then(function () {
|
|
|
_this.isLoading = false;
|
|
|
- if (_this.nextLoading) {
|
|
|
- return _this.nextLoading();
|
|
|
- }
|
|
|
- return _this.scene;
|
|
|
+ return model;
|
|
|
});
|
|
|
});
|
|
|
};
|
|
|
- AbstractViewer.prototype.initEnvironment = function (focusMeshes) {
|
|
|
- if (focusMeshes === void 0) { focusMeshes = this.scene.meshes; }
|
|
|
+ AbstractViewer.prototype.initEnvironment = function (model) {
|
|
|
this.configureEnvironment(this.configuration.skybox, this.configuration.ground);
|
|
|
return Promise.resolve(this.scene);
|
|
|
};
|