Hi, I tried https://sandbox.babylonjs.com/, and it is really nice. However I want to load some glb/gltf from from ajax or direct url.
And I find the following code which is handle load local files.
filesInput = new BABYLON.FilesInput(engine, null, sceneLoaded, null, null, null, startProcessingFiles, null, sceneError); filesInput.onProcessFileCallback = (function(file, name, extension) { if (filesInput._filesToLoad && filesInput._filesToLoad.length === 1 && extension) { if (extension.toLowerCase() === "dds" || extension.toLowerCase() === "env") { BABYLON.FilesInput.FilesToLoad[name] = file; skyboxPath = "file:" + file.correctName; return false; } } return true; }).bind(this); filesInput.monitorElementForDragNDrop(canvas); htmlInput.addEventListener('change', function(event) { // Handling data transfer via drag'n'drop if (event && event.dataTransfer && event.dataTransfer.files) { filesToLoad = event.dataTransfer.files; } // Handling files from input files if (event && event.target && event.target.files) { filesToLoad = event.target.files; } filesInput.loadFiles(event); }, false); }
How can I achieve this, I have searched the docs, but could not find some useful docs.