babylonjs-loaders 6.22.0 → 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.
@@ -6057,6 +6057,16 @@ var TransmissionHelper = /** @class */ (function () {
6057
6057
  }
6058
6058
  };
6059
6059
  /**
6060
+ * @internal
6061
+ * Check if the opaque render target has not been disposed and can still be used.
6062
+ * @returns
6063
+ */
6064
+ TransmissionHelper.prototype._isRenderTargetValid = function () {
6065
+ var _a;
6066
+ return ((_a = this._opaqueRenderTarget) === null || _a === void 0 ? void 0 : _a.getInternalTexture()) !== null;
6067
+ };
6068
+ /**
6069
+ * @internal
6060
6070
  * Setup the render targets according to the specified options.
6061
6071
  */
6062
6072
  TransmissionHelper.prototype._setupRenderTargets = function () {
@@ -6154,6 +6164,7 @@ var KHR_materials_transmission = /** @class */ (function () {
6154
6164
  });
6155
6165
  };
6156
6166
  KHR_materials_transmission.prototype._loadTransparentPropertiesAsync = function (context, material, babylonMaterial, extension) {
6167
+ var _a, _b;
6157
6168
  if (!(babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_0__.PBRMaterial)) {
6158
6169
  throw new Error("".concat(context, ": Material type not supported"));
6159
6170
  }
@@ -6170,6 +6181,10 @@ var KHR_materials_transmission = /** @class */ (function () {
6170
6181
  if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {
6171
6182
  new TransmissionHelper({}, pbrMaterial.getScene());
6172
6183
  }
6184
+ else if (pbrMaterial.subSurface.refractionIntensity && !((_a = scene._transmissionHelper) === null || _a === void 0 ? void 0 : _a._isRenderTargetValid())) {
6185
+ // If the render target is not valid, recreate it.
6186
+ (_b = scene._transmissionHelper) === null || _b === void 0 ? void 0 : _b._setupRenderTargets();
6187
+ }
6173
6188
  }
6174
6189
  else {
6175
6190
  pbrMaterial.subSurface.refractionIntensity = 0.0;