Namespace: pc

pc

Root namespace for the PlayCanvas Engine
Source:

Classes

Animation
AnimationComponent
AnimationComponentSystem
Application
ApplicationStats
Asset
AssetListLoader
AssetRegistry
AudioListenerComponent
AudioListenerComponentSystem
AudioSourceComponent
AudioSourceComponentData
AudioSourceComponentSystem
BasicMaterial
Batch
BatchGroup
BatchManager
BoundingBox
BoundingSphere
Bundle
BundleHandler
BundleRegistry
ButtonComponent
ButtonComponentSystem
Camera
CameraComponent
CameraComponentData
CameraComponentSystem
CanvasFont
Channel
CollisionComponent
CollisionComponentSystem
Color
Component
ComponentData
ComponentSystem
ComponentSystemRegistry
ContactPoint
ContactResult
Controller
Curve
CurveSet
DepthMaterial
ElementComponent
ElementComponentSystem
ElementInput
ElementInputEvent
ElementMouseEvent
ElementTouchEvent
Entity
Font
ForwardRenderer
Frustum
GamePads
GraphicsDevice
GraphNode
Http
I18n
IndexBuffer
IndexedList
Keyboard
KeyboardEvent
Layer
LayerComposition
LayoutCalculator
LayoutChildComponent
LayoutGroupComponent
Light
LightComponent
LightComponentSystem
Lightmapper
Listener
Mat3
Mat4
Material
Mesh
MeshInstance
Model
ModelComponent
ModelComponentData
ModelComponentSystem
ModelHandler
Morph
MorphInstance
MorphTarget
Mouse
MouseEvent
Node
OrientedBox
ParticleSystemComponent
ParticleSystemComponentSystem
Picker
Plane
PostEffect
PostEffectPass
PostEffectQueue
Quat
Ray
RaycastResult
RenderTarget
ResourceLoader
RigidBodyComponent
RigidBodyComponentData
RigidBodyComponentSystem
Scene
SceneRegistry
SceneRegistryItem
ScreenComponent
ScreenComponentSystem
ScriptAttributes
ScriptComponent
ScriptComponentSystem
ScriptHandler
ScriptRegistry
ScrollViewComponent
ScrollViewComponentSystem
Shader
SingleContactResult
Skeleton
Skin
SkinInstance
SortedLoopArray
Sound
SoundComponent
SoundComponentData
SoundComponentSystem
SoundInstance
SoundInstance3d
SoundManager
SoundSlot
Sprite
SpriteAnimationClip
SpriteComponent
SpriteComponentSystem
StandardMaterial
StencilParameters
Tags
Texture
TextureAtlas
Timer
Touch
TouchDevice
TouchEvent
TransformFeedback
Trigger
URI
Vec2
Vec3
Vec4
VertexBuffer
VertexFormat
VertexIterator
VrDisplay
VrManager
ZoneComponent
ZoneComponentSystem

Namespaces

debug
events
guid
math
path
platform
script
string

Members

(static, readonly) ADDRESS_CLAMP_TO_EDGE :Number

Clamps texture coordinate to the range 0 to 1.
Type:
  • Number
Source:

(static, readonly) ADDRESS_MIRRORED_REPEAT :Number

Texture coordinate to be set to the fractional part if the integer part is even; if the integer part is odd, then the texture coordinate is set to 1 minus the fractional part.
Type:
  • Number
Source:

(static, readonly) ADDRESS_REPEAT :Number

Ignores the integer part of texture coordinates, using only the fractional part.
Type:
  • Number
Source:

(static) AssetReference

An object that manages the case where an object holds a reference to an asset and needs to be notified when changes occur in the asset. e.g. notifications include load, add and remove events.
Properties:
Name Type Description
id Number Get or set the asset id which this references. One of either id or url must be set to initialize an asset reference.
url String Get or set the asset url which this references. One of either id or url must be called to initialize an asset reference.
Source:
Example
var reference = new pc.AssetReference('textureAsset', this, this.app.assets, {
    load: this.onTextureAssetLoad,
    add: this.onTextureAssetAdd,
    remove: this.onTextureAssetRemove
}, this);
reference.id = this.textureAsset.id;

(static) BLEND_ADDITIVE

Add the color of the source fragment to the destination fragment and write the result to the frame buffer.
Source:

(static) BLEND_ADDITIVEALPHA

Same as pc.BLEND_ADDITIVE except the source RGB is multiplied by the source alpha.
Source:

(static) BLEND_MAX

Maximum color. Check app.graphicsDevice.extBlendMinmax for support.
Source:

(static) BLEND_MIN

Minimum color. Check app.graphicsDevice.extBlendMinmax for support.
Source:

(static) BLEND_MULTIPLICATIVE

Multiply the color of the source fragment by the color of the destination fragment and write the result to the frame buffer.
Source:

(static) BLEND_MULTIPLICATIVE2X

Multiplies colors and doubles the result
Source:

(static) BLEND_NONE

Disable blending.
Source:

(static) BLEND_NORMAL

Enable simple translucency for materials such as glass. This is equivalent to enabling a source blend mode of pc.BLENDMODE_SRC_ALPHA and a destination blend mode of pc.BLENDMODE_ONE_MINUS_SRC_ALPHA.
Source:

(static) BLEND_PREMULTIPLIED

Similar to pc.BLEND_NORMAL expect the source fragment is assumed to have already been multiplied by the source alpha value.
Source:

