Protected_The running app instance.
Type of the resource the handler handles.
Gets the number of times to retry a failed request for the resource.
Sets the number of times to retry a failed request for the resource.
Gets a read-only copy of the registered parsers.
Registers a ResourceParser for this handler. Parsers are consulted newest-first: the most recently added parser whose ResourceParser#canParse returns true is selected. This lets a later registration override a built-in parser for the same format.
Register parsers before starting loads for this handler's type - selection runs for both the load and open phases, so changing the registry while loads are in flight can route them inconsistently. Note that handlers that implement their own loading without consulting registered parsers (for example cubemap or font) ignore registered parsers.
The parser to register. Must implement canParse(context).
Optionaldecider: anyRemoved. Previously a (url, data) => boolean selector; implement
canParse(context) on the parser instead. If passed, it is ignored and logs a warning.
Fetches a resource's raw data using this handler's retry settings, reusing pre-fetched
asset.file.contents when available. A convenience for a ResourceParser's load method,
so parsers don't reimplement the fetch boilerplate.
The resource URL, or a load/original structure.
The Http.ResponseType to fetch as (for example
Http.ResponseType.ARRAY_BUFFER for a binary format, or Http.ResponseType.TEXT).
Called with (err, data) when the fetch completes.
Optionalasset: AssetThe asset being loaded, used to reuse already-fetched contents.
Load a resource from a remote URL. When parsers are registered, the matching parser's load is
used; otherwise the base implementation does nothing (subclasses may override).
Either the URL of the resource to load or a structure containing the load URL (used for loading the resource) and the original URL (used for identifying the resource format; necessary when loading, for example, from a blob URL).
The callback used when the resource is loaded or an error occurs.
Optionalasset: AssetOptional asset that is passed by ResourceLoader.
The open function is passed the raw resource data. The handler can then process the data
into a format that can be used at runtime. When parsers are registered, the matching parser's
open is used (if it implements one); otherwise the base implementation simply returns the data.
The parsed resource data.
The patch function performs any operations on a resource that requires a dependency on its asset data or any other asset data. The base implementation does nothing.
The asset to patch.
The asset registry.
Removes a previously registered ResourceParser.
The parser to remove.
Loads files that contain multiple resources. For example glTF files can contain textures, models and animations.
For glTF files, the asset options object can be used to pass load time callbacks for handling the various resources at different stages of loading. The table below lists the resource types and the corresponding supported process functions.
Additional options that can be passed for glTF files: [options.morphPreserveData] - When true, the morph target keeps its data passed using the options, allowing the clone operation. [options.morphPreferHighPrecision] - When true, high precision storage for morph targets should be preferred. This is faster to create and allows higher precision, but takes more memory and might be slower to render. Defaults to false. [options.skipMeshes] - When true, the meshes and gaussian splats from the container are not created. This can be useful if you only need access to textures or animations and similar.
For example, to receive a texture preprocess callback: