@series-inc/rundot-3d-engine 0.6.5 → 0.6.7

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.
@@ -2569,6 +2569,7 @@ var AnimationCullingManager = class _AnimationCullingManager {
2569
2569
  };
2570
2570
 
2571
2571
  // src/engine/core/VenusGame.ts
2572
+ import { StowKitLoader } from "@series-inc/stowkit-three-loader";
2572
2573
  var DEFAULT_CONFIG = {
2573
2574
  backgroundColor: 0,
2574
2575
  antialias: true,
@@ -2698,6 +2699,9 @@ var VenusGame = class _VenusGame {
2698
2699
  _VenusGame._scene = instance.scene;
2699
2700
  _VenusGame._renderer = instance.renderer;
2700
2701
  _VenusGame._camera = instance.camera;
2702
+ const stowkitInitPromise = StowKitLoader.preInitialize({
2703
+ renderer: instance.renderer
2704
+ }).catch((e) => console.warn("[VenusGame] StowKit pre-init failed (will retry on first load):", e));
2701
2705
  const platform = await initializePlatformAsync(platformType);
2702
2706
  const context = await platform.initializeAsync({
2703
2707
  usePreloader: true
@@ -2719,6 +2723,7 @@ var VenusGame = class _VenusGame {
2719
2723
  ComponentUpdater.initialize(instance.scene);
2720
2724
  InstancedMeshManager.getInstance().initialize(instance.scene);
2721
2725
  instance.setupAudioListener();
2726
+ await stowkitInitPromise;
2722
2727
  await instance.onStart();
2723
2728
  instance.startRenderLoop();
2724
2729
  await Platform.preloader.hideLoadScreen();
@@ -5514,7 +5519,7 @@ var PrefabLoader = class {
5514
5519
  };
5515
5520
 
5516
5521
  // src/systems/stowkit/StowKitSystem.ts
5517
- import { StowKitLoader } from "@series-inc/stowkit-three-loader";
5522
+ import { StowKitLoader as StowKitLoader2 } from "@series-inc/stowkit-three-loader";
5518
5523
  import { PerfLogger } from "@series-inc/stowkit-reader";
5519
5524
  import * as THREE13 from "three";
5520
5525
  var DEFAULT_DECODER_PATHS = {
@@ -5580,21 +5585,23 @@ var StowKitSystem = class _StowKitSystem {
5580
5585
  const mounts = prefabCollection.getMounts();
5581
5586
  console.log(`[StowKitSystem] Loading ${mounts.length} packs from mounts...`);
5582
5587
  PerfLogger.disable();
5583
- for (const mount of mounts) {
5584
- if (this.packs.has(mount.alias)) {
5585
- continue;
5586
- }
5587
- console.log(`[StowKitSystem] Loading pack "${mount.alias}" from ${mount.path}`);
5588
- const blob = await config.fetchBlob(mount.path);
5589
- const arrayBuffer = await blob.arrayBuffer();
5590
- const pack = await StowKitLoader.loadFromMemory(arrayBuffer, {
5591
- basisPath: this.decoderPaths.basis,
5592
- dracoPath: this.decoderPaths.draco,
5593
- wasmPath: this.decoderPaths.wasm
5594
- });
5595
- this.packs.set(mount.alias, pack);
5596
- }
5597
- console.log(`[StowKitSystem] All packs loaded`);
5588
+ const packLoadStart = performance.now();
5589
+ await Promise.all(
5590
+ mounts.filter((mount) => !this.packs.has(mount.alias)).map(async (mount) => {
5591
+ console.log(`[StowKitSystem] Loading pack "${mount.alias}" from ${mount.path}`);
5592
+ const blob = await config.fetchBlob(mount.path);
5593
+ const arrayBuffer = await blob.arrayBuffer();
5594
+ const pack = await StowKitLoader2.loadFromMemory(arrayBuffer, {
5595
+ basisPath: this.decoderPaths.basis,
5596
+ dracoPath: this.decoderPaths.draco,
5597
+ wasmPath: this.decoderPaths.wasm
5598
+ });
5599
+ this.packs.set(mount.alias, pack);
5600
+ })
5601
+ );
5602
+ console.log(
5603
+ `[StowKitSystem] All packs loaded in ${(performance.now() - packLoadStart).toFixed(0)}ms`
5604
+ );
5598
5605
  return prefabCollection;
5599
5606
  }
5600
5607
  /**
@@ -5615,7 +5622,7 @@ var StowKitSystem = class _StowKitSystem {
5615
5622
  console.log(`[StowKitSystem] Loading pack "${alias}" from ${path}`);
5616
5623
  const blob = await this.fetchBlob(path);
5617
5624
  const arrayBuffer = await blob.arrayBuffer();
5618
- const pack = await StowKitLoader.loadFromMemory(arrayBuffer, {
5625
+ const pack = await StowKitLoader2.loadFromMemory(arrayBuffer, {
5619
5626
  basisPath: this.decoderPaths.basis,
5620
5627
  dracoPath: this.decoderPaths.draco,
5621
5628
  wasmPath: this.decoderPaths.wasm
@@ -5648,6 +5655,52 @@ var StowKitSystem = class _StowKitSystem {
5648
5655
  }
5649
5656
  return prefab;
5650
5657
  }
5658
+ /**
5659
+ * Pre-decode meshes so they're ready before the loading screen hides.
5660
+ * Call this in onStart() after loadFromBuildJson() to avoid a visible pop-in.
5661
+ *
5662
+ * @param meshNames Array of mesh asset paths to pre-decode
5663
+ * @returns Map of mesh names to loaded groups (failed meshes are logged and skipped)
5664
+ */
5665
+ async preloadMeshes(meshNames) {
5666
+ const start = performance.now();
5667
+ const results = /* @__PURE__ */ new Map();
5668
+ await Promise.allSettled(
5669
+ meshNames.map(async (name) => {
5670
+ try {
5671
+ const mesh = await this.getMesh(name);
5672
+ results.set(name, mesh);
5673
+ } catch (e) {
5674
+ console.warn(`[StowKitSystem] Failed to preload mesh "${name}":`, e);
5675
+ }
5676
+ })
5677
+ );
5678
+ console.log(
5679
+ `[StowKitSystem] Preloaded ${results.size}/${meshNames.length} meshes in ${(performance.now() - start).toFixed(0)}ms`
5680
+ );
5681
+ return results;
5682
+ }
5683
+ /**
5684
+ * Pre-decode skinned meshes so they're ready before the loading screen hides.
5685
+ */
5686
+ async preloadSkinnedMeshes(meshNames, scale = 1) {
5687
+ const start = performance.now();
5688
+ const results = /* @__PURE__ */ new Map();
5689
+ await Promise.allSettled(
5690
+ meshNames.map(async (name) => {
5691
+ try {
5692
+ const mesh = await this.getSkinnedMesh(name, scale);
5693
+ results.set(name, mesh);
5694
+ } catch (e) {
5695
+ console.warn(`[StowKitSystem] Failed to preload skinned mesh "${name}":`, e);
5696
+ }
5697
+ })
5698
+ );
5699
+ console.log(
5700
+ `[StowKitSystem] Preloaded ${results.size}/${meshNames.length} skinned meshes in ${(performance.now() - start).toFixed(0)}ms`
5701
+ );
5702
+ return results;
5703
+ }
5651
5704
  // ============================================
5652
5705
  // Pack Access
5653
5706
  // ============================================
@@ -6167,4 +6220,4 @@ export {
6167
6220
  PrefabLoader,
6168
6221
  StowKitSystem
6169
6222
  };
6170
- //# sourceMappingURL=chunk-CIAGTANU.js.map
6223
+ //# sourceMappingURL=chunk-SCNHMGS3.js.map