(static) BLEND_SCREEN

Softer version of additive
Source:

(static) BLEND_SUBTRACTIVE

Subtract the color of the source fragment from the destination fragment and write the result to the frame buffer.
Source:

(static) BLENDEQUATION_ADD

Add the results of the source and destination fragment multiplies.
Source:

(static) BLENDEQUATION_MAX

Use the largest value. Check app.graphicsDevice.extBlendMinmax for support.
Source:

(static) BLENDEQUATION_MIN

Use the smallest value. Check app.graphicsDevice.extBlendMinmax for support.
Source:

(static) BLENDEQUATION_REVERSE_SUBTRACT

Reverse and subtract the results of the source and destination fragment multiplies.
Source:

(static) BLENDEQUATION_SUBTRACT

Subtract the results of the source and destination fragment multiplies.
Source:

(static) BLENDMODE_DST_ALPHA

Multiply all fragment components by the alpha value of the destination fragment.
Source:

(static) BLENDMODE_DST_COLOR

Multiply all fragment components by the components of the destination fragment.
Source:

(static) BLENDMODE_ONE

Multiply all fragment components by one.
Source:

(static) BLENDMODE_ONE_MINUS_DST_ALPHA

Multiply all fragment components by one minus the alpha value of the destination fragment.
Source:

(static) BLENDMODE_ONE_MINUS_DST_COLOR

Multiply all fragment components by one minus the components of the destination fragment.
Source:

(static) BLENDMODE_ONE_MINUS_SRC_ALPHA

Multiply all fragment components by one minus the alpha value of the source fragment.
Source:

(static) BLENDMODE_ONE_MINUS_SRC_COLOR

Multiply all fragment components by one minus the components of the source fragment.
Source:

(static) BLENDMODE_SRC_ALPHA

Multiply all fragment components by the alpha value of the source fragment.
Source:

(static) BLENDMODE_SRC_ALPHA_SATURATE

Multiply all fragment components by the alpha value of the source fragment.
Source:

(static) BLENDMODE_SRC_COLOR

Multiply all fragment components by the components of the source fragment.
Source:

(static) BLENDMODE_ZERO

Multiply all fragment components by zero.
Source:

(static) BUFFER_DYNAMIC

The data store contents will be modified repeatedly and used many times.
Source:

(static) BUFFER_GPUDYNAMIC

The data store contents will be modified repeatedly on the GPU and used many times. Optimal for transform feedback usage (WebGL2 only).
Source:

(static) BUFFER_STATIC

The data store contents will be modified once and used many times.
Source:

(static) BUFFER_STREAM

The data store contents will be modified once and used at most a few times.
Source:

(static) BUTTON_TRANSITION_MODE_SPRITE_CHANGE

Specifies different sprites for the hover, pressed and inactive states.
Source:

(static) BUTTON_TRANSITION_MODE_TINT

Specifies different color tints for the hover, pressed and inactive states.
Source:

(static) CLEARFLAG_COLOR

Clear the color buffer.
Source:

(static) CLEARFLAG_DEPTH

Clear the depth buffer.
Source:

(static) CLEARFLAG_STENCIL

Clear the stencil buffer.
Source:

(static) CUBEFACE_NEGX

The negative X face of a cubemap.
Source:

(static) CUBEFACE_NEGY

The negative Y face of a cubemap.
Source:

(static) CUBEFACE_NEGZ

The negative Z face of a cubemap.
Source:

(static) CUBEFACE_POSX

The positive X face of a cubemap.
Source:

(static) CUBEFACE_POSY

The positive Y face of a cubemap.
Source:

(static) CUBEFACE_POSZ

The positive Z face of a cubemap.
Source:

(static) CULLFACE_BACK

Triangles facing away from the view direction are culled.
Source:

(static) CULLFACE_FRONT

Triangles facing the view direction are culled.
Source:

(static) CULLFACE_FRONTANDBACK

Triangles are culled regardless of their orientation with respect to the view direction. Note that point or line primitives are unaffected by this render state.
Source:

(static) CULLFACE_NONE

No triangles are culled.
Source:

(static) CURVE_CARDINAL

A cardinal spline interpolation scheme. This interpolation scheme is deprecated. Use CURVE_SPLINE instead.
Deprecated:
  • Yes
Source:

(static) CURVE_CATMULL

A Catmull-Rom spline interpolation scheme. This interpolation scheme is deprecated. Use CURVE_SPLINE instead.
Deprecated:
  • Yes
Source:

(static) CURVE_LINEAR

A linear interpolation scheme.
Source:

(static) CURVE_SMOOTHSTEP

A smooth step interpolation scheme.
Source:

(static) CURVE_SPLINE

Cardinal spline interpolation scheme. For Catmull-Rom, specify curve tension 0.5.
Source:

(static) CURVE_STEP

A stepped interpolater, free from the shackles of blending.
Source:

(static, readonly) DISTANCE_EXPONENTIAL :String

Exponential distance model
Type:
  • String
Source:

(static, readonly) DISTANCE_INVERSE :String

Inverse distance model
Type:
  • String
Source:

(static, readonly) DISTANCE_LINEAR :String

Linear distance model
Type:
  • String
Source:

(static) ElementDragHelper

Create a new ElementDragHelper
Source:

(static) ELEMENTTYPE_GROUP

A pc.ElementComponent that contains child pc.ElementComponents.
Source:

(static) ELEMENTTYPE_IMAGE

