@preference-sl/pref-viewer 2.16.0-beta.4 → 2.16.0-beta.5

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@preference-sl/pref-viewer",
3
- "version": "2.16.0-beta.4",
3
+ "version": "2.16.0-beta.5",
4
4
  "description": "Web Component to preview GLTF models with Babylon.js",
5
5
  "author": "Alex Moreno Palacio <amoreno@preference.es>",
6
6
  "scripts": {
@@ -2643,13 +2643,6 @@ export default class BabylonJSController {
2643
2643
  }
2644
2644
  const stagedAssetContainer = container?.assetContainer ?? null;
2645
2645
  if (stagedAssetContainer) {
2646
- try {
2647
- stagedAssetContainer.meshes?.forEach((mesh) => {
2648
- mesh.visibility = 0;
2649
- });
2650
- } catch {
2651
- // ignore
2652
- }
2653
2646
  try {
2654
2647
  container.state.visible = false;
2655
2648
  this.#addContainer(container, false);
@@ -2673,6 +2666,7 @@ export default class BabylonJSController {
2673
2666
  mesh.visibility = 1;
2674
2667
  });
2675
2668
  this.#setVisibilityOfWallAndFloorInModel();
2669
+ this.#setOptions_Materials(true);
2676
2670
  } catch {
2677
2671
  // ignore
2678
2672
  }
@@ -3844,6 +3838,15 @@ export default class BabylonJSController {
3844
3838
  }
3845
3839
 
3846
3840
  this.#requestRender({ frames: 3, continuousMs: this.#config.render.interactionMs });
3841
+ // Materials: shaders assigned by #setOptions_Materials need compilation. Start
3842
+ // rendering immediately (above) so the loop runs; then when all shaders are ready,
3843
+ // fire additional frames so the compiled textures actually appear without requiring
3844
+ // a camera interaction to trigger them.
3845
+ if (containerName === "materials" && this.#scene) {
3846
+ this.#scene.whenReadyAsync().then(() => {
3847
+ this.#requestRender({ frames: 3, force: true });
3848
+ }).catch(() => { /* scene disposed — ignore */ });
3849
+ }
3847
3850
  if (containerName === "model" && !this.#modelFirstPaintedEmitted) {
3848
3851
  try {
3849
3852
  performance.mark(`viewer:model-first-painted:scheduled:${modelFirstPaintedLoadToken}`);