pc
Root namespace for the PlayCanvas Engine.
Summary
Type Definitions
AddParserCallback | Callback used by ModelHandler#addParser to decide on which parser to use. |
AssetReadyCallback | Callback used by Asset#ready and called when an asset is ready. |
CalculateMatrixCallback | Callback used by CameraComponent#calculateTransform and CameraComponent#calculateProjection. |
CalculateSortDistanceCallback | Callback used by Layer to calculate the "sort distance" for a MeshInstance, which determines its place in the render order. |
ChangeSceneCallback | Callback used by SceneRegistry#changeScene. |
ConfigureAppCallback | Callback used by AppBase#configure when configuration file is loaded and parsed (or an error occurs). |
CreateScreenCallback | Callback used by script.createLoadingScreen. |
FilterAssetCallback | Callback used by AssetRegistry#filter to filter assets. |
FindNodeCallback | Callback used by GraphNode#find and GraphNode#findOne to search through a graph node and all of its descendants. |
ForEachNodeCallback | Callback used by GraphNode#forEach to iterate through a graph node and all of its descendants. |
HandleEventCallback | Callback used by EventHandler functions. |
HttpResponseCallback | Callback used by Http#get, Http#post, Http#put, Http#del, and Http#request. |
LoadAssetCallback | Callback used by AssetRegistry#loadFromUrl and called when an asset is loaded (or an error occurs). |
LoadHierarchyCallback | Callback used by SceneRegistry#loadSceneHierarchy. |
LoadSceneCallback | Callback used by SceneRegistry#loadScene. |
LoadSceneDataCallback | Callback used by SceneRegistry#loadSceneData. |
LoadSettingsCallback | Callback used by SceneRegistry#loadSceneSettings. |
LockMouseCallback | Callback used by Mouse#enablePointerLock and Application#disablePointerLock. |
ModuleErrorCallback | Callback used by Module#setConfig. |
ModuleInstanceCallback | Callback used by Module#getInstance. |
PreloadAppCallback | Callback used by AppBase#preload when all assets (marked as 'preload') are loaded. |
ResourceHandlerCallback | Callback used by ResourceHandler#load when a resource is loaded (or an error occurs). |
ResourceLoaderCallback | Callback used by ResourceLoader#load when a resource is loaded (or an error occurs). |
UpdateShaderCallback | Callback used by StandardMaterial#onUpdateShader. |
XrErrorCallback | Callback used by XrManager#endXr and XrManager#startXr. |
XrHitTestStartCallback | Callback used by XrHitTest#start and XrHitTest#startForInputSource. |
Static Properties
ADDRESS_CLAMP_TO_EDGE | Clamps texture coordinate to the range 0 to 1. |
ADDRESS_MIRRORED_REPEAT | Texture coordinate to be set to the fractional part if the integer part is even. |
ADDRESS_REPEAT | Ignores the integer part of texture coordinates, using only the fractional part. |
ANIM_BLEND_1D | |
ANIM_BLEND_2D_CARTESIAN | |
ANIM_BLEND_2D_DIRECTIONAL | |
ANIM_BLEND_DIRECT | |
ANIM_EQUAL_TO | Used to set an anim state graph transition condition predicate as '==='. |
ANIM_GREATER_THAN | Used to set an anim state graph transition condition predicate as '>'. |
ANIM_GREATER_THAN_EQUAL_TO | Used to set an anim state graph transition condition predicate as '>='. |
ANIM_INTERRUPTION_NEXT | Used to set the anim state graph transition interruption source as the next state only. |
ANIM_INTERRUPTION_NEXT_PREV | Used to set the anim state graph transition interruption sources as the next state followed by the previous state. |
ANIM_INTERRUPTION_NONE | Used to set the anim state graph transition interruption source to no state. |
ANIM_INTERRUPTION_PREV | Used to set the anim state graph transition interruption source as the previous state only. |
ANIM_INTERRUPTION_PREV_NEXT | Used to set the anim state graph transition interruption sources as the previous state followed by the next state. |
ANIM_LAYER_ADDITIVE | Used to indicate that a layers animations should blend additively with previous layers. |
ANIM_LAYER_OVERWRITE | Used to indicate that a layers animations should overwrite all previous layers. |
ANIM_LESS_THAN | Used to set an anim state graph transition condition predicate as '<'. |
ANIM_LESS_THAN_EQUAL_TO | Used to set an anim state graph transition condition predicate as '<='. |
ANIM_NOT_EQUAL_TO | Used to set an anim state graph transition condition predicate as '!=='. |
ANIM_PARAMETER_BOOLEAN | Used to set an anim state graph parameter as type boolean. |
ANIM_PARAMETER_FLOAT | Used to set an anim state graph parameter as type float. |
ANIM_PARAMETER_INTEGER | Used to set an anim state graph parameter as type integer. |
ANIM_PARAMETER_TRIGGER | Used to set an anim state graph parameter as type trigger. |
ANIM_STATE_ANY | Used to indicate any state in an anim state graph layer. |
ANIM_STATE_END | The ending state in an anim state graph layer. |
ANIM_STATE_START | The starting state in an anim state graph layer. |
ASPECT_AUTO | Automatically set aspect ratio to current render target's width divided by height. |
ASPECT_MANUAL | Use the manual aspect ratio value. |
ASSET_ANIMATION | Asset type name for animation. |
ASSET_AUDIO | Asset type name for audio. |
ASSET_CONTAINER | Asset type name for a container. |
ASSET_CSS | Asset type name for CSS. |
ASSET_CUBEMAP | Asset type name for cubemap. |
ASSET_HTML | Asset type name for HTML. |
ASSET_IMAGE | Asset type name for image. |
ASSET_JSON | Asset type name for json. |
ASSET_MATERIAL | Asset type name for material. |
ASSET_MODEL | Asset type name for model. |
ASSET_SCRIPT | Asset type name for script. |
ASSET_SHADER | Asset type name for shader. |
ASSET_TEXT | Asset type name for text. |
ASSET_TEXTURE | Asset type name for texture. |
ASSET_TEXTUREATLAS | Asset type name for textureatlas. |
BAKE_COLOR | Single color lightmap. |
BAKE_COLORDIR | Single color lightmap + dominant light direction (used for bump/specular). |
BLEND_ADDITIVE | Add the color of the source fragment to the destination fragment and write the result to the frame buffer. |
BLEND_ADDITIVEALPHA | Same as BLEND_ADDITIVE except the source RGB is multiplied by the source alpha. |
BLEND_MAX | Maximum color. |
BLEND_MIN | Minimum color. |
BLEND_MULTIPLICATIVE | Multiply the color of the source fragment by the color of the destination fragment and write the result to the frame buffer. |
BLEND_MULTIPLICATIVE2X | Multiplies colors and doubles the result. |
BLEND_NONE | Disable blending. |
BLEND_NORMAL | Enable simple translucency for materials such as glass. |
BLEND_PREMULTIPLIED | Similar to BLEND_NORMAL expect the source fragment is assumed to have already been multiplied by the source alpha value. |
BLEND_SCREEN | Softer version of additive. |
BLEND_SUBTRACTIVE | Subtract the color of the source fragment from the destination fragment and write the result to the frame buffer. |
BLENDEQUATION_ADD | Add the results of the source and destination fragment multiplies. |
BLENDEQUATION_MAX | Use the largest value. |
BLENDEQUATION_MIN | Use the smallest value. |
BLENDEQUATION_REVERSE_SUBTRACT | Reverse and subtract the results of the source and destination fragment multiplies. |
BLENDEQUATION_SUBTRACT | Subtract the results of the source and destination fragment multiplies. |
BLENDMODE_CONSTANT | Multiplies all fragment components by a constant. |
BLENDMODE_DST_ALPHA | Multiply all fragment components by the alpha value of the destination fragment. |
BLENDMODE_DST_COLOR | Multiply all fragment components by the components of the destination fragment. |
BLENDMODE_ONE | Multiply all fragment components by one. |
BLENDMODE_ONE_MINUS_CONSTANT | Multiplies all fragment components by 1 minus a constant. |
BLENDMODE_ONE_MINUS_DST_ALPHA | Multiply all fragment components by one minus the alpha value of the destination fragment. |
BLENDMODE_ONE_MINUS_DST_COLOR | Multiply all fragment components by one minus the components of the destination fragment. |
BLENDMODE_ONE_MINUS_SRC_ALPHA | Multiply all fragment components by one minus the alpha value of the source fragment. |
BLENDMODE_ONE_MINUS_SRC_COLOR | Multiply all fragment components by one minus the components of the source fragment. |
BLENDMODE_SRC_ALPHA | Multiply all fragment components by the alpha value of the source fragment. |
BLENDMODE_SRC_ALPHA_SATURATE | Multiply all fragment components by the alpha value of the source fragment. |
BLENDMODE_SRC_COLOR | Multiply all fragment components by the components of the source fragment. |
BLENDMODE_ZERO | Multiply all fragment components by zero. |
BLUR_BOX | Box filter. |
BLUR_GAUSSIAN | Gaussian filter. |
BODYTYPE_DYNAMIC | Rigid body is simulated according to applied forces. |
BODYTYPE_KINEMATIC | Rigid body has infinite mass and does not respond to forces but can still be moved by setting their velocity or position. |
BODYTYPE_STATIC | Rigid body has infinite mass and cannot move. |
BUFFER_DYNAMIC | The data store contents will be modified repeatedly and used many times. |
BUFFER_GPUDYNAMIC | The data store contents will be modified repeatedly on the GPU and used many times. |
BUFFER_STATIC | The data store contents will be modified once and used many times. |
BUFFER_STREAM | The data store contents will be modified once and used at most a few times. |
BUTTON_TRANSITION_MODE_SPRITE_CHANGE | Specifies different sprites for the hover, pressed and inactive states. |
BUTTON_TRANSITION_MODE_TINT | Specifies different color tints for the hover, pressed and inactive states. |
CHUNKAPI_1_51 | Chunk API versions |
CLEARFLAG_COLOR | Clear the color buffer. |
CLEARFLAG_DEPTH | Clear the depth buffer. |
CLEARFLAG_STENCIL | Clear the stencil buffer. |
CUBEFACE_NEGX | The negative X face of a cubemap. |
CUBEFACE_NEGY | The negative Y face of a cubemap. |
CUBEFACE_NEGZ | The negative Z face of a cubemap. |
CUBEFACE_POSX | The positive X face of a cubemap. |
CUBEFACE_POSY | The positive Y face of a cubemap. |
CUBEFACE_POSZ | The positive Z face of a cubemap. |
CUBEPROJ_BOX | The cube map is box-projected based on a world space axis-aligned bounding box. |
CUBEPROJ_NONE | The cube map is treated as if it is infinitely far away. |
CULLFACE_BACK | Triangles facing away from the view direction are culled. |
CULLFACE_FRONT | Triangles facing the view direction are culled. |
CULLFACE_NONE | No triangles are culled. |
CURVE_LINEAR | A linear interpolation scheme. |
CURVE_SMOOTHSTEP | A smooth step interpolation scheme. |
CURVE_SPLINE | Cardinal spline interpolation scheme. |
CURVE_STEP | A stepped interpolator, free from the shackles of blending. |
DETAILMODE_ADD | Add together the primary and secondary colors. |
DETAILMODE_MAX | Select whichever of the primary and secondary colors is lighter, component-wise. |
DETAILMODE_MIN | Select whichever of the primary and secondary colors is darker, component-wise. |
DETAILMODE_MUL | Multiply together the primary and secondary colors. |
DETAILMODE_OVERLAY | Multiplies or screens the colors, depending on the primary color. |
DETAILMODE_SCREEN | Softer version of DETAILMODE_ADD. |
DEVICETYPE_NULL | A Null device type. |
DEVICETYPE_WEBGL1 | A WebGL 1 device type. |
DEVICETYPE_WEBGL2 | A WebGL 2 device type. |
DEVICETYPE_WEBGPU | A WebGPU device type. |
DISTANCE_EXPONENTIAL | Exponential distance model. |
DISTANCE_INVERSE | Inverse distance model. |
DISTANCE_LINEAR | Linear distance model. |
ELEMENTTYPE_GROUP | A ElementComponent that contains child ElementComponents. |
ELEMENTTYPE_IMAGE | A ElementComponent that displays an image. |
ELEMENTTYPE_TEXT | A ElementComponent that displays text. |
EMITTERSHAPE_BOX | Box shape parameterized by emitterExtents. |
EMITTERSHAPE_SPHERE | Sphere shape parameterized by emitterRadius. |
EVENT_GAMEPADCONNECTED | Name of event fired when a gamepad connects. |
EVENT_GAMEPADDISCONNECTED | Name of event fired when a gamepad disconnects. |
EVENT_KEYDOWN | Name of event fired when a key is pressed. |
EVENT_KEYUP | Name of event fired when a key is released. |
EVENT_MOUSEDOWN | Name of event fired when a mouse button is pressed. |
EVENT_MOUSEMOVE | Name of event fired when the mouse is moved. |
EVENT_MOUSEUP | Name of event fired when a mouse button is released. |
EVENT_MOUSEWHEEL | Name of event fired when the mouse wheel is rotated. |
EVENT_SELECT | Name of event fired when a new xr select occurs. |
EVENT_SELECTEND | Name of event fired when xr select ends. |
EVENT_SELECTSTART | Name of event fired when a new xr select starts. |
EVENT_TOUCHCANCEL | Name of event fired when a touch point is interrupted in some way. |
EVENT_TOUCHEND | Name of event fired when touch ends. |
EVENT_TOUCHMOVE | Name of event fired when a touch moves. |
EVENT_TOUCHSTART | Name of event fired when a new touch occurs. |
FILLMODE_FILL_WINDOW | When resizing the window the size of the canvas will change to fill the window exactly. |
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. |
FILLMODE_NONE | When resizing the window the size of the canvas will not change. |
FILTER_LINEAR | Bilinear filtering. |
FILTER_LINEAR_MIPMAP_LINEAR | Linearly interpolate both the mipmap levels and between texels. |
FILTER_LINEAR_MIPMAP_NEAREST | Use the nearest neighbor after linearly interpolating between mipmap levels. |
FILTER_NEAREST | Point sample filtering. |
FILTER_NEAREST_MIPMAP_LINEAR | Linearly interpolate in the nearest mipmap level. |
FILTER_NEAREST_MIPMAP_NEAREST | Use the nearest neighbor in the nearest mipmap level. |
FITMODE_CONTAIN | Fit the content within the Element's bounding box while preserving its Aspect Ratio. |
FITMODE_COVER | Fit the content to cover the entire Element's bounding box while preserving its Aspect Ratio. |
FITMODE_STRETCH | Fit the content exactly to Element's bounding box. |
FITTING_BOTH | Apply both STRETCH and SHRINK fitting logic where applicable. |
FITTING_NONE | Disable all fitting logic. |
FITTING_SHRINK | Shrink child elements to fit the parent container. |
FITTING_STRETCH | Stretch child elements to fit the parent container. |
FOG_EXP | Fog rises according to an exponential curve controlled by a density value. |
FOG_EXP2 | Fog rises according to an exponential curve controlled by a density value. |
FOG_LINEAR | Fog rises linearly from zero to 1 between a start and end depth. |
FOG_NONE | No fog is applied to the scene. |
FRESNEL_NONE | No Fresnel. |
FRESNEL_SCHLICK | Schlick's approximation of Fresnel. |
FUNC_ALWAYS | Always pass. |
FUNC_EQUAL | Pass if (ref & mask) == (stencil & mask). |
FUNC_GREATER | Pass if (ref & mask) > (stencil & mask). |
FUNC_GREATEREQUAL | Pass if (ref & mask) >= (stencil & mask). |
FUNC_LESS | Pass if (ref & mask) < (stencil & mask). |
FUNC_LESSEQUAL | Pass if (ref & mask) <= (stencil & mask). |
FUNC_NEVER | Never pass. |
FUNC_NOTEQUAL | Pass if (ref & mask) != (stencil & mask). |
GAMMA_NONE | No gamma correction. |
GAMMA_SRGB | Apply sRGB gamma correction. |
GAMMA_SRGBHDR | Apply sRGB (HDR) gamma correction. |
INDEXFORMAT_UINT16 | 16-bit unsigned vertex indices (0 to 65,535). |
INDEXFORMAT_UINT32 | 32-bit unsigned vertex indices (0 to 4,294,967,295). |
INDEXFORMAT_UINT8 | 8-bit unsigned vertex indices (0 to 255). |
INTERPOLATION_CUBIC | A cubic spline interpolation scheme. |
INTERPOLATION_LINEAR | A linear interpolation scheme. |
INTERPOLATION_STEP | A stepped interpolation scheme. |
KEY_0 | |
KEY_1 | |
KEY_2 | |
KEY_3 | |
KEY_4 | |
KEY_5 | |
KEY_6 | |
KEY_7 | |
KEY_8 | |
KEY_9 | |
KEY_A | |
KEY_ADD | |
KEY_ALT | |
KEY_B | |
KEY_BACK_SLASH | |
KEY_BACKSPACE | |
KEY_C | |
KEY_CAPS_LOCK | |
KEY_CLOSE_BRACKET | |
KEY_COMMA | |
KEY_CONTEXT_MENU | |
KEY_CONTROL | |
KEY_D | |
KEY_DECIMAL | |
KEY_DELETE | |
KEY_DIVIDE | |
KEY_DOWN | |
KEY_E | |
KEY_END | |
KEY_ENTER | |
KEY_EQUAL | |
KEY_ESCAPE | |
KEY_F | |
KEY_F1 | |
KEY_F10 | |
KEY_F11 | |
KEY_F12 | |
KEY_F2 | |
KEY_F3 | |
KEY_F4 | |
KEY_F5 | |
KEY_F6 | |
KEY_F7 | |
KEY_F8 | |
KEY_F9 | |
KEY_G | |
KEY_H | |
KEY_HOME | |
KEY_I | |
KEY_INSERT | |
KEY_J | |
KEY_K | |
KEY_L | |
KEY_LEFT | |
KEY_M | |
KEY_META | |
KEY_MULTIPLY | |
KEY_N | |
KEY_NUMPAD_0 | |
KEY_NUMPAD_1 | |
KEY_NUMPAD_2 | |
KEY_NUMPAD_3 | |
KEY_NUMPAD_4 | |
KEY_NUMPAD_5 | |
KEY_NUMPAD_6 | |
KEY_NUMPAD_7 | |
KEY_NUMPAD_8 | |
KEY_NUMPAD_9 | |
KEY_O | |
KEY_OPEN_BRACKET | |
KEY_P | |
KEY_PAGE_DOWN | |
KEY_PAGE_UP | |
KEY_PAUSE | |
KEY_PERIOD | |
KEY_PRINT_SCREEN | |
KEY_Q | |
KEY_R | |
KEY_RETURN | |
KEY_RIGHT | |
KEY_S | |
KEY_SEMICOLON | |
KEY_SEPARATOR | |
KEY_SHIFT | |
KEY_SLASH | |
KEY_SPACE | |
KEY_SUBTRACT | |
KEY_T | |
KEY_TAB | |
KEY_U | |
KEY_UP | |
KEY_V | |
KEY_W | |
KEY_WINDOWS | |
KEY_X | |
KEY_Y | |
KEY_Z | |
LAYERID_DEPTH | The depth layer. |
LAYERID_IMMEDIATE | The immediate layer. |
LAYERID_SKYBOX | The skybox layer. |
LAYERID_UI | The UI layer. |
LAYERID_WORLD | The world layer. |
LIGHTFALLOFF_INVERSESQUARED | Inverse squared distance falloff model for light attenuation. |
LIGHTFALLOFF_LINEAR | Linear distance falloff model for light attenuation. |
LIGHTSHAPE_DISK | Disk shape of light source. |
LIGHTSHAPE_PUNCTUAL | Infinitesimally small point light source shape. |
LIGHTSHAPE_RECT | Rectangle shape of light source. |
LIGHTSHAPE_SPHERE | Sphere shape of light source. |
LIGHTTYPE_DIRECTIONAL | Directional (global) light source. |
LIGHTTYPE_OMNI | Omni-directional (local) light source. |
LIGHTTYPE_SPOT | Spot (local) light source. |
MOUSEBUTTON_LEFT | The left mouse button. |
MOUSEBUTTON_MIDDLE | The middle mouse button. |
MOUSEBUTTON_NONE | No mouse buttons pressed. |
MOUSEBUTTON_RIGHT | The right mouse button. |
ORIENTATION_HORIZONTAL | Horizontal orientation. |
ORIENTATION_VERTICAL | Vertical orientation. |
PAD_1 | Index for pad 1. |
PAD_2 | Index for pad 2. |
PAD_3 | Index for pad 3. |
PAD_4 | Index for pad 4. |
PAD_DOWN | Direction pad down. |
PAD_FACE_1 | The first face button, from bottom going clockwise. |
PAD_FACE_2 | The second face button, from bottom going clockwise. |
PAD_FACE_3 | The third face button, from bottom going clockwise. |
PAD_FACE_4 | The fourth face button, from bottom going clockwise. |
PAD_L_SHOULDER_1 | The first shoulder button on the left. |
PAD_L_SHOULDER_2 | The second shoulder button on the left. |
PAD_L_STICK_BUTTON | The button when depressing the left analogue stick. |
PAD_L_STICK_X | Horizontal axis on the left analogue stick. |
PAD_L_STICK_Y | Vertical axis on the left analogue stick. |
PAD_LEFT | Direction pad left. |
PAD_R_SHOULDER_1 | The first shoulder button on the right. |
PAD_R_SHOULDER_2 | The second shoulder button on the right. |
PAD_R_STICK_BUTTON | The button when depressing the right analogue stick. |
PAD_R_STICK_X | Horizontal axis on the right analogue stick. |
PAD_R_STICK_Y | Vertical axis on the right analogue stick. |
PAD_RIGHT | Direction pad right. |
PAD_SELECT | The select button. |
PAD_START | The start button. |
PAD_UP | Direction pad up. |
PAD_VENDOR | Vendor specific button. |
PARTICLEORIENTATION_EMITTER | Similar to previous, but the normal is affected by emitter(entity) transformation. |
PARTICLEORIENTATION_SCREEN | Particles are facing camera. |
PARTICLEORIENTATION_WORLD | User defines world space normal (particleNormal) to set planes orientation. |
PARTICLESORT_DISTANCE | Sorting based on distance to the camera. |
PARTICLESORT_NEWER_FIRST | Newer particles are drawn first. |
PARTICLESORT_NONE | No sorting, particles are drawn in arbitrary order. |
PARTICLESORT_OLDER_FIRST | Older particles are drawn first. |
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). |
PIXELFORMAT_A8 | 8-bit alpha. |
PIXELFORMAT_ASTC_4x4 | ATC compressed format with alpha channel in blocks of 4x4. |
PIXELFORMAT_ATC_RGB | ATC compressed format with no alpha channel. |
PIXELFORMAT_ATC_RGBA | ATC compressed format with alpha channel. |
PIXELFORMAT_DEPTH | A readable depth buffer format. |
PIXELFORMAT_DEPTHSTENCIL | A readable depth/stencil buffer format (WebGL2 only). |
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. |
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. |
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). |
PIXELFORMAT_ETC1 | ETC1 compressed format. |
PIXELFORMAT_ETC2_RGB | ETC2 (RGB) compressed format. |
PIXELFORMAT_ETC2_RGBA | ETC2 (RGBA) compressed format. |
PIXELFORMAT_L8 | 8-bit luminance. |
PIXELFORMAT_LA8 | 8-bit luminance with 8-bit alpha. |
PIXELFORMAT_PVRTC_2BPP_RGB_1 | PVRTC (2BPP RGB) compressed format. |
PIXELFORMAT_PVRTC_2BPP_RGBA_1 | PVRTC (2BPP RGBA) compressed format. |
PIXELFORMAT_PVRTC_4BPP_RGB_1 | PVRTC (4BPP RGB) compressed format. |
PIXELFORMAT_PVRTC_4BPP_RGBA_1 | PVRTC (4BPP RGBA) compressed format. |
PIXELFORMAT_R32F | 32-bit floating point single channel format (WebGL2 only). |
PIXELFORMAT_RGB16F | 16-bit floating point RGB (16-bit float for each red, green and blue channels). |
PIXELFORMAT_RGB32F | 32-bit floating point RGB (32-bit float for each red, green and blue channels). |
PIXELFORMAT_RGB565 | 16-bit RGB (5-bits for red channel, 6 for green and 5 for blue). |
PIXELFORMAT_RGB8 | 24-bit RGB (8-bits for red channel, 8 for green and 8 for blue). |
PIXELFORMAT_RGBA16F | 16-bit floating point RGBA (16-bit float for each red, green, blue and alpha channels). |
PIXELFORMAT_RGBA32F | 32-bit floating point RGBA (32-bit float for each red, green, blue and alpha channels). |
PIXELFORMAT_RGBA4 | 16-bit RGBA (4-bits for red channel, 4 for green, 4 for blue with 4-bit alpha). |
PIXELFORMAT_RGBA5551 | 16-bit RGBA (5-bits for red channel, 5 for green, 5 for blue with 1-bit alpha). |
PIXELFORMAT_RGBA8 | 32-bit RGBA (8-bits for red channel, 8 for green, 8 for blue with 8-bit alpha). |
PIXELFORMAT_SRGB | Color-only sRGB format (WebGL2 only). |
PIXELFORMAT_SRGBA | Color sRGB format with additional alpha channel (WebGL2 only). |
PRIMITIVE_LINELOOP | List of points that are linked sequentially by line segments, with a closing line segment between the last and first points. |
PRIMITIVE_LINES | Discrete list of line segments. |
PRIMITIVE_LINESTRIP | List of points that are linked sequentially by line segments. |
PRIMITIVE_POINTS | List of distinct points. |
PRIMITIVE_TRIANGLES | Discrete list of triangles. |
PRIMITIVE_TRIFAN | Connected fan of triangles where the first vertex forms triangles with the following pairs of vertices. |
PRIMITIVE_TRISTRIP | Connected strip of triangles where a specified vertex forms a triangle using the previous two. |
PROJECTION_ORTHOGRAPHIC | An orthographic camera projection where the frustum shape is essentially a cuboid. |
PROJECTION_PERSPECTIVE | A perspective camera projection where the frustum shape is essentially pyramidal. |
RENDERSTYLE_POINTS | Render mesh instance as points. |
RENDERSTYLE_SOLID | Render mesh instance as solid geometry. |
RENDERSTYLE_WIREFRAME | Render mesh instance as wireframe. |
RESOLUTION_AUTO | When the canvas is resized the resolution of the canvas will change to match the size of the canvas. |
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. |
revision | The engine revision number. |
SCALEMODE_BLEND | Scale the ScreenComponent when the application's resolution is different than the ScreenComponent's referenceResolution. |
SCALEMODE_NONE | Always use the application's resolution as the resolution for the ScreenComponent. |
SCROLL_MODE_BOUNCE | Content scrolls past its bounds and then gently bounces back. |
SCROLL_MODE_CLAMP | Content does not scroll any further than its bounds. |
SCROLL_MODE_INFINITE | Content can scroll forever. |
SCROLLBAR_VISIBILITY_SHOW_ALWAYS | The scrollbar will be visible all the time. |
SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED | The scrollbar will be visible only when content exceeds the size of the viewport. |
SEMANTIC_ATTR0 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR1 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR10 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR11 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR12 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR13 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR14 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR15 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR2 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR3 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR4 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR5 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR6 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR7 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR8 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR9 | Vertex attribute with a user defined semantic. |
SEMANTIC_BLENDINDICES | Vertex attribute to be treated as skin blend indices. |
SEMANTIC_BLENDWEIGHT | Vertex attribute to be treated as skin blend weights. |
SEMANTIC_COLOR | Vertex attribute to be treated as a color. |
SEMANTIC_NORMAL | Vertex attribute to be treated as a normal. |
SEMANTIC_POSITION | Vertex attribute to be treated as a position. |
SEMANTIC_TANGENT | Vertex attribute to be treated as a tangent. |
SEMANTIC_TEXCOORD0 | Vertex attribute to be treated as a texture coordinate (set 0). |
SEMANTIC_TEXCOORD1 | Vertex attribute to be treated as a texture coordinate (set 1). |
SEMANTIC_TEXCOORD2 | Vertex attribute to be treated as a texture coordinate (set 2). |
SEMANTIC_TEXCOORD3 | Vertex attribute to be treated as a texture coordinate (set 3). |
SEMANTIC_TEXCOORD4 | Vertex attribute to be treated as a texture coordinate (set 4). |
SEMANTIC_TEXCOORD5 | Vertex attribute to be treated as a texture coordinate (set 5). |
SEMANTIC_TEXCOORD6 | Vertex attribute to be treated as a texture coordinate (set 6). |
SEMANTIC_TEXCOORD7 | Vertex attribute to be treated as a texture coordinate (set 7). |
SHADER_DEPTH | Render RGBA-encoded depth value. |
SHADER_FORWARD | Render shaded materials with gamma correction and tonemapping. |
SHADER_FORWARDHDR | Render shaded materials without gamma correction and tonemapping. |
shaderChunks | Object containing all default shader chunks used by shader generators. |
SHADERLANGUAGE_GLSL | Shader source code uses GLSL language. |
SHADERLANGUAGE_WGSL | Shader source code uses WGSL language. |
SHADERPASS_ALBEDO | Shader used for debug rendering of albedo. |
SHADERPASS_AO | Shader used for debug rendering of ao. |
SHADERPASS_EMISSION | Shader used for debug rendering of emission. |
SHADERPASS_FORWARD | Shader that performs forward rendering. |
SHADERPASS_GLOSS | Shader used for debug rendering of gloss. |
SHADERPASS_LIGHTING | Shader used for debug rendering of lighting. |
SHADERPASS_METALNESS | Shader used for debug rendering of metalness. |
SHADERPASS_OPACITY | Shader used for debug rendering of opacity. |
SHADERPASS_SPECULARITY | Shader used for debug rendering of specularity. |
SHADERPASS_UV0 | Shader used for debug rendering of UV0 texture coordinates. |
SHADERPASS_WORLDNORMAL | Shader used for debug rendering of world normal. |
SHADOW_PCF1 | Render depth (color-packed on WebGL 1. |
SHADOW_PCF3 | Render depth (color-packed on WebGL 1. |
SHADOW_PCF5 | Render depth buffer only, can be used for hardware-accelerated PCF 5x5 sampling. |
SHADOW_PCSS | Render depth as color for PCSS software filtering. |
SHADOW_VSM16 | Render 16-bit exponential variance shadow map. |
SHADOW_VSM32 | Render 32-bit exponential variance shadow map. |
SHADOW_VSM8 | Render packed variance shadow map. |
SHADOWUPDATE_NONE | The shadow map is not to be updated. |
SHADOWUPDATE_REALTIME | The shadow map is regenerated every frame. |
SHADOWUPDATE_THISFRAME | The shadow map is regenerated this frame and not on subsequent frames. |
SORTMODE_BACK2FRONT | Mesh instances are sorted back to front. |
SORTMODE_FRONT2BACK | Mesh instances are sorted front to back. |
SORTMODE_MANUAL | Mesh instances are sorted based on MeshInstance#drawOrder. |
SORTMODE_MATERIALMESH | Mesh instances are sorted to minimize switching between materials and meshes to improve rendering performance. |
SORTMODE_NONE | No sorting is applied. |
SPECOCC_AO | Use AO directly to occlude specular. |
SPECOCC_GLOSSDEPENDENT | Modify AO based on material glossiness/view angle to occlude specular. |
SPECOCC_NONE | No specular occlusion. |
SPECULAR_BLINN | Energy-conserving Blinn-Phong. |
SPECULAR_PHONG | Phong without energy conservation. |
SPRITE_RENDERMODE_SIMPLE | This mode renders a sprite as a simple quad. |
SPRITE_RENDERMODE_SLICED | This mode renders a sprite using 9-slicing in 'sliced' mode. |
SPRITE_RENDERMODE_TILED | This mode renders a sprite using 9-slicing in 'tiled' mode. |
SPRITETYPE_ANIMATED | A SpriteComponent that renders sprite animations. |
SPRITETYPE_SIMPLE | A SpriteComponent that displays a single frame from a sprite asset. |
STENCILOP_DECREMENT | Decrement the value. |
STENCILOP_DECREMENTWRAP | Decrement the value but wrap it to a maximum representable value if the current value is 0. |
STENCILOP_INCREMENT | Increment the value. |
STENCILOP_INCREMENTWRAP | Increment the value but wrap it to zero when it's larger than a maximum representable value. |
STENCILOP_INVERT | Invert the value bitwise. |
STENCILOP_KEEP | Don't change the stencil buffer value. |
STENCILOP_REPLACE | Replace value with the reference value (see StencilParameters). |
STENCILOP_ZERO | Set value to zero. |
TEXTURELOCK_READ | Read only. |
TEXTURELOCK_WRITE | Write only. |
TEXTUREPROJECTION_CUBE | Texture data is stored in cubemap projection format. |
TEXTUREPROJECTION_EQUIRECT | Texture data is stored in equirectangular projection format. |
TEXTUREPROJECTION_NONE | Texture data is not stored a specific projection format. |
TEXTUREPROJECTION_OCTAHEDRAL | Texture data is stored in octahedral projection format. |
TEXTURETYPE_DEFAULT | Texture is a default type. |
TEXTURETYPE_RGBE | Texture stores high dynamic range data in RGBE format. |
TEXTURETYPE_RGBM | Texture stores high dynamic range data in RGBM format. |
TEXTURETYPE_RGBP | Texture stores high dynamic range data in RGBP encoding. |
TEXTURETYPE_SWIZZLEGGGR | Texture stores normalmap data swizzled in GGGR format. |
TONEMAP_ACES | ACES filmic tonemapping curve. |
TONEMAP_ACES2 | ACES v2 filmic tonemapping curve. |
TONEMAP_FILMIC | Filmic tonemapping curve. |
TONEMAP_HEJL | Hejl filmic tonemapping curve. |
TONEMAP_LINEAR | Linear tonemapping. |
TRACE_ID_ELEMENT | Logs the internal debug information for Elements. |
TRACEID_BINDGROUP_ALLOC | Logs the creation of bind groups. |
TRACEID_BINDGROUPFORMAT_ALLOC | Logs the creation of bind group formats. |
TRACEID_GPU_TIMINGS | Logs the GPU timings. |
TRACEID_PIPELINELAYOUT_ALLOC | Logs the creation of pipeline layouts. |
TRACEID_RENDER_ACTION | Logs render actions created by the layer composition. |
TRACEID_RENDER_FRAME | Logs a frame number. |
TRACEID_RENDER_FRAME_TIME | Logs a frame time. |
TRACEID_RENDER_PASS | Logs basic information about generated render passes. |
TRACEID_RENDER_PASS_DETAIL | Logs additional detail for render passes. |
TRACEID_RENDER_QUEUE | Logs the render queue commands. |
TRACEID_RENDER_TARGET_ALLOC | Logs the allocation of render targets. |
TRACEID_RENDERPIPELINE_ALLOC | Logs the creation of render pipelines. |
TRACEID_SHADER_ALLOC | Logs the creation of shaders. |
TRACEID_SHADER_COMPILE | Logs the compilation time of shaders. |
TRACEID_TEXTURE_ALLOC | Logs the allocation of textures. |
TRACEID_TEXTURES | Logs the vram use by all textures in memory. |
TRACEID_VRAM_IB | Logs the vram use by the index buffers. |
TRACEID_VRAM_TEXTURE | Logs the vram use by the textures. |
TRACEID_VRAM_VB | Logs the vram use by the vertex buffers. |
TYPE_FLOAT32 | Floating point vertex element type. |
TYPE_INT16 | Signed short vertex element type. |
TYPE_INT32 | Signed integer vertex element type. |
TYPE_INT8 | Signed byte vertex element type. |
TYPE_UINT16 | Unsigned short vertex element type. |
TYPE_UINT32 | Unsigned integer vertex element type. |
TYPE_UINT8 | Unsigned byte vertex element type. |
USER_INPUT_EVENTS | List of Window events to listen when AudioContext needs to be unlocked. |
version | The engine version number. |
VIEW_CENTER | Center of view. |
VIEW_LEFT | Left of view. |
VIEW_RIGHT | Right of view. |
XRDEPTHSENSINGFORMAT_F32 | Float 32 - indicates that depth sensing preferred raw data format is Float 32. |
XRDEPTHSENSINGFORMAT_L8A8 | Luminance Alpha - indicates that depth sensing preferred raw data format is Luminance Alpha. |
XRDEPTHSENSINGUSAGE_CPU | CPU - indicates that depth sensing preferred usage is CPU. |
XRDEPTHSENSINGUSAGE_GPU | GPU - indicates that depth sensing preferred usage is GPU. |
XRHAND_LEFT | Left - indicates that input source is meant to be held in left hand. |
XRHAND_NONE | None - input source is not meant to be held in hands. |
XRHAND_RIGHT | Right - indicates that input source is meant to be held in right hand. |
XRPAD_A | The A button from XR pad. |
XRPAD_B | The B button from XR pad. |
XRPAD_SQUEEZE | The squeeze button from XR pad. |
XRPAD_STICK_BUTTON | The button when pressing the XR pad's stick. |
XRPAD_STICK_X | Horizontal axis on the stick of a XR pad. |
XRPAD_STICK_Y | Vertical axis on the stick of a XR pad. |
XRPAD_TOUCHPAD_BUTTON | The button when pressing the XR pad's touchpad. |
XRPAD_TOUCHPAD_X | Horizontal axis on the touchpad of a XR pad. |
XRPAD_TOUCHPAD_Y | Vertical axis on the thouchpad of a XR pad. |
XRPAD_TRIGGER | The trigger button from XR pad. |
XRSPACE_BOUNDEDFLOOR | Bounded Floor - represents a tracking space with its native origin at the floor, where the user is expected to move within a pre-established boundary. |
XRSPACE_LOCAL | Local - represents a tracking space with a native origin near the viewer at the time of creation. |
XRSPACE_LOCALFLOOR | Local Floor - represents a tracking space with a native origin at the floor in a safe position for the user to stand. |
XRSPACE_UNBOUNDED | Unbounded - represents a tracking space where the user is expected to move freely around their environment, potentially even long distances from their starting point. |
XRSPACE_VIEWER | Viewer - always supported space with some basic tracking capabilities. |
XRTARGETRAY_GAZE | Gaze - indicates the target ray will originate at the viewer and follow the direction it is facing. |
XRTARGETRAY_POINTER | Tracked Pointer - indicates that the target ray originates from either a handheld device or other hand-tracking mechanism and represents that the user is using their hands or the held device for pointing. |
XRTARGETRAY_SCREEN | Screen - indicates that the input source was an interaction with the canvas element associated with an inline session's output context, such as a mouse click or touch event. |
XRTRACKABLE_MESH | Mesh - indicates that the hit test results will be computed based on the meshes detected by the underlying Augmented Reality system. |
XRTRACKABLE_PLANE | Plane - indicates that the hit test results will be computed based on the planes detected by the underlying Augmented Reality system. |
XRTRACKABLE_POINT | Point - indicates that the hit test results will be computed based on the feature points detected by the underlying Augmented Reality system. |
XRTYPE_AR | Immersive AR - session that provides exclusive access to VR/AR device that is intended to be blended with real-world environment. |
XRTYPE_INLINE | Inline - always available type of session. |
XRTYPE_VR | Immersive VR - session that provides exclusive access to VR device with best available tracking features. |
Static Methods
basisInitialize | Initialize the Basis transcode worker. |
calculateNormals | Generates normal information from the specified positions and triangle indices. |
calculateTangents | Generates tangent information from the specified positions, normals, texture coordinates and triangle indices. |
createBox | Creates a procedural box-shaped mesh. |
createCapsule | Creates a procedural capsule-shaped mesh. |
createCone | Creates a procedural cone-shaped mesh. |
createCylinder | Creates a procedural cylinder-shaped mesh. |
createGraphicsDevice | Creates a graphics device. |
createMesh | Creates a new mesh object from the supplied vertex information and topology. |
createPlane | Creates a procedural plane-shaped mesh. |
createScript | Create and register a new ScriptType. |
createShader | Create a shader from named shader chunks. |
createShaderFromCode | Create a shader from the supplied source code. |
createSphere | Creates a procedural sphere-shaped mesh. |
createTorus | Creates a procedural torus-shaped mesh. |
dracoInitialize | Initialize the Draco mesh decoder. |
drawQuadWithShader | Draws a screen-space quad using a specific shader. |
drawTexture | Draws a texture in screen-space. |
getTouchTargetCoords | This function takes a browser Touch object and returns the coordinates of the touch relative to the target DOM element. |
registerScript | Register a existing class type as a Script Type to ScriptRegistry. |
reprojectTexture | This function reprojects textures between cubemap, equirectangular and octahedral formats. |
Details
Type Definitions
AddParserCallback
Callback used by ModelHandler#addParser to decide on which parser to use.
Parameters
url | string | The resource url. |
data | object | The raw model data. |
AssetReadyCallback
Callback used by Asset#ready and called when an asset is ready.
Parameters
asset | Asset | The ready asset. |
CalculateMatrixCallback
Callback used by CameraComponent#calculateTransform and CameraComponent#calculateProjection.
Parameters
transformMatrix | Mat4 | Output of the function. |
view | number | Type of view. Can be VIEW_CENTER, VIEW_LEFT or VIEW_RIGHT. Left and right are only used in stereo rendering. |
CalculateSortDistanceCallback
Callback used by Layer to calculate the "sort distance" for a MeshInstance, which determines its place in the render order.
Parameters
meshInstance | MeshInstance | The mesh instance. |
cameraPosition | Vec3 | The position of the camera. |
cameraForward | Vec3 | The forward vector of the camera. |
ChangeSceneCallback
Callback used by SceneRegistry#changeScene.
Parameters
err | string, null | The error message in the case where the loading or parsing fails. |
entity | Entity | The loaded root entity if no errors were encountered. |
ConfigureAppCallback
Callback used by AppBase#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. |
CreateScreenCallback
Callback used by script.createLoadingScreen.
Parameters
app | AppBase | The application. |
FilterAssetCallback
Callback used by AssetRegistry#filter to filter assets.
Parameters
asset | Asset | The current asset to filter. |
FindNodeCallback
Callback used by GraphNode#find and GraphNode#findOne to search through a graph node and all of its descendants.
Parameters
node | GraphNode | The current graph node. |
ForEachNodeCallback
Callback used by GraphNode#forEach to iterate through a graph node and all of its descendants.
Parameters
node | GraphNode | The current graph node. |
HandleEventCallback
Callback used by EventHandler 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. |
HttpResponseCallback
Callback used by Http#get, Http#post, Http#put, Http#del, and 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). |
LoadAssetCallback
Callback used by 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 | Asset | The loaded asset if no errors were encountered. |
LoadHierarchyCallback
Callback used by SceneRegistry#loadSceneHierarchy.
Parameters
err | string, null | The error message in the case where the loading or parsing fails. |
entity | Entity | The loaded root entity if no errors were encountered. |
LoadSceneCallback
Callback used by SceneRegistry#loadScene.
Parameters
err | string, null | The error message in the case where the loading or parsing fails. |
entity | Entity | The loaded root entity if no errors were encountered. |
LoadSceneDataCallback
Callback used by SceneRegistry#loadSceneData.
Parameters
err | string, null | The error message in the case where the loading or parsing fails. |
sceneItem | SceneRegistryItem | The scene registry item if no errors were encountered. |
LoadSettingsCallback
Callback used by SceneRegistry#loadSceneSettings.
Parameters
err | string, null | The error message in the case where the loading or parsing fails. |
LockMouseCallback
Callback used by Mouse#enablePointerLock and Application#disablePointerLock.
ModuleErrorCallback
Callback used by Module#setConfig.
Parameters
error | string | If the instance fails to load this will contain a description of the error. |
ModuleInstanceCallback
Callback used by Module#getInstance.
Parameters
moduleInstance | any | The module instance. |
PreloadAppCallback
Callback used by AppBase#preload when all assets (marked as 'preload') are loaded.
ResourceHandlerCallback
Callback used by 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. |
ResourceLoaderCallback
Callback used by 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. |
UpdateShaderCallback
Callback used by StandardMaterial#onUpdateShader.
Parameters
options | StandardMaterialOptions | 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 StandardMaterial. Also contains a member named litOptions which holds some of the options only used by the lit shader backend LitShaderOptions. |
XrErrorCallback
Callback used by XrManager#endXr and XrManager#startXr.
Parameters
err | Error, null | The Error object or null if operation was successful. |
XrHitTestStartCallback
Callback used by XrHitTest#start and XrHitTest#startForInputSource.
Parameters
err | Error, null | The Error object if failed to create hit test source or null. |
hitTestSource | XrHitTestSource, null | Object that provides access to hit results against real world geometry. |
Static Properties
ADDRESS_CLAMP_TO_EDGE | Clamps texture coordinate to the range 0 to 1. |
ADDRESS_MIRRORED_REPEAT | 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. |
ADDRESS_REPEAT | Ignores the integer part of texture coordinates, using only the fractional part. |
ANIM_BLEND_1D | |
ANIM_BLEND_2D_CARTESIAN | |
ANIM_BLEND_2D_DIRECTIONAL | |
ANIM_BLEND_DIRECT | |
ANIM_EQUAL_TO | Used to set an anim state graph transition condition predicate as '==='. |
ANIM_GREATER_THAN | Used to set an anim state graph transition condition predicate as '>'. |
ANIM_GREATER_THAN_EQUAL_TO | Used to set an anim state graph transition condition predicate as '>='. |
ANIM_INTERRUPTION_NEXT | Used to set the anim state graph transition interruption source as the next state only. |
ANIM_INTERRUPTION_NEXT_PREV | Used to set the anim state graph transition interruption sources as the next state followed by the previous state. |
ANIM_INTERRUPTION_NONE | Used to set the anim state graph transition interruption source to no state. |
ANIM_INTERRUPTION_PREV | Used to set the anim state graph transition interruption source as the previous state only. |
ANIM_INTERRUPTION_PREV_NEXT | Used to set the anim state graph transition interruption sources as the previous state followed by the next state. |
ANIM_LAYER_ADDITIVE | Used to indicate that a layers animations should blend additively with previous layers. |
ANIM_LAYER_OVERWRITE | Used to indicate that a layers animations should overwrite all previous layers. |
ANIM_LESS_THAN | Used to set an anim state graph transition condition predicate as '<'. |
ANIM_LESS_THAN_EQUAL_TO | Used to set an anim state graph transition condition predicate as '<='. |
ANIM_NOT_EQUAL_TO | Used to set an anim state graph transition condition predicate as '!=='. |
ANIM_PARAMETER_BOOLEAN | Used to set an anim state graph parameter as type boolean. |
ANIM_PARAMETER_FLOAT | Used to set an anim state graph parameter as type float. |
ANIM_PARAMETER_INTEGER | Used to set an anim state graph parameter as type integer. |
ANIM_PARAMETER_TRIGGER | Used to set an anim state graph parameter as type trigger. |
ANIM_STATE_ANY | Used to indicate any state in an anim state graph layer. |
ANIM_STATE_END | The ending state in an anim state graph layer. |
ANIM_STATE_START | The starting state in an anim state graph layer. |
ASPECT_AUTO | Automatically set aspect ratio to current render target's width divided by height. |
ASPECT_MANUAL | Use the manual aspect ratio value. |
ASSET_ANIMATION | Asset type name for animation. |
ASSET_AUDIO | Asset type name for audio. |
ASSET_CONTAINER | Asset type name for a container. |
ASSET_CSS | Asset type name for CSS. |
ASSET_CUBEMAP | Asset type name for cubemap. |
ASSET_HTML | Asset type name for HTML. |
ASSET_IMAGE | Asset type name for image. |
ASSET_JSON | Asset type name for json. |
ASSET_MATERIAL | Asset type name for material. |
ASSET_MODEL | Asset type name for model. |
ASSET_SCRIPT | Asset type name for script. |
ASSET_SHADER | Asset type name for shader. |
ASSET_TEXT | Asset type name for text. |
ASSET_TEXTURE | Asset type name for texture. |
ASSET_TEXTUREATLAS | Asset type name for textureatlas. |
BAKE_COLOR | Single color lightmap. |
BAKE_COLORDIR | Single color lightmap + dominant light direction (used for bump/specular). |
BLEND_ADDITIVE | Add the color of the source fragment to the destination fragment and write the result to the frame buffer. |
BLEND_ADDITIVEALPHA | Same as BLEND_ADDITIVE except the source RGB is multiplied by the source alpha. |
BLEND_MAX | Maximum color. Check app.graphicsDevice.extBlendMinmax for support. |
BLEND_MIN | Minimum color. Check app.graphicsDevice.extBlendMinmax for support. |
BLEND_MULTIPLICATIVE | Multiply the color of the source fragment by the color of the destination fragment and write the result to the frame buffer. |
BLEND_MULTIPLICATIVE2X | Multiplies colors and doubles the result. |
BLEND_NONE | Disable blending. |
BLEND_NORMAL | Enable simple translucency for materials such as glass. This is equivalent to enabling a source blend mode of BLENDMODE_SRC_ALPHA and a destination blend mode of BLENDMODE_ONE_MINUS_SRC_ALPHA. |
BLEND_PREMULTIPLIED | Similar to BLEND_NORMAL expect the source fragment is assumed to have already been multiplied by the source alpha value. |
BLEND_SCREEN | Softer version of additive. |
BLEND_SUBTRACTIVE | Subtract the color of the source fragment from the destination fragment and write the result to the frame buffer. |
BLENDEQUATION_ADD | Add the results of the source and destination fragment multiplies. |
BLENDEQUATION_MAX | Use the largest value. Check app.graphicsDevice.extBlendMinmax for support. |
BLENDEQUATION_MIN | Use the smallest value. Check app.graphicsDevice.extBlendMinmax for support. |
BLENDEQUATION_REVERSE_SUBTRACT | Reverse and subtract the results of the source and destination fragment multiplies. |
BLENDEQUATION_SUBTRACT | Subtract the results of the source and destination fragment multiplies. |
BLENDMODE_CONSTANT | Multiplies all fragment components by a constant. |
BLENDMODE_DST_ALPHA | Multiply all fragment components by the alpha value of the destination fragment. |
BLENDMODE_DST_COLOR | Multiply all fragment components by the components of the destination fragment. |
BLENDMODE_ONE | Multiply all fragment components by one. |
BLENDMODE_ONE_MINUS_CONSTANT | Multiplies all fragment components by 1 minus a constant. |
BLENDMODE_ONE_MINUS_DST_ALPHA | Multiply all fragment components by one minus the alpha value of the destination fragment. |
BLENDMODE_ONE_MINUS_DST_COLOR | Multiply all fragment components by one minus the components of the destination fragment. |
BLENDMODE_ONE_MINUS_SRC_ALPHA | Multiply all fragment components by one minus the alpha value of the source fragment. |
BLENDMODE_ONE_MINUS_SRC_COLOR | Multiply all fragment components by one minus the components of the source fragment. |
BLENDMODE_SRC_ALPHA | Multiply all fragment components by the alpha value of the source fragment. |
BLENDMODE_SRC_ALPHA_SATURATE | Multiply all fragment components by the alpha value of the source fragment. |
BLENDMODE_SRC_COLOR | Multiply all fragment components by the components of the source fragment. |
BLENDMODE_ZERO | Multiply all fragment components by zero. |
BLUR_BOX | Box filter. |
BLUR_GAUSSIAN | Gaussian filter. May look smoother than box, but requires more samples. |
BODYTYPE_DYNAMIC | Rigid body is simulated according to applied forces. |
BODYTYPE_KINEMATIC | Rigid body has infinite mass and does not respond to forces but can still be moved by setting their velocity or position. |
BODYTYPE_STATIC | Rigid body has infinite mass and cannot move. |
BUFFER_DYNAMIC | The data store contents will be modified repeatedly and used many times. |
BUFFER_GPUDYNAMIC | The data store contents will be modified repeatedly on the GPU and used many times. Optimal for transform feedback usage (WebGL2 only). |
BUFFER_STATIC | The data store contents will be modified once and used many times. |
BUFFER_STREAM | The data store contents will be modified once and used at most a few times. |
BUTTON_TRANSITION_MODE_SPRITE_CHANGE | Specifies different sprites for the hover, pressed and inactive states. |
BUTTON_TRANSITION_MODE_TINT | Specifies different color tints for the hover, pressed and inactive states. |
CHUNKAPI_1_51 | Chunk API versions |
CLEARFLAG_COLOR | Clear the color buffer. |
CLEARFLAG_DEPTH | Clear the depth buffer. |
CLEARFLAG_STENCIL | Clear the stencil buffer. |
CUBEFACE_NEGX | The negative X face of a cubemap. |
CUBEFACE_NEGY | The negative Y face of a cubemap. |
CUBEFACE_NEGZ | The negative Z face of a cubemap. |
CUBEFACE_POSX | The positive X face of a cubemap. |
CUBEFACE_POSY | The positive Y face of a cubemap. |
CUBEFACE_POSZ | The positive Z face of a cubemap. |
CUBEPROJ_BOX | The cube map is box-projected based on a world space axis-aligned bounding box. |
CUBEPROJ_NONE | The cube map is treated as if it is infinitely far away. |
CULLFACE_BACK | Triangles facing away from the view direction are culled. |
CULLFACE_FRONT | Triangles facing the view direction are culled. |
CULLFACE_NONE | No triangles are culled. |
CURVE_LINEAR | A linear interpolation scheme. |
CURVE_SMOOTHSTEP | A smooth step interpolation scheme. |
CURVE_SPLINE | Cardinal spline interpolation scheme. For Catmull-Rom, specify curve tension 0.5. |
CURVE_STEP | A stepped interpolator, free from the shackles of blending. |
DETAILMODE_ADD | Add together the primary and secondary colors. |
DETAILMODE_MAX | Select whichever of the primary and secondary colors is lighter, component-wise. |
DETAILMODE_MIN | Select whichever of the primary and secondary colors is darker, component-wise. |
DETAILMODE_MUL | Multiply together the primary and secondary colors. |
DETAILMODE_OVERLAY | Multiplies or screens the colors, depending on the primary color. |
DETAILMODE_SCREEN | Softer version of DETAILMODE_ADD. |
DEVICETYPE_NULL | A Null device type. |
DEVICETYPE_WEBGL1 | A WebGL 1 device type. |
DEVICETYPE_WEBGL2 | A WebGL 2 device type. |
DEVICETYPE_WEBGPU | A WebGPU device type. |
DISTANCE_EXPONENTIAL | Exponential distance model. |
DISTANCE_INVERSE | Inverse distance model. |
DISTANCE_LINEAR | Linear distance model. |
ELEMENTTYPE_GROUP | A ElementComponent that contains child ElementComponents. |
ELEMENTTYPE_IMAGE | A ElementComponent that displays an image. |
ELEMENTTYPE_TEXT | A ElementComponent that displays text. |
EMITTERSHAPE_BOX | Box shape parameterized by emitterExtents. Initial velocity is directed towards local Z axis. |
EMITTERSHAPE_SPHERE | Sphere shape parameterized by emitterRadius. Initial velocity is directed outwards from the center. |
EVENT_GAMEPADCONNECTED | Name of event fired when a gamepad connects. |
EVENT_GAMEPADDISCONNECTED | Name of event fired when a gamepad disconnects. |
EVENT_KEYDOWN | Name of event fired when a key is pressed. |
EVENT_KEYUP | Name of event fired when a key is released. |
EVENT_MOUSEDOWN | Name of event fired when a mouse button is pressed. |
EVENT_MOUSEMOVE | Name of event fired when the mouse is moved. |
EVENT_MOUSEUP | Name of event fired when a mouse button is released. |
EVENT_MOUSEWHEEL | Name of event fired when the mouse wheel is rotated. |
EVENT_SELECT | Name of event fired when a new xr select occurs. For example, primary trigger was pressed. |
EVENT_SELECTEND | Name of event fired when xr select ends. For example, a primary trigger is now released. |
EVENT_SELECTSTART | Name of event fired when a new xr select starts. For example, primary trigger is now pressed. |
EVENT_TOUCHCANCEL | Name of event fired when a touch point is interrupted in some way. The exact reasons for canceling 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. |
EVENT_TOUCHEND | Name of event fired when touch ends. For example, a finger is lifted off the device. |
EVENT_TOUCHMOVE | Name of event fired when a touch moves. |
EVENT_TOUCHSTART | Name of event fired when a new touch occurs. For example, a finger is placed on the device. |
FILLMODE_FILL_WINDOW | When resizing the window the size of the canvas will change to fill the window exactly. |
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. |
FILLMODE_NONE | When resizing the window the size of the canvas will not change. |
FILTER_LINEAR | Bilinear filtering. |
FILTER_LINEAR_MIPMAP_LINEAR | Linearly interpolate both the mipmap levels and between texels. |
FILTER_LINEAR_MIPMAP_NEAREST | Use the nearest neighbor after linearly interpolating between mipmap levels. |
FILTER_NEAREST | Point sample filtering. |
FILTER_NEAREST_MIPMAP_LINEAR | Linearly interpolate in the nearest mipmap level. |
FILTER_NEAREST_MIPMAP_NEAREST | Use the nearest neighbor in the nearest mipmap level. |
FITMODE_CONTAIN | Fit the content within the Element's bounding box while preserving its Aspect Ratio. |
FITMODE_COVER | Fit the content to cover the entire Element's bounding box while preserving its Aspect Ratio. |
FITMODE_STRETCH | Fit the content exactly to Element's bounding box. |
FITTING_BOTH | Apply both STRETCH and SHRINK fitting logic where applicable. |
FITTING_NONE | Disable all fitting logic. |
FITTING_SHRINK | Shrink child elements to fit the parent container. |
FITTING_STRETCH | Stretch child elements to fit the parent container. |
FOG_EXP | Fog rises according to an exponential curve controlled by a density value. |
FOG_EXP2 | Fog rises according to an exponential curve controlled by a density value. |
FOG_LINEAR | Fog rises linearly from zero to 1 between a start and end depth. |
FOG_NONE | No fog is applied to the scene. |
FRESNEL_NONE | No Fresnel. |
FRESNEL_SCHLICK | Schlick's approximation of Fresnel. |
FUNC_ALWAYS | Always pass. |
FUNC_EQUAL | Pass if (ref & mask) == (stencil & mask). |
FUNC_GREATER | Pass if (ref & mask) > (stencil & mask). |
FUNC_GREATEREQUAL | Pass if (ref & mask) >= (stencil & mask). |
FUNC_LESS | Pass if (ref & mask) < (stencil & mask). |
FUNC_LESSEQUAL | Pass if (ref & mask) <= (stencil & mask). |
FUNC_NEVER | Never pass. |
FUNC_NOTEQUAL | Pass if (ref & mask) != (stencil & mask). |
GAMMA_NONE | No gamma correction. |
GAMMA_SRGB | Apply sRGB gamma correction. |
GAMMA_SRGBHDR | Apply sRGB (HDR) gamma correction. |
INDEXFORMAT_UINT16 | 16-bit unsigned vertex indices (0 to 65,535). |
INDEXFORMAT_UINT32 | 32-bit unsigned vertex indices (0 to 4,294,967,295). |
INDEXFORMAT_UINT8 | 8-bit unsigned vertex indices (0 to 255). |
INTERPOLATION_CUBIC | A cubic spline interpolation scheme. |
INTERPOLATION_LINEAR | A linear interpolation scheme. |
INTERPOLATION_STEP | A stepped interpolation scheme. |
KEY_0 | |
KEY_1 | |
KEY_2 | |
KEY_3 | |
KEY_4 | |
KEY_5 | |
KEY_6 | |
KEY_7 | |
KEY_8 | |
KEY_9 | |
KEY_A | |
KEY_ADD | |
KEY_ALT | |
KEY_B | |
KEY_BACK_SLASH | |
KEY_BACKSPACE | |
KEY_C | |
KEY_CAPS_LOCK | |
KEY_CLOSE_BRACKET | |
KEY_COMMA | |
KEY_CONTEXT_MENU | |
KEY_CONTROL | |
KEY_D | |
KEY_DECIMAL | |
KEY_DELETE | |
KEY_DIVIDE | |
KEY_DOWN | |
KEY_E | |
KEY_END | |
KEY_ENTER | |
KEY_EQUAL | |
KEY_ESCAPE | |
KEY_F | |
KEY_F1 | |
KEY_F10 | |
KEY_F11 | |
KEY_F12 | |
KEY_F2 | |
KEY_F3 | |
KEY_F4 | |
KEY_F5 | |
KEY_F6 | |
KEY_F7 | |
KEY_F8 | |
KEY_F9 | |
KEY_G | |
KEY_H | |
KEY_HOME | |
KEY_I | |
KEY_INSERT | |
KEY_J | |
KEY_K | |
KEY_L | |
KEY_LEFT | |
KEY_M | |
KEY_META | |
KEY_MULTIPLY | |
KEY_N | |
KEY_NUMPAD_0 | |
KEY_NUMPAD_1 | |
KEY_NUMPAD_2 | |
KEY_NUMPAD_3 | |
KEY_NUMPAD_4 | |
KEY_NUMPAD_5 | |
KEY_NUMPAD_6 | |
KEY_NUMPAD_7 | |
KEY_NUMPAD_8 | |
KEY_NUMPAD_9 | |
KEY_O | |
KEY_OPEN_BRACKET | |
KEY_P | |
KEY_PAGE_DOWN | |
KEY_PAGE_UP | |
KEY_PAUSE | |
KEY_PERIOD | |
KEY_PRINT_SCREEN | |
KEY_Q | |
KEY_R | |
KEY_RETURN | |
KEY_RIGHT | |
KEY_S | |
KEY_SEMICOLON | |
KEY_SEPARATOR | |
KEY_SHIFT | |
KEY_SLASH | |
KEY_SPACE | |
KEY_SUBTRACT | |
KEY_T | |
KEY_TAB | |
KEY_U | |
KEY_UP | |
KEY_V | |
KEY_W | |
KEY_WINDOWS | |
KEY_X | |
KEY_Y | |
KEY_Z | |
LAYERID_DEPTH | The depth layer. |
LAYERID_IMMEDIATE | The immediate layer. |
LAYERID_SKYBOX | The skybox layer. |
LAYERID_UI | The UI layer. |
LAYERID_WORLD | The world layer. |
LIGHTFALLOFF_INVERSESQUARED | Inverse squared distance falloff model for light attenuation. |
LIGHTFALLOFF_LINEAR | Linear distance falloff model for light attenuation. |
LIGHTSHAPE_DISK | Disk shape of light source. |
LIGHTSHAPE_PUNCTUAL | Infinitesimally small point light source shape. |
LIGHTSHAPE_RECT | Rectangle shape of light source. |
LIGHTSHAPE_SPHERE | Sphere shape of light source. |
LIGHTTYPE_DIRECTIONAL | Directional (global) light source. |
LIGHTTYPE_OMNI | Omni-directional (local) light source. |
LIGHTTYPE_SPOT | Spot (local) light source. |
MOUSEBUTTON_LEFT | The left mouse button. |
MOUSEBUTTON_MIDDLE | The middle mouse button. |
MOUSEBUTTON_NONE | No mouse buttons pressed. |
MOUSEBUTTON_RIGHT | The right mouse button. |
ORIENTATION_HORIZONTAL | Horizontal orientation. |
ORIENTATION_VERTICAL | Vertical orientation. |
PAD_1 | Index for pad 1. |
PAD_2 | Index for pad 2. |
PAD_3 | Index for pad 3. |
PAD_4 | Index for pad 4. |
PAD_DOWN | Direction pad down. |
PAD_FACE_1 | The first face button, from bottom going clockwise. |
PAD_FACE_2 | The second face button, from bottom going clockwise. |
PAD_FACE_3 | The third face button, from bottom going clockwise. |
PAD_FACE_4 | The fourth face button, from bottom going clockwise. |
PAD_L_SHOULDER_1 | The first shoulder button on the left. |
PAD_L_SHOULDER_2 | The second shoulder button on the left. |
PAD_L_STICK_BUTTON | The button when depressing the left analogue stick. |
PAD_L_STICK_X | Horizontal axis on the left analogue stick. |
PAD_L_STICK_Y | Vertical axis on the left analogue stick. |
PAD_LEFT | Direction pad left. |
PAD_R_SHOULDER_1 | The first shoulder button on the right. |
PAD_R_SHOULDER_2 | The second shoulder button on the right. |
PAD_R_STICK_BUTTON | The button when depressing the right analogue stick. |
PAD_R_STICK_X | Horizontal axis on the right analogue stick. |
PAD_R_STICK_Y | Vertical axis on the right analogue stick. |
PAD_RIGHT | Direction pad right. |
PAD_SELECT | The select button. |
PAD_START | The start button. |
PAD_UP | Direction pad up. |
PAD_VENDOR | Vendor specific button. |
PARTICLEORIENTATION_EMITTER | Similar to previous, but the normal is affected by emitter(entity) transformation. |
PARTICLEORIENTATION_SCREEN | Particles are facing camera. |
PARTICLEORIENTATION_WORLD | User defines world space normal (particleNormal) to set planes orientation. |
PARTICLESORT_DISTANCE | Sorting based on distance to the camera. CPU only. |
PARTICLESORT_NEWER_FIRST | Newer particles are drawn first. CPU only. |
PARTICLESORT_NONE | No sorting, particles are drawn in arbitrary order. Can be simulated on GPU. |
PARTICLESORT_OLDER_FIRST | Older particles are drawn first. CPU only. |
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). |
PIXELFORMAT_A8 | 8-bit alpha. |
PIXELFORMAT_ASTC_4x4 | ATC compressed format with alpha channel in blocks of 4x4. |
PIXELFORMAT_ATC_RGB | ATC compressed format with no alpha channel. |
PIXELFORMAT_ATC_RGBA | ATC compressed format with alpha channel. |
PIXELFORMAT_DEPTH | A readable depth buffer format. |
PIXELFORMAT_DEPTHSTENCIL | A readable depth/stencil buffer format (WebGL2 only). |
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. |
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. |
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). |
PIXELFORMAT_ETC1 | ETC1 compressed format. |
PIXELFORMAT_ETC2_RGB | ETC2 (RGB) compressed format. |
PIXELFORMAT_ETC2_RGBA | ETC2 (RGBA) compressed format. |
PIXELFORMAT_L8 | 8-bit luminance. |
PIXELFORMAT_LA8 | 8-bit luminance with 8-bit alpha. |
PIXELFORMAT_PVRTC_2BPP_RGB_1 | PVRTC (2BPP RGB) compressed format. |
PIXELFORMAT_PVRTC_2BPP_RGBA_1 | PVRTC (2BPP RGBA) compressed format. |
PIXELFORMAT_PVRTC_4BPP_RGB_1 | PVRTC (4BPP RGB) compressed format. |
PIXELFORMAT_PVRTC_4BPP_RGBA_1 | PVRTC (4BPP RGBA) compressed format. |
PIXELFORMAT_R32F | 32-bit floating point single channel format (WebGL2 only). |
PIXELFORMAT_RGB16F | 16-bit floating point RGB (16-bit float for each red, green and blue channels). |
PIXELFORMAT_RGB32F | 32-bit floating point RGB (32-bit float for each red, green and blue channels). |
PIXELFORMAT_RGB565 | 16-bit RGB (5-bits for red channel, 6 for green and 5 for blue). |
PIXELFORMAT_RGB8 | 24-bit RGB (8-bits for red channel, 8 for green and 8 for blue). |
PIXELFORMAT_RGBA16F | 16-bit floating point RGBA (16-bit float for each red, green, blue and alpha channels). |
PIXELFORMAT_RGBA32F | 32-bit floating point RGBA (32-bit float for each red, green, blue and alpha channels). |
PIXELFORMAT_RGBA4 | 16-bit RGBA (4-bits for red channel, 4 for green, 4 for blue with 4-bit alpha). |
PIXELFORMAT_RGBA5551 | 16-bit RGBA (5-bits for red channel, 5 for green, 5 for blue with 1-bit alpha). |
PIXELFORMAT_RGBA8 | 32-bit RGBA (8-bits for red channel, 8 for green, 8 for blue with 8-bit alpha). |
PIXELFORMAT_SRGB | Color-only sRGB format (WebGL2 only). |
PIXELFORMAT_SRGBA | Color sRGB format with additional alpha channel (WebGL2 only). |
PRIMITIVE_LINELOOP | List of points that are linked sequentially by line segments, with a closing line segment between the last and first points. |
PRIMITIVE_LINES | Discrete list of line segments. |
PRIMITIVE_LINESTRIP | List of points that are linked sequentially by line segments. |
PRIMITIVE_POINTS | List of distinct points. |
PRIMITIVE_TRIANGLES | Discrete list of triangles. |
PRIMITIVE_TRIFAN | Connected fan of triangles where the first vertex forms triangles with the following pairs of vertices. |
PRIMITIVE_TRISTRIP | Connected strip of triangles where a specified vertex forms a triangle using the previous two. |
PROJECTION_ORTHOGRAPHIC | An orthographic camera projection where the frustum shape is essentially a cuboid. |
PROJECTION_PERSPECTIVE | A perspective camera projection where the frustum shape is essentially pyramidal. |
RENDERSTYLE_POINTS | Render mesh instance as points. |
RENDERSTYLE_SOLID | Render mesh instance as solid geometry. |
RENDERSTYLE_WIREFRAME | Render mesh instance as wireframe. |
RESOLUTION_AUTO | When the canvas is resized the resolution of the canvas will change to match the size of the canvas. |
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. |
revision | The engine revision number. This is the Git hash of the last commit made to the branch from which the engine was built. |
SCALEMODE_BLEND | Scale the ScreenComponent when the application's resolution is different than the ScreenComponent's referenceResolution. |
SCALEMODE_NONE | Always use the application's resolution as the resolution for the ScreenComponent. |
SCROLL_MODE_BOUNCE | Content scrolls past its bounds and then gently bounces back. |
SCROLL_MODE_CLAMP | Content does not scroll any further than its bounds. |
SCROLL_MODE_INFINITE | Content can scroll forever. |
SCROLLBAR_VISIBILITY_SHOW_ALWAYS | The scrollbar will be visible all the time. |
SCROLLBAR_VISIBILITY_SHOW_WHEN_REQUIRED | The scrollbar will be visible only when content exceeds the size of the viewport. |
SEMANTIC_ATTR0 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR1 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR10 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR11 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR12 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR13 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR14 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR15 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR2 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR3 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR4 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR5 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR6 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR7 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR8 | Vertex attribute with a user defined semantic. |
SEMANTIC_ATTR9 | Vertex attribute with a user defined semantic. |
SEMANTIC_BLENDINDICES | Vertex attribute to be treated as skin blend indices. |
SEMANTIC_BLENDWEIGHT | Vertex attribute to be treated as skin blend weights. |
SEMANTIC_COLOR | Vertex attribute to be treated as a color. |
SEMANTIC_NORMAL | Vertex attribute to be treated as a normal. |
SEMANTIC_POSITION | Vertex attribute to be treated as a position. |
SEMANTIC_TANGENT | Vertex attribute to be treated as a tangent. |
SEMANTIC_TEXCOORD0 | Vertex attribute to be treated as a texture coordinate (set 0). |
SEMANTIC_TEXCOORD1 | Vertex attribute to be treated as a texture coordinate (set 1). |
SEMANTIC_TEXCOORD2 | Vertex attribute to be treated as a texture coordinate (set 2). |
SEMANTIC_TEXCOORD3 | Vertex attribute to be treated as a texture coordinate (set 3). |
SEMANTIC_TEXCOORD4 | Vertex attribute to be treated as a texture coordinate (set 4). |
SEMANTIC_TEXCOORD5 | Vertex attribute to be treated as a texture coordinate (set 5). |
SEMANTIC_TEXCOORD6 | Vertex attribute to be treated as a texture coordinate (set 6). |
SEMANTIC_TEXCOORD7 | Vertex attribute to be treated as a texture coordinate (set 7). |
SHADER_DEPTH | Render RGBA-encoded depth value. |
SHADER_FORWARD | Render shaded materials with gamma correction and tonemapping. |
SHADER_FORWARDHDR | Render shaded materials without gamma correction and tonemapping. |
shaderChunks | Object containing all default shader chunks used by shader generators. |
SHADERLANGUAGE_GLSL | Shader source code uses GLSL language. |
SHADERLANGUAGE_WGSL | Shader source code uses WGSL language. |
SHADERPASS_ALBEDO | Shader used for debug rendering of albedo. |
SHADERPASS_AO | Shader used for debug rendering of ao. |
SHADERPASS_EMISSION | Shader used for debug rendering of emission. |
SHADERPASS_FORWARD | Shader that performs forward rendering. |
SHADERPASS_GLOSS | Shader used for debug rendering of gloss. |
SHADERPASS_LIGHTING | Shader used for debug rendering of lighting. |
SHADERPASS_METALNESS | Shader used for debug rendering of metalness. |
SHADERPASS_OPACITY | Shader used for debug rendering of opacity. |
SHADERPASS_SPECULARITY | Shader used for debug rendering of specularity. |
SHADERPASS_UV0 | Shader used for debug rendering of UV0 texture coordinates. |
SHADERPASS_WORLDNORMAL | Shader used for debug rendering of world normal. |
SHADOW_PCF1 | Render depth (color-packed on WebGL 1.0), can be used for PCF 1x1 sampling. |
SHADOW_PCF3 | Render depth (color-packed on WebGL 1.0), can be used for PCF 3x3 sampling. |
SHADOW_PCF5 | Render depth buffer only, can be used for hardware-accelerated PCF 5x5 sampling. Requires WebGL 2. Falls back to SHADOW_PCF3 on WebGL 1. |
SHADOW_PCSS | Render depth as color for PCSS software filtering. |
SHADOW_VSM16 | Render 16-bit exponential variance shadow map. Requires OES_texture_half_float extension. Falls back to SHADOW_VSM8, if not supported. |
SHADOW_VSM32 | Render 32-bit exponential variance shadow map. Requires OES_texture_float extension. Falls back to SHADOW_VSM16, if not supported. |
SHADOW_VSM8 | Render packed variance shadow map. All shadow receivers must also cast shadows for this mode to work correctly. |
SHADOWUPDATE_NONE | The shadow map is not to be updated. |
SHADOWUPDATE_REALTIME | The shadow map is regenerated every frame. |
SHADOWUPDATE_THISFRAME | The shadow map is regenerated this frame and not on subsequent frames. |
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. |
SORTMODE_FRONT2BACK | Mesh instances are sorted front to back. Depending on GPU and the scene, this option may give better performance than SORTMODE_MATERIALMESH due to reduced overdraw. |
SORTMODE_MANUAL | Mesh instances are sorted based on MeshInstance#drawOrder. |
SORTMODE_MATERIALMESH | Mesh instances are sorted to minimize switching between materials and meshes to improve rendering performance. |
SORTMODE_NONE | No sorting is applied. Mesh instances are rendered in the same order they were added to a layer. |
SPECOCC_AO | Use AO directly to occlude specular. |
SPECOCC_GLOSSDEPENDENT | Modify AO based on material glossiness/view angle to occlude specular. |
SPECOCC_NONE | No specular occlusion. |
SPECULAR_BLINN | Energy-conserving Blinn-Phong. |
SPECULAR_PHONG | Phong without energy conservation. You should only use it as a backwards compatibility with older projects. |
SPRITE_RENDERMODE_SIMPLE | This mode renders a sprite as a simple quad. |
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. |
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. |
SPRITETYPE_ANIMATED | A SpriteComponent that renders sprite animations. |
SPRITETYPE_SIMPLE | A SpriteComponent that displays a single frame from a sprite asset. |
STENCILOP_DECREMENT | Decrement the value. |
STENCILOP_DECREMENTWRAP | Decrement the value but wrap it to a maximum representable value if the current value is 0. |
STENCILOP_INCREMENT | Increment the value. |
STENCILOP_INCREMENTWRAP | Increment the value but wrap it to zero when it's larger than a maximum representable value. |
STENCILOP_INVERT | Invert the value bitwise. |
STENCILOP_KEEP | Don't change the stencil buffer value. |
STENCILOP_REPLACE | Replace value with the reference value (see StencilParameters). |
STENCILOP_ZERO | Set value to zero. |
TEXTURELOCK_READ | Read only. Any changes to the locked mip level's pixels will not update the texture. |
TEXTURELOCK_WRITE | Write only. The contents of the specified mip level will be entirely replaced. |
TEXTUREPROJECTION_CUBE | Texture data is stored in cubemap projection format. |
TEXTUREPROJECTION_EQUIRECT | Texture data is stored in equirectangular projection format. |
TEXTUREPROJECTION_NONE | Texture data is not stored a specific projection format. |
TEXTUREPROJECTION_OCTAHEDRAL | Texture data is stored in octahedral projection format. |
TEXTURETYPE_DEFAULT | Texture is a default type. |
TEXTURETYPE_RGBE | Texture stores high dynamic range data in RGBE format. |
TEXTURETYPE_RGBM | Texture stores high dynamic range data in RGBM format. |
TEXTURETYPE_RGBP | Texture stores high dynamic range data in RGBP encoding. |
TEXTURETYPE_SWIZZLEGGGR | Texture stores normalmap data swizzled in GGGR format. This is used for tangent space normal maps. The R component is stored in alpha and G is stored in RGB. This packing can result in higher quality when the texture data is compressed. |
TONEMAP_ACES | ACES filmic tonemapping curve. |
TONEMAP_ACES2 | ACES v2 filmic tonemapping curve. |
TONEMAP_FILMIC | Filmic tonemapping curve. |
TONEMAP_HEJL | Hejl filmic tonemapping curve. |
TONEMAP_LINEAR | Linear tonemapping. |
TRACE_ID_ELEMENT | Logs the internal debug information for Elements. |
TRACEID_BINDGROUP_ALLOC | Logs the creation of bind groups. |
TRACEID_BINDGROUPFORMAT_ALLOC | Logs the creation of bind group formats. |
TRACEID_GPU_TIMINGS | Logs the GPU timings. |
TRACEID_PIPELINELAYOUT_ALLOC | Logs the creation of pipeline layouts. WebBPU only. |
TRACEID_RENDER_ACTION | Logs render actions created by the layer composition. Only executes when the layer composition changes. |
TRACEID_RENDER_FRAME | Logs a frame number. |
TRACEID_RENDER_FRAME_TIME | Logs a frame time. |
TRACEID_RENDER_PASS | Logs basic information about generated render passes. |
TRACEID_RENDER_PASS_DETAIL | Logs additional detail for render passes. |
TRACEID_RENDER_QUEUE | Logs the render queue commands. |
TRACEID_RENDER_TARGET_ALLOC | Logs the allocation of render targets. |
TRACEID_RENDERPIPELINE_ALLOC | Logs the creation of render pipelines. WebBPU only. |
TRACEID_SHADER_ALLOC | Logs the creation of shaders. |
TRACEID_SHADER_COMPILE | Logs the compilation time of shaders. |
TRACEID_TEXTURE_ALLOC | Logs the allocation of textures. |
TRACEID_TEXTURES | Logs the vram use by all textures in memory. |
TRACEID_VRAM_IB | Logs the vram use by the index buffers. |
TRACEID_VRAM_TEXTURE | Logs the vram use by the textures. |
TRACEID_VRAM_VB | Logs the vram use by the vertex buffers. |
TYPE_FLOAT32 | Floating point vertex element type. |
TYPE_INT16 | Signed short vertex element type. |
TYPE_INT32 | Signed integer vertex element type. |
TYPE_INT8 | Signed byte vertex element type. |
TYPE_UINT16 | Unsigned short vertex element type. |
TYPE_UINT32 | Unsigned integer vertex element type. |
TYPE_UINT8 | Unsigned byte vertex element type. |
USER_INPUT_EVENTS | List of Window events to listen when AudioContext needs to be unlocked. |
version | The engine version number. This is in semantic versioning format (MAJOR.MINOR.PATCH). |
VIEW_CENTER | Center of view. |
VIEW_LEFT | Left of view. Only used in stereo rendering. |
VIEW_RIGHT | Right of view. Only used in stereo rendering. |
XRDEPTHSENSINGFORMAT_F32 | Float 32 - indicates that depth sensing preferred raw data format is Float 32. |
XRDEPTHSENSINGFORMAT_L8A8 | Luminance Alpha - indicates that depth sensing preferred raw data format is Luminance Alpha. This format is guaranteed to be supported. |
XRDEPTHSENSINGUSAGE_CPU | CPU - indicates that depth sensing preferred usage is CPU. This usage path is guaranteed to be supported. |
XRDEPTHSENSINGUSAGE_GPU | GPU - indicates that depth sensing preferred usage is GPU. |
XRHAND_LEFT | Left - indicates that input source is meant to be held in left hand. |
XRHAND_NONE | None - input source is not meant to be held in hands. |
XRHAND_RIGHT | Right - indicates that input source is meant to be held in right hand. |
XRPAD_A | The A button from XR pad. |
XRPAD_B | The B button from XR pad. |
XRPAD_SQUEEZE | The squeeze button from XR pad. |
XRPAD_STICK_BUTTON | The button when pressing the XR pad's stick. |
XRPAD_STICK_X | Horizontal axis on the stick of a XR pad. |
XRPAD_STICK_Y | Vertical axis on the stick of a XR pad. |
XRPAD_TOUCHPAD_BUTTON | The button when pressing the XR pad's touchpad. |
XRPAD_TOUCHPAD_X | Horizontal axis on the touchpad of a XR pad. |
XRPAD_TOUCHPAD_Y | Vertical axis on the thouchpad of a XR pad. |
XRPAD_TRIGGER | The trigger button from XR pad. |
XRSPACE_BOUNDEDFLOOR | Bounded Floor - represents a tracking space with its native origin at the floor, where the user is expected to move within a pre-established boundary. Tracking in a bounded-floor reference space is optimized for keeping the native origin and bounds geometry stable relative to the user's environment. |
XRSPACE_LOCAL | Local - represents a tracking space with a native origin near the viewer at the time of creation. The exact position and orientation will be initialized based on the conventions of the underlying platform. When using this reference space the user is not expected to move beyond their initial position much, if at all, and tracking is optimized for that purpose. For devices with 6DoF tracking, local reference spaces should emphasize keeping the origin stable relative to the user's environment. |
XRSPACE_LOCALFLOOR | Local Floor - represents a tracking space with a native origin at the floor in a safe position for the user to stand. The y axis equals 0 at floor level, with the x and z position and orientation initialized based on the conventions of the underlying platform. Floor level value might be estimated by the underlying platform. When using this reference space, the user is not expected to move beyond their initial position much, if at all, and tracking is optimized for that purpose. For devices with 6DoF tracking, local-floor reference spaces should emphasize keeping the origin stable relative to the user's environment. |
XRSPACE_UNBOUNDED | Unbounded - represents a tracking space where the user is expected to move freely around their environment, potentially even long distances from their starting point. Tracking in an unbounded reference space is optimized for stability around the user's current position, and as such the native origin may drift over time. |
XRSPACE_VIEWER | Viewer - always supported space with some basic tracking capabilities. |
XRTARGETRAY_GAZE | Gaze - indicates the target ray will originate at the viewer and follow the direction it is facing. This is commonly referred to as a "gaze input" device in the context of head-mounted displays. |
XRTARGETRAY_POINTER | Tracked Pointer - indicates that the target ray originates from either a handheld device or other hand-tracking mechanism and represents that the user is using their hands or the held device for pointing. |
XRTARGETRAY_SCREEN | Screen - indicates that the input source was an interaction with the canvas element associated with an inline session's output context, such as a mouse click or touch event. |
XRTRACKABLE_MESH | Mesh - indicates that the hit test results will be computed based on the meshes detected by the underlying Augmented Reality system. |
XRTRACKABLE_PLANE | Plane - indicates that the hit test results will be computed based on the planes detected by the underlying Augmented Reality system. |
XRTRACKABLE_POINT | Point - indicates that the hit test results will be computed based on the feature points detected by the underlying Augmented Reality system. |
XRTYPE_AR | Immersive AR - session that provides exclusive access to VR/AR device that is intended to be blended with real-world environment. |
XRTYPE_INLINE | Inline - always available type of session. It has limited features availability and is rendered into HTML element. |
XRTYPE_VR | Immersive VR - session that provides exclusive access to VR device with best available tracking features. |
Static Methods
basisInitialize([config])
Initialize the Basis transcode worker.
Parameters
config | object | The Basis configuration. |
config.glueUrl | string | URL of glue script. |
config.wasmUrl | string | URL of the wasm module. |
config.fallbackUrl | string | URL of the fallback script to use when wasm modules aren't supported. |
config.lazyInit | boolean | Wait for first transcode request before initializing Basis (default is false). Otherwise initialize Basis immediately. |
config.numWorkers | number | Number of workers to use for transcoding (default is 1). While it is possible to improve transcode performance using multiple workers, this will likely depend on the runtime platform. For example, desktop will likely benefit from more workers compared to mobile. Also keep in mind that it takes time to initialize workers and increasing this value could impact application startup time. Make sure to test your application performance on all target platforms when changing this parameter. |
config.eagerWorkers | boolean | Use eager workers (default is true). When enabled, jobs are assigned to workers immediately, independent of their work load. This can result in unbalanced workloads, however there is no delay between jobs. If disabled, new jobs are assigned to workers only when their previous job has completed. This will result in balanced workloads across workers, however workers can be idle for a short time between jobs. |
config.rgbPriority | string[] | Array of texture compression formats in priority order for textures without alpha. The supported compressed formats are: 'astc', 'atc', 'dxt', 'etc1', 'etc2', 'pvr'. |
config.rgbaPriority | string[] | Array of texture compression formats in priority order for textures with alpha. The supported compressed formats are: 'astc', 'atc', 'dxt', 'etc1', 'etc2', 'pvr'. |
config.maxRetries | number | Number of http load retry attempts. Defaults to 5. |
calculateNormals(positions, indices)
Generates normal information from the specified positions and triangle indices. See createMesh.
const normals = pc.calculateNormals(positions, indices);
const mesh = pc.createMesh(graphicsDevice, positions, {
normals: normals,
uvs: uvs,
indices: indices
});
Parameters
positions | number[] | An array of 3-dimensional vertex positions. |
indices | number[] | An array of triangle indices. |
Returns
number[]An array of 3-dimensional vertex normals.
calculateTangents(positions, normals, uvs, indices)
Generates tangent information from the specified positions, normals, texture coordinates and triangle indices. See createMesh.
const tangents = pc.calculateTangents(positions, normals, uvs, indices);
const mesh = pc.createMesh(graphicsDevice, positions, {
normals: normals,
tangents: tangents,
uvs: uvs,
indices: indices
});
Parameters
positions | number[] | An array of 3-dimensional vertex positions. |
normals | number[] | An array of 3-dimensional vertex normals. |
uvs | number[] | An array of 2-dimensional vertex texture coordinates. |
indices | number[] | An array of triangle indices. |
Returns
number[]An array of 3-dimensional vertex tangents.
createBox(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.halfExtents | Vec3 | The half dimensions of the box in each axis (defaults to [0.5, 0.5, 0.5]). |
opts.widthSegments | number | The number of divisions along the X axis of the box (defaults to 1). |
opts.lengthSegments | number | The number of divisions along the Z axis of the box (defaults to 1). |
opts.heightSegments | number | The number of divisions along the Y axis of the box (defaults to 1). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new box-shaped mesh.
createCapsule(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.radius | number | The radius of the tube forming the body of the capsule (defaults to 0.3). |
opts.height | number | The length of the body of the capsule from tip to tip (defaults to 1.0). |
opts.heightSegments | number | The number of divisions along the tubular length of the capsule (defaults to 1). |
opts.sides | number | The number of divisions around the tubular body of the capsule (defaults to 20). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new cylinder-shaped mesh.
createCone(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.baseRadius | number | The base radius of the cone (defaults to 0.5). |
opts.peakRadius | number | The peak radius of the cone (defaults to 0.0). |
opts.height | number | The length of the body of the cone (defaults to 1.0). |
opts.heightSegments | number | The number of divisions along the length of the cone (defaults to 5). |
opts.capSegments | number | The number of divisions around the tubular body of the cone (defaults to 18). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new cone-shaped mesh.
createCylinder(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.radius | number | The radius of the tube forming the body of the cylinder (defaults to 0.5). |
opts.height | number | The length of the body of the cylinder (defaults to 1.0). |
opts.heightSegments | number | The number of divisions along the length of the cylinder (defaults to 5). |
opts.capSegments | number | The number of divisions around the tubular body of the cylinder (defaults to 20). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new cylinder-shaped mesh.
createGraphicsDevice(canvas, options)
Creates a graphics device.
Parameters
canvas | HTMLCanvasElement | The canvas element. |
options | object | Graphics device options. |
options.deviceTypes | string[] | An array of DEVICETYPE_*** constants, defining the order in which the devices are attempted to get created. Defaults to an empty array. If the specified array does not contain [DEVICETYPE_WEBGL2 or DEVICETYPE_WEBGL1], those are internally added to its end in this order. Typically, you'd only specify DEVICETYPE_WEBGPU, or leave it empty. |
options.antialias | boolean | Boolean that indicates whether or not to perform anti-aliasing if possible. Defaults to true. |
options.depth | boolean | Boolean that indicates that the drawing buffer is requested to have a depth buffer of at least 16 bits. Defaults to true. |
options.stencil | boolean | Boolean that indicates that the drawing buffer is requested to have a stencil buffer of at least 8 bits. Defaults to true. |
options.glslangUrl | string | The URL to the glslang script. Required if the DEVICETYPE_WEBGPU type is added to deviceTypes array. Not used for DEVICETYPE_WEBGL1 or DEVICETYPE_WEBGL2 device type creation. |
options.twgslUrl | string | An url to twgsl script, required if glslangUrl was specified. |
options.xrCompatible | boolean | Boolean that hints to the user agent to use a compatible graphics adapter for an immersive XR device. |
options.powerPreference | 'default', 'high-performance', 'low-power' | A hint indicating what configuration of GPU would be selected. Possible values are:
Defaults to 'default'. |
Returns
Promise- Promise object representing the created graphics device.
createMesh(device, positions, [opts])
Creates a new mesh object from the supplied vertex information and topology.
// Create a simple, indexed triangle (with texture coordinates and vertex normals)
const mesh = pc.createMesh(graphicsDevice, [0, 0, 0, 1, 0, 0, 0, 1, 0], {
normals: [0, 0, 1, 0, 0, 1, 0, 0, 1],
uvs: [0, 0, 1, 0, 0, 1],
indices: [0, 1, 2]
});
Parameters
device | GraphicsDevice | The graphics device used to manage the mesh. |
positions | number[] | An array of 3-dimensional vertex positions. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.normals | number[] | An array of 3-dimensional vertex normals. |
opts.tangents | number[] | An array of 3-dimensional vertex tangents. |
opts.colors | number[] | An array of 4-dimensional vertex colors where each component is an integer in the range 0 to 255. |
opts.uvs | number[] | An array of 2-dimensional vertex texture coordinates. |
opts.uvs1 | number[] | Same as opts.uvs, but for additional UV set |
opts.blendIndices | number[] | An array of 4-dimensional bone indices where each component is an integer in the range 0 to 255. |
opts.blendWeights | number[] | An array of 4-dimensional bone weights where each component is in the range 0 to 1 and the sum of the weights should equal 1. |
opts.indices | number[] | An array of triangle indices. |
Returns
MeshA new Mesh constructed from the supplied vertex and triangle data.
createPlane(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.halfExtents | Vec2 | The half dimensions of the plane in the X and Z axes (defaults to [0.5, 0.5]). |
opts.widthSegments | number | The number of divisions along the X axis of the plane (defaults to 5). |
opts.lengthSegments | number | The number of divisions along the Z axis of the plane (defaults to 5). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new plane-shaped mesh.
createScript(name, [app])
Create and register a new ScriptType. It returns new class type (constructor function), which is auto-registered to ScriptRegistry using its name. This is the main interface to create Script Types, to define custom logic using JavaScript, that is used to create interaction for entities.
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);
};
Parameters
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 |
app | AppBase | Optional application handler, to choose which ScriptRegistry
to add a script to. By default it will use |
Returns
typeof(ScriptType), nullA class type (constructor function) that inherits ScriptType, which the developer is meant to further extend by adding attributes and prototype methods. Returns null if there was an error.
createShader(device, vsName, fsName, [useTransformFeedback])
Create a shader from named shader chunks.
Parameters
device | GraphicsDevice | The graphics device. |
vsName | string | The vertex shader chunk name. |
fsName | string | The fragment shader chunk name. |
useTransformFeedback | boolean | Whether to use transform feedback. Defaults to false. |
Returns
ShaderThe newly created shader.
createShaderFromCode(device, vsCode, fsCode, uniqueName, [attributes], [useTransformFeedback])
Create a shader from the supplied source code. Note that this function adds additional shader blocks to both vertex and fragment shaders, which allow the shader to use more features and compile on both WebGL and WebGPU. Specifically, these blocks are added, and should not be part of provided vsCode and fsCode: shader version, shader precision, commonly used extensions.
Parameters
device | GraphicsDevice | The graphics device. |
vsCode | string | The vertex shader code. |
fsCode | string | The fragment shader code. |
uniqueName | string | Unique name for the shader. If a shader with this name already exists, it will be returned instead of a new shader instance. |
attributes | { [string]: string } | Object detailing the mapping of vertex shader attribute names to semantics SEMANTIC_*. This enables the engine to match vertex buffer data as inputs to the shader. Defaults to undefined, which generates the default attributes. |
useTransformFeedback | boolean | Whether to use transform feedback. Defaults to false. |
Returns
ShaderThe newly created shader.
createSphere(device, [opts])
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 centered 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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.radius | number | The radius of the sphere (defaults to 0.5). |
opts.latitudeBands | number | The number of divisions along the latitudinal axis of the sphere (defaults to 16). |
opts.longitudeBands | number | The number of divisions along the longitudinal axis of the sphere (defaults to 16). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new sphere-shaped mesh.
createTorus(device, [opts])
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
device | GraphicsDevice | The graphics device used to manage the mesh. |
opts | object | An object that specifies optional inputs for the function as follows: |
opts.tubeRadius | number | The radius of the tube forming the body of the torus (defaults to 0.2). |
opts.ringRadius | number | The radius from the centre of the torus to the centre of the tube (defaults to 0.3). |
opts.segments | number | The number of radial divisions forming cross-sections of the torus ring (defaults to 20). |
opts.sides | number | The number of divisions around the tubular body of the torus ring (defaults to 30). |
opts.calculateTangents | boolean | Generate tangent information (defaults to false). |
Returns
MeshA new torus-shaped mesh.
dracoInitialize([config])
Initialize the Draco mesh decoder.
Parameters
config | object | The Draco decoder configuration. |
config.jsUrl | string | URL of glue script. |
config.wasmUrl | string | URL of the wasm module. |
config.numWorkers | number | Number of workers to use for decoding (default is 1). |
config.lazyInit | boolean | Wait for first decode request before initializing workers (default is false). Otherwise initialize workers immediately. |
drawQuadWithShader(device, target, shader, [rect], [scissorRect])
Draws a screen-space quad using a specific shader.
Parameters
device | GraphicsDevice | The graphics device used to draw the quad. |
target | RenderTarget, null | The destination render target. If undefined, target is the frame buffer. |
shader | Shader | The shader used for rendering the quad. Vertex
shader should contain |
rect | Vec4 | The viewport rectangle of the quad, in
pixels. Defaults to fullscreen ( |
scissorRect | Vec4 | The scissor rectangle of the
quad, in pixels. Defaults to fullscreen ( |
drawTexture(device, texture, [target], [shader], [rect], [scissorRect])
Draws a texture in screen-space. Mostly used by post-effects.
Parameters
device | GraphicsDevice | The graphics device used to draw the texture. |
texture | Texture | The source texture to be drawn. Accessible as
|
target | RenderTarget | The destination render target. Defaults to the frame buffer. |
shader | Shader | The optional custom shader used for rendering the texture. |
rect | Vec4 | The viewport rectangle to use for the
texture, in pixels. Defaults to fullscreen ( |
scissorRect | Vec4 | The scissor rectangle to use for
the texture, in pixels. Defaults to fullscreen ( |
getTouchTargetCoords(touch)
This function takes a browser Touch object and returns the coordinates of the touch relative to the target DOM element.
Parameters
touch | globalThis.Touch | The browser Touch object. |
Returns
objectThe coordinates of the touch relative to the touch.target DOM element. In the format {x, y}.
registerScript(script, [name], [app])
Register a existing class type as a Script Type to ScriptRegistry. Useful when defining a ES6 script class that extends ScriptType (see example).
// define a ES6 script class
class PlayerController extends pc.ScriptType {
initialize() {
// called once on initialize
}
update(dt) {
// called each tick
}
}
// register the class as a script
pc.registerScript(PlayerController);
// declare script attributes (Must be after pc.registerScript())
PlayerController.attributes.add('attribute1', {type: 'number'});
Parameters
script | typeof(ScriptType) | The existing class type (constructor function) to be registered as a Script Type. Class must extend ScriptType (see example). Please note: A class created using createScript is auto-registered, and should therefore not be pass into registerScript (which would result in swapping out all related script instances). |
name | string | Optional unique name of the Script Type. By default it will use the
same name as the existing class. If a Script Type with the same name has already been registered
and the new one has a |
app | AppBase | Optional application handler, to choose which ScriptRegistry
to register the script type to. By default it will use |
reprojectTexture(source, target, [options])
This function reprojects textures between cubemap, equirectangular and octahedral formats. The function can read and write textures with pixel data in RGBE, RGBM, linear and sRGB formats. When specularPower is specified it will perform a phong-weighted convolution of the source (for generating a gloss maps).
Parameters
source | Texture | The source texture. |
target | Texture | The target texture. |
options | object | The options object. |
options.specularPower | number | Optional specular power. When specular power is specified, the source is convolved by a phong-weighted kernel raised to the specified power. Otherwise the function performs a standard resample. |
options.numSamples | number | Optional number of samples (default is 1024). |
options.face | number | Optional cubemap face to update (default is update all faces). |
options.distribution | string | Specify convolution distribution - 'none', 'lambert', 'phong', 'ggx'. Default depends on specularPower. |
options.rect | Vec4 | Optional viewport rectangle. |
options.seamPixels | number | Optional number of seam pixels to render |