A pc.ElementComponent that displays an image.
Source:

(static) ELEMENTTYPE_TEXT

A pc.ElementComponent that displays text.
Source:

(private, static) EntityReference

Helper class used for managing component properties that represent entity references.
Properties:
Name Type Description
entity Entity A reference to the entity, if present.
Source:

(static) EVENT_KEYDOWN

Name of event fired when a key is pressed
Source:

(static) EVENT_KEYUP

Name of event fired when a key is released
Source:

(static) EVENT_MOUSEDOWN

Name of event fired when a mouse button is pressed
Source:

(static) EVENT_MOUSEMOVE

Name of event fired when the mouse is moved
Source:

(static) EVENT_MOUSEUP

Name of event fired when a mouse button is released
Source:

(static) EVENT_MOUSEWHEEL

Name of event fired when the mouse wheel is rotated
Source:

(static) EVENT_TOUCHCANCEL

Name of event fired when a touch point is interrupted in some way. The exact reasons for cancelling a touch can vary from device to device. For example, a modal alert pops up during the interaction; the touch point leaves the document area; or there are more touch points than the device supports, in which case the earliest touch point is canceled.
Source:

(static) EVENT_TOUCHEND

Name of event fired when touch ends. For example, a finger is lifted off the device.
Source:

(static) EVENT_TOUCHMOVE

Name of event fired when a touch moves.
Source:

(static) EVENT_TOUCHSTART

Name of event fired when a new touch occurs. For example, a finger is placed on the device.
Source:

(static) FILLMODE_FILL_WINDOW

When resizing the window the size of the canvas will change to fill the window exactly.
Source:

(static) FILLMODE_KEEP_ASPECT

When resizing the window the size of the canvas will change to fill the window as best it can, while maintaining the same aspect ratio.
Source:

(static) FILLMODE_NONE

When resizing the window the size of the canvas will not change.
Source:

(static) FILTER_LINEAR

Bilinear filtering.
Source:

(static) FILTER_LINEAR_MIPMAP_LINEAR

Linearly interpolate both the mipmap levels and between texels.
Source:

(static) FILTER_LINEAR_MIPMAP_NEAREST

Use the nearest neighbor after linearly interpolating between mipmap levels.
Source:

(static) FILTER_NEAREST

Point sample filtering.
Source:

(static) FILTER_NEAREST_MIPMAP_LINEAR

Linearly interpolate in the nearest mipmap level.
Source:

(static) FILTER_NEAREST_MIPMAP_NEAREST

Use the nearest neighbor in the nearest mipmap level.
Source:

(static) FITTING_BOTH

Apply both STRETCH and SHRINK fitting logic where applicable.
Source:

(static) FITTING_NONE

Disable all fitting logic.
Source:

(static) FITTING_SHRINK

Shrink child elements to fit the parent container
Source:

(static) FITTING_STRETCH

Stretch child elements to fit the parent container
Source:

(static) FOG_EXP

Fog rises according to an exponential curve controlled by a density value.
Source:

(static) FOG_EXP2

Fog rises according to an exponential curve controlled by a density value.
Source:

(static) FOG_LINEAR

Fog rises linearly from zero to 1 between a start and end depth.
Source:

(static) FOG_NONE

No fog is applied to the scene.
Source:

(static) INDEXFORMAT_UINT8

8-bit unsigned vertex indices.
Source:

(static) INDEXFORMAT_UINT16

16-bit unsigned vertex indices.
Source:

(static) INDEXFORMAT_UINT32

32-bit unsigned vertex indices.
Source:

(private, static) JsonStandardMaterialParser

Convert incoming JSON data into a pc.StandardMaterial
Source:

(static) KEY_0

Source:

(static) KEY_1

Source:

(static) KEY_2

Source:

(static) KEY_3

Source:

(static) KEY_4

Source:

(static) KEY_5

Source:

(static) KEY_6

Source:

(static) KEY_7

Source:

(static) KEY_8

Source:

(static) KEY_9

Source:

(static) KEY_A

Source:

(static) KEY_ADD

Source:

(static) KEY_ALT

Source:

(static) KEY_B

Source:

(static) KEY_BACK_SLASH

Source:

(static) KEY_BACKSPACE

Source:

(static) KEY_C

Source:

(static) KEY_CAPS_LOCK

Source:

(static) KEY_CLOSE_BRACKET

Source:

(static) KEY_COMMA

Source:

(static) KEY_CONTEXT_MENU

Source:

(static) KEY_CONTROL

Source:

(static) KEY_D

Source:

(static) KEY_DECIMAL

Source:

(static) KEY_DELETE

Source:

(static) KEY_DIVIDE

Source:

(static) KEY_DOWN

Source:

(static) KEY_E

Source:

(static) KEY_END

Source:

(static) KEY_ENTER

Source:

(static) KEY_EQUAL

Source:

(static) KEY_ESCAPE

Source:

(static) KEY_F

Source:

(static) KEY_F1

Source:

(static) KEY_F2

Source:

(static) KEY_F3

Source:

(static) KEY_F4

Source:

(static) KEY_F5

Source:

(static) KEY_F6

Source:

(static) KEY_F7

Source:

(static) KEY_F8

Source:

(static) KEY_F9

Source:

(static) KEY_F10

Source:

(static) KEY_F11

Source:

(static) KEY_F12

Source:

(static) KEY_G

Source:

(static) KEY_H

Source:

