/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{invertOrIdentity as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{Matrix4BindUniform as r}from"../core/shaderModules/Matrix4BindUniform.js";function o(i,o={needUVs:!0,needEyeDirection:!0}){i.attributes.add("position","vec2"),i.varyings.add("worldRay","vec3");const{needUVs:a,needEyeDirection:t}=o;i.vertex.uniforms.add(new r("inverseProjectionMatrix",e=>e.camera.inverseProjectionMatrix),new r("inverseViewMatrix",i=>e(n,i.camera.viewMatrix))).main.add("\n    gl_Position = vec4(position, 1, 1);\n\n    vec3 posViewNear = (inverseProjectionMatrix * vec4(position, -1.0, 1.0)).xyz;\n    worldRay = (inverseViewMatrix * vec4(posViewNear, 0)).xyz;\n  "),a&&(i.varyings.add("uv","vec2"),i.vertex.main.add("uv = position * 0.5 + vec2(0.5);")),t&&(i.varyings.add("eyeDir","vec3"),i.vertex.main.add("eyeDir = posViewNear;"))}const n=i();export{o as ScreenSpacePassAtmosphere};
