sebavan vor 5 Jahren
Ursprung
Commit
3f9a526f4e
2 geänderte Dateien mit 17 neuen und 1 gelöschten Zeilen
  1. 16 1
      src/Engines/thinEngine.ts
  2. 1 0
      src/Misc/fileTools.ts

+ 16 - 1
src/Engines/thinEngine.ts

@@ -4180,7 +4180,7 @@ export class ThinEngine {
     /** @hidden */
     /** @hidden */
     public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void,
     public _loadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (data: any) => void,
         offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest {
         offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: IWebRequest, exception?: any) => void): IFileRequest {
-        let request = FileTools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);
+        let request = ThinEngine._FileToolsLoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);
         this._activeRequests.push(request);
         this._activeRequests.push(request);
         request.onCompleteObservable.add((request) => {
         request.onCompleteObservable.add((request) => {
             this._activeRequests.splice(this._activeRequests.indexOf(request), 1);
             this._activeRequests.splice(this._activeRequests.indexOf(request), 1);
@@ -4189,6 +4189,21 @@ export class ThinEngine {
     }
     }
 
 
     /**
     /**
+     * Loads a file from a url
+     * @param url url to load
+     * @param onSuccess callback called when the file successfully loads
+     * @param onProgress callback called while file is loading (if the server supports this mode)
+     * @param offlineProvider defines the offline provider for caching
+     * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer
+     * @param onError callback called when the file fails to load
+     * @returns a file request object
+     * @hidden
+     */
+    public static _FileToolsLoadFile(url: string, onSuccess: (data: string | ArrayBuffer, responseURL?: string) => void, onProgress?: (ev: ProgressEvent) => void, offlineProvider?: IOfflineProvider, useArrayBuffer?: boolean, onError?: (request?: WebRequest, exception?: LoadFileError) => void): IFileRequest {
+        throw  _DevTools.WarnImport("FileTools");
+    }
+
+    /**
      * Reads pixels from the current frame buffer. Please note that this function can be slow
      * Reads pixels from the current frame buffer. Please note that this function can be slow
      * @param x defines the x coordinate of the rectangle where pixels must be read
      * @param x defines the x coordinate of the rectangle where pixels must be read
      * @param y defines the y coordinate of the rectangle where pixels must be read
      * @param y defines the y coordinate of the rectangle where pixels must be read

+ 1 - 0
src/Misc/fileTools.ts

@@ -473,4 +473,5 @@ export class FileTools {
 }
 }
 
 
 ThinEngine._FileToolsLoadImage = FileTools.LoadImage;
 ThinEngine._FileToolsLoadImage = FileTools.LoadImage;
+ThinEngine._FileToolsLoadFile = FileTools.LoadFile;
 ShaderProcessor._FileToolsLoadFile = FileTools.LoadFile;
 ShaderProcessor._FileToolsLoadFile = FileTools.LoadFile;