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.Application#loadSceneHierarchy. |
| LoadSettings | Callback used by pc.Application#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. |
Details
Type Defintions
AddParser
Callback used by pc.ModelHandler#addParser to decide on which parser to use.
Parameters
| url | string | The resource url. |
| data | object | The raw model data. |
AssetReady
Callback used by pc.Asset#ready and called when an asset is ready.
Parameters
| asset | pc.Asset | The ready asset. |
CalculateMatrix
Callback used by pc.CameraComponent#calculateTransform and pc.CameraComponent#calculateProjection.
Parameters
| transformMatrix | pc.Mat4 | Output of the function. |
| view | number | 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
| meshInstance | pc.MeshInstance | The mesh instance. |
| cameraPosition | pc.Vec3 | The position of the camera. |
| cameraForward | pc.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
| err | string, null | The error message in the case where the loading or parsing fails. |
CreateScreen
Callback used by pc.script.createLoadingScreen.
Parameters
| app | pc.Application | The application. |
FilterAsset
Callback used by pc.AssetRegistry#filter to filter assets.
Parameters
| asset | pc.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
| node | pc.GraphNode | The current graph node. |
ForEach
Callback used by pc.GraphNode#forEach to iterate through a graph node and all of its descendants.
Parameters
| node | pc.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
| err | number, 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
| err | string, null | The error message is null if no errors were encountered. |
| asset | pc.Asset | The loaded asset if no errors were encountered. |
LoadHierarchy
Callback used by pc.Application#loadSceneHierarchy.
Parameters
| err | string, null | The error message in the case where the loading or parsing fails. |
| entity | pc.Entity | The loaded root entity if no errors were encountered. |
LoadSettings
Callback used by pc.Application#loadSceneSettings.
Parameters
| err | string, 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
| err | string, 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
| err | string, 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
| options | object | 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
| err | string, 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
| err | string, null | The error message if presenting fails, or null if the call succeeds. |
VrFrame
Callback used by pc.VrDisplay#requestAnimationFrame.