UNPKG

@itwin/core-frontend

Version:
250 lines • 18.4 kB
/*--------------------------------------------------------------------------------------------- * Copyright (c) Bentley Systems, Incorporated. All rights reserved. * See LICENSE.md in the project root for license terms and full copyright notice. *--------------------------------------------------------------------------------------------*/ /** @packageDocumentation * @module WebGL */ if (typeof (WebGLRenderingContext) === "undefined") { global.WebGLRenderingContext = new Proxy({}, { get: () => 0 }); } /** @internal */ export var GL; (function (GL) { let BlendEquation; (function (BlendEquation) { BlendEquation[BlendEquation["Add"] = WebGLRenderingContext.FUNC_ADD] = "Add"; BlendEquation[BlendEquation["Subtract"] = WebGLRenderingContext.FUNC_SUBTRACT] = "Subtract"; BlendEquation[BlendEquation["ReverseSubtract"] = WebGLRenderingContext.FUNC_REVERSE_SUBTRACT] = "ReverseSubtract"; BlendEquation[BlendEquation["Default"] = BlendEquation.Add] = "Default"; })(BlendEquation = GL.BlendEquation || (GL.BlendEquation = {})); let BlendFactor; (function (BlendFactor) { BlendFactor[BlendFactor["Zero"] = WebGLRenderingContext.ZERO] = "Zero"; BlendFactor[BlendFactor["One"] = WebGLRenderingContext.ONE] = "One"; BlendFactor[BlendFactor["SrcColor"] = WebGLRenderingContext.SRC_COLOR] = "SrcColor"; BlendFactor[BlendFactor["OneMinusSrcColor"] = WebGLRenderingContext.ONE_MINUS_SRC_COLOR] = "OneMinusSrcColor"; BlendFactor[BlendFactor["DstColor"] = WebGLRenderingContext.DST_COLOR] = "DstColor"; BlendFactor[BlendFactor["OneMinusDstColor"] = WebGLRenderingContext.ONE_MINUS_DST_COLOR] = "OneMinusDstColor"; BlendFactor[BlendFactor["SrcAlpha"] = WebGLRenderingContext.SRC_ALPHA] = "SrcAlpha"; BlendFactor[BlendFactor["OneMinusSrcAlpha"] = WebGLRenderingContext.ONE_MINUS_SRC_ALPHA] = "OneMinusSrcAlpha"; BlendFactor[BlendFactor["DstAlpha"] = WebGLRenderingContext.DST_ALPHA] = "DstAlpha"; BlendFactor[BlendFactor["OneMinusDstAlpha"] = WebGLRenderingContext.ONE_MINUS_DST_ALPHA] = "OneMinusDstAlpha"; BlendFactor[BlendFactor["ConstColor"] = WebGLRenderingContext.CONSTANT_COLOR] = "ConstColor"; BlendFactor[BlendFactor["OneMinusConstColor"] = WebGLRenderingContext.ONE_MINUS_CONSTANT_COLOR] = "OneMinusConstColor"; BlendFactor[BlendFactor["ConstAlpha"] = WebGLRenderingContext.CONSTANT_ALPHA] = "ConstAlpha"; BlendFactor[BlendFactor["OneMinusConstAlpha"] = WebGLRenderingContext.ONE_MINUS_CONSTANT_ALPHA] = "OneMinusConstAlpha"; BlendFactor[BlendFactor["AlphaSaturate"] = WebGLRenderingContext.SRC_ALPHA_SATURATE] = "AlphaSaturate"; BlendFactor[BlendFactor["DefaultSrc"] = BlendFactor.One] = "DefaultSrc"; BlendFactor[BlendFactor["DefaultDst"] = BlendFactor.Zero] = "DefaultDst"; })(BlendFactor = GL.BlendFactor || (GL.BlendFactor = {})); let Buffer; (function (Buffer) { let Target; (function (Target) { Target[Target["ArrayBuffer"] = WebGLRenderingContext.ARRAY_BUFFER] = "ArrayBuffer"; Target[Target["ElementArrayBuffer"] = WebGLRenderingContext.ELEMENT_ARRAY_BUFFER] = "ElementArrayBuffer"; })(Target = Buffer.Target || (Buffer.Target = {})); let Binding; (function (Binding) { Binding[Binding["ArrayBuffer"] = WebGLRenderingContext.ARRAY_BUFFER_BINDING] = "ArrayBuffer"; Binding[Binding["ElementArrayBuffer"] = WebGLRenderingContext.ELEMENT_ARRAY_BUFFER_BINDING] = "ElementArrayBuffer"; })(Binding = Buffer.Binding || (Buffer.Binding = {})); let Parameter; (function (Parameter) { Parameter[Parameter["Size"] = WebGLRenderingContext.BUFFER_SIZE] = "Size"; Parameter[Parameter["Usage"] = WebGLRenderingContext.BUFFER_USAGE] = "Usage"; })(Parameter = Buffer.Parameter || (Buffer.Parameter = {})); let Usage; (function (Usage) { Usage[Usage["DynamicDraw"] = WebGLRenderingContext.DYNAMIC_DRAW] = "DynamicDraw"; Usage[Usage["StaticDraw"] = WebGLRenderingContext.STATIC_DRAW] = "StaticDraw"; Usage[Usage["StreamDraw"] = WebGLRenderingContext.STREAM_DRAW] = "StreamDraw"; })(Usage = Buffer.Usage || (Buffer.Usage = {})); })(Buffer = GL.Buffer || (GL.Buffer = {})); let StencilOperation; (function (StencilOperation) { StencilOperation[StencilOperation["Keep"] = WebGLRenderingContext.KEEP] = "Keep"; StencilOperation[StencilOperation["Zero"] = WebGLRenderingContext.ZERO] = "Zero"; StencilOperation[StencilOperation["Replace"] = WebGLRenderingContext.REPLACE] = "Replace"; StencilOperation[StencilOperation["Incr"] = WebGLRenderingContext.INCR] = "Incr"; StencilOperation[StencilOperation["IncrWrap"] = WebGLRenderingContext.INCR_WRAP] = "IncrWrap"; StencilOperation[StencilOperation["Decr"] = WebGLRenderingContext.DECR] = "Decr"; StencilOperation[StencilOperation["DecrWrap"] = WebGLRenderingContext.DECR_WRAP] = "DecrWrap"; StencilOperation[StencilOperation["Invert"] = WebGLRenderingContext.INVERT] = "Invert"; StencilOperation[StencilOperation["Default"] = StencilOperation.Keep] = "Default"; })(StencilOperation = GL.StencilOperation || (GL.StencilOperation = {})); let StencilFunction; (function (StencilFunction) { StencilFunction[StencilFunction["Never"] = WebGLRenderingContext.NEVER] = "Never"; StencilFunction[StencilFunction["Less"] = WebGLRenderingContext.LESS] = "Less"; StencilFunction[StencilFunction["LEqual"] = WebGLRenderingContext.LEQUAL] = "LEqual"; StencilFunction[StencilFunction["Greater"] = WebGLRenderingContext.GREATER] = "Greater"; StencilFunction[StencilFunction["GEqual"] = WebGLRenderingContext.GEQUAL] = "GEqual"; StencilFunction[StencilFunction["Equal"] = WebGLRenderingContext.EQUAL] = "Equal"; StencilFunction[StencilFunction["NotEqual"] = WebGLRenderingContext.NOTEQUAL] = "NotEqual"; StencilFunction[StencilFunction["Always"] = WebGLRenderingContext.ALWAYS] = "Always"; StencilFunction[StencilFunction["Default"] = StencilFunction.Always] = "Default"; })(StencilFunction = GL.StencilFunction || (GL.StencilFunction = {})); let CullFace; (function (CullFace) { CullFace[CullFace["Front"] = WebGLRenderingContext.FRONT] = "Front"; CullFace[CullFace["Back"] = WebGLRenderingContext.BACK] = "Back"; CullFace[CullFace["FrontAndBack"] = WebGLRenderingContext.FRONT_AND_BACK] = "FrontAndBack"; CullFace[CullFace["Default"] = CullFace.Back] = "Default"; })(CullFace = GL.CullFace || (GL.CullFace = {})); let DataType; (function (DataType) { DataType[DataType["Byte"] = WebGLRenderingContext.BYTE] = "Byte"; DataType[DataType["Short"] = WebGLRenderingContext.SHORT] = "Short"; DataType[DataType["UnsignedByte"] = WebGLRenderingContext.UNSIGNED_BYTE] = "UnsignedByte"; DataType[DataType["UnsignedShort"] = WebGLRenderingContext.UNSIGNED_SHORT] = "UnsignedShort"; DataType[DataType["UnsignedInt"] = WebGLRenderingContext.UNSIGNED_INT] = "UnsignedInt"; DataType[DataType["Float"] = WebGLRenderingContext.FLOAT] = "Float"; // WebGL 2 has more data types // HalfFloat = WebGLRenderingContext.HALF_FLOAT, })(DataType = GL.DataType || (GL.DataType = {})); let FrontFace; (function (FrontFace) { FrontFace[FrontFace["CounterClockwise"] = WebGLRenderingContext.CCW] = "CounterClockwise"; FrontFace[FrontFace["Clockwise"] = WebGLRenderingContext.CW] = "Clockwise"; FrontFace[FrontFace["Default"] = FrontFace.CounterClockwise] = "Default"; })(FrontFace = GL.FrontFace || (GL.FrontFace = {})); let DepthFunc; (function (DepthFunc) { DepthFunc[DepthFunc["Never"] = WebGLRenderingContext.NEVER] = "Never"; DepthFunc[DepthFunc["Less"] = WebGLRenderingContext.LESS] = "Less"; DepthFunc[DepthFunc["Equal"] = WebGLRenderingContext.EQUAL] = "Equal"; DepthFunc[DepthFunc["LessOrEqual"] = WebGLRenderingContext.LEQUAL] = "LessOrEqual"; DepthFunc[DepthFunc["Greater"] = WebGLRenderingContext.GREATER] = "Greater"; DepthFunc[DepthFunc["NotEqual"] = WebGLRenderingContext.NOTEQUAL] = "NotEqual"; DepthFunc[DepthFunc["GreaterOrEqual"] = WebGLRenderingContext.GEQUAL] = "GreaterOrEqual"; DepthFunc[DepthFunc["Always"] = WebGLRenderingContext.ALWAYS] = "Always"; DepthFunc[DepthFunc["Default"] = DepthFunc.LessOrEqual] = "Default"; })(DepthFunc = GL.DepthFunc || (GL.DepthFunc = {})); let Capability; (function (Capability) { Capability[Capability["Blend"] = WebGLRenderingContext.BLEND] = "Blend"; Capability[Capability["BlendColor"] = WebGLRenderingContext.BLEND_COLOR] = "BlendColor"; Capability[Capability["BlendEquationAlpha"] = WebGLRenderingContext.BLEND_EQUATION_ALPHA] = "BlendEquationAlpha"; Capability[Capability["BlendEquationRGB"] = WebGLRenderingContext.BLEND_EQUATION_RGB] = "BlendEquationRGB"; Capability[Capability["BlendSrcAlpha"] = WebGLRenderingContext.BLEND_SRC_ALPHA] = "BlendSrcAlpha"; Capability[Capability["BlendSrcRgb"] = WebGLRenderingContext.BLEND_SRC_RGB] = "BlendSrcRgb"; Capability[Capability["BlendDstAlpha"] = WebGLRenderingContext.BLEND_DST_ALPHA] = "BlendDstAlpha"; Capability[Capability["BlendDstRgb"] = WebGLRenderingContext.BLEND_DST_RGB] = "BlendDstRgb"; Capability[Capability["CullFace"] = WebGLRenderingContext.CULL_FACE] = "CullFace"; Capability[Capability["CullFaceMode"] = WebGLRenderingContext.CULL_FACE_MODE] = "CullFaceMode"; Capability[Capability["DepthFunc"] = WebGLRenderingContext.DEPTH_FUNC] = "DepthFunc"; Capability[Capability["DepthTest"] = WebGLRenderingContext.DEPTH_TEST] = "DepthTest"; Capability[Capability["DepthWriteMask"] = WebGLRenderingContext.DEPTH_WRITEMASK] = "DepthWriteMask"; Capability[Capability["FrontFace"] = WebGLRenderingContext.FRONT_FACE] = "FrontFace"; Capability[Capability["StencilFrontFunc"] = WebGLRenderingContext.STENCIL_FUNC] = "StencilFrontFunc"; Capability[Capability["StencilFrontRef"] = WebGLRenderingContext.STENCIL_REF] = "StencilFrontRef"; Capability[Capability["StencilFrontValueMask"] = WebGLRenderingContext.STENCIL_VALUE_MASK] = "StencilFrontValueMask"; Capability[Capability["StencilFrontWriteMask"] = WebGLRenderingContext.STENCIL_WRITEMASK] = "StencilFrontWriteMask"; Capability[Capability["StencilFrontOpFail"] = WebGLRenderingContext.STENCIL_FAIL] = "StencilFrontOpFail"; Capability[Capability["StencilFrontOpZFail"] = WebGLRenderingContext.STENCIL_PASS_DEPTH_FAIL] = "StencilFrontOpZFail"; Capability[Capability["StencilFrontOpZPass"] = WebGLRenderingContext.STENCIL_PASS_DEPTH_PASS] = "StencilFrontOpZPass"; Capability[Capability["StencilBackFunc"] = WebGLRenderingContext.STENCIL_BACK_FUNC] = "StencilBackFunc"; Capability[Capability["StencilBackRef"] = WebGLRenderingContext.STENCIL_BACK_REF] = "StencilBackRef"; Capability[Capability["StencilBackValueMask"] = WebGLRenderingContext.STENCIL_BACK_VALUE_MASK] = "StencilBackValueMask"; Capability[Capability["StencilBackWriteMask"] = WebGLRenderingContext.STENCIL_BACK_WRITEMASK] = "StencilBackWriteMask"; Capability[Capability["StencilBackOpFail"] = WebGLRenderingContext.STENCIL_BACK_FAIL] = "StencilBackOpFail"; Capability[Capability["StencilBackOpZFail"] = WebGLRenderingContext.STENCIL_BACK_PASS_DEPTH_FAIL] = "StencilBackOpZFail"; Capability[Capability["StencilBackOpZPass"] = WebGLRenderingContext.STENCIL_BACK_PASS_DEPTH_PASS] = "StencilBackOpZPass"; Capability[Capability["StencilTest"] = WebGLRenderingContext.STENCIL_TEST] = "StencilTest"; Capability[Capability["StencilWriteMask"] = WebGLRenderingContext.STENCIL_WRITEMASK] = "StencilWriteMask"; })(Capability = GL.Capability || (GL.Capability = {})); let Texture; (function (Texture) { let Target; (function (Target) { Target[Target["TwoDee"] = WebGLRenderingContext.TEXTURE_2D] = "TwoDee"; Target[Target["CubeMap"] = WebGLRenderingContext.TEXTURE_CUBE_MAP] = "CubeMap"; Target[Target["CubeMapPositiveX"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_X] = "CubeMapPositiveX"; Target[Target["CubeMapNegativeX"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_X] = "CubeMapNegativeX"; Target[Target["CubeMapPositiveY"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Y] = "CubeMapPositiveY"; Target[Target["CubeMapNegativeY"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Y] = "CubeMapNegativeY"; Target[Target["CubeMapPositiveZ"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_POSITIVE_Z] = "CubeMapPositiveZ"; Target[Target["CubeMapNegativeZ"] = WebGLRenderingContext.TEXTURE_CUBE_MAP_NEGATIVE_Z] = "CubeMapNegativeZ"; })(Target = Texture.Target || (Texture.Target = {})); let Format; (function (Format) { Format[Format["Rgb"] = WebGLRenderingContext.RGB] = "Rgb"; Format[Format["Rgba"] = WebGLRenderingContext.RGBA] = "Rgba"; Format[Format["DepthStencil"] = WebGLRenderingContext.DEPTH_STENCIL] = "DepthStencil"; Format[Format["Luminance"] = WebGLRenderingContext.LUMINANCE] = "Luminance"; Format[Format["DepthComponent"] = WebGLRenderingContext.DEPTH_COMPONENT] = "DepthComponent"; })(Format = Texture.Format || (Texture.Format = {})); // This name is unambiguous as it is qualified by the namespace...https://github.com/palantir/tslint/issues/3789 let DataType; (function (DataType) { DataType[DataType["Float"] = WebGLRenderingContext.FLOAT] = "Float"; DataType[DataType["UnsignedByte"] = WebGLRenderingContext.UNSIGNED_BYTE] = "UnsignedByte"; // UnsignedInt24_8 = WebGLRenderingContext.UNSIGNED_INT_24_8, DataType[DataType["UnsignedInt"] = WebGLRenderingContext.UNSIGNED_INT] = "UnsignedInt"; })(DataType = Texture.DataType || (Texture.DataType = {})); let WrapMode; (function (WrapMode) { WrapMode[WrapMode["Repeat"] = WebGLRenderingContext.REPEAT] = "Repeat"; WrapMode[WrapMode["MirroredRepeat"] = WebGLRenderingContext.MIRRORED_REPEAT] = "MirroredRepeat"; WrapMode[WrapMode["ClampToEdge"] = WebGLRenderingContext.CLAMP_TO_EDGE] = "ClampToEdge"; })(WrapMode = Texture.WrapMode || (Texture.WrapMode = {})); })(Texture = GL.Texture || (GL.Texture = {})); let ShaderType; (function (ShaderType) { ShaderType[ShaderType["Fragment"] = WebGLRenderingContext.FRAGMENT_SHADER] = "Fragment"; ShaderType[ShaderType["Vertex"] = WebGLRenderingContext.VERTEX_SHADER] = "Vertex"; })(ShaderType = GL.ShaderType || (GL.ShaderType = {})); let ShaderParameter; (function (ShaderParameter) { ShaderParameter[ShaderParameter["CompileStatus"] = WebGLRenderingContext.COMPILE_STATUS] = "CompileStatus"; })(ShaderParameter = GL.ShaderParameter || (GL.ShaderParameter = {})); let ProgramParameter; (function (ProgramParameter) { ProgramParameter[ProgramParameter["LinkStatus"] = WebGLRenderingContext.LINK_STATUS] = "LinkStatus"; ProgramParameter[ProgramParameter["ActiveUniforms"] = WebGLRenderingContext.ACTIVE_UNIFORMS] = "ActiveUniforms"; })(ProgramParameter = GL.ProgramParameter || (GL.ProgramParameter = {})); let PrimitiveType; (function (PrimitiveType) { PrimitiveType[PrimitiveType["Points"] = WebGLRenderingContext.POINTS] = "Points"; PrimitiveType[PrimitiveType["Lines"] = WebGLRenderingContext.LINES] = "Lines"; PrimitiveType[PrimitiveType["Triangles"] = WebGLRenderingContext.TRIANGLES] = "Triangles"; })(PrimitiveType = GL.PrimitiveType || (GL.PrimitiveType = {})); let RenderBuffer; (function (RenderBuffer) { RenderBuffer.TARGET = WebGLRenderingContext.RENDERBUFFER; let Format; (function (Format) { Format[Format["DepthComponent16"] = WebGLRenderingContext.DEPTH_COMPONENT16] = "DepthComponent16"; })(Format = RenderBuffer.Format || (RenderBuffer.Format = {})); })(RenderBuffer = GL.RenderBuffer || (GL.RenderBuffer = {})); let FrameBuffer; (function (FrameBuffer) { FrameBuffer.TARGET = WebGLRenderingContext.FRAMEBUFFER; let Status; (function (Status) { Status[Status["Complete"] = WebGLRenderingContext.FRAMEBUFFER_COMPLETE] = "Complete"; Status[Status["IncompleteAttachment"] = WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_ATTACHMENT] = "IncompleteAttachment"; Status[Status["IncompleteMissingAttachment"] = WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT] = "IncompleteMissingAttachment"; Status[Status["IncompleteDimensions"] = WebGLRenderingContext.FRAMEBUFFER_INCOMPLETE_DIMENSIONS] = "IncompleteDimensions"; Status[Status["Unsupported"] = WebGLRenderingContext.FRAMEBUFFER_UNSUPPORTED] = "Unsupported"; })(Status = FrameBuffer.Status || (FrameBuffer.Status = {})); })(FrameBuffer = GL.FrameBuffer || (GL.FrameBuffer = {})); let BufferBit; (function (BufferBit) { BufferBit[BufferBit["Color"] = WebGLRenderingContext.COLOR_BUFFER_BIT] = "Color"; BufferBit[BufferBit["Depth"] = WebGLRenderingContext.DEPTH_BUFFER_BIT] = "Depth"; BufferBit[BufferBit["Stencil"] = WebGLRenderingContext.STENCIL_BUFFER_BIT] = "Stencil"; })(BufferBit = GL.BufferBit || (GL.BufferBit = {})); let MultiSampling; (function (MultiSampling) { let Filter; (function (Filter) { Filter[Filter["Nearest"] = WebGLRenderingContext.NEAREST] = "Nearest"; Filter[Filter["Linear"] = WebGLRenderingContext.LINEAR] = "Linear"; })(Filter = MultiSampling.Filter || (MultiSampling.Filter = {})); })(MultiSampling = GL.MultiSampling || (GL.MultiSampling = {})); GL.POLYGON_OFFSET_FILL = WebGLRenderingContext.POLYGON_OFFSET_FILL; })(GL || (GL = {})); //# sourceMappingURL=GL.js.map