|
@@ -24059,7 +24059,6 @@ var BABYLON;
|
|
|
// Camera
|
|
|
this.resetCachedMaterial();
|
|
|
this._renderId++;
|
|
|
- this.activeCamera.update();
|
|
|
this.updateTransformMatrix();
|
|
|
if (camera._alternateCamera) {
|
|
|
this.updateAlternateTransformMatrix(camera._alternateCamera);
|
|
@@ -24203,10 +24202,6 @@ var BABYLON;
|
|
|
this._renderForCamera(camera);
|
|
|
return;
|
|
|
}
|
|
|
- // Update camera
|
|
|
- if (this.activeCamera) {
|
|
|
- this.activeCamera.update();
|
|
|
- }
|
|
|
// rig cameras
|
|
|
for (var index = 0; index < camera._rigCameras.length; index++) {
|
|
|
this._renderForCamera(camera._rigCameras[index], camera);
|
|
@@ -24319,6 +24314,28 @@ var BABYLON;
|
|
|
}
|
|
|
// Before render
|
|
|
this.onBeforeRenderObservable.notifyObservers(this);
|
|
|
+ // 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ 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();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
// Customs render targets
|
|
|
this.OnBeforeRenderTargetsRenderObservable.notifyObservers(this);
|
|
|
var engine = this.getEngine();
|
|
@@ -59805,6 +59822,11 @@ var BABYLON;
|
|
|
var maxSize = engine.getCaps().maxTextureSize;
|
|
|
var requiredWidth = ((sourceTexture ? sourceTexture.width : this._engine.getRenderWidth(true)) * this._options) | 0;
|
|
|
var requiredHeight = ((sourceTexture ? sourceTexture.height : this._engine.getRenderHeight(true)) * this._options) | 0;
|
|
|
+ // If rendering to a webvr camera's left or right eye only half the width should be used to avoid resize when rendered to screen
|
|
|
+ var webVRCamera = camera.parent;
|
|
|
+ if (webVRCamera && (webVRCamera.leftCamera == camera || webVRCamera.rightCamera == camera)) {
|
|
|
+ requiredWidth /= 2;
|
|
|
+ }
|
|
|
var desiredWidth = (this._options.width || requiredWidth);
|
|
|
var desiredHeight = this._options.height || requiredHeight;
|
|
|
if (!this._shareOutputWithPostProcess && !this._forcedOutputTexture) {
|
|
@@ -66671,6 +66693,7 @@ var BABYLON;
|
|
|
(function (BABYLON) {
|
|
|
var PostProcessRenderPipeline = /** @class */ (function () {
|
|
|
function PostProcessRenderPipeline(engine, name) {
|
|
|
+ this.engine = engine;
|
|
|
this._name = name;
|
|
|
this._renderEffects = {};
|
|
|
this._renderEffectsForIsolatedPass = new Array();
|
|
@@ -66770,6 +66793,18 @@ var BABYLON;
|
|
|
this._renderEffects = {};
|
|
|
this._renderEffectsForIsolatedPass = new Array();
|
|
|
};
|
|
|
+ PostProcessRenderPipeline.prototype._enableMSAAOnFirstPostProcess = function () {
|
|
|
+ // Set samples of the very first post process to 4 to enable native anti-aliasing in browsers that support webGL 2.0 (See: https://github.com/BabylonJS/Babylon.js/issues/3754)
|
|
|
+ var effectKeys = Object.keys(this._renderEffects);
|
|
|
+ if (this.engine.webGLVersion >= 2 && effectKeys.length > 0) {
|
|
|
+ var postProcesses = this._renderEffects[effectKeys[0]].getPostProcesses();
|
|
|
+ if (postProcesses) {
|
|
|
+ postProcesses[0].samples = 4;
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ };
|
|
|
PostProcessRenderPipeline.prototype.dispose = function () {
|
|
|
// Must be implemented by children
|
|
|
};
|
|
@@ -69119,6 +69154,7 @@ var BABYLON;
|
|
|
if (this._cameras !== null) {
|
|
|
this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name, this._cameras);
|
|
|
}
|
|
|
+ this._enableMSAAOnFirstPostProcess();
|
|
|
};
|
|
|
DefaultRenderingPipeline.prototype._disposePostProcesses = function () {
|
|
|
for (var i = 0; i < this._cameras.length; i++) {
|
|
@@ -80555,7 +80591,7 @@ var BABYLON;
|
|
|
this._deviceToWorld.invertToRef(this._worldToDevice);
|
|
|
// Update the gamepad to ensure the mesh is updated on the same frame as camera
|
|
|
this.controllers.forEach(function (controller) {
|
|
|
- controller._deviceToWorld = _this._deviceToWorld;
|
|
|
+ controller._deviceToWorld.copyFrom(_this._deviceToWorld);
|
|
|
controller.update();
|
|
|
});
|
|
|
}
|
|
@@ -80589,6 +80625,9 @@ var BABYLON;
|
|
|
*/
|
|
|
WebVRFreeCamera.prototype._getWebVRViewMatrix = function () {
|
|
|
var _this = this;
|
|
|
+ // Update the parent camera prior to using a child camera to avoid desynchronization
|
|
|
+ var parentCamera = this._cameraRigParams["parentCamera"];
|
|
|
+ parentCamera._updateCache();
|
|
|
//WebVR 1.1
|
|
|
var viewArray = this._cameraRigParams["left"] ? this._cameraRigParams["frameData"].leftViewMatrix : this._cameraRigParams["frameData"].rightViewMatrix;
|
|
|
BABYLON.Matrix.FromArrayToRef(viewArray, 0, this._webvrViewMatrix);
|
|
@@ -80602,7 +80641,6 @@ var BABYLON;
|
|
|
BABYLON.Vector3.TransformCoordinatesToRef(this._referencePoint, this._cameraRotationMatrix, this._transformedReferencePoint);
|
|
|
// Computing target and final matrix
|
|
|
this.position.addToRef(this._transformedReferencePoint, this._currentTarget);
|
|
|
- var parentCamera = this._cameraRigParams["parentCamera"];
|
|
|
// should the view matrix be updated with scale and position offset?
|
|
|
if (parentCamera.deviceScaleFactor !== 1) {
|
|
|
this._webvrViewMatrix.invert();
|
|
@@ -80649,7 +80687,7 @@ var BABYLON;
|
|
|
_this._rightController = null;
|
|
|
}
|
|
|
if (webVrController.hand === "left") {
|
|
|
- _this._rightController = null;
|
|
|
+ _this._leftController = null;
|
|
|
}
|
|
|
var controllerIndex = _this.controllers.indexOf(webVrController);
|
|
|
if (controllerIndex !== -1) {
|
|
@@ -80660,7 +80698,7 @@ var BABYLON;
|
|
|
this._onGamepadConnectedObserver = manager.onGamepadConnectedObservable.add(function (gamepad) {
|
|
|
if (gamepad.type === BABYLON.Gamepad.POSE_ENABLED) {
|
|
|
var webVrController_1 = gamepad;
|
|
|
- webVrController_1._deviceToWorld = _this._deviceToWorld;
|
|
|
+ webVrController_1._deviceToWorld.copyFrom(_this._deviceToWorld);
|
|
|
if (_this.webVROptions.controllerMeshes) {
|
|
|
if (webVrController_1.defaultModel) {
|
|
|
webVrController_1.defaultModel.setEnabled(true);
|
|
@@ -87123,7 +87161,7 @@ var BABYLON;
|
|
|
this._viewMatrix = BABYLON.Matrix.Identity();
|
|
|
this._target = BABYLON.Vector3.Zero();
|
|
|
this._add = BABYLON.Vector3.Zero();
|
|
|
- this.invertYAxis = false;
|
|
|
+ this._invertYAxis = false;
|
|
|
this.position = BABYLON.Vector3.Zero();
|
|
|
this._scene = scene;
|
|
|
this._scene.reflectionProbes.push(this);
|
|
@@ -87137,10 +87175,10 @@ var BABYLON;
|
|
|
_this._add.copyFromFloats(-1, 0, 0);
|
|
|
break;
|
|
|
case 2:
|
|
|
- _this._add.copyFromFloats(0, _this.invertYAxis ? 1 : -1, 0);
|
|
|
+ _this._add.copyFromFloats(0, _this._invertYAxis ? 1 : -1, 0);
|
|
|
break;
|
|
|
case 3:
|
|
|
- _this._add.copyFromFloats(0, _this.invertYAxis ? -1 : 1, 0);
|
|
|
+ _this._add.copyFromFloats(0, _this._invertYAxis ? -1 : 1, 0);
|
|
|
break;
|
|
|
case 4:
|
|
|
_this._add.copyFromFloats(0, 0, 1);
|