(static) KEY_HOME

Source:

(static) KEY_I

Source:

(static) KEY_INSERT

Source:

(static) KEY_J

Source:

(static) KEY_K

Source:

(static) KEY_L

Source:

(static) KEY_LEFT

Source:

(static) KEY_M

Source:

(static) KEY_META

Source:

(static) KEY_MULTIPLY

Source:

(static) KEY_N

Source:

(static) KEY_NUMPAD_0

Source:

(static) KEY_NUMPAD_1

Source:

(static) KEY_NUMPAD_2

Source:

(static) KEY_NUMPAD_3

Source:

(static) KEY_NUMPAD_4

Source:

(static) KEY_NUMPAD_5

Source:

(static) KEY_NUMPAD_6

Source:

(static) KEY_NUMPAD_7

Source:

(static) KEY_NUMPAD_8

Source:

(static) KEY_NUMPAD_9

Source:

(static) KEY_O

Source:

(static) KEY_OPEN_BRACKET

Source:

(static) KEY_P

Source:

(static) KEY_PAGE_DOWN

Source:

(static) KEY_PAGE_UP

Source:

(static) KEY_PAUSE

Source:

(static) KEY_PERIOD

Source:

(static) KEY_PRINT_SCREEN

Source:

(static) KEY_Q

Source:

(static) KEY_R

Source:

(static) KEY_RETURN

Source:

(static) KEY_RIGHT

Source:

(static) KEY_S

Source:

(static) KEY_SEMICOLON

Source:

(static) KEY_SEPARATOR

Source:

(static) KEY_SHIFT

Source:

(static) KEY_SLASH

Source:

(static) KEY_SPACE

Source:

(static) KEY_SUBTRACT

Source:

(static) KEY_T

Source:

(static) KEY_TAB

Source:

(static) KEY_U

Source:

(static) KEY_UP

Source:

(static) KEY_V

Source:

(static) KEY_W

Source:

(static) KEY_WINDOWS

Source:

(static) KEY_X

Source:

(static) KEY_Y

Source:

(static) KEY_Z

Source:

(static) LAYERID_DEPTH

The depth layer.
Source:

(static) LAYERID_IMMEDIATE

The immediate layer.
Source:

(static) LAYERID_SKYBOX

The skybox layer.
Source:

(static) LAYERID_UI

The UI layer.
Source:

(static) LAYERID_WORLD

The world layer.
Source:

(private, static) LayoutChildComponentSystem

Create a new LayoutChildComponentSystem
Source:

(private, static) LayoutGroupComponentSystem

Create a new LayoutGroupComponentSystem
Source:

(static) LIGHTTYPE_DIRECTIONAL

Directional (global) light source.
Source:

(static) LIGHTTYPE_POINT

Point (local) light source.
Source:

(static) LIGHTTYPE_SPOT

Spot (local) light source.
Source:

(static) MOUSEBUTTON_LEFT

The left mouse button
Source:

(static) MOUSEBUTTON_MIDDLE

The middle mouse button
Source:

(static) MOUSEBUTTON_NONE

No mouse buttons pressed
Source:

(static) MOUSEBUTTON_RIGHT

The right mouse button
Source:

(static) ORIENTATION_HORIZONTAL

Horizontal orientation.
Source:

(static) ORIENTATION_VERTICAL

Vertical orientation.
Source:

(static) PIXELFORMAT_111110F

A floating-point color-only format with 11 bits for red and green channels, and 10 bits for the blue channel (WebGL2 only).
Source:

(static) PIXELFORMAT_A8

8-bit alpha.
Source:

(static) PIXELFORMAT_DEPTH

A readable depth buffer format
Source:

(static) PIXELFORMAT_DEPTHSTENCIL

A readable depth/stencil buffer format (WebGL2 only).
Source:

(static) PIXELFORMAT_DXT1

Block compressed format, storing 16 input pixels in 64 bits of output, consisting of two 16-bit RGB 5:6:5 color values and a 4x4 two bit lookup table.
Source:

(static) PIXELFORMAT_DXT3

Block compressed format, storing 16 input pixels (corresponding to a 4x4 pixel block) into 128 bits of output, consisting of 64 bits of alpha channel data (4 bits for each pixel) followed by 64 bits of color data, encoded the same way as DXT1.
Source:

(static) PIXELFORMAT_DXT5

Block compressed format, storing 16 input pixels into 128 bits of output, consisting of 64 bits of alpha channel data (two 8 bit alpha values and a 4x4 3 bit lookup table) followed by 64 bits of color data (encoded the same way as DXT1).
Source:

(static) PIXELFORMAT_L8

8-bit luminance.
Source:

(static) PIXELFORMAT_L8_A8

8-bit luminance with 8-bit alpha.
Source:

(static) PIXELFORMAT_R4_G4_B4_A4

16-bit RGBA (4-bits for red channel, 4 for green, 4 for blue with 4-bit alpha).
Source:

(static) PIXELFORMAT_R5_G5_B5_A1

16-bit RGBA (5-bits for red channel, 5 for green, 5 for blue with 1-bit alpha).
Source:

(static) PIXELFORMAT_R5_G6_B5

16-bit RGB (5-bits for red channel, 6 for green and 5 for blue).
Source:

(static) PIXELFORMAT_R8_G8_B8

24-bit RGB (8-bits for red channel, 8 for green and 8 for blue).
Source:

(static) PIXELFORMAT_R8_G8_B8_A8

