scenelLoadedr.waiting.for.database.ts 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. //module BABYLON {
  2. // export interface IFileLoader {
  3. // extensions: string;
  4. // importMesh(meshesNames: any, scene: Scene, data: string, rootUrl: string, meshes: Mesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]): boolean;
  5. // load(scene: Scene, data: string, rootUrl: string): void;
  6. // }
  7. // export class SceneLoader {
  8. // private static _registeredPlugins = new Array<IFileLoader>();
  9. // // Methods
  10. // private static _GetPluginForFilename(sceneFilename: string): IFileLoader {
  11. // var dotPosition = sceneFilename.lastIndexOf(".");
  12. // var extension = sceneFilename.substring(dotPosition).toLowerCase();
  13. // for (var index = 0; index < this._registeredPlugins.length; index++) {
  14. // var plugin = this._registeredPlugins[index];
  15. // if (plugin.extensions.indexOf(extension) !== -1) {
  16. // return plugin;
  17. // }
  18. // }
  19. // throw new Error("No plugin found to load this file: " + sceneFilename);
  20. // }
  21. // // Public functions
  22. // public static RegisterPlugin(plugin: IFileLoader): void {
  23. // plugin.extensions = plugin.extensions.toLowerCase();
  24. // SceneLoader._registeredPlugins.push(plugin);
  25. // }
  26. // public static ImportMesh(meshesNames: any, rootUrl: string, sceneFilename: string, scene: Scene,
  27. // onsuccess: (meshes: Mesh[], particleSystems: ParticleSystem[], skeletons: Skeleton[]) => void, progressCallBack: () => void, onerror: (scene: Scene) => void): void {
  28. // // Checking if a manifest file has been set for this scene and if offline mode has been requested
  29. // var database = new BABYLON.Database(rootUrl + sceneFilename);
  30. // scene.database = database;
  31. // var plugin = SceneLoader._GetPluginForFilename(sceneFilename);
  32. // BABYLON.Tools.LoadFile(rootUrl + sceneFilename, data => {
  33. // var meshes = [];
  34. // var particleSystems = [];
  35. // var skeletons = [];
  36. // if (!plugin.importMesh(meshesNames, scene, data, rootUrl, meshes, particleSystems, skeletons)) {
  37. // if (onerror) {
  38. // onerror(scene);
  39. // }
  40. // return;
  41. // }
  42. // if (onsuccess) {
  43. // onsuccess(meshes, particleSystems, skeletons);
  44. // }
  45. // }, progressCallBack, database);
  46. // }
  47. // public static Load(rootUrl: string, sceneFilename: any, engine: Engine, onsuccess: (scene: Scene) => void, progressCallBack: () => void, onerror: (scene: Scene) => void): void {
  48. // var plugin = SceneLoader._GetPluginForFilename(sceneFilename.name || sceneFilename);
  49. // var database;
  50. // var loadSceneFromData = data => {
  51. // var scene = new BABYLON.Scene(engine);
  52. // scene.database = database;
  53. // if (!plugin.load(scene, data, rootUrl)) {
  54. // if (onerror) {
  55. // onerror(scene);
  56. // }
  57. // return;
  58. // }
  59. // if (onsuccess) {
  60. // onsuccess(scene);
  61. // }
  62. // }
  63. // if (rootUrl.indexOf("file:") === -1) {
  64. // // Checking if a manifest file has been set for this scene and if offline mode has been requested
  65. // database = new BABYLON.Database(rootUrl + sceneFilename);
  66. // BABYLON.Tools.LoadFile(rootUrl + sceneFilename, loadSceneFromData, progressCallBack, database);
  67. // } else { // Loading file from disk via input file or drag'n'drop
  68. // BABYLON.Tools.ReadFile(sceneFilename, loadSceneFromData, progressCallBack);
  69. // }
  70. // }
  71. // }
  72. //}