@arcgis/core 5.2.0-next.169 → 5.2.0-next.170

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.
Files changed (62) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/18e7fa4d3e0b1a084cc6.js +1 -0
  3. package/assets/esri/core/workers/chunks/6de64abd9e2b51fa2872.js +1 -0
  4. package/assets/esri/core/workers/chunks/7697bbbaf3724f8c4445.js +1 -0
  5. package/assets/esri/core/workers/chunks/86524ae8926228898d95.js +1 -0
  6. package/assets/esri/core/workers/chunks/{1b24a40c0fa197014873.js → 9c33e67bb6f93f6529bb.js} +1 -1
  7. package/assets/esri/core/workers/chunks/b71029a2ab7dbb3706f9.js +1 -0
  8. package/assets/esri/core/workers/chunks/b7c4bb0f3f9662bac726.js +1 -0
  9. package/assets/esri/core/workers/chunks/bc6fdd9faf8ed54be0cb.js +1 -0
  10. package/assets/esri/core/workers/chunks/bec375ff37c25a49e080.js +1 -0
  11. package/assets/esri/views/3d/environment/resources/milkyway-band.avif +0 -0
  12. package/chunks/EmissionComposite.glsl.js +1 -1
  13. package/chunks/Fog.glsl.js +1 -1
  14. package/chunks/RibbonLine.glsl.js +176 -95
  15. package/config.d.ts +12 -9
  16. package/config.js +1 -1
  17. package/core/Collection.js +1 -1
  18. package/form/FormTemplate.d.ts +1 -1
  19. package/form/elements/AttachmentElement.d.ts +2 -0
  20. package/form/elements/FieldElement.d.ts +2 -2
  21. package/form/elements/FieldElement.js +1 -1
  22. package/form/elements/RelationshipElement.d.ts +1 -1
  23. package/form/elements/TextElement.d.ts +2 -2
  24. package/form/elements/UtilityNetworkAssociationsElement.d.ts +1 -1
  25. package/form/elements/inputs/inputUtils.js +1 -1
  26. package/form/elements/inputs/types.d.ts +19 -0
  27. package/form/elements/inputs.d.ts +3 -2
  28. package/form/elements/inputs.js +1 -1
  29. package/kernel.js +1 -1
  30. package/layers/knowledgeGraph/KnowledgeGraphSublayer.js +1 -1
  31. package/layers/save/parquetLayerUtils.js +1 -1
  32. package/package.json +2 -2
  33. package/rest/route.d.ts +1 -1
  34. package/rest/support/AreasAndLengthsParameters.d.ts +1 -1
  35. package/rest/support/LengthsParameters.d.ts +1 -1
  36. package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
  37. package/views/2d/layers/GeospatialPDFLayerView2D.js +1 -1
  38. package/views/3d/terrain/ExtentHelper.js +1 -1
  39. package/views/3d/terrain/TerrainRenderer.js +1 -1
  40. package/views/3d/terrain/TerrainSurface.js +1 -1
  41. package/views/3d/terrain/tileUtils.js +1 -1
  42. package/views/3d/webgl-engine/effects/fog/Fog.js +1 -1
  43. package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +3 -3
  44. package/views/3d/webgl-engine/effects/stars/Stars.js +1 -1
  45. package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
  46. package/views/3d/webgl-engine/shaders/EmissiveTechniqueConfiguration.js +1 -1
  47. package/views/input/InputManager.js +1 -1
  48. package/views/layers/LayerView.d.ts +10 -2
  49. package/widgets/BatchAttributeForm/inputs/FieldInput.d.ts +2 -2
  50. package/widgets/Editor/EditorViewModel.d.ts +10 -12
  51. package/widgets/FeatureTable/support/EditableColumnTemplateMixin.js +1 -1
  52. package/widgets/HistogramRangeSlider.d.ts +1 -1
  53. package/widgets/OrientedImageryViewer/adapters/view/SceneViewAdapter.js +1 -1
  54. package/assets/esri/core/workers/chunks/6f897b4e7ddd1dd1672b.js +0 -1
  55. package/assets/esri/core/workers/chunks/9e04703ee5f5ec47db43.js +0 -1
  56. package/assets/esri/core/workers/chunks/9f358c7b052cdc0ac06f.js +0 -1
  57. package/assets/esri/core/workers/chunks/a43b33955aa78a2a8deb.js +0 -1
  58. package/assets/esri/core/workers/chunks/b5b9d42e1f84ee82429c.js +0 -1
  59. package/assets/esri/core/workers/chunks/c9feffb9884cfed52c4b.js +0 -1
  60. package/assets/esri/core/workers/chunks/cdacc3e42f01c3b852d6.js +0 -1
  61. package/assets/esri/core/workers/chunks/feb6e041dd0aa1c59c31.js +0 -1
  62. package/layers/geospatialPDF/CIM2DLayerview.js +0 -2
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{sliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{evaluateSceneLightingFragment as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/evaluateSceneLightingFragment.glsl.js";import{LineStipple as r,computePixelSize as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{NormalUtils as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PiUtils as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{positionOutsideClipSpace as c}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{metersPerRenderUnit as l,screenPixelSizePerDistance as u,inverseProjectionMatrix as d,nearFar as f,viewport as p}from"../views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js";import{ColorConversion as ee}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{NoPerspectiveWrite as m,NoPerspectiveRead as h}from"../views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js";import{addProjViewLocalOrigin as g,addPixelRatio as _}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as y}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as b}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as x,If as S}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{alphaCutoff as C}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{animatedAlpha as w}from"../views/3d/webgl-engine/shaders/animatedAlpha.glsl.js";import{outputColorHighlightOLID as T}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as E}from"../views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js";import{ShaderBuilder as te}from"../views/webgl/ShaderBuilder.js";const D=1;function O(D){let O=new te,{attributes:k,varyings:A,vertex:j,fragment:M}=O,{applyMarkerOffset:N,draped:P,shadingEnabled:F,output:I,capType:L,stippleEnabled:R,falloffEnabled:z,wireframe:B,innerColorEnabled:V,hasAnimation:H,hasScreenSizePerspective:U,worldSized:W,imagePattern:G,useFlatJoinVarying:K}=D,q=L===2,J=R&&q,Y=z||J,X=R||q,Z=D.usePerspectiveCorrectStipple,Q=E(D).createBuilder(O,D);j.inputs.add(`position`,()=>Q.getTextureAttribute(`position`)),D.hasVVSize?j.inputs.add(`sizeFeatureAttribute`,()=>Q.getTextureAttribute(`sizeFeatureAttribute`)):j.inputs.add(`size`,()=>Q.getTextureAttribute(`size`)),D.hasVVOpacity&&j.inputs.add(`opacityFeatureAttribute`,()=>Q.getTextureAttribute(`opacityFeatureAttribute`)),D.hasVVColor?j.inputs.add(`colorFeatureAttribute`,()=>Q.getTextureAttribute(`colorFeatureAttribute`)):j.inputs.add(`color`,()=>Q.getTextureAttribute(`color`)),M.include(s),O.include(t,D),O.include(r,D),I===11?(O.varyings.add(`objectAndLayerIdColorVarying`,`vec4`),j.code.add(x`
2
+ import{sliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{RibbonVertexPosition as t}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{evaluateSceneLightingFragment as n}from"../views/3d/webgl-engine/core/shaderLibrary/shading/evaluateSceneLightingFragment.glsl.js";import{LineStipple as r,computePixelSize as ee}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{NormalUtils as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/NormalUtils.glsl.js";import{PiUtils as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{positionOutsideClipSpace as s}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{metersPerRenderUnit as c,screenPixelSizePerDistance as l,inverseProjectionMatrix as u,nearFar as d,viewport as f}from"../views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js";import{ColorConversion as te}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{NoPerspectiveWrite as ne,NoPerspectiveRead as p}from"../views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js";import{addProjViewLocalOrigin as m,addPixelRatio as h}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float4PassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as _}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as y,If as b}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{alphaCutoff as x}from"../views/3d/webgl-engine/shaders/alphaCutoff.glsl.js";import{animatedAlpha as S}from"../views/3d/webgl-engine/shaders/animatedAlpha.glsl.js";import{outputColorHighlightOLID as C}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as w}from"../views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js";import{ShaderBuilder as T}from"../views/webgl/ShaderBuilder.js";const E=1;function D(E){let D=new T,{attributes:O,varyings:k,vertex:A,fragment:j}=D,{applyMarkerOffset:M,draped:N,shadingEnabled:P,output:F,capType:I,stippleEnabled:L,falloffEnabled:R,wireframe:z,innerColorEnabled:B,hasAnimation:V,hasScreenSizePerspective:H,worldSized:U,imagePattern:W,useFlatJoinVarying:G}=E,K=I===2,q=L&&K,J=R||q,Y=L||K,X=U&&!N,Z=E.usePerspectiveCorrectStipple,Q=w(E).createBuilder(D,E);A.inputs.add(`position`,()=>Q.getTextureAttribute(`position`)),E.hasVVSize?A.inputs.add(`sizeFeatureAttribute`,()=>Q.getTextureAttribute(`sizeFeatureAttribute`)):A.inputs.add(`size`,()=>Q.getTextureAttribute(`size`)),E.hasVVOpacity&&A.inputs.add(`opacityFeatureAttribute`,()=>Q.getTextureAttribute(`opacityFeatureAttribute`)),E.hasVVColor?A.inputs.add(`colorFeatureAttribute`,()=>Q.getTextureAttribute(`colorFeatureAttribute`)):A.inputs.add(`color`,()=>Q.getTextureAttribute(`color`)),j.include(o),D.include(t,E),D.include(r,E),F===11?(D.varyings.add(`objectAndLayerIdColorVarying`,`vec4`),A.code.add(y`
3
3
  vec4 getOlidColor() {
4
4
  return ${Q.getTextureAttribute(`olidColor`)};
5
5
  }
@@ -7,9 +7,9 @@ import{sliceDraw as e}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.gls
7
7
  void forwardObjectAndLayerIdColor() {
8
8
  objectAndLayerIdColorVarying = getOlidColor();
9
9
  }
10
- `),M.code.add(x`void outputObjectAndLayerIdColor() {
10
+ `),j.code.add(y`void outputObjectAndLayerIdColor() {
11
11
  fragColor = objectAndLayerIdColorVarying;
12
- }`)):(j.code.add(x`void forwardObjectAndLayerIdColor() {}`),M.code.add(x`void outputObjectAndLayerIdColor() {}`));let $=N&&!P;if($&&O.include(a,D),g(j,D),P&&(W||R)){let e=W?`groundMetersToScreenRatio`:`planarDistanceToScreenRatio`;j.uniforms.add(new y(e,e=>1/(e.screenToPlanarDistanceRatio*(W?e.planarDistanceToGroundRatio:1))))}return W&&!P&&j.uniforms.add(l,u),j.uniforms.add(d,f,p,new b(`miterLimit`,e=>e.join===`miter`?e.miterLimit:0)),j.constants.add(`LARGE_HALF_FLOAT`,`float`,65500),j.constants.add(`EPS`,`float`,.001),j.constants.add(`NUM_JOIN_SUBDIVISIONS`,`float`,D.numJoinSubdivisions),k.add(`textureElementIndex`,`uint`),k.add(`lineParameters`,`vec2`),A.add(`vColor`,`vec4`),A.add(`vpos`,`vec3`,{invariant:!0}),A.add(`vLineDistance`,`float`),A.add(`vLineWidth`,`float`),K?A.add(`vIsInsideJoin`,`int`,{flat:!0}):A.add(`vIsInsideJoin`,`float`),A.add(`vStretchFactor`,`float`),A.add(`vJoinCenterLineSDFs`,`vec2`),A.add(`vSubdivisionFactor`,`float`),R&&A.add(`vLineSizeInv`,`float`),Y&&A.add(`vLineDistanceNorm`,`float`),q&&(A.add(`vSegmentSDF`,`float`),A.add(`vReverseSegmentSDF`,`float`)),j.code.add(x`vec3 perpendicular(vec3 v) {
12
+ }`)):(A.code.add(y`void forwardObjectAndLayerIdColor() {}`),j.code.add(y`void outputObjectAndLayerIdColor() {}`));let $=M&&!N;if($&&D.include(i,E),m(A,E),N&&(U||L)){let e=U?`groundMetersToScreenRatio`:`planarDistanceToScreenRatio`;A.uniforms.add(new _(e,e=>1/(e.screenToPlanarDistanceRatio*(U?e.planarDistanceToGroundRatio:1))))}return X&&A.uniforms.add(c,l),A.uniforms.add(u,d,f,new v(`miterLimit`,e=>e.join===`miter`?e.miterLimit:0)),A.constants.add(`LARGE_HALF_FLOAT`,`float`,65500),A.constants.add(`EPS`,`float`,.001),A.constants.add(`NUM_JOIN_SUBDIVISIONS`,`float`,E.numJoinSubdivisions),O.add(`textureElementIndex`,`uint`),O.add(`lineParameters`,`vec2`),k.add(`vColor`,`vec4`),k.add(`vpos`,`vec3`,{invariant:!0}),k.add(`vLineDistance`,`float`),k.add(`vLineWidth`,`float`),G?k.add(`vIsInsideJoin`,`int`,{flat:!0}):k.add(`vIsInsideJoin`,`float`),k.add(`vStretchFactor`,`float`),k.add(`vJoinCenterLineSDFs`,`vec2`),X&&k.add(`vJoinLineWidths`,`vec2`),k.add(`vSubdivisionFactor`,`float`),L&&k.add(`vLineSizeInv`,`float`),J&&k.add(`vLineDistanceNorm`,`float`),K&&(k.add(`vSegmentSDF`,`float`),k.add(`vReverseSegmentSDF`,`float`)),A.code.add(y`vec3 perpendicular(vec3 v) {
13
13
  return vec3(v.y, -v.x, 0.0);
14
14
  }
15
15
  float nearPlaneInterpolationFactor(float nearPlaneDistance, vec4 start, vec4 end) {
@@ -20,17 +20,17 @@ float s = sin(a);
20
20
  float c = cos(a);
21
21
  mat2 m = mat2(c, -s, s, c);
22
22
  return vec3(m * v.xy, v.z);
23
- }`),j.code.add(x`vec4 projectAndScale(vec4 pos) {
23
+ }`),A.code.add(y`vec4 projectAndScale(vec4 pos) {
24
24
  vec4 posNdc = proj * pos;
25
25
  posNdc.xy *= viewport.zw / posNdc.w;
26
26
  posNdc.z /= posNdc.w;
27
27
  return posNdc;
28
- }`),j.code.add(x`
28
+ }`),A.code.add(y`
29
29
  void clip(
30
30
  inout vec4 pos,
31
31
  inout vec4 prev,
32
32
  inout vec4 next,
33
- ${S(Z,x`inout float u0, inout float prevU0, inout float nextU0,`)}
33
+ ${b(Z,y`inout float u0, inout float prevU0, inout float nextU0,`)}
34
34
  bool isStartVertex
35
35
  ) {
36
36
  float adjustedNearPlaneDistance = nearFar[0] * 0.99;
@@ -41,7 +41,7 @@ return posNdc;
41
41
  if (prev.z < -nearFar[0]) {
42
42
  // Previous position in front of near plane
43
43
  float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, prev, pos);
44
- ${S(Z,x`u0 = mix(prevU0, u0, clipFactor); nextU0 = u0;`)}
44
+ ${b(Z,y`u0 = mix(prevU0, u0, clipFactor); nextU0 = u0;`)}
45
45
  pos = mix(prev, pos, clipFactor);
46
46
  next = pos;
47
47
  } else {
@@ -51,7 +51,7 @@ return posNdc;
51
51
  if (next.z < -nearFar[0]) {
52
52
  // Next position in front of near plane
53
53
  float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, pos, next);
54
- ${S(Z,x`u0 = mix(u0, nextU0, clipFactor); prevU0 = u0;`)}
54
+ ${b(Z,y`u0 = mix(u0, nextU0, clipFactor); prevU0 = u0;`)}
55
55
  pos = mix(pos, next, clipFactor);
56
56
  prev = pos;
57
57
  } else {
@@ -63,25 +63,25 @@ return posNdc;
63
63
  if (prev.z > -nearFar[0]) {
64
64
  // Previous position behind near plane
65
65
  float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, pos, prev);
66
- ${S(Z,x`prevU0 = mix(u0, prevU0, clipFactor);`)}
66
+ ${b(Z,y`prevU0 = mix(u0, prevU0, clipFactor);`)}
67
67
  prev = mix(pos, prev, clipFactor);
68
68
  }
69
69
 
70
70
  if (next.z > -nearFar[0]) {
71
71
  // Next position behind near plane
72
72
  float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, next, pos);
73
- ${S(Z,x`nextU0 = mix(nextU0, u0, clipFactor);`)}
73
+ ${b(Z,y`nextU0 = mix(nextU0, u0, clipFactor);`)}
74
74
  next = mix(next, pos, clipFactor);
75
75
  }
76
76
  }
77
77
  }
78
- `),_(j),j.constants.add(`aaWidth`,`float`,1),M.constants.add(`aaWidth`,`float`,1),j.main.add(x`
78
+ `),h(A),A.constants.add(`aaWidth`,`float`,1),j.constants.add(`aaWidth`,`float`,1),A.main.add(y`
79
79
  vec3 position = ${Q.getTextureAttribute(`position`)};
80
80
  float u0 = ${Q.getTextureAttribute(`u0`)};
81
- ${S(W,x`
81
+ ${b(U,y`
82
82
  float prevU0 = ${Q.getTextureAttribute(`u0`,-1)};
83
83
  float nextU0 = ${Q.getTextureAttribute(`u0`,1)};
84
- ${S(!P,x`
84
+ ${b(!N,y`
85
85
  u0 *= metersPerRenderUnit;
86
86
  prevU0 *= metersPerRenderUnit;
87
87
  nextU0 *= metersPerRenderUnit;
@@ -90,7 +90,7 @@ return posNdc;
90
90
 
91
91
  // unpack values from vertex type
92
92
  float vertexType = abs(lineParameters.y);
93
- ${S(!K,x`
93
+ ${b(!G,y`
94
94
  bool isInsideJoin = vertexType > 8.0;
95
95
  vertexType -= isInsideJoin ? 8.0 : 0.0;
96
96
  `)}
@@ -102,7 +102,7 @@ return posNdc;
102
102
  // Check for special value of lineParameters.y which is used by the Renderer when graphics are removed before the
103
103
  // VBO is recompacted. If this is the case, then we just project outside of clip space.
104
104
  if (lineParameters.y == 0.0) {
105
- gl_Position = ${c};
105
+ gl_Position = ${s};
106
106
  }
107
107
  else {
108
108
  vec4 pos = view * vec4(position, 1.0);
@@ -110,11 +110,47 @@ return posNdc;
110
110
  vec4 next = view * vec4(nextPosition, 1.0);
111
111
 
112
112
  bool isJoin = vertexType < 3.0;
113
- `),$&&j.main.add(x`vec4 other = isStartVertex ? next : prev;
113
+ `),$&&A.main.add(y`vec4 other = isStartVertex ? next : prev;
114
114
  bool markersHidden = areWorldMarkersHidden(pos.xyz, other.xyz);
115
115
  if (!isJoin && !markersHidden) {
116
116
  pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
117
- }`),O.include(m),j.code.add(x`
117
+ }`),D.include(ne),X&&A.code.add(y`vec2 computePerspectiveInnerJoin(
118
+ vec2 leftDirection,
119
+ vec2 rightDirection,
120
+ float leftLength,
121
+ float rightLength,
122
+ float previousWidth,
123
+ float currentWidth,
124
+ float nextWidth,
125
+ float lineSide,
126
+ bool isStartVertex
127
+ ) {
128
+ vec2 leftNormal = vec2(leftDirection.y, -leftDirection.x) * lineSide;
129
+ vec2 rightNormal = vec2(rightDirection.y, -rightDirection.x) * lineSide;
130
+ vec2 segmentOffset = (isStartVertex ? rightNormal : leftNormal) * currentWidth;
131
+ if (min(leftLength, rightLength) <= EPS) {
132
+ return segmentOffset;
133
+ }
134
+ vec2 leftEdge = leftDirection + leftNormal * ((currentWidth - previousWidth) / leftLength);
135
+ vec2 rightEdge = rightDirection + rightNormal * ((nextWidth - currentWidth) / rightLength);
136
+ vec2 offset = (rightNormal - leftNormal) * currentWidth;
137
+ float determinant = leftEdge.x * rightEdge.y - leftEdge.y * rightEdge.x;
138
+ float determinantScale = length(leftEdge) * length(rightEdge);
139
+ const float parallelTolerance = EPS * EPS;
140
+ if (!(abs(determinant) > parallelTolerance * determinantScale)) {
141
+ return segmentOffset;
142
+ }
143
+ float leftDistance = (offset.x * rightEdge.y - offset.y * rightEdge.x) / determinant;
144
+ float rightDistance = (offset.x * leftEdge.y - offset.y * leftEdge.x) / determinant;
145
+ if (!(leftDistance >= -leftLength && leftDistance <= 0.0 &&
146
+ rightDistance >= 0.0 && rightDistance <= rightLength)) {
147
+ return segmentOffset;
148
+ }
149
+ return leftNormal * currentWidth + leftDistance * leftEdge;
150
+ }`),X&&A.code.add(y`float perspectiveWidthAtOffset(vec2 offset, vec2 segment, float widthAtOrigin, float widthChange) {
151
+ float segmentFraction = dot(offset, segment) / max(dot(segment, segment), EPS * EPS);
152
+ return widthAtOrigin + segmentFraction * widthChange;
153
+ }`),A.code.add(y`
118
154
  vec2 computeJoinAndCapDisplacement(
119
155
  bool isJoin,
120
156
  bool isStartVertex,
@@ -122,11 +158,12 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
122
158
  inout vec3 right,
123
159
  float lineSide,
124
160
  float lineWidth,
161
+ ${b(X,`vec2 neighborWidths,`)}
125
162
  float subdivisionFactor,
126
163
  float perspectiveDivisor
127
164
  ) {
128
- float leftLen = length(left);
129
- float rightLen = length(right);
165
+ float leftLen = length(${b(X,y`left.xy`,y`left`)});
166
+ float rightLen = length(${b(X,y`right.xy`,y`right`)});
130
167
  left = leftLen > EPS ? left / leftLen : vec3(0.0);
131
168
  right = rightLen > EPS ? right / rightLen : vec3(0.0);
132
169
 
@@ -136,31 +173,50 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
136
173
  float miterDisplacementLen = lineWidth;
137
174
  float innerDisplacementLen = lineWidth;
138
175
  bool isOutside = false;
176
+ ${b(X,`vec2 innerDisplacement = vec2(0.0);`)}
139
177
 
140
178
  if (isJoin) {
141
179
  // Determine if the vertex is on the outside or inside of the join.
142
180
  isOutside = (left.x * right.y - left.y * right.x) * lineSide > 0.0;
143
181
 
144
182
  // Compute the miter join position first.
145
- vec3 joinDirection = normalize(left + right);
146
- joinDisplacementDir = perpendicular(joinDirection);
147
-
148
- // Compute the miter stretch.
149
- if (leftLen > EPS && rightLen > EPS) {
150
- float nDotSeg = dot(joinDisplacementDir, left);
151
- displacementLen /= length(nDotSeg * left - joinDisplacementDir);
152
- miterDisplacementLen = displacementLen;
153
-
154
- innerDisplacementLen = min(displacementLen, min(leftLen, rightLen) / abs(nDotSeg));
155
-
156
- // Limit displacement of inner vertices.
157
- if (!isOutside) {
158
- displacementLen = innerDisplacementLen;
159
- }
160
- }
183
+ ${b(X,y`
184
+ vec2 bisector = left.xy + right.xy;
185
+ vec2 segmentDirection = isStartVertex ? right.xy : left.xy;
186
+ vec3 joinDirection = vec3(length(bisector) > EPS ? normalize(bisector) : segmentDirection, 0.0);
187
+ joinDisplacementDir = perpendicular(joinDirection);
188
+
189
+ if (leftLen > EPS && rightLen > EPS) {
190
+ float nDotSeg = dot(joinDisplacementDir, left);
191
+ displacementLen /= length(nDotSeg * left.xy - joinDisplacementDir.xy);
192
+ miterDisplacementLen = displacementLen;
193
+ }
194
+
195
+ innerDisplacement = computePerspectiveInnerJoin(
196
+ left.xy, right.xy, leftLen, rightLen,
197
+ neighborWidths.x, lineWidth, neighborWidths.y,
198
+ isOutside ? -lineSide : lineSide, isStartVertex
199
+ );
200
+ innerDisplacementLen = length(innerDisplacement);
201
+ `,y`
202
+ vec3 joinDirection = normalize(left + right);
203
+ joinDisplacementDir = perpendicular(joinDirection);
204
+
205
+ if (leftLen > EPS && rightLen > EPS) {
206
+ float nDotSeg = dot(joinDisplacementDir, left);
207
+ displacementLen /= length(nDotSeg * left - joinDisplacementDir);
208
+ miterDisplacementLen = displacementLen;
209
+ innerDisplacementLen = min(displacementLen, min(leftLen, rightLen) / abs(nDotSeg));
210
+
211
+ // Limit displacement of inner vertices.
212
+ if (!isOutside) {
213
+ displacementLen = innerDisplacementLen;
214
+ }
215
+ }
216
+ `)}
161
217
 
162
218
  // Compute stretch compensation for feathering.
163
- ${S(K,x`
219
+ ${b(G,y`
164
220
  if (subdivisionFactor > 0.0) {
165
221
  vIsInsideJoin = 1;
166
222
  }
@@ -194,14 +250,14 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
194
250
  }
195
251
 
196
252
  if (isOutside && displacementLen > miterLimit * lineWidth) {
197
- ${S(D.roundJoins,x`
253
+ ${b(E.roundJoins,y`
198
254
  vec3 startDir = perpendicular(leftLen < EPS ? right : left);
199
255
  vec3 endDir = perpendicular(rightLen < EPS ? left : right);
200
- float factor = ${R?x`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:x`subdivisionFactor`};
256
+ float factor = ${L?y`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:y`subdivisionFactor`};
201
257
 
202
258
  float rotationAngle = acos(clamp(dot(startDir.xy, endDir.xy), -1.0, 1.0));
203
259
  joinDisplacementDir = rotateZ(startDir, -lineSide * factor * rotationAngle);
204
- `,x`
260
+ `,y`
205
261
  /**
206
262
  * Convert to bevel join if miterLimit is exceeded.
207
263
  * Here vertices with a subdivisionFactor > 0 are either START vertices or
@@ -213,19 +269,24 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
213
269
  vec3 startDir = perpendicular(leftLen < EPS ? right : left);
214
270
  vec3 endDir = perpendicular(rightLen < EPS ? left : right);
215
271
 
216
- ${S(R,x`joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? endDir : startDir;`,x`joinDisplacementDir = mix(startDir, endDir, subdivisionFactor);`)}
272
+ ${b(L,y`joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? endDir : startDir;`,y`joinDisplacementDir = mix(startDir, endDir, subdivisionFactor);`)}
217
273
  `)}
218
274
  displacementLen = lineWidth;
219
275
  }
220
276
  } else {
221
277
  joinDisplacementDir = perpendicular(isStartVertex ? right : left);
222
- ${L===0?``:x`capDisplacementDir = vec3((isStartVertex ? -right : left).xy, 0.0);`}
278
+ ${I===0?``:y`capDisplacementDir = vec3((isStartVertex ? -right : left).xy, 0.0);`}
223
279
  }
224
280
 
281
+ ${b(X,y`
282
+ if (isJoin && !isOutside) {
283
+ return innerDisplacement;
284
+ }
285
+ `)}
225
286
  return (joinDisplacementDir.xy * lineSide + capDisplacementDir.xy) * displacementLen;
226
287
  }
227
- `),j.main.add(x`
228
- clip(pos, prev, next, ${S(Z,x`u0, prevU0, nextU0,`)} isStartVertex);
288
+ `),A.main.add(y`
289
+ clip(pos, prev, next, ${b(Z,y`u0, prevU0, nextU0,`)} isStartVertex);
229
290
 
230
291
  vec3 clippedPos = pos.xyz;
231
292
  vec3 clippedCenter = mix(pos.xyz, isStartVertex ? next.xyz : prev.xyz, 0.5);
@@ -237,33 +298,37 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
237
298
  vec3 left = (pos.xyz - prev.xyz);
238
299
  vec3 right = (next.xyz - pos.xyz);
239
300
 
240
- float lineSize = getSize(${S(U,`clippedPos`)});
241
- ${S(R&&U,`float patternLineSize = getSize(clippedCenter);`)}
242
- ${S(R&&!U,`float patternLineSize = lineSize;`)}
301
+ float lineSize = getSize(${b(H,`clippedPos`)});
302
+ ${b(L&&H,`float patternLineSize = getSize(clippedCenter);`)}
303
+ ${b(L&&!H,`float patternLineSize = lineSize;`)}
243
304
 
244
- ${S(W,x`
245
- ${S(P,x`float lineSizeScreen = lineSize * groundMetersToScreenRatio;`,x`
246
- float metersPerScreenPixel = max(-clippedPos.z, nearFar[0]) * metersPerRenderUnit * screenPixelSizePerDistance;
247
- float lineSizeScreen = lineSize / metersPerScreenPixel;
305
+ ${b(U,y`
306
+ ${b(N,y`float lineSizeScreen = lineSize * groundMetersToScreenRatio;`,y`
307
+ float widthPerInverseDepth = lineSize / (metersPerRenderUnit * screenPixelSizePerDistance);
308
+ float lineSizeScreen = widthPerInverseDepth / max(-clippedPos.z, nearFar[0]);
248
309
  `)}
249
310
  float lineWidth = lineSizeScreen * pixelRatio + aaWidth;
250
- `,x`
311
+ `,y`
251
312
  float lineWidth = lineSize * pixelRatio + aaWidth;
252
313
  `)}
253
314
 
254
315
  vLineWidth = noPerspectiveWrite(lineWidth, pos.w);
255
- ${R?x`vLineSizeInv = noPerspectiveWrite(1.0 / ${W?`lineSize`:`max(lineSize, 1.0)`}, pos.w);`:``}
256
- `),X&&j.main.add(x`
316
+ ${L?y`vLineSizeInv = noPerspectiveWrite(1.0 / ${U?`lineSize`:`max(lineSize, 1.0)`}, pos.w);`:``}
317
+ `),Y&&A.main.add(y`
257
318
  float isEndVertex = float(!isStartVertex);
258
319
  vec3 segmentOrigin = mix(pos.xyz, prev.xyz, isEndVertex);
259
320
  vec3 segment = mix(right, left, isEndVertex);
260
- ${q?x`vec3 segmentEnd = mix(next.xyz, pos.xyz, isEndVertex);`:``}
261
- `),j.main.add(x`
262
- vIsInsideJoin = ${K?x`0`:x`float(isInsideJoin)`};
321
+ ${K?y`vec3 segmentEnd = mix(next.xyz, pos.xyz, isEndVertex);`:``}
322
+ `),A.main.add(y`
323
+ vIsInsideJoin = ${G?y`0`:y`float(isInsideJoin)`};
263
324
  vStretchFactor = 1.0;
264
325
  vSubdivisionFactor = 0.0;
265
326
  vJoinCenterLineSDFs = vec2(LARGE_HALF_FLOAT);
266
327
 
328
+ ${b(X,y`
329
+ vec2 neighborWidths = widthPerInverseDepth / max(vec2(prev.w, next.w), vec2(nearFar[0])) * pixelRatio + aaWidth;
330
+ `)}
331
+
267
332
  vec2 displacementXY = computeJoinAndCapDisplacement(
268
333
  isJoin,
269
334
  isStartVertex,
@@ -271,9 +336,17 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
271
336
  right,
272
337
  lineSide,
273
338
  lineWidth,
339
+ ${b(X,`neighborWidths,`)}
274
340
  lineParameters.x,
275
341
  pos.w
276
342
  );
343
+ ${b(X,y`
344
+ // Feathering must use each strip's width at the displaced vertex, not at the original join.
345
+ float leftWidth = perspectiveWidthAtOffset(displacementXY, pos.xy - prev.xy, lineWidth, lineWidth - neighborWidths.x);
346
+ float rightWidth = perspectiveWidthAtOffset(displacementXY, next.xy - pos.xy, lineWidth, neighborWidths.y - lineWidth);
347
+ // Match vJoinCenterLineSDFs: right first, selected when vSubdivisionFactor > 0.5.
348
+ vJoinLineWidths = noPerspectiveWrite(vec2(rightWidth, leftWidth), pos.w);
349
+ `)}
277
350
  vec3 segmentDirection = isStartVertex ? right : left;
278
351
 
279
352
  /**
@@ -288,10 +361,10 @@ pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
288
361
  float lineDistNorm = noPerspectiveWrite(lineSide, pos.w);
289
362
 
290
363
  vLineDistance = lineWidth * lineDistNorm;
291
- ${Y?x`vLineDistanceNorm = lineDistNorm;`:``}
364
+ ${J?y`vLineDistanceNorm = lineDistNorm;`:``}
292
365
 
293
366
  pos.xyz += displacement;
294
- `),j.main.add(x`if (isJoin) {
367
+ `),A.main.add(y`if (isJoin) {
295
368
  vec2 joinCenterToVertex = displacementXY;
296
369
  vec2 leftCenterlineDir = left.xy;
297
370
  vec2 rightCenterlineDir = right.xy;
@@ -306,36 +379,36 @@ dot(vec2(leftCenterlineDir.y, -leftCenterlineDir.x), joinCenterToVertex)
306
379
  ),
307
380
  pos.w
308
381
  );
309
- }`),q&&j.main.add(x`vec2 segmentDir = normalize(segment.xy);
382
+ }`),K&&A.main.add(y`vec2 segmentDir = normalize(segment.xy);
310
383
  vSegmentSDF = noPerspectiveWrite((isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin.xy, segmentDir)), pos.w);
311
- vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),R&&(P?j.main.add(x`float stippleDistanceToScreenRatio = ${W?`groundMetersToScreenRatio`:`planarDistanceToScreenRatio`};`):j.main.add(x`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
312
- float stippleDistanceToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),j.main.add(x`
384
+ vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),L&&(N?A.main.add(y`float stippleDistanceToScreenRatio = ${U?`groundMetersToScreenRatio`:`planarDistanceToScreenRatio`};`):A.main.add(y`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
385
+ float stippleDistanceToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),A.main.add(y`
313
386
  float segmentLengthScreenDouble = length(segment.xy);
314
387
  float segmentLengthScreen = segmentLengthScreenDouble * 0.5;
315
388
  float discreteStippleDistanceToScreenRatio = discretizeStippleDistanceToScreenRatio(stippleDistanceToScreenRatio);
316
- float segmentLengthRender = ${S(W,x`abs(mix(nextU0 - u0, u0 - prevU0, isEndVertex))`,x`length(mix(nextPosition - position, position - prevPosition, isEndVertex))`)};
389
+ float segmentLengthRender = ${b(U,y`abs(mix(nextU0 - u0, u0 - prevU0, isEndVertex))`,y`length(mix(nextPosition - position, position - prevPosition, isEndVertex))`)};
317
390
 
318
- ${S(!P||W,x`
319
- float segmentStartRender = ${S(W,x`mix(u0, prevU0, isEndVertex)`,x`mix(u0, u0 - segmentLengthRender, isEndVertex)`)};
391
+ ${b(!N||U,y`
392
+ float segmentStartRender = ${b(U,y`mix(u0, prevU0, isEndVertex)`,y`mix(u0, u0 - segmentLengthRender, isEndVertex)`)};
320
393
  `)}
321
394
 
322
395
  vStipplePatternStretch = stippleDistanceToScreenRatio / discreteStippleDistanceToScreenRatio;
323
- `),P?j.main.add(x`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteStippleDistanceToScreenRatio / stippleDistanceToScreenRatio;
324
- float startPseudoScreen = u0 * discreteStippleDistanceToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):j.main.add(x`float startPseudoScreen = segmentStartRender * discreteStippleDistanceToScreenRatio;
325
- float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceToScreenRatio;`),j.uniforms.add(new b(`stipplePatternPixelSize`,e=>i(e))),j.main.add(x`
396
+ `),N?A.main.add(y`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteStippleDistanceToScreenRatio / stippleDistanceToScreenRatio;
397
+ float startPseudoScreen = u0 * discreteStippleDistanceToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):A.main.add(y`float startPseudoScreen = segmentStartRender * discreteStippleDistanceToScreenRatio;
398
+ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceToScreenRatio;`),A.uniforms.add(new v(`stipplePatternPixelSize`,e=>ee(e))),A.main.add(y`
326
399
  float patternLength = patternLineSize * stipplePatternPixelSize;
327
400
  vec2 stippleDistanceLimits;
328
401
 
329
- ${S(W,x`
402
+ ${b(U,y`
330
403
  stippleDistanceLimits = vec2(segmentStartRender, segmentStartRender + segmentLengthRender);
331
404
  vStipplePatternStretch = 1.0;
332
405
 
333
- ${S(G,x`
406
+ ${b(W,y`
334
407
  // The v-coordinate used in case of an image pattern.
335
408
  bool isLeft = lineSide < 0.0;
336
409
  vStippleV = isLeft ? 0.0 : 1.0;
337
410
  `)}
338
- `,x`
411
+ `,y`
339
412
  // Compute the coordinates at both start and end of the line segment, because we need both to clamp to in the
340
413
  // fragment shader
341
414
  stippleDistanceLimits = computeStippleDistanceLimits(startPseudoScreen, segmentLengthPseudoScreen, segmentLengthScreen, patternLength);
@@ -355,7 +428,7 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
355
428
  vStippleDistance += (stippleDisplacementFactor - isEndVertex) * (stippleDistanceLimits.y - stippleDistanceLimits.x);
356
429
  }
357
430
 
358
- ${S(Z,x`
431
+ ${b(Z,y`
359
432
  float segmentStartInverseW = 1.0 / mix(pos.w, prev.w, isEndVertex);
360
433
  float segmentEndInverseW = 1.0 / mix(next.w, pos.w, isEndVertex);
361
434
  vStipplePerspective = noPerspectiveWrite(
@@ -371,7 +444,7 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
371
444
  // Disable stipple distance limits on caps
372
445
  vStippleLimitsAndCaps.zw = isJoin ? vec2(0.0) :
373
446
  isStartVertex ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
374
- `)),j.main.add(x`
447
+ `)),A.main.add(y`
375
448
  // Convert back into NDC
376
449
  pos.xy = (pos.xy / viewport.zw) * pos.w;
377
450
  pos.z = pos.z * pos.w;
@@ -379,42 +452,50 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
379
452
  vColor = getColor();
380
453
  vColor.a = noPerspectiveWrite(vColor.a, pos.w);
381
454
 
382
- ${B&&!P?`pos.z -= EPS * pos.w;`:``}
455
+ ${z&&!N?`pos.z -= EPS * pos.w;`:``}
383
456
 
384
457
  // transform final position to camera space for slicing
385
458
  vpos = (inverseProjectionMatrix * pos).xyz;
386
459
  gl_Position = pos;
387
460
  forwardObjectAndLayerIdColor();
388
- }`),O.include(T,D),O.include(h),M.include(ee),M.include(C),M.include(e,D),M.main.add(`discardBySlice(vpos);`),M.code.add(x`float lineFeatheringFactor(float lineWidth, float lineDistance) {
389
- float stretchFactor = float(vIsInsideJoin) > 0.5 ? noPerspectiveRead(vStretchFactor) : 1.0;
390
- float featherWidth = 2.0;
391
- float featherStartDistance = lineWidth - featherWidth / stretchFactor;
392
- float straightFeatherStartDistance = lineWidth - featherWidth;
393
- float value = abs(lineDistance);
394
- float feather = (value - featherStartDistance) / (lineWidth - featherStartDistance);
395
- vec2 joinCenterSDFs = noPerspectiveRead(vJoinCenterLineSDFs);
396
- float joinCenterDistance = abs(vSubdivisionFactor > 0.5 ? joinCenterSDFs.x : joinCenterSDFs.y);
397
- float straightFeather = (joinCenterDistance - straightFeatherStartDistance) / (lineWidth - straightFeatherStartDistance);
398
- feather = float(vIsInsideJoin) > 0.5 ? max(feather, straightFeather) : feather;
399
- float coverage = min(lineWidth - aaWidth, 1.0);
400
- return clamp(1.0 - feather, 0.0, coverage);
401
- }`),M.main.add(x`
461
+ }`),D.include(C,E),D.include(p),j.include(te),j.include(x),j.include(e,E),j.main.add(`discardBySlice(vpos);`),j.code.add(y`
462
+ float lineFeatheringFactor(float lineWidth, float lineDistance) {
463
+ /**
464
+ * Determine whether we are inside the feathering region or not, under
465
+ * consideration of triangle stretch and the distance to the centerline.
466
+ */
467
+ float stretchFactor = float(vIsInsideJoin) > 0.5 ? noPerspectiveRead(vStretchFactor) : 1.0;
468
+ float featherWidth = 2.0;
469
+ // Keep the filter in render-target pixels, including when its two sides overlap on a subpixel stroke.
470
+ float featherStartDistance = lineWidth - featherWidth / stretchFactor;
471
+ float straightLineWidth = ${X?y`noPerspectiveRead(vSubdivisionFactor > 0.5 ? vJoinLineWidths.x : vJoinLineWidths.y)`:`lineWidth`};
472
+ float straightFeatherStartDistance = straightLineWidth - featherWidth;
473
+ float value = abs(lineDistance);
474
+ float feather = (value - featherStartDistance) / (lineWidth - featherStartDistance);
475
+ vec2 joinCenterSDFs = noPerspectiveRead(vJoinCenterLineSDFs);
476
+ float joinCenterDistance = abs(vSubdivisionFactor > 0.5 ? joinCenterSDFs.x : joinCenterSDFs.y);
477
+ float straightFeather = (joinCenterDistance - straightFeatherStartDistance) / featherWidth;
478
+ feather = float(vIsInsideJoin) > 0.5 ? max(feather, straightFeather) : feather;
479
+ float coverage = min(lineWidth - aaWidth, 1.0);
480
+ return clamp(1.0 - feather, 0.0, coverage);
481
+ }
482
+ `),j.main.add(y`
402
483
  float lineWidth = noPerspectiveRead(vLineWidth);
403
484
  float lineDistance = noPerspectiveRead(vLineDistance);
404
- ${S(Y,x`float lineDistanceNorm = noPerspectiveRead(vLineDistanceNorm);`)}
405
- `),J&&M.main.add(x`float nominalLineWidth = lineWidth - aaWidth;`),B?M.main.add(x`vec4 albedo = vec4(1.0, 0.0, 1.0, 1.0);
406
- vec4 finalColor = albedo;`):(q&&M.main.add(x`
485
+ ${b(J,y`float lineDistanceNorm = noPerspectiveRead(vLineDistanceNorm);`)}
486
+ `),q&&j.main.add(y`float nominalLineWidth = lineWidth - aaWidth;`),z?j.main.add(y`vec4 albedo = vec4(1.0, 0.0, 1.0, 1.0);
487
+ vec4 finalColor = albedo;`):(K&&j.main.add(y`
407
488
  float sdf = noPerspectiveRead(min(vSegmentSDF, vReverseSegmentSDF));
408
489
  vec2 fragmentPosition = vec2(min(sdf, 0.0), lineDistance);
409
490
 
410
491
  float fragmentRadius = length(fragmentPosition);
411
- float fragmentCapSDF = (fragmentRadius - ${J?`nominalLineWidth`:`lineWidth`}) * 0.5; // Divide by 2 to transform from double pixel scale
492
+ float fragmentCapSDF = (fragmentRadius - ${q?`nominalLineWidth`:`lineWidth`}) * 0.5; // Divide by 2 to transform from double pixel scale
412
493
  float capCoverage = clamp(0.5 - fragmentCapSDF, 0.0, 1.0);
413
494
 
414
495
  if (capCoverage < alphaCutoff) {
415
496
  discard;
416
497
  }
417
- `),J?M.main.add(x`vec2 stipplePosition = vec2(
498
+ `),q?j.main.add(y`vec2 stipplePosition = vec2(
418
499
  min(getStippleCapDistance(), 0.0) * nominalLineWidth,
419
500
  lineDistance
420
501
  );
@@ -422,8 +503,8 @@ float stippleRadius = length(stipplePosition);
422
503
  float stippleCapSDF = (stippleRadius - nominalLineWidth) * 0.5;
423
504
  float stippleCoverage = clamp(0.5 - stippleCapSDF, 0.0, 1.0);
424
505
  float lineCoverage = min(lineFeatheringFactor(lineWidth, lineDistance), capCoverage);
425
- float stippleAlpha = lineCoverage > 0.0 ? min(stippleCoverage, lineCoverage) / lineCoverage : 0.0;`):M.main.add(x`float stippleAlpha = getStippleAlpha(lineWidth);`),I!==11&&M.main.add(x`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),M.uniforms.add(new v(`intrinsicColor`,e=>e.color)).main.add(x`vec4 color = intrinsicColor * vColor;
426
- color.a = noPerspectiveRead(color.a);`),V&&M.uniforms.add(new v(`innerColor`,e=>e.innerColor??e.color),new b(`innerWidth`,(e,t)=>e.innerWidth*t.camera.pixelRatio)).main.add(x`float distToInner = abs(lineDistance) - innerWidth;
506
+ float stippleAlpha = lineCoverage > 0.0 ? min(stippleCoverage, lineCoverage) / lineCoverage : 0.0;`):j.main.add(y`float stippleAlpha = getStippleAlpha(lineWidth);`),F!==11&&j.main.add(y`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),j.uniforms.add(new g(`intrinsicColor`,e=>e.color)).main.add(y`vec4 color = intrinsicColor * vColor;
507
+ color.a = noPerspectiveRead(color.a);`),B&&j.uniforms.add(new g(`innerColor`,e=>e.innerColor??e.color),new v(`innerWidth`,(e,t)=>e.innerWidth*t.camera.pixelRatio)).main.add(y`float distToInner = abs(lineDistance) - innerWidth;
427
508
  float innerAA = clamp(0.5 - distToInner, 0.0, 1.0);
428
509
  float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
429
- color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`),M.main.add(`vec4 albedo = blendStipple(color, stippleAlpha);`),z&&(M.uniforms.add(new b(`falloff`,e=>e.falloff)),M.main.add(x`albedo.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),M.main.add(x`albedo.a *= ${J?`lineCoverage`:`lineFeatheringFactor(lineWidth, lineDistance)`};`),H&&(j.main.add(`vec4 animatedAlphaTimeStamps = ${Q.getTextureAttribute(`timeStamps`)};`),O.include(w,D),M.main.add(`albedo.a *= animatedAlpha();`)),F?(A.add(`vnormal`,`vec3`),j.include(o,D),j.main.add(`vnormal = getLocalUp(vpos, localOrigin);`),O.include(n,D),M.main.add(`vec4 finalColor = evaluateSceneLightingFragment(vpos, vnormal, albedo);`)):M.main.add(`vec4 finalColor = albedo;`)),M.main.add(x`outputColorHighlightOLID(applySlice(finalColor, vpos), albedo.rgb);`),O}const k=Object.freeze(Object.defineProperty({__proto__:null,build:O,numRoundJoinSubdivisions:1},Symbol.toStringTag,{value:`Module`}));export{k as R,O as b,D as n};
510
+ color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);`),j.main.add(`vec4 albedo = blendStipple(color, stippleAlpha);`),R&&(j.uniforms.add(new v(`falloff`,e=>e.falloff)),j.main.add(y`albedo.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),j.main.add(y`albedo.a *= ${q?`lineCoverage`:`lineFeatheringFactor(lineWidth, lineDistance)`};`),V&&(A.main.add(`vec4 animatedAlphaTimeStamps = ${Q.getTextureAttribute(`timeStamps`)};`),D.include(S,E),j.main.add(`albedo.a *= animatedAlpha();`)),P?(k.add(`vnormal`,`vec3`),A.include(a,E),A.main.add(`vnormal = getLocalUp(vpos, localOrigin);`),D.include(n,E),j.main.add(`vec4 finalColor = evaluateSceneLightingFragment(vpos, vnormal, albedo);`)):j.main.add(`vec4 finalColor = albedo;`)),j.main.add(y`outputColorHighlightOLID(applySlice(finalColor, vpos), albedo.rgb);`),D}const O=Object.freeze(Object.defineProperty({__proto__:null,build:D,numRoundJoinSubdivisions:1},Symbol.toStringTag,{value:`Module`}));export{O as R,D as b,E as n};
package/config.d.ts CHANGED
@@ -5,20 +5,23 @@
5
5
  * >
6
6
  * > **Note**
7
7
  * >
8
- * > It is recommended that properties of the `config` module be set on a global `esriConfig` variable before the API is loaded. Setting properties on the `config` module after the API is loaded may not have the intended effect, as some properties need to be set by the time the first request is made that needs that value. For example, the `apiKey` property needs to be set before the first request is made to a secure service that requires an API key. If the `apiKey` is set after that, the request will fail with an authentication error and prompt for credentials instead of using the API key.
8
+ * > It is recommended that properties of the `config` module be set on a global `esriConfig` variable before the API is loaded. Setting properties on the `config` module after the API is loaded may not have the intended effect, as some properties need to be set by the time the first request is made that needs that value.
9
+ * >
10
+ * > For example, the `apiKey` property needs to be set before the first request is made to a secure service that requires an API key. If the `apiKey` is set after that, the request will fail with an authentication error and prompt for credentials instead of using the API key.
9
11
  *
10
12
  * @since 4.0
11
13
  * @example
12
- * // Load the config module and set the portalUrl property
13
- * const config = await $arcgis.import("@arcgis/core/config.js");
14
- * config.portalUrl = "https://myHostName.esri.com/arcgis";
15
- * @example
14
+ * // When using the CDN, the global esriConfig variable should be set before the JS Maps SDK script.
16
15
  * <script>
17
- * // Use the global esriConfig variable to initialize properties
18
- * var esriConfig = {
19
- * portalUrl: "https://myHostName.esri.com/arcgis"
20
- * };
16
+ * globalThis.esriConfig = {
17
+ * portalUrl: "https://myHostName.esri.com/arcgis",
18
+ * };
21
19
  * </script>
20
+ * <script type="module"src="https://js.arcgis.com/x.y/"></script>
21
+ * @example
22
+ * // Load the config module and set the respectPrefersReducedMotion property
23
+ * const config = await $arcgis.import("@arcgis/core/config.js");
24
+ * config.respectPrefersReducedMotion = true;
22
25
  */
23
26
  import type { LogInterceptor } from "./core/types.js";
24
27
  import type { RequestInterceptor } from "./request/types.js";
package/config.js CHANGED
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.169/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
2
+ import"./core/has.js";import{deepMerge as e}from"./core/object.js";const t={apiKey:void 0,apiKeys:{scopes:[]},applicationName:``,applicationUrl:globalThis.location?.href,assetsPath:``,fontsUrl:`https://static.arcgis.com/fonts`,geometryServiceUrl:`https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer`,geoRSSServiceUrl:`https://utility.arcgis.com/sharing/rss`,kmlServiceUrl:`https://utility.arcgis.com/sharing/kml`,userPrivilegesApplied:!0,portalUrl:`https://www.arcgis.com`,respectPrefersReducedMotion:!0,routeServiceUrl:`https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World`,workers:{loaderConfig:{has:{},paths:{},map:{},packages:[]}},request:{crossOriginNoCorsDomains:null,httpsDomains:[`arcgis.com`,`arcgisonline.com`,`esrikr.com`,`premiumservices.blackbridge.com`,`esripremium.accuweather.com`,`gbm.digitalglobe.com`,`firstlook.digitalglobe.com`,`msi.digitalglobe.com`],interceptors:[],internalInterceptors:[],maxUrlLength:2e3,priority:`high`,proxyRules:[],proxyUrl:null,timeout:62e3,trustedServers:[],useIdentity:!0},log:{interceptors:[],level:null}};globalThis.esriConfig&&(e(t,globalThis.esriConfig,!0),delete t.has),!t.assetsPath&&(t.assetsPath=`https://cdn.jsdelivr.net/npm/@arcgis/core@5.2.0-next.170/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};