API Reference

Class List

pc.callbacks

Namespace for callback definitions.

Summary

Type Defintions

AddParser

Callback used by pc.ModelHandler#addParser to decide on which parser to use.

AssetReady

Callback used by pc.Asset#ready and called when an asset is ready.

CalculateMatrix

Callback used by pc.CameraComponent#calculateTransform and pc.CameraComponent#calculateProjection.

CalculateSortDistance

Callback used by pc.Layer to calculate the "sort distance" for a pc.MeshInstance, which determines its place in the render order.

ConfigureApp

Callback used by pc.Application#configure when configuration file is loaded and parsed (or an error occurs).

CreateScreen

Callback used by pc.script.createLoadingScreen.

FilterAsset

Callback used by pc.AssetRegistry#filter to filter assets.

FindNode

Callback used by pc.GraphNode#find and pc.GraphNode#findOne to search through a graph node and all of its descendants.

ForEach

Callback used by pc.GraphNode#forEach to iterate through a graph node and all of its descendants.

HandleEvent

Callback used by pc.events functions.

HttpResponse

Callback used by pc.Http#get, pc.Http#post, pc.Http#put, pc.Http#del, and pc.Http#request.

LoadAsset

Callback used by pc.AssetRegistry#loadFromUrl and called when an asset is loaded (or an error occurs).

LoadHierarchy

Callback used by pc.SceneRegistry#loadSceneHierarchy.

LoadScene

Callback used by pc.SceneRegistry#loadScene.

LoadSettings

Callback used by pc.SceneRegistry#loadSceneSettings.

LockMouse

Callback used by pc.Mouse#enablePointerLock and pc.Application#disablePointerLock.

PreloadApp

Callback used by pc.Application#preload when all assets (marked as 'preload') are loaded.

ResourceHandler

Callback used by pc.ResourceHandler#load when a resource is loaded (or an error occurs).

ResourceLoader

Callback used by pc.ResourceLoader#load when a resource is loaded (or an error occurs).

UpdateShader

Callback used by pc.StandardMaterial#onUpdateShader.

VrCamera

Callback used by pc.CameraComponent#enterVr and pc.CameraComponent#exitVr.

VrDisplay

Callback used by pc.VrDisplay#requestPresent and pc.VrDisplay#exitPresent.

VrFrame

Callback used by pc.VrDisplay#requestAnimationFrame.

XrError

Callback used by pc.XrManager#endXr and pc.XrManager#startXr.

XrHitTestStart

Callback used by pc.XrHitTest#start and pc.XrHitTest#startForInputSource.

Details

Type Defintions

AddParser

Callback used by pc.ModelHandler#addParser to decide on which parser to use.

Parameters

urlstring

The resource url.

dataobject

The raw model data.

AssetReady

Callback used by pc.Asset#ready and called when an asset is ready.

Parameters

assetpc.Asset

The ready asset.

CalculateMatrix

Callback used by pc.CameraComponent#calculateTransform and pc.CameraComponent#calculateProjection.

Parameters

transformMatrixpc.Mat4

Output of the function.

viewnumber

Type of view. Can be pc.VIEW_CENTER, pc.VIEW_LEFT or pc.VIEW_RIGHT. Left and right are only used in stereo rendering.

CalculateSortDistance

Callback used by pc.Layer to calculate the "sort distance" for a pc.MeshInstance, which determines its place in the render order.

Parameters

meshInstancepc.MeshInstance

The mesh instance.

cameraPositionpc.Vec3

The position of the camera.

cameraForwardpc.Vec3

The forward vector of the camera.

ConfigureApp

Callback used by pc.Application#configure when configuration file is loaded and parsed (or an error occurs).

Parameters

errstring, null

The error message in the case where the loading or parsing fails.

CreateScreen

Callback used by pc.script.createLoadingScreen.

Parameters

apppc.Application

The application.

FilterAsset

