@deck.gl/arcgis 9.0.0-beta.8 → 9.0.0
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/commons.d.ts +26 -0
- package/dist/commons.d.ts.map +1 -0
- package/dist/commons.js +120 -0
- package/dist/deck-layer-view-2d.d.ts +2 -0
- package/dist/deck-layer-view-2d.d.ts.map +1 -0
- package/dist/deck-layer-view-2d.js +44 -0
- package/dist/deck-layer.d.ts +2 -0
- package/dist/deck-layer.d.ts.map +1 -0
- package/dist/deck-layer.js +27 -0
- package/dist/deck-props.d.ts +2 -0
- package/dist/deck-props.d.ts.map +1 -0
- package/dist/deck-props.js +53 -0
- package/dist/deck-renderer.d.ts +14 -0
- package/dist/deck-renderer.d.ts.map +1 -0
- package/dist/deck-renderer.js +49 -0
- package/dist/dist.dev.js +167 -155
- package/dist/index.cjs +360 -0
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/load-modules.d.ts +9 -0
- package/dist/load-modules.d.ts.map +1 -0
- package/dist/load-modules.js +46 -0
- package/dist.min.js +6 -6
- package/package.json +10 -6
- package/src/commons.ts +66 -51
- package/src/{deck-layer-view-2d.js → deck-layer-view-2d.ts} +12 -17
- package/src/deck-renderer.ts +65 -0
- package/src/{load-modules.js → load-modules.ts} +20 -9
- package/src/deck-renderer.js +0 -56
- /package/src/{deck-layer.js → deck-layer.ts} +0 -0
- /package/src/{deck-props.js → deck-props.ts} +0 -0
- /package/src/{index.js → index.ts} +0 -0
package/dist/dist.dev.js
CHANGED
|
@@ -71,7 +71,7 @@ var __exports__ = (() => {
|
|
|
71
71
|
var utils = {
|
|
72
72
|
Promise: isBrowser2 ? window["Promise"] : void 0
|
|
73
73
|
};
|
|
74
|
-
var DEFAULT_VERSION = "4.
|
|
74
|
+
var DEFAULT_VERSION = "4.25";
|
|
75
75
|
var NEXT = "next";
|
|
76
76
|
function parseVersion(version) {
|
|
77
77
|
if (version.toLowerCase() === NEXT) {
|
|
@@ -87,7 +87,7 @@ var __exports__ = (() => {
|
|
|
87
87
|
if (version === void 0) {
|
|
88
88
|
version = DEFAULT_VERSION;
|
|
89
89
|
}
|
|
90
|
-
return "https://js.arcgis.com/"
|
|
90
|
+
return "https://js.arcgis.com/".concat(version, "/");
|
|
91
91
|
}
|
|
92
92
|
function getCdnCssUrl(version) {
|
|
93
93
|
if (version === void 0) {
|
|
@@ -97,9 +97,9 @@ var __exports__ = (() => {
|
|
|
97
97
|
var parsedVersion = parseVersion(version);
|
|
98
98
|
if (parsedVersion !== NEXT && parsedVersion.major === 3) {
|
|
99
99
|
var path = parsedVersion.minor <= 10 ? "js/" : "";
|
|
100
|
-
return ""
|
|
100
|
+
return "".concat(baseUrl).concat(path, "esri/css/esri.css");
|
|
101
101
|
} else {
|
|
102
|
-
return baseUrl
|
|
102
|
+
return "".concat(baseUrl, "esri/themes/light/main.css");
|
|
103
103
|
}
|
|
104
104
|
}
|
|
105
105
|
function createStylesheetLink(href) {
|
|
@@ -117,7 +117,7 @@ var __exports__ = (() => {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
function getCss(url) {
|
|
120
|
-
return document.querySelector('link[href*="'
|
|
120
|
+
return document.querySelector('link[href*="'.concat(url, '"]'));
|
|
121
121
|
}
|
|
122
122
|
function getCssUrl(urlOrVersion) {
|
|
123
123
|
return !urlOrVersion || parseVersion(urlOrVersion) ? getCdnCssUrl(urlOrVersion) : urlOrVersion;
|
|
@@ -155,7 +155,7 @@ var __exports__ = (() => {
|
|
|
155
155
|
}
|
|
156
156
|
function handleScriptError(script, callback) {
|
|
157
157
|
var onScriptError = function(e) {
|
|
158
|
-
callback(e.error || new Error("There was an error attempting to load "
|
|
158
|
+
callback(e.error || new Error("There was an error attempting to load ".concat(script.src)));
|
|
159
159
|
script.removeEventListener("error", onScriptError, false);
|
|
160
160
|
};
|
|
161
161
|
script.addEventListener("error", onScriptError, false);
|
|
@@ -193,7 +193,7 @@ var __exports__ = (() => {
|
|
|
193
193
|
if (script) {
|
|
194
194
|
var src = script.getAttribute("src");
|
|
195
195
|
if (src !== url) {
|
|
196
|
-
reject(new Error("The ArcGIS API for JavaScript is already loaded ("
|
|
196
|
+
reject(new Error("The ArcGIS API for JavaScript is already loaded (".concat(src, ").")));
|
|
197
197
|
} else {
|
|
198
198
|
if (isLoaded()) {
|
|
199
199
|
resolve(script);
|
|
@@ -279,7 +279,7 @@ var __exports__ = (() => {
|
|
|
279
279
|
// bundle.ts
|
|
280
280
|
__reExport(bundle_exports, peer_dependency_exports);
|
|
281
281
|
|
|
282
|
-
//
|
|
282
|
+
// dist/deck-props.js
|
|
283
283
|
var properties = {
|
|
284
284
|
layers: {},
|
|
285
285
|
layerFilter: {},
|
|
@@ -333,7 +333,7 @@ var __exports__ = (() => {
|
|
|
333
333
|
return DeckProps;
|
|
334
334
|
}
|
|
335
335
|
|
|
336
|
-
//
|
|
336
|
+
// dist/deck-layer.js
|
|
337
337
|
function createDeckLayer(DeckProps, Layer2, DeckLayerView2D) {
|
|
338
338
|
return Layer2.createSubclass({
|
|
339
339
|
properties: {
|
|
@@ -351,9 +351,7 @@ var __exports__ = (() => {
|
|
|
351
351
|
layer: this
|
|
352
352
|
});
|
|
353
353
|
}
|
|
354
|
-
console.error(
|
|
355
|
-
"DeckLayer does not support SceneView at the moment. Use DeckRenderer instead."
|
|
356
|
-
);
|
|
354
|
+
console.error("DeckLayer does not support SceneView at the moment. Use DeckRenderer instead.");
|
|
357
355
|
return null;
|
|
358
356
|
}
|
|
359
357
|
});
|
|
@@ -1506,6 +1504,9 @@ var __exports__ = (() => {
|
|
|
1506
1504
|
}
|
|
1507
1505
|
return state;
|
|
1508
1506
|
}
|
|
1507
|
+
function resetGLParameters(gl) {
|
|
1508
|
+
setGLParameters(gl, GL_PARAMETER_DEFAULTS);
|
|
1509
|
+
}
|
|
1509
1510
|
function isObjectEmpty(object) {
|
|
1510
1511
|
for (const key in object) {
|
|
1511
1512
|
return false;
|
|
@@ -2196,12 +2197,8 @@ var __exports__ = (() => {
|
|
|
2196
2197
|
getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
|
|
2197
2198
|
}
|
|
2198
2199
|
*[Symbol.iterator]() {
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
yield feature;
|
|
2202
|
-
}
|
|
2203
|
-
}
|
|
2204
|
-
for (const feature of Object.keys(TEXTURE_FEATURES)) {
|
|
2200
|
+
const features = this.getFeatures();
|
|
2201
|
+
for (const feature of features) {
|
|
2205
2202
|
if (this.has(feature)) {
|
|
2206
2203
|
yield feature;
|
|
2207
2204
|
}
|
|
@@ -2224,9 +2221,14 @@ var __exports__ = (() => {
|
|
|
2224
2221
|
return this.features.has(feature);
|
|
2225
2222
|
}
|
|
2226
2223
|
initializeFeatures() {
|
|
2227
|
-
|
|
2224
|
+
const features = this.getFeatures().filter((feature) => feature !== "polygon-mode-webgl");
|
|
2225
|
+
for (const feature of features) {
|
|
2226
|
+
this.has(feature);
|
|
2228
2227
|
}
|
|
2229
2228
|
}
|
|
2229
|
+
getFeatures() {
|
|
2230
|
+
return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)];
|
|
2231
|
+
}
|
|
2230
2232
|
getWebGLFeature(feature) {
|
|
2231
2233
|
const featureInfo = WEBGL_FEATURES[feature];
|
|
2232
2234
|
const isSupported = typeof featureInfo === "string" ? Boolean(getWebGLExtension(this.gl, featureInfo, this.extensions)) : Boolean(featureInfo);
|
|
@@ -2429,9 +2431,9 @@ var __exports__ = (() => {
|
|
|
2429
2431
|
const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
|
|
2430
2432
|
const ext = extensions.WEBGL_polygon_mode;
|
|
2431
2433
|
if (parameters.polygonMode) {
|
|
2432
|
-
const mode = map("polygonMode", parameters.
|
|
2434
|
+
const mode = map("polygonMode", parameters.polygonMode, {
|
|
2433
2435
|
fill: 6914,
|
|
2434
|
-
|
|
2436
|
+
line: 6913
|
|
2435
2437
|
});
|
|
2436
2438
|
ext?.polygonModeWEBGL(1028, mode);
|
|
2437
2439
|
ext?.polygonModeWEBGL(1029, mode);
|
|
@@ -2551,7 +2553,12 @@ var __exports__ = (() => {
|
|
|
2551
2553
|
"src-alpha": 770,
|
|
2552
2554
|
"one-minus-src-alpha": 771,
|
|
2553
2555
|
"dst-alpha": 772,
|
|
2554
|
-
"one-minus-dst-alpha": 773
|
|
2556
|
+
"one-minus-dst-alpha": 773,
|
|
2557
|
+
"src-alpha-saturated": 776,
|
|
2558
|
+
"constant-color": 32769,
|
|
2559
|
+
"one-minus-constant-color": 32770,
|
|
2560
|
+
"constant-alpha": 32771,
|
|
2561
|
+
"one-minus-constant-alpha": 32772
|
|
2555
2562
|
});
|
|
2556
2563
|
}
|
|
2557
2564
|
function message(parameter, value) {
|
|
@@ -3338,7 +3345,7 @@ var __exports__ = (() => {
|
|
|
3338
3345
|
if (!isDefaultFramebuffer) {
|
|
3339
3346
|
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
3340
3347
|
this.autoCreateAttachmentTextures();
|
|
3341
|
-
this.gl.bindFramebuffer(36160, this.handle);
|
|
3348
|
+
const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
|
|
3342
3349
|
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
3343
3350
|
const attachment = this.colorAttachments[i];
|
|
3344
3351
|
const attachmentPoint = 36064 + i;
|
|
@@ -3355,7 +3362,7 @@ var __exports__ = (() => {
|
|
|
3355
3362
|
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
3356
3363
|
}
|
|
3357
3364
|
}
|
|
3358
|
-
this.gl.bindFramebuffer(36160,
|
|
3365
|
+
this.gl.bindFramebuffer(36160, prevHandle);
|
|
3359
3366
|
}
|
|
3360
3367
|
}
|
|
3361
3368
|
destroy() {
|
|
@@ -3790,10 +3797,10 @@ ${source2}`;
|
|
|
3790
3797
|
}
|
|
3791
3798
|
if (!this.device.features.has("compilation-status-async-webgl")) {
|
|
3792
3799
|
this._getCompilationStatus();
|
|
3800
|
+
this.debugShader();
|
|
3793
3801
|
if (this.compilationStatus === "error") {
|
|
3794
3802
|
throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
|
|
3795
3803
|
}
|
|
3796
|
-
this.debugShader();
|
|
3797
3804
|
return;
|
|
3798
3805
|
}
|
|
3799
3806
|
import_core15.log.once(1, "Shader compilation is asynchronous")();
|
|
@@ -3829,6 +3836,7 @@ ${source2}`;
|
|
|
3829
3836
|
var GL_STENCIL_BUFFER_BIT = 1024;
|
|
3830
3837
|
var GL_COLOR_BUFFER_BIT = 16384;
|
|
3831
3838
|
var GL_COLOR = 6144;
|
|
3839
|
+
var COLOR_CHANNELS = [1, 2, 4, 8];
|
|
3832
3840
|
var WEBGLRenderPass = class extends import_core16.RenderPass {
|
|
3833
3841
|
device;
|
|
3834
3842
|
glParameters;
|
|
@@ -3869,8 +3877,8 @@ ${source2}`;
|
|
|
3869
3877
|
glParameters.viewport = parameters.viewport;
|
|
3870
3878
|
}
|
|
3871
3879
|
}
|
|
3872
|
-
glParameters.scissorTest = Boolean(parameters.scissorRect);
|
|
3873
3880
|
if (parameters.scissorRect) {
|
|
3881
|
+
glParameters.scissorTest = true;
|
|
3874
3882
|
glParameters.scissor = parameters.scissorRect;
|
|
3875
3883
|
}
|
|
3876
3884
|
if (parameters.blendConstant) {
|
|
@@ -3880,6 +3888,9 @@ ${source2}`;
|
|
|
3880
3888
|
console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
|
|
3881
3889
|
parameters[2967] = parameters.stencilReference;
|
|
3882
3890
|
}
|
|
3891
|
+
if (parameters.colorMask) {
|
|
3892
|
+
glParameters.colorMask = COLOR_CHANNELS.map((channel) => Boolean(channel & parameters.colorMask));
|
|
3893
|
+
}
|
|
3883
3894
|
this.glParameters = glParameters;
|
|
3884
3895
|
setGLParameters(this.device.gl, glParameters);
|
|
3885
3896
|
}
|
|
@@ -4532,9 +4543,9 @@ ${source2}`;
|
|
|
4532
4543
|
this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
|
|
4533
4544
|
}
|
|
4534
4545
|
this._linkShaders();
|
|
4535
|
-
import_core18.log.time(
|
|
4546
|
+
import_core18.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4536
4547
|
this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
|
|
4537
|
-
import_core18.log.timeEnd(
|
|
4548
|
+
import_core18.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
|
|
4538
4549
|
this.shaderLayout = (0, import_core19.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
|
|
4539
4550
|
switch (this.props.topology) {
|
|
4540
4551
|
case "triangle-fan-webgl":
|
|
@@ -4550,12 +4561,14 @@ ${source2}`;
|
|
|
4550
4561
|
this.destroyed = true;
|
|
4551
4562
|
}
|
|
4552
4563
|
}
|
|
4553
|
-
setBindings(bindings) {
|
|
4564
|
+
setBindings(bindings, options) {
|
|
4554
4565
|
for (const [name, value] of Object.entries(bindings)) {
|
|
4555
4566
|
const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
|
|
4556
4567
|
if (!binding) {
|
|
4557
4568
|
const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
|
|
4558
|
-
|
|
4569
|
+
if (options?.disableWarnings) {
|
|
4570
|
+
import_core18.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
|
|
4571
|
+
}
|
|
4559
4572
|
continue;
|
|
4560
4573
|
}
|
|
4561
4574
|
if (!value) {
|
|
@@ -4584,13 +4597,15 @@ ${source2}`;
|
|
|
4584
4597
|
draw(options) {
|
|
4585
4598
|
const {
|
|
4586
4599
|
renderPass,
|
|
4600
|
+
parameters = this.props.parameters,
|
|
4601
|
+
topology = this.props.topology,
|
|
4587
4602
|
vertexArray,
|
|
4588
4603
|
vertexCount,
|
|
4589
4604
|
instanceCount,
|
|
4590
4605
|
firstVertex = 0,
|
|
4591
4606
|
transformFeedback
|
|
4592
4607
|
} = options;
|
|
4593
|
-
const glDrawMode = getGLDrawMode(
|
|
4608
|
+
const glDrawMode = getGLDrawMode(topology);
|
|
4594
4609
|
const isIndexed = Boolean(vertexArray.indexBuffer);
|
|
4595
4610
|
const glIndexType = vertexArray.indexBuffer?.glIndexType;
|
|
4596
4611
|
const isInstanced = Number(instanceCount) > 0;
|
|
@@ -4614,7 +4629,7 @@ ${source2}`;
|
|
|
4614
4629
|
this._applyBindings();
|
|
4615
4630
|
this._applyUniforms();
|
|
4616
4631
|
const webglRenderPass = renderPass;
|
|
4617
|
-
withDeviceAndGLParameters(this.device,
|
|
4632
|
+
withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
|
|
4618
4633
|
if (isIndexed && isInstanced) {
|
|
4619
4634
|
this.device.gl.drawElementsInstanced(
|
|
4620
4635
|
glDrawMode,
|
|
@@ -4861,6 +4876,7 @@ ${source2}`;
|
|
|
4861
4876
|
throw new Error("not implemented");
|
|
4862
4877
|
}
|
|
4863
4878
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
4879
|
+
let prevHandle;
|
|
4864
4880
|
try {
|
|
4865
4881
|
const webglBuffer = destination;
|
|
4866
4882
|
const sourceWidth = width || framebuffer.width;
|
|
@@ -4869,11 +4885,13 @@ ${source2}`;
|
|
|
4869
4885
|
const sourceFormat = sourceParams.dataFormat;
|
|
4870
4886
|
const sourceType = sourceParams.type;
|
|
4871
4887
|
device.gl.bindBuffer(35051, webglBuffer.handle);
|
|
4872
|
-
device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4888
|
+
prevHandle = device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4873
4889
|
device.gl.readPixels(origin[0], origin[1], sourceWidth, sourceHeight, sourceFormat, sourceType, byteOffset);
|
|
4874
4890
|
} finally {
|
|
4875
4891
|
device.gl.bindBuffer(35051, null);
|
|
4876
|
-
|
|
4892
|
+
if (prevHandle !== void 0) {
|
|
4893
|
+
device.gl.bindFramebuffer(36160, prevHandle);
|
|
4894
|
+
}
|
|
4877
4895
|
if (destroyFramebuffer) {
|
|
4878
4896
|
framebuffer.destroy();
|
|
4879
4897
|
}
|
|
@@ -4882,19 +4900,19 @@ ${source2}`;
|
|
|
4882
4900
|
function _copyTextureToTexture(device, options) {
|
|
4883
4901
|
const {
|
|
4884
4902
|
source,
|
|
4903
|
+
destinationMipLevel = 0,
|
|
4885
4904
|
origin = [0, 0],
|
|
4905
|
+
destinationOrigin = [0, 0],
|
|
4886
4906
|
destination
|
|
4887
4907
|
} = options;
|
|
4888
4908
|
let {
|
|
4889
4909
|
width = options.destination.width,
|
|
4890
|
-
height = options.destination.
|
|
4910
|
+
height = options.destination.height
|
|
4891
4911
|
} = options;
|
|
4892
|
-
const destinationMipmaplevel = 0;
|
|
4893
|
-
const destinationInternalFormat = 6408;
|
|
4894
4912
|
const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
|
|
4895
4913
|
const [sourceX, sourceY] = origin;
|
|
4896
|
-
const
|
|
4897
|
-
device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4914
|
+
const [destinationX, destinationY, destinationZ] = destinationOrigin;
|
|
4915
|
+
const prevHandle = device.gl.bindFramebuffer(36160, framebuffer.handle);
|
|
4898
4916
|
let texture = null;
|
|
4899
4917
|
let textureTarget;
|
|
4900
4918
|
if (destination instanceof WEBGLTexture) {
|
|
@@ -4902,21 +4920,28 @@ ${source2}`;
|
|
|
4902
4920
|
width = Number.isFinite(width) ? width : texture.width;
|
|
4903
4921
|
height = Number.isFinite(height) ? height : texture.height;
|
|
4904
4922
|
texture.bind(0);
|
|
4905
|
-
textureTarget = texture.
|
|
4923
|
+
textureTarget = texture.target;
|
|
4906
4924
|
} else {
|
|
4907
|
-
throw new Error("
|
|
4925
|
+
throw new Error("invalid destination");
|
|
4908
4926
|
}
|
|
4909
|
-
|
|
4910
|
-
|
|
4911
|
-
|
|
4927
|
+
switch (textureTarget) {
|
|
4928
|
+
case 3553:
|
|
4929
|
+
case 34067:
|
|
4930
|
+
device.gl.copyTexSubImage2D(textureTarget, destinationMipLevel, destinationX, destinationY, sourceX, sourceY, width, height);
|
|
4931
|
+
break;
|
|
4932
|
+
case 35866:
|
|
4933
|
+
case 32879:
|
|
4934
|
+
device.gl.copyTexSubImage3D(textureTarget, destinationMipLevel, destinationX, destinationY, destinationZ, sourceX, sourceY, width, height);
|
|
4935
|
+
break;
|
|
4936
|
+
default:
|
|
4912
4937
|
}
|
|
4913
4938
|
if (texture) {
|
|
4914
4939
|
texture.unbind();
|
|
4915
4940
|
}
|
|
4941
|
+
device.gl.bindFramebuffer(36160, prevHandle);
|
|
4916
4942
|
if (destroyFramebuffer) {
|
|
4917
4943
|
framebuffer.destroy();
|
|
4918
4944
|
}
|
|
4919
|
-
return texture;
|
|
4920
4945
|
}
|
|
4921
4946
|
function getFramebuffer(source) {
|
|
4922
4947
|
if (source instanceof import_core20.Texture) {
|
|
@@ -5004,6 +5029,7 @@ ${source2}`;
|
|
|
5004
5029
|
this.device.gl.bindVertexArray(this.handle);
|
|
5005
5030
|
this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
|
|
5006
5031
|
this.indexBuffer = buffer;
|
|
5032
|
+
this.device.gl.bindVertexArray(null);
|
|
5007
5033
|
}
|
|
5008
5034
|
setBuffer(location, attributeBuffer) {
|
|
5009
5035
|
const buffer = attributeBuffer;
|
|
@@ -5021,19 +5047,14 @@ ${source2}`;
|
|
|
5021
5047
|
this.device.gl.enableVertexAttribArray(location);
|
|
5022
5048
|
this.device.gl.vertexAttribDivisor(location, divisor || 0);
|
|
5023
5049
|
this.attributes[location] = buffer;
|
|
5050
|
+
this.device.gl.bindVertexArray(null);
|
|
5024
5051
|
}
|
|
5025
5052
|
setConstantWebGL(location, value) {
|
|
5026
5053
|
this._enable(location, false);
|
|
5027
5054
|
this.attributes[location] = value;
|
|
5028
5055
|
}
|
|
5029
|
-
init = false;
|
|
5030
5056
|
bindBeforeRender() {
|
|
5031
5057
|
this.device.gl.bindVertexArray(this.handle);
|
|
5032
|
-
if (!this.init) {
|
|
5033
|
-
const webglBuffer = this.indexBuffer;
|
|
5034
|
-
this.device.gl.bindBuffer(34963, webglBuffer?.handle || null);
|
|
5035
|
-
this.init = true;
|
|
5036
|
-
}
|
|
5037
5058
|
this._applyConstantAttributes();
|
|
5038
5059
|
}
|
|
5039
5060
|
unbindAfterRender() {
|
|
@@ -5708,11 +5729,15 @@ ${source2}`;
|
|
|
5708
5729
|
return getGLParameters(this.gl, parameters);
|
|
5709
5730
|
}
|
|
5710
5731
|
withParametersWebGL(parameters, func) {
|
|
5711
|
-
withGLParameters(this.gl, parameters, func);
|
|
5732
|
+
return withGLParameters(this.gl, parameters, func);
|
|
5712
5733
|
}
|
|
5713
5734
|
clearWebGL(options) {
|
|
5714
5735
|
clear(this, options);
|
|
5715
5736
|
}
|
|
5737
|
+
resetWebGL() {
|
|
5738
|
+
import_core28.log.warn("WebGLDevice.resetWebGL is deprecated, use only for debugging")();
|
|
5739
|
+
resetGLParameters(this.gl);
|
|
5740
|
+
}
|
|
5716
5741
|
gl;
|
|
5717
5742
|
debug = false;
|
|
5718
5743
|
_canvasSizeInfo = { clientWidth: 0, clientHeight: 0, devicePixelRatio: 1 };
|
|
@@ -5824,11 +5849,11 @@ ${source2}`;
|
|
|
5824
5849
|
return true;
|
|
5825
5850
|
}
|
|
5826
5851
|
|
|
5827
|
-
//
|
|
5852
|
+
// dist/commons.js
|
|
5828
5853
|
var import_engine = __toESM(require_engine(), 1);
|
|
5829
5854
|
var import_core29 = __toESM(require_core(), 1);
|
|
5830
5855
|
function initializeResources(device) {
|
|
5831
|
-
const
|
|
5856
|
+
const texture = device.createTexture({
|
|
5832
5857
|
format: "rgba8unorm",
|
|
5833
5858
|
width: 1,
|
|
5834
5859
|
height: 1,
|
|
@@ -5839,15 +5864,13 @@ ${source2}`;
|
|
|
5839
5864
|
addressModeV: "clamp-to-edge"
|
|
5840
5865
|
}
|
|
5841
5866
|
});
|
|
5842
|
-
|
|
5843
|
-
this.buffer = device.createBuffer(new Int8Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1]));
|
|
5844
|
-
this.model = new import_engine.Model(device, {
|
|
5867
|
+
const model = new import_engine.Model(device, {
|
|
5845
5868
|
vs: `#version 300 es
|
|
5846
|
-
in vec2
|
|
5869
|
+
in vec2 pos;
|
|
5847
5870
|
out vec2 v_texcoord;
|
|
5848
5871
|
void main(void) {
|
|
5849
|
-
gl_Position = vec4(
|
|
5850
|
-
v_texcoord = (
|
|
5872
|
+
gl_Position = vec4(pos, 0.0, 1.0);
|
|
5873
|
+
v_texcoord = (pos + 1.0) / 2.0;
|
|
5851
5874
|
}
|
|
5852
5875
|
`,
|
|
5853
5876
|
fs: `#version 300 es
|
|
@@ -5862,124 +5885,115 @@ void main(void) {
|
|
|
5862
5885
|
fragColor = imageColor;
|
|
5863
5886
|
}
|
|
5864
5887
|
`,
|
|
5865
|
-
bufferLayout: [{ name: "a_pos", format: "sint8x2" }],
|
|
5866
5888
|
bindings: {
|
|
5867
|
-
deckglTexture
|
|
5889
|
+
deckglTexture: texture
|
|
5868
5890
|
},
|
|
5869
5891
|
parameters: {
|
|
5870
5892
|
depthWriteEnabled: true,
|
|
5871
5893
|
depthCompare: "less-equal"
|
|
5872
5894
|
},
|
|
5873
|
-
|
|
5874
|
-
|
|
5875
|
-
|
|
5876
|
-
|
|
5877
|
-
|
|
5895
|
+
geometry: new import_engine.Geometry({
|
|
5896
|
+
topology: "triangle-strip",
|
|
5897
|
+
attributes: {
|
|
5898
|
+
pos: { size: 2, value: new Int8Array([-1, -1, 1, -1, -1, 1, -1, 1, 1, 1, 1, -1]) }
|
|
5899
|
+
}
|
|
5900
|
+
}),
|
|
5901
|
+
vertexCount: 6
|
|
5878
5902
|
});
|
|
5879
|
-
|
|
5903
|
+
const fbo = device.createFramebuffer({
|
|
5880
5904
|
id: "deckfbo",
|
|
5881
5905
|
width: 1,
|
|
5882
5906
|
height: 1,
|
|
5883
|
-
colorAttachments: [
|
|
5907
|
+
colorAttachments: [texture]
|
|
5884
5908
|
});
|
|
5885
|
-
|
|
5909
|
+
const deckInstance = new import_core29.Deck({
|
|
5886
5910
|
viewState: {},
|
|
5887
5911
|
controller: false,
|
|
5888
|
-
|
|
5912
|
+
device,
|
|
5889
5913
|
parameters: {
|
|
5890
5914
|
depthTest: true
|
|
5891
5915
|
},
|
|
5892
|
-
_framebuffer:
|
|
5916
|
+
_framebuffer: fbo,
|
|
5893
5917
|
width: null,
|
|
5894
5918
|
height: null,
|
|
5895
5919
|
_customRender: (redrawReason) => {
|
|
5896
5920
|
if (redrawReason === "arcgis") {
|
|
5897
|
-
|
|
5921
|
+
deckInstance._drawLayers(redrawReason);
|
|
5898
5922
|
} else {
|
|
5899
5923
|
this.redraw();
|
|
5900
5924
|
}
|
|
5901
5925
|
}
|
|
5902
5926
|
});
|
|
5927
|
+
return { deck: deckInstance, texture, fbo, model };
|
|
5903
5928
|
}
|
|
5904
|
-
function render(
|
|
5905
|
-
const
|
|
5929
|
+
function render(resources, viewport) {
|
|
5930
|
+
const { model, deck, fbo } = resources;
|
|
5931
|
+
const device = model.device;
|
|
5932
|
+
const screenFbo = device.getParametersWebGL(36006);
|
|
5933
|
+
const { width, height, ...viewState } = viewport;
|
|
5906
5934
|
const dpr = window.devicePixelRatio;
|
|
5907
|
-
|
|
5908
|
-
|
|
5909
|
-
|
|
5910
|
-
|
|
5911
|
-
|
|
5912
|
-
const device = this.deckInstance.device;
|
|
5935
|
+
const pixelWidth = Math.round(width * dpr);
|
|
5936
|
+
const pixelHeight = Math.round(height * dpr);
|
|
5937
|
+
fbo.resize({ width: pixelWidth, height: pixelHeight });
|
|
5938
|
+
deck.setProps({ viewState });
|
|
5939
|
+
deck.redraw("arcgis");
|
|
5913
5940
|
const textureToScreenPass = device.beginRenderPass({
|
|
5914
5941
|
framebuffer: screenFbo,
|
|
5915
|
-
parameters: { viewport: [0, 0,
|
|
5942
|
+
parameters: { viewport: [0, 0, pixelWidth, pixelHeight] },
|
|
5916
5943
|
clearColor: [0, 0, 0, 0],
|
|
5917
5944
|
clearDepth: 1
|
|
5918
5945
|
});
|
|
5919
|
-
device.withParametersWebGL(
|
|
5920
|
-
|
|
5921
|
-
|
|
5922
|
-
|
|
5923
|
-
|
|
5924
|
-
|
|
5925
|
-
this.model.setBindings({
|
|
5926
|
-
deckglTexture: this.deckFbo.colorAttachments[0]
|
|
5927
|
-
});
|
|
5928
|
-
this.model.draw(textureToScreenPass);
|
|
5929
|
-
}
|
|
5930
|
-
);
|
|
5946
|
+
device.withParametersWebGL({
|
|
5947
|
+
blend: true,
|
|
5948
|
+
blendFunc: [1, 771]
|
|
5949
|
+
}, () => {
|
|
5950
|
+
model.draw(textureToScreenPass);
|
|
5951
|
+
});
|
|
5931
5952
|
}
|
|
5932
|
-
function finalizeResources() {
|
|
5933
|
-
|
|
5934
|
-
|
|
5935
|
-
|
|
5936
|
-
|
|
5937
|
-
this.deckFbo?.delete();
|
|
5938
|
-
this.deckglTexture?.delete();
|
|
5953
|
+
function finalizeResources(resources) {
|
|
5954
|
+
resources.deck.finalize();
|
|
5955
|
+
resources.model.destroy();
|
|
5956
|
+
resources.fbo.destroy();
|
|
5957
|
+
resources.texture.destroy();
|
|
5939
5958
|
}
|
|
5940
5959
|
|
|
5941
|
-
//
|
|
5960
|
+
// dist/deck-layer-view-2d.js
|
|
5942
5961
|
function createDeckLayerView2D(BaseLayerViewGL2D) {
|
|
5943
5962
|
return BaseLayerViewGL2D.createSubclass({
|
|
5944
5963
|
properties: {
|
|
5945
|
-
|
|
5946
|
-
deckFbo: {},
|
|
5947
|
-
model: {},
|
|
5948
|
-
buffer: {}
|
|
5964
|
+
resources: null
|
|
5949
5965
|
},
|
|
5950
5966
|
attach() {
|
|
5951
5967
|
const gl = this.context;
|
|
5952
5968
|
const device = WebGLDevice.attach(gl);
|
|
5953
|
-
initializeResources.call(this, device);
|
|
5954
|
-
this.layer.deck.on("change", (props) => this.
|
|
5955
|
-
this.
|
|
5969
|
+
this.resources = initializeResources.call(this, device);
|
|
5970
|
+
this.layer.deck.on("change", (props) => this.resources.deck.setProps(props));
|
|
5971
|
+
this.resources.deck.setProps(this.layer.deck.toJSON());
|
|
5956
5972
|
},
|
|
5957
5973
|
redraw() {
|
|
5958
5974
|
this.requestRender();
|
|
5959
5975
|
},
|
|
5960
5976
|
detach() {
|
|
5961
|
-
finalizeResources
|
|
5977
|
+
finalizeResources(this.resources);
|
|
5978
|
+
this.resources = null;
|
|
5962
5979
|
},
|
|
5963
5980
|
render(renderParameters) {
|
|
5964
5981
|
const [width, height] = this.view.state.size;
|
|
5965
5982
|
const state = renderParameters.state;
|
|
5966
|
-
render
|
|
5967
|
-
gl: renderParameters.context,
|
|
5983
|
+
render(this.resources, {
|
|
5968
5984
|
width,
|
|
5969
5985
|
height,
|
|
5970
|
-
|
|
5971
|
-
|
|
5972
|
-
|
|
5973
|
-
|
|
5974
|
-
|
|
5975
|
-
pitch: 0
|
|
5976
|
-
}
|
|
5986
|
+
latitude: this.view.center.latitude,
|
|
5987
|
+
longitude: this.view.center.longitude,
|
|
5988
|
+
zoom: this.view.featuresTilingScheme.scaleToLevel(state.scale),
|
|
5989
|
+
bearing: -state.rotation,
|
|
5990
|
+
pitch: 0
|
|
5977
5991
|
});
|
|
5978
5992
|
}
|
|
5979
5993
|
});
|
|
5980
5994
|
}
|
|
5981
5995
|
|
|
5982
|
-
//
|
|
5996
|
+
// dist/deck-renderer.js
|
|
5983
5997
|
function arcgisFOVToDeckAltitude(fov, aspectRatio) {
|
|
5984
5998
|
const D = Math.sqrt(1 + aspectRatio ** 2);
|
|
5985
5999
|
const halfFOV = fov / 2 / 180 * Math.PI;
|
|
@@ -5988,44 +6002,46 @@ void main(void) {
|
|
|
5988
6002
|
function createDeckRenderer(DeckProps, externalRenderers) {
|
|
5989
6003
|
class DeckRenderer {
|
|
5990
6004
|
constructor(view, props) {
|
|
6005
|
+
this.resources = null;
|
|
5991
6006
|
this.view = view;
|
|
5992
6007
|
this.deck = new DeckProps(props);
|
|
5993
6008
|
}
|
|
5994
6009
|
setup(context) {
|
|
5995
6010
|
const gl = context.gl;
|
|
5996
|
-
|
|
5997
|
-
|
|
5998
|
-
this.
|
|
6011
|
+
const device = WebGLDevice.attach(gl);
|
|
6012
|
+
const resources = initializeResources.call(this, device);
|
|
6013
|
+
this.deck.on("change", (props) => resources.deck.setProps(props));
|
|
6014
|
+
resources.deck.setProps(this.deck.toJSON());
|
|
6015
|
+
this.resources = resources;
|
|
5999
6016
|
}
|
|
6000
6017
|
dispose() {
|
|
6001
|
-
|
|
6018
|
+
if (this.resources) {
|
|
6019
|
+
finalizeResources(this.resources);
|
|
6020
|
+
}
|
|
6002
6021
|
}
|
|
6003
6022
|
redraw() {
|
|
6004
6023
|
externalRenderers.requestRender(this.view);
|
|
6005
6024
|
}
|
|
6006
|
-
render(
|
|
6025
|
+
render() {
|
|
6007
6026
|
const [width, height] = this.view.size;
|
|
6008
|
-
render
|
|
6009
|
-
gl: context.gl,
|
|
6027
|
+
render(this.resources, {
|
|
6010
6028
|
width,
|
|
6011
6029
|
height,
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
pitch: this.view.camera.tilt
|
|
6019
|
-
}
|
|
6030
|
+
latitude: this.view.center.latitude,
|
|
6031
|
+
longitude: this.view.center.longitude,
|
|
6032
|
+
altitude: arcgisFOVToDeckAltitude(this.view.camera.fov, width / height),
|
|
6033
|
+
zoom: this.view.zoom,
|
|
6034
|
+
bearing: this.view.camera.heading,
|
|
6035
|
+
pitch: this.view.camera.tilt
|
|
6020
6036
|
});
|
|
6021
6037
|
}
|
|
6022
6038
|
}
|
|
6023
6039
|
return DeckRenderer;
|
|
6024
6040
|
}
|
|
6025
6041
|
|
|
6026
|
-
//
|
|
6042
|
+
// dist/load-modules.js
|
|
6027
6043
|
var import_esri_loader = __toESM(require_esri_loader(), 1);
|
|
6028
|
-
var arcGIS
|
|
6044
|
+
var arcGIS;
|
|
6029
6045
|
async function loadArcGISModules(modules, loadScriptOptions) {
|
|
6030
6046
|
const namespace = Array.isArray(modules) ? null : modules;
|
|
6031
6047
|
await loadArcGISModule(namespace, loadScriptOptions);
|
|
@@ -6036,28 +6052,24 @@ void main(void) {
|
|
|
6036
6052
|
}
|
|
6037
6053
|
return arcGIS;
|
|
6038
6054
|
}
|
|
6039
|
-
function loadArcGISModule(esri, loadScriptOptions) {
|
|
6055
|
+
async function loadArcGISModule(esri, loadScriptOptions) {
|
|
6040
6056
|
if (arcGIS) {
|
|
6041
6057
|
return arcGIS;
|
|
6042
6058
|
}
|
|
6043
6059
|
if (esri) {
|
|
6044
|
-
const
|
|
6045
|
-
const
|
|
6046
|
-
const
|
|
6047
|
-
const
|
|
6048
|
-
return initialize(
|
|
6049
|
-
}
|
|
6050
|
-
|
|
6051
|
-
|
|
6052
|
-
|
|
6053
|
-
|
|
6054
|
-
|
|
6055
|
-
|
|
6056
|
-
|
|
6057
|
-
loadScriptOptions
|
|
6058
|
-
).then(([Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers]) => {
|
|
6059
|
-
return initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers);
|
|
6060
|
-
});
|
|
6060
|
+
const Layer3 = esri.layers.Layer;
|
|
6061
|
+
const Accessor3 = esri.core.Accessor;
|
|
6062
|
+
const BaseLayerViewGL2D2 = esri.views["2d"].layers.BaseLayerViewGL2D;
|
|
6063
|
+
const externalRenderers2 = esri.views["3d"].externalRenderers;
|
|
6064
|
+
return initialize(Layer3, Accessor3, BaseLayerViewGL2D2, externalRenderers2);
|
|
6065
|
+
}
|
|
6066
|
+
const [Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers] = await (0, import_esri_loader.loadModules)([
|
|
6067
|
+
"esri/layers/Layer",
|
|
6068
|
+
"esri/core/Accessor",
|
|
6069
|
+
"esri/views/2d/layers/BaseLayerViewGL2D",
|
|
6070
|
+
"esri/views/3d/externalRenderers"
|
|
6071
|
+
], loadScriptOptions);
|
|
6072
|
+
return initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers);
|
|
6061
6073
|
}
|
|
6062
6074
|
function initialize(Layer2, Accessor2, BaseLayerViewGL2D, externalRenderers) {
|
|
6063
6075
|
const DeckProps = createDeckProps(Accessor2);
|