API Reference

Class List

ModelHandler

Resource handler used for loading Model resources.

Summary

Properties

handlerType

Type of the resource the handler handles.

Methods

addParser

Add a parser that converts raw data into a Model.

load

Load a resource from a remote URL.

open

Convert raw resource data into a resource instance.

Details

Properties

stringhandlerType

Type of the resource the handler handles.

Methods

addParser(parser, decider)

Add a parser that converts raw data into a Model. Default parser is for JSON models.

Parameters

parserobject

See JsonModelParser for example.

deciderAddParserCallback

Function that decides on which parser to use. Function should take (url, data) arguments and return true if this parser should be used to parse the data into a Model. The first parser to return true is used.

load(url, callback, [asset])

Load a resource from a remote URL. When loaded (or failed), use the callback to return an the raw resource data (or error).

Parameters

urlstring, object

Either the URL of the resource to load or a structure containing the load and original URL.

url.loadstring

The URL to be used for loading the resource.

url.originalstring

The original URL to be used for identifying the resource format. This is necessary when loading, for example from blob.

callbackResourceHandlerCallback

The callback used when the resource is loaded or an error occurs.

assetAsset

Optional asset that is passed by ResourceLoader.

open(url, data, [asset])

Convert raw resource data into a resource instance. E.g. Take 3D model format JSON and return a Model.

Parameters

urlstring

The URL of the resource to open.

data*

The raw resource data passed by callback from ResourceHandler#load.

assetAsset

Optional asset that is passed by ResourceLoader.

Returns

*

The parsed resource data.