|
@@ -8744,6 +8744,7 @@ var BABYLON;
|
|
|
this.blurScale = 2;
|
|
|
this._blurBoxOffset = 0;
|
|
|
this._bias = 0.00005;
|
|
|
+ this._lightDirection = BABYLON.Vector3.Zero();
|
|
|
this._darkness = 0;
|
|
|
this._transparencyShadow = false;
|
|
|
this._viewMatrix = BABYLON.Matrix.Zero();
|
|
@@ -9013,14 +9014,17 @@ var BABYLON;
|
|
|
}
|
|
|
this._currentRenderID = scene.getRenderId();
|
|
|
var lightPosition = this._light.position;
|
|
|
- var lightDirection = this._light.direction;
|
|
|
+ BABYLON.Vector3.NormalizeToRef(this._light.direction, this._lightDirection);
|
|
|
+ if (Math.abs(BABYLON.Vector3.Dot(this._lightDirection, BABYLON.Vector3.Up())) == 1.0) {
|
|
|
+ this._lightDirection.z = 0.0000000000001; // Need to avoid perfectly perpendicular light
|
|
|
+ }
|
|
|
if (this._light.computeTransformedPosition()) {
|
|
|
lightPosition = this._light.transformedPosition;
|
|
|
}
|
|
|
- if (this._light.needRefreshPerFrame() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !lightDirection.equals(this._cachedDirection)) {
|
|
|
+ if (this._light.needRefreshPerFrame() || !this._cachedPosition || !this._cachedDirection || !lightPosition.equals(this._cachedPosition) || !this._lightDirection.equals(this._cachedDirection)) {
|
|
|
this._cachedPosition = lightPosition.clone();
|
|
|
- this._cachedDirection = lightDirection.clone();
|
|
|
- BABYLON.Matrix.LookAtLHToRef(lightPosition, this._light.position.add(lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
|
|
|
+ this._cachedDirection = this._lightDirection.clone();
|
|
|
+ BABYLON.Matrix.LookAtLHToRef(lightPosition, this._light.position.add(this._lightDirection), BABYLON.Vector3.Up(), this._viewMatrix);
|
|
|
this._light.setShadowProjectionMatrix(this._projectionMatrix, this._viewMatrix, this.getShadowMap().renderList);
|
|
|
this._viewMatrix.multiplyToRef(this._projectionMatrix, this._transformMatrix);
|
|
|
}
|
|
@@ -10785,6 +10789,7 @@ var BABYLON;
|
|
|
this.angularSensibility = 1000.0;
|
|
|
this.wheelPrecision = 3.0;
|
|
|
this.pinchPrecision = 2.0;
|
|
|
+ this.panningSensibility = 0.1;
|
|
|
this.keysUp = [38];
|
|
|
this.keysDown = [40];
|
|
|
this.keysLeft = [37];
|
|
@@ -10924,8 +10929,8 @@ var BABYLON;
|
|
|
_this._localDirection = BABYLON.Vector3.Zero();
|
|
|
_this._transformedDirection = BABYLON.Vector3.Zero();
|
|
|
}
|
|
|
- var diffx = (evt.clientX - _this._lastPanningPosition.x) * 0.1;
|
|
|
- var diffy = (evt.clientY - _this._lastPanningPosition.y) * 0.1;
|
|
|
+ var diffx = (evt.clientX - _this._lastPanningPosition.x) * _this.panningSensibility;
|
|
|
+ var diffy = (evt.clientY - _this._lastPanningPosition.y) * _this.panningSensibility;
|
|
|
_this._localDirection.copyFromFloats(-diffx, diffy, 0);
|
|
|
_this._viewMatrix.invertToRef(_this._cameraTransformMatrix);
|
|
|
BABYLON.Vector3.TransformNormalToRef(_this._localDirection, _this._cameraTransformMatrix, _this._transformedDirection);
|
|
@@ -11219,14 +11224,16 @@ var BABYLON;
|
|
|
}
|
|
|
return this._viewMatrix;
|
|
|
};
|
|
|
- ArcRotateCamera.prototype.zoomOn = function (meshes) {
|
|
|
+ ArcRotateCamera.prototype.zoomOn = function (meshes, doNotUpdateMaxZ) {
|
|
|
+ if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }
|
|
|
meshes = meshes || this.getScene().meshes;
|
|
|
var minMaxVector = BABYLON.Mesh.MinMax(meshes);
|
|
|
var distance = BABYLON.Vector3.Distance(minMaxVector.min, minMaxVector.max);
|
|
|
this.radius = distance * this.zoomOnFactor;
|
|
|
- this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance });
|
|
|
+ this.focusOn({ min: minMaxVector.min, max: minMaxVector.max, distance: distance }, doNotUpdateMaxZ);
|
|
|
};
|
|
|
- ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance) {
|
|
|
+ ArcRotateCamera.prototype.focusOn = function (meshesOrMinMaxVectorAndDistance, doNotUpdateMaxZ) {
|
|
|
+ if (doNotUpdateMaxZ === void 0) { doNotUpdateMaxZ = false; }
|
|
|
var meshesOrMinMaxVector;
|
|
|
var distance;
|
|
|
if (meshesOrMinMaxVectorAndDistance.min === undefined) {
|
|
@@ -11239,7 +11246,9 @@ var BABYLON;
|
|
|
distance = meshesOrMinMaxVectorAndDistance.distance;
|
|
|
}
|
|
|
this.target = BABYLON.Mesh.Center(meshesOrMinMaxVector);
|
|
|
- this.maxZ = distance * 2;
|
|
|
+ if (!doNotUpdateMaxZ) {
|
|
|
+ this.maxZ = distance * 2;
|
|
|
+ }
|
|
|
};
|
|
|
/**
|
|
|
* @override
|