Interface ISceneLoaderPluginBase
extensions: string | ISceneLoaderPluginExtensions;
name: string;
canDirectLoad?(data: string): boolean;
directLoad?(scene: Scene, data: string): unknown;
loadFile?(
scene: Scene,
fileOrUrl: string | ArrayBufferView<ArrayBufferLike> | File,
rootUrl: string,
onSuccess: (data: unknown, responseURL?: string) => void,
onProgress?: (ev: ISceneLoaderProgressEvent) => void,
useArrayBuffer?: boolean,
onError?: (request?: WebRequest, exception?: LoadFileError) => void,
name?: string,
): Nullable<IFileRequest>;
rewriteRootURL?(rootUrl: string, responseURL?: string): string;
}
Hierarchy (View Summary)
- ISceneLoaderPluginMetadata
- ISceneLoaderPluginBase
Properties
Readonlyextensions
The file extensions supported by the plugin.
Readonlyname
The friendly name of the plugin.
Methods
Optionalcan Direct Load
-
The callback that returns true if the data can be directly loaded.
Parameters
- data: string
string containing the file data
Returns boolean
if the data can be loaded directly
- data: string
Optionaldirect Load
-
The callback that returns the data to pass to the plugin if the data can be directly loaded.
Parameters
- scene: Scene
scene loading this data
- data: string
string containing the data
Returns unknown
data to pass to the plugin
- scene: Scene
Optionalload File
-
loadFile?(
scene: Scene,
fileOrUrl: string | ArrayBufferView<ArrayBufferLike> | File,
rootUrl: string,
onSuccess: (data: unknown, responseURL?: string) => void,
onProgress?: (ev: ISceneLoaderProgressEvent) => void,
useArrayBuffer?: boolean,
onError?: (request?: WebRequest, exception?: LoadFileError) => void,
name?: string,
): Nullable<IFileRequest>The callback called when loading from a url.
Parameters
- scene: Scene
scene loading this url
- fileOrUrl: string | ArrayBufferView<ArrayBufferLike> | File
file or url to load
- rootUrl: string
root url to use to load assets
- onSuccess: (data: unknown, responseURL?: string) => void
callback called when the file successfully loads
OptionalonProgress: (ev: ISceneLoaderProgressEvent) => voidcallback called while file is loading (if the server supports this mode)
OptionaluseArrayBuffer: booleandefines a boolean indicating that date must be returned as ArrayBuffer
OptionalonError: (request?: WebRequest, exception?: LoadFileError) => voidcallback called when the file fails to load
Optionalname: stringdefines the name of the file when loading a binary file
Returns Nullable<IFileRequest>
a file request object
- scene: Scene
Optionalrewrite Root URL
-
The callback that allows custom handling of the root url based on the response url.
Parameters
- rootUrl: string
the original root url
OptionalresponseURL: stringthe response url if available
Returns string
the new root url
- rootUrl: string
Interface used to define the base of ISceneLoaderPlugin and ISceneLoaderPluginAsync