Users can also create custom loaders to load custom resources:
@resourceLoader(FBX, ["fbx"])
export class FBXLoader extends Loader<FBXResource> {
load(item: LoadItem, resourceManager: ResourceManager): AssetPromise<FBXResource> {
return new AssetPromise((resolve, reject)=> {
...
})
}
}
FBX
is the type enum, and ["fbx"]
is the suffix of the resource to be parsed.load
method will receive loadItem
and resourceManager
. loadItem
contains the basic information of the load, and resourceManager
can help load other referenced resources.resolve
the parsed resource result, for example, FBX returns a specific FBXResource
.reject
the error.