Interface ISceneLoaderPluginAsync
extensions: string | ISceneLoaderPluginExtensions;
name: string;
canDirectLoad?(data: string): boolean;
directLoad?(scene: Scene, data: string): unknown;
importMeshAsync(
meshesNames: string | readonly string[] | null | undefined,
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<ISceneLoaderAsyncResult>;
loadAssetContainerAsync(
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<AssetContainer>;
loadAsync(
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<void>;
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)
- ISceneLoaderPluginBase
- ISceneLoaderPluginAsync
Index
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
import Mesh Async
-
importMeshAsync(
meshesNames: string | readonly string[] | null | undefined,
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<ISceneLoaderAsyncResult>Import meshes into a scene.
Parameters
- meshesNames: string | readonly string[] | null | undefined
An array of mesh names, a single mesh name, or empty string for all meshes that filter what meshes are imported
- scene: Scene
The scene to import into
- data: unknown
The data to import
- rootUrl: string
The root url for scene and resources
OptionalonProgress: (event: ISceneLoaderProgressEvent) => voidThe callback when the load progresses
OptionalfileName: stringDefines the name of the file to load
Returns Promise<ISceneLoaderAsyncResult>
The loaded objects (e.g. meshes, particle systems, skeletons, animation groups, etc.)
- meshesNames: string | readonly string[] | null | undefined
load Asset Container Async
-
loadAssetContainerAsync(
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<AssetContainer>Load into an asset container.
Parameters
- scene: Scene
The scene to load into
- data: unknown
The data to import
- rootUrl: string
The root url for scene and resources
OptionalonProgress: (event: ISceneLoaderProgressEvent) => voidThe callback when the load progresses
OptionalfileName: stringDefines the name of the file to load
Returns Promise<AssetContainer>
The loaded asset container
- scene: Scene
load Async
-
loadAsync(
scene: Scene,
data: unknown,
rootUrl: string,
onProgress?: (event: ISceneLoaderProgressEvent) => void,
fileName?: string,
): Promise<void>Load into a scene.
Parameters
- scene: Scene
The scene to load into
- data: unknown
The data to import
- rootUrl: string
The root url for scene and resources
OptionalonProgress: (event: ISceneLoaderProgressEvent) => voidThe callback when the load progresses
OptionalfileName: stringDefines the name of the file to load
Returns Promise<void>
Nothing
- 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 an async SceneLoader plugin