babylonjs-loaders 6.22.1 → 6.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4447,6 +4447,16 @@ var TransmissionHelper = /** @class */ (function () {
4447
4447
  }
4448
4448
  };
4449
4449
  /**
4450
+ * @internal
4451
+ * Check if the opaque render target has not been disposed and can still be used.
4452
+ * @returns
4453
+ */
4454
+ TransmissionHelper.prototype._isRenderTargetValid = function () {
4455
+ var _a;
4456
+ return ((_a = this._opaqueRenderTarget) === null || _a === void 0 ? void 0 : _a.getInternalTexture()) !== null;
4457
+ };
4458
+ /**
4459
+ * @internal
4450
4460
  * Setup the render targets according to the specified options.
4451
4461
  */
4452
4462
  TransmissionHelper.prototype._setupRenderTargets = function () {
@@ -4544,6 +4554,7 @@ var KHR_materials_transmission = /** @class */ (function () {
4544
4554
  });
4545
4555
  };
4546
4556
  KHR_materials_transmission.prototype._loadTransparentPropertiesAsync = function (context, material, babylonMaterial, extension) {
4557
+ var _a, _b;
4547
4558
  if (!(babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_0__.PBRMaterial)) {
4548
4559
  throw new Error("".concat(context, ": Material type not supported"));
4549
4560
  }
@@ -4560,6 +4571,10 @@ var KHR_materials_transmission = /** @class */ (function () {
4560
4571
  if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {
4561
4572
  new TransmissionHelper({}, pbrMaterial.getScene());
4562
4573
  }
4574
+ else if (pbrMaterial.subSurface.refractionIntensity && !((_a = scene._transmissionHelper) === null || _a === void 0 ? void 0 : _a._isRenderTargetValid())) {
4575
+ // If the render target is not valid, recreate it.
4576
+ (_b = scene._transmissionHelper) === null || _b === void 0 ? void 0 : _b._setupRenderTargets();
4577
+ }
4563
4578
  }
4564
4579
  else {
4565
4580
  pbrMaterial.subSurface.refractionIntensity = 0.0;