1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[48647],{48647:(e,s,t)=>{var i=t(82541),n=t(46015),r=t(74307),o=t(58630),h=t(21891),a=t(20660),l=t(38713),d=t(37678),c=t(95897);n.u.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},n.u.prototype.enableEdgesRendering=function(e=.95,s=!1,t){return this.disableEdgesRendering(),this._edgesRenderer=new _(this,e,s,!0,t),this},Object.defineProperty(n.u.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),r.l.prototype.enableEdgesRendering=function(e=.95,s=!1){return this.disableEdgesRendering(),this._edgesRenderer=new g(this,e,s),this},r.Q.prototype.enableEdgesRendering=function(e=.95,s=!1){return r.l.prototype.enableEdgesRendering.apply(this,[e,s]),this};class u{constructor(){this.edges=[],this.edgesConnectedCount=0}}class _{get linesPositions(){return this._linesPositions}get linesNormals(){return this._linesNormals}get linesIndices(){return this._linesIndices}get lineShader(){return this._lineShader}set lineShader(e){this._lineShader=e}static _GetShader(e,s){if(!e._edgeRenderLineShader){let i=new a.B("lineShader",e,"line",{attributes:["position","normal"],uniforms:["world","viewProjection","color","width","aspectRatio"],uniformBuffers:["Scene","Mesh"],shaderLanguage:s,extraInitializationsAsync:async()=>{1===s?await Promise.all([t.e(58047).then(t.bind(t,58047)),t.e(38333).then(t.bind(t,38333))]):await Promise.all([t.e(31540).then(t.bind(t,31540)),t.e(444).then(t.bind(t,444))])}},!1);i.disableDepthWrite=!0,i.backFaceCulling=!1,i.checkReadyOnEveryCall=e.getEngine().isWebGPU,i.doNotSerialize=!0,e._edgeRenderLineShader=i,e.onDisposeObservable.add(()=>{e._edgeRenderLineShader.dispose(),e._edgeRenderLineShader=null})}return e._edgeRenderLineShader}get shaderLanguage(){return this._shaderLanguage}constructor(e,s=.95,t=!1,i=!0,n){this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=[],this._linesNormals=[],this._linesIndices=[],this._buffers={},this._buffersForInstances={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this.customInstances=new d.L(32),this._shaderLanguage=0,this._source=e,this._checkVerticesInsteadOfIndices=t,this._options=n??null,this._epsilon=s;let r=this._source.getScene().getEngine();r.isWebGPU&&(this._drawWrapper=new c.E(r),this._shaderLanguage=1),this._prepareResources(),i&&(n?.useAlternateEdgeFinder??!0?this._generateEdgesLinesAlternate():this._generateEdgesLines()),this._meshRebuildObserver=this._source.onRebuildObservable.add(()=>{this._rebuild()}),this._meshDisposeObserver=this._source.onDisposeObservable.add(()=>{this.dispose()})}_prepareResources(){this._lineShader||(this._lineShader=_._GetShader(this._source.getScene(),this._shaderLanguage))}_rebuild(){let e=this._buffers[i.R.PositionKind];e&&e._rebuild(),(e=this._buffers[i.R.NormalKind])&&e._rebuild();let s=this._source.getScene().getEngine();this._ib=s.createIndexBuffer(this._linesIndices)}dispose(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);let e=this._buffers[i.R.PositionKind];e&&(e.dispose(),this._buffers[i.R.PositionKind]=null),(e=this._buffers[i.R.NormalKind])&&(e.dispose(),this._buffers[i.R.NormalKind]=null),this._ib&&this._source.getScene().getEngine()._releaseBuffer(this._ib),this._drawWrapper?.dispose()}_processEdgeForAdjacencies(e,s,t,i,n){return e===t&&s===i||e===i&&s===t?0:e===i&&s===n||e===n&&s===i?1:e===n&&s===t||e===t&&s===n?2:-1}_processEdgeForAdjacenciesWithVertices(e,s,t,i,n){return e.equalsWithEpsilon(t,1e-10)&&s.equalsWithEpsilon(i,1e-10)||e.equalsWithEpsilon(i,1e-10)&&s.equalsWithEpsilon(t,1e-10)?0:e.equalsWithEpsilon(i,1e-10)&&s.equalsWithEpsilon(n,1e-10)||e.equalsWithEpsilon(n,1e-10)&&s.equalsWithEpsilon(i,1e-10)?1:e.equalsWithEpsilon(n,1e-10)&&s.equalsWithEpsilon(t,1e-10)||e.equalsWithEpsilon(t,1e-10)&&s.equalsWithEpsilon(n,1e-10)?2:-1}_checkEdge(e,s,t,i,n){(void 0===s||o.Pq.Dot(t[e],t[s])<this._epsilon)&&this.createLine(i,n,this._linesPositions.length/3)}createLine(e,s,t){this._linesPositions.push(e.x,e.y,e.z,e.x,e.y,e.z,s.x,s.y,s.z,s.x,s.y,s.z),this._linesNormals.push(s.x,s.y,s.z,-1,s.x,s.y,s.z,1,e.x,e.y,e.z,
1-1,e.x,e.y,e.z,1),this._linesIndices.push(t,t+1,t+2,t,t+2,t+3)}_tessellateTriangle(e,s,t,i){let n=(e,s,t)=>{t>=0&&s.push(t);for(let t=0;t<e.length;++t)s.push(e[t][0])},r=0;e[1].length>=e[0].length&&e[1].length>=e[2].length?r=1:e[2].length>=e[0].length&&e[2].length>=e[1].length&&(r=2);for(let s=0;s<3;++s)s===r?e[s].sort((e,s)=>e[1]<s[1]?-1:+(e[1]>s[1])):e[s].sort((e,s)=>e[1]>s[1]?-1:+(e[1]<s[1]));let o=[],h=[];n(e[r],o,-1);let a=o.length;for(let o=r+2;o>=r+1;--o)n(e[o%3],h,o!==r+2?i[t[s+(o+1)%3]]:-1);let l=h.length;t.push(i[t[s+r]],o[0],h[0]),t.push(i[t[s+(r+1)%3]],h[l-1],o[a-1]);let d=a<=l,c=d?a:l,u=d?l:a,_=d?a-1:l-1,g=+!d,p=a+l-2,f=0,b=0,R=d?o:h,A=d?h:o,m=0;for(;p-- >0;){let e;g?t.push(R[f],A[b]):t.push(A[b],R[f]),(m+=c)>=u&&f<_?(e=R[++f],m-=u):e=A[++b],t.push(e)}t[s+0]=t[t.length-3],t[s+1]=t[t.length-2],t[s+2]=t[t.length-1],t.length=t.length-3}_generateEdgesLinesAlternate(){let e=this._source.getVerticesData(i.R.PositionKind),s=this._source.getIndices();if(!s||!e)return;Array.isArray(s)||(s=Array.from(s));let t=this._options?.useFastVertexMerger??!0,n=t?Math.round(-Math.log(this._options?.epsilonVertexMerge??1e-6)/Math.log(10)):this._options?.epsilonVertexMerge??1e-6,r=[],h=[];if(t){let s={};for(let t=0;t<e.length;t+=3){let i=e[t+0],o=e[t+1],a=e[t+2],l=i.toFixed(n)+"|"+o.toFixed(n)+"|"+a.toFixed(n);if(void 0!==s[l])r.push(s[l]);else{let e=t/3;s[l]=e,r.push(e),h.push(e)}}}else for(let s=0;s<e.length;s+=3){let t=e[s+0],i=e[s+1],o=e[s+2],a=!1;for(let h=0;h<s&&!a;h+=3){let s=e[h+0],l=e[h+1],d=e[h+2];if(Math.abs(t-s)<n&&Math.abs(i-l)<n&&Math.abs(o-d)<n){r.push(h/3),a=!0;break}}a||(r.push(s/3),h.push(s/3))}if(this._options?.applyTessellation){let t=this._options?.epsilonVertexAligned??1e-6,i=[];for(let n=0;n<s.length;n+=3){let o;for(let a=0;a<3;++a){let l=r[s[n+a]],d=r[s[n+(a+1)%3]],c=r[s[n+(a+2)%3]];if(l===d)continue;let u=e[3*l+0],_=e[3*l+1],g=e[3*l+2],p=e[3*d+0],f=e[3*d+1],b=e[3*d+2],R=Math.sqrt((p-u)*(p-u)+(f-_)*(f-_)+(b-g)*(b-g));for(let s=0;s<h.length-1;s++){let r=h[s];if(r===l||r===d||r===c)continue;let A=e[3*r+0],m=e[3*r+1],E=e[3*r+2],I=Math.sqrt((A-u)*(A-u)+(m-_)*(m-_)+(E-g)*(E-g));Math.abs(I+Math.sqrt((A-p)*(A-p)+(m-f)*(m-f)+(E-b)*(E-b))-R)<t&&(o||(o={index:n,edgesPoints:[[],[],[]]},i.push(o)),o.edgesPoints[a].push([r,I]))}}}for(let e=0;e<i.length;++e){let t=i[e];this._tessellateTriangle(t.edgesPoints,t.index,s,r)}i.length=0}let a={};for(let t=0;t<s.length;t+=3){let i;for(let n=0;n<3;++n){let h=r[s[t+n]],l=r[s[t+(n+1)%3]],d=r[s[t+(n+2)%3]];if(h===l||(h===d||l===d)&&this._options?.removeDegeneratedTriangles)continue;if(o.AA.Vector3[0].copyFromFloats(e[3*h+0],e[3*h+1],e[3*h+2]),o.AA.Vector3[1].copyFromFloats(e[3*l+0],e[3*l+1],e[3*l+2]),o.AA.Vector3[2].copyFromFloats(e[3*d+0],e[3*d+1],e[3*d+2]),i||(o.AA.Vector3[1].subtractToRef(o.AA.Vector3[0],o.AA.Vector3[3]),o.AA.Vector3[2].subtractToRef(o.AA.Vector3[1],o.AA.Vector3[4]),(i=o.Pq.Cross(o.AA.Vector3[3],o.AA.Vector3[4])).normalize()),h>l){let e=h;h=l,l=e}let c=h+"_"+l,u=a[c];u?u.done||(o.Pq.Dot(i,u.normal)<this._epsilon&&this.createLine(o.AA.Vector3[0],o.AA.Vector3[1],this._linesPositions.length/3),u.done=!0):a[c]={normal:i,done:!1,index:t,i:n}}}for(let t in a){let i=a[t];if(!i.done){let t=r[s[i.index+i.i]],n=r[s[i.index+(i.i+1)%3]];o.AA.Vector3[0].copyFromFloats(e[3*t+0],e[3*t+1],e[3*t+2]),o.AA.Vector3[1].copyFromFloats(e[3*n+0],e[3*n+1],e[3*n+2]),this.createLine(o.AA.Vector3[0],o.AA.Vector3[1],this._linesPositions.length/3)}}let l=this._source.getScene().getEngine();this._buffers[i.R.PositionKind]=new i.R(l,this._linesPositions,i.R.PositionKind,!1),this._buffers[i.R.NormalKind]=new i.R(l,this._linesNormals,i.R.NormalKind,!1,!1,4),this._buffersForInstances[i.R.PositionKind]=this._buffers[i.R.PositionKind],this._buffersForInstances[i.R.NormalKind]=this._buffers[i.R.NormalKind],this._ib=l.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}_generateEdgesLines(){let e,s,t=this._source.getVerticesData(i.R.PositionKind),n=this._source.getIndices();if(!n||!t)return;let r=[],h=[];for(e=0;e<n.length;e+=3){s=new u;let i=n[e],a=n[e+1],l=n[e+2];s.p0=new o.Pq(t[3*i],t[3*i+1],t[3*i+2]),s.p1=new o.Pq(t[3*a],t[3*a+1],t[3*a+2]),s.p2=new o.Pq(t[3*l],t[3*l+1],t[3*l+2]);let d=o.Pq.Cross(s.p1.subtract(s.p0),s.p2.subtract(s.p1));d.normalize(),h.push(d),r.push(s)}for(e=0;e<r.length;e++){s=r[e];for(let t=e+1;t<r.length;t++){let i=r[t];if(3===s.edgesConnectedCount)break;
1if(3===i.edgesConnectedCount)continue;let o=n[3*t],h=n[3*t+1],a=n[3*t+2];for(let r=0;r<3;r++){let l=0;if(void 0===s.edges[r]){switch(r){case 0:l=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(s.p0,s.p1,i.p0,i.p1,i.p2):this._processEdgeForAdjacencies(n[3*e],n[3*e+1],o,h,a);break;case 1:l=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(s.p1,s.p2,i.p0,i.p1,i.p2):this._processEdgeForAdjacencies(n[3*e+1],n[3*e+2],o,h,a);break;case 2:l=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(s.p2,s.p0,i.p0,i.p1,i.p2):this._processEdgeForAdjacencies(n[3*e+2],n[3*e],o,h,a)}if(-1!==l&&(s.edges[r]=t,i.edges[l]=e,s.edgesConnectedCount++,i.edgesConnectedCount++,3===s.edgesConnectedCount))break}}}}for(e=0;e<r.length;e++){let s=r[e];this._checkEdge(e,s.edges[0],h,s.p0,s.p1),this._checkEdge(e,s.edges[1],h,s.p1,s.p2),this._checkEdge(e,s.edges[2],h,s.p2,s.p0)}let a=this._source.getScene().getEngine();this._buffers[i.R.PositionKind]=new i.R(a,this._linesPositions,i.R.PositionKind,!1),this._buffers[i.R.NormalKind]=new i.R(a,this._linesNormals,i.R.NormalKind,!1,!1,4),this._buffersForInstances[i.R.PositionKind]=this._buffers[i.R.PositionKind],this._buffersForInstances[i.R.NormalKind]=this._buffers[i.R.NormalKind],this._ib=a.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}isReady(){return this._lineShader.isReady(this._source,this._source.hasInstances&&this.customInstances.length>0||this._source.hasThinInstances)}render(){let e=this._source.getScene(),s=e.floatingOriginOffset,t=this._lineShader._getDrawWrapper();if(this._drawWrapper&&this._lineShader._setDrawWrapper(this._drawWrapper),!this.isReady()||!e.activeCamera)return void this._lineShader._setDrawWrapper(t);let i=this._source.hasInstances&&this.customInstances.length>0,n=i||this._source.hasThinInstances,r=0;if(n)if(this._buffersForInstances.world0=this._source.getVertexBuffer("world0"),this._buffersForInstances.world1=this._source.getVertexBuffer("world1"),this._buffersForInstances.world2=this._source.getVertexBuffer("world2"),this._buffersForInstances.world3=this._source.getVertexBuffer("world3"),i){let e=this._source._getInstanceDataStorage(),t=this._source._instanceDataStorage.isFrozen;if(r=this.customInstances.length,!e.instancesData){this._source.getScene()._activeMeshesFrozen||this.customInstances.reset();return}if(!t){let t=0;for(let i=0;i<r;++i){let n=this.customInstances.data[i];n.copyToArray(e.instancesData,t);let r=n.asArray();e.instancesData[t+12]=r[12]-s.x,e.instancesData[t+13]=r[13]-s.y,e.instancesData[t+14]=r[14]-s.z,t+=16}e.instancesBuffer.updateDirectly(e.instancesData,0,r)}}else r=this._source.thinInstanceCount;let o=e.getEngine();this._lineShader._preBind(),1!==this._source.edgesColor.a?o.setAlphaMode(2):o.setAlphaMode(0),o.bindBuffers(n?this._buffersForInstances:this._buffers,this._ib,this._lineShader.getEffect()),e.resetCachedMaterial(),this._lineShader.setColor4("color",this._source.edgesColor),e.activeCamera.mode===l.i.ORTHOGRAPHIC_CAMERA?this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForOrthographic):this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForPerspective),this._lineShader.setFloat("aspectRatio",o.getAspectRatio(e.activeCamera)),this._lineShader.bind(this._source.getWorldMatrix(),this._source),o.drawElementsType(h.i.TriangleFillMode,0,this._indicesCount,r),this._lineShader.unbind(),n&&o.unbindInstanceAttributes(),this._source.getScene()._activeMeshesFrozen||this.customInstances.reset(),this._lineShader._setDrawWrapper(t)}}class g extends _{constructor(e,s=.95,t=!1){super(e,s,t,!1),this._generateEdgesLines()}_generateEdgesLines(){let e=this._source.getVerticesData(i.R.PositionKind),s=this._source.getIndices();if(!s||!e)return;let t=o.AA.Vector3[0],n=o.AA.Vector3[1],r=s.length-1;for(let i=0,h=0;i<r;i+=2,h+=4)o.Pq.FromArrayToRef(e,3*s[i],t),o.Pq.FromArrayToRef(e,3*s[i+1],n),this.createLine(t,n,h);let h=this._source.getScene().getEngine();this._buffers[i.R.PositionKind]=new i.R(h,this._linesPositions,i.R.PositionKind,!1),this._buffers[i.R.NormalKind]=new i.R(h,this._linesNormals,i.R.NormalKind,!1,!1,4),this._ib=h.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.