@arcgis/core 4.30.0-next.20240611 → 4.30.0-next.20240613
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/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/6ae4a5e81fd398d2ebca.js +1 -0
- package/assets/esri/themes/base/widgets/_FeatureForm.scss +0 -4
- package/assets/esri/themes/base/widgets/_Print.scss +4 -30
- package/assets/esri/themes/base/widgets/_SnappingControls.scss +5 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ShadowHighlight.glsl.js +4 -29
- package/chunks/Viewshed.glsl.js +145 -84
- package/interfaces.d.ts +210 -76
- package/layers/support/featureLayerUtils.js +1 -1
- package/layers/support/wmsUtils.js +1 -1
- package/package.json +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/support/svgUtils.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/pointToPoint/Camera.js +1 -1
- package/views/3d/layers/VectorTileLayerView3D.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js +23 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ViewshedTechniqueConfiguration.js +5 -0
- package/views/draw/support/Reshape.js +1 -1
- package/views/draw/support/reshapeTooltipUtils.js +1 -1
- package/widgets/Compass/CompassViewModel.js +1 -1
- package/widgets/Feature/support/featureUtils.js +1 -1
- package/widgets/FeatureForm/FieldInput.js +1 -1
- package/widgets/FeatureForm/css.js +1 -1
- package/widgets/FeatureForm/featureFormUtils.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
- package/widgets/FeatureTable/Grid/Column.js +1 -1
- package/widgets/FeatureTable/support/tableUtils.js +1 -1
- package/widgets/FeatureTable.js +1 -1
- package/widgets/LayerList.js +1 -1
- package/widgets/Legend/styles/support/relationshipUtils.js +1 -1
- package/widgets/NavigationToggle/NavigationToggleViewModel.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Print.js +1 -1
- package/widgets/VersionManagement/VersionManagementViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingControlsViewModel.js +1 -1
- package/widgets/support/SnappingControls/SnappingListItem.js +1 -1
- package/widgets/support/SnappingControls/snappingLayerListUtils.js +1 -1
- package/widgets/support/SnappingControls.js +1 -1
- package/assets/esri/core/workers/chunks/17e8791bad1e2c3a0bb1.js +0 -1
|
@@ -2,36 +2,11 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{invert as e,translate as i}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as t,h as
|
|
6
|
-
vec3 normalFromDepth(vec3 pixelPos, vec2 fragCoord, vec2 uv) {
|
|
7
|
-
ivec2 iuv = ivec2(uv * vec2(textureSize(depthMap, 0)));
|
|
8
|
-
float leftPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(-1, 0), 0).r);
|
|
9
|
-
float rightPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(1, 0), 0).r);
|
|
10
|
-
float bottomPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(0, -1), 0).r);
|
|
11
|
-
float topPixelDepth = linearizeDepth(texelFetch(depthMap, iuv + ivec2(0, 1), 0).r);
|
|
12
|
-
|
|
13
|
-
bool pickLeft = abs(pixelPos.z - leftPixelDepth) < abs(pixelPos.z - rightPixelDepth);
|
|
14
|
-
bool pickBottom = abs(pixelPos.z - bottomPixelDepth) < abs(pixelPos.z - topPixelDepth);
|
|
15
|
-
|
|
16
|
-
vec3 fragCoordHorizontal = pickLeft
|
|
17
|
-
? vec3(fragCoord + vec2(-1.0, 0.0), leftPixelDepth)
|
|
18
|
-
: vec3(fragCoord + vec2(1.0, 0.0), rightPixelDepth);
|
|
19
|
-
vec3 fragCoordVertical = pickBottom
|
|
20
|
-
? vec3(fragCoord + vec2(0.0, -1.0), bottomPixelDepth)
|
|
21
|
-
: vec3(fragCoord + vec2(0.0, 1.0), topPixelDepth);
|
|
22
|
-
|
|
23
|
-
vec3 verticalPixelPos = reconstructPosition(fragCoordHorizontal.xy, fragCoordHorizontal.z);
|
|
24
|
-
vec3 horizontalPixelPos = reconstructPosition(fragCoordVertical.xy, fragCoordVertical.z);
|
|
25
|
-
|
|
26
|
-
vec3 normal = normalize(cross(verticalPixelPos - pixelPos, horizontalPixelPos - pixelPos));
|
|
27
|
-
// Flip normal depending on triangle winding order for consistency
|
|
28
|
-
return pickLeft == pickBottom ? normal : -normal;
|
|
29
|
-
}
|
|
30
|
-
|
|
5
|
+
import{invert as e,translate as i}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{n as t,h as a}from"./vec32.js";import{create as r}from"../core/libs/gl-matrix-2/factories/vec3f64.js";import{NormalFromDepth as l}from"../views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js";import{ScreenSpacePass as s}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{unoccludedHighlightFlag as d}from"../views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js";import{ReadShadowMapPass as h}from"../views/3d/webgl-engine/core/shaderLibrary/shading/ReadShadowMap.glsl.js";import{RgbaFloatEncoding as n}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloatEncoding.glsl.js";import{Float3PassUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{Float4PassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Float4PassUniform.js";import{FloatPassUniform as p}from"../views/3d/webgl-engine/core/shaderModules/FloatPassUniform.js";import{glsl as m}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4PassUniform as w}from"../views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js";import{ShaderBuilder as u}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as f}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";import{SnapshotSlot as v}from"../views/3d/webgl-engine/lib/ShadowMap.js";const x=.99999,b=.025;function M(o){const r=new u;r.include(h,o),r.include(s),r.include(l);const M=r.fragment;return M.include(n),M.uniforms.add(new f("defaultDepthTex",((e,i)=>i.shadowMap.getSnapshot(v.ExcludeHighlight))),new f("highlightDepthTex",((e,i)=>i.shadowMap.getSnapshot(v.Highlight))),new f("depthMap",((e,i)=>i.depth?.attachment)),new f("highlightTexture",(e=>e.highlight)),new g("uColor",(e=>e.shadowColor)),new p("opacity",(e=>e.shadowOpacity)),new p("occludedOpacity",(e=>e.occludedShadowOpacity)),new p("terminationFactor",(e=>e.opacityElevation*e.dayNightTerminator)),new c("lightingMainDirectionView",((e,i)=>t(S,a(S,i.lighting.mainLight.direction,i.camera.viewInverseTransposeMatrix)))),new w("inverseViewMatrix",((o,t)=>e(y,i(y,t.camera.viewMatrix,t.camera.center))))),M.constants.add("unoccludedHighlightFlag","vec4",d),M.code.add(m`
|
|
31
6
|
void main(void) {
|
|
32
7
|
vec4 highlightInfo = texture(highlightTexture, uv);
|
|
33
8
|
float visiblyHighlighted = (1.0 - clamp(distance(unoccludedHighlightFlag, highlightInfo), 0.0, 1.0)) * highlightInfo.a;
|
|
34
|
-
if (visiblyHighlighted > ${m.float(
|
|
9
|
+
if (visiblyHighlighted > ${m.float(x)}) {
|
|
35
10
|
discard;
|
|
36
11
|
}
|
|
37
12
|
|
|
@@ -72,10 +47,10 @@ import{invert as e,translate as i}from"../core/libs/gl-matrix-2/math/mat4.js";im
|
|
|
72
47
|
float depthDefault = readShadowMapDepth(uvShadow, defaultDepthTex);
|
|
73
48
|
bool shadowDefault = depthDefault < lvpos.z;
|
|
74
49
|
|
|
75
|
-
vec3 normal = normalFromDepth(currentPixelPos.xyz, gl_FragCoord.xy, uv);
|
|
50
|
+
vec3 normal = normalFromDepth(depthMap, currentPixelPos.xyz, gl_FragCoord.xy, uv);
|
|
76
51
|
bool shaded = dot(normal, lightingMainDirectionView) < ${m.float(b)};
|
|
77
52
|
|
|
78
53
|
float fragOpacity = (shadowDefault || shaded) ? occludedOpacity : opacity;
|
|
79
54
|
fragColor = vec4(uColor.rgb, uColor.a * fragOpacity * terminationFactor);
|
|
80
55
|
}
|
|
81
|
-
`),
|
|
56
|
+
`),r}const y=o(),S=r(),D=Object.freeze(Object.defineProperty({__proto__:null,build:M},Symbol.toStringTag,{value:"Module"}));export{D as S,M as b};
|
package/chunks/Viewshed.glsl.js
CHANGED
|
@@ -2,87 +2,148 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
float depth
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
float
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
return
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
vec2 uv
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
if (
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
5
|
+
import{invertOrIdentity as e}from"../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as o}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{NormalFromDepth as t}from"../views/3d/webgl-engine/core/shaderLibrary/NormalFromDepth.glsl.js";import{ScreenSpacePass as r}from"../views/3d/webgl-engine/core/shaderLibrary/ScreenSpacePass.glsl.js";import{ReadDepth as a}from"../views/3d/webgl-engine/core/shaderLibrary/output/ReadDepth.glsl.js";import{LocalFromScreenSpacePassParameters as s,LocalFromScreenSpace as n}from"../views/3d/webgl-engine/core/shaderLibrary/util/LocalFromScreenSpace.glsl.js";import{Rgba4FloatEncoding as d}from"../views/3d/webgl-engine/core/shaderLibrary/util/RgbaFloat16Encoding.glsl.js";import{TextureAtlasLookup as l}from"../views/3d/webgl-engine/core/shaderLibrary/util/TextureAtlasLookup.glsl.js";import{Float2PassUniform as h}from"../views/3d/webgl-engine/core/shaderModules/Float2PassUniform.js";import{Float3PassUniform as c}from"../views/3d/webgl-engine/core/shaderModules/Float3PassUniform.js";import{FloatsPassUniform as v}from"../views/3d/webgl-engine/core/shaderModules/FloatsPassUniform.js";import{IntegerPassUniform as w}from"../views/3d/webgl-engine/core/shaderModules/IntegerPassUniform.js";import{glsl as m}from"../views/3d/webgl-engine/core/shaderModules/interfaces.js";import{Matrix4PassUniform as p}from"../views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js";import{Matrix4sPassUniform as u}from"../views/3d/webgl-engine/core/shaderModules/Matrix4sPassUniform.js";import{ShaderBuilder as f}from"../views/3d/webgl-engine/core/shaderModules/ShaderBuilder.js";import{Texture2DPassUniform as g}from"../views/3d/webgl-engine/core/shaderModules/Texture2DPassUniform.js";class x extends s{constructor(){super(...arguments),this.targetVector=[1,0,0],this.upVector=[0,0,1],this.fovs=[45,45],this.headingAndTilt=[0,0],this.shadowMap={depthTexture:null,nearFar:[1,100],numActiveFaces:1,atlasRegions:[[0,0,1,1]]},this.projectionMatrices=i.flat(),this.viewMatrices=i.flat()}}function b(i){const o=new f,s=o.fragment;o.include(r),o.include(n),o.include(l),s.include(a),s.include(d),s.uniforms.add(new g("depthTexture",((e,i)=>i.depth?.attachment))),s.uniforms.add(new p("inverseProjectionMatrix",((e,i)=>i.camera.inverseProjectionMatrix)),new p("inverseViewNormalMatrix",((i,o)=>e(M,o.camera.viewInverseTransposeMatrix)))),s.uniforms.add(new c("viewshedTargetVector",((e,i)=>e.targetVector)),new c("viewshedUpVector",((e,i)=>e.upVector)),new h("viewshedFOVs",((e,i)=>e.fovs)),new h("viewshedHeadingAndTilt",((e,i)=>e.headingAndTilt)),new h("viewshedNearFar",((e,i)=>e.shadowMap.nearFar??[1,100]))),s.uniforms.add(new g("viewshedShadowMap",(e=>e.shadowMap.depthTexture)),new u("viewshedProjectionMatrices",((e,i)=>e.projectionMatrices),6),new u("viewshedViewMatrices",((e,i)=>e.viewMatrices),6),new w("viewshedNumFaces",((e,i)=>e.shadowMap.numActiveFaces)),new v("viewshedAtlasRegions",((e,i)=>e.shadowMap.atlasRegions.flat()),24)),s.constants.add("visibleColor","vec4",[0,1,0,.5]),s.constants.add("occludedColor","vec4",[1,0,0,.5]);const x=i.useNormalMap;return x?(s.uniforms.add(new g("normalMap",((e,i)=>e.normalTexture))),s.code.add(m`vec3 normalFromTexture() {
|
|
6
|
+
vec4 norm4 = texture(normalMap, uv);
|
|
7
|
+
vec3 nNormal = vec3(-1.0) + 2.0 * norm4.xyz;
|
|
8
|
+
return normalize((inverseViewNormalMatrix * vec4(nNormal, 1.0)).xyz);
|
|
9
|
+
}`)):o.include(t),s.code.add(m`
|
|
10
|
+
// UV coordinates of point projected onto viewshed shadow map
|
|
11
|
+
vec2 getViewshedUv(vec4 worldPosition, int face) {
|
|
12
|
+
mat4 viewshedMatrix = viewshedProjectionMatrices[face];
|
|
13
|
+
vec4 viewshedUv4 = viewshedMatrix * worldPosition;
|
|
14
|
+
vec3 viewshedUv = viewshedUv4.xyz / viewshedUv4.w;
|
|
15
|
+
return viewshedUv.xy;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
float viewshedDepthToFloat(float depth) {
|
|
19
|
+
return (depth - viewshedNearFar[0]) / (viewshedNearFar[1] - viewshedNearFar[0]);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Orthographic depth to viewshed of given point and given cube map face in range [0, 1].
|
|
23
|
+
float getOrthographicDepthToViewshed(vec4 worldPosition, int face) {
|
|
24
|
+
mat4 viewshedViewMatrix = viewshedViewMatrices[face];
|
|
25
|
+
vec4 viewshedUv4 = viewshedViewMatrix * worldPosition;
|
|
26
|
+
vec3 viewshedUv = viewshedUv4.xyz / viewshedUv4.w;
|
|
27
|
+
float depth = -viewshedUv.z;
|
|
28
|
+
return viewshedDepthToFloat(depth);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Read depth from shadow map given uv and cube map face
|
|
32
|
+
float getDepthFromShadowMap(vec2 uv, int face) {
|
|
33
|
+
int index = 4 * face;
|
|
34
|
+
|
|
35
|
+
float umin = viewshedAtlasRegions[index];
|
|
36
|
+
float umax = viewshedAtlasRegions[index + 1];
|
|
37
|
+
float vmin = viewshedAtlasRegions[index + 2];
|
|
38
|
+
float vmax = viewshedAtlasRegions[index + 3];
|
|
39
|
+
|
|
40
|
+
vec4 atlasRegion = vec4(umin, vmin, umax, vmax);
|
|
41
|
+
return rgba4ToFloat(textureAtlasLookup(viewshedShadowMap, uv, atlasRegion));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
struct ViewshedPoint {
|
|
45
|
+
int face;
|
|
46
|
+
vec2 uv;
|
|
47
|
+
bool isWithin;
|
|
48
|
+
float orthographicDepth;
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// Find cube map face the given position lies in and return relevant information about it
|
|
52
|
+
bool getViewshedPoint(vec4 worldPosition, out ViewshedPoint point) {
|
|
53
|
+
vec3 nUp = normalize(viewshedUpVector);
|
|
54
|
+
|
|
55
|
+
// Try with all active cube map faces
|
|
56
|
+
for(int i=0; i < viewshedNumFaces; i++) {
|
|
57
|
+
|
|
58
|
+
// Check if when projected, point lies within shadow map texture
|
|
59
|
+
vec2 viewshedUv = getViewshedUv(worldPosition, i);
|
|
60
|
+
if (viewshedUv.x > 0.0 && viewshedUv.x < 1.0 && viewshedUv.y > 0.0 && viewshedUv.y < 1.0) {
|
|
61
|
+
float orthoDepth = getOrthographicDepthToViewshed(worldPosition, i);
|
|
62
|
+
if (orthoDepth >= 0.0) { // found a cube map face
|
|
63
|
+
|
|
64
|
+
// Check whether point is really inside viewshed geometry, not just within the camera frustum
|
|
65
|
+
|
|
66
|
+
// outside farDistance
|
|
67
|
+
vec3 position = worldPosition.xyz;
|
|
68
|
+
bool isWithin = length(position) <= viewshedNearFar[1];
|
|
69
|
+
|
|
70
|
+
// horizontally outside fov
|
|
71
|
+
float t = dot(nUp, position);
|
|
72
|
+
bool isBottomHalf = t > 0.0;
|
|
73
|
+
vec3 nProjVector = normalize(position - t * nUp);
|
|
74
|
+
if (isWithin) {
|
|
75
|
+
float angle = acos(dot(normalize(viewshedTargetVector), nProjVector));
|
|
76
|
+
if (angle > viewshedFOVs[0] / 2.0) {
|
|
77
|
+
isWithin = false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// vertically outside fov
|
|
82
|
+
if (isWithin) {
|
|
83
|
+
float angle = acos(dot(nProjVector, normalize(position)));
|
|
84
|
+
if (!isBottomHalf) {
|
|
85
|
+
angle = -angle;
|
|
86
|
+
}
|
|
87
|
+
float tilt = viewshedHeadingAndTilt[1];
|
|
88
|
+
float limit = viewshedFOVs[1] / 2.0;
|
|
89
|
+
if (angle > limit || angle < -limit) {
|
|
90
|
+
isWithin = false;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
point = ViewshedPoint(i, viewshedUv, isWithin, orthoDepth);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// no cube face matches
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
float normalCosAngle(float linearDepth, vec3 localPosition) {
|
|
105
|
+
${x?m`vec3 normal = normalFromTexture();`:m`
|
|
106
|
+
vec3 cameraSpacePosition = reconstructPosition(gl_FragCoord.xy, linearDepth);
|
|
107
|
+
vec3 normal = normalFromDepth(depthTexture, cameraSpacePosition, gl_FragCoord.xy, uv);
|
|
108
|
+
normal = (inverseViewNormalMatrix * vec4(normal, 1.0)).xyz;
|
|
109
|
+
`};
|
|
110
|
+
|
|
111
|
+
vec3 viewingDir = normalize(localPosition);
|
|
112
|
+
return dot(normal, viewingDir);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
void main() {
|
|
116
|
+
float depth = depthFromTexture(depthTexture, uv);
|
|
117
|
+
|
|
118
|
+
// Outside camera planes
|
|
119
|
+
if (depth >= 1.0 || depth <= 0.0) {
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
float linearDepth = linearizeDepth(depth);
|
|
124
|
+
|
|
125
|
+
// Relative to viewshed position
|
|
126
|
+
vec4 localPosition = reconstructLocalPosition(gl_FragCoord.xy, linearDepth);
|
|
127
|
+
|
|
128
|
+
ViewshedPoint point;
|
|
129
|
+
bool foundFace = getViewshedPoint(localPosition, point);
|
|
130
|
+
|
|
131
|
+
// Outside every viewshed
|
|
132
|
+
if (!foundFace || !point.isWithin) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
float viewshedDepth = getDepthFromShadowMap(point.uv, point.face);
|
|
137
|
+
float distance = point.orthographicDepth;
|
|
138
|
+
|
|
139
|
+
bool visible = distance < viewshedDepth;
|
|
140
|
+
fragColor = visible ? visibleColor : occludedColor;
|
|
141
|
+
|
|
142
|
+
float cosAngle = normalCosAngle(linearDepth, localPosition.xyz);
|
|
143
|
+
|
|
144
|
+
// Everything facing away, and close to parallel is considered occluded.
|
|
145
|
+
// Theshold corresponds to around 0.6 degrees, tuned empirically.
|
|
146
|
+
if (cosAngle > -0.01) {
|
|
147
|
+
fragColor = occludedColor;
|
|
148
|
+
}
|
|
149
|
+
}`),o}const M=o(),P=Object.freeze(Object.defineProperty({__proto__:null,ViewshedPassParameters:x,build:b},Symbol.toStringTag,{value:"Module"}));export{x as V,P as a,b};
|