@arcgis/core 5.1.0-next.40 → 5.1.0-next.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{0a094337e9922d989aa6.js → 0836964a65f76da35b5c.js} +45 -45
- package/assets/esri/core/workers/chunks/{0d321b3496adc640d96a.js → 093aa05fbde548bf9040.js} +1 -1
- package/assets/esri/core/workers/chunks/0b661b90f7ee3ae23425.js +1 -0
- package/assets/esri/core/workers/chunks/{1f5d9e5d4ddc623fd511.js → 385f1bb9164b2d488b2d.js} +1 -1
- package/assets/esri/core/workers/chunks/{cce2d2c60d136e1bac75.js → 5f3f50fec18d1642fdf9.js} +1 -1
- package/assets/esri/core/workers/chunks/{6258ae3d991ce652d97f.js → 7132420980f77b6a871b.js} +1 -1
- package/assets/esri/core/workers/chunks/{85f309c1888c1c8411b1.js → 7380177f16d914fdbc63.js} +1 -1
- package/assets/esri/core/workers/chunks/73a008b48e29eb6f2064.js +2 -0
- package/assets/esri/core/workers/chunks/{19cbaeda71486df01d0f.js → 80bfb5e5d613d2c412bf.js} +1 -1
- package/assets/esri/core/workers/chunks/{2c12b1488819c038c6b1.js → 8f12a559dbf284c21e2f.js} +1 -1
- package/assets/esri/core/workers/chunks/9a9b1250be3e20499d75.js +1 -0
- package/assets/esri/core/workers/chunks/c1cae45a159a5373ac00.js +1 -0
- package/assets/esri/core/workers/chunks/{78472f69053061a18967.js → dbedd246f4b584583f95.js} +1 -1
- package/assets/esri/core/workers/chunks/{604f9e7228a66b6cf2f9.js → e63046a9567d84228644.js} +1 -1
- package/assets/esri/core/workers/chunks/{e68d7aec0f095b6d743d.js → eff198e0c21c9767ffaa.js} +1 -1
- package/assets/esri/core/workers/chunks/{5e9595eb6ae6a40e7265.js → f4ec2dcdc4bbf7dbcc94.js} +1 -1
- package/assets/esri/core/workers/chunks/{e47dd011c06ab42c18e0.js → f835eea9f617556c7276.js} +1 -1
- package/assets/esri/libs/vxl/vxlLayer.wasm +0 -0
- package/chunks/Viewshed.glsl.js +2 -2
- package/chunks/vxlLayer.js +1 -1
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/graphics/sources/MemorySource.js +1 -1
- package/layers/raster/datasets/BaseRaster.js +1 -1
- package/layers/raster/datasets/FunctionRaster.js +1 -1
- package/layers/support/SceneModification.js +1 -1
- package/libs/vxl/VxlModule.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/analysis/Dimension/LengthDimensionSubTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillVisualization.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/environment/EnvironmentManager.js +1 -1
- package/views/3d/interactive/manipulators/RotateManipulator.js +1 -1
- package/views/3d/layers/SceneLayerWorkerHandle.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/FBOCacheUsage.js +2 -0
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/effects/WeatherFader.js +1 -1
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizer.js +1 -1
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/CutFillComputationRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleTechniqueConfiguration.js +2 -0
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoardTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ColorMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/PatternTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/SlicePlaneMaterialTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/shaders/Viewshed.glsl.js +1 -1
- package/assets/esri/core/workers/chunks/49d6249e98f023344e0a.js +0 -1
- package/assets/esri/core/workers/chunks/60e4312044fe40dfd41d.js +0 -2
- package/assets/esri/core/workers/chunks/92f6d637f4786ba0d3e3.js +0 -1
- package/assets/esri/core/workers/chunks/bf9b83e020ff08c51ac1.js +0 -1
- /package/assets/esri/core/workers/chunks/{60e4312044fe40dfd41d.js.LICENSE.txt → 73a008b48e29eb6f2064.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as r,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=f();function h(t,i,o,e,c,s){if(!t.visible)return;const r=n(E,e,o),f=(n,t,i)=>s(n,i,t),{tolerance:l}=i,h=new a(l,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,r,l,c,h,f);else{const n=t.positionAttribute,i=t.primitivePositionIndices;T(o,r,0,i.length/3,i,n.data,n.stride,c,h,f)}}const m=c();function p(n,t,i,o,e,c,f){if(null==n)return;const u=C(i,m);if(s(l,n.bbMin),r(l,n.bbMax),null!=e&&e.applyToAabb(l),U(l,t,u,o)){const{primitiveIndices:s,position:r}=n,u=s?s.length:r.indices.length/3;if(u>z){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,f);return}}q(t,i,0,u,r.indices,r.data,r.stride,s,e,c,f)}}const b=c();function M(t,i,o,e,c,s,r,f,u){const{data:a,stride:l}=s;T(t,n(E,i,t),o,e,c,a,l,r,f,u)}function d(n,t,i,o){if(!i.visible)return;const e=(n,t,i)=>o(n,i,t),{boundingInfo:c}=i;if(c){const{bbMin:i,bbMax:o}=c;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const s=i.positionAttribute,r=i.primitivePositionIndices;x(n,t,0,r.length/3,r,s,e)}function x(n,t,i,o,e,c,s){const{data:r,stride:f}=c;for(let u=i;u<o;++u){const i=3*u,o=f*e[i],c=f*e[i+1],a=f*e[i+2],l=r[o+0]-n,h=r[o+1]-t,m=r[c+0]-n,p=r[c+1]-t,b=r[a+0]-n,M=r[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,u,null)}}function g(n,t,i,o,e,c,s,r,f,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],v=s*e[t+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[t+2],R=q-o,A=T-g,B=V-y,P=c[I]-o,w=c[I+1]-g,C=c[I+2]-y,U=M*C-w*d,k=d*P-C*p,z=p*w-P*M,E=R*U+A*k+B*z;if(Math.abs(E)<=D)continue;const F=l-o,G=h-g,H=m-y,J=F*U+G*k+H*z;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*B-A*H,L=H*R-B*F,N=F*A-R*G,O=p*K+M*L+d*N;if(E>0){if(O<0||J+O>E)continue}else if(O>0||J+O<E)continue;const Q=(P*K+w*L+C*N)/E;if(Q>=0){f(Q,n,r?j(R,A,B,P,w,C,b):null)}}}function y(n,t,i,o,e,c,s,r){const f=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,v=e[g]-M,q=e[g+1]-d,T=e[g+2]-x,V=e[y]-M,I=e[y+1]-d,R=e[y+2]-x,A=h*R-I*m,B=m*V-R*l,P=l*I-V*h,w=v*A+q*B+T*P;if(Math.abs(w)<=D)continue;const C=f-M,U=u-d,k=a-x,z=C*A+U*B+k*P;if(w>0){if(z<0||z>w)continue}else if(z>0||z<w)continue;const E=U*T-q*k,F=k*v-T*C,G=C*q-v*U,H=l*E+h*F+m*G;if(w>0){if(H<0||z+H>w)continue}else if(H>0||z+H<w)continue;const J=(V*E+I*F+R*G)/w;if(J>=0){r(J,p,s?j(v,q,T,V,I,R,b):null)}}}function v(n,t,i,o,e,c,s,r,f,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],v=c[i+1],q=c[i+2],T=s*e[t+1],V=c[T],I=c[T+1],R=c[T+2],A=s*e[t+2],B=c[A],P=c[A+1],w=c[A+2],C=q-f,U=r/Math.sqrt(o*o+v*v+C*C),k=o+o*U,z=v+v*U,E=q+C*U,F=R-f,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-f,N=r/Math.sqrt(B*B+P*P+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=P+P*N-z,Y=w+L*N-E,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=O*Z+Q*$+S*_;if(Math.abs(nn)<=D)continue;const tn=m-k,on=p-z,en=M-E,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,rn=en*O-S*tn,fn=tn*Q-O*on,un=d*sn+x*rn+g*fn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*rn+Y*fn)/nn;if(an>=0){a(an,n,u?j(O,Q,S,W,X,Y,b):null)}}}function q(n,t,i,o,e,c,s,r,f,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=r[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const v=s*e[t+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[t+2];let R=c[I],A=c[I+1],B=c[I+2];null!=f&&([o,u,y]=f.applyToVertex(o,u,y,g),[q,T,V]=f.applyToVertex(q,T,V,g),[R,A,B]=f.applyToVertex(R,A,B,g));const P=q-o,w=T-u,C=V-y,U=R-o,k=A-u,z=B-y,E=M*z-k*d,F=d*U-z*p,G=p*k-U*M,H=P*E+w*F+C*G;if(Math.abs(H)<=D)continue;const J=l-o,K=h-u,L=m-y,N=J*E+K*F+L*G;if(H>0){if(N<0||N>H)continue}else if(N>0||N<H)continue;const O=K*C-w*L,Q=L*P-C*J,S=J*w-P*K,W=p*O+M*Q+d*S;if(H>0){if(W<0||N+W>H)continue}else if(W>0||N+W<H)continue;const X=(U*O+k*Q+z*S)/H;if(X>=0){a(X,n,x?j(P,w,C,U,k,z,b):null)}}}function T(o,e,c,s,r,f,u,a,l,h){const m=e,p=F,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,v=(x+y)%3,q=(x+(3-y))%3,T=m[v]/m[g],j=m[q]/m[g],B=1/m[g],P=V,w=I,C=R,{normalRequired:U}=l;for(let V=c;V<s;++V){const e=3*V,c=u*r[e];t(p[0],f[c+0],f[c+1],f[c+2]);const s=u*r[e+1];t(p[1],f[s+0],f[s+1],f[s+2]);const l=u*r[e+2];t(p[2],f[l+0],f[l+1],f[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],V)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],V)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],V))),n(P,p[0],o),n(w,p[1],o),n(C,p[2],o);const m=P[v]-T*P[g],b=P[q]-j*P[g],M=w[v]-T*w[g],d=w[q]-j*w[g],x=C[v]-T*C[g],y=C[q]-j*C[g],I=x*d-y*M,R=m*y-b*x,k=M*b-d*m;if((I<0||R<0||k<0)&&(I>0||R>0||k>0))continue;const z=I+R+k;if(0===z)continue;const D=I*(B*P[g])+R*(B*w[g])+k*(B*C[g]);if(D*Math.sign(z)<0)continue;const E=D/z;if(E>=0){h(E,V,U?A(p):null)}}}const V=c(),I=c(),R=c();function j(n,i,c,s,r,f,u){return t(B,n,i,c),t(P,s,r,f),o(u,B,P),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(P,t[2],t[0]),o(b,B,P),e(b,b),b}const B=c(),P=c();function w(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function C(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function U(n,t,i,o){return k(n,t,i,o,1/0)}function k(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let r=Math.min(c,s),f=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(r=Math.max(r,Math.min(u,a)),r>f)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const z=1e3,D=1e-7,E=c(),F=[c(),c(),c()];export{a as MeshIntersectionOptions,w as computeInvDir,C as computeInvDirFromDirection,j as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as
|
|
2
|
+
import{sub as n,set as t,copy as i,cross as o,normalize as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as s,setMax as r,create as f}from"../../../../geometry/support/aaBoundingBox.js";import{assert as u}from"./Util.js";class a{constructor(n=0,t=!1,i=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=i}}const l=f();function h(t,i,o,e,c,s){if(!t.visible)return;const r=n(E,e,o),f=(n,t,i)=>s(n,i,t),{tolerance:l}=i,h=new a(l,!1,i.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.boundingInfo,o,r,l,c,h,f);else{const n=t.positionAttribute,i=t.primitivePositionIndices;T(o,r,0,i.length/3,i,n.data,n.stride,c,h,f)}}const m=c();function p(n,t,i,o,e,c,f){if(null==n)return;const u=C(i,m);if(s(l,n.bbMin),r(l,n.bbMax),null!=e&&e.applyToAabb(l),U(l,t,u,o)){const{primitiveIndices:s,position:r}=n,u=s?s.length:r.indices.length/3;if(u>z){const s=n.getChildren();if(void 0!==s){for(const n of s)p(n,t,i,o,e,c,f);return}}q(t,i,0,u,r.indices,r.data,r.stride,s,e,c,f)}}const b=c();function M(t,i,o,e,c,s,r,f,u){const{data:a,stride:l}=s;T(t,n(E,i,t),o,e,c,a,l,r,f,u)}function d(n,t,i,o){if(!i.visible)return;const e=(n,t,i)=>o(n,i,t),{boundingInfo:c}=i;if(c){const{bbMin:i,bbMax:o}=c;if(n<i[0]||n>o[0]||t<i[1]||t>o[1])return}const s=i.positionAttribute,r=i.primitivePositionIndices;x(n,t,0,r.length/3,r,s,e)}function x(n,t,i,o,e,c,s){const{data:r,stride:f}=c;for(let u=i;u<o;++u){const i=3*u,o=f*e[i],c=f*e[i+1],a=f*e[i+2],l=r[o+0]-n,h=r[o+1]-t,m=r[c+0]-n,p=r[c+1]-t,b=r[a+0]-n,M=r[a+1]-t,d=b*p-M*m,x=l*M-h*b,g=m*h-p*l;(d<0||x<0||g<0)&&(d>0||x>0||g>0)||s(0,u,null)}}function g(n,t,i,o,e,c,s,r,f,u=null,a=0){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2];for(let x=i;x<o;++x){const n=a+(u?.[x]??x),t=3*n,i=s*e[t],o=c[i],g=c[i+1],y=c[i+2],v=s*e[t+1],q=c[v],T=c[v+1],V=c[v+2],I=s*e[t+2],R=q-o,A=T-g,B=V-y,P=c[I]-o,w=c[I+1]-g,C=c[I+2]-y,U=M*C-w*d,k=d*P-C*p,z=p*w-P*M,E=R*U+A*k+B*z;if(Math.abs(E)<=D)continue;const F=l-o,G=h-g,H=m-y,J=F*U+G*k+H*z;if(E>0){if(J<0||J>E)continue}else if(J>0||J<E)continue;const K=G*B-A*H,L=H*R-B*F,N=F*A-R*G,O=p*K+M*L+d*N;if(E>0){if(O<0||J+O>E)continue}else if(O>0||J+O<E)continue;const Q=(P*K+w*L+C*N)/E;if(Q>=0){f(Q,n,r?j(R,A,B,P,w,C,b):null)}}}function y(n,t,i,o,e,c,s,r){const f=n[0],u=n[1],a=n[2],l=t[0],h=t[1],m=t[2];for(let p=i;p<o;++p){const n=3*p,t=n+1,i=n+2,o=c*n,M=e[o],d=e[o+1],x=e[o+2],g=c*t,y=c*i,v=e[g]-M,q=e[g+1]-d,T=e[g+2]-x,V=e[y]-M,I=e[y+1]-d,R=e[y+2]-x,A=h*R-I*m,B=m*V-R*l,P=l*I-V*h,w=v*A+q*B+T*P;if(Math.abs(w)<=D)continue;const C=f-M,U=u-d,k=a-x,z=C*A+U*B+k*P;if(w>0){if(z<0||z>w)continue}else if(z>0||z<w)continue;const E=U*T-q*k,F=k*v-T*C,G=C*q-v*U,H=l*E+h*F+m*G;if(w>0){if(H<0||z+H>w)continue}else if(H>0||z+H<w)continue;const J=(V*E+I*F+R*G)/w;if(J>=0){r(J,p,s?j(v,q,T,V,I,R,b):null)}}}function v(n,t,i,o,e,c,s,r,f,u,a,l=null,h=0){const m=n[0],p=n[1],M=n[2],d=t[0],x=t[1],g=t[2];for(let y=i;y<o;++y){const n=h+(l?.[y]??y),t=3*n,i=s*e[t],o=c[i],v=c[i+1],q=c[i+2],T=s*e[t+1],V=c[T],I=c[T+1],R=c[T+2],A=s*e[t+2],B=c[A],P=c[A+1],w=c[A+2],C=q-f,U=r/Math.sqrt(o*o+v*v+C*C),k=o+o*U,z=v+v*U,E=q+C*U,F=R-f,G=r/Math.sqrt(V*V+I*I+F*F),H=V+V*G,J=I+I*G,K=R+F*G,L=w-f,N=r/Math.sqrt(B*B+P*P+L*L),O=H-k,Q=J-z,S=K-E,W=B+B*N-k,X=P+P*N-z,Y=w+L*N-E,Z=x*Y-X*g,$=g*W-Y*d,_=d*X-W*x,nn=O*Z+Q*$+S*_;if(Math.abs(nn)<=D)continue;const tn=m-k,on=p-z,en=M-E,cn=tn*Z+on*$+en*_;if(nn>0){if(cn<0||cn>nn)continue}else if(cn>0||cn<nn)continue;const sn=on*S-Q*en,rn=en*O-S*tn,fn=tn*Q-O*on,un=d*sn+x*rn+g*fn;if(nn>0){if(un<0||cn+un>nn)continue}else if(un>0||cn+un<nn)continue;const an=(W*sn+X*rn+Y*fn)/nn;if(an>=0){a(an,n,u?j(O,Q,S,W,X,Y,b):null)}}}function q(n,t,i,o,e,c,s,r,f,u,a){const l=n[0],h=n[1],m=n[2],p=t[0],M=t[1],d=t[2],{normalRequired:x}=u;for(let g=i;g<o;++g){const n=r[g],t=3*n,i=s*e[t];let o=c[i],u=c[i+1],y=c[i+2];const v=s*e[t+1];let q=c[v],T=c[v+1],V=c[v+2];const I=s*e[t+2];let R=c[I],A=c[I+1],B=c[I+2];null!=f&&([o,u,y]=f.applyToVertex(o,u,y,g),[q,T,V]=f.applyToVertex(q,T,V,g),[R,A,B]=f.applyToVertex(R,A,B,g));const P=q-o,w=T-u,C=V-y,U=R-o,k=A-u,z=B-y,E=M*z-k*d,F=d*U-z*p,G=p*k-U*M,H=P*E+w*F+C*G;if(Math.abs(H)<=D)continue;const J=l-o,K=h-u,L=m-y,N=J*E+K*F+L*G;if(H>0){if(N<0||N>H)continue}else if(N>0||N<H)continue;const O=K*C-w*L,Q=L*P-C*J,S=J*w-P*K,W=p*O+M*Q+d*S;if(H>0){if(W<0||N+W>H)continue}else if(W>0||N+W<H)continue;const X=(U*O+k*Q+z*S)/H;if(X>=0){a(X,n,x?j(P,w,C,U,k,z,b):null)}}}function T(o,e,c,s,r,f,u,a,l,h){const m=e,p=F,b=Math.abs(m[0]),M=Math.abs(m[1]),d=Math.abs(m[2]),x=b>=M?b>=d?0:2:M>=d?1:2,g=x,y=m[g]<0?2:1,v=(x+y)%3,q=(x+(3-y))%3,T=m[v]/m[g],j=m[q]/m[g],B=1/m[g],P=V,w=I,C=R,{normalRequired:U}=l;for(let V=c;V<s;++V){const e=3*V,c=u*r[e];t(p[0],f[c+0],f[c+1],f[c+2]);const s=u*r[e+1];t(p[1],f[s+0],f[s+1],f[s+2]);const l=u*r[e+2];t(p[2],f[l+0],f[l+1],f[l+2]),a&&(i(p[0],a.applyToVertex(p[0][0],p[0][1],p[0][2],V)),i(p[1],a.applyToVertex(p[1][0],p[1][1],p[1][2],V)),i(p[2],a.applyToVertex(p[2][0],p[2][1],p[2][2],V))),n(P,p[0],o),n(w,p[1],o),n(C,p[2],o);const m=P[v]-T*P[g],b=P[q]-j*P[g],M=w[v]-T*w[g],d=w[q]-j*w[g],x=C[v]-T*C[g],y=C[q]-j*C[g],I=x*d-y*M,R=m*y-b*x,k=M*b-d*m;if((I<0||R<0||k<0)&&(I>0||R>0||k>0))continue;const z=I+R+k;if(0===z)continue;const D=I*(B*P[g])+R*(B*w[g])+k*(B*C[g]);if(D*Math.sign(z)<0)continue;const E=D/z;if(E>=0){h(E,V,U?A(p):null)}}}const V=c(),I=c(),R=c();function j(n,i,c,s,r,f,u){return t(B,n,i,c),t(P,s,r,f),o(u,B,P),e(u,u),u}function A(t){return n(B,t[1],t[0]),n(P,t[2],t[0]),o(b,B,P),e(b,b),b}const B=c(),P=c();function w(n,i,o){return t(o,1/(i[0]-n[0]),1/(i[1]-n[1]),1/(i[2]-n[2]))}function C(n,i){return t(i,1/n[0],1/n[1],1/n[2])}function U(n,t,i,o){return k(n,t,i,o,1/0)}function k(n,t,i,o,e){const c=(n[0]-o-t[0])*i[0],s=(n[3]+o-t[0])*i[0];let r=Math.min(c,s),f=Math.max(c,s);const u=(n[1]-o-t[1])*i[1],a=(n[4]+o-t[1])*i[1];if(f=Math.min(f,Math.max(u,a)),f<0)return!1;if(r=Math.max(r,Math.min(u,a)),r>f)return!1;const l=(n[2]-o-t[2])*i[2],h=(n[5]+o-t[2])*i[2];return f=Math.min(f,Math.max(l,h)),!(f<0)&&(r=Math.max(r,Math.min(l,h)),!(r>f)&&r<e)}const z=1e3,D=1e-7,E=c(),F=[c(),c(),c()];export{a as MeshIntersectionOptions,w as computeInvDir,C as computeInvDirFromDirection,j as computeNormalFromBarycentric,U as intersectAabbInvDir,k as intersectAabbInvDirBefore,g as intersectRayTriangles,T as intersectRayTrianglesWithDisplacementWatertight,v as intersectRayTrianglesWithVerticalOffsetENUGlobal,y as intersectRenderGeometryTriangles,h as intersectTriangleGeometry,d as intersectTriangleGeometry2D,M as intersectTriangles,x as intersectTriangles2d,D as triangleRayParallelTolerance};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as l}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as m,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as T}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as E,ZEROS as w}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as x,AllRenderNodeOutputs as R,AllInternalRenderNodeOutputs as S}from"../../webgl.js";import{minNearDistanceInMeters as D}from"../../state/NearFarHeuristic.js";import{debugFlags as O}from"../../support/debugFlags.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{innerAtmosphereFadeStart as M}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as G}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as q,renderHighlightBuffer as U}from"../effects/highlight/Highlight.js";import{OITBlend as L}from"../effects/transparency/OITBlend.js";import{AnimationTimer as j}from"./AnimationTimer.js";import{AnimationTimeStep as V}from"./AnimationTimeStep.js";import{BoundingInfo as B}from"./BoundingInfo.js";import{Compositor as k}from"./Compositor.js";import{DepthRange as z}from"./DepthRange.js";import{depthRangeFromScene as W}from"./depthRangeUtils.js";import{MainFramebuffer as Q}from"./MainFramebuffer.js";import{RenderContext as Y,defaultRenderOccludedMask as J}from"./RenderContext.js";import{RendererBase as K}from"./RendererBase.js";import{setupFeatureDefaults as Z}from"./RenderFeature.js";import{RenderPluginInput as $}from"./RenderPluginInput.js";import{ShadowAccumulator as X}from"./ShadowAccumulator.js";import{ShadowMap as ee}from"./ShadowMap.js";import te from"./SliceHelper.js";import{MergedRenderer as se}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as re}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ie,PerformanceCategory as ae}from"../statistics/RendererPerformanceInfo.js";import{PixelType as ne,ColorAttachment1 as he,ColorAttachment2 as oe,ColorAttachment0 as de}from"../../../webgl/enums.js";let _e=class extends K{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=E(0,0,0,1),this._sliceHelper=new te,this.sceneDepthRange=u(z.Infinite),this._state=u(2),this._hasAnimations=!1,this._animationTimestep=new V,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=u(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new $,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of we)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(r),this._compositor=new k(r,s),this._renderStateFeatures=u(Z(e.view.qualityProfile)),this._shadowMap=new ee(this._fboCache,e.viewingMode),this._renderContext=new Y(this._rctx,this._shadowMap,s),this._framebuffer=new Q(this._fboCache,this._bindParameters),this._performanceInfo=new ie(this._rctx),this._blit=new G(s),this._shadowAccumulator=new X(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(3,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new v(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>O.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():w;T(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=H,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},l),o(()=>this._bindParameters.clouds.data?.state,()=>i(),l),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,B.prune(),se.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new L(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=Z(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOutputs(),this._bindParameters.depth=n(this._bindParameters.depth)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Re(this.stage.view.resourceController)});return this.addHandles(o(()=>s.updating,()=>this._requestRender(),l)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&m(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...ge),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new j(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return new re(this._pluginInput.get(A.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._rctx.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit=this.hasFloatOit;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(x.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(x.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,l=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(l?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=l):l?.release(),this._ensureBindParametersCamera(a,n),this._plugins.sortTestsTransparentOrderedSlots(Pe),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...ue),this._precompilePrepasses(),this.performanceInfo.advance(ae.PREPARE);const u=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,u),this._pluginInput.set("normals",this._renderNormals()),this._renderRemainingGeometryDepth(),this._renderShadowAccumulation(u,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._rctx.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._shadowMap.disposeOutput(3),this._renderCutFillComputation(),this._pluginInput.set(x.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(x.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(x.VIEWSHED,e)),_.update(e=>this._renderNodes(x.LASERLINES,e)),_.update(e=>this._renderNodes(x.FOCUSAREA_COLOR,e)),this._pluginInput.release(x.FOCUSAREA),_.update(e=>this._renderNodes(x.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const p=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(x.ANTIALIASING,e));const c=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let m;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(c,e)),_.update(e=>this._renderNodes(x.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(c,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(x.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(m=_.color,m.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new re(m,p)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._rctx.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,x.OPAQUE_ENVIRONMENT,x.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._rctx.output=1,this._plugins.precompile(...pe),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._rctx.output=0,this._plugins.precompile(...pe),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,x.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,x.TRANSPARENT_ENVIRONMENT,x.VIEWSHED,x.CUTFILL_COMPUTATION,x.LASERLINES,x.FOCUSAREA_COLOR,x.OCCLUDED,x.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(8),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,x.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,x.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(x.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ae.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._rctx.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ae.OBJECT_AND_LAYER_ID_COLOR),this._rctx.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(w),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,ne.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,w),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ae.OPAQUE_EDGES:ae.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ae.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),r.clear(),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ae.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(x.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){const s=this._rctx.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._rctx.output=s}get _needsDepth(){return this._plugins.consumes(1)||this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderRemainingGeometryDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(x.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ae.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ae.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._rctx.output;this._rctx.output=1;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._rctx.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._rctx.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._rctx.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return z.Zero;const t=W(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=z.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<M)return void(this.sceneDepthRange.value=z.Infinite);const t=e.clone();t.near=D,t.far=1e10;const s=W(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){const e=this._nodes.require("normals",...R,x.VIEWSHED,x.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,x.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(w,!0,!0),this._rctx.output=2,this._plugins.render(...ce);const i=this._nodes.optional("normals",...R,x.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ae.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(x.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ae.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._rctx.output;this._rctx.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...pe),this._rctx.output=t}renderAllGeometry(e){this._rctx.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...fe);this._renderContext.renderOccludedMask=J}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...fe),this._renderContext.renderOccludedMask=J}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...Te[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFillReferenceDepth(){const e=this._rctx.output;this._rctx.output=7,this._plugins.precompile(...Ee),this._rctx.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.output=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._rctx.output=7,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._rctx.output=r}_renderOpaqueAndTransparentGeometry(e){this._rctx.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._rctx.output=e,this._plugins.render(...me)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...le),this._nodes.precompile(this._bindParameters.hasEmission,x.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...le)}_renderTransparentGeometry(){this._plugins.render(...ue),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,w),this.performanceInfo.advance(ae.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...pe)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._pluginsHas.hudElements&&(this._precompileHUDOutput(e),this._hasHighlights)){const t=this._rctx.output;this._rctx.output=8,this._precompileHUDOutput(e),this._rctx.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ge),this._bindParameters.oitPass=2,this._plugins.precompile(...ge),this._bindParameters.oitPass=0,this._oitBlend.precompile(this._bindParameters,!1,1)):this._plugins.precompile(...ge),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(he);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._rctx.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ae.HUD_OCCLUDED:ae.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>q?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(8,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._rctx.output=8,t.bindFramebuffer(h.fbo),U(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ae.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...S)+this._nodes.optional("highlights",...S)-1),h}_renderHighlightGeometries(){this._plugins.render(...be),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e);const{depth:s,camera:r,contentCamera:i}=this._bindParameters;this._rctx.output=0,this._shadowAccumulator.accumulating&&s&&this._shadowAccumulator.renderAccumulation(s,r,i,t)&&this.performanceInfo.advance(ae.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=2,this._plugins.precompile(...ue),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=0):this._plugins.precompile(...ue)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this.hasFloatOit?8:5,d=this._rctx.output;this._rctx.output=0,h.oitPass=1;const _=s?"oit hud":"oit",l=this.fboCache.acquire(r,i,_,o),u=this._bindParameters.hasEmission&&(0===e||1!==t);u&&l.acquireColor(he,o,"oit emissive");const p=u?oe:he;l.acquireColor(p,this.hasFloatOit?7:0,"oit alpha"),s||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,w),a(),l.detachDepth(),h.oitPass=2;const c=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&c.acquireColor(he,o,"oit emissive front"),s?c.acquireDepth(this._hudDepthFormat):c.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(c.fbo),this._rctx.clearFramebuffer(w,s),a(),c.detachDepth();const m=this._pluginsHas.occludedHudElements&&!s;let f;return this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),h.oitPass=0,s?(f=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(m&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-de,w)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,l,c,h,u,m,e),f?.detachDepth(),s||(this._rctx.bindFramebuffer(c.fbo),this._framebuffer.bind(),m&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),c.release(),l.release(),this._rctx.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...le)||this.plugins.produces(3,...le)||this.plugins.produces(1,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(x.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(x.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(x.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(x.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(x.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ae.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ae.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ae.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(Ae,this._bindParameters.camera.viewMatrix),f(Ce,this._bindParameters.camera.projectionMatrix),g(xe,Ae,Ce),g(xe,this._renderContext.lastFrameCamera.viewMatrix,xe),g(xe,this._renderContext.lastFrameCamera.projectionMatrix,xe),this._reprojectionMatrix=xe);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],_e.prototype,"highResolutionAtmosphere",null),e([p()],_e.prototype,"_edgeView",void 0),e([p()],_e.prototype,"updating",null),_e=e([c("esri.views.3d.webgl-engine.lib.Renderer")],_e);const le=[0,1,2,3],ue=[7,8,4,5],pe=[6,7,8],ce=[0,1,2,4,...pe],me=[3,5],fe=[2,4,9],ge=[17,13,15,14],be=[4,5,2,3,0,1,...pe],Pe=[4,9,5,12],Te={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...pe],we=["normals","highlights"],Ce=P(),Ae=P(),xe=P();function Re(e){return t=>e.immediate.schedule(t)}export{_e as Renderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{update as t}from"../../../../core/arrayUtils.js";import{createTask as s}from"../../../../core/asyncUtils.js";import has from"../../../../core/has.js";import{removeMaybe as r,abortMaybe as i,destroyMaybe as a,releaseMaybe as n}from"../../../../core/maybe.js";import{throwIfAborted as h}from"../../../../core/promiseUtils.js";import{watch as o,syncAndInitial as d,initial as _,sync as l}from"../../../../core/reactiveUtils.js";import{signal as u}from"../../../../core/signal.js";import{property as p,subclass as c}from"../../../../core/accessorSupport/decorators.js";import{equals as m,invert as f,multiply as g}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as b,create as P}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as T}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{fromValues as w,ZEROS as E}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{pruneIndexArrays as C}from"../../../../geometry/support/Indices.js";import{RenderNodeOutput as A,InternalRenderCategory as x,AllRenderNodeOutputs as S,AllInternalRenderNodeOutputs as R}from"../../webgl.js";import{minNearDistanceInMeters as D}from"../../state/NearFarHeuristic.js";import{debugFlags as O}from"../../support/debugFlags.js";import{FBOCache as I}from"../core/FBOCache.js";import{RenderPassManager as y}from"../core/renderPasses/RenderPassManager.js";import{isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{distanceFadeEnd as H}from"../core/shaderLibrary/shading/ScreenSpaceConstants.js";import{RenderNodes as v}from"../effects/RenderNodes.js";import{RenderPluginManager as N}from"../effects/RenderPluginManager.js";import{WeatherFader as M}from"../effects/WeatherFader.js";import{innerAtmosphereFadeStart as q}from"../effects/atmosphere/atmosphereUtils.js";import{Blit as G}from"../effects/blit/Blit.js";import{maxHighlightsPerChannel as U,renderHighlightBuffer as L}from"../effects/highlight/Highlight.js";import{OITBlend as j}from"../effects/transparency/OITBlend.js";import{AnimationTimer as V}from"./AnimationTimer.js";import{AnimationTimeStep as B}from"./AnimationTimeStep.js";import{BoundingInfo as k}from"./BoundingInfo.js";import{Compositor as z}from"./Compositor.js";import{DepthRange as W}from"./DepthRange.js";import{depthRangeFromScene as Q}from"./depthRangeUtils.js";import{MainFramebuffer as Y}from"./MainFramebuffer.js";import{RenderContext as J,defaultRenderOccludedMask as K}from"./RenderContext.js";import{RendererBase as Z}from"./RendererBase.js";import{setupFeatureDefaults as $}from"./RenderFeature.js";import{RenderPluginInput as X}from"./RenderPluginInput.js";import{ShadowAccumulator as ee}from"./ShadowAccumulator.js";import{ShadowMap as te}from"./ShadowMap.js";import se from"./SliceHelper.js";import{MergedRenderer as re}from"../materials/renderers/MergedRenderer.js";import{RenderSceneResult as ie}from"../parts/renderUtils.js";import{RendererPerformanceInfo as ae,PerformanceCategory as ne}from"../statistics/RendererPerformanceInfo.js";import{PixelType as he,ColorAttachment1 as oe,ColorAttachment2 as de,ColorAttachment0 as _e}from"../../../webgl/enums.js";let le=class extends Z{constructor(e,t,s,r,i){super({stage:e}),this._techniques=s,this._rctx=r,this._requestRender=i,this._pluginsHas={occludedHudElements:!1,hudElements:!1,water:!1},this.renderPassManager=new y,this._isRendering=!1,this._inGlobeView=!1,this._backgroundColor=w(0,0,0,1),this._sliceHelper=new se,this.sceneDepthRange=u(W.Infinite),this._state=u(2),this._hasAnimations=!1,this._animationTimestep=new B,this._loadEdgeViewTask=null,this._edgeViewCallbacks=[],this._reprojectionMatrixVersion=u(0),this._hasOIT8=!has("disable-feature:oit8"),this._hasIOSEmission=this._hasOIT8&&!has("disable-feature:oit8-emissive"),this._renderHiddenTransparentEdges=()=>{},this._pluginInput=new X,this._hasTransparentGeometry=!1,this._oitCallouts=!1,this._releaseNodeInputs=e=>{for(const t of Ce)e.some(({name:e})=>e===t)&&this._pluginInput.release(t)},this._debugNeedsDepth=!1,this._fboCache=new I(r),this._compositor=new z(r,s),this._renderStateFeatures=u($(e.view.qualityProfile)),this._shadowMap=new te(this._fboCache,e.viewingMode),this._renderContext=new J(this._rctx,this._shadowMap,s),this._framebuffer=new Y(this._fboCache,this._bindParameters),this._performanceInfo=new ae(this._rctx),this._blit=new G(s),this._shadowAccumulator=new ee(this.fboCache,s,e,e=>{const t=this.shadowsEnabled;this._shadowMap.enabled=!0,this._ensureBindParametersCamera(e.camera,e.contentCamera),this._plugins.prepareRender(),this._shadowMap.enabled=t},(t,s,r)=>{const i=e.view.qualitySettings.maximumPixelRatio;t.shadowMap.start(t.camera,s,r,!0,i),this._renderShadowCascades(3,t.shadowMap),t.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(t.camera,t.contentCamera)},i),this._nodes=new v(this._renderContext),this._plugins=new N({renderContext:this._renderContext,techniques:s,materials:t,requestRender:i,controller:e}),this._plugins.add(this.renderPassManager),this.weatherFader=new M({view:e.view}),this._plugins.add(this.weatherFader),this.addHandles([o(()=>e.view.state.camera,()=>i(),d),o(()=>O.EDGES_SHOW_HIDDEN_TRANSPARENT_EDGES,e=>{this._renderHiddenTransparentEdges=e?()=>this._renderEdges(0):()=>{},i()},_),o(()=>e.view.environment.background?.color,e=>{const t=e?e.toUnitRGBA():E;T(this._backgroundColor,t[0]*t[3],t[1]*t[3],t[2]*t[3],t[3]),i()},d),o(()=>e.view.state.camera.relativeElevation,e=>this._inGlobeView=(e??1/0)>=H,d),o(()=>this._bindParameters.clouds.fadeFactor,()=>{this._bindParameters.fadeLighting(),this._requestRender(2)},l),o(()=>this._bindParameters.clouds.data?.state,()=>i(),l),o(()=>e.view.state.highlights,e=>{this._bindParameters.highlights=e,i()},_),o(()=>"sun"===e.view.environment.lighting?.type,e=>{this._bindParameters.enableFillLights=e,this._requestRender()},d)])}destroy(){this._gpuTimerHandle=r(this._gpuTimerHandle),this._nodes.destroy(),this._framebuffer.dispose(),this._shadowMap.dispose(),this._shadowAccumulator.destroy(),this._shadowAccumulator=null,this._loadEdgeViewTask=i(this._loadEdgeViewTask),this._edgeView=a(this._edgeView),this.renderPassManager.dispose(),this._releaseFBOs(),this._disposeOffscreenBuffers(),this._fboCache.destroy(),this._fboCache=null,this._plugins.destroy(),this._plugins=null,this._pluginInput=null,this._oitBlendOrNil=null,this._nodes=null,this._framebuffer=null,this._shadowMap=null,this._renderContext=null,this._performanceInfo=null,k.prune(),re.prune(),C()}get renderContext(){return this._renderContext}get _bindParameters(){return this._renderContext.bind}get _oitBlend(){return this._oitBlendOrNil??=new j(this._techniques),this._oitBlendOrNil}get performanceInfo(){return this._performanceInfo}updateRenderFeatures(e){this._renderStateFeatures.value=$(e),this._requestRender()}isFeatureEnabled(e,t=this._state.value){return this._renderStateFeatures.value.get(t,e)??!1}setFeatureEnabled(e,t,s){this._renderStateFeatures.mutate(r=>r.set(t,e,s)),this._requestRender()}get _highQualityTransparency(){return this.isFeatureEnabled(1)}get hasReflections(){return this._pluginsHas.water&&this.isFeatureEnabled(5)}get _hasHighlights(){return this._plugins.produces(8,2,4,19,13,14,15)}hasHighlight(e){return this._plugins.hasHighlight(e)}get _hasHUDHighlights(){return this._plugins.produces(8,13,14,15)}get hasSSAO(){return this.isFeatureEnabled(4)&&!this._inGlobeView}get hasSMAA(){return this.isFeatureEnabled(0)}get _hasEmission(){return this._plugins.hasEmitters&&(this._hasIOSEmission||this.hasFloatOit)}get highResolutionAtmosphere(){return this.isFeatureEnabled(3)}get fboCache(){return this._fboCache}_releaseFBOs(){this._bindParameters.ssr.lastFrameColor=n(this._bindParameters.ssr.lastFrameColor),this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion)}_disposeOffscreenBuffers(){this._framebuffer.dispose(),this._disposeBindBuffers()}_disposeBindBuffers(){this._shadowMap.disposeOutputs(),this._bindParameters.depth=n(this._bindParameters.depth)}get updating(){return this._loadEdgeViewTask&&!this._loadEdgeViewTask.finished||this._edgeView?.updating||this._shadowAccumulator.readyToRun||this._plugins.updating||!this.isCameraFinal}loadEdgeView(){return this._loadEdgeViewTask||(this._loadEdgeViewTask=s(async e=>{const{EdgeView:t}=await import("./edgeRendering/EdgeView.js");h(e);const s=this._edgeView=new t({rctx:this._rctx,renderSR:this.stage.view.renderSpatialReference,viewingMode:this.stage.view.stage.viewingMode,techniques:this._techniques,setNeedsRender:()=>this._requestRender(),schedule:Re(this.stage.view.resourceController)});return this.addHandles(o(()=>s.updating,()=>this._requestRender(),l)),this._requestRender(),this._edgeViewCallbacks.forEach(e=>e(s)),this._edgeViewCallbacks.length=0,s})),this._loadEdgeViewTask.promise}withEdgeView(e){this.loadEdgeView(),null==this._edgeView?this._edgeViewCallbacks.push(e):e(this._edgeView)}get edgeView(){return this._edgeView}get isCameraFinal(){return this._reprojectionMatrixVersion.value>=0&&m(this._bindParameters.ssr.reprojectionMatrix,b)}set _reprojectionMatrix(e){t(this._bindParameters.ssr.reprojectionMatrix,e)&&this._reprojectionMatrixVersion.value++}get shadowsEnabled(){return!!this._shadowMap?.enabled}setParameters(e){void 0!==e.shadowMap&&this._shadowMap.enabled!==e.shadowMap&&(this._shadowMap.enabled=e.shadowMap,this._requestRender()),e.shadowCast&&this._shadowAccumulator.setParameters(e.shadowCast)}set slice(e){this._sliceHelper.update(e)&&this._requestRender()}get plugins(){return this._plugins}get hasFloatOit(){return this._rctx.driverTest.floatBufferBlend.result&&this.isFeatureEnabled(10)}get oitEnabled(){return this.hasFloatOit||this._hasOIT8}commit(e,t){return this._isRendering&&console.warn("Renderer.modify called while rendering"),!!super.commit(e,t,this._plugins.context)&&(this.updateHasFlags(),!0)}rendererAdded(e){this._plugins.add(e)}rendererRemoved(e){this._plugins.remove(e)}get occludedRequiresStencil(){return this.occludedRequiresOccludeeStencil||this.occludedRequiresIntegratedMeshStencil}get occludedRequiresOccludeeStencil(){return this._bindParameters.hasOccludees&&!!(8&this.plugins.renderOccludedFlags)}get occludedRequiresIntegratedMeshStencil(){return this._plugins.produces(0,0)&&this._plugins.produces(0,10)}updateHasFlags(){const has=this._pluginsHas;has.occludedHudElements=this._plugins.produces(0,14),has.hudElements=has.occludedHudElements||this._plugins.produces(0,...be),has.water=this._plugins.produces(2,20),this._bindParameters.hasOccludees=this._plugins.hasOccludees,this._requestRender()}updateAnimation(e,t){this._animationTimer??=new V(e.camera,t),this._animationTimer.advance(e.camera,t,this._animationTimeDilation);const s=this._hasAnimations;return this._hasAnimations=this._plugins.updateAnimation(this._animationTimer),this._hasAnimations=this._nodes.updateAnimation(this._animationTimer)||this._hasAnimations,this._hasAnimations!==s&&(this._gpuTimerHandle=s?r(this._gpuTimerHandle):this.performanceInfo.enableGPUPerformanceInfo()),this._hasAnimations}get animationTimestep(){return this._animationTimestep.value}get _animationTimeDilation(){return this._animationTimestep.timeDilation}resetAnimation(){this._animationTimestep.clear()}tick(){this.fboCache.clean()}render(e,t,s,r=!1){try{return this._isRendering=!0,this._render(e,t,s,r)}catch(i){console.error(`Exception during rendering: ${i}`)}finally{this._isRendering=!1}return new ie(this._pluginInput.get(A.FINAL),null)}_render(e,t,s,r){const i=0===s;this.performanceInfo.startFrame(),this.fboCache.frameStart(),this.fboCache.interactive=i,this._disposeBindBuffers();const{camera:a,contentCamera:n,mode:h,alignPixelEnabled:o}=e;this._state.value=h,this._renderContext.time=t,this._rctx.output=0,this._bindParameters.hasEmission=this._hasEmission,this._bindParameters.oitPass=0,this._bindParameters.alignPixelEnabled=o,this._bindParameters.decorations=!r,this._bindParameters.mainDepth=null,this._bindParameters.hasFloatOit=this.hasFloatOit;const d=!r||!this._sliceHelper.isDecoration;this._bindParameters.slicePlane=d?this._sliceHelper.plane:null,this._bindParameters.viewshedEnabled=this._nodes.produces(x.VIEWSHED),this._bindParameters.cutFillEnabled=this._nodes.produces(x.CUTFILL_COMPUTATION),this._renderOverlay(),a.setGLViewport(this._rctx);const _=this._framebuffer,l=_.initialize(a.fullWidth,a.fullHeight,this._backgroundColor);this.hasReflections?(l?.setName("last frame color"),this._bindParameters.ssr.lastFrameColor=l):l?.release(),this._ensureBindParametersCamera(a,n),this._plugins.sortTestsTransparentOrderedSlots(Te),this._plugins.prepareRender(),this._bindParameters.shadowHighlightsVisible=this._needsShadowHighlight&&!r,this._hasTransparentGeometry=this._plugins.produces(0,...pe),this._precompilePrepasses(),this.performanceInfo.advance(ne.PREPARE);const u=this._computeShadowDepthRange(a);this._renderShadowMap(a,this._bindParameters.lighting.mainLight.direction,u),this._pluginInput.set("normals",this._renderNormals()),this._renderSSAOAndDepth(),this._renderShadowAccumulation(u,!i),this._oitCallouts=this._hasTransparentGeometry&&this.oitEnabled,this._ensureBindParametersSSR(t),this._precompileShaders(),this._rctx.output=0,_.bind(),this._bindParameters.mainDepth=_.depth.attachment,this._renderOpaque(),this._renderTransparent(),this._shadowMap.disposeOutput(3),this._renderCutFillComputation(),this._pluginInput.set(x.FOCUSAREA,this._renderFocusAreaGeometry()),_.update(e=>this._renderNodes(x.TRANSPARENT_ENVIRONMENT,e)),_.update(e=>this._renderNodes(x.VIEWSHED,e)),_.update(e=>this._renderNodes(x.LASERLINES,e)),_.update(e=>this._renderNodes(x.FOCUSAREA_COLOR,e)),this._pluginInput.release(x.FOCUSAREA),_.update(e=>this._renderNodes(x.OCCLUDED,e)),this._pluginInput.set("highlights",this._renderHighlightPrepass());const p=2===s?this._renderObjectAndLayerIdColor():null;_.update(e=>this._renderNodes(A.COMPOSITE,e)),this._shadowMap.disposeOutputs(),_.update(e=>this._renderNodes(x.ANTIALIASING,e));const c=this._hasPhotoshopTerrain||!this._hasTransparentGeometry?1:2;let m;return this._bindParameters.hasEmission=!1,this._hasHUDHighlights&&_.update(e=>this._renderHUD(c,e)),_.update(e=>this._renderNodes(x.HIGHLIGHT_COLOR,e)),this._hasHUDHighlights||_.update(e=>this._renderHUD(c,e)),this._bindParameters.hasEmission=this._hasEmission,_.update(e=>this._renderNodes(x.MAGNIFIER,e)),_.update(e=>this._renderNodes(A.FINAL,e)),i&&this._blit.toFramebuffer(this._rctx,_.color,this._bindParameters),this.onPostRender?.(),this._releaseFBOs(),_.releaseDepth(),this._renderContext.lastFrameCamera.copyFrom(this._bindParameters.camera),this.fboCache.frameEnd(),i||(m=_.color,m.retain(),this._releaseFBOs(),this._disposeOffscreenBuffers()),this.performanceInfo.finishFrame(),new ie(m,p)}_precompileShaders(){++this._plugins.context.techniques.precompiling,this._rctx.output=0;const e=this._bindParameters.hasEmission;this._precompileOpaqueGeometry(),this._nodes.precompile(e,x.OPAQUE_ENVIRONMENT,x.PRE_TRANSPARENT);const t=this._bindParameters;if(t.terrainDepthTest=t.cullAboveTerrain=this._needsTerrainDepth,this._rctx.output=1,this._plugins.precompile(...ce),this._needsDepth&&(this._precompileOpaqueGeometry(),this._precompileTransparentGeometry()),this._rctx.output=0,this._plugins.precompile(...ce),this._hasTransparentGeometry){const e=this._pluginsHas.occludedHudElements;this._oitBlend.precompile(this._bindParameters,e,0),this._pluginsHas.hudElements&&this._oitBlend.precompile(this._bindParameters,!1,1)}this._hasTransparentGeometry&&(this._precompileTransparentGeometry(),this._hasPhotoshopTerrain&&(t.cullAboveTerrain=!1,this._precompileTransparentGeometry(),t.cullAboveTerrain=this._needsTerrainDepth)),this._nodes.precompile(e,x.FOCUSAREA);const s=this._hasPhotoshopTerrain&&!this._needsTerrainDepth;this._compositor.precompile(this._usesPremultipliedAlphaBlit,!!this._needsEdges,s,e),this._oitCallouts||this._plugins.precompile(16),t.terrainDepthTest=t.cullAboveTerrain=!1,this._nodes.precompile(e,x.TRANSPARENT_ENVIRONMENT,x.VIEWSHED,x.CUTFILL_COMPUTATION,x.LASERLINES,x.FOCUSAREA_COLOR,x.OCCLUDED,x.ANTIALIASING),t.highlightMixTexture=t.highlights.length>1?this._rctx.emptyTexture:null,this._precompileHUD(0),t.hasEmission=!1,this._precompileHUD(0),this._precompileHUD(1),t.hasEmission=this._hasEmission,this._hasHighlights&&(t.highlights.forEach((e,s)=>{t.highlightLevel=s,this._precompileAllGeometry(8),this._hasHUDHighlights&&this._plugins.precompile(14,13)}),t.highlightLevel=null,this._nodes.precompile(e,x.HIGHLIGHT_COLOR)),t.highlightMixTexture=null,this._nodes.precompile(e,A.COMPOSITE,x.MAGNIFIER),this._shadowAccumulator.precompile(),this._plugins.precompile(9),--this._plugins.context.techniques.precompiling}_renderFocusAreaGeometry(){const e=this._nodes.produce(x.FOCUSAREA,this._pluginInput);return e&&this.performanceInfo.advance(ne.FOCUS_AREA_MASK),e}_renderObjectAndLayerIdColor(){if(!this._nodes.produces("olid"))return null;const e=this._rctx.output;++this._techniques.precompiling;const{width:t,height:s}=this._framebuffer.size;let r=this.fboCache.acquire(t,s,"olid");return r.acquireDepth(13),r=this._nodes.render(r,this._pluginInput),--this._techniques.precompiling,this.performanceInfo.advance(ne.OBJECT_AND_LAYER_ID_COLOR),this._rctx.output=e,r}finish(e){this._hasAnimations||this._animationTimestep.clear();const t=this.performanceInfo.gpuSamplingEnabled,s=0===e;if(s||t){const e=s?this.performanceInfo.elapsedTime:0;let r=0;t?r=this.performanceInfo.totalGPUTimeSampler.last:this._rctx.gl.finish();const i=Math.max(e,r);this._animationTimestep.frame(i,s)}}readMainDepth(e,t){const{mainDepth:s,camera:r}=this._bindParameters;if(!s)return;const i=this.fboCache.acquire(this._framebuffer.size.width,this._framebuffer.size.height,"linear depth");this._rctx.bindFramebuffer(i.fbo),r.setGLViewport(this._rctx),this._rctx.setScissorRect(e[0],e[1],e[2],e[3]),this._rctx.setScissorTestEnabled(!0),this._rctx.clearFramebuffer(E),this._compositor.blitDepthToLinearDepth(this._bindParameters,s),this._rctx.setScissorTestEnabled(!1),this._rctx.setScissorRect(0,0,this._rctx.gl.canvas.width,this._rctx.gl.canvas.width),i.fbo?.readPixels(e[0],e[1],e[2],e[3],6408,he.UNSIGNED_BYTE,t),i.release()}readAccumulatedShadow(e){return this._shadowAccumulator.readAccumulatedShadow(e[0],e[1])}get _needsEdges(){return this._edgeView?.shouldRender()?this._edgeView:null}_renderEdges(e){const t=this._needsEdges;if(!t)return;const{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquire(s,r,"edges"),a=this._bindParameters.geometryDepth,n=()=>t.render(this._bindParameters,e);this._renderToTargets(n,i,a??this._framebuffer.depth,E),this._framebuffer.bind(),this._compositor.composite(this._bindParameters,i.getTexture()),i.release(),this.performanceInfo.advance(1===e?ne.OPAQUE_EDGES:ne.TRANSPARENT_EDGES)}_renderOverlay(){this._bindParameters.overlay=this.overlay?.render(this._renderContext.time),this._bindParameters.overlay&&this.performanceInfo.advance(ne.OVERLAY)}_renderShadowMap(e,t,s){if(!this.shadowsEnabled)return;const r=this._shadowMap;r.start(e,t,s,this.isFeatureEnabled(6),this.stage.view.qualitySettings.maximumPixelRatio),this._needsShadowHighlight?(this._renderShadowCascades(5,this._shadowMap),r.clear(),this._renderShadowCascades(4,this._shadowMap)):this._renderShadowCascades(3),e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,this._bindParameters.contentCamera),this.performanceInfo.advance(ne.SHADOW_MAP)}_renderCutFillComputation(){this._nodes.produce(x.CUTFILL_COMPUTATION,this._pluginInput)?.release()}_precompileShadowCascades(e){0!==this._shadowMap.cascades.length&&this._precompileAllGeometry(e)}_renderShadowCascades(e,t=this._shadowMap){const s=this._rctx.output;t.bindFramebuffer();for(const r of t.cascades)r.camera.setGLViewport(this._rctx),this._ensureBindParametersCamera(r.camera,r.camera),this.renderAllGeometry(e);t.finish(e),this._rctx.output=s}get _needsDepth(){return this._nodes.requireGeometryDepth()||this.hasReflections||this._needsShadowHighlight||this._shadowAccumulator.active||this._debugNeedsDepth}get _usesPremultipliedAlphaBlit(){return this._pluginsHas.hudElements&&this.oitEnabled||this._hasPhotoshopTerrain}_renderSSAOAndDepth(){const e=this._pluginInput.get("normals");e?(this._pluginInput.set(x.SSAO,this._renderSSAO()),this._needsDepth?(this._rctx.bindFramebuffer(e.fbo),this._rctx.clear(1024),this._renderGeometryWithoutNormals(1),this._bindParameters.depth?.release(),this._bindParameters.depth=e.obtainDepthTexture(),this.performanceInfo.advance(ne.DEPTH)):(e.detachDepth(),this._bindParameters.depth=n(this._bindParameters.depth)),this.hasSSAO&&this._pluginInput.release("normals")):this._renderAllGeometryDepth()}_renderAllGeometryDepth(){if(this._bindParameters.depth=n(this._bindParameters.depth),!this._needsDepth)return;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"geometry depth",13);this._rctx.bindFramebuffer(s.fbo),this._rctx.clear(1280),this.renderAllGeometry(1),this._bindParameters.depth=s.obtainDepthTexture(),s.release(),this.performanceInfo.advance(ne.DEPTH)}_renderTerrainDepth(){if(this._bindParameters.terrainDepth=n(this._bindParameters.terrainDepth),this._bindParameters.terrainDepthTest=this._bindParameters.cullAboveTerrain=this._needsTerrainDepth,!this._needsTerrainDepth)return;const e=this._rctx.output;this._rctx.output=1;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"terrain depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderTransparentGround(),this._bindParameters.terrainDepth=r.obtainDepthTexture(),r.release(),this._rctx.output=e}_renderGeometryDepth(){if(this._bindParameters.geometryDepth=n(this._bindParameters.geometryDepth),!this._needsTerrainDepth)return;const e=this._rctx.output,{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"geometry depth",13);this._rctx.bindFramebuffer(r.fbo),this._rctx.clear(1280),this._renderOpaqueAndTransparentGeometry(1),this._rctx.output=e,this._bindParameters.geometryDepth=r.obtainDepthTexture(),r.release()}get _needsShadowDepthRange(){return this._shadowMap.enabled||this._shadowAccumulator.active}_computeShadowDepthRange(e){if(!this._needsShadowDepthRange)return W.Zero;const t=Q(e,this._plugins.plugins,this.stage.layers,0);return t.union(this._plugins.queryDepthRange(e)),t.near=Math.max(e.near,t.near),t.far=Math.min(e.far,t.far),t}updateSceneDepthRange(e){if(!this.stage.view.state.isGlobal)return void(this.sceneDepthRange.value=W.Infinite);if((this.stage.view.renderCoordsHelper?.getAltitude(e.eye)??0)<q)return void(this.sceneDepthRange.value=W.Infinite);const t=e.clone();t.near=D,t.far=1e10;const s=Q(t,this._plugins.plugins,this.stage.layers,1);s.union(this._plugins.queryDepthRange(t)),this.sceneDepthRange.value.equals(s)||(this.sceneDepthRange.value=s)}get _normalsRequired(){const e=this._nodes.require("normals",...S,x.VIEWSHED,x.LASERLINES);return(this.hasSSAO?1:0)+e}_precompilePrepasses(){this._normalsRequired&&this._precompileAllGeometry(2),this._needsDepth&&this._precompileAllGeometry(1),this.shadowsEnabled&&(this._needsShadowHighlight?(this._precompileShadowCascades(4),this._precompileShadowCascades(5)):this._precompileShadowCascades(3)),this._shadowAccumulator.active&&this._precompileAllGeometry(3),this.hasSSAO&&this._normalsRequired&&this._nodes.precompile(this._bindParameters.hasEmission,x.SSAO)}_renderNormals(){const e=this._normalsRequired;if(0===e)return;const{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquire(t,s,"normals",5);r.acquireDepth(13),this._rctx.bindFramebuffer(r.fbo),this._rctx.clearFramebuffer(E,!0,!0),this._rctx.output=2,this._plugins.render(...me);const i=this._nodes.optional("normals",...S,x.VIEWSHED);return r.retain(e+i-1),this.performanceInfo.advance(ne.NORMALS),r}_renderSSAO(){const e=this._pluginInput.get("normals");if(this.hasSSAO&&e)return this._bindParameters.ssao=this._nodes.produce(x.SSAO,this._pluginInput),this._bindParameters.ssao&&this.performanceInfo.advance(ne.SSAO),this._bindParameters.ssao}_precompileAllGeometry(e){const t=this._rctx.output;this._rctx.output=e,this._precompileOpaqueGeometry(),this._precompileTransparentGeometry(),this._plugins.precompile(...ce),this._rctx.output=t}renderAllGeometry(e){this._rctx.output=e,this._renderOpaqueAndTransparentGeometry(e),this._renderTransparentGround()}precompileSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.precompile(this._renderContext)}precompileOccludedSlots(e,t){for(const s of t)this._renderContext.renderOccludedMask=s,this.precompileSlots(e,...ge);this._renderContext.renderOccludedMask=K}renderSlots(e,...t){for(const s of t)this._bindParameters.slot=s,e.forAll(e=>{const t=e.acquireTechniques(this._renderContext);t&&e.render(this._renderContext,t)})}renderOccludedSlots(e,t){this._renderContext.renderOccludedMask=t,this.plugins.renderOccludedFlags>1&&this._plugins.render(10),this.renderSlots(e,...ge),this._renderContext.renderOccludedMask=K}renderHUD(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(...we[e])}_renderHUDElements(e){this._bindParameters.hudRenderStyle=e,this._plugins.render(17),this.renderHUD(e),this._bindParameters.hudRenderStyle=e,this._plugins.render(15)}precompileViewshedShadowMap(){this._precompileAllGeometry(6)}precompileCutFillReferenceDepth(){const e=this._rctx.output;this._rctx.output=7,this._plugins.precompile(...Ee),this._rctx.output=e}renderViewshedShadowMap(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this.renderAllGeometry(6),this._ensureBindParametersCamera(t,s),this._bindParameters.camera.setGLViewport(this._rctx),this._rctx.output=r}renderCutFillReferenceDepth(e){const{camera:t,contentCamera:s}=this._bindParameters,r=this._rctx.output;e.setGLViewport(this._rctx),this._ensureBindParametersCamera(e,e),this._rctx.output=7,this._plugins.render(...Ee),this._ensureBindParametersCamera(t,s),t.setGLViewport(this._rctx),this._rctx.output=r}_renderOpaqueAndTransparentGeometry(e){this._rctx.output=e,this._renderOpaqueGeometry(),this._renderTransparentGeometry()}_renderGeometryWithoutNormals(e){this._rctx.output=e,this._plugins.render(...fe)}_precompileOpaqueGeometry(){this._needsOpaquePass&&(this._plugins.precompile(...ue),this._nodes.precompile(this._bindParameters.hasEmission,x.CUTFILL_COLOR,"opaque-color"))}_renderOpaqueGeometry(){this._plugins.render(...ue)}_renderTransparentGeometry(){this._plugins.render(...pe),this._oitCallouts&&this._plugins.render(16)}get _hasPhotoshopTerrain(){return this._plugins.produces(0,6)}get _needsTerrainDepth(){return this._highQualityTransparency&&this._hasPhotoshopTerrain}_renderPhotoshopTerrain(){if(!this._hasPhotoshopTerrain)return null;const{width:e,height:t}=this._framebuffer.size,s=this.fboCache.acquire(e,t,"transparent terrain"),r=()=>this._plugins.render(6);return this._renderToTargets(r,s,this._framebuffer.depth,E),this.performanceInfo.advance(ne.TRANSPARENT_TERRAIN),s}_renderTransparentGround(){this._plugins.render(...ce)}_renderLineCallouts(e){if(this._bindParameters.hudRenderStyle=e,0===e){const e=()=>this._plugins.render(16),{width:t,height:s}=this._framebuffer.size,r=this.fboCache.acquireDepth(this._hudDepthFormat,t,s,"line callouts");this._renderToTargets(e,this._framebuffer.color,r,void 0,!0,!0),r.release()}else this._plugins.render(16)}_precompileHUD(e){if(this._pluginsHas.hudElements&&(this._precompileHUDOutput(e),this._hasHighlights)){const t=this._rctx.output;this._rctx.output=8,this._precompileHUDOutput(e),this._rctx.output=t}}_precompileHUDOutput(e){const t=this._bindParameters.hudRenderStyle;this._bindParameters.hudRenderStyle=e,this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...be),this._bindParameters.oitPass=2,this._plugins.precompile(...be),this._bindParameters.oitPass=0,this._oitBlend.precompile(this._bindParameters,!1,1)):this._plugins.precompile(...be),this._bindParameters.hudRenderStyle=t}_renderHUD(e,t){if(!this._pluginsHas.hudElements)return t;if(this.oitEnabled){const s=this._renderOIT(1,e);this._rctx.bindFramebuffer(t.fbo);const r=!!t.getTexture(oe);this._compositor.compositePreMultipliedAlpha(this._bindParameters,s.getTexture(),r),s.release()}else if(this._rctx.output=0,0===e){const t=()=>this._renderHUDElements(e),{width:s,height:r}=this._framebuffer.size,i=this.fboCache.acquireDepth(this._hudDepthFormat,s,r,"hud");this._renderToTargets(t,this._framebuffer.color,i,void 0,!0,!0),i.release()}else t.acquireDepth(this._hudDepthFormat),this._rctx.bindFramebuffer(t.fbo),this._rctx.clear(256),this._renderHUDElements(e),t.detachDepth();return this.performanceInfo.advance(0===e?ne.HUD_OCCLUDED:ne.HUD),t}get _needsShadowHighlight(){return this.shadowsEnabled&&this._plugins.produces(4,2)}_renderHighlightPrepass(){if(!this._hasHighlights)return;const{fboCache:e,_rctx:t,_bindParameters:s}=this,{width:r,height:i}=this._framebuffer.size,{highlights:a}=s,n=a.length>U?3:1,h=e.acquire(r,i,"highlights",n);h.acquireDepth(13);const o=this._plugins.produces(8,0);return o&&this._framebuffer.color.fbo&&h.fbo&&t.blitFramebuffer(this._framebuffer.color.fbo,h.fbo,1024),t.bindFramebuffer(h.fbo),t.gl.clearBufferuiv(6144,0,[0,0,0,0]),o||t.clear(1024),this._rctx.output=8,t.bindFramebuffer(h.fbo),L(t,e,r,i,s,()=>this._renderHighlightGeometries()),h.detachDepth(),this.performanceInfo.advance(ne.HIGHLIGHTS),h.retain(this._nodes.require("highlights",...R)+this._nodes.optional("highlights",...R)-1),h}_renderHighlightGeometries(){this._plugins.render(...Pe),this._rctx.clear(256),this._renderHUDElements(2)}_renderShadowAccumulation(e,t){this._shadowAccumulator.updateDepthRange(e);const{depth:s,camera:r,contentCamera:i}=this._bindParameters;this._rctx.output=0,this._shadowAccumulator.accumulating&&s&&this._shadowAccumulator.renderAccumulation(s,r,i,t)&&this.performanceInfo.advance(ne.ACCUMULATED_SHADOWS)}_precompileTransparentGeometry(){this.oitEnabled&&F(this._rctx.output)?(this._bindParameters.oitPass=1,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=2,this._plugins.precompile(...pe),this._oitCallouts&&this._plugins.precompile(16),this._bindParameters.oitPass=0):this._plugins.precompile(...pe)}_renderOIT(e,t=2){const s=1===e,{width:r,height:i}=this._framebuffer.size,a=s?()=>this._renderHUDElements(t):()=>this._renderTransparentGeometry(),h=this._bindParameters,o=this.hasFloatOit?8:5,d=this._rctx.output;this._rctx.output=0,h.oitPass=1;const _=s?"oit hud":"oit",l=this.fboCache.acquire(r,i,_,o),u=this._bindParameters.hasEmission&&(0===e||1!==t);u&&l.acquireColor(oe,o,"oit emissive");const p=u?de:oe;l.acquireColor(p,this.hasFloatOit?7:0,"oit alpha"),s||l.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(l.fbo),this._rctx.clearFramebuffer([0,0,0,1]),u&&this._rctx.clearBuffer(1,E),a(),l.detachDepth(),h.oitPass=2;const c=this.fboCache.acquire(r,i,s?"oit hud front":"oit front");u&&c.acquireColor(oe,o,"oit emissive front"),s?c.acquireDepth(this._hudDepthFormat):c.attachDepth(this._framebuffer.depth),this._rctx.bindFramebuffer(c.fbo),this._rctx.clearFramebuffer(E,s),a(),c.detachDepth();const m=this._pluginsHas.occludedHudElements&&!s;let f;return this._bindParameters.hudOcclusion=n(this._bindParameters.hudOcclusion),h.oitPass=0,s?(f=this.fboCache.acquire(r,i,"oit hud composite"),this._rctx.bindFramebuffer(f.fbo),this._rctx.setClearColor(0,0,0,1e-13),this._rctx.clear(16384)):(m&&(this._framebuffer.color.acquireColor(p,0,"hud occlusion"),this._rctx.clearBuffer(p-_e,E)),this._framebuffer.bind()),this._oitBlend.blend(this._rctx,l,c,h,u,m,e),f?.detachDepth(),s||(this._rctx.bindFramebuffer(c.fbo),this._framebuffer.bind(),m&&(this._bindParameters.hudOcclusion=this._framebuffer.color.obtainAttachment(p))),c.release(),l.release(),this._rctx.output=d,f}get _hudDepthFormat(){return this.isFeatureEnabled(8)?13:12}get _needsOpaquePass(){return this.plugins.produces(0,...ue)||this.plugins.produces(3,...ue)||this.plugins.produces(1,3)}_renderOpaque(){const e=this._needsOpaquePass;e&&(this._plugins.render(0,1),this._framebuffer.update(e=>this._renderNodes(x.CUTFILL_COLOR,e)),this._plugins.render(2,3));const t=this._framebuffer;this._renderTerrainDepth(),t.update(t=>this._renderNodes(A.OPAQUE,t,e)),this.fboCache.debugCallback?.(A.OPAQUE,t.color.fbo),t.update(e=>this._renderNodes(x.OPAQUE_ENVIRONMENT,e)),this.fboCache.debugCallback?.(x.OPAQUE_ENVIRONMENT,t.color.fbo),this._renderEdges(1)}_renderTransparent(){const e=this._framebuffer;e.bind(),e.update(e=>this._renderNodes(x.PRE_TRANSPARENT,e)),this.fboCache.debugCallback?.(x.PRE_TRANSPARENT,e.color.fbo),this._renderHiddenTransparentEdges(),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry()),e.update(e=>this._renderNodes(A.TRANSPARENT,e,this._hasTransparentGeometry)),this.fboCache.debugCallback?.(A.TRANSPARENT,e.color.fbo),this._renderGeometryDepth(),this._needsTerrainDepth||this._oitCallouts||this._plugins.render(16),this._renderEdges(0);const t=this._renderPhotoshopTerrain(),s=t?.getTexture();s&&this._renderHUD(0,e.color),this._bindParameters.cullAboveTerrain=!1,s&&(e.bind(),this._compositor.compositePreMultipliedAlpha(this._bindParameters,s),t?.release(),this._needsTerrainDepth&&(this._renderEdges(1),this._hasTransparentGeometry&&(this.oitEnabled?this._renderOIT(0):this._renderTransparentGeometry(),this.performanceInfo.advance(ne.TRANSPARENT)),this._renderEdges(0))),this._bindParameters.ssao=n(this._bindParameters.ssao),this._needsTerrainDepth&&this._renderLineCallouts(1),this._bindParameters.terrainDepthTest=!1,this._renderTransparentEnvironment()}_renderTransparentEnvironment(){this._shadowAccumulator.render(this._bindParameters),this.performanceInfo.advance(ne.APPLY_ACCUMULATED_SHADOWS),this._framebuffer.bind(),this._plugins.render(9),this.performanceInfo.advance(ne.TRANSPARENT_MATERIAL_WITHOUT_DEPTH)}_renderNodes(e,t,s=!1){const r=t.name;if(t.setName(e),this._pluginInput.set(e,t),!this._nodes.produces(e))return s&&this.performanceInfo.advance(e),t;this._fboCache.debugCallback?.(r,t.fbo);const i=this._nodes.render(t,this._pluginInput,this._releaseNodeInputs);return this.performanceInfo.advance(e),i}_ensureBindParametersCamera(e,t){this._bindParameters.camera=e,this._bindParameters.contentCamera=t}_ensureBindParametersSSR(e){if(this._bindParameters.ssr.lastFrameColor){null==this._ssrEnableTime&&(this._ssrEnableTime=e),this._renderContext.lastFrameCamera.equals(this._bindParameters.camera)?this._reprojectionMatrix=b:(f(xe,this._bindParameters.camera.viewMatrix),f(Ae,this._bindParameters.camera.projectionMatrix),g(Se,xe,Ae),g(Se,this._renderContext.lastFrameCamera.viewMatrix,Se),g(Se,this._renderContext.lastFrameCamera.projectionMatrix,Se),this._reprojectionMatrix=Se);const t=this.stage.view.qualitySettings.fadeDuration;this._bindParameters.ssr.fadeFactor=t>0?Math.min(t,e-this._ssrEnableTime)/t:1,this._bindParameters.ssr.fadeFactor<1&&this._requestRender()}else this._reprojectionMatrix=b,this._ssrEnableTime=null}addRenderNode(e){this._nodes.add(e),this._requestRender()}removeRenderNode(e){this._nodes.remove(e),this._requestRender()}updateLighting(e,t,s,r){this._bindParameters.updateLighting(e,t,s,r),this._requestRender(1)}get usedMemory(){return{fbos:this.fboCache.usedMemory,plugins:this._plugins.usedMemory,edges:this.edgeView?.usedMemory??0}}_renderToTargets(e,t,s,r,i=!1,a=!1){t.attachDepth(s),this._rctx.bindFramebuffer(t.fbo),this._rctx.clearFramebuffer(r,i,a),e(),t.detachDepth()}get test(){}};e([p({readOnly:!0})],le.prototype,"highResolutionAtmosphere",null),e([p()],le.prototype,"_edgeView",void 0),e([p()],le.prototype,"updating",null),le=e([c("esri.views.3d.webgl-engine.lib.Renderer")],le);const ue=[0,1,2,3],pe=[7,8,4,5],ce=[6,7,8],me=[0,1,2,4,...ce],fe=[3,5],ge=[2,4,9],be=[17,13,15,14],Pe=[4,5,2,3,0,1,...ce],Te=[4,9,5,12],we={0:[14],1:[13],2:[14,13],3:[14,13]},Ee=[0,1,...ce],Ce=["normals","highlights"],Ae=P(),xe=P(),Se=P();function Re(e){return t=>e.immediate.schedule(t)}export{le as Renderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r}from"../../../../core/maybe.js";import{watch as
|
|
2
|
+
import{__decorate as e}from"tslib";import s from"../../../../core/Collection.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{disposeMaybe as r,releaseMaybe as i}from"../../../../core/maybe.js";import{watch as a,initial as o,when as n,sync as h}from"../../../../core/reactiveUtils.js";import{property as d,subclass as p}from"../../../../core/accessorSupport/decorators.js";import{translate as c,fromTranslation as w,scale as m,mul as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{sub as u,distance as v}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as _,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as g}from"../../../../geometry/support/sphere.js";import{InternalRenderCategory as b}from"../../webgl.js";import M from"../../webgl/RenderNode.js";import{ViewshedShadowMap as S}from"./ViewshedShadowMap.js";import{V as y}from"../../../../chunks/Viewshed.glsl.js";import{ViewshedTechnique as P}from"../shaders/ViewshedTechnique.js";import{ColorAttachment0 as j}from"../../../webgl/enums.js";let x=class extends M{get shadowMap(){return this._shadowMap}get hasViewsheds(){return this._viewsheds.length>0}get _contentPixelRatio(){return this.view.state.contentPixelRatio}get _viewshedsInView(){return this._viewsheds.items.filter(e=>A(this.view,e))}constructor(e){super(e),this.isDecoration=!1,this._passParameters=new y,this._viewsheds=new s,this._shadowMap=null,this.consumes={required:[b.VIEWSHED,"normals"]},this.produces=b.VIEWSHED}initialize(){this._shadowMap=new S(this.fboCache),this.addHandles([a(()=>this.view.resolutionScale,e=>{const s=this._shadowMap;s&&(s.settings.textureSizeQuality=e)},o),n(()=>!this.hasViewsheds,()=>this._shadowMap?.dispose()),a(()=>this._viewshedsInView.map(e=>[e.observerRenderSpace,e.heading,e.tilt,e.farDistance,e.horizontalFieldOfView,e.verticalFieldOfView]),()=>this.requestRender(1),h)])}destroy(){this._shadowMap=r(this._shadowMap)}precompile(){if(this.hasViewsheds){this.techniques.precompile(P);for(const e of this._viewshedsInView)if(this._shadowMap?.isActive(e))return void this.view.stage.renderer.precompileViewshedShadowMap()}}render(e){const s=this.bindParameters,t=this.renderingContext,r=e.find(({name:e})=>e===b.VIEWSHED);if(!this.hasViewsheds||this.isDecoration&&!s.decorations)return r;const a=this.techniques.getCompiled(P);if(!a)return this.requestRender(1),r;const o=this.view.stage.renderer.isFeatureEnabled(7);this._passParameters.shadowMap=this._shadowMap??this._passParameters.shadowMap,this._passParameters.depth=r.obtainDepthTexture(),this._passParameters.normals=e.find(({name:e})=>"normals"===e)?.getTexture();for(const i of this._viewshedsInView){if(!this._renderShadowCubeMap(s,i,o)||!this._shadowMap?.ready)continue;const e=this._setupViewshedParameters(i,s.camera);t.bindFramebuffer(r.fbo),t.bindTechnique(a,s,e),t.setDrawBuffers([j]),t.screen.draw()}return this.shadowMap?.dispose(),r.attachDepth(this._passParameters.depth),this._passParameters.depth=i(this._passParameters.depth),r}updateViewsheds(e){const s=this._viewsheds,{removes:t,adds:r}=e;if(t&&(Array.isArray(t)?s.removeMany(t):s.remove(t)),r)if(Array.isArray(r)){const e=r.filter(e=>!s.includes(e));s.addMany(e)}else s.includes(r)||s.add(r)}_renderShadowCubeMap(e,s,t){const r=this._shadowMap;if(!r)return!1;const i=this.view.basemapTerrain.hasStencilEnabledExtents,a=r.start(e.camera,s,t,this._contentPixelRatio,i);return a&&r.faces.forEach(e=>this.view.stage.renderer.renderViewshedShadowMap(e)),r.finish(),a}_setupViewshedParameters(e,s){const r=this._shadowMap;if(!r)return this._passParameters;const i=this._passParameters,a=e.effectiveObserverRenderSpace;i.localOrigin=a,i.observerOffset=u(I,e.observerRenderSpace,e.effectiveObserverRenderSpace),i.fovs=[t(e.horizontalFieldOfView),t(e.verticalFieldOfView)],i.headingAndTilt=[t(e.heading),t(e.tiltParallelToSurface)],i.upVector=e.tiltedUpVector;const o=R(e.targetRenderSpace,a);i.targetVector=o;const n=new Array,h=new Array;for(let t=0;t<r.numActiveFaces;t++)c(O,r.viewshedViewMatrices[t],a),n.push(...O),D(r.viewshedProjectionMatrices[t],O,q),h.push(...q);return i.viewMatrices=n,i.projectionMatrices=h,i.volumeOffset=this.selectedViewshed?.()===e.viewshed?E(e,this.view,s.eye):0,i}get test(){return{viewsheds:this._viewsheds,shadowMap:this._shadowMap,viewshedsInView:this._viewshedsInView}}};function R(e,s){const t=_();return u(t,e,s)}function D(e,s,t){const r=V(.5,.5,.5);return w(t,r),m(t,t,r),l(t,t,e),l(t,t,s),t}function A(e,s){const t=new g(s.observerRenderSpace,s.farDistanceRenderSpace);return!!e.ready&&e.frustum.intersectsSphere(t)}function E(e,s,t){if(null==e)return 0;const{observerRenderSpace:r,targetRenderSpace:i}=e,a=v(t,r)>v(t,i)?e.observer:e.target;return s.pixelSizeAt(a)}e([d()],x.prototype,"selectedViewshed",void 0),e([d()],x.prototype,"isDecoration",void 0),e([d()],x.prototype,"shadowMap",null),e([d()],x.prototype,"hasViewsheds",null),e([d()],x.prototype,"_contentPixelRatio",null),e([d()],x.prototype,"_viewshedsInView",null),e([d()],x.prototype,"consumes",void 0),e([d()],x.prototype,"produces",void 0),x=e([p("esri.views.3d.webgl-engine.lib.Viewshed")],x);const I=_(),O=f(),q=f();export{x as Viewshed,E as computeOffsetScale};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as
|
|
2
|
+
import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as t}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{DefaultBufferWriter as s}from"./DefaultBufferWriter.js";import{PositionUvLayout as o}from"./DefaultLayouts.js";import{TriangleMaterial as a,TriangleMaterialParameters as n}from"./TriangleMaterial.js";import{CheckerBoardTechnique as p}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";import{alphaCutoff as c}from"../../../../webscene/support/AlphaCutoff.js";class u extends a{constructor(r){super(r,m),this._configuration=new h,this.produces=new Map([[2,r=>t(r)&&!this.transparent],[4,r=>t(r)&&this.transparent&&this.parameters.writeDepth],[9,r=>t(r)&&this.transparent&&!this.parameters.writeDepth]])}updateConfiguration(r,e){super.updateConfiguration(r,e),this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.terrainDepthTest=e.terrainDepthTest,this._configuration.cullAboveTerrain=e.cullAboveTerrain}get visible(){return this.parameters.color1[3]>=c||this.parameters.color2[3]>=c}get transparent(){return this.parameters.color1[3]<1||this.parameters.color2[3]<1}createGLMaterial(r){return new f(r)}createBufferWriter(){return new s(o)}}class f extends i{beginSlot(r){return this.getTechnique(p,r)}}class m extends n{constructor(){super(...arguments),this.size=r(1,1),this.color1=e(.75,.75,.75,1),this.color2=e(.5,.5,.5,1),this.writeDepth=!0}}export{u as CheckerBoardMaterial,m as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{ZEROS as
|
|
2
|
+
import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColorOrOLID as t,isDepth as r,is2DGeometryOutput as s,isColor as i}from"../core/shaderLibrary/ShaderOutput.js";import a from"../lib/GLMaterial.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterial as n}from"./TriangleMaterial.js";import{VisualVariablePassParameters as h}from"./VisualVariablePassParameters.js";import{getLayout as p,ColorMaterialTechnique as u}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as c}from"../shaders/ColorMaterialTechniqueConfiguration.js";import{alphaCutoff as l}from"../../../../webscene/support/AlphaCutoff.js";class m extends n{constructor(e){super(e,g),this._configuration=new c,this.supportsEdges=!0,this.produces=new Map([[2,e=>this._isOpaqueMaterialPass(e)],[3,e=>this._isOpaqueNoSSAODepthPass(e)],[4,e=>t(e)&&this.transparent&&this.parameters.writeDepth],[5,e=>r(e)&&this.transparent&&this.parameters.writeDepth],[9,e=>t(e)&&this.transparent&&!this.parameters.writeDepth],[19,e=>s(e)]])}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.discardInvisibleFragments=this.transparent&&!this._isOpaquePass(e)&&this.parameters.discardInvisibleFragments,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest&&i(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration.emissionSource=this.hasEmissions?1:0}get visible(){return this.parameters.color[3]>=l}get transparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}get hasEmissions(){return this.parameters.emissiveStrength>0}_isOpaquePass(e){return i(e)||this._isOpaqueMaterialPass(e)||this._isOpaqueNoSSAODepthPass(e)}_isOpaqueMaterialPass(e){return 8===e||t(e)&&!this.transparent}_isOpaqueNoSSAODepthPass(e){return r(e)&&this.parameters.writeDepth&&!this.transparent}createGLMaterial(e){return new f(e)}createBufferWriter(){return new o(p(this.parameters))}}class f extends a{beginSlot(e){return this.getTechnique(u,e)}}class g extends h{constructor(){super(...arguments),this.color=e,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=0,this.draped=!1,this.discardInvisibleFragments=!1,this.emissiveStrength=0,this.useIndexing=!1}}export{m as ColorMaterial,g as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{exactEquals as e,set as r,copy as t,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,r){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}
|
|
2
|
+
import{exactEquals as e,set as r,copy as t,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOutputMRT as m,isShadowLike as p,isColor as d}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as f}from"../lib/GLTextureMaterial.js";import{Material as T}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as g}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as v}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as C}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as w}from"../shaders/RealisticTreeTechnique.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class R extends T{constructor(e,r){super(e,P),this.materialType="default",this.supportsEdges=!0,this.intersectDraped=void 0,this.produces=new Map([[2,e=>(m(e)||p(e))&&!this.transparent],[4,e=>(m(e)||p(e))&&this.transparent&&this.parameters.writeDepth],[9,e=>(m(e)||p(e))&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new C(r.spherical)}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:r,opacity:t,externalColor:s}=this.parameters;return e*("replace"===r?1:t)*("ignore"===r||isNaN(s[3])?1:s[3])>=y}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get hasEmissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)}updateConfiguration(e,r){const{parameters:t,_configuration:s}=this,{treeRendering:i,doubleSided:a,doubleSidedType:o}=t;super.updateConfiguration(e,r),s.hasNormalTexture=t.hasNormalTexture,s.hasColorTexture=t.hasColorTexture,s.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,s.hasOcclusionTexture=t.hasOcclusionTexture,s.hasVertexTangents=!i&&t.hasVertexTangents,s.instanced=t.instanced,s.instancedDoublePrecision=t.instancedDoublePrecision,s.hasVVColor=!!t.vvColor,s.hasVVSize=!!t.vvSize,s.hasVerticalOffset=null!=t.verticalOffset,s.hasScreenSizePerspective=null!=t.screenSizePerspective,s.hasSlicePlane=t.hasSlicePlane,s.alphaDiscardMode=t.textureAlphaMode,s.normalType=i?0:t.normalType,s.transparent=this.transparent,s.writeDepth=t.writeDepth,s.customDepthTest=t.customDepthTest??0,s.hasOccludees=r.hasOccludees,s.cullFace=t.hasSlicePlane?0:t.cullFace,s.cullAboveTerrain=r.cullAboveTerrain,s.hasModelTransformation=!i&&null!=t.modelTransformation,s.hasVertexColors=t.hasVertexColors,s.hasSymbolColors=t.hasSymbolColors,s.doubleSidedMode=i?2:a&&"normal"===o?1:a&&"winding-order"===o?2:0,s.instancedFeatureAttribute=t.instancedFeatureAttribute,s.instancedColor=t.instancedColor,d(e)?(s.terrainDepthTest=r.terrainDepthTest,s.receiveShadows=t.receiveShadows,s.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=r.ssao):(s.terrainDepthTest=!1,s.receiveShadows=s.receiveAmbientOcclusion=!1),s.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,s.pbrMode=t.usePBR?t.isSchematic?2:1:0,s.emissionSource=t.emissionSource,s.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),s.enableOffset=r.enableOffset,s.snowCover=r.snowCover>0,s.hasColorTextureTransform=!!t.colorTextureTransformMatrix,s.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,s.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,s.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,s.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersect(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;r(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(B,N);break;case 2:p=t(B,V)}const d=i(z,N,e.eye),f=a(d),T=o(d,d,1/f);let x=null;this.parameters.screenSizePerspective&&(x=n(p,T));const g=S(e,f,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(_,p,c.transform.inverseRotation),h=i(A,h,_),m=i(I,m,_)}x(e,c,h,m,g(c.verticalOffset),p)}createGLMaterial(e){return new D(e)}createBufferWriter(){return new v(this._layout)}get transparent(){return j(this.parameters)}}class D extends f{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const t=this._material.parameters;this.updateTexture(t.textureId);const s=e.camera.viewInverseTransposeMatrix;return r(t.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(t.treeRendering?w:O,e)}}class P extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return this.treeRendering?0:null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}function j(e){const{drivenOpacity:r,opacity:t,externalColor:s,layerOpacity:i,texture:a,textureId:o,textureAlphaMode:n,colorMixMode:l}=e,u=s[3];return r||t<1&&"replace"!==l||u<1&&"ignore"!==l||i<1||(null!=a||null!=o)&&1!==n&&2!==n&&"replace"!==l}const A=c(),I=c(),V=h(0,0,1),B=c(),_=c(),N=c(),z=c();export{D as DefaultGLMaterial,R as DefaultMaterial,P as DefaultMaterialParameters,j as isTransparent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as u,transformMat4 as f,normalize as h,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as P,ONES as C,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as A}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as w}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as _}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as U}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class se extends L{constructor(e,t,s=!1){super(e,Pe),this.produces=new Map([[13,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[14,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[15,e=>M(e)&&this.parameters.drawAsLabel],[19,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ee(t,s)}getConfiguration(e,t){const{parameters:s,_configuration:r}=this,i=s.draped;return super.getConfiguration(e,t,this._configuration),r.hasSlicePlane=s.hasSlicePlane,r.hasVerticalOffset=!!s.verticalOffset,r.hasScreenSizePerspective=!!s.screenSizePerspective,r.screenCenterOffsetUnitsEnabled="screen"===s.centerOffsetUnits,r.hasPolygonOffset=s.polygonOffset,r.draped=i,r.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,r.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,r.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,r.hasRotation=this.parameters.hasRotation,r.hasVVSize=!!this.parameters.vvSize,r.hasVVColor=!!this.parameters.vvColor,r.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,r.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,r.depthTestEnabled=this.parameters.depthEnabled,r.hasVertexColor=this.parameters.hasVertexColor,r.hasVertexSize=this.parameters.hasVertexSize,r.hasVertexRotation=this.parameters.hasVertexRotation,r.hasVertexUVi=this.parameters.hasVertexUVi,r.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,_(e)&&(r.debugDrawLabelBorder=!!w.LABELS_SHOW_BORDER),r.terrainDepthTest=t.terrainDepthTest,r.cullAboveTerrain=t.cullAboveTerrain,r.hasOcclusionTexture=!s.drawAsLabel&&r.transparentOccluded&&0!==t.oitPass,r}intersect(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const C=e.attributes.get("featureAttribute"),j=null==C?null:P(C.data,xe),{scaleX:D,scaleY:A}=je(j,V,z.pixelRatio),R=e.attributes.get("position"),w=e.attributes.get("size"),M=e.attributes.get("normal"),_=e.attributes.get("rotation"),F=e.attributes.get("centerOffset"),T=this.parameters.size;E(R.size>=3);const U=K(V),L="screen"===this.parameters.centerOffsetUnits;for(let P=0;P<R.data.length/R.size;P++){const e=P*R.size;if(u(le,R.data[e],R.data[e+1],R.data[e+2]),f(le,le,t),f(le,le,z.viewMatrix),F){const e=P*F.size;u(be,F.data[e],F.data[e+1],F.data[e+2])}else u(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];h(be,le),m(le,le,d(be,be,e))}const a=P*M.size;u(ce,M.data[a],M.data[a+1],M.data[a+2]),g(ce,ce,s(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=Ae(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,pe),pe[0]>-1){if(L&&(be[0]||be[1])&&(pe[0]+=be[0]*z.pixelRatio,0!==be[1]&&(pe[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(pe,le)),pe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,pe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,pe[0]=Math.floor(pe[0]),pe[1]=Math.floor(pe[1]),ye[0]=T[0],ye[1]=T[1],null!=w){const e=P*w.size;ye[0]*=w.data[e],ye[1]*=w.data[e+1]}oe.evaluator.applyVec2(ye,ye);const e=Oe*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*ye[0])*z.pixelRatio/2}ye[0]*=D,ye[1]*=A;const s=V.rotation+(null!=_?_.data[P*_.size]:0);if(ne(O,pe[0],pe[1],ye,e,t,s,V,U)){const e=r.ray;if(f(fe,le,i(ge,z.viewMatrix)),pe[0]=O[0],pe[1]=O[1],z.unprojectFromRenderScreen(pe,le)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,le)*s,t,-1,fe)}}}}}intersectDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),p=l.size,u=e.attributes.get("featureAttribute"),f=null==u?null:P(u.data,xe),{scaleX:h,scaleY:m}=je(f,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,u=a.data[t],f=a.data[t+1];if(ye[0]=p[0],ye[1]=p[1],null!=n){const e=g*n.size;ye[0]*=n.data[e],ye[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*ye[0])*e.screenToWorldRatio/2}ye[0]*=h,ye[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(s,u,f,ye,d,b,v,l,c)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new Ce(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(ue,r,s(de,i));const c=ae(ue,o,Se),p=De(x(t),o),u=Ae(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,u+p),b(e,e,ue,u+p);const f=n+u;this._applyPolygonOffsetView(t,c,f,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(h(ce,s),O(s,s,d(ce,ce,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=te||t>=te&&s[3]>=te;return this._visible&&r}createGLMaterial(e){return new re(e)}calculateRelativeScreenBounds(e,t,s=D()){return ie(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class re extends U{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function ie(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ae(e,t,s){return f(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Ve),s}function ne(e,s,r,i,a,l,c,p,u){let f=s-a-i[0]*u[0],h=f+i[0]+2*a,m=r-a-i[1]*u[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(f+=i[0]*g[0],m+=i[1]*g[1],h-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),f-=l,h+=l,m-=l,d+=l),n(me,s,r),o(he,e,me,t(c)),he[0]>f&&he[0]<h&&he[1]>m&&he[1]<d}const oe=new B,le=y(),ce=y(),pe=j(),ue=y(),fe=y(),he=p(),me=p(),de=r(),ge=a(),be=y(),ve=y(),xe=j(),Se={normal:y(),cosAngle:0},Oe=1,ze=2,ye=c(0,0),Ve=V(0,0,1);class Pe extends T{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ce{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i,a){const{position:n,normal:o,color:l,size:c,rotation:p,centerOffset:u,groundDistance:f,featureAttribute:h,uvi:m}=i;I(s.get("position"),e,n,a),W(s.get("normal"),t,o,a);const d=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,s,r,i)}}}if(l&&H(s.get("color"),4,l,a),c&&N(s.get("size"),c,a),p&&G(s.get("rotation"),p,a),u&&(s.get("centerOffset")?q(s.get("centerOffset"),u,a):X(u,a,d)),s.get("groundDistance")?G(s.get("groundDistance"),f,a):X(f,a,d),h&&(s.get("featureAttribute")?Y(s.get("featureAttribute"),h,a):X(h,a,d)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=i.getField("olidColor",A);k(r,s,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:s}=t;N(e.get("uv0"),s,0)}}function je(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(R(ve,t,e),{scaleX:ve[0]*s,scaleY:ve[1]*s})}function De(e,t){const s=t.computeRenderPixelSizeAtDist(e)*F;return(t.aboveGround?1:-1)*s}function Ae(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{se as HUDMaterial,Pe as Parameters};
|
|
2
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as h,transformMat4 as u,normalize as f,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as P,ONES as C,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as A}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as w}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as F}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as T}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as U,GLTextureMaterial as _}from"../lib/GLTextureMaterial.js";import{Material as L}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as B}from"../lib/screenSizePerspectiveUtils.js";import{assert as E}from"../lib/Util.js";import{writePosition as I,writeNormal as W,writeColor as H,writeBufferVec2 as N,writeBufferFloat as G,writeBufferVec3 as q,writeBufferZeros as X,writeBufferVec4 as Y,writeOlidColor as k}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as J}from"./internal/MaterialUtil.js";import{c as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class se extends L{constructor(e,t,s=!1){super(e,Pe),this.produces=new Map([[13,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[14,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[15,e=>M(e)&&this.parameters.drawAsLabel],[19,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new ee(t,s)}updateConfiguration(e,t){super.updateConfiguration(e,t);const{parameters:s,_configuration:r}=this,i=s.draped;r.hasSlicePlane=this.parameters.hasSlicePlane,r.hasVerticalOffset=!!this.parameters.verticalOffset,r.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,r.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,r.hasPolygonOffset=this.parameters.polygonOffset,r.draped=i,r.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,r.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,r.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,r.hasRotation=this.parameters.hasRotation,r.hasVVSize=!!this.parameters.vvSize,r.hasVVColor=!!this.parameters.vvColor,r.occludedFragmentFade=!i&&!!this.parameters.occludedFragmentOpacity,r.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,r.depthTestEnabled=this.parameters.depthEnabled,r.hasVertexColor=this.parameters.hasVertexColor,r.hasVertexSize=this.parameters.hasVertexSize,r.hasVertexRotation=this.parameters.hasVertexRotation,r.hasVertexUVi=this.parameters.hasVertexUVi,r.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,F(e)&&(r.debugDrawLabelBorder=!!w.LABELS_SHOW_BORDER),r.terrainDepthTest=t.terrainDepthTest,r.cullAboveTerrain=t.cullAboveTerrain,r.hasOcclusionTexture=!s.drawAsLabel&&r.transparentOccluded&&0!==t.oitPass}intersect(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const C=e.attributes.get("featureAttribute"),j=null==C?null:P(C.data,xe),{scaleX:D,scaleY:A}=je(j,V,z.pixelRatio),R=e.attributes.get("position"),w=e.attributes.get("size"),M=e.attributes.get("normal"),F=e.attributes.get("rotation"),T=e.attributes.get("centerOffset"),U=this.parameters.size;E(R.size>=3);const _=K(V),L="screen"===this.parameters.centerOffsetUnits;for(let P=0;P<R.data.length/R.size;P++){const e=P*R.size;if(h(le,R.data[e],R.data[e+1],R.data[e+2]),u(le,le,t),u(le,le,z.viewMatrix),T){const e=P*T.size;h(be,T.data[e],T.data[e+1],T.data[e+2])}else h(be,0,0,0);if(!L&&(le[0]+=be[0],le[1]+=be[1],0!==be[2])){const e=be[2];f(be,le),m(le,le,d(be,be,e))}const a=P*M.size;h(ce,M.data[a],M.data[a+1],M.data[a+2]),g(ce,ce,s(de,t));const{normal:n,cosAngle:l}=ae(ce,z,Se),c=Ae(this.parameters,le,l,z,oe);if(b(le,le,n,c),z.applyProjection(le,pe),pe[0]>-1){if(L&&(be[0]||be[1])&&(pe[0]+=be[0]*z.pixelRatio,0!==be[1]&&(pe[1]+=oe.alignmentEvaluator.apply(be[1])*z.pixelRatio),z.unapplyProjection(pe,le)),pe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,pe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,pe[0]=Math.floor(pe[0]),pe[1]=Math.floor(pe[1]),ye[0]=U[0],ye[1]=U[1],null!=w){const e=P*w.size;ye[0]*=w.data[e],ye[1]*=w.data[e+1]}oe.evaluator.applyVec2(ye,ye);const e=Oe*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*ye[0])*z.pixelRatio/2}ye[0]*=D,ye[1]*=A;const s=V.rotation+(null!=F?F.data[P*F.size]:0);if(ne(O,pe[0],pe[1],ye,e,t,s,V,_)){const e=r.ray;if(u(ue,le,i(ge,z.viewMatrix)),pe[0]=O[0],pe[1]=O[1],z.unprojectFromRenderScreen(pe,le)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,le)*s,t,-1,ue)}}}}}intersectDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=K(l),p=l.size,h=e.attributes.get("featureAttribute"),u=null==h?null:P(h.data,xe),{scaleX:f,scaleY:m}=je(u,l,e.screenToWorldRatio),d=ze*e.screenToWorldRatio;for(let g=0;g<a.data.length/a.size;g++){const t=g*a.size,h=a.data[t],u=a.data[t+1];if(ye[0]=p[0],ye[1]=p[1],null!=n){const e=g*n.size;ye[0]*=n.data[e],ye[1]*=n.data[e+1]}let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*ye[0])*e.screenToWorldRatio/2}ye[0]*=f,ye[1]*=m;const v=l.rotation+(null!=o?o.data[g*o.size]:0);ne(s,h,u,ye,d,b,v,l,c)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new Ce(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(he,r,s(de,i));const c=ae(he,o,Se),p=De(x(t),o),h=Ae(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,h+p),b(e,e,he,h+p);const u=n+h;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(f(ce,s),O(s,s,d(ce,ce,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=te||t>=te&&s[3]>=te;return this._visible&&r}createGLMaterial(e){return new re(e)}calculateRelativeScreenBounds(e,t,s=D()){return ie(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class re extends _{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function ie(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ae(e,t,s){return u(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Ve),s}function ne(e,s,r,i,a,l,c,p,h){let u=s-a-i[0]*h[0],f=u+i[0]+2*a,m=r-a-i[1]*h[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(u+=i[0]*g[0],m+=i[1]*g[1],f-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),u-=l,f+=l,m-=l,d+=l),n(me,s,r),o(fe,e,me,t(c)),fe[0]>u&&fe[0]<f&&fe[1]>m&&fe[1]<d}const oe=new B,le=y(),ce=y(),pe=j(),he=y(),ue=y(),fe=p(),me=p(),de=r(),ge=a(),be=y(),ve=y(),xe=j(),Se={normal:y(),cosAngle:0},Oe=1,ze=2,ye=c(0,0),Ve=V(0,0,1);class Pe extends U{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=l,this.polygonOffset=!1,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class Ce{constructor(e){this.baseInstanceLayout=Q,this.layout=Z(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i,a){const{position:n,normal:o,color:l,size:c,rotation:p,centerOffset:h,groundDistance:u,featureAttribute:f,uvi:m}=i;I(s.get("position"),e,n,a),W(s.get("normal"),t,o,a);const d=s.get("position").indices.length;if(m){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<d;++e){const n=a+e;m.setValues(n,t,s,r,i)}}}if(l&&H(s.get("color"),4,l,a),c&&N(s.get("size"),c,a),p&&G(s.get("rotation"),p,a),h&&(s.get("centerOffset")?q(s.get("centerOffset"),h,a):X(h,a,d)),s.get("groundDistance")?G(s.get("groundDistance"),u,a):X(u,a,d),f&&(s.get("featureAttribute")?Y(s.get("featureAttribute"),f,a):X(f,a,d)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=i.getField("olidColor",A);k(r,s,t,a)}}return{numVerticesPerItem:1,numItems:d}}writeBaseInstance(e,t){const{uv0:s}=t;N(e.get("uv0"),s,0)}}function je(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(R(ve,t,e),{scaleX:ve[0]*s,scaleY:ve[1]*s})}function De(e,t){const s=t.computeRenderPixelSizeAtDist(e)*T;return(t.aboveGround?1:-1)*s}function Ae(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=J(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{se as HUDMaterial,Pe as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../lib/GLMaterial.js";import{Material as i}from"../lib/Material.js";import{writePosition as
|
|
2
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import r from"../lib/GLMaterial.js";import{Material as i}from"../lib/Material.js";import{writePosition as a,writeBufferFloat as n}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as o,instanceLayout as u,HeatmapDensityPassParameters as c,HeatmapDensityTechnique as l,baseLayout as f}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const p=2;class h extends c{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class b extends i{constructor(t){super(t,h),this.visible=!0,this.produces=new Map([[19,t=>0===t]]),this._configuration=new m}updateConfiguration(t,e){super.updateConfiguration(t,e),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new d(t)}intersect(){}intersectDraped(s,r,i,a,n){const o=s.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=s,f=c*l+p*l,m=f*f,h=o.data.length/o.size;for(let p=0;p<h;p++){const s=p*o.size,r=t(v,o.data[s],o.data[s+1]);e(r,i)<m&&a(n.distance,n.normal,-1)}}createBufferWriter(){return new g(this.parameters.isAttributeDriven?o:u)}}class d extends r{beginSlot(t){return this.getTechnique(l,t)}}class g{constructor(t){this.layout=t,this.baseInstanceLayout=f}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,s,r,i,o){a(s.get("position"),t,i.position,o);const u="featureAttribute"in i?i.featureAttribute:null;return u&&n(s.get("featureAttribute"),u,o),null}writeBaseInstance(t,e){const s=e.uv0;s.setValues(0,-1,-1),s.setValues(1,-1,1),s.setValues(2,1,-1),s.setValues(3,1,1)}}const v=s();export{b as HeatmapDensityMaterial,h as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{
|
|
2
|
+
import{BufferViewFloat as e}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as t,isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{isUpdatableTexture as s}from"../lib/IManagedTexture.js";import{assert as a}from"../lib/Util.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{TriangleMaterialParameters as n,TriangleMaterial as p}from"./TriangleMaterial.js";import{writeBufferFloat as u,writeAttribute as h}from"./internal/bufferWriterUtils.js";import{getLayout as c,ImageMaterialTechnique as l}from"../shaders/ImageMaterialTechnique.js";import{ImageMaterialTechniqueConfiguration as m}from"../shaders/ImageMaterialTechniqueConfiguration.js";class f extends p{constructor(e){super(e,x),this.supportsEdges=!0,this.transparent=!0,this.visible=!0,this.produces=new Map([[2,e=>t(e)],[4,e=>r(e)&&this.parameters.writeDepth],[9,e=>r(e)&&!this.parameters.writeDepth],[19,e=>r(e)||t(e)]]),this._configuration=new m(e.draped)}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=t.hasOccludees,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.perspectiveInterpolation=this.parameters.perspectiveInterpolation}createGLMaterial(e){return new d(e)}createBufferWriter(){return new g(c(this.parameters))}}class d extends i{constructor(e){super({...e,...e.material.parameters}),this.parameters=e;const t=this._material.parameters.managedTexture;s(t)&&e.textures.updater.add(t)}dispose(){this.parameters.textures.updater.remove(this._material.parameters.managedTexture)}beginSlot(e){return this.getTechnique(l,e)}}class g extends o{write(t,r,i,s,o,n){for(const p of this.layout.fields.keys()){const s=i.get(p);if(s)if("perspectiveDivide"===p){a(1===s.size);const t=o.getField(p,e);t&&u(s,t,n)}else h(p,s,t,r,o,n)}return null}}class x extends n{constructor(e,t){super(),this.managedTexture=e,this.draped=t,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.opacity=1,this.perspectiveInterpolation=!1}get texture(){return this.managedTexture.texture}}export{f as ImageMaterial,x as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as
|
|
2
|
+
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectDraped=void 0,this.produces=new Map([[16,e=>r(e)],[17,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=17===t.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.terrainDepthTest=t.terrainDepthTest}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersect(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s,n){return o(r.get("position"),e,s.position,n),c(r.get("normal"),t,s.normal,n),l(r.get("centerOffset"),s.centerOffset,n),u(r.get("groundDistance"),s.groundDistance,n),null}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as
|
|
2
|
+
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as a}from"../../../../geometry/support/float16.js";import{isColor as s,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as l}from"./internal/bufferWriterUtils.js";import{getLayout as m,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>8===e||s(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[11,e=>h(e)&&8===this.parameters.renderOccluded],[12,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>s(e)&&this.parameters.writeDepth],[9,e=>s(e)&&!this.parameters.writeDepth],[19,e=>s(e)||8===e]]),this.intersectDraped=void 0,this._configuration=new d(t)}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.space=19===t.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=t.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.terrainDepthTest=t.terrainDepthTest&&s(e),this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersect(){}createBufferWriter(){return new S(m(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,s,o,h,n,c){const p=o.get("position").data,m=p.length/3;let u=[1,0,0];const d=o.get("normal");this._parameters.worldSpace&&null!=d&&(u=d.data);let f=1,g=0;this._parameters.vvSize?g=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(f=o.get("size").data[0]);let _=[1,1,1,1],v=0;this._parameters.vvColor?v=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(_=o.get("color").data);let S=0;this._parameters.vvOpacity&&(S=o.get("opacityFeatureAttribute").data[0]);const P=new Float32Array(n.buffer),T=a(n.buffer),O=new Uint8Array(n.buffer);let V=c*(this.layout.stride/4);const k=P.BYTES_PER_ELEMENT/T.BYTES_PER_ELEMENT,j=4/k,y=(e,t,r,i)=>{P[V++]=e[0],P[V++]=e[1],P[V++]=e[2],l(t,e,T,V*k),V+=j;let a=V*k;if(T[a++]=r[0],T[a++]=r[1],V=Math.ceil(a/k),this._parameters.vvColor)P[V++]=v;else{const e=Math.min(4*i,_.length-4),t=4*V++;O[t]=255*_[e],O[t+1]=255*_[e+1],O[t+2]=255*_[e+2],O[t+3]=255*_[e+3]}this._parameters.vvOpacity&&(P[V++]=S),a=V*k,this._parameters.vvSize?(P[V++]=g,a+=2):T[a++]=f,this._parameters.worldSpace&&(T[a++]=u[0],T[a++]=u[1],T[a++]=u[2]),V=Math.ceil(a/k)},M=(a,s)=>{const o=e(b,p[3*a],p[3*a+1],p[3*a+2]),h=w;let n=a+s;do{e(h,p[3*n],p[3*n+1],p[3*n+2]),n+=s}while(t(o,h)&&n>=0&&n<m);i&&(r(o,o,i),r(h,h,i)),y(o,h,[-1,-1],a),y(o,h,[1,-1],a),y(o,h,[1,1],a),y(o,h,[-1,-1],a),y(o,h,[1,1],a),y(o,h,[-1,1],a)},x=this._parameters.placement;return"begin"!==x&&"begin-end"!==x||M(0,1),"end"!==x&&"begin-end"!==x||M(m-1,-1),null}}const b=i(),w=i();export{g as LineMarkerMaterial,v as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as
|
|
2
|
+
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import c from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as u}from"../lib/Material.js";import{MeasurementArrowTechnique as h,layout as f}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends p{constructor(t){super(t,w),this._configuration=new m,this.intersectDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&l(t)],[9,t=>this._transparent&&l(t)]])}updateConfiguration(t,e){super.updateConfiguration(t,e),this._configuration.polygonOffsetEnabled=this.parameters.polygonOffset,this._configuration.transparent=this._transparent}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersect(){}createGLMaterial(t){return new C(t)}createBufferWriter(){return new O}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends c{beginSlot(t){return this.getTechnique(h,t)}}class w extends u{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1,this.polygonOffset=!1}}const b=n(),j=n(),v=n(),M=n(),x=n();class O{constructor(){this.layout=f}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,l,c,p,u){const{data:h,indices:f}=l.get("position"),m=l.get("normal").data,d=h.length/3;f&&f.length!==2*(d-1)&&console.warn("MeasurementArrowMaterial does not support indices");const g=b,C=j,w=v,O=M,_=x,y=p.position,A=p.normal,E=p.uv0;let L=0;for(let b=0;b<d;++b){const l=3*b;if(t(g,h[l],h[l+1],h[l+2]),b<d-1){const o=3*(b+1);t(C,h[o],h[o+1],h[o+2]),t(_,m[o],m[o+1],m[o+2]),e(_,_),r(w,C,g),e(w,w),s(O,_,w),e(O,O)}const c=o(g,C);n&&a&&(i(g,g,n),i(C,C,n),i(O,O,a));const p=u+2*b,f=p+1;y.setVec(p,g),y.setVec(f,g),A.setVec(p,O),A.setVec(f,O),E.set(p,0,L),E.set(p,1,-1),E.set(f,0,L),E.set(f,1,1),b<d-1&&(L+=c)}const V=p.length;for(let t=0;t<2*d;++t)V.set(u+t,L);return null}}export{g as MeasurementArrowMaterial,w as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as x,getNormal as y,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as v}from"../core/shaderLibrary/ShaderOutput.js";import S from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as x,getNormal as y,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as v}from"../core/shaderLibrary/ShaderOutput.js";import S from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as w}from"../lib/Material.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{DefaultBufferWriter as T}from"./DefaultBufferWriter.js";import{PositionColorLayout as _,PositionLayout as A}from"./DefaultLayouts.js";import{NativeLineTechnique as V}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as N}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,P),this._configuration=new N,this.produces=new Map([[2,e=>v(e)]])}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=t.hasOccludees}get visible(){return this.parameters.color[3]>=R}intersect(t,r,f,p,j,L){const{options:v,camera:S,rayBegin:M,rayEnd:w}=f;if(!v.selectionMode||!t.visible||!S)return;if(!C(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const T=t.attributes.get("position").data,_=H;o(_,f.point);const A=2;i(I[0],_[0]-A,_[1]+A,0),i(I[1],_[0]+A,_[1]+A,0),i(I[2],_[0]+A,_[1]-A,0),i(I[3],_[0]-A,_[1]-A,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(I[e],J[e]))return;b(S.eye,J[0],J[1],K),b(S.eye,J[1],J[2],Q),b(S.eye,J[2],J[3],Y),b(S.eye,J[3],J[0],Z);let V=Number.MAX_VALUE,N=0;for(let e=0;e<T.length-5;e+=3){if(q[0]=T[e]+r[12],q[1]=T[e+1]+r[13],q[2]=T[e+2]+r[14],B[0]=T[e+3]+r[12],B[1]=T[e+4]+r[13],B[2]=T[e+5]+r[14],x(K,q)<0&&x(K,B)<0||x(Q,q)<0&&x(Q,B)<0||x(Y,q)<0&&x(Y,B)<0||x(Z,q)<0&&x(Z,B)<0)continue;const t=S.projectToRenderScreen(q,W),o=S.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=S.frustum,r=-x(e[4],q)/n(D,y(e[4]));if(a(D,D,r),c(q,q,D),!S.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=S.frustum,t=-x(e[4],B)/n(D,y(e[4]));if(a(D,D,t),c(B,B,D),!S.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,F),_);i<V&&(V=i,l(G,q),l(z,B),N=e/3)}if(V<A*A){let e=Number.MAX_VALUE;if(d(g(G,z,F),g(M,w,k),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,w)}L(e,O,N)}}intersectDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new E(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?_:A;return new T(e)}}class E extends S{beginSlot(e){return this.getTechnique(V,e)}}class P extends w{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),z=f(),F=j(),k=j(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=L(),Q=L(),Y=L(),Z=L();export{U as NativeLineMaterial,P as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import{clamp as
|
|
2
|
+
import{clamp as e}from"../../../../core/mathUtils.js";import{clone as t}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{isShadowLike as s,is3DGeometryOutputMRT as a,isColor as o}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as h}from"../lib/Material.js";import{isPathGeometry as p}from"../lib/PathGeometry.js";import{MeshIntersectionOptions as c,intersectAabbInvDir as u}from"../lib/RayIntersections.js";import{DefaultBufferWriter as m}from"./DefaultBufferWriter.js";import{getLayout as l,PathPassParameters as d,PathTechnique as f}from"./PathTechnique.js";import{PathTechniqueConfiguration as b}from"./PathTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class _ extends h{constructor(e,t){super(e,w),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>(this.parameters.castShadows&&s(e)||a(e))&&!this.transparent],[4,e=>(this.parameters.castShadows&&s(e)||a(e))&&this.transparent]]),this._configuration=new b(t.spherical)}get hasEmissions(){return this.parameters.emissiveStrength>0}updateConfiguration(e,t){super.updateConfiguration(e,t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,o(e)?(this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?1:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?2:0,this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration.snowCover=t.snowCover>0}isVisibleForOutput(e){return 3!==e&&5!==e&&4!==e||this.parameters.castShadows}get visible(){return this.parameters.opacity>=g}intersect(e,t,i,r,s,a){this._intersect(e,i,r,s,a)}intersectDraped(e,t,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(e,t,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const h=i;if(!p(h))return;const m=h.path,l=t(this.parameters.size);if(this.parameters.vvSize){const{offset:t,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=m.sizeAttributeValue;Number.isNaN(o)?(l[0]*=a[0],l[1]*=a[2]):(l[0]*=e(t[0]+o*i[0],r[0],s[0]),l[1]*=e(t[2]+o*i[2],r[2],s[2]))}const d=new c(s.tolerance,!1,s.options.normalRequired),f=Math.max(l[0],l[1]),b=i.boundingInfo;if(null==b)return void v(m,l,a,o,d,n);const g=r(b.bbMin[0]-f,b.bbMin[1]-f,b.bbMin[2]-f,b.bbMax[0]+f,b.bbMax[1]+f,b.bbMax[2]+f),_=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],S=Math.sqrt(_[0]*_[0]+_[1]*_[1]+_[2]*_[2]),w=[S/_[0],S/_[1],S/_[2]];u(g,a,w,s.tolerance)&&v(m,l,a,o,d,n)}createBufferWriter(){return new m(l(this.parameters))}createGLMaterial(e){return new S(e)}get transparent(){const{parameters:e}=this;return e.drivenOpacity||e.opacity<1}}class S extends n{beginSlot(e){return this.getTechnique(f,e)}}function v(e,t,i,r,s,a){e.baked.size&&e.baked.size[0]===t[0]&&e.baked.size[1]===t[1]||e.baked.bake(t),e.baked.intersect(i,r,s,a)}class w extends d{constructor(){super(...arguments),this.doubleSided=!1,this.doubleSidedType="normal",this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1}}export{w as Parameters,_ as PathMaterial};
|