UNPKG

playcanvas

Version:

PlayCanvas WebGL game engine

1,039 lines (1,038 loc) 23.6 kB
/** * Subtract the color of the source fragment from the destination fragment and write the result to * the frame buffer. * * @type {number} * @category Graphics */ export const BLEND_SUBTRACTIVE: number; /** * Add the color of the source fragment to the destination fragment and write the result to the * frame buffer. * * @type {number} * @category Graphics */ export const BLEND_ADDITIVE: number; /** * Enable simple translucency for materials such as glass. This is equivalent to enabling a source * blend mode of {@link BLENDMODE_SRC_ALPHA} and a destination blend mode of * {@link BLENDMODE_ONE_MINUS_SRC_ALPHA}. * * @type {number} * @category Graphics */ export const BLEND_NORMAL: number; /** * Disable blending. * * @type {number} * @category Graphics */ export const BLEND_NONE: number; /** * Similar to {@link BLEND_NORMAL} expect the source fragment is assumed to have already been * multiplied by the source alpha value. * * @type {number} * @category Graphics */ export const BLEND_PREMULTIPLIED: number; /** * Multiply the color of the source fragment by the color of the destination fragment and write the * result to the frame buffer. * * @type {number} * @category Graphics */ export const BLEND_MULTIPLICATIVE: number; /** * Same as {@link BLEND_ADDITIVE} except the source RGB is multiplied by the source alpha. * * @type {number} * @category Graphics */ export const BLEND_ADDITIVEALPHA: number; /** * Multiplies colors and doubles the result. * * @type {number} * @category Graphics */ export const BLEND_MULTIPLICATIVE2X: number; /** * Softer version of additive. * * @type {number} * @category Graphics */ export const BLEND_SCREEN: number; /** * Minimum color. * * @type {number} * @category Graphics */ export const BLEND_MIN: number; /** * Maximum color. * * @type {number} * @category Graphics */ export const BLEND_MAX: number; export const blendNames: { [BLEND_SUBTRACTIVE]: string; [BLEND_ADDITIVE]: string; [BLEND_NORMAL]: string; [BLEND_NONE]: string; [BLEND_PREMULTIPLIED]: string; [BLEND_MULTIPLICATIVE]: string; [BLEND_ADDITIVEALPHA]: string; [BLEND_MULTIPLICATIVE2X]: string; [BLEND_SCREEN]: string; [BLEND_MIN]: string; [BLEND_MAX]: string; }; /** * No fog is applied to the scene. * * @type {string} * @category Graphics */ export const FOG_NONE: string; /** * Fog rises linearly from zero to 1 between a start and end depth. * * @type {string} * @category Graphics */ export const FOG_LINEAR: string; /** * Fog rises according to an exponential curve controlled by a density value. * * @type {string} * @category Graphics */ export const FOG_EXP: string; /** * Fog rises according to an exponential curve controlled by a density value. * * @type {string} * @category Graphics */ export const FOG_EXP2: string; /** * No Fresnel. * * @type {number} * @category Graphics */ export const FRESNEL_NONE: number; /** * Schlick's approximation of Fresnel. * * @type {number} * @category Graphics */ export const FRESNEL_SCHLICK: number; export const fresnelNames: { [FRESNEL_NONE]: string; [FRESNEL_SCHLICK]: string; }; export const LAYER_HUD: 0; export const LAYER_GIZMO: 1; export const LAYER_WORLD: 15; /** * The world layer. * * @type {number} * @category Graphics */ export const LAYERID_WORLD: number; /** * The depth layer. * * @type {number} * @category Graphics */ export const LAYERID_DEPTH: number; /** * The skybox layer. * * @type {number} * @category Graphics */ export const LAYERID_SKYBOX: number; /** * The immediate layer. * * @type {number} * @category Graphics */ export const LAYERID_IMMEDIATE: number; /** * The UI layer. * * @type {number} * @category Graphics */ export const LAYERID_UI: number; /** * Directional (global) light source. * * @type {number} * @category Graphics */ export const LIGHTTYPE_DIRECTIONAL: number; /** * Omni-directional (local) light source. * * @type {number} * @category Graphics */ export const LIGHTTYPE_OMNI: number; /** * Point (local) light source. * * @type {number} * @ignore * @category Graphics */ export const LIGHTTYPE_POINT: number; /** * Spot (local) light source. * * @type {number} * @category Graphics */ export const LIGHTTYPE_SPOT: number; export const LIGHTTYPE_COUNT: 3; export const lightTypeNames: { [LIGHTTYPE_DIRECTIONAL]: string; [LIGHTTYPE_OMNI]: string; [LIGHTTYPE_SPOT]: string; }; /** * Infinitesimally small point light source shape. * * @type {number} * @category Graphics */ export const LIGHTSHAPE_PUNCTUAL: number; /** * Rectangle shape of light source. * * @type {number} * @category Graphics */ export const LIGHTSHAPE_RECT: number; /** * Disk shape of light source. * * @type {number} * @category Graphics */ export const LIGHTSHAPE_DISK: number; /** * Sphere shape of light source. * * @type {number} * @category Graphics */ export const LIGHTSHAPE_SPHERE: number; export const lightShapeNames: { [LIGHTSHAPE_PUNCTUAL]: string; [LIGHTSHAPE_RECT]: string; [LIGHTSHAPE_DISK]: string; [LIGHTSHAPE_SPHERE]: string; }; /** * Linear distance falloff model for light attenuation. * * @type {number} * @category Graphics */ export const LIGHTFALLOFF_LINEAR: number; /** * Inverse squared distance falloff model for light attenuation. * * @type {number} * @category Graphics */ export const LIGHTFALLOFF_INVERSESQUARED: number; export const lightFalloffNames: { [LIGHTFALLOFF_LINEAR]: string; [LIGHTFALLOFF_INVERSESQUARED]: string; }; /** * A shadow sampling technique using 32bit shadow map that averages depth comparisons from a 3x3 * grid of texels for softened shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF3_32F: number; /** * @deprecated * @ignore */ export const SHADOW_PCF3: 0; /** * A shadow sampling technique using a 16-bit exponential variance shadow map that leverages * variance to approximate shadow boundaries, enabling soft shadows. Only supported when * {@link GraphicsDevice#textureHalfFloatRenderable} is true. Falls back to {@link SHADOW_PCF3_32F}, * if not supported. * * @type {number} * @category Graphics */ export const SHADOW_VSM_16F: number; /** * @deprecated * @ignore */ export const SHADOW_VSM16: 2; /** * A shadow sampling technique using a 32-bit exponential variance shadow map that leverages * variance to approximate shadow boundaries, enabling soft shadows. Only supported when * {@link GraphicsDevice#textureFloatRenderable} is true. Falls back to {@link SHADOW_VSM_16F}, if * not supported. * * @type {number} * @category Graphics */ export const SHADOW_VSM_32F: number; /** * @deprecated * @ignore */ export const SHADOW_VSM32: 3; /** * A shadow sampling technique using 32bit shadow map that averages depth comparisons from a 5x5 * grid of texels for softened shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF5_32F: number; /** * @deprecated * @ignore */ export const SHADOW_PCF5: 4; /** * A shadow sampling technique using a 32-bit shadow map that performs a single depth comparison for * sharp shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF1_32F: number; /** * @deprecated * @ignore */ export const SHADOW_PCF1: 5; /** * A shadow sampling technique using a 32-bit shadow map that adjusts filter size based on blocker * distance, producing realistic, soft shadow edges that vary with the light's occlusion. Note that * this technique requires either {@link GraphicsDevice#textureFloatRenderable} or * {@link GraphicsDevice#textureHalfFloatRenderable} to be true, and falls back to * {@link SHADOW_PCF3_32F} otherwise. * * @type {number} * @category Graphics */ export const SHADOW_PCSS_32F: number; /** * A shadow sampling technique using a 16-bit shadow map that performs a single depth comparison for * sharp shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF1_16F: number; /** * A shadow sampling technique using 16-bit shadow map that averages depth comparisons from a 3x3 * grid of texels for softened shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF3_16F: number; /** * A shadow sampling technique using 16-bit shadow map that averages depth comparisons from a 3x3 * grid of texels for softened shadow edges. * * @type {number} * @category Graphics */ export const SHADOW_PCF5_16F: number; /** * Information about shadow types. * * @type {Map<number, { name: string, format: number, pcf?: boolean, vsm?: boolean }>} * @ignore */ export const shadowTypeInfo: Map<number, { name: string; format: number; pcf?: boolean; vsm?: boolean; }>; /** * Box filter. * * @type {number} * @category Graphics */ export const BLUR_BOX: number; /** * Gaussian filter. May look smoother than box, but requires more samples. * * @type {number} * @category Graphics */ export const BLUR_GAUSSIAN: number; /** * No sorting, particles are drawn in arbitrary order. Can be simulated on GPU. * * @type {number} * @category Graphics */ export const PARTICLESORT_NONE: number; /** * Sorting based on distance to the camera. CPU only. * * @type {number} * @category Graphics */ export const PARTICLESORT_DISTANCE: number; /** * Newer particles are drawn first. CPU only. * * @type {number} * @category Graphics */ export const PARTICLESORT_NEWER_FIRST: number; /** * Older particles are drawn first. CPU only. * * @type {number} * @category Graphics */ export const PARTICLESORT_OLDER_FIRST: number; export const PARTICLEMODE_GPU: 0; export const PARTICLEMODE_CPU: 1; /** * Box shape parameterized by emitterExtents. Initial velocity is directed towards local Z axis. * * @type {number} * @category Graphics */ export const EMITTERSHAPE_BOX: number; /** * Sphere shape parameterized by emitterRadius. Initial velocity is directed outwards from the * center. * * @type {number} * @category Graphics */ export const EMITTERSHAPE_SPHERE: number; /** * Particles are facing camera. * * @type {number} * @category Graphics */ export const PARTICLEORIENTATION_SCREEN: number; /** * User defines world space normal (particleNormal) to set planes orientation. * * @type {number} * @category Graphics */ export const PARTICLEORIENTATION_WORLD: number; /** * Similar to previous, but the normal is affected by emitter(entity) transformation. * * @type {number} * @category Graphics */ export const PARTICLEORIENTATION_EMITTER: number; /** * A perspective camera projection where the frustum shape is essentially pyramidal. * * @type {number} * @category Graphics */ export const PROJECTION_PERSPECTIVE: number; /** * An orthographic camera projection where the frustum shape is essentially a cuboid. * * @type {number} * @category Graphics */ export const PROJECTION_ORTHOGRAPHIC: number; /** * Render mesh instance as solid geometry. * * @type {number} * @category Graphics */ export const RENDERSTYLE_SOLID: number; /** * Render mesh instance as wireframe. * * @type {number} * @category Graphics */ export const RENDERSTYLE_WIREFRAME: number; /** * Render mesh instance as points. * * @type {number} * @category Graphics */ export const RENDERSTYLE_POINTS: number; /** * The cube map is treated as if it is infinitely far away. * * @type {number} * @category Graphics */ export const CUBEPROJ_NONE: number; /** * The cube map is box-projected based on a world space axis-aligned bounding box. * * @type {number} * @category Graphics */ export const CUBEPROJ_BOX: number; export const cubemaProjectionNames: { [CUBEPROJ_NONE]: string; [CUBEPROJ_BOX]: string; }; /** * Multiply together the primary and secondary colors. * * @type {string} * @category Graphics */ export const DETAILMODE_MUL: string; /** * Add together the primary and secondary colors. * * @type {string} * @category Graphics */ export const DETAILMODE_ADD: string; /** * Softer version of {@link DETAILMODE_ADD}. * * @type {string} * @category Graphics */ export const DETAILMODE_SCREEN: string; /** * Multiplies or screens the colors, depending on the primary color. * * @type {string} * @category Graphics */ export const DETAILMODE_OVERLAY: string; /** * Select whichever of the primary and secondary colors is darker, component-wise. * * @type {string} * @category Graphics */ export const DETAILMODE_MIN: string; /** * Select whichever of the primary and secondary colors is lighter, component-wise. * * @type {string} * @category Graphics */ export const DETAILMODE_MAX: string; /** * No gamma correction. * * @type {number} * @category Graphics */ export const GAMMA_NONE: number; /** * Apply sRGB gamma correction. * * @type {number} * @category Graphics */ export const GAMMA_SRGB: number; export const gammaNames: { [GAMMA_NONE]: string; [GAMMA_SRGB]: string; }; /** * Linear tonemapping. The colors are preserved, but the exposure is applied. * * @type {number} * @category Graphics */ export const TONEMAP_LINEAR: number; /** * Filmic tonemapping curve. * * @type {number} * @category Graphics */ export const TONEMAP_FILMIC: number; /** * Hejl filmic tonemapping curve. * * @type {number} * @category Graphics */ export const TONEMAP_HEJL: number; /** * ACES filmic tonemapping curve. * * @type {number} * @category Graphics */ export const TONEMAP_ACES: number; /** * ACES v2 filmic tonemapping curve. * * @type {number} * @category Graphics */ export const TONEMAP_ACES2: number; /** * Khronos PBR Neutral tonemapping curve. * * @type {number} * @category Graphics */ export const TONEMAP_NEUTRAL: number; /** * No tonemapping or exposure is applied. Used for HDR rendering. * * @type {number} * @category Graphics */ export const TONEMAP_NONE: number; export const tonemapNames: string[]; /** * No specular occlusion. * * @type {number} * @category Graphics */ export const SPECOCC_NONE: number; /** * Use AO directly to occlude specular. * * @type {number} * @category Graphics */ export const SPECOCC_AO: number; /** * Modify AO based on material glossiness/view angle to occlude specular. * * @type {number} * @category Graphics */ export const SPECOCC_GLOSSDEPENDENT: number; export const specularOcclusionNames: { [SPECOCC_NONE]: string; [SPECOCC_AO]: string; [SPECOCC_GLOSSDEPENDENT]: string; }; export const REFLECTIONSRC_NONE: "none"; export const REFLECTIONSRC_ENVATLAS: "envAtlas"; export const REFLECTIONSRC_ENVATLASHQ: "envAtlasHQ"; export const REFLECTIONSRC_CUBEMAP: "cubeMap"; export const REFLECTIONSRC_SPHEREMAP: "sphereMap"; export namespace reflectionSrcNames { let none: string; let envAtlas: string; let envAtlasHQ: string; let cubeMap: string; let sphereMap: string; } export const AMBIENTSRC_AMBIENTSH: "ambientSH"; export const AMBIENTSRC_ENVALATLAS: "envAtlas"; export const AMBIENTSRC_CONSTANT: "constant"; export namespace ambientSrcNames { export let ambientSH: string; let envAtlas_1: string; export { envAtlas_1 as envAtlas }; export let constant: string; } export const SHADERDEF_NOSHADOW: 1; export const SHADERDEF_SKIN: 2; export const SHADERDEF_UV0: 4; export const SHADERDEF_UV1: 8; export const SHADERDEF_VCOLOR: 16; export const SHADERDEF_INSTANCING: 32; export const SHADERDEF_LM: 64; export const SHADERDEF_DIRLM: 128; export const SHADERDEF_SCREENSPACE: 256; export const SHADERDEF_TANGENTS: 512; export const SHADERDEF_MORPH_POSITION: 1024; export const SHADERDEF_MORPH_NORMAL: 2048; export const SHADERDEF_LMAMBIENT: 4096; export const SHADERDEF_MORPH_TEXTURE_BASED_INT: 8192; export const SHADERDEF_BATCH: 16384; /** * The shadow map is not to be updated. * * @type {number} * @category Graphics */ export const SHADOWUPDATE_NONE: number; /** * The shadow map is regenerated this frame and not on subsequent frames. * * @type {number} * @category Graphics */ export const SHADOWUPDATE_THISFRAME: number; /** * The shadow map is regenerated every frame. * * @type {number} * @category Graphics */ export const SHADOWUPDATE_REALTIME: number; export const MASK_AFFECT_DYNAMIC: 1; export const MASK_AFFECT_LIGHTMAPPED: 2; export const MASK_BAKE: 4; /** * Render shaded materials using forward rendering. * * @type {number} * @category Graphics */ export const SHADER_FORWARD: number; export const SHADER_PREPASS: 1; /** * Render RGBA-encoded depth value. * * @type {number} * @category Graphics */ export const SHADER_DEPTH: number; export const SHADER_PICK: 3; export const SHADER_SHADOW: 4; /** * Shader that performs forward rendering. * * @type {string} * @category Graphics */ export const SHADERPASS_FORWARD: string; /** * Shader used for debug rendering of albedo. * * @type {string} * @category Graphics */ export const SHADERPASS_ALBEDO: string; /** * Shader used for debug rendering of world normal. * * @type {string} * @category Graphics */ export const SHADERPASS_WORLDNORMAL: string; /** * Shader used for debug rendering of opacity. * * @type {string} * @category Graphics */ export const SHADERPASS_OPACITY: string; /** * Shader used for debug rendering of specularity. * * @type {string} * @category Graphics */ export const SHADERPASS_SPECULARITY: string; /** * Shader used for debug rendering of gloss. * * @type {string} * @category Graphics */ export const SHADERPASS_GLOSS: string; /** * Shader used for debug rendering of metalness. * * @type {string} * @category Graphics */ export const SHADERPASS_METALNESS: string; /** * Shader used for debug rendering of ao. * * @type {string} * @category Graphics */ export const SHADERPASS_AO: string; /** * Shader used for debug rendering of emission. * * @type {string} * @category Graphics */ export const SHADERPASS_EMISSION: string; /** * Shader used for debug rendering of lighting. * * @type {string} * @category Graphics */ export const SHADERPASS_LIGHTING: string; /** * Shader used for debug rendering of UV0 texture coordinates. * * @type {string} * @category Graphics */ export const SHADERPASS_UV0: string; /** * This mode renders a sprite as a simple quad. * * @type {number} * @category Graphics */ export const SPRITE_RENDERMODE_SIMPLE: number; /** * 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. * * @type {number} * @category Graphics */ export const SPRITE_RENDERMODE_SLICED: number; /** * 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. * * @type {number} * @category Graphics */ export const SPRITE_RENDERMODE_TILED: number; export const spriteRenderModeNames: { [SPRITE_RENDERMODE_SIMPLE]: string; [SPRITE_RENDERMODE_SLICED]: string; [SPRITE_RENDERMODE_TILED]: string; }; /** * Single color lightmap. * * @type {number} * @category Graphics */ export const BAKE_COLOR: number; /** * Single color lightmap + dominant light direction (used for bump/specular). * * @type {number} * @category Graphics */ export const BAKE_COLORDIR: number; /** * Center of view. * * @type {number} * @category Graphics */ export const VIEW_CENTER: number; /** * Left of view. Only used in stereo rendering. * * @type {number} * @category Graphics */ export const VIEW_LEFT: number; /** * Right of view. Only used in stereo rendering. * * @type {number} * @category Graphics */ export const VIEW_RIGHT: number; /** * No sorting is applied. Mesh instances are rendered in the same order they were added to a layer. * * @type {number} * @category Graphics */ export const SORTMODE_NONE: number; /** * Mesh instances are sorted based on {@link MeshInstance#drawOrder}. * * @type {number} * @category Graphics */ export const SORTMODE_MANUAL: number; /** * Mesh instances are sorted to minimize switching between materials and meshes to improve * rendering performance. * * @type {number} * @category Graphics */ export const SORTMODE_MATERIALMESH: number; /** * 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. * * @type {number} * @category Graphics */ export const SORTMODE_BACK2FRONT: number; /** * Mesh instances are sorted front to back. Depending on GPU and the scene, this option may give * better performance than {@link SORTMODE_MATERIALMESH} due to reduced overdraw. * * @type {number} * @category Graphics */ export const SORTMODE_FRONT2BACK: number; /** * Provide custom functions for sorting drawcalls and calculating distance. * * @type {number} * @ignore * @category Graphics */ export const SORTMODE_CUSTOM: number; /** * Automatically set aspect ratio to current render target's width divided by height. * * @type {number} * @category Graphics */ export const ASPECT_AUTO: number; /** * Use the manual aspect ratio value. * * @type {number} * @category Graphics */ export const ASPECT_MANUAL: number; /** * Horizontal orientation. * * @type {number} * @category Graphics */ export const ORIENTATION_HORIZONTAL: number; /** * Vertical orientation. * * @type {number} * @category Graphics */ export const ORIENTATION_VERTICAL: number; /** * A sky texture is rendered using an infinite projection. * * @type {string} * @category Graphics */ export const SKYTYPE_INFINITE: string; /** * A sky texture is rendered using a box projection. This is generally suitable for interior * environments. * * @type {string} * @category Graphics */ export const SKYTYPE_BOX: string; /** * A sky texture is rendered using a dome projection. This is generally suitable for exterior * environments. * * @type {string} * @category Graphics */ export const SKYTYPE_DOME: string; /** * Opacity dithering is disabled. * * @type {string} * @category Graphics */ export const DITHER_NONE: string; /** * Opacity is dithered using a Bayer 8 matrix. * * @type {string} * @category Graphics */ export const DITHER_BAYER8: string; /** * Opacity is dithered using a blue noise. * * @type {string} * @category Graphics */ export const DITHER_BLUENOISE: string; /** * Opacity is dithered using an interleaved gradient noise. * * @type {string} * @category Graphics */ export const DITHER_IGNNOISE: string; /** * Name of event fired before the camera renders the scene. * * @type {string} * @ignore */ export const EVENT_PRERENDER: string; /** * Name of event fired after the camera renders the scene. * * @type {string} * @ignore */ export const EVENT_POSTRENDER: string; /** * Name of event fired before a layer is rendered by a camera. * * @type {string} * @ignore */ export const EVENT_PRERENDER_LAYER: string; /** * Name of event fired after a layer is rendered by a camera. * * @type {string} * @ignore */ export const EVENT_POSTRENDER_LAYER: string; /** * Name of event fired before visibility culling is performed for the camera * * @type {string} * @ignore */ export const EVENT_PRECULL: string; /** * Name of event after before visibility culling is performed for the camera * * @type {string} * @ignore */ export const EVENT_POSTCULL: string;