32-bit RGBA (8-bits for red channel, 8 for green, 8 for blue with 8-bit alpha).
Source:

(static) PIXELFORMAT_R32F

32-bit floating point single channel format (WebGL2 only).
Source:

(static) PIXELFORMAT_RGB16F

16-bit floating point RGB (16-bit float for each red, green and blue channels).
Source:

(static) PIXELFORMAT_RGB32F

32-bit floating point RGB (32-bit float for each red, green and blue channels).
Source:

(static) PIXELFORMAT_RGBA16F

16-bit floating point RGBA (16-bit float for each red, green, blue and alpha channels).
Source:

(static) PIXELFORMAT_RGBA32F

32-bit floating point RGBA (32-bit float for each red, green, blue and alpha channels).
Source:

(static) PIXELFORMAT_SRGB

Color-only sRGB format (WebGL2 only).
Source:

(static) PIXELFORMAT_SRGBA

Color sRGB format with additional alpha channel (WebGL2 only).
Source:

(static) PRIMITIVE_LINELOOP

List of points that are linked sequentially by line segments, with a closing line segment between the last and first points.
Source:

(static) PRIMITIVE_LINES

Discrete list of line segments.
Source:

(static) PRIMITIVE_LINESTRIP

List of points that are linked sequentially by line segments.
Source:

(static) PRIMITIVE_POINTS

List of distinct points.
Source:

(static) PRIMITIVE_TRIANGLES

Discrete list of triangles.
Source:

(static) PRIMITIVE_TRIFAN

Connected fan of triangles where the first vertex forms triangles with the following pairs of vertices.
Source:

(static) PRIMITIVE_TRISTRIP

Connected strip of triangles where a specified vertex forms a triangle using the previous two.
Source:

(static) PROJECTION_ORTHOGRAPHIC

An orthographic camera projection where the frustum shape is essentially a cuboid.
Source:

(static) PROJECTION_PERSPECTIVE

A perspective camera projection where the frustum shape is essentially pyramidal.
Source:

(static) RESOLUTION_AUTO

When the canvas is resized the resolution of the canvas will change to match the size of the canvas.
Source:

(static) RESOLUTION_FIXED

When the canvas is resized the resolution of the canvas will remain at the same value and the output will just be scaled to fit the canvas.
Source:

(static) SCALEMODE_BLEND

Scale the pc.ScreenComponent when the application's resolution is different than the ScreenComponent's referenceResolution.
Source:

(static) SCALEMODE_NONE

Always use the application's resolution as the resolution for the pc.ScreenComponent.
Source:

(static) SCROLL_MODE_BOUNCE

Content scrolls past its bounds and then gently bounces back.
Source:

(static) SCROLL_MODE_CLAMP

Content does not scroll any further than its bounds.
Source:

(static) SCROLL_MODE_INFINITE

Content can scroll forever.
Source:

(static) SCROLLBAR_VISIBILITY_SHOW_ALWAYS

The scrollbar will be visible all the time.
Source:

(static) SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED

The scrollbar will be visible only when content exceeds the size of the viewport.
Source:

(private, static) ScrollbarComponent

Create a new ScrollbarComponent
Properties:
Name Type Description
orientation pc.ORIENTATION Whether the scrollbar moves horizontally or vertically.
value Number The current position value of the scrollbar, in the range 0...1.
handleSize Number The size of the handle relative to the size of the track, in the range 0...1. For a vertical scrollbar, a value of 1 means that the handle will take up the full height of the track.
handleEntity pc.Entity The entity to be used as the scrollbar handle. This entity must have a Scrollbar component.
Source:

(private, static) ScrollbarComponentSystem

Create a new ScrollbarComponentSystem
Source:

(static) SEMANTIC_ATTR0

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR1

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR2

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR3

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR4

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR5

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR6

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR7

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR8

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR9

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR10

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR11

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR12

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR13

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR14

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_ATTR15

Vertex attribute with a user defined semantic.
Source:

(static) SEMANTIC_BLENDINDICES

Vertex attribute to be treated as skin blend indices.
Source:

(static) SEMANTIC_BLENDWEIGHT

Vertex attribute to be treated as skin blend weights.
Source:

(static) SEMANTIC_COLOR

Vertex attribute to be treated as a color.
Source:

(static) SEMANTIC_NORMAL

Vertex attribute to be treated as a normal.
Source:

(static) SEMANTIC_POSITION

Vertex attribute to be treated as a position.
Source:

(static) SEMANTIC_TANGENT

Vertex attribute to be treated as a tangent.
Source:

(static) SEMANTIC_TEXCOORD0

Vertex attribute to be treated as a texture coordinate (set 0).
Source:

(static) SEMANTIC_TEXCOORD1

Vertex attribute to be treated as a texture coordinate (set 1).
Source:

(static) SEMANTIC_TEXCOORD2

Vertex attribute to be treated as a texture coordinate (set 2).
Source:

(static) SEMANTIC_TEXCOORD3

Vertex attribute to be treated as a texture coordinate (set 3).
Source:

(static) SEMANTIC_TEXCOORD4

Vertex attribute to be treated as a texture coordinate (set 4).
Source:

(static) SEMANTIC_TEXCOORD5

Vertex attribute to be treated as a texture coordinate (set 5).
Source:

(static) SEMANTIC_TEXCOORD6

Vertex attribute to be treated as a texture coordinate (set 6).
Source:

