(function webpackUniversalModuleDefinition(root, factory) { if (typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if (typeof define === 'function' && define.amd) define([], factory); else if (typeof exports === 'object') exports['deck'] = factory(); else root['deck'] = factory();})(globalThis, function () { "use strict"; var __exports__ = (() => { var __create = Object.create; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __getProtoOf = Object.getPrototypeOf; var __hasOwnProp = Object.prototype.hasOwnProperty; var __commonJS = (cb, mod) => function __require() { return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; }; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default")); var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod )); var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // external-global-plugin:@deck.gl/core var require_core = __commonJS({ "external-global-plugin:@deck.gl/core"(exports, module) { module.exports = globalThis.deck; } }); // external-global-plugin:@luma.gl/engine var require_engine = __commonJS({ "external-global-plugin:@luma.gl/engine"(exports, module) { module.exports = globalThis.luma; } }); // bundle.ts var bundle_exports = {}; __export(bundle_exports, { BrushingExtension: () => BrushingExtension, ClipExtension: () => ClipExtension, CollisionFilterExtension: () => CollisionFilterExtension, DataFilterExtension: () => DataFilterExtension, FillStyleExtension: () => FillStyleExtension, Fp64Extension: () => Fp64Extension, MaskExtension: () => MaskExtension, PathStyleExtension: () => PathStyleExtension, _TerrainExtension: () => TerrainExtension, project64: () => project64_default }); // ../core/bundle/peer-dependency.ts var peer_dependency_exports = {}; var import_core = __toESM(require_core(), 1); __reExport(peer_dependency_exports, __toESM(require_core(), 1)); if (!import_core.Layer) { throw new Error("@deck.gl/core is not found"); } // bundle.ts __reExport(bundle_exports, peer_dependency_exports); // src/brushing/brushing-extension.ts var import_core3 = __toESM(require_core(), 1); // src/brushing/shader-module.ts var import_core2 = __toESM(require_core(), 1); // src/utils/syntax-tags.ts var glsl = (s) => `${s}`; // src/brushing/shader-module.ts var vs = glsl` uniform bool brushing_enabled; uniform int brushing_target; uniform vec2 brushing_mousePos; uniform float brushing_radius; in vec2 brushingTargets; out float brushing_isVisible; bool brushing_isPointInRange(vec2 position) { if (!brushing_enabled) { return true; } vec2 source_commonspace = project_position(position); vec2 target_commonspace = project_position(brushing_mousePos); float distance = length((target_commonspace - source_commonspace) / project_uCommonUnitsPerMeter.xy); return distance <= brushing_radius; } bool brushing_arePointsInRange(vec2 sourcePos, vec2 targetPos) { return brushing_isPointInRange(sourcePos) || brushing_isPointInRange(targetPos); } void brushing_setVisible(bool visible) { brushing_isVisible = float(visible); } `; var fs = glsl` uniform bool brushing_enabled; in float brushing_isVisible; `; var TARGET = { source: 0, target: 1, custom: 2, source_target: 3 }; var inject = { "vs:DECKGL_FILTER_GL_POSITION": glsl` vec2 brushingTarget; vec2 brushingSource; if (brushing_target == 3) { brushingTarget = geometry.worldPositionAlt.xy; brushingSource = geometry.worldPosition.xy; } else if (brushing_target == 0) { brushingTarget = geometry.worldPosition.xy; } else if (brushing_target == 1) { brushingTarget = geometry.worldPositionAlt.xy; } else { brushingTarget = brushingTargets; } bool visible; if (brushing_target == 3) { visible = brushing_arePointsInRange(brushingSource, brushingTarget); } else { visible = brushing_isPointInRange(brushingTarget); } brushing_setVisible(visible); `, "fs:DECKGL_FILTER_COLOR": ` if (brushing_enabled && brushing_isVisible < 0.5) { discard; } ` }; var shader_module_default = { name: "brushing", dependencies: [import_core2.project], vs, fs, inject, getUniforms: (opts) => { if (!opts || !("viewport" in opts)) { return {}; } const { brushingEnabled = true, brushingRadius = 1e4, brushingTarget = "source", mousePosition, viewport } = opts; return { brushing_enabled: Boolean( brushingEnabled && mousePosition && viewport.containsPixel(mousePosition) ), brushing_radius: brushingRadius, brushing_target: TARGET[brushingTarget] || 0, brushing_mousePos: mousePosition ? viewport.unproject([mousePosition.x - viewport.x, mousePosition.y - viewport.y]) : [0, 0] }; } }; // src/brushing/brushing-extension.ts var defaultProps = { getBrushingTarget: { type: "accessor", value: [0, 0] }, brushingTarget: "source", brushingEnabled: true, brushingRadius: 1e4 }; var BrushingExtension = class extends import_core3.LayerExtension { getShaders() { return { modules: [shader_module_default] }; } initializeState(context, extension) { const attributeManager = this.getAttributeManager(); if (attributeManager) { attributeManager.add({ brushingTargets: { size: 2, stepMode: "dynamic", accessor: "getBrushingTarget" } }); } const onMouseMove = () => { this.getCurrentLayer()?.setNeedsRedraw(); }; this.state.onMouseMove = onMouseMove; if (context.deck) { context.deck.eventManager.on({ pointermove: onMouseMove, pointerleave: onMouseMove }); } } finalizeState(context, extension) { if (context.deck) { const onMouseMove = this.state.onMouseMove; context.deck.eventManager.off({ pointermove: onMouseMove, pointerleave: onMouseMove }); } } }; BrushingExtension.defaultProps = defaultProps; BrushingExtension.extensionName = "BrushingExtension"; // src/data-filter/data-filter-extension.ts var import_core4 = __toESM(require_core(), 1); // src/data-filter/shader-module.ts var vs2 = glsl` uniform bool filter_useSoftMargin; uniform bool filter_enabled; uniform bool filter_transformSize; uniform ivec4 filter_categoryBitMask; #ifdef DATAFILTER_TYPE uniform DATAFILTER_TYPE filter_min; uniform DATAFILTER_TYPE filter_softMin; uniform DATAFILTER_TYPE filter_softMax; uniform DATAFILTER_TYPE filter_max; in DATAFILTER_TYPE filterValues; #ifdef DATAFILTER_DOUBLE in DATAFILTER_TYPE filterValues64Low; uniform DATAFILTER_TYPE filter_min64High; uniform DATAFILTER_TYPE filter_max64High; #endif #endif #ifdef DATACATEGORY_TYPE in DATACATEGORY_TYPE filterCategoryValues; #endif out float dataFilter_value; float dataFilter_reduceValue(float value) { return value; } float dataFilter_reduceValue(vec2 value) { return min(value.x, value.y); } float dataFilter_reduceValue(vec3 value) { return min(min(value.x, value.y), value.z); } float dataFilter_reduceValue(vec4 value) { return min(min(value.x, value.y), min(value.z, value.w)); } #ifdef DATAFILTER_TYPE void dataFilter_setValue(DATAFILTER_TYPE valueFromMin, DATAFILTER_TYPE valueFromMax) { if (filter_useSoftMargin) { // smoothstep results are undefined if edge0 ≥ edge1 // Fallback to ignore filterSoftRange if it is truncated by filterRange DATAFILTER_TYPE leftInRange = mix( smoothstep(filter_min, filter_softMin, valueFromMin), step(filter_min, valueFromMin), step(filter_softMin, filter_min) ); DATAFILTER_TYPE rightInRange = mix( 1.0 - smoothstep(filter_softMax, filter_max, valueFromMax), step(valueFromMax, filter_max), step(filter_max, filter_softMax) ); dataFilter_value = dataFilter_reduceValue(leftInRange * rightInRange); } else { dataFilter_value = dataFilter_reduceValue( step(filter_min, valueFromMin) * step(valueFromMax, filter_max) ); } } #endif #ifdef DATACATEGORY_TYPE void dataFilter_setCategoryValue(DATACATEGORY_TYPE category) { #if DATACATEGORY_CHANNELS == 1 // One 128-bit mask int dataFilter_masks = filter_categoryBitMask[int(category / 32.0)]; #elif DATACATEGORY_CHANNELS == 2 // Two 64-bit masks ivec2 dataFilter_masks = ivec2( filter_categoryBitMask[int(category.x / 32.0)], filter_categoryBitMask[int(category.y / 32.0) + 2] ); #elif DATACATEGORY_CHANNELS == 3 // Three 32-bit masks ivec3 dataFilter_masks = filter_categoryBitMask.xyz; #else // Four 32-bit masks ivec4 dataFilter_masks = filter_categoryBitMask; #endif // Shift mask and extract relevant bits DATACATEGORY_TYPE dataFilter_bits = DATACATEGORY_TYPE(dataFilter_masks) / pow(DATACATEGORY_TYPE(2.0), mod(category, 32.0)); dataFilter_bits = mod(floor(dataFilter_bits), 2.0); #if DATACATEGORY_CHANNELS == 1 if(dataFilter_bits == 0.0) dataFilter_value = 0.0; #else if(any(equal(dataFilter_bits, DATACATEGORY_TYPE(0.0)))) dataFilter_value = 0.0; #endif } #endif `; var fs2 = glsl` uniform bool filter_transformColor; in float dataFilter_value; `; function getUniforms(opts) { if (!opts || !("extensions" in opts)) { return {}; } const { filterRange = [-1, 1], filterEnabled = true, filterTransformSize = true, filterTransformColor = true } = opts; const filterSoftRange = opts.filterSoftRange || filterRange; return { ...Number.isFinite(filterRange[0]) ? { filter_min: filterRange[0], filter_softMin: filterSoftRange[0], filter_softMax: filterSoftRange[1], filter_max: filterRange[1] } : { filter_min: filterRange.map((r) => r[0]), filter_softMin: filterSoftRange.map((r) => r[0]), filter_softMax: filterSoftRange.map((r) => r[1]), filter_max: filterRange.map((r) => r[1]) }, filter_enabled: filterEnabled, filter_useSoftMargin: Boolean(opts.filterSoftRange), filter_transformSize: filterEnabled && filterTransformSize, filter_transformColor: filterEnabled && filterTransformColor }; } function getUniforms64(opts) { if (!opts || !("extensions" in opts)) { return {}; } const uniforms = getUniforms(opts); if (Number.isFinite(uniforms.filter_min)) { const min64High = Math.fround(uniforms.filter_min); uniforms.filter_min -= min64High; uniforms.filter_softMin -= min64High; uniforms.filter_min64High = min64High; const max64High = Math.fround(uniforms.filter_max); uniforms.filter_max -= max64High; uniforms.filter_softMax -= max64High; uniforms.filter_max64High = max64High; } else { const min64High = uniforms.filter_min.map(Math.fround); uniforms.filter_min = uniforms.filter_min.map((x, i) => x - min64High[i]); uniforms.filter_softMin = uniforms.filter_softMin.map((x, i) => x - min64High[i]); uniforms.filter_min64High = min64High; const max64High = uniforms.filter_max.map(Math.fround); uniforms.filter_max = uniforms.filter_max.map((x, i) => x - max64High[i]); uniforms.filter_softMax = uniforms.filter_softMax.map((x, i) => x - max64High[i]); uniforms.filter_max64High = max64High; } return uniforms; } var inject2 = { "vs:#main-start": glsl` dataFilter_value = 1.0; if (filter_enabled) { #ifdef DATAFILTER_TYPE #ifdef DATAFILTER_DOUBLE dataFilter_setValue( filterValues - filter_min64High + filterValues64Low, filterValues - filter_max64High + filterValues64Low ); #else dataFilter_setValue(filterValues, filterValues); #endif #endif #ifdef DATACATEGORY_TYPE dataFilter_setCategoryValue(filterCategoryValues); #endif } `, "vs:#main-end": glsl` if (dataFilter_value == 0.0) { gl_Position = vec4(0.); } `, "vs:DECKGL_FILTER_SIZE": glsl` if (filter_transformSize) { size = size * dataFilter_value; } `, "fs:DECKGL_FILTER_COLOR": glsl` if (dataFilter_value == 0.0) discard; if (filter_transformColor) { color.a *= dataFilter_value; } ` }; var shaderModule = { name: "data-filter", vs: vs2, fs: fs2, inject: inject2, getUniforms }; var shaderModule64 = { name: "data-filter-fp64", vs: vs2, fs: fs2, inject: inject2, getUniforms: getUniforms64 }; // src/data-filter/aggregator.ts var import_engine = __toESM(require_engine(), 1); // ../../node_modules/@luma.gl/constants/dist/webgl-constants.js var GLEnum; (function(GLEnum2) { GLEnum2[GLEnum2["DEPTH_BUFFER_BIT"] = 256] = "DEPTH_BUFFER_BIT"; GLEnum2[GLEnum2["STENCIL_BUFFER_BIT"] = 1024] = "STENCIL_BUFFER_BIT"; GLEnum2[GLEnum2["COLOR_BUFFER_BIT"] = 16384] = "COLOR_BUFFER_BIT"; GLEnum2[GLEnum2["POINTS"] = 0] = "POINTS"; GLEnum2[GLEnum2["LINES"] = 1] = "LINES"; GLEnum2[GLEnum2["LINE_LOOP"] = 2] = "LINE_LOOP"; GLEnum2[GLEnum2["LINE_STRIP"] = 3] = "LINE_STRIP"; GLEnum2[GLEnum2["TRIANGLES"] = 4] = "TRIANGLES"; GLEnum2[GLEnum2["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP"; GLEnum2[GLEnum2["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN"; GLEnum2[GLEnum2["ZERO"] = 0] = "ZERO"; GLEnum2[GLEnum2["ONE"] = 1] = "ONE"; GLEnum2[GLEnum2["SRC_COLOR"] = 768] = "SRC_COLOR"; GLEnum2[GLEnum2["ONE_MINUS_SRC_COLOR"] = 769] = "ONE_MINUS_SRC_COLOR"; GLEnum2[GLEnum2["SRC_ALPHA"] = 770] = "SRC_ALPHA"; GLEnum2[GLEnum2["ONE_MINUS_SRC_ALPHA"] = 771] = "ONE_MINUS_SRC_ALPHA"; GLEnum2[GLEnum2["DST_ALPHA"] = 772] = "DST_ALPHA"; GLEnum2[GLEnum2["ONE_MINUS_DST_ALPHA"] = 773] = "ONE_MINUS_DST_ALPHA"; GLEnum2[GLEnum2["DST_COLOR"] = 774] = "DST_COLOR"; GLEnum2[GLEnum2["ONE_MINUS_DST_COLOR"] = 775] = "ONE_MINUS_DST_COLOR"; GLEnum2[GLEnum2["SRC_ALPHA_SATURATE"] = 776] = "SRC_ALPHA_SATURATE"; GLEnum2[GLEnum2["CONSTANT_COLOR"] = 32769] = "CONSTANT_COLOR"; GLEnum2[GLEnum2["ONE_MINUS_CONSTANT_COLOR"] = 32770] = "ONE_MINUS_CONSTANT_COLOR"; GLEnum2[GLEnum2["CONSTANT_ALPHA"] = 32771] = "CONSTANT_ALPHA"; GLEnum2[GLEnum2["ONE_MINUS_CONSTANT_ALPHA"] = 32772] = "ONE_MINUS_CONSTANT_ALPHA"; GLEnum2[GLEnum2["FUNC_ADD"] = 32774] = "FUNC_ADD"; GLEnum2[GLEnum2["FUNC_SUBTRACT"] = 32778] = "FUNC_SUBTRACT"; GLEnum2[GLEnum2["FUNC_REVERSE_SUBTRACT"] = 32779] = "FUNC_REVERSE_SUBTRACT"; GLEnum2[GLEnum2["BLEND_EQUATION"] = 32777] = "BLEND_EQUATION"; GLEnum2[GLEnum2["BLEND_EQUATION_RGB"] = 32777] = "BLEND_EQUATION_RGB"; GLEnum2[GLEnum2["BLEND_EQUATION_ALPHA"] = 34877] = "BLEND_EQUATION_ALPHA"; GLEnum2[GLEnum2["BLEND_DST_RGB"] = 32968] = "BLEND_DST_RGB"; GLEnum2[GLEnum2["BLEND_SRC_RGB"] = 32969] = "BLEND_SRC_RGB"; GLEnum2[GLEnum2["BLEND_DST_ALPHA"] = 32970] = "BLEND_DST_ALPHA"; GLEnum2[GLEnum2["BLEND_SRC_ALPHA"] = 32971] = "BLEND_SRC_ALPHA"; GLEnum2[GLEnum2["BLEND_COLOR"] = 32773] = "BLEND_COLOR"; GLEnum2[GLEnum2["ARRAY_BUFFER_BINDING"] = 34964] = "ARRAY_BUFFER_BINDING"; GLEnum2[GLEnum2["ELEMENT_ARRAY_BUFFER_BINDING"] = 34965] = "ELEMENT_ARRAY_BUFFER_BINDING"; GLEnum2[GLEnum2["LINE_WIDTH"] = 2849] = "LINE_WIDTH"; GLEnum2[GLEnum2["ALIASED_POINT_SIZE_RANGE"] = 33901] = "ALIASED_POINT_SIZE_RANGE"; GLEnum2[GLEnum2["ALIASED_LINE_WIDTH_RANGE"] = 33902] = "ALIASED_LINE_WIDTH_RANGE"; GLEnum2[GLEnum2["CULL_FACE_MODE"] = 2885] = "CULL_FACE_MODE"; GLEnum2[GLEnum2["FRONT_FACE"] = 2886] = "FRONT_FACE"; GLEnum2[GLEnum2["DEPTH_RANGE"] = 2928] = "DEPTH_RANGE"; GLEnum2[GLEnum2["DEPTH_WRITEMASK"] = 2930] = "DEPTH_WRITEMASK"; GLEnum2[GLEnum2["DEPTH_CLEAR_VALUE"] = 2931] = "DEPTH_CLEAR_VALUE"; GLEnum2[GLEnum2["DEPTH_FUNC"] = 2932] = "DEPTH_FUNC"; GLEnum2[GLEnum2["STENCIL_CLEAR_VALUE"] = 2961] = "STENCIL_CLEAR_VALUE"; GLEnum2[GLEnum2["STENCIL_FUNC"] = 2962] = "STENCIL_FUNC"; GLEnum2[GLEnum2["STENCIL_FAIL"] = 2964] = "STENCIL_FAIL"; GLEnum2[GLEnum2["STENCIL_PASS_DEPTH_FAIL"] = 2965] = "STENCIL_PASS_DEPTH_FAIL"; GLEnum2[GLEnum2["STENCIL_PASS_DEPTH_PASS"] = 2966] = "STENCIL_PASS_DEPTH_PASS"; GLEnum2[GLEnum2["STENCIL_REF"] = 2967] = "STENCIL_REF"; GLEnum2[GLEnum2["STENCIL_VALUE_MASK"] = 2963] = "STENCIL_VALUE_MASK"; GLEnum2[GLEnum2["STENCIL_WRITEMASK"] = 2968] = "STENCIL_WRITEMASK"; GLEnum2[GLEnum2["STENCIL_BACK_FUNC"] = 34816] = "STENCIL_BACK_FUNC"; GLEnum2[GLEnum2["STENCIL_BACK_FAIL"] = 34817] = "STENCIL_BACK_FAIL"; GLEnum2[GLEnum2["STENCIL_BACK_PASS_DEPTH_FAIL"] = 34818] = "STENCIL_BACK_PASS_DEPTH_FAIL"; GLEnum2[GLEnum2["STENCIL_BACK_PASS_DEPTH_PASS"] = 34819] = "STENCIL_BACK_PASS_DEPTH_PASS"; GLEnum2[GLEnum2["STENCIL_BACK_REF"] = 36003] = "STENCIL_BACK_REF"; GLEnum2[GLEnum2["STENCIL_BACK_VALUE_MASK"] = 36004] = "STENCIL_BACK_VALUE_MASK"; GLEnum2[GLEnum2["STENCIL_BACK_WRITEMASK"] = 36005] = "STENCIL_BACK_WRITEMASK"; GLEnum2[GLEnum2["VIEWPORT"] = 2978] = "VIEWPORT"; GLEnum2[GLEnum2["SCISSOR_BOX"] = 3088] = "SCISSOR_BOX"; GLEnum2[GLEnum2["COLOR_CLEAR_VALUE"] = 3106] = "COLOR_CLEAR_VALUE"; GLEnum2[GLEnum2["COLOR_WRITEMASK"] = 3107] = "COLOR_WRITEMASK"; GLEnum2[GLEnum2["UNPACK_ALIGNMENT"] = 3317] = "UNPACK_ALIGNMENT"; GLEnum2[GLEnum2["PACK_ALIGNMENT"] = 3333] = "PACK_ALIGNMENT"; GLEnum2[GLEnum2["MAX_TEXTURE_SIZE"] = 3379] = "MAX_TEXTURE_SIZE"; GLEnum2[GLEnum2["MAX_VIEWPORT_DIMS"] = 3386] = "MAX_VIEWPORT_DIMS"; GLEnum2[GLEnum2["SUBPIXEL_BITS"] = 3408] = "SUBPIXEL_BITS"; GLEnum2[GLEnum2["RED_BITS"] = 3410] = "RED_BITS"; GLEnum2[GLEnum2["GREEN_BITS"] = 3411] = "GREEN_BITS"; GLEnum2[GLEnum2["BLUE_BITS"] = 3412] = "BLUE_BITS"; GLEnum2[GLEnum2["ALPHA_BITS"] = 3413] = "ALPHA_BITS"; GLEnum2[GLEnum2["DEPTH_BITS"] = 3414] = "DEPTH_BITS"; GLEnum2[GLEnum2["STENCIL_BITS"] = 3415] = "STENCIL_BITS"; GLEnum2[GLEnum2["POLYGON_OFFSET_UNITS"] = 10752] = "POLYGON_OFFSET_UNITS"; GLEnum2[GLEnum2["POLYGON_OFFSET_FACTOR"] = 32824] = "POLYGON_OFFSET_FACTOR"; GLEnum2[GLEnum2["TEXTURE_BINDING_2D"] = 32873] = "TEXTURE_BINDING_2D"; GLEnum2[GLEnum2["SAMPLE_BUFFERS"] = 32936] = "SAMPLE_BUFFERS"; GLEnum2[GLEnum2["SAMPLES"] = 32937] = "SAMPLES"; GLEnum2[GLEnum2["SAMPLE_COVERAGE_VALUE"] = 32938] = "SAMPLE_COVERAGE_VALUE"; GLEnum2[GLEnum2["SAMPLE_COVERAGE_INVERT"] = 32939] = "SAMPLE_COVERAGE_INVERT"; GLEnum2[GLEnum2["COMPRESSED_TEXTURE_FORMATS"] = 34467] = "COMPRESSED_TEXTURE_FORMATS"; GLEnum2[GLEnum2["VENDOR"] = 7936] = "VENDOR"; GLEnum2[GLEnum2["RENDERER"] = 7937] = "RENDERER"; GLEnum2[GLEnum2["VERSION"] = 7938] = "VERSION"; GLEnum2[GLEnum2["IMPLEMENTATION_COLOR_READ_TYPE"] = 35738] = "IMPLEMENTATION_COLOR_READ_TYPE"; GLEnum2[GLEnum2["IMPLEMENTATION_COLOR_READ_FORMAT"] = 35739] = "IMPLEMENTATION_COLOR_READ_FORMAT"; GLEnum2[GLEnum2["BROWSER_DEFAULT_WEBGL"] = 37444] = "BROWSER_DEFAULT_WEBGL"; GLEnum2[GLEnum2["STATIC_DRAW"] = 35044] = "STATIC_DRAW"; GLEnum2[GLEnum2["STREAM_DRAW"] = 35040] = "STREAM_DRAW"; GLEnum2[GLEnum2["DYNAMIC_DRAW"] = 35048] = "DYNAMIC_DRAW"; GLEnum2[GLEnum2["ARRAY_BUFFER"] = 34962] = "ARRAY_BUFFER"; GLEnum2[GLEnum2["ELEMENT_ARRAY_BUFFER"] = 34963] = "ELEMENT_ARRAY_BUFFER"; GLEnum2[GLEnum2["BUFFER_SIZE"] = 34660] = "BUFFER_SIZE"; GLEnum2[GLEnum2["BUFFER_USAGE"] = 34661] = "BUFFER_USAGE"; GLEnum2[GLEnum2["CURRENT_VERTEX_ATTRIB"] = 34342] = "CURRENT_VERTEX_ATTRIB"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_ENABLED"] = 34338] = "VERTEX_ATTRIB_ARRAY_ENABLED"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_SIZE"] = 34339] = "VERTEX_ATTRIB_ARRAY_SIZE"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_STRIDE"] = 34340] = "VERTEX_ATTRIB_ARRAY_STRIDE"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_TYPE"] = 34341] = "VERTEX_ATTRIB_ARRAY_TYPE"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_NORMALIZED"] = 34922] = "VERTEX_ATTRIB_ARRAY_NORMALIZED"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_POINTER"] = 34373] = "VERTEX_ATTRIB_ARRAY_POINTER"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"] = 34975] = "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING"; GLEnum2[GLEnum2["CULL_FACE"] = 2884] = "CULL_FACE"; GLEnum2[GLEnum2["FRONT"] = 1028] = "FRONT"; GLEnum2[GLEnum2["BACK"] = 1029] = "BACK"; GLEnum2[GLEnum2["FRONT_AND_BACK"] = 1032] = "FRONT_AND_BACK"; GLEnum2[GLEnum2["BLEND"] = 3042] = "BLEND"; GLEnum2[GLEnum2["DEPTH_TEST"] = 2929] = "DEPTH_TEST"; GLEnum2[GLEnum2["DITHER"] = 3024] = "DITHER"; GLEnum2[GLEnum2["POLYGON_OFFSET_FILL"] = 32823] = "POLYGON_OFFSET_FILL"; GLEnum2[GLEnum2["SAMPLE_ALPHA_TO_COVERAGE"] = 32926] = "SAMPLE_ALPHA_TO_COVERAGE"; GLEnum2[GLEnum2["SAMPLE_COVERAGE"] = 32928] = "SAMPLE_COVERAGE"; GLEnum2[GLEnum2["SCISSOR_TEST"] = 3089] = "SCISSOR_TEST"; GLEnum2[GLEnum2["STENCIL_TEST"] = 2960] = "STENCIL_TEST"; GLEnum2[GLEnum2["NO_ERROR"] = 0] = "NO_ERROR"; GLEnum2[GLEnum2["INVALID_ENUM"] = 1280] = "INVALID_ENUM"; GLEnum2[GLEnum2["INVALID_VALUE"] = 1281] = "INVALID_VALUE"; GLEnum2[GLEnum2["INVALID_OPERATION"] = 1282] = "INVALID_OPERATION"; GLEnum2[GLEnum2["OUT_OF_MEMORY"] = 1285] = "OUT_OF_MEMORY"; GLEnum2[GLEnum2["CONTEXT_LOST_WEBGL"] = 37442] = "CONTEXT_LOST_WEBGL"; GLEnum2[GLEnum2["CW"] = 2304] = "CW"; GLEnum2[GLEnum2["CCW"] = 2305] = "CCW"; GLEnum2[GLEnum2["DONT_CARE"] = 4352] = "DONT_CARE"; GLEnum2[GLEnum2["FASTEST"] = 4353] = "FASTEST"; GLEnum2[GLEnum2["NICEST"] = 4354] = "NICEST"; GLEnum2[GLEnum2["GENERATE_MIPMAP_HINT"] = 33170] = "GENERATE_MIPMAP_HINT"; GLEnum2[GLEnum2["BYTE"] = 5120] = "BYTE"; GLEnum2[GLEnum2["UNSIGNED_BYTE"] = 5121] = "UNSIGNED_BYTE"; GLEnum2[GLEnum2["SHORT"] = 5122] = "SHORT"; GLEnum2[GLEnum2["UNSIGNED_SHORT"] = 5123] = "UNSIGNED_SHORT"; GLEnum2[GLEnum2["INT"] = 5124] = "INT"; GLEnum2[GLEnum2["UNSIGNED_INT"] = 5125] = "UNSIGNED_INT"; GLEnum2[GLEnum2["FLOAT"] = 5126] = "FLOAT"; GLEnum2[GLEnum2["DOUBLE"] = 5130] = "DOUBLE"; GLEnum2[GLEnum2["DEPTH_COMPONENT"] = 6402] = "DEPTH_COMPONENT"; GLEnum2[GLEnum2["ALPHA"] = 6406] = "ALPHA"; GLEnum2[GLEnum2["RGB"] = 6407] = "RGB"; GLEnum2[GLEnum2["RGBA"] = 6408] = "RGBA"; GLEnum2[GLEnum2["LUMINANCE"] = 6409] = "LUMINANCE"; GLEnum2[GLEnum2["LUMINANCE_ALPHA"] = 6410] = "LUMINANCE_ALPHA"; GLEnum2[GLEnum2["UNSIGNED_SHORT_4_4_4_4"] = 32819] = "UNSIGNED_SHORT_4_4_4_4"; GLEnum2[GLEnum2["UNSIGNED_SHORT_5_5_5_1"] = 32820] = "UNSIGNED_SHORT_5_5_5_1"; GLEnum2[GLEnum2["UNSIGNED_SHORT_5_6_5"] = 33635] = "UNSIGNED_SHORT_5_6_5"; GLEnum2[GLEnum2["FRAGMENT_SHADER"] = 35632] = "FRAGMENT_SHADER"; GLEnum2[GLEnum2["VERTEX_SHADER"] = 35633] = "VERTEX_SHADER"; GLEnum2[GLEnum2["COMPILE_STATUS"] = 35713] = "COMPILE_STATUS"; GLEnum2[GLEnum2["DELETE_STATUS"] = 35712] = "DELETE_STATUS"; GLEnum2[GLEnum2["LINK_STATUS"] = 35714] = "LINK_STATUS"; GLEnum2[GLEnum2["VALIDATE_STATUS"] = 35715] = "VALIDATE_STATUS"; GLEnum2[GLEnum2["ATTACHED_SHADERS"] = 35717] = "ATTACHED_SHADERS"; GLEnum2[GLEnum2["ACTIVE_ATTRIBUTES"] = 35721] = "ACTIVE_ATTRIBUTES"; GLEnum2[GLEnum2["ACTIVE_UNIFORMS"] = 35718] = "ACTIVE_UNIFORMS"; GLEnum2[GLEnum2["MAX_VERTEX_ATTRIBS"] = 34921] = "MAX_VERTEX_ATTRIBS"; GLEnum2[GLEnum2["MAX_VERTEX_UNIFORM_VECTORS"] = 36347] = "MAX_VERTEX_UNIFORM_VECTORS"; GLEnum2[GLEnum2["MAX_VARYING_VECTORS"] = 36348] = "MAX_VARYING_VECTORS"; GLEnum2[GLEnum2["MAX_COMBINED_TEXTURE_IMAGE_UNITS"] = 35661] = "MAX_COMBINED_TEXTURE_IMAGE_UNITS"; GLEnum2[GLEnum2["MAX_VERTEX_TEXTURE_IMAGE_UNITS"] = 35660] = "MAX_VERTEX_TEXTURE_IMAGE_UNITS"; GLEnum2[GLEnum2["MAX_TEXTURE_IMAGE_UNITS"] = 34930] = "MAX_TEXTURE_IMAGE_UNITS"; GLEnum2[GLEnum2["MAX_FRAGMENT_UNIFORM_VECTORS"] = 36349] = "MAX_FRAGMENT_UNIFORM_VECTORS"; GLEnum2[GLEnum2["SHADER_TYPE"] = 35663] = "SHADER_TYPE"; GLEnum2[GLEnum2["SHADING_LANGUAGE_VERSION"] = 35724] = "SHADING_LANGUAGE_VERSION"; GLEnum2[GLEnum2["CURRENT_PROGRAM"] = 35725] = "CURRENT_PROGRAM"; GLEnum2[GLEnum2["NEVER"] = 512] = "NEVER"; GLEnum2[GLEnum2["LESS"] = 513] = "LESS"; GLEnum2[GLEnum2["EQUAL"] = 514] = "EQUAL"; GLEnum2[GLEnum2["LEQUAL"] = 515] = "LEQUAL"; GLEnum2[GLEnum2["GREATER"] = 516] = "GREATER"; GLEnum2[GLEnum2["NOTEQUAL"] = 517] = "NOTEQUAL"; GLEnum2[GLEnum2["GEQUAL"] = 518] = "GEQUAL"; GLEnum2[GLEnum2["ALWAYS"] = 519] = "ALWAYS"; GLEnum2[GLEnum2["KEEP"] = 7680] = "KEEP"; GLEnum2[GLEnum2["REPLACE"] = 7681] = "REPLACE"; GLEnum2[GLEnum2["INCR"] = 7682] = "INCR"; GLEnum2[GLEnum2["DECR"] = 7683] = "DECR"; GLEnum2[GLEnum2["INVERT"] = 5386] = "INVERT"; GLEnum2[GLEnum2["INCR_WRAP"] = 34055] = "INCR_WRAP"; GLEnum2[GLEnum2["DECR_WRAP"] = 34056] = "DECR_WRAP"; GLEnum2[GLEnum2["NEAREST"] = 9728] = "NEAREST"; GLEnum2[GLEnum2["LINEAR"] = 9729] = "LINEAR"; GLEnum2[GLEnum2["NEAREST_MIPMAP_NEAREST"] = 9984] = "NEAREST_MIPMAP_NEAREST"; GLEnum2[GLEnum2["LINEAR_MIPMAP_NEAREST"] = 9985] = "LINEAR_MIPMAP_NEAREST"; GLEnum2[GLEnum2["NEAREST_MIPMAP_LINEAR"] = 9986] = "NEAREST_MIPMAP_LINEAR"; GLEnum2[GLEnum2["LINEAR_MIPMAP_LINEAR"] = 9987] = "LINEAR_MIPMAP_LINEAR"; GLEnum2[GLEnum2["TEXTURE_MAG_FILTER"] = 10240] = "TEXTURE_MAG_FILTER"; GLEnum2[GLEnum2["TEXTURE_MIN_FILTER"] = 10241] = "TEXTURE_MIN_FILTER"; GLEnum2[GLEnum2["TEXTURE_WRAP_S"] = 10242] = "TEXTURE_WRAP_S"; GLEnum2[GLEnum2["TEXTURE_WRAP_T"] = 10243] = "TEXTURE_WRAP_T"; GLEnum2[GLEnum2["TEXTURE_2D"] = 3553] = "TEXTURE_2D"; GLEnum2[GLEnum2["TEXTURE"] = 5890] = "TEXTURE"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP"] = 34067] = "TEXTURE_CUBE_MAP"; GLEnum2[GLEnum2["TEXTURE_BINDING_CUBE_MAP"] = 34068] = "TEXTURE_BINDING_CUBE_MAP"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_POSITIVE_X"] = 34069] = "TEXTURE_CUBE_MAP_POSITIVE_X"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_NEGATIVE_X"] = 34070] = "TEXTURE_CUBE_MAP_NEGATIVE_X"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_POSITIVE_Y"] = 34071] = "TEXTURE_CUBE_MAP_POSITIVE_Y"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_NEGATIVE_Y"] = 34072] = "TEXTURE_CUBE_MAP_NEGATIVE_Y"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_POSITIVE_Z"] = 34073] = "TEXTURE_CUBE_MAP_POSITIVE_Z"; GLEnum2[GLEnum2["TEXTURE_CUBE_MAP_NEGATIVE_Z"] = 34074] = "TEXTURE_CUBE_MAP_NEGATIVE_Z"; GLEnum2[GLEnum2["MAX_CUBE_MAP_TEXTURE_SIZE"] = 34076] = "MAX_CUBE_MAP_TEXTURE_SIZE"; GLEnum2[GLEnum2["TEXTURE0"] = 33984] = "TEXTURE0"; GLEnum2[GLEnum2["ACTIVE_TEXTURE"] = 34016] = "ACTIVE_TEXTURE"; GLEnum2[GLEnum2["REPEAT"] = 10497] = "REPEAT"; GLEnum2[GLEnum2["CLAMP_TO_EDGE"] = 33071] = "CLAMP_TO_EDGE"; GLEnum2[GLEnum2["MIRRORED_REPEAT"] = 33648] = "MIRRORED_REPEAT"; GLEnum2[GLEnum2["TEXTURE_WIDTH"] = 4096] = "TEXTURE_WIDTH"; GLEnum2[GLEnum2["TEXTURE_HEIGHT"] = 4097] = "TEXTURE_HEIGHT"; GLEnum2[GLEnum2["FLOAT_VEC2"] = 35664] = "FLOAT_VEC2"; GLEnum2[GLEnum2["FLOAT_VEC3"] = 35665] = "FLOAT_VEC3"; GLEnum2[GLEnum2["FLOAT_VEC4"] = 35666] = "FLOAT_VEC4"; GLEnum2[GLEnum2["INT_VEC2"] = 35667] = "INT_VEC2"; GLEnum2[GLEnum2["INT_VEC3"] = 35668] = "INT_VEC3"; GLEnum2[GLEnum2["INT_VEC4"] = 35669] = "INT_VEC4"; GLEnum2[GLEnum2["BOOL"] = 35670] = "BOOL"; GLEnum2[GLEnum2["BOOL_VEC2"] = 35671] = "BOOL_VEC2"; GLEnum2[GLEnum2["BOOL_VEC3"] = 35672] = "BOOL_VEC3"; GLEnum2[GLEnum2["BOOL_VEC4"] = 35673] = "BOOL_VEC4"; GLEnum2[GLEnum2["FLOAT_MAT2"] = 35674] = "FLOAT_MAT2"; GLEnum2[GLEnum2["FLOAT_MAT3"] = 35675] = "FLOAT_MAT3"; GLEnum2[GLEnum2["FLOAT_MAT4"] = 35676] = "FLOAT_MAT4"; GLEnum2[GLEnum2["SAMPLER_2D"] = 35678] = "SAMPLER_2D"; GLEnum2[GLEnum2["SAMPLER_CUBE"] = 35680] = "SAMPLER_CUBE"; GLEnum2[GLEnum2["LOW_FLOAT"] = 36336] = "LOW_FLOAT"; GLEnum2[GLEnum2["MEDIUM_FLOAT"] = 36337] = "MEDIUM_FLOAT"; GLEnum2[GLEnum2["HIGH_FLOAT"] = 36338] = "HIGH_FLOAT"; GLEnum2[GLEnum2["LOW_INT"] = 36339] = "LOW_INT"; GLEnum2[GLEnum2["MEDIUM_INT"] = 36340] = "MEDIUM_INT"; GLEnum2[GLEnum2["HIGH_INT"] = 36341] = "HIGH_INT"; GLEnum2[GLEnum2["FRAMEBUFFER"] = 36160] = "FRAMEBUFFER"; GLEnum2[GLEnum2["RENDERBUFFER"] = 36161] = "RENDERBUFFER"; GLEnum2[GLEnum2["RGBA4"] = 32854] = "RGBA4"; GLEnum2[GLEnum2["RGB5_A1"] = 32855] = "RGB5_A1"; GLEnum2[GLEnum2["RGB565"] = 36194] = "RGB565"; GLEnum2[GLEnum2["DEPTH_COMPONENT16"] = 33189] = "DEPTH_COMPONENT16"; GLEnum2[GLEnum2["STENCIL_INDEX"] = 6401] = "STENCIL_INDEX"; GLEnum2[GLEnum2["STENCIL_INDEX8"] = 36168] = "STENCIL_INDEX8"; GLEnum2[GLEnum2["DEPTH_STENCIL"] = 34041] = "DEPTH_STENCIL"; GLEnum2[GLEnum2["RENDERBUFFER_WIDTH"] = 36162] = "RENDERBUFFER_WIDTH"; GLEnum2[GLEnum2["RENDERBUFFER_HEIGHT"] = 36163] = "RENDERBUFFER_HEIGHT"; GLEnum2[GLEnum2["RENDERBUFFER_INTERNAL_FORMAT"] = 36164] = "RENDERBUFFER_INTERNAL_FORMAT"; GLEnum2[GLEnum2["RENDERBUFFER_RED_SIZE"] = 36176] = "RENDERBUFFER_RED_SIZE"; GLEnum2[GLEnum2["RENDERBUFFER_GREEN_SIZE"] = 36177] = "RENDERBUFFER_GREEN_SIZE"; GLEnum2[GLEnum2["RENDERBUFFER_BLUE_SIZE"] = 36178] = "RENDERBUFFER_BLUE_SIZE"; GLEnum2[GLEnum2["RENDERBUFFER_ALPHA_SIZE"] = 36179] = "RENDERBUFFER_ALPHA_SIZE"; GLEnum2[GLEnum2["RENDERBUFFER_DEPTH_SIZE"] = 36180] = "RENDERBUFFER_DEPTH_SIZE"; GLEnum2[GLEnum2["RENDERBUFFER_STENCIL_SIZE"] = 36181] = "RENDERBUFFER_STENCIL_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"] = 36048] = "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"] = 36049] = "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"] = 36050] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"] = 36051] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE"; GLEnum2[GLEnum2["COLOR_ATTACHMENT0"] = 36064] = "COLOR_ATTACHMENT0"; GLEnum2[GLEnum2["DEPTH_ATTACHMENT"] = 36096] = "DEPTH_ATTACHMENT"; GLEnum2[GLEnum2["STENCIL_ATTACHMENT"] = 36128] = "STENCIL_ATTACHMENT"; GLEnum2[GLEnum2["DEPTH_STENCIL_ATTACHMENT"] = 33306] = "DEPTH_STENCIL_ATTACHMENT"; GLEnum2[GLEnum2["NONE"] = 0] = "NONE"; GLEnum2[GLEnum2["FRAMEBUFFER_COMPLETE"] = 36053] = "FRAMEBUFFER_COMPLETE"; GLEnum2[GLEnum2["FRAMEBUFFER_INCOMPLETE_ATTACHMENT"] = 36054] = "FRAMEBUFFER_INCOMPLETE_ATTACHMENT"; GLEnum2[GLEnum2["FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"] = 36055] = "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT"; GLEnum2[GLEnum2["FRAMEBUFFER_INCOMPLETE_DIMENSIONS"] = 36057] = "FRAMEBUFFER_INCOMPLETE_DIMENSIONS"; GLEnum2[GLEnum2["FRAMEBUFFER_UNSUPPORTED"] = 36061] = "FRAMEBUFFER_UNSUPPORTED"; GLEnum2[GLEnum2["FRAMEBUFFER_BINDING"] = 36006] = "FRAMEBUFFER_BINDING"; GLEnum2[GLEnum2["RENDERBUFFER_BINDING"] = 36007] = "RENDERBUFFER_BINDING"; GLEnum2[GLEnum2["READ_FRAMEBUFFER"] = 36008] = "READ_FRAMEBUFFER"; GLEnum2[GLEnum2["DRAW_FRAMEBUFFER"] = 36009] = "DRAW_FRAMEBUFFER"; GLEnum2[GLEnum2["MAX_RENDERBUFFER_SIZE"] = 34024] = "MAX_RENDERBUFFER_SIZE"; GLEnum2[GLEnum2["INVALID_FRAMEBUFFER_OPERATION"] = 1286] = "INVALID_FRAMEBUFFER_OPERATION"; GLEnum2[GLEnum2["UNPACK_FLIP_Y_WEBGL"] = 37440] = "UNPACK_FLIP_Y_WEBGL"; GLEnum2[GLEnum2["UNPACK_PREMULTIPLY_ALPHA_WEBGL"] = 37441] = "UNPACK_PREMULTIPLY_ALPHA_WEBGL"; GLEnum2[GLEnum2["UNPACK_COLORSPACE_CONVERSION_WEBGL"] = 37443] = "UNPACK_COLORSPACE_CONVERSION_WEBGL"; GLEnum2[GLEnum2["READ_BUFFER"] = 3074] = "READ_BUFFER"; GLEnum2[GLEnum2["UNPACK_ROW_LENGTH"] = 3314] = "UNPACK_ROW_LENGTH"; GLEnum2[GLEnum2["UNPACK_SKIP_ROWS"] = 3315] = "UNPACK_SKIP_ROWS"; GLEnum2[GLEnum2["UNPACK_SKIP_PIXELS"] = 3316] = "UNPACK_SKIP_PIXELS"; GLEnum2[GLEnum2["PACK_ROW_LENGTH"] = 3330] = "PACK_ROW_LENGTH"; GLEnum2[GLEnum2["PACK_SKIP_ROWS"] = 3331] = "PACK_SKIP_ROWS"; GLEnum2[GLEnum2["PACK_SKIP_PIXELS"] = 3332] = "PACK_SKIP_PIXELS"; GLEnum2[GLEnum2["TEXTURE_BINDING_3D"] = 32874] = "TEXTURE_BINDING_3D"; GLEnum2[GLEnum2["UNPACK_SKIP_IMAGES"] = 32877] = "UNPACK_SKIP_IMAGES"; GLEnum2[GLEnum2["UNPACK_IMAGE_HEIGHT"] = 32878] = "UNPACK_IMAGE_HEIGHT"; GLEnum2[GLEnum2["MAX_3D_TEXTURE_SIZE"] = 32883] = "MAX_3D_TEXTURE_SIZE"; GLEnum2[GLEnum2["MAX_ELEMENTS_VERTICES"] = 33e3] = "MAX_ELEMENTS_VERTICES"; GLEnum2[GLEnum2["MAX_ELEMENTS_INDICES"] = 33001] = "MAX_ELEMENTS_INDICES"; GLEnum2[GLEnum2["MAX_TEXTURE_LOD_BIAS"] = 34045] = "MAX_TEXTURE_LOD_BIAS"; GLEnum2[GLEnum2["MAX_FRAGMENT_UNIFORM_COMPONENTS"] = 35657] = "MAX_FRAGMENT_UNIFORM_COMPONENTS"; GLEnum2[GLEnum2["MAX_VERTEX_UNIFORM_COMPONENTS"] = 35658] = "MAX_VERTEX_UNIFORM_COMPONENTS"; GLEnum2[GLEnum2["MAX_ARRAY_TEXTURE_LAYERS"] = 35071] = "MAX_ARRAY_TEXTURE_LAYERS"; GLEnum2[GLEnum2["MIN_PROGRAM_TEXEL_OFFSET"] = 35076] = "MIN_PROGRAM_TEXEL_OFFSET"; GLEnum2[GLEnum2["MAX_PROGRAM_TEXEL_OFFSET"] = 35077] = "MAX_PROGRAM_TEXEL_OFFSET"; GLEnum2[GLEnum2["MAX_VARYING_COMPONENTS"] = 35659] = "MAX_VARYING_COMPONENTS"; GLEnum2[GLEnum2["FRAGMENT_SHADER_DERIVATIVE_HINT"] = 35723] = "FRAGMENT_SHADER_DERIVATIVE_HINT"; GLEnum2[GLEnum2["RASTERIZER_DISCARD"] = 35977] = "RASTERIZER_DISCARD"; GLEnum2[GLEnum2["VERTEX_ARRAY_BINDING"] = 34229] = "VERTEX_ARRAY_BINDING"; GLEnum2[GLEnum2["MAX_VERTEX_OUTPUT_COMPONENTS"] = 37154] = "MAX_VERTEX_OUTPUT_COMPONENTS"; GLEnum2[GLEnum2["MAX_FRAGMENT_INPUT_COMPONENTS"] = 37157] = "MAX_FRAGMENT_INPUT_COMPONENTS"; GLEnum2[GLEnum2["MAX_SERVER_WAIT_TIMEOUT"] = 37137] = "MAX_SERVER_WAIT_TIMEOUT"; GLEnum2[GLEnum2["MAX_ELEMENT_INDEX"] = 36203] = "MAX_ELEMENT_INDEX"; GLEnum2[GLEnum2["RED"] = 6403] = "RED"; GLEnum2[GLEnum2["RGB8"] = 32849] = "RGB8"; GLEnum2[GLEnum2["RGBA8"] = 32856] = "RGBA8"; GLEnum2[GLEnum2["RGB10_A2"] = 32857] = "RGB10_A2"; GLEnum2[GLEnum2["TEXTURE_3D"] = 32879] = "TEXTURE_3D"; GLEnum2[GLEnum2["TEXTURE_WRAP_R"] = 32882] = "TEXTURE_WRAP_R"; GLEnum2[GLEnum2["TEXTURE_MIN_LOD"] = 33082] = "TEXTURE_MIN_LOD"; GLEnum2[GLEnum2["TEXTURE_MAX_LOD"] = 33083] = "TEXTURE_MAX_LOD"; GLEnum2[GLEnum2["TEXTURE_BASE_LEVEL"] = 33084] = "TEXTURE_BASE_LEVEL"; GLEnum2[GLEnum2["TEXTURE_MAX_LEVEL"] = 33085] = "TEXTURE_MAX_LEVEL"; GLEnum2[GLEnum2["TEXTURE_COMPARE_MODE"] = 34892] = "TEXTURE_COMPARE_MODE"; GLEnum2[GLEnum2["TEXTURE_COMPARE_FUNC"] = 34893] = "TEXTURE_COMPARE_FUNC"; GLEnum2[GLEnum2["SRGB"] = 35904] = "SRGB"; GLEnum2[GLEnum2["SRGB8"] = 35905] = "SRGB8"; GLEnum2[GLEnum2["SRGB8_ALPHA8"] = 35907] = "SRGB8_ALPHA8"; GLEnum2[GLEnum2["COMPARE_REF_TO_TEXTURE"] = 34894] = "COMPARE_REF_TO_TEXTURE"; GLEnum2[GLEnum2["RGBA32F"] = 34836] = "RGBA32F"; GLEnum2[GLEnum2["RGB32F"] = 34837] = "RGB32F"; GLEnum2[GLEnum2["RGBA16F"] = 34842] = "RGBA16F"; GLEnum2[GLEnum2["RGB16F"] = 34843] = "RGB16F"; GLEnum2[GLEnum2["TEXTURE_2D_ARRAY"] = 35866] = "TEXTURE_2D_ARRAY"; GLEnum2[GLEnum2["TEXTURE_BINDING_2D_ARRAY"] = 35869] = "TEXTURE_BINDING_2D_ARRAY"; GLEnum2[GLEnum2["R11F_G11F_B10F"] = 35898] = "R11F_G11F_B10F"; GLEnum2[GLEnum2["RGB9_E5"] = 35901] = "RGB9_E5"; GLEnum2[GLEnum2["RGBA32UI"] = 36208] = "RGBA32UI"; GLEnum2[GLEnum2["RGB32UI"] = 36209] = "RGB32UI"; GLEnum2[GLEnum2["RGBA16UI"] = 36214] = "RGBA16UI"; GLEnum2[GLEnum2["RGB16UI"] = 36215] = "RGB16UI"; GLEnum2[GLEnum2["RGBA8UI"] = 36220] = "RGBA8UI"; GLEnum2[GLEnum2["RGB8UI"] = 36221] = "RGB8UI"; GLEnum2[GLEnum2["RGBA32I"] = 36226] = "RGBA32I"; GLEnum2[GLEnum2["RGB32I"] = 36227] = "RGB32I"; GLEnum2[GLEnum2["RGBA16I"] = 36232] = "RGBA16I"; GLEnum2[GLEnum2["RGB16I"] = 36233] = "RGB16I"; GLEnum2[GLEnum2["RGBA8I"] = 36238] = "RGBA8I"; GLEnum2[GLEnum2["RGB8I"] = 36239] = "RGB8I"; GLEnum2[GLEnum2["RED_INTEGER"] = 36244] = "RED_INTEGER"; GLEnum2[GLEnum2["RGB_INTEGER"] = 36248] = "RGB_INTEGER"; GLEnum2[GLEnum2["RGBA_INTEGER"] = 36249] = "RGBA_INTEGER"; GLEnum2[GLEnum2["R8"] = 33321] = "R8"; GLEnum2[GLEnum2["RG8"] = 33323] = "RG8"; GLEnum2[GLEnum2["R16F"] = 33325] = "R16F"; GLEnum2[GLEnum2["R32F"] = 33326] = "R32F"; GLEnum2[GLEnum2["RG16F"] = 33327] = "RG16F"; GLEnum2[GLEnum2["RG32F"] = 33328] = "RG32F"; GLEnum2[GLEnum2["R8I"] = 33329] = "R8I"; GLEnum2[GLEnum2["R8UI"] = 33330] = "R8UI"; GLEnum2[GLEnum2["R16I"] = 33331] = "R16I"; GLEnum2[GLEnum2["R16UI"] = 33332] = "R16UI"; GLEnum2[GLEnum2["R32I"] = 33333] = "R32I"; GLEnum2[GLEnum2["R32UI"] = 33334] = "R32UI"; GLEnum2[GLEnum2["RG8I"] = 33335] = "RG8I"; GLEnum2[GLEnum2["RG8UI"] = 33336] = "RG8UI"; GLEnum2[GLEnum2["RG16I"] = 33337] = "RG16I"; GLEnum2[GLEnum2["RG16UI"] = 33338] = "RG16UI"; GLEnum2[GLEnum2["RG32I"] = 33339] = "RG32I"; GLEnum2[GLEnum2["RG32UI"] = 33340] = "RG32UI"; GLEnum2[GLEnum2["R8_SNORM"] = 36756] = "R8_SNORM"; GLEnum2[GLEnum2["RG8_SNORM"] = 36757] = "RG8_SNORM"; GLEnum2[GLEnum2["RGB8_SNORM"] = 36758] = "RGB8_SNORM"; GLEnum2[GLEnum2["RGBA8_SNORM"] = 36759] = "RGBA8_SNORM"; GLEnum2[GLEnum2["RGB10_A2UI"] = 36975] = "RGB10_A2UI"; GLEnum2[GLEnum2["TEXTURE_IMMUTABLE_FORMAT"] = 37167] = "TEXTURE_IMMUTABLE_FORMAT"; GLEnum2[GLEnum2["TEXTURE_IMMUTABLE_LEVELS"] = 33503] = "TEXTURE_IMMUTABLE_LEVELS"; GLEnum2[GLEnum2["UNSIGNED_INT_2_10_10_10_REV"] = 33640] = "UNSIGNED_INT_2_10_10_10_REV"; GLEnum2[GLEnum2["UNSIGNED_INT_10F_11F_11F_REV"] = 35899] = "UNSIGNED_INT_10F_11F_11F_REV"; GLEnum2[GLEnum2["UNSIGNED_INT_5_9_9_9_REV"] = 35902] = "UNSIGNED_INT_5_9_9_9_REV"; GLEnum2[GLEnum2["FLOAT_32_UNSIGNED_INT_24_8_REV"] = 36269] = "FLOAT_32_UNSIGNED_INT_24_8_REV"; GLEnum2[GLEnum2["UNSIGNED_INT_24_8"] = 34042] = "UNSIGNED_INT_24_8"; GLEnum2[GLEnum2["HALF_FLOAT"] = 5131] = "HALF_FLOAT"; GLEnum2[GLEnum2["RG"] = 33319] = "RG"; GLEnum2[GLEnum2["RG_INTEGER"] = 33320] = "RG_INTEGER"; GLEnum2[GLEnum2["INT_2_10_10_10_REV"] = 36255] = "INT_2_10_10_10_REV"; GLEnum2[GLEnum2["CURRENT_QUERY"] = 34917] = "CURRENT_QUERY"; GLEnum2[GLEnum2["QUERY_RESULT"] = 34918] = "QUERY_RESULT"; GLEnum2[GLEnum2["QUERY_RESULT_AVAILABLE"] = 34919] = "QUERY_RESULT_AVAILABLE"; GLEnum2[GLEnum2["ANY_SAMPLES_PASSED"] = 35887] = "ANY_SAMPLES_PASSED"; GLEnum2[GLEnum2["ANY_SAMPLES_PASSED_CONSERVATIVE"] = 36202] = "ANY_SAMPLES_PASSED_CONSERVATIVE"; GLEnum2[GLEnum2["MAX_DRAW_BUFFERS"] = 34852] = "MAX_DRAW_BUFFERS"; GLEnum2[GLEnum2["DRAW_BUFFER0"] = 34853] = "DRAW_BUFFER0"; GLEnum2[GLEnum2["DRAW_BUFFER1"] = 34854] = "DRAW_BUFFER1"; GLEnum2[GLEnum2["DRAW_BUFFER2"] = 34855] = "DRAW_BUFFER2"; GLEnum2[GLEnum2["DRAW_BUFFER3"] = 34856] = "DRAW_BUFFER3"; GLEnum2[GLEnum2["DRAW_BUFFER4"] = 34857] = "DRAW_BUFFER4"; GLEnum2[GLEnum2["DRAW_BUFFER5"] = 34858] = "DRAW_BUFFER5"; GLEnum2[GLEnum2["DRAW_BUFFER6"] = 34859] = "DRAW_BUFFER6"; GLEnum2[GLEnum2["DRAW_BUFFER7"] = 34860] = "DRAW_BUFFER7"; GLEnum2[GLEnum2["DRAW_BUFFER8"] = 34861] = "DRAW_BUFFER8"; GLEnum2[GLEnum2["DRAW_BUFFER9"] = 34862] = "DRAW_BUFFER9"; GLEnum2[GLEnum2["DRAW_BUFFER10"] = 34863] = "DRAW_BUFFER10"; GLEnum2[GLEnum2["DRAW_BUFFER11"] = 34864] = "DRAW_BUFFER11"; GLEnum2[GLEnum2["DRAW_BUFFER12"] = 34865] = "DRAW_BUFFER12"; GLEnum2[GLEnum2["DRAW_BUFFER13"] = 34866] = "DRAW_BUFFER13"; GLEnum2[GLEnum2["DRAW_BUFFER14"] = 34867] = "DRAW_BUFFER14"; GLEnum2[GLEnum2["DRAW_BUFFER15"] = 34868] = "DRAW_BUFFER15"; GLEnum2[GLEnum2["MAX_COLOR_ATTACHMENTS"] = 36063] = "MAX_COLOR_ATTACHMENTS"; GLEnum2[GLEnum2["COLOR_ATTACHMENT1"] = 36065] = "COLOR_ATTACHMENT1"; GLEnum2[GLEnum2["COLOR_ATTACHMENT2"] = 36066] = "COLOR_ATTACHMENT2"; GLEnum2[GLEnum2["COLOR_ATTACHMENT3"] = 36067] = "COLOR_ATTACHMENT3"; GLEnum2[GLEnum2["COLOR_ATTACHMENT4"] = 36068] = "COLOR_ATTACHMENT4"; GLEnum2[GLEnum2["COLOR_ATTACHMENT5"] = 36069] = "COLOR_ATTACHMENT5"; GLEnum2[GLEnum2["COLOR_ATTACHMENT6"] = 36070] = "COLOR_ATTACHMENT6"; GLEnum2[GLEnum2["COLOR_ATTACHMENT7"] = 36071] = "COLOR_ATTACHMENT7"; GLEnum2[GLEnum2["COLOR_ATTACHMENT8"] = 36072] = "COLOR_ATTACHMENT8"; GLEnum2[GLEnum2["COLOR_ATTACHMENT9"] = 36073] = "COLOR_ATTACHMENT9"; GLEnum2[GLEnum2["COLOR_ATTACHMENT10"] = 36074] = "COLOR_ATTACHMENT10"; GLEnum2[GLEnum2["COLOR_ATTACHMENT11"] = 36075] = "COLOR_ATTACHMENT11"; GLEnum2[GLEnum2["COLOR_ATTACHMENT12"] = 36076] = "COLOR_ATTACHMENT12"; GLEnum2[GLEnum2["COLOR_ATTACHMENT13"] = 36077] = "COLOR_ATTACHMENT13"; GLEnum2[GLEnum2["COLOR_ATTACHMENT14"] = 36078] = "COLOR_ATTACHMENT14"; GLEnum2[GLEnum2["COLOR_ATTACHMENT15"] = 36079] = "COLOR_ATTACHMENT15"; GLEnum2[GLEnum2["SAMPLER_3D"] = 35679] = "SAMPLER_3D"; GLEnum2[GLEnum2["SAMPLER_2D_SHADOW"] = 35682] = "SAMPLER_2D_SHADOW"; GLEnum2[GLEnum2["SAMPLER_2D_ARRAY"] = 36289] = "SAMPLER_2D_ARRAY"; GLEnum2[GLEnum2["SAMPLER_2D_ARRAY_SHADOW"] = 36292] = "SAMPLER_2D_ARRAY_SHADOW"; GLEnum2[GLEnum2["SAMPLER_CUBE_SHADOW"] = 36293] = "SAMPLER_CUBE_SHADOW"; GLEnum2[GLEnum2["INT_SAMPLER_2D"] = 36298] = "INT_SAMPLER_2D"; GLEnum2[GLEnum2["INT_SAMPLER_3D"] = 36299] = "INT_SAMPLER_3D"; GLEnum2[GLEnum2["INT_SAMPLER_CUBE"] = 36300] = "INT_SAMPLER_CUBE"; GLEnum2[GLEnum2["INT_SAMPLER_2D_ARRAY"] = 36303] = "INT_SAMPLER_2D_ARRAY"; GLEnum2[GLEnum2["UNSIGNED_INT_SAMPLER_2D"] = 36306] = "UNSIGNED_INT_SAMPLER_2D"; GLEnum2[GLEnum2["UNSIGNED_INT_SAMPLER_3D"] = 36307] = "UNSIGNED_INT_SAMPLER_3D"; GLEnum2[GLEnum2["UNSIGNED_INT_SAMPLER_CUBE"] = 36308] = "UNSIGNED_INT_SAMPLER_CUBE"; GLEnum2[GLEnum2["UNSIGNED_INT_SAMPLER_2D_ARRAY"] = 36311] = "UNSIGNED_INT_SAMPLER_2D_ARRAY"; GLEnum2[GLEnum2["MAX_SAMPLES"] = 36183] = "MAX_SAMPLES"; GLEnum2[GLEnum2["SAMPLER_BINDING"] = 35097] = "SAMPLER_BINDING"; GLEnum2[GLEnum2["PIXEL_PACK_BUFFER"] = 35051] = "PIXEL_PACK_BUFFER"; GLEnum2[GLEnum2["PIXEL_UNPACK_BUFFER"] = 35052] = "PIXEL_UNPACK_BUFFER"; GLEnum2[GLEnum2["PIXEL_PACK_BUFFER_BINDING"] = 35053] = "PIXEL_PACK_BUFFER_BINDING"; GLEnum2[GLEnum2["PIXEL_UNPACK_BUFFER_BINDING"] = 35055] = "PIXEL_UNPACK_BUFFER_BINDING"; GLEnum2[GLEnum2["COPY_READ_BUFFER"] = 36662] = "COPY_READ_BUFFER"; GLEnum2[GLEnum2["COPY_WRITE_BUFFER"] = 36663] = "COPY_WRITE_BUFFER"; GLEnum2[GLEnum2["COPY_READ_BUFFER_BINDING"] = 36662] = "COPY_READ_BUFFER_BINDING"; GLEnum2[GLEnum2["COPY_WRITE_BUFFER_BINDING"] = 36663] = "COPY_WRITE_BUFFER_BINDING"; GLEnum2[GLEnum2["FLOAT_MAT2x3"] = 35685] = "FLOAT_MAT2x3"; GLEnum2[GLEnum2["FLOAT_MAT2x4"] = 35686] = "FLOAT_MAT2x4"; GLEnum2[GLEnum2["FLOAT_MAT3x2"] = 35687] = "FLOAT_MAT3x2"; GLEnum2[GLEnum2["FLOAT_MAT3x4"] = 35688] = "FLOAT_MAT3x4"; GLEnum2[GLEnum2["FLOAT_MAT4x2"] = 35689] = "FLOAT_MAT4x2"; GLEnum2[GLEnum2["FLOAT_MAT4x3"] = 35690] = "FLOAT_MAT4x3"; GLEnum2[GLEnum2["UNSIGNED_INT_VEC2"] = 36294] = "UNSIGNED_INT_VEC2"; GLEnum2[GLEnum2["UNSIGNED_INT_VEC3"] = 36295] = "UNSIGNED_INT_VEC3"; GLEnum2[GLEnum2["UNSIGNED_INT_VEC4"] = 36296] = "UNSIGNED_INT_VEC4"; GLEnum2[GLEnum2["UNSIGNED_NORMALIZED"] = 35863] = "UNSIGNED_NORMALIZED"; GLEnum2[GLEnum2["SIGNED_NORMALIZED"] = 36764] = "SIGNED_NORMALIZED"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_INTEGER"] = 35069] = "VERTEX_ATTRIB_ARRAY_INTEGER"; GLEnum2[GLEnum2["VERTEX_ATTRIB_ARRAY_DIVISOR"] = 35070] = "VERTEX_ATTRIB_ARRAY_DIVISOR"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BUFFER_MODE"] = 35967] = "TRANSFORM_FEEDBACK_BUFFER_MODE"; GLEnum2[GLEnum2["MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS"] = 35968] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_VARYINGS"] = 35971] = "TRANSFORM_FEEDBACK_VARYINGS"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BUFFER_START"] = 35972] = "TRANSFORM_FEEDBACK_BUFFER_START"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BUFFER_SIZE"] = 35973] = "TRANSFORM_FEEDBACK_BUFFER_SIZE"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN"] = 35976] = "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN"; GLEnum2[GLEnum2["MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS"] = 35978] = "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS"; GLEnum2[GLEnum2["MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS"] = 35979] = "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS"; GLEnum2[GLEnum2["INTERLEAVED_ATTRIBS"] = 35980] = "INTERLEAVED_ATTRIBS"; GLEnum2[GLEnum2["SEPARATE_ATTRIBS"] = 35981] = "SEPARATE_ATTRIBS"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BUFFER"] = 35982] = "TRANSFORM_FEEDBACK_BUFFER"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BUFFER_BINDING"] = 35983] = "TRANSFORM_FEEDBACK_BUFFER_BINDING"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK"] = 36386] = "TRANSFORM_FEEDBACK"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_PAUSED"] = 36387] = "TRANSFORM_FEEDBACK_PAUSED"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_ACTIVE"] = 36388] = "TRANSFORM_FEEDBACK_ACTIVE"; GLEnum2[GLEnum2["TRANSFORM_FEEDBACK_BINDING"] = 36389] = "TRANSFORM_FEEDBACK_BINDING"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING"] = 33296] = "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE"] = 33297] = "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_RED_SIZE"] = 33298] = "FRAMEBUFFER_ATTACHMENT_RED_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_GREEN_SIZE"] = 33299] = "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_BLUE_SIZE"] = 33300] = "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE"] = 33301] = "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE"] = 33302] = "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE"] = 33303] = "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE"; GLEnum2[GLEnum2["FRAMEBUFFER_DEFAULT"] = 33304] = "FRAMEBUFFER_DEFAULT"; GLEnum2[GLEnum2["DEPTH24_STENCIL8"] = 35056] = "DEPTH24_STENCIL8"; GLEnum2[GLEnum2["DRAW_FRAMEBUFFER_BINDING"] = 36006] = "DRAW_FRAMEBUFFER_BINDING"; GLEnum2[GLEnum2["READ_FRAMEBUFFER_BINDING"] = 36010] = "READ_FRAMEBUFFER_BINDING"; GLEnum2[GLEnum2["RENDERBUFFER_SAMPLES"] = 36011] = "RENDERBUFFER_SAMPLES"; GLEnum2[GLEnum2["FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER"] = 36052] = "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER"; GLEnum2[GLEnum2["FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"] = 36182] = "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE"; GLEnum2[GLEnum2["UNIFORM_BUFFER"] = 35345] = "UNIFORM_BUFFER"; GLEnum2[GLEnum2["UNIFORM_BUFFER_BINDING"] = 35368] = "UNIFORM_BUFFER_BINDING"; GLEnum2[GLEnum2["UNIFORM_BUFFER_START"] = 35369] = "UNIFORM_BUFFER_START"; GLEnum2[GLEnum2["UNIFORM_BUFFER_SIZE"] = 35370] = "UNIFORM_BUFFER_SIZE"; GLEnum2[GLEnum2["MAX_VERTEX_UNIFORM_BLOCKS"] = 35371] = "MAX_VERTEX_UNIFORM_BLOCKS"; GLEnum2[GLEnum2["MAX_FRAGMENT_UNIFORM_BLOCKS"] = 35373] = "MAX_FRAGMENT_UNIFORM_BLOCKS"; GLEnum2[GLEnum2["MAX_COMBINED_UNIFORM_BLOCKS"] = 35374] = "MAX_COMBINED_UNIFORM_BLOCKS"; GLEnum2[GLEnum2["MAX_UNIFORM_BUFFER_BINDINGS"] = 35375] = "MAX_UNIFORM_BUFFER_BINDINGS"; GLEnum2[GLEnum2["MAX_UNIFORM_BLOCK_SIZE"] = 35376] = "MAX_UNIFORM_BLOCK_SIZE"; GLEnum2[GLEnum2["MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS"] = 35377] = "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS"; GLEnum2[GLEnum2["MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS"] = 35379] = "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS"; GLEnum2[GLEnum2["UNIFORM_BUFFER_OFFSET_ALIGNMENT"] = 35380] = "UNIFORM_BUFFER_OFFSET_ALIGNMENT"; GLEnum2[GLEnum2["ACTIVE_UNIFORM_BLOCKS"] = 35382] = "ACTIVE_UNIFORM_BLOCKS"; GLEnum2[GLEnum2["UNIFORM_TYPE"] = 35383] = "UNIFORM_TYPE"; GLEnum2[GLEnum2["UNIFORM_SIZE"] = 35384] = "UNIFORM_SIZE"; GLEnum2[GLEnum2["UNIFORM_BLOCK_INDEX"] = 35386] = "UNIFORM_BLOCK_INDEX"; GLEnum2[GLEnum2["UNIFORM_OFFSET"] = 35387] = "UNIFORM_OFFSET"; GLEnum2[GLEnum2["UNIFORM_ARRAY_STRIDE"] = 35388] = "UNIFORM_ARRAY_STRIDE"; GLEnum2[GLEnum2["UNIFORM_MATRIX_STRIDE"] = 35389] = "UNIFORM_MATRIX_STRIDE"; GLEnum2[GLEnum2["UNIFORM_IS_ROW_MAJOR"] = 35390] = "UNIFORM_IS_ROW_MAJOR"; GLEnum2[GLEnum2["UNIFORM_BLOCK_BINDING"] = 35391] = "UNIFORM_BLOCK_BINDING"; GLEnum2[GLEnum2["UNIFORM_BLOCK_DATA_SIZE"] = 35392] = "UNIFORM_BLOCK_DATA_SIZE"; GLEnum2[GLEnum2["UNIFORM_BLOCK_ACTIVE_UNIFORMS"] = 35394] = "UNIFORM_BLOCK_ACTIVE_UNIFORMS"; GLEnum2[GLEnum2["UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES"] = 35395] = "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES"; GLEnum2[GLEnum2["UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER"] = 35396] = "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER"; GLEnum2[GLEnum2["UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER"] = 35398] = "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER"; GLEnum2[GLEnum2["OBJECT_TYPE"] = 37138] = "OBJECT_TYPE"; GLEnum2[GLEnum2["SYNC_CONDITION"] = 37139] = "SYNC_CONDITION"; GLEnum2[GLEnum2["SYNC_STATUS"] = 37140] = "SYNC_STATUS"; GLEnum2[GLEnum2["SYNC_FLAGS"] = 37141] = "SYNC_FLAGS"; GLEnum2[GLEnum2["SYNC_FENCE"] = 37142] = "SYNC_FENCE"; GLEnum2[GLEnum2["SYNC_GPU_COMMANDS_COMPLETE"] = 37143] = "SYNC_GPU_COMMANDS_COMPLETE"; GLEnum2[GLEnum2["UNSIGNALED"] = 37144] = "UNSIGNALED"; GLEnum2[GLEnum2["SIGNALED"] = 37145] = "SIGNALED"; GLEnum2[GLEnum2["ALREADY_SIGNALED"] = 37146] = "ALREADY_SIGNALED"; GLEnum2[GLEnum2["TIMEOUT_EXPIRED"] = 37147] = "TIMEOUT_EXPIRED"; GLEnum2[GLEnum2["CONDITION_SATISFIED"] = 37148] = "CONDITION_SATISFIED"; GLEnum2[GLEnum2["WAIT_FAILED"] = 37149] = "WAIT_FAILED"; GLEnum2[GLEnum2["SYNC_FLUSH_COMMANDS_BIT"] = 1] = "SYNC_FLUSH_COMMANDS_BIT"; GLEnum2[GLEnum2["COLOR"] = 6144] = "COLOR"; GLEnum2[GLEnum2["DEPTH"] = 6145] = "DEPTH"; GLEnum2[GLEnum2["STENCIL"] = 6146] = "STENCIL"; GLEnum2[GLEnum2["MIN"] = 32775] = "MIN"; GLEnum2[GLEnum2["MAX"] = 32776] = "MAX"; GLEnum2[GLEnum2["DEPTH_COMPONENT24"] = 33190] = "DEPTH_COMPONENT24"; GLEnum2[GLEnum2["STREAM_READ"] = 35041] = "STREAM_READ"; GLEnum2[GLEnum2["STREAM_COPY"] = 35042] = "STREAM_COPY"; GLEnum2[GLEnum2["STATIC_READ"] = 35045] = "STATIC_READ"; GLEnum2[GLEnum2["STATIC_COPY"] = 35046] = "STATIC_COPY"; GLEnum2[GLEnum2["DYNAMIC_READ"] = 35049] = "DYNAMIC_READ"; GLEnum2[GLEnum2["DYNAMIC_COPY"] = 35050] = "DYNAMIC_COPY"; GLEnum2[GLEnum2["DEPTH_COMPONENT32F"] = 36012] = "DEPTH_COMPONENT32F"; GLEnum2[GLEnum2["DEPTH32F_STENCIL8"] = 36013] = "DEPTH32F_STENCIL8"; GLEnum2[GLEnum2["INVALID_INDEX"] = 4294967295] = "INVALID_INDEX"; GLEnum2[GLEnum2["TIMEOUT_IGNORED"] = -1] = "TIMEOUT_IGNORED"; GLEnum2[GLEnum2["MAX_CLIENT_WAIT_TIMEOUT_WEBGL"] = 37447] = "MAX_CLIENT_WAIT_TIMEOUT_WEBGL"; GLEnum2[GLEnum2["UNMASKED_VENDOR_WEBGL"] = 37445] = "UNMASKED_VENDOR_WEBGL"; GLEnum2[GLEnum2["UNMASKED_RENDERER_WEBGL"] = 37446] = "UNMASKED_RENDERER_WEBGL"; GLEnum2[GLEnum2["MAX_TEXTURE_MAX_ANISOTROPY_EXT"] = 34047] = "MAX_TEXTURE_MAX_ANISOTROPY_EXT"; GLEnum2[GLEnum2["TEXTURE_MAX_ANISOTROPY_EXT"] = 34046] = "TEXTURE_MAX_ANISOTROPY_EXT"; GLEnum2[GLEnum2["R16_EXT"] = 33322] = "R16_EXT"; GLEnum2[GLEnum2["RG16_EXT"] = 33324] = "RG16_EXT"; GLEnum2[GLEnum2["RGB16_EXT"] = 32852] = "RGB16_EXT"; GLEnum2[GLEnum2["RGBA16_EXT"] = 32859] = "RGBA16_EXT"; GLEnum2[GLEnum2["R16_SNORM_EXT"] = 36760] = "R16_SNORM_EXT"; GLEnum2[GLEnum2["RG16_SNORM_EXT"] = 36761] = "RG16_SNORM_EXT"; GLEnum2[GLEnum2["RGB16_SNORM_EXT"] = 36762] = "RGB16_SNORM_EXT"; GLEnum2[GLEnum2["RGBA16_SNORM_EXT"] = 36763] = "RGBA16_SNORM_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGB_S3TC_DXT1_EXT"] = 33776] = "COMPRESSED_RGB_S3TC_DXT1_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGBA_S3TC_DXT1_EXT"] = 33777] = "COMPRESSED_RGBA_S3TC_DXT1_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGBA_S3TC_DXT3_EXT"] = 33778] = "COMPRESSED_RGBA_S3TC_DXT3_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGBA_S3TC_DXT5_EXT"] = 33779] = "COMPRESSED_RGBA_S3TC_DXT5_EXT"; GLEnum2[GLEnum2["COMPRESSED_SRGB_S3TC_DXT1_EXT"] = 35916] = "COMPRESSED_SRGB_S3TC_DXT1_EXT"; GLEnum2[GLEnum2["COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"] = 35917] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT"; GLEnum2[GLEnum2["COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"] = 35918] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT"; GLEnum2[GLEnum2["COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"] = 35919] = "COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT"; GLEnum2[GLEnum2["COMPRESSED_RED_RGTC1_EXT"] = 36283] = "COMPRESSED_RED_RGTC1_EXT"; GLEnum2[GLEnum2["COMPRESSED_SIGNED_RED_RGTC1_EXT"] = 36284] = "COMPRESSED_SIGNED_RED_RGTC1_EXT"; GLEnum2[GLEnum2["COMPRESSED_RED_GREEN_RGTC2_EXT"] = 36285] = "COMPRESSED_RED_GREEN_RGTC2_EXT"; GLEnum2[GLEnum2["COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT"] = 36286] = "COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGBA_BPTC_UNORM_EXT"] = 36492] = "COMPRESSED_RGBA_BPTC_UNORM_EXT"; GLEnum2[GLEnum2["COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT"] = 36493] = "COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT"] = 36494] = "COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT"; GLEnum2[GLEnum2["COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT"] = 36495] = "COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT"; GLEnum2[GLEnum2["COMPRESSED_R11_EAC"] = 37488] = "COMPRESSED_R11_EAC"; GLEnum2[GLEnum2["COMPRESSED_SIGNED_R11_EAC"] = 37489] = "COMPRESSED_SIGNED_R11_EAC"; GLEnum2[GLEnum2["COMPRESSED_RG11_EAC"] = 37490] = "COMPRESSED_RG11_EAC"; GLEnum2[GLEnum2["COMPRESSED_SIGNED_RG11_EAC"] = 37491] = "COMPRESSED_SIGNED_RG11_EAC"; GLEnum2[GLEnum2["COMPRESSED_RGB8_ETC2"] = 37492] = "COMPRESSED_RGB8_ETC2"; GLEnum2[GLEnum2["COMPRESSED_RGBA8_ETC2_EAC"] = 37493] = "COMPRESSED_RGBA8_ETC2_EAC"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ETC2"] = 37494] = "COMPRESSED_SRGB8_ETC2"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"] = 37495] = "COMPRESSED_SRGB8_ALPHA8_ETC2_EAC"; GLEnum2[GLEnum2["COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37496] = "COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"] = 37497] = "COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2"; GLEnum2[GLEnum2["COMPRESSED_RGB_PVRTC_4BPPV1_IMG"] = 35840] = "COMPRESSED_RGB_PVRTC_4BPPV1_IMG"; GLEnum2[GLEnum2["COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"] = 35842] = "COMPRESSED_RGBA_PVRTC_4BPPV1_IMG"; GLEnum2[GLEnum2["COMPRESSED_RGB_PVRTC_2BPPV1_IMG"] = 35841] = "COMPRESSED_RGB_PVRTC_2BPPV1_IMG"; GLEnum2[GLEnum2["COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"] = 35843] = "COMPRESSED_RGBA_PVRTC_2BPPV1_IMG"; GLEnum2[GLEnum2["COMPRESSED_RGB_ETC1_WEBGL"] = 36196] = "COMPRESSED_RGB_ETC1_WEBGL"; GLEnum2[GLEnum2["COMPRESSED_RGB_ATC_WEBGL"] = 35986] = "COMPRESSED_RGB_ATC_WEBGL"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"] = 35986] = "COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"] = 34798] = "COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_4x4_KHR"] = 37808] = "COMPRESSED_RGBA_ASTC_4x4_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_5x4_KHR"] = 37809] = "COMPRESSED_RGBA_ASTC_5x4_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_5x5_KHR"] = 37810] = "COMPRESSED_RGBA_ASTC_5x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_6x5_KHR"] = 37811] = "COMPRESSED_RGBA_ASTC_6x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_6x6_KHR"] = 37812] = "COMPRESSED_RGBA_ASTC_6x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_8x5_KHR"] = 37813] = "COMPRESSED_RGBA_ASTC_8x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_8x6_KHR"] = 37814] = "COMPRESSED_RGBA_ASTC_8x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_8x8_KHR"] = 37815] = "COMPRESSED_RGBA_ASTC_8x8_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_10x5_KHR"] = 37816] = "COMPRESSED_RGBA_ASTC_10x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_10x6_KHR"] = 37817] = "COMPRESSED_RGBA_ASTC_10x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_10x8_KHR"] = 37818] = "COMPRESSED_RGBA_ASTC_10x8_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_10x10_KHR"] = 37819] = "COMPRESSED_RGBA_ASTC_10x10_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_12x10_KHR"] = 37820] = "COMPRESSED_RGBA_ASTC_12x10_KHR"; GLEnum2[GLEnum2["COMPRESSED_RGBA_ASTC_12x12_KHR"] = 37821] = "COMPRESSED_RGBA_ASTC_12x12_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"] = 37840] = "COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"] = 37841] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"] = 37842] = "COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"] = 37843] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"] = 37844] = "COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"] = 37845] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"] = 37846] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"] = 37847] = "COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"] = 37848] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"] = 37849] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"] = 37850] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"] = 37851] = "COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"] = 37852] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR"; GLEnum2[GLEnum2["COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"] = 37853] = "COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR"; GLEnum2[GLEnum2["QUERY_COUNTER_BITS_EXT"] = 34916] = "QUERY_COUNTER_BITS_EXT"; GLEnum2[GLEnum2["CURRENT_QUERY_EXT"] = 34917] = "CURRENT_QUERY_EXT"; GLEnum2[GLEnum2["QUERY_RESULT_EXT"] = 34918] = "QUERY_RESULT_EXT"; GLEnum2[GLEnum2["QUERY_RESULT_AVAILABLE_EXT"] = 34919] = "QUERY_RESULT_AVAILABLE_EXT"; GLEnum2[GLEnum2["TIME_ELAPSED_EXT"] = 35007] = "TIME_ELAPSED_EXT"; GLEnum2[GLEnum2["TIMESTAMP_EXT"] = 36392] = "TIMESTAMP_EXT"; GLEnum2[GLEnum2["GPU_DISJOINT_EXT"] = 36795] = "GPU_DISJOINT_EXT"; GLEnum2[GLEnum2["COMPLETION_STATUS_KHR"] = 37297] = "COMPLETION_STATUS_KHR"; GLEnum2[GLEnum2["DEPTH_CLAMP_EXT"] = 34383] = "DEPTH_CLAMP_EXT"; GLEnum2[GLEnum2["FIRST_VERTEX_CONVENTION_WEBGL"] = 36429] = "FIRST_VERTEX_CONVENTION_WEBGL"; GLEnum2[GLEnum2["LAST_VERTEX_CONVENTION_WEBGL"] = 36430] = "LAST_VERTEX_CONVENTION_WEBGL"; GLEnum2[GLEnum2["PROVOKING_VERTEX_WEBL"] = 36431] = "PROVOKING_VERTEX_WEBL"; GLEnum2[GLEnum2["POLYGON_MODE_WEBGL"] = 2880] = "POLYGON_MODE_WEBGL"; GLEnum2[GLEnum2["POLYGON_OFFSET_LINE_WEBGL"] = 10754] = "POLYGON_OFFSET_LINE_WEBGL"; GLEnum2[GLEnum2["LINE_WEBGL"] = 6913] = "LINE_WEBGL"; GLEnum2[GLEnum2["FILL_WEBGL"] = 6914] = "FILL_WEBGL"; GLEnum2[GLEnum2["MAX_CLIP_DISTANCES_WEBGL"] = 3378] = "MAX_CLIP_DISTANCES_WEBGL"; GLEnum2[GLEnum2["MAX_CULL_DISTANCES_WEBGL"] = 33529] = "MAX_CULL_DISTANCES_WEBGL"; GLEnum2[GLEnum2["MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL"] = 33530] = "MAX_COMBINED_CLIP_AND_CULL_DISTANCES_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE0_WEBGL"] = 12288] = "CLIP_DISTANCE0_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE1_WEBGL"] = 12289] = "CLIP_DISTANCE1_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE2_WEBGL"] = 12290] = "CLIP_DISTANCE2_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE3_WEBGL"] = 12291] = "CLIP_DISTANCE3_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE4_WEBGL"] = 12292] = "CLIP_DISTANCE4_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE5_WEBGL"] = 12293] = "CLIP_DISTANCE5_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE6_WEBGL"] = 12294] = "CLIP_DISTANCE6_WEBGL"; GLEnum2[GLEnum2["CLIP_DISTANCE7_WEBGL"] = 12295] = "CLIP_DISTANCE7_WEBGL"; GLEnum2[GLEnum2["POLYGON_OFFSET_CLAMP_EXT"] = 36379] = "POLYGON_OFFSET_CLAMP_EXT"; GLEnum2[GLEnum2["LOWER_LEFT_EXT"] = 36001] = "LOWER_LEFT_EXT"; GLEnum2[GLEnum2["UPPER_LEFT_EXT"] = 36002] = "UPPER_LEFT_EXT"; GLEnum2[GLEnum2["NEGATIVE_ONE_TO_ONE_EXT"] = 37726] = "NEGATIVE_ONE_TO_ONE_EXT"; GLEnum2[GLEnum2["ZERO_TO_ONE_EXT"] = 37727] = "ZERO_TO_ONE_EXT"; GLEnum2[GLEnum2["CLIP_ORIGIN_EXT"] = 37724] = "CLIP_ORIGIN_EXT"; GLEnum2[GLEnum2["CLIP_DEPTH_MODE_EXT"] = 37725] = "CLIP_DEPTH_MODE_EXT"; GLEnum2[GLEnum2["SRC1_COLOR_WEBGL"] = 35065] = "SRC1_COLOR_WEBGL"; GLEnum2[GLEnum2["SRC1_ALPHA_WEBGL"] = 34185] = "SRC1_ALPHA_WEBGL"; GLEnum2[GLEnum2["ONE_MINUS_SRC1_COLOR_WEBGL"] = 35066] = "ONE_MINUS_SRC1_COLOR_WEBGL"; GLEnum2[GLEnum2["ONE_MINUS_SRC1_ALPHA_WEBGL"] = 35067] = "ONE_MINUS_SRC1_ALPHA_WEBGL"; GLEnum2[GLEnum2["MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL"] = 35068] = "MAX_DUAL_SOURCE_DRAW_BUFFERS_WEBGL"; GLEnum2[GLEnum2["MIRROR_CLAMP_TO_EDGE_EXT"] = 34627] = "MIRROR_CLAMP_TO_EDGE_EXT"; })(GLEnum || (GLEnum = {})); // src/data-filter/aggregator.ts var AGGREGATE_VS = `#version 300 es #define SHADER_NAME data-filter-vertex-shader #ifdef FLOAT_TARGET in float filterIndices; in float filterPrevIndices; #else in vec2 filterIndices; in vec2 filterPrevIndices; #endif out vec4 vColor; const float component = 1.0 / 255.0; void main() { #ifdef FLOAT_TARGET dataFilter_value *= float(filterIndices != filterPrevIndices); gl_Position = vec4(0.0, 0.0, 0.0, 1.0); vColor = vec4(0.0, 0.0, 0.0, 1.0); #else // Float texture is not supported: pack result into 4 channels x 256 px x 64px dataFilter_value *= float(filterIndices.x != filterPrevIndices.x); float col = filterIndices.x; float row = filterIndices.y * 4.0; float channel = floor(row); row = fract(row); vColor = component * vec4(bvec4(channel == 0.0, channel == 1.0, channel == 2.0, channel == 3.0)); gl_Position = vec4(col * 2.0 - 1.0, row * 2.0 - 1.0, 0.0, 1.0); #endif gl_PointSize = 1.0; } `; var AGGREGATE_FS = `#version 300 es #define SHADER_NAME data-filter-fragment-shader precision highp float; in vec4 vColor; out vec4 fragColor; void main() { if (dataFilter_value < 0.5) { discard; } fragColor = vColor; } `; var FLOAT_TARGET_FEATURES = [ "float32-renderable-webgl", "texture-blend-float-webgl" ]; function supportsFloatTarget(device) { return FLOAT_TARGET_FEATURES.every((feature) => device.features.has(feature)); } function getFramebuffer(device, useFloatTarget) { if (useFloatTarget) { return device.createFramebuffer({ width: 1, height: 1, colorAttachments: [ device.createTexture({ format: "rgba32float", type: GLEnum.FLOAT, mipmaps: false }) ] }); } return device.createFramebuffer({ width: 256, height: 64, colorAttachments: [device.createTexture({ format: "rgba8unorm", type: GLEnum.FLOAT, mipmaps: false })] }); } function getModel(device, shaderOptions, useFloatTarget) { shaderOptions.defines.NON_INSTANCED_MODEL = 1; if (useFloatTarget) { shaderOptions.defines.FLOAT_TARGET = 1; } return new import_engine.Model(device, { id: "data-filter-aggregation-model", vertexCount: 1, isInstanced: false, drawMode: GLEnum.POINTS, vs: AGGREGATE_VS, fs: AGGREGATE_FS, ...shaderOptions }); } var parameters = { blend: true, blendFunc: [GLEnum.ONE, GLEnum.ONE, GLEnum.ONE, GLEnum.ONE], blendEquation: [GLEnum.FUNC_ADD, GLEnum.FUNC_ADD], depthTest: false }; // src/data-filter/data-filter-extension.ts var defaultProps2 = { getFilterValue: { type: "accessor", value: 0 }, getFilterCategory: { type: "accessor", value: 0 }, onFilteredItemsChange: { type: "function", value: null, optional: true }, filterEnabled: true, filterRange: [-1, 1], filterSoftRange: null, filterCategories: [0], filterTransformSize: true, filterTransformColor: true }; var defaultOptions = { categorySize: 0, filterSize: 1, fp64: false, countItems: false }; var DATA_TYPE_FROM_SIZE = { 1: "float", 2: "vec2", 3: "vec3", 4: "vec4" }; var DataFilterExtension = class extends import_core4.LayerExtension { constructor(opts = {}) { super({ ...defaultOptions, ...opts }); } getShaders(extension) { const { categorySize, filterSize, fp64: fp642 } = extension.opts; const defines = {}; if (categorySize) { defines.DATACATEGORY_TYPE = DATA_TYPE_FROM_SIZE[categorySize]; defines.DATACATEGORY_CHANNELS = categorySize; } if (filterSize) { defines.DATAFILTER_TYPE = DATA_TYPE_FROM_SIZE[filterSize]; defines.DATAFILTER_DOUBLE = Boolean(fp642); } return { modules: [fp642 ? shaderModule64 : shaderModule], defines }; } initializeState(context, extension) { const attributeManager = this.getAttributeManager(); const { categorySize, filterSize, fp64: fp642 } = extension.opts; if (attributeManager) { if (filterSize) { attributeManager.add({ filterValues: { size: filterSize, type: fp642 ? "float64" : "float32", stepMode: "dynamic", accessor: "getFilterValue" } }); } if (categorySize) { attributeManager.add({ filterCategoryValues: { size: categorySize, stepMode: "dynamic", accessor: "getFilterCategory", transform: categorySize === 1 ? (d) => extension._getCategoryKey.call(this, d, 0) : (d) => d.map((x, i) => extension._getCategoryKey.call(this, x, i)) } }); } } const { device } = this.context; if (attributeManager && extension.opts.countItems) { const useFloatTarget = supportsFloatTarget(device); attributeManager.add({ filterIndices: { size: useFloatTarget ? 1 : 2, vertexOffset: 1, type: "unorm8", accessor: (object, { index }) => { const i = object && object.__source ? object.__source.index : index; return useFloatTarget ? (i + 1) % 255 : [(i + 1) % 255, Math.floor(i / 255) % 255]; }, shaderAttributes: { filterPrevIndices: { vertexOffset: 0 }, filterIndices: { vertexOffset: 1 } } } }); const filterFBO = getFramebuffer(device, useFloatTarget); const filterModel = getModel( device, extension.getShaders.call(this, extension), useFloatTarget ); this.setState({ filterFBO, filterModel }); } } updateState({ props, oldProps, changeFlags }, extension) { const attributeManager = this.getAttributeManager(); const { categorySize } = extension.opts; if (this.state.filterModel) { const filterNeedsUpdate = attributeManager.attributes.filterValues?.needsUpdate() || attributeManager.attributes.filterCategoryValues?.needsUpdate() || props.filterEnabled !== oldProps.filterEnabled || props.filterRange !== oldProps.filterRange || props.filterSoftRange !== oldProps.filterSoftRange || props.filterCategories !== oldProps.filterCategories; if (filterNeedsUpdate) { this.setState({ filterNeedsUpdate }); } } if (attributeManager?.attributes.filterCategoryValues) { const categoryBitMaskNeedsUpdate = attributeManager.attributes.filterCategoryValues.needsUpdate() || !(0, import_core4._deepEqual)(props.filterCategories, oldProps.filterCategories, 2); if (categoryBitMaskNeedsUpdate) { this.setState({ categoryBitMask: null }); } const resetCategories = changeFlags.dataChanged; if (resetCategories) { this.setState({ categoryMap: Array(categorySize).fill(0).map(() => ({})) }); attributeManager.attributes.filterCategoryValues.setNeedsUpdate("categoryMap"); } } } draw(params, extension) { const filterFBO = this.state.filterFBO; const filterModel = this.state.filterModel; const filterNeedsUpdate = this.state.filterNeedsUpdate; const { onFilteredItemsChange } = this.props; if (!this.state.categoryBitMask) { extension._updateCategoryBitMask.call(this, params, extension); } params.uniforms.filter_categoryBitMask = this.state.categoryBitMask; if (filterNeedsUpdate && onFilteredItemsChange && filterModel) { const { attributes: { filterValues, filterCategoryValues, filterIndices } } = this.getAttributeManager(); filterModel.setVertexCount(this.getNumInstances()); this.context.device.clearWebGL({ framebuffer: filterFBO, color: [0, 0, 0, 0] }); filterModel.updateModuleSettings(params.moduleParameters); filterModel.setAttributes({ ...filterValues?.getValue(), ...filterCategoryValues?.getValue(), ...filterIndices?.getValue() }); filterModel.setUniforms(params.uniforms); filterModel.device.withParametersWebGL( { framebuffer: filterFBO, ...parameters, viewport: [0, 0, filterFBO.width, filterFBO.height] }, () => { filterModel.draw(this.context.renderPass); } ); const color = filterModel.device.readPixelsToArrayWebGL(filterFBO); let count = 0; for (let i = 0; i < color.length; i++) { count += color[i]; } onFilteredItemsChange({ id: this.id, count }); this.state.filterNeedsUpdate = false; } } finalizeState() { const filterFBO = this.state.filterFBO; const filterModel = this.state.filterModel; filterFBO?.destroy(); filterModel?.destroy(); } _updateCategoryBitMask(params, extension) { const { categorySize } = extension.opts; if (!categorySize) return; const { filterCategories } = this.props; const categoryBitMask = new Uint32Array([0, 0, 0, 0]); const categoryFilters = categorySize === 1 ? [filterCategories] : filterCategories; const maxCategories = categorySize === 1 ? 128 : categorySize === 2 ? 64 : 32; for (let c = 0; c < categoryFilters.length; c++) { const categoryFilter = categoryFilters[c]; for (const category of categoryFilter) { const key = extension._getCategoryKey.call(this, category, c); if (key < maxCategories) { const channel = c * (maxCategories / 32) + Math.floor(key / 32); categoryBitMask[channel] += Math.pow(2, key % 32); } else { import_core4.log.warn(`Exceeded maximum number of categories (${maxCategories})`)(); } } } this.state.categoryBitMask = categoryBitMask; } _getCategoryKey(category, channel) { const categoryMap = this.state.categoryMap[channel]; if (!(category in categoryMap)) { categoryMap[category] = Object.keys(categoryMap).length; } return categoryMap[category]; } }; DataFilterExtension.defaultProps = defaultProps2; DataFilterExtension.extensionName = "DataFilterExtension"; // src/fp64/fp64-extension.ts var import_core6 = __toESM(require_core(), 1); // ../../node_modules/@luma.gl/shadertools/dist/modules-webgl1/math/fp64/fp64-utils.js function fp64ify(a, out = [], startIndex = 0) { const hiPart = Math.fround(a); const loPart = a - hiPart; out[startIndex] = hiPart; out[startIndex + 1] = loPart; return out; } function fp64LowPart(a) { return a - Math.fround(a); } function fp64ifyMatrix4(matrix) { const matrixFP64 = new Float32Array(32); for (let i = 0; i < 4; ++i) { for (let j = 0; j < 4; ++j) { const index = i * 4 + j; fp64ify(matrix[j * 4 + i], matrixFP64, index * 2); } } return matrixFP64; } // ../../node_modules/@luma.gl/shadertools/dist/modules-webgl1/math/fp64/fp64-arithmetic-glsl.js var fp64arithmeticShader = `uniform float ONE; vec2 split(float a) { const float SPLIT = 4097.0; float t = a * SPLIT; #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) float a_hi = t * ONE - (t - a); float a_lo = a * ONE - a_hi; #else float a_hi = t - (t - a); float a_lo = a - a_hi; #endif return vec2(a_hi, a_lo); } vec2 split2(vec2 a) { vec2 b = split(a.x); b.y += a.y; return b; } vec2 quickTwoSum(float a, float b) { #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) float sum = (a + b) * ONE; float err = b - (sum - a) * ONE; #else float sum = a + b; float err = b - (sum - a); #endif return vec2(sum, err); } vec2 twoSum(float a, float b) { float s = (a + b); #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) float v = (s * ONE - a) * ONE; float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v); #else float v = s - a; float err = (a - (s - v)) + (b - v); #endif return vec2(s, err); } vec2 twoSub(float a, float b) { float s = (a - b); #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) float v = (s * ONE - a) * ONE; float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v); #else float v = s - a; float err = (a - (s - v)) - (b + v); #endif return vec2(s, err); } vec2 twoSqr(float a) { float prod = a * a; vec2 a_fp64 = split(a); #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x * a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE; #else float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y; #endif return vec2(prod, err); } vec2 twoProd(float a, float b) { float prod = a * b; vec2 a_fp64 = split(a); vec2 b_fp64 = split(b); float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y + a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y; return vec2(prod, err); } vec2 sum_fp64(vec2 a, vec2 b) { vec2 s, t; s = twoSum(a.x, b.x); t = twoSum(a.y, b.y); s.y += t.x; s = quickTwoSum(s.x, s.y); s.y += t.y; s = quickTwoSum(s.x, s.y); return s; } vec2 sub_fp64(vec2 a, vec2 b) { vec2 s, t; s = twoSub(a.x, b.x); t = twoSub(a.y, b.y); s.y += t.x; s = quickTwoSum(s.x, s.y); s.y += t.y; s = quickTwoSum(s.x, s.y); return s; } vec2 mul_fp64(vec2 a, vec2 b) { vec2 prod = twoProd(a.x, b.x); prod.y += a.x * b.y; #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) prod = split2(prod); #endif prod = quickTwoSum(prod.x, prod.y); prod.y += a.y * b.x; #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) prod = split2(prod); #endif prod = quickTwoSum(prod.x, prod.y); return prod; } vec2 div_fp64(vec2 a, vec2 b) { float xn = 1.0 / b.x; #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) vec2 yn = mul_fp64(a, vec2(xn, 0)); #else vec2 yn = a * xn; #endif float diff = (sub_fp64(a, mul_fp64(b, yn))).x; vec2 prod = twoProd(xn, diff); return sum_fp64(yn, prod); } vec2 sqrt_fp64(vec2 a) { if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0); if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); float x = 1.0 / sqrt(a.x); float yn = a.x * x; #if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND) vec2 yn_sqr = twoSqr(yn) * ONE; #else vec2 yn_sqr = twoSqr(yn); #endif float diff = sub_fp64(a, yn_sqr).x; vec2 prod = twoProd(x * 0.5, diff); #if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND) return sum_fp64(split(yn), prod); #else return sum_fp64(vec2(yn, 0.0), prod); #endif } `; // ../../node_modules/@luma.gl/shadertools/dist/modules-webgl1/math/fp64/fp64-functions-glsl.js var fp64functionShader = `const vec2 E_FP64 = vec2(2.7182817459106445e+00, 8.254840366817007e-08); const vec2 LOG2_FP64 = vec2(0.6931471824645996e+00, -1.9046542121259336e-09); const vec2 PI_FP64 = vec2(3.1415927410125732, -8.742278012618954e-8); const vec2 TWO_PI_FP64 = vec2(6.2831854820251465, -1.7484556025237907e-7); const vec2 PI_2_FP64 = vec2(1.5707963705062866, -4.371139006309477e-8); const vec2 PI_4_FP64 = vec2(0.7853981852531433, -2.1855695031547384e-8); const vec2 PI_16_FP64 = vec2(0.19634954631328583, -5.463923757886846e-9); const vec2 PI_16_2_FP64 = vec2(0.39269909262657166, -1.0927847515773692e-8); const vec2 PI_16_3_FP64 = vec2(0.5890486240386963, -1.4906100798128818e-9); const vec2 PI_180_FP64 = vec2(0.01745329238474369, 1.3519960498364902e-10); const vec2 SIN_TABLE_0_FP64 = vec2(0.19509032368659973, -1.6704714833615242e-9); const vec2 SIN_TABLE_1_FP64 = vec2(0.3826834261417389, 6.22335089017767e-9); const vec2 SIN_TABLE_2_FP64 = vec2(0.5555702447891235, -1.1769521357507529e-8); const vec2 SIN_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617041793133e-8); const vec2 COS_TABLE_0_FP64 = vec2(0.9807852506637573, 2.9739473106360492e-8); const vec2 COS_TABLE_1_FP64 = vec2(0.9238795042037964, 2.8307490351764386e-8); const vec2 COS_TABLE_2_FP64 = vec2(0.8314695954322815, 1.6870263741530778e-8); const vec2 COS_TABLE_3_FP64 = vec2(0.7071067690849304, 1.2101617152815436e-8); const vec2 INVERSE_FACTORIAL_3_FP64 = vec2(1.666666716337204e-01, -4.967053879312289e-09); const vec2 INVERSE_FACTORIAL_4_FP64 = vec2(4.16666679084301e-02, -1.2417634698280722e-09); const vec2 INVERSE_FACTORIAL_5_FP64 = vec2(8.333333767950535e-03, -4.34617203337595e-10); const vec2 INVERSE_FACTORIAL_6_FP64 = vec2(1.3888889225199819e-03, -3.3631094437103215e-11); const vec2 INVERSE_FACTORIAL_7_FP64 = vec2(1.9841270113829523e-04, -2.725596874933456e-12); const vec2 INVERSE_FACTORIAL_8_FP64 = vec2(2.4801587642286904e-05, -3.406996025904184e-13); const vec2 INVERSE_FACTORIAL_9_FP64 = vec2(2.75573188446287533e-06, 3.7935713937038186e-14); const vec2 INVERSE_FACTORIAL_10_FP64 = vec2(2.755731998149713e-07, -7.575112367869873e-15); float nint(float d) { if (d == floor(d)) return d; return floor(d + 0.5); } vec2 nint_fp64(vec2 a) { float hi = nint(a.x); float lo; vec2 tmp; if (hi == a.x) { lo = nint(a.y); tmp = quickTwoSum(hi, lo); } else { lo = 0.0; if (abs(hi - a.x) == 0.5 && a.y < 0.0) { hi -= 1.0; } tmp = vec2(hi, lo); } return tmp; } vec2 exp_fp64(vec2 a) { const int k_power = 4; const float k = 16.0; const float inv_k = 1.0 / k; if (a.x <= -88.0) return vec2(0.0, 0.0); if (a.x >= 88.0) return vec2(1.0 / 0.0, 1.0 / 0.0); if (a.x == 0.0 && a.y == 0.0) return vec2(1.0, 0.0); if (a.x == 1.0 && a.y == 0.0) return E_FP64; float m = floor(a.x / LOG2_FP64.x + 0.5); vec2 r = sub_fp64(a, mul_fp64(LOG2_FP64, vec2(m, 0.0))) * inv_k; vec2 s, t, p; p = mul_fp64(r, r); s = sum_fp64(r, p * 0.5); p = mul_fp64(p, r); t = mul_fp64(p, INVERSE_FACTORIAL_3_FP64); s = sum_fp64(s, t); p = mul_fp64(p, r); t = mul_fp64(p, INVERSE_FACTORIAL_4_FP64); s = sum_fp64(s, t); p = mul_fp64(p, r); t = mul_fp64(p, INVERSE_FACTORIAL_5_FP64); s = sum_fp64(s, t); for (int i = 0; i < k_power; i++) { s = sum_fp64(s * 2.0, mul_fp64(s, s)); } #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND) s = sum_fp64(s, vec2(ONE, 0.0)); #else s = sum_fp64(s, vec2(1.0, 0.0)); #endif return s * pow(2.0, m); } vec2 log_fp64(vec2 a) { if (a.x == 1.0 && a.y == 0.0) return vec2(0.0, 0.0); if (a.x <= 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0); vec2 x = vec2(log(a.x), 0.0); vec2 s; #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND) s = vec2(ONE, 0.0); #else s = vec2(1.0, 0.0); #endif x = sub_fp64(sum_fp64(x, mul_fp64(a, exp_fp64(-x))), s); return x; } vec2 sin_taylor_fp64(vec2 a) { vec2 r, s, t, x; if (a.x == 0.0 && a.y == 0.0) { return vec2(0.0, 0.0); } x = -mul_fp64(a, a); s = a; r = a; r = mul_fp64(r, x); t = mul_fp64(r, INVERSE_FACTORIAL_3_FP64); s = sum_fp64(s, t); r = mul_fp64(r, x); t = mul_fp64(r, INVERSE_FACTORIAL_5_FP64); s = sum_fp64(s, t); return s; } vec2 cos_taylor_fp64(vec2 a) { vec2 r, s, t, x; if (a.x == 0.0 && a.y == 0.0) { return vec2(1.0, 0.0); } x = -mul_fp64(a, a); r = x; s = sum_fp64(vec2(1.0, 0.0), r * 0.5); r = mul_fp64(r, x); t = mul_fp64(r, INVERSE_FACTORIAL_4_FP64); s = sum_fp64(s, t); r = mul_fp64(r, x); t = mul_fp64(r, INVERSE_FACTORIAL_6_FP64); s = sum_fp64(s, t); return s; } void sincos_taylor_fp64(vec2 a, out vec2 sin_t, out vec2 cos_t) { if (a.x == 0.0 && a.y == 0.0) { sin_t = vec2(0.0, 0.0); cos_t = vec2(1.0, 0.0); } sin_t = sin_taylor_fp64(a); cos_t = sqrt_fp64(sub_fp64(vec2(1.0, 0.0), mul_fp64(sin_t, sin_t))); } vec2 sin_fp64(vec2 a) { if (a.x == 0.0 && a.y == 0.0) { return vec2(0.0, 0.0); } vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64)); vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z)); vec2 t; float q = floor(r.x / PI_2_FP64.x + 0.5); int j = int(q); if (j < -2 || j > 2) { return vec2(0.0 / 0.0, 0.0 / 0.0); } t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0))); q = floor(t.x / PI_16_FP64.x + 0.5); int k = int(q); if (k == 0) { if (j == 0) { return sin_taylor_fp64(t); } else if (j == 1) { return cos_taylor_fp64(t); } else if (j == -1) { return -cos_taylor_fp64(t); } else { return -sin_taylor_fp64(t); } } int abs_k = int(abs(float(k))); if (abs_k > 4) { return vec2(0.0 / 0.0, 0.0 / 0.0); } else { t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0))); } vec2 u = vec2(0.0, 0.0); vec2 v = vec2(0.0, 0.0); #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND) if (abs(float(abs_k) - 1.0) < 0.5) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs(float(abs_k) - 2.0) < 0.5) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs(float(abs_k) - 3.0) < 0.5) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs(float(abs_k) - 4.0) < 0.5) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #else if (abs_k == 1) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs_k == 2) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs_k == 3) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs_k == 4) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #endif vec2 sin_t, cos_t; sincos_taylor_fp64(t, sin_t, cos_t); vec2 result = vec2(0.0, 0.0); if (j == 0) { if (k > 0) { result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } else { result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } } else if (j == 1) { if (k > 0) { result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } else { result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } } else if (j == -1) { if (k > 0) { result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t)); } else { result = -sum_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t)); } } else { if (k > 0) { result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } else { result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t)); } } return result; } vec2 cos_fp64(vec2 a) { if (a.x == 0.0 && a.y == 0.0) { return vec2(1.0, 0.0); } vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64)); vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z)); vec2 t; float q = floor(r.x / PI_2_FP64.x + 0.5); int j = int(q); if (j < -2 || j > 2) { return vec2(0.0 / 0.0, 0.0 / 0.0); } t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0))); q = floor(t.x / PI_16_FP64.x + 0.5); int k = int(q); if (k == 0) { if (j == 0) { return cos_taylor_fp64(t); } else if (j == 1) { return -sin_taylor_fp64(t); } else if (j == -1) { return sin_taylor_fp64(t); } else { return -cos_taylor_fp64(t); } } int abs_k = int(abs(float(k))); if (abs_k > 4) { return vec2(0.0 / 0.0, 0.0 / 0.0); } else { t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0))); } vec2 u = vec2(0.0, 0.0); vec2 v = vec2(0.0, 0.0); #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND) if (abs(float(abs_k) - 1.0) < 0.5) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs(float(abs_k) - 2.0) < 0.5) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs(float(abs_k) - 3.0) < 0.5) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs(float(abs_k) - 4.0) < 0.5) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #else if (abs_k == 1) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs_k == 2) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs_k == 3) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs_k == 4) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #endif vec2 sin_t, cos_t; sincos_taylor_fp64(t, sin_t, cos_t); vec2 result = vec2(0.0, 0.0); if (j == 0) { if (k > 0) { result = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } else { result = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } } else if (j == 1) { if (k > 0) { result = -sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } else { result = sub_fp64(mul_fp64(v, cos_t), mul_fp64(u, sin_t)); } } else if (j == -1) { if (k > 0) { result = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } else { result = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); } } else { if (k > 0) { result = sub_fp64(mul_fp64(v, sin_t), mul_fp64(u, cos_t)); } else { result = -sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } } return result; } vec2 tan_fp64(vec2 a) { vec2 sin_a; vec2 cos_a; if (a.x == 0.0 && a.y == 0.0) { return vec2(0.0, 0.0); } vec2 z = nint_fp64(div_fp64(a, TWO_PI_FP64)); vec2 r = sub_fp64(a, mul_fp64(TWO_PI_FP64, z)); vec2 t; float q = floor(r.x / PI_2_FP64.x + 0.5); int j = int(q); if (j < -2 || j > 2) { return vec2(0.0 / 0.0, 0.0 / 0.0); } t = sub_fp64(r, mul_fp64(PI_2_FP64, vec2(q, 0.0))); q = floor(t.x / PI_16_FP64.x + 0.5); int k = int(q); int abs_k = int(abs(float(k))); if (abs_k > 4) { return vec2(0.0 / 0.0, 0.0 / 0.0); } else { t = sub_fp64(t, mul_fp64(PI_16_FP64, vec2(q, 0.0))); } vec2 u = vec2(0.0, 0.0); vec2 v = vec2(0.0, 0.0); vec2 sin_t, cos_t; vec2 s, c; sincos_taylor_fp64(t, sin_t, cos_t); if (k == 0) { s = sin_t; c = cos_t; } else { #if defined(NVIDIA_FP64_WORKAROUND) || defined(INTEL_FP64_WORKAROUND) if (abs(float(abs_k) - 1.0) < 0.5) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs(float(abs_k) - 2.0) < 0.5) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs(float(abs_k) - 3.0) < 0.5) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs(float(abs_k) - 4.0) < 0.5) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #else if (abs_k == 1) { u = COS_TABLE_0_FP64; v = SIN_TABLE_0_FP64; } else if (abs_k == 2) { u = COS_TABLE_1_FP64; v = SIN_TABLE_1_FP64; } else if (abs_k == 3) { u = COS_TABLE_2_FP64; v = SIN_TABLE_2_FP64; } else if (abs_k == 4) { u = COS_TABLE_3_FP64; v = SIN_TABLE_3_FP64; } #endif if (k > 0) { s = sum_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); c = sub_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } else { s = sub_fp64(mul_fp64(u, sin_t), mul_fp64(v, cos_t)); c = sum_fp64(mul_fp64(u, cos_t), mul_fp64(v, sin_t)); } } if (j == 0) { sin_a = s; cos_a = c; } else if (j == 1) { sin_a = c; cos_a = -s; } else if (j == -1) { sin_a = -c; cos_a = s; } else { sin_a = -s; cos_a = -c; } return div_fp64(sin_a, cos_a); } vec2 radians_fp64(vec2 degree) { return mul_fp64(degree, PI_180_FP64); } vec2 mix_fp64(vec2 a, vec2 b, float x) { vec2 range = sub_fp64(b, a); return sum_fp64(a, mul_fp64(range, vec2(x, 0.0))); } void vec2_sum_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) { out_val[0] = sum_fp64(a[0], b[0]); out_val[1] = sum_fp64(a[1], b[1]); } void vec2_sub_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) { out_val[0] = sub_fp64(a[0], b[0]); out_val[1] = sub_fp64(a[1], b[1]); } void vec2_mul_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) { out_val[0] = mul_fp64(a[0], b[0]); out_val[1] = mul_fp64(a[1], b[1]); } void vec2_div_fp64(vec2 a[2], vec2 b[2], out vec2 out_val[2]) { out_val[0] = div_fp64(a[0], b[0]); out_val[1] = div_fp64(a[1], b[1]); } void vec2_mix_fp64(vec2 x[2], vec2 y[2], float a, out vec2 out_val[2]) { vec2 range[2]; vec2_sub_fp64(y, x, range); vec2 portion[2]; portion[0] = range[0] * a; portion[1] = range[1] * a; vec2_sum_fp64(x, portion, out_val); } vec2 vec2_length_fp64(vec2 x[2]) { return sqrt_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1]))); } void vec2_normalize_fp64(vec2 x[2], out vec2 out_val[2]) { vec2 length = vec2_length_fp64(x); vec2 length_vec2[2]; length_vec2[0] = length; length_vec2[1] = length; vec2_div_fp64(x, length_vec2, out_val); } vec2 vec2_distance_fp64(vec2 x[2], vec2 y[2]) { vec2 diff[2]; vec2_sub_fp64(x, y, diff); return vec2_length_fp64(diff); } vec2 vec2_dot_fp64(vec2 a[2], vec2 b[2]) { vec2 v[2]; v[0] = mul_fp64(a[0], b[0]); v[1] = mul_fp64(a[1], b[1]); return sum_fp64(v[0], v[1]); } void vec3_sub_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) { for (int i = 0; i < 3; i++) { out_val[i] = sum_fp64(a[i], b[i]); } } void vec3_sum_fp64(vec2 a[3], vec2 b[3], out vec2 out_val[3]) { for (int i = 0; i < 3; i++) { out_val[i] = sum_fp64(a[i], b[i]); } } vec2 vec3_length_fp64(vec2 x[3]) { return sqrt_fp64(sum_fp64(sum_fp64(mul_fp64(x[0], x[0]), mul_fp64(x[1], x[1])), mul_fp64(x[2], x[2]))); } vec2 vec3_distance_fp64(vec2 x[3], vec2 y[3]) { vec2 diff[3]; vec3_sub_fp64(x, y, diff); return vec3_length_fp64(diff); } void vec4_fp64(vec4 a, out vec2 out_val[4]) { out_val[0].x = a[0]; out_val[0].y = 0.0; out_val[1].x = a[1]; out_val[1].y = 0.0; out_val[2].x = a[2]; out_val[2].y = 0.0; out_val[3].x = a[3]; out_val[3].y = 0.0; } void vec4_scalar_mul_fp64(vec2 a[4], vec2 b, out vec2 out_val[4]) { out_val[0] = mul_fp64(a[0], b); out_val[1] = mul_fp64(a[1], b); out_val[2] = mul_fp64(a[2], b); out_val[3] = mul_fp64(a[3], b); } void vec4_sum_fp64(vec2 a[4], vec2 b[4], out vec2 out_val[4]) { for (int i = 0; i < 4; i++) { out_val[i] = sum_fp64(a[i], b[i]); } } void vec4_dot_fp64(vec2 a[4], vec2 b[4], out vec2 out_val) { vec2 v[4]; v[0] = mul_fp64(a[0], b[0]); v[1] = mul_fp64(a[1], b[1]); v[2] = mul_fp64(a[2], b[2]); v[3] = mul_fp64(a[3], b[3]); out_val = sum_fp64(sum_fp64(v[0], v[1]), sum_fp64(v[2], v[3])); } void mat4_vec4_mul_fp64(vec2 b[16], vec2 a[4], out vec2 out_val[4]) { vec2 tmp[4]; for (int i = 0; i < 4; i++) { for (int j = 0; j < 4; j++) { tmp[j] = b[j + i * 4]; } vec4_dot_fp64(a, tmp, out_val[i]); } } `; // ../../node_modules/@luma.gl/shadertools/dist/modules-webgl1/math/fp64/fp64.js var CONST_UNIFORMS = { ONE: 1 }; function getUniforms2() { return CONST_UNIFORMS; } var fp64arithmetic = { name: "fp64-arithmetic", vs: fp64arithmeticShader, getUniforms: getUniforms2, fp64ify, fp64LowPart, fp64ifyMatrix4 }; var fp64 = { name: "fp64", vs: fp64functionShader, dependencies: [fp64arithmetic], fp64ify, fp64LowPart, fp64ifyMatrix4 }; // ../../node_modules/@math.gl/core/dist/lib/common.js var RADIANS_TO_DEGREES = 1 / Math.PI * 180; var DEGREES_TO_RADIANS = 1 / 180 * Math.PI; var DEFAULT_CONFIG = { EPSILON: 1e-12, debug: false, precision: 4, printTypes: false, printDegrees: false, printRowMajor: true, _cartographicRadians: false }; globalThis.mathgl = globalThis.mathgl || { config: { ...DEFAULT_CONFIG } }; var config = globalThis.mathgl.config; function isArray(value) { return Array.isArray(value) || ArrayBuffer.isView(value) && !(value instanceof DataView); } function equals(a, b, epsilon) { const oldEpsilon = config.EPSILON; if (epsilon) { config.EPSILON = epsilon; } try { if (a === b) { return true; } if (isArray(a) && isArray(b)) { if (a.length !== b.length) { return false; } for (let i = 0; i < a.length; ++i) { if (!equals(a[i], b[i])) { return false; } } return true; } if (a && a.equals) { return a.equals(b); } if (b && b.equals) { return b.equals(a); } if (typeof a === "number" && typeof b === "number") { return Math.abs(a - b) <= config.EPSILON * Math.max(1, Math.abs(a), Math.abs(b)); } return false; } finally { config.EPSILON = oldEpsilon; } } // ../../node_modules/@math.gl/core/dist/gl-matrix/common.js var EPSILON = 1e-6; var ARRAY_TYPE = typeof Float32Array !== "undefined" ? Float32Array : Array; var RANDOM = Math.random; function round(a) { if (a >= 0) return Math.round(a); return a % 0.5 === 0 ? Math.floor(a) : Math.round(a); } var degree = Math.PI / 180; // ../../node_modules/@math.gl/core/dist/gl-matrix/vec3.js var vec3_exports = {}; __export(vec3_exports, { add: () => add, angle: () => angle, bezier: () => bezier, ceil: () => ceil, clone: () => clone, copy: () => copy, create: () => create, cross: () => cross, dist: () => dist, distance: () => distance, div: () => div, divide: () => divide, dot: () => dot, equals: () => equals2, exactEquals: () => exactEquals, floor: () => floor, forEach: () => forEach, fromValues: () => fromValues, hermite: () => hermite, inverse: () => inverse, len: () => len, length: () => length, lerp: () => lerp, max: () => max, min: () => min, mul: () => mul, multiply: () => multiply, negate: () => negate, normalize: () => normalize, random: () => random, rotateX: () => rotateX, rotateY: () => rotateY, rotateZ: () => rotateZ, round: () => round2, scale: () => scale, scaleAndAdd: () => scaleAndAdd, set: () => set, slerp: () => slerp, sqrDist: () => sqrDist, sqrLen: () => sqrLen, squaredDistance: () => squaredDistance, squaredLength: () => squaredLength, str: () => str, sub: () => sub, subtract: () => subtract, transformMat3: () => transformMat3, transformMat4: () => transformMat4, transformQuat: () => transformQuat, zero: () => zero }); function create() { const out = new ARRAY_TYPE(3); if (ARRAY_TYPE != Float32Array) { out[0] = 0; out[1] = 0; out[2] = 0; } return out; } function clone(a) { const out = new ARRAY_TYPE(3); out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; return out; } function length(a) { const x = a[0]; const y = a[1]; const z = a[2]; return Math.sqrt(x * x + y * y + z * z); } function fromValues(x, y, z) { const out = new ARRAY_TYPE(3); out[0] = x; out[1] = y; out[2] = z; return out; } function copy(out, a) { out[0] = a[0]; out[1] = a[1]; out[2] = a[2]; return out; } function set(out, x, y, z) { out[0] = x; out[1] = y; out[2] = z; return out; } function add(out, a, b) { out[0] = a[0] + b[0]; out[1] = a[1] + b[1]; out[2] = a[2] + b[2]; return out; } function subtract(out, a, b) { out[0] = a[0] - b[0]; out[1] = a[1] - b[1]; out[2] = a[2] - b[2]; return out; } function multiply(out, a, b) { out[0] = a[0] * b[0]; out[1] = a[1] * b[1]; out[2] = a[2] * b[2]; return out; } function divide(out, a, b) { out[0] = a[0] / b[0]; out[1] = a[1] / b[1]; out[2] = a[2] / b[2]; return out; } function ceil(out, a) { out[0] = Math.ceil(a[0]); out[1] = Math.ceil(a[1]); out[2] = Math.ceil(a[2]); return out; } function floor(out, a) { out[0] = Math.floor(a[0]); out[1] = Math.floor(a[1]); out[2] = Math.floor(a[2]); return out; } function min(out, a, b) { out[0] = Math.min(a[0], b[0]); out[1] = Math.min(a[1], b[1]); out[2] = Math.min(a[2], b[2]); return out; } function max(out, a, b) { out[0] = Math.max(a[0], b[0]); out[1] = Math.max(a[1], b[1]); out[2] = Math.max(a[2], b[2]); return out; } function round2(out, a) { out[0] = round(a[0]); out[1] = round(a[1]); out[2] = round(a[2]); return out; } function scale(out, a, b) { out[0] = a[0] * b; out[1] = a[1] * b; out[2] = a[2] * b; return out; } function scaleAndAdd(out, a, b, scale2) { out[0] = a[0] + b[0] * scale2; out[1] = a[1] + b[1] * scale2; out[2] = a[2] + b[2] * scale2; return out; } function distance(a, b) { const x = b[0] - a[0]; const y = b[1] - a[1]; const z = b[2] - a[2]; return Math.sqrt(x * x + y * y + z * z); } function squaredDistance(a, b) { const x = b[0] - a[0]; const y = b[1] - a[1]; const z = b[2] - a[2]; return x * x + y * y + z * z; } function squaredLength(a) { const x = a[0]; const y = a[1]; const z = a[2]; return x * x + y * y + z * z; } function negate(out, a) { out[0] = -a[0]; out[1] = -a[1]; out[2] = -a[2]; return out; } function inverse(out, a) { out[0] = 1 / a[0]; out[1] = 1 / a[1]; out[2] = 1 / a[2]; return out; } function normalize(out, a) { const x = a[0]; const y = a[1]; const z = a[2]; let len2 = x * x + y * y + z * z; if (len2 > 0) { len2 = 1 / Math.sqrt(len2); } out[0] = a[0] * len2; out[1] = a[1] * len2; out[2] = a[2] * len2; return out; } function dot(a, b) { return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; } function cross(out, a, b) { const ax = a[0]; const ay = a[1]; const az = a[2]; const bx = b[0]; const by = b[1]; const bz = b[2]; out[0] = ay * bz - az * by; out[1] = az * bx - ax * bz; out[2] = ax * by - ay * bx; return out; } function lerp(out, a, b, t) { const ax = a[0]; const ay = a[1]; const az = a[2]; out[0] = ax + t * (b[0] - ax); out[1] = ay + t * (b[1] - ay); out[2] = az + t * (b[2] - az); return out; } function slerp(out, a, b, t) { const angle2 = Math.acos(Math.min(Math.max(dot(a, b), -1), 1)); const sinTotal = Math.sin(angle2); const ratioA = Math.sin((1 - t) * angle2) / sinTotal; const ratioB = Math.sin(t * angle2) / sinTotal; out[0] = ratioA * a[0] + ratioB * b[0]; out[1] = ratioA * a[1] + ratioB * b[1]; out[2] = ratioA * a[2] + ratioB * b[2]; return out; } function hermite(out, a, b, c, d, t) { const factorTimes2 = t * t; const factor1 = factorTimes2 * (2 * t - 3) + 1; const factor2 = factorTimes2 * (t - 2) + t; const factor3 = factorTimes2 * (t - 1); const factor4 = factorTimes2 * (3 - 2 * t); out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; return out; } function bezier(out, a, b, c, d, t) { const inverseFactor = 1 - t; const inverseFactorTimesTwo = inverseFactor * inverseFactor; const factorTimes2 = t * t; const factor1 = inverseFactorTimesTwo * inverseFactor; const factor2 = 3 * t * inverseFactorTimesTwo; const factor3 = 3 * factorTimes2 * inverseFactor; const factor4 = factorTimes2 * t; out[0] = a[0] * factor1 + b[0] * factor2 + c[0] * factor3 + d[0] * factor4; out[1] = a[1] * factor1 + b[1] * factor2 + c[1] * factor3 + d[1] * factor4; out[2] = a[2] * factor1 + b[2] * factor2 + c[2] * factor3 + d[2] * factor4; return out; } function random(out, scale2) { scale2 = scale2 === void 0 ? 1 : scale2; const r = RANDOM() * 2 * Math.PI; const z = RANDOM() * 2 - 1; const zScale = Math.sqrt(1 - z * z) * scale2; out[0] = Math.cos(r) * zScale; out[1] = Math.sin(r) * zScale; out[2] = z * scale2; return out; } function transformMat4(out, a, m) { const x = a[0]; const y = a[1]; const z = a[2]; let w = m[3] * x + m[7] * y + m[11] * z + m[15]; w = w || 1; out[0] = (m[0] * x + m[4] * y + m[8] * z + m[12]) / w; out[1] = (m[1] * x + m[5] * y + m[9] * z + m[13]) / w; out[2] = (m[2] * x + m[6] * y + m[10] * z + m[14]) / w; return out; } function transformMat3(out, a, m) { const x = a[0]; const y = a[1]; const z = a[2]; out[0] = x * m[0] + y * m[3] + z * m[6]; out[1] = x * m[1] + y * m[4] + z * m[7]; out[2] = x * m[2] + y * m[5] + z * m[8]; return out; } function transformQuat(out, a, q) { const qx = q[0]; const qy = q[1]; const qz = q[2]; const qw = q[3]; const x = a[0]; const y = a[1]; const z = a[2]; let uvx = qy * z - qz * y; let uvy = qz * x - qx * z; let uvz = qx * y - qy * x; let uuvx = qy * uvz - qz * uvy; let uuvy = qz * uvx - qx * uvz; let uuvz = qx * uvy - qy * uvx; const w2 = qw * 2; uvx *= w2; uvy *= w2; uvz *= w2; uuvx *= 2; uuvy *= 2; uuvz *= 2; out[0] = x + uvx + uuvx; out[1] = y + uvy + uuvy; out[2] = z + uvz + uuvz; return out; } function rotateX(out, a, b, rad) { const p = []; const r = []; p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; r[0] = p[0]; r[1] = p[1] * Math.cos(rad) - p[2] * Math.sin(rad); r[2] = p[1] * Math.sin(rad) + p[2] * Math.cos(rad); out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function rotateY(out, a, b, rad) { const p = []; const r = []; p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; r[0] = p[2] * Math.sin(rad) + p[0] * Math.cos(rad); r[1] = p[1]; r[2] = p[2] * Math.cos(rad) - p[0] * Math.sin(rad); out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function rotateZ(out, a, b, rad) { const p = []; const r = []; p[0] = a[0] - b[0]; p[1] = a[1] - b[1]; p[2] = a[2] - b[2]; r[0] = p[0] * Math.cos(rad) - p[1] * Math.sin(rad); r[1] = p[0] * Math.sin(rad) + p[1] * Math.cos(rad); r[2] = p[2]; out[0] = r[0] + b[0]; out[1] = r[1] + b[1]; out[2] = r[2] + b[2]; return out; } function angle(a, b) { const ax = a[0]; const ay = a[1]; const az = a[2]; const bx = b[0]; const by = b[1]; const bz = b[2]; const mag = Math.sqrt((ax * ax + ay * ay + az * az) * (bx * bx + by * by + bz * bz)); const cosine = mag && dot(a, b) / mag; return Math.acos(Math.min(Math.max(cosine, -1), 1)); } function zero(out) { out[0] = 0; out[1] = 0; out[2] = 0; return out; } function str(a) { return `vec3(${a[0]}, ${a[1]}, ${a[2]})`; } function exactEquals(a, b) { return a[0] === b[0] && a[1] === b[1] && a[2] === b[2]; } function equals2(a, b) { const a0 = a[0]; const a1 = a[1]; const a2 = a[2]; const b0 = b[0]; const b1 = b[1]; const b2 = b[2]; return Math.abs(a0 - b0) <= EPSILON * Math.max(1, Math.abs(a0), Math.abs(b0)) && Math.abs(a1 - b1) <= EPSILON * Math.max(1, Math.abs(a1), Math.abs(b1)) && Math.abs(a2 - b2) <= EPSILON * Math.max(1, Math.abs(a2), Math.abs(b2)); } var sub = subtract; var mul = multiply; var div = divide; var dist = distance; var sqrDist = squaredDistance; var len = length; var sqrLen = squaredLength; var forEach = function() { const vec = create(); return function(a, stride, offset, count, fn, arg) { let i; let l; if (!stride) { stride = 3; } if (!offset) { offset = 0; } if (count) { l = Math.min(count * stride + offset, a.length); } else { l = a.length; } for (i = offset; i < l; i += stride) { vec[0] = a[i]; vec[1] = a[i + 1]; vec[2] = a[i + 2]; fn(vec, vec, arg); a[i] = vec[0]; a[i + 1] = vec[1]; a[i + 2] = vec[2]; } return a; }; }(); // src/fp64/project64.ts var import_core5 = __toESM(require_core(), 1); // src/fp64/project64.glsl.ts var project64_glsl_default = ` const vec2 WORLD_SCALE_FP64 = vec2(81.4873275756836, 0.0000032873668232014097); uniform vec2 project_uViewProjectionMatrixFP64[16]; // longitude: lnglat_fp64.xy; latitude: lnglat_fp64.zw void mercatorProject_fp64(vec4 lnglat_fp64, out vec2 out_val[2]) { #if defined(NVIDIA_FP64_WORKAROUND) out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64 * ONE); #else out_val[0] = sum_fp64(radians_fp64(lnglat_fp64.xy), PI_FP64); #endif out_val[1] = sum_fp64(PI_FP64, log_fp64(tan_fp64(sum_fp64(PI_4_FP64, radians_fp64(lnglat_fp64.zw) / 2.0)))); return; } void project_position_fp64(vec4 position_fp64, out vec2 out_val[2]) { vec2 pos_fp64[2]; mercatorProject_fp64(position_fp64, pos_fp64); out_val[0] = mul_fp64(pos_fp64[0], WORLD_SCALE_FP64); out_val[1] = mul_fp64(pos_fp64[1], WORLD_SCALE_FP64); return; } void project_position_fp64(vec2 position, vec2 position64xyLow, out vec2 out_val[2]) { vec4 position64xy = vec4( position.x, position64xyLow.x, position.y, position64xyLow.y); project_position_fp64(position64xy, out_val); } vec4 project_common_position_to_clipspace_fp64(vec2 vertex_pos_modelspace[4]) { vec2 vertex_pos_clipspace[4]; mat4_vec4_mul_fp64(project_uViewProjectionMatrixFP64, vertex_pos_modelspace, vertex_pos_clipspace); return vec4( vertex_pos_clipspace[0].x, vertex_pos_clipspace[1].x, vertex_pos_clipspace[2].x, vertex_pos_clipspace[3].x ); } vec4 project_position_to_clipspace( vec3 position, vec3 position64xyLow, vec3 offset, out vec4 commonPosition ) { // This is the local offset to the instance position vec2 offset64[4]; vec4_fp64(vec4(offset, 0.0), offset64); float z = project_size(position.z); // Apply web mercator projection (depends on coordinate system imn use) vec2 projectedPosition64xy[2]; project_position_fp64(position.xy, position64xyLow.xy, projectedPosition64xy); vec2 commonPosition64[4]; commonPosition64[0] = sum_fp64(offset64[0], projectedPosition64xy[0]); commonPosition64[1] = sum_fp64(offset64[1], projectedPosition64xy[1]); commonPosition64[2] = sum_fp64(offset64[2], vec2(z, 0.0)); commonPosition64[3] = vec2(1.0, 0.0); commonPosition = vec4(projectedPosition64xy[0].x, projectedPosition64xy[1].x, z, 1.0); return project_common_position_to_clipspace_fp64(commonPosition64); } vec4 project_position_to_clipspace( vec3 position, vec3 position64xyLow, vec3 offset ) { vec4 commonPosition; return project_position_to_clipspace( position, position64xyLow, offset, commonPosition ); } `; // src/fp64/project64.ts var { fp64ify: fp64ify2, fp64ifyMatrix4: fp64ifyMatrix42 } = fp64; var project64_default = { name: "project64", dependencies: [import_core5.project, fp64], vs: project64_glsl_default, getUniforms: getUniforms3 }; var getMemoizedUniforms = (0, import_core5._memoize)(calculateUniforms); function getUniforms3(opts) { if (opts && "viewport" in opts) { const { viewProjectionMatrix, scale: scale2 } = opts.viewport; return getMemoizedUniforms({ viewProjectionMatrix, scale: scale2 }); } return {}; } function calculateUniforms({ viewProjectionMatrix, scale: scale2 }) { const glViewProjectionMatrixFP64 = fp64ifyMatrix42(viewProjectionMatrix); const scaleFP64 = fp64ify2(scale2); return { project_uViewProjectionMatrixFP64: glViewProjectionMatrixFP64, project64_uViewProjectionMatrix: glViewProjectionMatrixFP64, project64_uScale: scaleFP64 }; } // src/fp64/fp64-extension.ts var Fp64Extension = class extends import_core6.LayerExtension { getShaders() { const { coordinateSystem } = this.props; if (coordinateSystem !== import_core6.COORDINATE_SYSTEM.LNGLAT && coordinateSystem !== import_core6.COORDINATE_SYSTEM.DEFAULT) { throw new Error("fp64: coordinateSystem must be LNGLAT"); } return { modules: [project64_default] }; } }; Fp64Extension.extensionName = "Fp64Extension"; // src/path-style/path-style-extension.ts var import_core7 = __toESM(require_core(), 1); // src/path-style/shaders.glsl.ts var dashShaders = { inject: { "vs:#decl": ` in vec2 instanceDashArrays; in float instanceDashOffsets; out vec2 vDashArray; out float vDashOffset; `, "vs:#main-end": ` vDashArray = instanceDashArrays; vDashOffset = instanceDashOffsets / width.x; `, "fs:#decl": ` uniform float dashAlignMode; uniform float capType; uniform bool dashGapPickable; in vec2 vDashArray; in float vDashOffset; `, "fs:#main-start": ` float solidLength = vDashArray.x; float gapLength = vDashArray.y; float unitLength = solidLength + gapLength; float offset; if (unitLength > 0.0) { if (dashAlignMode == 0.0) { offset = vDashOffset; } else { unitLength = vPathLength / round(vPathLength / unitLength); offset = solidLength / 2.0; } float unitOffset = mod(vPathPosition.y + offset, unitLength); if (gapLength > 0.0 && unitOffset > solidLength) { if (capType <= 0.5) { if (!(dashGapPickable && bool(picking.isActive))) { discard; } } else { // caps are rounded, test the distance to solid ends float distToEnd = length(vec2( min(unitOffset - solidLength, unitLength - unitOffset), vPathPosition.x )); if (distToEnd > 1.0) { if (!(dashGapPickable && bool(picking.isActive))) { discard; } } } } } ` } }; var offsetShaders = { inject: { "vs:#decl": ` in float instanceOffsets; `, "vs:DECKGL_FILTER_SIZE": ` float offsetWidth = abs(instanceOffsets * 2.0) + 1.0; size *= offsetWidth; `, "vs:#main-end": ` float offsetWidth = abs(instanceOffsets * 2.0) + 1.0; float offsetDir = sign(instanceOffsets); vPathPosition.x = (vPathPosition.x + offsetDir) * offsetWidth - offsetDir; vPathPosition.y *= offsetWidth; vPathLength *= offsetWidth; `, "fs:#main-start": ` float isInside; isInside = step(-1.0, vPathPosition.x) * step(vPathPosition.x, 1.0); if (isInside == 0.0) { discard; } ` } }; // src/path-style/path-style-extension.ts var defaultProps3 = { getDashArray: { type: "accessor", value: [0, 0] }, getOffset: { type: "accessor", value: 0 }, dashJustified: false, dashGapPickable: false }; var PathStyleExtension = class extends import_core7.LayerExtension { constructor({ dash = false, offset = false, highPrecisionDash = false } = {}) { super({ dash: dash || highPrecisionDash, offset, highPrecisionDash }); } isEnabled(layer) { return "pathTesselator" in layer.state; } getShaders(extension) { if (!extension.isEnabled(this)) { return null; } let result = {}; if (extension.opts.dash) { result = (0, import_core7._mergeShaders)(result, dashShaders); } if (extension.opts.offset) { result = (0, import_core7._mergeShaders)(result, offsetShaders); } return result; } initializeState(context, extension) { const attributeManager = this.getAttributeManager(); if (!attributeManager || !extension.isEnabled(this)) { return; } if (extension.opts.dash) { attributeManager.addInstanced({ instanceDashArrays: { size: 2, accessor: "getDashArray" }, instanceDashOffsets: extension.opts.highPrecisionDash ? { size: 1, accessor: "getPath", transform: extension.getDashOffsets.bind(this) } : { size: 1, update: (attribute) => { attribute.constant = true; attribute.value = [0]; } } }); } if (extension.opts.offset) { attributeManager.addInstanced({ instanceOffsets: { size: 1, accessor: "getOffset" } }); } } updateState(params, extension) { if (!extension.isEnabled(this)) { return; } const uniforms = {}; if (extension.opts.dash) { uniforms.dashAlignMode = this.props.dashJustified ? 1 : 0; uniforms.dashGapPickable = Boolean(this.props.dashGapPickable); } this.state.model?.setUniforms(uniforms); } getDashOffsets(path) { const result = [0]; const positionSize = this.props.positionFormat === "XY" ? 2 : 3; const isNested = Array.isArray(path[0]); const geometrySize = isNested ? path.length : path.length / positionSize; let p; let prevP; for (let i = 0; i < geometrySize - 1; i++) { p = isNested ? path[i] : path.slice(i * positionSize, i * positionSize + positionSize); p = this.projectPosition(p); if (i > 0) { result[i] = result[i - 1] + vec3_exports.dist(prevP, p); } prevP = p; } result[geometrySize - 1] = 0; return result; } }; PathStyleExtension.defaultProps = defaultProps3; PathStyleExtension.extensionName = "PathStyleExtension"; // src/fill-style/fill-style-extension.ts var import_core10 = __toESM(require_core(), 1); // src/fill-style/shader-module.ts var import_core9 = __toESM(require_core(), 1); var patternVs = glsl` in vec4 fillPatternFrames; in float fillPatternScales; in vec2 fillPatternOffsets; uniform bool fill_patternEnabled; uniform vec2 fill_patternTextureSize; out vec2 fill_uv; out vec4 fill_patternBounds; out vec4 fill_patternPlacement; `; var patternFs = glsl` uniform bool fill_patternEnabled; uniform bool fill_patternMask; uniform sampler2D fill_patternTexture; uniform vec2 fill_uvCoordinateOrigin; uniform vec2 fill_uvCoordinateOrigin64Low; in vec4 fill_patternBounds; in vec4 fill_patternPlacement; in vec2 fill_uv; const float FILL_UV_SCALE = 512.0 / 40000000.0; `; var inject3 = { "vs:DECKGL_FILTER_GL_POSITION": glsl` fill_uv = geometry.position.xy; `, "vs:DECKGL_FILTER_COLOR": glsl` if (fill_patternEnabled) { fill_patternBounds = fillPatternFrames / vec4(fill_patternTextureSize, fill_patternTextureSize); fill_patternPlacement.xy = fillPatternOffsets; fill_patternPlacement.zw = fillPatternScales * fillPatternFrames.zw; } `, "fs:DECKGL_FILTER_COLOR": glsl` if (fill_patternEnabled) { vec2 scale = FILL_UV_SCALE * fill_patternPlacement.zw; vec2 patternUV = mod(mod(fill_uvCoordinateOrigin, scale) + fill_uvCoordinateOrigin64Low + fill_uv, scale) / scale; patternUV = mod(fill_patternPlacement.xy + patternUV, 1.0); vec2 texCoords = fill_patternBounds.xy + fill_patternBounds.zw * patternUV; vec4 patternColor = texture(fill_patternTexture, texCoords); color.a *= patternColor.a; if (!fill_patternMask) { color.rgb = patternColor.rgb; } } ` }; function getPatternUniforms(opts, uniforms) { if (!opts) { return {}; } if ("fillPatternTexture" in opts) { const { fillPatternTexture } = opts; return { fill_patternTexture: fillPatternTexture, fill_patternTextureSize: [fillPatternTexture.width, fillPatternTexture.height] }; } if ("viewport" in opts) { const { fillPatternMask = true, fillPatternEnabled = true } = opts; const { project_uCommonOrigin: coordinateOriginCommon } = uniforms; const coordinateOriginCommon64Low = [ (0, import_core9.fp64LowPart)(coordinateOriginCommon[0]), (0, import_core9.fp64LowPart)(coordinateOriginCommon[1]) ]; return { fill_uvCoordinateOrigin: coordinateOriginCommon.slice(0, 2), fill_uvCoordinateOrigin64Low: coordinateOriginCommon64Low, fill_patternMask: fillPatternMask, fill_patternEnabled: fillPatternEnabled }; } return {}; } var patternShaders = { name: "fill-pattern", vs: patternVs, fs: patternFs, inject: inject3, dependencies: [import_core9.project], getUniforms: getPatternUniforms }; // src/fill-style/fill-style-extension.ts var defaultProps4 = { fillPatternEnabled: true, fillPatternAtlas: { type: "image", value: null, async: true, parameters: { lodMaxClamp: 0 } }, fillPatternMapping: { type: "object", value: {}, async: true }, fillPatternMask: true, getFillPattern: { type: "accessor", value: (d) => d.pattern }, getFillPatternScale: { type: "accessor", value: 1 }, getFillPatternOffset: { type: "accessor", value: [0, 0] } }; var FillStyleExtension = class extends import_core10.LayerExtension { constructor({ pattern = false } = {}) { super({ pattern }); } isEnabled(layer) { return layer.getAttributeManager() !== null && !("pathTesselator" in layer.state); } getShaders(extension) { if (!extension.isEnabled(this)) { return null; } return { modules: [extension.opts.pattern && patternShaders].filter(Boolean) }; } initializeState(context, extension) { if (!extension.isEnabled(this)) { return; } const attributeManager = this.getAttributeManager(); if (extension.opts.pattern) { attributeManager.add({ fillPatternFrames: { size: 4, stepMode: "dynamic", accessor: "getFillPattern", transform: extension.getPatternFrame.bind(this) }, fillPatternScales: { size: 1, stepMode: "dynamic", accessor: "getFillPatternScale", defaultValue: 1 }, fillPatternOffsets: { size: 2, stepMode: "dynamic", accessor: "getFillPatternOffset" } }); } this.setState({ emptyTexture: this.context.device.createTexture({ data: new Uint8Array(4), width: 1, height: 1 }) }); } updateState({ props, oldProps }, extension) { if (!extension.isEnabled(this)) { return; } if (props.fillPatternMapping && props.fillPatternMapping !== oldProps.fillPatternMapping) { this.getAttributeManager().invalidate("getFillPattern"); } } draw(params, extension) { if (!extension.isEnabled(this)) { return; } const { fillPatternAtlas } = this.props; this.setModuleParameters({ fillPatternTexture: fillPatternAtlas || this.state.emptyTexture }); } finalizeState() { const emptyTexture = this.state.emptyTexture; emptyTexture?.delete(); } getPatternFrame(name) { const { fillPatternMapping } = this.getCurrentLayer().props; const def = fillPatternMapping && fillPatternMapping[name]; return def ? [def.x, def.y, def.width, def.height] : [0, 0, 0, 0]; } }; FillStyleExtension.defaultProps = defaultProps4; FillStyleExtension.extensionName = "FillStyleExtension"; // src/clip/clip-extension.ts var import_core11 = __toESM(require_core(), 1); var defaultProps5 = { clipBounds: [0, 0, 1, 1], clipByInstance: void 0 }; var shaderFunction = glsl` uniform vec4 clip_bounds; bool clip_isInBounds(vec2 position) { return position.x >= clip_bounds[0] && position.y >= clip_bounds[1] && position.x < clip_bounds[2] && position.y < clip_bounds[3]; } `; var shaderModuleVs = { name: "clip-vs", vs: shaderFunction }; var injectionVs = { "vs:#decl": glsl` out float clip_isVisible; `, "vs:DECKGL_FILTER_GL_POSITION": glsl` clip_isVisible = float(clip_isInBounds(geometry.worldPosition.xy)); `, "fs:#decl": glsl` in float clip_isVisible; `, "fs:DECKGL_FILTER_COLOR": glsl` if (clip_isVisible < 0.5) discard; ` }; var shaderModuleFs = { name: "clip-fs", fs: shaderFunction }; var injectionFs = { "vs:#decl": glsl` out vec2 clip_commonPosition; `, "vs:DECKGL_FILTER_GL_POSITION": glsl` clip_commonPosition = geometry.position.xy; `, "fs:#decl": glsl` in vec2 clip_commonPosition; `, "fs:DECKGL_FILTER_COLOR": glsl` if (!clip_isInBounds(clip_commonPosition)) discard; ` }; var ClipExtension = class extends import_core11.LayerExtension { getShaders() { let clipByInstance = "instancePositions" in this.getAttributeManager().attributes; if (this.props.clipByInstance !== void 0) { clipByInstance = Boolean(this.props.clipByInstance); } this.state.clipByInstance = clipByInstance; return clipByInstance ? { modules: [shaderModuleVs], inject: injectionVs } : { modules: [shaderModuleFs], inject: injectionFs }; } draw({ uniforms }) { const { clipBounds } = this.props; if (this.state.clipByInstance) { uniforms.clip_bounds = clipBounds; } else { const corner0 = this.projectPosition([clipBounds[0], clipBounds[1], 0]); const corner1 = this.projectPosition([clipBounds[2], clipBounds[3], 0]); uniforms.clip_bounds = [ Math.min(corner0[0], corner1[0]), Math.min(corner0[1], corner1[1]), Math.max(corner0[0], corner1[0]), Math.max(corner0[1], corner1[1]) ]; } } }; ClipExtension.defaultProps = defaultProps5; ClipExtension.extensionName = "ClipExtension"; // src/collision-filter/collision-filter-extension.ts var import_core16 = __toESM(require_core(), 1); // src/collision-filter/shader-module.ts var import_core12 = __toESM(require_core(), 1); var vs3 = glsl` in float collisionPriorities; uniform sampler2D collision_texture; uniform bool collision_sort; uniform bool collision_enabled; vec2 collision_getCoords(vec4 position) { vec4 collision_clipspace = project_common_position_to_clipspace(position); return (1.0 + collision_clipspace.xy / collision_clipspace.w) / 2.0; } float collision_match(vec2 tex, vec3 pickingColor) { vec4 collision_pickingColor = texture(collision_texture, tex); float delta = dot(abs(collision_pickingColor.rgb - pickingColor), vec3(1.0)); float e = 0.001; return step(delta, e); } float collision_isVisible(vec2 texCoords, vec3 pickingColor) { if (!collision_enabled) { return 1.0; } // Visibility test, sample area of 5x5 pixels in order to fade in/out. // Due to the locality, the lookups will be cached // This reduces the flicker present when objects are shown/hidden const int N = 2; float accumulator = 0.0; vec2 step = vec2(1.0 / project_uViewportSize); const float floatN = float(N); vec2 delta = -floatN * step; for(int i = -N; i <= N; i++) { delta.x = -step.x * floatN; for(int j = -N; j <= N; j++) { accumulator += collision_match(texCoords + delta, pickingColor); delta.x += step.x; } delta.y += step.y; } float W = 2.0 * floatN + 1.0; return pow(accumulator / (W * W), 2.2); } `; var inject4 = { "vs:#decl": glsl` float collision_fade = 1.0; `, "vs:DECKGL_FILTER_GL_POSITION": glsl` if (collision_sort) { float collisionPriority = collisionPriorities; position.z = -0.001 * collisionPriority * position.w; // Support range -1000 -> 1000 } if (collision_enabled) { vec4 collision_common_position = project_position(vec4(geometry.worldPosition, 1.0)); vec2 collision_texCoords = collision_getCoords(collision_common_position); collision_fade = collision_isVisible(collision_texCoords, geometry.pickingColor / 255.0); if (collision_fade < 0.0001) { // Position outside clip space bounds to discard position = vec4(0.0, 0.0, 2.0, 1.0); } } `, "vs:DECKGL_FILTER_COLOR": glsl` color.a *= collision_fade; ` }; var getCollisionUniforms = (opts, uniforms) => { if (!opts || !("dummyCollisionMap" in opts)) { return {}; } const { collisionFBO, drawToCollisionMap, dummyCollisionMap } = opts; return { collision_sort: Boolean(drawToCollisionMap), collision_texture: !drawToCollisionMap && collisionFBO ? collisionFBO.colorAttachments[0] : dummyCollisionMap }; }; var shader_module_default2 = { name: "collision", dependencies: [import_core12.project], vs: vs3, inject: inject4, getUniforms: getCollisionUniforms }; // src/collision-filter/collision-filter-effect.ts var import_core15 = __toESM(require_core(), 1); // src/collision-filter/collision-filter-pass.ts var import_core13 = __toESM(require_core(), 1); var CollisionFilterPass = class extends import_core13._LayersPass { renderCollisionMap(target, options) { const padding = 1; const clearColor = [0, 0, 0, 0]; const scissorRect = [padding, padding, target.width - 2 * padding, target.height - 2 * padding]; this.render({ ...options, clearColor, scissorRect, target, pass: "collision" }); } getLayerParameters(layer, layerIndex, viewport) { return { ...layer.props.parameters, blend: false, depthRange: [0, 1], depthTest: true }; } getModuleParameters() { return { drawToCollisionMap: true, picking: { isActive: 1, isAttribute: false }, lightSources: {} }; } }; // src/collision-filter/collision-filter-effect.ts var DOWNSCALE = 2; var CollisionFilterEffect = class { constructor() { this.id = "collision-filter-effect"; this.props = null; this.useInPicking = true; this.order = 1; this.channels = {}; this.collisionFBOs = {}; } setup(context) { this.context = context; const { device } = context; this.dummyCollisionMap = device.createTexture({ width: 1, height: 1 }); this.collisionFilterPass = new CollisionFilterPass(device, { id: "default-collision-filter" }); } preRender({ effects: allEffects, layers, layerFilter, viewports, onViewportActive, views, isPicking, preRenderStats = {} }) { const { device } = this.context; if (isPicking) { return; } const collisionLayers = layers.filter( ({ props: { visible, collisionEnabled } }) => visible && collisionEnabled ); if (collisionLayers.length === 0) { this.channels = {}; return; } const effects = allEffects?.filter((e) => e.useInPicking && preRenderStats[e.id]); const maskEffectRendered = preRenderStats["mask-effect"]?.didRender; const channels = this._groupByCollisionGroup(device, collisionLayers); const viewport = viewports[0]; const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport) || maskEffectRendered; for (const collisionGroup in channels) { const collisionFBO = this.collisionFBOs[collisionGroup]; const renderInfo = channels[collisionGroup]; const [width, height] = device.canvasContext.getPixelSize(); collisionFBO.resize({ width: width / DOWNSCALE, height: height / DOWNSCALE }); this._render(renderInfo, { effects, layerFilter, onViewportActive, views, viewport, viewportChanged }); } } _render(renderInfo, { effects, layerFilter, onViewportActive, views, viewport, viewportChanged }) { const { collisionGroup } = renderInfo; const oldRenderInfo = this.channels[collisionGroup]; if (!oldRenderInfo) { return; } const needsRender = viewportChanged || renderInfo === oldRenderInfo || !(0, import_core15._deepEqual)(oldRenderInfo.layers, renderInfo.layers, 1) || renderInfo.layerBounds.some((b, i) => !equals(b, oldRenderInfo.layerBounds[i])) || renderInfo.allLayersLoaded !== oldRenderInfo.allLayersLoaded || renderInfo.layers.some((layer) => layer.props.transitions); this.channels[collisionGroup] = renderInfo; if (needsRender) { this.lastViewport = viewport; const collisionFBO = this.collisionFBOs[collisionGroup]; this.collisionFilterPass.renderCollisionMap(collisionFBO, { pass: "collision-filter", isPicking: true, layers: renderInfo.layers, effects, layerFilter, viewports: viewport ? [viewport] : [], onViewportActive, views, moduleParameters: { dummyCollisionMap: this.dummyCollisionMap, devicePixelRatio: collisionFBO.device.canvasContext.getDevicePixelRatio() / DOWNSCALE } }); } } _groupByCollisionGroup(device, collisionLayers) { const channelMap = {}; for (const layer of collisionLayers) { const { collisionGroup } = layer.props; let channelInfo = channelMap[collisionGroup]; if (!channelInfo) { channelInfo = { collisionGroup, layers: [], layerBounds: [], allLayersLoaded: true }; channelMap[collisionGroup] = channelInfo; } channelInfo.layers.push(layer); channelInfo.layerBounds.push(layer.getBounds()); if (!layer.isLoaded) { channelInfo.allLayersLoaded = false; } } for (const collisionGroup of Object.keys(channelMap)) { if (!this.collisionFBOs[collisionGroup]) { this.createFBO(device, collisionGroup); } if (!this.channels[collisionGroup]) { this.channels[collisionGroup] = channelMap[collisionGroup]; } } for (const collisionGroup of Object.keys(this.collisionFBOs)) { if (!channelMap[collisionGroup]) { this.destroyFBO(collisionGroup); } } return channelMap; } getModuleParameters(layer) { const { collisionGroup } = layer.props; const { collisionFBOs, dummyCollisionMap } = this; return { collisionFBO: collisionFBOs[collisionGroup], dummyCollisionMap }; } cleanup() { if (this.dummyCollisionMap) { this.dummyCollisionMap.delete(); this.dummyCollisionMap = void 0; } this.channels = {}; for (const collisionGroup of Object.keys(this.collisionFBOs)) { this.destroyFBO(collisionGroup); } this.collisionFBOs = {}; this.lastViewport = void 0; } createFBO(device, collisionGroup) { const { width, height } = device.gl.canvas; const collisionMap = device.createTexture({ format: "rgba8unorm", width, height, sampler: { minFilter: "nearest", magFilter: "nearest", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" } }); const depthStencilAttachment = device.createTexture({ format: "depth16unorm", width, height, mipmaps: false, dataFormat: 6402, type: 5125 }); this.collisionFBOs[collisionGroup] = device.createFramebuffer({ id: `collision-${collisionGroup}`, width, height, colorAttachments: [collisionMap], depthStencilAttachment }); } destroyFBO(collisionGroup) { const fbo = this.collisionFBOs[collisionGroup]; fbo.colorAttachments[0]?.destroy(); fbo.depthStencilAttachment?.destroy(); fbo.destroy(); delete this.collisionFBOs[collisionGroup]; } }; // src/collision-filter/collision-filter-extension.ts var defaultProps6 = { getCollisionPriority: { type: "accessor", value: 0 }, collisionEnabled: true, collisionGroup: { type: "string", value: "default" }, collisionTestProps: {} }; var CollisionFilterExtension = class extends import_core16.LayerExtension { getShaders() { return { modules: [shader_module_default2] }; } draw({ uniforms, context, moduleParameters }) { const { collisionEnabled } = this.props; const { collisionFBO, drawToCollisionMap } = moduleParameters; const enabled = collisionEnabled && Boolean(collisionFBO); uniforms.collision_enabled = enabled; if (drawToCollisionMap) { this.props = this.clone(this.props.collisionTestProps).props; } } initializeState(context, extension) { if (this.getAttributeManager() === null) { return; } this.context.deck?._addDefaultEffect(new CollisionFilterEffect()); const attributeManager = this.getAttributeManager(); attributeManager.add({ collisionPriorities: { size: 1, stepMode: "dynamic", accessor: "getCollisionPriority" } }); } getNeedsPickingBuffer() { return this.props.collisionEnabled; } }; CollisionFilterExtension.defaultProps = defaultProps6; CollisionFilterExtension.extensionName = "CollisionFilterExtension"; // src/mask/mask-extension.ts var import_core22 = __toESM(require_core(), 1); // src/mask/shader-module.ts var import_core17 = __toESM(require_core(), 1); var vs4 = glsl` uniform vec4 mask_bounds; uniform bool mask_maskByInstance; vec2 mask_getCoords(vec4 position) { return (position.xy - mask_bounds.xy) / (mask_bounds.zw - mask_bounds.xy); } `; var fs3 = glsl` uniform sampler2D mask_texture; uniform int mask_channel; uniform bool mask_enabled; uniform bool mask_inverted; bool mask_isInBounds(vec2 texCoords) { if (!mask_enabled) { return true; } vec4 maskColor = texture(mask_texture, texCoords); float maskValue = 1.0; if (mask_channel == 0) { maskValue = maskColor.r; } else if (mask_channel == 1) { maskValue = maskColor.g; } else if (mask_channel == 2) { maskValue = maskColor.b; } else if (mask_channel == 3) { maskValue = maskColor.a; } if (mask_inverted) { return maskValue >= 0.5; } else { return maskValue < 0.5; } } `; var inject5 = { "vs:#decl": glsl` out vec2 mask_texCoords; `, "vs:#main-end": glsl` vec4 mask_common_position; if (mask_maskByInstance) { mask_common_position = project_position(vec4(geometry.worldPosition, 1.0)); } else { mask_common_position = geometry.position; } mask_texCoords = mask_getCoords(mask_common_position); `, "fs:#decl": glsl` in vec2 mask_texCoords; `, "fs:#main-start": glsl` if (mask_enabled) { bool mask = mask_isInBounds(mask_texCoords); // Debug: show extent of render target // fragColor = vec4(mask_texCoords, 0.0, 1.0); fragColor = texture(mask_texture, mask_texCoords); if (!mask) discard; } ` }; var getMaskUniforms = (opts) => { if (opts && "maskMap" in opts) { return { mask_texture: opts.maskMap }; } return {}; }; var shader_module_default3 = { name: "mask", dependencies: [import_core17.project], vs: vs4, fs: fs3, inject: inject5, getUniforms: getMaskUniforms }; // src/mask/mask-effect.ts var import_core20 = __toESM(require_core(), 1); // src/mask/mask-pass.ts var import_core18 = __toESM(require_core(), 1); var MASK_BLENDING = { blendColorOperation: "subtract", blendColorSrcFactor: "zero", blendColorDstFactor: "one", blendAlphaOperation: "subtract", blendAlphaSrcFactor: "zero", blendAlphaDstFactor: "one" }; var MaskPass = class extends import_core18._LayersPass { constructor(device, props) { super(device, props); const { mapSize = 2048 } = props; this.maskMap = device.createTexture({ format: "rgba8unorm", width: mapSize, height: mapSize, sampler: { minFilter: "linear", magFilter: "linear", addressModeU: "clamp-to-edge", addressModeV: "clamp-to-edge" } }); this.fbo = device.createFramebuffer({ id: "maskmap", width: mapSize, height: mapSize, colorAttachments: [this.maskMap] }); } render(options) { const colorMask = 2 ** options.channel; const clearColor = [255, 255, 255, 255]; super.render({ ...options, clearColor, colorMask, target: this.fbo, pass: "mask" }); } getLayerParameters(layer, layerIndex, viewport) { return { ...layer.props.parameters, blend: true, depthTest: false, ...MASK_BLENDING }; } shouldDrawLayer(layer) { return layer.props.operation.includes("mask"); } delete() { this.fbo.delete(); this.maskMap.delete(); } }; // src/utils/projection-utils.ts var import_core19 = __toESM(require_core(), 1); function joinLayerBounds(layers, viewport) { const bounds = [Infinity, Infinity, -Infinity, -Infinity]; for (const layer of layers) { const layerBounds = layer.getBounds(); if (layerBounds) { const bottomLeftCommon = layer.projectPosition(layerBounds[0], { viewport, autoOffset: false }); const topRightCommon = layer.projectPosition(layerBounds[1], { viewport, autoOffset: false }); bounds[0] = Math.min(bounds[0], bottomLeftCommon[0]); bounds[1] = Math.min(bounds[1], bottomLeftCommon[1]); bounds[2] = Math.max(bounds[2], topRightCommon[0]); bounds[3] = Math.max(bounds[3], topRightCommon[1]); } } if (Number.isFinite(bounds[0])) { return bounds; } return null; } var MAX_VIEWPORT_SIZE = 2048; function makeViewport(opts) { const { bounds, viewport, border = 0 } = opts; const { isGeospatial } = viewport; if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) { return null; } const centerWorld = viewport.unprojectPosition([ (bounds[0] + bounds[2]) / 2, (bounds[1] + bounds[3]) / 2, 0 ]); let { width, height, zoom } = opts; if (zoom === void 0) { width = width - border * 2; height = height - border * 2; const scale2 = Math.min(width / (bounds[2] - bounds[0]), height / (bounds[3] - bounds[1])); zoom = Math.min(Math.log2(scale2), 20); } else if (!width || !height) { const scale2 = 2 ** zoom; width = Math.round(Math.abs(bounds[2] - bounds[0]) * scale2); height = Math.round(Math.abs(bounds[3] - bounds[1]) * scale2); const maxSize = MAX_VIEWPORT_SIZE - border * 2; if (width > maxSize || height > maxSize) { const r = maxSize / Math.max(width, height); width = Math.round(width * r); height = Math.round(height * r); zoom += Math.log2(r); } } return isGeospatial ? new import_core19.WebMercatorViewport({ id: viewport.id, x: border, y: border, width, height, longitude: centerWorld[0], latitude: centerWorld[1], zoom, orthographic: true }) : new import_core19.OrthographicViewport({ id: viewport.id, x: border, y: border, width, height, target: centerWorld, zoom, flipY: false }); } function getViewportBounds(viewport, zRange) { let viewportBoundsWorld; if (zRange && zRange.length === 2) { const [minZ, maxZ] = zRange; const bounds0 = viewport.getBounds({ z: minZ }); const bounds1 = viewport.getBounds({ z: maxZ }); viewportBoundsWorld = [ Math.min(bounds0[0], bounds1[0]), Math.min(bounds0[1], bounds1[1]), Math.max(bounds0[2], bounds1[2]), Math.max(bounds0[3], bounds1[3]) ]; } else { viewportBoundsWorld = viewport.getBounds(); } const viewportBottomLeftCommon = viewport.projectPosition(viewportBoundsWorld.slice(0, 2)); const viewportTopRightCommon = viewport.projectPosition(viewportBoundsWorld.slice(2, 4)); return [ viewportBottomLeftCommon[0], viewportBottomLeftCommon[1], viewportTopRightCommon[0], viewportTopRightCommon[1] ]; } function getRenderBounds(layerBounds, viewport, zRange) { if (!layerBounds) { return [0, 0, 1, 1]; } const viewportBounds = getViewportBounds(viewport, zRange); const paddedBounds = doubleBounds(viewportBounds); if (layerBounds[2] - layerBounds[0] <= paddedBounds[2] - paddedBounds[0] && layerBounds[3] - layerBounds[1] <= paddedBounds[3] - paddedBounds[1]) { return layerBounds; } return [ Math.max(layerBounds[0], paddedBounds[0]), Math.max(layerBounds[1], paddedBounds[1]), Math.min(layerBounds[2], paddedBounds[2]), Math.min(layerBounds[3], paddedBounds[3]) ]; } function doubleBounds(bounds) { const dx = bounds[2] - bounds[0]; const dy = bounds[3] - bounds[1]; const centerX = (bounds[0] + bounds[2]) / 2; const centerY = (bounds[1] + bounds[3]) / 2; return [centerX - dx, centerY - dy, centerX + dx, centerY + dy]; } // src/mask/mask-effect.ts var MaskEffect = class { constructor() { this.id = "mask-effect"; this.props = null; this.useInPicking = true; this.order = 0; this.channels = []; this.masks = null; } setup({ device }) { this.dummyMaskMap = device.createTexture({ width: 1, height: 1 }); this.maskPass = new MaskPass(device, { id: "default-mask" }); this.maskMap = this.maskPass.maskMap; } preRender({ layers, layerFilter, viewports, onViewportActive, views, isPicking }) { let didRender = false; if (isPicking) { return { didRender }; } const maskLayers = layers.filter((l) => l.props.visible && l.props.operation.includes("mask")); if (maskLayers.length === 0) { this.masks = null; this.channels.length = 0; return { didRender }; } this.masks = {}; const channelMap = this._sortMaskChannels(maskLayers); const viewport = viewports[0]; const viewportChanged = !this.lastViewport || !this.lastViewport.equals(viewport); if (viewport.resolution !== void 0) { import_core20.log.warn("MaskExtension is not supported in GlobeView")(); return { didRender }; } for (const maskId in channelMap) { const result = this._renderChannel(channelMap[maskId], { layerFilter, onViewportActive, views, viewport, viewportChanged }); didRender ||= result; } return { didRender }; } _renderChannel(channelInfo, { layerFilter, onViewportActive, views, viewport, viewportChanged }) { let didRender = false; const oldChannelInfo = this.channels[channelInfo.index]; if (!oldChannelInfo) { return didRender; } const maskChanged = channelInfo === oldChannelInfo || channelInfo.layers.length !== oldChannelInfo.layers.length || channelInfo.layers.some( (layer, i) => layer !== oldChannelInfo.layers[i] || layer.props.transitions ) || channelInfo.layerBounds.some((b, i) => b !== oldChannelInfo.layerBounds[i]); channelInfo.bounds = oldChannelInfo.bounds; channelInfo.maskBounds = oldChannelInfo.maskBounds; this.channels[channelInfo.index] = channelInfo; if (maskChanged || viewportChanged) { this.lastViewport = viewport; const layerBounds = joinLayerBounds(channelInfo.layers, viewport); channelInfo.bounds = layerBounds && getRenderBounds(layerBounds, viewport); if (maskChanged || !equals(channelInfo.bounds, oldChannelInfo.bounds)) { const { maskPass, maskMap } = this; const maskViewport = layerBounds && makeViewport({ bounds: channelInfo.bounds, viewport, width: maskMap.width, height: maskMap.height, border: 1 }); channelInfo.maskBounds = maskViewport ? maskViewport.getBounds() : [0, 0, 1, 1]; maskPass.render({ pass: "mask", channel: channelInfo.index, layers: channelInfo.layers, layerFilter, viewports: maskViewport ? [maskViewport] : [], onViewportActive, views, moduleParameters: { devicePixelRatio: 1 } }); didRender = true; } } this.masks[channelInfo.id] = { index: channelInfo.index, bounds: channelInfo.maskBounds, coordinateOrigin: channelInfo.coordinateOrigin, coordinateSystem: channelInfo.coordinateSystem }; return didRender; } _sortMaskChannels(maskLayers) { const channelMap = {}; let channelCount = 0; for (const layer of maskLayers) { const { id } = layer.root; let channelInfo = channelMap[id]; if (!channelInfo) { if (++channelCount > 4) { import_core20.log.warn("Too many mask layers. The max supported is 4")(); continue; } channelInfo = { id, index: this.channels.findIndex((c) => c?.id === id), layers: [], layerBounds: [], coordinateOrigin: layer.root.props.coordinateOrigin, coordinateSystem: layer.root.props.coordinateSystem }; channelMap[id] = channelInfo; } channelInfo.layers.push(layer); channelInfo.layerBounds.push(layer.getBounds()); } for (let i = 0; i < 4; i++) { const channelInfo = this.channels[i]; if (!channelInfo || !(channelInfo.id in channelMap)) { this.channels[i] = null; } } for (const maskId in channelMap) { const channelInfo = channelMap[maskId]; if (channelInfo.index < 0) { channelInfo.index = this.channels.findIndex((c) => !c); this.channels[channelInfo.index] = channelInfo; } } return channelMap; } getModuleParameters() { return { maskMap: this.masks ? this.maskMap : this.dummyMaskMap, maskChannels: this.masks }; } cleanup() { if (this.dummyMaskMap) { this.dummyMaskMap.delete(); this.dummyMaskMap = void 0; } if (this.maskPass) { this.maskPass.delete(); this.maskPass = void 0; this.maskMap = void 0; } this.lastViewport = void 0; this.masks = null; this.channels.length = 0; } }; // src/mask/mask-extension.ts var defaultProps7 = { maskId: "", maskByInstance: void 0, maskInverted: false }; var MaskExtension = class extends import_core22.LayerExtension { initializeState() { this.context.deck?._addDefaultEffect(new MaskEffect()); } getShaders() { let maskByInstance = "instancePositions" in this.getAttributeManager().attributes; if (this.props.maskByInstance !== void 0) { maskByInstance = Boolean(this.props.maskByInstance); } this.state.maskByInstance = maskByInstance; return { modules: [shader_module_default3] }; } draw({ uniforms, context, moduleParameters }) { uniforms.mask_maskByInstance = this.state.maskByInstance; const { maskId, maskInverted } = this.props; const { maskChannels } = moduleParameters; const { viewport } = context; if (maskChannels && maskChannels[maskId]) { const { index, bounds, coordinateOrigin: fromCoordinateOrigin } = maskChannels[maskId]; let { coordinateSystem: fromCoordinateSystem } = maskChannels[maskId]; uniforms.mask_enabled = true; uniforms.mask_channel = index; uniforms.mask_inverted = maskInverted; if (fromCoordinateSystem === import_core22.COORDINATE_SYSTEM.DEFAULT) { fromCoordinateSystem = viewport.isGeospatial ? import_core22.COORDINATE_SYSTEM.LNGLAT : import_core22.COORDINATE_SYSTEM.CARTESIAN; } const opts = { modelMatrix: null, fromCoordinateOrigin, fromCoordinateSystem }; const bl = this.projectPosition([bounds[0], bounds[1], 0], opts); const tr = this.projectPosition([bounds[2], bounds[3], 0], opts); uniforms.mask_bounds = [bl[0], bl[1], tr[0], tr[1]]; } else { if (maskId) { import_core22.log.warn(`Could not find a mask layer with id: ${maskId}`)(); } uniforms.mask_enabled = false; } } }; MaskExtension.defaultProps = defaultProps7; MaskExtension.extensionName = "MaskExtension"; // src/terrain/terrain-extension.ts var import_core27 = __toESM(require_core(), 1); // src/terrain/terrain-effect.ts var import_core26 = __toESM(require_core(), 1); // src/terrain/shader-module.ts var import_core23 = __toESM(require_core(), 1); var TERRAIN_MODE = { NONE: 0, WRITE_HEIGHT_MAP: 1, USE_HEIGHT_MAP: 2, USE_COVER: 3, USE_COVER_ONLY: 4, SKIP: 5 }; var TERRAIN_MODE_CONSTANTS = Object.keys(TERRAIN_MODE).map((key) => `const float TERRAIN_MODE_${key} = ${TERRAIN_MODE[key]}.0;`).join("\n"); var terrainModule = { name: "terrain", dependencies: [import_core23.project], inject: { "vs:#decl": glsl` uniform float terrain_mode; uniform sampler2D terrain_map; uniform vec4 terrain_bounds; out vec3 commonPos; ` + TERRAIN_MODE_CONSTANTS, "vs:#main-start": glsl` if (terrain_mode == TERRAIN_MODE_SKIP) { gl_Position = vec4(0.0); return; } `, "vs:DECKGL_FILTER_GL_POSITION": glsl` commonPos = geometry.position.xyz; if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) { vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw; position = vec4(texCoords * 2.0 - 1.0, 0.0, 1.0); commonPos.z += project_uCommonOrigin.z; } if (terrain_mode == TERRAIN_MODE_USE_HEIGHT_MAP) { vec3 anchor = geometry.worldPosition; anchor.z = 0.0; vec3 anchorCommon = project_position(anchor); vec2 texCoords = (anchorCommon.xy - terrain_bounds.xy) / terrain_bounds.zw; if (texCoords.x >= 0.0 && texCoords.y >= 0.0 && texCoords.x <= 1.0 && texCoords.y <= 1.0) { float terrainZ = texture(terrain_map, texCoords).r; geometry.position.z += terrainZ; position = project_common_position_to_clipspace(geometry.position); } } `, "fs:#decl": glsl` uniform float terrain_mode; uniform sampler2D terrain_map; uniform vec4 terrain_bounds; in vec3 commonPos; ` + TERRAIN_MODE_CONSTANTS, "fs:#main-start": glsl` if (terrain_mode == TERRAIN_MODE_WRITE_HEIGHT_MAP) { fragColor = vec4(commonPos.z, 0.0, 0.0, 1.0); return; } `, "fs:DECKGL_FILTER_COLOR": glsl` if ((terrain_mode == TERRAIN_MODE_USE_COVER) || (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY)) { vec2 texCoords = (commonPos.xy - terrain_bounds.xy) / terrain_bounds.zw; vec4 pixel = texture(terrain_map, texCoords); if (terrain_mode == TERRAIN_MODE_USE_COVER_ONLY) { color = pixel; } else { // pixel is premultiplied color = pixel + color * (1.0 - pixel.a); } return; } ` }, getUniforms: (opts = {}, uniforms) => { if ("dummyHeightMap" in opts) { const { drawToTerrainHeightMap, heightMap, heightMapBounds, dummyHeightMap, terrainCover, useTerrainHeightMap, terrainSkipRender } = opts; const { project_uCommonOrigin } = uniforms; let mode = terrainSkipRender ? TERRAIN_MODE.SKIP : TERRAIN_MODE.NONE; let sampler = dummyHeightMap; let bounds = null; if (drawToTerrainHeightMap) { mode = TERRAIN_MODE.WRITE_HEIGHT_MAP; bounds = heightMapBounds; } else if (useTerrainHeightMap && heightMap) { mode = TERRAIN_MODE.USE_HEIGHT_MAP; sampler = heightMap; bounds = heightMapBounds; } else if (terrainCover) { const isPicking = opts.picking?.isActive; const fbo = isPicking ? terrainCover.getPickingFramebuffer() : terrainCover.getRenderFramebuffer(); sampler = fbo?.colorAttachments[0].texture; if (isPicking) { mode = TERRAIN_MODE.SKIP; } if (sampler) { mode = mode === TERRAIN_MODE.SKIP ? TERRAIN_MODE.USE_COVER_ONLY : TERRAIN_MODE.USE_COVER; bounds = terrainCover.bounds; } else { sampler = dummyHeightMap; } } return { terrain_mode: mode, terrain_map: sampler, terrain_bounds: bounds ? [ bounds[0] - project_uCommonOrigin[0], bounds[1] - project_uCommonOrigin[1], bounds[2] - bounds[0], bounds[3] - bounds[1] ] : [0, 0, 0, 0] }; } return null; } }; // src/terrain/utils.ts function createRenderTarget(device, opts) { return device.createFramebuffer({ id: opts.id, colorAttachments: [ device.createTexture({ id: opts.id, ...opts.float && { format: "rgba32float", type: GLEnum.FLOAT }, mipmaps: false, sampler: opts.interpolate === false ? { minFilter: "nearest", magFilter: "nearest" } : { minFilter: "linear", magFilter: "linear" } }) ] }); } // src/terrain/terrain-cover.ts var TerrainCover = class { constructor(targetLayer) { this.isDirty = true; this.renderViewport = null; this.bounds = null; this.layers = []; this.targetBounds = null; this.targetBoundsCommon = null; this.targetLayer = targetLayer; this.tile = getTile(targetLayer); } get id() { return this.targetLayer.id; } get isActive() { return Boolean(this.targetLayer.getCurrentLayer()); } shouldUpdate({ targetLayer, viewport, layers, layerNeedsRedraw }) { if (targetLayer) { this.targetLayer = targetLayer; } const sizeChanged = viewport ? this._updateViewport(viewport) : false; let layersChanged = layers ? this._updateLayers(layers) : false; if (layerNeedsRedraw) { for (const id of this.layers) { if (layerNeedsRedraw[id]) { layersChanged = true; break; } } } return layersChanged || sizeChanged; } _updateLayers(layers) { let needsRedraw = false; layers = this.tile ? getIntersectingLayers(this.tile, layers) : layers; if (layers.length !== this.layers.length) { needsRedraw = true; } else { for (let i = 0; i < layers.length; i++) { const id = layers[i].id; if (id !== this.layers[i]) { needsRedraw = true; break; } } } if (needsRedraw) { this.layers = layers.map((layer) => layer.id); } return needsRedraw; } _updateViewport(viewport) { const targetLayer = this.targetLayer; let shouldRedraw = false; if (this.tile && "boundingBox" in this.tile) { if (!this.targetBounds) { shouldRedraw = true; this.targetBounds = this.tile.boundingBox; const bottomLeftCommon = viewport.projectPosition(this.targetBounds[0]); const topRightCommon = viewport.projectPosition(this.targetBounds[1]); this.targetBoundsCommon = [ bottomLeftCommon[0], bottomLeftCommon[1], topRightCommon[0], topRightCommon[1] ]; } } else if (this.targetBounds !== targetLayer.getBounds()) { shouldRedraw = true; this.targetBounds = targetLayer.getBounds(); this.targetBoundsCommon = joinLayerBounds([targetLayer], viewport); } if (!this.targetBoundsCommon) { return false; } const newZoom = Math.ceil(viewport.zoom + 0.5); if (this.tile) { this.bounds = this.targetBoundsCommon; } else { const oldZoom = this.renderViewport?.zoom; shouldRedraw = shouldRedraw || newZoom !== oldZoom; const newBounds = getRenderBounds(this.targetBoundsCommon, viewport); const oldBounds = this.bounds; shouldRedraw = shouldRedraw || !oldBounds || newBounds.some((x, i) => x !== oldBounds[i]); this.bounds = newBounds; } if (shouldRedraw) { this.renderViewport = makeViewport({ bounds: this.bounds, zoom: newZoom, viewport }); } return shouldRedraw; } getRenderFramebuffer() { if (!this.renderViewport || this.layers.length === 0) { return null; } if (!this.fbo) { this.fbo = createRenderTarget(this.targetLayer.context.device, { id: this.id }); } return this.fbo; } getPickingFramebuffer() { if (!this.renderViewport || this.layers.length === 0 && !this.targetLayer.props.pickable) { return null; } if (!this.pickingFbo) { this.pickingFbo = createRenderTarget(this.targetLayer.context.device, { id: `${this.id}-picking`, interpolate: false }); } return this.pickingFbo; } filterLayers(layers) { return layers.filter(({ id }) => this.layers.includes(id)); } delete() { const { fbo, pickingFbo } = this; if (fbo) { fbo.colorAttachments[0].destroy(); fbo.destroy(); } if (pickingFbo) { pickingFbo.colorAttachments[0].destroy(); pickingFbo.destroy(); } } }; function getIntersectingLayers(sourceTile, layers) { return layers.filter((layer) => { const tile = getTile(layer); if (tile) { return intersect(sourceTile.boundingBox, tile.boundingBox); } return true; }); } function getTile(layer) { while (layer) { const { tile } = layer.props; if (tile) { return tile; } layer = layer.parent; } return null; } function intersect(b1, b2) { if (b1 && b2) { return b1[0][0] < b2[1][0] && b2[0][0] < b1[1][0] && b1[0][1] < b2[1][1] && b2[0][1] < b1[1][1]; } return false; } // src/terrain/terrain-pass.ts var import_core24 = __toESM(require_core(), 1); var TERRAIN_BLENDING = { blendColorOperation: "max", blendColorSrcFactor: "one", blendColorDstFactor: "one", blendAlphaOperation: "max", blendAlphaSrcFactor: "one", blendAlphaDstFactor: "one" }; var TerrainPass = class extends import_core24._LayersPass { getRenderableLayers(viewport, opts) { const { layers } = opts; const result = []; const drawParamsByIndex = this._getDrawLayerParams(viewport, opts, true); for (let i = 0; i < layers.length; i++) { const layer = layers[i]; if (!layer.isComposite && drawParamsByIndex[i].shouldDrawLayer) { result.push(layer); } } return result; } renderHeightMap(heightMap, opts) { const target = heightMap.getRenderFramebuffer(); const viewport = heightMap.renderViewport; if (!target || !viewport) { return; } target.resize(viewport); this.render({ ...opts, target, pass: "terrain-height-map", layers: opts.layers, viewports: [viewport], effects: [], clearColor: [0, 0, 0, 0] }); } renderTerrainCover(terrainCover, opts) { const target = terrainCover.getRenderFramebuffer(); const viewport = terrainCover.renderViewport; if (!target || !viewport) { return; } const layers = terrainCover.filterLayers(opts.layers); target.resize(viewport); this.render({ ...opts, target, pass: `terrain-cover-${terrainCover.id}`, layers, effects: [], viewports: [viewport], clearColor: [0, 0, 0, 0] }); } getLayerParameters(layer, layerIndex, viewport) { return { ...layer.props.parameters, blend: true, depthTest: false, ...layer.props.operation.includes("terrain") && TERRAIN_BLENDING }; } }; // src/terrain/terrain-picking-pass.ts var import_core25 = __toESM(require_core(), 1); var TerrainPickingPass = class extends import_core25._PickLayersPass { constructor() { super(...arguments); this.drawParameters = {}; } getRenderableLayers(viewport, opts) { const { layers } = opts; const result = []; this.drawParameters = {}; this._resetColorEncoder(opts.pickZ); const drawParamsByIndex = this._getDrawLayerParams(viewport, opts); for (let i = 0; i < layers.length; i++) { const layer = layers[i]; if (!layer.isComposite && drawParamsByIndex[i].shouldDrawLayer) { result.push(layer); this.drawParameters[layer.id] = drawParamsByIndex[i].layerParameters; } } return result; } renderTerrainCover(terrainCover, opts) { const target = terrainCover.getPickingFramebuffer(); const viewport = terrainCover.renderViewport; if (!target || !viewport) { return; } const layers = terrainCover.filterLayers(opts.layers); const terrainLayer = terrainCover.targetLayer; if (terrainLayer.props.pickable) { layers.unshift(terrainLayer); } target.resize(viewport); this.render({ ...opts, pickingFBO: target, pass: `terrain-cover-picking-${terrainCover.id}`, layers, effects: [], viewports: [viewport], cullRect: void 0, deviceRect: viewport, pickZ: false }); } getLayerParameters(layer, layerIndex, viewport) { let parameters2; if (this.drawParameters[layer.id]) { parameters2 = this.drawParameters[layer.id]; } else { parameters2 = super.getLayerParameters(layer, layerIndex, viewport); parameters2.blend = true; } return { ...parameters2, depthTest: false }; } }; // src/terrain/height-map-builder.ts var MAP_MAX_SIZE = 2048; var HeightMapBuilder = class { constructor(device) { this.renderViewport = null; this.bounds = null; this.layers = []; this.layersBounds = []; this.layersBoundsCommon = null; this.lastViewport = null; this.device = device; } static isSupported(device) { return device.isTextureFormatRenderable("rgba32float"); } getRenderFramebuffer() { if (!this.renderViewport) { return null; } if (!this.fbo) { this.fbo = createRenderTarget(this.device, { id: "height-map", float: true }); } return this.fbo; } shouldUpdate({ layers, viewport }) { const layersChanged = layers.length !== this.layers.length || layers.some( (layer, i) => layer !== this.layers[i] || layer.props.transitions || layer.getBounds() !== this.layersBounds[i] ); if (layersChanged) { this.layers = layers; this.layersBounds = layers.map((layer) => layer.getBounds()); this.layersBoundsCommon = joinLayerBounds(layers, viewport); } const viewportChanged = !this.lastViewport || !viewport.equals(this.lastViewport); if (!this.layersBoundsCommon) { this.renderViewport = null; } else if (layersChanged || viewportChanged) { const bounds = getRenderBounds(this.layersBoundsCommon, viewport); if (bounds[2] <= bounds[0] || bounds[3] <= bounds[1]) { this.renderViewport = null; return false; } this.bounds = bounds; this.lastViewport = viewport; const scale2 = viewport.scale; const pixelWidth = (bounds[2] - bounds[0]) * scale2; const pixelHeight = (bounds[3] - bounds[1]) * scale2; this.renderViewport = pixelWidth > 0 || pixelHeight > 0 ? makeViewport({ bounds: [ viewport.center[0] - 1, viewport.center[1] - 1, viewport.center[0] + 1, viewport.center[1] + 1 ], zoom: viewport.zoom, width: Math.min(pixelWidth, MAP_MAX_SIZE), height: Math.min(pixelHeight, MAP_MAX_SIZE), viewport }) : null; return true; } return false; } delete() { if (this.fbo) { this.fbo.colorAttachments[0].delete(); this.fbo.delete(); } } }; // src/terrain/terrain-effect.ts var TerrainEffect = class { constructor() { this.id = "terrain-effect"; this.props = null; this.useInPicking = true; this.isPicking = false; this.isDrapingEnabled = false; this.terrainCovers = /* @__PURE__ */ new Map(); } setup({ device, deck }) { this.dummyHeightMap = device.createTexture({ width: 1, height: 1, data: new Uint8Array([0, 0, 0, 0]) }); this.terrainPass = new TerrainPass(device, { id: "terrain" }); this.terrainPickingPass = new TerrainPickingPass(device, { id: "terrain-picking" }); if (HeightMapBuilder.isSupported(device)) { this.heightMap = new HeightMapBuilder(device); } else { import_core26.log.warn("Terrain offset mode is not supported by this browser")(); } deck._addDefaultShaderModule(terrainModule); } preRender(opts) { if (opts.pickZ) { this.isDrapingEnabled = false; return; } const { viewports } = opts; const isPicking = opts.pass.startsWith("picking"); this.isPicking = isPicking; this.isDrapingEnabled = true; const viewport = viewports[0]; const layers = (isPicking ? this.terrainPickingPass : this.terrainPass).getRenderableLayers( viewport, opts ); const terrainLayers = layers.filter((l) => l.props.operation.includes("terrain")); if (terrainLayers.length === 0) { return; } if (!isPicking) { const offsetLayers = layers.filter((l) => l.state.terrainDrawMode === "offset"); if (offsetLayers.length > 0) { this._updateHeightMap(terrainLayers, viewport, opts); } } const drapeLayers = layers.filter((l) => l.state.terrainDrawMode === "drape"); this._updateTerrainCovers(terrainLayers, drapeLayers, viewport, opts); } getModuleParameters(layer) { const { terrainDrawMode } = layer.state; return { heightMap: this.heightMap?.getRenderFramebuffer()?.colorAttachments[0].texture || null, heightMapBounds: this.heightMap?.bounds, dummyHeightMap: this.dummyHeightMap, terrainCover: this.isDrapingEnabled ? this.terrainCovers.get(layer.id) : null, useTerrainHeightMap: terrainDrawMode === "offset", terrainSkipRender: terrainDrawMode === "drape" || !layer.props.operation.includes("draw") }; } cleanup({ deck }) { if (this.dummyHeightMap) { this.dummyHeightMap.delete(); this.dummyHeightMap = void 0; } if (this.heightMap) { this.heightMap.delete(); this.heightMap = void 0; } for (const terrainCover of this.terrainCovers.values()) { terrainCover.delete(); } this.terrainCovers.clear(); deck._removeDefaultShaderModule(terrainModule); } _updateHeightMap(terrainLayers, viewport, opts) { if (!this.heightMap) { return; } const shouldUpdate = this.heightMap.shouldUpdate({ layers: terrainLayers, viewport }); if (!shouldUpdate) { return; } this.terrainPass.renderHeightMap(this.heightMap, { ...opts, layers: terrainLayers, moduleParameters: { heightMapBounds: this.heightMap.bounds, dummyHeightMap: this.dummyHeightMap, devicePixelRatio: 1, drawToTerrainHeightMap: true } }); } _updateTerrainCovers(terrainLayers, drapeLayers, viewport, opts) { const layerNeedsRedraw = {}; for (const layer of drapeLayers) { if (layer.state.terrainCoverNeedsRedraw) { layerNeedsRedraw[layer.id] = true; layer.state.terrainCoverNeedsRedraw = false; } } for (const terrainCover of this.terrainCovers.values()) { terrainCover.isDirty = terrainCover.isDirty || terrainCover.shouldUpdate({ layerNeedsRedraw }); } for (const layer of terrainLayers) { this._updateTerrainCover(layer, drapeLayers, viewport, opts); } if (!this.isPicking) { this._pruneTerrainCovers(); } } _updateTerrainCover(terrainLayer, drapeLayers, viewport, opts) { const renderPass = this.isPicking ? this.terrainPickingPass : this.terrainPass; let terrainCover = this.terrainCovers.get(terrainLayer.id); if (!terrainCover) { terrainCover = new TerrainCover(terrainLayer); this.terrainCovers.set(terrainLayer.id, terrainCover); } try { const isDirty = terrainCover.shouldUpdate({ targetLayer: terrainLayer, viewport, layers: drapeLayers }); if (this.isPicking || terrainCover.isDirty || isDirty) { renderPass.renderTerrainCover(terrainCover, { ...opts, layers: drapeLayers, moduleParameters: { dummyHeightMap: this.dummyHeightMap, terrainSkipRender: false, devicePixelRatio: 1 } }); if (!this.isPicking) { terrainCover.isDirty = false; } } } catch (err) { terrainLayer.raiseError(err, `Error rendering terrain cover ${terrainCover.id}`); } } _pruneTerrainCovers() { const idsToRemove = []; for (const [id, terrainCover] of this.terrainCovers) { if (!terrainCover.isActive) { idsToRemove.push(id); } } for (const id of idsToRemove) { this.terrainCovers.delete(id); } } }; // src/terrain/terrain-extension.ts var defaultProps8 = { terrainDrawMode: void 0 }; var TerrainExtension = class extends import_core27.LayerExtension { getShaders() { return { modules: [terrainModule] }; } initializeState() { this.context.deck?._addDefaultEffect(new TerrainEffect()); } updateState(params) { const { props, oldProps } = params; if (this.state.terrainDrawMode && props.terrainDrawMode === oldProps.terrainDrawMode && props.extruded === oldProps.extruded) { return; } let { terrainDrawMode } = props; if (!terrainDrawMode) { const is3d = this.props.extruded; const attributes = this.getAttributeManager()?.attributes; const hasAnchor = attributes && "instancePositions" in attributes; terrainDrawMode = is3d || hasAnchor ? "offset" : "drape"; } this.setState({ terrainDrawMode }); } onNeedsRedraw() { const state = this.state; if (state.terrainDrawMode === "drape") { state.terrainCoverNeedsRedraw = true; } } }; TerrainExtension.defaultProps = defaultProps8; TerrainExtension.extensionName = "TerrainExtension"; return __toCommonJS(bundle_exports); })(); return __exports__; });