Class: ModelHandler

pc.ModelHandler

Resource Handler for creating pc.Model resources

Constructor

new ModelHandler(device, defaultMaterial)

pc.ResourceHandler use to load 3D model resources
Parameters:
Name Type Description
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
Source:

Methods

addParser(parser, decider)

Add a parser that converts raw data into a pc.Model Default parser is for JSON models
Parameters:
Name Type Description
parser Object See JsonModelParser for example
decider function 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.
Source:

load(url, callback)

Fetch model data from a remote url
Parameters:
Name Type Description
url String The URL of the model data.
callback function 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 repsponse is the model data that has been successfully loaded.
Source:

open(url, data) → {pc.Model}

Process data in deserialized format into a pc.Model object.
Parameters:
Name Type Description
url String The URL of the model data.
data Object The data from model file deserialized into a JavaScript Object.
Source:
Returns:
The loaded model.
Type
pc.Model