/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.24/esri/copyright.txt for details.
*/
define(["exports","../../../../chunks/_rollupPluginBabelHelpers","../../../../chunks/vec3","../../../../chunks/vec3f64","../../support/buffer/InterleavedLayout","../core/shaderLibrary/ShaderOutputOptions","../lib/basicInterfaces","../lib/GLMaterial","../lib/Material","../lib/RenderSlot","../lib/VertexAttribute","../shaders/MeasurementArrowTechnique"],(function(e,t,r,n,i,o,s,a,u,c,l,f){"use strict";let p=function(e){function r(t){var r;return(r=e.call(this,t,new d)||this).techniqueConfig=new f.MeasurementArrowTechniqueConfiguration,r}t._inheritsLoose(r,e);var n=r.prototype;return n.getConfiguration=function(e,t){var r;return this.techniqueConfig.polygonOffsetEnabled=this.parameters.polygonOffset,this.techniqueConfig.transparent=this.parameters.stripeEvenColor[3]<1||this.parameters.stripeOddColor[3]<1||this.parameters.outlineColor[3]<1,this.techniqueConfig.transparencyPassType=null!=(r=null==t?void 0:t.transparencyPassType)?r:s.TransparencyPassType.NONE,this.techniqueConfig},n.dispose=function(){},n.intersect=function(){},n.requiresSlot=function(e){return e===c.RenderSlot.OPAQUE_MATERIAL},n.createGLMaterial=function(e){return e.output===o.ShaderOutput.Color?new h(e):null},n.createBufferWriter=function(){return new y},r}(u.Material),h=function(e){function r(){return e.apply(this,arguments)||this}return t._inheritsLoose(r,e),r.prototype.beginSlot=function(e){return this.ensureTechnique(f.MeasurementArrowTechnique,e)},r}(a),d=function(e){function r(){var t;return(t=e.apply(this,arguments)||this).width=32,t.outlineSize=.2,t.outlineColor=[1,.5,0,1],t.stripeLength=1,t.stripeEvenColor=[1,1,1,1],t.stripeOddColor=[1,.5,0,1],t.polygonOffset=!1,t}return t._inheritsLoose(r,e),r}(u.MaterialParameters);const b=i.newLayout().vec3f(l.VertexAttribute.POSITION).vec3f(l.VertexAttribute.NORMAL).vec2f(l.VertexAttribute.UV0).f32(l.VertexAttribute.AUXPOS1),g=n.create(),m=n.create(),v=n.create(),A=n.create(),O=n.create();let y=function(){function e(){this.vertexBufferLayout=b}var t=e.prototype;return t.allocate=function(e){return this.vertexBufferLayout.createBuffer(e)},t.elementCount=function(e){return 2*(e.indices.get(l.VertexAttribute.POSITION).length/2+1)},t.write=function(e,t,n,i){const o=t.vertexAttributes.get(l.VertexAttribute.POSITION).data,s=t.vertexAttributes.get(l.VertexAttribute.NORMAL).data,a=o.length/3,u=t&&t.indices&&t.indices.get(l.VertexAttribute.POSITION);u&&u.length!==2*(a-1)&&console.warn("MeasurementArrowMaterial does not support indices");const c=g,f=m,p=v,h=A,d=O,b=e.transformation,y=e.invTranspTransformation,M=n.position,T=n.normal,x=n.uv0;let C=0;for(let l=0;l<a;++l){const e=3*l;if(r.set(c,o[e],o[e+1],o[e+2]),l<a-1){const e=3*(l+1);r.set(f,o[e],o[e+1],o[e+2]),r.set(d,s[e],s[e+1],s[e+2]),r.normalize(d,d),r.subtract(p,f,c),r.normalize(p,p),r.cross(h,d,p),r.normalize(h,h)}const t=r.distance(c,f);b&&y&&(r.transformMat4(c,c,b),r.transformMat4(f,f,b),r.transformMat4(h,h,y));const n=i+2*l,u=n+1;M.setVec(n,c),M.setVec(u,c),T.setVec(n,h),T.setVec(u,h),x.set(n,0,C),x.set(n,1,-1),x.set(u,0,C),x.set(u,1,1),l<a-1&&(C+=t)}const L=n.auxpos1;for(let r=0;r<2*a;++r)L.set(i+r,C)},e}();e.MeasurementArrowMaterial=p,e.Parameters=d,Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
