pc.ModelHandler
Resource handler used for loading pc.Model resources.
Summary
Methods
| addParser | Add a parser that converts raw data into a pc.Model Default parser is for JSON models. |
| load | Fetch model data from a remote url. |
| open | Process data in deserialized format into a pc. |
Details
Constructor
ModelHandler(device, defaultMaterial)
Parameters
| device | pc.GraphicsDevice | The graphics device that will be rendering. |
| defaultMaterial | pc.StandardMaterial | The shared default material that is used in any place that a material is not specified. |
Methods
addParser(parser, decider)
Add a parser that converts raw data into a pc.Model Default parser is for JSON models.
Parameters
| parser | object | See JsonModelParser for example. |
| decider | pc.callbacks.AddParser | 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 pc.Model. The first parser to return true is used. |
load(url, callback)
Fetch model data from a remote url.
Parameters
| url | string | The URL of the model data. |
| callback | pc.callbacks.ResourceHandler | Callback function called when the load completes. The callback is of the form fn(err, response), where err is a String error message in the case where the load fails, and response is the model data that has been successfully loaded. |