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.
@@ -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;
@@ -7736,14 +7751,7 @@ var GLTFLoader = /** @class */ (function () {
7736
7751
  accessor._babylonVertexBuffer = {};
7737
7752
  }
7738
7753
  var engine = this._babylonScene.getEngine();
7739
- if (accessor.sparse) {
7740
- accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then(function (data) {
7741
- return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, data, kind, false);
7742
- });
7743
- }
7744
- // Load joint indices as a float array since the shaders expect float data but glTF uses unsigned byte/short.
7745
- // This prevents certain platforms (e.g. D3D) from having to convert the data to float on the fly.
7746
- else if (kind === babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesKind || kind === babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer.MatricesIndicesExtraKind) {
7754
+ if (accessor.sparse || accessor.bufferView == undefined) {
7747
7755
  accessor._babylonVertexBuffer[kind] = this._loadFloatAccessorAsync(context, accessor).then(function (data) {
7748
7756
  return new babylonjs_Misc_deferred__WEBPACK_IMPORTED_MODULE_0__.VertexBuffer(engine, data, kind, false);
7749
7757
  });
@@ -7751,8 +7759,8 @@ var GLTFLoader = /** @class */ (function () {
7751
7759
  else {
7752
7760
  var bufferView_2 = ArrayItem.Get("".concat(context, "/bufferView"), this._gltf.bufferViews, accessor.bufferView);
7753
7761
  accessor._babylonVertexBuffer[kind] = this._loadVertexBufferViewAsync(bufferView_2).then(function (babylonBuffer) {
7754
- var size = GLTFLoader._GetNumComponents(context, accessor.type);
7755
- 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);
7762
+ var numComponents = GLTFLoader._GetNumComponents(context, accessor.type);
7763
+ 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);
7756
7764
  });
7757
7765
  }
7758
7766
  return accessor._babylonVertexBuffer[kind];