Callback used by pc.AssetRegistry#filter to filter assets.

Parameters

assetpc.Asset

The current asset to filter.

FindNode

Callback used by pc.GraphNode#find and pc.GraphNode#findOne to search through a graph node and all of its descendants.

Parameters

nodepc.GraphNode

The current graph node.

ForEach

Callback used by pc.GraphNode#forEach to iterate through a graph node and all of its descendants.

Parameters

nodepc.GraphNode

The current graph node.

HandleEvent

Callback used by pc.events functions. Note the callback is limited to 8 arguments.

Parameters

arg1*

First argument that is passed from caller.

arg2*

Second argument that is passed from caller.

arg3*

Third argument that is passed from caller.

arg4*

Fourth argument that is passed from caller.

arg5*

Fifth argument that is passed from caller.

arg6*

Sixth argument that is passed from caller.

arg7*

Seventh argument that is passed from caller.

arg8*

Eighth argument that is passed from caller.

HttpResponse

Callback used by pc.Http#get, pc.Http#post, pc.Http#put, pc.Http#del, and pc.Http#request.

Parameters

errnumber, string, Error, null

The error code, message, or exception in the case where the request fails.

response*

The response data if no errors were encountered. (format depends on response type: text, Object, ArrayBuffer, XML).

LoadAsset

Callback used by pc.AssetRegistry#loadFromUrl and called when an asset is loaded (or an error occurs).

Parameters

errstring, null

The error message is null if no errors were encountered.

assetpc.Asset

The loaded asset if no errors were encountered.

LoadHierarchy

Callback used by pc.SceneRegistry#loadSceneHierarchy.

Parameters

errstring, null

The error message in the case where the loading or parsing fails.

entitypc.Entity

The loaded root entity if no errors were encountered.

LoadScene

Callback used by pc.SceneRegistry#loadScene.

Parameters

errstring, null

The error message in the case where the loading or parsing fails.

entitypc.Entity

The loaded root entity if no errors were encountered.

LoadSettings

Callback used by pc.SceneRegistry#loadSceneSettings.

Parameters

errstring, null

The error message in the case where the loading or parsing fails.

LockMouse

Callback used by pc.Mouse#enablePointerLock and pc.Application#disablePointerLock.

PreloadApp

Callback used by pc.Application#preload when all assets (marked as 'preload') are loaded.

ResourceHandler

Callback used by pc.ResourceHandler#load when a resource is loaded (or an error occurs).

Parameters

errstring, null

The error message in the case where the load fails.

response*

The raw data that has been successfully loaded.

ResourceLoader

Callback used by pc.ResourceLoader#load when a resource is loaded (or an error occurs).

Parameters

errstring, null

The error message in the case where the load fails.

resource*

The resource that has been successfully loaded.

UpdateShader

Callback used by pc.StandardMaterial#onUpdateShader.

Parameters

optionsobject

An object with shader generator settings (based on current material and scene properties), that you can change and then return. Properties of the object passed into this function are documented in pc.StandardMaterial#onUpdateShader.

VrCamera

Callback used by pc.CameraComponent#enterVr and pc.CameraComponent#exitVr.

Parameters

errstring, null

On success it is null on failure it is the error message.

VrDisplay

Callback used by pc.VrDisplay#requestPresent and pc.VrDisplay#exitPresent.

Parameters

errstring, null

The error message if presenting fails, or null if the call succeeds.

VrFrame

Callback used by pc.VrDisplay#requestAnimationFrame.

XrError

Callback used by pc.XrManager#endXr and pc.XrManager#startXr.

Parameters

errError, null

The Error object or null if operation was successfull.

XrHitTestStart

Callback used by pc.XrHitTest#start and pc.XrHitTest#startForInputSource.

Parameters

errError, null

The Error object if failed to create hit test source or null.

hitTestSourcepc.XrHitTestSource, null

object that provides access to hit results against real world geometry.