@arcgis/core 4.33.0-next.20250310 → 4.33.0-next.20250312

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.
Files changed (88) hide show
  1. package/assets/esri/core/workers/RemoteClient.js +1 -1
  2. package/assets/esri/core/workers/chunks/{f0351930cbb3d8643119.js → 0a98dc3ea67ce97a6e7b.js} +1 -1
  3. package/assets/esri/core/workers/chunks/{eacab4bd6eb58e545f73.js → 11f9d7cd95891596b716.js} +1 -1
  4. package/assets/esri/core/workers/chunks/{400951e3e742452a5fe2.js → 3ee2cf2db08164cde43c.js} +45 -45
  5. package/assets/esri/core/workers/chunks/4d95cc85f4b73e857b1f.js +1 -0
  6. package/assets/esri/core/workers/chunks/54ace3e4802934f3f9f2.js +1 -0
  7. package/assets/esri/core/workers/chunks/5820808c7659460969d4.js +1 -0
  8. package/assets/esri/core/workers/chunks/{42b862550c96cc1be956.js → 81bf362ec0d23ffdc90c.js} +2 -2
  9. package/assets/esri/core/workers/chunks/add0770399a63b7635b5.js +1 -0
  10. package/assets/esri/core/workers/chunks/b2f8702a9f54fff23ad9.js +1 -0
  11. package/assets/esri/core/workers/chunks/b8b8425e8b1246cdc86d.js +1 -0
  12. package/assets/esri/core/workers/chunks/d0ad20548eb4786b7750.js +314 -0
  13. package/assets/esri/core/workers/chunks/d0fbd4c6bffe0cb98d14.js +1 -0
  14. package/assets/esri/core/workers/chunks/dd6f18bbab50be139d20.js +1 -0
  15. package/assets/esri/core/workers/chunks/de6864e120243cf0bee8.js +1 -0
  16. package/assets/esri/core/workers/chunks/fc7ce48c7b31a4665a9b.js +1 -0
  17. package/chunks/DefaultMaterial.glsl.js +21 -21
  18. package/chunks/Pattern.glsl.js +23 -25
  19. package/chunks/RealisticTree.glsl.js +12 -12
  20. package/chunks/Terrain.glsl.js +27 -27
  21. package/core/LRUCache.js +1 -1
  22. package/core/MemCache.js +1 -1
  23. package/editing/sharedTemplates/SharedTemplateProvider.js +1 -1
  24. package/geometry/support/ShortArray.js +5 -0
  25. package/interfaces.d.ts +18 -4
  26. package/layers/video/VideoController.js +1 -1
  27. package/package.json +1 -1
  28. package/support/revision.js +1 -1
  29. package/views/2d/layers/graphics/GraphicsView2D.js +1 -1
  30. package/views/3d/analysis/Viewshed/ViewshedComputedData.js +1 -1
  31. package/views/3d/analysis/ViewshedAnalysisView3D.js +1 -1
  32. package/views/3d/environment/Precipitation.js +1 -1
  33. package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
  34. package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
  35. package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
  36. package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
  37. package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
  38. package/views/3d/layers/graphics/LabelInfo.js +1 -1
  39. package/views/3d/layers/graphics/defaultSymbolComplexity.js +1 -1
  40. package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
  41. package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
  42. package/views/3d/layers/graphics/wosrLoader.js +1 -1
  43. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PathVertexPosition.glsl.js +63 -77
  44. package/views/3d/webgl-engine/core/shaderLibrary/attributes/VertexPosition.glsl.js +6 -6
  45. package/views/3d/webgl-engine/effects/focusArea/FocusAreaMaskNode.js +1 -1
  46. package/views/3d/webgl-engine/lib/Normals.js +1 -1
  47. package/views/3d/webgl-engine/lib/Object3D.js +1 -1
  48. package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
  49. package/views/3d/webgl-engine/lib/PathGeometryData.js +1 -1
  50. package/views/3d/webgl-engine/lib/VertexAttribute.js +1 -1
  51. package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
  52. package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
  53. package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
  54. package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
  55. package/views/3d/webgl-engine/materials/PathTechnique.js +1 -1
  56. package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
  57. package/views/3d/webgl-engine/materials/internal/bufferWriterUtils.js +1 -1
  58. package/views/3d/webgl-engine/materials/renderers/PerBufferData.js +1 -1
  59. package/views/3d/webgl-engine/parts/Model.js +1 -1
  60. package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
  61. package/views/3d/webgl-engine/shaders/DefaultMaterialTechnique.js +1 -1
  62. package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
  63. package/views/3d/webgl-engine/shaders/Terrain.glsl.js +1 -1
  64. package/views/FocusAreas.js +1 -1
  65. package/views/animation/easing.js +1 -1
  66. package/views/support/projectionUtils.js +1 -1
  67. package/views/webgl/VertexArrayObject.js +1 -1
  68. package/widgets/Editor/CreateFeaturesWorkflow.js +1 -1
  69. package/widgets/Editor/EditorViewModel.js +1 -1
  70. package/widgets/Editor/workflowUtils.js +1 -1
  71. package/widgets/FeatureTable/FeatureTableViewModel.js +1 -1
  72. package/widgets/FloorFilter/FloorFilterViewModel.js +1 -1
  73. package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
  74. package/widgets/OrientedImageryViewer.js +1 -1
  75. package/widgets/support/GoTo.js +1 -1
  76. package/widgets/support/goToUtils.js +1 -1
  77. package/assets/esri/core/workers/chunks/40f2c8022fd583c43f42.js +0 -1
  78. package/assets/esri/core/workers/chunks/5295e685ae839087c568.js +0 -1
  79. package/assets/esri/core/workers/chunks/54b115ecf446b4095d3e.js +0 -1
  80. package/assets/esri/core/workers/chunks/5a536de1ecae424bad05.js +0 -1
  81. package/assets/esri/core/workers/chunks/6ce738960ee47904968f.js +0 -314
  82. package/assets/esri/core/workers/chunks/840c02610d845114ace7.js +0 -1
  83. package/assets/esri/core/workers/chunks/97078a7871e243c19b6b.js +0 -1
  84. package/assets/esri/core/workers/chunks/9dfdd8e91897d166d888.js +0 -1
  85. package/assets/esri/core/workers/chunks/a4228101f709f0bb9a3d.js +0 -1
  86. package/assets/esri/core/workers/chunks/aba4353892c47de98eb3.js +0 -1
  87. package/assets/esri/core/workers/chunks/c2939e0c45a6d074cac0.js +0 -1
  88. package/views/3d/webgl-engine/core/shaderLibrary/attributes/PositionAttribute.glsl.js +0 -5
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as c,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as x,doubleArrayFrom as w}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as L}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as R}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as M}from"../../webgl-engine/lib/Path.js";import{PathBuilder as F}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as T,MiterExtruder as W}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends A{get usedMemory(){return this._usedMemory+super.usedMemory}constructor(e,t,r,i){super(e,t,r,i,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this._usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,r=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,r]});const i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new W(0,D);break;case"bevel":this._extruder=new W(0,1);break;case"miter":this._extruder=new W(.8*Math.PI,1);break;default:this._extruder=new T}const h=this.symbolLayer.cap||"butt";switch(h){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:L}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:L});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?c(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_=y[3],v=_<1||this.needsDrivenTransparentPass,x={diffuse:g,ambient:g,emissiveFactor:u,opacity:_,transparent:v,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,cullFace:v||"none"===h?G.None:G.Back,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");if(this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates){const e={...x,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)};this._materials[0]=new se(e,this._context)}else x.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,x.normalType=I.Compressed,this._materials[0]=new ie(x,this._context);this._materials[0].setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),this._context.stage.add(this._materials[0])}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t),i=e.renderingInfo;return this._createAs3DShape(t,i,r,t.uid)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e),r=t<1||this.needsDrivenTransparentPass;this._materials[0]?.setParameters({opacity:t,transparent:r})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return R.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return R.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return R.FastUpdate}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const c of r)t+=c.length;const n=x(3*t);let l,h=0;for(const c of r){i.push({offset:h,numVertices:c.length});for(const t of c)n[h++]=t[0],n[h++]=t[1],n[h++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=w(n):(l=x(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t,a,o){this._usedMemory=0;const n=e.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const c=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES);for(const g of l.pathVertexDataInfos){const n=g.numVertices;if(n<2)continue;const b=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,b,n,f),!v(f,this._context.clippingExtent)))continue;const y=new Array,x=b+3*n;for(let e=b;e<x;e+=3){u.offset=e;const t=j(u,this._context.elevationProvider,a,d);m(pe,l.vertexDataRS[e],l.vertexDataRS[e+1],l.vertexDataRS[e+2]),d.setAltitude(pe,t),l.vertexDataRS[e]=pe[0],l.vertexDataRS[e+1]=pe[1],l.vertexDataRS[e+2]=pe[2],y.push(te(this._upVectorAlignment))}const w=new M(y,l.vertexDataES,l.vertexDataRS,b);ne(w,this._upVectorAlignment,this._context.renderCoordsHelper);const P=new F(w,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const t=this._fastUpdates.visualVariables,r=z(t.size?.field,e)??0,i=z(t.color?.field,e)??0,s=z(t.opacity?.field,e)??0;S=new Q(P,r,i,s)}else{const e=h(this._intrinsicSize);if(this._drivenProperties.size){const r=t.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(r[0],"symbol-value"===r[2]?this.symbolLayer.height||0:r[2],this.symbolLayer.width||0),e[1]*=le(r[2],"symbol-value"===r[0]?this.symbolLayer.width||0:r[0],this.symbolLayer.height||0)}let r;if(this._drivenProperties.color&&(r=t.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=t.opacity??this._getFallbackOpacityAndColor()[3];r=r?[r[0],r[1],r[2],e]:[1,1,1,e]}const i=new X(P);i.bake(e),r&&i.bakeVertexColors(r),S=i}const C=S.createGeometryData(),D=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:o,layerUid:this._context.layer.uid}),L=new J(this._materials[0],C,S,p,this._stencilWidth,D);L.transformation=r(s(),i,P.path.origin),c.push(L),this._usedMemory+=P.usedMemory}if(0===c.length)return null;const b=new B({geometries:c,layerUid:this._context.layer.uid,graphicUid:o}),y=new C(this,b,c,null,null,((e,t,r,i,s)=>ce(e,t,i,s,this._upVectorAlignment)),a);return y.alignedSampledElevation=0,y.needsElevationUpdates=P(a.mode),y}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+i[0],pe[1]=s[a++]+i[1],pe[2]=s[a++]+i[2],r.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+i[0],pe[1]=s[a+1]+i[1],pe[2]=s[a+2]+i[2],r.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function he(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,h=e.offset+3*o.length;for(let c=e.offset;c<h;c+=3)m(pe,l[c],l[c+1],l[c+2]),r(pe,fe),s+=fe.sampledElevation,pe[0]=n[c]+a[0],pe[1]=n[c+1]+a[1],pe[2]=n[c+2]+a[2],i.setAltitude(pe,fe.z),n[c]=pe[0]-a[0],n[c+1]=pe[1]-a[1],n[c+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function ce(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=he(o,t,r,i),s!==Z.World&&ne(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,re.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
5
+ import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Error.js";import{translate as r}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as i,create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as a,scale as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as n,fromArray as l,clone as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{F as h,i as m}from"../../../../chunks/vec32.js";import{clone as p,ZEROS as f,fromArray as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as b}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{projectBuffer as y}from"../../../../geometry/projection/projectBuffer.js";import{create as g,fromSubBuffer as _,intersectsClippingArea as v}from"../../../../geometry/support/aaBoundingBox.js";import{newDoubleArray as x,doubleArrayFrom as w}from"../../../../geometry/support/DoubleArray.js";import{needsElevationUpdates3D as P,evaluateElevationAlignmentAtPoint as j,SampleElevationInfo as S}from"./elevationAlignmentUtils.js";import{Graphics3DObject3DGraphicLayer as C}from"./Graphics3DObject3DGraphicLayer.js";import{pathNumRoundJoinSubdivisions as D,pathNumRoundCapExtrusionSubdivisions as L}from"./Graphics3DPathSymbolLayerConstants.js";import{Graphics3DSymbolLayer as A}from"./Graphics3DSymbolLayer.js";import{isValidSize as V}from"./graphicUtils.js";import{ApplyRendererDiffResult as R}from"./interfaces.js";import{ConvertOptions as U,initFastSymbolUpdatesState as k,updateFastSymbolUpdatesState as E,getAttributeValue as z}from"../support/FastSymbolUpdates.js";import{SamplePosition as O}from"../../support/ElevationProvider.js";import{NormalType as I}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Object3D as B}from"../../webgl-engine/lib/Object3D.js";import{Path as F}from"../../webgl-engine/lib/Path.js";import{PathBuilder as M}from"../../webgl-engine/lib/PathBuilder.js";import{RoundCapBuilder as q,TriangulationCapBuilder as H,NoCapBuilder as N}from"../../webgl-engine/lib/PathCapBuilder.js";import{SimpleExtruder as W,MiterExtruder as T}from"../../webgl-engine/lib/PathExtruder.js";import{UpVectorAlignment as Z,PathGeometry as J,isPathGeometry as K}from"../../webgl-engine/lib/PathGeometry.js";import{FastUpdatePathGeometry as Q,StaticPathGeometry as X}from"../../webgl-engine/lib/PathGeometryData.js";import{computeMinimumRotationTangentFrame as Y}from"../../webgl-engine/lib/pathGeometryUtils.js";import{quadProfiles as $,circleProfiles as ee}from"../../webgl-engine/lib/PathProfile.js";import{newPathVertex as te}from"../../webgl-engine/lib/PathVertex.js";import{VertexAttribute as re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ie}from"../../webgl-engine/materials/DefaultMaterial.js";import{PathMaterial as se}from"../../webgl-engine/materials/PathMaterial.js";const ae=["polyline"];class oe extends A{get usedMemory(){return this._usedMemory+super.usedMemory}constructor(e,t,r,i){super(e,t,r,i,me(t)),this._intrinsicSize=n(1,1),this._upVectorAlignment=Z.Path,this._stencilWidth=.1,this._usedMemory=0,this.ensureDrapedStatus(!1)}async doLoad(){const e=null!=this.symbolLayer.width?this.symbolLayer.width:this.symbolLayer.height,r=null!=this.symbolLayer.height?this.symbolLayer.height:e;this._vvConvertOptions=new U({supports:{size:!0,color:!0,rotation:!1,opacity:!0},modelSize:[1,1,1],symbolSize:[e,1,r],unitInMeters:this._context.renderCoordsHelper.unitInMeters,fallbackColor:this._getFallbackOpacityAndColor(),fallbackSize:[e,1,r]});const i=this._context.renderer?.visualVariables;this._fastUpdates=i?.length?k(this._context.renderer,this._vvConvertOptions):null;const s=this.symbolLayer.anchor||"center";this._upVectorAlignment="heading"===this.symbolLayer.profileRotation?Z.World:Z.Path;const n=this.symbolLayer.profile||"circle";switch(n){default:case"circle":this._profile=ee[s];break;case"quad":this._profile=$[s]}switch(this.symbolLayer.join){case"round":this._extruder=new T(0,D);break;case"bevel":this._extruder=new T(0,1);break;case"miter":this._extruder=new T(.8*Math.PI,1);break;default:this._extruder=new W}const c=this.symbolLayer.cap||"butt";switch(c){case"none":this._startCap=new N,this._endCap=new N;break;case"butt":default:this._startCap=new H(this._profile,0),this._endCap=new H(this._profile,0,!0);break;case"square":this._startCap=new H(this._profile,-.5),this._endCap=new H(this._profile,.5,!0);break;case"round":{const e="quad"===n;this._startCap=new q({profile:this._profile,flip:!1,breakNormals:e,subdivisions:L}),this._endCap=new q({profile:this._profile,flip:!0,breakNormals:e,subdivisions:L});break}}const m=this.symbolLayer?.material?.emissiveFactor,u=m?h(p(m)):f,b=this.symbolLayer?.material?.color,y=this._getCombinedOpacityAndColor(b),g=d(y),_={diffuse:g,ambient:g,emissiveFactor:u,opacity:y[3],drivenOpacity:this.needsDrivenTransparentPass,hasVertexColors:!1,hasSlicePlane:this._context.slicePlaneEnabled,castShadows:this.symbolLayer.castShadows,offsetTransparentBackfaces:!0};if(!this._drivenProperties.size&&(a(this._intrinsicSize,e,r),!V(this._intrinsicSize[0])||!V(this._intrinsicSize[1])))throw new t("graphics3dpathsymbollayer:invalid-size","Symbol sizes may not be negative values");let v;this._fastUpdates?.visualVariables.size||o(this._intrinsicSize,this._intrinsicSize,1/this._context.renderCoordsHelper.unitInMeters),this._fastUpdates?v=new se({..._,...this._fastUpdates.materialParameters,size:l(this._intrinsicSize)},this._context):(_.hasVertexColors=this._drivenProperties.color||this._drivenProperties.opacity,_.normalType=I.Compressed,v=new ie(_,this._context)),v.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0,cullFace:v.transparent||"none"===c?G.None:G.Back}),this._materials[0]=v,this._context.stage.add(v)}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,ae,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this._createAs3DShape(e,r)}layerOpacityChanged(){const e=this.symbolLayer?.material?.color,t=this._getCombinedOpacity(e);this._materials[0]?.setParameters({opacity:t})}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,P)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return this._materials[0]?.setParameters({usePBR:this._context.physicalBasedRenderingEnabled,isSchematic:!0}),!0}applyRendererDiff(e,t){for(const r in e.diff){if("visualVariables"!==r)return R.RecreateSymbol;if(!E(this._fastUpdates,t,this._vvConvertOptions))return R.RecreateSymbol;this._materials[0]?.setParameters(this._fastUpdates.materialParameters)}return R.FastUpdate}_getVertexData(e){let t=0;const r=e.paths,i=[],s=e.spatialReference,a=this._context.elevationProvider.spatialReference,o=this._context.renderCoordsHelper.spatialReference;for(const h of r)t+=h.length;const n=x(3*t);let l,c=0;for(const h of r){i.push({offset:c,numVertices:h.length});for(const t of h)n[c++]=t[0],n[c++]=t[1],n[c++]=e.hasZ?t[2]:0}return null==a||s.equals(a)||y(n,s,0,n,a,0,t)?(null==a||a.equals(o)?l=w(n):(l=x(3*t),y(n,a,0,l,o,0,t)),{pathVertexDataInfos:i,vertexDataES:n,vertexDataRS:l}):null}_createAs3DShape(e,t){const{graphic:a,renderingInfo:o}=e,n=a.geometry,l=this._getVertexData(n);if(null==l)return this.logger.warn("PathSymbol3DLayer geometry failed to be created (failed to project geometry to view spatial reference)"),null;if(0===l.pathVertexDataInfos.length)return 0!==n.paths.length&&n.paths.some((e=>e.length>0))||this.logger.warn("PathSymbol3DLayer geometry failed to be created (no paths were defined)"),null;const h=new Array,p=n.spatialReference,f=g(),d=this._context.renderCoordsHelper,u=new O(l.vertexDataES),b=a.uid;for(const g of l.pathVertexDataInfos){const e=g.numVertices;if(e<2)continue;const n=g.offset;if(null!=this._context.clippingExtent&&(_(l.vertexDataES,n,e,f),!v(f,this._context.clippingExtent)))continue;const y=new Array,x=n+3*e;for(let r=n;r<x;r+=3){u.offset=r;const e=j(u,this._context.elevationProvider,t,d);m(pe,l.vertexDataRS[r],l.vertexDataRS[r+1],l.vertexDataRS[r+2]),d.setAltitude(pe,e),l.vertexDataRS[r]=pe[0],l.vertexDataRS[r+1]=pe[1],l.vertexDataRS[r+2]=pe[2],y.push(te(this._upVectorAlignment))}const w=new F(y,l.vertexDataES,l.vertexDataRS,n);ne(w,this._upVectorAlignment,this._context.renderCoordsHelper);const P=new M(w,this._profile,this._extruder,this._startCap,this._endCap);let S=null;if(this._fastUpdates){const e=this._fastUpdates.visualVariables,t=z(e.size?.field,a)??0,r=z(e.color?.field,a)??0,i=z(e.opacity?.field,a)??0;S=new Q(P,t,r,i)}else{const e=c(this._intrinsicSize);if(this._drivenProperties.size){const t=o.size??["symbol-value","symbol-value","symbol-value"];e[0]*=le(t[0],"symbol-value"===t[2]?this.symbolLayer.height||0:t[2],this.symbolLayer.width||0),e[1]*=le(t[2],"symbol-value"===t[0]?this.symbolLayer.width||0:t[0],this.symbolLayer.height||0)}let t;if(this._drivenProperties.color&&(t=o.color??this._getFallbackOpacityAndColor()),this._drivenProperties.opacity){const e=o.opacity??this._getFallbackOpacityAndColor()[3];t=t?[t[0],t[1],t[2],e]:[1,1,1,e]}const r=new X(P);r.bake(e),t&&r.bakeVertexColors(t),S=r}const C=S.createGeometryData(),D=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:b,layerUid:this._context.layer.uid}),L=new J(this._materials[0],C,S,p,this._stencilWidth,D);L.transformation=r(s(),i,P.path.origin),h.push(L),this._usedMemory+=P.usedMemory}if(0===h.length)return null;const y=new B({geometries:h,layerUid:this._context.layer.uid,graphicUid:b}),x=new C(this,y,h,null,null,((e,t,r,i,s)=>he(e,t,i,s,this._upVectorAlignment)),t);return x.alignedSampledElevation=0,x.needsElevationUpdates=P(t.mode),x}_getFallbackOpacityAndColor(){const t=this.symbolLayer?.material?.color;return e.toUnitRGBA(t)??b}}function ne(e,t,r){const{origin:i,positions:s}=e;let a=e.offset;switch(t){default:case Z.World:for(const t of e.vertices)pe[0]=s[a++]+i[0],pe[1]=s[a++]+i[1],pe[2]=s[a++]+i[2],r.worldUpAtPosition(pe,pe),t.setFrameFromUpVector(pe);break;case Z.Path:pe[0]=s[a]+i[0],pe[1]=s[a+1]+i[1],pe[2]=s[a+2]+i[2],r.worldUpAtPosition(pe,pe),Y(e,pe)}}function le(e,t,r){switch(e){case"symbol-value":return r;case"proportional":return t;default:return e}}function ce(e,t,r,i){let s=0;const{origin:a,vertices:o,positions:n,positionsES:l}=e,c=e.offset+3*o.length;for(let h=e.offset;h<c;h+=3)m(pe,l[h],l[h+1],l[h+2]),r(pe,fe),s+=fe.sampledElevation,pe[0]=n[h]+a[0],pe[1]=n[h+1]+a[1],pe[2]=n[h+2]+a[2],i.setAltitude(pe,fe.z),n[h]=pe[0]-a[0],n[h+1]=pe[1]-a[1],n[h+2]=pe[2]-a[2];return e.updatePathVertexInformation(),s/o.length}function he(e,t,r,i,s){const a=e.stageObject,o=a.geometries;let n=0;for(const l of o){if(!K(l))continue;const e=l.path,o=e.builder.path;n+=ce(o,t,r,i),s!==Z.World&&ne(o,s,i),e.onPathChanged(l),l.invalidateBoundingInfo(),a.geometryVertexAttributeUpdated(l,re.POSITION)}return n/o.length}function me(e){return 1===(e.material?.color?.a??1)}const pe=u(),fe=new S;export{oe as Graphics3DPathSymbolLayer};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{i as t,l as n}from"../../../../chunks/vec32.js";import{ZEROS as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,center as c,height as s}from"../../../../geometry/support/aaBoundingBox.js";import{labelMarginPx as i}from"./constants.js";import{getGraphics3DSymbol as o}from"./graphicSymbolUtils.js";import{LabelPlacement as f}from"./LabelParameters.js";import{textVerticalPaddingPx as m}from"../../webgl-engine/lib/TextRenderer.js";import{HUDMaterial as h}from"../../webgl-engine/materials/HUDMaterial.js";const p=()=>e.getLogger("esri.views.3d.layers.graphics.labelPlacement");class u{constructor(e,t,n,r=null){this._graphic=e,this._symbol=t,this._class=n,this._disablePlacement=r}get placement(){const e=this._verticalOffsetPlacement;if(null==e)return null;const t=this._getPlacementInfo(e);if(null==t)return null;const n=t.anchor,r=!!e.hasLabelVerticalOffset,l=e.verticalOffset,a=new f(l,n,r);return this._calculatePlacementOffsets(a,t)}get _verticalOffsetPlacement(){const e=this._class.labelPlacement,{_symbol:t,_graphic:n}=this,r=o(n.graphics3DSymbol),l="point-3d"===r?.symbol.type?r.symbol:null,a=P[e]||this._defaultPlacementInfo;return l?.supportsCallout()&&l.hasVisibleVerticalOffset()&&!n.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:l.verticalOffset.clone(),anchor:null,normalizedOffset:null}:!t?.hasVisibleVerticalOffset()||null!=l&&l.supportsCallout()&&l.verticalOffset&&!n.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:a&&O(a.placement)?{placement:"above-center",verticalOffset:t.verticalOffset.clone(),anchor:"bottom",normalizedOffset:[0,a.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(p().errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+e+" placement)"),null)}_getPlacementInfo(e){if(e.anchor)return e;const t=this._class.labelPlacement,n=P[t],r=n||this._defaultPlacementInfo;return t&&!n&&p().warnOncePerTick(`the requested label placement '${t}' is currently unsupported in SceneView.`),this._validatePlacementInfo(r)}_calculatePlacementOffsets(e,t){const n=this._graphic.graphic.geometry;if(null==n)return null;switch(n.type){case"point":this._setPointSpecificPlacement(e,t);break;case"mesh":this._setMeshSpecificPlacement(e,t);break;case"polygon":this._setPolygonSpecificPlacement(e,t)}const r=i-m;return e.screenOffset[0]+=r*t.normalizedOffset[0],e.screenOffset[1]+=r*t.normalizedOffset[1],e}get _defaultPlacementInfo(){const e=this._graphic.graphic.geometry;if(null==e)return null;switch(e.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:r,anchor:"center"};case"polygon":{const e=this._firstSymbolLayer;return"extrude"===e?.type?P["above-center"]:{placement:"center-center",normalizedOffset:r,anchor:"center"}}case"point":case"mesh":return P["above-center"];default:return}}_validatePlacementInfo(e){const t=this._graphic.graphic.geometry;if(null==t)return null;if(null!=this._disablePlacement){return this._class.labelPlacement?(p().warnOncePerTick(b(e?.placement,this._disablePlacement.logEntityDescription)),this._defaultPlacementInfo):e}const n=t.type;switch(n){case"polyline":case"polygon":case"extent":case"multipoint":if(this._class.labelPlacement)return p().warnOncePerTick(b(e?.placement,`'${n}' geometries`)),this._defaultPlacementInfo;break;case"point":case"mesh":return e}return e}_setPointSpecificPlacement(e,n){const r=this._firstSymbolLayer;if(null==r)return;const l=this._graphic.layers[0];switch(null!=l?l.getCenterObjectSpace(e.translation):t(e.translation,0,0,0),r.type){case"icon":case"text":this._setHUDSpecificPlacement(e,n,l);break;case"object":g(e,n,l)}}_setMeshSpecificPlacement(e,t){const n=this._firstSymbolLayer;if(null!=n&&"fill"===n.type){g(e,t,this._graphic.layers[0])}}_setPolygonSpecificPlacement(e,n){const r=this._firstSymbolLayer;if(null!=r)switch(r.type){case"extrude":{const r=this._graphic.layers[0];null!=r?(r.getBoundingBoxObjectSpace(_),c(_,e.translation),e.translation[2]=s(_)/2):t(e.translation,0,0,0),g(e,n,r);break}}}_setHUDSpecificPlacement(e,t,n){const{_graphic:r}=this,l=null!=n?n.getScreenSize():null;if(r.isDraped||null==l)e.hasLabelVerticalOffset||"center"===e.anchor||(P[this._class.labelPlacement]&&p().warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor="center");else{const n=this._normalizedSymbolAnchorPos;e.screenOffset[0]=l[0]/2*(t.normalizedOffset[0]-n[0]);const r=l[1]/2*(t.normalizedOffset[1]-n[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=r,e.centerOffsetUnits="screen"):e.screenOffset[1]=r}}get _firstSymbolLayer(){const e=this._graphic.graphics3DSymbol,t=o(e);return null!=t?t.symbol.symbolLayers.at(0):null}get _normalizedSymbolAnchorPos(){const e=this._graphic.layers[0],t=e?.stageObject.geometries[0].material??null;if(t&&t instanceof h){const e=t.parameters.anchorPosition;y[0]=2*(e[0]-.5),y[1]=2*(e[1]-.5)}else y[0]=0,y[1]=0;return y}}function b(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function g(e,t,r){const a=null!=r?r.getBoundingBoxObjectSpace(_):_,c=l(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(c[0]*c[0]+c[1]*c[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];const i=e.translation[2],o=c[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=i+o;const f=n(c);e.centerOffset[2]=f/2*t.normalizedOffset[2]}function O(e){return"above-center"===e}const P={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},d={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const v in d){const e=d[v],t=P[v];e.forEach((e=>{P[e]=t}))}Object.freeze&&(Object.freeze(P),Object.keys(P).forEach((e=>{Object.freeze(P[e]),Object.freeze(P[e]?.normalizedOffset)})));const y=[0,0],_=a();export{u as LabelInfo};
5
+ import"../../../../core/has.js";import e from"../../../../core/Logger.js";import{i as t,l as n}from"../../../../chunks/vec32.js";import{ZEROS as r,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,center as c,height as s}from"../../../../geometry/support/aaBoundingBox.js";import{labelMarginPx as i}from"./constants.js";import{getGraphics3DSymbol as o}from"./graphicSymbolUtils.js";import{LabelPlacement as f}from"./LabelParameters.js";import{textVerticalPaddingPx as m}from"../../webgl-engine/lib/TextRenderer.js";import{HUDMaterial as h}from"../../webgl-engine/materials/HUDMaterial.js";const p=()=>e.getLogger("esri.views.3d.layers.graphics.labelPlacement");class u{constructor(e,t,n,r=null){this._graphic=e,this._symbol=t,this._class=n,this._disablePlacement=r}get placement(){const e=this._verticalOffsetPlacement;if(null==e)return null;const t=this._getPlacementInfo(e);if(null==t)return null;const n=t.anchor,r=!!e.hasLabelVerticalOffset,l=e.verticalOffset,a=new f(l,n,r);return this._calculatePlacementOffsets(a,t)}get _verticalOffsetPlacement(){const e=this._class.labelPlacement,{_symbol:t,_graphic:n}=this,r=o(n.graphics3DSymbol),l="point-3d"===r?.symbol.type?r.symbol:null,a=P[e]||this._defaultPlacementInfo;return l?.supportsCallout()&&l.hasVisibleVerticalOffset()&&!n.isDraped?{placement:null,hasLabelVerticalOffset:!1,verticalOffset:l.verticalOffset.clone(),anchor:null,normalizedOffset:null}:!t?.hasVisibleVerticalOffset()||null!=l&&l.supportsCallout()&&l.verticalOffset&&!n.isDraped?{placement:null,verticalOffset:null,anchor:null,normalizedOffset:null,hasLabelVerticalOffset:!1}:a&&O(a.placement)?{placement:"above-center",verticalOffset:t.verticalOffset.clone(),anchor:"bottom",normalizedOffset:[0,a.normalizedOffset[1],0],hasLabelVerticalOffset:!0}:(p().errorOncePerTick("Callouts and vertical offset on labels are currently only supported with 'above-center' label placement (not with "+e+" placement)"),null)}_getPlacementInfo(e){if(e.anchor)return e;const t=this._class.labelPlacement,n=P[t],r=n||this._defaultPlacementInfo;return t&&!n&&p().warnOnce(`the requested label placement '${t}' is currently unsupported in SceneView.`),this._validatePlacementInfo(r)}_calculatePlacementOffsets(e,t){const n=this._graphic.graphic.geometry;if(null==n)return null;switch(n.type){case"point":this._setPointSpecificPlacement(e,t);break;case"mesh":this._setMeshSpecificPlacement(e,t);break;case"polygon":this._setPolygonSpecificPlacement(e,t)}const r=i-m;return e.screenOffset[0]+=r*t.normalizedOffset[0],e.screenOffset[1]+=r*t.normalizedOffset[1],e}get _defaultPlacementInfo(){const e=this._graphic.graphic.geometry;if(null==e)return null;switch(e.type){case"polyline":case"extent":case"multipoint":return{placement:"center-center",normalizedOffset:r,anchor:"center"};case"polygon":{const e=this._firstSymbolLayer;return"extrude"===e?.type?P["above-center"]:{placement:"center-center",normalizedOffset:r,anchor:"center"}}case"point":case"mesh":return P["above-center"];default:return}}_validatePlacementInfo(e){const t=this._graphic.graphic.geometry;if(null==t)return null;if(null!=this._disablePlacement){const t=this._class.labelPlacement;return t?(p().warnOncePerTick(b(t,this._disablePlacement.logEntityDescription)),this._defaultPlacementInfo):e}const n=t.type;switch(n){case"polyline":case"polygon":case"extent":case"multipoint":{const e=this._class.labelPlacement;if(e)return P[e]&&p().warnOnce(b(e,`'${n}' geometries`)),this._defaultPlacementInfo;break}case"point":case"mesh":return e}return e}_setPointSpecificPlacement(e,n){const r=this._firstSymbolLayer;if(null==r)return;const l=this._graphic.layers[0];switch(null!=l?l.getCenterObjectSpace(e.translation):t(e.translation,0,0,0),r.type){case"icon":case"text":this._setHUDSpecificPlacement(e,n,l);break;case"object":g(e,n,l)}}_setMeshSpecificPlacement(e,t){const n=this._firstSymbolLayer;if(null!=n&&"fill"===n.type){g(e,t,this._graphic.layers[0])}}_setPolygonSpecificPlacement(e,n){const r=this._firstSymbolLayer;if(null!=r)switch(r.type){case"extrude":{const r=this._graphic.layers[0];null!=r?(r.getBoundingBoxObjectSpace(_),c(_,e.translation),e.translation[2]=s(_)/2):t(e.translation,0,0,0),g(e,n,r);break}}}_setHUDSpecificPlacement(e,t,n){const{_graphic:r}=this,l=null!=n?n.getScreenSize():null;if(r.isDraped||null==l)e.hasLabelVerticalOffset||"center"===e.anchor||(P[this._class.labelPlacement]&&p().warnOncePerTick(`the requested placement '${t.placement}' is currently unsupported for draped graphics`),e.anchor="center");else{const n=this._normalizedSymbolAnchorPos;e.screenOffset[0]=l[0]/2*(t.normalizedOffset[0]-n[0]);const r=l[1]/2*(t.normalizedOffset[1]-n[1]);e.hasLabelVerticalOffset?(e.centerOffset[1]=r,e.centerOffsetUnits="screen"):e.screenOffset[1]=r}}get _firstSymbolLayer(){const e=this._graphic.graphics3DSymbol,t=o(e);return null!=t?t.symbol.symbolLayers.at(0):null}get _normalizedSymbolAnchorPos(){const e=this._graphic.layers[0],t=e?.stageObject.geometries[0].material??null;if(t&&t instanceof h){const e=t.parameters.anchorPosition;y[0]=2*(e[0]-.5),y[1]=2*(e[1]-.5)}else y[0]=0,y[1]=0;return y}}function b(e,t){return`the requested label placement '${e}' is currently unsupported for ${t} in SceneView.`}function g(e,t,r){const a=null!=r?r.getBoundingBoxObjectSpace(_):_,c=l(a[3]-a[0],a[4]-a[1],a[5]-a[2]),s=Math.sqrt(c[0]*c[0]+c[1]*c[1]);e.centerOffset[0]=s/2*t.normalizedOffset[0];const i=e.translation[2],o=c[2]/2*t.normalizedOffset[1];e.translation[2]=0,e.elevationOffset=i+o;const f=n(c);e.centerOffset[2]=f/2*t.normalizedOffset[2]}function O(e){return"above-center"===e}const P={"above-center":{placement:"above-center",normalizedOffset:[0,1,0],anchor:"bottom"},"above-left":{placement:"above-left",normalizedOffset:[-1,1,0],anchor:"bottom-right"},"above-right":{placement:"above-right",normalizedOffset:[1,1,0],anchor:"bottom-left"},"below-center":{placement:"below-center",normalizedOffset:[0,-1,2],anchor:"top"},"below-left":{placement:"below-left",normalizedOffset:[-1,-1,0],anchor:"top-right"},"below-right":{placement:"below-right",normalizedOffset:[1,-1,0],anchor:"top-left"},"center-center":{placement:"center-center",normalizedOffset:[0,0,1],anchor:"center"},"center-left":{placement:"center-left",normalizedOffset:[-1,0,0],anchor:"right"},"center-right":{placement:"center-right",normalizedOffset:[1,0,0],anchor:"left"}},d={"above-center":["default","esriServerPointLabelPlacementAboveCenter"],"above-left":["esriServerPointLabelPlacementAboveLeft"],"above-right":["esriServerPointLabelPlacementAboveRight"],"below-center":["esriServerPointLabelPlacementBelowCenter"],"below-left":["esriServerPointLabelPlacementBelowLeft"],"below-right":["esriServerPointLabelPlacementBelowRight"],"center-center":["esriServerPointLabelPlacementCenterCenter"],"center-left":["esriServerPointLabelPlacementCenterLeft"],"center-right":["esriServerPointLabelPlacementCenterRight"]};for(const v in d){const e=d[v],t=P[v];e.forEach((e=>{P[e]=t}))}Object.freeze&&(Object.freeze(P),Object.keys(P).forEach((e=>{Object.freeze(P[e]),Object.freeze(P[e]?.normalizedOffset)})));const y=[0,0],_=a();export{u as LabelInfo};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{neverReached as e}from"../../../../core/compilerUtils.js";import{defaultPrimitive as r}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{pathNumRoundCapExtrusionSubdivisions as t,pathNumCircleProfileSubdivisions as a,pathNumRoundJoinSubdivisions as s}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as o,EstimatedAggregateSymbolComplexity as b,AggregateSymbolComplexity as i,SymbolComplexity as y,SymbolComplexityMemory as c}from"./SymbolComplexity.js";import{hasEdges as n}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const P=new o({});function m(e){if("web-style"===e.type)return P;return F(e.symbolLayers.toArray().map((r=>L(e,r))))}function F(e){let r=0,t=0,a=0,s=!1,u=0;const o=new c;for(const b of e)null!=b&&(r+=b.verticesPerFeature,t+=b.verticesPerCoordinate,a+=b.drawCallsPerFeature,o.bytesPerFeature+=b.memory.bytesPerFeature,o.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,o.resourceBytes+=b.memory.resourceBytes,o.draped.bytesPerFeature+=b.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,s=s||b.estimated,++u);return s?new b(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o}):new i(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o})}function d(e){const r=F(e);return r.numComplexities>0&&(r.verticesPerFeature/=r.numComplexities,r.verticesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities),r}const p={};function L(u,b){const i=C(u,b),c=n(b)?2:0;switch(b.type){case"extrude":return new y({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:c,memory:i});case"fill":if("mesh-3d"===u.type)return new y({drawCallsPerFeature:c,memory:i});if(null!=b.outline&&b.outline.size>0)return new y({verticesPerFeature:-12,verticesPerCoordinate:9,memory:i});case"water":return new y({verticesPerFeature:-6,verticesPerCoordinate:3,memory:i});case"line":return new y({verticesPerFeature:-6,verticesPerCoordinate:6,memory:i});case"object":return b.resource?.href?new o({verticesPerFeature:100,memory:i}):{...f(b.resource?.primitive??r),memory:i};case"path":{let r=0,u=0;switch(b.profile){case"circle":r=a;break;case"quad":r=4;break;default:return void e(b.profile)}switch(b.join){case"round":u=s;break;case"miter":case"bevel":u=1;break;default:return}const o=2*r,c=r*u*2,n=c+o;let l=-2*c-o;switch(b.cap){case"none":break;case"butt":case"square":l+=2*(r-1);break;case"round":l+=2*(r*(t-1)*2+r);break;default:return}return new y({verticesPerFeature:l,verticesPerCoordinate:n,memory:i})}case"text":case"icon":return new y({verticesPerFeature:6,memory:i});default:return}}function C(r,t){const a="point-3d"===r.type;switch(t.type){case"extrude":return t.edges&&t.edges.size>0?E.EXTRUDE_EDGES:E.EXTRUDE;case"fill":return null!=t.outline&&t.outline.size>0?E.FILL_OUTLINE:E.FILL;case"water":return E.FILL;case"line":return"round"===t.join?E.LINE_ROUND:E.LINE_MITER;case"path":switch(t.join){case"round":switch(t.profile){case"circle":return E.PATH_ROUND_CIRCLE;case"quad":return E.PATH_ROUND_QUAD;default:return void e(t.profile)}case"miter":case"bevel":switch(t.profile){case"circle":return E.PATH_MITER_CIRCLE;case"quad":return E.PATH_MITER_QUAD;default:return void e(t.profile)}default:return}case"object":return a?E.OBJECT_POINT:E.OBJECT_POLYGON;case"icon":case"text":return a?E.ICON_POINT:E.ICON_POLYGON;default:return}}function f(e){const r=p[e];if(r)return r;const t=w(u(e,new l({},{spherical:!0})).levels);return p[e]=new y({verticesPerFeature:t}),p[e]}function w(e){return e.reduce(((e,r,t)=>e+r.numVertices*(1/10**t)),0)/e.reduce(((e,r,t)=>e+1/10**t),0)}const E={ICON_POINT:{bytesPerFeature:2346.460896195398,bytesPerFeatureLabel:3484.7516349999996,resourceBytes:0,draped:{bytesPerFeature:2007.3528529826217,bytesPerFeatureLabel:3522.702025}},ICON_POLYGON:{bytesPerFeature:3677.214053765355,bytesPerFeatureLabel:3502.5355950000003,resourceBytes:0,draped:{bytesPerFeature:3030.3700096053935,bytesPerFeatureLabel:3550.247175}},OBJECT_POINT:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992,resourceBytes:0,draped:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992}},OBJECT_POLYGON:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001,resourceBytes:0,draped:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001}},LINE_MITER:{bytesPerFeature:3252.89170349711,bytesPerFeatureLabel:3554.3931949999997,resourceBytes:0,draped:{bytesPerFeature:2843.5793737736867,bytesPerFeatureLabel:3538.2547083333334}},LINE_ROUND:{bytesPerFeature:3384.080501909172,bytesPerFeatureLabel:3522.6055950000004,resourceBytes:0,draped:{bytesPerFeature:2833.1897218657587,bytesPerFeatureLabel:3532.0680950000005}},PATH_MITER_CIRCLE:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998,resourceBytes:0,draped:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998}},PATH_ROUND_CIRCLE:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955,resourceBytes:0,draped:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955}},PATH_MITER_QUAD:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925,resourceBytes:0,draped:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925}},PATH_ROUND_QUAD:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997,resourceBytes:0,draped:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997}},FILL:{bytesPerFeature:3419.9079008788176,bytesPerFeatureLabel:3564.2132483333335,resourceBytes:0,draped:{bytesPerFeature:2910.096178654882,bytesPerFeatureLabel:3554.8655816666665}},FILL_OUTLINE:{bytesPerFeature:5018.088812445781,bytesPerFeatureLabel:3524.8219616666665,resourceBytes:0,draped:{bytesPerFeature:4278.49006198517,bytesPerFeatureLabel:3532.068368333334}},EXTRUDE:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005,resourceBytes:0,draped:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005}},EXTRUDE_EDGES:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337,resourceBytes:0,draped:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337}}};export{d as averageSymbolComplexities,m as defaultSymbolComplexity,L as defaultSymbolLayerComplexity,C as defaultSymbolLayerMemoryComplexity,P as emptySymbolComplexity,w as estimateNumVerticesForLods,F as totalSymbolComplexities};
5
+ import{neverReached as e}from"../../../../core/compilerUtils.js";import{defaultPrimitive as r}from"../../../../symbols/support/ObjectSymbol3DLayerResource.js";import{pathNumRoundCapExtrusionSubdivisions as t,pathNumCircleProfileSubdivisions as a,pathNumRoundJoinSubdivisions as s}from"./Graphics3DPathSymbolLayerConstants.js";import{primitiveLodResources as u}from"./primitiveObjectSymbolUtils.js";import{EstimatedSymbolComplexity as o,EstimatedAggregateSymbolComplexity as b,AggregateSymbolComplexity as y,SymbolComplexity as i,SymbolComplexityMemory as c}from"./SymbolComplexity.js";import{hasEdges as n}from"../support/edgeUtils.js";import{DefaultMaterial as l}from"../../webgl-engine/materials/DefaultMaterial.js";const P=new o({});function m(e){if("web-style"===e.type)return P;return F(e.symbolLayers.toArray().map((r=>L(e,r))))}function F(e){let r=0,t=0,a=0,s=!1,u=0;const o=new c;for(const b of e)null!=b&&(r+=b.verticesPerFeature,t+=b.verticesPerCoordinate,a+=b.drawCallsPerFeature,o.bytesPerFeature+=b.memory.bytesPerFeature,o.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,o.resourceBytes+=b.memory.resourceBytes,o.draped.bytesPerFeature+=b.memory.bytesPerFeature,o.draped.bytesPerFeatureLabel+=b.memory.bytesPerFeatureLabel,s=s||b.estimated,++u);return s?new b(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o}):new y(u,{verticesPerFeature:r,verticesPerCoordinate:t,drawCallsPerFeature:a,memory:o})}function d(e){const r=F(e);return r.numComplexities>0&&(r.verticesPerFeature/=r.numComplexities,r.verticesPerCoordinate/=r.numComplexities,r.drawCallsPerFeature/=r.numComplexities,r.memory.bytesPerFeature/=r.numComplexities,r.memory.bytesPerFeatureLabel/=r.numComplexities,r.memory.resourceBytes/=r.numComplexities,r.memory.draped.bytesPerFeature/=r.numComplexities,r.memory.draped.bytesPerFeatureLabel/=r.numComplexities),r}const p={};function L(u,b){const y=C(u,b),c=n(b)?2:0;switch(b.type){case"extrude":return new i({verticesPerFeature:-12,verticesPerCoordinate:12,drawCallsPerFeature:c,memory:y});case"fill":if("mesh-3d"===u.type)return new i({drawCallsPerFeature:c,memory:y});if(null!=b.outline&&b.outline.size>0)return new i({verticesPerFeature:-12,verticesPerCoordinate:9,memory:y});case"water":return new i({verticesPerFeature:-6,verticesPerCoordinate:3,memory:y});case"line":return new i({verticesPerFeature:-6,verticesPerCoordinate:6,memory:y});case"object":return b.resource?.href?new o({verticesPerFeature:100,memory:y}):{...f(b.resource?.primitive??r),memory:y};case"path":{let r=0,u=0;switch(b.profile){case"circle":r=a;break;case"quad":r=4;break;default:return void e(b.profile)}switch(b.join){case"round":u=s;break;case"miter":case"bevel":u=1;break;default:return}const o=2*r,c=r*u*2,n=c+o;let l=-2*c-o;switch(b.cap){case"none":break;case"butt":case"square":l+=2*(r-1);break;case"round":l+=2*(r*(t-1)*2+r);break;default:return}return new i({verticesPerFeature:l,verticesPerCoordinate:n,memory:y})}case"text":{const e="label-3d"===u.type?0:2;return new i({verticesPerFeature:6,memory:y,drawCallsPerFeature:e})}case"icon":return new i({verticesPerFeature:6,memory:y});default:return}}function C(r,t){const a="point-3d"===r.type;switch(t.type){case"extrude":return t.edges&&t.edges.size>0?E.EXTRUDE_EDGES:E.EXTRUDE;case"fill":return null!=t.outline&&t.outline.size>0?E.FILL_OUTLINE:E.FILL;case"water":return E.FILL;case"line":return"round"===t.join?E.LINE_ROUND:E.LINE_MITER;case"path":switch(t.join){case"round":switch(t.profile){case"circle":return E.PATH_ROUND_CIRCLE;case"quad":return E.PATH_ROUND_QUAD;default:return void e(t.profile)}case"miter":case"bevel":switch(t.profile){case"circle":return E.PATH_MITER_CIRCLE;case"quad":return E.PATH_MITER_QUAD;default:return void e(t.profile)}default:return}case"object":return a?E.OBJECT_POINT:E.OBJECT_POLYGON;case"icon":case"text":return a?E.ICON_POINT:E.ICON_POLYGON;default:return}}function f(e){const r=p[e];if(r)return r;const t=w(u(e,new l({},{spherical:!0})).levels);return p[e]=new i({verticesPerFeature:t}),p[e]}function w(e){return e.reduce(((e,r,t)=>e+r.numVertices*(1/10**t)),0)/e.reduce(((e,r,t)=>e+1/10**t),0)}const E={ICON_POINT:{bytesPerFeature:2346.460896195398,bytesPerFeatureLabel:3484.7516349999996,resourceBytes:0,draped:{bytesPerFeature:2007.3528529826217,bytesPerFeatureLabel:3522.702025}},ICON_POLYGON:{bytesPerFeature:3677.214053765355,bytesPerFeatureLabel:3502.5355950000003,resourceBytes:0,draped:{bytesPerFeature:3030.3700096053935,bytesPerFeatureLabel:3550.247175}},OBJECT_POINT:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992,resourceBytes:0,draped:{bytesPerFeature:569.2092700798497,bytesPerFeatureLabel:3183.0256999999992}},OBJECT_POLYGON:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001,resourceBytes:0,draped:{bytesPerFeature:1252.202280530861,bytesPerFeatureLabel:3125.853350000001}},LINE_MITER:{bytesPerFeature:3252.89170349711,bytesPerFeatureLabel:3554.3931949999997,resourceBytes:0,draped:{bytesPerFeature:2843.5793737736867,bytesPerFeatureLabel:3538.2547083333334}},LINE_ROUND:{bytesPerFeature:3384.080501909172,bytesPerFeatureLabel:3522.6055950000004,resourceBytes:0,draped:{bytesPerFeature:2833.1897218657587,bytesPerFeatureLabel:3532.0680950000005}},PATH_MITER_CIRCLE:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998,resourceBytes:0,draped:{bytesPerFeature:38490.63544346431,bytesPerFeatureLabel:3660.7835999999998}},PATH_ROUND_CIRCLE:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955,resourceBytes:0,draped:{bytesPerFeature:42934.88589895749,bytesPerFeatureLabel:3729.49955}},PATH_MITER_QUAD:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925,resourceBytes:0,draped:{bytesPerFeature:25392.923576583788,bytesPerFeatureLabel:3647.05925}},PATH_ROUND_QUAD:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997,resourceBytes:0,draped:{bytesPerFeature:40448.297252606244,bytesPerFeatureLabel:3646.8303499999997}},FILL:{bytesPerFeature:3419.9079008788176,bytesPerFeatureLabel:3564.2132483333335,resourceBytes:0,draped:{bytesPerFeature:2910.096178654882,bytesPerFeatureLabel:3554.8655816666665}},FILL_OUTLINE:{bytesPerFeature:5018.088812445781,bytesPerFeatureLabel:3524.8219616666665,resourceBytes:0,draped:{bytesPerFeature:4278.49006198517,bytesPerFeatureLabel:3532.068368333334}},EXTRUDE:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005,resourceBytes:0,draped:{bytesPerFeature:7963.8889768932695,bytesPerFeatureLabel:3628.5106350000005}},EXTRUDE_EDGES:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337,resourceBytes:0,draped:{bytesPerFeature:3111.7648563053044,bytesPerFeatureLabel:2658.4350683333337}}};export{d as averageSymbolComplexities,m as defaultSymbolComplexity,L as defaultSymbolLayerComplexity,C as defaultSymbolLayerMemoryComplexity,P as emptySymbolComplexity,w as estimateNumVerticesForLods,F as totalSymbolComplexities};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as T}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as R,BufferViewVec3u8 as v,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as F}from"../../../../chunks/vec3.js";import{t as A,b as E}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as C}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as U}from"./ProcessedObjectResource.js";import{load as k,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as W}from"../../webgl-engine/lib/Geometry.js";import{Texture as H}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as $}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as z}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as K,advancedMRRFactors as Q,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):k(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:K}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:Q},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s){const i=e.model,n=new Array,l=new Map,a=new Map,u=i.lods.length,c=x();return i.lods.forEach(((e,m)=>{const f=!0===o.skipHighLods&&(u>1&&0===m||u>3&&1===m)||!1===o.skipHighLods&&null!=s&&m!==s;if(f&&0!==m)return;const d=new U(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=f?new z({},o):re(i,e,d,r,t,l,a,o),{geometry:n,vertexCount:u}=te(e,s??new z({},o)),p=n.boundingInfo;null!=p&&0===m&&(T(c,p.bbMin),T(c,p.bbMax)),null!=s&&(d.stageResources.geometries.push(n),d.numberOfVertices+=u)})),f||n.push(d)})),{engineResources:n,referenceBoundingBox:c}}function re(r,t,o,s,i,n,l,u){const c=r.materials.get(t.material);if(null==c)return null;const{normal:m,color:f,texCoord0:d,tangent:p}=t.attributes,g=t.material+(m?"_normal":"")+(f?"_color":"")+(d?"_texCoord0":"")+(p?"_tangent":""),x=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,b=se(c.alphaMode);if(!n.has(g)){if(x){const e=(e,t=!1)=>{if(null!=e&&!l.has(e)){const o=r.textures.get(e);if(o){const r=o.data;l.set(e,new H(O(r)?r.data:r,{...o.parameters,preMultiplyAlpha:!O(r)&&t,encoding:O(r)?r.encoding:void 0}))}}};e(c.colorTexture,b!==_.Opaque),e(c.normalTexture),e(c.occlusionTexture),e(c.emissiveTexture),e(c.metallicRoughnessTexture)}const o=1/e,m=c.color[0]**o,f=c.color[1]**o,d=c.color[2]**o,p=c.emissiveFactor[0]**o,h=c.emissiveFactor[1]**o,y=c.emissiveFactor[2]**o,w=null!=c.colorTexture&&x?l.get(c.colorTexture):null,R=J(c),v=null!=c.normalTextureTransform?.scale?c.normalTextureTransform?.scale:a;n.set(g,new z({...s,transparent:b===_.Blend,customDepthTest:q.Lequal,textureAlphaMode:b,textureAlphaCutoff:c.alphaCutoff,diffuse:[m,f,d],ambient:[m,f,d],opacity:c.opacity,doubleSided:c.doubleSided,doubleSidedType:"winding-order",cullFace:c.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:c.receiveShadows,receiveAmbientOcclusion:c.receiveAmbientOcclustion,textureId:null!=w?w.id:void 0,colorMixMode:c.colorMixMode,normalTextureId:null!=c.normalTexture&&x?l.get(c.normalTexture).id:void 0,textureAlphaPremultiplied:null!=w&&!!w.parameters.preMultiplyAlpha,occlusionTextureId:null!=c.occlusionTexture&&x?l.get(c.occlusionTexture).id:void 0,emissiveTextureId:null!=c.emissiveTexture&&x?l.get(c.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=c.metallicRoughnessTexture&&x?l.get(c.metallicRoughnessTexture).id:void 0,emissiveFactor:[p,h,y],mrrFactors:R?X:[c.metallicFactor,c.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:P(c.colorTextureTransform),normalTextureTransformMatrix:P(c.normalTextureTransform),scale:[v[0],v[1]],occlusionTextureTransformMatrix:P(c.occlusionTextureTransform),emissiveTextureTransformMatrix:P(c.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:P(c.metallicRoughnessTextureTransform),...i},u))}const h=n.get(g);if(o.stageResources.materials.push(h),x){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(c.colorTexture),e(c.normalTexture),e(c.occlusionTexture),e(c.emissiveTexture),e(c.metallicRoughnessTexture)}return h}function te(e,r){const i=e.attributes.position.count,n=C(e.indices||i,e.primitiveType),l=b(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[$.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=b(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([$.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=b(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),A(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([$.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=b(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;I(r,t,2,o),c.push([$.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof R?F(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof v||e.attributes.color instanceof j)&&F(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([$.COLOR,new D(r,n,4,!0)])}return{geometry:new W(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,T=g(),b=g(),y=g(),w=new Float32Array(4*x),v=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,b),s.getVec(n,T),u(b,b,i.transform),c(y,b,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,T,l>-1?.2:Math.min(-4*l-3.8,1)),v[B]=y[0],v[B+1]=y[1],v[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new R(v),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
5
+ import{colorGamma as e}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as r}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as o,fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as n}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{t as u,d as c,E as m,l as f,n as d,m as p}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as x,expandWithVec3 as T}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as b}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as h,BufferViewVec4u8 as y,BufferViewVec4u16 as w,BufferViewVec3f as R,BufferViewVec3u8 as v,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as B,b as S,n as M,f as A}from"../../../../chunks/vec3.js";import{t as F,b as E}from"../../../../chunks/vec4.js";import{a as I}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as O}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as C}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as P}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as U}from"./ProcessedObjectResource.js";import{load as k,processLoadResult as N}from"./wosrLoader.js";import{NormalType as V}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as q,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as W}from"../../webgl-engine/lib/Geometry.js";import{Texture as H}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Q}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{esriSymbologyMRRFactors as z,advancedMRRFactors as K,useSchematicPBR as J,schematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(e,t){const o=Z(r(e));if("wosr"===o.fileType){const e=await(t.cache?t.cache.loadWOSR(o.url,t):k(o.url,t)),{engineResources:r,referenceBoundingBox:s}=N(e,t);return{lods:r,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(t.cache)s=await t.cache.loadGLTF(o.url,t,!!t.usePBR);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new L(t.streamDataRequester),o.url,t,t.usePBR)}const i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!t.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:z}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:K},u={...t.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,t,o.specifiedLodIndex);return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,r,t,o,s){const i=e.model,n=new Array,l=new Map,a=new Map,u=i.lods.length,c=x();return i.lods.forEach(((e,m)=>{const f=!0===o.skipHighLods&&(u>1&&0===m||u>3&&1===m)||!1===o.skipHighLods&&null!=s&&m!==s;if(f&&0!==m)return;const d=new U(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const s=f?new $({},o):re(i,e,d,r,t,l,a,o),{geometry:n,vertexCount:u}=te(e,s??new $({},o)),p=n.boundingInfo;null!=p&&0===m&&(T(c,p.bbMin),T(c,p.bbMax)),null!=s&&(d.stageResources.geometries.push(n),d.numberOfVertices+=u)})),f||n.push(d)})),{engineResources:n,referenceBoundingBox:c}}function re(r,t,o,s,i,n,l,u){const c=r.materials.get(t.material);if(null==c)return null;const{normal:m,color:f,texCoord0:d,tangent:p}=t.attributes,g=t.material+(m?"_normal":"")+(f?"_color":"")+(d?"_texCoord0":"")+(p?"_tangent":""),x=null!=t.attributes.texCoord0,T=null!=t.attributes.normal,b=se(c.alphaMode);if(!n.has(g)){if(x){const e=(e,t=!1)=>{if(null!=e&&!l.has(e)){const o=r.textures.get(e);if(o){const r=o.data;l.set(e,new H(C(r)?r.data:r,{...o.parameters,preMultiplyAlpha:!C(r)&&t,encoding:C(r)?r.encoding:void 0}))}}};e(c.colorTexture,b!==_.Opaque),e(c.normalTexture),e(c.occlusionTexture),e(c.emissiveTexture),e(c.metallicRoughnessTexture)}const o=1/e,m=c.color[0]**o,f=c.color[1]**o,d=c.color[2]**o,p=c.emissiveFactor[0]**o,h=c.emissiveFactor[1]**o,y=c.emissiveFactor[2]**o,w=null!=c.colorTexture&&x?l.get(c.colorTexture):null,R=J(c),v=null!=c.normalTextureTransform?.scale?c.normalTextureTransform?.scale:a;n.set(g,new $({...s,customDepthTest:q.Lequal,textureAlphaMode:b,textureAlphaCutoff:c.alphaCutoff,diffuse:[m,f,d],ambient:[m,f,d],opacity:"OPAQUE"===c.alphaMode?1:c.opacity,doubleSided:c.doubleSided,doubleSidedType:"winding-order",cullFace:c.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:T?V.Attribute:V.ScreenDerivative,castShadows:!0,receiveShadows:c.receiveShadows,receiveAmbientOcclusion:c.receiveAmbientOcclustion,textureId:null!=w?w.id:void 0,colorMixMode:c.colorMixMode,normalTextureId:null!=c.normalTexture&&x?l.get(c.normalTexture).id:void 0,textureAlphaPremultiplied:null!=w&&!!w.parameters.preMultiplyAlpha,occlusionTextureId:null!=c.occlusionTexture&&x?l.get(c.occlusionTexture).id:void 0,emissiveTextureId:null!=c.emissiveTexture&&x?l.get(c.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=c.metallicRoughnessTexture&&x?l.get(c.metallicRoughnessTexture).id:void 0,emissiveFactor:[p,h,y],mrrFactors:R?X:[c.metallicFactor,c.roughnessFactor,s.mrrFactors[2]],isSchematic:R,colorTextureTransformMatrix:P(c.colorTextureTransform),normalTextureTransformMatrix:P(c.normalTextureTransform),scale:[v[0],v[1]],occlusionTextureTransformMatrix:P(c.occlusionTextureTransform),emissiveTextureTransformMatrix:P(c.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:P(c.metallicRoughnessTextureTransform),...i},u))}const h=n.get(g);if(o.stageResources.materials.push(h),x){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(c.colorTexture),e(c.normalTexture),e(c.occlusionTexture),e(c.emissiveTexture),e(c.metallicRoughnessTexture)}return h}function te(e,r){const i=e.attributes.position.count,n=O(e.indices||i,e.primitiveType),l=b(3*i),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;B(l,a,e.transform,3,u);const c=[[Q.POSITION,new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=b(3*i),{typedBuffer:s,typedBufferStride:l}=e.attributes.normal;o(oe,e.transform),S(r,s,oe,3,l),t(oe)&&M(r,r),c.push([Q.NORMAL,new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=b(4*i),{typedBuffer:o,typedBufferStride:l}=e.attributes.tangent;s(oe,e.transform),F(r,o,oe,4,l),t(oe)&&M(r,r,4),c.push([Q.TANGENT,new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=b(2*i),{typedBuffer:t,typedBufferStride:o}=e.attributes.texCoord0;I(r,t,2,o),c.push([Q.UV0,new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*i);4===m.elementCount?m instanceof h?E(r,m,1,255):(m instanceof y||m instanceof w)&&E(r,m,1/255,255):(r.fill(255),m instanceof R?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof v||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push([Q.COLOR,new D(r,n,4,!0)])}return{geometry:new W(r,c),vertexCount:i}}const oe=i();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(r,t){for(let o=0;o<r.model.lods.length;++o){const s=r.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const a=i.attributes.position,x=a.count,T=g(),b=g(),y=g(),w=new Float32Array(4*x),v=new Float32Array(3*x),j=n(l(),i.transform);let B=0,S=0;for(let n=0;n<x;n++){a.getVec(n,b),s.getVec(n,T),u(b,b,i.transform),c(y,b,t.center),m(y,y,t.radius);const l=y[2],g=f(y),x=Math.min(.45+.55*g*g,1)**e;m(y,y,t.radius),null!==j&&u(y,y,j),d(y,y),o+1!==r.model.lods.length&&r.model.lods.length>1&&p(y,y,T,l>-1?.2:Math.min(-4*l-3.8,1)),v[B]=y[0],v[B+1]=y[1],v[B+2]=y[2],B+=3,w[S]=x,w[S+1]=x,w[S+2]=x,w[S+3]=1,S+=4}i.attributes.normal=new R(v),i.attributes.color=new h(w)}}}export{Y as fetch,Z as parseUrl};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as m}from"./DirectRenderer.js";import{LodRenderer as u}from"./LodRenderer.js";import{defaultBoundingBox as h,createTexture as p,requiresHalfTexelOffset as f}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as g}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let _=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=b(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=R(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new m({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t._stage.addRenderPlugin(s),t._stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new u({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry":this._addDirectRendererGeometry(r);break;case"remove-direct-renderer-geometry":this._removeDirectRendererGeometry(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometry({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometry(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometry({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometry(e),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view._stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view._stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view._stage.renderView.requestRender()}};function R(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:h},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>p("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=f("circle")}return[new v(t,r),s]}function b(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};return I(s),r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0,new w(s,{spherical:t})}function I(e){const r=e.opacity??1,t=r<1;return e.transparent=t,e.opacity=r,e.cullFace=t?g.None:g.Back,e}e([o({readOnly:!0})],_.prototype,"totalFeatures",void 0),_=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],_);export{_ as FeaturePipelineRenderManager,b as createDefaultMaterial,R as createHudMaterial};
5
+ import{_ as e}from"../../../../../../chunks/tslib.es6.js";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{makeHandle as t}from"../../../../../../core/handleUtils.js";import{releaseMaybe as s}from"../../../../../../core/maybe.js";import{createAbortError as i}from"../../../../../../core/promiseUtils.js";import{property as o}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as n}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{ViewingMode as l}from"../../../../../ViewingMode.js";import{namedAnchorToHUDMaterialAnchorPos as c}from"../../placementUtils.js";import{DirectRenderer as m}from"./DirectRenderer.js";import{LodRenderer as u}from"./LodRenderer.js";import{defaultBoundingBox as h,createTexture as p,requiresHalfTexelOffset as f}from"../../../../support/engineContent/sdfPrimitives.js";import{CullFaceOptions as g}from"../../../../webgl-engine/lib/basicInterfaces.js";import{DefaultMaterial as w}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as v}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as y}from"../../../../webgl-engine/materials/pbrUtils.js";let _=class extends r{constructor(e){super(),this.view=null,this.layerUid=null,this._materials=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerUid=e.layerUid}initialize(){}destroy(){this.removeAllHandles(),this._lodRenderers.forEach((e=>e.destroy()))}async createMaterial(e,r){const{view:i}=this,{sharedSymbolResources:o}=i;if(null==o)throw new Error("No shared symbol resources found!");const{textures:n}=o,d=i.state.viewingMode===l.Global;let a=null;switch(r){case"default":a=b(o,{physicalBasedRenderingEnabled:!0,slicePlaneEnabled:!1,castShadows:!0,isPrimitive:!0,screenSizePerspectiveEnabled:!0},d);break;case"hud":{const[e,r]=R(n,d);this.addHandles([t((()=>s(r)))]),a=e}break;default:throw new Error(`unable to create unknown material type ${r}`)}this._materials.set(e,a)}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new m({material:r,layerUid:this.layerUid});this._directRenderers.set(e,s),t._stage.addRenderPlugin(s),t._stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,t){const s=new u({view:this.view,layerUid:this.layerUid}),o=e=>this._materials.get(e);if(await s.doLoad(r,o,t),t?.aborted)throw s.destroy(),i();this._lodRenderers.set(e,s)}async executeRenderCommands(e){for(const r of e)switch(r.id){case"add-direct-renderer-geometry":this._addDirectRendererGeometry(r);break;case"remove-direct-renderer-geometry":this._removeDirectRendererGeometry(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_addDirectRendererGeometry({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const o=this._directRenderers.get(r);null!=o?(o.addRenderGeometry(e,t,s,i),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometry({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometry(e),this.view._stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view._stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view._stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view._stage.renderView.requestRender()}};function R(e,r){const t={anchorPosition:c.center,occlusionTest:!0,hasSlicePlane:!1,color:[1,0,0,1],outlineColor:[0,0,0,1],outlineSize:1,distanceFieldBoundingBox:h},s=null;if(null!=e){const r=e.fromData("circle-icon",(()=>p("circle")));t.textureId=r.texture.id,t.textureIsSignedDistanceField=!0,t.sampleSignedDistanceFieldTexelCenter=f("circle")}return[new v(t,r),s]}function b(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:y,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspectiveSettings),s.externalColor=a,s.isInstanced=!0;const i=new w(s,{spherical:t});return i.setParameters({cullFace:i.transparent?g.None:g.Back}),i}e([o({readOnly:!0})],_.prototype,"totalFeatures",void 0),_=e([n("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],_);export{_ as FeaturePipelineRenderManager,b as createDefaultMaterial,R as createHudMaterial};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as d,AlphaDiscardMode as g}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{Texture as w}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as h}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as x}from"../../../webgl/enums.js";const v=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class A{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function j(e,t){const r=await I(e,t),n=await T(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new A(r,n,o+s(r))}async function I(r,n){const s=n?.streamDataRequester;if(s)return P(r,s,n);const o=await t(e(r,n));if(!0===o.ok)return o.value.data;a(o.error),M(o.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;a(s.error),M(s.error.details.url)}function M(e){throw new r("",`Request for object resource failed: ${e}`)}function U(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(v().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(v().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(v().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(v().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else v().warn("Indexed geometries must specify faces"),n=!1;break}default:v().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(v().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(v().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function E(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");R.validate(c);const p=u.model.name,g=u.model.geometries,x=u.materialDefinitions??{},v=e.textures;let A=0;const j=new Map;for(let o=0;o<g.length;o++){const e=g[o];if(!U(e))continue;const i=q(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[b.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,E=v&&v[M];if(E&&!j.has(M)){const{image:e,parameters:t}=E,r=new w(e,t);n.push(r),j.set(M,r)}const O=j.get(M),T=O?O.id:void 0,R=i.material;let B=a.get(R,M);if(null==B){const e=x[R.slice(R.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=E&&E.alphaChannelUsage,n=e.transparency>0||"transparency"===r||"maskAndTransparency"===r,s=E?k(E.alphaChannelUsage):void 0,o={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),transparent:n,textureAlphaMode:s,textureAlphaCutoff:.33,textureId:T,doubleSided:!0,cullFace:d.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:E?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(o,t.materialParameters),B=new h(o,t),a.set(R,M,B)}s.push(B);const C=new y(B,c);A+=c.find((e=>e[0]===b.POSITION))?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:A,lodThreshold:null}],referenceBoundingBox:O(r)}}function O(e){const t=u();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))})),t}async function T(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){v().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:x.REPEAT,t:x.REPEAT},preMultiplyAlpha:k(l)!==g.Opaque},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then((e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l}))))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function k(e){switch(e){case"mask":return g.Mask;case"maskAndTransparency":return g.MaskBlend;case"none":return g.Opaque;default:return g.Blend}}function q(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new i(1,2,"wosr");export{A as LoaderResultWOSR,T as createTextureResources,j as load,E as processLoadResult};
5
+ import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import{Version as i}from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithVec3 as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../support/requestImageUtils.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{CullFaceOptions as d,AlphaDiscardMode as g}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as y}from"../../webgl-engine/lib/Geometry.js";import{Texture as w}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as b}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as x}from"../../webgl-engine/materials/DefaultMaterial.js";import{TextureWrapMode as h}from"../../../webgl/enums.js";const v=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class j{constructor(e,t,r){this.resource=e,this.textures=t,this.cachedMemory=r}}async function A(e,t){const r=await I(e,t),n=await T(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new j(r,n,o+s(r))}async function I(r,n){const s=n?.streamDataRequester;if(s)return P(r,s,n);const o=await t(e(r,n));if(!0===o.ok)return o.value.data;a(o.error),M(o.error)}async function P(e,r,n){const s=await t(r.request(e,"json",n));if(!0===s.ok)return s.value;a(s.error),M(s.error.details.url)}function M(e){throw new r("",`Request for object resource failed: ${e}`)}function E(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(v().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(v().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(v().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(v().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else v().warn("Indexed geometries must specify faces"),n=!1;break}default:v().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(v().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(v().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function U(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");R.validate(c);const p=u.model.name,g=u.model.geometries,h=u.materialDefinitions??{},v=e.textures;let j=0;const A=new Map;for(let o=0;o<g.length;o++){const e=g[o];if(!E(e))continue;const i=q(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},I=u[b.POSITION],P=I.values.length/I.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,U=v&&v[M];if(U&&!A.has(M)){const{image:e,parameters:t}=U,r=new w(e,t);n.push(r),A.set(M,r)}const O=A.get(M),T=O?O.id:void 0,R=i.material;let B=a.get(R,M);if(null==B){const e=h[R.slice(R.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=U?k(U.alphaChannelUsage):void 0,n={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:T,doubleSided:!0,cullFace:d.None,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:U?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(n,t.materialParameters),B=new x(n,t),a.set(R,M,B)}s.push(B);const C=new y(B,c);j+=c.find((e=>e[0]===b.POSITION))?.[1]?.indices.length??0,r.push(C)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:j,lodThreshold:null}],referenceBoundingBox:O(r)}}function O(e){const t=u();return e.forEach((e=>{const r=e.boundingInfo;null!=r&&(c(t,r.bbMin),c(t,r.bbMax))})),t}async function T(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){v().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:h.REPEAT,t:h.REPEAT},preMultiplyAlpha:k(l)!==g.Opaque},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then((e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l}))))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function k(e){switch(e){case"mask":return g.Mask;case"maskAndTransparency":return g.MaskBlend;case"none":return g.Opaque;default:return g.Blend}}function q(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const R=new i(1,2,"wosr");export{j as LoaderResultWOSR,T as createTextureResources,A as load,U as processLoadResult};
@@ -2,96 +2,82 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{fromValues as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{PositionAttribute as o}from"./PositionAttribute.glsl.js";import{Float2PassUniform as r}from"../../shaderModules/Float2PassUniform.js";import{Float3PassUniform as i}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as a}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as t}from"../../shaderModules/Float4sPassUniform.js";import{FloatPassUniform as l}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as v}from"../../shaderModules/FloatsPassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{VertexAttribute as c}from"../../../lib/VertexAttribute.js";import{vvColorNumber as n,VisualVariablePassParameters as f}from"../../../materials/VisualVariablePassParameters.js";const p=8;function u(e,f){const u=c.FEATUREVALUE;e.attributes.add(u,"vec4");const d=e.vertex;d.code.add(s`
6
- bool isCapVertex() {
7
- return ${u}.w == 1.0;
8
- }
9
- `),d.uniforms.add(new r("size",(e=>e.size))),f.vvSize?(d.uniforms.add(new i("vvSizeMinSize",(e=>e.vvSize.minSize)),new i("vvSizeMaxSize",(e=>e.vvSize.maxSize)),new i("vvSizeOffset",(e=>e.vvSize.offset)),new i("vvSizeFactor",(e=>e.vvSize.factor)),new i("vvSizeFallback",(e=>e.vvSize.fallback))),d.code.add(s`
10
- vec2 getSize() {
11
- float value = ${u}.x;
12
- if (isnan(value)) {
13
- return vvSizeFallback.xz;
14
- }
15
- return size * clamp(vvSizeOffset + value * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz;
16
- }
17
- `)):d.code.add(s`vec2 getSize(){
5
+ import{fromValues as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{Float2PassUniform as o}from"../../shaderModules/Float2PassUniform.js";import{Float3PassUniform as a}from"../../shaderModules/Float3PassUniform.js";import{Float4PassUniform as r}from"../../shaderModules/Float4PassUniform.js";import{Float4sPassUniform as i}from"../../shaderModules/Float4sPassUniform.js";import{FloatPassUniform as t}from"../../shaderModules/FloatPassUniform.js";import{FloatsPassUniform as v}from"../../shaderModules/FloatsPassUniform.js";import{glsl as l}from"../../shaderModules/glsl.js";import{VertexAttribute as s}from"../../../lib/VertexAttribute.js";import{vvColorNumber as c,VisualVariablePassParameters as p}from"../../../materials/VisualVariablePassParameters.js";const f=8;function n(e,p){e.attributes.add(s.POSITION,"vec3"),e.attributes.add(s.PROFILEVERTEXANDNORMAL,"vec4"),e.attributes.add(s.FEATUREVALUE,"vec4"),e.attributes.add(s.PROFILEAUXDATA,"vec2"),e.attributes.add(s.PROFILERIGHT,"vec2"),e.attributes.add(s.PROFILEUP,"vec2");const n=e.vertex;n.code.add(l`bool isCapVertex() {
6
+ return featureValue.w == 1.0;
7
+ }`),n.uniforms.add(new o("size",(e=>e.size))),p.vvSize?(n.uniforms.add(new a("vvSizeMinSize",(e=>e.vvSize.minSize)),new a("vvSizeMaxSize",(e=>e.vvSize.maxSize)),new a("vvSizeOffset",(e=>e.vvSize.offset)),new a("vvSizeFactor",(e=>e.vvSize.factor)),new a("vvSizeFallback",(e=>e.vvSize.fallback))),n.code.add(l`vec2 getSize() {
8
+ float value = featureValue.x;
9
+ if (isnan(value)) {
10
+ return vvSizeFallback.xz;
11
+ }
12
+ return size * clamp(vvSizeOffset + value * vvSizeFactor, vvSizeMinSize, vvSizeMaxSize).xz;
13
+ }`)):n.code.add(l`vec2 getSize(){
18
14
  return size;
19
- }`),f.vvOpacity?(d.constants.add("vvOpacityNumber","int",p),d.uniforms.add(new v("vvOpacityValues",(e=>e.vvOpacity.values),p),new v("vvOpacityOpacities",(e=>e.vvOpacity.opacityValues),p),new l("vvOpacityFallback",(e=>e.vvOpacity.fallback))),d.code.add(s`
20
- vec4 applyOpacity(vec4 color) {
21
- float value = ${u}.z;
22
- if (isnan(value)) {
23
- return vec4(color.rgb, vvOpacityFallback);
24
- }
25
-
26
- if (value <= vvOpacityValues[0]) {
27
- return vec4( color.xyz, vvOpacityOpacities[0]);
28
- }
29
-
30
- for (int i = 1; i < vvOpacityNumber; ++i) {
31
- if (vvOpacityValues[i] >= value) {
32
- float f = (value - vvOpacityValues[i-1]) / (vvOpacityValues[i] - vvOpacityValues[i-1]);
33
- return vec4( color.xyz, mix(vvOpacityOpacities[i-1], vvOpacityOpacities[i], f));
34
- }
35
- }
36
-
37
- return vec4( color.xyz, vvOpacityOpacities[vvOpacityNumber - 1]);
38
- }
39
- `)):d.code.add(s`vec4 applyOpacity(vec4 color){
15
+ }`),p.vvOpacity?(n.constants.add("vvOpacityNumber","int",f),n.uniforms.add(new v("vvOpacityValues",(e=>e.vvOpacity.values),f),new v("vvOpacityOpacities",(e=>e.vvOpacity.opacityValues),f),new t("vvOpacityFallback",(e=>e.vvOpacity.fallback))),n.code.add(l`vec4 applyOpacity(vec4 color) {
16
+ float value = featureValue.z;
17
+ if (isnan(value)) {
18
+ return vec4(color.rgb, vvOpacityFallback);
19
+ }
20
+ if (value <= vvOpacityValues[0]) {
21
+ return vec4( color.xyz, vvOpacityOpacities[0]);
22
+ }
23
+ for (int i = 1; i < vvOpacityNumber; ++i) {
24
+ if (vvOpacityValues[i] >= value) {
25
+ float f = (value - vvOpacityValues[i-1]) / (vvOpacityValues[i] - vvOpacityValues[i-1]);
26
+ return vec4( color.xyz, mix(vvOpacityOpacities[i-1], vvOpacityOpacities[i], f));
27
+ }
28
+ }
29
+ return vec4( color.xyz, vvOpacityOpacities[vvOpacityNumber - 1]);
30
+ }`)):n.code.add(l`vec4 applyOpacity(vec4 color){
40
31
  return color;
41
- }`),f.vvColor?(d.constants.add("vvColorNumber","int",n),d.uniforms.add(new v("vvColorValues",(e=>e.vvColor.values),n),new t("vvColorColors",(e=>e.vvColor.colors),n),new a("vvColorFallback",(e=>e.vvColor.fallback))),d.code.add(s`
42
- vec4 getColor() {
43
- float value = ${u}.y;
44
- if (isnan(value)) {
45
- return applyOpacity(vvColorFallback);
46
- }
47
-
48
- if (value <= vvColorValues[0]) {
49
- return applyOpacity(vvColorColors[0]);
50
- }
51
-
52
- for (int i = 1; i < vvColorNumber; ++i) {
53
- if (vvColorValues[i] >= value) {
54
- float f = (value - vvColorValues[i-1]) / (vvColorValues[i] - vvColorValues[i-1]);
55
- return applyOpacity(mix(vvColorColors[i-1], vvColorColors[i], f));
56
- }
57
- }
58
-
59
- return applyOpacity(vvColorColors[vvColorNumber - 1]);
60
- }
61
- `)):d.code.add(s`vec4 getColor(){
32
+ }`),p.vvColor?(n.constants.add("vvColorNumber","int",c),n.uniforms.add(new v("vvColorValues",(e=>e.vvColor.values),c),new i("vvColorColors",(e=>e.vvColor.colors),c),new r("vvColorFallback",(e=>e.vvColor.fallback))),n.code.add(l`vec4 getColor() {
33
+ float value = featureValue.y;
34
+ if (isnan(value)) {
35
+ return applyOpacity(vvColorFallback);
36
+ }
37
+ if (value <= vvColorValues[0]) {
38
+ return applyOpacity(vvColorColors[0]);
39
+ }
40
+ for (int i = 1; i < vvColorNumber; ++i) {
41
+ if (vvColorValues[i] >= value) {
42
+ float f = (value - vvColorValues[i-1]) / (vvColorValues[i] - vvColorValues[i-1]);
43
+ return applyOpacity(mix(vvColorColors[i-1], vvColorColors[i], f));
44
+ }
45
+ }
46
+ return applyOpacity(vvColorColors[vvColorNumber - 1]);
47
+ }`)):n.code.add(l`vec4 getColor(){
62
48
  return applyOpacity(vec4(1, 1, 1, 1));
63
- }`),e.include(o),e.attributes.add(c.PROFILERIGHT,"vec4"),e.attributes.add(c.PROFILEUP,"vec4"),e.attributes.add(c.PROFILEVERTEXANDNORMAL,"vec4"),d.code.add(s`vec3 calculateVPos() {
49
+ }`),n.code.add(l`vec3 decompressAxis(vec2 axis) {
50
+ float z = 1.0 - abs(axis.x) - abs(axis.y);
51
+ return normalize(vec3(axis + sign(axis) * min(z, 0.0), z));
52
+ }
53
+ vec3 calculateVPos() {
64
54
  vec2 size = getSize();
65
55
  vec3 origin = position;
66
- vec3 right = profileRight.xyz;
67
- vec3 up = profileUp.xyz;
56
+ vec3 right = decompressAxis(profileRight);
57
+ vec3 up = decompressAxis(profileUp);
58
+ vec2 profileVertex = profileVertexAndNormal.xy * size;`),n.code.add(l`if(isCapVertex()) {
59
+ float positionOffsetAlongProfilePlaneNormal = profileAuxData.x * size[0];
68
60
  vec3 forward = cross(up, right);
69
- vec2 profileVertex = profileVertexAndNormal.xy * size;
70
- vec2 profileNormal = profileVertexAndNormal.zw;
71
- float positionOffsetAlongProfilePlaneNormal = 0.0;
72
- float normalOffsetAlongProfilePlaneNormal = 0.0;`),d.code.add(s`if(!isCapVertex()) {
73
- vec2 rotationRight = vec2(profileRight.w, profileUp.w);
74
- float maxDistance = length(rotationRight);`),d.code.add(s`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
61
+ vec3 offset = right * profileVertex.x + up * profileVertex.y + forward * positionOffsetAlongProfilePlaneNormal;
62
+ return origin + offset;
63
+ }
64
+ vec2 rotationRight = vec2(profileAuxData.x, profileAuxData.y);
65
+ float maxDistance = length(rotationRight);`),n.code.add(l`rotationRight = maxDistance > 0.0 ? normalize(rotationRight) : vec2(0, 0);
75
66
  float rx = dot(profileVertex, rotationRight);
76
67
  if (abs(rx) > maxDistance) {
77
68
  vec2 rotationUp = vec2(-rotationRight.y, rotationRight.x);
78
69
  float ry = dot(profileVertex, rotationUp);
79
70
  profileVertex = rotationRight * maxDistance * sign(rx) + rotationUp * ry;
80
71
  }
81
- }else{
82
- positionOffsetAlongProfilePlaneNormal = profileRight.w * size[0];
83
- normalOffsetAlongProfilePlaneNormal = profileUp.w;
84
- }
85
- vec3 offset = right * profileVertex.x + up * profileVertex.y + forward * positionOffsetAlongProfilePlaneNormal;
72
+ vec3 offset = right * profileVertex.x + up * profileVertex.y;
86
73
  return origin + offset;
87
- }`),d.code.add(s`vec3 localNormal() {
88
- vec3 right = profileRight.xyz;
89
- vec3 up = profileUp.xyz;
90
- vec3 forward = cross(up, right);
91
- vec2 profileNormal = profileVertexAndNormal.zw;
92
- vec3 normal = right * profileNormal.x + up * profileNormal.y;
74
+ }`),n.code.add(l`vec3 localNormal() {
75
+ vec3 right = decompressAxis(profileRight);
76
+ vec3 up = decompressAxis(profileUp);
77
+ vec3 normal = right * profileVertexAndNormal.z + up * profileVertexAndNormal.w;
93
78
  if(isCapVertex()) {
94
- normal += forward * profileUp.w;
79
+ vec3 forward = cross(up, right);
80
+ normal += forward * profileAuxData.y;
95
81
  }
96
82
  return normal;
97
- }`)}class d extends f{constructor(){super(...arguments),this.size=e(1,1)}}export{u as PathVertexPosition,d as PathVertexPositionPassParameters};
83
+ }`)}class u extends p{constructor(){super(...arguments),this.size=e(1,1)}}export{n as PathVertexPosition,u as PathVertexPositionPassParameters};
@@ -2,8 +2,8 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{PositionAttribute as t}from"./PositionAttribute.glsl.js";import{DoublePrecision as i}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as m}from"../../shaderModules/Float3PassUniform.js";import{glsl as s}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as l}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4PassUniform as n}from"../../shaderModules/Matrix4PassUniform.js";import{NoParameters as f}from"../../../../../webgl/NoParameters.js";function v(r,o){r.include(t);const{vertex:e,varyings:f,fragment:v}=r;e.include(i,o),f.add("vPositionWorldCameraRelative","vec3"),f.add("vPosition_view","vec3",{invariant:!0}),e.uniforms.add(new m("transformWorldFromViewTH",(r=>r.transformWorldFromViewTH)),new m("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL)),new d("transformViewFromCameraRelativeRS",(r=>r.transformViewFromCameraRelativeRS)),new n("transformProjFromView",(r=>r.transformProjFromView)),new l("transformWorldFromModelRS",(r=>r.transformWorldFromModelRS)),new a("transformWorldFromModelTH",(r=>r.transformWorldFromModelTH)),new a("transformWorldFromModelTL",(r=>r.transformWorldFromModelTL))),e.code.add(s`vec3 positionWorldCameraRelative() {
6
- vec3 rotatedModelPosition = transformWorldFromModelRS * positionModel();
5
+ import{create as r}from"../../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as o}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{create as e}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{DoublePrecision as t}from"../util/DoublePrecision.glsl.js";import{Float3DrawUniform as a}from"../../shaderModules/Float3DrawUniform.js";import{Float3PassUniform as i}from"../../shaderModules/Float3PassUniform.js";import{glsl as m}from"../../shaderModules/glsl.js";import{Matrix3DrawUniform as s}from"../../shaderModules/Matrix3DrawUniform.js";import{Matrix3PassUniform as d}from"../../shaderModules/Matrix3PassUniform.js";import{Matrix4PassUniform as l}from"../../shaderModules/Matrix4PassUniform.js";import{VertexAttribute as n}from"../../../lib/VertexAttribute.js";import{NoParameters as f}from"../../../../../webgl/NoParameters.js";function v(r,o){const{attributes:e,vertex:f,varyings:v,fragment:F}=r;f.include(t,o),e.add(n.POSITION,"vec3"),v.add("vPositionWorldCameraRelative","vec3"),v.add("vPosition_view","vec3",{invariant:!0}),f.uniforms.add(new i("transformWorldFromViewTH",(r=>r.transformWorldFromViewTH)),new i("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL)),new d("transformViewFromCameraRelativeRS",(r=>r.transformViewFromCameraRelativeRS)),new l("transformProjFromView",(r=>r.transformProjFromView)),new s("transformWorldFromModelRS",(r=>r.transformWorldFromModelRS)),new a("transformWorldFromModelTH",(r=>r.transformWorldFromModelTH)),new a("transformWorldFromModelTL",(r=>r.transformWorldFromModelTL))),f.code.add(m`vec3 positionWorldCameraRelative() {
6
+ vec3 rotatedModelPosition = transformWorldFromModelRS * position;
7
7
  vec3 transform_CameraRelativeFromModel = dpAdd(
8
8
  transformWorldFromModelTL,
9
9
  transformWorldFromModelTH,
@@ -11,18 +11,18 @@ transformWorldFromModelTH,
11
11
  -transformWorldFromViewTH
12
12
  );
13
13
  return transform_CameraRelativeFromModel + rotatedModelPosition;
14
- }`),e.code.add(s`
14
+ }`),f.code.add(m`
15
15
  void forwardPosition(float fOffset) {
16
16
  vPositionWorldCameraRelative = positionWorldCameraRelative();
17
17
  if (fOffset != 0.0) {
18
- vPositionWorldCameraRelative += fOffset * ${o.spherical?s`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:s`vec3(0.0, 0.0, 1.0)`};
18
+ vPositionWorldCameraRelative += fOffset * ${o.spherical?m`normalize(transformWorldFromViewTL + vPositionWorldCameraRelative)`:m`vec3(0.0, 0.0, 1.0)`};
19
19
  }
20
20
 
21
21
  vPosition_view = transformViewFromCameraRelativeRS * vPositionWorldCameraRelative;
22
22
  gl_Position = transformProjFromView * vec4(vPosition_view, 1.0);
23
23
  }
24
- `),v.uniforms.add(new m("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL))),e.code.add(s`vec3 positionWorld() {
24
+ `),F.uniforms.add(new i("transformWorldFromViewTL",(r=>r.transformWorldFromViewTL))),f.code.add(m`vec3 positionWorld() {
25
25
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
26
- }`),v.code.add(s`vec3 positionWorld() {
26
+ }`),F.code.add(m`vec3 positionWorld() {
27
27
  return transformWorldFromViewTL + vPositionWorldCameraRelative;
28
28
  }`)}class F extends f{constructor(){super(...arguments),this.transformWorldFromViewTH=e(),this.transformWorldFromViewTL=e(),this.transformViewFromCameraRelativeRS=r(),this.transformProjFromView=o()}}class w extends f{constructor(){super(...arguments),this.transformWorldFromModelRS=r(),this.transformWorldFromModelTH=e(),this.transformWorldFromModelTL=e()}}export{v as VertexPosition,w as VertexPositionDrawParameters,F as VertexPositionPassParameters};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as l}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{FramebufferBit as m,Face as d,StencilOperation as g,CompareFunction as f,PrimitiveType as A,Usage as E}from"../../../../webgl/enums.js";import{noParameters as _}from"../../../../webgl/NoParameters.js";let b=class extends n{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new l}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,n=s.camera,c=n.fullViewport[2],h=n.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,i.RGBA);if(!t.compiled||!this._vaos)return this.requestRender(),p;const l=e.find((({name:e})=>e===o.TRANSPARENT)),u=this.renderingContext;p.attachDepth(l.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),u.bindFramebuffer(p.fbo),u.clear(m.COLOR|m.STENCIL),u.setViewport(0,0,c,h),u.gl.clearStencil(0),u.gl.clear(u.gl.STENCIL_BUFFER_BIT),u.setClearStencil(0);const E=u.bindTechnique(t,s);u.setFaceCullingEnabled(!1),u.setStencilTestEnabled(!0),u.setStencilOpSeparate(d.FRONT,g.KEEP,g.INCR_WRAP,g.KEEP),u.setStencilOpSeparate(d.BACK,g.KEEP,g.DECR_WRAP,g.KEEP),u.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],E.bindDraw(s,_,this._maskParameters),u.bindVAO(e),u.setStencilWriteMask(255),u.setStencilFunction(f.ALWAYS,0,255),u.setColorMask(!1,!1,!1,!1),u.drawArrays(A.TRIANGLES,0,t),u.setStencilWriteMask(0),u.setStencilFunction(f.NOTEQUAL,0,255),u.setColorMask(!0,!0,!0,!0),u.drawArrays(A.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view._stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",u.createVertex(this.renderingContext,E.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],b.prototype,"consumes",void 0),e([t()],b.prototype,"produces",void 0),e([t({constructOnly:!0})],b.prototype,"focusAreas",void 0),b=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],b);class w{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var R;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(R||(R={}));export{R as FocusAreaEffect,w as FocusAreaGeometry,b as FocusAreaMaskNode};
5
+ import{_ as e}from"../../../../../chunks/tslib.es6.js";import{property as t}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import"../../../../../core/RandomLCG.js";import{subclass as s}from"../../../../../core/accessorSupport/decorators/subclass.js";import{InternalRenderCategory as r,RenderCategory as o}from"../../../webgl.js";import{ColorFormat as i}from"../../../webgl/formats.js";import n from"../../../webgl/RenderNode.js";import{FocusAreaMaskTechnique as a}from"./FocusAreaMaskTechnique.js";import{Default3D as c}from"../../lib/DefaultVertexAttributeLocations.js";import{Pos3 as h}from"../../lib/DefaultVertexBufferLayouts.js";import{VertexArrayObject as p}from"../../lib/VertexArrayObject.js";import{F as l}from"../../../../../chunks/FocusAreaMask.glsl.js";import{BufferObject as u}from"../../../../webgl/BufferObject.js";import{FramebufferBit as m,Face as d,StencilOperation as g,CompareFunction as f,PrimitiveType as A,Usage as E}from"../../../../webgl/enums.js";import{noParameters as _}from"../../../../webgl/NoParameters.js";let b=class extends n{constructor(e){super({...e,view:e.focusAreas.view}),this.consumes={required:[r.FOCUSAREA,o.TRANSPARENT]},this.produces=r.FOCUSAREA,this._vaos=new Array,this._counts=new Array,this._origins=new Array,this._maskParameters=new l}initialize(){this.updateGeometries()}destroy(){this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0}precompile(){this.techniques.precompile(a)}render(e){const t=this.techniques.get(a),s=this.bindParameters,n=s.camera,c=n.fullViewport[2],h=n.fullViewport[3],p=this.fboCache.acquire(c,h,r.FOCUSAREA,i.RGBA);if(!t.compiled||!this._vaos)return this.requestRender(),p;const l=e.find((({name:e})=>e===o.TRANSPARENT)),u=this.renderingContext;p.attachDepth(l.getAttachment(this.gl.DEPTH_STENCIL_ATTACHMENT)),u.bindFramebuffer(p.fbo),u.clear(m.COLOR|m.STENCIL),u.setViewport(0,0,c,h),u.gl.clearStencil(0),u.gl.clear(u.gl.STENCIL_BUFFER_BIT),u.setClearStencil(0);const E=u.bindTechnique(t,s);u.setFaceCullingEnabled(!1),u.setStencilTestEnabled(!0),u.setStencilOpSeparate(d.FRONT,g.KEEP,g.INCR_WRAP,g.KEEP),u.setStencilOpSeparate(d.BACK,g.KEEP,g.DECR_WRAP,g.KEEP),u.setDepthWriteEnabled(!1);for(let r=0;r<this._vaos.length;r++){const e=this._vaos[r],t=this._counts[r];this._maskParameters.origin=this._origins[r],E.bindDraw(s,_,this._maskParameters),u.bindVAO(e),u.setDepthTestEnabled(!0),u.setStencilWriteMask(255),u.setStencilFunction(f.ALWAYS,0,255),u.setColorMask(!1,!1,!1,!1),u.drawArrays(A.TRIANGLES,0,t),u.setDepthTestEnabled(!1),u.setStencilWriteMask(0),u.setStencilFunction(f.NOTEQUAL,0,255),u.setColorMask(!0,!0,!0,!0),u.drawArrays(A.TRIANGLES,0,t)}return p}updateGeometries(){if(!this.view._stage)return;this._vaos.forEach((e=>e.dispose())),this._vaos.length=this._counts.length=this._origins.length=0;const e=this.focusAreas.geometries;for(const t of e){const e=new Array,s=t.indicesBottom;for(let n=0;n<s.length;n++)e.push(t.positions[3*(s[n]-1)]),e.push(t.positions[3*(s[n]-1)+1]),e.push(t.positions[3*(s[n]-1)+2]);const r=t.indicesExtruded;for(let n=0;n<r.length;n++)e.push(t.positions[3*r[n]]),e.push(t.positions[3*r[n]+1]),e.push(t.positions[3*r[n]+2]);const o=new Float32Array(e),i=new p(this.renderingContext,c,new Map([["geometry",h]]),new Map([["geometry",u.createVertex(this.renderingContext,E.STATIC_DRAW,o)]]));this._vaos.push(i),this._counts.push(s.length+r.length),this._origins.push(t.origin)}this.requestRender()}};e([t()],b.prototype,"consumes",void 0),e([t()],b.prototype,"produces",void 0),e([t({constructOnly:!0})],b.prototype,"focusAreas",void 0),b=e([s("esri.views.3d.webgl-engine.effects.focusArea.FocusAreaMaskNode")],b);class w{constructor(e,t,s,r,o,i){this.positions=e,this.indicesBottom=t,this.indicesExtruded=s,this.height=r,this.origin=o,this.color=i}}var R;!function(e){e[e.NONE=0]="NONE",e[e.BRIGHT=1]="BRIGHT",e[e.DARK=2]="DARK"}(R||(R={}));export{R as FocusAreaEffect,w as FocusAreaGeometry,b as FocusAreaMaskNode};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import{clamp as t}from"../../../../core/mathUtils.js";import{q as n,n as r}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";function s(t,n,r,o,a,s=2){const e=1/(Math.abs(r)+Math.abs(o)+Math.abs(a)),c=r*e,f=o*e,h=a<=0?(c>=0?1:-1)*(1-Math.abs(f)):c,u=a<=0?(f>=0?1:-1)*(1-Math.abs(c)):f,l=n*s;t[l]=i(h),t[l+1]=i(u)}function e(t){const n=t.length/3,r=new Int16Array(2*n);let o=0;for(let a=0;a<n;++a)s(r,a,t[o++],t[o++],t[o++]);return r}function c(t,r){const a=t.length/3,e=new Int16Array(2*a);let c=0;const f=o();for(let o=0;o<a;++o)f[0]=t[c++],f[1]=t[c++],f[2]=t[c++],n(f,f,r),s(e,o,f[0],f[1],f[2]);return e}function f(t,n,o,a=2){const s=o*a,e=u(n[s]),c=u(n[s+1]),f=1-Math.abs(e)-Math.abs(c);t[2]=f,f<0?(t[0]=(e>=0?1:-1)*(1-Math.abs(c)),t[1]=(c>=0?1:-1)*(1-Math.abs(e))):(t[0]=e,t[1]=c),r(t,t)}function h(t,n=2){const r=t.length/n,s=a(3*r),e=o();let c=0;for(let o=0;o<r;++o)f(e,t,o,n),s[c++]=e[0],s[c++]=e[1],s[c++]=e[2];return s}function i(n){return t(Math.round(32767*n),-32767,32767)}function u(n){return t(n/32767,-1,1)}export{c as compressAndTransformNormals,s as compressNormal,e as compressNormals,u as decodeInt16,f as decompressNormal,h as decompressNormals,i as encodeInt16};
5
+ import{clamp as t}from"../../../../core/mathUtils.js";import{q as r,n as o}from"../../../../chunks/vec32.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newFloatArray as a}from"../../../../geometry/support/FloatArray.js";import{newShortArray as s}from"../../../../geometry/support/ShortArray.js";function e(t,r,o,n,a,s=2){const e=1/(Math.abs(o)+Math.abs(n)+Math.abs(a)),c=o*e,f=n*e,u=a<=0?(c>=0?1:-1)*(1-Math.abs(f)):c,h=a<=0?(f>=0?1:-1)*(1-Math.abs(c)):f,m=r*s;t[m]=i(u),t[m+1]=i(h)}function c(t){const r=t.length/3,o=s(2*r);let n=0;for(let a=0;a<r;++a)e(o,a,t[n++],t[n++],t[n++]);return o}function f(t,o){const a=t.length/3,s=new Int16Array(2*a);let c=0;const f=n();for(let n=0;n<a;++n)f[0]=t[c++],f[1]=t[c++],f[2]=t[c++],r(f,f,o),e(s,n,f[0],f[1],f[2]);return s}function u(t,r,n,a=2){const s=n*a,e=m(r[s]),c=m(r[s+1]),f=1-Math.abs(e)-Math.abs(c);return t[2]=f,f<0?(t[0]=(e>=0?1:-1)*(1-Math.abs(c)),t[1]=(c>=0?1:-1)*(1-Math.abs(e))):(t[0]=e,t[1]=c),o(t,t)}function h(t,r=2){const o=t.length/r,s=a(3*o),e=n();let c=0;for(let n=0;n<o;++n)u(e,t,n,r),s[c++]=e[0],s[c++]=e[1],s[c++]=e[2];return s}function i(r){return t(Math.round(32767*r),-32767,32767)}function m(r){return t(r/32767,-1,1)}export{f as compressAndTransformNormals,e as compressNormal,c as compressNormals,m as decodeInt16,u as decompressNormal,h as decompressNormals,i as encodeInt16};
@@ -2,4 +2,4 @@
2
2
  All material copyright ESRI, All Rights Reserved, unless otherwise specified.
3
3
  See https://js.arcgis.com/4.33/esri/copyright.txt for details.
4
4
  */
5
- import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as o,t as a,j as n,i as m,g as h,p as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as g,c as f}from"../../../../chunks/sphere.js";import{maxScale as b}from"../../support/mathUtils.js";import{Object3DState as _}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DOccludeeStateID as j,Object3DHighlightStateID as y}from"./Object3DStateID.js";import{assert as S}from"./Util.js";import{affectsGeometry as x}from"./VertexAttribute.js";import{addObject3DStateID as V,removeObject3DStateID as O}from"../materials/renderers/utils.js";class A extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new L),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){S(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t),this._emit("geometryAdded",{object:this,geometry:t}),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];e&&(this._emit("geometryRemoved",{object:this,geometry:e}),this._invalidateBoundingVolume())}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),x(e)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new j;for(const e of this._geometries)e.occludees=V(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=O(e.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const e=new y(t);for(const i of this._geometries)i.addHighlight(e);return this._emit("highlightChanged",this),e}removeHighlight(t){for(const e of this._geometries)e.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){t.channel===_.Highlight?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new M,this._validateBoundingVolume(this._bvWorldSpace,E.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new M,this._validateBoundingVolume(this._bvObjectSpace,E.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===E.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&T(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(g(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=b(r);a(W,e.center,r);const m=n(W,g(t.bounds)),h=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],m+h)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class L{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class M extends L{constructor(){super(...arguments),this.bounds=f()}}function T(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=m(C,s[12],s[13],s[14]);h(B,r,t),h(U,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],U[i])}else if(a(B,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],B[i]);else{a(U,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t]);for(let t=0;t<3;++t){l(B,r),l(U,o),B[t]=o[t],U[t]=r[t],a(B,B,s),a(U,U,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t])}}}const C=u(),B=u(),U=u(),W=u();var E;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(E||(E={}));export{M as BoundingVolume,A as Object3D};
5
+ import"../../../../core/has.js";import{copy as t,multiply as e,hasIdentityRotation as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{IDENTITY as s,create as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{m as o,t as a,j as n,i as h,g as m,p as c,c as l}from"../../../../chunks/vec32.js";import{fromValues as d,create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{a as u,c as f}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{Object3DState as b}from"./basicInterfaces.js";import{ContentObject as p}from"./ContentObject.js";import{ContentObjectType as v}from"./ContentObjectType.js";import{Object3DOccludeeStateID as j,Object3DHighlightStateID as S}from"./Object3DStateID.js";import{assert as y}from"./Util.js";import{affectsGeometry as x}from"./VertexAttribute.js";import{addObject3DStateID as V,removeObject3DStateID as O}from"../materials/renderers/utils.js";class A extends p{get geometries(){return this._geometries}get transformation(){return this._transformation??s}set transformation(e){this._transformation=t(this._transformation??r(),e),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(e){this._shaderTransformation=e?t(this._shaderTransformation??r(),e):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}constructor(t={}){super(),this.type=v.Object,this._shaderTransformation=null,this._parentLayer=null,this._visible=!0,this._highlightIds=new Set,this.castShadow=t.castShadow??!0,this.usesVerticalDistanceToGround=t.usesVerticalDistanceToGround??!1,this.graphicUid=t.graphicUid,this.layerUid=t.layerUid,t.isElevationSource&&(this.lastValidElevationBB=new C),this._geometries=t.geometries?Array.from(t.geometries):new Array}dispose(){this._geometries.length=0}get parentLayer(){return this._parentLayer}set parentLayer(t){y(null==this._parentLayer||null==t,"Object3D can only be added to a single Layer"),this._parentLayer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const e of this._highlightIds)t.addHighlight(e);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const e=this._geometries.splice(t,1)[0];if(e){for(const t of this._highlightIds)e.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:e}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,e,i=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:e,sync:i}),x(e)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new j;for(const e of this._geometries)e.occludees=V(e.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const e of this._geometries)e.occludees=O(e.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const e=new S(t);for(const i of this._geometries)i.addHighlight(e);return this._emit("highlightChanged",this),this._highlightIds.add(e),e}removeHighlight(t){this._highlightIds.delete(t);for(const e of this._geometries)e.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){t.channel===b.Highlight?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,i){return e(i,this.transformation,t.transformation)}getCombinedShaderTransformation(t,i=r()){return e(i,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=this._bvWorldSpace||new L,this._validateBoundingVolume(this._bvWorldSpace,W.WorldSpace)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=this._bvObjectSpace||new L,this._validateBoundingVolume(this._bvObjectSpace,W.ObjectSpace)),this._bvObjectSpace}_validateBoundingVolume(t,e){const i=e===W.ObjectSpace;for(const s of this._geometries){const e=s.boundingInfo;e&&M(e,t,i?s.transformation:this.getCombinedShaderTransformation(s))}o(u(t.bounds),t.min,t.max,.5);for(const s of this._geometries){const e=s.boundingInfo;if(null==e)continue;const r=i?s.transformation:this.getCombinedShaderTransformation(s),o=_(r);a(I,e.center,r);const h=n(I,u(t.bounds)),m=e.radius*o;t.bounds[3]=Math.max(t.bounds[3],h+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this._parentLayer&&t&&this._parentLayer.notifyObjectBBChanged(this,t)}_emit(t,e){this._parentLayer&&this._parentLayer.events.emit(t,e)}get test(){}}class C{constructor(){this.min=d(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this.max=d(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)}isEmpty(){return this.max[0]<this.min[0]&&this.max[1]<this.min[1]&&this.max[2]<this.min[2]}}class L extends C{constructor(){super(...arguments),this.bounds=f()}}function M(t,e,s){const r=t.bbMin,o=t.bbMax;if(i(s)){const t=h(T,s[12],s[13],s[14]);m(B,r,t),m(U,o,t);for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],U[i])}else if(a(B,r,s),c(r,o))for(let i=0;i<3;++i)e.min[i]=Math.min(e.min[i],B[i]),e.max[i]=Math.max(e.max[i],B[i]);else{a(U,o,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t]);for(let t=0;t<3;++t){l(B,r),l(U,o),B[t]=o[t],U[t]=r[t],a(B,B,s),a(U,U,s);for(let t=0;t<3;++t)e.min[t]=Math.min(e.min[t],B[t],U[t]),e.max[t]=Math.max(e.max[t],B[t],U[t])}}}const T=g(),B=g(),U=g(),I=g();var W;!function(t){t[t.WorldSpace=0]="WorldSpace",t[t.ObjectSpace=1]="ObjectSpace"}(W||(W={}));export{L as BoundingVolume,A as Object3D};