@babylonjs/lite-compat 1.39.2 → 1.39.3

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.
@@ -2147,6 +2147,9 @@ var StandardMaterial = class StandardMaterial extends PushMaterial {
2147
2147
  cloned._diffuseTexture = this._diffuseTexture;
2148
2148
  cloned._bumpTexture = this._bumpTexture;
2149
2149
  cloned._emissiveTexture = this._emissiveTexture;
2150
+ cloned._watchTexture(cloned._diffuseTexture);
2151
+ cloned._watchTexture(cloned._bumpTexture);
2152
+ cloned._watchTexture(cloned._emissiveTexture);
2150
2153
  return cloned;
2151
2154
  }
2152
2155
  };
@@ -2194,9 +2197,11 @@ var PBRClearCoatConfiguration = class {
2194
2197
  var PBRSheenConfiguration = class {
2195
2198
  _props;
2196
2199
  _markDirty;
2197
- constructor(_props, _markDirty) {
2200
+ _watchTexture;
2201
+ constructor(_props, _markDirty, _watchTexture) {
2198
2202
  this._props = _props;
2199
2203
  this._markDirty = _markDirty;
2204
+ this._watchTexture = _watchTexture;
2200
2205
  }
2201
2206
  get isEnabled() {
2202
2207
  return this._props.isEnabled;
@@ -2240,16 +2245,29 @@ var PBRSheenConfiguration = class {
2240
2245
  return this._texture;
2241
2246
  }
2242
2247
  set texture(value) {
2248
+ this._textureAssigned = true;
2243
2249
  this._texture = value;
2244
2250
  if (value?._lite) this._props.texture = value._lite;
2245
2251
  else delete this._props.texture;
2252
+ this._watchTexture(value);
2246
2253
  this._markDirty();
2247
2254
  }
2248
2255
  _texture = null;
2256
+ _textureAssigned = false;
2249
2257
  /** Enumerate the sheen texture slot for `Material.getActiveTextures`. */
2250
2258
  getActiveTextures() {
2251
2259
  return this._texture ? [this._texture] : [];
2252
2260
  }
2261
+ /** @internal Rebind a replaced or newly-ready texture handle. */
2262
+ _ensureRenderable() {
2263
+ if (!this._textureAssigned) return;
2264
+ if (this._texture?._lite) this._props.texture = this._texture._lite;
2265
+ else delete this._props.texture;
2266
+ }
2267
+ /** @internal Copy an explicit facade texture assignment without disturbing loader-owned state. */
2268
+ _copyTextureTo(target) {
2269
+ if (this._textureAssigned) target.texture = this._texture;
2270
+ }
2253
2271
  };
2254
2272
  /** Babylon.js `PBRAnisotropicConfiguration` — the `pbr.anisotropy` sub-object over Lite `AnisotropyProps`. */
2255
2273
  var PBRAnisotropicConfiguration = class {
@@ -2507,7 +2525,7 @@ var PBRMaterial = class PBRMaterial extends PushMaterial {
2507
2525
  get sheen() {
2508
2526
  if (!this._sheen) {
2509
2527
  setPbrSheen(this._lite, this._lite._sheen ?? { isEnabled: false });
2510
- this._sheen = new PBRSheenConfiguration(this._lite._sheen, () => this._markDirty());
2528
+ this._sheen = new PBRSheenConfiguration(this._lite._sheen, () => this._markDirty(), (texture) => this._watchTexture(texture));
2511
2529
  }
2512
2530
  return this._sheen;
2513
2531
  }
@@ -2566,6 +2584,7 @@ var PBRMaterial = class PBRMaterial extends PushMaterial {
2566
2584
  lite.bentNormalTexture = bent._lite;
2567
2585
  lite.bentNormalStrength = bent.level ?? 1;
2568
2586
  }
2587
+ this._sheen?._ensureRenderable();
2569
2588
  if (!lite.baseColorTexture) {
2570
2589
  lite.baseColorTexture = createSolidTexture2D(engine, 1, 1, 1, 1);
2571
2590
  lite.baseColorFactor = [...this._albedoFactor];
@@ -2601,7 +2620,10 @@ var PBRMaterial = class PBRMaterial extends PushMaterial {
2601
2620
  const dst = target._lite;
2602
2621
  if (src._emissiveColor) setPbrEmissive(dst, [...src._emissiveColor]);
2603
2622
  if (src._clearCoat) setPbrClearCoat(dst, { ...src._clearCoat });
2604
- if (src._sheen) setPbrSheen(dst, { ...src._sheen });
2623
+ if (src._sheen) {
2624
+ setPbrSheen(dst, { ...src._sheen });
2625
+ if (this._sheen) this._sheen._copyTextureTo(target.sheen);
2626
+ }
2605
2627
  if (src._anisotropy) setPbrAnisotropy(dst, { ...src._anisotropy });
2606
2628
  if (src._iridescence) setPbrIridescence(dst, { ...src._iridescence });
2607
2629
  if (src.bentNormalTexture) {
@@ -4477,4 +4499,4 @@ var PolygonBuilder = {
4477
4499
  function RegisterPolygonBuilder() {}
4478
4500
  export { Vector2 as $, Material as A, attachMaterialToScene as B, RegisterPolygonBuilder as C, registerMeshAtStart as D, VertexData as E, PBRMetallicRoughnessMaterial as F, BoundingSphere as G, Observable as H, PBRSheenConfiguration as I, transformNormal as J, Matrix as K, PBRSpecularGlossinessMaterial as L, PBRClearCoatConfiguration as M, PBRIridescenceConfiguration as N, MorphTarget as O, PBRMaterial as P, liteBackedColor3 as Q, PushMaterial as R, PolygonBuilder as S, VertexBuffer as T, BoundingBox as U, Node as V, BoundingInfo as W, Color3 as X, Quaternion as Y, Color4 as Z, GroundMesh as _, CreateDisc as a, Mesh as b, CreateLines as c, CreatePolygonVertexData as d, Vector3 as et, CreateSphere as f, ExtrudePolygon as g, CreateTorus as h, CreateDashedLines as i, unsupported as it, PBRAnisotropicConfiguration as j, MorphTargetManager as k, CreatePlane as l, CreateTiledPlane as m, CreateBox as n, liteBackedVector3 as nt, CreateGround as o, CreateTiledBox as p, transformCoordinates as q, CreateCylinder as r, LiteCompatError as rt, CreateLineSystem as s, AbstractMesh as t, Vector4 as tt, CreatePolygon as u, InstancedMesh as v, TransformNode as w, MeshBuilder as x, LinesMesh as y, StandardMaterial as z };
4479
4501
 
4480
- //# sourceMappingURL=meshes-DWnDIh1l.js.map
4502
+ //# sourceMappingURL=meshes-FwqJpX7D.js.map