|
@@ -12953,7 +12953,7 @@ var BABYLON;
|
|
* Returns the current version of the framework
|
|
* Returns the current version of the framework
|
|
*/
|
|
*/
|
|
get: function () {
|
|
get: function () {
|
|
- return "4.0.0-alpha.8";
|
|
|
|
|
|
+ return "4.0.0-alpha.9";
|
|
},
|
|
},
|
|
enumerable: true,
|
|
enumerable: true,
|
|
configurable: true
|
|
configurable: true
|
|
@@ -18827,6 +18827,10 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
this.metadata = null;
|
|
this.metadata = null;
|
|
/**
|
|
/**
|
|
|
|
+ * For internal use only. Please do not use.
|
|
|
|
+ */
|
|
|
|
+ this.reservedDataStore = null;
|
|
|
|
+ /**
|
|
* Gets or sets a boolean used to define if the node must be serialized
|
|
* Gets or sets a boolean used to define if the node must be serialized
|
|
*/
|
|
*/
|
|
this.doNotSerialize = false;
|
|
this.doNotSerialize = false;
|
|
@@ -18914,7 +18918,7 @@ var BABYLON;
|
|
if (index !== -1) {
|
|
if (index !== -1) {
|
|
this._parentNode._children.splice(index, 1);
|
|
this._parentNode._children.splice(index, 1);
|
|
}
|
|
}
|
|
- if (!parent) {
|
|
|
|
|
|
+ if (!parent && !this._isDisposed) {
|
|
this.addToSceneRootNodes();
|
|
this.addToSceneRootNodes();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -19386,6 +19390,7 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
Node.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
Node.prototype.dispose = function (doNotRecurse, disposeMaterialAndTextures) {
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
if (disposeMaterialAndTextures === void 0) { disposeMaterialAndTextures = false; }
|
|
|
|
+ this._isDisposed = true;
|
|
if (!doNotRecurse) {
|
|
if (!doNotRecurse) {
|
|
var nodes = this.getDescendants(true);
|
|
var nodes = this.getDescendants(true);
|
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
|
|
@@ -19416,7 +19421,6 @@ var BABYLON;
|
|
behavior.detach();
|
|
behavior.detach();
|
|
}
|
|
}
|
|
this._behaviors = [];
|
|
this._behaviors = [];
|
|
- this._isDisposed = true;
|
|
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Parse animation range data from a serialization object and store them into a given node
|
|
* Parse animation range data from a serialization object and store them into a given node
|
|
@@ -20514,17 +20518,7 @@ var BABYLON;
|
|
var dv = TransformNode._lookAtVectorCache;
|
|
var dv = TransformNode._lookAtVectorCache;
|
|
var pos = space === BABYLON.Space.LOCAL ? this.position : this.getAbsolutePosition();
|
|
var pos = space === BABYLON.Space.LOCAL ? this.position : this.getAbsolutePosition();
|
|
targetPoint.subtractToRef(pos, dv);
|
|
targetPoint.subtractToRef(pos, dv);
|
|
- var yaw = -Math.atan2(dv.z, dv.x) - Math.PI / 2;
|
|
|
|
- var len = Math.sqrt(dv.x * dv.x + dv.z * dv.z);
|
|
|
|
- var pitch = Math.atan2(dv.y, len);
|
|
|
|
- if (this.rotationQuaternion) {
|
|
|
|
- BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
|
|
- }
|
|
|
|
- else {
|
|
|
|
- this.rotation.x = pitch + pitchCor;
|
|
|
|
- this.rotation.y = yaw + yawCor;
|
|
|
|
- this.rotation.z = rollCor;
|
|
|
|
- }
|
|
|
|
|
|
+ this.setDirection(dv, yawCor, pitchCor, rollCor);
|
|
// Correct for parent's rotation offset
|
|
// Correct for parent's rotation offset
|
|
if (space === BABYLON.Space.WORLD && this.parent) {
|
|
if (space === BABYLON.Space.WORLD && this.parent) {
|
|
if (this.rotationQuaternion) {
|
|
if (this.rotationQuaternion) {
|
|
@@ -20579,6 +20573,31 @@ var BABYLON;
|
|
return this;
|
|
return this;
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
|
|
+ * Sets this transform node rotation to the given local axis.
|
|
|
|
+ * @param localAxis the axis in local space
|
|
|
|
+ * @param yawCor optional yaw (y-axis) correction in radians
|
|
|
|
+ * @param pitchCor optional pitch (x-axis) correction in radians
|
|
|
|
+ * @param rollCor optional roll (z-axis) correction in radians
|
|
|
|
+ * @returns this TransformNode
|
|
|
|
+ */
|
|
|
|
+ TransformNode.prototype.setDirection = function (localAxis, yawCor, pitchCor, rollCor) {
|
|
|
|
+ if (yawCor === void 0) { yawCor = 0; }
|
|
|
|
+ if (pitchCor === void 0) { pitchCor = 0; }
|
|
|
|
+ if (rollCor === void 0) { rollCor = 0; }
|
|
|
|
+ var yaw = -Math.atan2(localAxis.z, localAxis.x) - Math.PI / 2;
|
|
|
|
+ var len = Math.sqrt(localAxis.x * localAxis.x + localAxis.z * localAxis.z);
|
|
|
|
+ var pitch = Math.atan2(localAxis.y, len);
|
|
|
|
+ if (this.rotationQuaternion) {
|
|
|
|
+ BABYLON.Quaternion.RotationYawPitchRollToRef(yaw + yawCor, pitch + pitchCor, rollCor, this.rotationQuaternion);
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ this.rotation.x = pitch + pitchCor;
|
|
|
|
+ this.rotation.y = yaw + yawCor;
|
|
|
|
+ this.rotation.z = rollCor;
|
|
|
|
+ }
|
|
|
|
+ return this;
|
|
|
|
+ };
|
|
|
|
+ /**
|
|
* Sets a new pivot point to the current node
|
|
* Sets a new pivot point to the current node
|
|
* @param point defines the new pivot point to use
|
|
* @param point defines the new pivot point to use
|
|
* @param space defines if the point is in world or local space (local by default)
|
|
* @param space defines if the point is in world or local space (local by default)
|
|
@@ -24614,6 +24633,7 @@ var BABYLON;
|
|
this._rigCameras[i].minZ = this.minZ;
|
|
this._rigCameras[i].minZ = this.minZ;
|
|
this._rigCameras[i].maxZ = this.maxZ;
|
|
this._rigCameras[i].maxZ = this.maxZ;
|
|
this._rigCameras[i].fov = this.fov;
|
|
this._rigCameras[i].fov = this.fov;
|
|
|
|
+ this._rigCameras[i].upVector.copyFrom(this.upVector);
|
|
}
|
|
}
|
|
// only update viewport when ANAGLYPH
|
|
// only update viewport when ANAGLYPH
|
|
if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
|
|
if (this.cameraRigMode === Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH) {
|
|
@@ -25844,6 +25864,10 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
_this.metadata = null;
|
|
_this.metadata = null;
|
|
/**
|
|
/**
|
|
|
|
+ * For internal use only. Please do not use.
|
|
|
|
+ */
|
|
|
|
+ _this.reservedDataStore = null;
|
|
|
|
+ /**
|
|
* Use this array to add regular expressions used to disable offline support for specific urls
|
|
* Use this array to add regular expressions used to disable offline support for specific urls
|
|
*/
|
|
*/
|
|
_this.disableOfflineSupportExceptionRules = new Array();
|
|
_this.disableOfflineSupportExceptionRules = new Array();
|
|
@@ -31658,6 +31682,10 @@ var BABYLON;
|
|
* Gets or sets an object used to store user defined information.
|
|
* Gets or sets an object used to store user defined information.
|
|
*/
|
|
*/
|
|
this.metadata = null;
|
|
this.metadata = null;
|
|
|
|
+ /**
|
|
|
|
+ * For internal use only. Please do not use.
|
|
|
|
+ */
|
|
|
|
+ this.reservedDataStore = null;
|
|
this._hasAlpha = false;
|
|
this._hasAlpha = false;
|
|
/**
|
|
/**
|
|
* Defines if the alpha value should be determined via the rgb values.
|
|
* Defines if the alpha value should be determined via the rgb values.
|
|
@@ -31746,8 +31774,8 @@ var BABYLON;
|
|
this._cachedSize = BABYLON.Size.Zero();
|
|
this._cachedSize = BABYLON.Size.Zero();
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
this._scene = scene || BABYLON.Engine.LastCreatedScene;
|
|
if (this._scene) {
|
|
if (this._scene) {
|
|
- this._scene.addTexture(this);
|
|
|
|
this.uniqueId = this._scene.getUniqueId();
|
|
this.uniqueId = this._scene.getUniqueId();
|
|
|
|
+ this._scene.addTexture(this);
|
|
}
|
|
}
|
|
this._uid = null;
|
|
this._uid = null;
|
|
}
|
|
}
|
|
@@ -36959,6 +36987,10 @@ var BABYLON;
|
|
*/
|
|
*/
|
|
this.metadata = null;
|
|
this.metadata = null;
|
|
/**
|
|
/**
|
|
|
|
+ * For internal use only. Please do not use.
|
|
|
|
+ */
|
|
|
|
+ this.reservedDataStore = null;
|
|
|
|
+ /**
|
|
* Specifies if the ready state should be checked on each call
|
|
* Specifies if the ready state should be checked on each call
|
|
*/
|
|
*/
|
|
this.checkReadyOnEveryCall = false;
|
|
this.checkReadyOnEveryCall = false;
|
|
@@ -49055,6 +49087,8 @@ var BABYLON;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
_this._currentTarget = BABYLON.Vector3.Zero();
|
|
_this._currentTarget = BABYLON.Vector3.Zero();
|
|
/** @hidden */
|
|
/** @hidden */
|
|
|
|
+ _this._initialFocalDistance = 1;
|
|
|
|
+ /** @hidden */
|
|
_this._viewMatrix = BABYLON.Matrix.Zero();
|
|
_this._viewMatrix = BABYLON.Matrix.Zero();
|
|
/** @hidden */
|
|
/** @hidden */
|
|
_this._camMatrix = BABYLON.Matrix.Zero();
|
|
_this._camMatrix = BABYLON.Matrix.Zero();
|
|
@@ -49174,6 +49208,7 @@ var BABYLON;
|
|
/** @hidden */
|
|
/** @hidden */
|
|
TargetCamera.prototype.setTarget = function (target) {
|
|
TargetCamera.prototype.setTarget = function (target) {
|
|
this.upVector.normalize();
|
|
this.upVector.normalize();
|
|
|
|
+ this._initialFocalDistance = target.subtract(this.position).length();
|
|
if (this.position.z === target.z) {
|
|
if (this.position.z === target.z) {
|
|
this.position.z += BABYLON.Epsilon;
|
|
this.position.z += BABYLON.Epsilon;
|
|
}
|
|
}
|
|
@@ -49374,10 +49409,8 @@ var BABYLON;
|
|
//provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
|
|
//provisionnaly using _cameraRigParams.stereoHalfAngle instead of calculations based on _cameraRigParams.interaxialDistance:
|
|
var leftSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;
|
|
var leftSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? 1 : -1;
|
|
var rightSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;
|
|
var rightSign = (this.cameraRigMode === BABYLON.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED) ? -1 : 1;
|
|
- this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft.position);
|
|
|
|
- this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle * rightSign, camRight.position);
|
|
|
|
- camLeft.setTarget(this.getTarget());
|
|
|
|
- camRight.setTarget(this.getTarget());
|
|
|
|
|
|
+ this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * leftSign, camLeft);
|
|
|
|
+ this._getRigCamPositionAndTarget(this._cameraRigParams.stereoHalfAngle * rightSign, camRight);
|
|
break;
|
|
break;
|
|
case BABYLON.Camera.RIG_MODE_VR:
|
|
case BABYLON.Camera.RIG_MODE_VR:
|
|
if (camLeft.rotationQuaternion) {
|
|
if (camLeft.rotationQuaternion) {
|
|
@@ -49394,13 +49427,17 @@ var BABYLON;
|
|
}
|
|
}
|
|
_super.prototype._updateRigCameras.call(this);
|
|
_super.prototype._updateRigCameras.call(this);
|
|
};
|
|
};
|
|
- TargetCamera.prototype._getRigCamPosition = function (halfSpace, result) {
|
|
|
|
|
|
+ TargetCamera.prototype._getRigCamPositionAndTarget = function (halfSpace, rigCamera) {
|
|
var target = this.getTarget();
|
|
var target = this.getTarget();
|
|
- BABYLON.Matrix.TranslationToRef(-target.x, -target.y, -target.z, TargetCamera._TargetTransformMatrix);
|
|
|
|
|
|
+ target.subtractToRef(this.position, TargetCamera._TargetFocalPoint);
|
|
|
|
+ TargetCamera._TargetFocalPoint.normalize().scaleInPlace(this._initialFocalDistance);
|
|
|
|
+ var newFocalTarget = TargetCamera._TargetFocalPoint.addInPlace(this.position);
|
|
|
|
+ BABYLON.Matrix.TranslationToRef(-newFocalTarget.x, -newFocalTarget.y, -newFocalTarget.z, TargetCamera._TargetTransformMatrix);
|
|
TargetCamera._TargetTransformMatrix.multiplyToRef(BABYLON.Matrix.RotationY(halfSpace), TargetCamera._RigCamTransformMatrix);
|
|
TargetCamera._TargetTransformMatrix.multiplyToRef(BABYLON.Matrix.RotationY(halfSpace), TargetCamera._RigCamTransformMatrix);
|
|
- BABYLON.Matrix.TranslationToRef(target.x, target.y, target.z, TargetCamera._TargetTransformMatrix);
|
|
|
|
|
|
+ BABYLON.Matrix.TranslationToRef(newFocalTarget.x, newFocalTarget.y, newFocalTarget.z, TargetCamera._TargetTransformMatrix);
|
|
TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);
|
|
TargetCamera._RigCamTransformMatrix.multiplyToRef(TargetCamera._TargetTransformMatrix, TargetCamera._RigCamTransformMatrix);
|
|
- BABYLON.Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, result);
|
|
|
|
|
|
+ BABYLON.Vector3.TransformCoordinatesToRef(this.position, TargetCamera._RigCamTransformMatrix, rigCamera.position);
|
|
|
|
+ rigCamera.setTarget(newFocalTarget);
|
|
};
|
|
};
|
|
/**
|
|
/**
|
|
* Gets the current object class name.
|
|
* Gets the current object class name.
|
|
@@ -49411,6 +49448,7 @@ var BABYLON;
|
|
};
|
|
};
|
|
TargetCamera._RigCamTransformMatrix = new BABYLON.Matrix();
|
|
TargetCamera._RigCamTransformMatrix = new BABYLON.Matrix();
|
|
TargetCamera._TargetTransformMatrix = new BABYLON.Matrix();
|
|
TargetCamera._TargetTransformMatrix = new BABYLON.Matrix();
|
|
|
|
+ TargetCamera._TargetFocalPoint = new BABYLON.Vector3();
|
|
__decorate([
|
|
__decorate([
|
|
BABYLON.serializeAsVector3()
|
|
BABYLON.serializeAsVector3()
|
|
], TargetCamera.prototype, "rotation", void 0);
|
|
], TargetCamera.prototype, "rotation", void 0);
|
|
@@ -70660,9 +70698,7 @@ var BABYLON;
|
|
vertexData.applyToMesh(plane, options.updatable);
|
|
vertexData.applyToMesh(plane, options.updatable);
|
|
if (options.sourcePlane) {
|
|
if (options.sourcePlane) {
|
|
plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
|
|
plane.translate(options.sourcePlane.normal, -options.sourcePlane.d);
|
|
- var dot = BABYLON.Vector3.Dot(plane.position, options.sourcePlane.normal);
|
|
|
|
- var flip = dot >= 0;
|
|
|
|
- plane.lookAt(BABYLON.Vector3.Zero(), 0, flip ? Math.PI : 0, 0);
|
|
|
|
|
|
+ plane.setDirection(options.sourcePlane.normal);
|
|
}
|
|
}
|
|
return plane;
|
|
return plane;
|
|
};
|
|
};
|
|
@@ -109407,6 +109443,7 @@ var BABYLON;
|
|
newCamera.minZ = 0;
|
|
newCamera.minZ = 0;
|
|
newCamera.parent = this;
|
|
newCamera.parent = this;
|
|
newCamera.rotationQuaternion = new BABYLON.Quaternion();
|
|
newCamera.rotationQuaternion = new BABYLON.Quaternion();
|
|
|
|
+ newCamera.updateUpVectorFromRotation = true;
|
|
this.rigCameras.push(newCamera);
|
|
this.rigCameras.push(newCamera);
|
|
}
|
|
}
|
|
while (this.rigCameras.length > viewCount) {
|
|
while (this.rigCameras.length > viewCount) {
|
|
@@ -121191,6 +121228,7 @@ var BABYLON;
|
|
hdrSkybox.infiniteDistance = true;
|
|
hdrSkybox.infiniteDistance = true;
|
|
hdrSkybox.material = skyboxMaterial;
|
|
hdrSkybox.material = skyboxMaterial;
|
|
}
|
|
}
|
|
|
|
+ hdrSkybox.isPickable = false;
|
|
return hdrSkybox;
|
|
return hdrSkybox;
|
|
};
|
|
};
|
|
BABYLON.Scene.prototype.createDefaultEnvironment = function (options) {
|
|
BABYLON.Scene.prototype.createDefaultEnvironment = function (options) {
|