@babylonjs/lite-compat 1.18.0-preview → 1.20.0-preview

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.
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { quatFromRotationMatrix, mat4FromQuatInto, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, createSolidTexture2D, createStandardMaterial, createMeshFromData, setMeshVisible, computeAabb, resizeMeshGeometry, removeFromScene, createLineSystem, createLineMaterial, setLineMaterialColor, setThinInstances, setThinInstanceColors, cloneTransformNode, updateLineSystem, createExtrudeShape, createTube, createRibbon, createPolyhedron, createDisc, createTorusKnot, createTorus, createCylinder, createPlane, createGroundFromHeightMap, updateMeshUvs, createGround, createSphere, createBox, createTransformNode, addToScene, setParent } from "@babylonjs/lite";
4
+ import { quatFromRotationMatrix, mat4FromQuatInto, markMaterialUboDirty, rebuildMaterial, createPbrMaterial, setPbrEmissive, setPbrClearCoat, setPbrSheen, setPbrAnisotropy, setPbrIridescence, setPbrGammaAlbedo, createSolidTexture2D, createStandardMaterial, createMeshFromData, setMeshVisible, computeAabb, resizeMeshGeometry, removeFromScene, createLineSystem, createLineMaterial, setLineMaterialColor, setThinInstances, setThinInstanceColors, cloneTransformNode, updateDashedLines, createDashedLines, updateLineSystem, createExtrudeShape, createTube, createRibbon, createPolyhedron, createDisc, createTorusKnot, createTorus, createCylinder, createPlane, createGroundFromHeightMap, updateMeshUvs, createGround, createSphere, createBox, createTransformNode, addToScene, setParent } from "@babylonjs/lite";
5
5
  class LiteCompatError extends Error {
6
6
  constructor(api, detail) {
7
7
  super(detail ? `'${api}' is not supported by the Babylon Lite compat layer. ${detail}` : `'${api}' is not supported by the Babylon Lite compat layer.`);
@@ -1813,10 +1813,10 @@ class PBRMaterial extends PushMaterial {
1813
1813
  this._markDirty();
1814
1814
  }
1815
1815
  get emissiveColor() {
1816
- return readColor3(this._lite.emissiveColor);
1816
+ return readColor3(this._lite._emissiveColor);
1817
1817
  }
1818
1818
  set emissiveColor(value) {
1819
- this._lite.emissiveColor = [value.r, value.g, value.b];
1819
+ setPbrEmissive(this._lite, [value.r, value.g, value.b]);
1820
1820
  this._markDirty();
1821
1821
  }
1822
1822
  /**
@@ -1848,40 +1848,32 @@ class PBRMaterial extends PushMaterial {
1848
1848
  */
1849
1849
  get clearCoat() {
1850
1850
  if (!this._clearCoat) {
1851
- if (!this._lite.clearCoat) {
1852
- this._lite.clearCoat = { isEnabled: false };
1853
- }
1854
- this._clearCoat = new PBRClearCoatConfiguration(this._lite.clearCoat, () => this._markDirty());
1851
+ setPbrClearCoat(this._lite, this._lite._clearCoat ?? { isEnabled: false });
1852
+ this._clearCoat = new PBRClearCoatConfiguration(this._lite._clearCoat, () => this._markDirty());
1855
1853
  }
1856
1854
  return this._clearCoat;
1857
1855
  }
1858
1856
  /** Babylon.js `pbr.sheen` sub-configuration (Lite `SheenProps`). */
1859
1857
  get sheen() {
1860
1858
  if (!this._sheen) {
1861
- if (!this._lite.sheen) {
1862
- this._lite.sheen = { isEnabled: false };
1863
- }
1864
- this._sheen = new PBRSheenConfiguration(this._lite.sheen, () => this._markDirty());
1859
+ setPbrSheen(this._lite, this._lite._sheen ?? { isEnabled: false });
1860
+ this._sheen = new PBRSheenConfiguration(this._lite._sheen, () => this._markDirty());
1865
1861
  }
1866
1862
  return this._sheen;
1867
1863
  }
1868
1864
  /** Babylon.js `pbr.anisotropy` sub-configuration (Lite `AnisotropyProps`). */
1869
1865
  get anisotropy() {
1870
1866
  if (!this._anisotropy) {
1871
- if (!this._lite.anisotropy) {
1872
- this._lite.anisotropy = { isEnabled: false };
1873
- }
1874
- this._anisotropy = new PBRAnisotropicConfiguration(this._lite.anisotropy, () => this._markDirty());
1867
+ setPbrAnisotropy(this._lite, this._lite._anisotropy ?? { isEnabled: false });
1868
+ this._anisotropy = new PBRAnisotropicConfiguration(this._lite._anisotropy, () => this._markDirty());
1875
1869
  }
1876
1870
  return this._anisotropy;
1877
1871
  }
1878
1872
  /** Babylon.js `pbr.iridescence` sub-configuration (Lite `IridescenceProps`). */
1879
1873
  get iridescence() {
1880
1874
  if (!this._iridescence) {
1881
- if (!this._lite.iridescence) {
1882
- this._lite.iridescence = { isEnabled: false };
1883
- }
1884
- this._iridescence = new PBRIridescenceConfiguration(this._lite.iridescence, () => this._markDirty());
1875
+ setPbrIridescence(this._lite, this._lite._iridescence ?? { isEnabled: false });
1876
+ this._iridescence = new PBRIridescenceConfiguration(this._lite._iridescence, () => this._markDirty());
1885
1877
  }
1886
1878
  return this._iridescence;
1887
1879
  }
@@ -1914,7 +1906,11 @@ class PBRMaterial extends PushMaterial {
1914
1906
  if (albedo == null ? void 0 : albedo._lite) {
1915
1907
  lite.baseColorTexture = albedo._lite;
1916
1908
  lite.baseColorFactor = [...this._albedoFactor];
1917
- lite.gammaAlbedo = albedo.gammaSpace ?? true;
1909
+ if (albedo.gammaSpace ?? true) {
1910
+ setPbrGammaAlbedo(lite);
1911
+ } else {
1912
+ lite._gammaAlbedo = false;
1913
+ }
1918
1914
  }
1919
1915
  if (!lite.baseColorTexture) {
1920
1916
  const f = this._albedoFactor;
@@ -1954,17 +1950,20 @@ class PBRMaterial extends PushMaterial {
1954
1950
  target._albedoTexture = this._albedoTexture;
1955
1951
  const src = this._lite;
1956
1952
  const dst = target._lite;
1957
- if (src.clearCoat) {
1958
- dst.clearCoat = { ...src.clearCoat };
1953
+ if (src._emissiveColor) {
1954
+ setPbrEmissive(dst, [...src._emissiveColor]);
1955
+ }
1956
+ if (src._clearCoat) {
1957
+ setPbrClearCoat(dst, { ...src._clearCoat });
1959
1958
  }
1960
- if (src.sheen) {
1961
- dst.sheen = { ...src.sheen };
1959
+ if (src._sheen) {
1960
+ setPbrSheen(dst, { ...src._sheen });
1962
1961
  }
1963
- if (src.anisotropy) {
1964
- dst.anisotropy = { ...src.anisotropy };
1962
+ if (src._anisotropy) {
1963
+ setPbrAnisotropy(dst, { ...src._anisotropy });
1965
1964
  }
1966
- if (src.iridescence) {
1967
- dst.iridescence = { ...src.iridescence };
1965
+ if (src._iridescence) {
1966
+ setPbrIridescence(dst, { ...src._iridescence });
1968
1967
  }
1969
1968
  }
1970
1969
  }
@@ -3233,8 +3232,30 @@ const MeshBuilder = {
3233
3232
  return addPrimitive(new LinesMesh(name, lite, scene, !!options.colors, options.useVertexAlpha ?? true), scene);
3234
3233
  },
3235
3234
  // ── Known but unsupported (not present in Babylon Lite) ────────────────
3236
- CreateDashedLines() {
3237
- return unsupported("MeshBuilder.CreateDashedLines", "Dashed line meshes are not implemented in Babylon Lite.");
3235
+ CreateDashedLines(name, options, scene) {
3236
+ if (options.instance) {
3237
+ const instanceScene = options.instance.getScene() ?? scene;
3238
+ if (!instanceScene) {
3239
+ throw new Error("MeshBuilder.CreateDashedLines requires the instance to belong to a scene");
3240
+ }
3241
+ updateDashedLines(engineOf(instanceScene), options.instance._lite, { points: options.points });
3242
+ return options.instance;
3243
+ }
3244
+ if (options.material) {
3245
+ return unsupported("MeshBuilder.CreateDashedLines.material", "Custom line materials are not implemented in Babylon Lite compatibility mode.");
3246
+ }
3247
+ if (!scene) {
3248
+ throw new Error("MeshBuilder.CreateDashedLines requires a scene");
3249
+ }
3250
+ const lite = createDashedLines(engineOf(scene), {
3251
+ name,
3252
+ points: options.points,
3253
+ ...options.dashSize !== void 0 ? { dashSize: options.dashSize } : {},
3254
+ ...options.gapSize !== void 0 ? { gapSize: options.gapSize } : {},
3255
+ ...options.dashNb !== void 0 ? { dashNb: options.dashNb } : {},
3256
+ useVertexAlpha: options.useVertexAlpha
3257
+ });
3258
+ return addPrimitive(new LinesMesh(name, lite, scene, false, options.useVertexAlpha ?? true), scene);
3238
3259
  },
3239
3260
  CreateDecal() {
3240
3261
  return unsupported("MeshBuilder.CreateDecal", "Decal projection is not implemented in Babylon Lite.");
@@ -3282,6 +3303,9 @@ function CreateLines(name, options, scene) {
3282
3303
  function CreateLineSystem(name, options, scene) {
3283
3304
  return MeshBuilder.CreateLineSystem(name, options, scene);
3284
3305
  }
3306
+ function CreateDashedLines(name, options, scene) {
3307
+ return MeshBuilder.CreateDashedLines(name, options, scene);
3308
+ }
3285
3309
  function CreateTiledBox(name, options, scene) {
3286
3310
  return MeshBuilder.CreateTiledBox(name, options, scene);
3287
3311
  }
@@ -3292,20 +3316,21 @@ export {
3292
3316
  AbstractMesh as A,
3293
3317
  BoundingBox as B,
3294
3318
  Color3 as C,
3295
- PushMaterial as D,
3296
- Vector2 as E,
3297
- Vector4 as F,
3319
+ PBRSpecularGlossinessMaterial as D,
3320
+ PushMaterial as E,
3321
+ Vector2 as F,
3298
3322
  GroundMesh as G,
3299
- VertexBuffer as H,
3323
+ Vector4 as H,
3300
3324
  InstancedMesh as I,
3301
- VertexData as J,
3302
- transformCoordinates as K,
3325
+ VertexBuffer as J,
3326
+ VertexData as K,
3303
3327
  LiteCompatError as L,
3304
3328
  Matrix as M,
3305
3329
  Node as N,
3306
- transformNormal as O,
3330
+ transformCoordinates as O,
3307
3331
  PBRAnisotropicConfiguration as P,
3308
3332
  Quaternion as Q,
3333
+ transformNormal as R,
3309
3334
  StandardMaterial as S,
3310
3335
  TransformNode as T,
3311
3336
  Vector3 as V,
@@ -3315,25 +3340,25 @@ export {
3315
3340
  BoundingSphere as d,
3316
3341
  CreateBox as e,
3317
3342
  CreateCylinder as f,
3318
- CreateDisc as g,
3319
- CreateGround as h,
3320
- CreateLineSystem as i,
3321
- CreateLines as j,
3322
- CreatePlane as k,
3343
+ CreateDashedLines as g,
3344
+ CreateDisc as h,
3345
+ CreateGround as i,
3346
+ CreateLineSystem as j,
3347
+ CreateLines as k,
3323
3348
  liteBackedVector3 as l,
3324
- CreateSphere as m,
3325
- CreateTiledBox as n,
3326
- CreateTiledPlane as o,
3327
- CreateTorus as p,
3328
- LinesMesh as q,
3329
- Material as r,
3330
- MeshBuilder as s,
3331
- PBRClearCoatConfiguration as t,
3349
+ CreatePlane as m,
3350
+ CreateSphere as n,
3351
+ CreateTiledBox as o,
3352
+ CreateTiledPlane as p,
3353
+ CreateTorus as q,
3354
+ LinesMesh as r,
3355
+ Material as s,
3356
+ MeshBuilder as t,
3332
3357
  unsupported as u,
3333
- PBRIridescenceConfiguration as v,
3334
- PBRMaterial as w,
3335
- PBRMetallicRoughnessMaterial as x,
3336
- PBRSheenConfiguration as y,
3337
- PBRSpecularGlossinessMaterial as z
3358
+ PBRClearCoatConfiguration as v,
3359
+ PBRIridescenceConfiguration as w,
3360
+ PBRMaterial as x,
3361
+ PBRMetallicRoughnessMaterial as y,
3362
+ PBRSheenConfiguration as z
3338
3363
  };
3339
- //# sourceMappingURL=meshes-0TVZfbq3.js.map
3364
+ //# sourceMappingURL=meshes-eNVvq5sm.js.map