UNPKG

@arcgis/core

Version:

ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API

14 lines (13 loc) 729 B
/* All material copyright ESRI, All Rights Reserved, unless otherwise specified. See https://js.arcgis.com/4.32/esri/copyright.txt for details. */ import{glsl as n}from"../../shaderModules/glsl.js";function e(e,t){e.varyings.add("tbnTangent","vec3"),e.varyings.add("tbnBiTangent","vec3"),t.spherical?e.vertex.code.add(n`void forwardVertexTangent(vec3 n) { tbnTangent = normalize(cross(vec3(0.0, 0.0, 1.0), n)); tbnBiTangent = normalize(cross(n, tbnTangent)); }`):e.vertex.code.add(n`void forwardVertexTangent(vec3 n) { tbnTangent = vec3(1.0, 0.0, 0.0); tbnBiTangent = normalize(cross(n, tbnTangent)); }`),e.fragment.code.add(n`mat3 getTBNMatrix(vec3 n) { return mat3(tbnTangent, tbnBiTangent, n); }`)}export{e as VertexTangent};