(static) SEMANTIC_TEXCOORD7

Vertex attribute to be treated as a texture coordinate (set 7).
Source:

(static) SHADER_FORWARD

Render RGBA-encoded depth value.
Source:

(static) SHADER_FORWARD

Render shaded materials without gamma correction and tonemapping.
Source:

(static) SHADER_FORWARD

Render shaded materials with gamma correction and tonemapping.
Source:

(static) SORTMODE_BACK2FRONT

Mesh instances are sorted back to front. This is the way to properly render many semi-transparent objects on different depth, one is blended on top of another.
Source:

(private, static) SORTMODE_CUSTOM

Provide custom functions for sorting drawcalls and calculating distance
Source:

(static) SORTMODE_FRONT2BACK

Mesh instances are sorted front to back. Depending on GPU and the scene, this option may give better performance than pc.SORTMODE_MATERIALMESH due to reduced overdraw.
Source:

(static) SORTMODE_MANUAL

Mesh instances are sorted based on pc.MeshInstance#drawOrder.
Source:

(static) SORTMODE_MATERIALMESH

Mesh instances are sorted to minimize switching between materials and meshes to improve rendering performance.
Source:

(static) SORTMODE_NONE

No sorting is applied. Mesh instances are rendered in the same order they were added to a layer.
Source:

(static) SPRITE_RENDERMODE_SIMPLE

This mode renders a sprite as a simple quad.
Source:

(static) SPRITE_RENDERMODE_SLICED

This mode renders a sprite using 9-slicing in 'sliced' mode. Sliced mode stretches the top and bottom regions of the sprite horizontally, the left and right regions vertically and the middle region both horizontally and vertically.
Source:

(static) SPRITE_RENDERMODE_TILED

This mode renders a sprite using 9-slicing in 'tiled' mode. Tiled mode tiles the top and bottom regions of the sprite horizontally, the left and right regions vertically and the middle region both horizontally and vertically.
Source:

(static) SPRITETYPE_ANIMATED

A pc.SpriteComponent that renders sprite animations.
Source:

(static) SPRITETYPE_SIMPLE

A pc.SpriteComponent that displays a single frame from a sprite asset.
Source:

(static) TEXTURELOCK_READ

Read only. Any changes to the locked mip level's pixels will not update the texture.
Source:

(static) TEXTURELOCK_WRITE

Write only. The contents of the specified mip level will be entirely replaced.
Source:

(static) TYPE_FLOAT32

Floating point vertex element type.
Source:

(static) TYPE_INT8

Signed byte vertex element type.
Source:

(static) TYPE_INT16

Signed short vertex element type.
Source:

(static) TYPE_INT32

Signed integer vertex element type.
Source:

(static) TYPE_UINT8

Unsigned byte vertex element type.
Source:

(static) TYPE_UINT16

Unsigned short vertex element type.
Source:

(static) TYPE_UINT32

Unsigned integer vertex element type.
Source:

(private, static) Untar

Creates a new instance of pc.Untar
Source:

(private, static) UntarWorker

Creates new instance of a pc.UntarWorker.
Source:

Methods

(static) calculateNormals(positions, indices) → {Array.<Number>}

Generates normal information from the specified positions and triangle indices. See pc.createMesh.
Parameters:
Name Type Description
positions Array.<Number> An array of 3-dimensional vertex positions.
indices Array.<Number> An array of triangle indices.
Source:
Returns:
An array of 3-dimensional vertex normals.
Type
Array.<Number>
Example
var normals = pc.calculateNormals(positions, indices);
var tangents = pc.calculateTangents(positions, normals, uvs, indices);
var mesh = pc.createMesh(positions, normals, tangents, uvs, indices);

(static) calculateTangents(positions, normals, uvs, indices) → {Array.<Number>}

Generates tangent information from the specified positions, normals, texture coordinates and triangle indices. See pc.createMesh.
Parameters:
Name Type Description
positions Array.<Number> An array of 3-dimensional vertex positions.
normals Array.<Number> An array of 3-dimensional vertex normals.
uvs Array.<Number> An array of 2-dimensional vertex texture coordinates.
indices Array.<Number> An array of triangle indices.
Source:
Returns:
An array of 3-dimensional vertex tangents.
Type
Array.<Number>
Example
var tangents = pc.calculateTangents(positions, normals, uvs, indices);
var mesh = pc.createMesh(positions, normals, tangents, uvs, indices);

(static) createBox(device, opts) → {pc.Mesh}

Creates a procedural box-shaped mesh. The size, shape and tesselation properties of the box can be controlled via function parameters. By default, the function will create a box centred on the object space origin with a width, length and height of 1.0 unit and 10 segments in either axis (50 triangles per face).
Note that the box is created with UVs in the range of 0 to 1 on each face. Additionally, tangent information is generated into the vertex buffer of the box's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
halfExtents pc.Vec3 The half dimensions of the box in each axis (defaults to [0.5, 0.5, 0.5]).
widthSegments Number The number of divisions along the X axis of the box (defaults to 1).
lengthSegments Number The number of divisions along the Z axis of the box (defaults to 1).
heightSegments Number The number of divisions along the Y axis of the box (defaults to 1).
Source:
Returns:
A new box-shaped mesh.
Type
pc.Mesh

(static) createCapsule(device, opts) → {pc.Mesh}

