/* COPYRIGHT Esri - https://js.arcgis.com/5.1.0/LICENSE.txt */
import{copy as e,multiply as o}from"../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../core/libs/gl-matrix-2/factories/mat4f64.js";import{Float4BindUniform as r}from"../views/3d/webgl-engine/core/shaderModules/Float4BindUniform.js";import{FloatBindUniform as i}from"../views/3d/webgl-engine/core/shaderModules/FloatBindUniform.js";import{glsl as t}from"../views/3d/webgl-engine/core/shaderModules/glsl.js";import{Matrix4PassUniform as l}from"../views/3d/webgl-engine/core/shaderModules/Matrix4PassUniform.js";import{ShaderBuilder as s}from"../views/webgl/ShaderBuilder.js";function n(){const e=new s;return e.attributes.add("position","vec3"),e.attributes.add("color","vec4"),e.attributes.add("size","float"),e.varyings.add("vcolor","vec4"),e.varyings.add("vsize","float"),e.vertex.uniforms.add(new l("transform",(e,o)=>c(e,o)),new r("viewport",e=>e.camera.fullViewport),new i("pixelRatio",e=>e.camera.pixelRatio)),e.vertex.main.add(t`gl_Position = transform * vec4(position, 0);
vcolor = color / 1.2;
vsize = size * 5.0 * pixelRatio;
gl_PointSize = vsize;`),e.fragment.main.add(t`float cap = 0.7;
float scale = 1.0 / cap;
float helper = clamp(length(abs(gl_PointCoord - vec2(0.5))), 0.0, cap);
float alpha = clamp((cap - helper) * scale, 0.0, 1.0);
float intensity = alpha * alpha * alpha;
if (vsize < 3.0) {
intensity *= 0.5;
}
fragColor = vec4(vcolor.xyz, intensity);`),e}function c(a,r){const i=24e-8;return e(d,r.camera.projectionMatrix),d[10]=i-1,d[11]=-1,d[14]=(i-2)*r.camera.near,o(d,d,r.camera.viewMatrix),o(d,d,a.modelMatrix)}const d=a(),m=Object.freeze(Object.defineProperty({__proto__:null,build:n},Symbol.toStringTag,{value:"Module"}));export{m as S,n as b};
