engineStore.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import { Nullable } from "../types";
  2. declare type Engine = import("./engine").Engine;
  3. declare type Scene = import("../scene").Scene;
  4. /**
  5. * The engine store class is responsible to hold all the instances of Engine and Scene created
  6. * during the life time of the application.
  7. */
  8. export class EngineStore {
  9. /** Gets the list of created engines */
  10. public static Instances = new Array<Engine>();
  11. /** @hidden */
  12. public static _LastCreatedScene: Nullable<Scene> = null;
  13. /**
  14. * Gets the latest created engine
  15. */
  16. public static get LastCreatedEngine(): Nullable<Engine> {
  17. if (this.Instances.length === 0) {
  18. return null;
  19. }
  20. return this.Instances[this.Instances.length - 1];
  21. }
  22. /**
  23. * Gets the latest created scene
  24. */
  25. public static get LastCreatedScene(): Nullable<Scene> {
  26. return this._LastCreatedScene;
  27. }
  28. /**
  29. * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded
  30. * @ignorenaming
  31. */
  32. public static UseFallbackTexture = true;
  33. /**
  34. * Texture content used if a texture cannot loaded
  35. * @ignorenaming
  36. */
  37. public static FallbackTexture = "";
  38. }