API Reference

Class List

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

devicepc.GraphicsDevice

The graphics device that will be rendering.

defaultMaterialpc.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

parserobject

See JsonModelParser for example.

deciderpc.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

urlstring

The URL of the model data.

callbackpc.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.

open(url, data)

Process data in deserialized format into a pc.Model object.

Parameters

urlstring

The URL of the model data.

dataobject

The data from model file deserialized into a JavaScript Object.

Returns

pc.Model

The loaded model.