babylonjs-loaders 6.22.1 → 6.23.1

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;
@@ -5249,14 +5264,7 @@ var GLTFLoader = /** @class */ (function () {
5249
5264
  accessor._babylonVertexBuffer = {};
5250
5265
  }
5251
5266
  var engine = this._babylonScene.getEngine();
5252
- if (accessor.sparse) {
5253
- accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then(function (data) {
5254
- return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, data, kind, false);
5255
- });
5256
- }
5257
- // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.
5258
- // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.
5259
- else if (kind === babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind || kind === babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind) {
5267
+ if (accessor.sparse || accessor.bufferView == undefined) {
5260
5268
  accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then(function (data) {
5261
5269
  return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, data, kind, false);
5262
5270
  });
@@ -5264,8 +5272,8 @@ var GLTFLoader = /** @class */ (function () {
5264
5272
  else {
5265
5273
  var bufferView_2 = ArrayItem.Get("".concat(context, "/bufferView"), this._gltf.bufferViews, accessor.bufferView);
5266
5274
  accessor._babylonVertexBuffer[kind] = this._loadVertexBufferViewAsync(bufferView_2).then(function (babylonBuffer) {
5267
- var size = GLTFLoader._GetNumComponents(context, accessor.type);
5268
- return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, babylonBuffer, kind, false, false, bufferView_2.byteStride, false, accessor.byteOffset, size, accessor.componentType, accessor.normalized, true, 1, true);
5275
+ var numComponents = GLTFLoader._GetNumComponents(context, accessor.type);
5276
+ return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, babylonBuffer, kind, false, undefined, bufferView_2.byteStride, undefined, accessor.byteOffset, numComponents, accessor.componentType, accessor.normalized, true, undefined, true);
5269
5277
  });
5270
5278
  }
5271
5279
  return accessor._babylonVertexBuffer[kind];