// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("exports ../../../core/maybe ../../../chunks/vec32 ../../../geometry/support/aaBoundingBox ./terrainUtils ../webgl-engine/lib/Normals".split(" "),function(g,n,p,k,q,l){function m(a,b,c,d){a.setValues(b,16384*c,16384*d)}class r{constructor(){this.indices=null;this.poleIndicesStartIndex=this.edgeIndicesStartIndex=this.indexCount=0;this.vertexAttributes=null;this.maxEdgeVertexCount=this.poleVerticesStartIndex=this.edgeVerticesStartIndex=0;this.boundingBox=k.empty();this.minv=this.minu=this.numVerticesPerSide= 0;this.maxv=this.maxu=1;this.outerEdgesOffsetAndLength=[0,0,0,0,0,0,0,0]}release(){this.vertexAttributes=n.releaseMaybe(this.vertexAttributes);this.indices=null}reset(){this.vertexAttributes=this.indices=null;k.empty(this.boundingBox);this.numVerticesPerSide=0}getEdgeFirstVertexIndex(a){return this.outerEdgesOffsetAndLength[2*a]}getEdgeCount(a){return this.outerEdgesOffsetAndLength[2*a+1]}getEdgeVertexIndex(a,b){return this.getEdgeAttributeIndex(a,b)}getEdgeVertexPosition(a,b,c,d){this._getEdgeVertexRaw(this.getEdgeAttributeIndex(a, d),b);p.add(b,b,c)}getEdgeNormal(a,b,c){const {typedBuffer:d,typedBufferStride:e}=this.vertexAttributes.normalCompressed;l.decompressNormal(b,d,this.getEdgeAttributeIndex(a,c),e)}setEdgeNormalFromValues(a,b,c,d,e){this._setNormal(this.getEdgeAttributeIndex(a,b),c,d,e)}setEdgeVertexFromValuesRawPositionUV(a,b,c,d,e,f,h){a=this.getEdgeAttributeIndex(a,b);this.vertexAttributes.position.setValues(a,c,d,e);this._setUV(a,f,h)}setEdgeVertexFromValuesRawPositionUVNormal(a,b,c,d,e,f,h,t,u,v){a=this.getEdgeAttributeIndex(a, b);this.vertexAttributes.position.setValues(a,c,d,e);this._setUV(a,f,h);this._setNormal(a,t,u,v)}_getEdgeVertexRaw(a,b){this.vertexAttributes.position.getVec(a,b)}_setNormal(a,b,c,d){const {typedBuffer:e,typedBufferStride:f}=this.vertexAttributes.normalCompressed;l.compressNormal(e,a,b,c,d,f)}_setUV(a,b,c){m(this.vertexAttributes.uv0,a,b,c)}getEdgeAttributeIndex(a,b){q.internalAssert(0<=b&&b