Creates a procedural capsule-shaped mesh. The size, shape and tesselation properties of the capsule can be controlled via function parameters. By default, the function will create a capsule standing vertically centred on the XZ-plane with a radius of 0.25, a height of 1.0, 1 height segment and 10 cap segments.
Note that the capsule is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the capsule's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
radius Number The radius of the tube forming the body of the capsule (defaults to 0.3).
height Number The length of the body of the capsule from tip to tip (defaults to 1.0).
heightSegments Number The number of divisions along the tubular length of the capsule (defaults to 1).
sides Number The number of divisions around the tubular body of the capsule (defaults to 20).
Source:
Returns:
A new cylinder-shaped mesh.
Type
pc.Mesh

(static) createCone(device, opts) → {pc.Mesh}

Creates a procedural cone-shaped mesh.

The size, shape and tesselation properties of the cone can be controlled via function parameters. By default, the function will create a cone standing vertically centred on the XZ-plane with a base radius of 0.5, a height of 1.0, 5 height segments and 20 cap segments.
Note that the cone is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the cone's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
baseRadius Number The base radius of the cone (defaults to 0.5).
peakRadius Number The peak radius of the cone (defaults to 0.0).
height Number The length of the body of the cone (defaults to 1.0).
heightSegments Number The number of divisions along the length of the cone (defaults to 5).
capSegments Number The number of divisions around the tubular body of the cone (defaults to 18).
Source:
Returns:
A new cone-shaped mesh.
Type
pc.Mesh

(static) createCylinder(device, opts) → {pc.Mesh}

Creates a procedural cylinder-shaped mesh. The size, shape and tesselation properties of the cylinder can be controlled via function parameters. By default, the function will create a cylinder standing vertically centred on the XZ-plane with a radius of 0.5, a height of 1.0, 1 height segment and 20 cap segments.
Note that the cylinder is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the cylinder's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
radius Number The radius of the tube forming the body of the cylinder (defaults to 0.5).
height Number The length of the body of the cylinder (defaults to 1.0).
heightSegments Number The number of divisions along the length of the cylinder (defaults to 5).
capSegments Number The number of divisions around the tubular body of the cylinder (defaults to 20).
Source:
Returns:
A new cylinder-shaped mesh.
Type
pc.Mesh

(static) createMesh(device, positions, opts) → {pc.Mesh}

Creates a new mesh object from the supplied vertex information and topology.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
positions Array.<Number> An array of 3-dimensional vertex positions.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
normals Array.<Number> An array of 3-dimensional vertex normals.
tangents Array.<Number> An array of 3-dimensional vertex tangents.
colors Array.<Number> An array of 4-dimensional vertex colors.
uvs Array.<Number> An array of 2-dimensional vertex texture coordinates.
uvs1 Array.<Number> Same as opts.uvs, but for additional UV set
indices Array.<Number> An array of triangle indices.
Source:
Returns:
A new Geometry constructed from the supplied vertex and triangle data.
Type
pc.Mesh
Example
// Create a new mesh supplying optional parameters using object literal notation
var mesh = pc.createMesh(
    graphicsDevice,
    positions,
    {
        normals: treeNormals,
        uvs: treeUvs,
        indices: treeIndices
    });

(static) createPlane(device, opts) → {pc.Mesh}

Creates a procedural plane-shaped mesh. The size and tesselation properties of the plane can be controlled via function parameters. By default, the function will create a plane centred on the object space origin with a width and length of 1.0 and 5 segments in either axis (50 triangles). The normal vector of the plane is aligned along the positive Y axis.
Note that the plane is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the plane's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
halfExtents pc.Vec2 The half dimensions of the plane in the X and Z axes (defaults to [0.5, 0.5]).
widthSegments Number The number of divisions along the X axis of the plane (defaults to 5).
lengthSegments Number The number of divisions along the Z axis of the plane (defaults to 5).
Source:
Returns:
A new plane-shaped mesh.
Type
pc.Mesh

(static) createScript(name, appopt) → {function}

Method to create named ScriptType. It returns new function (class) "Script Type", which is auto-registered to pc.ScriptRegistry using it's name. This is the main interface to create Script Types, to define custom logic using JavaScript, that is used to create interaction for entities.
Parameters:
Name Type Attributes Description
name String unique Name of a Script Type. If a Script Type with the same name has already been registered and the new one has a `swap` method defined in its prototype, then it will perform hot swapping of existing Script Instances on entities using this new Script Type. Note: There is a reserved list of names that cannot be used, such as list below as well as some starting from `_` (underscore): system, entity, create, destroy, swap, move, scripts, onEnable, onDisable, onPostStateChange, has, on, off, fire, once, hasEvent
app pc.Application <optional>
Optional application handler, to choose which pc.ScriptRegistry to add a script to. By default it will use `pc.Application.getApplication()` to get current pc.Application.
Source:
Returns:
The constructor of a ScriptType, which the developer is meant to extend by adding attributes and prototype methods.
Type
function
Example
var Turning = pc.createScript('turn');

// define `speed` attribute that is available in Editor UI
Turning.attributes.add('speed', {
    type: 'number',
    default: 180,
    placeholder: 'deg/s'
});

// runs every tick
Turning.prototype.update = function(dt) {
    this.entity.rotate(0, this.speed * dt, 0);
};

(static) createSphere(device, opts) → {pc.Mesh}

