@arcgis/core 4.30.0-next.20240213 → 4.30.0-next.20240214
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/TimeExtent.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/051c00021039f20ad935.js +1 -0
- package/assets/esri/core/workers/chunks/08ba549f9c4afc42a21c.js +1 -0
- package/assets/esri/core/workers/chunks/{a384f29cb3256401962a.js → 1629a8c2085dce59cd1b.js} +1 -1
- package/assets/esri/core/workers/chunks/18512caeeb03b9759ab1.js +1 -0
- package/assets/esri/core/workers/chunks/{cc1c958aad790a44048b.js → 1ca28af7c516d8283bb0.js} +1 -1
- package/assets/esri/core/workers/chunks/1f8a0fb32b96e50f5909.js +1 -0
- package/assets/esri/core/workers/chunks/25f7e92cb4934c4930be.js +1 -0
- package/assets/esri/core/workers/chunks/2649166d1a462c7f8338.js +1 -0
- package/assets/esri/core/workers/chunks/51e4f771bfe352967c97.js +1 -0
- package/assets/esri/core/workers/chunks/5467bacd2771e6b1cdfa.js +1 -0
- package/assets/esri/core/workers/chunks/5638d95e600ff271c5b1.js +1 -0
- package/assets/esri/core/workers/chunks/58f088b08e12c5435dbc.js +1 -0
- package/assets/esri/core/workers/chunks/5aef1e898618f8dda2c9.js +1 -0
- package/assets/esri/core/workers/chunks/656ec8a14df0e4b68433.js +1 -0
- package/assets/esri/core/workers/chunks/66f21348fb68c83b9dc3.js +1108 -0
- package/assets/esri/core/workers/chunks/{eb2d6f1ee63b40ae0736.js → 774b655498289b1b36bb.js} +1 -1
- package/assets/esri/core/workers/chunks/9310f1de92d9b82dc803.js +1 -0
- package/assets/esri/core/workers/chunks/{f03d62ab7806b68d0b62.js → 9fbf61675e2a5374f754.js} +1 -1
- package/assets/esri/core/workers/chunks/a0b017a34cafd08ce945.js +1 -0
- package/assets/esri/core/workers/chunks/a28711db61c1df2d7bac.js +1 -0
- package/assets/esri/core/workers/chunks/aa9b46bcb75c96731de3.js +1 -0
- package/assets/esri/core/workers/chunks/c83da4659646ce3f5b50.js +1 -0
- package/assets/esri/core/workers/chunks/{05ebb9cec0e1826b283f.js → cafcc53175f9d4c5de2f.js} +1 -1
- package/assets/esri/core/workers/chunks/{1c6914ded7db720f7bf7.js → daf6eab5dd198ca9a67b.js} +1 -1
- package/assets/esri/core/workers/chunks/e03edeaf3af46495449e.js +1 -0
- package/assets/esri/core/workers/chunks/e0c9f29eedfa71554445.js +1 -0
- package/assets/esri/core/workers/chunks/e123017c670f22266768.js +1 -0
- package/assets/esri/core/workers/chunks/eba3a6f0a66b51b8ec12.js +1 -0
- package/assets/esri/core/workers/chunks/ebb294c82207f3ff9f04.js +1 -0
- package/assets/esri/core/workers/chunks/{e4da908079417cc2f495.js → ee0c77889059815a31b2.js} +1 -1
- package/assets/esri/core/workers/chunks/f36e55302b45e2936a5b.js +1 -0
- package/assets/esri/core/workers/chunks/f85e67d4a18603ccaaed.js +1 -0
- package/assets/esri/core/workers/chunks/f90bbebd2dc07a77ce09.js +1 -0
- package/chunks/vec32.js +1 -1
- package/interfaces.d.ts +131 -66
- package/layers/WFSLayer.js +1 -1
- package/layers/buildingSublayers/BuildingComponentSublayer.js +1 -1
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/ArcGISImageService.js +1 -1
- package/package.json +1 -1
- package/portal/Portal.js +1 -1
- package/portal/PortalGroup.js +1 -1
- package/portal/PortalUser.js +1 -1
- package/portal/support/geometryServiceUtils.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToUpdateResponseFactories.js +1 -1
- package/rest/networks/support/Association.js +1 -1
- package/rest/places.js +1 -1
- package/rest/query/operations/pbfJSONFeatureSet.js +1 -1
- package/rest/support/ImageSampleParameters.js +1 -1
- package/smartMapping/support/adapters/FeatureLayerAdapter.js +1 -1
- package/smartMapping/support/adapters/SceneLayerAdapter.js +1 -1
- package/support/elevationInfoUtils.js +1 -1
- package/support/revision.js +1 -1
- package/symbols/cim/cimAnalyzer.js +1 -1
- package/symbols/cim/defaultCIMValues.js +1 -1
- package/symbols/cim/utils.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/labels/LabelMeshWriter.js +1 -1
- package/views/2d/engine/webgl/shaderGraph/techniques/text/TextMeshWriter.js +1 -1
- package/views/3d/interactive/measurementTools/directLineMeasurement3D/DirectLineMeasurement3DView.js +1 -1
- package/views/3d/layers/BuildingComponentSublayerView3D.js +1 -1
- package/views/3d/layers/IntegratedMeshLayerView3D.js +1 -1
- package/views/3d/layers/SceneLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/support/FeatureTileVisibility3D.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/terrain/OverlayFramebufferObject.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/webgl/RenderNode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js +1 -1
- package/views/3d/webgl-engine/core/FBOCache.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ComputeNormalTexture.glsl.js +9 -7
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceConstants.js +5 -0
- package/views/3d/webgl-engine/core/shaderLibrary/shading/Water.glsl.js +8 -8
- package/views/3d/webgl-engine/effects/debug/RenderNodeVisualizerNode.js +1 -1
- package/views/3d/webgl-engine/effects/highlight/Highlight.js +1 -1
- package/views/3d/webgl-engine/effects/smaa/SMAA.js +1 -1
- package/views/3d/webgl-engine/effects/ssao/SSAO.js +1 -1
- package/views/3d/webgl-engine/lib/GLTextureMaterial.js +1 -1
- package/views/draw/drawSurfaces.js +1 -1
- package/views/layers/ImageryTileLayerView.js +1 -1
- package/webdoc/support/webdocLoadUtils.js +1 -1
- package/webdoc/support/webdocSaveUtils.js +1 -1
- package/widgets/Editor.js +1 -1
- package/widgets/FeatureForm.js +1 -1
- package/widgets/Print/PrintViewModel.js +1 -1
- package/widgets/Search/support/locatorUtils.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/assets/esri/core/workers/chunks/00b9e92f8df245a83921.js +0 -1
- package/assets/esri/core/workers/chunks/02ee044597c89c86b934.js +0 -1
- package/assets/esri/core/workers/chunks/143ccb14c9e915dd1412.js +0 -1
- package/assets/esri/core/workers/chunks/24649b410b757599a549.js +0 -1
- package/assets/esri/core/workers/chunks/2519b207894132d5ea91.js +0 -1
- package/assets/esri/core/workers/chunks/30f9b2a3417cbcfeecca.js +0 -1
- package/assets/esri/core/workers/chunks/42ab9c282bb267c3db03.js +0 -1
- package/assets/esri/core/workers/chunks/49afeac45250b15b5f36.js +0 -1
- package/assets/esri/core/workers/chunks/50bb67f2eeace5d50673.js +0 -1
- package/assets/esri/core/workers/chunks/50cdc59426ba859027e2.js +0 -1
- package/assets/esri/core/workers/chunks/58c5861d060c808813a1.js +0 -1
- package/assets/esri/core/workers/chunks/5dbb3ef6fdd25ac632ad.js +0 -1
- package/assets/esri/core/workers/chunks/61c4bb58ef9f2d99c75e.js +0 -1
- package/assets/esri/core/workers/chunks/6e50220f8e2d392e2855.js +0 -1
- package/assets/esri/core/workers/chunks/6fd8047741a0df006ddd.js +0 -1
- package/assets/esri/core/workers/chunks/7709248f59520aee6f51.js +0 -1
- package/assets/esri/core/workers/chunks/8852a64918caf80fc414.js +0 -1
- package/assets/esri/core/workers/chunks/94dfb80ab23dda92918b.js +0 -1
- package/assets/esri/core/workers/chunks/9ebbc75ba5c623a322aa.js +0 -1
- package/assets/esri/core/workers/chunks/a74c59cf5d1c4e63a4e1.js +0 -1
- package/assets/esri/core/workers/chunks/be562536212360943388.js +0 -1
- package/assets/esri/core/workers/chunks/d06d36815c2121484a13.js +0 -1
- package/assets/esri/core/workers/chunks/d5f06a7b0ea7951c8dd0.js +0 -1
- package/assets/esri/core/workers/chunks/de6d54df7ae32694fd70.js +0 -1
- package/assets/esri/core/workers/chunks/f13c4b9692dad5802a32.js +0 -1106
- package/assets/esri/core/workers/chunks/f1e8f7d1a98b9e207b1b.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import has from"../../../core/has.js";import{initial as t}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 s}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as i}from"./I3SMeshView3D.js";import{DrapeTargetType as a}from"./interfaces.js";import{LayerView3D as n}from"./LayerView3D.js";import{updatingProgress as l}from"../support/updatingProperties.js";import p from"../../layers/LayerView.js";const d=.2;let c=class extends(i(n(p))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext="im",this._isIntegratedMesh=!0,this._supportsLabeling=!1,this._needsNormals=has("enable-feature:im-shading"),this.drapeTargetType=a.WithoutRasterImage}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add((()=>this.layer.modifications),(()=>this._loadModifications()),t),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this)}destroy(){this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this)}_createLayerGraphic(){
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../Graphic.js";import has from"../../../core/has.js";import{initial as t}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 s}from"../../../core/accessorSupport/decorators/subclass.js";import{I3SMeshView3D as i}from"./I3SMeshView3D.js";import{DrapeTargetType as a}from"./interfaces.js";import{LayerView3D as n}from"./LayerView3D.js";import{updatingProgress as l}from"../support/updatingProperties.js";import p from"../../layers/LayerView.js";const d=.2;let c=class extends(i(n(p))){constructor(){super(...arguments),this.type="integrated-mesh-3d",this._elevationContext="im",this._isIntegratedMesh=!0,this._supportsLabeling=!1,this._needsNormals=has("enable-feature:im-shading"),this.drapeTargetType=a.WithoutRasterImage}get i3slayer(){return this.layer}get updatingProgressValue(){return this._controller?.updatingProgress??0}get lodFactor(){return this.view?.qualitySettings?.sceneService?.integratedMesh?.lodFactor??1}get progressiveLoadFactor(){return this.lodFactor>=1?d:1}get layerPopupEnabledAndHasTemplate(){return!1}initialize(){this._updatingHandles.add((()=>this.layer.modifications),(()=>this._loadModifications()),t),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this)}destroy(){this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this)}_createLayerGraphic(){return new r({layer:this.layer,sourceLayer:this.layer})}canResume(){return super.canResume()&&(!this._controller||this._controller.rootNodeVisible)}_loadModifications(){if(this.removeHandles("modifications"),null==this.layer.modifications)return void(this._modifications=[]);const e=this.layer.modifications;this.addHandles(this._updatingHandles.addOnCollectionChange((()=>e),(()=>this._modifications=e.toArray()),t),"modifications")}};e([o()],c.prototype,"layer",void 0),e([o()],c.prototype,"i3slayer",null),e([o(l)],c.prototype,"updatingProgress",void 0),e([o()],c.prototype,"updatingProgressValue",null),e([o()],c.prototype,"lodFactor",null),e([o({readOnly:!0})],c.prototype,"progressiveLoadFactor",null),c=e([s("esri.views.3d.layers.SceneLayerView3D")],c);const m=c;export{m 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.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveSet.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import a from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as u}from"../../../layers/support/floorFilterUtils.js";import h from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as p}from"../../../support/featureFlags.js";import{I3SMeshView3D as c}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as y}from"./II3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as m,normalizeEditResultsEvent as f,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as b}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as j}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as I}from"./i3s/I3SNode.js";import{I3SOverrides as v}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as w}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as O,getIndexCrs as H,objectIdFilter as x}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as C}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{PopupSceneLayerView as V}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import{updatingProgress as R}from"../support/updatingProperties.js";import D from"../../layers/SceneLayerView.js";import{hasPopupTemplate as A}from"../../layers/support/popupUtils.js";import{TaskPriority as G}from"../../support/Scheduler.js";const U=Q();let P=class extends(c(L(C(V(g(D)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this._setVisibilityHiddenObjectIds=new s,this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{O(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new v({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&A(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",j.checkSupport(e)?e:null)}get viewFilter(){const e=this.mergedFilter,t=this.layerFilter;if(null==e&&null==t)return null;const i=this._get("viewFilter");return null==i?new j({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}):(i.viewFilter=e,i.layerFilter=t,i)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=u(this);return null!=e?d.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort(((e,t)=>e-t)):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort(((e,t)=>e-t)):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.object?.lodFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new q({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this._updatingHandles.add((()=>this.layer.renderer),(e=>this._updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>this._floorFilterClause),e),this._updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this._updatingHandles.add((()=>this._setVisibilityHiddenObjectIdsSorted),e),this._updatingHandles.add((()=>this.viewFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this.viewFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),p()&&this.i3sOverrides.is3DOFL&&this._updatingHandles.add((()=>this.i3sOverrides.sortedGeometryChangedObjectIds),e),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new h(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const i of e.features)i.layer=t,i.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=b(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new w({layerView:this,priority:G.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new S({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,i,r)=>e({id:t,index:i,meta:r})),t,y.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:H(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof h){const{set:i,handle:r}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(i,e))),r}return super.highlight(e)}createInteractiveEditSession(e){return m(this._attributeEditingContext,e)}_createLayerGraphic(e){const i=new t(null,null,e);return i.layer=this.layer,i.sourceLayer=this.layer,i}getFilters(){const e=super.getFilters();p()&&this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push(((e,t)=>{t.node.index>=0&&x(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)}));const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push((e=>x(t,!1,e)));const i=this._excludeObjectIdsSorted;return null!=i&&e.push((e=>x(i,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():h.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes((t=>null!=t?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=p(),i=this._attributeEditingContext,r=await f(i,e);t&&_(i,r),F(i,r)}get hasGeometryFilter(){const e=this.viewFilter;return null!=e?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?I.Unmodified:I.Culled}};e([n()],P.prototype,"i3slayer",null),e([n(R)],P.prototype,"updatingProgress",void 0),e([n({type:a})],P.prototype,"filter",null),e([n({readOnly:!0})],P.prototype,"viewFilter",null),e([n(U.requiredFields)],P.prototype,"requiredFields",null),e([n(U.availableFields)],P.prototype,"availableFields",void 0),e([n()],P.prototype,"_fieldsHelper",void 0),e([n()],P.prototype,"_floorFilterClause",null),e([n()],P.prototype,"_excludeObjectIdsSorted",null),e([n()],P.prototype,"_setVisibilityHiddenObjectIds",void 0),e([n()],P.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([n()],P.prototype,"lodFactor",null),e([n()],P.prototype,"updatingProgressValue",null),P=e([o("esri.views.3d.layers.SceneLayerView3D")],P);const M=P;export{M as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Graphic.js";import i from"../../../core/Logger.js";import{destroyMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ReactiveSet.js";import{initial as l}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{WhereClause as d}from"../../../core/sql/WhereClause.js";import a from"../../../layers/support/FeatureFilter.js";import{getFloorFilterClause as u}from"../../../layers/support/floorFilterUtils.js";import h from"../../../rest/support/Query.js";import{sceneLayerEditingEnabled as p}from"../../../support/featureFlags.js";import{I3SMeshView3D as c}from"./I3SMeshView3D.js";import{ForAllFeaturesMode as y}from"./II3SMeshView3D.js";import{LayerView3D as g}from"./LayerView3D.js";import{createInteractiveEditSession as m,normalizeEditResultsEvent as f,processGeometryEdits as _,processAttributeEdits as F}from"./i3s/featureEditing.js";import{createGetFeatureExtent as b}from"./i3s/I3SGeometryUtil.js";import{I3SMeshViewFilter as j}from"./i3s/I3SMeshViewFilter.js";import{NodeFilterImpact as I}from"./i3s/I3SNode.js";import{I3SOverrides as v}from"./i3s/I3SOverrides.js";import{I3SQueryEngine as w}from"./i3s/I3SQueryEngine.js";import{I3SQueryFeatureAdapter as S}from"./i3s/I3SQueryFeatureAdapter.js";import{I3SQueryFeatureStore as E}from"./i3s/I3SQueryFeatureStore.js";import{checkRecyclable as O,getIndexCrs as H,objectIdFilter as x}from"./i3s/I3SUtil.js";import{DefinitionExpressionSceneLayerView as C}from"./support/DefinitionExpressionSceneLayerView.js";import{defineFieldProperties as Q}from"./support/fieldProperties.js";import{PopupSceneLayerView as V}from"./support/PopupSceneLayerView.js";import{SceneLayerViewRequiredFields as q}from"./support/SceneLayerViewRequiredFields.js";import{TemporalSceneLayerView as L}from"./support/TemporalSceneLayerView.js";import{updatingProgress as R}from"../support/updatingProperties.js";import D from"../../layers/SceneLayerView.js";import{hasPopupTemplate as A}from"../../layers/support/popupUtils.js";import{TaskPriority as G}from"../../support/Scheduler.js";const U=Q();let P=class extends(c(L(C(V(g(D)))))){constructor(){super(...arguments),this.type="scene-layer-3d",this._setVisibilityHiddenObjectIds=new s,this.progressiveLoadFactor=1,this._elevationContext="scene",this._isIntegratedMesh=!1,this._supportsLabeling=!0,this._pendingEditsQueue=Promise.resolve(),this._interactiveEditingSessions=new Map,this._queryEngine=null}get i3slayer(){return this.layer}tryRecycleWith(e,t){return e.url===this.layer.url&&this.i3sOverrides.isEmpty?e.load(t).then((()=>{O(this.layer,e,this.i3sOverrides),this.layer=e,this.i3sOverrides.destroy();const t=this.view.resourceController?.memoryController;this.i3sOverrides=new v({view:this.view,layer:e,memoryController:t}),this.resetHighlights()})):null}get layerPopupEnabledAndHasTemplate(){return this.layer.popupEnabled&&A(this.layer,this.view.popup?.defaultPopupTemplateEnabled)}get filter(){return this._get("filter")}set filter(e){this._set("filter",j.checkSupport(e)?e:null)}get viewFilter(){const e=this.mergedFilter,t=this.layerFilter;if(null==e&&null==t)return null;const i=this._get("viewFilter");return null==i?new j({layerFilter:t,viewFilter:e,layerFieldsIndex:this.layer.fieldsIndex,loadAsyncModule:e=>this._loadAsyncModule(e),addSqlFilter:(e,t)=>this.addSqlFilter(e,t,this.logError),addTimeFilter:(e,t)=>this.addTimeFilter(e,t)}):(i.viewFilter=e,i.layerFilter=t,i)}get requiredFields(){return this._fieldsHelper?.requiredFields??[]}get _floorFilterClause(){const e=u(this);return null!=e?d.create(e,this.layer.fieldsIndex):null}get _excludeObjectIdsSorted(){const e=this.layer.excludeObjectIds.toArray();return e.length?e.sort(((e,t)=>e-t)):null}get _setVisibilityHiddenObjectIdsSorted(){return this._setVisibilityHiddenObjectIds.size?Array.from(this._setVisibilityHiddenObjectIds).sort(((e,t)=>e-t)):null}get lodFactor(){return this.view?.qualitySettings?.sceneService?.object?.lodFactor??1}get lodCrossfadeUncoveredDuration(){return this.view?.qualitySettings?.fadeDuration??0}get updatingProgressValue(){return this._controller?.updatingProgress??0}initialize(){this._fieldsHelper=new q({layerView:this}),this._updatingHandles.add((()=>this.layer.rangeInfos),(e=>this._rangeInfosChanged(e)),l),this._updatingHandles.add((()=>this.layer.renderer),(e=>this._updatingHandles.addPromise(this._rendererChange(e))),l);const e=()=>this._filterChange();this._updatingHandles.add((()=>this.parsedDefinitionExpression),e),this._updatingHandles.add((()=>this.mergedFilter),e),this._updatingHandles.add((()=>this._floorFilterClause),e),this._updatingHandles.add((()=>this._excludeObjectIdsSorted),e),this._updatingHandles.add((()=>this._setVisibilityHiddenObjectIdsSorted),e),this._updatingHandles.add((()=>this.viewFilter?.sortedObjectIds),e),this._updatingHandles.add((()=>this.viewFilter?.parsedWhereClause),e),this._updatingHandles.add((()=>this.getTimeFilterDependencies()),e),this._updatingHandles.add((()=>[this.viewFilter?.parsedGeometry,this.mergedFilter?.spatialRelationship,this.layer.filter?.spatialRelationship]),(()=>this._geometryFilterChange())),p()&&this.i3sOverrides.is3DOFL&&this._updatingHandles.add((()=>this.i3sOverrides.sortedGeometryChangedObjectIds),e),this.addHandles(this.layer.on("apply-edits",(e=>this._updatingHandles.addPromise(e.result)))),this.addHandles(this.layer.on("edits",(e=>{const t=this._pendingEditsQueue.then((()=>this._handleEdits(e))).then();this._pendingEditsQueue=t,this._updatingHandles.addPromise(t)})))}destroy(){this._fieldsHelper=r(this._fieldsHelper)}_rangeInfosChanged(e){null!=e&&e.length>0&&i.getLogger(this).warn("Unsupported property: rangeInfos are currently only serialized to and from web scenes but do not affect rendering.")}createQuery(){const e={outFields:["*"],returnGeometry:!1,outSpatialReference:this.view.spatialReference};return this.mergedFilter?.createQuery(e)??new h(e)}queryExtent(e,t){return this._ensureQueryEngine().executeQueryForExtent(this._ensureQuery(e),t?.signal)}queryFeatureCount(e,t){return this._ensureQueryEngine().executeQueryForCount(this._ensureQuery(e),t?.signal)}queryFeatures(e,t){return this._ensureQueryEngine().executeQuery(this._ensureQuery(e),t?.signal).then((e=>{if(!e?.features)return e;const t=this.layer;for(const i of e.features)i.layer=t,i.sourceLayer=t;return e}))}queryObjectIds(e,t){return this._ensureQueryEngine().executeQueryForIds(this._ensureQuery(e),t?.signal)}_ensureQueryEngine(){return this._queryEngine||(this._queryEngine=this._createQueryEngine()),this._queryEngine}_createQueryEngine(){const e=b(this.view.spatialReference,this.view.renderSpatialReference,this._collection);return new w({layerView:this,priority:G.FEATURE_QUERY_ENGINE,spatialIndex:new E({featureAdapter:new S({objectIdField:this.layer.objectIdField,attributeStorageInfo:this.layer.attributeStorageInfo??[],getFeatureExtent:e}),forAllFeatures:(e,t)=>this._forAllFeatures(((t,i,r)=>e({id:t,index:i,meta:r})),t,y.QUERYABLE),getFeatureExtent:e,sourceSpatialReference:H(this.layer),viewSpatialReference:this.view.spatialReference})})}highlight(e){const t=this._highlights;if(e instanceof h){const{set:i,handle:r}=t.acquireSet();return this.queryObjectIds(e).then((e=>t.setFeatureIds(i,e))),r}return super.highlight(e)}createInteractiveEditSession(e){return m(this._attributeEditingContext,e)}_createLayerGraphic(e){return new t({attributes:e,layer:this.layer,sourceLayer:this.layer})}getFilters(){const e=super.getFilters();p()&&this.i3sOverrides.is3DOFL&&this.i3sOverrides.sortedGeometryChangedObjectIds.length>0&&e.push(((e,t)=>{t.node.index>=0&&x(this.i3sOverrides.sortedGeometryChangedObjectIds,!1,e)}));const t=this._setVisibilityHiddenObjectIdsSorted;null!=t&&e.push((e=>x(t,!1,e)));const i=this._excludeObjectIdsSorted;return null!=i&&e.push((e=>x(i,!1,e))),this._floorFilterClause&&this.addSqlFilter(e,this._floorFilterClause,this.logError),this.addSqlFilter(e,this.parsedDefinitionExpression,this.logError),null!=this.viewFilter&&this.viewFilter.addFilters(e,this.view,this._controller.crsIndex,this._collection),e}setVisibility(e,t){t?this._setVisibilityHiddenObjectIds.delete(e):this._setVisibilityHiddenObjectIds.add(e)}isUpdating(){return super.isUpdating()||this.layerFilterUpdating||null!=this.viewFilter&&this.viewFilter.updating||null!=this.i3sOverrides&&this.i3sOverrides.updating}_ensureQuery(e){return this._addDefinitionExpressionToQuery(null==e?this.createQuery():h.from(e))}get _attributeEditingContext(){return{sessions:this._interactiveEditingSessions,fieldsIndex:this.layer.fieldsIndex,objectIdField:this._getObjectIdField(),globalIdField:this._getGlobalIdField(),forEachNode:e=>this._forAllNodes((t=>null!=t?e(t.node,t.featureIds):null)),attributeStorageInfo:this.i3slayer.attributeStorageInfo??[],i3sOverrides:this.i3sOverrides,getAttributeData:e=>this.getAttributeData(e),setAttributeData:(e,t)=>this.setAttributeData(e,t),clearMemCache:()=>this.clearMemCache()}}async _handleEdits(e){const t=p(),i=this._attributeEditingContext,r=await f(i,e);t&&_(i,r),F(i,r)}get hasGeometryFilter(){const e=this.viewFilter;return null!=e?.parsedGeometry}computeNodeFiltering(e){const t=this.viewFilter;return null==t||!this.view.spatialReference||t.isMBSGeometryVisible(e,this.view.spatialReference,this._controller.crsIndex)?I.Unmodified:I.Culled}};e([n()],P.prototype,"i3slayer",null),e([n(R)],P.prototype,"updatingProgress",void 0),e([n({type:a})],P.prototype,"filter",null),e([n({readOnly:!0})],P.prototype,"viewFilter",null),e([n(U.requiredFields)],P.prototype,"requiredFields",null),e([n(U.availableFields)],P.prototype,"availableFields",void 0),e([n()],P.prototype,"_fieldsHelper",void 0),e([n()],P.prototype,"_floorFilterClause",null),e([n()],P.prototype,"_excludeObjectIdsSorted",null),e([n()],P.prototype,"_setVisibilityHiddenObjectIds",void 0),e([n()],P.prototype,"_setVisibilityHiddenObjectIdsSorted",null),e([n()],P.prototype,"lodFactor",null),e([n()],P.prototype,"updatingProgressValue",null),P=e([o("esri.views.3d.layers.SceneLayerView3D")],P);const M=P;export{M 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.30/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{fromMat4 as r,transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as s,multiply as n,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{s as h,g as f,i as p,j as d,n as g,f as x,b as _}from"../../../../chunks/vec32.js";import{ZEROS as T,ONES as b,create as y}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as C}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as w}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as j}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as M}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as O,empty as P,expandWithBuffer as A,intersectsClippingArea as R}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as E}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as I,getZeroIndexArray as N}from"../../../../geometry/support/Indices.js";import S from"../../../../geometry/support/MeshComponent.js";import F from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import B from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as U}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{a as L,b as $}from"../../../../chunks/vec3.js";import{project as V}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as G,projectNormalToPCPF as D,transformTangent as H,projectTangentToPCPF as q}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as k}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as W}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as z}from"../../../ViewingMode.js";import{isEncodedMeshTexture as Y}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as J}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as K}from"./ElevationAligners.js";import{needsElevationUpdates3D as Q,evaluateElevationInfoAtPoint as X}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as Z}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as ee}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as te}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as re,MeshFastUpdateProcessor as oe}from"./MeshFastUpdateProcessor.js";import{createMaterial as ae}from"../support/edgeUtils.js";import{parseColorMixMode as se,encodeSymbolColor as ne}from"../support/symbolColorUtils.js";import{debugFlags as ie}from"../../support/debugFlags.js";import{Attribute as le}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as ce,CullFaceOptions as ue}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as me}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as he}from"../../webgl-engine/lib/Geometry.js";import{Object3D as fe}from"../../webgl-engine/lib/Object3D.js";import{Texture as pe}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as de}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as ge}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as xe}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as _e,defaultSchematicMRRFactors as Te,defaultAdvancedMRRFactors as be}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as ye}from"../../../webgl/enums.js";const ve=["mesh"];class Ce extends te{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new re,this._fastUpdateProcessor=new oe,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){ie.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new xe({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new xe({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,ve,"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,Q)}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){const a=this._context.renderCoordsHelper.spatialReference,s=Ie,{origin:n,transform:i}=r;switch(w(t,h(Me,n.x,n.y,n.z??0),s,a),o){case W.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case W.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case W.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,i,this._context.localOriginFactory)}const{elevationContext:l}=e;l.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:c,renderCoordsHelper:u}=this._context,m=(e,t)=>X(e,c,l,u,t);return e.alignedSampledElevation=K(e,l,c.spatialReference,m,u,s),e.updateTransform(s,i,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Fe;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof F){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,ce.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);if(!a){let s=null;const n=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:n,mipmap:n>1};Y(r)?(s=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(s=r,i.preMultiplyAlpha=t!==ce.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),a=new pe(s,i),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)}return a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ye.CLAMP_TO_EDGE;case"mirror":return ye.MIRRORED_REPEAT;default:return ye.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(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=J(t.colorTextureTransform),r.normalTextureTransformMatrix=J(t.normalTextureTransform),r.occlusionTextureTransformMatrix=J(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=J(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=J(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=v;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=v)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(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}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),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=_e({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:T,diffuse:b,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:ue.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...Te]:[l.metallic,l.roughness,be[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?ue.None:ue.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new ge(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_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?ce.MaskBlend:ce.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?ce.Opaque:"mask"===t.alphaMode?ce.Mask:ce.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let h=0;h<r;h++){const e=t[h],r=e.attributes.get(de.POSITION),o=e.attributes.get(de.NORMAL),c=r.data,u=r.indices,m=o.data,d=o.indices;for(let t=0;t<u.length;t++){const e=3*u[t],r=3*d[t];for(let t=0;t<3;t++)s.push(c[e+t]);for(let t=0;t<3;t++)s.push(c[e+t]+m[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(c,u,t,Ae),this._getFaceVertices(c,u,t,Me,Oe,Pe),f(Me,Me,Oe),f(Me,Me,Pe),p(Me,Me,1/3);for(let e=0;e<3;e++)i.push(Me[e]);for(let e=0;e<3;e++)i.push(Me[e]+Ae[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new he(this._debugVertexNormalMaterial,[[de.POSITION,new le(s,n,3,!0)]],null,me.Line);t.push(u),u.transformation=c;const m=new he(this._debugFaceNormalMaterial,[[de.POSITION,new le(i,l,3,!0)]],null,me.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;ie.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new fe({geometries:n,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=ae(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new ee(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new Z(this,l,n,null,null,K,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=Q(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>X(e,h,r,f,t);return m.alignedSampledElevation=K(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=k(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return M([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Ae);for(let e=0;e<3;e++){const r=3*o[s+e];Me[0]=t[r],Me[1]=t[r+1],Me[2]=t[r+2],d(Ae,Me)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new we(t,o,a)}_createComponentNormalsFlat(e,t){const r=E(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Ae);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new we(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Ae);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:y(),count:0},r[a]=n),f(n.normal,n.normal,o),n.count++}}const o=E(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(g(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new we(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,Me,Oe,Pe),x(Oe,Oe,Me),x(Pe,Pe,Me),_(Me,Oe,Pe),g(o,Me),o}_getOrCreateComponents(e){return e.components??Se}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===Be.ECEF?t.transformBeforeProject:null;if(o&&(r=L(new Float64Array(r.length),r,o)),t.reprojection===Be.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return j(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=G(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return D(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===Be.ECEF?r.transformBeforeProject:null;a&&(o=H(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Be.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return q(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=se(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ne(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,a=e.vertexAttributes.uv,s=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(s&&s.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(a&&a.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 n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),l=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:l,symbolColorBuffer:u,objectTransformation:n.reprojection===Be.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===Be.NONE&&n.geometryTransformation?n.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?this._context.renderCoordsHelper.viewingMode===z.Local?Be.NONE:Be.ECEF:Be.NONE;if(U(t)){const o=t.origin,a=c(),i=e.transform?.localMatrix??u;if(r===Be.NONE){w(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:m(i),needsBufferCopy:!1}}const l=s(c(),o);return n(l,l,i),{reprojection:r,transformBeforeProject:l,needsBufferCopy:!0}}return{reprojection:r,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,l=e.anchor;je[0]=l.x,je[1]=l.y,je[2]=l.z??0;const u=c();return w(e.spatialReference,je,u,n),i(Re,u),L(t,t,Re),(a||s)&&(r(Ee,u),o(Ee,Ee),a&&$(a,a,Ee),s&&$(s,s,Ee,4)),u}_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}_getOrCreateFaces(e,t){return t.faces??I(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=V({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===z.Local}),a=o.length/3;return P(Ne),A(Ne,o,0,a),!R(Ne,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!C(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=new Array;let d=!1;const g=l(Me,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of f){if(!this._validateFaces(e,l))return null;const t=this._getOrCreateFaces(e,l);if(0===t.length)continue;const o=this._createComponentNormals(a,c,l,t);o.didFlipNormals&&(d=!0);const m=[[de.POSITION,new le(a,t,3,!0)],[de.NORMAL,new le(o.normals,o.indices,3,!0)]];n&&m.push([de.COLOR,new le(n,t,4,!0)]),i&&m.push([de.SYMBOLCOLOR,new le(i,N(t.length),4,!0)]),s&&m.push([de.UV0,new le(s,t,2,!0)]),u&&m.push([de.TANGENT,new le(u,t,4,!0)]);const f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new he(g,m,null,me.Mesh,f);_.transformation=h,_.localOrigin=x,p.push(_)}return d&&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:p,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class we{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const je=y(),Me=y(),Oe=y(),Pe=y(),Ae=y(),Re=c(),Ee=a(),Ie=c(),Ne=O(),Se=[new S],Fe=new B;var Be;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(Be||(Be={}));export{Ce as Graphics3DMeshFillSymbolLayer};
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import{deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as r,transpose as o}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{fromTranslation as s,multiply as n,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 h}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{s as f,g as p,i as d,j as g,n as x,f as _,b as T}from"../../../../chunks/vec32.js";import{ZEROS as b,ONES as y,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as C}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{canProjectWithoutEngine as w}from"../../../../geometry/projection.js";import{computeTranslationToOriginAndRotation as j}from"../../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{projectBuffer as M}from"../../../../geometry/projection/projectBuffer.js";import{projectVectorToPoint as O}from"../../../../geometry/projection/projectVectorToPoint.js";import{create as P,empty as A,expandWithBuffer as R,intersectsClippingArea as E}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as I}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as N,getZeroIndexArray as S}from"../../../../geometry/support/Indices.js";import F from"../../../../geometry/support/MeshComponent.js";import B from"../../../../geometry/support/MeshMaterialMetallicRoughness.js";import U from"../../../../geometry/support/MeshTextureTransform.js";import{isRelativeVertexSpace as L}from"../../../../geometry/support/meshVertexSpaceUtils.js";import{a as $,b as V}from"../../../../chunks/vec3.js";import{project as G}from"../../../../geometry/support/meshUtils/georeference.js";import{transformNormal as D,projectNormalToPCPF as H,transformTangent as q,projectTangentToPCPF as k}from"../../../../geometry/support/meshUtils/projection.js";import{makeDehydratedPoint as W}from"../../../../layers/graphics/dehydratedPoint.js";import{MeshTransformUpdateAction as z}from"../../../../layers/graphics/sources/interfaces.js";import{ViewingMode as Y}from"../../../ViewingMode.js";import{isEncodedMeshTexture as J}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as K}from"../../glTF/internal/TextureTransformUtils.js";import{perObjectElevationAligner as Q}from"./ElevationAligners.js";import{needsElevationUpdates3D as X,evaluateElevationInfoAtPoint as Z}from"./elevationAlignmentUtils.js";import{Graphics3DMeshObject3DGraphicLayer as ee}from"./Graphics3DMeshObject3DGraphicLayer.js";import{Object3DEdgeState as te}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as re}from"./Graphics3DSymbolLayer.js";import{MaterialInfoCache as oe,MeshFastUpdateProcessor as ae}from"./MeshFastUpdateProcessor.js";import{createMaterial as se}from"../support/edgeUtils.js";import{parseColorMixMode as ne,encodeSymbolColor as ie}from"../support/symbolColorUtils.js";import{debugFlags as le}from"../../support/debugFlags.js";import{Attribute as ce}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as ue,CullFaceOptions as me}from"../../webgl-engine/lib/basicInterfaces.js";import{ContentObjectType as he}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as fe}from"../../webgl-engine/lib/Geometry.js";import{Object3D as pe}from"../../webgl-engine/lib/Object3D.js";import{Texture as de}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as ge}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as xe}from"../../webgl-engine/materials/DefaultMaterial.js";import{NativeLineMaterial as _e}from"../../webgl-engine/materials/NativeLineMaterial.js";import{useSchematicPBR as Te,defaultSchematicMRRFactors as be,defaultAdvancedMRRFactors as ye}from"../../webgl-engine/materials/pbrUtils.js";import{TextureWrapMode as ve}from"../../../webgl/enums.js";const Ce=["mesh"];class we extends re{constructor(e,t,r,o){super(e,t,r,o),this._materialInfoCache=new oe,this._fastUpdateProcessor=new ae,this._textures=new Map,this.ensureDrapedStatus(!1)}async doLoad(){le.DRAW_MESH_GEOMETRY_NORMALS&&(this._debugVertexNormalMaterial=new _e({color:[1,0,1,1]}),this._debugFaceNormalMaterial=new _e({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,Ce,"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,X)}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){const a=this._context.renderCoordsHelper.spatialReference,s=Ne,{origin:n,transform:i}=r;switch(j(t,f(Oe,n.x,n.y,n.z??0),s,a),o){case z.EnableFastUpdates:this._fastUpdateProcessor.enable(e,this._materialInfoCache,this._context);break;case z.DisableFastUpdates:this._fastUpdateProcessor.disable(e,this._materialInfoCache,this._context);break;case z.UpdateFastLocalOrigin:e.updateFastLocalOrigin(s,i,this._context.localOriginFactory)}const{elevationContext:l}=e;l.centerPointInElevationSR=this._getCenterPointInElevationSR(s);const{elevationProvider:c,renderCoordsHelper:u}=this._context,m=(e,t)=>Z(e,c,l,u,t);return e.alignedSampledElevation=Q(e,l,c.spatialReference,m,u,s),e.updateTransform(s,i,this._context.isAsync),!0}_requiresSymbolVertexColors(){return this._drivenProperties.color||this._drivenProperties.opacity}_colorOrTextureUid(t){return null==t?"-":t instanceof e?t.toHex():t.contentHash}_materialPropertiesDefault(e,t){const r=this._requiresSymbolVertexColors(),o=!!e.vertexAttributes.color,a=!!e.vertexAttributes.tangent;return{hasSymbolVertexColors:r,hasVertexColors:o,hasVertexTangents:a,uid:`vc:${o},vt:${a},vct${t},svc:${r}`}}_textureTransformUid(e){const{offset:t,scale:r,rotation:o}=e??Be;return`${t[0]},${t[1]},${o},${r[0]},${r[1]}`}_materialProperties(e,t,r){const o=this._materialPropertiesDefault(e,r);if(!t.material)return o;const{color:a,colorTexture:s,colorTextureTransform:n,normalTexture:i,normalTextureTransform:l,doubleSided:c,alphaCutoff:u,alphaMode:m}=t.material,h=this._colorOrTextureUid(a),f=this._colorOrTextureUid(s),p=this._textureTransformUid(n),d=this._colorOrTextureUid(i),g=this._textureTransformUid(l);if(o.color=a,o.colorTexture=s,o.normalTexture=i,o.uid=`${o.uid},cmuid:${h},ctmuid:${f},cttuid:${p},ntmuid:${d},nttuid:${g},ds:${c},ac:${u},am:${m}`,t.material instanceof B){const{metallic:e,roughness:r,metallicRoughnessTexture:a,metallicRoughnessTextureTransform:s,emissiveColor:i,emissiveTexture:c,emissiveTextureTransform:u,occlusionTexture:m,occlusionTextureTransform:h}=t.material,f=this._colorOrTextureUid(a),p=this._textureTransformUid(s),d=this._colorOrTextureUid(i),g=this._colorOrTextureUid(c),x=this._textureTransformUid(u),_=this._colorOrTextureUid(m),T=this._textureTransformUid(h);o.metallic=e,o.roughness=r,o.metallicRoughnessTexture=a,o.emissiveColor=i,o.emissiveTexture=c,o.occlusionTexture=m,o.colorTextureTransform=this._convertTextureTransform(n),o.normalTextureTransform=this._convertTextureTransform(l),o.emissiveTextureTransform=this._convertTextureTransform(u),o.occlusionTextureTransform=this._convertTextureTransform(h),o.metallicRoughnessTextureTransform=this._convertTextureTransform(s),o.uid=`${o.uid},mrm:${e},mrr:${r},mrt:${f},mrtt:${p},emuid:${d},etmuid:${g},ett:${x},otmuid:${_},ott:${T}`}return o}_convertTextureTransform(e){if(!e)return null;const{scale:r,offset:o,rotation:a}=e;return{scale:r,offset:o,rotation:t(a)}}_setInternalColorValueParameters(t,r){r.diffuse=e.toUnitRGB(t),r.opacity=t.a}_getLoadableTextureResource(e){return e.data??e.url}_getInternalTextureId(e){const t=this._getInternalTexture(e,ue.Opaque);return t?.id}_getInternalTexture(e,t){const r=this._getLoadableTextureResource(e);if(!r)return null;const o=`${e.contentHash}/${t}`;let a=this._textures.get(o);if(!a){let s=null;const n=this._context.stage.renderView.renderingContext.parameters.maxMaxAnisotropy,i={wrap:this._castTextureWrap(e.wrap),noUnpackFlip:!0,maxAnisotropy:n,mipmap:n>1};J(r)?(s=r.data,i.preMultiplyAlpha=!1,i.encoding=r.encoding):(s=r,i.preMultiplyAlpha=t!==ue.Opaque,i.downsampleUncompressed=this._context.graphicsCoreOwner.view.qualitySettings.graphics3D.uncompressedTextureDownsamplingEnabled),a=new de(s,i),this._textures.set(o,a),a.load(this._context.stage.renderView.renderingContext),this._context.stage.add(a)}return a}_castTextureWrap(e="repeat"){if("string"==typeof e){const t=this._castTextureWrapIndividual(e);return{s:t,t}}return{s:this._castTextureWrapIndividual(e.horizontal),t:this._castTextureWrapIndividual(e.vertical)}}_castTextureWrapIndividual(e){switch(e){case"clamp":return ve.CLAMP_TO_EDGE;case"mirror":return ve.MIRRORED_REPEAT;default:return ve.REPEAT}}_setInternalMaterialParameters(t,r){if(null!=t.color&&this._setInternalColorValueParameters(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=K(t.colorTextureTransform),r.normalTextureTransformMatrix=K(t.normalTextureTransform);const o=null!=t.normalTextureTransform?.scale?t.normalTextureTransform?.scale:h;r.scale=[o[0],o[1]],r.occlusionTextureTransformMatrix=K(t.occlusionTextureTransform),r.emissiveTextureTransformMatrix=K(t.emissiveTextureTransform),r.metallicRoughnessTextureTransformMatrix=K(t.metallicRoughnessTextureTransform)}_setExternalMaterialParameters(t){const r=this._drivenProperties.color;let o=this.symbolLayer.material?.colorMixMode??null;if(r)t.externalColor=C;else{const r=this.symbolLayer.material?.color??null;r?t.externalColor=e.toUnitRGBA(r):(o=null,t.externalColor=C)}o&&(t.colorMixMode=o),t.castShadows=!!this.symbolLayer.castShadows}_hasTransparentVertexColors(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}_getOrCreateMaterial(t,r){const o=r.material?.color,a=r.material?.colorTexture,s=r.material?.alphaMode,n="blend"===s,i=!("opaque"===s)&&(this._hasTransparentVertexColors(t)||null!=o&&o.a<1||a?.transparent||n),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=Te({normalTexture:l.normalTexture,metallicRoughnessTexture:l.metallicRoughnessTexture,metallicFactor:l.metallic,roughnessFactor:l.roughness,emissiveTexture:l.emissiveTexture,emissiveFactor:e.toUnitRGB(l.emissiveColor),occlusionTexture:l.occlusionTexture}),h={usePBR:this._usePBR(),isSchematic:m,hasVertexColors:l.hasVertexColors,hasSymbolColors:l.hasSymbolVertexColors,hasVertexTangents:l.hasVertexTangents,ambient:b,diffuse:y,opacity:1,doubleSided:!0,doubleSidedType:"winding-order",cullFace:me.None,layerOpacity:this._getLayerOpacity(),hasSlicePlane:this._context.slicePlaneEnabled,initTextureTransparent:!0};h.mrrFactors=m?[...be]:[l.metallic,l.roughness,ye[2]],r.material&&(h.doubleSided=r.material.doubleSided,h.cullFace=r.material.doubleSided?me.None:me.Back,h.textureAlphaCutoff=r.material.alphaCutoff),this._setExternalMaterialParameters(h),this._setMaterialTransparentParameter(h,u),this._setInternalMaterialParameters(l,h);const f=new xe(h);return u.material=f,this._materialInfoCache.set(l.uid,u),this._context.stage.add(f),f}_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?ue.MaskBlend:ue.Opaque:e.textureAlphaMode="opaque"===t.alphaMode?ue.Opaque:"mask"===t.alphaMode?ue.Mask:ue.Blend}_addDebugNormals(e,t){const r=t.length,o=e.spatialReference.isGeographic?20015077/180:1,a=.1*Math.max(e.extent.width*o,e.extent.height*o,e.extent.zmax-e.extent.zmin),s=[],n=[],i=[],l=[];for(let h=0;h<r;h++){const e=t[h],r=e.attributes.get(ge.POSITION),o=e.attributes.get(ge.NORMAL),c=r.data,u=r.indices,m=o.data,f=o.indices;for(let t=0;t<u.length;t++){const e=3*u[t],r=3*f[t];for(let t=0;t<3;t++)s.push(c[e+t]);for(let t=0;t<3;t++)s.push(c[e+t]+m[r+t]*a);if(n.push(n.length),n.push(n.length),t%3==0){this._calculateFaceNormal(c,u,t,Re),this._getFaceVertices(c,u,t,Oe,Pe,Ae),p(Oe,Oe,Pe),p(Oe,Oe,Ae),d(Oe,Oe,1/3);for(let e=0;e<3;e++)i.push(Oe[e]);for(let e=0;e<3;e++)i.push(Oe[e]+Re[e]*a);l.push(l.length),l.push(l.length)}}}const c=t[0].transformation,u=new fe(this._debugVertexNormalMaterial,[[ge.POSITION,new ce(s,n,3,!0)]],null,he.Line);t.push(u),u.transformation=c;const m=new fe(this._debugFaceNormalMaterial,[[ge.POSITION,new ce(i,l,3,!0)]],null,he.Line);m.transformation=c,t.push(m)}_createAs3DShape(e,t,r,o){const a=e.geometry;if("mesh"!==a.type)return null;const s=this._createGeometryInfo(a,t,o);if(null==s)return null;const{geometries:n,objectTransformation:i}=s;le.DRAW_MESH_GEOMETRY_NORMALS&&this._addDebugNormals(a,n);const l=new pe({geometries:n,layerUid:this._context.layer.uid,graphicUid:o,isElevationSource:!0});l.transformation=i;const c=se(this.symbolLayer,{opacity:this._getLayerOpacity()}),u=c?new te(n[0].material,[c],{mergeGeometries:!0,hasSlicePlane:this._context.slicePlaneEnabled}):null,m=new ee(this,l,n,null,null,Q,r,u);this._fastUpdateProcessor.onAddGraphic(),m.needsElevationUpdates=X(r.mode),m.useObjectOriginAsAttachmentOrigin=!0,r.centerPointInElevationSR=this._getCenterPointInElevationSR(l.transformation);const{elevationProvider:h,renderCoordsHelper:f}=this._context,p=(e,t)=>Z(e,h,r,f,t);return m.alignedSampledElevation=Q(m,r,h.spatialReference,p,f),m}_getCenterPointInElevationSR(e){const t=W(0,0,0,null!=this._context.elevationProvider.spatialReference?this._context.elevationProvider.spatialReference:null);return O([e[12],e[13],e[14]],this._context.renderCoordsHelper.spatialReference,t),t}_createComponentNormals(e,t,r,o){switch(r.shading||"flat"){default:case"source":return this._createComponentNormalsSource(e,t,r,o);case"flat":return this._createComponentNormalsFlat(e,o);case"smooth":return this._createComponentNormalsSmooth(e,o)}}_createComponentNormalsSource(e,t,r,o){if(null==t)return this._createComponentNormalsFlat(e,o);let a=!1;if(!r.trustSourceNormals)for(let s=0;s<o.length;s+=3){this._calculateFaceNormal(e,o,s,Re);for(let e=0;e<3;e++){const r=3*o[s+e];Oe[0]=t[r],Oe[1]=t[r+1],Oe[2]=t[r+2],g(Re,Oe)<0&&(t[r]=-t[r],t[r+1]=-t[r+1],t[r+2]=-t[r+2],a=!0)}}return new je(t,o,a)}_createComponentNormalsFlat(e,t){const r=I(t.length),o=new Array(3*t.length);for(let a=0;a<t.length;a+=3){const s=this._calculateFaceNormal(e,t,a,Re);for(let e=0;e<3;e++)r[a+e]=s[e],o[a+e]=a/3}return new je(r,o,!1)}_createComponentNormalsSmooth(e,t){const r={};for(let s=0;s<t.length;s+=3){const o=this._calculateFaceNormal(e,t,s,Re);for(let e=0;e<3;e++){const a=t[s+e];let n=r[a];n||(n={normal:v(),count:0},r[a]=n),p(n.normal,n.normal,o),n.count++}}const o=I(3*t.length),a=new Array(3*t.length);for(let s=0;s<t.length;s++){const e=r[t[s]];1!==e.count&&(x(e.normal,e.normal),e.count=1);for(let t=0;t<3;t++)o[3*s+t]=e.normal[t];a[s]=s}return new je(o,a,!1)}_getFaceVertices(e,t,r,o,a,s){const n=3*t[r],i=3*t[r+1],l=3*t[r+2];o[0]=e[n],o[1]=e[n+1],o[2]=e[n+2],a[0]=e[i],a[1]=e[i+1],a[2]=e[i+2],s[0]=e[l],s[1]=e[l+1],s[2]=e[l+2]}_calculateFaceNormal(e,t,r,o){return this._getFaceVertices(e,t,r,Oe,Pe,Ae),_(Pe,Pe,Oe),_(Ae,Ae,Oe),T(Oe,Pe,Ae),x(o,Oe),o}_getOrCreateComponents(e){return e.components??Fe}_createPositionBuffer(e,t){let r=e.vertexAttributes.position;const o=t.reprojection===Ue.ECEF?t.transformBeforeProject:null;if(o&&(r=$(new Float64Array(r.length),r,o)),t.reprojection===Ue.NONE)return t.needsBufferCopy?new Float64Array(r):r;const a=o?r:new Float64Array(r.length);return M(r,e.spatialReference,0,a,this._context.renderCoordsHelper.spatialReference,0,r.length/3),a}_createNormalBuffer(e,t,r){let o=e.vertexAttributes.normal;if(null==o)return null;const a=r.reprojection===Ue.ECEF?r.transformBeforeProject:null;a&&(o=D(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Ue.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return H(o,s,t,e.spatialReference,n)}_createTangentBuffer(e,t,r){let o=e.vertexAttributes.tangent;if(null==o)return null;const a=r.reprojection===Ue.ECEF?r.transformBeforeProject:null;a&&(o=q(o,new Float32Array(o.length),a));if("local"===this._context.graphicsCoreOwner.view.viewingMode||r.reprojection===Ue.NONE)return r.needsBufferCopy&&e.vertexAttributes.normal===o?new Float32Array(o):o;const s=e.vertexAttributes.position,n=a?o:new Float32Array(o.length);return k(o,s,t,e.spatialReference,n)}_createColorBuffer(e){return e.vertexAttributes.color}_createSymbolColorBuffer(e){if(this._requiresSymbolVertexColors()){const t=this._getVertexOpacityAndColor(e),r=ne(this.symbolLayer?.material?.colorMixMode),o=new Uint8Array(4);return ie(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,a=e.vertexAttributes.uv,s=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(s&&s.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(a&&a.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 n=this._computeReprojectionInfo(e),i=this._createPositionBuffer(e,n),l=this._createColorBuffer(e),u=this._createSymbolColorBuffer(t),m=this._createNormalBuffer(e,i,n),h=this._createTangentBuffer(e,i,n);return{positionBuffer:i,normalBuffer:m,tangentBuffer:h,uvBuffer:a,colorBuffer:l,symbolColorBuffer:u,objectTransformation:n.reprojection===Ue.NONE&&n.objectTransformation?n.objectTransformation:this._transformOriginLocal(e,i,m,h),geometryTransformation:n.reprojection===Ue.NONE&&n.geometryTransformation?n.geometryTransformation:c()}}_computeReprojectionInfo(e){const{vertexSpace:t}=e,r="georeferenced"===t.type?this._context.renderCoordsHelper.viewingMode===Y.Local?Ue.NONE:Ue.ECEF:Ue.NONE;if(L(t)){const o=t.origin,a=c(),i=e.transform?.localMatrix??u;if(r===Ue.NONE){j(e.spatialReference,o,a,this._context.renderCoordsHelper.spatialReference);return{reprojection:r,objectTransformation:a,geometryTransformation:m(i),needsBufferCopy:!1}}const l=s(c(),o);return n(l,l,i),{reprojection:r,transformBeforeProject:l,needsBufferCopy:!0}}return{reprojection:r,needsBufferCopy:!0}}_transformOriginLocal(e,t,a,s){const n=this._context.renderCoordsHelper.spatialReference,l=e.anchor;Me[0]=l.x,Me[1]=l.y,Me[2]=l.z??0;const u=c();return j(e.spatialReference,Me,u,n),i(Ee,u),$(t,t,Ee),(a||s)&&(r(Ie,u),o(Ie,Ie),a&&V(a,a,Ie),s&&V(s,s,Ie,4)),u}_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}_getOrCreateFaces(e,t){return t.faces??N(e.vertexAttributes.position.length/3)}_isOutsideClippingArea(e){if(!this._context.clippingExtent)return!1;const t=e.vertexAttributes?.position;if(!t)return!1;const r=this._context.elevationProvider.spatialReference,o=G({positions:t,transform:e.transform,vertexSpace:e.vertexSpace,inSpatialReference:e.spatialReference,outSpatialReference:r??e.spatialReference,localMode:this._context.stage.viewingMode===Y.Local}),a=o.length/3;return A(Se),R(Se,o,0,a),!E(Se,this._context.clippingExtent)}_createGeometryInfo(e,t,r){if(!w(e.spatialReference,this._context.graphicsCoreOwner.view.spatialReference))return this.logger.warn("Geometry spatial reference is not compatible with the view"),null;if(this._isOutsideClippingArea(e))return null;const o=this._createBuffers(e,t);if(null==o)return null;const{positionBuffer:a,uvBuffer:s,colorBuffer:n,symbolColorBuffer:i,normalBuffer:c,tangentBuffer:u,objectTransformation:m,geometryTransformation:h}=o,f=this._getOrCreateComponents(e),p=new Array;let d=!1;const g=l(Oe,m),x=this._context.localOriginFactory.getOrigin(g);for(const l of f){if(!this._validateFaces(e,l))return null;const t=this._getOrCreateFaces(e,l);if(0===t.length)continue;const o=this._createComponentNormals(a,c,l,t);o.didFlipNormals&&(d=!0);const m=[[ge.POSITION,new ce(a,t,3,!0)],[ge.NORMAL,new ce(o.normals,o.indices,3,!0)]];n&&m.push([ge.COLOR,new ce(n,t,4,!0)]),i&&m.push([ge.SYMBOLCOLOR,new ce(i,S(t.length),4,!0)]),s&&m.push([ge.UV0,new ce(s,t,2,!0)]),u&&m.push([ge.TANGENT,new ce(u,t,4,!0)]);const f=this._context.stage.renderView.getObjectAndLayerIdColor({graphicUid:r,layerUid:this._context.layer.uid}),g=this._getOrCreateMaterial(e,l),_=new fe(g,m,null,he.Mesh,f);_.transformation=h,_.localOrigin=x,p.push(_)}return d&&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:p,objectTransformation:m}}_updateMaterialParameters(e){this._materialInfoCache.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachMaterialInfo(e),this._fastUpdateProcessor.forEachClonedMaterial(((e,t)=>{t.setParameters(e.parameters)}))}test(){return{...super.test(),materials:this._materialInfoCache.materials}}}class je{constructor(e,t,r){this.normals=e,this.indices=t,this.didFlipNormals=r}}const Me=v(),Oe=v(),Pe=v(),Ae=v(),Re=v(),Ee=c(),Ie=a(),Ne=c(),Se=P(),Fe=[new F],Be=new U;var Ue;!function(e){e[e.NONE=0]="NONE",e[e.ECEF=1]="ECEF"}(Ue||(Ue={}));export{we 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.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{normalFromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{e as
|
|
5
|
+
import{adjustStaticAGOUrl as e}from"../../../../core/devEnvironmentUtils.js";import{normalFromMat4 as t}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as o}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{e as n,f as l,G as a,l as u,n as c,k as m}from"../../../../chunks/vec32.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as d,expandWithVec3 as p}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as g}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec4f as x,BufferViewVec4u8 as b,BufferViewVec4u16 as h,BufferViewVec3f as T,BufferViewVec3u8 as w,BufferViewVec3u16 as y}from"../../../../geometry/support/buffer/BufferView.js";import{a as v,b as R,s as j}from"../../../../chunks/vec3.js";import{t as M,s as B}from"../../../../chunks/vec4.js";import{n as S}from"../../../../chunks/vec2.js";import{c as F}from"../../../../chunks/vec33.js";import{c as A}from"../../../../chunks/vec43.js";import{DefaultLoadingContext as L}from"../../glTF/DefaultLoadingContext.js";import{loadGLTF as E}from"../../glTF/loader.js";import{convertPrimitiveToTriangles as O}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as I}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as C}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as k}from"./ProcessedObjectResource.js";import{load as N,processLoadResult as P}from"./wosrLoader.js";import{NormalType as U}from"../../webgl-engine/core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{Attribute as V}from"../../webgl-engine/lib/Attribute.js";import{AlphaDiscardMode as _,DepthTestFunction as D,CullFaceOptions as G}from"../../webgl-engine/lib/basicInterfaces.js";import{Geometry as H}from"../../webgl-engine/lib/Geometry.js";import{Texture as q}from"../../webgl-engine/lib/Texture.js";import{VertexAttribute as W}from"../../webgl-engine/lib/VertexAttribute.js";import{DefaultMaterial as $}from"../../webgl-engine/materials/DefaultMaterial.js";import{colorGamma as z}from"../../webgl-engine/materials/DefaultMaterial_COLOR_GAMMA.js";import{defaultEsriSymbologyMRRFactors as K,defaultAdvancedMRRFactors as Q,useSchematicPBR as J,defaultSchematicMRRFactors as X}from"../../webgl-engine/materials/pbrUtils.js";async function Y(t,r){const o=Z(e(t));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):N(o.url,r)),{engineResources:t,referenceBoundingBox:s}=P(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}const s=await(r.cache?r.cache.loadGLTF(o.url,r,!!r.usePBR):E(new L(r.streamDataRequester),o.url,r,r.usePBR)),i=s.model.meta?.ESRI_proxyEllipsoid,n=s.meta.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.meta.ESRI_webstyle;n&&!s.customMeta.esriTreeRendering&&(s.customMeta.esriTreeRendering=!0,ie(s,i));const l=!!r.usePBR,a=s.meta.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:[...K]}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:[...Q]},u={...r.materialParameters,treeRendering:n},{engineResources:c,referenceBoundingBox:m}=ee(s,a,u,r.skipHighLods&&null==o.specifiedLodIndex?{skipHighLods:!0}:{skipHighLods:!1,singleLodIndex:o.specifiedLodIndex});return{lods:c,referenceBoundingBox:m,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function Z(e){const t=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(t)return{fileType:"gltf",url:t[1],specifiedLodIndex:null!=t[4]?Number(t[4]):null};return e.match(/(.*\.(json|json\.gz))$/)?{fileType:"wosr",url:e,specifiedLodIndex:null}:{fileType:"unknown",url:e,specifiedLodIndex:null}}function ee(e,t,r,o){const s=e.model,i=new Array,n=new Map,l=new Map,a=s.lods.length,u=d();return s.lods.forEach(((e,c)=>{const m=!0===o.skipHighLods&&(a>1&&0===c||a>3&&1===c)||!1===o.skipHighLods&&null!=o.singleLodIndex&&c!==o.singleLodIndex;if(m&&0!==c)return;const f=new k(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach((e=>{const o=m?new $({}):te(s,e,f,t,r,n,l),{geometry:i,vertexCount:a}=re(e,null!=o?o:new $({})),d=i.boundingInfo;null!=d&&0===c&&(p(u,d.bbMin),p(u,d.bbMax)),null!=o&&(f.stageResources.geometries.push(i),f.numberOfVertices+=a)})),m||i.push(f)})),{engineResources:i,referenceBoundingBox:u}}function te(e,t,r,o,s,n,l){const a=t.material+(t.attributes.normal?"_normal":"")+(t.attributes.color?"_color":"")+(t.attributes.texCoord0?"_texCoord0":"")+(t.attributes.tangent?"_tangent":""),u=e.materials.get(t.material),c=null!=t.attributes.texCoord0,m=null!=t.attributes.normal;if(null==u)return null;const f=se(u.alphaMode);if(!n.has(a)){if(c){const t=(t,r=!1)=>{if(null!=t&&!l.has(t)){const o=e.textures.get(t);if(null!=o){const e=o.data;l.set(t,new q(I(e)?e.data:e,{...o.parameters,preMultiplyAlpha:!I(e)&&r,encoding:I(e)&&null!=e.encoding?e.encoding:void 0}))}}};t(u.textureColor,f!==_.Opaque),t(u.textureNormal),t(u.textureOcclusion),t(u.textureEmissive),t(u.textureMetallicRoughness)}const r=u.color[0]**(1/z),d=u.color[1]**(1/z),p=u.color[2]**(1/z),g=u.emissiveFactor[0]**(1/z),x=u.emissiveFactor[1]**(1/z),b=u.emissiveFactor[2]**(1/z),h=null!=u.textureColor&&c?l.get(u.textureColor):null,T=J({normalTexture:u.textureNormal,metallicRoughnessTexture:u.textureMetallicRoughness,metallicFactor:u.metallicFactor,roughnessFactor:u.roughnessFactor,emissiveTexture:u.textureEmissive,emissiveFactor:u.emissiveFactor,occlusionTexture:u.textureOcclusion}),w=null!=u.normalTextureTransform?.scale?u.normalTextureTransform?.scale:i;n.set(a,new $({...o,transparent:f===_.Blend,customDepthTest:D.Lequal,textureAlphaMode:f,textureAlphaCutoff:u.alphaCutoff,diffuse:[r,d,p],ambient:[r,d,p],opacity:u.opacity,doubleSided:u.doubleSided,doubleSidedType:"winding-order",cullFace:u.doubleSided?G.None:G.Back,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:m?U.Attribute:U.ScreenDerivative,castShadows:!0,receiveShadows:u.receiveShadows,receiveAmbientOcclusion:u.receiveAmbientOcclustion,textureId:null!=h?h.id:void 0,colorMixMode:u.colorMixMode,normalTextureId:null!=u.textureNormal&&c?l.get(u.textureNormal).id:void 0,textureAlphaPremultiplied:null!=h&&!!h.parameters.preMultiplyAlpha,occlusionTextureId:null!=u.textureOcclusion&&c?l.get(u.textureOcclusion).id:void 0,emissiveTextureId:null!=u.textureEmissive&&c?l.get(u.textureEmissive).id:void 0,metallicRoughnessTextureId:null!=u.textureMetallicRoughness&&c?l.get(u.textureMetallicRoughness).id:void 0,emissiveFactor:[g,x,b],mrrFactors:T?[...X]:[u.metallicFactor,u.roughnessFactor,o.mrrFactors[2]],isSchematic:T,colorTextureTransformMatrix:C(u.colorTextureTransform),normalTextureTransformMatrix:C(u.normalTextureTransform),scale:[w[0],w[1]],occlusionTextureTransformMatrix:C(u.occlusionTextureTransform),emissiveTextureTransformMatrix:C(u.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:C(u.metallicRoughnessTextureTransform),...s}))}const d=n.get(a);if(r.stageResources.materials.push(d),c){const e=e=>{null!=e&&r.stageResources.textures.push(l.get(e))};e(u.textureColor),e(u.textureNormal),e(u.textureOcclusion),e(u.textureEmissive),e(u.textureMetallicRoughness)}return d}function re(e,r){const o=e.attributes.position.count,s=O(e.indices||o,e.primitiveType),i=g(3*o),{typedBuffer:n,typedBufferStride:l}=e.attributes.position;v(i,n,e.transform,3,l);const a=[[W.POSITION,new V(i,s,3,!0)]];if(null!=e.attributes.normal){const r=g(3*o),{typedBuffer:i,typedBufferStride:n}=e.attributes.normal;t(oe,e.transform),R(r,i,oe,3,n),a.push([W.NORMAL,new V(r,s,3,!0)])}if(null!=e.attributes.tangent){const r=g(4*o),{typedBuffer:i,typedBufferStride:n}=e.attributes.tangent;t(oe,e.transform),M(r,i,oe,4,n),a.push([W.TANGENT,new V(r,s,4,!0)])}if(null!=e.attributes.texCoord0){const t=g(2*o),{typedBuffer:r,typedBufferStride:i}=e.attributes.texCoord0;S(t,r,2,i),a.push([W.UV0,new V(t,s,2,!0)])}if(null!=e.attributes.color){const t=new Uint8Array(4*o);4===e.attributes.color.elementCount?e.attributes.color instanceof x?B(t,e.attributes.color,255):e.attributes.color instanceof b?A(t,e.attributes.color):e.attributes.color instanceof h&&B(t,e.attributes.color,1/256):(t.fill(255),e.attributes.color instanceof T?j(t,e.attributes.color,255,4):e.attributes.color instanceof w?F(t,e.attributes.color.typedBuffer,4,e.attributes.color.typedBufferStride):e.attributes.color instanceof y&&j(t,e.attributes.color,1/256,4)),a.push([W.COLOR,new V(t,s,4,!0)])}return{geometry:new H(r,a),vertexCount:o}}const oe=r();function se(e){switch(e){case"BLEND":return _.Blend;case"MASK":return _.Mask;case"OPAQUE":case null:case void 0:return _.Opaque}}function ie(e,t){for(let r=0;r<e.model.lods.length;++r){const i=e.model.lods[r];for(const d of i.parts){const i=d.attributes.normal;if(null==i)return;const p=d.attributes.position,g=p.count,x=f(),h=f(),w=f(),y=new Uint8Array(4*g),v=new Float64Array(3*g),R=o(s(),d.transform);let j=0,M=0;for(let o=0;o<g;o++){p.getVec(o,h),i.getVec(o,x),n(h,h,d.transform),l(w,h,t.center),a(w,w,t.radius);const s=w[2],f=u(w),g=Math.min(.45+.55*f*f,1);a(w,w,t.radius),null!==R&&n(w,w,R),c(w,w),r+1!==e.model.lods.length&&e.model.lods.length>1&&m(w,w,x,s>-1?.2:Math.min(-4*s-3.8,1)),v[j]=w[0],v[j+1]=w[1],v[j+2]=w[2],j+=3,y[M]=255*g,y[M+1]=255*g,y[M+2]=255*g,y[M+3]=255,M+=4}d.attributes.normal=new T(v),d.attributes.color=new b(y)}}}export{Y as fetch,ee as gltfToEngineResources,Z as parseUrl};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,i as r,g as i,n,y as o,j as u,q as c,s as a,m as l,b as d,E as _,C as h}from"../../../../chunks/vec32.js";import{create as f,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as T}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as F}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as E,PointIndex as g}from"../../../../geometry/support/frustum.js";import{create as I,projectVector as R,fromPoints as A,getNormal as O,signedDistance as S}from"../../../../geometry/support/plane.js";import{wrap as b}from"../../../../geometry/support/ray.js";import{ViewingMode as P}from"../../../ViewingMode.js";import{FeatureTileDescriptor3D as B,Visibility as j}from"./FeatureTileDescriptor3D.js";import{Frustum as H}from"../../state/Frustum.js";import{FrustumExtentIntersection as x}from"../../support/FrustumExtentIntersection.js";class N{constructor(e){this._renderCoordsHelper=e,this._surfaceElevation=0,this._cache=new Map,this._frustumBoundingSphereCenter=f(),this._frustumBoundingSphereRadius=0,this._frustum=new H(e),this._extendedFrustum=new H(e),this._intersector=new x({renderCoordsHelper:e}),this._renderCoordsHelper=e}begin(e,t){this._surfaceElevation=t,this._aboveGround=this._renderCoordsHelper.getAltitude(e.eye)>t,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e),this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(e){const t=this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]>=V&&e.lij[0]<C,s=this._getOrCalculateSingleTileVisibility(e,!t);return s!==j.INVISIBLE&&t?this._calculateAggregatedChildrenVisibility(e):s}_shortenFrustumFarPlane(e){const t=H.nearFarLineIndices,n=e.mutablePoints;for(const o of t){const[e,t]=o,u=n[e],c=n[t];s(y,c,u),r(y,y,M),i(n[t],u,y)}e.updatePoints(n)}_calculateAggregatedChildrenVisibility(e){let t=j.INVISIBLE;const s=this._cache.get(e.id);if(null!=s)return s;const r=U.acquire();e.getChildren(r);for(const i of r){const e=this.calculate(i);if(e!==j.INVISIBLE&&(t=e,e===j.VISIBLE_ON_SURFACE))break}return U.release(r),this._cache.set(e.id,t),t}_getOrCalculateSingleTileVisibility(e,t){const s=this._cache.get(e.id);if(null!=s)return s;const r=this._calculateSingleTileVisibility(e);return t&&this._cache.set(e.id,r),r}_calculateSingleTileVisibility(e){if(!this._aboveGround&&this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]<G){return this._calculateSingleTileVisibilitySided(e,!1)===j.INVISIBLE?this._calculateSingleTileVisibilitySided(e,!0):void 0}return this._calculateSingleTileVisibilitySided(e,this._aboveGround)}_isTileVisibleInFrustum(e){return this._renderCoordsHelper.viewingMode===P.Local?this._isTileVisibleInFrustumLocal(e):this._isTileVisibleInFrustumGlobal(e)}_updateFrustumBoundingSphere(){const e=this._frustum,t=e.origin,s=
|
|
5
|
+
import{acosClamped as e}from"../../../../core/mathUtils.js";import t from"../../../../core/ObjectPool.js";import{f as s,i as r,g as i,n,y as o,j as u,q as c,s as a,m as l,b as d,E as _,C as h}from"../../../../chunks/vec32.js";import{create as f,fromValues as m}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as p}from"../../../../geometry/ellipsoidUtils.js";import{projectBuffer as T}from"../../../../geometry/projection/projectBuffer.js";import{projectVec3Array as F}from"../../../../geometry/projection/projectVec3Array.js";import{PlaneIndex as E,PointIndex as g}from"../../../../geometry/support/frustum.js";import{create as I,projectVector as R,fromPoints as A,getNormal as O,signedDistance as S}from"../../../../geometry/support/plane.js";import{wrap as b}from"../../../../geometry/support/ray.js";import{ViewingMode as P}from"../../../ViewingMode.js";import{FeatureTileDescriptor3D as B,Visibility as j}from"./FeatureTileDescriptor3D.js";import{Frustum as H}from"../../state/Frustum.js";import{FrustumExtentIntersection as x}from"../../support/FrustumExtentIntersection.js";class N{constructor(e){this._renderCoordsHelper=e,this._surfaceElevation=0,this._cache=new Map,this._frustumBoundingSphereCenter=f(),this._frustumBoundingSphereRadius=0,this._frustum=new H(e),this._extendedFrustum=new H(e),this._intersector=new x({renderCoordsHelper:e}),this._renderCoordsHelper=e}begin(e,t){this._surfaceElevation=t,this._aboveGround=this._renderCoordsHelper.getAltitude(e.eye)>t,this._frustum.update(e),this._shortenFrustumFarPlane(this._frustum),this._updateExtendedFrustum(e),this._updateFrustumBoundingSphere()}end(){this._cache.clear()}calculate(e){const t=this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]>=V&&e.lij[0]<C,s=this._getOrCalculateSingleTileVisibility(e,!t);return s!==j.INVISIBLE&&t?this._calculateAggregatedChildrenVisibility(e):s}_shortenFrustumFarPlane(e){const t=H.nearFarLineIndices,n=e.mutablePoints;for(const o of t){const[e,t]=o,u=n[e],c=n[t];s(y,c,u),r(y,y,M),i(n[t],u,y)}e.updatePoints(n)}_calculateAggregatedChildrenVisibility(e){let t=j.INVISIBLE;const s=this._cache.get(e.id);if(null!=s)return s;const r=U.acquire();e.getChildren(r);for(const i of r){const e=this.calculate(i);if(e!==j.INVISIBLE&&(t=e,e===j.VISIBLE_ON_SURFACE))break}return U.release(r),this._cache.set(e.id,t),t}_getOrCalculateSingleTileVisibility(e,t){const s=this._cache.get(e.id);if(null!=s)return s;const r=this._calculateSingleTileVisibility(e);return t&&this._cache.set(e.id,r),r}_calculateSingleTileVisibility(e){if(!this._aboveGround&&this._renderCoordsHelper.viewingMode===P.Global&&e.lij[0]<G){return this._calculateSingleTileVisibilitySided(e,!1)===j.INVISIBLE?this._calculateSingleTileVisibilitySided(e,!0):void 0}return this._calculateSingleTileVisibilitySided(e,this._aboveGround)}_isTileVisibleInFrustum(e){return this._renderCoordsHelper.viewingMode===P.Local?this._isTileVisibleInFrustumLocal(e):this._isTileVisibleInFrustumGlobal(e)}_updateFrustumBoundingSphere(){const e=this._frustum,t=e.origin,s=ce;n(s,e.direction);const r=e.points,i=ae;o(i,r[4],t);const a=.5*u(i,i)/u(s,i),l=this._frustumBoundingSphereCenter;c(l,t,s,a);const d=1+a;this._frustumBoundingSphereRadius=d}_isTileVisibleInFrustumLocal(e){const t=e.tilingScheme.spatialReference,s=e.extent,r=this._renderCoordsHelper.spatialReference,i=Q;if(i[0]=s[0],i[1]=s[1],i[2]=0,i[3]=s[2],i[4]=s[3],i[5]=0,!T(i,t,0,i,r,0,2))return!1;const n=Z;a(n[0],i[0],i[1],0),a(n[1],i[3],i[1],0),a(n[2],i[3],i[4],0),a(n[3],i[0],i[4],0);const d=$;a(d,.5*(i[0]+i[3]),.5*(i[1]+i[4]),.5*(i[2]+i[5]));const _=ee;a(_,0,0,1);const h=.5*l(n[0],n[2]),f=this._frustum,m=this._frustumBoundingSphereRadius,p=this._frustumBoundingSphereCenter,F=de;o(F,p,d);const E=u(_,F),g=le;c(g,d,_,E);if(l(g,p)>h+m)return!1;const I=K,R=E+m,A=E-m;for(let o=0;o<4;++o)c(I[o],n[o],_,R),c(I[o+4],n[o],_,A);return!X(f.planes,I,8)}_isTileVisibleInFrustumGlobal(e){const t=e.tilingScheme.spatialReference,s=e.extent,_=this._renderCoordsHelper.spatialReference;if(e.lij[0]<Y)return!0;const h=Z,f=.5*(s[0]+s[2]);if(a(h[0],s[0],s[1],0),a(h[1],s[2],s[1],0),a(h[2],s[2],s[3],0),a(h[3],s[0],s[3],0),a(h[4],f,s[1],0),a(h[5],f,s[3],0),!F(h,t,0,h,_,0,6))return!1;const T=h[0][2]>0,E=h[3][2]<0,g=T||E,I=p(_).radius;if(g){const e=m(0,0,1),t=se;W(t,e,h[0]);const s=re;if(W(s,e,h[1]),T){const r=te,i=h[4],n=ie;W(n,i,e),W(r,n,i);const o=h[0];d(o,t,r),k(o,I);const u=h[1];d(u,s,r),k(u,I)}else if(E){const r=te,i=h[5],n=ie;W(n,i,e),W(r,i,n);const o=h[3];d(o,r,t),k(o,I);const u=h[2];d(u,r,s),k(u,I)}}const R=$;{const e=pe;o(e,h[3],h[0]),n(e,e);const t=Te;i(t,h[0],h[3]),r(t,t,.5);const s=-u(t,e),a=Fe,l=Ee;i(a,h[0],h[1]),r(a,a,.5),i(l,h[2],h[3]),r(l,l,.5);const d=ge;o(d,l,a),n(d,d);const _=-(s+u(e,a))/u(e,d);c(R,a,d,_),k(R,I)}const A=this._frustumBoundingSphereRadius,O=this._frustumBoundingSphereCenter,S=this._frustum,b=S.planes;if(h.some((e=>S.intersectsPoint(e))))return!0;if(S.intersectsPoint(R))return!0;const P=ne;n(P,R);const B=he;o(B,O,_e);const j=u(B,P);if(j<-A)return!1;const H=ue;n(H,h[0]);const x=u(H,P);if(x<=0)return!0;const N=oe;r(N,P,j);const V=l(N,O),C=t.isWGS84,G=e.lij,M=C&&G[2]===2**G[0]-1,L=C&&0===G[2],y=L?He:M?Be:be,v=L?xe:M?je:Pe,w=S.points;{const e=h,t=Ne,s=Ie,r=Re,i=_e;for(const n of y){const o=e[n];if(D(s,e[(n+1)%4],o),D(r,i,o),W(t,r,s),J(t,w,1))return!1}}let U=null;if(j<2*A){const e=2.5*A;if(V>x*e+A)return!1;const t=me,s=e/x;for(let i=0;i<4;++i)r(t[i],h[i],s/I);a(t[4],0,0,0),U=t}else{const e=(j+A)/x,t=(j-A)/x,s=fe;for(let i=0;i<4;++i){const n=h[i];r(s[i+4],n,t/I),r(s[i],n,e/I)}U=s}if(X(b,U,U.length))return!1;const z=S.lines,q=Ae,K=Oe;for(const r of v){n(q,h[r]);for(const e of z)if(n(K,e.direction),Me(K,q,U,w))return!1}return!0}_calculateSingleTileVisibilitySided(e,t){if(this._isTileVisibleInFrustum(e)){this._intersector.update(e.extent,e.tilingScheme.spatialReference,this._surfaceElevation,t);const s=p(e.tilingScheme.spatialReference).radius;return this._intersector.isVisibleInFrustum(this._frustum,s,!0)?j.VISIBLE_ON_SURFACE:j.VISIBLE_WHEN_EXTENDED}return j.INVISIBLE}_updateExtendedFrustum(t){this._extendedFrustum.update(t),this._shortenFrustumFarPlane(this._extendedFrustum);const s=this._renderCoordsHelper.worldUpAtPosition(t.eye,y);this._aboveGround||_(s,s);const i=e(-u(s,t.viewForward));if(this._hasExtendedFrustum=i>t.fovY/2,!this._hasExtendedFrustum)return;const n=this._extendedFrustumParameters(),o=this._extendedFrustum.mutablePoints;for(let e=0;e<4;e++){const t=n.pointIndices[e],s=o[t],i=this._renderCoordsHelper.getAltitude(s);if(n.needsAltitudeAdjustment(i)){switch(this._renderCoordsHelper.worldUpAtPosition(s,y),t){case g.FAR_BOTTOM_LEFT:case g.FAR_TOP_LEFT:case g.NEAR_BOTTOM_LEFT:case g.NEAR_TOP_LEFT:R(this._extendedFrustum.planes[E.LEFT],y,y);break;case g.FAR_BOTTOM_RIGHT:case g.FAR_TOP_RIGHT:case g.NEAR_BOTTOM_RIGHT:case g.NEAR_TOP_RIGHT:R(this._extendedFrustum.planes[E.RIGHT],y,y)}r(y,y,n.direction),this._renderCoordsHelper.intersectInfiniteManifold(b(s,y),n.zWithMargin,s)}}if(this._extendedFrustum.updatePoints(o),A(o[g.NEAR_BOTTOM_LEFT],o[g.NEAR_BOTTOM_RIGHT],o[g.NEAR_TOP_RIGHT],v),A(o[g.NEAR_BOTTOM_RIGHT],o[g.NEAR_TOP_RIGHT],o[g.NEAR_TOP_LEFT],w),u(O(v),O(w))<0){const e=this._extendedFrustum.mutablePoints;this._aboveGround?[e[g.NEAR_BOTTOM_LEFT],e[g.NEAR_BOTTOM_RIGHT]]=[e[g.NEAR_BOTTOM_RIGHT],e[g.NEAR_BOTTOM_LEFT]]:[e[g.NEAR_TOP_LEFT],e[g.NEAR_TOP_RIGHT]]=[e[g.NEAR_TOP_RIGHT],e[g.NEAR_TOP_LEFT]],this._extendedFrustum.updatePoints(e)}}_extendedFrustumParameters(){return this._aboveGround?this._extendedFrustumParametersAboveSurface():this._extendedFrustumParametersBelowSurface()}_extendedFrustumParametersAboveSurface(){const e=this._surfaceElevation-L;return{zWithMargin:e,pointIndices:H.planePointIndices.bottom,direction:-1,needsAltitudeAdjustment:t=>t>e}}_extendedFrustumParametersBelowSurface(){const e=this._surfaceElevation+L;return{zWithMargin:e,pointIndices:H.planePointIndices.top,direction:1,needsAltitudeAdjustment:t=>t<e}}}const V=2,C=6,G=12,M=.95,L=1,y=f(),v=I(),w=I(),U=new t(Array,(e=>{4!==e.length&&(e[0]=new B,e[1]=new B,e[2]=new B,e[3]=new B)}),(e=>{e[0].release(),e[1].release(),e[2].release(),e[3].release()}));function W(e,t,s){return d(e,t,s),n(e,e),e}function D(e,t,s){return o(e,t,s),n(e,e),e}function k(e,t){return r(e,e,t/h(e)),e}const z=[E.LEFT,E.RIGHT,E.BOTTOM,E.TOP,E.FAR];function q(e,t,s){for(let r=0;r<s;++r)if(S(e,t[r])<0)return!1;return!0}function X(e,t,s){for(const r of z)if(q(e[r],t,s))return!0;return!1}const Y=3;function J(e,t,s){for(const r of t)if(u(r,e)<s)return!1;return!0}const K=[f(),f(),f(),f(),f(),f(),f(),f()],Q=[0,0,0,0,0,0],Z=[f(),f(),f(),f(),f(),f()],$=f(),ee=f(),te=f(),se=f(),re=f(),ie=f(),ne=f(),oe=f(),ue=f(),ce=f(),ae=f(),le=f(),de=f(),_e=m(0,0,0),he=f(),fe=[f(),f(),f(),f(),f(),f(),f(),f()],me=[f(),f(),f(),f(),f()],pe=f(),Te=f(),Fe=f(),Ee=f(),ge=f(),Ie=f(),Re=f(),Ae=f(),Oe=f(),Se=f(),be=[0,1,2,3],Pe=[0,1,2,3],Be=[0,1,3],je=[0,1,3],He=[1,2,3],xe=[1,2,3],Ne=f();function Ve(e,t,s){let r=1/0,i=-1/0;for(const n of s){const e=u(t,n);r=Math.min(r,e),i=Math.max(i,e)}e[0]=r,e[1]=i}function Ce(e,t,s,r){let i=1/0,n=-1/0;for(const o of r){const r=u(s,o);if(i=Math.min(i,r),n=Math.max(n,r),i<=t&&n>=e)return!1}return!0}const Ge=[0,0];function Me(e,t,s,r){const i=Se;W(i,e,t);const n=Ge;return Ve(n,i,s),Ce(n[0],n[1],i,r)}export{N as FeatureTileVisibility3D,Y as globalTileLevelThreshold,X as isConvexHullOutsideOfFrustum};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{g as
|
|
5
|
+
import e from"../../../../core/PooledArray.js";import{castRenderScreenPointArray3 as t,createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{g as i,n as s}from"../../../../chunks/vec32.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as l,copy as c,negativeInfinity as a,width as u,height as h,expandPointInPlace as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as p}from"../../../../geometry/support/ray.js";import{sv3d as m}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as y}from"../../../../support/elevationInfoUtils.js";import{ViewingMode as f}from"../../../ViewingMode.js";import{computeMapPointFromVec3d as g}from"../../support/hitTest.js";import{fromRenderAtEye as R,fromScreen as _}from"../../support/geometryUtils/ray.js";import{defaultTolerance as I,newIntersector as v}from"../../webgl-engine/lib/Intersector.js";import{StoreResults as b,IntersectorType as w}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{isValidIntersectorResult as P,sliceFilterPredicate as j}from"../../webgl-engine/lib/intersectorUtils.js";class M{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=I,this._tmpRay=p(),this._tmpRegion=l(),this._validateHUDIntersector=v(this.viewingMode),this._validateHUDIntersector.options.hud=!1}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),L(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,L(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=b.MIN,this.computeIntersection(e,t,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(F,r,n),F[0]+=.0466,F[1]-=.0123,R(e,F,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||P(n)&&n.intersector!==w.TERRAIN||(t.options.selectionMode=!1,this.computeIntersection(e,t,r))}setTolerance(e=I){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort(((e,t)=>e.type===w.TERRAIN?1:t.type===w.TERRAIN?-1:0))}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort(((e,t)=>e.type===w.TERRAIN?1:t.type===w.TERRAIN?-1:0))}_getPickRay(e,t){const r=this._view.state.camera;return _(r,e,t)}_intersectRayFreePointLocal(e,t){return this.viewingMode!==f.Local||null==e||i(t,e.origin,s(m.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,r,s=0,o=null){if(null==e)return null;const l=this._view,c=n(l.spatialReference),a=null!=r?r.mode:"absolute-height",u=y(r)/c,h=("on-the-ground"!==a?u+s:0)*c/l.renderCoordsHelper.unitInMeters;if("absolute-height"===a){if(l.renderCoordsHelper.intersectInfiniteManifold(e,h,k)){const e=g(l,k);return e.z??=0,e.z-=u,e}return null}const{camera:d}=l.state,p=t(m.get());d.projectToRenderScreen(e.origin,p);const f=new T(null,this._forEachLayer),R=l.slicePlane,_=null!=R?j(R):null,I=v(this.viewingMode);I.options.store=b.MIN,I.options.verticalOffset=h;const P=e.origin,M=i(m.get(),P,e.direction);I.reset(P,M,d),I.point=p;const x=o?"type"in o&&"graphics"===o.type?e=>e.layerUid!==o.uid:e=>e.graphicUid!==o.uid:null;switch(a){case"relative-to-scene":{const e=e=>(!x||x(e))&&!!e.lastValidElevationBB;I.intersect(f.layers,p,this._tolerance,null,e),this._externalIntersectionHandlers.forAll((e=>{if(e.type===w.I3S||e.type===w.TERRAIN||e.type===w.TILES3D){const t=e.slicePlaneEnabled?_:null;e.intersect(I,t,I.rayBegin,I.rayEnd,p)}}));break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll((e=>{if(e.isGround){const t=e.slicePlaneEnabled?_:null;e.intersect(I,t,I.rayBegin,I.rayEnd,p)}}))}if(I.results.min.getIntersectionPoint(k)){const e=g(l,k);return e.z=s,e}return null}computeIntersection(e,r,n,s){if(null==e)return;const o=this._view.state.camera,l=t(m.get());o.projectToRenderScreen(e.origin,l);const c=new T(n,this._forEachLayer);r.options.selectOpaqueTerrainOnly=!n||!("include"in n||"exclude"in n);const a=e.origin,u=i(m.get(),e.origin,e.direction);r.reset(a,u,o),r.intersect(c.layers,l,this._tolerance);const h=this._view.slicePlane,d=null!=h?j(h):null;r.intersect(c.sliceableLayers,l,this._tolerance,d);const p=n&&(n.requiresGroundFeedback||n.enableDraped);this._externalIntersectionHandlers.forAll((e=>{const t=e.layerUid,n=Array.isArray(t),i=n?t:[t];n&&(r.options.filteredLayerUids=[]);let o=!1;for(const s of i){!c.filterLayerUid(s)?n&&r.options.filteredLayerUids.push(s):o=!0}if(r.options.isFiltered=!o,e.isGround&&p||!r.options.isFiltered){const t=e.slicePlaneEnabled?d:null;e.intersect(r,t,a,u,l,s)}}));const y=m.get(),f=this._view.basemapTerrain;if(n&&n.enableDraped&&null!=f.spatialReference&&r.results.ground.getIntersectionPoint(y)){const e=f.overlayManager.renderer,t=this._view.renderCoordsHelper.spatialReference,n=m.get();this._view.renderCoordsHelper.fromRenderCoords(y,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(y[0],y[1],y[2],t,"ground")??0,e.intersect(r,n,r.results.ground,(e=>c.filterRenderGeometry(e)))}r.sortResults(),this._processHUDResults(r)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,a);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new E(e);r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),n.push(t),d(i,t.screenPoint)};e.sortResults(t.all),null!=t.min.dist&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.dist&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,p=Math.max(0,i[0]-x),m=Math.max(0,i[1]-x),y=Math.min(u(i)+2*x,o-p),f=Math.min(h(i)+2*x,l-m);if(y<=0||f<=0)return;const g=new Uint8Array(y*f*4);this._view._stage.renderer.readHUDVisibility(p,m,y,f,g);let R=!0;const _=null==e.results.max.dist;let I=0;for(const c of n)for(const t of U){const r=4*(Math.min(c.screenPoint[0]+t[0],o)-i[0]+(Math.min(c.screenPoint[1]+t[1],l)-i[1])*y);if(!(r<0||r>=g.length)&&g[r]){R&&(e.results.min.copy(c.result),R=!1),_&&e.results.max.copy(c.result),e.options.store===b.ALL&&e.results.all.splice(I++,0,c.result);break}}}}const x=1,U=(()=>{const e=[],t=x;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class E{constructor(e){this.result=e,this.screenPoint=r()}}let H;function L(e){return H&&H.viewingMode===e||(H=v(e)),H}class T{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t((e=>{e.pickable&&this.filterLayerUid(e.apiLayerUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)}))}filterLayerUid(e){const{include:t,exclude:r}=this;return null==e?null==t&&null==r:(null==t||t.has(e))&&(null==r||!r.has(e))}filterRenderGeometry(e){return this.filterLayerUid(e.layerUid)}}function A(e){return"object"==typeof e&&"intersect"in e}const k=o(),F=r();export{M as SceneIntersectionHelper,A as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,h){this._fbos=e,this._format=t,this._name=h}get valid(){return null!=this._handle?.getTexture()}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.getTexture()}bind(e,t,h){this._handle&&this._handle.fbo.width===t&&this._handle.fbo.height===h
|
|
5
|
+
import{releaseMaybe as e}from"../../../core/maybe.js";class t{constructor(e,t,h){this._fbos=e,this._format=t,this._name=h}get valid(){return null!=this._handle?.getTexture()}dispose(){this._handle=e(this._handle)}get texture(){return this._handle?.getTexture()}bind(e,t,h){this._handle&&this._handle.fbo.width===t&&this._handle.fbo.height===h||(this._handle?.release(),this._handle=this._fbos.acquire(t,h,this._name,this._format)),e.unbindTexture(this._handle?.fbo.colorTexture),e.bindFramebuffer(this._handle?.fbo)}generateMipMap(){this._handle?.getTexture()?.descriptor?.hasMipmap&&this._handle?.getTexture()?.generateMipmap()}}export{t as OverlayFramebufferObject};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{s as _}from"../../../chunks/vec32.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as w}from"../support/debugFlags.js";import{OverlayIndex as b}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as v}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import{ShaderOutput as S}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as P}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as O}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as j}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as F,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as q}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as I}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as V}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as N}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as k}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as H}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as G}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{ClearBufferBit as J,TextureSamplingMode as K}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new P,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new j,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[q.DRAPED_MATERIAL,e=>e!==S.Highlight||this.hasHighlights],[q.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextures:t,stippleTextures:s,markerTextures:i}=r;this._shaderTechniques=new O({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new F(this._rctx,new I(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new A(r.textureRepository,this._shaderTechniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=q.DRAPED_MATERIAL,this._bindParameters.mainDepth=null,this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=k.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new G(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(Y.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._shaderTechniques=a(this._shaderTechniques),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMemoryForMaterial(e){return Array.from(this._renderers.values()).reduce(((r,t)=>r+t.getMemoryForMaterial(e)),0)}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,V)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this.view._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=i(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(v.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===H.SYNC))}get isEmpty(){return!w.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se;const r=this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)));return this._renderContext.renderOccludedMask=e,r}renders(e){return w.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==v.Occluded||this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)))}get mode(){return this.isEmpty?C.Disabled:this._renderTargets?.getTexture(v.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(v.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryViewsDirect();for(const r of this._renderTargets.targets)(r.content!==v.ColorNoRasterImage||this._needsColorWithoutRasterImage)&&(this._drawTarget(b.INNER,r,e),this._drawTarget(b.OUTER,r,e))}}_drawTarget(e,r,t){const s=this._overlays[e],i=s.canvasGeometries;if(0===i.numViews)return;const{alignPixelEnabled:a,contentPixelRatio:o}=t;this._screenToWorldRatio=o*s.mapUnitsPerPixel/this._bindParameters.overlayStretch;const n=r.output;if(this.isEmpty||n===S.Highlight&&!this.hasHighlights||n===S.Normal&&!this.hasWater||!s.hasSomeSizedView())return;const h=this._rctx;if(this._camera.pixelRatio=s.pixelRatio*o,this._renderContext.output=n,this._bindParameters.alignPixelEnabled=a,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=n===S.Normal?q.DRAPED_WATER:q.DRAPED_MATERIAL,r.content===v.Occluded&&(this._renderContext.renderOccludedMask=se),!this.renders(r.content))return void(this._renderContext.renderOccludedMask=L);const d=s.resolution;this._rctx.setViewport(e===b.INNER?0:d,0,d,d);const l=2*s.resolution,c=s.resolution,u=r.fbo;u.bind(h,l,c),e===b.INNER&&(h.setClearColor(0,0,0,0),h.clearSafe(J.COLOR_BUFFER_BIT));if(w.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==v.Occluded)for(let p=0;p<i.numViews;p++)this._setViewParameters(i.extents[p],s),this._ensureDebugPatternResources(s.resolution,re[e]),this._rctx.bindTechnique(this._debugTextureTechnique,this._renderContext.bindParameters,this._passParameters),this._rctx.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:a})=>{if(r.content===v.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&n===S.Color?this.bindTemporaryFramebuffer(l,c):null;for(let e=0;e<i.numViews;e++)this._setViewParameters(i.extents[e],s),a.render(this._renderContext);if(d){u.bind(h,l,c),this._overlayParameters.texture=d.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const r=this.pluginContext.techniqueRepository.acquire(z);this._rctx.bindTechnique(r,this._renderContext.bindParameters,this._overlayParameters),this._rctx.screen.draw(),r.release(),d.release()}})),h.bindFramebuffer(null),e===b.OUTER&&u.generateMipMap(),this._renderContext.renderOccludedMask=L}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(e,r,"overlay tmp");return t.rctx.clearSafe(J.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniques.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:a}of this._sortedRenderers)i=a.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),a=i>=0,o=s.renderGroup??(a?T.MapLayer:T.ViewLayer),n=r*o+(a?i:0);this._sortedRenderers.push(new ee(s,t,n))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let o=0;o<e;o++)for(let r=0;r<e;r++){const i=Math.floor(r/10),a=Math.floor(o/10);i<2||a<2||10*i>e-20||10*a>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&a?1&r^1&o?0:255:1&i^1&a?0:128)}const i=new Z(e);i.samplingMode=K.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t);const a=new U;a.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniques.acquire(N,a)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),sortedDrapeSources:Array.from(this._sortedRenderers).map((({drapeSource:e})=>e)),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],$.prototype,"hasHighlights",void 0),e([c()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c()],$.prototype,"_shaderTechniques",void 0),e([c({constructOnly:!0})],$.prototype,"view",void 0),e([c()],$.prototype,"worldToPCSRatio",void 0),e([c()],$.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c()],$.prototype,"isEmpty",null),e([c({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([u("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Evented.js";import{someMap as t}from"../../../core/MapUtils.js";import{releaseMaybe as s,disposeMaybe as i,destroyMaybe as a}from"../../../core/maybe.js";import o from"../../../core/PooledArray.js";import{watch as n,syncAndInitial as h,on as d}from"../../../core/reactiveUtils.js";import{someSet as l}from"../../../core/SetUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as u}from"../../../core/accessorSupport/decorators/subclass.js";import{ortho as p,fromTranslation as m}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{s as _}from"../../../chunks/vec32.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as y}from"../../ViewingMode.js";import{DrapeTargetType as R,DrapeSourceType as f,DrapedRenderGroup as T}from"../layers/interfaces.js";import{debugFlags as b}from"../support/debugFlags.js";import{OverlayIndex as w}from"./interfaces.js";import{Overlay as x}from"./Overlay.js";import{OverlayContent as v}from"./OverlayContent.js";import{OverlayRenderTargets as D}from"./OverlayRenderTargets.js";import{ShaderOutput as S}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as P}from"../../../chunks/TextureOnly.glsl.js";import{ShaderTechniqueRepository as O}from"../webgl-engine/core/shaderTechnique/ShaderTechniqueRepository.js";import{SyncRenderPlugin as E}from"../webgl-engine/effects/RenderPlugin.js";import{Camera as j}from"../webgl-engine/lib/Camera.js";import{GLMaterialRepository as A}from"../webgl-engine/lib/GLMaterialRepository.js";import{GridLocalOriginFactory as M}from"../webgl-engine/lib/GridLocalOriginFactory.js";import{RenderOccludedFlag as W}from"../webgl-engine/lib/Material.js";import{OverlayRenderContext as F,defaultRenderOccludedMask as L}from"../webgl-engine/lib/RenderContext.js";import{RenderSlot as q}from"../webgl-engine/lib/RenderSlot.js";import{ShadowMap as I}from"../webgl-engine/lib/ShadowMap.js";import{SortedRenderGeometryRenderer as V}from"../webgl-engine/lib/SortedRenderGeometryRenderer.js";import{TextureTechnique as N}from"../webgl-engine/lib/TextureTechnique.js";import{TextureTechniqueConfiguration as U}from"../webgl-engine/lib/TextureTechniqueConfiguration.js";import{TransparencyPassType as k}from"../webgl-engine/lib/TransparencyPassType.js";import{UpdatePolicy as H}from"../webgl-engine/lib/UpdatePolicy.js";import{AmbientLight as G}from"../webgl-engine/lighting/Lightsources.js";import{O as B}from"../../../chunks/OverlayCompositing.glsl.js";import{OverlayCompositingTechnique as z}from"../webgl-engine/shaders/OverlayCompositingTechnique.js";import{TaskPriority as Y,noBudget as X}from"../../support/Scheduler.js";import{ClearBufferBit as J,TextureSamplingMode as K}from"../../webgl/enums.js";import{Texture as Q}from"../../webgl/Texture.js";import{TextureDescriptor as Z}from"../../webgl/TextureDescriptor.js";let $=class extends E{constructor(e){super(e),this._overlays=null,this._renderTargets=null,this._overlayParameters=new B,this.hasHighlights=!1,this._hasWater=!1,this._renderers=new Map,this._sortedDrapeSourceRenderersDirty=!1,this._sortedRenderers=new o,this._passParameters=new P,this._materialRepository=null,this._screenToWorldRatio=1,this._localOriginFactory=null,this.unloadedMemory=0,this.ignoresMemoryFactor=!1,this._camera=new j,this.worldToPCSRatio=1,this.events=new r,this.longitudeCyclical=null,this.produces=new Map([[q.DRAPED_MATERIAL,e=>e!==S.Highlight||this.hasHighlights],[q.DRAPED_WATER,()=>this._hasWater]]),this._hasTargetWithoutRasterImage=!1,this._hasDrapedFeatureSource=!1,this._hasDrapedRasterSource=!1}initialize(){const e=this.view._stage.renderer.fboCache,r=this.view._stage.renderView,{waterTextures:t,stippleTextures:s,markerTextures:i}=r;this._shaderTechniques=new O({rctx:this._rctx,viewingMode:y.Local,stippleTextureRepository:s,markerTextureRepository:i,waterTextureRepository:t}),this._renderContext=new F(this._rctx,new I(e,this.view.state.viewingMode),null),this.addHandles([n((()=>t.updating),(()=>this.events.emit("content-changed")),h),n((()=>this.spatialReference),(e=>this._localOriginFactory=new M(e)),h),d((()=>this.view.allLayerViews),"after-changes",(()=>this._sortedDrapeSourceRenderersDirty=!0))]),this._materialRepository=new A(r.textureRepository,this._shaderTechniques,(()=>{this.notifyChange("rendersOccludedDraped"),this.events.emit("content-changed"),this.notifyChange("updating"),this.notifyChange("isEmpty")}),(()=>this.events.emit("content-changed"))),this._bindParameters.slot=q.DRAPED_MATERIAL,this._bindParameters.mainDepth=null,this._camera.near=1,this._camera.far=1e4,this._camera.relativeElevation=null,this._bindParameters.camera=this._camera,this._bindParameters.transparencyPassType=k.NONE,this._bindParameters.newLighting.noonFactor=0,this._bindParameters.newLighting.globalFactor=0,this._bindParameters.newLighting.set([new G(g(1,1,1))]),this.addHandles(this.view.resourceController.scheduler.registerTask(Y.STAGE,this))}destroy(){this._renderers.forEach((e=>e.destroy())),this._renderers.clear(),this._debugTextureTechnique=s(this._debugTextureTechnique),this._passParameters.texture=i(this._passParameters.texture),this._shaderTechniques=a(this._shaderTechniques),this.disposeOverlays()}get _bindParameters(){return this._renderContext.bindParameters}get _rctx(){return this.view._stage.renderView.renderingContext}get rctx(){return this._rctx}get materialRepository(){return this._materialRepository}get screenToWorldRatio(){return this._screenToWorldRatio}get localOriginFactory(){return this._localOriginFactory}initializeRenderContext(e){this.pluginContext=e}uninitializeRenderContext(){}renderNode(){}get updating(){return this._sortedDrapeSourceRenderersDirty||t(this._renderers,(e=>e.updating))}get hasOverlays(){return null!=this._overlays&&null!=this._renderTargets}getMemoryForMaterial(e){return Array.from(this._renderers.values()).reduce(((r,t)=>r+t.getMemoryForMaterial(e)),0)}get layers(){return this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers(),this._sortedRenderers.map((e=>e.drapeSource.layer)).filter((e=>!!e))}createGeometryDrapeSourceRenderer(e){return this.createDrapeSourceRenderer(e,V)}createDrapeSourceRenderer(e,r,t){const s=this._renderers.get(e);null!=s&&s.destroy();const i=new r({...t,rendererContext:this,drapeSource:e});return this._renderers.set(e,i),this._sortedDrapeSourceRenderersDirty=!0,"fullOpacity"in e&&this.addHandles(n((()=>e.fullOpacity),(()=>this.events.emit("content-changed"))),e),i}removeDrapeSourceRenderer(e){if(null==e)return;const r=this._renderers.get(e);null!=r&&(this._sortedDrapeSourceRenderersDirty=!0,this._renderers.delete(e),this.removeHandles(e),r.destroy())}computeValidity(){return this._renderTargets?.computeValidity()??0}releaseRenderTargets(){this._renderTargets?.dispose()}get overlays(){return this._overlays??[]}ensureDrapeTargets(e){this._hasTargetWithoutRasterImage=!!this._overlays&&l(e,(e=>e.drapeTargetType===R.WithoutRasterImage))}ensureDrapeSources(e){this._overlays?(this._hasDrapedFeatureSource=l(e,(e=>e.drapeSourceType===f.Features)),this._hasDrapedRasterSource=l(e,(e=>e.drapeSourceType===f.RasterImage))):this._hasDrapedFeatureSource=this._hasDrapedRasterSource=!1}get _needsColorWithoutRasterImage(){return this._hasDrapedRasterSource&&this._hasDrapedFeatureSource&&this._hasTargetWithoutRasterImage}ensureOverlays(e,r,t=this._bindParameters.overlayStretch){null==this._overlays&&(this._renderTargets=new D(this.view._stage.renderer.fboCache),this._overlays=[new x,new x]),this.ensureDrapeTargets(e),this.ensureDrapeSources(r),this._bindParameters.overlayStretch=t}disposeOverlays(){this._overlays=null,this._renderTargets=i(this._renderTargets),this.events.emit("textures-disposed")}getTexture(e){if(null!=e)return e===v.ColorNoRasterImage&&!this._needsColorWithoutRasterImage&&this._hasDrapedFeatureSource?this._renderTargets?.getTexture(v.Color):this._renderTargets?.getTexture(e)}get running(){return this.updating}runTask(e){this._processDrapeSources(e,(()=>!0))}_processDrapeSources(e,r){let s=!1;for(const[t,i]of this._renderers){if(e.done)break;(t.destroyed||r(t))&&(i.commitChanges()&&(s=!0,e.madeProgress()))}this._sortedDrapeSourceRenderersDirty&&(this._sortedDrapeSourceRenderersDirty=!1,s=!0,this._updateSortedDrapeSourceRenderers()),s&&(null!=this._overlays&&0===this._renderers.size&&this.disposeOverlays(),this.notifyChange("updating"),this.notifyChange("isEmpty"),this.events.emit("content-changed"),this.hasHighlights=t(this._renderers,(e=>e.hasHighlights)),this.notifyChange("rendersOccludedDraped"),this._updateHasWater())}processSyncDrapeSources(){this._processDrapeSources(X,(e=>e.updatePolicy===H.SYNC))}get isEmpty(){return!b.OVERLAY_DRAW_DEBUG_TEXTURE&&!t(this._renderers,(e=>!e.isEmpty))}get hasWater(){return this._hasWater}get rendersOccludedDraped(){const e=this._renderContext.renderOccludedMask;this._renderContext.renderOccludedMask=se;const r=this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)));return this._renderContext.renderOccludedMask=e,r}renders(e){return b.OVERLAY_DRAW_DEBUG_TEXTURE&&e!==v.Occluded||this._sortedRenderers.some((({renderer:e})=>e.shouldRender(this._renderContext)))}get mode(){return this.isEmpty?C.Disabled:this._renderTargets?.getTexture(v.WaterNormal)?C.EnabledWithWater:this._renderTargets?.getTexture(v.Color)?C.Enabled:C.Disabled}updateAnimation(e){let r=!1;return this._renderers.forEach((t=>r=t.updateAnimation(e)||r)),r}updateDrapeSourceOrder(){this._sortedDrapeSourceRenderersDirty=!0}drawOverlays(e){if(this._overlays&&this._renderTargets){for(const e of this._overlays)this.longitudeCyclical?e.setupGeometryViewsCyclical(this.longitudeCyclical):e.setupGeometryViewsDirect();for(const r of this._renderTargets.targets)(r.content!==v.ColorNoRasterImage||this._needsColorWithoutRasterImage)&&(this._drawTarget(w.INNER,r,e),this._drawTarget(w.OUTER,r,e))}}_drawTarget(e,r,t){const s=this._overlays[e],i=s.canvasGeometries;if(0===i.numViews)return;const{alignPixelEnabled:a,contentPixelRatio:o}=t;this._screenToWorldRatio=o*s.mapUnitsPerPixel/this._bindParameters.overlayStretch;const n=r.output;if(this.isEmpty||n===S.Highlight&&!this.hasHighlights||n===S.Normal&&!this.hasWater||!s.hasSomeSizedView())return;const h=this._rctx;if(this._camera.pixelRatio=s.pixelRatio*o,this._renderContext.output=n,this._bindParameters.alignPixelEnabled=a,this._bindParameters.screenToWorldRatio=this._screenToWorldRatio,this._bindParameters.screenToPCSRatio=this._screenToWorldRatio*this.worldToPCSRatio,this._bindParameters.slot=n===S.Normal?q.DRAPED_WATER:q.DRAPED_MATERIAL,r.content===v.Occluded&&(this._renderContext.renderOccludedMask=se),!this.renders(r.content))return void(this._renderContext.renderOccludedMask=L);const d=s.resolution;this._rctx.setViewport(e===w.INNER?0:d,0,d,d);const l=2*s.resolution,c=s.resolution,u=r.fbo;u.bind(h,l,c),e===w.INNER&&(h.setClearColor(0,0,0,0),h.clearSafe(J.COLOR_BUFFER_BIT));if(b.OVERLAY_DRAW_DEBUG_TEXTURE&&r.content!==v.Occluded)for(let p=0;p<i.numViews;p++)this._setViewParameters(i.extents[p],s),this._ensureDebugPatternResources(s.resolution,re[e]),this._rctx.bindTechnique(this._debugTextureTechnique,this._renderContext.bindParameters,this._passParameters),this._rctx.screen.draw();this._sortedRenderers.forAll((({drapeSource:t,renderer:a})=>{if(r.content===v.ColorNoRasterImage&&t.drapeSourceType===f.RasterImage)return;const{fullOpacity:o}=t,d=null!=o&&o<1&&n===S.Color?this.bindTemporaryFramebuffer(l,c):null;for(let e=0;e<i.numViews;e++)this._setViewParameters(i.extents[e],s),a.render(this._renderContext);if(d){u.bind(h,l,c),this._overlayParameters.texture=d.getTexture(),this._overlayParameters.opacity=o,this._overlayParameters.overlayIndex=e;const r=this.pluginContext.techniqueRepository.acquire(z);this._rctx.bindTechnique(r,this._renderContext.bindParameters,this._overlayParameters),this._rctx.screen.draw(),r.release(),d.release()}})),h.bindFramebuffer(null),e===w.OUTER&&u.generateMipMap(),this._renderContext.renderOccludedMask=L}bindTemporaryFramebuffer(e,r){const t=this.view._stage.renderer.fboCache,s=t.acquire(e,r,"overlay tmp");return t.rctx.unbindTexture(s.fbo.colorTexture),t.rctx.bindFramebuffer(s.fbo),t.rctx.clearSafe(J.COLOR_BUFFER_BIT),s}async reloadShaders(){await this._shaderTechniques.reloadAll()}notifyContentChanged(){this.events.emit("content-changed")}intersect(e,r,t,s){this._sortedDrapeSourceRenderersDirty&&this._updateSortedDrapeSourceRenderers();let i=0;for(const{renderer:a}of this._sortedRenderers)i=a.intersect?.(e,r,t,s,i)??i}_updateSortedDrapeSourceRenderers(){if(this._sortedRenderers.clear(),0===this._renderers.size)return;const e=this.view.map.allLayers,r=e.length;this._renderers.forEach(((t,s)=>{const i=e.indexOf(s.layer),a=i>=0,o=s.renderGroup??(a?T.MapLayer:T.ViewLayer),n=r*o+(a?i:0);this._sortedRenderers.push(new ee(s,t,n))})),this._sortedRenderers.sort(((e,r)=>e.index-r.index))}_setViewParameters(e,r){const t=this._camera;t.viewport=[0,0,r.resolution,r.resolution],p(t.projectionMatrix,0,e[2]-e[0],0,e[3]-e[1],t.near,t.far),m(t.viewMatrix,[-e[0],-e[1],0])}_updateHasWater(){const e=t(this._renderers,(e=>e.hasWater));e!==this._hasWater&&(this._hasWater=e,this.events.emit("has-water",e))}_ensureDebugPatternResources(e,r){if(_(this._passParameters.color,r[0],r[1],r[2]),this._passParameters.texture)return;const t=new Uint8Array(e*e*4);let s=0;for(let o=0;o<e;o++)for(let r=0;r<e;r++){const i=Math.floor(r/10),a=Math.floor(o/10);i<2||a<2||10*i>e-20||10*a>e-20?(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=255):(t[s++]=255,t[s++]=255,t[s++]=255,t[s++]=1&i&&1&a?1&r^1&o?0:255:1&i^1&a?0:128)}const i=new Z(e);i.samplingMode=K.NEAREST,this._passParameters.texture=new Q(this._rctx,i,t);const a=new U;a.hasAlpha=!0,this._debugTextureTechnique=this._shaderTechniques.acquire(N,a)}get test(){return{drapedRenderers:Array.from(this._renderers.values()),sortedDrapeSources:Array.from(this._sortedRenderers).map((({drapeSource:e})=>e)),getDrapeSourceRenderer:e=>this._renderers.get(e)}}};e([c()],$.prototype,"hasHighlights",void 0),e([c()],$.prototype,"_sortedDrapeSourceRenderersDirty",void 0),e([c()],$.prototype,"_shaderTechniques",void 0),e([c({constructOnly:!0})],$.prototype,"view",void 0),e([c()],$.prototype,"worldToPCSRatio",void 0),e([c()],$.prototype,"spatialReference",void 0),e([c({type:Boolean,readOnly:!0})],$.prototype,"updating",null),e([c()],$.prototype,"isEmpty",null),e([c({readOnly:!0})],$.prototype,"rendersOccludedDraped",null),$=e([u("esri.views.3d.terrain.OverlayRenderer")],$);class ee{constructor(e,r,t){this.drapeSource=e,this.renderer=r,this.index=t}}const re=[[1,.5,.5],[.5,.5,1]],te=-2,se=W.OccludeAndTransparent;export{$ as OverlayRenderer,te as drapedZ,se as overlayRenderOccludedFlag};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Error.js";import{watch as i,initial as s}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";let d=class extends r{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces="composite-color",this._context=null,this._dirty=!0}initialize(){this.addHandles([i((()=>this.view.ready),(e=>{e&&this.view._stage.renderer.addRenderNode(this)}),s)])}destroy(){this.view._stage?.renderer?.removeRenderNode(this)}render(){throw new t("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view._stage.renderView.renderingContext.gl}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import r from"../../../core/Accessor.js";import t from"../../../core/Error.js";import{watch as i,initial as s}from"../../../core/reactiveUtils.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";let d=class extends r{constructor(e){super(e),this.view=null,this.consumes={required:[]},this.produces="composite-color",this._context=null,this._dirty=!0}initialize(){this.addHandles([i((()=>this.view.ready),(e=>{e&&this.view._stage.renderer.addRenderNode(this)}),s)])}destroy(){this.view._stage?.renderer?.removeRenderNode(this)}render(){throw new t("RenderNode:render-function-not-implemented","render() is not implemented.")}get camera(){return this.view.state.camera.clone()}get sunLight(){return this.bindParameters.lighting.legacy}get gl(){return this.view._stage.renderView.renderingContext.gl}acquireOutputFramebuffer(){const e=this._frameBuffer?.getTexture()?.descriptor,r=this.view._stage.renderer.fboCache.acquire(e?.width??640,e?.height??480,this.produces);return r.fbo.initializeAndBind(),r}bindRenderTarget(){return this._frameBuffer?.fbo.initializeAndBind(),this._frameBuffer}requestRender(){this._dirty=!0}resetWebGLState(){this.renderingContext.resetState(),this.renderingContext.bindFramebuffer(this._frameBuffer?.fbo)}get fboCache(){return this.view._stage.renderer.fboCache}get bindParameters(){return this._context.bindParameters}get renderingContext(){return this.view._stage.renderView.renderingContext}updateAnimation(){return!!this._dirty&&(this._dirty=!1,!0)}doRender(e,r){this._context=r,this._frameBuffer=e.find((({name:e})=>e===this.produces));const t=this.render(e);return this.renderingContext.enforceState(),this._frameBuffer=null,t}};e([n({constructOnly:!0})],d.prototype,"view",void 0),e([n({constructOnly:!0})],d.prototype,"consumes",void 0),e([n()],d.prototype,"produces",void 0),d=e([o("esri.views.3d.webgl.RenderNode")],d);const a=d;export{a as default};
|
package/views/3d/webgl-engine/collections/Component/Material/ComponentTechniqueConfiguration.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as o}from"../../../../../../chunks/tslib.es6.js";import{ComponentDataType as e}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"./shader/VertexDiscardByOpacity.glsl.js";import{ShaderOutput as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as s}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as i}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NormalsDoubleSidedMode as a}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as d}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{BindType as n}from"../../../core/shaderTechnique/BindType.js";import{parameter as l,ShaderTechniqueConfiguration as c}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as h,AlphaDiscardMode as u}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as y}from"../../../lib/TransparencyPassType.js";var v;!function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(v||(v={}));class m extends c{constructor(){super(...arguments),this.output=r.Color,this.textureCoordinateType=i.None,this.componentData=e.Uniform,this.cullFace=h.Back,this.vertexDiscardMode=t.None,this.doubleSidedMode=a.WindingOrder,this.alphaDiscardMode=u.Opaque,this.integratedMeshMode=v.None,this.transparencyPassType=y.NONE,this.ellipsoidMode=d.Earth,this.pbrMode=p.Disabled,this.normalType=s.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.hasCloudsReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1}}o([l({count:r.COUNT})],m.prototype,"output",void 0),o([l({count:i.COUNT})],m.prototype,"textureCoordinateType",void 0),o([l({count:e.COUNT})],m.prototype,"componentData",void 0),o([l({count:h.COUNT})],m.prototype,"cullFace",void 0),o([l({count:t.COUNT})],m.prototype,"vertexDiscardMode",void 0),o([l({count:a.COUNT})],m.prototype,"doubleSidedMode",void 0),o([l({count:u.COUNT})],m.prototype,"alphaDiscardMode",void 0),o([l({count:v.COUNT})],m.prototype,"integratedMeshMode",void 0),o([l({count:y.COUNT})],m.prototype,"transparencyPassType",void 0),o([l({count:d.COUNT})],m.prototype,"ellipsoidMode",void 0),o([l({count:p.COUNT})],m.prototype,"pbrMode",void 0),o([l({count:s.COUNT})],m.prototype,"normalType",void 0),o([l()],m.prototype,"spherical",void 0),o([l()],m.prototype,"doublePrecisionRequiresObfuscation",void 0),o([l()],m.prototype,"hasVertexColors",void 0),o([l()],m.prototype,"hasNormals",void 0),o([l()],m.prototype,"hasSlicePlane",void 0),o([l()],m.prototype,"hasColorTexture",void 0),o([l()],m.prototype,"receiveAmbientOcclusion",void 0),o([l()],m.prototype,"receiveShadows",void 0),o([l()],m.prototype,"blendingEnabled",void 0),o([l()],m.prototype,"hasScreenSpaceReflections",void 0),o([l()],m.prototype,"hasPolygonOffset",void 0),o([l()],m.prototype,"hasMetallicRoughnessTexture",void 0),o([l()],m.prototype,"hasEmissionTexture",void 0),o([l()],m.prototype,"hasOcclusionTexture",void 0),o([l()],m.prototype,"hasNormalTexture",void 0),o([l()],m.prototype,"hasOccludees",void 0),o([l()],m.prototype,"multipassEnabled",void 0),o([l()],m.prototype,"cullAboveGround",void 0),o([l()],m.prototype,"hasCloudsReflections",void 0),o([l()],m.prototype,"snowCover",void 0),o([l()],m.prototype,"objectAndLayerIdColor",void 0),o([l({constValue:!1})],m.prototype,"occlusionPass",void 0),o([l({constValue:n.Draw})],m.prototype,"pbrTextureBindType",void 0),o([l({constValue:!0})],m.prototype,"hasSliceHighlight",void 0),o([l({constValue:!1})],m.prototype,"hasSliceInVertexProgram",void 0),o([l({constValue:!1})],m.prototype,"useCustomDTRExponentForWater",void 0),o([l({constValue:!1})],m.prototype,"hasVertexTangents",void 0),o([l({constValue:!0})],m.prototype,"supportsTextureAtlas",void 0),o([l({constValue:!1})],m.prototype,"highStepCount",void 0),o([l({constValue:!1})],m.prototype,"instancedDoublePrecision",void 0),o([l({constValue:!1})],m.prototype,"hasModelTransformation",void 0),o([l({constValue:!0})],m.prototype,"useFillLights",void 0),o([l({constValue:!1})],m.prototype,"objectAndLayerIdColorInstanced",void 0);export{m as ComponentTechniqueConfiguration,v as IntegratedMeshMode};
|
|
5
|
+
import{_ as o}from"../../../../../../chunks/tslib.es6.js";import{ComponentDataType as e}from"./shader/ComponentData.glsl.js";import{VertexDiscardMode as t}from"./shader/VertexDiscardByOpacity.glsl.js";import{ShaderOutput as r}from"../../../core/shaderLibrary/ShaderOutput.js";import{NormalType as s}from"../../../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{TextureCoordinateAttributeType as i}from"../../../core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{NormalsDoubleSidedMode as a}from"../../../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as p}from"../../../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{EllipsoidMode as d}from"../../../core/shaderLibrary/util/EllipsoidMode.js";import{BindType as n}from"../../../core/shaderTechnique/BindType.js";import{parameter as l,ShaderTechniqueConfiguration as c}from"../../../core/shaderTechnique/ShaderTechniqueConfiguration.js";import{CullFaceOptions as h,AlphaDiscardMode as u}from"../../../lib/basicInterfaces.js";import{TransparencyPassType as y}from"../../../lib/TransparencyPassType.js";var v;!function(o){o[o.None=0]="None",o[o.NoOverlay=1]="NoOverlay",o[o.ColorOverlay=2]="ColorOverlay",o[o.ColorOverlayWithWater=3]="ColorOverlayWithWater",o[o.COUNT=4]="COUNT"}(v||(v={}));class m extends c{constructor(){super(...arguments),this.output=r.Color,this.textureCoordinateType=i.None,this.componentData=e.Uniform,this.cullFace=h.Back,this.vertexDiscardMode=t.None,this.doubleSidedMode=a.WindingOrder,this.alphaDiscardMode=u.Opaque,this.integratedMeshMode=v.None,this.transparencyPassType=y.NONE,this.ellipsoidMode=d.Earth,this.pbrMode=p.Disabled,this.normalType=s.Attribute,this.spherical=!1,this.doublePrecisionRequiresObfuscation=!1,this.hasVertexColors=!1,this.hasNormals=!1,this.hasSlicePlane=!1,this.hasColorTexture=!1,this.receiveAmbientOcclusion=!0,this.receiveShadows=!0,this.blendingEnabled=!0,this.hasScreenSpaceReflections=!1,this.hasPolygonOffset=!1,this.hasMetallicRoughnessTexture=!1,this.hasEmissionTexture=!1,this.hasOcclusionTexture=!1,this.hasNormalTexture=!1,this.hasOccludees=!1,this.multipassEnabled=!1,this.cullAboveGround=!1,this.hasNormalTextureTransform=!1,this.hasCloudsReflections=!0,this.snowCover=!1,this.objectAndLayerIdColor=!1}}o([l({count:r.COUNT})],m.prototype,"output",void 0),o([l({count:i.COUNT})],m.prototype,"textureCoordinateType",void 0),o([l({count:e.COUNT})],m.prototype,"componentData",void 0),o([l({count:h.COUNT})],m.prototype,"cullFace",void 0),o([l({count:t.COUNT})],m.prototype,"vertexDiscardMode",void 0),o([l({count:a.COUNT})],m.prototype,"doubleSidedMode",void 0),o([l({count:u.COUNT})],m.prototype,"alphaDiscardMode",void 0),o([l({count:v.COUNT})],m.prototype,"integratedMeshMode",void 0),o([l({count:y.COUNT})],m.prototype,"transparencyPassType",void 0),o([l({count:d.COUNT})],m.prototype,"ellipsoidMode",void 0),o([l({count:p.COUNT})],m.prototype,"pbrMode",void 0),o([l({count:s.COUNT})],m.prototype,"normalType",void 0),o([l()],m.prototype,"spherical",void 0),o([l()],m.prototype,"doublePrecisionRequiresObfuscation",void 0),o([l()],m.prototype,"hasVertexColors",void 0),o([l()],m.prototype,"hasNormals",void 0),o([l()],m.prototype,"hasSlicePlane",void 0),o([l()],m.prototype,"hasColorTexture",void 0),o([l()],m.prototype,"receiveAmbientOcclusion",void 0),o([l()],m.prototype,"receiveShadows",void 0),o([l()],m.prototype,"blendingEnabled",void 0),o([l()],m.prototype,"hasScreenSpaceReflections",void 0),o([l()],m.prototype,"hasPolygonOffset",void 0),o([l()],m.prototype,"hasMetallicRoughnessTexture",void 0),o([l()],m.prototype,"hasEmissionTexture",void 0),o([l()],m.prototype,"hasOcclusionTexture",void 0),o([l()],m.prototype,"hasNormalTexture",void 0),o([l()],m.prototype,"hasOccludees",void 0),o([l()],m.prototype,"multipassEnabled",void 0),o([l()],m.prototype,"cullAboveGround",void 0),o([l()],m.prototype,"hasNormalTextureTransform",void 0),o([l()],m.prototype,"hasCloudsReflections",void 0),o([l()],m.prototype,"snowCover",void 0),o([l()],m.prototype,"objectAndLayerIdColor",void 0),o([l({constValue:!1})],m.prototype,"occlusionPass",void 0),o([l({constValue:n.Draw})],m.prototype,"pbrTextureBindType",void 0),o([l({constValue:!0})],m.prototype,"hasSliceHighlight",void 0),o([l({constValue:!1})],m.prototype,"hasSliceInVertexProgram",void 0),o([l({constValue:!1})],m.prototype,"useCustomDTRExponentForWater",void 0),o([l({constValue:!1})],m.prototype,"hasVertexTangents",void 0),o([l({constValue:!0})],m.prototype,"supportsTextureAtlas",void 0),o([l({constValue:!1})],m.prototype,"highStepCount",void 0),o([l({constValue:!1})],m.prototype,"instancedDoublePrecision",void 0),o([l({constValue:!1})],m.prototype,"hasModelTransformation",void 0),o([l({constValue:!0})],m.prototype,"useFillLights",void 0),o([l({constValue:!1})],m.prototype,"objectAndLayerIdColorInstanced",void 0);export{m as ComponentTechniqueConfiguration,v as IntegratedMeshMode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.30/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{ColorFormat as e,DepthFormat as t}from"../../webgl/formats.js";import{ManagedColorAttachment as
|
|
5
|
+
import{ColorFormat as e,DepthFormat as t}from"../../webgl/formats.js";import{ManagedColorAttachment as a}from"../../webgl/ManagedColorAttachment.js";import{ManagedDepthAttachment as r}from"../../webgl/ManagedDepthAttachment.js";import h from"../../webgl/ManagedFBO.js";import{AttachmentType as c}from"../../webgl/ManagedFBObject.js";import{FBOPool as i}from"./FBOPool.js";import{PixelFormat as o,SizedPixelFormat as s,TextureWrapMode as n,PixelType as _,TextureSamplingMode as d,RenderbufferFormat as l}from"../../../webgl/enums.js";import{FramebufferObject as m}from"../../../webgl/FramebufferObject.js";import{Renderbuffer as p}from"../../../webgl/Renderbuffer.js";import{RenderbufferDescriptor as u}from"../../../webgl/RenderbufferDescriptor.js";import{Texture as w}from"../../../webgl/Texture.js";import{TextureDescriptor as E}from"../../../webgl/TextureDescriptor.js";class C{constructor(e){this.rctx=e,this._acquired=new Set,this._cache=new i(e.newCache,"FBOCache"),this._depthCache=new i(e.newCache,"DepthAttachmentCache"),this._colorCache=new i(e.newCache,"ColorAttachmentCache")}destroy(){this._cache.destroy(),this._depthCache.destroy(),this._colorCache.destroy()}clean(){this._cache.clean(),this._colorCache.clean(),this._depthCache.clean()}frameStart(){this._cache.frame(),this._colorCache.frame(),this._depthCache.frame(),this.debugCallback&&this.debugCallback()}frameEnd(){const e=this.debugCallback;e&&this._acquired.forEach((t=>t.type===c.FBO&&e(t.name,t.fbo)))}get usedMemory(){return Array.from(this._acquired.values()).reduce(((e,t)=>e+("getTexture"in t?t.getTexture()?.usedMemory??0:t.usedMemory)),this._cache.usedMemory+this._colorCache.usedMemory+this._depthCache.usedMemory)}set interactive(e){this._cache.interactive=this._colorCache.interactive=this._depthCache.interactive=e}acquire(a,r,c,i=e.RGBA){const o=T(i,a,r);let s=this._cache.pop(o);return s?(s.retain(),s.setName(c)):s=new h(o,c,new m(this.rctx,{...F[i],width:a,height:r}),(e=>{e??=t.DEPTH_STENCIL_TEXTURE;const a=this._acquireDepth(e,s.fbo.width,s.fbo.height,`${s.name} depth`);return s.attachDepth(a),a.release(),s}),((t,h)=>{h??=e.RGBA;const c=this._acquireColor(h,a,r,`${s.name} color ${t}`);return s.attachColor(c,t),c.release(),s}),(()=>{this.debugCallback&&this.debugCallback(s.name,s.fbo),this._acquired.delete(s),s.detachAll(),this._cache.put(s)})),this._trackHandle(s)}acquireDepth(e,t,a,r){return this._acquireDepth(e,t,a,r)}_acquireDepth(e,a,h,c){const i=T(e,a,h),o=this._depthCache.pop(i);if(o)return o.retain(),o.name=c,this._trackHandle(o);const s=e===t.DEPTH_STENCIL_TEXTURE?new r(i,new w(this.rctx,{...x[e],width:a,height:h}),(()=>{this._acquired.delete(s),this._depthCache.put(s)})):new r(i,new p(this.rctx,{...x[e],width:a,height:h}),(()=>{this._acquired.delete(s),this._depthCache.put(s)}));return s.name=c,this._trackHandle(s)}_acquireColor(e,t,r,h){const c=T(e,t,r),i=this._colorCache.pop(c);if(i)return i.retain(),i.name=h,this._trackHandle(i);const o=new a(c,new w(this.rctx,{...F[e],width:t,height:r}),(()=>{this._acquired.delete(o),this._colorCache.put(o)}));return o.name=h,this._trackHandle(o)}_trackHandle(e){return this._acquired.add(e),e}}function T(e,t,a){return`${e}x${t}x${a}`}const f=new E;f.pixelFormat=o.RED,f.internalFormat=s.R8,f.wrapMode=n.CLAMP_TO_EDGE;const g=new E;g.pixelFormat=o.RG,g.internalFormat=s.RG8,g.wrapMode=n.CLAMP_TO_EDGE;const A=new E;A.internalFormat=s.RGBA4,A.dataType=_.UNSIGNED_SHORT_4_4_4_4,A.wrapMode=n.CLAMP_TO_EDGE;const M=new E;M.wrapMode=n.CLAMP_TO_EDGE;const b=new E;b.wrapMode=n.CLAMP_TO_EDGE,b.samplingMode=d.LINEAR_MIPMAP_LINEAR,b.hasMipmap=!0,b.maxAnisotropy=8;const R=new E;R.pixelFormat=o.RED,R.dataType=_.HALF_FLOAT,R.internalFormat=s.R16F,R.samplingMode=d.NEAREST;const D=new E;D.dataType=_.HALF_FLOAT,D.internalFormat=s.RGBA16F,D.samplingMode=d.NEAREST;const F={[e.RED]:f,[e.RG]:g,[e.RGBA4]:A,[e.RGBA]:M,[e.RGBA_MIPMAP]:b,[e.R16F]:R,[e.RGBA16F]:D},G=new E;G.pixelFormat=o.DEPTH_STENCIL,G.dataType=_.UNSIGNED_INT_24_8,G.samplingMode=d.NEAREST,G.wrapMode=n.CLAMP_TO_EDGE;const x={[t.DEPTH_STENCIL_TEXTURE]:G,[t.DEPTH16_BUFFER]:new u(l.DEPTH_COMPONENT16,4)};export{C as FBOCache};
|