@skewedaspect/sage 0.11.0 → 0.13.0

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.
@@ -50,6 +50,11 @@ export declare abstract class Level<Registry extends NodeEntityRegistry = NodeEn
50
50
  * into a fresh one (design/simulation.md#saved-games).
51
51
  */
52
52
  $adoptSimulation(simulation: NodeSimulation<Registry>): void;
53
+ /**
54
+ * Builds an empty scene through the scene engine and makes it this level's scene at once
55
+ * (design/levels.md#the-base-class).
56
+ */
57
+ protected createScene(): Scene;
53
58
  /**
54
59
  * Builds this level's simulation for the scene it just created, named after the level, and keeps it. A
55
60
  * subclass calls this from `buildScene` before it spawns anything, since a NodeEntity constructs its node
@@ -3,6 +3,10 @@ import { EventBus } from '@skewedaspect/sage-core';
3
3
  import { SceneEngine } from "../engines/scene.js";
4
4
  import { Disposable } from "../interfaces/lifecycle.js";
5
5
  import { LoggingUtility } from "../utils/logger.js";
6
+ /** How `instantiate` copies a file's meshes (design/engine.md#the-asset-manager). */
7
+ export interface InstantiateOptions {
8
+ instances?: boolean;
9
+ }
6
10
  /**
7
11
  * Central asset cache with preloading, GLB fragment extraction, mesh instancing, and reference counting.
8
12
  *
@@ -79,9 +83,10 @@ export declare class AssetManager implements Disposable {
79
83
  clone(path: string, into: Scene): Mesh;
80
84
  /**
81
85
  * Copies a whole file into the scene it is handed: every mesh and node, with the file's skeletons and animation
82
- * groups. The meshes are cloned and share the container's materials. The copy is the caller's to dispose.
86
+ * groups. The meshes are cloned and share the container's materials, or, given `instances`, every mesh Babylon
87
+ * can instance is an instance of the container's. The copy is the caller's to dispose.
83
88
  */
84
- instantiate(path: string, scene: Scene): Promise<InstantiatedEntries>;
89
+ instantiate(path: string, scene: Scene, options?: InstantiateOptions): Promise<InstantiatedEntries>;
85
90
  /**
86
91
  * Preload a batch of asset paths, up to `MAX_CONCURRENT_LOADS` at a time, so a batch costs about as
87
92
  * long as its slowest asset rather than the sum of them all.
@@ -95,6 +95,11 @@ export declare class LevelManager<Registry extends NodeEntityRegistry = NodeEnti
95
95
  /** The level loaded under this name, or nothing when none is loaded under it. */
96
96
  getLevel(name: string): Level<Registry> | null;
97
97
  /** The configuration registered under this name, or nothing when none is. */
98
+ /**
99
+ * Unloads the level registered under the name if it is loaded, then forgets its configuration
100
+ * (design/levels.md#configurations-and-classes).
101
+ */
102
+ unregisterLevelConfig(name: string): Promise<void>;
98
103
  getLevelConfig(name: string): LevelConfig | null;
99
104
  /**
100
105
  * Loads the level a registered name points at, or the one a configuration carries, registering that
package/dist/sage.d.ts CHANGED
@@ -19,6 +19,7 @@ export declare function createGameEngine<Registry extends NodeEntityRegistry = N
19
19
  export * from "./interfaces/game.js";
20
20
  export * from "./interfaces/logger.js";
21
21
  export { AssetManager, AudioEngine, GameEngine, GameManager, LevelManager, SceneEngine };
22
+ export type { InstantiateOptions } from "./managers/asset.js";
22
23
  export type { DebugTools, Engines, GameHook, Managers, RebuildSimulationOptions, SimulationFactory, } from "./classes/gameEngine.js";
23
24
  export * from "./classes/level.js";
24
25
  export * from "./classes/gameLevel.js";