Creates a procedural sphere-shaped mesh. The size and tesselation properties of the sphere can be controlled via function parameters. By default, the function will create a sphere centred on the object space origin with a radius of 0.5 and 16 segments in both longitude and latitude.
Note that the sphere is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the sphere's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
radius Number The radius of the sphere (defaults to 0.5).
segments Number The number of divisions along the longitudinal and latitudinal axes of the sphere (defaults to 16).
Source:
Returns:
A new sphere-shaped mesh.
Type
pc.Mesh

(static) createStyle(cssString) → {Element}

Creates a <style> DOM element from a string that contains CSS
Parameters:
Name Type Description
cssString String A string that contains valid CSS
Source:
Returns:
The style DOM element
Type
Element
Example
var css = 'body {height: 100;}';
var style = pc.createStyle(css);
document.head.appendChild(style);

(static) createTorus(device, opts) → {pc.Mesh}

Creates a procedural torus-shaped mesh. The size, shape and tesselation properties of the torus can be controlled via function parameters. By default, the function will create a torus in the XZ-plane with a tube radius of 0.2, a ring radius of 0.3, 20 segments and 30 sides.
Note that the torus is created with UVs in the range of 0 to 1. Additionally, tangent information is generated into the vertex buffer of the torus's mesh.
Parameters:
Name Type Description
device pc.GraphicsDevice The graphics device used to manage the mesh.
opts Object An object that specifies optional inputs for the function as follows:
Properties
Name Type Description
tubeRadius Number The radius of the tube forming the body of the torus (defaults to 0.2).
ringRadius Number The radius from the centre of the torus to the centre of the tube (defaults to 0.3).
segments Number The number of radial divisions forming cross-sections of the torus ring (defaults to 20).
sides Number The number of divisions around the tubular body of the torus ring (defaults to 30).
Source:
Returns:
A new torus-shaped mesh.
Type
pc.Mesh

(private, static) createURI(options) → {String}

Create a URI object from constituent parts
Parameters:
Name Type Description
options Object Parts of the URI to build
Properties
Name Type Attributes Description
scheme String <optional>
The URI scheme (e.g. http)
authority String <optional>
The URI authority (e.g. www.example.com)
host String <optional>
Combination of scheme and authority (e.g. http://www.example.com)
path String <optional>
The URI path (e.g. /users/example)
hostpath String <optional>
Combination of scheme, authority and path (e.g. http://www.example.com/users/example)
query String <optional>
The query section, after the ?(e.g. http://example.com?key=value&another=123)
fragment String <optional>
The fragment section, after the # (e.g. http://example.com#fragment/data)
Source:
Returns:
A URI string
Type
String

(private, static) extend(target, ex) → {Object}

Merge the contents of two objects into a single object
Parameters:
Name Type Description
target Object The target object of the merge
ex Object The object that is merged with target
Source:
Returns:
The target object
Type
Object
Example
var A = {a: function() {console.log(this.a}};
var B = {b: function() {console.log(this.b}};

pc.extend(A,B);
A.a();
// logs "a"
A.b();
// logs "b"

(static) getTouchTargetCoords(touch) → {Object}

Similiar to pc.getTargetCoords for the MouseEvents. This function takes a browser Touch object and returns the co-ordinates of the touch relative to the target element.
Parameters:
Name Type Description
touch Touch The browser Touch object
Source:
Returns:
The co-ordinates of the touch relative to the touch.target element. In the format {x, y}
Type
Object

(private, static) hashCode(str) → {Number}

Calculates simple hash value of a string. Designed for performance, not perfect.
Parameters:
Name Type Description
str String String
Source:
Returns:
Hash value
Type
Number

(private, static) inherits(Self, Super) → {function}

Implementation of inheritance for JavaScript objects e.g. Class can access all of Base's function prototypes The super classes prototype is available on the derived class as _super
Parameters:
Name Type Description
Self function Constructor of derived class
Super function Constructor of base class
Deprecated:
  • Yes
Source:
Returns:
New instance of Self which inherits from Super
Type
function
Example
Base = function () {};
Base.prototype.fn = function () {
  console.log('base');
};
Class = function () {}
Class = pc.inherits(Class, Base);
Class.prototype.fn = function () {
  // Call overridden method
  Class._super.fn();
  console.log('class');
};

var c = new Class();
c.fn(); // prints 'base' then 'class'

(private, static) isDefined(o) → {Boolean}

Return true if the Object is not undefined
Parameters:
Name Type Description
o Object The Object to test
Source:
Returns:
True if the Object is not undefined
Type
Boolean

(private, static) makeArray(arr) → {Array}

Convert an array-like object into a normal array. For example, this is useful for converting the arguments object into an array.
Parameters:
Name Type Description
arr Object The array to convert
Source:
Returns:
An array
Type
Array

(private, static) now() → {Number}

Get current time in milliseconds. Use it to measure time difference. Reference time may differ on different platforms.
Source:
Returns:
The time in milliseconds
Type
Number

(private, static) toKeyCode(s) → {Number}

Convert a string or keycode to a keycode
Parameters:
Name Type Description
s String | Number Either a character code or the key character.
Source:
Returns:
The character code.
Type
Number

(private, static) type(obj) → {String}

Extended typeof() function, returns the type of the object.
Parameters:
Name Type Description
obj Object The object to get the type of
Source:
Returns:
The type string: "null", "undefined", "number", "string", "boolean", "array", "object", "function", "date", "regexp" or "float32array"
Type
String

(private, static) unpack()

Copy a set of common PlayCanvas functions/classes/namespaces into the global namespace
Source: