@arcgis/core 4.31.0-next.20240620 → 4.31.0-next.20240621
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{3a74d3fc690177a703f5.js → 019ce38b02e3bf517125.js} +1 -1
- package/assets/esri/core/workers/chunks/{222807cfaa2e17d0efea.js → 6745cedf6f82c8917904.js} +1 -1
- package/assets/esri/core/workers/chunks/7b6cd976367a0dd297d6.js +1 -0
- package/assets/esri/core/workers/chunks/{8a948d46d0377a6adb86.js → 9d677af08238d9e09e72.js} +2 -2
- package/assets/esri/core/workers/chunks/bedf60888f07b78b314d.js +1 -0
- package/assets/esri/core/workers/chunks/c39237c00c1d588dc107.js +1 -0
- package/assets/esri/core/workers/chunks/de7fa31d86a65ccdffc1.js +1 -0
- package/assets/esri/core/workers/chunks/{8ee8f3c54b2cce217845.js → f13fb6b712e364bbf48c.js} +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ar.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bg.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_bs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ca.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_cs.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_da.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_de.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_el.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_es.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_et.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_fr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_he.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_hu.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_id.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_it.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ja.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ko.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lt.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_lv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nb.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_nl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-BR.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_pt-PT.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ro.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_ru.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sl.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_sv.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_th.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_tr.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_uk.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_vi.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-CN.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-HK.json +1 -1
- package/assets/esri/widgets/CatalogLayerList/t9n/CatalogLayerList_zh-TW.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ar.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bg.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_bs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ca.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_cs.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_da.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_de.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_el.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_es.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_et.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_fr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_he.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_hu.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_id.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_it.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ja.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ko.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lt.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_lv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nb.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_nl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-BR.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_pt-PT.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ro.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_ru.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sl.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_sv.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_th.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_tr.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_uk.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_vi.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-CN.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-HK.json +1 -1
- package/assets/esri/widgets/FeatureTable/t9n/FeatureTable_zh-TW.json +1 -1
- package/chunks/CheckerBoard.glsl.js +9 -6
- package/chunks/ComponentShader.glsl.js +4 -4
- package/chunks/ImageMaterial.glsl.js +1 -2
- package/interfaces.d.ts +50 -14
- package/layers/graphics/sources/FeatureLayerSource.js +1 -1
- package/layers/mixins/EditBusLayer.js +1 -1
- package/layers/mixins/FeatureLayerBase.js +1 -1
- package/layers/orientedImagery/core/ExposurePoint.js +1 -1
- package/layers/orientedImagery/transformations/imageToGroundUtils.js +1 -1
- package/layers/support/featureLayerUtils.js +1 -1
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/knowledgeGraph/wasmInterface/WasmDataModelWrapperInterfaces.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/layers/support/ExportStrategy.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObject3DGraphicLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentData.glsl.js +1 -2
- package/views/3d/webgl-engine/effects/RenderPlugin.js +1 -1
- package/views/3d/webgl-engine/lib/Material.js +1 -1
- package/views/3d/webgl-engine/lib/RenderingContext.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/EdgeView.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/interfaces.js +1 -1
- package/views/3d/webgl-engine/lib/edgeRendering/util.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/shaders/CheckerBoard.glsl.js +1 -1
- package/views/SelectionManager.js +1 -1
- package/widgets/OrientedImageryViewer/OrientedImageryViewerViewModel.js +1 -1
- package/widgets/OrientedImageryViewer/adapters/OrientedImageryViewerViewModelAdapter2D.js +1 -1
- package/widgets/OrientedImageryViewer/utils.js +1 -1
- package/widgets/OrientedImageryViewer.js +1 -1
- package/widgets/PanoramicViewer/PanoramicViewerViewModel.js +1 -1
- package/widgets/PanoramicViewer/constants.js +1 -1
- package/widgets/PanoramicViewer/utils.js +1 -1
- package/widgets/Print.js +1 -1
- package/assets/esri/core/workers/chunks/4f2be9fd4ff5b3ad3110.js +0 -1
- package/assets/esri/core/workers/chunks/88c7d84a1fde246ca71f.js +0 -1
- package/assets/esri/core/workers/chunks/986520dd0de64105dbff.js +0 -1
- package/assets/esri/core/workers/chunks/ad0a87dba95785ad6171.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{c as e,h as t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{g as d}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as h}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.
|
|
5
|
+
import{c as e,h as t,g as i}from"../../../../chunks/vec32.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{setMin as a,setMax as n,create as r,isPoint as o,empty as l,center as c,offset as g}from"../../../../geometry/support/aaBoundingBox.js";import{g as d}from"../../../../chunks/sphere.js";import{evaluateElevationInfoAtPoint as h}from"./elevationAlignmentUtils.js";import{setContextFeature as u}from"./featureExpressionInfoUtils.js";import{demResolutionForBoundingBox as b}from"./graphicUtils.js";import{Object3DState as m}from"../../webgl-engine/lib/basicInterfaces.js";import{Transparency as O}from"../../webgl-engine/lib/edgeRendering/interfaces.js";class j{constructor(e,t,i){this.baseMaterial=e,this.edgeMaterial=t,this.hasSlicePlane=i}}class p{get isElevationSource(){return!!this.stageObject.lastValidElevationBB}constructor(e,t,i,s,a,n,r,o=null){this.graphics3DSymbolLayer=e,this.stageObject=t,this._uniqueGeometries=i,this._uniqueMaterials=s,this._sharedResource=a,this.elevationAligner=n,this.elevationContext=r,this._edgeState=o,this.type="object3d",this._stageLayer=null,this._visible=!1,this._addedToStage=!1,this.alignedSampledElevation=0,this.needsElevationUpdates=!1,this.useObjectOriginAsAttachmentOrigin=!1}initialize(e){this._stageLayer=e;const t=e.stage;t.addMany(this._uniqueMaterials),t.addMany(this._uniqueGeometries),t.add(this.stageObject)}destroy(){if(!this._stageLayer)return;const e=this._stageLayer.stage;e.removeMany(this._uniqueMaterials),e.removeMany(this._uniqueGeometries),e.remove(this.stageObject),this._addedToStage&&(this._stageLayer.remove(this.stageObject),this._addedToStage=!1),e.renderer.edgeView?.removeObject(this.stageObject),this.stageObject.dispose(),this._sharedResource?.release(),this._visible=!1,this._stageLayer=null}layerOpacityChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;if(null==s)return;const n=v(s.baseMaterial);s.edgeMaterial.objectTransparency!==n&&(s.edgeMaterial.objectTransparency=n,this.resetEdgeObject(t)),a.stage.renderer.withEdgeView((t=>t.updateAllComponentOpacities(i,[e])))}slicePlaneEnabledChanged(e,t){const{stageObject:i,_edgeState:s,_stageLayer:a}=this;null!=s&&a.stage.renderer.withEdgeView((a=>{a.updateAllComponentMaterials(i,s.edgeMaterial,e,!t),s.hasSlicePlane=e}))}setVisibility(e){const{_edgeState:t,stageObject:i,_stageLayer:s}=this;null!=s&&this.visible!==e&&(this._visible=e,i.visible=e,e&&!this._addedToStage&&(s.add(i),this._addedToStage=!0),null!=t&&s.stage.renderer.withEdgeView((s=>{s.hasObject(i)?s.updateObjectVisibility(i,e):e&&this._addOrUpdateEdgeObject(t,s,!1)})))}get visible(){return this._visible}alignWithElevation(e,t,i,s){if(null==this.elevationAligner)return;null!=i&&u(this.elevationContext.featureExpressionInfoContext,i);const a=(i,s)=>h(i,e,this.elevationContext,t,s);this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,e.spatialReference,a,t),this.resetEdgeObject(s)}alignWithAbsoluteElevation(e,t,i){const s=(t,i)=>{i.sampledElevation=e,i.verticalDistanceToGround=0,i.z=e};this.alignedSampledElevation=this.elevationAligner(this,this.elevationContext,null,s,t),this.resetEdgeObject(i)}getCenterObjectSpace(t=s()){return e(t,d(this.stageObject.boundingVolumeObjectSpace.bounds))}getBoundingBoxObjectSpace(e=r()){const t=this.stageObject.boundingVolumeObjectSpace;return a(e,t.min),n(e,t.max),e}computeAttachmentOrigin(e){const s=this.stageObject.effectiveTransformation;if(this.useObjectOriginAsAttachmentOrigin)e.render.origin[0]+=s[12],e.render.origin[1]+=s[13],e.render.origin[2]+=s[14],e.render.num++;else for(const a of this.stageObject.geometries)a.computeAttachmentOrigin(y)&&(t(y,y,s),i(e.render.origin,e.render.origin,y),e.render.num++)}async getProjectedBoundingBox(e,i,s,a,n){const r=this.getBoundingBoxObjectSpace(n),d=S,h=o(r)?1:d.length;for(let o=0;o<h;o++){const e=d[o];f[0]=r[e[0]],f[1]=r[e[1]],f[2]=r[e[2]],t(f,f,this.stageObject.transformation),_[3*o]=f[0],_[3*o+1]=f[1],_[3*o+2]=f[2]}if(!e(_,0,h))return null;l(r);let u=null;this.calculateRelativeScreenBounds&&(u=this.calculateRelativeScreenBounds());for(let t=0;t<3*h;t+=3){for(let e=0;e<3;e++)r[e]=Math.min(r[e],_[t+e]),r[e+3]=Math.max(r[e+3],_[t+e]);u&&s.push({location:_.slice(t,t+3),screenSpaceBoundingRect:u})}if(i?.service&&"absolute-height"!==this.elevationContext.mode){c(r,y);const e="relative-to-scene"===this.elevationContext.mode?"scene":"ground";let t=0;if(i.useViewElevation)t=i.service.getElevation(y[0],y[1],e)??0;else try{const s=b(r,i.service.spatialReference,i);t=await i.service.queryElevation(y[0],y[1],a,s,e)??0}catch(m){}g(r,0,0,-this.alignedSampledElevation+t)}return r}addObjectState(e,t){e===m.Highlight&&t.addObject(this.stageObject,this.stageObject.highlight()),e===m.MaskOccludee&&t.addObject(this.stageObject,this.stageObject.maskOccludee())}removeObjectState(e){e.removeObject(this.stageObject)}resetEdgeObject(e){const{_edgeState:t,stageObject:i,_stageLayer:s,_visible:a}=this;null!=t&&s.stage.renderer.withEdgeView((s=>{a?this._addOrUpdateEdgeObject(t,s,e):s.removeObject(i)}))}_addOrUpdateEdgeObject(e,t,i){const s=v(e.baseMaterial);e.edgeMaterial.objectTransparency=s,t.addOrUpdateObject3D(this.stageObject,e.edgeMaterial,e.hasSlicePlane,!i).then((()=>this._stageLayer?.sync()))}}function v(e){return e.parameters.transparent?O.TRANSPARENT:O.OPAQUE}const _=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],f=s(),y=s(),S=[[0,1,2],[3,1,2],[0,4,2],[3,4,2],[0,1,5],[3,1,5],[0,4,5],[3,4,5]];export{p as Graphics3DObject3DGraphicLayer,j as Object3DEdgeState};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as h}from"../support/FastSymbolUpdates.js";const u=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=u(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.complexity=this.computeComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&u().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):u().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(u().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(u().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return u().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&u().warnOncePerTick("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return g}_defaultElevationInfoZ(){return m}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as o}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as n}from"./defaultSymbolComplexity.js";import{SymbolUpdateType as s}from"./elevationAlignmentUtils.js";import{ElevationContext as a}from"./ElevationContext.js";import{zeroContext as l}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as p}from"./graphicUtils.js";import{ApplyRendererDiffResult as c}from"./interfaces.js";import{Loadable as d}from"./Loadable.js";import{getAttributeValue as h}from"../support/FastSymbolUpdates.js";const u=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class y extends d{constructor(e,t,i,r){super(i.schedule),this.symbol=e,this.symbolLayer=t,this._context=i,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1},this._materials=[],this.usedMemory=0,this.logger=u(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=r.renderPriority,this._renderPriorityStep=r.renderPriorityStep,this._elevationContext=new a,this.complexity=this.computeComplexity(),this.ignoreDrivers=r.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=f(this._context.renderer)),this._updateElevationContext()}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,i=f(e);return i.color!==t.color||i.opacity!==t.opacity||i.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||i.size!==t.size}get needsDrivenTransparentPass(){return this._drivenProperties.opacity&&!this._drivenProperties.opacityAlwaysOpaque}_logGeometryCreationWarnings(e,t,i,r){const o=e.projectionSuccess,n="polygons"in e?e.polygons:null,s=`${r} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,i,r)&&n&&0===n.length&&"rings"===i&&t.length>0&&t[0].length>2&&u().warnOncePerTick(`${s} (filled rings should use clockwise winding - try reversing the order of vertices)`):u().warnOncePerTick(`${s} (failed to project geometry to view spatial reference)`)}_logGeometryValidationWarnings(e,t,i){const r=`${i} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(u().warnOncePerTick(`${r} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(u().warnOncePerTick(`${r} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,i=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+i+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return u().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":o(e)&&u().warnOncePerTick("Fixed a non-closed polygon ring.")}return!0}_defaultElevationInfoNoZ(){return g}_defaultElevationInfoZ(){return m}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.updateFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.updateFeatureExpressionInfoContext(this._context.featureExpressionInfoContext)):this._elevationContext.reset()}getDefaultElevationInfo(e){return e.hasZ?this._defaultElevationInfoZ():this._defaultElevationInfoNoZ()}getGeometryElevationMode(e,t=this.getDefaultElevationInfo(e)){return this._elevationContext.mode||t.mode}setElevationInfoOverride(e){this._elevationInfoOverride=e,this._updateElevationContext()}setGraphicElevationContext(e,t=new a){const i=e.geometry,r=this.getDefaultElevationInfo(i);t.unit=null!=this._elevationContext.unit?this._elevationContext.unit:r.unit,t.mode=this.getGeometryElevationMode(i,r),t.offsetMeters=this._elevationContext.meterUnitOffset??r.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===t.mode;o&&(t.mode="relative-to-ground",t.offsetMeters=0);const n=o?l:this._elevationContext.featureExpressionInfoContext;return t.updateFeatureExpressionInfoContext(n,e,this._context.layer),t}prepareSymbolLayerPatch(e){}updateGeometry(e,t){return!1}updateTransform(e,t,i,r){return!1}onRemoveGraphic(e){}_getLayerOpacity(){if(this._context.graphicsCoreOwner&&"fullOpacity"in this._context.graphicsCoreOwner)return this._context.graphicsCoreOwner.fullOpacity??0;const e=this._context.layer.opacity;return e??1}_getCombinedOpacity(e,t=v){const i=this.draped?1:this._getLayerOpacity();return this._drivenProperties.opacity?i:e?i*e.a:t.hasIntrinsicColor?i:0}_getCombinedOpacityAndColor(t,r=v){const o=this._getCombinedOpacity(t,r);if(this._drivenProperties.color)return p(null,o);const n=null!=t?e.toUnitRGB(t):i;return p(n,o)}_getVertexOpacityAndColor(e,t=null){const i=this._drivenProperties.color?e.color:null,r=this._drivenProperties.opacity?e.opacity:null,o=p(i,r);return t&&(o[0]*=t,o[1]*=t,o[2]*=t,o[3]*=t),o}isFastUpdatesEnabled(){return null!=this._fastUpdates}computeComplexity(){return n(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,i){switch(e){case"opacity":return this.layerOpacityChanged(t,i),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return this.layerElevationInfoChanged(t,i,e)!==s.RECREATE}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,i);case"physicalBasedRenderingEnabled":return this.physicalBasedRenderingChanged();case"pixelRatio":return this.pixelRatioChanged;case"skipHighSymbolLods":return this.skipHighSymbolLodsChanged;default:return!1}}get pixelRatioChanged(){return!0}updateGraphics3DGraphicElevationInfo(e,t,i){let r=s.UPDATE;return e.forEach((e=>{const o=t(e);if(null!=o){const t=e.graphic;this.setGraphicElevationContext(t,o.elevationContext),o.needsElevationUpdates=i(o.elevationContext.mode)}else r=s.RECREATE})),r}applyRendererDiff(e,t){return c.RecreateSymbol}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,i=t.size?h(t.size.field,e):0,o=t.color?h(t.color.field,e):0,n=t.opacity?h(t.opacity.field,e):0;return r(i,o,n,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&u().warnOnce("A symbol can only produce either draped or non-draped visualizations. Use two separate symbol instances for draped and non-draped graphics if necessary."),!1)}test(){const e=()=>({size:this._fastUpdates?.visualVariables.size?.field??null,color:this._fastUpdates?.visualVariables.color?.field??null,opacity:this._fastUpdates?.visualVariables.opacity?.field??null,rotation:this._fastUpdates?.visualVariables.rotation?.field??null});return{drivenProperties:this._drivenProperties,getVisVarFields:e}}}function f(e){const t={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach((e=>{switch(e.type){case"color":if(t.color=!0,e.stops)for(let i=0;i<e.stops.length;i++){const r=e.stops[i].color;r&&(t.opacity=!0,r.a<1&&(t.opacityAlwaysOpaque=!1))}break;case"opacity":t.opacity=!0,t.opacityAlwaysOpaque=!1;break;case"size":t.size=!0}})),t}const g={mode:"on-the-ground",offset:0,unit:"meters"},m={mode:"absolute-height",offset:0,unit:"meters"},v={hasIntrinsicColor:!1};export{y as Graphics3DSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as m,expandWithAABB as
|
|
5
|
+
import e from"../../../../Color.js";import{getMetersPerUnitForSR as t}from"../../../../core/unitUtils.js";import{e as r}from"../../../../chunks/earcut.js";import{set as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as i,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{b as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{create as l,empty as c,expandWithBuffer as h,intersectsClippingArea as m,expandWithAABB as u}from"../../../../geometry/support/aaBoundingBox.js";import{create as p,empty as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newDoubleArray as y,doubleSubArray as f}from"../../../../geometry/support/DoubleArray.js";import{perVertexElevationAligner as _}from"./ElevationAligners.js";import{SymbolUpdateType as x,elevationModeChangeUpdateType as v,needsElevationUpdates2D as b}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as C}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as D}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as j}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as w,PolygonCreationDataBase as G}from"./polygonUtils.js";import{geometryToRenderInfo as E,geometryToRenderInfoDraped as A}from"../../support/renderInfoUtils/polygon.js";import{Object3D as L}from"../../webgl-engine/lib/Object3D.js";import{RenderGeometry as O}from"../../webgl-engine/lib/RenderGeometry.js";import{WaterMaterialParameters as P,WaterMaterial as T}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as R}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const I=["polyline","polygon","extent"];class B extends j{constructor(e,t,r,o){super(e,t,r,o)}async doLoad(){}destroy(){super.destroy(),this._context.stage.remove(this._materials[0]),this._materials.length=0}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,I,this.symbolLayer.type))return null;const r=this.setGraphicElevationContext(t);return this.ensureDrapedStatus("on-the-ground"===r.mode),this.ensureMaterial(),this.draped?this._createAsOverlay(t):this._createAs3DShape(t,r,t.uid)}ensureMaterial(){if(this._materials[0])return;const t=new P,r=this.symbolLayer.color;null!=r&&(t.color=e.toUnitRGBA(r));const o=this._getCombinedOpacity(r,{hasIntrinsicColor:!0});t.color=[t.color[0],t.color[1],t.color[2],o],t.transparent=o<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?U(this.symbolLayer.waveDirection):i(0,0);const n=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,s=R[n];t.waveStrength=s.waveStrength,t.waveTextureRepeat=s.textureRepeat,t.waveVelocity=s.waveVelocity,t.flowStrength=s.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new T(t),this._context.stage.add(this._materials[0])}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this._getCombinedOpacity(this.symbolLayer.color,{hasIntrinsicColor:!0}),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerElevationInfoChanged(e,t,r){const o=this._elevationContext.mode,i=v(B.elevationModeChangeTypes,r,o);if(i!==x.UPDATE)return i;const n=b(o);return this.updateGraphics3DGraphicElevationInfo(e,t,(()=>n))}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}_createAs3DShape(e,t,r){const o=S(e.geometry);if(null==o)return null;const i=E(o,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=i.position.length/3,s=y(2*n);M(s,i.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new N(i,s,this._context.layer.uid,e.uid);if(a.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,o.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerUid:this._context.layer.uid,graphicUid:r}),c=new D(this,l,a.outGeometries,null,null,_,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=b(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,o=e.uvCoords;for(const{count:i,index:n,position:s,mapPositions:a,holeIndices:l}of t){if(null!=this._context.clippingExtent&&(c(k),h(k,a),!m(k,this._context.clippingExtent)))continue;const t=r(a,l,3);if(0===t.length)continue;const u=f(o,2*n,2*i),p=w({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:u}},e.objectAndLayerIdColor);e.outGeometries.push(p)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=A(t,this._context.overlaySR),o=r.position.length/3,i=y(2*o);M(i,r.position,o,this._context.overlaySR);const n=new H(r,i,this._context.layer.uid,e.uid);return n.objectAndLayerIdColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=c(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new C(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,o=e.renderData.polygons;for(const{position:i,holeIndices:n,index:s,count:a}of o){if(c(k),h(k,i),!m(k,this._context.clippingExtent))continue;u(e.outBoundingBox,k);const o=r(i,n,3);if(0===o.length)continue;const l=f(t,2*s,2*a),p=w({material:this._materials[0],indices:o,attributeData:{position:i,uv0:l}},e.objectAndLayerIdColor);e.outGeometries.push(new O(p,e))}}test(){return{...super.test(),create3DShape:e=>this._createAs3DShape(e.graphic,e.elevationContext,e.graphicUid),ensureMaterial:()=>this.ensureMaterial()}}}function U(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function M(e,r,i,n){const a=t(n);d(z);for(let t=0;t<i;t++)o(V,r[3*t],r[3*t+1]),g(z,V);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;W[0]=z[0]-l,W[1]=z[1]-c;for(let t=0;t<i;t++)e[2*t]=(r[3*t]*a-W[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-W[1])/B.unitSizeOfTexture}B.unitSizeOfTexture=100,B.elevationModeChangeTypes={definedChanged:x.RECREATE,staysOnTheGround:x.NONE,onTheGroundChanged:x.RECREATE};const W=n(),z=p(),V=n(),k=l();class N extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}class H extends G{constructor(e,t,r,o){super(e,r,o),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,U as headingVectorFromAngle};
|
|
@@ -25,7 +25,6 @@ return vec2(coordX, coordY) + 0.5;
|
|
|
25
25
|
${s?l`
|
|
26
26
|
void forwardObjectAndLayerIdColor() {
|
|
27
27
|
vec2 textureCoordinates = getComponentTextureCoordinates(componentIndex, 2.0);
|
|
28
|
-
|
|
29
28
|
vObjectAndLayerIdColor = texelFetch(componentColorTex, ivec2(textureCoordinates), 0);
|
|
30
29
|
}`:l`void forwardObjectAndLayerIdColor() {}`}
|
|
31
30
|
|
|
@@ -66,6 +65,6 @@ return externalColor;
|
|
|
66
65
|
}
|
|
67
66
|
|
|
68
67
|
void outputObjectAndLayerIdColor() {
|
|
69
|
-
${c?l`fragColor = vec4(0,0,0,0);`:""}
|
|
68
|
+
${c?l`fragColor = vec4(0, 0, 0, 0);`:""}
|
|
70
69
|
}
|
|
71
70
|
`)}export{m as ComponentData,s as ComponentDataType,C as encodeElevationOffset,x as maxElevationOffset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Accessor.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";const t={required:[]},s={required:[r.Depth]};class n extends e{consumes(){return t}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}modify(e){}get numGeometries(){return 0}get hasOccludees(){return!1}queryRenderOccludedState(e){return!1}}class u extends n{}class c extends n{constructor(){super(...arguments),this.drapedPriority=0}}class o extends n{}class i extends n{}class d extends n{}function a(e){return"prepareTechnique"in e}function p(e){return"prepareTechniques"in e}export{d as ASyncPreparesRenderPlugin,i as AsyncRenderPlugin,s as ConsumesDepth,t as ConsumesNone,c as SyncPrepareRenderPlugin,o as SyncPreparesRenderPlugin,u as SyncRenderPlugin,a as isPrepareRenderPlugin,p as isPreparesRenderPlugin};
|
|
5
|
+
import e from"../../../../core/Accessor.js";import{ShaderOutput as r}from"../core/shaderLibrary/ShaderOutput.js";const t={required:[]},s={required:[r.Depth]};class n extends e{consumes(){return t}get usedMemory(){return 0}get isDecoration(){return!1}get running(){return!1}modify(e){}get numGeometries(){return 0}get hasOccludees(){return!1}forEachGeometry(e){}queryRenderOccludedState(e){return!1}}class u extends n{}class c extends n{constructor(){super(...arguments),this.drapedPriority=0}}class o extends n{}class i extends n{}class d extends n{}function a(e){return"prepareTechnique"in e}function p(e){return"prepareTechniques"in e}export{d as ASyncPreparesRenderPlugin,i as AsyncRenderPlugin,s as ConsumesDepth,t as ConsumesNone,c as SyncPrepareRenderPlugin,o as SyncPreparesRenderPlugin,u as SyncRenderPlugin,a as isPrepareRenderPlugin,p as isPreparesRenderPlugin};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{NoParameters as t}from"../core/shaderModules/interfaces.js";import{Parameters as r}from"./AnimationTimer.js";import{Decorations as s}from"./basicInterfaces.js";import{ContentObject as i}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{Default3D as n}from"./DefaultVertexAttributeLocations.js";import{copyParameters as o,updateParameters as p}from"../materials/internal/MaterialUtil.js";class c extends i{constructor(t,r){super(),this.type=a.Material,this.supportsEdges=!1,this.
|
|
5
|
+
import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{NoParameters as t}from"../core/shaderModules/interfaces.js";import{Parameters as r}from"./AnimationTimer.js";import{Decorations as s}from"./basicInterfaces.js";import{ContentObject as i}from"./ContentObject.js";import{ContentObjectType as a}from"./ContentObjectType.js";import{Default3D as n}from"./DefaultVertexAttributeLocations.js";import{copyParameters as o,updateParameters as p}from"../materials/internal/MaterialUtil.js";class c extends i{constructor(t,r){super(),this.type=a.Material,this.supportsEdges=!1,this._renderPriority=0,this._vertexAttributeLocations=n,this._pp0=e(0,0,1),this._pp1=e(0,0,0),this._parameters=o(t,r),this.validateParameters(this._parameters)}get parameters(){return this._parameters}update(e){return!1}setParameters(e,t=!0){p(this._parameters,e)&&(this.validateParameters(this._parameters),t&&this.parametersChanged())}validateParameters(e){}shouldRender(e){return this.visible&&this.isVisibleForOutput(e.output)&&(!this.parameters.isDecoration||e.bindParameters.decorations===s.ON)&&!!(this.parameters.renderOccluded&e.renderOccludedMask)}isVisibleForOutput(e){return!0}get renderPriority(){return this._renderPriority}set renderPriority(e){e!==this._renderPriority&&(this._renderPriority=e,this.parametersChanged())}get vertexAttributeLocations(){return this._vertexAttributeLocations}get visible(){return!0}parametersChanged(){this.repository?.materialChanged(this)}queryRenderOccludedState(e){return this.visible&&this.parameters.renderOccluded===e}intersectDraped(e,t,r,s,i,a){return this._pp0[0]=this._pp1[0]=s[0],this._pp0[1]=this._pp1[1]=s[1],this.intersect(e,t,r,this._pp0,this._pp1,i)}}class d extends r{constructor(e,t,r){super(t,r),this.camera=e}}var u;!function(e){e[e.None=0]="None",e[e.Occlude=1]="Occlude",e[e.Transparent=2]="Transparent",e[e.OccludeAndTransparent=4]="OccludeAndTransparent",e[e.OccludeAndTransparentStencil=8]="OccludeAndTransparentStencil",e[e.Opaque=16]="Opaque"}(u||(u={}));class h extends t{constructor(){super(...arguments),this.renderOccluded=u.Occlude,this.isDecoration=!1}}export{c as Material,h as MaterialParameters,u as RenderOccludedFlag,d as UpdateParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=
|
|
5
|
+
import"../../../../core/has.js";import{NestedMap as e}from"../../../../core/NestedMap.js";import{ScreenSpaceGeometry as r}from"../effects/ScreenSpaceGeometry.js";import{VaoCache as s}from"../materials/renderers/VaoCache.js";import{AppleAmdDriverHelper as t}from"../../../webgl/AppleAmdDriverHelper.js";import{RenderingContext as i}from"../../../webgl/RenderingContext.js";class o extends i{constructor(s,t){super(s,t),this.gl=s,this._vaoCaches=new e,this._appleAmdDriverHelper=null,this._refCount=1,this._newCache=t.newCache,this.screen=new r(this)}configure(e){super.configure(e),this._newCache=e.newCache}destroy(){this._vaoCaches?.forAll((e=>e.dispose())),this._vaoCaches?.clear(),--this._refCount>0||this.dispose()}ref(){++this._refCount}dispose(){super.dispose(),this._appleAmdDriverHelper?.dispose(),this.screen.destroy(),this._vaoCaches.forAll((e=>e.dispose())),this._vaoCaches.clear()}get newCache(){return this._newCache}getVaoCache(e,r){const t=Array.from(e.keys()).map((r=>`${r}:${e.get(r)}`)).join("."),i=JSON.stringify(r),o=this._vaoCaches.get(t,i);if(o)return o;const a=new s(this,e,r);return this._vaoCaches.set(t,i,a),a}bindTechnique(e,r,s,t,i){return this.useProgram(e.program),this.setPipelineState(e.getPipeline(!!i)),e.program.bindPass(s,r),t&&e.program.bindDraw(t,r,s),e.program}runAppleAmdDriverHelper(){this.driverTest.drawArraysRequiresIndicesTypeReset.result&&(this._appleAmdDriverHelper??=new t(this),this._appleAmdDriverHelper.run())}get test(){}}export{o as RenderingContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unpackFloatRGBA as t}from"../../../../core/floatRGBA.js";import e from"../../../../core/PooledArray.js";import{multiply as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as s}from"../../../../chunks/vec32.js";import{l as a}from"../../../../chunks/vec42.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as h,create as f,copy as c}from"../../../../geometry/support/frustum.js";import{g as l,c as u}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{empty as d,union as m,set as g,DepthRange as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const v=1e4,R=100,j=500,C=500,A=.1;function B(e,r,i){return t(r,e)*(i[1]-i[0])+i[0]}function M(t,e,r){let i=0;if(!e.some((t=>!!t.material&&(i+=t.numGeometries,i>=v))))return Q.compute(t,e);const n=d();return r.forAll((e=>m(n,O(t,e)))),n}function O(t,e){if(!e.visible)return;const r=d(),i=e.getSpatialQueryAccelerator();return i?x(r,t,i):D(r,t,e.objects),r}function x(t,e,r){const i=e.eye,n=e.viewForward,s=e.frustum,a=t=>t.visible,o=r.objectCount;if(o<j)g(G,e.near,Math.min(t.near,e.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,G,((r,i)=>{T(t,e,r),G.far=t.near,i.setRange(G)}),s,a),g(G,Math.max(t.far,e.near),e.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,G,((r,i)=>{T(t,e,r),G.near=t.far,i.setRange(G)}),s,a);else{const i=Math.max(Math.min(o,C),Math.ceil(o*A)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(I(t,e,h.boundingVolumeWorldSpace.bounds),I(t,e,f.boundingVolumeWorldSpace.bounds))}}function D(t,e,r){U.clear(),r.forAll((t=>{t.visible&&0!==t.geometries.length&&U.add(t)})),U.empty||(U.sort(e),g(G,e.near,Math.min(t.near,e.far)),U.forEachInDepthRange(G,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<t.near&&T(t,e,r)})),g(G,Math.max(t.far,e.near),e.far),U.forEachInDepthRange(G,b.DepthOrder.BACK_TO_FRONT,((e,r,i)=>{t.far=Math.max(t.far,i)})))}function T(t,e,i){if(!i.visible)return;if(!h(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const n=i.transformation,s=k;i.geometries.forEach((i=>{r(s,n,i.transformation);const a=_(s);F(t,e,i.boundingInfo,s,a)}))}function F(t,e,r,i,n){if(null==r)return;s(l(V),r.center,i);const{eye:a,viewForward:o}=e,f=o[0]*(V[0]-a[0])+o[1]*(V[1]-a[1])+o[2]*(V[2]-a[2]);if(V[3]=r.radius*n,!(f-V[3]>t.near&&f+V[3]<t.far)&&h(e.frustum,V))if(r.radius>R&&r.getChildren())for(const s of r.getChildren())F(t,e,s,i,n);else q.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function I(t,e,r){const i=e.eye,n=e.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];t.near=Math.min(t.near,s-r[3]),t.far=Math.max(t.far,s+r[3])}class
|
|
5
|
+
import{unpackFloatRGBA as t}from"../../../../core/floatRGBA.js";import e from"../../../../core/PooledArray.js";import{multiply as r,copy as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{h as s}from"../../../../chunks/vec32.js";import{l as a}from"../../../../chunks/vec42.js";import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{intersectsSphere as h,create as f,copy as c}from"../../../../geometry/support/frustum.js";import{g as l,c as u}from"../../../../chunks/sphere.js";import{maxScale as _}from"../../support/mathUtils.js";import{empty as d,union as m,set as g,DepthRange as p}from"./depthRange.js";import b from"./Octree.js";import{assert as w}from"./Util.js";const v=1e4,R=100,j=500,C=500,A=.1;function B(e,r,i){return t(r,e)*(i[1]-i[0])+i[0]}function M(t,e,r){let i=0;if(!e.some((t=>!!t.material&&(i+=t.numGeometries,i>=v))))return Q.compute(t,e);const n=d();return r.forAll((e=>m(n,O(t,e)))),n}function O(t,e){if(!e.visible)return;const r=d(),i=e.getSpatialQueryAccelerator();return i?x(r,t,i):D(r,t,e.objects),r}function x(t,e,r){const i=e.eye,n=e.viewForward,s=e.frustum,a=t=>t.visible,o=r.objectCount;if(o<j)g(G,e.near,Math.min(t.near,e.far)),r.forEachInDepthRange(i,n,b.DepthOrder.FRONT_TO_BACK,G,((r,i)=>{T(t,e,r),G.far=t.near,i.setRange(G)}),s,a),g(G,Math.max(t.far,e.near),e.far),r.forEachInDepthRange(i,n,b.DepthOrder.BACK_TO_FRONT,G,((r,i)=>{T(t,e,r),G.near=t.far,i.setRange(G)}),s,a);else{const i=Math.max(Math.min(o,C),Math.ceil(o*A)),h=r.findClosest(n,b.DepthOrder.FRONT_TO_BACK,s,a,i),f=r.findClosest(n,b.DepthOrder.BACK_TO_FRONT,s,a,i);h&&f&&(I(t,e,h.boundingVolumeWorldSpace.bounds),I(t,e,f.boundingVolumeWorldSpace.bounds))}}function D(t,e,r){U.clear(),r.forAll((t=>{t.visible&&0!==t.geometries.length&&U.add(t)})),U.empty||(U.sort(e),g(G,e.near,Math.min(t.near,e.far)),U.forEachInDepthRange(G,b.DepthOrder.FRONT_TO_BACK,((r,i)=>{i<t.near&&T(t,e,r)})),g(G,Math.max(t.far,e.near),e.far),U.forEachInDepthRange(G,b.DepthOrder.BACK_TO_FRONT,((e,r,i)=>{t.far=Math.max(t.far,i)})))}function T(t,e,i){if(!i.visible)return;if(!h(e.frustum,i.boundingVolumeWorldSpace.bounds))return;const n=i.transformation,s=k;i.geometries.forEach((i=>{r(s,n,i.transformation);const a=_(s);F(t,e,i.boundingInfo,s,a)}))}function F(t,e,r,i,n){if(null==r)return;s(l(V),r.center,i);const{eye:a,viewForward:o}=e,f=o[0]*(V[0]-a[0])+o[1]*(V[1]-a[1])+o[2]*(V[2]-a[2]);if(V[3]=r.radius*n,!(f-V[3]>t.near&&f+V[3]<t.far)&&h(e.frustum,V))if(r.radius>R&&r.getChildren())for(const s of r.getChildren())F(t,e,s,i,n);else q.unionDepthRangeWithAABB(t,e.viewProjectionMatrix,i,r.bbMin,r.bbMax)}function I(t,e,r){const i=e.eye,n=e.viewForward,s=(r[0]-i[0])*n[0]+(r[1]-i[1])*n[1]+(r[2]-i[2])*n[2];t.near=Math.min(t.near,s-r[3]),t.far=Math.max(t.far,s+r[3])}class P{constructor(){this._items=new e({allocator:t=>t||{object:null,distance:0,near:0,far:0},deallocator:t=>(t.object=null,t.distance=0,t.near=0,t.far=0,t)})}get length(){return this._items.length}get empty(){return 0===this._items.length}clear(){this._items.clear()}add(t){this._items.pushNew().object=t}sort(t){const e=t.eye,r=t.viewForward;this._items.forAll((t=>{const i=t.object.boundingVolumeWorldSpace.bounds,n=(i[0]-e[0])*r[0]+(i[1]-e[1])*r[1]+(i[2]-e[2])*r[2];t.distance=n,t.near=n-i[3],t.far=n+i[3]})),this._items.sort(((t,e)=>t.distance-e.distance))}forEachInDepthRange(t,e,r){if(e===b.DepthOrder.FRONT_TO_BACK)for(let i=0;i<this._items.length;++i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}else for(let i=this._items.length-1;i>=0;--i){const e=this._items.data[i];e.far<t.near||e.near>t.far||r(e.object,e.near,e.far)}}}class y{constructor(){this._view=n(),this._viewProj=n(),this._frustum=f(),this._geometries=new Array,this._near=[],this._far=[],this._nearCandidates=[],this._farCandidates=[],this._looseRange={near:0,far:0}}compute(t,e){this._reset(),i(this._view,t.viewMatrix),r(this._viewProj,t.projectionMatrix,this._view),c(this._frustum,t.frustum);const n=this._view,s=n[2],a=n[6],o=n[10],h=n[14];e.forAll((t=>{t.forEachGeometry((t=>{if(!t.visible||!t.castShadow)return;const e=t.boundingSphere,r=s*e[0]+a*e[1]+o*e[2]+h,i=r-e[3],n=r+e[3];this._geometries.push(t),this._near.push(-n),this._far.push(-i)}))}));const f=new p;if(0===this._geometries.length)return f;for(let r=0;r<this._geometries.length;++r)this._near[r]>f.far&&(f.far=this._near[r]),this._near[r]>2&&this._far[r]<f.near&&(f.near=this._far[r]);const l=this._looseRange;l.near=Math.max(.5*f.near,2),l.far=2*f.far;let u=0,_=0;for(let r=0;r<this._geometries.length;++r)this._near[r]<f.near&&(this._near[r]>=l.near?f.near=this._near[r]:this._nearCandidates[u++]=r),this._far[r]>f.far&&(this._far[r]<=l.far?f.far=this._far[r]:this._farCandidates[_++]=r);if(0===this._nearCandidates.length&&0===this._farCandidates.length)return f;this._nearCandidates.sort(((t,e)=>this._near[t]<this._near[e]?-1:this._near[t]>this._near[e]?1:0)),this._farCandidates.sort(((t,e)=>this._far[t]<this._far[e]?1:this._far[t]>this._far[e]?-1:0));for(let r=0;r<this._nearCandidates.length;++r){const t=this._nearCandidates[r];if(this._near[t]<f.near){const e=this._geometries[t],r=e.boundingInfo;this._includeNearBoundingInfoRec(r,e.shaderTransformation,f)}}for(let r=0;r<this._farCandidates.length;++r){const t=this._farCandidates[r];if(this._far[t]>f.far){const e=this._geometries[t],r=e.boundingInfo;this._includeFarBoundingInfoRec(r,e.shaderTransformation,f)}}return this._reset(),f}_reset(){this._geometries.length=0,this._near.length=0,this._far.length=0,this._nearCandidates.length=0,this._farCandidates.length=0}_includeNearBoundingInfoRec(t,e,r){if(null==t)return;const i=t.center;s(l(V),i,e);const n=_(e),a=V[0],o=V[1],h=V[2],f=t.radius*n,c=this._frustum;if(c[0][0]*a+c[0][1]*o+c[0][2]*h+c[0][3]>f||c[1][0]*a+c[1][1]*o+c[1][2]*h+c[1][3]>f||c[2][0]*a+c[2][1]*o+c[2][2]*h+c[2][3]>f||c[3][0]*a+c[3][1]*o+c[3][2]*h+c[3][3]>f)return;const u=this._view[2]*a+this._view[6]*o+this._view[10]*h+this._view[14],d=u+f;if(!(-(u-f)<2||-d>=r.near))if(-d>this._looseRange.near)r.near=-d;else{if(f>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeNearBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}_includeFarBoundingInfoRec(t,e,r){if(null==t)return;let i=t.radius;const n=t.center;s(l(V),n,e);const a=_(e),o=V[0],h=V[1],f=V[2];i*=a;const c=this._frustum;if(c[0][0]*o+c[0][1]*h+c[0][2]*f+c[0][3]>i||c[1][0]*o+c[1][1]*h+c[1][2]*f+c[1][3]>i||c[2][0]*o+c[2][1]*h+c[2][2]*f+c[2][3]>i||c[3][0]*o+c[3][1]*h+c[3][2]*f+c[3][3]>i)return;const u=this._view[2]*o+this._view[6]*h+this._view[10]*f+this._view[14]-i;if(!(-u<=r.far))if(-u<this._looseRange.far)r.far=-u;else{if(i>R){const i=t.getChildren();if(void 0!==i){for(const t of i)this._includeFarBoundingInfoRec(t,e,r);return}}q.unionDepthRangeWithAABB(r,this._viewProj,e,t.bbMin,t.bbMax)}}}class N{constructor(){this._modelViewProj=n(),this._clipPosition=[o(),o(),o(),o(),o(),o(),o(),o()]}unionDepthRangeWithAABB(t,e,i,n,s){const a=this._modelViewProj;r(a,e,i);let o=!1;for(let r=0;r<8;++r){const t=this._clipPosition[r],e=0===r||3===r||4===r||7===r?n[0]:s[0],i=0===r||1===r||4===r||5===r?n[1]:s[1],o=r<4?n[2]:s[2];t[0]=a[0]*e+a[4]*i+a[8]*o+a[12],t[1]=a[1]*e+a[5]*i+a[9]*o+a[13],t[2]=a[2]*e+a[6]*i+a[10]*o+a[14],t[3]=a[3]*e+a[7]*i+a[11]*o+a[15]}for(let r=0;r<12;++r){const e=W(this._clipPosition[S[r][0]],this._clipPosition[S[r][1]],this._clipPosition[S[r][2]]);let i=!0;for(let t=0;t<e.length;++t){if(e[t][3]>=2){i=!1;break}}if(!i){o=!0;for(let r=0;r<e.length;++r){const i=e[r][3];Number.isFinite(i)&&(t.near=Math.min(i,t.near),t.far=Math.max(i,t.far))}}}return o}}function W(t,e,r){let i=[t,e,r];for(let n=0;n<4;++n){const t=i;i=[];for(let e=0;e<t.length;++e){const r=t[e],s=t[(e+1)%t.length];E(s,n)?(E(r,n)||i.push(K(r,s,n)),i.push(s)):E(r,n)&&i.push(K(r,s,n))}}return i}function E(t,e){return 0===e?t[0]>=-t[3]:1===e?t[1]>=-t[3]:2===e?t[0]<=t[3]:3===e?t[1]<=t[3]:void w(!1)}function K(t,e,r){let i=0;return 0===r?i=(-t[3]-t[0])/(e[0]-t[0]+e[3]-t[3]):1===r?i=(-t[3]-t[1])/(e[1]-t[1]+e[3]-t[3]):2===r?i=(t[3]-t[0])/(e[0]-t[0]-e[3]+t[3]):3===r&&(i=(t[3]-t[1])/(e[1]-t[1]-e[3]+t[3])),a(o(),t,e,i)}const S=[[0,1,3],[2,3,1],[1,5,2],[6,2,5],[5,4,6],[7,6,4],[4,0,7],[3,7,0],[3,2,7],[6,7,2],[4,5,0],[1,0,5]],V=u(),k=n(),G=d(),U=new P,Q=new y,q=new N;export{y as DepthRangeFromRenderGeometries,O as depthRangeFromLayer,M as depthRangeFromScene,B as textureToDepth};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{transpose as t,invert as s}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{s as n}from"../../../../../chunks/vec32.js";import{debugFlags as
|
|
5
|
+
import{releaseMaybe as e}from"../../../../../core/maybe.js";import r from"../../../../../core/PooledArray.js";import{transpose as t,invert as s}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as i}from"../../../../../core/libs/gl-matrix-2/factories/mat3f32.js";import{s as n}from"../../../../../chunks/vec32.js";import{debugFlags as o}from"../../../support/debugFlags.js";import{TwoVectorPosition as a}from"../../core/util/TwoVectorPosition.js";import{EdgeDrawParameters as d}from"./EdgeShaderParameters.js";import{EdgeShaderTechnique as l}from"./EdgeShaderTechnique.js";import{EdgeShaderTechniqueConfiguration as h}from"./EdgeShaderTechniqueConfiguration.js";import{Transparency as c}from"./interfaces.js";import{EdgeType as u}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{PrimitiveType as _}from"../../../../webgl/enums.js";const m=8,g=128,f={type:u.Solid,hasSlicePlane:!1,strokesTexture:null,legacy:!0,spherical:!0};class b{constructor(e,t,s){this._rctx=e,this._techniques=t,this._configuration=new h,this.refCount=0,this._renderables=new Set,this._sortedRenderables={[c.TRANSPARENT]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r},[c.OPAQUE]:{[c.TRANSPARENT]:new r,[c.OPAQUE]:new r}},this._renderablesDirty=!1,this._drawParameters=new d,this._settings={...f,...s},this.key=b.getKey(this._settings.type,this._settings.hasSlicePlane,this._settings.legacy);const i=this._settings.strokesTexture.variants;this.writerSettings={variants:i,reducedPrecision:o.TESTS_DISABLE_OPTIMIZATIONS},this._configuration.legacy=this._settings.legacy,this._configuration.type=this._settings.type,this._configuration.silhouette=!1,this._configuration.hasSlicePlane=this._settings.hasSlicePlane,this._configuration.doublePrecisionRequiresObfuscation=e.driverTest.doublePrecisionRequiresObfuscation.result,this._configuration.spherical=s.spherical}dispose(){this._technique=e(this._technique)}addRenderable(e){this._renderables.add(e),this._renderablesDirty=!0}removeRenderable(e){this._renderables.delete(e),this._renderablesDirty=!0}setRenderablesDirty(){this._renderablesDirty=!0}forEachRenderable(e,r){this._renderablesDirty&&this._sortRenderables();const t=this._sortedRenderables[r];t[c.TRANSPARENT].forAll(e),t[c.OPAQUE].forAll(e)}updateTechnique(e,r){return this._configuration.multipassEnabled=!!e.multipassEnabled,this._configuration.cullAboveGround=!!e.multipassTerrain.cullAboveGround,this._configuration.silhouette=r,this._technique=this._techniques.releaseAndAcquire(l,this._configuration,this._technique),this._technique}bindRegularEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!1),r,e)}bindSilhouetteEdges(e,r){return this._lastOriginId=null,this._rctx.bindTechnique(this.updateTechnique(r,!0),r,e)}renderRegularEdges(e,r,t,s,i){this._render(e,r,r.regular.vao,t,s,i)}renderSilhouetteEdges(e,r,t,s,i){this._render(e,r,r.silhouette.vao,t,s,i)}_render(e,r,t,s,i,n){n>0&&(this._bindDraw(e,r,s,i),this._rctx.bindVAO(t),this._rctx.drawArraysInstanced(_.TRIANGLE_FAN,0,4,n))}_bindDraw(e,r,i,o){this._drawParameters.componentDataTexture=r.components.buffer.textureBuffer.texture,this._drawParameters.strokesTexture=this._settings.strokesTexture;const d=r.transform.origin;if(d){const t=d.origin.id;this._lastOriginId!==t&&(e.setUniformMatrix4fv("localView",d.viewMatrix),this._lastOriginId=t),e.setUniformMatrix4fv("model",r.transform.modelMatrix),this._drawParameters.slicePlaneLocalOrigin=d.origin.vec3}else{const e=new a(r.transform.position),i=t(A,s(A,r.transform.rotationScale));this._drawParameters.transformWorldFromModelTL=e.low,this._drawParameters.transformWorldFromModelTH=e.high,this._drawParameters.transformWorldFromModelRS=r.transform.rotationScale,this._drawParameters.transformNormalGlobalFromModel=i;const d=o.camera.viewInverseTransposeMatrix;n(this._drawParameters.slicePlaneLocalOrigin,d[3],d[7],d[11])}e.bindDraw(this._drawParameters,o,i)}_sortRenderables(){this._renderablesDirty=!1,this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].clear(),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].clear(),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].clear(),this._sortedRenderables[c.OPAQUE][c.OPAQUE].clear(),this._renderables.forEach((e=>this._sortedRenderables[e.objectTransparency][e.edgeTransparency].push(e)));const e=(e,r)=>e.transform.origin?r.transform.origin?e.transform.origin.origin.id<r.transform.origin.origin.id?-1:e.transform.origin.origin.id>r.transform.origin.origin.id?1:0:1:0;this._sortedRenderables[c.TRANSPARENT][c.TRANSPARENT].sort(e),this._sortedRenderables[c.TRANSPARENT][c.OPAQUE].sort(e),this._sortedRenderables[c.OPAQUE][c.TRANSPARENT].sort(e),this._sortedRenderables[c.OPAQUE][c.OPAQUE].sort(e)}static getKey(e,r,t){return`edges-t:${e}:${r}:${t}`}}const A=i();export{b as EdgeRenderer,g as extensionLengthOffset,m as lineWidthFractionFactor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as i}from"../../../../../core/mathUtils.js";import{disposeMaybe as o,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as _,c as b,z as y,m as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{g as v,b as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as M}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as C}from"../../core/util/TwoVectorPosition.js";import{Attribute as A}from"../Attribute.js";import{GridLocalOriginFactory as P}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as D}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as S}from"../VertexArrayObject.js";import{VertexAttribute as k}from"../VertexAttribute.js";import{VertexLayout as I,EdgeInputBufferLayout as B,EdgeShaderAttributeLocations as V,glVertexLayout as H}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as G,SilhouetteEdgeBufferWriter as N}from"./edgeBufferWriters.js";import{EdgeRenderer as W,lineWidthFractionFactor as q,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new P(e.renderSR));const t=I.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=o(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,i,o){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,i,o));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const i=new AbortController;let o;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(i,new Promise((e=>o=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(r.mergeGeometries&&e.geometries.length>1&&oe(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const i of e.geometries)i.material.supportsEdges&&n.push(this._addGeometry(e,l,i,t[0],r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),o()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,i=n.transform;if(!(i instanceof de))return!1;const[o]=r;if(o.localOrigin!==i.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,o,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],i=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(i,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,i=!!r.hasSlicePlane,o=Q(t),a=W.getKey(o,i,n),c=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=c&&(c.renderables.forEach((e=>{if(a!==e.rendererKey){const t=this._renderers.get(e.rendererKey),r=this._acquireRenderer(o,i,n);t.removeRenderable(e),--t.refCount,e.rendererKey=a,r.addRenderable(e)}for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new C;let i=0,o=0;if(this._renderers.forEach((r=>{if(0===r.refCount)return this._renderers.delete(r.key),void r.dispose();let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(i+=t.statistics.averageEdgeLength,o++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===o)return;const a=new F(40*i/o,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,D(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],i=r.acquireIndex();t.push({index:i,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,i,o=i.length){return o<se&&(n=!0),this._worker.process({data:r,indices:i,indicesLength:o,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const i=t=>new le(new S(this.rctx,V,{vertices:H,instances:t===ee.REGULAR?G.glLayout:N.glLayout},{vertices:this._verticesBufferObject,instances:te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),o=e.regular.lodInfo.lengths.length>0?i(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?i(ee.SILHOUETTE):null,c=(o?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new he(o,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,i){if(r.edgeIndicesLength<=0)return;const o=r.attributes.get(k.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(o,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,i)}async _addPositionData(e,t,r,s,n,i=!1){if(null==e.loaded)return;const o=this._createComponentBuffers([s]);if(null==o)return;const a=this._acquireRenderer(s.type,!!n.hasSlicePlane,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(o.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,i,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,o,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,i,o,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(i);if(null==c)return 0;const l=Q(i),d=this._acquireRenderer(l,o.hasSlicePlane||!1,!1),h=B.createBuffer(r.length/3);R(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const i=new Map;let o=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(k.POSITION);return a+=t.data.length/t.size,o+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=o?new d(o):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(k.POSITION),r=t.indices;let s=i.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);i.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new A(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r[0],s,n))}_acquireRenderer(e,t,r){const s=W.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new W(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===M.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){ie(e.regular),ie(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),i=e.radius,o=n<-i?1/0:n<i?0:n-i;e.renderables.forEach((e=>e.distanceToCamera=o))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function ie(e){e?.vao&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function oe(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,i,o,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=i,this.components=o,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,o=t[n].index,a=i(Math.round(e.size*q),0,255),c=i(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(o,0,h,u,m,g),r.textureBuffer.setData(o,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(o,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,i=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!pe(n)||!n.visible)return;const o=ye(n.regular.lod.lengths,n.distanceToCamera,i);e.renderRegularEdges(s,n,r,t,o)}),n)}function fe(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,i=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!be(n)||!n.visible)return;const o=ye(n.silhouette.lod.lengths,n.distanceToCamera,i);e.renderSilhouetteEdges(s,n,r,t,o)}),n)}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,i=s(e,n,!0);return-1===i?n<e[0]?e.length:0:e.length-i}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import t from"../../../../../core/Accessor.js";import{equals as r,binaryIndexOf as s}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import n from"../../../../../core/Logger.js";import{clamp as o}from"../../../../../core/mathUtils.js";import{disposeMaybe as i,destroyMaybe as a}from"../../../../../core/maybe.js";import{isAbortError as c,onAbortOrThrow as l}from"../../../../../core/promiseUtils.js";import{property as d}from"../../../../../core/accessorSupport/decorators/property.js";import{subclass as h}from"../../../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as u,transpose as m,invert as g}from"../../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{create as p}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{s as _,c as b,z as y,m as j}from"../../../../../chunks/vec32.js";import{create as O,clone as w}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as E}from"../../../../../core/support/UpdatingHandles.js";import{g as v,b as x}from"../../../../../chunks/sphere.js";import{c as R}from"../../../../../chunks/vec33.js";import{ViewingMode as M}from"../../../../ViewingMode.js";import{encodeElevationOffset as T}from"../../collections/Component/Material/shader/ComponentData.glsl.js";import{TwoVectorPosition as A}from"../../core/util/TwoVectorPosition.js";import{Attribute as C}from"../Attribute.js";import{GridLocalOriginFactory as D}from"../GridLocalOriginFactory.js";import{applyToModelMatrix as P}from"../localOriginHelper.js";import{LocalOriginManager as U}from"../LocalOriginManager.js";import{Object3D as L}from"../Object3D.js";import{VertexArrayObject as k}from"../VertexArrayObject.js";import{VertexAttribute as I}from"../VertexAttribute.js";import{VertexLayout as S,EdgeInputBufferLayout as B,EdgeShaderAttributeLocations as V,glVertexLayout as H}from"./bufferLayouts.js";import{RegularEdgeBufferWriter as G,SilhouetteEdgeBufferWriter as N}from"./edgeBufferWriters.js";import{EdgeRenderer as W,lineWidthFractionFactor as q,extensionLengthOffset as z}from"./EdgeRenderer.js";import{EdgePassParameters as F}from"./EdgeShaderParameters.js";import{EdgeWorkerHandle as K}from"./EdgeWorkerHandle.js";import"./interfaces.js";import{generateStrokesTexture as J}from"./strokes.js";import{determineRendererType as Q,determineEdgeTransparency as X,determineObjectTransparency as Y,fillComponentBufferIndices as Z}from"./util.js";import{BufferManager as $}from"../TextureBackedBuffer/BufferManager.js";import{EdgeSilhouette as ee}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";import{BufferObject as te}from"../../../../webgl/BufferObject.js";import{Usage as re}from"../../../../webgl/enums.js";const se=128;let ne=class extends t{constructor(e){super(e),this._updatingHandles=new E,this._objectEntries=new Map,this._pendingDeletions=new Map,this._renderers=new Map,this._gpuMemoryUsage=0,this._workerAbort=new AbortController,this._tmpModelPosition=O(),this._localOrigins=new U(new D(e.renderSR));const t=S.createBuffer(4);for(let r=0;r<4;r++)t.sideness.set(r,0,0===r||3===r?0:1),t.sideness.set(r,1,0===r||1===r?0:1);this._verticesBufferObject=te.createVertex(e.rctx,re.STATIC_DRAW,t.buffer)}initialize(){this._worker=new K(this.schedule),this._componentColorManager=new $(this.rctx,3)}destroy(){this.destroyed||(this._objectEntries.forEach((e=>this._discardObjectEntry(e))),this._objectEntries.clear(),this._pendingDeletions.forEach((e=>this._discardObjectEntry(e))),this._pendingDeletions.clear(),this._strokesTexture=i(this._strokesTexture),this._componentColorManager=a(this._componentColorManager),this._workerAbort.abort(),this._worker.destroy(),this._verticesBufferObject.dispose(),this._renderers.clear(),this._updatingHandles.destroy(),this._set("schedule",we))}get updating(){return this._updatingHandles.updating}get usedMemory(){return this._gpuMemoryUsage}shouldRender(){return this._renderers.size>0}async addComponentObject(e,t,r,s,n,o,i){if(this.hasObject(e))return this._getObjectMemoryUsage(e);let a;const c=new ae(null,new Promise((e=>a=e)),e.obb.center,e.obb.radius);this._objectEntries.set(e,c);const l=await this._updatingHandles.addPromise(this._addComponentGeometry(e.transform,c,t,r,s,n,o,i));return this.setNeedsRender(),a(),l}async addOrUpdateObject3D(e,t,r,s){if(this.destroyed)return void n.getLogger(this).warn("Attempt to add an object to a destroyed instance");const o=new AbortController;let i;const a=e.boundingVolumeWorldSpace.bounds,l=new ae(o,new Promise((e=>i=e)),v(a),x(a)),d=this._objectEntries.get(e);d&&(this._pendingDeletions.has(e)?this._discardObjectEntry(d):this._pendingDeletions.set(e,d)),this._objectEntries.set(e,l);try{const n=new Array;if(e.geometries.length>1&&ie(e))n.push(this._addObjectMergedGeometries(e,l,t,r,s));else for(const o of e.geometries)o.material.supportsEdges&&n.push(this._addGeometry(e,l,o,t,r,s));await this._updatingHandles.addPromise(Promise.all(n)),this._removePendingDeletion(e)}catch(h){c(h)?this._discardObjectEntry(l):this._removePendingDeletion(e)}finally{this.setNeedsRender(),i()}}removeObject(e){const t=this._objectEntries.get(e);this._objectEntries.delete(e),this._discardObjectEntry(t),this._removePendingDeletion(e)}_removePendingDeletion(e){const t=this._pendingDeletions.get(e);this._pendingDeletions.delete(e),this._discardObjectEntry(t)}async _getObjectEntry(e){const t=this._objectEntries.get(e);if(!t)throw new Error("no object");return await t.loaded,null==t.loaded?null:t}fastUpdateObject3DEdgesTransform(e){if(this.destroyed)return!1;const t=this._objectEntries.get(e);if(!t)return!1;const{geometries:r}=e,{renderables:s}=t;if(0===r.length||0===s.length)return!0;if(s.length>1)return!1;const[n]=s,o=n.transform;if(!(o instanceof de))return!1;const[i]=r;if(i.localOrigin!==o.origin.origin)return!1;const a=p(),c=this._computeModelTransformWithLocalOrigin(e,i,a);return n.transform=new de(a,c),this.setNeedsRender(),!0}_discardObjectEntry(e){e&&(e.abort?.abort(),e.renderables.length&&(e.renderables.forEach((e=>this._removeRenderable(e))),this.setNeedsRender()),e.loaded=null)}hasObject(e){return this._objectEntries.has(e)}async updateAllComponentOpacities(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));if(null==r)return;const s=Array.isArray(t)?e=>t[e]:()=>t;r.renderables.forEach((e=>{const t=e.components.meta.length;for(let r=0;r<t;r++){const t=s(r),n=e.components.meta[r],o=n.index;n.material.opacity=t,e.components.buffer.textureBuffer.setDataElement(o,1,3,255*t)}this._updateTransparency(e)})),this.setNeedsRender()}async _getObjectMemoryUsage(e){const t=await this._getObjectEntry(e);return t?t.renderables.reduce(((e,t)=>e+t.statistics.gpuMemoryUsage),0):0}async updateAllComponentMaterials(e,t,r,s){const n=e instanceof L,o=Q(t),i=W.getKey(o,r,n),a=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=a&&(a.renderables.forEach((e=>{if(i!==e.rendererKey){const t=this._renderers.get(e.rendererKey),s=this._acquireRenderer(o,r,n);t.removeRenderable(e),--t.refCount,e.rendererKey=i,s.addRenderable(e)}if(Array.isArray(t))for(let r=0;r<t.length;r++)e.components.meta[r].material=t[r];else e.components.meta[0].material=t;s&&me(e.components),this._updateTransparency(e)})),this.setNeedsRender())}async updateAllVerticalOffsets(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));null!=r&&this._updateAllVerticalOffsets(r,t)}_updateAllVerticalOffsets(e,t){e.renderables.forEach((e=>{const r=e.components.meta;for(let s=0;s<r.length;s++)e.components.meta[s].verticalOffset=t?.[s]??0;me(e.components)})),this.setNeedsRender()}async updateObjectVisibility(e,t){const r=await this._updatingHandles.addPromise(this._getObjectEntry(e));r&&(r.renderables.forEach((e=>e.visible=t)),this.setNeedsRender())}render(e,t){if(null==this._componentColorManager)return;this._localOrigins.updateViewMatrices(e.camera.viewMatrix);const r=e.camera.viewInverseTransposeMatrix,s=O(),n=new A;let o=0,i=0;if(this._renderers.forEach((r=>{if(0===r.refCount)return this._renderers.delete(r.key),void r.dispose();let s=!0,n=!0;r.forEachRenderable((t=>{t.visible&&(o+=t.statistics.averageEdgeLength,i++,s&&t.regular&&(r.updateTechnique(e,!1),s=!1),n&&t.silhouette&&(r.updateTechnique(e,!0),n=!1))}),t)})),this._componentColorManager.garbageCollect(),this._componentColorManager.updateTextures(),0===i)return;const a=new F(40*o/i,t);_(s,r[3],r[7],r[11]),n.set(s),b(a.transformWorldFromViewTH,n.high),b(a.transformWorldFromViewTL,n.low),u(a.transformViewFromCameraRelativeRS,e.camera.viewMatrix),m(Oe,a.transformViewFromCameraRelativeRS),g(a.transformNormalViewFromGlobal,Oe),a.transformProjFromView=e.camera.projectionMatrix,this._updateObjectCameraDistances(e),this._renderers.forEach((t=>{ge(t,e,a),fe(t,e,a)}))}_updateTransparency(e){const t=X(e.components.meta),r=Y(e.components.meta);t===e.edgeTransparency&&r===e.objectTransparency||(e.edgeTransparency=t,e.objectTransparency=r,this._renderers.get(e.rendererKey).setRenderablesDirty())}_computeModelTransformWithLocalOrigin(e,t,r){e.getCombinedShaderTransformation(t,r);const s=null!=t.localOrigin?this._localOrigins.register(t.localOrigin):this._localOrigins.acquire(_(this._tmpModelPosition,r[12],r[13],r[14]));return t.localOrigin=s.origin,P(s.origin.vec3,r),s}_createComponentBuffers(e){if(null==this._componentColorManager)return null;const t=new Array,r=this._componentColorManager.getBuffer(e.length);for(let n=0;n<e.length;n++){const s=e[n],o=r.acquireIndex();t.push({index:o,verticalOffset:0,material:s})}const s=new ce(r,t);return me(s),s}_extractEdges(e,t,r,s,n,o,i=o.length){return i<se&&(n=!0),this._worker.process({data:r,indices:o,indicesLength:i,writerSettings:t,skipDeduplicate:s},e,n)}_createRenderable(e,t,r,s,n){const o=t=>new le(new k(this.rctx,V,{vertices:H,instances:t===ee.REGULAR?G.glLayout:N.glLayout},{vertices:this._verticesBufferObject,instances:te.createVertex(this.rctx,re.STATIC_DRAW,t===ee.REGULAR?e.regular.instancesData.buffer:e.silhouette.instancesData.buffer)}),t===ee.REGULAR?e.regular.lodInfo:e.silhouette.lodInfo),i=e.regular.lodInfo.lengths.length>0?o(ee.REGULAR):null,a=e.silhouette.lodInfo.lengths.length>0?o(ee.SILHOUETTE):null,c=(i?.vao.usedMemory??0)+(a?.vao.usedMemory??0);return new he(i,a,{gpuMemoryUsage:c,externalMemoryUsage:n,averageEdgeLength:e.averageEdgeLength},r,X(t.meta),Y(t.meta),t,s)}async _addGeometry(e,t,r,s,n,o){if(r.edgeIndicesLength<=0)return;const i=r.attributes.get(I.POSITION),a=p(),c=this._computeModelTransformWithLocalOrigin(e,r,a),l=new je(i,a,c);return this._addPositionData(t,l,r.edgeIndicesLength,s,n,o)}async _addPositionData(e,t,r,s,n,o=!1){if(null==e.loaded)return;const i=this._createComponentBuffers([s]);if(null==i)return;const a=this._acquireRenderer(s.type,n,!0),{modelTransform:c,origin:l}=t,d=t.position.indices,h=t.position,u=h.data.length/h.size,m=B.createBuffer(u);for(let p=0;p<u;p++)m.position.set(p,0,h.data[p*h.size]),m.position.set(p,1,h.data[p*h.size+1]),m.position.set(p,2,h.data[p*h.size+2]);Z(i.meta,[0,m.componentIndex.count],m.componentIndex);const g=await this._updatingHandles.addPromise(this._extractEdges(e.abort?.signal||this._workerAbort.signal,a.writerSettings,m,!1,o,d,r));if(null==e.loaded)return;const f=this._createRenderable(g,i,new de(c,l),a.key,!1);e.renderables.push(f),a.addRenderable(f),this._gpuMemoryUsage+=f.statistics.gpuMemoryUsage}async _addComponentGeometry(e,t,r,s,n,o,i,a){if(null==t.loaded)return 0;const c=this._createComponentBuffers(o);if(null==c)return 0;const l=Q(o),d=this._acquireRenderer(l,i||!1,!1),h=B.createBuffer(r.length/3);R(h.position.typedBuffer,r,h.position.typedBufferStride,3),Z(c.meta,n,h.componentIndex,s);const u=!0,m=d.writerSettings,g=await this._updatingHandles.addPromise(this._extractEdges(this._workerAbort.signal,m,h,u,!1,s));if(null==t.loaded)return 0;const f=this._createRenderable(g,c,e,d.key,!0);return t.renderables.push(f),d.addRenderable(f),this._updateAllVerticalOffsets(t,a),f.statistics.gpuMemoryUsage}async _addObjectMergedGeometries(e,t,r,s,n){const o=new Map;let i=0,a=0,c=null;const l=e.geometries.filter((e=>{if(e.edgeIndicesLength<=0||!e.material.supportsEdges)return!1;!c&&e.localOrigin&&(c=e);const t=e.attributes.get(I.POSITION);return a+=t.data.length/t.size,i+=e.edgeIndicesLength,!0}));if(0===l.length)return;const d=a>=65536?Uint32Array:Uint16Array,h=i?new d(i):null,u=[];let m=0;l.forEach((e=>{const t=e.attributes.get(I.POSITION),r=t.indices;let s=o.get(t.data);if(null==s){s=u.length/3;for(let e=0;e<t.data.length;e+=t.size)u.push(t.data[e]),u.push(t.data[e+1]),u.push(t.data[e+2]);o.set(t.data,s)}for(let n=0;n<e.edgeIndicesLength;n++)h[m++]=s+r[n]}));const g=c||e.geometries[0],f=p(),_=this._computeModelTransformWithLocalOrigin(e,g,f);for(let p=0;p<e.geometries.length;p++)e.geometries[p].localOrigin=_.origin;const b=new je(new C(u,h,3),f,_);await this._updatingHandles.addPromise(this._addPositionData(t,b,h.length,r,s,n))}_acquireRenderer(e,t,r){const s=W.getKey(e,t,r);let n=this._renderers.get(s);return null==this._strokesTexture&&(this._strokesTexture=J(this.rctx)),n||(n=new W(this.rctx,this.techniques,{type:e,hasSlicePlane:t,strokesTexture:this._strokesTexture,legacy:r,spherical:this.viewingMode===M.Global}),this._renderers.set(s,n)),++n.refCount,n}_removeRenderable(e){oe(e.regular),oe(e.silhouette);const t=this._renderers.get(e.rendererKey);if(t){t.removeRenderable(e),--t.refCount,this._localOrigins.release(e.transform.origin),this._gpuMemoryUsage-=e.statistics.externalMemoryUsage?0:e.statistics.gpuMemoryUsage;for(const t of e.components.meta)e.components.buffer.releaseIndex(t.index)}}_updateObjectCameraDistances(e){const t=e.camera.eye,r=e.camera.viewForward,s=O(),n=e=>{y(s,e.center,t);const n=j(s,r),o=e.radius,i=n<-o?1/0:n<o?0:n-o;e.renderables.forEach((e=>e.distanceToCamera=i))};this._objectEntries.forEach(n),this._pendingDeletions.forEach(n)}get test(){}};function oe(e){e?.vao&&(e.vao.vertexBuffers.instances.dispose(),e.vao.disposeVAOOnly(),e.vao=null)}function ie(e){let t=null,s=null;for(const n of e.geometries){if(n.material.supportsEdges){if(t){if(!r(t,n.transformation))return!1}else t=n.transformation;if(s||null==n.localOrigin){if(null!=s?.localOrigin&&null!=n.localOrigin&&s.localOrigin.id!==n.localOrigin.id)return!1}else s=n}}return!0}e([d({constructOnly:!0})],ne.prototype,"rctx",void 0),e([d({constructOnly:!0})],ne.prototype,"renderSR",void 0),e([d({constructOnly:!0})],ne.prototype,"viewingMode",void 0),e([d({constructOnly:!0})],ne.prototype,"techniques",void 0),e([d({constructOnly:!0})],ne.prototype,"setNeedsRender",void 0),e([d({constructOnly:!0})],ne.prototype,"schedule",void 0),e([d({readOnly:!0})],ne.prototype,"_updatingHandles",void 0),e([d({readOnly:!0})],ne.prototype,"updating",null),ne=e([h("esri.views.3d.webgl-engine.lib.edgeRendering.EdgeView")],ne);class ae{constructor(e,t,r,s){this.abort=e,this.radius=s,this.renderables=new Array;const n=e?l(e.signal,(()=>e.abort())):null;this.loaded=t,this.loaded.then((()=>{null!=this.loaded&&(this.loaded=!0),this.abort=null,n?.remove()})),this.center=w(r)}}class ce{constructor(e,t){this.buffer=e,this.meta=t}}class le{constructor(e,t){this.vao=e,this.lod=t}}class de{constructor(e,t){this.modelMatrix=e,this.origin=t}}class he{constructor(e,t,r,s,n,o,i,a){this.regular=e,this.silhouette=t,this.statistics=r,this.transform=s,this.edgeTransparency=n,this.objectTransparency=o,this.components=i,this.rendererKey=a,this.distanceToCamera=0,this.visible=!0}}class ue extends he{}function me(e){const{meta:t,buffer:r}=e,s=new Uint8Array(4);for(let n=0;n<t.length;n++){const e=t[n].material,i=t[n].index,a=o(Math.round(e.size*q),0,255),c=o(e.extensionLength,-z,255-z)+z,l=255*e.opacity,d=e.color,h=255*d[0],u=255*d[1],m=255*d[2],g=255*d[3];r.textureBuffer.setData(i,0,h,u,m,g),r.textureBuffer.setData(i,1,a,c,e.type,l),T(t[n].verticalOffset,s),r.textureBuffer.setData(i,2,s[0],s[1],s[2],s[3])}}function ge(e,t,r){const s=e.bindRegularEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!pe(n)||!n.visible)return;const i=ye(n.regular.lod.lengths,n.distanceToCamera,o);e.renderRegularEdges(s,n,r,t,i)}),n)}function fe(e,t,r){const s=e.bindSilhouetteEdges(r,t),n=r.transparency,o=t.camera.perScreenPixelRatio;e.forEachRenderable((n=>{if(!be(n)||!n.visible)return;const i=ye(n.silhouette.lod.lengths,n.distanceToCamera,o);e.renderSilhouetteEdges(s,n,r,t,i)}),n)}function pe(e){return null!=e.regular}class _e extends he{}function be(e){return null!=e.silhouette}function ye(e,t,r){const n=t*r,o=s(e,n,!0);return-1===o?n<e[0]?e.length:0:e.length-o}class je{constructor(e,t,r){this.position=e,this.modelTransform=t,this.origin=r}}const Oe=f(),we=()=>Promise.reject();export{ne as EdgeView,de as LegacyTransform,ue as RegularRenderable,he as Renderable,_e as SilhouetteRenderable};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
var A;!function(A){A[A.
|
|
5
|
+
var A;!function(A){A[A.TRANSPARENT=0]="TRANSPARENT",A[A.OPAQUE=1]="OPAQUE"}(A||(A={}));export{A as Transparency};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{Transparency as e}from"./interfaces.js";import{EdgeType as
|
|
5
|
+
import{Transparency as e}from"./interfaces.js";import{EdgeType as r}from"../../shaders/sources/edgeRenderer/EdgeUtil.glsl.js";function t(e){if(!Array.isArray(e))return f(e)?e.type:r.Mixed;let t;for(const o of e){const e=o.type;if(f(o))if(null==t)t=e;else if(t!==e)return r.Mixed}return t??r.Mixed}function o(r){let t=e.TRANSPARENT;for(const{material:o}of r)if(i(o)){if(o.color[3]*o.opacity<1)return e.TRANSPARENT;t=e.OPAQUE}return t}function n(r){let t=e.TRANSPARENT;for(const{material:o}of r)if(i(o)){switch(o.objectTransparency){case e.TRANSPARENT:return e.TRANSPARENT;case e.OPAQUE:if(o.opacity<1)return e.TRANSPARENT}t=e.OPAQUE}return t}function i(e){return e.size*e.color[3]*e.opacity>0}function f(e){return e.size*e.color[3]>0}function c(e,r,t,o){for(let n=0;n<e.length;n++){const i=e[n].index,f=r[n],c=r[n+1];if(o)for(let e=f;e<c;e++){const r=o[e];t.set(r,i)}else for(let e=f;e<c;e++)t.set(e,i)}}export{o as determineEdgeTransparency,n as determineObjectTransparency,t as determineRendererType,c as fillComponentBufferIndices};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,m as c,h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import g from"../../../webgl/RenderCamera.js";import{ShaderOutput as I}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as C}from"../../effects/RenderPlugin.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends C{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new g,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t?.(I.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==I.Highlight&&e!==I.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.isVisible()||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==I.Highlight&&e!==I.ShadowHighlight,r=e!==I.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.isVisible()||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;b(!!(n&T.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===I.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(b(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(b(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(b(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
5
|
+
import{_ as e}from"../../../../../chunks/tslib.es6.js";import{isSome as t}from"../../../../../core/arrayUtils.js";import{destroyMaybe as r}from"../../../../../core/maybe.js";import{isAborted as a,throwIfAborted as s}from"../../../../../core/promiseUtils.js";import{property as n}from"../../../../../core/accessorSupport/decorators/property.js";import"../../../../../core/has.js";import"../../../../../core/Logger.js";import{subclass as i}from"../../../../../core/accessorSupport/decorators/subclass.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as l,m as c,h}from"../../../../../chunks/vec32.js";import{create as d}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as u,fromValues as m}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as f}from"../../../support/debugFlags.js";import{glLayout as _}from"../../../support/buffer/glUtil.js";import{newLayout as p}from"../../../support/buffer/InterleavedLayout.js";import g from"../../../webgl/RenderCamera.js";import{ShaderOutput as I}from"../../core/shaderLibrary/ShaderOutput.js";import{ASyncPreparesRenderPlugin as C}from"../../effects/RenderPlugin.js";import{Default3D as y}from"../DefaultVertexAttributeLocations.js";import{IntersectorType as v}from"../IntersectorInterfaces.js";import E from"../Octree.js";import{RenderSlot as A}from"../RenderSlot.js";import{assert as b}from"../Util.js";import{VertexAttribute as D}from"../VertexAttribute.js";import{InstanceData as R,StateFlags as T}from"./InstanceData.js";import{InstanceOctree as L}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as O}from"./LodLevel.js";import{RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as x}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as N}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as M}from"../../shaders/DefaultMaterialTechnique.js";import{TaskPriority as U,noBudget as w}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as F,unbindVertexBufferLayout as H}from"../../../../webgl/Util.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map((e=>e.minScreenSpaceRadius));return new S(t,r)};let B=class extends C{constructor(e,t){super(e),this.type=v.LOD,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=[new Array],this._highlightRenderInstanceData=[new Array],this._allRenderInstanceData=[this._defaultRenderInstanceData[0],this._highlightRenderInstanceData[0]],this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new g,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[A.OPAQUE_MATERIAL,e=>this._produces(e)],[A.TRANSPARENT_MATERIAL,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new R({shaderTransformation:e.shaderTransformation},e.optionalFields),this.addHandles(t.registerTask(U.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=q(this.optionalFields),this._glInstanceBufferLayout=_(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",(()=>this._requestUpdateCycle())),this._instanceData.events.on("instance-transform-changed",(({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)})),this._instanceData.events.on("instance-visibility-changed",(({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)})),this._instanceData.events.on("instance-highlight-changed",(()=>this._requestUpdateCycle(!0)))])}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerUid(){return this.metadata.layerUid}get instanceData(){return this._instanceData}get usedMemory(){return this._allRenderInstanceData.reduce(((e,t)=>t.reduce(((e,t)=>e+t.usedMemory),e)),0)}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach(((e,r)=>{const a=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:a,renderedTriangles:a*s,trianglesPerInstance:s})})),{totalInstances:e,renderedInstances:t.reduce(((e,t)=>e+t.renderedInstances),0),renderedTriangles:t.reduce(((e,t)=>e+t.renderedTriangles),0),levels:t}}async initializeRenderContext(e,r){this._context=e;const n=e.renderContext.rctx,i=await Promise.allSettled(this.symbol.levels.map((t=>(this._defaultRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),this._highlightRenderInstanceData[0].push(new j(n,this._instanceBufferLayout)),O.create(e,t,r))))),o=i.map((e=>"fulfilled"===e.status?e.value:null)).filter(t);if(a(r)||o.length!==i.length){o.forEach((e=>e.destroy())),s(r);for(const e of i)if("rejected"===e.status)throw e.reason}this._levels=o,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach((e=>e.destroy())),this._defaultRenderInstanceData[0].forEach((e=>e.destroy())),this._highlightRenderInstanceData[0].forEach((e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some((e=>e.components.some((e=>{const t=e.material.produces.get(A.TRANSPARENT_MATERIAL);return t?.(I.Color)}))))}hasHighlights(){return this._highlightRenderInstanceData[0].some((e=>e.size>0))}_produces(e){return e!==I.Highlight&&e!==I.ShadowHighlight||this.hasHighlights()}prepareRender(e){if(!f.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bindParameters.contentCamera.equals(this._camera);this._camera.copyFrom(e.bindParameters.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(w),this._needFullCycle=!1)}}prepareTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e.output);if(!t)return null;const r=new Array;return t.forEach((t=>this.levels.forEach(((a,s)=>{a.components.forEach((a=>r.push(this._beginComponent(e,t[s],a))))})))),r}renderNode(e,t){const r=this._getInstanceDatas(e.output);if(!r||null==t)return;let a=0;e.rctx.bindVAO(),r.forEach((r=>this.levels.forEach(((s,n)=>{s.components.forEach((s=>this._renderComponent(e,t[a++],r[n],s,n)))}))))}_getInstanceDatas(e){const t=e!==I.Highlight&&e!==I.ShadowHighlight,r=e!==I.ShadowExcludeHighlight;return t&&r?this._allRenderInstanceData:t?this._defaultRenderInstanceData:r?this._highlightRenderInstanceData:null}intersect(e,t,r,a){if(!this.baseMaterial.visible||null==this._octree)return;const s=d();l(s,a,r);const n=s=>{this._instanceData.getCombinedModelTransform(s,W),e.transform.set(W),h(K,r,e.transform.inverse),h(Y,a,e.transform.inverse);const n=this._instanceData.getState(s),i=this._instanceData.getLodLevel(s),o=this._levels.length;b(!!(n&T.ACTIVE),"invalid instance state"),b(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,K,Y,s,this.metadata,o)};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(n):this._octree.forEachAlongRay(r,s,n)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new L(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)t.get(r)&T.ACTIVE&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=r(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return{near:1/0,far:-1/0};const t=e.viewForward,r=this._octree.findClosest(t,E.DepthOrder.FRONT_TO_BACK,e.frustum),a=this._octree.findClosest(t,E.DepthOrder.BACK_TO_FRONT,e.frustum);if(null==r||null==a)return{near:1/0,far:-1/0};const s=e.eye,n=this._instanceData.view;n.boundingSphere.getVec(r,k),l(k,k,s);const i=c(k,t)-k[3];n.boundingSphere.getVec(a,k),l(k,k,s);const o=c(k,t)+k[3];return{near:Math.max(e.near,i),far:Math.min(e.far,o)}}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.startUpdateCycle()))))}get running(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:r,_levelSelector:a}=this;this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.beginUpdate()))));const s=this._instanceData,n=s.view;let i=s.size;const o=s.capacity;let l=this._instanceIndex;const c=Math.ceil(o/500);for(let h=0;h<i&&!e.done;++h){l===this._cycleStartIndex&&this._startUpdateCycle();const h=n.state.get(l);let d=0;if(!(h&T.ALLOCATED)){l=l+1===o?0:l+1,i++;continue}const u=n.lodLevel.get(l);if(h&T.DEFAULT_ACTIVE&&this._defaultRenderInstanceData[0][u].freeTail(),h&T.HIGHLIGHT_ACTIVE&&this._highlightRenderInstanceData[0][u].freeTail(),h&T.REMOVE)s.freeInstance(l);else if(h&T.VISIBLE){let e=0;t&&(n.modelOrigin.getVec(l,z),e=a.selectLevel(z,s.getCombinedMedianScaleFactor(l),r)),d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),e>=0&&(h&T.HIGHLIGHT?(P(this._highlightRenderInstanceData[0][e],n,l),d|=T.HIGHLIGHT_ACTIVE):(P(this._defaultRenderInstanceData[0][e],n,l),d|=T.DEFAULT_ACTIVE)),n.state.set(l,d),n.lodLevel.set(l,e)}else d=h&~(T.ACTIVE|T.TRANSFORM_CHANGED),n.state.set(l,d);if(null!=this._octreeCached){const e=!!(h&T.ACTIVE),t=!!(d&T.ACTIVE);!e&&t?this._octreeCached.addInstance(l):e&&!t?this._octreeCached.removeInstance(l):e&&t&&h&T.TRANSFORM_CHANGED&&(this._octreeCached.removeInstance(l),this._octreeCached.addInstance(l))}l=l+1===o?0:l+1,l%c==0&&e.madeProgress()}this._instanceIndex=l,this._allRenderInstanceData.forEach((e=>e.forEach((e=>e.endUpdate())))),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const a=r.glMaterials.load(e.rctx,e.bindParameters.slot,e.output);return null!=a?a.beginSlot(e.bindParameters):null}_renderComponent(e,t,r,a,s){if(!t)return;const{bindParameters:n,rctx:i}=e;i.runAppleAmdDriverHelper();const o=i.bindTechnique(t,n,a.material.parameters,Q);i.bindVAO(a.vao),t.ensureAttributeLocations(a.vao),f.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&e.output===I.Color&&(o.setUniform4fv("externalColor",J[Math.min(s,J.length-1)]),o.setUniform1i("colorMixMode",x.replace));const l=r.capacity,c=r.headIndex,h=r.tailIndex,d=r.firstIndex,u=this._glInstanceBufferLayout,m=(e,s)=>{F(i,y,r.buffer,u,e),i.drawArraysInstanced(t.primitiveType,0,a.vertexCount,s-e),H(i,y,r.buffer,u)};a.material.parameters.transparent&&null!=d?c>h?(b(d>=h&&d<=c,"invalid firstIndex"),m(d,c),m(h,d)):c<h&&(d<=c?(b(d>=0&&d<=c,"invalid firstIndex"),m(d,c),m(h,l),m(0,d)):(b(d>=h&&d<=l,"invalid firstIndex"),m(d,l),m(0,c),m(h,d))):c>h?m(h,c):c<h&&(m(0,c),m(h,l)),i.bindVAO(null)}};function P(e,t,r){const a=e.allocateHead();G(t,r,e.view,a)}function G(e,t,r,a){N(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,a),r.model.copyFrom(a,e.model,t),r.modelNormal.copyFrom(a,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(a,e.color,t),e.objectAndLayerIdColor&&r.objectAndLayerIdColor&&r.objectAndLayerIdColor.copyFrom(a,e.objectAndLayerIdColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(a,e.featureAttribute,t)}function q(e){let t=p().vec3f(D.INSTANCEMODELORIGINHI).vec3f(D.INSTANCEMODELORIGINLO).mat3f(D.INSTANCEMODEL).mat3f(D.INSTANCEMODELNORMAL);return null!=e&&e.includes("featureAttribute")&&(t=t.vec4f(D.INSTANCEFEATUREATTRIBUTE)),null!=e&&e.includes("color")&&(t=t.vec4u8(D.INSTANCECOLOR)),null!=e&&e.includes("objectAndLayerIdColor")&&(t=t.vec4u8(D.INSTANCEOBJECTANDLAYERIDCOLOR)),t}e([n({constructOnly:!0})],B.prototype,"symbol",void 0),e([n({constructOnly:!0})],B.prototype,"optionalFields",void 0),e([n({constructOnly:!0})],B.prototype,"metadata",void 0),e([n({constructOnly:!0})],B.prototype,"shaderTransformation",void 0),e([n()],B.prototype,"_instanceData",void 0),e([n()],B.prototype,"_cycleStartIndex",void 0),e([n({readOnly:!0})],B.prototype,"_enableLevelSelection",null),e([n()],B.prototype,"_updateCyclesWithStaticCamera",void 0),e([n({readOnly:!0})],B.prototype,"running",null),B=e([i("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],B);const z=d(),k=u(),W=o(),K=d(),Y=d(),J=[m(1,0,1,1),m(0,0,1,1),m(0,1,0,1),m(1,1,0,1),m(1,0,0,1)],Q=new M;export{B as LodRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as f}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";class u extends p{constructor(r){super(r,new m),this.produces=new Map([[a.OPAQUE_MATERIAL,r=>e(r)&&!this.parameters.transparent],[a.TRANSPARENT_MATERIAL,r=>e(r)&&this.parameters.transparent&&this.parameters.writeDepth],[a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,r=>e(r)&&this.parameters.transparent&&!this.parameters.writeDepth]])
|
|
5
|
+
import{fromValues as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as e}from"../core/shaderLibrary/ShaderOutput.js";import s from"../lib/GLMaterial.js";import{MaterialParameters as i}from"../lib/Material.js";import{RenderSlot as a}from"../lib/RenderSlot.js";import{DefaultBufferWriter as o}from"./DefaultBufferWriter.js";import{PositionUVLayout as n}from"./DefaultLayouts.js";import{TriangleMaterial as p}from"./TriangleMaterial.js";import{CheckerBoardTechnique as f}from"../shaders/CheckerBoardTechnique.js";import{CheckerBoardTechniqueConfiguration as h}from"../shaders/CheckerBoardTechniqueConfiguration.js";class u extends p{constructor(r){super(r,new m),this._configuration=new h,this.produces=new Map([[a.OPAQUE_MATERIAL,r=>e(r)&&!this.parameters.transparent],[a.TRANSPARENT_MATERIAL,r=>e(r)&&this.parameters.transparent&&this.parameters.writeDepth],[a.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,r=>e(r)&&this.parameters.transparent&&!this.parameters.writeDepth]])}getConfiguration(r,t){return this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration}createGLMaterial(r){return new c(r)}createBufferWriter(){return new o(n)}}class c extends s{beginSlot(r){return this.ensureTechnique(f,r)}}class m extends i{constructor(){super(...arguments),this.size=r(1,1),this.color1=t(.75,.75,.75,1),this.color2=t(.5,.5,.5,1),this.transparent=!1,this.writeDepth=!0,this.polygonOffset=!1}}export{u as CheckerBoardMaterial,m as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as t,isColorOrOID as s,isDepth as a,is2DGeometryOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as o}from"../lib/basicInterfaces.js";import n from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as h}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as f}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as _}from"../shaders/ColorMaterialTechniqueConfiguration.js";class d extends u{constructor(e){super(e,new g),this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===t.Highlight||s(e)&&!this._isTransparent],[p.OPAQUE_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&!this._isTransparent],[p.TRANSPARENT_MATERIAL,e=>s(e)&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(s(e)||a(e)&&this.parameters.writeLinearDepth)&&this._isTransparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>i(e)]])
|
|
5
|
+
import has from"../../../../core/has.js";import{ZEROS as e}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ShaderOutput as t,isColorOrOID as s,isDepth as a,is2DGeometryOutput as i}from"../core/shaderLibrary/ShaderOutput.js";import{CullFaceOptions as o}from"../lib/basicInterfaces.js";import n from"../lib/GLMaterial.js";import{OITPolygonOffsetLimit as h}from"../lib/OrderIndependentTransparency.js";import{RenderSlot as p}from"../lib/RenderSlot.js";import{VertexAttribute as c}from"../lib/VertexAttribute.js";import{DefaultBufferWriter as l}from"./DefaultBufferWriter.js";import{TriangleMaterial as u}from"./TriangleMaterial.js";import{VisualVariablePassParameters as m}from"./VisualVariablePassParameters.js";import{ColorMaterialTechnique as f}from"../shaders/ColorMaterialTechnique.js";import{ColorMaterialTechniqueConfiguration as _}from"../shaders/ColorMaterialTechniqueConfiguration.js";class d extends u{constructor(e){super(e,new g),this._configuration=new _,this.supportsEdges=!0,this.produces=new Map([[p.OPAQUE_MATERIAL,e=>e===t.Highlight||s(e)&&!this._isTransparent],[p.OPAQUE_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&!this._isTransparent],[p.TRANSPARENT_MATERIAL,e=>s(e)&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_NO_SSAO_DEPTH,e=>a(e)&&this.parameters.writeLinearDepth&&this._isTransparent&&this.parameters.writeDepth],[p.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(s(e)||a(e)&&this.parameters.writeLinearDepth)&&this._isTransparent&&!this.parameters.writeDepth],[p.DRAPED_MATERIAL,e=>i(e)]])}getConfiguration(e,r){return this._configuration.output=e,this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasVertexColors=this.parameters.hasVertexColors&&!this.parameters.vvColor,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this._isTransparent,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.transparencyPassType=r.transparencyPassType,this._configuration.enableOffset=r.camera.relativeElevation<h,this._configuration.multipassEnabled=r.multipassEnabled,this._configuration.cullAboveGround=r.multipassTerrain.cullAboveGround,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.draped=this.parameters.draped,this._configuration}createGLMaterial(e){return new T(e)}createBufferWriter(){const e=r().vec3f(c.POSITION);return has("enable-feature:objectAndLayerId-rendering")&&e.vec4u8(c.OBJECTANDLAYERIDCOLOR),this.parameters.vvColor?e.f32(c.COLORFEATUREATTRIBUTE):e.vec4u8(c.COLOR),new l(e)}get _isTransparent(){return this.parameters.color[3]<1||this.parameters.forceTransparentMode}}class T extends n{_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(e){return this._output===t.Color&&this._updateOccludeeState(e),this.ensureTechnique(f,e)}}class g extends m{constructor(){super(...arguments),this.color=e,this.forceTransparentMode=!1,this.writeDepth=!0,this.writeLinearDepth=!1,this.hasVertexColors=!1,this.polygonOffset=!1,this.hasSlicePlane=!1,this.cullFace=o.None,this.hasOccludees=!1,this.draped=!1}}export{d as ColorMaterial,g as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,j as i,m as o,t as n}from"../../../../chunks/vec32.js";import{create as h,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutput as m,isShadowRelatedOutput as p,ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as g}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as T}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as x}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as S}from"../lib/RayIntersections.js";import{RenderSlot as O}from"../lib/RenderSlot.js";import{VertexAttribute as w}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as y}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as R,DefaultMaterialPassParameters as I}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as A}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as P}from"../shaders/RealisticTreeTechnique.js";class j extends b{constructor(e){super(e,D),this.supportsEdges=!0,this.produces=new Map([[O.OPAQUE_MATERIAL,e=>(m(e)||p(e))&&!this.parameters.transparent],[O.TRANSPARENT_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&this.parameters.writeDepth],[O.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this.
|
|
5
|
+
import has from"../../../../core/has.js";import{s as e,c as t,n as r,f as s,l as a,j as i,m as o,t as n}from"../../../../chunks/vec32.js";import{create as h,fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ViewingMode as c}from"../../../ViewingMode.js";import{newLayout as u}from"../../support/buffer/InterleavedLayout.js";import{is3DGeometryOutput as m,isShadowRelatedOutput as p,ShaderOutput as f}from"../core/shaderLibrary/ShaderOutput.js";import{NormalType as d}from"../core/shaderLibrary/attributes/NormalAttribute.glsl.js";import{NormalsDoubleSidedMode as g}from"../core/shaderLibrary/shading/Normals.glsl.js";import{PBRMode as T}from"../core/shaderLibrary/shading/PhysicallyBasedRenderingParameters.glsl.js";import{CullFaceOptions as _}from"../lib/basicInterfaces.js";import{GLTextureMaterial as x}from"../lib/GLTextureMaterial.js";import{Material as b}from"../lib/Material.js";import{OITPolygonOffsetLimit as v}from"../lib/OrderIndependentTransparency.js";import{intersectTriangleGeometry as S}from"../lib/RayIntersections.js";import{RenderSlot as O}from"../lib/RenderSlot.js";import{VertexAttribute as w}from"../lib/VertexAttribute.js";import{getVerticalOffsetObject3D as M}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as C}from"./DefaultBufferWriter.js";import{verticalOffsetAtDistance as y}from"./internal/MaterialUtil.js";import{DefaultMaterialTechnique as R,DefaultMaterialPassParameters as I}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as A}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as P}from"../shaders/RealisticTreeTechnique.js";class j extends b{constructor(e){super(e,D),this._configuration=new A,this.supportsEdges=!0,this.produces=new Map([[O.OPAQUE_MATERIAL,e=>(m(e)||p(e))&&!this.parameters.transparent],[O.TRANSPARENT_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&this.parameters.writeDepth],[O.TRANSPARENT_DEPTH_WRITE_DISABLED_MATERIAL,e=>(m(e)||p(e))&&this.parameters.transparent&&!this.parameters.writeDepth]]),this._vertexBufferLayout=N(this.parameters)}isVisibleForOutput(e){return e!==f.Shadow&&e!==f.ShadowExcludeHighlight&&e!==f.ShadowHighlight||this.parameters.castShadows}get visible(){const e=this.parameters;if(0===e.layerOpacity)return!1;const{hasInstancedColor:t,hasVertexColors:r,hasSymbolColors:s,vvColor:a}=e,i="replace"===e.colorMixMode,o=e.opacity>0,n=e.externalColor&&e.externalColor[3]>0,h=t||a||s;return r&&h?i||o:r?i?n:o:h?i||o:i?n:o}getConfiguration(e,t){return this._configuration.output=e,this._configuration.hasNormalTexture=!!this.parameters.normalTextureId,this._configuration.hasColorTexture=!!this.parameters.textureId,this._configuration.hasVertexTangents=this.parameters.hasVertexTangents,this._configuration.instanced=this.parameters.isInstanced,this._configuration.instancedDoublePrecision=this.parameters.instancedDoublePrecision,this._configuration.vvSize=!!this.parameters.vvSize,this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasSliceHighlight=this.parameters.hasSliceHighlight,this._configuration.alphaDiscardMode=this.parameters.textureAlphaMode,this._configuration.normalType=this.parameters.normalType,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,null!=this.parameters.customDepthTest&&(this._configuration.customDepthTest=this.parameters.customDepthTest),this._configuration.hasOccludees=this.parameters.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?_.None:this.parameters.cullFace,this._configuration.multipassEnabled=t.multipassEnabled,this._configuration.cullAboveGround=t.multipassTerrain.cullAboveGround,this._configuration.hasModelTransformation=null!=this.parameters.modelTransformation,e===f.Color&&(this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.hasSymbolColors=this.parameters.hasSymbolColors,this.parameters.treeRendering?this._configuration.doubleSidedMode=g.WindingOrder:this._configuration.doubleSidedMode=this.parameters.doubleSided&&"normal"===this.parameters.doubleSidedType?g.View:this.parameters.doubleSided&&"winding-order"===this.parameters.doubleSidedType?g.WindingOrder:g.None,this._configuration.instancedColor=this.parameters.hasInstancedColor,this._configuration.receiveShadows=this.parameters.receiveShadows&&this.parameters.shadowMappingEnabled,this._configuration.receiveAmbientOcclusion=this.parameters.receiveAmbientOcclusion&&null!=t.ssao,this._configuration.vvColor=!!this.parameters.vvColor,this._configuration.textureAlphaPremultiplied=!!this.parameters.textureAlphaPremultiplied,this._configuration.pbrMode=this.parameters.usePBR?this.parameters.isSchematic?T.Schematic:T.Normal:T.Disabled,this._configuration.hasMetallicRoughnessTexture=!!this.parameters.metallicRoughnessTextureId,this._configuration.hasEmissionTexture=!!this.parameters.emissiveTextureId,this._configuration.hasOcclusionTexture=!!this.parameters.occlusionTextureId,this._configuration.offsetBackfaces=!(!this.parameters.transparent||!this.parameters.offsetTransparentBackfaces),this._configuration.transparencyPassType=t.transparencyPassType,this._configuration.enableOffset=t.camera.relativeElevation<v,this._configuration.snowCover=this.hasSnowCover(t),this._configuration.hasColorTextureTransform=!!this.parameters.colorTextureTransformMatrix,this._configuration.hasNormalTextureTransform=!!this.parameters.normalTextureTransformMatrix,this._configuration.hasEmissionTextureTransform=!!this.parameters.emissiveTextureTransformMatrix,this._configuration.hasOcclusionTextureTransform=!!this.parameters.occlusionTextureTransformMatrix,this._configuration.hasMetallicRoughnessTextureTransform=!!this.parameters.metallicRoughnessTextureTransformMatrix),this._configuration}hasSnowCover(e){return null!=e.weather&&e.weatherVisible&&"snowy"===e.weather.type&&"enabled"===e.weather.snowCover}intersect(h,l,u,m,p,f){if(null!=this.parameters.verticalOffset){const h=u.camera;e(W,l[12],l[13],l[14]);let f=null;switch(u.viewingMode){case c.Global:f=r(G,W);break;case c.Local:f=t(G,z)}let d=0;const g=s(k,W,h.eye),T=a(g),_=i(g,g,1/T);let x=null;this.parameters.screenSizePerspective&&(x=o(f,_)),d+=y(h,T,this.parameters.verticalOffset,x??0,this.parameters.screenSizePerspective),i(f,f,d),n(H,f,u.transform.inverseRotation),m=s(V,m,H),p=s(B,p,H)}S(h,u,m,p,M(u.verticalOffset),f)}createGLMaterial(e){return new E(e)}createBufferWriter(){return new C(this._vertexBufferLayout)}}class E extends x{constructor(e){super({...e,...e.material.parameters})}_updateShadowState(e){e.shadowMap.enabled!==this._material.parameters.shadowMappingEnabled&&this._material.setParameters({shadowMappingEnabled:e.shadowMap.enabled})}_updateOccludeeState(e){e.hasOccludees!==this._material.parameters.hasOccludees&&this._material.setParameters({hasOccludees:e.hasOccludees})}beginSlot(t){this._output===f.Color&&(this._updateShadowState(t),this._updateOccludeeState(t));const r=this._material.parameters;this.updateTexture(r.textureId);const s=t.camera.viewInverseTransposeMatrix;return e(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.ensureTechnique(r.treeRendering?P:R,t)}}class L extends I{constructor(){super(...arguments),this.initTextureTransparent=!1,this.treeRendering=!1,this.hasVertexTangents=!1}}const D=new L;function N(e){const t=u().vec3f(w.POSITION);e.normalType===d.Compressed?t.vec2i16(w.NORMALCOMPRESSED,{glNormalized:!0}):t.vec3f(w.NORMAL),e.hasVertexTangents&&t.vec4f(w.TANGENT);return(e.textureId||e.normalTextureId||e.metallicRoughnessTextureId||e.emissiveTextureId||e.occlusionTextureId)&&t.vec2f(w.UV0),e.hasVertexColors&&t.vec4u8(w.COLOR),e.hasSymbolColors&&t.vec4u8(w.SYMBOLCOLOR),has("enable-feature:objectAndLayerId-rendering")&&t.vec4u8(w.OBJECTANDLAYERIDCOLOR),t}const V=h(),B=h(),z=l(0,0,1),G=h(),H=h(),W=h(),k=h();export{E as DefaultGLMaterial,j as DefaultMaterial,L as DefaultMaterialParameters};
|