engineStore.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Observable } from "../Misc/observable.js";
  2. /**
  3. * The engine store class is responsible to hold all the instances of Engine and Scene created
  4. * during the life time of the application.
  5. */
  6. export class EngineStore {
  7. /**
  8. * Gets the latest created engine
  9. */
  10. static get LastCreatedEngine() {
  11. if (this.Instances.length === 0) {
  12. return null;
  13. }
  14. return this.Instances[this.Instances.length - 1];
  15. }
  16. /**
  17. * Gets the latest created scene
  18. */
  19. static get LastCreatedScene() {
  20. return this._LastCreatedScene;
  21. }
  22. }
  23. /** Gets the list of created engines */
  24. EngineStore.Instances = [];
  25. /**
  26. * Notifies when an engine was disposed.
  27. * Mainly used for static/cache cleanup
  28. */
  29. EngineStore.OnEnginesDisposedObservable = new Observable();
  30. /** @internal */
  31. EngineStore._LastCreatedScene = null;
  32. /**
  33. * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded
  34. * @ignorenaming
  35. */
  36. EngineStore.UseFallbackTexture = true;
  37. /**
  38. * Texture content used if a texture cannot loaded
  39. * @ignorenaming
  40. */
  41. EngineStore.FallbackTexture = "";
  42. //# sourceMappingURL=engineStore.js.map