/* COPYRIGHT Esri - https://js.arcgis.com/5.1.2/LICENSE.txt */
import{glsl as e}from"../../shaderModules/glsl.js";function r(r,o){switch(r.fragment.code.add(e`vec3 screenDerivativeNormal(vec3 positionView) {
return normalize(cross(dFdx(positionView), dFdy(positionView)));
}`),o.normalType){case 1:r.attributes.add("normalCompressed","vec2"),r.vertex.code.add(e`vec3 decompressNormal(vec2 normal) {
float z = 1.0 - abs(normal.x) - abs(normal.y);
return vec3(normal + sign(normal) * min(z, 0.0), z);
}
vec3 normalModel() {
return decompressNormal(normalCompressed);
}`);break;case 0:r.attributes.add("normal","vec3"),r.vertex.code.add(e`vec3 normalModel() {
return normal;
}`);break;default:o.normalType;case 2:case 3:}}export{r as NormalAttribute};
