123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- import {
- a2 as a,
- a3 as a2,
- b,
- c,
- d2 as d,
- d4 as d2,
- e2,
- e6 as e3,
- e8 as e4,
- h,
- h3 as h2,
- h4 as h3,
- i3 as i,
- i4 as i2,
- n2,
- n3,
- n4,
- o as o2,
- o2 as o3,
- o4 as o5,
- o7,
- p,
- p2,
- r2 as r,
- s,
- s2,
- t,
- u2 as u,
- u3 as u2,
- v,
- v2,
- x
- } from "./chunk-5242SYQJ.js";
- import {
- o2 as o4
- } from "./chunk-LDMWL65U.js";
- import {
- e
- } from "./chunk-UUVY36LI.js";
- import {
- f,
- n,
- o2 as o,
- o3 as o6
- } from "./chunk-FQZKJNXZ.js";
- import {
- O
- } from "./chunk-RUM3DXFX.js";
- // node_modules/@arcgis/core/chunks/RealisticTree.glsl.js
- function I(I2) {
- const R2 = new o(), { vertex: z, fragment: k, varyings: G } = R2;
- return v(z, I2), R2.include(o5), G.add("vpos", "vec3"), R2.include(s, I2), R2.include(p, I2), R2.include(a, I2), I2.output !== h.Color && I2.output !== h.Alpha || (c(R2.vertex, I2), R2.include(o2, I2), R2.include(r, I2), I2.offsetBackfaces && R2.include(e3), I2.instancedColor && R2.attributes.add(O.INSTANCECOLOR, "vec4"), G.add("vNormalWorld", "vec3"), G.add("localvpos", "vec3"), I2.hasMultipassTerrain && G.add("depth", "float"), R2.include(o3, I2), R2.include(d2, I2), R2.include(i, I2), R2.include(e4, I2), z.uniforms.add(new e("externalColor", (e5) => e5.externalColor)), G.add("vcolorExt", "vec4"), z.code.add(n`
- void main(void) {
- forwardNormalizedVertexColor();
- vcolorExt = externalColor;
- ${I2.instancedColor ? "vcolorExt *= instanceColor;" : ""}
- vcolorExt *= vvColor();
- vcolorExt *= getSymbolColor();
- forwardColorMixMode();
- if (vcolorExt.a < ${n.float(t)}) {
- gl_Position = vec4(1e38, 1e38, 1e38, 1.0);
- } else {
- vpos = calculateVPos();
- localvpos = vpos - view[3].xyz;
- vpos = subtractOrigin(vpos);
- vNormalWorld = dpNormal(vvLocalNormal(normalModel()));
- vpos = addVerticalOffset(vpos, localOrigin);
- gl_Position = transformPosition(proj, view, vpos);
- ${I2.offsetBackfaces ? "gl_Position = offsetBackfacingClipPosition(gl_Position, vpos, vNormalWorld, cameraPosition);" : ""}
- }
- ${I2.hasMultipassTerrain ? n`depth = (view * vec4(vpos, 1.0)).z;` : ""}
- forwardLinearDepth();
- forwardTextureCoordinates();
- }
- `)), I2.output === h.Alpha && (R2.include(u, I2), R2.include(s2, I2), R2.include(n4, I2), k.uniforms.add([new o6("opacity", (e5) => e5.opacity), new o6("layerOpacity", (e5) => e5.layerOpacity)]), I2.hasColorTexture && k.uniforms.add(new f("tex", (e5) => e5.texture)), k.include(i2), k.code.add(n`
- void main() {
- discardBySlice(vpos);
- ${I2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
- ${I2.hasColorTexture ? n`
- vec4 texColor = texture2D(tex, ${I2.hasColorTextureTransform ? n`colorUV` : n`vuv0`});
- ${I2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
- discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
- ${I2.hasVertexColors ? n`float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n`float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
- gl_FragColor = vec4(opacity_);
- }
- `)), I2.output === h.Color && (R2.include(u, I2), R2.include(p2, I2), R2.include(n2, I2), R2.include(s2, I2), R2.include(I2.instancedDoublePrecision ? h3 : v2, I2), R2.include(n4, I2), c(R2.fragment, I2), o7(k), h2(k), u2(k), k.uniforms.add([z.uniforms.get("localOrigin"), z.uniforms.get("view"), new e2("ambient", (e5) => e5.ambient), new e2("diffuse", (e5) => e5.diffuse), new o6("opacity", (e5) => e5.opacity), new o6("layerOpacity", (e5) => e5.layerOpacity)]), I2.hasColorTexture && k.uniforms.add(new f("tex", (e5) => e5.texture)), R2.include(x, I2), R2.include(n3, I2), k.include(i2), R2.extensions.add("GL_OES_standard_derivatives"), a2(k), k.code.add(n`
- void main() {
- discardBySlice(vpos);
- ${I2.hasMultipassTerrain ? n`terrainDepthTest(gl_FragCoord, depth);` : ""}
- ${I2.hasColorTexture ? n`
- vec4 texColor = texture2D(tex, ${I2.hasColorTextureTransform ? n`colorUV` : n`vuv0`});
- ${I2.textureAlphaPremultiplied ? "texColor.rgb /= texColor.a;" : ""}
- discardOrAdjustAlpha(texColor);` : n`vec4 texColor = vec4(1.0);`}
- vec3 viewDirection = normalize(vpos - cameraPosition);
- ${I2.pbrMode === d.Normal ? "applyPBRFactors();" : ""}
- float ssao = evaluateAmbientOcclusionInverse();
- ssao *= getBakedOcclusion();
- float additionalAmbientScale = additionalDirectedAmbientLight(vpos + localOrigin);
- vec3 additionalLight = ssao * mainLightIntensity * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor;
- ${I2.receiveShadows ? "float shadow = readShadowMap(vpos, linearDepth);" : I2.spherical ? "float shadow = lightingGlobalFactor * (1.0 - additionalAmbientScale);" : "float shadow = 0.0;"}
- vec3 matColor = max(ambient, diffuse);
- ${I2.hasVertexColors ? n`
- vec3 albedo = mixExternalColor(vColor.rgb * matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
- float opacity_ = layerOpacity * mixExternalOpacity(vColor.a * opacity, texColor.a, vcolorExt.a, int(colorMixMode));` : n`
- vec3 albedo = mixExternalColor(matColor, texColor.rgb, vcolorExt.rgb, int(colorMixMode));
- float opacity_ = layerOpacity * mixExternalOpacity(opacity, texColor.a, vcolorExt.a, int(colorMixMode));`}
- ${I2.snowCover ? n`albedo = mix(albedo, vec3(1), 0.9);` : n``}
- ${n`
- vec3 shadingNormal = normalize(vNormalWorld);
- albedo *= 1.2;
- vec3 viewForward = vec3(view[0][2], view[1][2], view[2][2]);
- float alignmentLightView = clamp(dot(viewForward, -mainLightDirection), 0.0, 1.0);
- float transmittance = 1.0 - clamp(dot(viewForward, shadingNormal), 0.0, 1.0);
- float treeRadialFalloff = vColor.r;
- float backLightFactor = 0.5 * treeRadialFalloff * alignmentLightView * transmittance * (1.0 - shadow);
- additionalLight += backLightFactor * mainLightIntensity;`}
- ${I2.pbrMode === d.Normal || I2.pbrMode === d.Schematic ? I2.spherical ? n`vec3 normalGround = normalize(vpos + localOrigin);` : n`vec3 normalGround = vec3(0.0, 0.0, 1.0);` : n``}
- ${I2.pbrMode === d.Normal || I2.pbrMode === d.Schematic ? n`
- float additionalAmbientIrradiance = additionalAmbientIrradianceFactor * mainLightIntensity[2];
- ${I2.snowCover ? n`
- mrr = vec3(0.0, 1.0, 0.04);
- emission = vec3(0.0);` : ""}
- vec3 shadedColor = evaluateSceneLightingPBR(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight, viewDirection, normalGround, mrr, emission, additionalAmbientIrradiance);` : n`vec3 shadedColor = evaluateSceneLighting(shadingNormal, albedo, shadow, 1.0 - ssao, additionalLight);`}
- gl_FragColor = highlightSlice(vec4(shadedColor, opacity_), vpos);
- ${I2.transparencyPassType === o4.Color ? n`gl_FragColor = premultiplyAlpha(gl_FragColor);` : n``}
- }
- `)), R2.include(b, I2), R2;
- }
- var R = Object.freeze(Object.defineProperty({ __proto__: null, build: I }, Symbol.toStringTag, { value: "Module" }));
- export {
- I,
- R
- };
- //# sourceMappingURL=chunk-VW76IV6V.js.map
|