@arcgis/core 6.0.0-next.58 → 6.0.0-next.59
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/Graphic.d.ts +1 -0
- package/applications/SceneViewer/sceneViewerUtils.d.ts +74 -0
- package/applications/SceneViewer/sceneViewerUtils.js +1 -1
- package/arcgisGlobal.d.ts +2 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{5e4de4ddd3bdc74100e0.js → 75667b1427a7f02f2cda.js} +1 -1
- package/assets/esri/core/workers/chunks/{b4018b21a03c0c909d23.js → 75a48b122254deb3ad59.js} +1 -1
- package/assets/esri/core/workers/chunks/{690041373d03d02a3044.js → 956810d6f553c2198aae.js} +1 -1
- package/assets/esri/core/workers/chunks/a27c2edd7e043643cdd1.js +1 -0
- package/assets/esri/core/workers/chunks/bd8ee0205f0a01d6d4d7.js +1 -0
- package/assets/esri/core/workers/chunks/{423c7a981b9a06b76cbd.js → d833fc1fe63c9917ae3e.js} +1 -1
- package/assets/esri/core/workers/chunks/{32d5aae2e0953420216a.js → dca6abf260c0bfb7c9c0.js} +1 -1
- package/assets/esri/core/workers/chunks/{fc8cb947a677aa12348d.js → e38ffdb19132529beda7.js} +1 -1
- package/chunks/BlurEmission.glsl.js +6 -6
- package/chunks/EmissionComposite.glsl.js +2 -2
- package/chunks/Fog.glsl.js +4 -4
- package/chunks/RibbonLine.glsl.js +154 -108
- package/config.js +1 -1
- package/core/urlUtils.js +1 -1
- package/interfaces.d.ts +8 -0
- package/kernel.js +1 -1
- package/layers/graphics/sources/CSVSource.js +1 -1
- package/layers/graphics/sources/GeoJSONSource.js +1 -1
- package/layers/raster/formats/tiffParser.js +1 -1
- package/package.json +2 -2
- package/popup/FeatureModel.js +1 -1
- package/popup/FeaturesModel.js +1 -1
- package/rest/support/AttributeBinsQuery.d.ts +41 -1
- package/rest/support/AttributeBinsQuery.js +1 -1
- package/rest/support/Query.d.ts +1 -2
- package/rest/versionManagement/gdbVersion/post.js +1 -1
- package/rest/versionManagement/gdbVersion/reconcile.js +1 -1
- package/rest/versionManagement/gdbVersion/serverVersionUtils.js +1 -1
- package/rest/versionManagement/gdbVersion/support/PostResult.d.ts +1 -1
- package/rest/versionManagement/gdbVersion/support/ReconcileResult.d.ts +1 -1
- package/smartMapping/statistics/histogram.js +1 -1
- package/smartMapping/statistics/types.d.ts +18 -0
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/support/histogramUtils.js +1 -1
- package/symbols/LineSymbol3DLayer.js +1 -1
- package/tables/support/templateUtils.js +1 -1
- package/versionManagement/VersionManagementService.d.ts +47 -1
- package/versionManagement/VersionManagementService.js +1 -1
- package/versionManagement/support/PostJobInfo.d.ts +61 -0
- package/versionManagement/support/PostJobInfo.js +2 -0
- package/versionManagement/support/ReconcileJobInfo.d.ts +61 -0
- package/versionManagement/support/ReconcileJobInfo.js +2 -0
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/PatchGeometry.js +1 -1
- package/views/3d/terrain/PatchGeometryFactory.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +21 -12
- package/views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/fog/Fog.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/BlurEmission.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/glow/applyEmissiveGlow.glsl.js +20 -15
- package/views/3d/webgl-engine/lib/EmissionComposite.glsl.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleRangeBVH.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/Attribution.js +2 -2
- package/views/DOMContainer.d.ts +3 -2
- package/views/DOMContainer.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/View.d.ts +2 -2
- package/views/View.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/294097140e349e073b7e.js +0 -1
- package/assets/esri/core/workers/chunks/6a202ef9ba9b89e09153.js +0 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{multiply as e,translate as t}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{ShaderBuilder as ee}from"../views/webgl/ShaderBuilder.js";import{RibbonVertexPosition as te}from"../views/3d/webgl-engine/core/shaderLibrary/attributes/RibbonVertexPosition.glsl.js";import{addCalculateLinearDepth as ne}from"../views/3d/webgl-engine/core/shaderLibrary/forwardLinearDepthToWriteShadow.glsl.js";import{outputDepth as re}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputDepth.glsl.js";import{isColor as ie,isShadow as ae}from"../views/3d/webgl-engine/core/shaderLibrary/ShaderOutput.js";import{EvaluateAmbientOcclusion as r}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateAmbientOcclusion.glsl.js";import{EvaluateSceneLighting as i}from"../views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js";import{forwardLocalUp as a}from"../views/3d/webgl-engine/core/shaderLibrary/shading/forwardLocalUp.glsl.js";import{mainLightIntensity as o}from"../views/3d/webgl-engine/core/shaderLibrary/shading/lightingUniforms.js";import{LineStipple as oe,computePixelSize as se}from"../views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js";import{MarkerSizing as ce}from"../views/3d/webgl-engine/core/shaderLibrary/shading/MarkerSizing.glsl.js";import{PiUtils as le}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PiUtils.glsl.js";import{positionOutsideClipSpace as ue}from"../views/3d/webgl-engine/core/shaderLibrary/shading/PositionOutsideClipSpace.js";import{readFragmentShadow as de}from"../views/3d/webgl-engine/core/shaderLibrary/shading/readFragmentShadow.glsl.js";import{sliceDraw as fe}from"../views/3d/webgl-engine/core/shaderLibrary/Slice.glsl.js";import{metersPerRenderUnit as pe,screenPixelSizePerDistance as me,inverseProjectionMatrix as he,nearFar as ge,viewport as s,pixelRatio as _e}from"../views/3d/webgl-engine/core/shaderLibrary/util/cameraUniforms.js";import{ColorConversion as c}from"../views/3d/webgl-engine/core/shaderLibrary/util/ColorConversion.glsl.js";import{NoPerspectiveRead as l,NoPerspectiveWrite as ve}from"../views/3d/webgl-engine/core/shaderLibrary/util/NoPerspective.glsl.js";import{getPackedUint32Field as u}from"../views/3d/webgl-engine/core/shaderLibrary/util/PackedUint32.glsl.js";import{addProjView as d}from"../views/3d/webgl-engine/core/shaderLibrary/util/View.glsl.js";import{Float2BindUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Float2BindUniform.js";import{Float4BindUniform as p}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{Float4PassUniform as m}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatBindUniform as h}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{FloatPassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as _,If as v}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4BindUniform as y}from"../views/3d/webgl-engine/core/shaderModules/Matrix4BindUniform.js";import{Matrix4DrawUniform as ye}from"../views/3d/webgl-engine/core/shaderModules/Matrix4DrawUniform.js";import{ribbonLineVertexInfoPacking as b,ribbonLineVertexTypePacking as x,ribbonSubdivisionScale as S}from"../views/3d/webgl-engine/lib/RibbonLineVertexInfo.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{groundMetersToScreenRatio as T,planarDistanceToScreenRatio as E}from"../views/3d/webgl-engine/shaders/lineUniforms.js";import{outputColorHighlightOLID as D}from"../views/3d/webgl-engine/shaders/OutputColorHighlightOLID.glsl.js";import{getTextureBackedBufferModule as O}from"../views/3d/webgl-engine/shaders/RibbonLineTextureBuffer.glsl.js";const k=1;function A(n){let k=new ee,{attributes:A,varyings:M,vertex:N,fragment:P}=k,{applyMarkerOffset:be,draped:F,shadingEnabled:xe,output:I,capType:L,stippleEnabled:R,falloffEnabled:z,wireframe:B,innerColorEnabled:V,hasAnimation:Se,hasScreenSizePerspective:H,worldSized:U,imagePattern:Ce,useFlatJoinVarying:W}=n,G=L===2,K=R&&G,q=z||K,we=R||G,J=R&&n.usePerspectiveCorrectStipple,Y=ae(I),X=(U||Y)&&!F;k.include(l),Y&&P.code.add(_`#undef noPerspectiveRead
|
|
3
|
+
#define noPerspectiveRead(x) (x)`);let Z=O(n).createBuilder(k,n);N.inputs.add(`position`,()=>Z.getTextureAttribute(`position`)),n.hasVVSize?N.inputs.add(`sizeFeatureAttribute`,()=>Z.getTextureAttribute(`sizeFeatureAttribute`)):N.inputs.add(`size`,()=>n.hasVertexSize?Z.getTextureAttribute(`size`):_`1.0`),n.hasVVOpacity&&N.inputs.add(`opacityFeatureAttribute`,()=>Z.getTextureAttribute(`opacityFeatureAttribute`)),n.hasVVColor?N.inputs.add(`colorFeatureAttribute`,()=>Z.getTextureAttribute(`colorFeatureAttribute`)):N.inputs.add(`color`,()=>n.hasVertexColor?Z.getTextureAttribute(`color`):_`vec4(1.0)`),P.include(le),k.include(te,n),k.include(oe,n),I===11?(k.varyings.add(`objectAndLayerIdColorVarying`,`vec4`),N.code.add(_`
|
|
3
4
|
vec4 getOlidColor() {
|
|
4
|
-
return ${
|
|
5
|
+
return ${Z.getTextureAttribute(`olidColor`)};
|
|
5
6
|
}
|
|
6
7
|
|
|
7
8
|
void forwardObjectAndLayerIdColor() {
|
|
8
9
|
objectAndLayerIdColorVarying = getOlidColor();
|
|
9
10
|
}
|
|
10
|
-
`),
|
|
11
|
+
`),P.code.add(_`void outputObjectAndLayerIdColor() {
|
|
11
12
|
fragColor = objectAndLayerIdColorVarying;
|
|
12
|
-
}`)):(
|
|
13
|
+
}`)):(N.code.add(_`void forwardObjectAndLayerIdColor() {}`),P.code.add(_`void outputObjectAndLayerIdColor() {}`));let Q=be&&!F;Q&&k.include(ce,n),d(N,n),F&&(U||R)&&N.uniforms.add(U?T:E),X&&N.uniforms.add(pe,me),Y&&(N.uniforms.add(new y(`shadowViewFromView`,({camera:t,viewCamera:n})=>e(j,t.viewMatrix,n.inverseViewMatrix)),new y(`shadowProjection`,({camera:e})=>e.projectionMatrix),new f(`shadowNearFar`,({camera:e})=>e.nearFar)),k.varyings.add(`depth`,`float`),ne(k),k.include(re,n)),N.uniforms.add(he,ge,s,new g(`miterLimit`,e=>e.join===`miter`?e.miterLimit:0)),Y&&N.uniforms.add(new ye(`view`,(e,{viewCamera:n})=>t(j,n.viewMatrix,e.origin)),new y(`proj`,({viewCamera:e})=>e.projectionMatrix),new y(`inverseProjectionMatrix`,({viewCamera:e})=>e.inverseProjectionMatrix),new f(`nearFar`,({viewCamera:e})=>e.nearFar),new p(`viewport`,({viewCamera:e})=>e.fullViewport),new h(`pixelRatio`,({viewCamera:e,overlayStretch:t})=>e.pixelRatio/t),new h(`screenPixelSizePerDistance`,({viewCamera:e})=>e.screenPixelSizePerDistance),new h(`renderPixelSizePerDistance`,({viewCamera:e})=>e.renderPixelSizePerDistance)),N.constants.add(`LARGE_HALF_FLOAT`,`float`,65500),N.constants.add(`EPS`,`float`,.001),N.constants.add(`NUM_JOIN_SUBDIVISIONS`,`float`,n.numJoinSubdivisions),A.add(`ribbonLineVertexInfo`,`uint`),M.add(`vColor`,`vec4`),M.add(`vpos`,`vec3`,{invariant:!0}),M.add(`vLineDistance`,`float`),M.add(`vLineWidth`,`float`),W?M.add(`vIsInsideJoin`,`int`,{flat:!0}):M.add(`vPointTag`,`vec2`),M.add(`vStretchFactor`,`float`),M.add(`vJoinCenterLineSDFs`,`vec2`),X&&M.add(`vJoinLineWidths`,`vec2`),M.add(`vSubdivisionFactor`,`float`),R&&M.add(`vLineSizeInv`,`float`),q&&M.add(`vLineDistanceNorm`,`float`),G&&(M.add(`vSegmentSDF`,`float`),M.add(`vReverseSegmentSDF`,`float`)),Y&&V&&(M.add(`vInnerWidth`,`float`),N.uniforms.add(new g(`innerWidth`,e=>e.innerWidth))),N.code.add(_`vec3 perpendicular(vec3 v) {
|
|
13
14
|
return vec3(v.y, -v.x, 0.0);
|
|
14
15
|
}
|
|
15
16
|
float nearPlaneInterpolationFactor(float nearPlaneDistance, vec4 start, vec4 end) {
|
|
@@ -20,17 +21,28 @@ float s = sin(a);
|
|
|
20
21
|
float c = cos(a);
|
|
21
22
|
mat2 m = mat2(c, -s, s, c);
|
|
22
23
|
return vec3(m * v.xy, v.z);
|
|
23
|
-
}`),
|
|
24
|
-
vec4
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
}`),N.code.add(_`
|
|
25
|
+
vec4 projectAndScale(vec4 pos) {
|
|
26
|
+
${v(Y,_`
|
|
27
|
+
vec4 lightPosition = shadowViewFromView * pos;
|
|
28
|
+
// Use double meters instead of double pixels so widths do not depend on the warped shadow projection.
|
|
29
|
+
return vec4(lightPosition.xy * (2.0 * metersPerRenderUnit), lightPosition.z, 1.0);
|
|
30
|
+
`,_`
|
|
31
|
+
vec4 posNdc = proj * pos;
|
|
32
|
+
|
|
33
|
+
// Note that posNdc is in -1:1, scaling by screenSize converts this to a coordinate system
|
|
34
|
+
// that is twice scaled (going from -size:size).
|
|
35
|
+
posNdc.xy *= viewport.zw / posNdc.w;
|
|
36
|
+
posNdc.z /= posNdc.w;
|
|
37
|
+
return posNdc;
|
|
38
|
+
`)}
|
|
39
|
+
}
|
|
40
|
+
`),N.code.add(_`
|
|
29
41
|
void clip(
|
|
30
42
|
inout vec4 pos,
|
|
31
43
|
inout vec4 prev,
|
|
32
44
|
inout vec4 next,
|
|
33
|
-
${
|
|
45
|
+
${v(J,_`inout float u0, inout float prevU0, inout float nextU0,`)}
|
|
34
46
|
bool isStartVertex
|
|
35
47
|
) {
|
|
36
48
|
float adjustedNearPlaneDistance = nearFar[0] * 0.99;
|
|
@@ -41,7 +53,7 @@ return posNdc;
|
|
|
41
53
|
if (prev.z < -nearFar[0]) {
|
|
42
54
|
// Previous position in front of near plane
|
|
43
55
|
float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, prev, pos);
|
|
44
|
-
${
|
|
56
|
+
${v(J,_`u0 = mix(prevU0, u0, clipFactor); nextU0 = u0;`)}
|
|
45
57
|
pos = mix(prev, pos, clipFactor);
|
|
46
58
|
next = pos;
|
|
47
59
|
} else {
|
|
@@ -51,7 +63,7 @@ return posNdc;
|
|
|
51
63
|
if (next.z < -nearFar[0]) {
|
|
52
64
|
// Next position in front of near plane
|
|
53
65
|
float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, pos, next);
|
|
54
|
-
${
|
|
66
|
+
${v(J,_`u0 = mix(u0, nextU0, clipFactor); prevU0 = u0;`)}
|
|
55
67
|
pos = mix(pos, next, clipFactor);
|
|
56
68
|
prev = pos;
|
|
57
69
|
} else {
|
|
@@ -63,55 +75,55 @@ return posNdc;
|
|
|
63
75
|
if (prev.z > -nearFar[0]) {
|
|
64
76
|
// Previous position behind near plane
|
|
65
77
|
float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, pos, prev);
|
|
66
|
-
${
|
|
78
|
+
${v(J,_`prevU0 = mix(u0, prevU0, clipFactor);`)}
|
|
67
79
|
prev = mix(pos, prev, clipFactor);
|
|
68
80
|
}
|
|
69
81
|
|
|
70
82
|
if (next.z > -nearFar[0]) {
|
|
71
83
|
// Next position behind near plane
|
|
72
84
|
float clipFactor = nearPlaneInterpolationFactor(adjustedNearPlaneDistance, next, pos);
|
|
73
|
-
${
|
|
85
|
+
${v(J,_`nextU0 = mix(nextU0, u0, clipFactor);`)}
|
|
74
86
|
next = mix(next, pos, clipFactor);
|
|
75
87
|
}
|
|
76
88
|
}
|
|
77
89
|
}
|
|
78
|
-
`)
|
|
79
|
-
uint vertexType = ${
|
|
80
|
-
bool isJoin = ${
|
|
81
|
-
float lineSide = ${
|
|
82
|
-
bool isStartVertex = ${
|
|
83
|
-
float subdivisionFactor = float(${
|
|
84
|
-
vec3 position = ${
|
|
85
|
-
${
|
|
86
|
-
${
|
|
87
|
-
float prevU0 = ${
|
|
88
|
-
float nextU0 = ${
|
|
89
|
-
${
|
|
90
|
+
`);let $=+!Y;return N.uniforms.add(_e),N.constants.add(`aaWidth`,`float`,$),P.constants.add(`aaWidth`,`float`,$),N.main.add(_`
|
|
91
|
+
uint vertexType = ${u(b,1,_`ribbonLineVertexInfo`)};
|
|
92
|
+
bool isJoin = ${u(x,0,_`vertexType`)} == 0u;
|
|
93
|
+
float lineSide = ${u(x,1,_`vertexType`)} == 0u ? 1.0 : -1.0;
|
|
94
|
+
bool isStartVertex = ${u(x,2,_`vertexType`)} != 0u;
|
|
95
|
+
float subdivisionFactor = float(${u(b,2,_`ribbonLineVertexInfo`)}) / ${_.float(S)};
|
|
96
|
+
vec3 position = ${Z.getTextureAttribute(`position`)};
|
|
97
|
+
${R?_`float u0 = ${Z.getTextureAttribute(`u0`)};`:``}
|
|
98
|
+
${R&&U?_`
|
|
99
|
+
float prevU0 = ${Z.getTextureAttribute(`u0`,-1)};
|
|
100
|
+
float nextU0 = ${Z.getTextureAttribute(`u0`,1)};
|
|
101
|
+
${v(!F,_`
|
|
90
102
|
u0 *= metersPerRenderUnit;
|
|
91
103
|
prevU0 *= metersPerRenderUnit;
|
|
92
104
|
nextU0 *= metersPerRenderUnit;
|
|
93
105
|
`)}
|
|
94
106
|
`:``}
|
|
95
|
-
${
|
|
96
|
-
float textureIndexParity = float(${
|
|
107
|
+
${v(!W,_`
|
|
108
|
+
float textureIndexParity = float(${u(b,0,_`ribbonLineVertexInfo`)} % 2u);
|
|
97
109
|
vPointTag = vec2(textureIndexParity, 1.0 - textureIndexParity);
|
|
98
110
|
`)}
|
|
99
|
-
vec3 prevPosition = ${
|
|
100
|
-
vec3 nextPosition = ${
|
|
111
|
+
vec3 prevPosition = ${Z.getTextureAttribute(`position`,-1)};
|
|
112
|
+
vec3 nextPosition = ${Z.getTextureAttribute(`position`,1)};
|
|
101
113
|
|
|
102
114
|
// Cleared geometry has a zero descriptor. Texture index 0 is never valid for a vertex, as it is only used for padding.
|
|
103
115
|
if (ribbonLineVertexInfo == 0u) {
|
|
104
|
-
gl_Position = ${
|
|
116
|
+
gl_Position = ${ue};
|
|
105
117
|
}
|
|
106
118
|
else {
|
|
107
119
|
vec4 pos = view * vec4(position, 1.0);
|
|
108
120
|
vec4 prev = view * vec4(prevPosition, 1.0);
|
|
109
121
|
vec4 next = view * vec4(nextPosition, 1.0);
|
|
110
|
-
`)
|
|
122
|
+
`),Q&&N.main.add(_`vec4 other = isStartVertex ? next : prev;
|
|
111
123
|
bool markersHidden = areWorldMarkersHidden(pos.xyz, other.xyz);
|
|
112
124
|
if (!isJoin && !markersHidden) {
|
|
113
125
|
pos.xyz += normalize(other.xyz - pos.xyz) * getWorldMarkerSize(pos.xyz) * 0.5;
|
|
114
|
-
}`),k.include(
|
|
126
|
+
}`),k.include(ve),X&&N.code.add(_`vec2 computePerspectiveInnerJoin(
|
|
115
127
|
vec2 leftDirection,
|
|
116
128
|
vec2 rightDirection,
|
|
117
129
|
float leftLength,
|
|
@@ -144,10 +156,10 @@ rightDistance >= 0.0 && rightDistance <= rightLength)) {
|
|
|
144
156
|
return segmentOffset;
|
|
145
157
|
}
|
|
146
158
|
return leftNormal * currentWidth + leftDistance * leftEdge;
|
|
147
|
-
}`),
|
|
159
|
+
}`),X&&N.code.add(_`float perspectiveWidthAtOffset(vec2 offset, vec2 segment, float widthAtOrigin, float widthChange) {
|
|
148
160
|
float segmentFraction = dot(offset, segment) / max(dot(segment, segment), EPS * EPS);
|
|
149
161
|
return widthAtOrigin + segmentFraction * widthChange;
|
|
150
|
-
}`),
|
|
162
|
+
}`),N.code.add(_`
|
|
151
163
|
vec2 computeJoinAndCapDisplacement(
|
|
152
164
|
bool isJoin,
|
|
153
165
|
bool isStartVertex,
|
|
@@ -155,12 +167,12 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
155
167
|
inout vec3 right,
|
|
156
168
|
float lineSide,
|
|
157
169
|
float lineWidth,
|
|
158
|
-
${
|
|
170
|
+
${v(X,`vec2 neighborWidths,`)}
|
|
159
171
|
float subdivisionFactor,
|
|
160
172
|
float perspectiveDivisor
|
|
161
173
|
) {
|
|
162
|
-
float leftLen = length(${
|
|
163
|
-
float rightLen = length(${
|
|
174
|
+
float leftLen = length(${v(X,_`left.xy`,_`left`)});
|
|
175
|
+
float rightLen = length(${v(X,_`right.xy`,_`right`)});
|
|
164
176
|
left = leftLen > EPS ? left / leftLen : vec3(0.0);
|
|
165
177
|
right = rightLen > EPS ? right / rightLen : vec3(0.0);
|
|
166
178
|
|
|
@@ -170,14 +182,14 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
170
182
|
float miterDisplacementLen = lineWidth;
|
|
171
183
|
float innerDisplacementLen = lineWidth;
|
|
172
184
|
bool isOutside = false;
|
|
173
|
-
${
|
|
185
|
+
${v(X,`vec2 innerDisplacement = vec2(0.0);`)}
|
|
174
186
|
|
|
175
187
|
if (isJoin) {
|
|
176
188
|
// Determine if the vertex is on the outside or inside of the join.
|
|
177
189
|
isOutside = (left.x * right.y - left.y * right.x) * lineSide > 0.0;
|
|
178
190
|
|
|
179
191
|
// Compute the miter join position first.
|
|
180
|
-
${
|
|
192
|
+
${v(X,_`
|
|
181
193
|
vec2 bisector = left.xy + right.xy;
|
|
182
194
|
vec2 segmentDirection = isStartVertex ? right.xy : left.xy;
|
|
183
195
|
vec3 joinDirection = vec3(length(bisector) > EPS ? normalize(bisector) : segmentDirection, 0.0);
|
|
@@ -195,7 +207,7 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
195
207
|
isOutside ? -lineSide : lineSide, isStartVertex
|
|
196
208
|
);
|
|
197
209
|
innerDisplacementLen = length(innerDisplacement);
|
|
198
|
-
`,
|
|
210
|
+
`,_`
|
|
199
211
|
vec3 joinDirection = normalize(left + right);
|
|
200
212
|
joinDisplacementDir = perpendicular(joinDirection);
|
|
201
213
|
|
|
@@ -213,7 +225,7 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
213
225
|
`)}
|
|
214
226
|
|
|
215
227
|
// Compute stretch compensation for feathering.
|
|
216
|
-
${
|
|
228
|
+
${v(W,_`
|
|
217
229
|
if (subdivisionFactor > 0.0) {
|
|
218
230
|
vIsInsideJoin = 1;
|
|
219
231
|
}
|
|
@@ -247,14 +259,14 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
247
259
|
}
|
|
248
260
|
|
|
249
261
|
if (isOutside && displacementLen > miterLimit * lineWidth) {
|
|
250
|
-
${
|
|
262
|
+
${v(n.roundJoins,_`
|
|
251
263
|
vec3 startDir = perpendicular(leftLen < EPS ? right : left);
|
|
252
264
|
vec3 endDir = perpendicular(rightLen < EPS ? left : right);
|
|
253
|
-
float factor = ${
|
|
265
|
+
float factor = ${R?_`min(1.0, subdivisionFactor * ((NUM_JOIN_SUBDIVISIONS + 1.0) / NUM_JOIN_SUBDIVISIONS))`:_`subdivisionFactor`};
|
|
254
266
|
|
|
255
267
|
float rotationAngle = acos(clamp(dot(startDir.xy, endDir.xy), -1.0, 1.0));
|
|
256
268
|
joinDisplacementDir = rotateZ(startDir, -lineSide * factor * rotationAngle);
|
|
257
|
-
`,
|
|
269
|
+
`,_`
|
|
258
270
|
/**
|
|
259
271
|
* Convert to bevel join if miterLimit is exceeded.
|
|
260
272
|
* Here vertices with a subdivisionFactor > 0 are either START vertices or
|
|
@@ -266,28 +278,38 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
266
278
|
vec3 startDir = perpendicular(leftLen < EPS ? right : left);
|
|
267
279
|
vec3 endDir = perpendicular(rightLen < EPS ? left : right);
|
|
268
280
|
|
|
269
|
-
${
|
|
281
|
+
${v(R,_`joinDisplacementDir = (isStartVertex || subdivisionFactor > 0.0) ? endDir : startDir;`,_`joinDisplacementDir = mix(startDir, endDir, subdivisionFactor);`)}
|
|
270
282
|
`)}
|
|
271
283
|
displacementLen = lineWidth;
|
|
272
284
|
}
|
|
273
285
|
} else {
|
|
274
286
|
joinDisplacementDir = perpendicular(isStartVertex ? right : left);
|
|
275
|
-
${
|
|
287
|
+
${L===0?``:_`capDisplacementDir = vec3((isStartVertex ? -right : left).xy, 0.0);`}
|
|
276
288
|
}
|
|
277
289
|
|
|
278
|
-
${
|
|
290
|
+
${v(X,_`
|
|
279
291
|
if (isJoin && !isOutside) {
|
|
280
292
|
return innerDisplacement;
|
|
281
293
|
}
|
|
282
294
|
`)}
|
|
283
295
|
return (joinDisplacementDir.xy * lineSide + capDisplacementDir.xy) * displacementLen;
|
|
284
296
|
}
|
|
285
|
-
`),
|
|
286
|
-
clip(pos, prev, next, ${
|
|
297
|
+
`),N.main.add(_`
|
|
298
|
+
clip(pos, prev, next, ${v(J,_`u0, prevU0, nextU0,`)} isStartVertex);
|
|
287
299
|
|
|
288
300
|
vec3 clippedPos = pos.xyz;
|
|
289
301
|
vec3 clippedCenter = mix(pos.xyz, isStartVertex ? next.xyz : prev.xyz, 0.5);
|
|
290
|
-
|
|
302
|
+
${v(Y&&!U,_`
|
|
303
|
+
vec2 neighborDepths = max(-vec2(prev.z, next.z), vec2(nearFar[0]));
|
|
304
|
+
${v(R,_`
|
|
305
|
+
vec4 patternStart = proj * (isStartVertex ? pos : prev);
|
|
306
|
+
vec4 patternEnd = proj * (isStartVertex ? next : pos);
|
|
307
|
+
vStippleViewInverseW = 1.0 / vec2(patternStart.w, patternEnd.w);
|
|
308
|
+
float viewSegmentLength = length(
|
|
309
|
+
(patternEnd.xy / patternEnd.w - patternStart.xy / patternStart.w) * viewport.zw
|
|
310
|
+
) * 0.5;
|
|
311
|
+
`)}
|
|
312
|
+
`)}
|
|
291
313
|
pos = projectAndScale(pos);
|
|
292
314
|
next = projectAndScale(next);
|
|
293
315
|
prev = projectAndScale(prev);
|
|
@@ -295,35 +317,38 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
295
317
|
vec3 left = (pos.xyz - prev.xyz);
|
|
296
318
|
vec3 right = (next.xyz - pos.xyz);
|
|
297
319
|
|
|
298
|
-
float lineSize = getSize(${
|
|
299
|
-
${
|
|
300
|
-
${
|
|
320
|
+
float lineSize = getSize(${v(H,`clippedPos`)});
|
|
321
|
+
${v(R&&H,`float patternLineSize = getSize(clippedCenter);`)}
|
|
322
|
+
${v(R&&!H,`float patternLineSize = lineSize;`)}
|
|
301
323
|
|
|
302
|
-
${
|
|
303
|
-
${
|
|
324
|
+
${v(Y,_`
|
|
325
|
+
float lineWidth = ${U?`lineSize`:`lineSize * max(-clippedPos.z, nearFar[0]) * metersPerRenderUnit * screenPixelSizePerDistance`};
|
|
326
|
+
${v(V,`vInnerWidth = innerWidth * max(-clippedPos.z, nearFar[0]) * metersPerRenderUnit * screenPixelSizePerDistance;`)}
|
|
327
|
+
`,v(U,_`
|
|
328
|
+
${v(F,_`float lineSizeScreen = lineSize * groundMetersToScreenRatio;`,_`
|
|
304
329
|
float widthPerInverseDepth = lineSize / (metersPerRenderUnit * screenPixelSizePerDistance);
|
|
305
330
|
float lineSizeScreen = widthPerInverseDepth / max(-clippedPos.z, nearFar[0]);
|
|
306
331
|
`)}
|
|
307
332
|
float lineWidth = lineSizeScreen * pixelRatio + aaWidth;
|
|
308
|
-
`,
|
|
333
|
+
`,_`
|
|
309
334
|
float lineWidth = lineSize * pixelRatio + aaWidth;
|
|
310
|
-
`)}
|
|
335
|
+
`))}
|
|
311
336
|
|
|
312
337
|
vLineWidth = noPerspectiveWrite(lineWidth, pos.w);
|
|
313
|
-
${
|
|
314
|
-
`),
|
|
338
|
+
${R?`vLineSizeInv = noPerspectiveWrite(1.0 / ${U?`lineSize`:`max(lineSize, 1.0)`}, pos.w);`:``}
|
|
339
|
+
`),we&&N.main.add(_`
|
|
315
340
|
float isEndVertex = float(!isStartVertex);
|
|
316
341
|
vec3 segmentOrigin = mix(pos.xyz, prev.xyz, isEndVertex);
|
|
317
342
|
vec3 segment = mix(right, left, isEndVertex);
|
|
318
|
-
${
|
|
319
|
-
`),
|
|
320
|
-
${
|
|
343
|
+
${G?`vec3 segmentEnd = mix(next.xyz, pos.xyz, isEndVertex);`:``}
|
|
344
|
+
`),N.main.add(_`
|
|
345
|
+
${v(W,_`vIsInsideJoin = 0;`)}
|
|
321
346
|
vStretchFactor = 1.0;
|
|
322
347
|
vSubdivisionFactor = 0.0;
|
|
323
348
|
vJoinCenterLineSDFs = vec2(LARGE_HALF_FLOAT);
|
|
324
349
|
|
|
325
|
-
${
|
|
326
|
-
vec2 neighborWidths = widthPerInverseDepth / max(vec2(prev.w, next.w), vec2(nearFar[0])) * pixelRatio + aaWidth;
|
|
350
|
+
${v(X,_`
|
|
351
|
+
vec2 neighborWidths = ${Y?U?`vec2(lineWidth)`:`lineSize * neighborDepths * metersPerRenderUnit * screenPixelSizePerDistance`:`widthPerInverseDepth / max(vec2(prev.w, next.w), vec2(nearFar[0])) * pixelRatio + aaWidth`};
|
|
327
352
|
`)}
|
|
328
353
|
|
|
329
354
|
vec2 displacementXY = computeJoinAndCapDisplacement(
|
|
@@ -333,11 +358,11 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
333
358
|
right,
|
|
334
359
|
lineSide,
|
|
335
360
|
lineWidth,
|
|
336
|
-
${
|
|
361
|
+
${v(X,`neighborWidths,`)}
|
|
337
362
|
subdivisionFactor,
|
|
338
363
|
pos.w
|
|
339
364
|
);
|
|
340
|
-
${
|
|
365
|
+
${v(X,_`
|
|
341
366
|
// Feathering must use each strip's width at the displaced vertex, not at the original join.
|
|
342
367
|
float leftWidth = perspectiveWidthAtOffset(displacementXY, pos.xy - prev.xy, lineWidth, lineWidth - neighborWidths.x);
|
|
343
368
|
float rightWidth = perspectiveWidthAtOffset(displacementXY, next.xy - pos.xy, lineWidth, neighborWidths.y - lineWidth);
|
|
@@ -352,16 +377,16 @@ return widthAtOrigin + segmentFraction * widthChange;
|
|
|
352
377
|
* To do so, the below formula projects the xy displacement onto the original segment direction
|
|
353
378
|
* to find the z-offset necessary so the triangle orientation is independent of the width.
|
|
354
379
|
*/
|
|
355
|
-
float displacementZ = dot(displacementXY, segmentDirection.xy) / dot(segmentDirection.xy, segmentDirection.xy) * segmentDirection.z;
|
|
380
|
+
float displacementZ = dot(displacementXY, segmentDirection.xy) / ${v(Y,`max(dot(segmentDirection.xy, segmentDirection.xy), EPS * EPS)`,`dot(segmentDirection.xy, segmentDirection.xy)`)} * segmentDirection.z;
|
|
356
381
|
vec3 displacement = vec3(displacementXY, displacementZ);
|
|
357
382
|
|
|
358
383
|
float lineDistNorm = noPerspectiveWrite(lineSide, pos.w);
|
|
359
384
|
|
|
360
385
|
vLineDistance = lineWidth * lineDistNorm;
|
|
361
|
-
${
|
|
386
|
+
${q?_`vLineDistanceNorm = lineDistNorm;`:``}
|
|
362
387
|
|
|
363
388
|
pos.xyz += displacement;
|
|
364
|
-
`),
|
|
389
|
+
`),N.main.add(_`if (isJoin) {
|
|
365
390
|
vec2 joinCenterToVertex = displacementXY;
|
|
366
391
|
vec2 leftCenterlineDir = left.xy;
|
|
367
392
|
vec2 rightCenterlineDir = right.xy;
|
|
@@ -376,36 +401,36 @@ dot(vec2(leftCenterlineDir.y, -leftCenterlineDir.x), joinCenterToVertex)
|
|
|
376
401
|
),
|
|
377
402
|
pos.w
|
|
378
403
|
);
|
|
379
|
-
}`),
|
|
404
|
+
}`),G&&N.main.add(_`vec2 segmentDir = normalize(segment.xy);
|
|
380
405
|
vSegmentSDF = noPerspectiveWrite((isJoin && isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentOrigin.xy, segmentDir)), pos.w);
|
|
381
|
-
vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),
|
|
382
|
-
float stippleDistanceToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),
|
|
406
|
+
vReverseSegmentSDF = noPerspectiveWrite((isJoin && !isStartVertex) ? LARGE_HALF_FLOAT : (dot(pos.xy - segmentEnd.xy, -segmentDir)), pos.w);`),R&&(F?N.main.add(`float stippleDistanceToScreenRatio = ${U?`groundMetersToScreenRatio`:`planarDistanceToScreenRatio`};`):N.main.add(_`vec3 segmentCenter = mix((nextPosition + position) * 0.5, (position + prevPosition) * 0.5, isEndVertex);
|
|
407
|
+
float stippleDistanceToScreenRatio = computeWorldToScreenRatio(segmentCenter);`),N.main.add(_`
|
|
383
408
|
float segmentLengthScreenDouble = length(segment.xy);
|
|
384
|
-
float segmentLengthScreen = segmentLengthScreenDouble * 0.5;
|
|
409
|
+
float segmentLengthScreen = ${Y&&!U?`viewSegmentLength`:`segmentLengthScreenDouble * 0.5`};
|
|
385
410
|
float discreteStippleDistanceToScreenRatio = discretizeStippleDistanceToScreenRatio(stippleDistanceToScreenRatio);
|
|
386
|
-
float segmentLengthRender = ${
|
|
411
|
+
float segmentLengthRender = ${v(U,_`abs(mix(nextU0 - u0, u0 - prevU0, isEndVertex))`,_`length(mix(nextPosition - position, position - prevPosition, isEndVertex))`)};
|
|
387
412
|
|
|
388
|
-
${
|
|
389
|
-
float segmentStartRender = ${
|
|
413
|
+
${v(!F||U,_`
|
|
414
|
+
float segmentStartRender = ${v(U,_`mix(u0, prevU0, isEndVertex)`,_`mix(u0, u0 - segmentLengthRender, isEndVertex)`)};
|
|
390
415
|
`)}
|
|
391
416
|
|
|
392
417
|
vStipplePatternStretch = stippleDistanceToScreenRatio / discreteStippleDistanceToScreenRatio;
|
|
393
|
-
`),F?
|
|
394
|
-
float startPseudoScreen = u0 * discreteStippleDistanceToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):
|
|
395
|
-
float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceToScreenRatio;`),
|
|
418
|
+
`),F?N.main.add(_`float segmentLengthPseudoScreen = segmentLengthScreen / pixelRatio * discreteStippleDistanceToScreenRatio / stippleDistanceToScreenRatio;
|
|
419
|
+
float startPseudoScreen = u0 * discreteStippleDistanceToScreenRatio - mix(0.0, segmentLengthPseudoScreen, isEndVertex);`):N.main.add(_`float startPseudoScreen = segmentStartRender * discreteStippleDistanceToScreenRatio;
|
|
420
|
+
float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceToScreenRatio;`),N.uniforms.add(new g(`stipplePatternPixelSize`,e=>se(e))),N.main.add(_`
|
|
396
421
|
float patternLength = patternLineSize * stipplePatternPixelSize;
|
|
397
422
|
vec2 stippleDistanceLimits;
|
|
398
423
|
|
|
399
|
-
${
|
|
424
|
+
${v(U,_`
|
|
400
425
|
stippleDistanceLimits = vec2(segmentStartRender, segmentStartRender + segmentLengthRender);
|
|
401
426
|
vStipplePatternStretch = 1.0;
|
|
402
427
|
|
|
403
|
-
${
|
|
428
|
+
${v(Ce,_`
|
|
404
429
|
// The v-coordinate used in case of an image pattern.
|
|
405
430
|
bool isLeft = lineSide < 0.0;
|
|
406
431
|
vStippleV = isLeft ? 0.0 : 1.0;
|
|
407
432
|
`)}
|
|
408
|
-
`,
|
|
433
|
+
`,_`
|
|
409
434
|
// Compute the coordinates at both start and end of the line segment, because we need both to clamp to in the
|
|
410
435
|
// fragment shader
|
|
411
436
|
stippleDistanceLimits = computeStippleDistanceLimits(startPseudoScreen, segmentLengthPseudoScreen, segmentLengthScreen, patternLength);
|
|
@@ -425,7 +450,7 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
|
|
|
425
450
|
vStippleDistance += (stippleDisplacementFactor - isEndVertex) * (stippleDistanceLimits.y - stippleDistanceLimits.x);
|
|
426
451
|
}
|
|
427
452
|
|
|
428
|
-
${
|
|
453
|
+
${v(J,_`
|
|
429
454
|
float segmentStartInverseW = 1.0 / mix(pos.w, prev.w, isEndVertex);
|
|
430
455
|
float segmentEndInverseW = 1.0 / mix(next.w, pos.w, isEndVertex);
|
|
431
456
|
vStipplePerspective = noPerspectiveWrite(
|
|
@@ -441,32 +466,44 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
|
|
|
441
466
|
// Disable stipple distance limits on caps
|
|
442
467
|
vStippleLimitsAndCaps.zw = isJoin ? vec2(0.0) :
|
|
443
468
|
isStartVertex ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
|
444
|
-
`)),
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
469
|
+
`)),N.main.add(_`
|
|
470
|
+
${v(!Y,_`
|
|
471
|
+
// Convert back into NDC
|
|
472
|
+
pos.xy = (pos.xy / viewport.zw) * pos.w;
|
|
473
|
+
pos.z = pos.z * pos.w;
|
|
474
|
+
`)}
|
|
448
475
|
|
|
449
476
|
vColor = getColor();
|
|
450
477
|
vColor.a = noPerspectiveWrite(vColor.a, pos.w);
|
|
451
478
|
|
|
452
|
-
${
|
|
479
|
+
${B&&!F?`pos.z -= EPS * pos.w;`:``}
|
|
453
480
|
|
|
454
481
|
// transform final position to camera space for slicing
|
|
455
|
-
|
|
482
|
+
${v(Y,_`
|
|
483
|
+
vec4 shadowPosition = vec4(pos.xy / (2.0 * metersPerRenderUnit), pos.z, 1.0);
|
|
484
|
+
vpos = shadowPosition.xyz;
|
|
485
|
+
// Put the proxy's depth behind the visible ribbon to avoid self-shadowing when their planes differ.
|
|
486
|
+
float shadowDepth = shadowPosition.z - lineWidth / (2.0 * metersPerRenderUnit);
|
|
487
|
+
depth = calculateLinearDepth(shadowNearFar, shadowDepth);
|
|
488
|
+
pos = shadowProjection * shadowPosition;
|
|
489
|
+
`,`vpos = (inverseProjectionMatrix * pos).xyz;`)}
|
|
456
490
|
gl_Position = pos;
|
|
457
491
|
forwardObjectAndLayerIdColor();
|
|
458
|
-
}
|
|
492
|
+
}
|
|
493
|
+
`),k.include(D,n),k.include(l),P.include(c),P.include(C),P.include(fe,n),P.main.add(`discardBySlice(vpos);`),Y?P.code.add(_`float lineFeatheringFactor(float lineWidth, float lineDistance) {
|
|
494
|
+
return step(abs(lineDistance), lineWidth);
|
|
495
|
+
}`):P.code.add(_`
|
|
459
496
|
float lineFeatheringFactor(float lineWidth, float lineDistance) {
|
|
460
497
|
/**
|
|
461
498
|
* Determine whether we are inside the feathering region or not, under
|
|
462
499
|
* consideration of triangle stretch and the distance to the centerline.
|
|
463
500
|
*/
|
|
464
|
-
bool isInsideJoin = ${
|
|
501
|
+
bool isInsideJoin = ${W?_`vIsInsideJoin == 1`:_`any(equal(vPointTag, vec2(0.0)))`};
|
|
465
502
|
float stretchFactor = isInsideJoin ? noPerspectiveRead(vStretchFactor) : 1.0;
|
|
466
503
|
float featherWidth = 2.0;
|
|
467
504
|
// Keep the filter in render-target pixels, including when its two sides overlap on a subpixel stroke.
|
|
468
505
|
float featherStartDistance = lineWidth - featherWidth / stretchFactor;
|
|
469
|
-
float straightLineWidth = ${
|
|
506
|
+
float straightLineWidth = ${X?_`noPerspectiveRead(vSubdivisionFactor > 0.5 ? vJoinLineWidths.x : vJoinLineWidths.y)`:`lineWidth`};
|
|
470
507
|
float straightFeatherStartDistance = straightLineWidth - featherWidth;
|
|
471
508
|
float value = abs(lineDistance);
|
|
472
509
|
float feather = (value - featherStartDistance) / (lineWidth - featherStartDistance);
|
|
@@ -477,35 +514,43 @@ float segmentLengthPseudoScreen = segmentLengthRender * discreteStippleDistanceT
|
|
|
477
514
|
float coverage = min(lineWidth - aaWidth, 1.0);
|
|
478
515
|
return clamp(1.0 - feather, 0.0, coverage);
|
|
479
516
|
}
|
|
480
|
-
|
|
517
|
+
`),P.main.add(_`
|
|
481
518
|
float lineWidth = noPerspectiveRead(vLineWidth);
|
|
482
519
|
float lineDistance = noPerspectiveRead(vLineDistance);
|
|
483
|
-
${
|
|
484
|
-
`),
|
|
485
|
-
|
|
520
|
+
${v(q,_`float lineDistanceNorm = noPerspectiveRead(vLineDistanceNorm);`)}
|
|
521
|
+
`),K&&P.main.add(_`float nominalLineWidth = lineWidth - aaWidth;`),P.code.add(_`
|
|
522
|
+
float aaCoverage(float value) {
|
|
523
|
+
return ${Y?`step(value, 0.0)`:`clamp(0.5 - value, 0.0, 1.0)`};
|
|
524
|
+
}
|
|
525
|
+
`),B?P.main.add(_`vec4 albedo = vec4(1.0, 0.0, 1.0, 1.0);
|
|
526
|
+
vec4 finalColor = albedo;`):(G&&P.main.add(_`
|
|
486
527
|
float sdf = noPerspectiveRead(min(vSegmentSDF, vReverseSegmentSDF));
|
|
487
528
|
vec2 fragmentPosition = vec2(min(sdf, 0.0), lineDistance);
|
|
488
529
|
|
|
489
530
|
float fragmentRadius = length(fragmentPosition);
|
|
490
|
-
float fragmentCapSDF = (fragmentRadius - ${
|
|
491
|
-
float capCoverage =
|
|
531
|
+
float fragmentCapSDF = (fragmentRadius - ${K?`nominalLineWidth`:`lineWidth`}) * 0.5; // Divide by 2 to transform from double pixel scale
|
|
532
|
+
float capCoverage = aaCoverage(fragmentCapSDF);
|
|
492
533
|
|
|
493
534
|
if (capCoverage < alphaCutoff) {
|
|
494
535
|
discard;
|
|
495
536
|
}
|
|
496
|
-
`),
|
|
537
|
+
`),K?P.main.add(_`vec2 stipplePosition = vec2(
|
|
497
538
|
min(getStippleCapDistance(), 0.0) * nominalLineWidth,
|
|
498
539
|
lineDistance
|
|
499
540
|
);
|
|
500
541
|
float stippleRadius = length(stipplePosition);
|
|
501
542
|
float stippleCapSDF = (stippleRadius - nominalLineWidth) * 0.5;
|
|
502
|
-
float stippleCoverage =
|
|
543
|
+
float stippleCoverage = aaCoverage(stippleCapSDF);
|
|
503
544
|
float lineCoverage = min(lineFeatheringFactor(lineWidth, lineDistance), capCoverage);
|
|
504
|
-
float stippleAlpha = lineCoverage > 0.0 ? min(stippleCoverage, lineCoverage) / lineCoverage : 0.0;`):
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
545
|
+
float stippleAlpha = lineCoverage > 0.0 ? min(stippleCoverage, lineCoverage) / lineCoverage : 0.0;`):P.main.add(_`
|
|
546
|
+
float stippleAlpha = ${Y&&R?`step(0.0, getStippleSDF())`:`getStippleAlpha(lineWidth)`};
|
|
547
|
+
`),I!==11&&P.main.add(_`discardByStippleAlpha(stippleAlpha, alphaCutoff);`),P.uniforms.add(new m(`intrinsicColor`,e=>e.color)).main.add(_`vec4 color = intrinsicColor * vColor;
|
|
548
|
+
color.a = noPerspectiveRead(color.a);`),V&&(Y||P.uniforms.add(new g(`innerWidth`,(e,t)=>e.innerWidth*t.camera.pixelRatio)),P.uniforms.add(new m(`innerColor`,e=>e.innerColor??e.color)).main.add(_`
|
|
549
|
+
float distToInner = abs(lineDistance) - ${Y?`vInnerWidth`:`innerWidth`};
|
|
550
|
+
float innerAA = aaCoverage(distToInner);
|
|
551
|
+
float innerAlpha = innerColor.a + color.a * (1.0 - innerColor.a);
|
|
552
|
+
color = mix(color, vec4(innerColor.rgb, innerAlpha), innerAA);
|
|
553
|
+
`)),P.main.add(`vec4 albedo = blendStipple(color, stippleAlpha);`),z&&(P.uniforms.add(new g(`falloff`,e=>e.falloff)),P.main.add(_`albedo.a *= pow(max(0.0, 1.0 - abs(lineDistanceNorm)), falloff);`)),P.main.add(_`albedo.a *= ${K?`lineCoverage`:`lineFeatheringFactor(lineWidth, lineDistance)`};`),Se&&(N.main.add(`vec4 animatedAlphaTimeStamps = ${Z.getTextureAttribute(`timeStamps`)};`),k.include(w,n),P.main.add(`albedo.a *= animatedAlpha();`)),xe&&ie(I)?(k.include(a,n),N.main.add(_`forwardLocalUp(position);`),N.main.add(`forwardLinearDepthToReadShadow();`),k.include(de,n),P.include(i,n),P.include(r,n),P.uniforms.add(o).main.add(_`vec3 normal = normalize(upNormal);
|
|
509
554
|
float additionalAmbientScale = additionalDirectedAmbientLight(normal);
|
|
510
555
|
float shadow = readFragmentShadow(additionalAmbientScale);
|
|
511
556
|
float ssao = evaluateAmbientOcclusionInverse();
|
|
@@ -514,4 +559,5 @@ vec3 viewDirection = normalize((inverseViewMatrix * vec4(vpos, 0.0)).xyz);
|
|
|
514
559
|
vec4 finalColor = vec4(
|
|
515
560
|
evaluateSceneLighting(normal, albedo.rgb, shadow, 1.0 - ssao, additionalLight,viewDirection, normal),
|
|
516
561
|
albedo.a
|
|
517
|
-
);`)):
|
|
562
|
+
);`)):P.main.add(`vec4 finalColor = albedo;`)),Y?P.main.add(_`if (finalColor.a < alphaCutoff) discard;
|
|
563
|
+
outputDepth(depth);`):P.main.add(`outputColorHighlightOLID(applySlice(finalColor, vpos), albedo.rgb, 0.0);`),k}const j=n(),M=Object.freeze(Object.defineProperty({__proto__:null,build:A,numRoundJoinSubdivisions:1},Symbol.toStringTag,{value:`Module`}));export{M as R,A as b,k as n};
|
package/config.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/6.0/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@6.0.0-next.
|
|
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@6.0.0-next.59/assets`,t.defaultAssetsPath=t.assetsPath);export{t as default};
|