@arcgis/core 4.31.0-next.20240619 → 4.31.0-next.20240621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
- package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
- package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
- package/assets/esri/core/workers/chunks/{d7c0728bdd9a7fd1d701.js → 9d677af08238d9e09e72.js} +36 -25
- package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
- package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
- package/assets/esri/core/workers/chunks/cf1530abe2842f3d8eb0.js +1 -0
- package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
- package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/chunks/CheckerBoard.glsl.js +9 -6
- package/chunks/ComponentShader.glsl.js +23 -23
- package/chunks/HUDMaterial.glsl.js +29 -33
- package/chunks/HighlightApply.glsl.js +150 -23
- package/chunks/HighlightDownsample.glsl.js +25 -12
- package/chunks/ImageMaterial.glsl.js +1 -2
- package/chunks/LineMarker.glsl.js +30 -30
- package/chunks/RibbonLine.glsl.js +42 -42
- package/chunks/ShadowHighlight.glsl.js +15 -6
- package/chunks/Terrain.glsl.js +6 -3
- package/interfaces.d.ts +50 -14
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/Highlights.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/HighlightOptions.js +1 -1
- package/views/3d/support/HighlightOptionsBase.js +5 -0
- package/views/3d/terrain/OverlayRenderTargets.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentData.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentMaterial.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPass.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/output/OutputHighlight.glsl.js +18 -7
- package/views/3d/webgl-engine/core/shaderModules/Integer2PassUniform.js +5 -0
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/HighlightPassParameters.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/DefaultVertexBufferLayouts.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/Program.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/Viewshed.js +1 -1
- package/views/3d/webgl-engine/lib/ViewshedShadowMap.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineMarker.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RibbonLine.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/ShadowHighlight.glsl.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/views/support/HighlightDefaults.js +1 -1
- package/views/webgl/BufferObject.js +1 -1
- package/views/webgl/RenderingContext.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/constants.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/24484bd0185ea0f79760.js +0 -1
- package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
- package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
- package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
- package/chunks/HighlightBlur.glsl.js +0 -25
- package/views/3d/webgl-engine/effects/highlight/HighlightBlurTechnique.js +0 -5
- package/views/3d/webgl-engine/shaders/HighlightBlur.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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as r,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as s,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as p,g as h,j as g,h as d,t as x,n as _,r as T,m as b,f as y,b as v}from"../../../../chunks/vec32.js";import{ZEROS as w,ONES as R,create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as P}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as E}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,empty as N,expandWithBuffer as I,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as U}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as B,getContinuousIndexArray as F}from"../../../../geometry/support/Indices.js";import D from"../../../../geometry/support/MeshComponent.js";import G from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import L from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as V,isAbsoluteVertexSpace as $}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as H,isPlateCarree as k}from"../../../../geometry/support/spatialReferenceUtils.js";import{a as q}from"../../../../chunks/vec3.js";import{transformNormal as z,transformVectorENUPlateCarree as W,VectorType as Y,transformVectorWMPlateCarree as J,projectNormalToPCPF as K,transformTangent as Q,projectTangentToPCPF as X,project as Z}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as ee}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as te}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as re}from"../../../ViewingMode.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as ae}from"./ElevationAligners.js";import{needsElevationUpdates3D as se,evaluateElevationInfoAtPoint as ie}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as le}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ce}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ue}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as me,MeshFastUpdateProcessor as fe}from"./MeshFastUpdateProcessor.js";import{createMaterial as pe}from"../support/edgeUtils.js";import{parseColorMixMode as he,encodeSymbolColor as ge}from"../support/symbolColorUtils.js";import{debugFlags as de}from"../../support/debugFlags.js";import{Attribute as xe}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _e,CullFaceOptions as Te}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as be}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as ye}from"../../webgl-engine/lib/Geometry.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{Texture as we}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Me}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as je}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ae,defaultSchematicMRRFactors as Ce,defaultAdvancedMRRFactors as Pe}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Ee}from"../../../webgl/enums.js";const Oe=["mesh"];class Ne extends ue{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new me,this._fastUpdateProcessor=new fe,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){de.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new je({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new je({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new je({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Oe,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,se)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case te.EnableFastUpdates:if(n)return!0;break;case te.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,te.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,te.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=nt,{origin:i,transform:l}=r;if(!C(t,p(Ze,i.x,i.y,i.z??0),s,a))return!1;switch(o){case te.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case te.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case te.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>ie(e,u,c,m,t);return e.alignedSampledElevation=ae(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,te.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=Ye(n),p=Ye(a),h=Je(s),g=Ye(i),d=Je(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${g},nttuid:${d},ds:${c},ac:${u},am:${m}`,t.material instanceof G){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=Ye(n),h=Je(a),g=Ye(i),d=Ye(c),x=Je(u),_=Ye(m),T=Je(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(u),o.occlusionTextureTransform=$e(f),o.metallicRoughnessTextureTransform=$e(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${g},etmuid:${d},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTextureId(e){const t=this._getInternalTexture(e,_e.Opaque);return t?.id}_getInternalTexture(e,t){const r=We(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let n=this._textures.get(o);if(!n){let a=null;const s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:He(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};oe(r)?(a=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(a=r,i.preMultiplyAlpha=t!==_e.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),n=new we(a,i),this._textures.set(o,n),n.load(this._context.stage.renderView.renderingContext),this._context.stage.add(n)}return n}_setInternalMaterialParameters(t,r){if(null!=t.color&&ze(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=ne(t.colorTextureTransform),r.normalTextureTransformMatrix=ne(t.normalTextureTransform);const o=null!=t.normalTextureTransform?.scale?t.normalTextureTransform?.scale:f;r.scale=[o[0],o[1]],r.occlusionTextureTransformMatrix=ne(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=ne(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=ne(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=j;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=j)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(qe(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Ae({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:w,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:Te.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};f.mrrFactors=m?[...Ce]:[l.metallic,l.roughness,Pe[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?Te.None:Te.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const p=new Me(f);return u.material=p,this._materialInfoCache.set(l.uid,u),this._context.stage.add(p),p}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?_e.MaskBlend:_e.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?_e.Opaque:"mask"===t.alphaMode?_e.Mask:_e.Blend}_createFaceDebugNormals(e,t){const o=t.length,a=e.spatialReference.isGeographic?20015077/180:1,s=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=r(n(),c);for(let r=0;r<o;r++){const e=t[r].attributes.get(Re.POSITION);if(!e)continue;const o=e.data,n=e.indices;for(let t=0;t<n.length;t+=3)Le(o,n,t,rt),Ge(o,n,t,Ze,et,tt),h(Ze,Ze,et),h(Ze,Ze,tt),g(Ze,Ze,1/3),d(Ze,Ze,c),i.push(...Ze),x(rt,rt,u),_(rt,rt),T(Ze,Ze,rt,s),i.push(...Ze),l.push(l.length),l.push(l.length)}return i.length?new ye(this._debugFaceNormalMaterial,[[Re.POSITION,new xe(i,l,3,!0)]],null,be.Line):null}_createPerVertexDebugVectors(e,t,a,s,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],h=t[0].transformation,g=r(n(),h);a===Re.TANGENT&&o(g,h);for(let r=0;r<l;r++){const e=t[r],o=e.attributes.get(Re.POSITION),n=e.attributes.get(a);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;p(Ze,s[e+0],s[e+1],s[e+2]),d(Ze,Ze,h),m.push(...Ze),p(et,l[r+0],l[r+1],l[r+2]),x(et,et,g),_(et,et),T(Ze,Ze,et,u),m.push(...Ze),f.push(f.length),f.push(f.length)}}return m.length?new ye(s,[[Re.POSITION,new xe(m,f,3,!0)]],null,be.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(de.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,Re.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,Re.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new ve({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=pe(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new ce(s[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new le(this,l,s,null,null,ae,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=se(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:p}=this._context,h=(e,t)=>ie(e,f,r,p,t);return m.alignedSampledElevation=ae(m,r,f.spatialReference,h,p),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!V(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===re.Global&&"local"===o||a===re.Local&&H(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=ee(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return E([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===it.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o=r,n=null;if(t.reprojection===it.NONE)return{position:o,georeferencedPositionBuffer:n};const a=t.reprojection===it.RENDER?t.transformBeforeProject:null;a&&(o=q(new Float64Array(o.length),o,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(n=o);const l=o===r||o===n?new Float64Array(o.length):o;return P(o,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0,o.length/3),{position:l,georeferencedPositionBuffer:n}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!k(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return W(a,Y.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return J(a,Y.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a;return K(a,r,t,e.spatialReference,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=Q(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!k(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return W(a,Y.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return J(a,Y.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a;return X(a,r,t,e.spatialReference,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=he(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ge(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),u=Ke(e),m=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:g,position:d,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:d,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:u,symbolColorBuffer:m,objectTransformation:g,geometryTransformation:s.reprojection===it.NONE&&s.geometryTransformation?s.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?H(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?it.NONE:it.RENDER:it.NONE;if($(t))return{reprojection:r};const o=t.origin,n=c(),i=e.transform?.localMatrix??u;if(r===it.NONE){C(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:m(i)}}const l=a(c(),o);return s(l,l,i),{reprojection:r,transformBeforeProject:l}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.anchor;Xe[0]=a.x,Xe[1]=a.y,Xe[2]=a.z??0;const s=c();C(e.spatialReference,Xe,s,n),i(ot,s);const{position:l,normal:u,tangent:m}=e.vertexAttributes,f=t===l?new Float64Array(t.length):t;q(f,t,ot);const p=r?r===u?new Float32Array(r.length):r:null,h=o?o===m?new Float32Array(o.length):o:null;return r&&p&&z(r,p,ot),o&&h&&Q(o,h,ot),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=Z({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===re.Local});if(!o)return!1;const n=o.length/3;return N(at),I(at,o,0,n),!S(at,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!A(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:f}=o,p=Ve(e),h=new Array;let g=!1;const d=l(Ze,m),x=this._context.localOriginFactory.getOrigin(d);for(const l of p){if(!this._validateFaces(e,l))return null;const t=Se(e,l);if(0===t.length)continue;const o=Ue(n,c,l,t);o.didFlipNormals&&(g=!0);const m=[[Re.POSITION,new xe(n,t,3,!0)],[Re.NORMAL,new xe(o.normals,o.indices,3,!0)]];s&&m.push([Re.COLOR,new xe(s,t,4,!0)]),i&&m.push([Re.SYMBOLCOLOR,new xe(i,B(t.length),4,!0)]),a&&m.push([Re.UV0,new xe(a,t,2,!0)]),u&&m.push([Re.TANGENT,new xe(u,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),d=this._getOrCreateMaterial(e,l),_=new ye(d,m,null,be.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return g&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==re.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Se(e,t){return t.faces??F(e.vertexAttributes.position.length/3)}function Ue(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Fe(e,t,r,o);case"flat":return Be(e,o);case"smooth":return De(e,o)}}function Be(e,t){const r=U(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Le(e,t,n,rt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Fe(e,t,r,o){if(null==t)return Be(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Le(e,o,a,rt);for(let e=0;e<3;e++){const r=3*o[a+e];Ze[0]=t[r],Ze[1]=t[r+1],Ze[2]=t[r+2],b(rt,Ze)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function De(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Le(e,t,a,rt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),h(s.normal,s.normal,o),s.count++}}const o=U(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(_(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Ie(o,n,!1)}function Ge(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Le(e,t,r,o){return Ge(e,t,r,Ze,et,tt),y(et,et,Ze),y(tt,tt,Ze),v(Ze,et,tt),_(o,Ze),o}function Ve(e){return e.components??st}function $e(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function He(e="repeat"){if("string"==typeof e){const t=ke(e);return{s:t,t}}return{s:ke(e.horizontal),t:ke(e.vertical)}}function ke(e){switch(e){case"clamp":return Ee.CLAMP_TO_EDGE;case"mirror":return Ee.MIRRORED_REPEAT;default:return Ee.REPEAT}}function qe(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function ze(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function We(e){return e.data??e.url}function Ye(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Je(e){const{offset:t,scale:r,rotation:o}=e??Qe;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Ke(e){return e.vertexAttributes.color}const Qe=new L,Xe=M(),Ze=M(),et=M(),tt=M(),rt=M(),ot=c(),nt=c(),at=O(),st=[new D];var it;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(it||(it={}));export{Ne as Graphics3DMeshFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{normalFromMat4 as r,fromMat4 as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as a,multiply as s,invert as i,getTranslation as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as c,IDENTITY as u,clone as m}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as f}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as p,g as h,j as g,h as d,t as x,n as _,r as T,m as b,f as y,b as v}from"../../../../chunks/vec32.js";import{ZEROS as w,ONES as R,create as M}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as A}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as C}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as P}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as E}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,empty as N,expandWithBuffer as I,intersectsClippingArea as S}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as U}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as B,getContinuousIndexArray as F}from"../../../../geometry/support/Indices.js";import D from"../../../../geometry/support/MeshComponent.js";import G from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import L from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as V,isAbsoluteVertexSpace as $}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{equals as H,isPlateCarree as k}from"../../../../geometry/support/spatialReferenceUtils.js";import{a as q}from"../../../../chunks/vec3.js";import{transformNormal as z,transformVectorENUPlateCarree as W,VectorType as Y,transformVectorWMPlateCarree as J,projectNormalToPCPF as K,transformTangent as Q,projectTangentToPCPF as X,project as Z}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as ee}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as te}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as re}from"../../../ViewingMode.js";import{isEncodedMeshTexture as oe}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as ne}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as ae}from"./ElevationAligners.js";import{needsElevationUpdates3D as se,evaluateElevationInfoAtPoint as ie}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as le}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ce}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as ue}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as me,MeshFastUpdateProcessor as fe}from"./MeshFastUpdateProcessor.js";import{createMaterial as pe}from"../support/edgeUtils.js";import{parseColorMixMode as he,encodeSymbolColor as ge}from"../support/symbolColorUtils.js";import{debugFlags as de}from"../../support/debugFlags.js";import{Attribute as xe}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _e,CullFaceOptions as Te}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as be}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as ye}from"../../webgl-engine/lib/Geometry.js";import{Object3D as ve}from"../../webgl-engine/lib/Object3D.js";import{Texture as we}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as Re}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as Me}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as je}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Ae,defaultSchematicMRRFactors as Ce,defaultAdvancedMRRFactors as Pe}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as Ee}from"../../../webgl/enums.js";const Oe=["mesh"];class Ne extends ue{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new me,this._fastUpdateProcessor=new fe,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){de.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new je({color:[1,0,1,1]}),this._debugTangentNormalMaterial=new je({color:[1,.5,0,1]}),this._debugFaceNormalMaterial=new je({color:[0,1,1,1]}))}destroy(){super.destroy(),this._textures.forEach((e=>e.unload())),this._context.stage.removeMany(this._materialInfoCache.materials),this._context.stage.removeMany(Array.from(this._textures.values())),this._materialInfoCache.clear(),this._textures.clear(),this._fastUpdateProcessor.destroy(this._context.stage)}get materials(){return this._materialInfoCache.materials}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,Oe,"fill on mesh-3d"))return null;const r=this.setGraphicElevationContext(t),o=e.renderingInfo;return this._createAs3DShape(t,o,r,t.uid)}onRemoveGraphic(e){this._fastUpdateProcessor.onRemoveGraphic(e,this._materialInfoCache,this._context)}layerOpacityChanged(e,t){const r=this._getLayerOpacity();this._updateMaterialParameters((e=>{e.material.setParameters({layerOpacity:r});const t=e.material.parameters;this._setMaterialTransparentParameter(t,e),e.material.setParameters({transparent:t.transparent})})),e.forEach((e=>t(e)?.layerOpacityChanged(r,this._context.isAsync)))}layerElevationInfoChanged(e,t){return this.updateGraphics3DGraphicElevationInfo(e,t,se)}slicePlaneEnabledChanged(e,t){return this._updateMaterialParameters((({material:e})=>{e.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})})),e.forEach((e=>t(e)?.slicePlaneEnabledChanged(this._context.slicePlaneEnabled,this._context.isAsync))),!0}physicalBasedRenderingChanged(){const e=this._usePBR();return this._updateMaterialParameters((({material:t})=>t.setParameters({usePBR:e}))),!0}updateTransform(e,t,r,o){if(!e.fastTransformUpdatesAllowed)return!1;const n=e.fastTransformUpdatesEnabled;switch(o){case te.EnableFastUpdates:if(n)return!0;break;case te.DisableFastUpdates:if(!n)return!0;break;default:if(!n)return!!this.updateTransform(e,t,r,te.EnableFastUpdates)&&(e.autoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,te.DisableFastUpdates))),!0)}const a=this._context.renderCoordsHelper.spatialReference,s=nt,{origin:i,transform:l}=r;if(!C(t,p(Ze,i.x,i.y,i.z??0),s,a))return!1;switch(o){case te.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case te.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case te.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,l,this._context.localOriginFactory)}const{elevationContext:c}=e;c.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:u,renderCoordsHelper:m}=this._context,f=(e,t)=>ie(e,u,c,m,t);return e.alignedSampledElevation=ae(e,c,u.spatialReference,f,m,s),e.updateTransform(s,l,this._context.isAsync),e.updateAutoDisableFastTransformUpdates((()=>this.updateTransform(e,t,r,te.DisableFastUpdates))),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,n=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:n,uid:`vc:${o},vt:${n},vct${t},svc:${r}`}}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:n,colorTexture:a,colorTextureTransform:s,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,f=Ye(n),p=Ye(a),h=Je(s),g=Ye(i),d=Je(l);if(o.color=n,o.colorTexture=a,o.normalTexture=i,o.uid=`${o.uid},cmuid:${f},ctmuid:${p},cttuid:${h},ntmuid:${g},nttuid:${d},ds:${c},ac:${u},am:${m}`,t.material instanceof G){const{metallic:e,roughness:r,metallicRoughnessTexture:n,metallicRoughnessTextureTransform:a,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:f}=t.material,p=Ye(n),h=Je(a),g=Ye(i),d=Ye(c),x=Je(u),_=Ye(m),T=Je(f);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=n,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=$e(s),o.normalTextureTransform=$e(l),o.emissiveTextureTransform=$e(u),o.occlusionTextureTransform=$e(f),o.metallicRoughnessTextureTransform=$e(a),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${p},mrtt:${h},emuid:${g},etmuid:${d},ett:${x},otmuid:${_},ott:${T}`}return o}_getInternalTextureId(e){const t=this._getInternalTexture(e,_e.Opaque);return t?.id}_getInternalTexture(e,t){const r=We(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let n=this._textures.get(o);if(!n){let a=null;const s=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:He(e.wrap),noUnpackFlip:!0,maxAnisotropy:s,mipmap:s>1};oe(r)?(a=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(a=r,i.preMultiplyAlpha=t!==_e.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),n=new we(a,i),this._textures.set(o,n),n.load(this._context.stage.renderView.renderingContext),this._context.stage.add(n)}return n}_setInternalMaterialParameters(t,r){if(null!=t.color&&ze(t.color,r),null!=t.colorTexture){const e=this._getInternalTexture(t.colorTexture,r.textureAlphaMode);e?(r.textureId=e.id,r.textureAlphaPremultiplied=!!e.parameters.preMultiplyAlpha):r.textureId=void 0}t.normalTexture&&(r.normalTextureId=this._getInternalTextureId(t.normalTexture)),t.emissiveColor&&(r.emissiveFactor=e.toUnitRGB(t.emissiveColor)),t.emissiveTexture&&(r.emissiveTextureId=this._getInternalTextureId(t.emissiveTexture)),t.occlusionTexture&&(r.occlusionTextureId=this._getInternalTextureId(t.occlusionTexture)),t.metallicRoughnessTexture&&(r.metallicRoughnessTextureId=this._getInternalTextureId(t.metallicRoughnessTexture)),r.colorTextureTransformMatrix=ne(t.colorTextureTransform),r.normalTextureTransformMatrix=ne(t.normalTextureTransform);const o=null!=t.normalTextureTransform?.scale?t.normalTextureTransform?.scale:f;r.scale=[o[0],o[1]],r.occlusionTextureTransformMatrix=ne(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=ne(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=ne(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=j;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=j)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_getOrCreateMaterial(t,r){const o=r.material?.color,n=r.material?.colorTexture,a=r.material?.alphaMode,s="blend"===a,i=!("opaque"===a)&&(qe(t)||null!=o&&o.a<1||n?.transparent||s),l=this._materialProperties(t,r,i),c=this._materialInfoCache.byUid(l.uid);if(c)return c.material;const u={uid:l.uid,material:null,isComponentTransparent:i,alphaMode:r.material?r.material.alphaMode:"opaque"},m=Ae({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),f={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:w,diffuse:R,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:Te.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};f.mrrFactors=m?[...Ce]:[l.metallic,l.roughness,Pe[2]],r.material&&(f.doubleSided=r.material.doubleSided,f.cullFace=r.material.doubleSided?Te.None:Te.Back,f.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(f),this._setMaterialTransparentParameter(f,u),this._setInternalMaterialParameters(l,f);const p=new Me(f);return u.material=p,this._materialInfoCache.set(l.uid,u),this._context.stage.add(p),p}_usePBR(){return this._context.physicalBasedRenderingEnabled}_setMaterialTransparentParameter(e,t){e.transparent=this.needsDrivenTransparentPass||t.isComponentTransparent||e.layerOpacity<1||e.opacity<1||e.externalColor&&e.externalColor[3]<1,"auto"===t.alphaMode?e.textureAlphaMode=e.transparent?_e.MaskBlend:_e.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?_e.Opaque:"mask"===t.alphaMode?_e.Mask:_e.Blend}_createFaceDebugNormals(e,t){const o=t.length,a=e.spatialReference.isGeographic?20015077/180:1,s=.1*Math.max(e.extent.width*a,e.extent.height*a,e.extent.zmax-e.extent.zmin),i=[],l=[],c=t[0].transformation,u=r(n(),c);for(let r=0;r<o;r++){const e=t[r].attributes.get(Re.POSITION);if(!e)continue;const o=e.data,n=e.indices;for(let t=0;t<n.length;t+=3)Le(o,n,t,rt),Ge(o,n,t,Ze,et,tt),h(Ze,Ze,et),h(Ze,Ze,tt),g(Ze,Ze,1/3),d(Ze,Ze,c),i.push(...Ze),x(rt,rt,u),_(rt,rt),T(Ze,Ze,rt,s),i.push(...Ze),l.push(l.length),l.push(l.length)}return i.length?new ye(this._debugFaceNormalMaterial,[[Re.POSITION,new xe(i,l,3,!0)]],null,be.Line):null}_createPerVertexDebugVectors(e,t,a,s,i){const l=t.length,c=e.spatialReference.isGeographic?20015077/180:1,u=.1*i*Math.max(e.extent.width*c,e.extent.height*c,e.extent.zmax-e.extent.zmin),m=[],f=[],h=t[0].transformation,g=r(n(),h);a===Re.TANGENT&&o(g,h);for(let r=0;r<l;r++){const e=t[r],o=e.attributes.get(Re.POSITION),n=e.attributes.get(a);if(!o||!n)continue;const s=o.data,i=o.indices,l=n.data,c=n.indices;for(let t=0;t<i.length;t++){const e=3*i[t],r=c[t]*n.stride;p(Ze,s[e+0],s[e+1],s[e+2]),d(Ze,Ze,h),m.push(...Ze),p(et,l[r+0],l[r+1],l[r+2]),x(et,et,g),_(et,et),T(Ze,Ze,et,u),m.push(...Ze),f.push(f.length),f.push(f.length)}}return m.length?new ye(s,[[Re.POSITION,new xe(m,f,3,!0)]],null,be.Line):null}_createAs3DShape(e,t,r,o){const n=e.geometry;if("mesh"!==n.type)return null;const a=this._createGeometryInfo(n,t,o);if(null==a)return null;const{geometries:s,objectTransformation:i}=a;if(de.DRAW_MESH_GEOMETRY_NORMALS){const e=this._createPerVertexDebugVectors(n,s,Re.NORMAL,this._debugVertexNormalMaterial,1),t=this._createPerVertexDebugVectors(n,s,Re.TANGENT,this._debugTangentNormalMaterial,.5),r=this._createFaceDebugNormals(n,s);e&&s.push(e),t&&s.push(t),r&&s.push(r)}const l=new ve({geometries:s,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=pe(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new ce(s[0].material,c,this._context.slicePlaneEnabled):null,m=new le(this,l,s,null,null,ae,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=se(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,m.fastTransformUpdatesAllowed=this._fastTransformUpdatesAllowed(n),r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:f,renderCoordsHelper:p}=this._context,h=(e,t)=>ie(e,f,r,p,t);return m.alignedSampledElevation=ae(m,r,f.spatialReference,h,p),m}_fastTransformUpdatesAllowed(e){const{vertexSpace:t,spatialReference:r}=e;if(!V(t))return!1;const{type:o}=t,{view:n}=this._context.graphicsCoreOwner,{viewingMode:a}=n.state,s=n.spatialReference;return a===re.Global&&"local"===o||a===re.Local&&H(s,r)&&"georeferenced"===o&&!r.isGeographic}_getCenterPointInElevationSR(e){const t=ee(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return E([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_passthroughReprojectionInfo(e){return e.reprojection===it.NONE&&!!e.objectTransformation}_createPositionBuffer(e,t){const r=e.vertexAttributes.position;let o=r,n=null;if(t.reprojection===it.NONE)return{position:o,georeferencedPositionBuffer:n};const a=t.reprojection===it.RENDER?t.transformBeforeProject:null;a&&(o=q(new Float64Array(o.length),o,a));const{normal:s,tangent:i}=e.vertexAttributes;this._passthroughReprojectionInfo(t)||!s&&!i||(n=o);const l=o===r||o===n?new Float64Array(o.length):o;return P(o,e.spatialReference,0,l,this._context.renderCoordsHelper.spatialReference,0,o.length/3),{position:l,georeferencedPositionBuffer:n}}_createNormalBuffer(e,t,r,o){const n=e.vertexAttributes.normal;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=z(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!k(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return W(a,Y.NORMAL,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return J(a,Y.NORMAL,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a;return K(a,r,t,e.spatialReference,l)}_createTangentBuffer(e,t,r,o){const n=e.vertexAttributes.tangent;if(null==n)return null;let a=n;const s=o.reprojection===it.RENDER?o.transformBeforeProject:null;s&&(a=Q(a,new Float32Array(a.length),s));const i=this._context.graphicsCoreOwner.view.viewingMode;if(o.reprojection===it.NONE)return a;if("local"===i){if(!k(this._context.renderCoordsHelper.spatialReference))return a;if(null==r)return null;if(e.spatialReference.isGeographic){const e=a===n?new Float32Array(a.length):a;return W(a,Y.TANGENT,r,e)}if(e.spatialReference.isWebMercator){const e=a===n?new Float32Array(a.length):a;return J(a,Y.TANGENT,r,e)}return a}if(null==r)return null;const l=a===n?new Float32Array(a.length):a;return X(a,r,t,e.spatialReference,l)}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=he(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ge(t,r,o),o}return null}_createBuffers(e,t){const r=e.vertexAttributes&&e.vertexAttributes.position;if(!r)return this.logger.warn("Mesh geometry must contain position vertex attributes"),null;const o=e.vertexAttributes.normal,n=e.vertexAttributes.uv,a=e.vertexAttributes.tangent;if(o&&o.length!==r.length)return this.logger.warn("Mesh normal vertex buffer must contain the same number of elements as the position buffer"),null;if(a&&a.length/4!=r.length/3)return this.logger.warn("Mesh tangent vertex buffer must contain the same number of elements as the position buffer"),null;if(n&&n.length/2!=r.length/3)return this.logger.warn("Mesh uv vertex buffer must contain the same number of elements as the position buffer"),null;const s=this._computeReprojectionInfo(e),{position:i,georeferencedPositionBuffer:l}=this._createPositionBuffer(e,s),u=Ke(e),m=this._createSymbolColorBuffer(t),f=this._createNormalBuffer(e,i,l,s),p=this._createTangentBuffer(e,i,l,s),h=n,{transformation:g,position:d,normal:x,tangent:_}=this._passthroughReprojectionInfo(s)?{transformation:s.objectTransformation,position:i,normal:f,tangent:p}:this._transformOriginLocal(e,i,f,p);return{positionBuffer:d,normalBuffer:x,tangentBuffer:_,uvBuffer:h,colorBuffer:u,symbolColorBuffer:m,objectTransformation:g,geometryTransformation:s.reprojection===it.NONE&&s.geometryTransformation?s.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?H(this._context.renderCoordsHelper.spatialReference,e.spatialReference)?it.NONE:it.RENDER:it.NONE;if($(t))return{reprojection:r};const o=t.origin,n=c(),i=e.transform?.localMatrix??u;if(r===it.NONE){C(e.spatialReference,o,n,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:n,geometryTransformation:m(i)}}const l=a(c(),o);return s(l,l,i),{reprojection:r,transformBeforeProject:l}}_transformOriginLocal(e,t,r,o){const n=this._context.renderCoordsHelper.spatialReference,a=e.anchor;Xe[0]=a.x,Xe[1]=a.y,Xe[2]=a.z??0;const s=c();C(e.spatialReference,Xe,s,n),i(ot,s);const{position:l,normal:u,tangent:m}=e.vertexAttributes,f=t===l?new Float64Array(t.length):t;q(f,t,ot);const p=r?r===u?new Float32Array(r.length):r:null,h=o?o===m?new Float32Array(o.length):o:null;return r&&p&&z(r,p,ot),o&&h&&Q(o,h,ot),{transformation:s,position:f,normal:p,tangent:h}}_validateFaces(e,t){const r=e.vertexAttributes.position.length/3,o=t.faces;if(o){let e=-1;for(let t=0;t<o.length;t++){const r=o[t];r>e&&(e=r)}if(r<=e)return this.logger.warn(`Vertex index ${e} is out of bounds of the mesh position buffer`),!1}else if(r%3!=0)return this.logger.warn("Mesh position buffer length must be a multiple of 9 if no component faces are defined (3 values per vertex * 3 vertices per triangle)"),!1;return!0}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=Z({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===re.Local});if(!o)return!1;const n=o.length/3;return N(at),I(at,o,0,n),!S(at,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!A(e.spatialReference,this._context.renderCoordsHelper.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(!this._validateVertexSpace(e))return null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:n,uvBuffer:a,colorBuffer:s,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:f}=o,p=Ve(e),h=new Array;let g=!1;const d=l(Ze,m),x=this._context.localOriginFactory.getOrigin(d);for(const l of p){if(!this._validateFaces(e,l))return null;const t=Se(e,l);if(0===t.length)continue;const o=Ue(n,c,l,t);o.didFlipNormals&&(g=!0);const m=[[Re.POSITION,new xe(n,t,3,!0)],[Re.NORMAL,new xe(o.normals,o.indices,3,!0)]];s&&m.push([Re.COLOR,new xe(s,t,4,!0)]),i&&m.push([Re.SYMBOLCOLOR,new xe(i,B(t.length),4,!0)]),a&&m.push([Re.UV0,new xe(a,t,2,!0)]),u&&m.push([Re.TANGENT,new xe(u,t,4,!0)]);const p=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),d=this._getOrCreateMaterial(e,l),_=new ye(d,m,null,be.Mesh,p);_.transformation=f,_.localOrigin=x,h.push(_)}return g&&this.logger.warn("Normals have been automatically flipped to be consistent with the counter clock wise face winding order. It is better to generate mesh geometries that have consistent normals."),{geometries:h,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}_validateVertexSpace(e){const{_context:{graphicsCoreOwner:{view:{state:{viewingMode:t}}}}}=this,{vertexSpace:r}=e;return t!==re.Local||"local"!==r.type||(this.logger.warn("Displaying a mesh with a local vertex space in a view in local viewing mode is not supported."),!1)}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class Ie{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}function Se(e,t){return t.faces??F(e.vertexAttributes.position.length/3)}function Ue(e,t,r,o){switch(r.shading||"flat"){default:case"source":return Fe(e,t,r,o);case"flat":return Be(e,o);case"smooth":return De(e,o)}}function Be(e,t){const r=U(t.length),o=new Array(3*t.length);for(let n=0;n<t.length;n+=3){const a=Le(e,t,n,rt);for(let e=0;e<3;e++)r[n+e]=a[e],o[n+e]=n/3}return new Ie(r,o,!1)}function Fe(e,t,r,o){if(null==t)return Be(e,o);let n=!1;if(!r.trustSourceNormals)for(let a=0;a<o.length;a+=3){Le(e,o,a,rt);for(let e=0;e<3;e++){const r=3*o[a+e];Ze[0]=t[r],Ze[1]=t[r+1],Ze[2]=t[r+2],b(rt,Ze)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],n=!0)}}return new Ie(t,o,n)}function De(e,t){const r={};for(let a=0;a<t.length;a+=3){const o=Le(e,t,a,rt);for(let e=0;e<3;e++){const n=t[a+e];let s=r[n];s||(s={normal:M(),count:0},r[n]=s),h(s.normal,s.normal,o),s.count++}}const o=U(3*t.length),n=new Array(3*t.length);for(let a=0;a<t.length;a++){const e=r[t[a]];1!==e.count&&(_(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*a+t]=e.normal[t];n[a]=a}return new Ie(o,n,!1)}function Ge(e,t,r,o,n,a){const s=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[s],o[1]=e[s+1],o[2]=e[s+2],n[0]=e[i],n[1]=e[i+1],n[2]=e[i+2],a[0]=e[l],a[1]=e[l+1],a[2]=e[l+2]}function Le(e,t,r,o){return Ge(e,t,r,Ze,et,tt),y(et,et,Ze),y(tt,tt,Ze),v(Ze,et,tt),_(o,Ze),o}function Ve(e){return e.components??st}function $e(e){if(!e)return null;const{scale:r,offset:o,rotation:n}=e;return{scale:r,offset:o,rotation:t(n)}}function He(e="repeat"){if("string"==typeof e){const t=ke(e);return{s:t,t}}return{s:ke(e.horizontal),t:ke(e.vertical)}}function ke(e){switch(e){case"clamp":return Ee.CLAMP_TO_EDGE;case"mirror":return Ee.MIRRORED_REPEAT;default:return Ee.REPEAT}}function qe(e){const t=e.vertexAttributes.color;if(null==t)return!1;for(let r=3;r<t.length;r+=4)if(255!==t[r])return!0;return!1}function ze(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}function We(e){return e.data??e.url}function Ye(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}function Je(e){const{offset:t,scale:r,rotation:o}=e??Qe;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}function Ke(e){return e.vertexAttributes.color}const Qe=new L,Xe=M(),Ze=M(),et=M(),tt=M(),rt=M(),ot=c(),nt=c(),at=O(),st=[new D];var it;!function(e){e[e.NONE=0]="NONE",e[e.RENDER=1]="RENDER"}(it||(it={}));export{Ne as Graphics3DMeshFillSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,h as t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{g as d}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as h}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.
|
|
5
|
+
import{c as e,h as t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{g as d}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as h}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=i}}class p{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,i,s,a,n,r,o=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=i,this._uniqueMaterials=s,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const t=e.stage;t.addMany(this._uniqueMaterials),t.addMany(this._uniqueGeometries),t.add(this.stageObject)}destroy(){if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1),e.renderer.edgeView?.removeObject(this.stageObject),this.stageObject.dispose(),this._sharedResource?.release(),this._visible=!1,this._stageLayer=null}layerOpacityChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;if(null==s)return;const n=v(s.baseMaterial);s.edgeMaterial.objectTransparency!==n&&(s.edgeMaterial.objectTransparency=n,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView((t=>t.updateAllComponentOpacities(i,[e])))}slicePlaneEnabledChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;null!=s&&a.stage.renderer.withEdgeView((a=>{a.updateAllComponentMaterials(i,s.edgeMaterial,e,!t),s.hasSlicePlane=e}))}setVisibility(e){const{_edgeState:t,stageObject:i,_stageLayer:s}=this;null!=s&&this.visible!==e&&(this._visible=e,i.visible=e,e&&!this._addedToStage&&(s.add(i),this._addedToStage=!0),null!=t&&s.stage.renderer.withEdgeView((s=>{s.hasObject(i)?s.updateObjectVisibility(i,e):e&&this._addOrUpdateEdgeObject(t,s,!1)})))}get visible(){return this._visible}alignWithElevation(e,t,i,s){if(null==this.elevationAligner)return;null!=i&&u(this.elevationContext.featureExpressionInfoContext,i);const a=(i,s)=>h(i,e,this.elevationContext,t,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,a,t),this.resetEdgeObject(s)}alignWithAbsoluteElevation(e,t,i){const s=(t,i)=>{i.sampledElevation=e,i.verticalDistanceToGround=0,i.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,s,t),this.resetEdgeObject(i)}getCenterObjectSpace(t=s()){return e(t,d(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=r()){const t=this.stageObject.boundingVolumeObjectSpace;return a(e,t.min),n(e,t.max),e}computeAttachmentOrigin(e){const s=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=s[12],e.render.origin[1]+=s[13],e.render.origin[2]+=s[14],e.render.num++;else for(const a of this.stageObject.geometries)a.computeAttachmentOrigin(y)&&(t(y,y,s),i(e.render.origin,e.render.origin,y),e.render.num++)}async getProjectedBoundingBox(e,i,s,a,n){const r=this.getBoundingBoxObjectSpace(n),d=S,h=o(r)?1:d.length;for(let o=0;o<h;o++){const e=d[o];f[0]=r[e[0]],f[1]=r[e[1]],f[2]=r[e[2]],t(f,f,this.stageObject.transformation),_[3*o]=f[0],_[3*o+1]=f[1],_[3*o+2]=f[2]}if(!e(_,0,h))return null;l(r);let u=null;this.calculateRelativeScreenBounds&&(u=this.calculateRelativeScreenBounds());for(let t=0;t<3*h;t+=3){for(let e=0;e<3;e++)r[e]=Math.min(r[e],_[t+e]),r[e+3]=Math.max(r[e+3],_[t+e]);u&&s.push({location:_.slice(t,t+3),screenSpaceBoundingRect:u})}if(i?.service&&"absolute-height"!==this.elevationContext.mode){c(r,y);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let t=0;if(i.useViewElevation)t=i.service.getElevation(y[0],y[1],e)??0;else try{const s=b(r,i.service.spatialReference,i);t=await i.service.queryElevation(y[0],y[1],a,s,e)??0}catch(m){}g(r,0,0,-this.alignedSampledElevation+t)}return r}addObjectState(e,t){e===m.Highlight&&t.addObject(this.stageObject,this.stageObject.highlight()),e===m.MaskOccludee&&t.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeObject(this.stageObject)}resetEdgeObject(e){const{_edgeState:t,stageObject:i,_stageLayer:s,_visible:a}=this;null!=t&&s.stage.renderer.withEdgeView((s=>{a?this._addOrUpdateEdgeObject(t,s,e):s.removeObject(i)}))}_addOrUpdateEdgeObject(e,t,i){const s=v(e.baseMaterial);e.edgeMaterial.objectTransparency=s,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!i).then((()=>this._stageLayer?.sync()))}}function v(e){return e.parameters.transparent?O.TRANSPARENT:O.OPAQUE}const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=s(),y=s(),S=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{p as Graphics3DObject3DGraphicLayer,j as Object3DEdgeState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as h}from"../support/FastSymbolUpdates.js";const u=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=u(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.complexity=this.computeComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&u().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):u().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(u().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(u().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return u().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&u().warnOncePerTick("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return g}_defaultElevationInfoZ(){return m}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as h}from"../support/FastSymbolUpdates.js";const u=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=u(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.complexity=this.computeComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&u().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):u().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(u().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(u().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return u().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&u().warnOncePerTick("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return g}_defaultElevationInfoZ(){return m}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){const i=this.draped?1:this._getLayerOpacity();return this._drivenProperties.opacity?i:e?i*e.a:t.hasIntrinsicColor?i:0}_getCombinedOpacityAndColor(t,r=v){const o=this._getCombinedOpacity(t,r);if(this._drivenProperties.color)return p(null,o);const n=null!=t?e.toUnitRGB(t):i;return p(n,o)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,o=p(i,r);return t&&(o[0]*=t,o[1]*=t,o[2]*=t,o[3]*=t),o}isFastUpdatesEnabled(){return null!=this._fastUpdates}computeComplexity(){return n(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==s.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let r=s.UPDATE;return e.forEach((e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=i(o.elevationContext.mode)}else r=s.RECREATE})),r}applyRendererDiff(e,t){return c.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?h(t.size.field,e):0,o=t.color?h(t.color.field,e):0,n=t.opacity?h(t.opacity.field,e):0;return r(i,o,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&u().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function f(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const r=e.stops[i].color;r&&(t.opacity=!0,r.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const g={mode:"on-the-ground",offset:0,unit:"meters"},m={mode:"absolute-height",offset:0,unit:"meters"},v={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as m,expandWithAABB as
|
|
5
|
+
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as m,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{create as p,empty as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as y,doubleSubArray as f}from"../../../../geometry/support/DoubleArray.js";import{perVertexElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as v,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as w,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{WaterMaterialParameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=["polyline","polygon","extent"];class B extends j{constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}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,I,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?U(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=v(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layer.uid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),c=new D(this,l,a.outGeometries,null,null,_,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:l}of t){if(null!=this._context.clippingExtent&&(c(k),h(k,a),!m(k,this._context.clippingExtent)))continue;const t=r(a,l,3);if(0===t.length)continue;const u=f(o,2*n,2*i),p=w({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:u}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new H(r,i,this._context.layer.uid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=c(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new C(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(c(k),h(k,i),!m(k,this._context.clippingExtent))continue;u(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const l=f(t,2*s,2*a),p=w({material:this._materials[0],indices:o,attributeData:{position:i,uv0:l}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function U(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);d(z);for(let t=0;t<i;t++)o(V,r[3*t],r[3*t+1]),g(z,V);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;W[0]=z[0]-l,W[1]=z[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-W[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-W[1])/B.unitSizeOfTexture}B.unitSizeOfTexture=100,B.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE};const W=n(),z=p(),V=n(),k=l();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,U as headingVectorFromAngle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{removeUnordered as t}from"../../../../core/arrayUtils.js";import{makeHandle as e}from"../../../../core/handleUtils.js";import{ForAllFeaturesReturnType as i}from"../II3SMeshView3D.js";class s{constructor(){this.ids=new Set}}class h{constructor({collection:t,forAllFeatures:e,forAllFeaturesOfNode:i}){this._highlights=
|
|
5
|
+
import{removeUnordered as t}from"../../../../core/arrayUtils.js";import{makeHandle as e}from"../../../../core/handleUtils.js";import{ForAllFeaturesReturnType as i}from"../II3SMeshView3D.js";class s{constructor(){this.ids=new Set}}class h{constructor({collection:t,forAllFeatures:e,forAllFeaturesOfNode:i}){this._highlights=new Map,this._collection=t,this._forAllFeatures=e,this._forAllFeaturesOfNode=i}destroy(){this._highlights.forEach((t=>t.forEach((t=>this._releaseSet(t))))),this._highlights=null}acquireSet(i){const h=new s;let l=this._highlights.get(i);l||(l=[],this._highlights.set(i,l)),l.push(h);const o=e((()=>{if(!this._highlights)return;const e=this._highlights.get(i);e&&(this._releaseSet(h),t(e,h))}));return{set:h,handle:o}}setFeatureIds(t,e,i){e.forEach((e=>t.ids.add(e))),this._initializeSet(t,i)}_initializeSet(t,e){this._forAllFeatures(((s,h,l)=>(t.ids.has(s)&&this._collection.addComponentHighlight(l.objectHandle,h,e),i.CONTINUE)))}_releaseSet(t){this._forAllFeatures(((e,s,h)=>(t.ids.has(e)&&this._collection.removeComponentHighlight(h.objectHandle,s),i.CONTINUE)))}objectCreated(t){this._highlights.forEach(((e,s)=>{e.forEach((e=>{this._forAllFeaturesOfNode(t,((h,l)=>(e.ids.has(h)&&this._collection.addComponentHighlight(t.objectHandle,l,s),i.CONTINUE)))}))}))}objectDeleted(t){this._collection.clearHighlights(t.objectHandle)}}export{h as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,j as a,k as l,m as h,q as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as w}from"./PointHighlights.js";import{isDepth as R,ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as j}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as q}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as O,StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as I}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as v}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as F}from"../../webgl-engine/lib/VertexAttribute.js";import{P as
|
|
5
|
+
import{_ as e}from"../../../../chunks/tslib.es6.js";import{disposeMaybe as s}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{f as n,l as o,j as a,k as l,m as h,q as c}from"../../../../chunks/vec32.js";import{create as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as u}from"../../../../chunks/vec42.js";import{create as m,offset as p,contains as g,containsPoint as _,set as f,positiveInfinity as P,equals as b}from"../../../../geometry/support/aaBoundingBox.js";import{create as S}from"../../../../geometry/support/plane.js";import{fromPoints as x}from"../../../../geometry/support/ray.js";import{PclTarget as z}from"./Intersector.js";import{PointHighlights as w}from"./PointHighlights.js";import{isDepth as R,ShaderOutput as A}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{SyncPrepareRenderPlugin as j}from"../../webgl-engine/effects/RenderPlugin.js";import{Default3D as q}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as O,StoreResults as E}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as I}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as v}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as F}from"../../webgl-engine/lib/VertexAttribute.js";import{P as L,a as N,g as C}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as T}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as H}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as M}from"../../../webgl/BufferObject.js";import{DataType as B,PrimitiveType as D,Usage as U}from"../../../webgl/enums.js";import{VertexElementDescriptor as V}from"../../../webgl/VertexElementDescriptor.js";const W={positions:[new V(F.POSITION,3,B.FLOAT,0,12)],colors:[new V(F.COLOR,3,B.UNSIGNED_BYTE,0,3,!0)]};let k=class extends j{constructor(e){super(e),this.type=O.PCL,this.isGround=!1,this._passParameters=new L,this._highlights=new w({forEachNode:e=>this.forEachNode(e),addHighlight:(e,s,t)=>this._addHighlight(e,s,t),removeHighlight:(e,s)=>this._removeHighlight(e,s)}),this.produces=new Map([[I.OPAQUE_MATERIAL,e=>!(R(e)||e===A.Highlight&&this._highlights.empty)],[I.OPAQUE_NO_SSAO_DEPTH,e=>R(e)]]),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new H,this._nodes=new t}initializeRenderContext(e){this._context=e,e.requestRender()}uninitializeRenderContext(){}intersect(e,s,t,i){const r=d(),f=d(),P=d(),b=d(),w=S(),R=e.camera.perScreenPixelRatio/2,A=e.camera.near;n(f,i,t);const j=1/o(f);a(f,f,j),l(P,f),u(w,f[0],f[1],f[2],-h(f,t));const q=new ee,O=new ee,I=new Array,v=m(),F=m(this._passParameters.clipBox);p(F,-t[0],-t[1],-t[2],F),this._nodes.forAll((o=>{const a=o.splatSize*this._passParameters.scaleFactor;let l=o.obb.minimumDistancePlane(w),d=o.obb.maximumDistancePlane(w);l-=J(a,l+A,this._passParameters,R,o.isLeaf),d-=J(a,d+A,this._passParameters,R,o.isLeaf);const u=d<0,m=null!=q.dist&&null!=O.dist&&q.dist<l*j&&O.dist>d*j;if(u||m)return;const S=Y(a,d+A,this._passParameters,R,o.isLeaf);if(!o.obb.intersectRay(t,f,S))return;const x=S*S;o.obb.toAaBoundingBox(v),p(v,-t[0],-t[1],-t[2],v);const z=!g(F,v);n(b,o.origin,t);const y=o.coordinates.length/3;for(let n=0;n<y;n++){if(r[0]=b[0]+o.coordinates[3*n],r[1]=b[1]+o.coordinates[3*n+1],r[2]=b[2]+o.coordinates[3*n+2],z&&!_(F,r))continue;const l=h(r,f),d=c(r)-l*l;if(d>x)continue;let u=l+A;const m=J(a,u,this._passParameters,R,o.isLeaf);if(l-m<0)continue;u-=m;const p=Y(a,u,this._passParameters,R,o.isLeaf);if(d>p*p)continue;const g=(l-m)*j,S=e=>(e.point=K(o,n,e.point),e.dist=g,e.normal=P,e.node=o,e.pointId=n,e.layerUid=this.layerUid,e);if((null==q.dist||g<q.dist)&&(null==s||s(t,i,g))&&S(q),e.options.store!==E.MIN&&(null==O.dist||g>O.dist)&&(null==s||s(t,i,g))&&S(O),e.options.store===E.ALL&&(null==s||s(t,i,g))){const e=new ee;I.push(S(e))}}}));const L=e=>{const{layerUid:s,node:t,pointId:i}=e;return new z(e.point,s,i,(()=>this.createGraphic(t,i,e.point)))},N=(e,s)=>{const t=L(s);e.set(this.type,t,s.dist,s.normal)};if(se(q)){const s=e.results.min;(null==s.dist||q.dist<s.dist)&&N(s,q)}if(se(O)&&e.options.store!==E.MIN){const s=e.results.max;(null==s.dist||O.dist>s.dist)&&N(s,O)}if(e.options.store===E.ALL){const s=x(t,i);for(const t of I){const i=y(s);N(i,t),e.results.all.push(i)}}}prepareTechnique(e){return 0!==this._nodes.length&&(e.output===A.Color||R(e.output)&&e.bindParameters.slot===I.OPAQUE_NO_SSAO_DEPTH||e.output===A.Highlight)?(this._nodes.forAll((s=>{null==s.vao&&this._initNode(e,s)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output,this._context.techniques.releaseAndAcquire(T,this._techniqueConfig,this._technique)):null}renderNode(e,s){const t=e.rctx,i=t.bindTechnique(s,e.bindParameters,this._passParameters),r=e.output===A.Highlight;this._nodes.forAll((s=>{0!==s.coordinates.length&&(!r||s.highlights&&0===e.bindParameters.highlightLevel)&&(i.bindDraw(s,e.bindParameters,this._passParameters),t.bindVAO(s.vao),r?this._renderHighlightFragments(t,s):t.drawArrays(D.POINTS,0,s.coordinates.length/3))}))}_renderHighlightFragments(e,s){const t=s.highlights;if(null==t)return;let i=t[0].component,r=i+1;for(let o=1;o<t.length;o++){const s=t[o].component;if(s!==r){const t=r-i;t>0&&e.drawArrays(D.POINTS,i,t),i=s}r=s+1}const n=r-i;n>0&&e.drawArrays(D.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){f(this._passParameters.clipBox,e||P)}get _clippingEnabled(){return!b(this._passParameters.clipBox,P,((e,s)=>e===s))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(e){let t=null;return this._nodes.filterInPlace((i=>i.id!==e||(t=i,i.vao=s(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),t}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((e=>e.vao=s(e.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,s,t){e.highlights=Z(e.highlights,s,t),this._requestRender()}_removeHighlight(e,s){e.highlights=$(e.highlights,s),this._requestRender()}_initNode(e,s){const t=e.rctx;s.vao=new v(t,q,W,{positions:M.createVertex(t,U.STATIC_DRAW,s.coordinates),colors:M.createVertex(t,U.STATIC_DRAW,s.rgb)})}_requestRender(){this._context&&this._context.requestRender()}};e([i({constructOnly:!0})],k.prototype,"createGraphic",void 0),k=e([r("esri.views.3d.layers.i3s.PointRenderer")],k);class G extends N{constructor(e,s,t,i,r,n,o,a,l=null,h=null){super(t,r,s),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=l,this.highlights=h}}function Q(e){return e.hasOwnProperty("splatSize")}function Y(e,s,t,i,r){if(t.drawScreenSpace)return t.fixedSize*s*i;const n=C(r)*s*i;return t.useFixedSizes?Math.min(t.fixedSize/2,n):t.screenMinSize>0?Math.min(Math.max(t.screenMinSize*s*i,e/2),n):Math.min(e/2,n)}function J(e,s,t,i,r){return t.drawScreenSpace?0:Y(e,s,t,i,r)}function K(e,s,t){return null==t&&(t=d()),t[0]=e.origin[0]+e.coordinates[3*s],t[1]=e.origin[1]+e.coordinates[3*s+1],t[2]=e.origin[2]+e.coordinates[3*s+2],t}function X(e){return null!=e.component?e.component:-1}function Z(e,s,t){null==e&&(e=[]);const i={component:s,id:t};e.push(i);const r=X(i);let n=e.length-1;for(;n>0&&r<X(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function $(e,s){if(null==e)return e;const t=e.filter((e=>e.id!==s));return 0===t.length?null:t}class ee{constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function se(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{k as PointRenderer,G as PointRendererNode,Q as isPointRendererNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../chunks/tslib.es6.js";import s from"../../../Color.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultShadowColor as
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import s from"../../../Color.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{HighlightOptionsBase as e}from"./HighlightOptionsBase.js";import{defaultShadowColor as i,defaultShadowOpacity as p,defaultShadowDifference as a}from"../../support/HighlightDefaults.js";let h=class extends e{constructor(){super(...arguments),this.shadowColor=i.clone(),this.shadowOpacity=p,this.shadowDifference=a}equals(o){return super.equals(o)&&this.shadowColor===o.shadowColor&&this.shadowOpacity===o.shadowOpacity&&this.shadowColor.equals(o.shadowColor)}};o([r({type:s})],h.prototype,"shadowColor",void 0),o([r()],h.prototype,"shadowOpacity",void 0),o([r()],h.prototype,"shadowDifference",void 0),h=o([t("esri.views.3d.support.HighlightOptions")],h);const c=h;export{c as default};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{_ as o}from"../../../chunks/tslib.es6.js";import r from"../../../Color.js";import t from"../../../core/Accessor.js";import{property as s}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as i}from"../../../core/accessorSupport/decorators/subclass.js";import{defaultColor as p,defaultHaloOpacity as l,defaultFillOpacity as e}from"../../support/HighlightDefaults.js";let c=class extends t{constructor(){super(...arguments),this.color=p.clone(),this.haloColor=null,this.haloOpacity=l,this.fillOpacity=e}equals(o){return this.color.equals(o.color)&&(this.haloColor?.equals(o.haloColor)??!0)&&this.haloOpacity===o.haloOpacity&&this.fillOpacity===o.fillOpacity}};o([s({type:r})],c.prototype,"color",void 0),o([s({type:r})],c.prototype,"haloColor",void 0),o([s()],c.prototype,"haloOpacity",void 0),o([s()],c.prototype,"fillOpacity",void 0),c=o([i("esri.views.3d.support.HighlightOptionsBase")],c);export{c as HighlightOptionsBase};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../core/has.js";import{OverlayContent as r}from"./OverlayContent.js";import{OverlayFramebufferObject as e}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";class a{constructor(r,t,a,s,l=o.RGBA_MIPMAP){this.output=a,this.content=s,this.fbo=new e(r,l,t)}get valid(){return this.fbo.valid}}class s{constructor(e){this.targets=[new a(e,"overlay color",t.Color,r.Color),new a(e,"overlay IM color",t.Color,r.ColorNoRasterImage),new a(e,"overlay highlight",t.Highlight,r.Highlight,o.
|
|
5
|
+
import has from"../../../core/has.js";import{OverlayContent as r}from"./OverlayContent.js";import{OverlayFramebufferObject as e}from"./OverlayFramebufferObject.js";import{ColorFormat as o}from"../webgl/formats.js";import{ShaderOutput as t}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";class a{constructor(r,t,a,s,l=o.RGBA_MIPMAP){this.output=a,this.content=s,this.fbo=new e(r,l,t)}get valid(){return this.fbo.valid}}class s{constructor(e){this.targets=[new a(e,"overlay color",t.Color,r.Color),new a(e,"overlay IM color",t.Color,r.ColorNoRasterImage),new a(e,"overlay highlight",t.Highlight,r.Highlight,o.RGBA),new a(e,"overlay water",t.Normal,r.WaterNormal),new a(e,"overlay occluded",t.Color,r.Occluded)],has("enable-feature:objectAndLayerId-rendering")&&this.targets.push(new a(e,"overlay oid",t.ObjectAndLayerIdColor,r.ObjectAndLayerIdColor))}getTexture(r){return this.targets[r]?.fbo.texture}dispose(){for(const r of this.targets)r.fbo.dispose()}computeValidity(){return this.targets.reduce(((r,e,o)=>e.valid?r|=1<<o:r),0)}}export{s as OverlayRenderTargets,a as RenderTargetDescriptor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as P}from"./OverlayRenderer.js";import{PatchRenderData as v}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as C,sortTiles as N,compareTiles as j}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as F}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as G}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as q}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as L,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ne}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as oe}from"../../webgl/enums.js";const le=7,ce=10,de=m();let he=class extends L{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new ae,this._passParameters=new G,this._drawParameters=new se,this._renderDataPool=new s(v),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new C,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()],[$.TRANSPARENT_TERRAIN,()=>this._produces()],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?P:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.updateTileTexture(e,A.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ce-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=ue,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,T=_&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,x=new J(!1,R),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;b(de,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(de));const w=de;if(fe[0]=i[0]-v[0],fe[1]=i[1]-v[1],fe[2]=i[2]-v[2],!K(w,fe,n,g,T))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),T=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(O.backfacesTerrain||u(d,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),O.isFiltered)return;O.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),O.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=pe;d(E,r,v);const{indices:A,indexCount:C}=P,N=P.vertexAttributes,j=N.getField(te.POSITION,y),B=new z(j.typedBuffer,3,N.stride/4),F=C/3;if(!p&&F>I){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(A,0,F,B)),e.intersectionData.intersectRay(fe,E,x,S)}else Z(fe,E,0,F,A,B,p,x,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,T)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&P))return null}else{const t=this.transparency===B.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===B.Empty)return null;switch(e.output){case F.Color:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(F.Color,e.bindParameters.slot===$.OCCLUDED_TERRAIN);case F.Shadow:case F.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Shadow,!1)):null;case F.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.ViewshedShadow,!1)):null;case F.Depth:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Depth,!1);case F.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Normal,!1);case F.ObjectAndLayerIdColor:return this._updateTechnique(F.ObjectAndLayerIdColor,!1);case F.Highlight:return this._overlayRenderer.hasHighlights?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case F.Color:{const i=e.bindParameters.slot===$.OCCLUDED_TERRAIN?x.Occluded:x.Color;this._renderMaterialPass(e,t,i);break}case F.Depth:case F.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case F.Highlight:this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break;case F.Shadow:case F.ShadowExcludeHighlight:case F.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case F.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?q.GridComposite:null!=i.backgroundColor?q.ColorComposite:q.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==w.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>j(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],oe.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===x.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",g));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===q.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;t.program.bindDraw(new se(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ne,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],he.prototype,"_isGlobal",null),e([o()],he.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],he.prototype,"renderingDisabled",null),e([o({value:!0})],he.prototype,"visible",null),e([o()],he.prototype,"renderPatchBorders",null),e([o()],he.prototype,"visualizeNormals",null),e([o()],he.prototype,"cullBackFaces",null),e([o({value:w.FRONT_TO_BACK})],he.prototype,"renderOrder",null),e([o()],he.prototype,"wireframe",null),he=e([l("esri.views.3d.terrain.TerrainRenderer")],he);const ue=p(),_e=p(),fe=p(),pe=p();export{he as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as P}from"./OverlayRenderer.js";import{PatchRenderData as v}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as C,sortTiles as N,compareTiles as j}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as F}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as q,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ne}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as oe}from"../../webgl/enums.js";const le=7,ce=10,de=m();let he=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new ae,this._passParameters=new L,this._drawParameters=new se,this._renderDataPool=new s(v),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new C,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()],[$.TRANSPARENT_TERRAIN,()=>this._produces()],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?P:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.updateTileTexture(e,A.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ce-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=ue,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,T=_&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,x=new J(!1,R),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;b(de,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(de));const w=de;if(fe[0]=i[0]-v[0],fe[1]=i[1]-v[1],fe[2]=i[2]-v[2],!K(w,fe,n,g,T))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),T=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(O.backfacesTerrain||u(d,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),O.isFiltered)return;O.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),O.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=pe;d(E,r,v);const{indices:A,indexCount:C}=P,N=P.vertexAttributes,j=N.getField(te.POSITION,y),B=new z(j.typedBuffer,3,N.stride/4),F=C/3;if(!p&&F>I){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(A,0,F,B)),e.intersectionData.intersectRay(fe,E,x,S)}else Z(fe,E,0,F,A,B,p,x,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,T)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&P))return null}else{const t=this.transparency===B.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===B.Empty)return null;switch(e.output){case F.Color:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(F.Color,e.bindParameters.slot===$.OCCLUDED_TERRAIN);case F.Shadow:case F.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Shadow,!1)):null;case F.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.ViewshedShadow,!1)):null;case F.Depth:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Depth,!1);case F.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Normal,!1);case F.ObjectAndLayerIdColor:return this._updateTechnique(F.ObjectAndLayerIdColor,!1);case F.Highlight:return this._overlayRenderer.hasHighlights&&0===e.bindParameters.highlightLevel?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case F.Color:{const i=e.bindParameters.slot===$.OCCLUDED_TERRAIN?x.Occluded:x.Color;this._renderMaterialPass(e,t,i);break}case F.Depth:case F.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case F.Highlight:0===e.bindParameters.highlightLevel&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break;case F.Shadow:case F.ShadowExcludeHighlight:case F.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case F.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==w.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>j(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],oe.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===x.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",g));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;t.program.bindDraw(new se(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ne,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],he.prototype,"_isGlobal",null),e([o()],he.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],he.prototype,"renderingDisabled",null),e([o({value:!0})],he.prototype,"visible",null),e([o()],he.prototype,"renderPatchBorders",null),e([o()],he.prototype,"visualizeNormals",null),e([o()],he.prototype,"cullBackFaces",null),e([o({value:w.FRONT_TO_BACK})],he.prototype,"renderOrder",null),e([o()],he.prototype,"wireframe",null),he=e([l("esri.views.3d.terrain.TerrainRenderer")],he);const ue=p(),_e=p(),fe=p(),pe=p();export{he as TerrainRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ComponentRangeRunLengthEncoded as t}from"./IndexRange/ComponentRangeRunLengthEncoded.js";class e{constructor(e,h){this.offsets=h,this.pickability=null,this.highlightCounts=null,this.verticalOffsets=null,this.cachedGeometryRanges=null,this.
|
|
5
|
+
import{ComponentRangeRunLengthEncoded as t}from"./IndexRange/ComponentRangeRunLengthEncoded.js";class e{constructor(e,h){this.offsets=h,this.pickability=null,this.highlightCounts=null,this.highlightGroups=null,this.verticalOffsets=null,this.cachedGeometryRanges=null,this.cachedHighlightRangesMap=null,this.cachedDefaultRanges=null;const i=this.count;this.visibility=new t(i),this.materialDataBuffer=e.getBuffer(i),this.materialDataIndices=new Uint16Array(i);for(let t=0;t<i;t++)this.materialDataIndices[t]=this.materialDataBuffer.acquireIndex()}destroy(){for(let t=0;t<this.count;t++)this.materialDataBuffer.releaseIndex(this.materialDataIndices[t])}get count(){return this.offsets.length-1}get geometryRanges(){return null==this.cachedGeometryRanges&&(this.cachedGeometryRanges=this.visibility.computeOffsetRanges(this.offsets)),this.cachedGeometryRanges}get highlightRanges(){return null==this.highlightCounts?null:(this._updateCachedHighlightRanges(),this.cachedHighlightRangesMap)}get defaultShadowMapRanges(){return null==this.highlightCounts?this.geometryRanges:(this._updateCachedHighlightRanges(),this.cachedDefaultRanges)}highlightsDirty(){this.cachedHighlightRangesMap=null,this.cachedDefaultRanges=null}visibilityDirty(){this.cachedGeometryRanges=null,this.highlightsDirty()}_updateCachedHighlightRanges(){if((null==this.cachedHighlightRangesMap||null==this.cachedDefaultRanges)&&null!=this.highlightCounts&&null!=this.highlightGroups){const{highlightRangesMap:t,defaultRanges:e}=h(this.highlightCounts,this.highlightGroups,this.visibility,this.offsets);this.cachedHighlightRangesMap=t,this.cachedDefaultRanges=e}}}function h(t,e,h,i){const s=new Map,a=[];let n=i.length;return h.forEachComponent((h=>{if(t[h]>0){const t=e[h];let a=s.get(t);void 0===a&&(a=[],s.set(t,a));const n=i[h],l=i[h+1];a.push(n),a.push(l-n)}else n!==h-1&&(a.length&&a.push(i[n+1]-a[a.length-1]),a.push(i[h])),n=h;return!0})),a.length&&a.push(i[n+1]-a[a.length-1]),{highlightRangesMap:s,defaultRanges:a}}export{e as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isArray as o}from"../../../../../core/typedArrayUtil.js";import{a as n}from"../../../../../chunks/vec32.js";import{clone as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as s}from"../../../../../geometry/support/Indices.js";import{c as a}from"../../../../../chunks/vec3.js";import{c as l}from"../../../../../chunks/vec33.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{ColorMixModeEnum as m,encodeSymbolColor as h}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as f}from"../../../support/orientedBoundingBox.js";import{glLayout as p}from"../../../support/buffer/glUtil.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import d from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{Renderable as y}from"./Renderable.js";import{RenderGeometry as C}from"./RenderGeometry.js";import{RenderSubmitSystem as v}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as _}from"./SourceGeometry.js";import{UniformComponentParameters as j}from"./UniformComponentParameters.js";import{ComponentParametersVarying as M,ComponentParametersUniform as x,ComponentParameterSummary as w,ComponentMaterial as O}from"./Material/ComponentMaterial.js";import{attributeLocations as A}from"./Material/ComponentTechnique.js";import{encodeElevationOffset as R}from"./Material/shader/ComponentData.glsl.js";import{getVisibility as D,updateVisibilityWithCount as I}from"../../lib/ComponentUtils.js";import{assert as S}from"../../lib/Util.js";import{VertexAttribute as E}from"../../lib/VertexAttribute.js";import{getVerticalOffsetI3S as V}from"../../lib/verticalOffsetUtils.js";import{BufferManager as B}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as P}from"../../../../webgl/BufferObject.js";import{Usage as L,PrimitiveType as N}from"../../../../webgl/enums.js";import{VertexArrayObject as U}from"../../../../webgl/VertexArrayObject.js";const T=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class G{constructor(e,o){this._renderManager=e,this._viewingMode=o,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._visible=new t,this._hidden=new t,this._renderSubmit=new v(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=has("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new B(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){S(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._visible.forAll((e=>e.destroy())),this._hidden.forAll((e=>e.destroy())),this._visible.clear(),this._hidden.clear()}createObject(e){const t=e.geometry,o=new d(this._componentBufferManager,s(t.componentOffsets)),n=this._createRenderable(e,o),i=new b(this._viewingMode,t.positionData,o),r=new g(e.transform,e.toMapSpace,e.obb.clone(),o,n,i);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(t?(this._hidden.removeUnordered(o),this._visible.push(o)):(this._visible.removeUnordered(o),this._hidden.push(o)),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center)))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount;return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,n=o.renderable.material,i=o.components,r=i.materialDataBuffer,s=i.materialDataIndices,a=new j,l=r.textureBuffer,c=new Uint8Array(4),p=new Uint32Array(c.buffer);let u=0,d=0,g=0,b=i.verticalOffsets,y=1/0,C=-1/0,v=!1,_=!1,O=0;for(let f=0;f<i.count;f++){t(f,a),u+=+(a.externalColor[3]<1),d+=+(a.externalColorMixMode===m.Replace&&1===a.externalColor[3]),g+=+a.castShadows,h(a.externalColor,a.externalColorMixMode,c),c[2]=254&c[2]|+a.castShadows,l.setData(s[f],0,c[0],c[1],c[2],c[3]),v||=f>0&&O!==p[0],O=p[0],_||=0!==a.elevationOffset,_&&null==b&&(b=new Array(f).fill(0)),null!=b&&(b[f]=a.elevationOffset),y=Math.min(y,a.elevationOffset),C=Math.max(C,a.elevationOffset),R(a.elevationOffset,c),l.setData(s[f],1,c[0],c[1],c[2],c[3]);const e=a.objectAndLayerIdColor;null!=e&&l.setData(s[f],2,e[0],e[1],e[2],e[3]),a.pickable!==D(i.pickability,f)&&(i.pickability=I(i.pickability,i.count,f,a.pickable))}i.verticalOffsets=_?b:null,o.offsetObb=_?f(o.obb,y,C,this._viewingMode,o.offsetObb??o.obb.clone()):null,v||_||this._hasObjectAndLayerId?(n.componentParameters=new M,n.componentParameters.castShadows=q(g,i.count),n.componentParameters.transparent=q(u,i.count),n.componentParameters.opaqueOverride=q(d,i.count),n.componentParameters.texture=l,l.updateTexture()):(n.componentParameters=new x,n.componentParameters.castShadows=a.castShadows?w.All:w.None,n.componentParameters.externalColor=a.externalColor,n.componentParameters.externalColorMixMode=a.externalColorMixMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,o,n=!1){e.intersectionGeometry.getComponentAabb(t,o);const i=e,r=i.components.verticalOffsets;if(n||null==r)return o;const s=r[t];if(this._viewingMode===c.Local||0===s)return o[2]+=s,o[5]+=s,o;const a=V(s);return a.localOrigin=i.transform.position,a.applyToAabb(o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}expandRangeWithComponentObjectElevationRange(e,t,o,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const i=e,r=i.components,s=r.count,a=r.verticalOffsets,l=i.intersectionGeometry,m=this._viewingMode===c.Local,h=l.getComponentAabbs(),f=W;let p=1/0,u=-1/0;for(let c=0;c<s;c++){const e=6*c,r=a?.[c]??0;let s=1/0,l=-1/0;if(m)s=h[e+2]+r+t,l=h[e+5]+r+t;else{if(f[0]=h[e],f[1]=h[e+1],f[2]=h[e+2],f[3]=h[e+3],f[4]=h[e+4],f[5]=h[e+5],0!==r){const e=V(r);e.localOrigin=i.transform.position,e.applyToAabb(f)}const s=Math.max(Math.abs(f[3]),Math.abs(f[0])),a=Math.max(Math.abs(f[4]),Math.abs(f[1])),l=t+f[5]+o;n.expandElevationRangeValues(t+f[2],Math.sqrt(s*s+a*a+l*l)-o)}n.expandElevationRangeValues(s,l),p=Math.min(p,s),u=Math.max(u,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=u}intersect(e,t,o,n,i,r,s){const a=e,{transform:l}=a,{position:c}=l;return null!=i&&(i.localOrigin=c),a.intersectionGeometry.intersect(t,o,n,i,a.components.verticalOffsets,l,r,s)}addEdges(e,t,o,n,i){const r=e,{indices:s,positions:a}=r.intersectionGeometry,l=r.components.offsets;return t.addComponentObject(r,a,s,l,o,n,i)}async extractEdgeInformation(e,t,o){const n=e,r=n.components.visibility;if(r.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:c}=n.intersectionGeometry,m=n.components.offsets,{EdgeInputBufferLayout:h}=await import("../../lib/edgeRendering/bufferLayouts.js"),f=h.createBuffer(c.length/3);l(f.position.typedBuffer,c,f.position.typedBufferStride,3),a(f.position,f.position,n.transform.rotationScale),this._setComponentIndices(f.componentIndex,s,m);const p=f.count,u=this._computeVisibilityIndices(s,r,m,p);return{origin:i(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:u,indicesLength:u.length,skipDeduplicate:!0,data:f,writerSettings:{reducedPrecision:!1,variants:0}},o)}}_setComponentIndices(e,t,o){let n=0;for(let i=0;i<o.length-1;i++){const r=o[i],s=o[i+1];for(let o=r;o<s;o++){const i=t?t[o]:o;e.set(i,n)}n++}}_computeVisibilityIndices(e,t,n,i){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange(((e,t)=>(r+=n[t]-n[e],!0)));const s=o(e)?new Array(r):2===e?.BYTES_PER_ELEMENT||i<=65536?new Uint16Array(r):new Uint32Array(r);let a=0;return t.forEachComponentRange(((t,o)=>{const i=n[t],r=n[o];for(let n=i;n<r;n++)s[a++]=e?e[n]:n;return!0})),s}addComponentHighlight(e,t){const o=e.components;null==o.highlightCounts&&(o.highlightCounts=new Uint32Array(o.count+1));0===o.highlightCounts[t]++&&(o.highlightsDirty(),this._notifyDirty()),o.highlightCounts[o.count]++}removeComponentHighlight(e,t){const o=e.components;if(null==o.highlightCounts)return void T().warn("Removing non-existing highlight.");const n=o.highlightCounts[t],i=o.highlightCounts[o.count];if(0!==n){if(n>1)return o.highlightCounts[t]=n-1,void(o.highlightCounts[o.count]=i-1);o.highlightCounts[t]=0,o.highlightsDirty(),this._notifyDirty(),1===i?o.highlightCounts=null:o.highlightCounts[o.count]=i-1}else T().warn("Removing non-existing highlight.")}clearHighlights(e){const t=e.components;null!=t.highlightCounts&&(t.highlightCounts=null,t.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const o=this._renderManager.rctx,n=e.geometry,i=n.vertices.layoutParameters,r=P.createVertex(o,L.STATIC_DRAW,n.vertices.data),s=n.indices?P.createIndex(o,L.STATIC_DRAW,n.indices):null,a=p(_(i)),l=new Uint16Array(n.vertices.count);for(let p=0;p<t.count;p++){const e=t.offsets[p],o=t.offsets[p+1],i=t.materialDataIndices[p];if(null!=n.indices)for(let t=e;t<o;t++){l[n.indices[t]]=i}else for(let t=e;t<o;t++)l[t]=i}const c=P.createVertex(o,L.STATIC_DRAW,l.buffer),m=new O(e.transform,e.toMapSpace),h=new U(o,A,{data:a,componentIndices:k},{data:r,componentIndices:c},s),f=new C(h,N.TRIANGLES,i,null!=s),u={cameraDepthSquared:.5,gpuMemoryEstimate:r.usedMemory+c.usedMemory+(null!=s?s.usedMemory:0)};return new y(m,f,u)}_notifyDirty(){this._renderManager.notifyDirty()}}const k=p(u().u16(E.COMPONENTINDEX));function q(e,t){return e===t?w.All:0===e?w.None:w.Some}const W=r();export{G as ComponentObjectCollection};
|
|
5
|
+
import has from"../../../../../core/has.js";import e from"../../../../../core/Logger.js";import t from"../../../../../core/PooledArray.js";import{isArray as o}from"../../../../../core/typedArrayUtil.js";import{a as n}from"../../../../../chunks/vec32.js";import{clone as i}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as r}from"../../../../../geometry/support/aaBoundingBox.js";import{compactIndices as s}from"../../../../../geometry/support/Indices.js";import{c as a}from"../../../../../chunks/vec3.js";import{c as l}from"../../../../../chunks/vec33.js";import{ViewingMode as c}from"../../../../ViewingMode.js";import{ColorMixModeEnum as m,encodeSymbolColor as f}from"../../../layers/support/symbolColorUtils.js";import{computeOffsetObb as h}from"../../../support/orientedBoundingBox.js";import{glLayout as p}from"../../../support/buffer/glUtil.js";import{newLayout as u}from"../../../support/buffer/InterleavedLayout.js";import d from"./ComponentData.js";import{ComponentObject as g}from"./ComponentObject.js";import{IntersectionGeometry as b}from"./IntersectionGeometry.js";import{Renderable as y}from"./Renderable.js";import{RenderGeometry as v}from"./RenderGeometry.js";import{RenderSubmitSystem as C}from"./RenderSubmitSystem.js";import{createVertexBufferLayout as _}from"./SourceGeometry.js";import{UniformComponentParameters as j}from"./UniformComponentParameters.js";import{ComponentParametersVarying as M,ComponentParametersUniform as x,ComponentParameterSummary as w,ComponentMaterial as O}from"./Material/ComponentMaterial.js";import{attributeLocations as A}from"./Material/ComponentTechnique.js";import{encodeElevationOffset as R}from"./Material/shader/ComponentData.glsl.js";import{getVisibility as D,updateVisibilityWithCount as I}from"../../lib/ComponentUtils.js";import{assert as S}from"../../lib/Util.js";import{VertexAttribute as E}from"../../lib/VertexAttribute.js";import{getVerticalOffsetI3S as V}from"../../lib/verticalOffsetUtils.js";import{BufferManager as B}from"../../lib/TextureBackedBuffer/BufferManager.js";import{BufferObject as P}from"../../../../webgl/BufferObject.js";import{Usage as L,PrimitiveType as N}from"../../../../webgl/enums.js";import{VertexArrayObject as U}from"../../../../webgl/VertexArrayObject.js";const T=()=>e.getLogger("esri.views.3d.webgl-engine.collections.Component.ComponentObjectCollection");class G{constructor(e,o){this._renderManager=e,this._viewingMode=o,this._elevationRangeCacheVerticalOffset=NaN,this._elevationRangeCacheMin=NaN,this._elevationRangeCacheMax=NaN,this._visible=new t,this._hidden=new t,this._renderSubmit=new C(this),this._renderManager.register(this._renderSubmit),this._hasObjectAndLayerId=has("enable-feature:objectAndLayerId-rendering"),this._componentBufferManager=new B(e.rctx,2+(this._hasObjectAndLayerId?1:0))}destroy(){S(0===this._hidden.length&&0===this._visible.length,"ObjectCollection should be empty upon disposal"),this._componentBufferManager.destroy(),this._visible.forAll((e=>e.destroy())),this._hidden.forAll((e=>e.destroy())),this._visible.clear(),this._hidden.clear()}createObject(e){const t=e.geometry,o=new d(this._componentBufferManager,s(t.componentOffsets)),n=this._createRenderable(e,o),i=new b(this._viewingMode,t.positionData,o),r=new g(e.transform,e.toMapSpace,e.obb.clone(),o,n,i);return(r.visible?this._visible:this._hidden).push(r),r}destroyObject(e){const t=e;(t.visible?this._visible:this._hidden).removeUnordered(t),t.destroy(),this._notifyDirty()}setObjectVisibility(e,t){const o=e;t!==o.visible&&(t?(this._hidden.removeUnordered(o),this._visible.push(o)):(this._visible.removeUnordered(o),this._hidden.push(o)),o.visible=t,this._notifyDirty())}preSubmit(e){const t=e.camera.eye;this.visibleObjects.forAll((e=>e.renderable.meta.cameraDepthSquared=n(t,e.obb.center)))}getMaterial(e){return e.renderable.material}updateMaterial(e,t){const o=e.renderable.material;t(o),o.dirty&&this._notifyDirty()}setAllComponentVisibilities(e,t){const o=e;o.components.visibility.reset(t),o.components.visibilityDirty(),this._notifyDirty()}forEachVisibleComponent(e,t){return e.components.visibility.forEachComponent(t)}getComponentCount(e){const t=e,o=t.components.visibility.componentCount;return{visible:o,invisible:t.components.count-o}}setComponentData(e,t){const o=e,n=o.renderable.material,i=o.components,r=i.materialDataBuffer,s=i.materialDataIndices,a=new j,l=r.textureBuffer,c=new Uint8Array(4),p=new Uint32Array(c.buffer);let u=0,d=0,g=0,b=i.verticalOffsets,y=1/0,v=-1/0,C=!1,_=!1,O=0;for(let h=0;h<i.count;h++){t(h,a),u+=+(a.externalColor[3]<1),d+=+(a.externalColorMixMode===m.Replace&&1===a.externalColor[3]),g+=+a.castShadows,f(a.externalColor,a.externalColorMixMode,c),c[2]=254&c[2]|+a.castShadows,l.setData(s[h],0,c[0],c[1],c[2],c[3]),C||=h>0&&O!==p[0],O=p[0],_||=0!==a.elevationOffset,_&&null==b&&(b=new Array(h).fill(0)),null!=b&&(b[h]=a.elevationOffset),y=Math.min(y,a.elevationOffset),v=Math.max(v,a.elevationOffset),R(a.elevationOffset,c),l.setData(s[h],1,c[0],c[1],c[2],c[3]);const e=a.objectAndLayerIdColor;null!=e&&l.setData(s[h],2,e[0],e[1],e[2],e[3]),a.pickable!==D(i.pickability,h)&&(i.pickability=I(i.pickability,i.count,h,a.pickable))}i.verticalOffsets=_?b:null,o.offsetObb=_?h(o.obb,y,v,this._viewingMode,o.offsetObb??o.obb.clone()):null,C||_||this._hasObjectAndLayerId?(n.componentParameters=new M,n.componentParameters.castShadows=q(g,i.count),n.componentParameters.transparent=q(u,i.count),n.componentParameters.opaqueOverride=q(d,i.count),n.componentParameters.texture=l,l.updateTexture()):(n.componentParameters=new x,n.componentParameters.castShadows=a.castShadows?w.All:w.None,n.componentParameters.externalColor=a.externalColor,n.componentParameters.externalColorMixMode=a.externalColorMixMode),this._elevationRangeCacheVerticalOffset=NaN,this._notifyDirty()}getComponentAabb(e,t,o,n=!1){e.intersectionGeometry.getComponentAabb(t,o);const i=e,r=i.components.verticalOffsets;if(n||null==r)return o;const s=r[t];if(this._viewingMode===c.Local||0===s)return o[2]+=s,o[5]+=s,o;const a=V(s);return a.localOrigin=i.transform.position,a.applyToAabb(o)}getComponentObb(e){return e.obb}getObjectTransform(e){return e.transform}getComponentPositions(e,t,o){return e.intersectionGeometry.getComponentPositions(t,o)}expandRangeWithComponentObjectElevationRange(e,t,o,n){Number.isNaN(this._elevationRangeCacheVerticalOffset)||this._elevationRangeCacheVerticalOffset!==t||n.expandElevationRangeValues(this._elevationRangeCacheMin,this._elevationRangeCacheMax);const i=e,r=i.components,s=r.count,a=r.verticalOffsets,l=i.intersectionGeometry,m=this._viewingMode===c.Local,f=l.getComponentAabbs(),h=W;let p=1/0,u=-1/0;for(let c=0;c<s;c++){const e=6*c,r=a?.[c]??0;let s=1/0,l=-1/0;if(m)s=f[e+2]+r+t,l=f[e+5]+r+t;else{if(h[0]=f[e],h[1]=f[e+1],h[2]=f[e+2],h[3]=f[e+3],h[4]=f[e+4],h[5]=f[e+5],0!==r){const e=V(r);e.localOrigin=i.transform.position,e.applyToAabb(h)}const s=Math.max(Math.abs(h[3]),Math.abs(h[0])),a=Math.max(Math.abs(h[4]),Math.abs(h[1])),l=t+h[5]+o;n.expandElevationRangeValues(t+h[2],Math.sqrt(s*s+a*a+l*l)-o)}n.expandElevationRangeValues(s,l),p=Math.min(p,s),u=Math.max(u,l)}this._elevationRangeCacheVerticalOffset=t,this._elevationRangeCacheMin=p,this._elevationRangeCacheMax=u}intersect(e,t,o,n,i,r,s){const a=e,{transform:l}=a,{position:c}=l;return null!=i&&(i.localOrigin=c),a.intersectionGeometry.intersect(t,o,n,i,a.components.verticalOffsets,l,r,s)}addEdges(e,t,o,n,i){const r=e,{indices:s,positions:a}=r.intersectionGeometry,l=r.components.offsets;return t.addComponentObject(r,a,s,l,o,n,i)}async extractEdgeInformation(e,t,o){const n=e,r=n.components.visibility;if(r.allInvisible()){const{extractComponentsEdgeLocationsLayout:e}=await import("../../lib/edgeRendering/edgeProcessing.js");return{buffer:e.createBuffer(0),origin:[0,0,0]}}const{indices:s,positions:c}=n.intersectionGeometry,m=n.components.offsets,{EdgeInputBufferLayout:f}=await import("../../lib/edgeRendering/bufferLayouts.js"),h=f.createBuffer(c.length/3);l(h.position.typedBuffer,c,h.position.typedBufferStride,3),a(h.position,h.position,n.transform.rotationScale),this._setComponentIndices(h.componentIndex,s,m);const p=h.count,u=this._computeVisibilityIndices(s,r,m,p);return{origin:i(n.transform.position),buffer:await t.extractComponentsEdgeLocations({indices:u,indicesLength:u.length,skipDeduplicate:!0,data:h,writerSettings:{reducedPrecision:!1,variants:0}},o)}}_setComponentIndices(e,t,o){let n=0;for(let i=0;i<o.length-1;i++){const r=o[i],s=o[i+1];for(let o=r;o<s;o++){const i=t?t[o]:o;e.set(i,n)}n++}}_computeVisibilityIndices(e,t,n,i){if(e&&t.allVisible())return e;let r=0;t.forEachComponentRange(((e,t)=>(r+=n[t]-n[e],!0)));const s=o(e)?new Array(r):2===e?.BYTES_PER_ELEMENT||i<=65536?new Uint16Array(r):new Uint32Array(r);let a=0;return t.forEachComponentRange(((t,o)=>{const i=n[t],r=n[o];for(let n=i;n<r;n++)s[a++]=e?e[n]:n;return!0})),s}addComponentHighlight(e,t,o){const n=e.components;let i=n.highlightCounts,r=n.highlightGroups;null!=i&&null!=r||(i=new Uint32Array(n.count+1),n.highlightCounts=i,r=new Array(n.count+1),n.highlightGroups=r),r[t]=o;0===i[t]++&&(n.highlightsDirty(),this._notifyDirty()),i[n.count]++}removeComponentHighlight(e,t){const o=e.components,n=o.highlightCounts;if(null==n)return void T().warn("Removing non-existing highlight.");const i=n[t];if(0===i)return void T().warn("Removing non-existing highlight.");const r=n[o.count];if(i>1)return n[t]=i-1,void(n[o.count]=r-1);n[t]=0,o.highlightsDirty(),this._notifyDirty(),1===r?(o.highlightCounts=null,o.highlightGroups=null):n[o.count]=r-1}clearHighlights(e){const t=e.components;null!=t.highlightCounts&&(t.highlightCounts=null,t.highlightGroups=null,t.highlightsDirty(),this._notifyDirty())}getObjectGPUMemoryUsage(e){return e.renderable.meta.gpuMemoryEstimate}get visibleObjects(){return this._visible}_createRenderable(e,t){const o=this._renderManager.rctx,n=e.geometry,i=n.vertices.layoutParameters,r=P.createVertex(o,L.STATIC_DRAW,n.vertices.data),s=n.indices?P.createIndex(o,L.STATIC_DRAW,n.indices):null,a=p(_(i)),l=new Uint16Array(n.vertices.count);for(let p=0;p<t.count;p++){const e=t.offsets[p],o=t.offsets[p+1],i=t.materialDataIndices[p];if(null!=n.indices)for(let t=e;t<o;t++){l[n.indices[t]]=i}else for(let t=e;t<o;t++)l[t]=i}const c=P.createVertex(o,L.STATIC_DRAW,l.buffer),m=new O(e.transform,e.toMapSpace),f=new U(o,A,{data:a,componentIndices:k},{data:r,componentIndices:c},s),h=new v(f,N.TRIANGLES,i,null!=s),u={cameraDepthSquared:.5,gpuMemoryEstimate:r.usedMemory+c.usedMemory+(null!=s?s.usedMemory:0)};return new y(m,h,u)}_notifyDirty(){this._renderManager.notifyDirty()}}const k=p(u().u16(E.COMPONENTINDEX));function q(e,t){return e===t?w.All:0===e?w.None:w.Some}const W=r();export{G as ComponentObjectCollection};
|