@deck.gl/aggregation-layers 9.0.0-beta.5 → 9.0.0-beta.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contour-layer/contour-layer.d.ts.map +1 -1
- package/dist/contour-layer/contour-layer.js +2 -3
- package/dist/cpu-grid-layer/cpu-grid-layer.d.ts.map +1 -1
- package/dist/cpu-grid-layer/cpu-grid-layer.js +1 -2
- package/dist/dist.dev.js +228 -314
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-fragment.glsl.js +2 -6
- package/dist/gpu-grid-layer/gpu-grid-cell-layer-vertex.glsl.js +50 -79
- package/dist/gpu-grid-layer/gpu-grid-cell-layer.js +4 -4
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.d.ts.map +1 -1
- package/dist/gpu-grid-layer/gpu-grid-layer.js +4 -4
- package/dist/grid-aggregation-layer.js +1 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts +0 -1
- package/dist/heatmap-layer/heatmap-layer.d.ts.map +1 -1
- package/dist/heatmap-layer/heatmap-layer.js +4 -20
- package/dist/heatmap-layer/max-fs.glsl.js +2 -2
- package/dist/heatmap-layer/max-vs.glsl.js +6 -10
- package/dist/heatmap-layer/triangle-layer-fragment.glsl.js +15 -25
- package/dist/heatmap-layer/triangle-layer-vertex.glsl.js +11 -16
- package/dist/heatmap-layer/weights-fs.glsl.js +7 -11
- package/dist/heatmap-layer/weights-vs.glsl.js +7 -12
- package/dist/hexagon-layer/hexagon-layer.d.ts +1 -1
- package/dist/hexagon-layer/hexagon-layer.d.ts.map +1 -1
- package/dist/hexagon-layer/hexagon-layer.js +1 -2
- package/dist/index.cjs +223 -390
- package/dist/index.cjs.map +3 -3
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts +1 -2
- package/dist/screen-grid-layer/screen-grid-cell-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-cell-layer.js +0 -3
- package/dist/screen-grid-layer/screen-grid-layer-fragment.glsl.js +5 -10
- package/dist/screen-grid-layer/screen-grid-layer-vertex.glsl.js +30 -42
- package/dist/screen-grid-layer/screen-grid-layer.d.ts +0 -3
- package/dist/screen-grid-layer/screen-grid-layer.d.ts.map +1 -1
- package/dist/screen-grid-layer/screen-grid-layer.js +1 -8
- package/dist/utils/gpu-grid-aggregation/aggregate-all-fs.glsl.js +6 -9
- package/dist/utils/gpu-grid-aggregation/aggregate-all-vs.glsl.js +14 -25
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-fs.glsl.js +2 -6
- package/dist/utils/gpu-grid-aggregation/aggregate-to-grid-vs.glsl.js +25 -42
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator-constants.js +8 -8
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.d.ts.map +1 -1
- package/dist/utils/gpu-grid-aggregation/gpu-grid-aggregator.js +13 -24
- package/dist/utils/gpu-grid-aggregation/transform-mean-vs.glsl.js +4 -9
- package/dist.min.js +298 -450
- package/package.json +8 -10
- package/src/contour-layer/contour-layer.ts +2 -3
- package/src/cpu-grid-layer/cpu-grid-layer.ts +1 -2
- package/src/gpu-grid-layer/gpu-grid-cell-layer.ts +1 -1
- package/src/gpu-grid-layer/gpu-grid-layer.ts +2 -2
- package/src/heatmap-layer/heatmap-layer.ts +5 -23
- package/src/hexagon-layer/hexagon-layer.ts +2 -3
- package/src/screen-grid-layer/screen-grid-cell-layer.ts +0 -4
- package/src/screen-grid-layer/screen-grid-layer.ts +1 -11
- package/src/utils/gpu-grid-aggregation/gpu-grid-aggregator.ts +4 -15
package/dist.min.js
CHANGED
|
@@ -4,175 +4,140 @@
|
|
|
4
4
|
else if (typeof define === 'function' && define.amd) define([], factory);
|
|
5
5
|
else if (typeof exports === 'object') exports['deck'] = factory();
|
|
6
6
|
else root['deck'] = factory();})(globalThis, function () {
|
|
7
|
-
"use strict";var __exports__=(()=>{var Ai=Object.create;var Pe=Object.defineProperty;var Ri=Object.getOwnPropertyDescriptor;var Ti=Object.getOwnPropertyNames;var ci=Object.getPrototypeOf,gi=Object.prototype.hasOwnProperty;var Le=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Si=(e,t)=>{for(var o in t)Pe(e,o,{get:t[o],enumerable:!0})},Be=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ti(t))!gi.call(e,r)&&r!==o&&Pe(e,r,{get:()=>t[r],enumerable:!(i=Ri(t,r))||i.enumerable});return e},V=(e,t,o)=>(Be(e,t,"default"),o&&Be(o,t,"default")),h=(e,t,o)=>(o=e!=null?Ai(ci(e)):{},Be(t||!e||!e.__esModule?Pe(o,"default",{value:e,enumerable:!0}):o,e)),fi=e=>Be(Pe({},"__esModule",{value:!0}),e);var L=Le((Ur,Et)=>{Et.exports=globalThis.deck});var x=Le((vr,pt)=>{pt.exports=globalThis.deck});var q=Le((Wr,Ct)=>{Ct.exports=globalThis.luma});var xe={};Si(xe,{AGGREGATION_OPERATION:()=>F,CPUGridLayer:()=>k,ContourLayer:()=>Oe,GPUGridLayer:()=>Z,GridLayer:()=>he,HeatmapLayer:()=>De,HexagonLayer:()=>Ce,ScreenGridLayer:()=>pe,_AggregationLayer:()=>B,_BinSorter:()=>H,_CPUAggregator:()=>W,_GPUGridAggregator:()=>D});var v={},Nt=h(L(),1);V(v,h(L(),1));if(!Nt.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");V(xe,v);var at=h(x(),1);var M=function(e){return e[e.DEPTH_BUFFER_BIT=256]="DEPTH_BUFFER_BIT",e[e.STENCIL_BUFFER_BIT=1024]="STENCIL_BUFFER_BIT",e[e.COLOR_BUFFER_BIT=16384]="COLOR_BUFFER_BIT",e[e.POINTS=0]="POINTS",e[e.LINES=1]="LINES",e[e.LINE_LOOP=2]="LINE_LOOP",e[e.LINE_STRIP=3]="LINE_STRIP",e[e.TRIANGLES=4]="TRIANGLES",e[e.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",e[e.TRIANGLE_FAN=6]="TRIANGLE_FAN",e[e.ZERO=0]="ZERO",e[e.ONE=1]="ONE",e[e.SRC_COLOR=768]="SRC_COLOR",e[e.ONE_MINUS_SRC_COLOR=769]="ONE_MINUS_SRC_COLOR",e[e.SRC_ALPHA=770]="SRC_ALPHA",e[e.ONE_MINUS_SRC_ALPHA=771]="ONE_MINUS_SRC_ALPHA",e[e.DST_ALPHA=772]="DST_ALPHA",e[e.ONE_MINUS_DST_ALPHA=773]="ONE_MINUS_DST_ALPHA",e[e.DST_COLOR=774]="DST_COLOR",e[e.ONE_MINUS_DST_COLOR=775]="ONE_MINUS_DST_COLOR",e[e.SRC_ALPHA_SATURATE=776]="SRC_ALPHA_SATURATE",e[e.CONSTANT_COLOR=32769]="CONSTANT_COLOR",e[e.ONE_MINUS_CONSTANT_COLOR=32770]="ONE_MINUS_CONSTANT_COLOR",e[e.CONSTANT_ALPHA=32771]="CONSTANT_ALPHA",e[e.ONE_MINUS_CONSTANT_ALPHA=32772]="ONE_MINUS_CONSTANT_ALPHA",e[e.FUNC_ADD=32774]="FUNC_ADD",e[e.FUNC_SUBTRACT=32778]="FUNC_SUBTRACT",e[e.FUNC_REVERSE_SUBTRACT=32779]="FUNC_REVERSE_SUBTRACT",e[e.BLEND_EQUATION=32777]="BLEND_EQUATION",e[e.BLEND_EQUATION_RGB=32777]="BLEND_EQUATION_RGB",e[e.BLEND_EQUATION_ALPHA=34877]="BLEND_EQUATION_ALPHA",e[e.BLEND_DST_RGB=32968]="BLEND_DST_RGB",e[e.BLEND_SRC_RGB=32969]="BLEND_SRC_RGB",e[e.BLEND_DST_ALPHA=32970]="BLEND_DST_ALPHA",e[e.BLEND_SRC_ALPHA=32971]="BLEND_SRC_ALPHA",e[e.BLEND_COLOR=32773]="BLEND_COLOR",e[e.ARRAY_BUFFER_BINDING=34964]="ARRAY_BUFFER_BINDING",e[e.ELEMENT_ARRAY_BUFFER_BINDING=34965]="ELEMENT_ARRAY_BUFFER_BINDING",e[e.LINE_WIDTH=2849]="LINE_WIDTH",e[e.ALIASED_POINT_SIZE_RANGE=33901]="ALIASED_POINT_SIZE_RANGE",e[e.ALIASED_LINE_WIDTH_RANGE=33902]="ALIASED_LINE_WIDTH_RANGE",e[e.CULL_FACE_MODE=2885]="CULL_FACE_MODE",e[e.FRONT_FACE=2886]="FRONT_FACE",e[e.DEPTH_RANGE=2928]="DEPTH_RANGE",e[e.DEPTH_WRITEMASK=2930]="DEPTH_WRITEMASK",e[e.DEPTH_CLEAR_VALUE=2931]="DEPTH_CLEAR_VALUE",e[e.DEPTH_FUNC=2932]="DEPTH_FUNC",e[e.STENCIL_CLEAR_VALUE=2961]="STENCIL_CLEAR_VALUE",e[e.STENCIL_FUNC=2962]="STENCIL_FUNC",e[e.STENCIL_FAIL=2964]="STENCIL_FAIL",e[e.STENCIL_PASS_DEPTH_FAIL=2965]="STENCIL_PASS_DEPTH_FAIL",e[e.STENCIL_PASS_DEPTH_PASS=2966]="STENCIL_PASS_DEPTH_PASS",e[e.STENCIL_REF=2967]="STENCIL_REF",e[e.STENCIL_VALUE_MASK=2963]="STENCIL_VALUE_MASK",e[e.STENCIL_WRITEMASK=2968]="STENCIL_WRITEMASK",e[e.STENCIL_BACK_FUNC=34816]="STENCIL_BACK_FUNC",e[e.STENCIL_BACK_FAIL=34817]="STENCIL_BACK_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_FAIL=34818]="STENCIL_BACK_PASS_DEPTH_FAIL",e[e.STENCIL_BACK_PASS_DEPTH_PASS=34819]="STENCIL_BACK_PASS_DEPTH_PASS",e[e.STENCIL_BACK_REF=36003]="STENCIL_BACK_REF",e[e.STENCIL_BACK_VALUE_MASK=36004]="STENCIL_BACK_VALUE_MASK",e[e.STENCIL_BACK_WRITEMASK=36005]="STENCIL_BACK_WRITEMASK",e[e.VIEWPORT=2978]="VIEWPORT",e[e.SCISSOR_BOX=3088]="SCISSOR_BOX",e[e.COLOR_CLEAR_VALUE=3106]="COLOR_CLEAR_VALUE",e[e.COLOR_WRITEMASK=3107]="COLOR_WRITEMASK",e[e.UNPACK_ALIGNMENT=3317]="UNPACK_ALIGNMENT",e[e.PACK_ALIGNMENT=3333]="PACK_ALIGNMENT",e[e.MAX_TEXTURE_SIZE=3379]="MAX_TEXTURE_SIZE",e[e.MAX_VIEWPORT_DIMS=3386]="MAX_VIEWPORT_DIMS",e[e.SUBPIXEL_BITS=3408]="SUBPIXEL_BITS",e[e.RED_BITS=3410]="RED_BITS",e[e.GREEN_BITS=3411]="GREEN_BITS",e[e.BLUE_BITS=3412]="BLUE_BITS",e[e.ALPHA_BITS=3413]="ALPHA_BITS",e[e.DEPTH_BITS=3414]="DEPTH_BITS",e[e.STENCIL_BITS=3415]="STENCIL_BITS",e[e.POLYGON_OFFSET_UNITS=10752]="POLYGON_OFFSET_UNITS",e[e.POLYGON_OFFSET_FACTOR=32824]="POLYGON_OFFSET_FACTOR",e[e.TEXTURE_BINDING_2D=32873]="TEXTURE_BINDING_2D",e[e.SAMPLE_BUFFERS=32936]="SAMPLE_BUFFERS",e[e.SAMPLES=32937]="SAMPLES",e[e.SAMPLE_COVERAGE_VALUE=32938]="SAMPLE_COVERAGE_VALUE",e[e.SAMPLE_COVERAGE_INVERT=32939]="SAMPLE_COVERAGE_INVERT",e[e.COMPRESSED_TEXTURE_FORMATS=34467]="COMPRESSED_TEXTURE_FORMATS",e[e.VENDOR=7936]="VENDOR",e[e.RENDERER=7937]="RENDERER",e[e.VERSION=7938]="VERSION",e[e.IMPLEMENTATION_COLOR_READ_TYPE=35738]="IMPLEMENTATION_COLOR_READ_TYPE",e[e.IMPLEMENTATION_COLOR_READ_FORMAT=35739]="IMPLEMENTATION_COLOR_READ_FORMAT",e[e.BROWSER_DEFAULT_WEBGL=37444]="BROWSER_DEFAULT_WEBGL",e[e.STATIC_DRAW=35044]="STATIC_DRAW",e[e.STREAM_DRAW=35040]="STREAM_DRAW",e[e.DYNAMIC_DRAW=35048]="DYNAMIC_DRAW",e[e.ARRAY_BUFFER=34962]="ARRAY_BUFFER",e[e.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",e[e.BUFFER_SIZE=34660]="BUFFER_SIZE",e[e.BUFFER_USAGE=34661]="BUFFER_USAGE",e[e.CURRENT_VERTEX_ATTRIB=34342]="CURRENT_VERTEX_ATTRIB",e[e.VERTEX_ATTRIB_ARRAY_ENABLED=34338]="VERTEX_ATTRIB_ARRAY_ENABLED",e[e.VERTEX_ATTRIB_ARRAY_SIZE=34339]="VERTEX_ATTRIB_ARRAY_SIZE",e[e.VERTEX_ATTRIB_ARRAY_STRIDE=34340]="VERTEX_ATTRIB_ARRAY_STRIDE",e[e.VERTEX_ATTRIB_ARRAY_TYPE=34341]="VERTEX_ATTRIB_ARRAY_TYPE",e[e.VERTEX_ATTRIB_ARRAY_NORMALIZED=34922]="VERTEX_ATTRIB_ARRAY_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_POINTER=34373]="VERTEX_ATTRIB_ARRAY_POINTER",e[e.VERTEX_ATTRIB_ARRAY_BUFFER_BINDING=34975]="VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",e[e.CULL_FACE=2884]="CULL_FACE",e[e.FRONT=1028]="FRONT",e[e.BACK=1029]="BACK",e[e.FRONT_AND_BACK=1032]="FRONT_AND_BACK",e[e.BLEND=3042]="BLEND",e[e.DEPTH_TEST=2929]="DEPTH_TEST",e[e.DITHER=3024]="DITHER",e[e.POLYGON_OFFSET_FILL=32823]="POLYGON_OFFSET_FILL",e[e.SAMPLE_ALPHA_TO_COVERAGE=32926]="SAMPLE_ALPHA_TO_COVERAGE",e[e.SAMPLE_COVERAGE=32928]="SAMPLE_COVERAGE",e[e.SCISSOR_TEST=3089]="SCISSOR_TEST",e[e.STENCIL_TEST=2960]="STENCIL_TEST",e[e.NO_ERROR=0]="NO_ERROR",e[e.INVALID_ENUM=1280]="INVALID_ENUM",e[e.INVALID_VALUE=1281]="INVALID_VALUE",e[e.INVALID_OPERATION=1282]="INVALID_OPERATION",e[e.OUT_OF_MEMORY=1285]="OUT_OF_MEMORY",e[e.CONTEXT_LOST_WEBGL=37442]="CONTEXT_LOST_WEBGL",e[e.CW=2304]="CW",e[e.CCW=2305]="CCW",e[e.DONT_CARE=4352]="DONT_CARE",e[e.FASTEST=4353]="FASTEST",e[e.NICEST=4354]="NICEST",e[e.GENERATE_MIPMAP_HINT=33170]="GENERATE_MIPMAP_HINT",e[e.BYTE=5120]="BYTE",e[e.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",e[e.SHORT=5122]="SHORT",e[e.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",e[e.INT=5124]="INT",e[e.UNSIGNED_INT=5125]="UNSIGNED_INT",e[e.FLOAT=5126]="FLOAT",e[e.DOUBLE=5130]="DOUBLE",e[e.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",e[e.ALPHA=6406]="ALPHA",e[e.RGB=6407]="RGB",e[e.RGBA=6408]="RGBA",e[e.LUMINANCE=6409]="LUMINANCE",e[e.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",e[e.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",e[e.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",e[e.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",e[e.FRAGMENT_SHADER=35632]="FRAGMENT_SHADER",e[e.VERTEX_SHADER=35633]="VERTEX_SHADER",e[e.COMPILE_STATUS=35713]="COMPILE_STATUS",e[e.DELETE_STATUS=35712]="DELETE_STATUS",e[e.LINK_STATUS=35714]="LINK_STATUS",e[e.VALIDATE_STATUS=35715]="VALIDATE_STATUS",e[e.ATTACHED_SHADERS=35717]="ATTACHED_SHADERS",e[e.ACTIVE_ATTRIBUTES=35721]="ACTIVE_ATTRIBUTES",e[e.ACTIVE_UNIFORMS=35718]="ACTIVE_UNIFORMS",e[e.MAX_VERTEX_ATTRIBS=34921]="MAX_VERTEX_ATTRIBS",e[e.MAX_VERTEX_UNIFORM_VECTORS=36347]="MAX_VERTEX_UNIFORM_VECTORS",e[e.MAX_VARYING_VECTORS=36348]="MAX_VARYING_VECTORS",e[e.MAX_COMBINED_TEXTURE_IMAGE_UNITS=35661]="MAX_COMBINED_TEXTURE_IMAGE_UNITS",e[e.MAX_VERTEX_TEXTURE_IMAGE_UNITS=35660]="MAX_VERTEX_TEXTURE_IMAGE_UNITS",e[e.MAX_TEXTURE_IMAGE_UNITS=34930]="MAX_TEXTURE_IMAGE_UNITS",e[e.MAX_FRAGMENT_UNIFORM_VECTORS=36349]="MAX_FRAGMENT_UNIFORM_VECTORS",e[e.SHADER_TYPE=35663]="SHADER_TYPE",e[e.SHADING_LANGUAGE_VERSION=35724]="SHADING_LANGUAGE_VERSION",e[e.CURRENT_PROGRAM=35725]="CURRENT_PROGRAM",e[e.NEVER=512]="NEVER",e[e.LESS=513]="LESS",e[e.EQUAL=514]="EQUAL",e[e.LEQUAL=515]="LEQUAL",e[e.GREATER=516]="GREATER",e[e.NOTEQUAL=517]="NOTEQUAL",e[e.GEQUAL=518]="GEQUAL",e[e.ALWAYS=519]="ALWAYS",e[e.KEEP=7680]="KEEP",e[e.REPLACE=7681]="REPLACE",e[e.INCR=7682]="INCR",e[e.DECR=7683]="DECR",e[e.INVERT=5386]="INVERT",e[e.INCR_WRAP=34055]="INCR_WRAP",e[e.DECR_WRAP=34056]="DECR_WRAP",e[e.NEAREST=9728]="NEAREST",e[e.LINEAR=9729]="LINEAR",e[e.NEAREST_MIPMAP_NEAREST=9984]="NEAREST_MIPMAP_NEAREST",e[e.LINEAR_MIPMAP_NEAREST=9985]="LINEAR_MIPMAP_NEAREST",e[e.NEAREST_MIPMAP_LINEAR=9986]="NEAREST_MIPMAP_LINEAR",e[e.LINEAR_MIPMAP_LINEAR=9987]="LINEAR_MIPMAP_LINEAR",e[e.TEXTURE_MAG_FILTER=10240]="TEXTURE_MAG_FILTER",e[e.TEXTURE_MIN_FILTER=10241]="TEXTURE_MIN_FILTER",e[e.TEXTURE_WRAP_S=10242]="TEXTURE_WRAP_S",e[e.TEXTURE_WRAP_T=10243]="TEXTURE_WRAP_T",e[e.TEXTURE_2D=3553]="TEXTURE_2D",e[e.TEXTURE=5890]="TEXTURE",e[e.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",e[e.TEXTURE_BINDING_CUBE_MAP=34068]="TEXTURE_BINDING_CUBE_MAP",e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",e[e.MAX_CUBE_MAP_TEXTURE_SIZE=34076]="MAX_CUBE_MAP_TEXTURE_SIZE",e[e.TEXTURE0=33984]="TEXTURE0",e[e.ACTIVE_TEXTURE=34016]="ACTIVE_TEXTURE",e[e.REPEAT=10497]="REPEAT",e[e.CLAMP_TO_EDGE=33071]="CLAMP_TO_EDGE",e[e.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",e[e.TEXTURE_WIDTH=4096]="TEXTURE_WIDTH",e[e.TEXTURE_HEIGHT=4097]="TEXTURE_HEIGHT",e[e.FLOAT_VEC2=35664]="FLOAT_VEC2",e[e.FLOAT_VEC3=35665]="FLOAT_VEC3",e[e.FLOAT_VEC4=35666]="FLOAT_VEC4",e[e.INT_VEC2=35667]="INT_VEC2",e[e.INT_VEC3=35668]="INT_VEC3",e[e.INT_VEC4=35669]="INT_VEC4",e[e.BOOL=35670]="BOOL",e[e.BOOL_VEC2=35671]="BOOL_VEC2",e[e.BOOL_VEC3=35672]="BOOL_VEC3",e[e.BOOL_VEC4=35673]="BOOL_VEC4",e[e.FLOAT_MAT2=35674]="FLOAT_MAT2",e[e.FLOAT_MAT3=35675]="FLOAT_MAT3",e[e.FLOAT_MAT4=35676]="FLOAT_MAT4",e[e.SAMPLER_2D=35678]="SAMPLER_2D",e[e.SAMPLER_CUBE=35680]="SAMPLER_CUBE",e[e.LOW_FLOAT=36336]="LOW_FLOAT",e[e.MEDIUM_FLOAT=36337]="MEDIUM_FLOAT",e[e.HIGH_FLOAT=36338]="HIGH_FLOAT",e[e.LOW_INT=36339]="LOW_INT",e[e.MEDIUM_INT=36340]="MEDIUM_INT",e[e.HIGH_INT=36341]="HIGH_INT",e[e.FRAMEBUFFER=36160]="FRAMEBUFFER",e[e.RENDERBUFFER=36161]="RENDERBUFFER",e[e.RGBA4=32854]="RGBA4",e[e.RGB5_A1=32855]="RGB5_A1",e[e.RGB565=36194]="RGB565",e[e.DEPTH_COMPONENT16=33189]="DEPTH_COMPONENT16",e[e.STENCIL_INDEX=6401]="STENCIL_INDEX",e[e.STENCIL_INDEX8=36168]="STENCIL_INDEX8",e[e.DEPTH_STENCIL=34041]="DEPTH_STENCIL",e[e.RENDERBUFFER_WIDTH=36162]="RENDERBUFFER_WIDTH",e[e.RENDERBUFFER_HEIGHT=36163]="RENDERBUFFER_HEIGHT",e[e.RENDERBUFFER_INTERNAL_FORMAT=36164]="RENDERBUFFER_INTERNAL_FORMAT",e[e.RENDERBUFFER_RED_SIZE=36176]="RENDERBUFFER_RED_SIZE",e[e.RENDERBUFFER_GREEN_SIZE=36177]="RENDERBUFFER_GREEN_SIZE",e[e.RENDERBUFFER_BLUE_SIZE=36178]="RENDERBUFFER_BLUE_SIZE",e[e.RENDERBUFFER_ALPHA_SIZE=36179]="RENDERBUFFER_ALPHA_SIZE",e[e.RENDERBUFFER_DEPTH_SIZE=36180]="RENDERBUFFER_DEPTH_SIZE",e[e.RENDERBUFFER_STENCIL_SIZE=36181]="RENDERBUFFER_STENCIL_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE=36048]="FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_OBJECT_NAME=36049]="FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL=36050]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE=36051]="FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",e[e.COLOR_ATTACHMENT0=36064]="COLOR_ATTACHMENT0",e[e.DEPTH_ATTACHMENT=36096]="DEPTH_ATTACHMENT",e[e.STENCIL_ATTACHMENT=36128]="STENCIL_ATTACHMENT",e[e.DEPTH_STENCIL_ATTACHMENT=33306]="DEPTH_STENCIL_ATTACHMENT",e[e.NONE=0]="NONE",e[e.FRAMEBUFFER_COMPLETE=36053]="FRAMEBUFFER_COMPLETE",e[e.FRAMEBUFFER_INCOMPLETE_ATTACHMENT=36054]="FRAMEBUFFER_INCOMPLETE_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT=36055]="FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",e[e.FRAMEBUFFER_INCOMPLETE_DIMENSIONS=36057]="FRAMEBUFFER_INCOMPLETE_DIMENSIONS",e[e.FRAMEBUFFER_UNSUPPORTED=36061]="FRAMEBUFFER_UNSUPPORTED",e[e.FRAMEBUFFER_BINDING=36006]="FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_BINDING=36007]="RENDERBUFFER_BINDING",e[e.READ_FRAMEBUFFER=36008]="READ_FRAMEBUFFER",e[e.DRAW_FRAMEBUFFER=36009]="DRAW_FRAMEBUFFER",e[e.MAX_RENDERBUFFER_SIZE=34024]="MAX_RENDERBUFFER_SIZE",e[e.INVALID_FRAMEBUFFER_OPERATION=1286]="INVALID_FRAMEBUFFER_OPERATION",e[e.UNPACK_FLIP_Y_WEBGL=37440]="UNPACK_FLIP_Y_WEBGL",e[e.UNPACK_PREMULTIPLY_ALPHA_WEBGL=37441]="UNPACK_PREMULTIPLY_ALPHA_WEBGL",e[e.UNPACK_COLORSPACE_CONVERSION_WEBGL=37443]="UNPACK_COLORSPACE_CONVERSION_WEBGL",e[e.READ_BUFFER=3074]="READ_BUFFER",e[e.UNPACK_ROW_LENGTH=3314]="UNPACK_ROW_LENGTH",e[e.UNPACK_SKIP_ROWS=3315]="UNPACK_SKIP_ROWS",e[e.UNPACK_SKIP_PIXELS=3316]="UNPACK_SKIP_PIXELS",e[e.PACK_ROW_LENGTH=3330]="PACK_ROW_LENGTH",e[e.PACK_SKIP_ROWS=3331]="PACK_SKIP_ROWS",e[e.PACK_SKIP_PIXELS=3332]="PACK_SKIP_PIXELS",e[e.TEXTURE_BINDING_3D=32874]="TEXTURE_BINDING_3D",e[e.UNPACK_SKIP_IMAGES=32877]="UNPACK_SKIP_IMAGES",e[e.UNPACK_IMAGE_HEIGHT=32878]="UNPACK_IMAGE_HEIGHT",e[e.MAX_3D_TEXTURE_SIZE=32883]="MAX_3D_TEXTURE_SIZE",e[e.MAX_ELEMENTS_VERTICES=33e3]="MAX_ELEMENTS_VERTICES",e[e.MAX_ELEMENTS_INDICES=33001]="MAX_ELEMENTS_INDICES",e[e.MAX_TEXTURE_LOD_BIAS=34045]="MAX_TEXTURE_LOD_BIAS",e[e.MAX_FRAGMENT_UNIFORM_COMPONENTS=35657]="MAX_FRAGMENT_UNIFORM_COMPONENTS",e[e.MAX_VERTEX_UNIFORM_COMPONENTS=35658]="MAX_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_ARRAY_TEXTURE_LAYERS=35071]="MAX_ARRAY_TEXTURE_LAYERS",e[e.MIN_PROGRAM_TEXEL_OFFSET=35076]="MIN_PROGRAM_TEXEL_OFFSET",e[e.MAX_PROGRAM_TEXEL_OFFSET=35077]="MAX_PROGRAM_TEXEL_OFFSET",e[e.MAX_VARYING_COMPONENTS=35659]="MAX_VARYING_COMPONENTS",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT",e[e.RASTERIZER_DISCARD=35977]="RASTERIZER_DISCARD",e[e.VERTEX_ARRAY_BINDING=34229]="VERTEX_ARRAY_BINDING",e[e.MAX_VERTEX_OUTPUT_COMPONENTS=37154]="MAX_VERTEX_OUTPUT_COMPONENTS",e[e.MAX_FRAGMENT_INPUT_COMPONENTS=37157]="MAX_FRAGMENT_INPUT_COMPONENTS",e[e.MAX_SERVER_WAIT_TIMEOUT=37137]="MAX_SERVER_WAIT_TIMEOUT",e[e.MAX_ELEMENT_INDEX=36203]="MAX_ELEMENT_INDEX",e[e.RED=6403]="RED",e[e.RGB8=32849]="RGB8",e[e.RGBA8=32856]="RGBA8",e[e.RGB10_A2=32857]="RGB10_A2",e[e.TEXTURE_3D=32879]="TEXTURE_3D",e[e.TEXTURE_WRAP_R=32882]="TEXTURE_WRAP_R",e[e.TEXTURE_MIN_LOD=33082]="TEXTURE_MIN_LOD",e[e.TEXTURE_MAX_LOD=33083]="TEXTURE_MAX_LOD",e[e.TEXTURE_BASE_LEVEL=33084]="TEXTURE_BASE_LEVEL",e[e.TEXTURE_MAX_LEVEL=33085]="TEXTURE_MAX_LEVEL",e[e.TEXTURE_COMPARE_MODE=34892]="TEXTURE_COMPARE_MODE",e[e.TEXTURE_COMPARE_FUNC=34893]="TEXTURE_COMPARE_FUNC",e[e.SRGB=35904]="SRGB",e[e.SRGB8=35905]="SRGB8",e[e.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",e[e.COMPARE_REF_TO_TEXTURE=34894]="COMPARE_REF_TO_TEXTURE",e[e.RGBA32F=34836]="RGBA32F",e[e.RGB32F=34837]="RGB32F",e[e.RGBA16F=34842]="RGBA16F",e[e.RGB16F=34843]="RGB16F",e[e.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",e[e.TEXTURE_BINDING_2D_ARRAY=35869]="TEXTURE_BINDING_2D_ARRAY",e[e.R11F_G11F_B10F=35898]="R11F_G11F_B10F",e[e.RGB9_E5=35901]="RGB9_E5",e[e.RGBA32UI=36208]="RGBA32UI",e[e.RGB32UI=36209]="RGB32UI",e[e.RGBA16UI=36214]="RGBA16UI",e[e.RGB16UI=36215]="RGB16UI",e[e.RGBA8UI=36220]="RGBA8UI",e[e.RGB8UI=36221]="RGB8UI",e[e.RGBA32I=36226]="RGBA32I",e[e.RGB32I=36227]="RGB32I",e[e.RGBA16I=36232]="RGBA16I",e[e.RGB16I=36233]="RGB16I",e[e.RGBA8I=36238]="RGBA8I",e[e.RGB8I=36239]="RGB8I",e[e.RED_INTEGER=36244]="RED_INTEGER",e[e.RGB_INTEGER=36248]="RGB_INTEGER",e[e.RGBA_INTEGER=36249]="RGBA_INTEGER",e[e.R8=33321]="R8",e[e.RG8=33323]="RG8",e[e.R16F=33325]="R16F",e[e.R32F=33326]="R32F",e[e.RG16F=33327]="RG16F",e[e.RG32F=33328]="RG32F",e[e.R8I=33329]="R8I",e[e.R8UI=33330]="R8UI",e[e.R16I=33331]="R16I",e[e.R16UI=33332]="R16UI",e[e.R32I=33333]="R32I",e[e.R32UI=33334]="R32UI",e[e.RG8I=33335]="RG8I",e[e.RG8UI=33336]="RG8UI",e[e.RG16I=33337]="RG16I",e[e.RG16UI=33338]="RG16UI",e[e.RG32I=33339]="RG32I",e[e.RG32UI=33340]="RG32UI",e[e.R8_SNORM=36756]="R8_SNORM",e[e.RG8_SNORM=36757]="RG8_SNORM",e[e.RGB8_SNORM=36758]="RGB8_SNORM",e[e.RGBA8_SNORM=36759]="RGBA8_SNORM",e[e.RGB10_A2UI=36975]="RGB10_A2UI",e[e.TEXTURE_IMMUTABLE_FORMAT=37167]="TEXTURE_IMMUTABLE_FORMAT",e[e.TEXTURE_IMMUTABLE_LEVELS=33503]="TEXTURE_IMMUTABLE_LEVELS",e[e.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",e[e.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",e[e.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",e[e.HALF_FLOAT=5131]="HALF_FLOAT",e[e.RG=33319]="RG",e[e.RG_INTEGER=33320]="RG_INTEGER",e[e.INT_2_10_10_10_REV=36255]="INT_2_10_10_10_REV",e[e.CURRENT_QUERY=34917]="CURRENT_QUERY",e[e.QUERY_RESULT=34918]="QUERY_RESULT",e[e.QUERY_RESULT_AVAILABLE=34919]="QUERY_RESULT_AVAILABLE",e[e.ANY_SAMPLES_PASSED=35887]="ANY_SAMPLES_PASSED",e[e.ANY_SAMPLES_PASSED_CONSERVATIVE=36202]="ANY_SAMPLES_PASSED_CONSERVATIVE",e[e.MAX_DRAW_BUFFERS=34852]="MAX_DRAW_BUFFERS",e[e.DRAW_BUFFER0=34853]="DRAW_BUFFER0",e[e.DRAW_BUFFER1=34854]="DRAW_BUFFER1",e[e.DRAW_BUFFER2=34855]="DRAW_BUFFER2",e[e.DRAW_BUFFER3=34856]="DRAW_BUFFER3",e[e.DRAW_BUFFER4=34857]="DRAW_BUFFER4",e[e.DRAW_BUFFER5=34858]="DRAW_BUFFER5",e[e.DRAW_BUFFER6=34859]="DRAW_BUFFER6",e[e.DRAW_BUFFER7=34860]="DRAW_BUFFER7",e[e.DRAW_BUFFER8=34861]="DRAW_BUFFER8",e[e.DRAW_BUFFER9=34862]="DRAW_BUFFER9",e[e.DRAW_BUFFER10=34863]="DRAW_BUFFER10",e[e.DRAW_BUFFER11=34864]="DRAW_BUFFER11",e[e.DRAW_BUFFER12=34865]="DRAW_BUFFER12",e[e.DRAW_BUFFER13=34866]="DRAW_BUFFER13",e[e.DRAW_BUFFER14=34867]="DRAW_BUFFER14",e[e.DRAW_BUFFER15=34868]="DRAW_BUFFER15",e[e.MAX_COLOR_ATTACHMENTS=36063]="MAX_COLOR_ATTACHMENTS",e[e.COLOR_ATTACHMENT1=36065]="COLOR_ATTACHMENT1",e[e.COLOR_ATTACHMENT2=36066]="COLOR_ATTACHMENT2",e[e.COLOR_ATTACHMENT3=36067]="COLOR_ATTACHMENT3",e[e.COLOR_ATTACHMENT4=36068]="COLOR_ATTACHMENT4",e[e.COLOR_ATTACHMENT5=36069]="COLOR_ATTACHMENT5",e[e.COLOR_ATTACHMENT6=36070]="COLOR_ATTACHMENT6",e[e.COLOR_ATTACHMENT7=36071]="COLOR_ATTACHMENT7",e[e.COLOR_ATTACHMENT8=36072]="COLOR_ATTACHMENT8",e[e.COLOR_ATTACHMENT9=36073]="COLOR_ATTACHMENT9",e[e.COLOR_ATTACHMENT10=36074]="COLOR_ATTACHMENT10",e[e.COLOR_ATTACHMENT11=36075]="COLOR_ATTACHMENT11",e[e.COLOR_ATTACHMENT12=36076]="COLOR_ATTACHMENT12",e[e.COLOR_ATTACHMENT13=36077]="COLOR_ATTACHMENT13",e[e.COLOR_ATTACHMENT14=36078]="COLOR_ATTACHMENT14",e[e.COLOR_ATTACHMENT15=36079]="COLOR_ATTACHMENT15",e[e.SAMPLER_3D=35679]="SAMPLER_3D",e[e.SAMPLER_2D_SHADOW=35682]="SAMPLER_2D_SHADOW",e[e.SAMPLER_2D_ARRAY=36289]="SAMPLER_2D_ARRAY",e[e.SAMPLER_2D_ARRAY_SHADOW=36292]="SAMPLER_2D_ARRAY_SHADOW",e[e.SAMPLER_CUBE_SHADOW=36293]="SAMPLER_CUBE_SHADOW",e[e.INT_SAMPLER_2D=36298]="INT_SAMPLER_2D",e[e.INT_SAMPLER_3D=36299]="INT_SAMPLER_3D",e[e.INT_SAMPLER_CUBE=36300]="INT_SAMPLER_CUBE",e[e.INT_SAMPLER_2D_ARRAY=36303]="INT_SAMPLER_2D_ARRAY",e[e.UNSIGNED_INT_SAMPLER_2D=36306]="UNSIGNED_INT_SAMPLER_2D",e[e.UNSIGNED_INT_SAMPLER_3D=36307]="UNSIGNED_INT_SAMPLER_3D",e[e.UNSIGNED_INT_SAMPLER_CUBE=36308]="UNSIGNED_INT_SAMPLER_CUBE",e[e.UNSIGNED_INT_SAMPLER_2D_ARRAY=36311]="UNSIGNED_INT_SAMPLER_2D_ARRAY",e[e.MAX_SAMPLES=36183]="MAX_SAMPLES",e[e.SAMPLER_BINDING=35097]="SAMPLER_BINDING",e[e.PIXEL_PACK_BUFFER=35051]="PIXEL_PACK_BUFFER",e[e.PIXEL_UNPACK_BUFFER=35052]="PIXEL_UNPACK_BUFFER",e[e.PIXEL_PACK_BUFFER_BINDING=35053]="PIXEL_PACK_BUFFER_BINDING",e[e.PIXEL_UNPACK_BUFFER_BINDING=35055]="PIXEL_UNPACK_BUFFER_BINDING",e[e.COPY_READ_BUFFER=36662]="COPY_READ_BUFFER",e[e.COPY_WRITE_BUFFER=36663]="COPY_WRITE_BUFFER",e[e.COPY_READ_BUFFER_BINDING=36662]="COPY_READ_BUFFER_BINDING",e[e.COPY_WRITE_BUFFER_BINDING=36663]="COPY_WRITE_BUFFER_BINDING",e[e.FLOAT_MAT2x3=35685]="FLOAT_MAT2x3",e[e.FLOAT_MAT2x4=35686]="FLOAT_MAT2x4",e[e.FLOAT_MAT3x2=35687]="FLOAT_MAT3x2",e[e.FLOAT_MAT3x4=35688]="FLOAT_MAT3x4",e[e.FLOAT_MAT4x2=35689]="FLOAT_MAT4x2",e[e.FLOAT_MAT4x3=35690]="FLOAT_MAT4x3",e[e.UNSIGNED_INT_VEC2=36294]="UNSIGNED_INT_VEC2",e[e.UNSIGNED_INT_VEC3=36295]="UNSIGNED_INT_VEC3",e[e.UNSIGNED_INT_VEC4=36296]="UNSIGNED_INT_VEC4",e[e.UNSIGNED_NORMALIZED=35863]="UNSIGNED_NORMALIZED",e[e.SIGNED_NORMALIZED=36764]="SIGNED_NORMALIZED",e[e.VERTEX_ATTRIB_ARRAY_INTEGER=35069]="VERTEX_ATTRIB_ARRAY_INTEGER",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR",e[e.TRANSFORM_FEEDBACK_BUFFER_MODE=35967]="TRANSFORM_FEEDBACK_BUFFER_MODE",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS=35968]="MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",e[e.TRANSFORM_FEEDBACK_VARYINGS=35971]="TRANSFORM_FEEDBACK_VARYINGS",e[e.TRANSFORM_FEEDBACK_BUFFER_START=35972]="TRANSFORM_FEEDBACK_BUFFER_START",e[e.TRANSFORM_FEEDBACK_BUFFER_SIZE=35973]="TRANSFORM_FEEDBACK_BUFFER_SIZE",e[e.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN=35976]="TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",e[e.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS=35978]="MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",e[e.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS=35979]="MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",e[e.INTERLEAVED_ATTRIBS=35980]="INTERLEAVED_ATTRIBS",e[e.SEPARATE_ATTRIBS=35981]="SEPARATE_ATTRIBS",e[e.TRANSFORM_FEEDBACK_BUFFER=35982]="TRANSFORM_FEEDBACK_BUFFER",e[e.TRANSFORM_FEEDBACK_BUFFER_BINDING=35983]="TRANSFORM_FEEDBACK_BUFFER_BINDING",e[e.TRANSFORM_FEEDBACK=36386]="TRANSFORM_FEEDBACK",e[e.TRANSFORM_FEEDBACK_PAUSED=36387]="TRANSFORM_FEEDBACK_PAUSED",e[e.TRANSFORM_FEEDBACK_ACTIVE=36388]="TRANSFORM_FEEDBACK_ACTIVE",e[e.TRANSFORM_FEEDBACK_BINDING=36389]="TRANSFORM_FEEDBACK_BINDING",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",e[e.FRAMEBUFFER_ATTACHMENT_RED_SIZE=33298]="FRAMEBUFFER_ATTACHMENT_RED_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_GREEN_SIZE=33299]="FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_BLUE_SIZE=33300]="FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE=33301]="FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE=33302]="FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",e[e.FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE=33303]="FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",e[e.FRAMEBUFFER_DEFAULT=33304]="FRAMEBUFFER_DEFAULT",e[e.DEPTH24_STENCIL8=35056]="DEPTH24_STENCIL8",e[e.DRAW_FRAMEBUFFER_BINDING=36006]="DRAW_FRAMEBUFFER_BINDING",e[e.READ_FRAMEBUFFER_BINDING=36010]="READ_FRAMEBUFFER_BINDING",e[e.RENDERBUFFER_SAMPLES=36011]="RENDERBUFFER_SAMPLES",e[e.FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER=36052]="FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",e[e.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE=36182]="FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",e[e.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",e[e.UNIFORM_BUFFER_BINDING=35368]="UNIFORM_BUFFER_BINDING",e[e.UNIFORM_BUFFER_START=35369]="UNIFORM_BUFFER_START",e[e.UNIFORM_BUFFER_SIZE=35370]="UNIFORM_BUFFER_SIZE",e[e.MAX_VERTEX_UNIFORM_BLOCKS=35371]="MAX_VERTEX_UNIFORM_BLOCKS",e[e.MAX_FRAGMENT_UNIFORM_BLOCKS=35373]="MAX_FRAGMENT_UNIFORM_BLOCKS",e[e.MAX_COMBINED_UNIFORM_BLOCKS=35374]="MAX_COMBINED_UNIFORM_BLOCKS",e[e.MAX_UNIFORM_BUFFER_BINDINGS=35375]="MAX_UNIFORM_BUFFER_BINDINGS",e[e.MAX_UNIFORM_BLOCK_SIZE=35376]="MAX_UNIFORM_BLOCK_SIZE",e[e.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS=35377]="MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",e[e.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS=35379]="MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",e[e.UNIFORM_BUFFER_OFFSET_ALIGNMENT=35380]="UNIFORM_BUFFER_OFFSET_ALIGNMENT",e[e.ACTIVE_UNIFORM_BLOCKS=35382]="ACTIVE_UNIFORM_BLOCKS",e[e.UNIFORM_TYPE=35383]="UNIFORM_TYPE",e[e.UNIFORM_SIZE=35384]="UNIFORM_SIZE",e[e.UNIFORM_BLOCK_INDEX=35386]="UNIFORM_BLOCK_INDEX",e[e.UNIFORM_OFFSET=35387]="UNIFORM_OFFSET",e[e.UNIFORM_ARRAY_STRIDE=35388]="UNIFORM_ARRAY_STRIDE",e[e.UNIFORM_MATRIX_STRIDE=35389]="UNIFORM_MATRIX_STRIDE",e[e.UNIFORM_IS_ROW_MAJOR=35390]="UNIFORM_IS_ROW_MAJOR",e[e.UNIFORM_BLOCK_BINDING=35391]="UNIFORM_BLOCK_BINDING",e[e.UNIFORM_BLOCK_DATA_SIZE=35392]="UNIFORM_BLOCK_DATA_SIZE",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORMS=35394]="UNIFORM_BLOCK_ACTIVE_UNIFORMS",e[e.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES=35395]="UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",e[e.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER=35396]="UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",e[e.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER=35398]="UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",e[e.OBJECT_TYPE=37138]="OBJECT_TYPE",e[e.SYNC_CONDITION=37139]="SYNC_CONDITION",e[e.SYNC_STATUS=37140]="SYNC_STATUS",e[e.SYNC_FLAGS=37141]="SYNC_FLAGS",e[e.SYNC_FENCE=37142]="SYNC_FENCE",e[e.SYNC_GPU_COMMANDS_COMPLETE=37143]="SYNC_GPU_COMMANDS_COMPLETE",e[e.UNSIGNALED=37144]="UNSIGNALED",e[e.SIGNALED=37145]="SIGNALED",e[e.ALREADY_SIGNALED=37146]="ALREADY_SIGNALED",e[e.TIMEOUT_EXPIRED=37147]="TIMEOUT_EXPIRED",e[e.CONDITION_SATISFIED=37148]="CONDITION_SATISFIED",e[e.WAIT_FAILED=37149]="WAIT_FAILED",e[e.SYNC_FLUSH_COMMANDS_BIT=1]="SYNC_FLUSH_COMMANDS_BIT",e[e.COLOR=6144]="COLOR",e[e.DEPTH=6145]="DEPTH",e[e.STENCIL=6146]="STENCIL",e[e.MIN=32775]="MIN",e[e.MAX=32776]="MAX",e[e.DEPTH_COMPONENT24=33190]="DEPTH_COMPONENT24",e[e.STREAM_READ=35041]="STREAM_READ",e[e.STREAM_COPY=35042]="STREAM_COPY",e[e.STATIC_READ=35045]="STATIC_READ",e[e.STATIC_COPY=35046]="STATIC_COPY",e[e.DYNAMIC_READ=35049]="DYNAMIC_READ",e[e.DYNAMIC_COPY=35050]="DYNAMIC_COPY",e[e.DEPTH_COMPONENT32F=36012]="DEPTH_COMPONENT32F",e[e.DEPTH32F_STENCIL8=36013]="DEPTH32F_STENCIL8",e[e.INVALID_INDEX=4294967295]="INVALID_INDEX",e[e.TIMEOUT_IGNORED=-1]="TIMEOUT_IGNORED",e[e.MAX_CLIENT_WAIT_TIMEOUT_WEBGL=37447]="MAX_CLIENT_WAIT_TIMEOUT_WEBGL",e[e.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE=35070]="VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",e[e.UNMASKED_VENDOR_WEBGL=37445]="UNMASKED_VENDOR_WEBGL",e[e.UNMASKED_RENDERER_WEBGL=37446]="UNMASKED_RENDERER_WEBGL",e[e.MAX_TEXTURE_MAX_ANISOTROPY_EXT=34047]="MAX_TEXTURE_MAX_ANISOTROPY_EXT",e[e.TEXTURE_MAX_ANISOTROPY_EXT=34046]="TEXTURE_MAX_ANISOTROPY_EXT",e[e.SRGB_EXT=35904]="SRGB_EXT",e[e.SRGB_ALPHA_EXT=35906]="SRGB_ALPHA_EXT",e[e.SRGB8_ALPHA8_EXT=35907]="SRGB8_ALPHA8_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT=33296]="FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT",e[e.R16_EXT=33322]="R16_EXT",e[e.RG16_EXT=33324]="RG16_EXT",e[e.RGB16_EXT=32852]="RGB16_EXT",e[e.RGBA16_EXT=32859]="RGBA16_EXT",e[e.R16_SNORM_EXT=36760]="R16_SNORM_EXT",e[e.RG16_SNORM_EXT=36761]="RG16_SNORM_EXT",e[e.RGB16_SNORM_EXT=36762]="RGB16_SNORM_EXT",e[e.RGBA16_SNORM_EXT=36763]="RGBA16_SNORM_EXT",e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",e[e.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",e[e.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",e[e.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",e[e.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",e[e.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",e[e.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",e[e.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",e[e.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",e[e.COMPRESSED_RGBA8_ETC2_EAC=37493]="COMPRESSED_RGBA8_ETC2_EAC",e[e.COMPRESSED_SRGB8_ETC2=37494]="COMPRESSED_SRGB8_ETC2",e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37495]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37496]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37497]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]="COMPRESSED_RGB_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]="COMPRESSED_RGBA_PVRTC_4BPPV1_IMG",e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]="COMPRESSED_RGB_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]="COMPRESSED_RGBA_PVRTC_2BPPV1_IMG",e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]="COMPRESSED_RGB_ETC1_WEBGL",e[e.COMPRESSED_RGB_ATC_WEBGL=35986]="COMPRESSED_RGB_ATC_WEBGL",e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35986]="COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]="COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL",e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",e[e.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",e[e.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",e[e.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",e[e.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",e[e.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",e[e.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",e[e.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",e[e.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",e[e.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",e[e.UNSIGNED_INT_24_8_WEBGL=34042]="UNSIGNED_INT_24_8_WEBGL",e[e.HALF_FLOAT_OES=36193]="HALF_FLOAT_OES",e[e.RGBA32F_EXT=34836]="RGBA32F_EXT",e[e.RGB32F_EXT=34837]="RGB32F_EXT",e[e.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT=33297]="FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT",e[e.UNSIGNED_NORMALIZED_EXT=35863]="UNSIGNED_NORMALIZED_EXT",e[e.MIN_EXT=32775]="MIN_EXT",e[e.MAX_EXT=32776]="MAX_EXT",e[e.FRAGMENT_SHADER_DERIVATIVE_HINT_OES=35723]="FRAGMENT_SHADER_DERIVATIVE_HINT_OES",e[e.COLOR_ATTACHMENT0_WEBGL=36064]="COLOR_ATTACHMENT0_WEBGL",e[e.COLOR_ATTACHMENT1_WEBGL=36065]="COLOR_ATTACHMENT1_WEBGL",e[e.COLOR_ATTACHMENT2_WEBGL=36066]="COLOR_ATTACHMENT2_WEBGL",e[e.COLOR_ATTACHMENT3_WEBGL=36067]="COLOR_ATTACHMENT3_WEBGL",e[e.COLOR_ATTACHMENT4_WEBGL=36068]="COLOR_ATTACHMENT4_WEBGL",e[e.COLOR_ATTACHMENT5_WEBGL=36069]="COLOR_ATTACHMENT5_WEBGL",e[e.COLOR_ATTACHMENT6_WEBGL=36070]="COLOR_ATTACHMENT6_WEBGL",e[e.COLOR_ATTACHMENT7_WEBGL=36071]="COLOR_ATTACHMENT7_WEBGL",e[e.COLOR_ATTACHMENT8_WEBGL=36072]="COLOR_ATTACHMENT8_WEBGL",e[e.COLOR_ATTACHMENT9_WEBGL=36073]="COLOR_ATTACHMENT9_WEBGL",e[e.COLOR_ATTACHMENT10_WEBGL=36074]="COLOR_ATTACHMENT10_WEBGL",e[e.COLOR_ATTACHMENT11_WEBGL=36075]="COLOR_ATTACHMENT11_WEBGL",e[e.COLOR_ATTACHMENT12_WEBGL=36076]="COLOR_ATTACHMENT12_WEBGL",e[e.COLOR_ATTACHMENT13_WEBGL=36077]="COLOR_ATTACHMENT13_WEBGL",e[e.COLOR_ATTACHMENT14_WEBGL=36078]="COLOR_ATTACHMENT14_WEBGL",e[e.COLOR_ATTACHMENT15_WEBGL=36079]="COLOR_ATTACHMENT15_WEBGL",e[e.DRAW_BUFFER0_WEBGL=34853]="DRAW_BUFFER0_WEBGL",e[e.DRAW_BUFFER1_WEBGL=34854]="DRAW_BUFFER1_WEBGL",e[e.DRAW_BUFFER2_WEBGL=34855]="DRAW_BUFFER2_WEBGL",e[e.DRAW_BUFFER3_WEBGL=34856]="DRAW_BUFFER3_WEBGL",e[e.DRAW_BUFFER4_WEBGL=34857]="DRAW_BUFFER4_WEBGL",e[e.DRAW_BUFFER5_WEBGL=34858]="DRAW_BUFFER5_WEBGL",e[e.DRAW_BUFFER6_WEBGL=34859]="DRAW_BUFFER6_WEBGL",e[e.DRAW_BUFFER7_WEBGL=34860]="DRAW_BUFFER7_WEBGL",e[e.DRAW_BUFFER8_WEBGL=34861]="DRAW_BUFFER8_WEBGL",e[e.DRAW_BUFFER9_WEBGL=34862]="DRAW_BUFFER9_WEBGL",e[e.DRAW_BUFFER10_WEBGL=34863]="DRAW_BUFFER10_WEBGL",e[e.DRAW_BUFFER11_WEBGL=34864]="DRAW_BUFFER11_WEBGL",e[e.DRAW_BUFFER12_WEBGL=34865]="DRAW_BUFFER12_WEBGL",e[e.DRAW_BUFFER13_WEBGL=34866]="DRAW_BUFFER13_WEBGL",e[e.DRAW_BUFFER14_WEBGL=34867]="DRAW_BUFFER14_WEBGL",e[e.DRAW_BUFFER15_WEBGL=34868]="DRAW_BUFFER15_WEBGL",e[e.MAX_COLOR_ATTACHMENTS_WEBGL=36063]="MAX_COLOR_ATTACHMENTS_WEBGL",e[e.MAX_DRAW_BUFFERS_WEBGL=34852]="MAX_DRAW_BUFFERS_WEBGL",e[e.VERTEX_ARRAY_BINDING_OES=34229]="VERTEX_ARRAY_BINDING_OES",e[e.QUERY_COUNTER_BITS_EXT=34916]="QUERY_COUNTER_BITS_EXT",e[e.CURRENT_QUERY_EXT=34917]="CURRENT_QUERY_EXT",e[e.QUERY_RESULT_EXT=34918]="QUERY_RESULT_EXT",e[e.QUERY_RESULT_AVAILABLE_EXT=34919]="QUERY_RESULT_AVAILABLE_EXT",e[e.TIME_ELAPSED_EXT=35007]="TIME_ELAPSED_EXT",e[e.TIMESTAMP_EXT=36392]="TIMESTAMP_EXT",e[e.GPU_DISJOINT_EXT=36795]="GPU_DISJOINT_EXT",e}(M||{});var Ne=h(q(),1);var Mt=e=>`${e}`;function Ge(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],o=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,i=Math.fround(e),r=e-i;return t[o]=i,t[o+1]=r,t}function Ot(e){return e-Math.fround(e)}function It(e){let t=new Float32Array(32);for(let o=0;o<4;++o)for(let i=0;i<4;++i){let r=o*4+i;Ge(e[i*4+o],t,r*2)}return t}var ht=Mt`\
|
|
8
|
-
uniform float ONE;
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
About LUMA_FP64_CODE_ELIMINATION_WORKAROUND
|
|
12
|
-
|
|
13
|
-
The purpose of this workaround is to prevent shader compilers from
|
|
14
|
-
optimizing away necessary arithmetic operations by swapping their sequences
|
|
15
|
-
or transform the equation to some 'equivalent' form.
|
|
16
|
-
|
|
17
|
-
The method is to multiply an artifical variable, ONE, which will be known to
|
|
18
|
-
the compiler to be 1 only at runtime. The whole expression is then represented
|
|
19
|
-
as a polynomial with respective to ONE. In the coefficients of all terms, only one a
|
|
20
|
-
and one b should appear
|
|
21
|
-
|
|
22
|
-
err = (a + b) * ONE^6 - a * ONE^5 - (a + b) * ONE^4 + a * ONE^3 - b - (a + b) * ONE^2 + a * ONE
|
|
23
|
-
*/
|
|
24
|
-
|
|
25
|
-
// Divide float number to high and low floats to extend fraction bits
|
|
7
|
+
"use strict";var __exports__=(()=>{var li=Object.create;var Nt=Object.defineProperty;var ci=Object.getOwnPropertyDescriptor;var ui=Object.getOwnPropertyNames;var gi=Object.getPrototypeOf,fi=Object.prototype.hasOwnProperty;var Qt=(n,t)=>()=>(t||n((t={exports:{}}).exports,t),t.exports),di=(n,t)=>{for(var e in t)Nt(n,e,{get:t[e],enumerable:!0})},Pt=(n,t,e,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of ui(t))!fi.call(n,i)&&i!==e&&Nt(n,i,{get:()=>t[i],enumerable:!(o=ci(t,i))||o.enumerable});return n},U=(n,t,e)=>(Pt(n,t,"default"),e&&Pt(e,t,"default")),M=(n,t,e)=>(e=n!=null?li(gi(n)):{},Pt(t||!n||!n.__esModule?Nt(e,"default",{value:n,enumerable:!0}):e,n)),pi=n=>Pt(Nt({},"__esModule",{value:!0}),n);var $=Qt((Pr,he)=>{he.exports=globalThis.deck});var E=Qt((Dr,ve)=>{ve.exports=globalThis.deck});var q=Qt((Or,Se)=>{Se.exports=globalThis.luma});var Et={};di(Et,{AGGREGATION_OPERATION:()=>T,CPUGridLayer:()=>H,ContourLayer:()=>_t,GPUGridLayer:()=>V,GridLayer:()=>Mt,HeatmapLayer:()=>Ct,HexagonLayer:()=>At,ScreenGridLayer:()=>St,_AggregationLayer:()=>P,_BinSorter:()=>F,_CPUAggregator:()=>I,_GPUGridAggregator:()=>C});var L={},xe=M($(),1);U(L,M($(),1));if(!xe.GeoJsonLayer)throw new Error("@deck.gl/layers is not found");U(Et,L);var oo=M(E(),1);var vt=M(q(),1);function Zt(n,t=[],e=0){let o=Math.fround(n),i=n-o;return t[e]=o,t[e+1]=i,t}function Ae(n){return n-Math.fround(n)}function ye(n){let t=new Float32Array(32);for(let e=0;e<4;++e)for(let o=0;o<4;++o){let i=e*4+o;Zt(n[o*4+e],t,i*2)}return t}var _e=`uniform float ONE;
|
|
26
8
|
vec2 split(float a) {
|
|
27
|
-
|
|
28
|
-
|
|
9
|
+
const float SPLIT = 4097.0;
|
|
10
|
+
float t = a * SPLIT;
|
|
29
11
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
30
|
-
|
|
31
|
-
|
|
12
|
+
float a_hi = t * ONE - (t - a);
|
|
13
|
+
float a_lo = a * ONE - a_hi;
|
|
32
14
|
#else
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
float a_hi = t - (t - a);
|
|
16
|
+
float a_lo = a - a_hi;
|
|
35
17
|
#endif
|
|
36
|
-
|
|
18
|
+
return vec2(a_hi, a_lo);
|
|
37
19
|
}
|
|
38
|
-
|
|
39
|
-
// Divide float number again when high float uses too many fraction bits
|
|
40
20
|
vec2 split2(vec2 a) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
21
|
+
vec2 b = split(a.x);
|
|
22
|
+
b.y += a.y;
|
|
23
|
+
return b;
|
|
44
24
|
}
|
|
45
|
-
|
|
46
|
-
// Special sum operation when a > b
|
|
47
25
|
vec2 quickTwoSum(float a, float b) {
|
|
48
26
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
49
|
-
|
|
50
|
-
|
|
27
|
+
float sum = (a + b) * ONE;
|
|
28
|
+
float err = b - (sum - a) * ONE;
|
|
51
29
|
#else
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
float sum = a + b;
|
|
31
|
+
float err = b - (sum - a);
|
|
54
32
|
#endif
|
|
55
|
-
|
|
33
|
+
return vec2(sum, err);
|
|
56
34
|
}
|
|
57
|
-
|
|
58
|
-
// General sum operation
|
|
59
35
|
vec2 twoSum(float a, float b) {
|
|
60
|
-
|
|
36
|
+
float s = (a + b);
|
|
61
37
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
62
|
-
|
|
63
|
-
|
|
38
|
+
float v = (s * ONE - a) * ONE;
|
|
39
|
+
float err = (a - (s - v) * ONE) * ONE * ONE * ONE + (b - v);
|
|
64
40
|
#else
|
|
65
|
-
|
|
66
|
-
|
|
41
|
+
float v = s - a;
|
|
42
|
+
float err = (a - (s - v)) + (b - v);
|
|
67
43
|
#endif
|
|
68
|
-
|
|
44
|
+
return vec2(s, err);
|
|
69
45
|
}
|
|
70
|
-
|
|
71
46
|
vec2 twoSub(float a, float b) {
|
|
72
|
-
|
|
47
|
+
float s = (a - b);
|
|
73
48
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
74
|
-
|
|
75
|
-
|
|
49
|
+
float v = (s * ONE - a) * ONE;
|
|
50
|
+
float err = (a - (s - v) * ONE) * ONE * ONE * ONE - (b + v);
|
|
76
51
|
#else
|
|
77
|
-
|
|
78
|
-
|
|
52
|
+
float v = s - a;
|
|
53
|
+
float err = (a - (s - v)) - (b + v);
|
|
79
54
|
#endif
|
|
80
|
-
|
|
55
|
+
return vec2(s, err);
|
|
81
56
|
}
|
|
82
|
-
|
|
83
57
|
vec2 twoSqr(float a) {
|
|
84
|
-
|
|
85
|
-
|
|
58
|
+
float prod = a * a;
|
|
59
|
+
vec2 a_fp64 = split(a);
|
|
86
60
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
87
|
-
|
|
88
|
-
|
|
61
|
+
float err = ((a_fp64.x * a_fp64.x - prod) * ONE + 2.0 * a_fp64.x *
|
|
62
|
+
a_fp64.y * ONE * ONE) + a_fp64.y * a_fp64.y * ONE * ONE * ONE;
|
|
89
63
|
#else
|
|
90
|
-
|
|
64
|
+
float err = ((a_fp64.x * a_fp64.x - prod) + 2.0 * a_fp64.x * a_fp64.y) + a_fp64.y * a_fp64.y;
|
|
91
65
|
#endif
|
|
92
|
-
|
|
66
|
+
return vec2(prod, err);
|
|
93
67
|
}
|
|
94
|
-
|
|
95
68
|
vec2 twoProd(float a, float b) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
|
|
69
|
+
float prod = a * b;
|
|
70
|
+
vec2 a_fp64 = split(a);
|
|
71
|
+
vec2 b_fp64 = split(b);
|
|
72
|
+
float err = ((a_fp64.x * b_fp64.x - prod) + a_fp64.x * b_fp64.y +
|
|
73
|
+
a_fp64.y * b_fp64.x) + a_fp64.y * b_fp64.y;
|
|
74
|
+
return vec2(prod, err);
|
|
75
|
+
}
|
|
104
76
|
vec2 sum_fp64(vec2 a, vec2 b) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
|
|
77
|
+
vec2 s, t;
|
|
78
|
+
s = twoSum(a.x, b.x);
|
|
79
|
+
t = twoSum(a.y, b.y);
|
|
80
|
+
s.y += t.x;
|
|
81
|
+
s = quickTwoSum(s.x, s.y);
|
|
82
|
+
s.y += t.y;
|
|
83
|
+
s = quickTwoSum(s.x, s.y);
|
|
84
|
+
return s;
|
|
85
|
+
}
|
|
115
86
|
vec2 sub_fp64(vec2 a, vec2 b) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
87
|
+
vec2 s, t;
|
|
88
|
+
s = twoSub(a.x, b.x);
|
|
89
|
+
t = twoSub(a.y, b.y);
|
|
90
|
+
s.y += t.x;
|
|
91
|
+
s = quickTwoSum(s.x, s.y);
|
|
92
|
+
s.y += t.y;
|
|
93
|
+
s = quickTwoSum(s.x, s.y);
|
|
94
|
+
return s;
|
|
95
|
+
}
|
|
126
96
|
vec2 mul_fp64(vec2 a, vec2 b) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
prod.y += a.x * b.y;
|
|
97
|
+
vec2 prod = twoProd(a.x, b.x);
|
|
98
|
+
prod.y += a.x * b.y;
|
|
130
99
|
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
|
|
131
|
-
|
|
100
|
+
prod = split2(prod);
|
|
132
101
|
#endif
|
|
133
|
-
|
|
134
|
-
|
|
102
|
+
prod = quickTwoSum(prod.x, prod.y);
|
|
103
|
+
prod.y += a.y * b.x;
|
|
135
104
|
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
|
|
136
|
-
|
|
105
|
+
prod = split2(prod);
|
|
137
106
|
#endif
|
|
138
|
-
|
|
139
|
-
|
|
107
|
+
prod = quickTwoSum(prod.x, prod.y);
|
|
108
|
+
return prod;
|
|
140
109
|
}
|
|
141
|
-
|
|
142
110
|
vec2 div_fp64(vec2 a, vec2 b) {
|
|
143
|
-
|
|
111
|
+
float xn = 1.0 / b.x;
|
|
144
112
|
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
|
|
145
|
-
|
|
113
|
+
vec2 yn = mul_fp64(a, vec2(xn, 0));
|
|
146
114
|
#else
|
|
147
|
-
|
|
115
|
+
vec2 yn = a * xn;
|
|
148
116
|
#endif
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
117
|
+
float diff = (sub_fp64(a, mul_fp64(b, yn))).x;
|
|
118
|
+
vec2 prod = twoProd(xn, diff);
|
|
119
|
+
return sum_fp64(yn, prod);
|
|
152
120
|
}
|
|
153
|
-
|
|
154
121
|
vec2 sqrt_fp64(vec2 a) {
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
float yn = a.x * x;
|
|
122
|
+
if (a.x == 0.0 && a.y == 0.0) return vec2(0.0, 0.0);
|
|
123
|
+
if (a.x < 0.0) return vec2(0.0 / 0.0, 0.0 / 0.0);
|
|
124
|
+
float x = 1.0 / sqrt(a.x);
|
|
125
|
+
float yn = a.x * x;
|
|
160
126
|
#if defined(LUMA_FP64_CODE_ELIMINATION_WORKAROUND)
|
|
161
|
-
|
|
127
|
+
vec2 yn_sqr = twoSqr(yn) * ONE;
|
|
162
128
|
#else
|
|
163
|
-
|
|
129
|
+
vec2 yn_sqr = twoSqr(yn);
|
|
164
130
|
#endif
|
|
165
|
-
|
|
166
|
-
|
|
131
|
+
float diff = sub_fp64(a, yn_sqr).x;
|
|
132
|
+
vec2 prod = twoProd(x * 0.5, diff);
|
|
167
133
|
#if defined(LUMA_FP64_HIGH_BITS_OVERFLOW_WORKAROUND)
|
|
168
|
-
|
|
134
|
+
return sum_fp64(split(yn), prod);
|
|
169
135
|
#else
|
|
170
|
-
|
|
136
|
+
return sum_fp64(vec2(yn, 0.0), prod);
|
|
171
137
|
#endif
|
|
172
138
|
}
|
|
173
|
-
`;var
|
|
139
|
+
`;var mi={ONE:1};function hi(){return mi}var K={name:"fp64-arithmetic",vs:_e,getUniforms:hi,fp64ify:Zt,fp64LowPart:Ae,fp64ifyMatrix4:ye};var J=M(E(),1);var T={SUM:1,MEAN:2,MIN:3,MAX:4};function be(n,t){return n+t}function xi(n,t){return t>n?t:n}function vi(n,t){return t<n?t:n}function Si(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(be,0)/e.length:null}function Ai(n,t){if(Number.isFinite(t))return n.length?n.length*t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(be,0):null}function yi(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(xi,-1/0):null}function _i(n,t){if(Number.isFinite(t))return n.length?t:null;let e=n.map(t).filter(Number.isFinite);return e.length?e.reduce(vi,1/0):null}function Q(n,t,e){let o=T[n]||T.SUM;switch(t=bi(t,e),o){case T.MIN:return i=>_i(i,t);case T.SUM:return i=>Ai(i,t);case T.MEAN:return i=>Si(i,t);case T.MAX:return i=>yi(i,t);default:return null}}function bi(n,t={}){return Number.isFinite(n)?n:e=>(t.index=e.index,n(e.source,t))}function Me(n,t={}){return e=>(t.indices=e.map(o=>o.index),n(e.map(o=>o.source),t))}var Te={projectPoints:!1,viewport:null,createBufferObjects:!0,moduleSettings:{}},W=3402823466e29,Jt=[32775,32774],te=[32776,32774],Ce=[32776,32775],ee={[T.SUM]:32774,[T.MEAN]:32774,[T.MIN]:Jt,[T.MAX]:te};var Ee={size:1,operation:T.SUM,needMin:!1,needMax:!1,combineMaxMin:!1},Pe=4;var Ne=`#version 300 es
|
|
174
140
|
#define SHADER_NAME gpu-aggregation-to-grid-vs
|
|
175
|
-
|
|
176
141
|
in vec3 positions;
|
|
177
142
|
in vec3 positions64Low;
|
|
178
143
|
in vec3 weights;
|
|
@@ -181,140 +146,99 @@ uniform vec2 gridSize;
|
|
|
181
146
|
uniform bool projectPoints;
|
|
182
147
|
uniform vec2 translation;
|
|
183
148
|
uniform vec3 scaling;
|
|
184
|
-
|
|
185
149
|
out vec3 vWeights;
|
|
186
|
-
|
|
187
150
|
vec2 project_to_pixel(vec4 pos) {
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
151
|
+
vec4 result;
|
|
152
|
+
pos.xy = pos.xy/pos.w;
|
|
153
|
+
result = pos + vec4(translation, 0., 0.);
|
|
154
|
+
result.xy = scaling.z > 0. ? result.xy * scaling.xy : result.xy;
|
|
155
|
+
return result.xy;
|
|
193
156
|
}
|
|
194
|
-
|
|
195
157
|
void main(void) {
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
// Transform (0,0):gridSize -> (-1, -1):(1,1)
|
|
219
|
-
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
220
|
-
|
|
221
|
-
// Move to pixel center, pixel-size in screen sapce (2/gridSize) * 0.5 => 1/gridSize
|
|
222
|
-
vec2 offset = 1.0 / gridSize;
|
|
223
|
-
pos = pos + offset;
|
|
224
|
-
|
|
225
|
-
gl_Position = vec4(pos, 0.0, 1.0);
|
|
226
|
-
|
|
227
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
228
|
-
gl_PointSize = 1.0;
|
|
229
|
-
}
|
|
230
|
-
`;var vt=`#version 300 es
|
|
158
|
+
vWeights = weights;
|
|
159
|
+
vec4 windowPos = vec4(positions, 1.);
|
|
160
|
+
if (projectPoints) {
|
|
161
|
+
windowPos = project_position_to_clipspace(positions, positions64Low, vec3(0));
|
|
162
|
+
}
|
|
163
|
+
vec2 pos = project_to_pixel(windowPos);
|
|
164
|
+
vec2 pixelXY64[2];
|
|
165
|
+
pixelXY64[0] = vec2(pos.x, 0.);
|
|
166
|
+
pixelXY64[1] = vec2(pos.y, 0.);
|
|
167
|
+
vec2 gridXY64[2];
|
|
168
|
+
gridXY64[0] = div_fp64(pixelXY64[0], vec2(cellSize.x, 0));
|
|
169
|
+
gridXY64[1] = div_fp64(pixelXY64[1], vec2(cellSize.y, 0));
|
|
170
|
+
float x = floor(gridXY64[0].x);
|
|
171
|
+
float y = floor(gridXY64[1].x);
|
|
172
|
+
pos = vec2(x, y);
|
|
173
|
+
pos = (pos * (2., 2.) / (gridSize)) - (1., 1.);
|
|
174
|
+
vec2 offset = 1.0 / gridSize;
|
|
175
|
+
pos = pos + offset;
|
|
176
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
177
|
+
gl_PointSize = 1.0;
|
|
178
|
+
}
|
|
179
|
+
`;var De=`#version 300 es
|
|
231
180
|
#define SHADER_NAME gpu-aggregation-to-grid-fs
|
|
232
|
-
|
|
233
181
|
precision highp float;
|
|
234
|
-
|
|
235
182
|
in vec3 vWeights;
|
|
236
|
-
|
|
237
183
|
out vec4 fragColor;
|
|
238
|
-
|
|
239
184
|
void main(void) {
|
|
240
|
-
|
|
241
|
-
|
|
185
|
+
fragColor = vec4(vWeights, 1.0);
|
|
186
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
242
187
|
}
|
|
243
|
-
`;var
|
|
188
|
+
`;var Oe=`#version 300 es
|
|
244
189
|
#define SHADER_NAME gpu-aggregation-all-vs-64
|
|
245
|
-
|
|
246
190
|
in vec2 position;
|
|
247
191
|
uniform ivec2 gridSize;
|
|
248
192
|
out vec2 vTextureCoord;
|
|
249
|
-
|
|
250
193
|
void main(void) {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
269
|
-
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
270
|
-
|
|
271
|
-
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
272
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
273
|
-
gl_PointSize = 1.0;
|
|
274
|
-
}
|
|
275
|
-
`;var Ht=`#version 300 es
|
|
194
|
+
vec2 pos = vec2(-1.0, -1.0);
|
|
195
|
+
vec2 offset = 1.0 / vec2(gridSize);
|
|
196
|
+
pos = pos + offset;
|
|
197
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
198
|
+
int yIndex = gl_InstanceID / gridSize[0];
|
|
199
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
200
|
+
vec2 yIndexFP64 = vec2(float(yIndex), 0.);
|
|
201
|
+
vec2 xIndexFP64 = vec2(float(xIndex), 0.);
|
|
202
|
+
vec2 gridSizeYFP64 = vec2(gridSize[1], 0.);
|
|
203
|
+
vec2 gridSizeXFP64 = vec2(gridSize[0], 0.);
|
|
204
|
+
vec2 texCoordXFP64 = div_fp64(yIndexFP64, gridSizeYFP64);
|
|
205
|
+
vec2 texCoordYFP64 = div_fp64(xIndexFP64, gridSizeXFP64);
|
|
206
|
+
vTextureCoord = vec2(texCoordYFP64.x, texCoordXFP64.x);
|
|
207
|
+
gl_PointSize = 1.0;
|
|
208
|
+
}
|
|
209
|
+
`;var Le=`#version 300 es
|
|
276
210
|
#define SHADER_NAME gpu-aggregation-all-fs
|
|
277
|
-
|
|
278
211
|
precision highp float;
|
|
279
|
-
|
|
280
212
|
in vec2 vTextureCoord;
|
|
281
213
|
uniform sampler2D uSampler;
|
|
282
214
|
uniform bool combineMaxMin;
|
|
283
215
|
out vec4 fragColor;
|
|
284
216
|
void main(void) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
`;var bt=`#version 300 es
|
|
217
|
+
vec4 textureColor = texture(uSampler, vec2(vTextureCoord.s, vTextureCoord.t));
|
|
218
|
+
if (textureColor.a == 0.) {
|
|
219
|
+
discard;
|
|
220
|
+
}
|
|
221
|
+
fragColor.rgb = textureColor.rgb;
|
|
222
|
+
fragColor.a = combineMaxMin ? textureColor.r : textureColor.a;
|
|
223
|
+
}
|
|
224
|
+
`;var Fe=`#version 300 es
|
|
294
225
|
#define SHADER_NAME gpu-aggregation-transform-mean-vs
|
|
295
226
|
in vec4 aggregationValues;
|
|
296
227
|
out vec4 meanValues;
|
|
297
|
-
|
|
298
228
|
void main()
|
|
299
229
|
{
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
307
|
-
gl_PointSize = 1.0;
|
|
308
|
-
}
|
|
309
|
-
`;var Fi={minFilter:"nearest",magFilter:"nearest"};function te(e,t){let{width:o=1,height:i=1,data:r=null,parameters:s=Fi}=t;return e.createTexture({data:r,format:"rgba32float",mipmaps:!1,sampler:s,width:o,height:i})}function Ee(e,t){let{id:o,width:i=1,height:r=1,texture:s}=t;return e.createFramebuffer({id:o,width:i,height:r,colorAttachments:[s]})}var Di=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],Wt={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},xi=["webgl2","blend-minmax-webgl1","texture-renderable-float32-webgl","texture-blend-float-webgl1","texture-formats-float32-webgl1"],D=class{static getAggregationData({aggregationData:t,maxData:o,minData:i,maxMinData:r,pixelIndex:s}){let a=s*Ut,_={};return t&&(_.cellCount=t[a+3],_.cellWeight=t[a]),r?(_.maxCellWieght=r[0],_.minCellWeight=r[3]):(o&&(_.maxCellWieght=o[0],_.totalCount=o[3]),i&&(_.minCellWeight=i[0],_.totalCount=i[3])),_}static getCellData({countsData:t,size:o=1}){let i=t.length/4,r=new Float32Array(i*o),s=new Uint32Array(i);for(let a=0;a<i;a++){for(let _=0;_<o;_++)r[a*o+_]=t[a*4+_];s[a]=t[a*4+3]}return{cellCounts:s,cellWeights:r}}static isSupported(t){return xi.every(o=>t.features.has(o))}constructor(t,o={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=o.id||"gpu-grid-aggregator",this.device=t;let i=["blend-minmax-webgl1","texture-renderable-float32-webgl","texture-formats-float32-webgl1"];this._hasGPUSupport=this.device.info.type==="webgl2"&&i.every(r=>t.features.has(r)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:t,allAggregationModel:o,meanTransform:i}=this,{textures:r,framebuffers:s,maxMinFramebuffers:a,minFramebuffers:_,maxFramebuffers:n,meanTextures:l,resources:R}=this.state;t?.destroy(),o?.destroy(),i?.destroy(),Pi([s,r,a,_,n,l,R])}run(t={}){this.setState({results:{}});let o=this._normalizeAggregationParams(t);return this._hasGPUSupport||K.log.log(1,"GPUGridAggregator: not supported")(),this._runAggregation(o)}getData(t){let o={},i=this.state.results;i[t].aggregationData||(i[t].aggregationData=i[t].aggregationBuffer.getData()),o.aggregationData=i[t].aggregationData;for(let r in Wt){let s=Wt[r];(i[t][r]||i[t][s])&&(i[t][r]=i[t][r]||i[t][s].getData(),o[r]=i[t][r])}return o}updateShaders(t={}){this.setState({shaderOptions:t,modelDirty:!0})}_normalizeAggregationParams(t){let o={...xt,...t},{weights:i}=o;return i&&(o.weights=Bi(i)),o}setState(t){Object.assign(this.state,t)}_getAggregateData(t){let o={},{textures:i,framebuffers:r,maxMinFramebuffers:s,minFramebuffers:a,maxFramebuffers:_,resources:n}=this.state,{weights:l}=t;for(let R in l){o[R]={};let{needMin:T,needMax:c,combineMaxMin:g}=l[R];o[R].aggregationTexture=i[R],o[R].aggregationBuffer=this.device.readPixelsToBufferWebGL(r[R],{target:l[R].aggregationBuffer,sourceType:M.FLOAT}),T&&c&&g?(o[R].maxMinBuffer=this.device.readPixelsToBufferWebGL(s[R],{target:l[R].maxMinBuffer,sourceType:M.FLOAT}),o[R].maxMinTexture=n[`${R}-maxMinTexture`]):(T&&(o[R].minBuffer=this.device.readPixelsToBufferWebGL(a[R],{target:l[R].minBuffer,sourceType:M.FLOAT}),o[R].minTexture=n[`${R}-minTexture`]),c&&(o[R].maxBuffer=this.device.readPixelsToBufferWebGL(_[R],{target:l[R].maxBuffer,sourceType:M.FLOAT}),o[R].maxTexture=n[`${R}-maxTexture`]))}return this._trackGPUResultBuffers(o,l),o}_renderAggregateData(t){let{cellSize:o,projectPoints:i,attributes:r,moduleSettings:s,numCol:a,numRow:_,weights:n,translation:l,scaling:R}=t,{maxMinFramebuffers:T,minFramebuffers:c,maxFramebuffers:g}=this.state,d=[a,_],f={blend:!0,depthTest:!1,blendFunc:[M.ONE,M.ONE]},p={cellSize:o,gridSize:d,projectPoints:i,translation:l,scaling:R};for(let N in n){let{needMin:C,needMax:O}=n[N],I=C&&O&&n[N].combineMaxMin;this._renderToWeightsTexture({id:N,parameters:f,moduleSettings:s,uniforms:p,gridSize:d,attributes:r,weights:n}),I?this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:Bt},gridSize:d,minOrMaxFb:T[N],clearParams:{clearColor:[0,0,0,w]},combineMaxMin:I}):(C&&this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:et},gridSize:d,minOrMaxFb:c[N],clearParams:{clearColor:[w,w,w,0]},combineMaxMin:I}),O&&this._renderToMaxMinTexture({id:N,parameters:{...f,blendEquation:tt},gridSize:d,minOrMaxFb:g[N],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:I}))}}_renderToMaxMinTexture(t){let{id:o,parameters:i,gridSize:r,minOrMaxFb:s,combineMaxMin:a,clearParams:_={}}=t,{framebuffers:n}=this.state,{allAggregationModel:l}=this;this.device.withParametersWebGL({..._,framebuffer:s,viewport:[0,0,r[0],r[1]]},()=>{this.device.clearWebGL({color:!0}),l.setUniforms({gridSize:r,combineMaxMin:a}),l.setBindings({uSampler:n[o].texture}),l.draw()})}_renderToWeightsTexture(t){let{id:o,parameters:i,moduleSettings:r,uniforms:s,gridSize:a,weights:_}=t,{framebuffers:n,equations:l,weightAttributes:R}=this.state,{gridAggregationModel:T}=this,{operation:c}=_[o],g=c===F.MIN?[w,w,w,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:n[o],viewport:[0,0,a[0],a[1]],clearColor:g},()=>{this.device.clearWebGL({color:!0});let d={weights:R[o]};T.draw({parameters:{...i,blendEquation:l[o]},moduleSettings:r,uniforms:s,attributes:d})}),c===F.MEAN){let{meanTextures:d,textures:f}=this.state,p={_sourceTextures:{aggregationValues:d[o]},_targetTexture:f[o],elementCount:f[o].width*f[o].height};this.meanTransform?this.meanTransform.update(p):this.meanTransform=vi(this.device,p),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),n[o].attach({[M.COLOR_ATTACHMENT0]:f[o]})}}_runAggregation(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);let o=this._getAggregateData(t);return this.setState({results:o}),o}_setupFramebuffers(t){let{textures:o,framebuffers:i,maxMinFramebuffers:r,minFramebuffers:s,maxFramebuffers:a,meanTextures:_,equations:n}=this.state,{weights:l}=t,{numCol:R,numRow:T}=t,c={width:R,height:T};for(let g in l){let{needMin:d,needMax:f,combineMaxMin:p,operation:N}=l[g];o[g]=l[g].aggregationTexture||o[g]||te(this.device,{id:`${g}-texture`,width:R,height:T}),o[g].resize(c);let C=o[g];N===F.MEAN&&(_[g]=_[g]||te(this.device,{id:`${g}-mean-texture`,width:R,height:T}),_[g].resize(c),C=_[g]),i[g]?i[g].attach({[M.COLOR_ATTACHMENT0]:C}):i[g]=Ee(this.device,{id:`${g}-fb`,width:R,height:T,texture:C}),i[g].resize(c),n[g]=ot[N]||ot[F.SUM],(d||f)&&(d&&f&&p?r[g]||(C=l[g].maxMinTexture||this._getMinMaxTexture(`${g}-maxMinTexture`),r[g]=Ee(this.device,{id:`${g}-maxMinFb`,texture:C})):(d&&(s[g]||(C=l[g].minTexture||this._getMinMaxTexture(`${g}-minTexture`),s[g]=Ee(this.device,{id:`${g}-minFb`,texture:C}))),f&&(a[g]||(C=l[g].maxTexture||this._getMinMaxTexture(`${g}-maxTexture`),a[g]=Ee(this.device,{id:`${g}-maxFb`,texture:C})))))}}_getMinMaxTexture(t){let{resources:o}=this.state;return o[t]||(o[t]=te(this.device,{id:"resourceName"})),o[t]}_setupModels({numCol:t=0,numRow:o=0}={}){let{shaderOptions:i}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Ui(this.device,i),!this.allAggregationModel){let r=t*o;this.allAggregationModel=ui(this.device,r)}}_setupWeightAttributes(t){let{weightAttributes:o}=this.state,{weights:i}=t;for(let r in i)o[r]=t.attributes[r]}_trackGPUResultBuffers(t,o){let{resources:i}=this.state;for(let r in t)if(t[r]){for(let s of Di)if(t[r][s]&&o[r][s]!==t[r][s]){let a=`gpu-result-${r}-${s}`;i[a]&&i[a].delete(),i[a]=t[r][s]}}}_updateModels(t){let{vertexCount:o,attributes:i,numCol:r,numRow:s}=t,{modelDirty:a}=this.state;a&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(o),this.gridAggregationModel.setAttributes(i),this.allAggregationModel.setInstanceCount(r*s)}};function Bi(e){let t={};for(let o in e)t[o]={...Pt,...e[o]};return t}function Pi(e){e=Array.isArray(e)?e:[e],e.forEach(t=>{for(let o in t)t[o].delete()})}function Ui(e,t){let o=(0,K._mergeShaders)({vs:ut,fs:vt,modules:[G,K.project32]},t);return new Ne.Model(e,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:M.POINTS,shaderAssembler:(0,K.getShaderAssembler)(),...o})}function ui(e,t){return new Ne.Model(e,{id:"All-Aggregation-Model",vs:yt,fs:Ht,modules:[G],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function vi(e,t){return new Ne.TextureTransform(e,{vs:bt,_targetTextureVarying:"meanValues",...t})}var ue=h(q(),1),oe=h(x(),1);var U=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function z(e,t=!1,o=Float32Array){let i;if(Number.isFinite(e[0]))i=new o(e);else{i=new o(e.length*4);let r=0;for(let s=0;s<e.length;s++){let a=e[s];i[r++]=a[0],i[r++]=a[1],i[r++]=a[2],i[r++]=Number.isFinite(a[3])?a[3]:255}}if(t)for(let r=0;r<i.length;r++)i[r]/=255;return i}var Xt=`#version 300 es
|
|
230
|
+
bool isCellValid = bool(aggregationValues.w > 0.);
|
|
231
|
+
meanValues.xyz = isCellValid ? aggregationValues.xyz/aggregationValues.w : vec3(0, 0, 0);
|
|
232
|
+
meanValues.w = aggregationValues.w;
|
|
233
|
+
gl_PointSize = 1.0;
|
|
234
|
+
}
|
|
235
|
+
`;var Mi={minFilter:"nearest",magFilter:"nearest"};function Z(n,t){let{width:e=1,height:o=1,data:i=null,parameters:r=Mi}=t;return n.createTexture({data:i,format:"rgba32float",mipmaps:!1,sampler:r,width:e,height:o})}function xt(n,t){let{id:e,width:o=1,height:i=1,texture:r}=t;return n.createFramebuffer({id:e,width:o,height:i,colorAttachments:[r]})}var Ti=["aggregationBuffer","maxMinBuffer","minBuffer","maxBuffer"],we={maxData:"maxBuffer",minData:"minBuffer",maxMinData:"maxMinBuffer"},Ci=["float32-renderable-webgl","texture-blend-float-webgl"],C=class{static getAggregationData({aggregationData:t,maxData:e,minData:o,maxMinData:i,pixelIndex:r}){let s=r*Pe,a={};return t&&(a.cellCount=t[s+3],a.cellWeight=t[s]),i?(a.maxCellWieght=i[0],a.minCellWeight=i[3]):(e&&(a.maxCellWieght=e[0],a.totalCount=e[3]),o&&(a.minCellWeight=o[0],a.totalCount=o[3])),a}static getCellData({countsData:t,size:e=1}){let o=t.length/4,i=new Float32Array(o*e),r=new Uint32Array(o);for(let s=0;s<o;s++){for(let a=0;a<e;a++)i[s*e+a]=t[s*4+a];r[s]=t[s*4+3]}return{cellCounts:r,cellWeights:i}}static isSupported(t){return Ci.every(e=>t.features.has(e))}constructor(t,e={}){this.state={weightAttributes:{},textures:{},meanTextures:{},buffers:{},framebuffers:{},maxMinFramebuffers:{},minFramebuffers:{},maxFramebuffers:{},equations:{},shaderOptions:{},modelDirty:!1,resources:{},results:{}},this.id=e.id||"gpu-grid-aggregator",this.device=t;let o=["float32-renderable-webgl"];this._hasGPUSupport=o.every(i=>t.features.has(i)),this._hasGPUSupport&&this._setupModels()}delete(){let{gridAggregationModel:t,allAggregationModel:e,meanTransform:o}=this,{textures:i,framebuffers:r,maxMinFramebuffers:s,minFramebuffers:a,maxFramebuffers:l,meanTextures:c,resources:g}=this.state;t?.destroy(),e?.destroy(),o?.destroy(),Pi([r,i,s,a,l,c,g])}run(t={}){this.setState({results:{}});let e=this._normalizeAggregationParams(t);return this._runAggregation(e)}getData(t){let e={},o=this.state.results;o[t].aggregationData||(o[t].aggregationData=o[t].aggregationBuffer.getData()),e.aggregationData=o[t].aggregationData;for(let i in we){let r=we[i];(o[t][i]||o[t][r])&&(o[t][i]=o[t][i]||o[t][r].getData(),e[i]=o[t][i])}return e}updateShaders(t={}){this.setState({shaderOptions:t,modelDirty:!0})}_normalizeAggregationParams(t){let e={...Te,...t},{weights:o}=e;return o&&(e.weights=Ei(o)),e}setState(t){Object.assign(this.state,t)}_getAggregateData(t){let e={},{textures:o,framebuffers:i,maxMinFramebuffers:r,minFramebuffers:s,maxFramebuffers:a,resources:l}=this.state,{weights:c}=t;for(let g in c){e[g]={};let{needMin:f,needMax:d,combineMaxMin:p}=c[g];e[g].aggregationTexture=o[g],e[g].aggregationBuffer=this.device.readPixelsToBufferWebGL(i[g],{target:c[g].aggregationBuffer,sourceType:5126}),f&&d&&p?(e[g].maxMinBuffer=this.device.readPixelsToBufferWebGL(r[g],{target:c[g].maxMinBuffer,sourceType:5126}),e[g].maxMinTexture=l[`${g}-maxMinTexture`]):(f&&(e[g].minBuffer=this.device.readPixelsToBufferWebGL(s[g],{target:c[g].minBuffer,sourceType:5126}),e[g].minTexture=l[`${g}-minTexture`]),d&&(e[g].maxBuffer=this.device.readPixelsToBufferWebGL(a[g],{target:c[g].maxBuffer,sourceType:5126}),e[g].maxTexture=l[`${g}-maxTexture`]))}return this._trackGPUResultBuffers(e,c),e}_renderAggregateData(t){let{cellSize:e,projectPoints:o,attributes:i,moduleSettings:r,numCol:s,numRow:a,weights:l,translation:c,scaling:g}=t,{maxMinFramebuffers:f,minFramebuffers:d,maxFramebuffers:p}=this.state,x=[s,a],h={blend:!0,depthTest:!1,blendFunc:[1,1]},A={cellSize:e,gridSize:x,projectPoints:o,translation:c,scaling:g};for(let S in l){let{needMin:y,needMax:_}=l[S],b=y&&_&&l[S].combineMaxMin;this._renderToWeightsTexture({id:S,parameters:h,moduleSettings:r,uniforms:A,gridSize:x,attributes:i,weights:l}),b?this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Ce},gridSize:x,minOrMaxFb:f[S],clearParams:{clearColor:[0,0,0,W]},combineMaxMin:b}):(y&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:Jt},gridSize:x,minOrMaxFb:d[S],clearParams:{clearColor:[W,W,W,0]},combineMaxMin:b}),_&&this._renderToMaxMinTexture({id:S,parameters:{...h,blendEquation:te},gridSize:x,minOrMaxFb:p[S],clearParams:{clearColor:[0,0,0,0]},combineMaxMin:b}))}}_renderToMaxMinTexture(t){let{id:e,parameters:o,gridSize:i,minOrMaxFb:r,combineMaxMin:s,clearParams:a={}}=t,{framebuffers:l}=this.state,{allAggregationModel:c}=this;this.device.withParametersWebGL({...a,framebuffer:r,viewport:[0,0,i[0],i[1]]},()=>{this.device.clearWebGL({color:!0}),c.setUniforms({gridSize:i,combineMaxMin:s}),c.setBindings({uSampler:l[e].texture}),c.draw()})}_renderToWeightsTexture(t){let{id:e,parameters:o,moduleSettings:i,uniforms:r,gridSize:s,weights:a}=t,{framebuffers:l,equations:c,weightAttributes:g}=this.state,{gridAggregationModel:f}=this,{operation:d}=a[e],p=d===T.MIN?[W,W,W,0]:[0,0,0,0];if(this.device.withParametersWebGL({framebuffer:l[e],viewport:[0,0,s[0],s[1]],clearColor:p},()=>{this.device.clearWebGL({color:!0});let x={weights:g[e]};f.draw({parameters:{...o,blendEquation:c[e]},moduleSettings:i,uniforms:r,attributes:x})}),d===T.MEAN){let{meanTextures:x,textures:h}=this.state,A={_sourceTextures:{aggregationValues:x[e]},_targetTexture:h[e],elementCount:h[e].width*h[e].height};this.meanTransform?this.meanTransform.update(A):this.meanTransform=Oi(this.device,A),this.meanTransform.run({parameters:{blend:!1,depthTest:!1}}),l[e].attach({[36064]:h[e]})}}_runAggregation(t){this._updateModels(t),this._setupFramebuffers(t),this._renderAggregateData(t);let e=this._getAggregateData(t);return this.setState({results:e}),e}_setupFramebuffers(t){let{textures:e,framebuffers:o,maxMinFramebuffers:i,minFramebuffers:r,maxFramebuffers:s,meanTextures:a,equations:l}=this.state,{weights:c}=t,{numCol:g,numRow:f}=t,d={width:g,height:f};for(let p in c){let{needMin:x,needMax:h,combineMaxMin:A,operation:S}=c[p];e[p]=c[p].aggregationTexture||e[p]||Z(this.device,{id:`${p}-texture`,width:g,height:f}),e[p].resize(d);let y=e[p];S===T.MEAN&&(a[p]=a[p]||Z(this.device,{id:`${p}-mean-texture`,width:g,height:f}),a[p].resize(d),y=a[p]),o[p]?o[p].attach({[36064]:y}):o[p]=xt(this.device,{id:`${p}-fb`,width:g,height:f,texture:y}),o[p].resize(d),l[p]=ee[S]||ee[T.SUM],(x||h)&&(x&&h&&A?i[p]||(y=c[p].maxMinTexture||this._getMinMaxTexture(`${p}-maxMinTexture`),i[p]=xt(this.device,{id:`${p}-maxMinFb`,texture:y})):(x&&(r[p]||(y=c[p].minTexture||this._getMinMaxTexture(`${p}-minTexture`),r[p]=xt(this.device,{id:`${p}-minFb`,texture:y}))),h&&(s[p]||(y=c[p].maxTexture||this._getMinMaxTexture(`${p}-maxTexture`),s[p]=xt(this.device,{id:`${p}-maxFb`,texture:y})))))}}_getMinMaxTexture(t){let{resources:e}=this.state;return e[t]||(e[t]=Z(this.device,{id:"resourceName"})),e[t]}_setupModels({numCol:t=0,numRow:e=0}={}){let{shaderOptions:o}=this.state;if(this.gridAggregationModel?.destroy(),this.gridAggregationModel=Ni(this.device,o),!this.allAggregationModel){let i=t*e;this.allAggregationModel=Di(this.device,i)}}_setupWeightAttributes(t){let{weightAttributes:e}=this.state,{weights:o}=t;for(let i in o)e[i]=t.attributes[i]}_trackGPUResultBuffers(t,e){let{resources:o}=this.state;for(let i in t)if(t[i]){for(let r of Ti)if(t[i][r]&&e[i][r]!==t[i][r]){let s=`gpu-result-${i}-${r}`;o[s]&&o[s].delete(),o[s]=t[i][r]}}}_updateModels(t){let{vertexCount:e,attributes:o,numCol:i,numRow:r}=t,{modelDirty:s}=this.state;s&&(this._setupModels(t),this.setState({modelDirty:!1})),this._setupWeightAttributes(t),this.gridAggregationModel.setVertexCount(e),this.gridAggregationModel.setAttributes(o),this.allAggregationModel.setInstanceCount(i*r)}};function Ei(n){let t={};for(let e in n)t[e]={...Ee,...n[e]};return t}function Pi(n){n=Array.isArray(n)?n:[n],n.forEach(t=>{for(let e in t)t[e].delete()})}function Ni(n,t){let e=(0,J._mergeShaders)({vs:Ne,fs:De,modules:[K,J.project32]},t);return new vt.Model(n,{id:"Grid-Aggregation-Model",vertexCount:1,drawMode:0,shaderAssembler:(0,J.getShaderAssembler)(),...e})}function Di(n,t){return new vt.Model(n,{id:"All-Aggregation-Model",vs:Oe,fs:Le,modules:[K],vertexCount:1,topology:"point-list",isInstanced:!0,instanceCount:t,attributes:{position:[0,0]}})}function Oi(n,t){return new vt.TextureTransform(n,{vs:Fe,_targetTextureVarying:"meanValues",...t})}var Ot=M(q(),1),et=M(E(),1);var D=[[255,255,178],[254,217,118],[254,178,76],[253,141,60],[240,59,32],[189,0,38]];function z(n,t=!1,e=Float32Array){let o;if(Number.isFinite(n[0]))o=new e(n);else{o=new e(n.length*4);let i=0;for(let r=0;r<n.length;r++){let s=n[r];o[i++]=s[0],o[i++]=s[1],o[i++]=s[2],o[i++]=Number.isFinite(s[3])?s[3]:255}}if(t)for(let i=0;i<o.length;i++)o[i]/=255;return o}var Ie=`#version 300 es
|
|
310
236
|
#define SHADER_NAME screen-grid-layer-vertex-shader
|
|
311
237
|
#define RANGE_COUNT 6
|
|
312
|
-
|
|
313
238
|
in vec3 positions;
|
|
314
239
|
in vec3 instancePositions;
|
|
315
240
|
in vec4 instanceCounts;
|
|
316
241
|
in vec3 instancePickingColors;
|
|
317
|
-
|
|
318
242
|
uniform float opacity;
|
|
319
243
|
uniform vec3 cellScale;
|
|
320
244
|
uniform vec4 minColor;
|
|
@@ -323,89 +247,69 @@ uniform vec4 colorRange[RANGE_COUNT];
|
|
|
323
247
|
uniform vec2 colorDomain;
|
|
324
248
|
uniform bool shouldUseMinMax;
|
|
325
249
|
uniform sampler2D maxTexture;
|
|
326
|
-
|
|
327
250
|
out vec4 vColor;
|
|
328
251
|
out float vSampleCount;
|
|
329
|
-
|
|
330
252
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
}
|
|
348
|
-
|
|
253
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
254
|
+
if (value >= domain.x && value <= domain.y) {
|
|
255
|
+
float domainRange = domain.y - domain.x;
|
|
256
|
+
if (domainRange <= 0.) {
|
|
257
|
+
outColor = colorRange[0];
|
|
258
|
+
} else {
|
|
259
|
+
float rangeCount = float(RANGE_COUNT);
|
|
260
|
+
float rangeStep = domainRange / rangeCount;
|
|
261
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
262
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
263
|
+
int intIdx = int(idx);
|
|
264
|
+
outColor = colorRange[intIdx];
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
outColor = outColor / 255.;
|
|
268
|
+
return outColor;
|
|
269
|
+
}
|
|
349
270
|
void main(void) {
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
// Set color to be rendered to picking fbo (also used to check for selection highlight).
|
|
368
|
-
picking_setPickingColor(instancePickingColors);
|
|
369
|
-
|
|
370
|
-
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
371
|
-
}
|
|
372
|
-
`;var Vt=`#version 300 es
|
|
271
|
+
vSampleCount = instanceCounts.a;
|
|
272
|
+
float weight = instanceCounts.r;
|
|
273
|
+
float maxWeight = texture(maxTexture, vec2(0.5)).r;
|
|
274
|
+
float step = weight / maxWeight;
|
|
275
|
+
vec4 minMaxColor = mix(minColor, maxColor, step) / 255.;
|
|
276
|
+
vec2 domain = colorDomain;
|
|
277
|
+
float domainMaxValid = float(colorDomain.y != 0.);
|
|
278
|
+
domain.y = mix(maxWeight, colorDomain.y, domainMaxValid);
|
|
279
|
+
vec4 rangeColor = quantizeScale(domain, colorRange, weight);
|
|
280
|
+
float rangeMinMax = float(shouldUseMinMax);
|
|
281
|
+
vec4 color = mix(rangeColor, minMaxColor, rangeMinMax);
|
|
282
|
+
vColor = vec4(color.rgb, color.a * opacity);
|
|
283
|
+
picking_setPickingColor(instancePickingColors);
|
|
284
|
+
gl_Position = vec4(instancePositions + positions * cellScale, 1.);
|
|
285
|
+
}
|
|
286
|
+
`;var Re=`#version 300 es
|
|
373
287
|
#define SHADER_NAME screen-grid-layer-fragment-shader
|
|
374
|
-
|
|
375
288
|
precision highp float;
|
|
376
|
-
|
|
377
289
|
in vec4 vColor;
|
|
378
290
|
in float vSampleCount;
|
|
379
|
-
|
|
380
291
|
out vec4 fragColor;
|
|
381
|
-
|
|
382
292
|
void main(void) {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
}
|
|
390
|
-
`;var yi=[0,0,0,0],Hi=[0,255,0,255],bi=["minColor","maxColor","colorRange","colorDomain"],Wi={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:U},Ue=class extends oe.Layer{static isSupported(t){return t.features.has("texture-formats-float32-webgl1")}getShaders(){return{vs:Xt,fs:Vt,modules:[oe.picking]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t);let{oldProps:o,props:i,changeFlags:r}=t,s=this.getAttributeManager();i.numInstances!==o.numInstances?s.invalidateAll():o.cellSizePixels!==i.cellSizePixels&&s.invalidate("instancePositions"),this._updateUniforms(o,i,r)}draw({uniforms:t}){let{parameters:o,maxTexture:i}=this.props,r=this.props.minColor||yi,s=this.props.maxColor||Hi,a=this.props.colorDomain||[1,0],_=this.state.model;_.setUniforms(t),_.setBindings({maxTexture:i}),_.setUniforms({minColor:r,maxColor:s,colorDomain:a}),_.setParameters({depthWriteEnabled:!1,...o}),_.draw(this.context.renderPass)}calculateInstancePositions(t,{numInstances:o}){let{width:i,height:r}=this.context.viewport,{cellSizePixels:s}=this.props,a=Math.ceil(i/s),{value:_,size:n}=t;for(let l=0;l<o;l++){let R=l%a,T=Math.floor(l/a);_[l*n+0]=R*s/i*2-1,_[l*n+1]=1-T*s/r*2,_[l*n+2]=0}}_getModel(){return new ue.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new ue.Geometry({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:t,maxColor:o,colorDomain:i,colorRange:r}=this.props;return t||o?(oe.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(i||r)}_updateUniforms(t,o,i){let r=this.state.model;if(bi.some(s=>t[s]!==o[s])&&r.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==o.colorRange&&r.setUniforms({colorRange:z(o.colorRange)}),t.cellMarginPixels!==o.cellMarginPixels||t.cellSizePixels!==o.cellSizePixels||i.viewportChanged){let{width:s,height:a}=this.context.viewport,{cellSizePixels:_,cellMarginPixels:n}=this.props,l=_>n?n:0,R=new Float32Array([(_-l)/s*2,-(_-l)/a*2,1]);r.setUniforms({cellScale:R})}}},$=Ue;(()=>{Ue.layerName="ScreenGridCellLayer"})(),(()=>{Ue.defaultProps=Wi})();var io=h(x(),1);var ie=h(x(),1);function wt(e,t){let o={};for(let i in e)t.includes(i)||(o[i]=e[i]);return o}var it=class extends ie.CompositeLayer{initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:wt(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);let{changeFlags:o}=t;if(o.extensionsChanged){let i=this.getShaders({});i&&i.defines&&(i.defines.NON_INSTANCED_MODEL=1),this.updateShaders(i)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:t,mousePosition:o,device:i}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:o,picking:{isActive:0},devicePixelRatio:i.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t,o={}){let{props:i,oldProps:r,changeFlags:s}=t,{compareAll:a=!1,dimension:_}=o,{ignoreProps:n}=this.state,{props:l,accessors:R=[]}=_,{updateTriggersChanged:T}=s;if(s.dataChanged)return!0;if(T){if(T.all)return!0;for(let c of R)if(T[c])return!0}if(a)return s.extensionsChanged?!0:(0,ie._compareProps)({oldProps:r,newProps:i,ignoreProps:n,propTypes:this.constructor._propTypes});for(let c of l)if(i[c]!==r[c])return!0;return!1}isAttributeChanged(t){let{changedAttributes:o}=this.state;return t?o&&o[t]!==void 0:!Xi(o)}_getAttributeManager(){return new ie.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},B=it;(()=>{it.layerName="AggregationLayer"})();function Xi(e){let t=!0;for(let o in e){t=!1;break}return t}var zt=h(x(),1);function ve(e,t,o){let i=o;return i.domain=()=>e,i.range=()=>t,i}function Kt(e,t){return ve(e,t,i=>ji(e,t,i))}function Vi(e,t){return ve(e,t,i=>mi(e,t,i))}function wi(e,t){let o=e.sort(Yt),i=0,r=Math.max(1,t.length),s=new Array(r-1);for(;++i<r;)s[i-1]=Ki(o,i/r);let a=_=>Yi(s,t,_);return a.thresholds=()=>s,ve(e,t,a)}function Yt(e,t){return e-t}function Ki(e,t){let o=e.length;if(t<=0||o<2)return e[0];if(t>=1)return e[o-1];let i=(o-1)*t,r=Math.floor(i),s=e[r],a=e[r+1];return s+(a-s)*(i-r)}function zi(e,t){let o=0,i=e.length;for(;o<i;){let r=o+i>>>1;Yt(e[r],t)>0?i=r:o=r+1}return o}function Yi(e,t,o){return t[zi(e,o)]}function ki(e,t,o,i){let r=`${i}`,s=t.get(r);return s===void 0&&(s=e.push(i),t.set(r,s)),o[(s-1)%o.length]}function Zi(e,t){let o=new Map,i=[];for(let s of e){let a=`${s}`;o.has(a)||o.set(a,i.push(s))}return ve(e,t,s=>ki(i,o,t,s))}function ji(e,t,o){let i=e[1]-e[0];if(i<=0)return zt.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];let r=i/t.length,s=Math.floor((o-e[0])/r),a=Math.max(Math.min(s,t.length-1),0);return t[a]}function mi(e,t,o){return(o-e[0])/(e[1]-e[0])*(t[1]-t[0])+t[0]}function kt(e){return e!=null}function Qi(e){let t=[];return e.forEach(o=>{!t.includes(o)&&kt(o)&&t.push(o)}),t}function Zt(e,t){return(typeof t=="function"?e.map(t):e).filter(kt)}function jt(e,t){return Zt(e,t)}function mt(e,t){return Qi(Zt(e,t))}function Qt(e,t,o){return Math.max(t,Math.min(o,e))}function qt(e){switch(e){case"quantize":return Kt;case"linear":return Vi;case"quantile":return wi;case"ordinal":return Zi;default:return Kt}}var Jt=e=>e.length,qi=3402823466e29,Lt=e=>e.points,Gt=e=>e.index,$t=(e,t)=>e<t?-1:e>t?1:e>=t?0:NaN,$i={getValue:Jt,getPoints:Lt,getIndex:Gt,filterData:null},H=class{constructor(t=[],o=$i){this.aggregatedBins=this.getAggregatedBins(t,o),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,o){let{getValue:i=Jt,getPoints:r=Lt,getIndex:s=Gt,filterData:a}=o,_=typeof a=="function",n=t.length,l=[],R=0;for(let T=0;T<n;T++){let c=t[T],g=r(c),d=s(c),f=_?g.filter(a):g;c.filteredPoints=_?f:null;let p=f.length?i(f):null;p!=null&&(l[R]={i:Number.isFinite(d)?d:T,value:p,counts:f.length},R++)}return l}_percentileToIndex(t){let o=this.sortedBins.length;if(o<2)return[0,0];let[i,r]=t.map(_=>Qt(_,0,100)),s=Math.ceil(i/100*(o-1)),a=Math.floor(r/100*(o-1));return[s,a]}getBinMap(){let t={};for(let o of this.aggregatedBins)t[o.i]=o;return t}_updateMinMaxValues(){let t=0,o=0,i=qi,r=0;for(let s of this.aggregatedBins)t=t>s.counts?t:s.counts,o=o>s.value?o:s.value,i=i<s.value?i:s.value,r+=s.counts;this.maxCount=t,this.maxValue=o,this.minValue=i,this.totalCount=r}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>$t(r.value,s.value))),!this.sortedBins.length)return[];let o=0,i=this.sortedBins.length-1;if(Array.isArray(t)){let r=this._percentileToIndex(t);o=r[0],i=r[1]}return[this.sortedBins[o].value,this.sortedBins[i].value]}getValueDomainByScale(t,[o=0,i=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((s,a)=>$t(s.value,a.value))),!this.sortedBins.length)return[];let r=this._percentileToIndex([o,i]);return this._getScaleDomain(t,r)}_getScaleDomain(t,[o,i]){let r=this.sortedBins;switch(t){case"quantize":case"linear":return[r[o].value,r[i].value];case"quantile":return jt(r.slice(o,i+1),s=>s.value);case"ordinal":return mt(r,s=>s.value);default:return[r[o].value,r[i].value]}}};var oo=h(x(),1);var Y=h(x(),1),to=6378e3;function ye(e){return Number.isFinite(e)?e:0}function He(e,t){let o=e.positions.value,i=1/0,r=-1/0,s=1/0,a=-1/0,_,n;for(let R=0;R<t;R++)n=o[R*3],_=o[R*3+1],i=_<i?_:i,r=_>r?_:r,s=n<s?n:s,a=n>a?n:a;return{xMin:ye(s),xMax:ye(a),yMin:ye(i),yMax:ye(r)}}function Ji(e,t,o,i){let{width:r,height:s}=i,a=o===Y.COORDINATE_SYSTEM.CARTESIAN?[-r/2,-s/2]:[-180,-90];Y.log.assert(o===Y.COORDINATE_SYSTEM.CARTESIAN||o===Y.COORDINATE_SYSTEM.LNGLAT||o===Y.COORDINATE_SYSTEM.DEFAULT);let{xMin:_,yMin:n}=e;return[-1*(eo(_-a[0],t.xOffset)+a[0]),-1*(eo(n-a[1],t.yOffset)+a[1])]}function eo(e,t){let o=e<0?-1:1,i=o<0?Math.abs(e)+t:Math.abs(e);return i=Math.floor(i/t)*t,i*o}function rt(e,t,o=!0){if(!o)return{xOffset:t,yOffset:t};let{yMin:i,yMax:r}=e,s=(i+r)/2;return Li(t,s)}function be(e,t,o,i){let r=rt(e,t,i!==Y.COORDINATE_SYSTEM.CARTESIAN),s=Ji(e,r,i,o),{xMin:a,yMin:_,xMax:n,yMax:l}=e,R=n-a+r.xOffset,T=l-_+r.yOffset,c=Math.ceil(R/r.xOffset),g=Math.ceil(T/r.yOffset);return{gridOffset:r,translation:s,width:R,height:T,numCol:c,numRow:g}}function Li(e,t){let o=Gi(e),i=er(t,e);return{yOffset:o,xOffset:i}}function Gi(e){return e/to*(180/Math.PI)}function er(e,t){return t/to*(180/Math.PI)/Math.cos(e*Math.PI/180)}function re(e,t){let o=tr(e,t),i=or(o);return{gridHash:o.gridHash,gridOffset:o.gridOffset,data:i}}function tr(e,t){let{data:o=[],cellSize:i}=e,{attributes:r,viewport:s,projectPoints:a,numInstances:_}=t,n=r.positions.value,{size:l}=r.positions.getAccessor(),R=t.boundingBox||ir(r.positions,_),T=t.posOffset||[180,90],c=t.gridOffset||rt(R,i);if(c.xOffset<=0||c.yOffset<=0)return{gridHash:{},gridOffset:c,offsets:[0,0]};let{width:g,height:d}=s,f=Math.ceil(g/c.xOffset),p=Math.ceil(d/c.yOffset),N={},{iterable:C,objectInfo:O}=(0,oo.createIterable)(o),I=new Array(3);for(let u of C){O.index++,I[0]=n[O.index*l],I[1]=n[O.index*l+1],I[2]=l>=3?n[O.index*l+2]:0;let[X,fe]=a?s.project(I):I;if(Number.isFinite(X)&&Number.isFinite(fe)){let j=Math.floor((fe+T[1])/c.yOffset),m=Math.floor((X+T[0])/c.xOffset);if(!a||m>=0&&m<f&&j>=0&&j<p){let Q=`${j}-${m}`;N[Q]=N[Q]||{count:0,points:[],lonIdx:m,latIdx:j},N[Q].count+=1,N[Q].points.push({source:u,index:O.index})}}}return{gridHash:N,gridOffset:c,offsets:[T[0]*-1,T[1]*-1]}}function or({gridHash:e,gridOffset:t,offsets:o}){let i=new Array(Object.keys(e).length),r=0;for(let s in e){let a=s.split("-"),_=parseInt(a[0],10),n=parseInt(a[1],10),l=r++;i[l]={index:l,position:[o[0]+t.xOffset*n,o[1]+t.yOffset*_],...e[s]}}return i}function ir(e,t){let o=e.value,{size:i}=e.getAccessor(),r=1/0,s=-1/0,a=1/0,_=-1/0,n,l;for(let R=0;R<t;R++)l=o[R*i],n=o[R*i+1],Number.isFinite(l)&&Number.isFinite(n)&&(r=n<r?n:r,s=n>s?n:s,a=l<a?l:a,_=l>_?l:_);return{xMin:a,xMax:_,yMin:r,yMax:s}}var st=class extends B{initializeAggregationLayer({dimensions:t}){super.initializeAggregationLayer(t),this.setState({layerData:{},gpuGridAggregator:new D(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:re})}updateState(t){super.updateState(t),this.updateAggregationState(t);let{aggregationDataDirty:o,aggregationWeightsDirty:i,gpuAggregation:r}=this.state;if(this.getNumInstances()<=0)return;let s=!1;(o||r&&i)&&(this._updateAggregation(t),s=!0),!r&&(o||i)&&(this._updateWeightBins(),this._uploadAggregationResults(),s=!0),this.setState({aggregationDirty:s})}finalizeState(t){let{count:o}=this.state.weights;o&&o.aggregationBuffer&&o.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(t)}updateShaders(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}updateAggregationState(t){io.log.assert(!1)}allocateResources(t,o){if(this.state.numRow!==t||this.state.numCol!==o){let i=o*t*4*4,{weights:r}=this.state;for(let s in r){let a=r[s];a.aggregationBuffer&&a.aggregationBuffer.delete(),a.aggregationBuffer=this.context.device.createBuffer({byteLength:i,accessor:{size:4,type:M.FLOAT,divisor:1}})}}}updateResults({aggregationData:t,maxMinData:o,maxData:i,minData:r}){let{count:s}=this.state.weights;s&&(s.aggregationData=t,s.maxMinData=o,s.maxData=i,s.minData=r)}_updateAggregation(t){let{cpuGridAggregator:o,gpuGridAggregator:i,gridOffset:r,posOffset:s,translation:a=[0,0],scaling:_=[0,0,0],boundingBox:n,projectPoints:l,gpuAggregation:R,numCol:T,numRow:c}=this.state,{props:g}=t,{viewport:d}=this.context,f=this.getAttributes(),p=this.getNumInstances();if(R){let{weights:N}=this.state;i.run({weights:N,cellSize:[r.xOffset,r.yOffset],numCol:T,numRow:c,translation:a,scaling:_,vertexCount:p,projectPoints:l,attributes:f,moduleSettings:this.getModuleSettings()})}else{let N=o(g,{gridOffset:r,projectPoints:l,attributes:f,viewport:d,posOffset:s,boundingBox:n});this.setState({layerData:N})}}_updateWeightBins(){let{getValue:t}=this.state,o=new H(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:o})}_uploadAggregationResults(){let{numCol:t,numRow:o}=this.state,{data:i}=this.state.layerData,{aggregatedBins:r,minValue:s,maxValue:a,totalCount:_}=this.state.sortedBins,n=4,l=t*o*n,R=new Float32Array(l).fill(0);for(let d of r){let{lonIdx:f,latIdx:p}=i[d.i],{value:N,counts:C}=d,O=(f+p*t)*n;R[O]=N,R[O+n-1]=C}let T=new Float32Array([a,0,0,s]),c=new Float32Array([a,0,0,_]),g=new Float32Array([s,0,0,_]);this.updateResults({aggregationData:R,maxMinData:T,maxData:c,minData:g})}},b=st;(()=>{st.layerName="GridAggregationLayer"})();var rr={...$.defaultProps,getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},ro="positions",sr={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},We=class extends b{initializeState(){if(!$.isSupported(this.context.device)){this.setState({supported:!1}),at.log.error(`ScreenGridLayer: ${this.id} is not supported on this browser`)();return}super.initializeAggregationLayer({dimensions:sr,getCellSize:i=>i.cellSizePixels});let t={count:{size:1,operation:F.SUM,needMax:!0,maxTexture:te(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:t,subLayerData:{attributes:{}},maxTexture:t.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[ro]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:t}){return this.state.supported&&t.somethingChanged}updateState(t){super.updateState(t)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:t,numRow:o,numCol:i,weights:r}=this.state,{updateTriggers:s}=this.props,{aggregationBuffer:a}=r.count,_=this.getSubLayerClass("cells",$);return new _(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:s}),{data:{attributes:{instanceCounts:a}},maxTexture:t,numInstances:o*i})}finalizeState(t){super.finalizeState(t);let{aggregationBuffer:o,maxBuffer:i,maxTexture:r}=this.state;o?.delete(),i?.delete(),r?.delete()}getPickingInfo({info:t}){let{index:o}=t;if(o>=0){let{gpuGridAggregator:i,gpuAggregation:r,weights:s}=this.state,a=r?i.getData("count"):s.count;t.object=D.getAggregationData({pixelIndex:o,...a})}return t}updateResults({aggregationData:t,maxData:o}){let{count:i}=this.state.weights;i.aggregationData=t,i.aggregationBuffer.write(t),i.maxData=o,i.maxTexture.setImageData({data:o})}updateAggregationState(t){let o=t.props.cellSizePixels,i=t.oldProps.cellSizePixels!==o,{viewportChanged:r}=t.changeFlags,s=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&s&&!D.isSupported(this.context.device)&&(at.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),s=!1);let a=s!==this.state.gpuAggregation;this.setState({gpuAggregation:s});let _=this.isAttributeChanged(ro),{dimensions:n}=this.state,{data:l,weights:R}=n,T=_||a||r||this.isAggregationDirty(t,{compareAll:s,dimension:l}),c=this.isAggregationDirty(t,{dimension:R});this.setState({aggregationDataDirty:T,aggregationWeightsDirty:c});let{viewport:g}=this.context;if(r||i){let{width:d,height:f}=g,p=Math.ceil(d/o),N=Math.ceil(f/o);this.allocateResources(N,p),this.setState({scaling:[d/2,-f/2,1],gridOffset:{xOffset:o,yOffset:o},width:d,height:f,numCol:p,numRow:N})}c&&this._updateAccessors(t),(T||c)&&this._resetResults()}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}},pe=We;(()=>{We.layerName="ScreenGridLayer"})(),(()=>{We.defaultProps=rr})();var lo=h(L(),1);function so(){}var ao=["getBins","getDomain","getScaleFunc"],_o=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],ar=e=>e.cellSize,W=class{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||ar,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||_o)}static defaultDimensions(){return _o}updateState(t,o){let{oldProps:i,props:r,changeFlags:s}=t;this.updateGetValueFuncs(i,r,s);let a=this.needsReProjectPoints(i,r,s),_=!1;return s.dataChanged||a?(this.getAggregatedData(r,o),_=!0):((this.getDimensionChanges(i,r,s)||[]).forEach(l=>typeof l=="function"&&l()),_=!0),this.setState({aggregationDirty:_}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,o){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...o}}})}normalizeResult(t={}){return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,o){let r=this._getAggregator(t)(t,o);this.setState({layerData:this.normalizeResult(r)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,o,i){for(let r in this.dimensionUpdaters){let{value:s,weight:a,aggregation:_}=this.dimensionUpdaters[r].getBins.triggers,n=o[s.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[r].getBins,t,o,i)&&(n?n=Dt(n,{data:o.data}):n=ee(o[_.prop],o[a.prop],{data:o.data})),n&&this.setDimensionState(r,{getValue:n})}}needsReProjectPoints(t,o,i){return this._getCellSize(t)!==this._getCellSize(o)||this._getAggregator(t)!==this._getAggregator(o)||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(t=[]){t.forEach(o=>{let{key:i}=o;this.dimensionUpdaters[i]=this.getDimensionUpdaters(o),this.state.dimensions[i]={getValue:null,domain:null,sortedBins:null,scaleFunc:so}})}getDimensionUpdaters({key:t,accessor:o,pickingInfo:i,getBins:r,getDomain:s,getScaleFunc:a,nullValue:_}){return{key:t,accessor:o,pickingInfo:i,getBins:{updater:this.getDimensionSortedBins.bind(this),...r},getDomain:{updater:this.getDimensionValueDomain.bind(this),...s},getScaleFunc:{updater:this.getDimensionScale.bind(this),...a},attributeAccessor:this.getSubLayerDimensionAttribute(t,_)}}needUpdateDimensionStep(t,o,i,r){return Object.values(t.triggers).some(s=>s.updateTrigger?r.dataChanged||r.updateTriggersChanged&&(r.updateTriggersChanged.all||r.updateTriggersChanged[s.updateTrigger]):o[s.prop]!==i[s.prop])}getDimensionChanges(t,o,i){let r=[];for(let s in this.dimensionUpdaters){let a=ao.find(_=>this.needUpdateDimensionStep(this.dimensionUpdaters[s][_],t,o,i));a&&r.push(this.dimensionUpdaters[s][a].updater.bind(this,o,this.dimensionUpdaters[s]))}return r.length?r:null}getUpdateTriggers(t){let o=t.updateTriggers||{},i={};for(let r in this.dimensionUpdaters){let{accessor:s}=this.dimensionUpdaters[r];i[s]={},ao.forEach(a=>{Object.values(this.dimensionUpdaters[r][a].triggers).forEach(({prop:_,updateTrigger:n})=>{if(n){let l=o[n];typeof l=="object"&&!Array.isArray(l)?Object.assign(i[s],l):l!==void 0&&(i[s][_]=l)}else i[s][_]=t[_]})})}return i}getSortedBins(t){for(let o in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[o])}getDimensionSortedBins(t,o){let{key:i}=o,{getValue:r}=this.state.dimensions[i],s=new H(this.state.layerData.data||[],{getValue:r,filterData:t._filterData});this.setDimensionState(i,{sortedBins:s}),this.getDimensionValueDomain(t,o)}getDimensionValueDomain(t,o){let{getDomain:i,key:r}=o,{triggers:{lowerPercentile:s,upperPercentile:a,scaleType:_}}=i,n=this.state.dimensions[r].sortedBins.getValueDomainByScale(t[_.prop],[t[s.prop],t[a.prop]]);this.setDimensionState(r,{valueDomain:n}),this.getDimensionScale(t,o)}getDimensionScale(t,o){let{key:i,getScaleFunc:r,getDomain:s}=o,{domain:a,range:_}=r.triggers,{scaleType:n}=s.triggers,{onSet:l}=r,R=t[_.prop],T=t[a.prop]||this.state.dimensions[i].valueDomain,g=qt(n&&t[n.prop])(T,R);typeof l=="object"&&typeof t[l.props]=="function"&&t[l.props](g.domain()),this.setDimensionState(i,{scaleFunc:g})}getSubLayerDimensionAttribute(t,o){return i=>{let{sortedBins:r,scaleFunc:s}=this.state.dimensions[t],a=r.binMap[i.index];if(a&&a.counts===0)return o;let _=a&&a.value,n=s.domain();return _>=n[0]&&_<=n[n.length-1]?s(_):o}}getSubLayerAccessors(t){let o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]=this.getSubLayerDimensionAttribute(t,i)}return o}getPickingInfo({info:t}){let o=t.picked&&t.index>-1,i=null;if(o){let r=this.state.layerData.data[t.index],s={};for(let a in this.dimensionUpdaters){let{pickingInfo:_}=this.dimensionUpdaters[a],{sortedBins:n}=this.state.dimensions[a],l=n.binMap[r.index]&&n.binMap[r.index].value;s[_]=l}i=Object.assign(s,r,{points:r.filteredPoints||r.points})}return t.picked=Boolean(i),t.object=i,t}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:so}};function no(){}var _r={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:no,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:no,gridAggregator:re,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:e=>e.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Xe=class extends B{initializeState(){let t=new W({getAggregator:i=>i.gridAggregator,getCellSize:i=>i.cellSize});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){super.updateState(t),this.setState({aggregatorState:this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,cellSize:i,coverage:r,material:s,transitions:a}=this.props,{cpuAggregator:_}=this.state,n=this.getSubLayerClass("grid-cell",lo.GridCellLayer),l=this._getSublayerUpdateTriggers();return new n({cellSize:i,coverage:r,material:s,elevationScale:t,extruded:o,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:a&&{getFillColor:a.getColorValue||a.getColorWeight,getElevation:a.getElevationValue||a.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:l}),{data:_.state.layerData.data})}},k=Xe;(()=>{Xe.layerName="CPUGridLayer"})(),(()=>{Xe.defaultProps=_r})();var To=h(x(),1),co=h(L(),1);var se=Math.PI/3,nr=[0,se,2*se,3*se,4*se,5*se];function lr(e){return e[0]}function Ar(e){return e[1]}function _t(){var e=0,t=0,o=1,i=1,r=lr,s=Ar,a,_,n;function l(T){var c={},g=[],d,f=T.length;for(d=0;d<f;++d)if(!(isNaN(N=+r.call(null,p=T[d],d,T))||isNaN(C=+s.call(null,p,d,T)))){var p,N,C,O=Math.round(C=C/n),I=Math.round(N=N/_-(O&1)/2),u=C-O;if(Math.abs(u)*3>1){var X=N-I,fe=I+(N<I?-1:1)/2,j=O+(C<O?-1:1),m=N-fe,Q=C-j;X*X+u*u>m*m+Q*Q&&(I=fe+(O&1?1:-1)/2,O=j)}var dt=I+"-"+O,de=c[dt];de?de.push(p):(g.push(de=c[dt]=[p]),de.x=(I+(O&1)/2)*_,de.y=O*n)}return g}function R(T){var c=0,g=0;return nr.map(function(d){var f=Math.sin(d)*T,p=-Math.cos(d)*T,N=f-c,C=p-g;return c=f,g=p,[N,C]})}return l.hexagon=function(T){return"m"+R(T==null?a:+T).join("l")+"z"},l.centers=function(){for(var T=[],c=Math.round(t/n),g=Math.round(e/_),d=c*n;d<i+a;d+=n,++c)for(var f=g*_+(c&1)*_/2;f<o+_/2;f+=_)T.push([f,d]);return T},l.mesh=function(){var T=R(a).slice(0,4).join("l");return l.centers().map(function(c){return"M"+c+"m"+T}).join("")},l.x=function(T){return arguments.length?(r=T,l):r},l.y=function(T){return arguments.length?(s=T,l):s},l.radius=function(T){return arguments.length?(a=+T,_=a*2*Math.sin(se),n=a*1.5,l):a},l.size=function(T){return arguments.length?(e=t=0,o=+T[0],i=+T[1],l):[o-e,i-t]},l.extent=function(T){return arguments.length?(e=+T[0][0],t=+T[0][1],o=+T[1][0],i=+T[1][1],l):[[e,t],[o,i]]},l.radius(1)}var Ve=h(x(),1);function Ao(e,t){let{data:o,radius:i}=e,{viewport:r,attributes:s}=t,a=o.length?Rr(o,t):null,_=Tr(i,r,a),n=[],{iterable:l,objectInfo:R}=(0,Ve.createIterable)(o),T=s.positions.value,{size:c}=s.positions.getAccessor();for(let f of l){R.index++;let p=R.index*c,N=[T[p],T[p+1]];Number.isFinite(N[0])&&Number.isFinite(N[1])?n.push({screenCoord:r.projectFlat(N),source:f,index:R.index}):Ve.log.warn("HexagonLayer: invalid position")()}return{hexagons:_t().radius(_).x(f=>f.screenCoord[0]).y(f=>f.screenCoord[1])(n).map((f,p)=>({position:r.unprojectFlat([f.x,f.y]),points:f,index:p})),radiusCommon:_}}function Rr(e,t){let{attributes:o}=t,i=o.positions.value,{size:r}=o.positions.getAccessor(),s=1/0,a=1/0,_=-1/0,n=-1/0,l;for(l=0;l<r*e.length;l+=r){let R=i[l],T=i[l+1];Number.isFinite(R)&&Number.isFinite(T)&&(s=Math.min(R,s),_=Math.max(R,_),a=Math.min(T,a),n=Math.max(T,n))}return[s,a,_,n].every(Number.isFinite)?[(s+_)/2,(a+n)/2]:null}function Tr(e,t,o){let{unitsPerMeter:i}=t.getDistanceScales(o);return e*i[0]}function Ro(){}var cr={colorDomain:null,colorRange:U,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:Ro,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:Ro,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:Ao,getPosition:{type:"accessor",value:e=>e.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},we=class extends B{initializeState(){let t=new W({getAggregator:i=>i.hexagonAggregator,getCellSize:i=>i.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:M.DOUBLE,accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){let o=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==o.layerData){let{hexagonVertices:i}=o.layerData||{};this.setState({vertices:i&&this.convertLatLngToMeterOffset(i)})}this.setState({aggregatorState:o})}}convertLatLngToMeterOffset(t){let{viewport:o}=this.context;if(Array.isArray(t)&&t.length===6){let i=t[0],r=t[3],s=[(i[0]+r[0])/2,(i[1]+r[1])/2],a=o.projectFlat(s),{metersPerUnit:_}=o.getDistanceScales(s);return t.map(l=>{let R=o.projectFlat(l);return[(R[0]-a[0])*_[0],(R[1]-a[1])*_[1]]})}return To.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:o,coverage:i,material:r,transitions:s}=this.props,{aggregatorState:a,vertices:_}=this.state,n=this.getSubLayerClass("hexagon-cell",co.ColumnLayer),l=this._getSublayerUpdateTriggers(),R=_?{vertices:_,radius:1}:{radius:a.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new n({...R,diskResolution:6,elevationScale:t,extruded:o,coverage:i,material:r,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:l}),{data:a.layerData.data})}},Ce=we;(()=>{we.layerName="HexagonLayer"})(),(()=>{we.defaultProps=cr})();var je=h(L(),1);var wo=h(x(),1);var E=.16666666666666666,A={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},ae=[A.W,A.SW,A.S],_e=[A.S,A.SE,A.E],ne=[A.E,A.NE,A.N],le=[A.NW,A.W,A.N],Ae=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5]],Re=[[-E,-.5],[E,-.5],[.5,-E],[.5,E]],Te=[[.5,-E],[.5,E],[E,.5],[-E,.5]],ce=[[-.5,E],[-.5,-E],[E,.5],[-E,.5]],go=[A.W,A.SW,A.SE,A.E],So=[A.S,A.SE,A.NE,A.N],fo=[A.NW,A.W,A.E,A.NE],Eo=[A.NW,A.SW,A.S,A.N],No=[[-.5,E],[-.5,-E],[.5,-E],[.5,E]],po=[[-E,-.5],[E,-.5],[E,.5],[-E,.5]],gr=[A.NW,A.SW,A.SE,A.NE],Co=[A.NW,A.SW,A.SE,A.E,A.N],Mo=[A.W,A.SW,A.SE,A.NE,A.N],Oo=[A.NW,A.W,A.S,A.SE,A.NE],Io=[A.NW,A.SW,A.S,A.E,A.NE],ho=[A.NW,A.W,[.5,-E],[.5,E],A.N],Fo=[[-E,-.5],[E,-.5],A.E,A.NE,A.N],Do=[[-.5,E],[-.5,-E],A.S,A.SE,A.E],xo=[A.W,A.SW,A.S,[E,.5],[-E,.5]],Bo=[A.NW,A.W,[-E,-.5],[E,-.5],A.N],Po=[[-.5,E],[-.5,-E],A.E,A.NE,A.N],Uo=[A.S,A.SE,A.E,[E,.5],[-E,.5]],uo=[A.W,A.SW,A.S,[.5,-E],[.5,E]],vo=[A.W,A.SW,A.SE,A.E,[E,.5],[-E,.5]],yo=[[-.5,E],[-.5,-E],A.S,A.SE,A.NE,A.N],Ho=[A.NW,A.W,[-E,-.5],[E,-.5],A.E,A.NE],bo=[A.NW,A.SW,A.S,[.5,-E],[.5,E],A.N],ge=[A.W,A.SW,A.S,A.E,A.NE,A.N],Se=[A.NW,A.W,A.S,A.SE,A.E,A.N],Ke=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],A.E,A.NE,A.N],ze=[A.W,A.SW,A.S,[.5,-E],[.5,E],[E,.5],[-E,.5]],Ye=[A.NW,A.W,[-E,-.5],[E,-.5],[.5,-E],[.5,E],A.N],ke=[[-.5,E],[-.5,-E],A.S,A.SE,A.E,[E,.5],[-E,.5]],Wo=[[-.5,E],[-.5,-E],[-E,-.5],[E,-.5],[.5,-E],[.5,E],[E,.5],[-E,.5]],Xo={0:[],1:[[A.W,A.S]],2:[[A.S,A.E]],3:[[A.W,A.E]],4:[[A.N,A.E]],5:{0:[[A.W,A.S],[A.N,A.E]],1:[[A.W,A.N],[A.S,A.E]]},6:[[A.N,A.S]],7:[[A.W,A.N]],8:[[A.W,A.N]],9:[[A.N,A.S]],10:{0:[[A.W,A.N],[A.S,A.E]],1:[[A.W,A.S],[A.N,A.E]]},11:[[A.N,A.E]],12:[[A.W,A.E]],13:[[A.S,A.E]],14:[[A.W,A.S]],15:[]};function S(e){return parseInt(e,4)}var Vo={[S("0000")]:[],[S("2222")]:[],[S("2221")]:[ae],[S("2212")]:[_e],[S("2122")]:[ne],[S("1222")]:[le],[S("0001")]:[ae],[S("0010")]:[_e],[S("0100")]:[ne],[S("1000")]:[le],[S("2220")]:[Ae],[S("2202")]:[Re],[S("2022")]:[Te],[S("0222")]:[ce],[S("0002")]:[Ae],[S("0020")]:[Re],[S("0200")]:[Te],[S("2000")]:[ce],[S("0011")]:[go],[S("0110")]:[So],[S("1100")]:[fo],[S("1001")]:[Eo],[S("2211")]:[go],[S("2112")]:[So],[S("1122")]:[fo],[S("1221")]:[Eo],[S("2200")]:[No],[S("2002")]:[po],[S("0022")]:[No],[S("0220")]:[po],[S("1111")]:[gr],[S("1211")]:[Co],[S("2111")]:[Mo],[S("1112")]:[Oo],[S("1121")]:[Io],[S("1011")]:[Co],[S("0111")]:[Mo],[S("1110")]:[Oo],[S("1101")]:[Io],[S("1200")]:[ho],[S("0120")]:[Fo],[S("0012")]:[Do],[S("2001")]:[xo],[S("1022")]:[ho],[S("2102")]:[Fo],[S("2210")]:[Do],[S("0221")]:[xo],[S("1002")]:[Bo],[S("2100")]:[Po],[S("0210")]:[Uo],[S("0021")]:[uo],[S("1220")]:[Bo],[S("0122")]:[Po],[S("2012")]:[Uo],[S("2201")]:[uo],[S("0211")]:[vo],[S("2110")]:[yo],[S("1102")]:[Ho],[S("1021")]:[bo],[S("2011")]:[vo],[S("0112")]:[yo],[S("1120")]:[Ho],[S("1201")]:[bo],[S("2101")]:[ge],[S("0121")]:[ge],[S("1012")]:[Se],[S("1210")]:[Se],[S("0101")]:{0:[ae,ne],1:[ge],2:[ge]},[S("1010")]:{0:[le,_e],1:[Se],2:[Se]},[S("2121")]:{0:[ge],1:[ge],2:[ae,ne]},[S("1212")]:{0:[Se],1:[Se],2:[le,_e]},[S("2120")]:{0:[Ke],1:[Ke],2:[Ae,ne]},[S("2021")]:{0:[ze],1:[ze],2:[ae,Te]},[S("1202")]:{0:[Ye],1:[Ye],2:[le,Re]},[S("0212")]:{0:[ke],1:[ke],2:[_e,ce]},[S("0102")]:{0:[Ae,ne],1:[Ke],2:[Ke]},[S("0201")]:{0:[ae,Te],1:[ze],2:[ze]},[S("1020")]:{0:[le,Re],1:[Ye],2:[Ye]},[S("2010")]:{0:[_e,ce],1:[ke],2:[ke]},[S("2020")]:{0:[ce,Re],1:[Wo],2:[Ae,Te]},[S("0202")]:{0:[Te,Ae],1:[Wo],2:[ce,Re]}};var J={ISO_LINES:1,ISO_BANDS:2},Sr={zIndex:0,zOffset:.005};function Me(e,t){return Array.isArray(t)?e<t[0]?0:e<t[1]?1:2:e>=t?1:0}function Ko(e){let{cellWeights:t,x:o,y:i,width:r,height:s}=e,a=e.threshold;e.thresholdValue&&(wo.log.deprecated("thresholdValue","threshold")(),a=e.thresholdValue);let _=o<0,n=o>=r-1,l=i<0,R=i>=s-1,T=_||n||l||R,c={},g={};_||R?g.top=0:(c.top=t[(i+1)*r+o],g.top=Me(c.top,a)),n||R?g.topRight=0:(c.topRight=t[(i+1)*r+o+1],g.topRight=Me(c.topRight,a)),n||l?g.right=0:(c.right=t[i*r+o+1],g.right=Me(c.right,a)),_||l?g.current=0:(c.current=t[i*r+o],g.current=Me(c.current,a));let{top:d,topRight:f,right:p,current:N}=g,C=-1;Number.isFinite(a)&&(C=d<<3|f<<2|p<<1|N),Array.isArray(a)&&(C=d<<6|f<<4|p<<2|N);let O=0;return T||(O=Me((c.top+c.topRight+c.right+c.current)/4,a)),{code:C,meanCode:O}}function nt(e){let{gridOrigin:t,cellSize:o,x:i,y:r,code:s,meanCode:a,type:_=J.ISO_LINES}=e,n={...Sr,...e.thresholdData},l=_===J.ISO_BANDS?Vo[s]:Xo[s];Array.isArray(l)||(l=l[a]);let R=n.zIndex*n.zOffset,T=(i+1)*o[0],c=(r+1)*o[1],g=t[0]+T,d=t[1]+c;if(_===J.ISO_BANDS){let p=[];return l.forEach(N=>{let C=[];N.forEach(O=>{let I=g+O[0]*o[0],u=d+O[1]*o[1];C.push([I,u,R])}),p.push(C)}),p}let f=[];return l.forEach(p=>{p.forEach(N=>{let C=g+N[0]*o[0],O=d+N[1]*o[1];f.push([C,O,R])})}),f}function zo({thresholdData:e,cellWeights:t,gridSize:o,gridOrigin:i,cellSize:r}){let s=[],a=[],_=o[0],n=o[1],l=0,R=0;for(let T of e){let{contour:c}=T,{threshold:g}=c;for(let d=-1;d<_;d++)for(let f=-1;f<n;f++){let{code:p,meanCode:N}=Ko({cellWeights:t,threshold:g,x:d,y:f,width:_,height:n}),C={type:J.ISO_BANDS,gridOrigin:i,cellSize:r,x:d,y:f,width:_,height:n,code:p,meanCode:N,thresholdData:T};if(Array.isArray(g)){C.type=J.ISO_BANDS;let O=nt(C);for(let I of O)a[R++]={vertices:I,contour:c}}else{C.type=J.ISO_LINES;let O=nt(C);for(let I=0;I<O.length;I+=2)s[l++]={start:O[I],end:O[I+1],contour:c}}}}return{contourSegments:s,contourPolygons:a}}var Zo=h(x(),1);var Yo=[255,255,255,255],fr=1,dr=1,Er={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:e=>e.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:dr}],optional:!0,compare:3},zOffset:.005},ko="positions",Nr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Ze=class extends b{initializeState(){super.initializeAggregationLayer({dimensions:Nr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:F.SUM}}}),this.getAttributeManager().add({[ko]:{size:3,accessor:"getPosition",type:M.DOUBLE,fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(t){super.updateState(t);let o=!1,{oldProps:i,props:r}=t,{aggregationDirty:s}=this.state;(i.contours!==r.contours||i.zOffset!==r.zOffset)&&(o=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(s||o)&&this._generateContours()}renderLayers(){let{contourSegments:t,contourPolygons:o}=this.state.contourData,i=this.getSubLayerClass("lines",je.LineLayer),r=this.getSubLayerClass("bands",je.SolidPolygonLayer),s=t&&t.length>0&&new i(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:_=>_.start,getTargetPosition:_=>_.end,getColor:_=>_.contour.color||Yo,getWidth:_=>_.contour.strokeWidth||fr}),a=o&&o.length>0&&new r(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:_=>_.vertices,getFillColor:_=>_.contour.color||Yo});return[s,a]}updateAggregationState(t){let{props:o,oldProps:i}=t,{cellSize:r,coordinateSystem:s}=o,{viewport:a}=this.context,_=i.cellSize!==r,n=o.gpuAggregation;this.state.gpuAggregation!==o.gpuAggregation&&n&&!D.isSupported(this.context.device)&&(Zo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),n=!1);let l=n!==this.state.gpuAggregation;this.setState({gpuAggregation:n});let{dimensions:R}=this.state,T=this.isAttributeChanged(ko),{data:c,weights:g}=R,{boundingBox:d}=this.state;if(T&&(d=He(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:d})),T||_){let{gridOffset:N,translation:C,width:O,height:I,numCol:u,numRow:X}=be(d,r,a,s);this.allocateResources(X,u),this.setState({gridOffset:N,boundingBox:d,translation:C,posOffset:C.slice(),gridOrigin:[-1*C[0],-1*C[1]],width:O,height:I,numCol:u,numRow:X})}let f=T||l||this.isAggregationDirty(t,{dimension:c,compareAll:n}),p=this.isAggregationDirty(t,{dimension:g});p&&this._updateAccessors(t),(f||p)&&this._resetResults(),this.setState({aggregationDataDirty:f,aggregationWeightsDirty:p})}_updateAccessors(t){let{getWeight:o,aggregation:i,data:r}=t.props,{count:s}=this.state.weights;s&&(s.getWeight=o,s.operation=F[i]),this.setState({getValue:ee(i,o,{data:r})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}_generateContours(){let{numCol:t,numRow:o,gridOrigin:i,gridOffset:r,thresholdData:s}=this.state,{count:a}=this.state.weights,{aggregationData:_}=a;_||(_=a.aggregationBuffer.readSyncWebGL2(),a.aggregationData=_);let{cellWeights:n}=D.getCellData({countsData:_}),l=zo({thresholdData:s,cellWeights:n,gridSize:[t,o],gridOrigin:i,cellSize:[r.xOffset,r.yOffset]});this.setState({contourData:l})}_updateThresholdData(t){let{contours:o,zOffset:i}=t,r=o.length,s=new Array(r);for(let a=0;a<r;a++){let _=o[a];s[a]={contour:_,zIndex:_.zIndex||a,zOffset:i}}this.setState({thresholdData:s})}},Oe=Ze;(()=>{Ze.layerName="ContourLayer"})(),(()=>{Ze.defaultProps=Er})();var Lo=h(x(),1);var Jo=h(x(),1);var P=h(x(),1),Qo=h(q(),1);var qo=h(q(),1);var jo=`#version 300 es
|
|
293
|
+
if (vSampleCount <= 0.0) {
|
|
294
|
+
discard;
|
|
295
|
+
}
|
|
296
|
+
fragColor = vColor;
|
|
297
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
298
|
+
}
|
|
299
|
+
`;var Li=[0,0,0,0],Fi=[0,255,0,255],wi=["minColor","maxColor","colorRange","colorDomain"],Ii={cellSizePixels:{type:"number",value:100,min:1},cellMarginPixels:{type:"number",value:2,min:0,max:5},colorDomain:null,colorRange:D},Dt=class extends et.Layer{getShaders(){return{vs:Ie,fs:Re,modules:[et.picking]}}initializeState(){this.getAttributeManager().addInstanced({instancePositions:{size:3,update:this.calculateInstancePositions},instanceCounts:{size:4,noAlloc:!0}}),this.setState({model:this._getModel()})}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t);let{oldProps:e,props:o,changeFlags:i}=t,r=this.getAttributeManager();o.numInstances!==e.numInstances?r.invalidateAll():e.cellSizePixels!==o.cellSizePixels&&r.invalidate("instancePositions"),this._updateUniforms(e,o,i)}draw({uniforms:t}){let{parameters:e,maxTexture:o}=this.props,i=this.props.minColor||Li,r=this.props.maxColor||Fi,s=this.props.colorDomain||[1,0],a=this.state.model;a.setUniforms(t),a.setBindings({maxTexture:o}),a.setUniforms({minColor:i,maxColor:r,colorDomain:s}),a.setParameters({depthWriteEnabled:!1,...e}),a.draw(this.context.renderPass)}calculateInstancePositions(t,{numInstances:e}){let{width:o,height:i}=this.context.viewport,{cellSizePixels:r}=this.props,s=Math.ceil(o/r),{value:a,size:l}=t;for(let c=0;c<e;c++){let g=c%s,f=Math.floor(c/s);a[c*l+0]=g*r/o*2-1,a[c*l+1]=1-f*r/i*2,a[c*l+2]=0}}_getModel(){return new Ot.Model(this.context.device,{...this.getShaders(),id:this.props.id,bufferLayout:this.getAttributeManager().getBufferLayouts(),geometry:new Ot.Geometry({topology:"triangle-list",attributes:{positions:new Float32Array([0,0,0,1,0,0,1,1,0,0,0,0,1,1,0,0,1,0])}})})}_shouldUseMinMax(){let{minColor:t,maxColor:e,colorDomain:o,colorRange:i}=this.props;return t||e?(et.log.deprecated("ScreenGridLayer props: minColor and maxColor","colorRange, colorDomain")(),!0):!(o||i)}_updateUniforms(t,e,o){let i=this.state.model;if(wi.some(r=>t[r]!==e[r])&&i.setUniforms({shouldUseMinMax:this._shouldUseMinMax()}),t.colorRange!==e.colorRange&&i.setUniforms({colorRange:z(e.colorRange)}),t.cellMarginPixels!==e.cellMarginPixels||t.cellSizePixels!==e.cellSizePixels||o.viewportChanged){let{width:r,height:s}=this.context.viewport,{cellSizePixels:a,cellMarginPixels:l}=this.props,c=a>l?l:0,g=new Float32Array([(a-c)/r*2,-(a-c)/s*2,1]);i.setUniforms({cellScale:g})}}},tt=Dt;(()=>{Dt.layerName="ScreenGridCellLayer"})(),(()=>{Dt.defaultProps=Ii})();var to=M(E(),1);var ot=M(E(),1);function Be(n,t){let e={};for(let o in n)t.includes(o)||(e[o]=n[o]);return e}var oe=class extends ot.CompositeLayer{initializeAggregationLayer(t){super.initializeState(this.context),this.setState({ignoreProps:Be(this.constructor._propTypes,t.data.props),dimensions:t})}updateState(t){super.updateState(t);let{changeFlags:e}=t;if(e.extensionsChanged){let o=this.getShaders({});o&&o.defines&&(o.defines.NON_INSTANCED_MODEL=1),this.updateShaders(o)}this._updateAttributes()}updateAttributes(t){this.setState({changedAttributes:t})}getAttributes(){return this.getAttributeManager().getAttributes()}getModuleSettings(){let{viewport:t,mousePosition:e,device:o}=this.context;return Object.assign(Object.create(this.props),{viewport:t,mousePosition:e,picking:{isActive:0},devicePixelRatio:o.canvasContext.cssToDeviceRatio()})}updateShaders(t){}isAggregationDirty(t,e={}){let{props:o,oldProps:i,changeFlags:r}=t,{compareAll:s=!1,dimension:a}=e,{ignoreProps:l}=this.state,{props:c,accessors:g=[]}=a,{updateTriggersChanged:f}=r;if(r.dataChanged)return!0;if(f){if(f.all)return!0;for(let d of g)if(f[d])return!0}if(s)return r.extensionsChanged?!0:(0,ot._compareProps)({oldProps:i,newProps:o,ignoreProps:l,propTypes:this.constructor._propTypes});for(let d of c)if(o[d]!==i[d])return!0;return!1}isAttributeChanged(t){let{changedAttributes:e}=this.state;return t?e&&e[t]!==void 0:!Ri(e)}_getAttributeManager(){return new ot.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}},P=oe;(()=>{oe.layerName="AggregationLayer"})();function Ri(n){let t=!0;for(let e in n){t=!1;break}return t}var We=M(E(),1);function Lt(n,t,e){let o=e;return o.domain=()=>n,o.range=()=>t,o}function Ue(n,t){return Lt(n,t,o=>ki(n,t,o))}function Bi(n,t){return Lt(n,t,o=>ji(n,t,o))}function Ui(n,t){let e=n.sort(ze),o=0,i=Math.max(1,t.length),r=new Array(i-1);for(;++o<i;)r[o-1]=Wi(e,o/i);let s=a=>Gi(r,t,a);return s.thresholds=()=>r,Lt(n,t,s)}function ze(n,t){return n-t}function Wi(n,t){let e=n.length;if(t<=0||e<2)return n[0];if(t>=1)return n[e-1];let o=(e-1)*t,i=Math.floor(o),r=n[i],s=n[i+1];return r+(s-r)*(o-i)}function zi(n,t){let e=0,o=n.length;for(;e<o;){let i=e+o>>>1;ze(n[i],t)>0?o=i:e=i+1}return e}function Gi(n,t,e){return t[zi(n,e)]}function Hi(n,t,e,o){let i=`${o}`,r=t.get(i);return r===void 0&&(r=n.push(o),t.set(i,r)),e[(r-1)%e.length]}function Vi(n,t){let e=new Map,o=[];for(let r of n){let s=`${r}`;e.has(s)||e.set(s,o.push(r))}return Lt(n,t,r=>Hi(o,e,t,r))}function ki(n,t,e){let o=n[1]-n[0];if(o<=0)return We.log.warn("quantizeScale: invalid domain, returning range[0]")(),t[0];let i=o/t.length,r=Math.floor((e-n[0])/i),s=Math.max(Math.min(r,t.length-1),0);return t[s]}function ji(n,t,e){return(e-n[0])/(n[1]-n[0])*(t[1]-t[0])+t[0]}function Ge(n){return n!=null}function Xi(n){let t=[];return n.forEach(e=>{!t.includes(e)&&Ge(e)&&t.push(e)}),t}function He(n,t){return(typeof t=="function"?n.map(t):n).filter(Ge)}function Ve(n,t){return He(n,t)}function ke(n,t){return Xi(He(n,t))}function je(n,t,e){return Math.max(t,Math.min(e,n))}function Xe(n){switch(n){case"quantize":return Ue;case"linear":return Bi;case"quantile":return Ui;case"ordinal":return Vi;default:return Ue}}var Ye=n=>n.length,qi=3402823466e29,$e=n=>n.points,Ke=n=>n.index,qe=(n,t)=>n<t?-1:n>t?1:n>=t?0:NaN,Yi={getValue:Ye,getPoints:$e,getIndex:Ke,filterData:null},F=class{constructor(t=[],e=Yi){this.aggregatedBins=this.getAggregatedBins(t,e),this._updateMinMaxValues(),this.binMap=this.getBinMap()}getAggregatedBins(t,e){let{getValue:o=Ye,getPoints:i=$e,getIndex:r=Ke,filterData:s}=e,a=typeof s=="function",l=t.length,c=[],g=0;for(let f=0;f<l;f++){let d=t[f],p=i(d),x=r(d),h=a?p.filter(s):p;d.filteredPoints=a?h:null;let A=h.length?o(h):null;A!=null&&(c[g]={i:Number.isFinite(x)?x:f,value:A,counts:h.length},g++)}return c}_percentileToIndex(t){let e=this.sortedBins.length;if(e<2)return[0,0];let[o,i]=t.map(a=>je(a,0,100)),r=Math.ceil(o/100*(e-1)),s=Math.floor(i/100*(e-1));return[r,s]}getBinMap(){let t={};for(let e of this.aggregatedBins)t[e.i]=e;return t}_updateMinMaxValues(){let t=0,e=0,o=qi,i=0;for(let r of this.aggregatedBins)t=t>r.counts?t:r.counts,e=e>r.value?e:r.value,o=o<r.value?o:r.value,i+=r.counts;this.maxCount=t,this.maxValue=e,this.minValue=o,this.totalCount=i}getValueRange(t){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((i,r)=>qe(i.value,r.value))),!this.sortedBins.length)return[];let e=0,o=this.sortedBins.length-1;if(Array.isArray(t)){let i=this._percentileToIndex(t);e=i[0],o=i[1]}return[this.sortedBins[e].value,this.sortedBins[o].value]}getValueDomainByScale(t,[e=0,o=100]=[]){if(this.sortedBins||(this.sortedBins=this.aggregatedBins.sort((r,s)=>qe(r.value,s.value))),!this.sortedBins.length)return[];let i=this._percentileToIndex([e,o]);return this._getScaleDomain(t,i)}_getScaleDomain(t,[e,o]){let i=this.sortedBins;switch(t){case"quantize":case"linear":return[i[e].value,i[o].value];case"quantile":return Ve(i.slice(e,o+1),r=>r.value);case"ordinal":return ke(i,r=>r.value);default:return[i[e].value,i[o].value]}}};var Je=M(E(),1);var G=M(E(),1),Ze=6378e3;function Ft(n){return Number.isFinite(n)?n:0}function wt(n,t){let e=n.positions.value,o=1/0,i=-1/0,r=1/0,s=-1/0,a,l;for(let g=0;g<t;g++)l=e[g*3],a=e[g*3+1],o=a<o?a:o,i=a>i?a:i,r=l<r?l:r,s=l>s?l:s;return{xMin:Ft(r),xMax:Ft(s),yMin:Ft(o),yMax:Ft(i)}}function $i(n,t,e,o){let{width:i,height:r}=o,s=e===G.COORDINATE_SYSTEM.CARTESIAN?[-i/2,-r/2]:[-180,-90];G.log.assert(e===G.COORDINATE_SYSTEM.CARTESIAN||e===G.COORDINATE_SYSTEM.LNGLAT||e===G.COORDINATE_SYSTEM.DEFAULT);let{xMin:a,yMin:l}=n;return[-1*(Qe(a-s[0],t.xOffset)+s[0]),-1*(Qe(l-s[1],t.yOffset)+s[1])]}function Qe(n,t){let e=n<0?-1:1,o=e<0?Math.abs(n)+t:Math.abs(n);return o=Math.floor(o/t)*t,o*e}function ie(n,t,e=!0){if(!e)return{xOffset:t,yOffset:t};let{yMin:o,yMax:i}=n,r=(o+i)/2;return Ki(t,r)}function It(n,t,e,o){let i=ie(n,t,o!==G.COORDINATE_SYSTEM.CARTESIAN),r=$i(n,i,o,e),{xMin:s,yMin:a,xMax:l,yMax:c}=n,g=l-s+i.xOffset,f=c-a+i.yOffset,d=Math.ceil(g/i.xOffset),p=Math.ceil(f/i.yOffset);return{gridOffset:i,translation:r,width:g,height:f,numCol:d,numRow:p}}function Ki(n,t){let e=Qi(n),o=Zi(t,n);return{yOffset:e,xOffset:o}}function Qi(n){return n/Ze*(180/Math.PI)}function Zi(n,t){return t/Ze*(180/Math.PI)/Math.cos(n*Math.PI/180)}function it(n,t){let e=Ji(n,t),o=tr(e);return{gridHash:e.gridHash,gridOffset:e.gridOffset,data:o}}function Ji(n,t){let{data:e=[],cellSize:o}=n,{attributes:i,viewport:r,projectPoints:s,numInstances:a}=t,l=i.positions.value,{size:c}=i.positions.getAccessor(),g=t.boundingBox||er(i.positions,a),f=t.posOffset||[180,90],d=t.gridOffset||ie(g,o);if(d.xOffset<=0||d.yOffset<=0)return{gridHash:{},gridOffset:d,offsets:[0,0]};let{width:p,height:x}=r,h=Math.ceil(p/d.xOffset),A=Math.ceil(x/d.yOffset),S={},{iterable:y,objectInfo:_}=(0,Je.createIterable)(e),b=new Array(3);for(let O of y){_.index++,b[0]=l[_.index*c],b[1]=l[_.index*c+1],b[2]=c>=3?l[_.index*c+2]:0;let[B,mt]=s?r.project(b):b;if(Number.isFinite(B)&&Number.isFinite(mt)){let k=Math.floor((mt+f[1])/d.yOffset),j=Math.floor((B+f[0])/d.xOffset);if(!s||j>=0&&j<h&&k>=0&&k<A){let X=`${k}-${j}`;S[X]=S[X]||{count:0,points:[],lonIdx:j,latIdx:k},S[X].count+=1,S[X].points.push({source:O,index:_.index})}}}return{gridHash:S,gridOffset:d,offsets:[f[0]*-1,f[1]*-1]}}function tr({gridHash:n,gridOffset:t,offsets:e}){let o=new Array(Object.keys(n).length),i=0;for(let r in n){let s=r.split("-"),a=parseInt(s[0],10),l=parseInt(s[1],10),c=i++;o[c]={index:c,position:[e[0]+t.xOffset*l,e[1]+t.yOffset*a],...n[r]}}return o}function er(n,t){let e=n.value,{size:o}=n.getAccessor(),i=1/0,r=-1/0,s=1/0,a=-1/0,l,c;for(let g=0;g<t;g++)c=e[g*o],l=e[g*o+1],Number.isFinite(c)&&Number.isFinite(l)&&(i=l<i?l:i,r=l>r?l:r,s=c<s?c:s,a=c>a?c:a);return{xMin:s,xMax:a,yMin:i,yMax:r}}var re=class extends P{initializeAggregationLayer({dimensions:t}){super.initializeAggregationLayer(t),this.setState({layerData:{},gpuGridAggregator:new C(this.context.device,{id:`${this.id}-gpu-aggregator`}),cpuGridAggregator:it})}updateState(t){super.updateState(t),this.updateAggregationState(t);let{aggregationDataDirty:e,aggregationWeightsDirty:o,gpuAggregation:i}=this.state;if(this.getNumInstances()<=0)return;let r=!1;(e||i&&o)&&(this._updateAggregation(t),r=!0),!i&&(e||o)&&(this._updateWeightBins(),this._uploadAggregationResults(),r=!0),this.setState({aggregationDirty:r})}finalizeState(t){let{count:e}=this.state.weights;e&&e.aggregationBuffer&&e.aggregationBuffer.delete(),this.state.gpuGridAggregator?.delete(),super.finalizeState(t)}updateShaders(t){this.state.gpuAggregation&&this.state.gpuGridAggregator.updateShaders(t)}updateAggregationState(t){to.log.assert(!1)}allocateResources(t,e){if(this.state.numRow!==t||this.state.numCol!==e){let o=e*t*4*4,{weights:i}=this.state;for(let r in i){let s=i[r];s.aggregationBuffer&&s.aggregationBuffer.delete(),s.aggregationBuffer=this.context.device.createBuffer({byteLength:o,accessor:{size:4,type:5126,divisor:1}})}}}updateResults({aggregationData:t,maxMinData:e,maxData:o,minData:i}){let{count:r}=this.state.weights;r&&(r.aggregationData=t,r.maxMinData=e,r.maxData=o,r.minData=i)}_updateAggregation(t){let{cpuGridAggregator:e,gpuGridAggregator:o,gridOffset:i,posOffset:r,translation:s=[0,0],scaling:a=[0,0,0],boundingBox:l,projectPoints:c,gpuAggregation:g,numCol:f,numRow:d}=this.state,{props:p}=t,{viewport:x}=this.context,h=this.getAttributes(),A=this.getNumInstances();if(g){let{weights:S}=this.state;o.run({weights:S,cellSize:[i.xOffset,i.yOffset],numCol:f,numRow:d,translation:s,scaling:a,vertexCount:A,projectPoints:c,attributes:h,moduleSettings:this.getModuleSettings()})}else{let S=e(p,{gridOffset:i,projectPoints:c,attributes:h,viewport:x,posOffset:r,boundingBox:l});this.setState({layerData:S})}}_updateWeightBins(){let{getValue:t}=this.state,e=new F(this.state.layerData.data||[],{getValue:t});this.setState({sortedBins:e})}_uploadAggregationResults(){let{numCol:t,numRow:e}=this.state,{data:o}=this.state.layerData,{aggregatedBins:i,minValue:r,maxValue:s,totalCount:a}=this.state.sortedBins,l=4,c=t*e*l,g=new Float32Array(c).fill(0);for(let x of i){let{lonIdx:h,latIdx:A}=o[x.i],{value:S,counts:y}=x,_=(h+A*t)*l;g[_]=S,g[_+l-1]=y}let f=new Float32Array([s,0,0,r]),d=new Float32Array([s,0,0,a]),p=new Float32Array([r,0,0,a]);this.updateResults({aggregationData:g,maxMinData:f,maxData:d,minData:p})}},w=re;(()=>{re.layerName="GridAggregationLayer"})();var or={...tt.defaultProps,getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM"},eo="positions",ir={data:{props:["cellSizePixels"]},weights:{props:["aggregation"],accessors:["getWeight"]}},Rt=class extends w{initializeState(){super.initializeAggregationLayer({dimensions:ir,getCellSize:o=>o.cellSizePixels});let t={count:{size:1,operation:T.SUM,needMax:!0,maxTexture:Z(this.context.device,{id:`${this.id}-max-texture`})}};this.setState({supported:!0,projectPoints:!0,weights:t,subLayerData:{attributes:{}},maxTexture:t.count.maxTexture,positionAttributeName:"positions",posOffset:[0,0],translation:[1,-1]}),this.getAttributeManager().add({[eo]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}shouldUpdateState({changeFlags:t}){return this.state.supported&&t.somethingChanged}updateState(t){super.updateState(t)}renderLayers(){if(!this.state.supported)return[];let{maxTexture:t,numRow:e,numCol:o,weights:i}=this.state,{updateTriggers:r}=this.props,{aggregationBuffer:s}=i.count,a=this.getSubLayerClass("cells",tt);return new a(this.props,this.getSubLayerProps({id:"cell-layer",updateTriggers:r}),{data:{attributes:{instanceCounts:s}},maxTexture:t,numInstances:e*o})}finalizeState(t){super.finalizeState(t);let{aggregationBuffer:e,maxBuffer:o,maxTexture:i}=this.state;e?.delete(),o?.delete(),i?.delete()}getPickingInfo({info:t}){let{index:e}=t;if(e>=0){let{gpuGridAggregator:o,gpuAggregation:i,weights:r}=this.state,s=i?o.getData("count"):r.count;t.object=C.getAggregationData({pixelIndex:e,...s})}return t}updateResults({aggregationData:t,maxData:e}){let{count:o}=this.state.weights;o.aggregationData=t,o.aggregationBuffer.write(t),o.maxData=e,o.maxTexture.setImageData({data:e})}updateAggregationState(t){let e=t.props.cellSizePixels,o=t.oldProps.cellSizePixels!==e,{viewportChanged:i}=t.changeFlags,r=t.props.gpuAggregation;this.state.gpuAggregation!==t.props.gpuAggregation&&r&&!C.isSupported(this.context.device)&&(oo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),r=!1);let s=r!==this.state.gpuAggregation;this.setState({gpuAggregation:r});let a=this.isAttributeChanged(eo),{dimensions:l}=this.state,{data:c,weights:g}=l,f=a||s||i||this.isAggregationDirty(t,{compareAll:r,dimension:c}),d=this.isAggregationDirty(t,{dimension:g});this.setState({aggregationDataDirty:f,aggregationWeightsDirty:d});let{viewport:p}=this.context;if(i||o){let{width:x,height:h}=p,A=Math.ceil(x/e),S=Math.ceil(h/e);this.allocateResources(S,A),this.setState({scaling:[x/2,-h/2,1],gridOffset:{xOffset:e,yOffset:e},width:x,height:h,numCol:A,numRow:S})}d&&this._updateAccessors(t),(f||d)&&this._resetResults()}_updateAccessors(t){let{getWeight:e,aggregation:o,data:i}=t.props,{count:r}=this.state.weights;r&&(r.getWeight=e,r.operation=T[o]),this.setState({getValue:Q(o,e,{data:i})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}},St=Rt;(()=>{Rt.layerName="ScreenGridLayer"})(),(()=>{Rt.defaultProps=or})();var ao=M($(),1);function io(){}var ro=["getBins","getDomain","getScaleFunc"],no=[{key:"fillColor",accessor:"getFillColor",pickingInfo:"colorValue",getBins:{triggers:{value:{prop:"getColorValue",updateTrigger:"getColorValue"},weight:{prop:"getColorWeight",updateTrigger:"getColorWeight"},aggregation:{prop:"colorAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"lowerPercentile"},upperPercentile:{prop:"upperPercentile"},scaleType:{prop:"colorScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"colorDomain"},range:{prop:"colorRange"}},onSet:{props:"onSetColorDomain"}},nullValue:[0,0,0,0]},{key:"elevation",accessor:"getElevation",pickingInfo:"elevationValue",getBins:{triggers:{value:{prop:"getElevationValue",updateTrigger:"getElevationValue"},weight:{prop:"getElevationWeight",updateTrigger:"getElevationWeight"},aggregation:{prop:"elevationAggregation"},filterData:{prop:"_filterData",updateTrigger:"_filterData"}}},getDomain:{triggers:{lowerPercentile:{prop:"elevationLowerPercentile"},upperPercentile:{prop:"elevationUpperPercentile"},scaleType:{prop:"elevationScaleType"}}},getScaleFunc:{triggers:{domain:{prop:"elevationDomain"},range:{prop:"elevationRange"}},onSet:{props:"onSetElevationDomain"}},nullValue:-1}],rr=n=>n.cellSize,I=class{constructor(t){this.state={layerData:{data:void 0},dimensions:{}},this.changeFlags={},this.dimensionUpdaters={},this._getCellSize=t.getCellSize||rr,this._getAggregator=t.getAggregator,this._addDimension(t.dimensions||no)}static defaultDimensions(){return no}updateState(t,e){let{oldProps:o,props:i,changeFlags:r}=t;this.updateGetValueFuncs(o,i,r);let s=this.needsReProjectPoints(o,i,r),a=!1;return r.dataChanged||s?(this.getAggregatedData(i,e),a=!0):((this.getDimensionChanges(o,i,r)||[]).forEach(c=>typeof c=="function"&&c()),a=!0),this.setState({aggregationDirty:a}),this.state}setState(t){this.state={...this.state,...t}}setDimensionState(t,e){this.setState({dimensions:{...this.state.dimensions,[t]:{...this.state.dimensions[t],...e}}})}normalizeResult(t={}){return t.hexagons?{data:t.hexagons,...t}:t.layerData?{data:t.layerData,...t}:t}getAggregatedData(t,e){let i=this._getAggregator(t)(t,e);this.setState({layerData:this.normalizeResult(i)}),this.changeFlags={layerData:!0},this.getSortedBins(t)}updateGetValueFuncs(t,e,o){for(let i in this.dimensionUpdaters){let{value:r,weight:s,aggregation:a}=this.dimensionUpdaters[i].getBins.triggers,l=e[r.prop];this.needUpdateDimensionStep(this.dimensionUpdaters[i].getBins,t,e,o)&&(l?l=Me(l,{data:e.data}):l=Q(e[a.prop],e[s.prop],{data:e.data})),l&&this.setDimensionState(i,{getValue:l})}}needsReProjectPoints(t,e,o){return this._getCellSize(t)!==this._getCellSize(e)||this._getAggregator(t)!==this._getAggregator(e)||o.updateTriggersChanged&&(o.updateTriggersChanged.all||o.updateTriggersChanged.getPosition)}addDimension(t){this._addDimension(t)}_addDimension(t=[]){t.forEach(e=>{let{key:o}=e;this.dimensionUpdaters[o]=this.getDimensionUpdaters(e),this.state.dimensions[o]={getValue:null,domain:null,sortedBins:null,scaleFunc:io}})}getDimensionUpdaters({key:t,accessor:e,pickingInfo:o,getBins:i,getDomain:r,getScaleFunc:s,nullValue:a}){return{key:t,accessor:e,pickingInfo:o,getBins:{updater:this.getDimensionSortedBins.bind(this),...i},getDomain:{updater:this.getDimensionValueDomain.bind(this),...r},getScaleFunc:{updater:this.getDimensionScale.bind(this),...s},attributeAccessor:this.getSubLayerDimensionAttribute(t,a)}}needUpdateDimensionStep(t,e,o,i){return Object.values(t.triggers).some(r=>r.updateTrigger?i.dataChanged||i.updateTriggersChanged&&(i.updateTriggersChanged.all||i.updateTriggersChanged[r.updateTrigger]):e[r.prop]!==o[r.prop])}getDimensionChanges(t,e,o){let i=[];for(let r in this.dimensionUpdaters){let s=ro.find(a=>this.needUpdateDimensionStep(this.dimensionUpdaters[r][a],t,e,o));s&&i.push(this.dimensionUpdaters[r][s].updater.bind(this,e,this.dimensionUpdaters[r]))}return i.length?i:null}getUpdateTriggers(t){let e=t.updateTriggers||{},o={};for(let i in this.dimensionUpdaters){let{accessor:r}=this.dimensionUpdaters[i];o[r]={},ro.forEach(s=>{Object.values(this.dimensionUpdaters[i][s].triggers).forEach(({prop:a,updateTrigger:l})=>{if(l){let c=e[l];typeof c=="object"&&!Array.isArray(c)?Object.assign(o[r],c):c!==void 0&&(o[r][a]=c)}else o[r][a]=t[a]})})}return o}getSortedBins(t){for(let e in this.dimensionUpdaters)this.getDimensionSortedBins(t,this.dimensionUpdaters[e])}getDimensionSortedBins(t,e){let{key:o}=e,{getValue:i}=this.state.dimensions[o],r=new F(this.state.layerData.data||[],{getValue:i,filterData:t._filterData});this.setDimensionState(o,{sortedBins:r}),this.getDimensionValueDomain(t,e)}getDimensionValueDomain(t,e){let{getDomain:o,key:i}=e,{triggers:{lowerPercentile:r,upperPercentile:s,scaleType:a}}=o,l=this.state.dimensions[i].sortedBins.getValueDomainByScale(t[a.prop],[t[r.prop],t[s.prop]]);this.setDimensionState(i,{valueDomain:l}),this.getDimensionScale(t,e)}getDimensionScale(t,e){let{key:o,getScaleFunc:i,getDomain:r}=e,{domain:s,range:a}=i.triggers,{scaleType:l}=r.triggers,{onSet:c}=i,g=t[a.prop],f=t[s.prop]||this.state.dimensions[o].valueDomain,p=Xe(l&&t[l.prop])(f,g);typeof c=="object"&&typeof t[c.props]=="function"&&t[c.props](p.domain()),this.setDimensionState(o,{scaleFunc:p})}getSubLayerDimensionAttribute(t,e){return o=>{let{sortedBins:i,scaleFunc:r}=this.state.dimensions[t],s=i.binMap[o.index];if(s&&s.counts===0)return e;let a=s&&s.value,l=r.domain();return a>=l[0]&&a<=l[l.length-1]?r(a):e}}getSubLayerAccessors(t){let e={};for(let o in this.dimensionUpdaters){let{accessor:i}=this.dimensionUpdaters[o];e[i]=this.getSubLayerDimensionAttribute(t,o)}return e}getPickingInfo({info:t}){let e=t.picked&&t.index>-1,o=null;if(e){let i=this.state.layerData.data[t.index],r={};for(let s in this.dimensionUpdaters){let{pickingInfo:a}=this.dimensionUpdaters[s],{sortedBins:l}=this.state.dimensions[s],c=l.binMap[i.index]&&l.binMap[i.index].value;r[a]=c}o=Object.assign(r,i,{points:i.filteredPoints||i.points})}return t.picked=Boolean(o),t.object=o,t}getAccessor(t){return this.dimensionUpdaters.hasOwnProperty(t)?this.dimensionUpdaters[t].attributeAccessor:io}};function so(){}var nr={colorDomain:null,colorRange:D,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",min:0,max:100,value:0},upperPercentile:{type:"number",min:0,max:100,value:100},colorScaleType:"quantize",onSetColorDomain:so,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",min:0,max:100,value:0},elevationUpperPercentile:{type:"number",min:0,max:100,value:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:so,gridAggregator:it,cellSize:{type:"number",min:0,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:n=>n.position},extruded:!1,material:!0,_filterData:{type:"function",value:null,optional:!0}},Bt=class extends P{initializeState(){let t=new I({getAggregator:o=>o.gridAggregator,getCellSize:o=>o.cellSize});this.state={cpuAggregator:t,aggregatorState:t.state},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(t){super.updateState(t),this.setState({aggregatorState:this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes(),numInstances:this.getNumInstances()})})}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:e,cellSize:o,coverage:i,material:r,transitions:s}=this.props,{cpuAggregator:a}=this.state,l=this.getSubLayerClass("grid-cell",ao.GridCellLayer),c=this._getSublayerUpdateTriggers();return new l({cellSize:o,coverage:i,material:r,elevationScale:t,extruded:e,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:s&&{getFillColor:s.getColorValue||s.getColorWeight,getElevation:s.getElevationValue||s.getElevationWeight}},this.getSubLayerProps({id:"grid-cell",updateTriggers:c}),{data:a.state.layerData.data})}},H=Bt;(()=>{Bt.layerName="CPUGridLayer"})(),(()=>{Bt.defaultProps=nr})();var uo=M(E(),1),go=M($(),1);var rt=Math.PI/3,sr=[0,rt,2*rt,3*rt,4*rt,5*rt];function ar(n){return n[0]}function lr(n){return n[1]}function ne(){var n=0,t=0,e=1,o=1,i=ar,r=lr,s,a,l;function c(f){var d={},p=[],x,h=f.length;for(x=0;x<h;++x)if(!(isNaN(S=+i.call(null,A=f[x],x,f))||isNaN(y=+r.call(null,A,x,f)))){var A,S,y,_=Math.round(y=y/l),b=Math.round(S=S/a-(_&1)/2),O=y-_;if(Math.abs(O)*3>1){var B=S-b,mt=b+(S<b?-1:1)/2,k=_+(y<_?-1:1),j=S-mt,X=y-k;B*B+O*O>j*j+X*X&&(b=mt+(_&1?1:-1)/2,_=k)}var me=b+"-"+_,ht=d[me];ht?ht.push(A):(p.push(ht=d[me]=[A]),ht.x=(b+(_&1)/2)*a,ht.y=_*l)}return p}function g(f){var d=0,p=0;return sr.map(function(x){var h=Math.sin(x)*f,A=-Math.cos(x)*f,S=h-d,y=A-p;return d=h,p=A,[S,y]})}return c.hexagon=function(f){return"m"+g(f==null?s:+f).join("l")+"z"},c.centers=function(){for(var f=[],d=Math.round(t/l),p=Math.round(n/a),x=d*l;x<o+s;x+=l,++d)for(var h=p*a+(d&1)*a/2;h<e+a/2;h+=a)f.push([h,x]);return f},c.mesh=function(){var f=g(s).slice(0,4).join("l");return c.centers().map(function(d){return"M"+d+"m"+f}).join("")},c.x=function(f){return arguments.length?(i=f,c):i},c.y=function(f){return arguments.length?(r=f,c):r},c.radius=function(f){return arguments.length?(s=+f,a=s*2*Math.sin(rt),l=s*1.5,c):s},c.size=function(f){return arguments.length?(n=t=0,e=+f[0],o=+f[1],c):[e-n,o-t]},c.extent=function(f){return arguments.length?(n=+f[0][0],t=+f[0][1],e=+f[1][0],o=+f[1][1],c):[[n,t],[e,o]]},c.radius(1)}var Ut=M(E(),1);function lo(n,t){let{data:e,radius:o}=n,{viewport:i,attributes:r}=t,s=e.length?cr(e,t):null,a=ur(o,i,s),l=[],{iterable:c,objectInfo:g}=(0,Ut.createIterable)(e),f=r.positions.value,{size:d}=r.positions.getAccessor();for(let h of c){g.index++;let A=g.index*d,S=[f[A],f[A+1]];Number.isFinite(S[0])&&Number.isFinite(S[1])?l.push({screenCoord:i.projectFlat(S),source:h,index:g.index}):Ut.log.warn("HexagonLayer: invalid position")()}return{hexagons:ne().radius(a).x(h=>h.screenCoord[0]).y(h=>h.screenCoord[1])(l).map((h,A)=>({position:i.unprojectFlat([h.x,h.y]),points:h,index:A})),radiusCommon:a}}function cr(n,t){let{attributes:e}=t,o=e.positions.value,{size:i}=e.positions.getAccessor(),r=1/0,s=1/0,a=-1/0,l=-1/0,c;for(c=0;c<i*n.length;c+=i){let g=o[c],f=o[c+1];Number.isFinite(g)&&Number.isFinite(f)&&(r=Math.min(g,r),a=Math.max(g,a),s=Math.min(f,s),l=Math.max(f,l))}return[r,s,a,l].every(Number.isFinite)?[(r+a)/2,(s+l)/2]:null}function ur(n,t,e){let{unitsPerMeter:o}=t.getDistanceScales(e);return n*o[0]}function co(){}var gr={colorDomain:null,colorRange:D,getColorValue:{type:"accessor",value:null},getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",lowerPercentile:{type:"number",value:0,min:0,max:100},upperPercentile:{type:"number",value:100,min:0,max:100},colorScaleType:"quantize",onSetColorDomain:co,elevationDomain:null,elevationRange:[0,1e3],getElevationValue:{type:"accessor",value:null},getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationLowerPercentile:{type:"number",value:0,min:0,max:100},elevationUpperPercentile:{type:"number",value:100,min:0,max:100},elevationScale:{type:"number",min:0,value:1},elevationScaleType:"linear",onSetElevationDomain:co,radius:{type:"number",value:1e3,min:1},coverage:{type:"number",min:0,max:1,value:1},extruded:!1,hexagonAggregator:lo,getPosition:{type:"accessor",value:n=>n.position},material:!0,_filterData:{type:"function",value:null,optional:!0}},Wt=class extends P{initializeState(){let t=new I({getAggregator:o=>o.hexagonAggregator,getCellSize:o=>o.radius});this.state={cpuAggregator:t,aggregatorState:t.state,vertices:null},this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"}})}updateState(t){if(super.updateState(t),t.changeFlags.propsOrDataChanged){let e=this.state.cpuAggregator.updateState(t,{viewport:this.context.viewport,attributes:this.getAttributes()});if(this.state.aggregatorState.layerData!==e.layerData){let{hexagonVertices:o}=e.layerData||{};this.setState({vertices:o&&this.convertLatLngToMeterOffset(o)})}this.setState({aggregatorState:e})}}convertLatLngToMeterOffset(t){let{viewport:e}=this.context;if(Array.isArray(t)&&t.length===6){let o=t[0],i=t[3],r=[(o[0]+i[0])/2,(o[1]+i[1])/2],s=e.projectFlat(r),{metersPerUnit:a}=e.getDistanceScales(r);return t.map(c=>{let g=e.projectFlat(c);return[(g[0]-s[0])*a[0],(g[1]-s[1])*a[1]]})}return uo.log.error("HexagonLayer: hexagonVertices needs to be an array of 6 points")(),null}getPickingInfo({info:t}){return this.state.cpuAggregator.getPickingInfo({info:t})}_onGetSublayerColor(t){return this.state.cpuAggregator.getAccessor("fillColor")(t)}_onGetSublayerElevation(t){return this.state.cpuAggregator.getAccessor("elevation")(t)}_getSublayerUpdateTriggers(){return this.state.cpuAggregator.getUpdateTriggers(this.props)}renderLayers(){let{elevationScale:t,extruded:e,coverage:o,material:i,transitions:r}=this.props,{aggregatorState:s,vertices:a}=this.state,l=this.getSubLayerClass("hexagon-cell",go.ColumnLayer),c=this._getSublayerUpdateTriggers(),g=a?{vertices:a,radius:1}:{radius:s.layerData.radiusCommon||1,radiusUnits:"common",angle:90};return new l({...g,diskResolution:6,elevationScale:t,extruded:e,coverage:o,material:i,getFillColor:this._onGetSublayerColor.bind(this),getElevation:this._onGetSublayerElevation.bind(this),transitions:r&&{getFillColor:r.getColorValue||r.getColorWeight,getElevation:r.getElevationValue||r.getElevationWeight}},this.getSubLayerProps({id:"hexagon-cell",updateTriggers:c}),{data:s.layerData.data})}},At=Wt;(()=>{Wt.layerName="HexagonLayer"})(),(()=>{Wt.defaultProps=gr})();var jt=M($(),1);var Uo=M(E(),1);var v=.16666666666666666,u={N:[0,.5],E:[.5,0],S:[0,-.5],W:[-.5,0],NE:[.5,.5],NW:[-.5,.5],SE:[.5,-.5],SW:[-.5,-.5]},nt=[u.W,u.SW,u.S],st=[u.S,u.SE,u.E],at=[u.E,u.NE,u.N],lt=[u.NW,u.W,u.N],ct=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5]],ut=[[-v,-.5],[v,-.5],[.5,-v],[.5,v]],gt=[[.5,-v],[.5,v],[v,.5],[-v,.5]],ft=[[-.5,v],[-.5,-v],[v,.5],[-v,.5]],fo=[u.W,u.SW,u.SE,u.E],po=[u.S,u.SE,u.NE,u.N],mo=[u.NW,u.W,u.E,u.NE],ho=[u.NW,u.SW,u.S,u.N],xo=[[-.5,v],[-.5,-v],[.5,-v],[.5,v]],vo=[[-v,-.5],[v,-.5],[v,.5],[-v,.5]],fr=[u.NW,u.SW,u.SE,u.NE],So=[u.NW,u.SW,u.SE,u.E,u.N],Ao=[u.W,u.SW,u.SE,u.NE,u.N],yo=[u.NW,u.W,u.S,u.SE,u.NE],_o=[u.NW,u.SW,u.S,u.E,u.NE],bo=[u.NW,u.W,[.5,-v],[.5,v],u.N],Mo=[[-v,-.5],[v,-.5],u.E,u.NE,u.N],To=[[-.5,v],[-.5,-v],u.S,u.SE,u.E],Co=[u.W,u.SW,u.S,[v,.5],[-v,.5]],Eo=[u.NW,u.W,[-v,-.5],[v,-.5],u.N],Po=[[-.5,v],[-.5,-v],u.E,u.NE,u.N],No=[u.S,u.SE,u.E,[v,.5],[-v,.5]],Do=[u.W,u.SW,u.S,[.5,-v],[.5,v]],Oo=[u.W,u.SW,u.SE,u.E,[v,.5],[-v,.5]],Lo=[[-.5,v],[-.5,-v],u.S,u.SE,u.NE,u.N],Fo=[u.NW,u.W,[-v,-.5],[v,-.5],u.E,u.NE],wo=[u.NW,u.SW,u.S,[.5,-v],[.5,v],u.N],dt=[u.W,u.SW,u.S,u.E,u.NE,u.N],pt=[u.NW,u.W,u.S,u.SE,u.E,u.N],zt=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],u.E,u.NE,u.N],Gt=[u.W,u.SW,u.S,[.5,-v],[.5,v],[v,.5],[-v,.5]],Ht=[u.NW,u.W,[-v,-.5],[v,-.5],[.5,-v],[.5,v],u.N],Vt=[[-.5,v],[-.5,-v],u.S,u.SE,u.E,[v,.5],[-v,.5]],Io=[[-.5,v],[-.5,-v],[-v,-.5],[v,-.5],[.5,-v],[.5,v],[v,.5],[-v,.5]],Ro={0:[],1:[[u.W,u.S]],2:[[u.S,u.E]],3:[[u.W,u.E]],4:[[u.N,u.E]],5:{0:[[u.W,u.S],[u.N,u.E]],1:[[u.W,u.N],[u.S,u.E]]},6:[[u.N,u.S]],7:[[u.W,u.N]],8:[[u.W,u.N]],9:[[u.N,u.S]],10:{0:[[u.W,u.N],[u.S,u.E]],1:[[u.W,u.S],[u.N,u.E]]},11:[[u.N,u.E]],12:[[u.W,u.E]],13:[[u.S,u.E]],14:[[u.W,u.S]],15:[]};function m(n){return parseInt(n,4)}var Bo={[m("0000")]:[],[m("2222")]:[],[m("2221")]:[nt],[m("2212")]:[st],[m("2122")]:[at],[m("1222")]:[lt],[m("0001")]:[nt],[m("0010")]:[st],[m("0100")]:[at],[m("1000")]:[lt],[m("2220")]:[ct],[m("2202")]:[ut],[m("2022")]:[gt],[m("0222")]:[ft],[m("0002")]:[ct],[m("0020")]:[ut],[m("0200")]:[gt],[m("2000")]:[ft],[m("0011")]:[fo],[m("0110")]:[po],[m("1100")]:[mo],[m("1001")]:[ho],[m("2211")]:[fo],[m("2112")]:[po],[m("1122")]:[mo],[m("1221")]:[ho],[m("2200")]:[xo],[m("2002")]:[vo],[m("0022")]:[xo],[m("0220")]:[vo],[m("1111")]:[fr],[m("1211")]:[So],[m("2111")]:[Ao],[m("1112")]:[yo],[m("1121")]:[_o],[m("1011")]:[So],[m("0111")]:[Ao],[m("1110")]:[yo],[m("1101")]:[_o],[m("1200")]:[bo],[m("0120")]:[Mo],[m("0012")]:[To],[m("2001")]:[Co],[m("1022")]:[bo],[m("2102")]:[Mo],[m("2210")]:[To],[m("0221")]:[Co],[m("1002")]:[Eo],[m("2100")]:[Po],[m("0210")]:[No],[m("0021")]:[Do],[m("1220")]:[Eo],[m("0122")]:[Po],[m("2012")]:[No],[m("2201")]:[Do],[m("0211")]:[Oo],[m("2110")]:[Lo],[m("1102")]:[Fo],[m("1021")]:[wo],[m("2011")]:[Oo],[m("0112")]:[Lo],[m("1120")]:[Fo],[m("1201")]:[wo],[m("2101")]:[dt],[m("0121")]:[dt],[m("1012")]:[pt],[m("1210")]:[pt],[m("0101")]:{0:[nt,at],1:[dt],2:[dt]},[m("1010")]:{0:[lt,st],1:[pt],2:[pt]},[m("2121")]:{0:[dt],1:[dt],2:[nt,at]},[m("1212")]:{0:[pt],1:[pt],2:[lt,st]},[m("2120")]:{0:[zt],1:[zt],2:[ct,at]},[m("2021")]:{0:[Gt],1:[Gt],2:[nt,gt]},[m("1202")]:{0:[Ht],1:[Ht],2:[lt,ut]},[m("0212")]:{0:[Vt],1:[Vt],2:[st,ft]},[m("0102")]:{0:[ct,at],1:[zt],2:[zt]},[m("0201")]:{0:[nt,gt],1:[Gt],2:[Gt]},[m("1020")]:{0:[lt,ut],1:[Ht],2:[Ht]},[m("2010")]:{0:[st,ft],1:[Vt],2:[Vt]},[m("2020")]:{0:[ft,ut],1:[Io],2:[ct,gt]},[m("0202")]:{0:[gt,ct],1:[Io],2:[ft,ut]}};var Y={ISO_LINES:1,ISO_BANDS:2},dr={zIndex:0,zOffset:.005};function yt(n,t){return Array.isArray(t)?n<t[0]?0:n<t[1]?1:2:n>=t?1:0}function Wo(n){let{cellWeights:t,x:e,y:o,width:i,height:r}=n,s=n.threshold;n.thresholdValue&&(Uo.log.deprecated("thresholdValue","threshold")(),s=n.thresholdValue);let a=e<0,l=e>=i-1,c=o<0,g=o>=r-1,f=a||l||c||g,d={},p={};a||g?p.top=0:(d.top=t[(o+1)*i+e],p.top=yt(d.top,s)),l||g?p.topRight=0:(d.topRight=t[(o+1)*i+e+1],p.topRight=yt(d.topRight,s)),l||c?p.right=0:(d.right=t[o*i+e+1],p.right=yt(d.right,s)),a||c?p.current=0:(d.current=t[o*i+e],p.current=yt(d.current,s));let{top:x,topRight:h,right:A,current:S}=p,y=-1;Number.isFinite(s)&&(y=x<<3|h<<2|A<<1|S),Array.isArray(s)&&(y=x<<6|h<<4|A<<2|S);let _=0;return f||(_=yt((d.top+d.topRight+d.right+d.current)/4,s)),{code:y,meanCode:_}}function se(n){let{gridOrigin:t,cellSize:e,x:o,y:i,code:r,meanCode:s,type:a=Y.ISO_LINES}=n,l={...dr,...n.thresholdData},c=a===Y.ISO_BANDS?Bo[r]:Ro[r];Array.isArray(c)||(c=c[s]);let g=l.zIndex*l.zOffset,f=(o+1)*e[0],d=(i+1)*e[1],p=t[0]+f,x=t[1]+d;if(a===Y.ISO_BANDS){let A=[];return c.forEach(S=>{let y=[];S.forEach(_=>{let b=p+_[0]*e[0],O=x+_[1]*e[1];y.push([b,O,g])}),A.push(y)}),A}let h=[];return c.forEach(A=>{A.forEach(S=>{let y=p+S[0]*e[0],_=x+S[1]*e[1];h.push([y,_,g])})}),h}function zo({thresholdData:n,cellWeights:t,gridSize:e,gridOrigin:o,cellSize:i}){let r=[],s=[],a=e[0],l=e[1],c=0,g=0;for(let f of n){let{contour:d}=f,{threshold:p}=d;for(let x=-1;x<a;x++)for(let h=-1;h<l;h++){let{code:A,meanCode:S}=Wo({cellWeights:t,threshold:p,x,y:h,width:a,height:l}),y={type:Y.ISO_BANDS,gridOrigin:o,cellSize:i,x,y:h,width:a,height:l,code:A,meanCode:S,thresholdData:f};if(Array.isArray(p)){y.type=Y.ISO_BANDS;let _=se(y);for(let b of _)s[g++]={vertices:b,contour:d}}else{y.type=Y.ISO_LINES;let _=se(y);for(let b=0;b<_.length;b+=2)r[c++]={start:_[b],end:_[b+1],contour:d}}}}return{contourSegments:r,contourPolygons:s}}var Vo=M(E(),1);var Go=[255,255,255,255],pr=1,mr=1,hr={cellSize:{type:"number",min:1,max:1e3,value:1e3},getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},gpuAggregation:!1,aggregation:"SUM",contours:{type:"object",value:[{threshold:mr}],optional:!0,compare:3},zOffset:.005},Ho="positions",xr={data:{props:["cellSize"]},weights:{props:["aggregation"],accessors:["getWeight"]}},kt=class extends w{initializeState(){super.initializeAggregationLayer({dimensions:xr}),this.setState({contourData:{},projectPoints:!1,weights:{count:{size:1,operation:T.SUM}}}),this.getAttributeManager().add({[Ho]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},count:{size:3,accessor:"getWeight"}})}updateState(t){super.updateState(t);let e=!1,{oldProps:o,props:i}=t,{aggregationDirty:r}=this.state;(o.contours!==i.contours||o.zOffset!==i.zOffset)&&(e=!0,this._updateThresholdData(t.props)),this.getNumInstances()>0&&(r||e)&&this._generateContours()}renderLayers(){let{contourSegments:t,contourPolygons:e}=this.state.contourData,o=this.getSubLayerClass("lines",jt.LineLayer),i=this.getSubLayerClass("bands",jt.SolidPolygonLayer),r=t&&t.length>0&&new o(this.getSubLayerProps({id:"lines"}),{data:this.state.contourData.contourSegments,getSourcePosition:a=>a.start,getTargetPosition:a=>a.end,getColor:a=>a.contour.color||Go,getWidth:a=>a.contour.strokeWidth||pr}),s=e&&e.length>0&&new i(this.getSubLayerProps({id:"bands"}),{data:this.state.contourData.contourPolygons,getPolygon:a=>a.vertices,getFillColor:a=>a.contour.color||Go});return[r,s]}updateAggregationState(t){let{props:e,oldProps:o}=t,{cellSize:i,coordinateSystem:r}=e,{viewport:s}=this.context,a=o.cellSize!==i,l=e.gpuAggregation;this.state.gpuAggregation!==e.gpuAggregation&&l&&!C.isSupported(this.context.device)&&(Vo.log.warn("GPU Grid Aggregation not supported, falling back to CPU")(),l=!1);let c=l!==this.state.gpuAggregation;this.setState({gpuAggregation:l});let{dimensions:g}=this.state,f=this.isAttributeChanged(Ho),{data:d,weights:p}=g,{boundingBox:x}=this.state;if(f&&(x=wt(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:x})),f||a){let{gridOffset:S,translation:y,width:_,height:b,numCol:O,numRow:B}=It(x,i,s,r);this.allocateResources(B,O),this.setState({gridOffset:S,boundingBox:x,translation:y,posOffset:y.slice(),gridOrigin:[-1*y[0],-1*y[1]],width:_,height:b,numCol:O,numRow:B})}let h=f||c||this.isAggregationDirty(t,{dimension:d,compareAll:l}),A=this.isAggregationDirty(t,{dimension:p});A&&this._updateAccessors(t),(h||A)&&this._resetResults(),this.setState({aggregationDataDirty:h,aggregationWeightsDirty:A})}_updateAccessors(t){let{getWeight:e,aggregation:o,data:i}=t.props,{count:r}=this.state.weights;r&&(r.getWeight=e,r.operation=T[o]),this.setState({getValue:Q(o,e,{data:i})})}_resetResults(){let{count:t}=this.state.weights;t&&(t.aggregationData=null)}_generateContours(){let{numCol:t,numRow:e,gridOrigin:o,gridOffset:i,thresholdData:r}=this.state,{count:s}=this.state.weights,{aggregationData:a}=s;a||(a=s.aggregationBuffer.readSyncWebGL(),s.aggregationData=a);let{cellWeights:l}=C.getCellData({countsData:a}),c=zo({thresholdData:r,cellWeights:l,gridSize:[t,e],gridOrigin:o,cellSize:[i.xOffset,i.yOffset]});this.setState({contourData:c})}_updateThresholdData(t){let{contours:e,zOffset:o}=t,i=e.length,r=new Array(i);for(let s=0;s<i;s++){let a=e[s];r[s]={contour:a,zIndex:a.zIndex||s,zOffset:o}}this.setState({thresholdData:r})}},_t=kt;(()=>{kt.layerName="ContourLayer"})(),(()=>{kt.defaultProps=hr})();var Ko=M(E(),1);var $o=M(E(),1);var N=M(E(),1),Xo=M(q(),1);var qo=M(q(),1);var ko=`#version 300 es
|
|
391
300
|
#define SHADER_NAME gpu-grid-cell-layer-vertex-shader
|
|
392
301
|
#define RANGE_COUNT 6
|
|
393
|
-
|
|
394
302
|
in vec3 positions;
|
|
395
303
|
in vec3 normals;
|
|
396
|
-
|
|
397
304
|
in vec4 colors;
|
|
398
305
|
in vec4 elevations;
|
|
399
306
|
in vec3 instancePickingColors;
|
|
400
|
-
|
|
401
|
-
// Custom uniforms
|
|
402
307
|
uniform vec2 offset;
|
|
403
308
|
uniform bool extruded;
|
|
404
309
|
uniform float cellSize;
|
|
405
310
|
uniform float coverage;
|
|
406
311
|
uniform float opacity;
|
|
407
312
|
uniform float elevationScale;
|
|
408
|
-
|
|
409
313
|
uniform ivec2 gridSize;
|
|
410
314
|
uniform vec2 gridOrigin;
|
|
411
315
|
uniform vec2 gridOriginLow;
|
|
@@ -413,183 +317,140 @@ uniform vec2 gridOffset;
|
|
|
413
317
|
uniform vec2 gridOffsetLow;
|
|
414
318
|
uniform vec4 colorRange[RANGE_COUNT];
|
|
415
319
|
uniform vec2 elevationRange;
|
|
416
|
-
|
|
417
|
-
// Domain uniforms
|
|
418
320
|
uniform vec2 colorDomain;
|
|
419
321
|
uniform bool colorDomainValid;
|
|
420
322
|
uniform vec2 elevationDomain;
|
|
421
323
|
uniform bool elevationDomainValid;
|
|
422
|
-
|
|
423
324
|
layout(std140) uniform;
|
|
424
325
|
uniform ColorData
|
|
425
326
|
{
|
|
426
|
-
|
|
327
|
+
vec4 maxMinCount;
|
|
427
328
|
} colorData;
|
|
428
329
|
uniform ElevationData
|
|
429
330
|
{
|
|
430
|
-
|
|
331
|
+
vec4 maxMinCount;
|
|
431
332
|
} elevationData;
|
|
432
|
-
|
|
433
333
|
#define EPSILON 0.00001
|
|
434
|
-
|
|
435
|
-
// Result
|
|
436
334
|
out vec4 vColor;
|
|
437
|
-
|
|
438
335
|
vec4 quantizeScale(vec2 domain, vec4 range[RANGE_COUNT], float value) {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
336
|
+
vec4 outColor = vec4(0., 0., 0., 0.);
|
|
337
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
338
|
+
float domainRange = domain.y - domain.x;
|
|
339
|
+
if (domainRange <= 0.) {
|
|
340
|
+
outColor = colorRange[0];
|
|
341
|
+
} else {
|
|
342
|
+
float rangeCount = float(RANGE_COUNT);
|
|
343
|
+
float rangeStep = domainRange / rangeCount;
|
|
344
|
+
float idx = floor((value - domain.x) / rangeStep);
|
|
345
|
+
idx = clamp(idx, 0., rangeCount - 1.);
|
|
346
|
+
int intIdx = int(idx);
|
|
347
|
+
outColor = colorRange[intIdx];
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return outColor;
|
|
351
|
+
}
|
|
456
352
|
float linearScale(vec2 domain, vec2 range, float value) {
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
353
|
+
if (value >= (domain.x - EPSILON) && value <= (domain.y + EPSILON)) {
|
|
354
|
+
return ((value - domain.x) / (domain.y - domain.x)) * (range.y - range.x) + range.x;
|
|
355
|
+
}
|
|
356
|
+
return -1.;
|
|
461
357
|
}
|
|
462
|
-
|
|
463
358
|
void main(void) {
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
496
|
-
|
|
497
|
-
// Light calculations
|
|
498
|
-
// Worldspace is the linear space after Mercator projection
|
|
499
|
-
|
|
500
|
-
vec3 normals_commonspace = project_normal(normals);
|
|
501
|
-
|
|
502
|
-
if (extruded) {
|
|
503
|
-
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
504
|
-
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
505
|
-
} else {
|
|
506
|
-
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
507
|
-
}
|
|
508
|
-
}
|
|
509
|
-
`;var mo=`#version 300 es
|
|
359
|
+
vec2 clrDomain = colorDomainValid ? colorDomain : vec2(colorData.maxMinCount.a, colorData.maxMinCount.r);
|
|
360
|
+
vec4 color = quantizeScale(clrDomain, colorRange, colors.r);
|
|
361
|
+
float elevation = 0.0;
|
|
362
|
+
if (extruded) {
|
|
363
|
+
vec2 elvDomain = elevationDomainValid ? elevationDomain : vec2(elevationData.maxMinCount.a, elevationData.maxMinCount.r);
|
|
364
|
+
elevation = linearScale(elvDomain, elevationRange, elevations.r);
|
|
365
|
+
elevation = elevation * (positions.z + 1.0) / 2.0 * elevationScale;
|
|
366
|
+
}
|
|
367
|
+
float shouldRender = float(color.r > 0.0 && elevations.r >= 0.0);
|
|
368
|
+
float dotRadius = cellSize / 2. * coverage * shouldRender;
|
|
369
|
+
int yIndex = (gl_InstanceID / gridSize[0]);
|
|
370
|
+
int xIndex = gl_InstanceID - (yIndex * gridSize[0]);
|
|
371
|
+
vec2 instancePositionXFP64 = mul_fp64(vec2(gridOffset[0], gridOffsetLow[0]), vec2(float(xIndex), 0.));
|
|
372
|
+
instancePositionXFP64 = sum_fp64(instancePositionXFP64, vec2(gridOrigin[0], gridOriginLow[0]));
|
|
373
|
+
vec2 instancePositionYFP64 = mul_fp64(vec2(gridOffset[1], gridOffsetLow[1]), vec2(float(yIndex), 0.));
|
|
374
|
+
instancePositionYFP64 = sum_fp64(instancePositionYFP64, vec2(gridOrigin[1], gridOriginLow[1]));
|
|
375
|
+
vec3 centroidPosition = vec3(instancePositionXFP64[0], instancePositionYFP64[0], elevation);
|
|
376
|
+
vec3 centroidPosition64Low = vec3(instancePositionXFP64[1], instancePositionYFP64[1], 0.0);
|
|
377
|
+
geometry.worldPosition = centroidPosition;
|
|
378
|
+
vec3 pos = vec3(project_size(positions.xy + offset) * dotRadius, 0.);
|
|
379
|
+
picking_setPickingColor(instancePickingColors);
|
|
380
|
+
gl_Position = project_position_to_clipspace(centroidPosition, centroidPosition64Low, pos, geometry.position);
|
|
381
|
+
vec3 normals_commonspace = project_normal(normals);
|
|
382
|
+
if (extruded) {
|
|
383
|
+
vec3 lightColor = lighting_getLightColor(color.rgb, project_uCameraPosition, geometry.position.xyz, normals_commonspace);
|
|
384
|
+
vColor = vec4(lightColor, color.a * opacity) / 255.;
|
|
385
|
+
} else {
|
|
386
|
+
vColor = vec4(color.rgb, color.a * opacity) / 255.;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
`;var jo=`#version 300 es
|
|
510
390
|
#define SHADER_NAME gpu-grid-cell-layer-fragment-shader
|
|
511
|
-
|
|
512
391
|
precision highp float;
|
|
513
|
-
|
|
514
392
|
in vec4 vColor;
|
|
515
|
-
|
|
516
393
|
out vec4 fragColor;
|
|
517
|
-
|
|
518
394
|
void main(void) {
|
|
519
|
-
|
|
520
|
-
|
|
395
|
+
fragColor = vColor;
|
|
396
|
+
fragColor = picking_filterColor(fragColor);
|
|
521
397
|
}
|
|
522
|
-
`;var
|
|
398
|
+
`;var ae=0,le=1,vr={colorDomain:null,colorRange:D,elevationDomain:null,elevationRange:[0,1e3],elevationScale:{type:"number",min:0,value:1},gridSize:{type:"array",value:[1,1]},gridOrigin:{type:"array",value:[0,0]},gridOffset:{type:"array",value:[0,0]},cellSize:{type:"number",min:0,max:1e3,value:1e3},offset:{type:"array",value:[1,1]},coverage:{type:"number",min:0,max:1,value:1},extruded:!0,material:!0},Xt=class extends N.Layer{getShaders(){return super.getShaders({vs:ko,fs:jo,modules:[N.project32,N.gouraudLighting,N.picking,K]})}initializeState(){this.getAttributeManager().addInstanced({colors:{size:4,noAlloc:!0},elevations:{size:4,noAlloc:!0}});let e=this._getModel();this._setupUniformBuffer(e),this.setState({model:e})}_getModel(){return new qo.Model(this.context.device,{...this.getShaders(),id:this.props.id,geometry:new Xo.CubeGeometry,isInstanced:!0})}draw({uniforms:t}){let{cellSize:e,offset:o,extruded:i,elevationScale:r,coverage:s,gridSize:a,gridOrigin:l,gridOffset:c,elevationRange:g,colorMaxMinBuffer:f,elevationMaxMinBuffer:d}=this.props,p=this.state.model,x=[(0,N.fp64LowPart)(l[0]),(0,N.fp64LowPart)(l[1])],h=[(0,N.fp64LowPart)(c[0]),(0,N.fp64LowPart)(c[1])],A=this.getDomainUniforms(),S=z(this.props.colorRange);this.bindUniformBuffers(f,d),p.setUniforms(t),p.setUniforms(A),p.setUniforms({cellSize:e,offset:o,extruded:i,elevationScale:r,coverage:s,gridSize:a,gridOrigin:l,gridOriginLow:x,gridOffset:c,gridOffsetLow:h,colorRange:S,elevationRange:g}),p.draw(this.context.renderPass),this.unbindUniformBuffers(f,d)}bindUniformBuffers(t,e){t.bind({target:35345,index:ae}),e.bind({target:35345,index:le})}unbindUniformBuffers(t,e){t.unbind({target:35345,index:ae}),e.unbind({target:35345,index:le})}getDomainUniforms(){let{colorDomain:t,elevationDomain:e}=this.props,o={};return t!==null?(o.colorDomainValid=!0,o.colorDomain=t):o.colorDomainValid=!1,e!==null?(o.elevationDomainValid=!0,o.elevationDomain=e):o.elevationDomainValid=!1,o}_setupUniformBuffer(t){let e=t.pipeline.handle,o=this.context.gl,i=o.getUniformBlockIndex(e,"ColorData"),r=o.getUniformBlockIndex(e,"ElevationData");o.uniformBlockBinding(e,i,ae),o.uniformBlockBinding(e,r,le)}},bt=Xt;(()=>{Xt.layerName="GPUGridCellLayer"})(),(()=>{Xt.defaultProps=vr})();var Sr={colorDomain:null,colorRange:D,getColorWeight:{type:"accessor",value:1},colorAggregation:"SUM",elevationDomain:null,elevationRange:[0,1e3],getElevationWeight:{type:"accessor",value:1},elevationAggregation:"SUM",elevationScale:{type:"number",min:0,value:1},cellSize:{type:"number",min:1,max:1e3,value:1e3},coverage:{type:"number",min:0,max:1,value:1},getPosition:{type:"accessor",value:n=>n.position},extruded:!1,material:!0},Ar={data:{props:["cellSize","colorAggregation","elevationAggregation"]}},Yo="positions",qt=class extends w{initializeState({device:t}){let e=C.isSupported(t);e||$o.log.error("GPUGridLayer is not supported on this browser, use GridLayer instead")(),super.initializeAggregationLayer({dimensions:Ar}),this.setState({gpuAggregation:!1,projectPoints:!1,isSupported:e,weights:{color:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})},elevation:{needMin:!0,needMax:!0,combineMaxMin:!0,maxMinBuffer:t.createBuffer({byteLength:4*4,accessor:{size:4,type:5126,divisor:1}})}},positionAttributeName:"positions"}),this.getAttributeManager().add({[Yo]:{size:3,accessor:"getPosition",type:"float64",fp64:this.use64bitPositions()},color:{size:3,accessor:"getColorWeight"},elevation:{size:3,accessor:"getElevationWeight"}})}updateState(t){if(this.state.isSupported===!1)return;super.updateState(t);let{aggregationDirty:e}=this.state;e&&this.setState({gridHash:null})}getHashKeyForIndex(t){let{numRow:e,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,e],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(t/s[0]),g=t-c*s[0],f=Math.floor((c*l[1]+a[1]+90+l[1]/2)/l[1]),d=Math.floor((g*l[0]+a[0]+180+l[0]/2)/l[0]);return`${f}-${d}`}getPositionForIndex(t){let{numRow:e,numCol:o,boundingBox:i,gridOffset:r}=this.state,s=[o,e],a=[i.xMin,i.yMin],l=[r.xOffset,r.yOffset],c=Math.floor(t/s[0]),g=t-c*s[0],f=c*l[1]+a[1];return[g*l[0]+a[0],f]}getPickingInfo({info:t,mode:e}){let{index:o}=t,i=null;if(o>=0){let r=this.state.gpuGridAggregator,s=this.getPositionForIndex(o),a=C.getAggregationData({pixelIndex:o,...r.getData("color")}),l=C.getAggregationData({pixelIndex:o,...r.getData("elevation")});if(i={colorValue:a.cellWeight,elevationValue:l.cellWeight,count:a.cellCount||l.cellCount,position:s,totalCount:a.totalCount||l.totalCount},e!=="hover"){let{props:c}=this,{gridHash:g}=this.state;if(!g){let{gridOffset:p,translation:x,boundingBox:h}=this.state,{viewport:A}=this.context,S=this.getAttributes();g=it(c,{gridOffset:p,attributes:S,viewport:A,translation:x,boundingBox:h}).gridHash,this.setState({gridHash:g})}let f=this.getHashKeyForIndex(o),d=g[f];Object.assign(i,d)}}return t.picked=Boolean(i),t.object=i,t}renderLayers(){if(!this.state.isSupported)return null;let{elevationScale:t,extruded:e,cellSize:o,coverage:i,material:r,elevationRange:s,colorDomain:a,elevationDomain:l}=this.props,{weights:c,numRow:g,numCol:f,gridOrigin:d,gridOffset:p}=this.state,{color:x,elevation:h}=c,A=z(this.props.colorRange),S=this.getSubLayerClass("gpu-grid-cell",bt);return new S({gridSize:[f,g],gridOrigin:d,gridOffset:[p.xOffset,p.yOffset],colorRange:A,elevationRange:s,colorDomain:a,elevationDomain:l,cellSize:o,coverage:i,material:r,elevationScale:t,extruded:e},this.getSubLayerProps({id:"gpu-grid-cell"}),{data:{attributes:{colors:x.aggregationBuffer,elevations:h.aggregationBuffer}},colorMaxMinBuffer:x.maxMinBuffer,elevationMaxMinBuffer:h.maxMinBuffer,numInstances:f*g})}finalizeState(t){let{color:e,elevation:o}=this.state.weights;[e,o].forEach(i=>{let{aggregationBuffer:r,maxMinBuffer:s}=i;s?.destroy(),r?.destroy()}),super.finalizeState(t)}updateAggregationState(t){let{props:e,oldProps:o}=t,{cellSize:i,coordinateSystem:r}=e,{viewport:s}=this.context,a=o.cellSize!==i,{dimensions:l}=this.state,c=this.isAttributeChanged(Yo),g=c||this.isAttributeChanged(),{boundingBox:f}=this.state;if(c&&(f=wt(this.getAttributes(),this.getNumInstances()),this.setState({boundingBox:f})),c||a){let{gridOffset:p,translation:x,width:h,height:A,numCol:S,numRow:y}=It(f,i,s,r);this.allocateResources(y,S),this.setState({gridOffset:p,translation:x,gridOrigin:[-1*x[0],-1*x[1]],width:h,height:A,numCol:S,numRow:y})}let d=g||this.isAggregationDirty(t,{dimension:l.data,compareAll:!0});d&&this._updateAccessors(t),this.setState({aggregationDataDirty:d})}_updateAccessors(t){let{colorAggregation:e,elevationAggregation:o}=t.props,{color:i,elevation:r}=this.state.weights;i.operation=T[e],r.operation=T[o]}},V=qt;(()=>{qt.layerName="GPUGridLayer"})(),(()=>{qt.defaultProps=Sr})();var yr={...V.defaultProps,...H.defaultProps,gpuAggregation:!1},Yt=class extends Ko.CompositeLayer{initializeState(){this.state={useGPUAggregation:!1}}updateState({props:t}){this.setState({useGPUAggregation:!1})}renderLayers(){let{data:t,updateTriggers:e}=this.props,o=this.state.useGPUAggregation?"GPU":"CPU",i=this.state.useGPUAggregation?this.getSubLayerClass("GPU",V):this.getSubLayerClass("CPU",H);return new i(this.props,this.getSubLayerProps({id:o,updateTriggers:e}),{data:t})}canUseGPUAggregation(t){let{gpuAggregation:e,lowerPercentile:o,upperPercentile:i,getColorValue:r,getElevationValue:s,colorScaleType:a}=t;return!(!e||!C.isSupported(this.context.device)||o!==0||i!==100||r!==null||s!==null||a==="quantile"||a==="ordinal")}},Mt=Yt;(()=>{Yt.layerName="GridLayer"})(),(()=>{Yt.defaultProps=yr})();function Zo(n){let t=n.map(a=>a[0]),e=n.map(a=>a[1]),o=Math.min.apply(null,t),i=Math.max.apply(null,t),r=Math.min.apply(null,e),s=Math.max.apply(null,e);return[o,r,i,s]}function Jo(n,t){return t[0]>=n[0]&&t[2]<=n[2]&&t[1]>=n[1]&&t[3]<=n[3]}var Qo=new Float32Array(12);function ce(n,t=2){let e=0;for(let o of n)for(let i=0;i<t;i++)Qo[e++]=o[i]||0;return Qo}function ti(n,t,e){let[o,i,r,s]=n,a=r-o,l=s-i,c=a,g=l;a/l<t/e?c=t/e*l:g=e/t*a,c<t&&(c=t,g=e);let f=(r+o)/2,d=(s+i)/2;return[f-c/2,d-g/2,f+c/2,d+g/2]}function ei(n,t){let[e,o,i,r]=t;return[(n[0]-e)/(i-e),(n[1]-o)/(r-o)]}var pe=M(q(),1),R=M(E(),1);var ri=M(q(),1),$t=M(E(),1);var oi=`#version 300 es
|
|
523
399
|
#define SHADER_NAME heatp-map-layer-vertex-shader
|
|
524
|
-
|
|
525
400
|
uniform sampler2D maxTexture;
|
|
526
401
|
uniform float intensity;
|
|
527
402
|
uniform vec2 colorDomain;
|
|
528
403
|
uniform float threshold;
|
|
529
404
|
uniform float aggregationMode;
|
|
530
|
-
|
|
531
405
|
in vec3 positions;
|
|
532
406
|
in vec2 texCoords;
|
|
533
|
-
|
|
534
407
|
out vec2 vTexCoords;
|
|
535
408
|
out float vIntensityMin;
|
|
536
409
|
out float vIntensityMax;
|
|
537
|
-
|
|
538
410
|
void main(void) {
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
`;var si=`#version 300 es
|
|
411
|
+
gl_Position = project_position_to_clipspace(positions, vec3(0.0), vec3(0.0));
|
|
412
|
+
vTexCoords = texCoords;
|
|
413
|
+
vec4 maxTexture = texture(maxTexture, vec2(0.5));
|
|
414
|
+
float maxValue = aggregationMode < 0.5 ? maxTexture.r : maxTexture.g;
|
|
415
|
+
float minValue = maxValue * threshold;
|
|
416
|
+
if (colorDomain[1] > 0.) {
|
|
417
|
+
maxValue = colorDomain[1];
|
|
418
|
+
minValue = colorDomain[0];
|
|
419
|
+
}
|
|
420
|
+
vIntensityMax = intensity / maxValue;
|
|
421
|
+
vIntensityMin = intensity / minValue;
|
|
422
|
+
}
|
|
423
|
+
`;var ii=`#version 300 es
|
|
553
424
|
#define SHADER_NAME triangle-layer-fragment-shader
|
|
554
|
-
|
|
555
425
|
precision highp float;
|
|
556
|
-
|
|
557
426
|
uniform float opacity;
|
|
558
427
|
uniform sampler2D weightsTexture;
|
|
559
428
|
uniform sampler2D colorTexture;
|
|
560
429
|
uniform float aggregationMode;
|
|
561
|
-
|
|
562
430
|
in vec2 vTexCoords;
|
|
563
431
|
in float vIntensityMin;
|
|
564
432
|
in float vIntensityMax;
|
|
565
|
-
|
|
566
433
|
out vec4 fragColor;
|
|
567
|
-
|
|
568
434
|
vec4 getLinearColor(float value) {
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
435
|
+
float factor = clamp(value * vIntensityMax, 0., 1.);
|
|
436
|
+
vec4 color = texture(colorTexture, vec2(factor, 0.5));
|
|
437
|
+
color.a *= min(value * vIntensityMin, 1.0);
|
|
438
|
+
return color;
|
|
573
439
|
}
|
|
574
|
-
|
|
575
440
|
void main(void) {
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
linearColor.a *= opacity;
|
|
590
|
-
fragColor = linearColor;
|
|
591
|
-
}
|
|
592
|
-
`;var Tt=class extends $e.Layer{getShaders(){return{vs:ri,fs:si,modules:[$e.project32]}}initializeState({device:t}){this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:o,data:i,weightsTexture:r,maxTexture:s,colorTexture:a}=this.props;return new ai.Model(t,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:r,maxTexture:s,colorTexture:a},attributes:i.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:o})}draw({uniforms:t}){let{model:o}=this.state,{intensity:i,threshold:r,aggregationMode:s,colorDomain:a}=this.props;o.setUniforms({...t,intensity:i,threshold:r,aggregationMode:s,colorDomain:a}),o.draw(this.context.renderPass)}},Fe=Tt;(()=>{Tt.layerName="TriangleLayer"})();var ct=`#version 300 es
|
|
441
|
+
vec4 weights = texture(weightsTexture, vTexCoords);
|
|
442
|
+
float weight = weights.r;
|
|
443
|
+
if (aggregationMode > 0.5) {
|
|
444
|
+
weight /= max(1.0, weights.a);
|
|
445
|
+
}
|
|
446
|
+
if (weight <= 0.) {
|
|
447
|
+
discard;
|
|
448
|
+
}
|
|
449
|
+
vec4 linearColor = getLinearColor(weight);
|
|
450
|
+
linearColor.a *= opacity;
|
|
451
|
+
fragColor = linearColor;
|
|
452
|
+
}
|
|
453
|
+
`;var ue=class extends $t.Layer{getShaders(){return{vs:oi,fs:ii,modules:[$t.project32]}}initializeState({device:t}){this.setState({model:this._getModel(t)})}_getModel(t){let{vertexCount:e,data:o,weightsTexture:i,maxTexture:r,colorTexture:s}=this.props;return new ri.Model(t,{...this.getShaders(),id:this.props.id,bindings:{weightsTexture:i,maxTexture:r,colorTexture:s},attributes:o.attributes,bufferLayout:[{name:"positions",format:"float32x3"},{name:"texCoords",format:"float32x2"}],topology:"triangle-fan-webgl",vertexCount:e})}draw({uniforms:t}){let{model:e}=this.state,{intensity:o,threshold:i,aggregationMode:r,colorDomain:s}=this.props;e.setUniforms({...t,intensity:o,threshold:i,aggregationMode:r,colorDomain:s}),e.draw(this.context.renderPass)}},Tt=ue;(()=>{ue.layerName="TriangleLayer"})();var ge=`#version 300 es
|
|
593
454
|
in vec3 positions;
|
|
594
455
|
in vec3 positions64Low;
|
|
595
456
|
in float weights;
|
|
@@ -598,64 +459,51 @@ uniform float radiusPixels;
|
|
|
598
459
|
uniform float textureWidth;
|
|
599
460
|
uniform vec4 commonBounds;
|
|
600
461
|
uniform float weightsScale;
|
|
601
|
-
|
|
602
462
|
void main()
|
|
603
463
|
{
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
614
|
-
gl_Position.w = 1.0;
|
|
615
|
-
}
|
|
616
|
-
`;var gt=`#version 300 es
|
|
464
|
+
weightsTexture = vec4(weights * weightsScale, 0., 0., 1.);
|
|
465
|
+
float radiusTexels = project_pixel_size(radiusPixels) * textureWidth / (commonBounds.z - commonBounds.x);
|
|
466
|
+
gl_PointSize = radiusTexels * 2.;
|
|
467
|
+
vec3 commonPosition = project_position(positions, positions64Low);
|
|
468
|
+
gl_Position.xy = (commonPosition.xy - commonBounds.xy) / (commonBounds.zw - commonBounds.xy) ;
|
|
469
|
+
gl_Position.xy = (gl_Position.xy * 2.) - (1.);
|
|
470
|
+
gl_Position.w = 1.0;
|
|
471
|
+
}
|
|
472
|
+
`;var fe=`#version 300 es
|
|
617
473
|
in vec4 weightsTexture;
|
|
618
474
|
out vec4 fragColor;
|
|
619
|
-
// Epanechnikov function, keeping for reference
|
|
620
|
-
// float epanechnikovKDE(float u) {
|
|
621
|
-
// return 0.75 * (1.0 - u * u);
|
|
622
|
-
// }
|
|
623
475
|
float gaussianKDE(float u){
|
|
624
|
-
|
|
476
|
+
return pow(2.71828, -u*u/0.05555)/(1.77245385*0.166666);
|
|
625
477
|
}
|
|
626
478
|
void main()
|
|
627
479
|
{
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
}
|
|
635
|
-
`;var
|
|
480
|
+
float dist = length(gl_PointCoord - vec2(0.5, 0.5));
|
|
481
|
+
if (dist > 0.5) {
|
|
482
|
+
discard;
|
|
483
|
+
}
|
|
484
|
+
fragColor = weightsTexture * gaussianKDE(2. * dist);
|
|
485
|
+
DECKGL_FILTER_COLOR(fragColor, geometry);
|
|
486
|
+
}
|
|
487
|
+
`;var ni=`#version 300 es
|
|
636
488
|
uniform sampler2D inTexture;
|
|
637
489
|
uniform float textureSize;
|
|
638
490
|
out vec4 outTexture;
|
|
639
|
-
|
|
640
491
|
void main()
|
|
641
492
|
{
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
649
|
-
// Enforce default value for ANGLE issue (https://bugs.chromium.org/p/angleproject/issues/detail?id=3941)
|
|
650
|
-
gl_PointSize = 1.0;
|
|
493
|
+
int yIndex = gl_VertexID / int(textureSize);
|
|
494
|
+
int xIndex = gl_VertexID - (yIndex * int(textureSize));
|
|
495
|
+
vec2 uv = (0.5 + vec2(float(xIndex), float(yIndex))) / textureSize;
|
|
496
|
+
outTexture = texture(inTexture, uv);
|
|
497
|
+
gl_Position = vec4(0.0, 0.0, 0.0, 1.0);
|
|
498
|
+
gl_PointSize = 1.0;
|
|
651
499
|
}
|
|
652
|
-
`;var
|
|
500
|
+
`;var si=`#version 300 es
|
|
653
501
|
in vec4 outTexture;
|
|
654
502
|
out vec4 fragColor;
|
|
655
503
|
void main() {
|
|
656
|
-
|
|
657
|
-
|
|
504
|
+
fragColor = outTexture;
|
|
505
|
+
fragColor.g = outTexture.r / max(1.0, outTexture.a);
|
|
658
506
|
}
|
|
659
|
-
`;var
|
|
507
|
+
`;var _r=2,de={format:"rgba8unorm",mipmaps:!1,sampler:{minFilter:"linear",magFilter:"linear",addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}},ai=[0,0],br={SUM:0,MEAN:1},Mr={getPosition:{type:"accessor",value:n=>n.position},getWeight:{type:"accessor",value:1},intensity:{type:"number",min:0,value:1},radiusPixels:{type:"number",min:1,max:100,value:50},colorRange:D,threshold:{type:"number",min:0,max:1,value:.05},colorDomain:{type:"array",value:null,optional:!0},aggregation:"SUM",weightsTextureSize:{type:"number",min:128,max:2048,value:2048},debounceTimeout:{type:"number",min:0,max:1e3,value:500}},Tr=["float32-renderable-webgl","texture-blend-float-webgl"],Cr={data:{props:["radiusPixels"]}},Kt=class extends P{initializeState(){super.initializeAggregationLayer(Cr),this.setState({colorDomain:ai}),this._setupTextureParams(),this._setupAttributes(),this._setupResources()}shouldUpdateState({changeFlags:t}){return t.somethingChanged}updateState(t){super.updateState(t),this._updateHeatmapState(t)}_updateHeatmapState(t){let{props:e,oldProps:o}=t,i=this._getChangeFlags(t);(i.dataChanged||i.viewportChanged)&&(i.boundsChanged=this._updateBounds(i.dataChanged),this._updateTextureRenderingBounds()),i.dataChanged||i.boundsChanged?(clearTimeout(this.state.updateTimer),this.setState({isWeightMapDirty:!0})):i.viewportZoomChanged&&this._debouncedUpdateWeightmap(),e.colorRange!==o.colorRange&&this._updateColorTexture(t),this.state.isWeightMapDirty&&this._updateWeightmap(),this.setState({zoom:t.context.viewport.zoom})}renderLayers(){let{weightsTexture:t,triPositionBuffer:e,triTexCoordBuffer:o,maxWeightsTexture:i,colorTexture:r,colorDomain:s}=this.state,{updateTriggers:a,intensity:l,threshold:c,aggregation:g}=this.props,f=this.getSubLayerClass("triangle",Tt);return new f(this.getSubLayerProps({id:"triangle-layer",updateTriggers:a}),{coordinateSystem:R.COORDINATE_SYSTEM.DEFAULT,data:{attributes:{positions:e,texCoords:o}},vertexCount:4,maxTexture:i,colorTexture:r,aggregationMode:br[g]||0,weightsTexture:t,intensity:l,threshold:c,colorDomain:s})}finalizeState(t){super.finalizeState(t);let{weightsTransform:e,weightsTexture:o,maxWeightTransform:i,maxWeightsTexture:r,triPositionBuffer:s,triTexCoordBuffer:a,colorTexture:l,updateTimer:c}=this.state;e?.destroy(),o?.destroy(),i?.destroy(),r?.destroy(),s?.destroy(),a?.destroy(),l?.destroy(),c&&clearTimeout(c)}_getAttributeManager(){return new R.AttributeManager(this.context.device,{id:this.props.id,stats:this.context.stats})}_getChangeFlags(t){let e={},{dimensions:o}=this.state;e.dataChanged=this.isAttributeChanged()&&"attribute changed"||this.isAggregationDirty(t,{compareAll:!0,dimension:o.data})&&"aggregation is dirty",e.viewportChanged=t.changeFlags.viewportChanged;let{zoom:i}=this.state;return(!t.context.viewport||t.context.viewport.zoom!==i)&&(e.viewportZoomChanged=!0),e}_createTextures(){let{textureSize:t,format:e}=this.state;this.setState({weightsTexture:this.context.device.createTexture({...de,width:t,height:t,format:e}),maxWeightsTexture:this.context.device.createTexture({...de,width:1,height:1,format:e})})}_setupAttributes(){this.getAttributeManager().add({positions:{size:3,type:"float64",accessor:"getPosition"},weights:{size:1,accessor:"getWeight"}}),this.setState({positionAttributeName:"positions"})}_setupTextureParams(){let{device:t}=this.context,{weightsTextureSize:e}=this.props,o=Math.min(e,t.limits.maxTextureDimension2D),i=Tr.every(a=>t.features.has(a)),r=i?"rgba32float":"rgba8unorm",s=i?1:1/255;this.setState({textureSize:o,format:r,weightsScale:s}),i||R.log.warn(`HeatmapLayer: ${this.id} rendering to float texture not supported, falling back to low precision format`)()}_createWeightsTransform(t){let{weightsTransform:e}=this.state,{weightsTexture:o}=this.state,i=this.getAttributeManager();e?.destroy(),e=new pe.TextureTransform(this.context.device,{id:`${this.id}-weights-transform`,bufferLayout:i.getBufferLayouts(),vertexCount:1,targetTexture:o,parameters:{depthWriteEnabled:!1,blendColorOperation:"add",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"},topology:"point-list",...t}),this.setState({weightsTransform:e})}_setupResources(){this._createTextures();let{device:t}=this.context,{textureSize:e,weightsTexture:o,maxWeightsTexture:i}=this.state,r=this.getShaders({vs:ge,fs:fe});this._createWeightsTransform(r);let s=this.getShaders({vs:ni,fs:si}),a=new pe.TextureTransform(t,{id:`${this.id}-max-weights-transform`,bindings:{inTexture:o},uniforms:{textureSize:e},targetTexture:i,...s,vertexCount:e*e,topology:"point-list",parameters:{depthWriteEnabled:!1,blendColorOperation:"max",blendAlphaOperation:"max",blendColorSrcFactor:"one",blendColorDstFactor:"one",blendAlphaSrcFactor:"one",blendAlphaDstFactor:"one"}});this.setState({weightsTexture:o,maxWeightsTexture:i,maxWeightTransform:a,zoom:null,triPositionBuffer:t.createBuffer({byteLength:48}),triTexCoordBuffer:t.createBuffer({byteLength:48})})}updateShaders(t){this._createWeightsTransform({vs:ge,fs:fe,...t})}_updateMaxWeightValue(){let{maxWeightTransform:t,textureSize:e}=this.state;t.run({parameters:{viewport:[0,0,1,1]},clearColor:[0,0,0,0]})}_updateBounds(t=!1){let{viewport:e}=this.context,o=[e.unproject([0,0]),e.unproject([e.width,0]),e.unproject([e.width,e.height]),e.unproject([0,e.height])].map(a=>a.map(Math.fround)),i=Zo(o),r={visibleWorldBounds:i,viewportCorners:o},s=!1;if(t||!this.state.worldBounds||!Jo(this.state.worldBounds,i)){let a=this._worldToCommonBounds(i),l=this._commonToWorldBounds(a);this.props.coordinateSystem===R.COORDINATE_SYSTEM.LNGLAT&&(l[1]=Math.max(l[1],-85.051129),l[3]=Math.min(l[3],85.051129),l[0]=Math.max(l[0],-360),l[2]=Math.min(l[2],360));let c=this._worldToCommonBounds(l);r.worldBounds=l,r.normalizedCommonBounds=c,s=!0}return this.setState(r),s}_updateTextureRenderingBounds(){let{triPositionBuffer:t,triTexCoordBuffer:e,normalizedCommonBounds:o,viewportCorners:i}=this.state,{viewport:r}=this.context;t.write(ce(i,3));let s=i.map(a=>ei(r.projectPosition(a),o));e.write(ce(s,2))}_updateColorTexture(t){let{colorRange:e}=t.props,{colorTexture:o}=this.state,i=z(e,!1,Uint8Array);o&&o?.width===e.length?o.setSubImageData({data:i}):(o?.destroy(),o=this.context.device.createTexture({...de,data:i,width:e.length,height:1})),this.setState({colorTexture:o})}_updateWeightmap(){let{radiusPixels:t,colorDomain:e,aggregation:o}=this.props,{worldBounds:i,textureSize:r,weightsScale:s}=this.state,a=this.state.weightsTransform;this.state.isWeightMapDirty=!1;let l=this._worldToCommonBounds(i,{useLayerCoordinateSystem:!0});if(e&&o==="SUM"){let{viewport:h}=this.context,A=h.distanceScales.metersPerUnit[2]*(l[2]-l[0])/r;this.state.colorDomain=e.map(S=>S*A*s)}else this.state.colorDomain=e||ai;let g=this.getAttributeManager().getAttributes(),f=this.getModuleSettings(),d=g.positions.buffer,p={radiusPixels:t,commonBounds:l,textureWidth:r,weightsScale:s},x=g.weights.buffer;a.model.setAttributes({positions:d,weights:x}),a.model.setVertexCount(this.getNumInstances()),a.model.setUniforms(p),a.model.updateModuleSettings(f),a.run({parameters:{viewport:[0,0,r,r]},clearColor:[0,0,0,0]}),this._updateMaxWeightValue()}_debouncedUpdateWeightmap(t=!1){let{updateTimer:e}=this.state,{debounceTimeout:o}=this.props;t?(e=null,this._updateBounds(!0),this._updateTextureRenderingBounds(),this.setState({isWeightMapDirty:!0})):(this.setState({isWeightMapDirty:!1}),clearTimeout(e),e=setTimeout(this._debouncedUpdateWeightmap.bind(this,!0),o)),this.setState({updateTimer:e})}_worldToCommonBounds(t,e={}){let{useLayerCoordinateSystem:o=!1}=e,[i,r,s,a]=t,{viewport:l}=this.context,{textureSize:c}=this.state,{coordinateSystem:g}=this.props,f=o&&(g===R.COORDINATE_SYSTEM.LNGLAT_OFFSETS||g===R.COORDINATE_SYSTEM.METER_OFFSETS),d=f?l.projectPosition(this.props.coordinateOrigin):[0,0],p=c*_r/l.scale,x,h;return o&&!f?(x=this.projectPosition([i,r,0]),h=this.projectPosition([s,a,0])):(x=l.projectPosition([i,r,0]),h=l.projectPosition([s,a,0])),ti([x[0]-d[0],x[1]-d[1],h[0]-d[0],h[1]-d[1]],p,p)}_commonToWorldBounds(t){let[e,o,i,r]=t,{viewport:s}=this.context,a=s.unprojectPosition([e,o]),l=s.unprojectPosition([i,r]);return a.slice(0,2).concat(l.slice(0,2))}},Ct=Kt;(()=>{Kt.layerName="HeatmapLayer"})(),(()=>{Kt.defaultProps=Mr})();return pi(Et);})();
|
|
660
508
|
return __exports__;
|
|
661
509
|
});
|