legacy-glTF2.ts 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import * as Extensions from "../glTF/2.0/Extensions";
  2. import * as Interfaces from "../glTF/2.0/glTFLoaderInterfaces";
  3. import * as GLTF2 from "../glTF/2.0";
  4. /**
  5. * This is the entry point for the UMD module.
  6. * The entry point for a future ESM package should be index.ts
  7. */
  8. var globalObject = (typeof global !== 'undefined') ? global : ((typeof window !== 'undefined') ? window : undefined);
  9. if (typeof globalObject !== "undefined") {
  10. (<any>globalObject).BABYLON = (<any>globalObject).BABYLON || {};
  11. var BABYLON = (<any>globalObject).BABYLON;
  12. BABYLON.GLTF2 = BABYLON.GLTF2 || {};
  13. BABYLON.GLTF2.Loader = BABYLON.GLTF2.Loader || {};
  14. BABYLON.GLTF2.Loader.Extensions = BABYLON.GLTF2.Loader.Extensions || {};
  15. const keys = [];
  16. for (var key in Extensions) {
  17. BABYLON.GLTF2.Loader.Extensions[key] = (<any>Extensions)[key];
  18. keys.push(key);
  19. }
  20. for (var key in Interfaces) {
  21. BABYLON.GLTF2.Loader[key] = (<any>Interfaces)[key];
  22. keys.push(key);
  23. }
  24. for (var key in GLTF2) {
  25. // Prevent Reassignment.
  26. if (keys.indexOf(key) > -1) {
  27. continue;
  28. }
  29. BABYLON.GLTF2[key] = (<any>GLTF2)[key];
  30. }
  31. }
  32. export { GLTF2 };