/*
All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
*/
import{neverReached as e}from"../../../../../../core/compilerUtils.js";import{glsl as r}from"../../shaderModules/glsl.js";function o(o,a){switch(o.fragment.code.add(r`vec3 screenDerivativeNormal(vec3 positionView) {
return normalize(cross(dFdx(positionView), dFdy(positionView)));
}`),a.normalType){case 1:o.attributes.add("normalCompressed","vec2"),o.vertex.code.add(r`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:o.attributes.add("normal","vec3"),o.vertex.code.add(r`vec3 normalModel() {
return normal;
}`);break;default:e(a.normalType);case 2:case 3:}}export{o as NormalAttribute};
