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.
@@ -1960,6 +1960,16 @@ var TransmissionHelper = /** @class */ (function () {
1960
1960
  }
1961
1961
  };
1962
1962
  /**
1963
+ * @internal
1964
+ * Check if the opaque render target has not been disposed and can still be used.
1965
+ * @returns
1966
+ */
1967
+ TransmissionHelper.prototype._isRenderTargetValid = function () {
1968
+ var _a;
1969
+ return ((_a = this._opaqueRenderTarget) === null || _a === void 0 ? void 0 : _a.getInternalTexture()) !== null;
1970
+ };
1971
+ /**
1972
+ * @internal
1963
1973
  * Setup the render targets according to the specified options.
1964
1974
  */
1965
1975
  TransmissionHelper.prototype._setupRenderTargets = function () {
@@ -2057,6 +2067,7 @@ var KHR_materials_transmission = /** @class */ (function () {
2057
2067
  });
2058
2068
  };
2059
2069
  KHR_materials_transmission.prototype._loadTransparentPropertiesAsync = function (context, material, babylonMaterial, extension) {
2070
+ var _a, _b;
2060
2071
  if (!(babylonMaterial instanceof babylonjs_Materials_PBR_pbrMaterial__WEBPACK_IMPORTED_MODULE_0__.PBRMaterial)) {
2061
2072
  throw new Error("".concat(context, ": Material type not supported"));
2062
2073
  }
@@ -2073,6 +2084,10 @@ var KHR_materials_transmission = /** @class */ (function () {
2073
2084
  if (pbrMaterial.subSurface.refractionIntensity && !scene._transmissionHelper) {
2074
2085
  new TransmissionHelper({}, pbrMaterial.getScene());
2075
2086
  }
2087
+ else if (pbrMaterial.subSurface.refractionIntensity && !((_a = scene._transmissionHelper) === null || _a === void 0 ? void 0 : _a._isRenderTargetValid())) {
2088
+ // If the render target is not valid, recreate it.
2089
+ (_b = scene._transmissionHelper) === null || _b === void 0 ? void 0 : _b._setupRenderTargets();
2090
+ }
2076
2091
  }
2077
2092
  else {
2078
2093
  pbrMaterial.subSurface.refractionIntensity = 0.0;