@arcgis/core 4.34.0-next.72 → 4.34.0-next.73
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/11acefc48c0354e675df.js +1 -0
- package/assets/esri/core/workers/chunks/433c4dc666a6b2c99063.js +353 -0
- package/assets/esri/core/workers/chunks/{1f51c94d392826fdbdf4.js → 8ce653c3c5dde10ccbcf.js} +46 -46
- package/assets/esri/core/workers/chunks/8d91e2d185be4a4e8598.js +1 -0
- package/assets/esri/core/workers/chunks/{bcc233a86e01ff1eac16.js → ae7b86bd08a44e26b339.js} +1 -1
- package/assets/esri/core/workers/chunks/be9edd9791a00cab9c2b.js +1 -0
- package/assets/esri/core/workers/chunks/e8d25d4ca9b335883f34.js +1 -0
- package/assets/esri/widgets/Sketch/t9n/Sketch.json +1 -1
- package/assets/esri/widgets/Sketch/t9n/Sketch_en.json +1 -1
- package/chunks/Fog.glsl.js +5 -10
- package/chunks/GlowComposition.glsl.js +4 -4
- package/chunks/Terrain.glsl.js +29 -43
- package/chunks/boundedPlane.js +1 -1
- package/config.js +1 -1
- package/geometry/support/boundedPlane.js +1 -1
- package/interfaces.d.ts +26 -3
- package/kernel.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/support/gaussianSplatUtils.js +1 -1
- package/package.json +3 -3
- package/support/basemapDefinitions.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/engine/flow/FlowDisplayData.js +1 -1
- package/views/2d/engine/flow/FlowStrategy.js +1 -1
- package/views/2d/engine/flow/dataUtils.js +1 -1
- package/views/2d/engine/flow/utils.js +1 -1
- package/views/2d/interactive/editingTools/TransformTool.js +1 -1
- package/views/2d/interactive/editingTools/manipulations/ScaleManipulation.js +1 -1
- package/views/3d/analysis/DirectLineMeasurement/DirectLineMeasurementVisualization.js +1 -1
- package/views/3d/analysis/Slice/SliceController.js +1 -1
- package/views/3d/analysis/Slice/SliceTool.js +1 -1
- package/views/3d/analysis/Slice/sliceToolUtils.js +1 -1
- package/views/3d/environment/Fog.glsl.js +1 -1
- package/views/3d/interactive/Manipulator3D.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentRotate.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/ExtentScale.js +1 -1
- package/views/3d/interactive/editingTools/transform/extentTransform/extentUtils.js +1 -1
- package/views/3d/interactive/support/viewUtils.js +1 -1
- package/views/3d/interactive/visualElements/LabelVisualElement.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/Deconflictor.js +1 -1
- package/views/3d/layers/graphics/Graphics3DCore.js +1 -1
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DIconSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineCalloutSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DLineSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DMeshFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPathSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DPolygonFillSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DTextSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DWaterSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/support/Tiles3DIntersectionHandler.js +1 -1
- package/views/3d/state/ScreenSizePerspective.js +5 -0
- package/views/3d/state/controllers/PinchAndPanControllerGlobal.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/SharedSymbolResources.js +1 -1
- package/views/3d/support/ViewSlice.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/support/flow/FlowWorker.js +1 -1
- package/views/3d/support/flow/geometryUtils.js +1 -1
- package/views/3d/support/geometryUtils/ray.js +1 -1
- package/views/3d/support/pointsOfInterest/CenterOnSurface.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/ScreenSizePerspective.glsl.js +4 -4
- package/views/3d/webgl-engine/effects/glow/GlowComposition.glsl.js +1 -1
- package/views/3d/webgl-engine/effects/raymarching/RayDistanceFalloff.glsl.js +10 -0
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/SliceHelper.js +1 -1
- package/views/3d/webgl-engine/lib/screenSizePerspectiveUtils.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/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/internal/MaterialUtil.js +1 -1
- package/views/3d/webgl-engine/shaders/AnimatedLine.glsl.js +28 -10
- package/views/3d/webgl-engine/shaders/RibbonLineTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/TerrainTechniqueConfiguration.js +1 -1
- package/views/SceneView.js +1 -1
- package/views/draw/support/tooltipUtils.js +1 -1
- package/views/interactive/editGeometry/support/editPlaneUtils.js +1 -1
- package/views/interactive/snapping/featureSources/featureServiceSource/tileUtils.js +1 -1
- package/views/support/GroundViewElevationSampler.js +1 -1
- package/widgets/Sketch/SketchViewModel.js +1 -1
- package/widgets/Sketch/VisibleElements.js +1 -1
- package/widgets/Sketch/support/OperationHandle.js +1 -1
- package/widgets/Sketch/support/sketchUtils.js +1 -1
- package/widgets/Sketch.js +1 -1
- package/assets/esri/core/workers/chunks/16cfbe7bedf75d3a86e5.js +0 -1
- package/assets/esri/core/workers/chunks/226833d408eb1225e168.js +0 -1
- package/assets/esri/core/workers/chunks/cf69f6afeaf1229e032c.js +0 -1
- package/assets/esri/core/workers/chunks/e21eeb4e78a46fb7e32e.js +0 -1
- package/assets/esri/core/workers/chunks/f87a6b32292c1464b7b7.js +0 -353
- package/views/3d/webgl-engine/materials/ScaleInfo.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/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 r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as u}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as
|
|
5
|
+
import e from"../../../../Color.js";import"../../../../core/has.js";import t from"../../../../core/Logger.js";import{ONES as r}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{d as i,c as o}from"../../../../chunks/vec42.js";import{fromValues as s,ONES as n,ZEROS as a,fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{closeRings as p}from"../../../../geometry/support/coordsUtils.js";import{defaultSymbolLayerComplexity as c}from"./defaultSymbolComplexity.js";import{ElevationContext as d}from"./ElevationContext.js";import{zeroContext as h}from"./featureExpressionInfoUtils.js";import{mixinColorAndOpacity as u}from"./graphicUtils.js";import{Loadable as y}from"./Loadable.js";import{getAttributeValue as f}from"../support/FastSymbolUpdates.js";import{encodeNaNUInt8 as v}from"../support/symbolColorUtils.js";const g=()=>t.getLogger("esri.views.3d.layers.graphics.Graphics3DSymbolLayer");class m extends y{constructor(e,t,r,i,o=!0){super(r.schedule),this.symbol=e,this.symbolLayer=t,this._context=r,this._drivenOpacityFallbackAlwaysOpaque=o,this.ignoreDrivers=!1,this._drivenProperties={color:!1,opacity:!1,opacityAlwaysOpaque:!0,size:!1,rotation:!1},this._materials=[],this.logger=g(),this._elevationOptions={supportsOffsetAdjustment:!1,supportsOnTheGround:!0},this.skipHighSymbolLodsChanged=!0,this._renderPriority=i.renderPriority,this._renderPriorityStep=i.renderPriorityStep,this._elevationContext=new d,this.updateComplexity(),this.ignoreDrivers=i.ignoreDrivers,this.ignoreDrivers||(this._drivenProperties=_(this._context.renderer,o)),this._updateElevationContext()}destroy(){this.complexity=null,this._materials.length=0,super.destroy()}get view(){return this._context.stage.view}getCachedSize(){return null}get extentPadding(){return 0}get materials(){return this._materials}get estimatedMemory(){const{complexity:e}=this;if(null==e)return 0;return(this.draped?e.memory.draped:e.memory).bytesPerFeature}get usedMemory(){return this.estimatedMemory}_drivenPropertiesChanged(e){if(this.ignoreDrivers)return!1;const t=this._drivenProperties,r=_(e,this._drivenOpacityFallbackAlwaysOpaque);return r.color!==t.color||r.opacity!==t.opacity||r.opacityAlwaysOpaque!==t.opacityAlwaysOpaque||r.size!==t.size||r.rotation!==t.rotation}get needsDrivenTransparentPass(){return this._hasDrivenColorOrOpacity&&!this._drivenProperties.opacityAlwaysOpaque}get _hasDrivenColorOrOpacity(){return this._drivenProperties.color||this._drivenProperties.opacity}_logGeometryCreationWarnings(e,t,r,i){const o=e.projectionSuccess,s="polygons"in e?e.polygons:null,n=`${i} geometry failed to be created`;o?!this._logGeometryValidationWarnings(t,r,i)&&s&&0===s.length&&"rings"===r&&t.length>0&&t[0].length>2&&g().warnOncePerTick(`${n} (filled rings should use clockwise winding - try reversing the order of vertices)`):g().warnOncePerTick(`${n} (failed to project geometry to view spatial reference)`)}get needsUpdateFocus(){return!1}_logGeometryValidationWarnings(e,t,r){const i=`${r} geometry failed to be created`;return!e.length||1===e.length&&!e[0].length?(g().warnOncePerTick(`${i} (no ${t} were defined)`),!0):(!Array.isArray(e)||!Array.isArray(e[0]))&&(g().warnOncePerTick(`${i} (${t} should be defined as a 2D array)`),!0)}_validateGeometry(e,t=null,r=null){if(null!=t&&!t.includes(e.type))return this.logger.warn("unsupported geometry type for "+r+` symbol: ${e.type}`),!1;switch(e.type){case"point":{const t=e;if(!isFinite(t.x)||!isFinite(t.y))return g().warn("point coordinate is not a valid number, graphic skipped"),!1;break}case"polygon":p(e)}return!0}_defaultElevationInfoNoZ(){return x}_defaultElevationInfoZ(){return C}_updateElevationContext(){null!=this._elevationInfoOverride?(this._elevationContext.setFromElevationInfo(this._elevationInfoOverride),this._elevationContext.setFeatureExpressionInfoContext(null)):this._context.layer.elevationInfo?(this._elevationContext.setFromElevationInfo(this._context.layer.elevationInfo),this._elevationContext.setFeatureExpressionInfoContext(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()}createElevationContextForGraphic(e){const t=new d;return this.updateElevationContextForGraphic(t,e),t}updateElevationContextForGraphic(e,t){const r=t.geometry,i=this.getDefaultElevationInfo(r);e.unit=null!=this._elevationContext.unit?this._elevationContext.unit:i.unit,e.mode=this.getGeometryElevationMode(r,i),e.offsetMeters=this._elevationContext.meterUnitOffset??i.offset??0;const o=!this._elevationOptions.supportsOnTheGround&&"on-the-ground"===e.mode;o&&(e.mode="relative-to-ground",e.offsetMeters=0);const s=o?h:this._elevationContext.featureExpressionInfoContext;s?e.updateFeatureExpressionInfoContextForGraphic(s,t,this._context.layer):e.setFeatureExpressionInfoContext(null)}prepareSymbolLayerPatch(e){}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=b){const r=this.draped?1:this._getLayerOpacity();return this._drivenProperties.color?r:e?r*(this._drivenProperties.opacity?1:e.a):t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=b){const o=this._getCombinedOpacity(t,i);if(this._drivenProperties.color)return u(null,o);const s=null!=t?e.toUnitRGB(t):r;return u(s,o)}_getDrivenUInt8Color({color:t,opacity:r},i,o){const{color:s,opacity:l}=this._drivenProperties,p=e.toUnitRGBA(i)??(o?n:a),c=s?t??p:null,d=t||i||o,h=s?null:p[3];return u(c,l&&d?r??h:null,255)}_getDrivenUInt8ColorWithNaNSupport({color:t,opacity:r},n,a){const p=n?l(e.toUnitRGBA(n)):s(NaN,NaN,NaN,a?NaN:0);return this._drivenProperties.color&&null!=t&&i(p,t),this._drivenProperties.opacity&&null!=r&&(p[3]=r),o(p,p,255),v(p,p)}isFastUpdatesEnabled(){return null!=this._fastUpdates}updateComplexity(){this.complexity=this.computeComplexity()}computeComplexity(){return c(this.symbol,this.symbolLayer)}globalPropertyChanged(e,t,r){switch(e){case"opacity":return this.layerOpacityChanged(t,r),!0;case"screenSizePerspectiveEnabled":return this.layerScreenSizePerspectiveChanged(t,r),!0;case"elevationInfo":{const e=this._elevationContext.mode;this._updateElevationContext();return 2!==this.layerElevationInfoChanged(t,r,e)}case"slicePlaneEnabled":return this.slicePlaneEnabledChanged(t,r);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,r){let i=1;return e?.forEach(e=>{const o=t(e);if(null!=o){const t=e.graphic;this.updateElevationContextForGraphic(o.elevationContext,t),o.needsElevationUpdates=r(o.elevationContext.mode)}else i=2}),i}applyRendererDiff(e,t){return 0}getFastUpdateAttrValues(e){if(!this._fastUpdates)return null;const t=this._fastUpdates.visualVariables,r=t.size?f(t.size.field,e):0,i=t.color?f(t.color.field,e):0,o=t.opacity?f(t.opacity.field,e):0;return s(r,i,o,0)}get draped(){return this._draped}ensureDrapedStatus(e){return null==this._draped?(this._draped=e,!0):(e!==this.draped&&g().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 _(e,t){const r={color:!1,opacity:!1,opacityAlwaysOpaque:t,size:!1,rotation:!1};return e&&"visualVariables"in e&&e.visualVariables&&e.visualVariables.forEach(e=>{switch(e.type){case"color":if(r.color=!0,e.stops)for(let t=0;t<e.stops.length;t++){const i=e.stops[t].color;i&&i.a<1&&(r.opacityAlwaysOpaque=!1)}break;case"opacity":r.opacity=!0,r.opacityAlwaysOpaque=!1;break;case"size":r.size=!0;break;case"rotation":r.rotation=!0}}),r}const x={mode:"on-the-ground",offset:0,unit:"meters"},C={mode:"absolute-height",offset:0,unit:"meters"},b={hasIntrinsicColor:!1},O=s(NaN,NaN,NaN,NaN);export{m as Graphics3DSymbolLayer,_ as getDrivenProperties,O as nanFallbackColor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as r}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as
|
|
5
|
+
import e from"../../../../core/Error.js";import has from"../../../../core/has.js";import{releaseMaybe as t}from"../../../../core/maybe.js";import{isPromiseLike as r}from"../../../../core/promiseUtils.js";import{pt2px as s}from"../../../../core/screenUtils.js";import{fromValues as n,ZEROS as i,create as o}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{freeze as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as l}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{hasCalloutSupport as c,textSymbolLayerSupportsVerticalOffset as m}from"../../../../symbols/callouts/calloutUtils.js";import{perObjectElevationAligner as f}from"./ElevationAligners.js";import{needsElevationUpdates2D as h}from"./elevationAlignmentUtils.js";import{focusAreaHUDColor as p}from"./focusAreaStyle.js";import{Graphics3DObject3DGraphicLayer as u}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DObjectMetadata as d}from"./Graphics3DObjectMetadata.js";import{Graphics3DSymbolLayer as g}from"./Graphics3DSymbolLayer.js";import{validateSymbolLayerSize as y}from"./graphicUtils.js";import{LabelPlacement as v,LabelParameters as x}from"./LabelParameters.js";import{verticalScreenOffsetFromAlignment as b,verticalPlacementFromAlignment as O,textRenderAlignmentFromHorizontalPlacement as P,horizontalPlacementToAnchorX as w,anchorFromPlacements as j,namedAnchorToHUDMaterialAnchorPos as S}from"./placementUtils.js";import{placePointOnGeometry as _,updateStageObjectGeometry as E,getLocalOriginForPoint as z,extendPointGraphicElevationContext as C,createStageObject as F}from"./pointUtils.js";import{getFontMetrics as G}from"../../webgl-engine/lib/FontMetrics.js";import{createPointGeometry as L}from"../../webgl-engine/lib/GeometryUtil.js";import{TextRenderParameters as A}from"../../webgl-engine/lib/TextRenderParameters.js";import U from"../../webgl-engine/lib/TextTextureFactory.js";import{HUDMaterial as D}from"../../webgl-engine/materials/HUDMaterial.js";const R=a(0,0,1);class T extends g{constructor(e,t,r,s){super(e,t,r,s),this._elevationOptions={supportsOffsetAdjustment:!0,supportsOnTheGround:!1},this.ensureDrapedStatus(!1)}async doLoad(){if(!this._drivenProperties.size){const t=y(this.symbolLayer.size);if(t)throw new e("graphics3dtextsymbollayer:invalid-size",t)}await this._createTextRenderParameters()}async _createTextRenderParameters(){const e=this._context.graphicsCoreOwner.view.state.rasterPixelRatio;this._textRenderParameters=await A.fromSymbol(this.symbolLayer,e)}destroy(){super.destroy()}createGraphics3DGraphic(e){const t=e.graphic,r=_(t.geometry);if(null==r)return this.logger.warn(`unsupported geometry type for text symbol: ${t.geometry.type}`),null;const s=this.view.focusAreasView?.containsGeometry(r)??!0,n=this.symbolLayer.text;if(null==n||""===n)return null;const i=c(this.symbol)&&this.symbol.hasVisibleVerticalOffset()?this.symbol.verticalOffset:null;if(null!=i&&!m(this.symbolLayer))return this.logger.errorOncePerTick(`Callouts and vertical offset on text symbols are currently only supported with 'center' horizontal alignment (not with '${this.symbolLayer.horizontalAlignment}' alignment)`),null;const{verticalAlignment:o}=this.symbolLayer,a=new v(i);b(o,a.screenOffset);const l=new x(a,this.symbolLayer.horizontalAlignment,O(o));return l.isFocused=s??l.isFocused,this._createAs3DShape(t,r,n,l)}get needsUpdateFocus(){return!0}createLabel(e,t,r,s,n){const i=e.graphic,o=_(i.geometry);if(null==o)return this.logger.warn(`unsupported geometry type for label: ${i.geometry.type}`),null;const a=this.view.focusAreasView?.containsGeometry(o)??!0,l=t.text;return!l||/^\s+$/.test(l)?null:(t.isFocused=a??t.isFocused,this._createAs3DShape(i,o,l,t,r,s,n))}createElevationContextForGraphic(e,t=0){const r=super.createElevationContextForGraphic(e);return r.addOffsetRenderUnits(t),r}updateElevationContextForGraphic(e,t,r=0){super.updateElevationContextForGraphic(e,t),e.addOffsetRenderUnits(r)}layerOpacityChanged(){return this.logger.warn("layer opacity change not yet implemented in Graphics3DTextSymbolLayer"),!1}layerScreenSizePerspectiveChanged(e,t){const r=!this.draped&&this._context.screenSizePerspectiveEnabled,s=r?this.view.screenSizePerspective.labelParameters:null,n=r?this.view.screenSizePerspective.parameters:null;V(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({screenSizePerspective:s,screenSizePerspectiveAlignment:n})})}layerElevationInfoChanged(e,t){return V(e,t,(e,t)=>{this.graphics3DGraphicLayerElevationInfoChanged(t,e)}),1}slicePlaneEnabledChanged(e,t){return V(e,t,e=>{for(const t of e.stageObject.geometries)t.material.setParameters({hasSlicePlane:this._context.slicePlaneEnabled})}),!0}physicalBasedRenderingChanged(){return!0}get pixelRatioChanged(){return!1}graphics3DGraphicLayerElevationInfoChanged(e,t){const{elevationContext:r,metadata:s}=t;this.updateElevationContextForGraphic(r,e,s?.elevationOffset??0),t.needsElevationUpdates=h(r.mode)||"absolute-height"===r.mode}updateGeometry(e,t){const r=e.geometry;if(this.draped||!r||!this._validateGeometry(r))return!1;const{elevationContext:s,stageObject:n}=t;if(s.mode!==this.getGeometryElevationMode(r))return!1;const i=_(r);if(!i)return!1;s.updateFeatureExpressionFeature(e,this._context.layer);const o=E(n,this._context,i,s);if(null==o)return!1;const a=z(this._context,i);return n.geometries[0].localOrigin===a&&(t.alignedSampledElevation=o,C(t,i,this._context.elevationProvider),!0)}_defaultElevationInfoNoZ(){return I}_createAs3DShape(e,a,c,m,g,y=null,v=()=>m.placement.elevationOffset){const x=this.createElevationContextForGraphic(e,m.placement.elevationOffset),b=e.uid;let O=null,w=null;if(null==y){const e=P(m.horizontalPlacement);O=new U(c,e,this._textRenderParameters);let s=null;if(null!=this._context.sharedResources.textures){w=this._context.sharedResources.textures.fromData(O.key,()=>O.create()),w.texture.events.on("unloaded",()=>s=t(s));const e=this._context.stage.renderView.textures.acquire(w.texture.id);if(null==e||r(e))return w.release(),null;s=e}}const j=!has("disable-feature:non-occluded-hud"),S=H(O,m),_={occlusionTest:!j,occludedFragmentFade:j,horizonCullingEnabled:j&&this._context.spherical,screenOffset:m.placement.screenOffset,anchorPosition:S,polygonOffset:!0,color:[1,1,1,1],centerOffsetUnits:m.placement.centerOffsetUnits,depthEnabled:!1,drawAsLabel:!0,isLabel:!0,isFocused:m.isFocused};if("polyline"===e.geometry?.type&&(_.shaderPolygonOffset=1e-4),y?_.textureId=y.id:w&&(_.textureId=w.texture.id),null!=m.placement.verticalOffset){const{screenLength:e,minWorldLength:t,maxWorldLength:r}=m.placement.verticalOffset;_.verticalOffset={screenLength:s(e),minWorldLength:t||0,maxWorldLength:null!=r?r:1/0}}const E=this._context.graphicsCoreOwner.view.focusAreasView?.polygons.length,z={screenOffset:_.screenOffset,anchorPosition:S,centerOffsetUnits:_.centerOffsetUnits,verticalOffset:_.verticalOffset,shaderPolygonOffset:_.shaderPolygonOffset,occlusionTest:_.occlusionTest,isFocused:m.isFocused,focusStyle:this.view.map?.focusAreas.style??"none"};if(this._context.screenSizePerspectiveEnabled){const{parameters:e,labelParameters:t}=this.view.screenSizePerspective,r=G(this._textRenderParameters);_.screenSizePerspective=t,_.screenSizePerspectiveMinPixelReferenceSize=r.maxHeight,_.screenSizePerspectiveAlignment=e,z.fontHeight=r.maxHeight}_.hasSlicePlane=this._context.slicePlaneEnabled;const A=this._context.spherical,T=g?JSON.stringify(z):"";let V=g?.get(T);if(null==V){if(!m.isFocused&&E){const e=this.view.map?.focusAreas.style;_.color=p(_.color,e),_.outlineColor=p(_.outlineColor,e)}V=new D(_,A),g?.set(T,V)}const I=m.placement.translation,W=O?n(O.displayWidth,O.displayHeight):i,M=m.placement.centerOffset,$=R,k=y?l(0,0,0,0):null,N=L(V,{normal:$,position:I,size:W,centerOffsetAndDistance:M,uvi:k}),q=F(this._context,a,N,x,b);if(null==q)return null;const B=(t,r,s,n,i,o)=>{const a=v()||m.placement.elevationOffset;return this.updateElevationContextForGraphic(r,e,a),f(t,r,s,n,i,o)},J=new u(this,q.object,w,B,x);J.alignedSampledElevation=q.sampledElevation,J.needsElevationUpdates=h(x.mode)||"absolute-height"===x.mode,J.getScreenSize=(e=o())=>(e[0]=O?O.displayWidth:m.displaySize[0],e[1]=O?O.displayHeight:m.displaySize[1],e);const Y=new d(m.placement.elevationOffset,c);return J.metadata=Y,C(J,a,this._context.elevationProvider),J}}function V(e,t,r){e?.forEach(e=>{const s=t(e);null!=s&&r(s,e.graphic)})}function H(e,t){if("baseline"===t.verticalPlacement){const r=w[t.horizontalPlacement],s=null!=e?e.baselineAnchorY:0;return n(r,s)}const r=j(t.horizontalPlacement,t.verticalPlacement);return S[r]}const I={mode:"relative-to-ground",offset:0};export{T as Graphics3DTextSymbolLayer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/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 i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry 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 i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{fromValues as o,create as n}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{c as s}from"../../../../chunks/vec42.js";import{toRadian as a}from"../../../../core/libs/gl-matrix-2/math/common.js";import{fromBuffer as l,create as c,intersectsClippingArea as h,empty as p,expandWithAABB as m}from"../../../../geometry/support/aaBoundingBox.js";import{empty as u,create as d,expandPointInPlace as g}from"../../../../geometry/support/aaBoundingRect.js";import{newFloatArray as y,floatSubArray as f}from"../../../../geometry/support/FloatArray.js";import{perVertexElevationAligner as v}from"./ElevationAligners.js";import{elevationModeChangeUpdateType as x,needsElevationUpdates2D as _}from"./elevationAlignmentUtils.js";import{Graphics3DDrapedGraphicLayer as w}from"./Graphics3DDrapedGraphicLayer.js";import{Graphics3DObject3DGraphicLayer as b}from"./Graphics3DObject3DGraphicLayer.js";import{Graphics3DSymbolLayer as D}from"./Graphics3DSymbolLayer.js";import{geometryAsPolygon as S,createWaterGeometry as C,PolygonCreationDataBase as j}from"./polygonUtils.js";import{geometryToRenderInfo as G,geometryToRenderInfoDraped as P}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{Parameters as A,WaterMaterial as E}from"../../webgl-engine/materials/WaterMaterial.js";import{wavePresets as T}from"../../webgl-engine/materials/internal/waterMaterialUtils.js";const U=["polyline","polygon","extent"];class B extends D{static{this.unitSizeOfTexture=100}static{this.elevationModeChangeTypes={definedChanged:2,staysOnTheGround:0,onTheGroundChanged:2}}constructor(e,t,r,i){super(e,t,r,i)}async doLoad(){}createGraphics3DGraphic(e){const t=e.graphic;if(!this._validateGeometry(t.geometry,U,this.symbolLayer.type))return null;const r=this.createElevationContextForGraphic(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 A,r=e.toUnitRGBA(this.symbolLayer.color);r[3]*=this._getLayerOpacity(),t.color=r,t.transparent=r[3]<1||this.needsDrivenTransparentPass,t.waveDirection=null!=this.symbolLayer.waveDirection?M(this.symbolLayer.waveDirection):o(0,0);const i=this.symbolLayer.waveStrength+"-"+this.symbolLayer.waterbodySize,n=T[i];t.waveStrength=n.waveStrength,t.waveTextureRepeat=n.textureRepeat,t.waveVelocity=n.waveVelocity,t.flowStrength=n.perturbationStrength,t.hasSlicePlane=this._context.slicePlaneEnabled,t.draped=this.draped,this._materials[0]=new E(t,this._context)}layerOpacityChanged(){if(null==this._materials[0])return;const e=this._materials[0].parameters.color,t=this.symbolLayer.color.a*this._getLayerOpacity(),r=t<1||this.needsDrivenTransparentPass;this._materials[0].setParameters({color:[e[0],e[1],e[2],t],transparent:r})}layerScreenSizePerspectiveChanged(){}layerElevationInfoChanged(e,t,r){const i=this._elevationContext.mode,o=x(B.elevationModeChangeTypes,r,i);if(1!==o)return o;const n=_(i);return this.updateGraphics3DGraphicElevationInfo(e,t,()=>n)}slicePlaneEnabledChanged(){return this._materials[0]?.setParameters({hasSlicePlane:this._context.slicePlaneEnabled}),!0}physicalBasedRenderingChanged(){return!0}get needsDrivenTransparentPass(){return!1}_createAs3DShape(e,t,r){const i=S(e.geometry);if(null==i)return null;const o=G(i,this._context.elevationProvider,this._context.renderCoordsHelper,t),n=o.position.length/3,s=y(2*n);R(s,o.mapPositions,n,this._context.elevationProvider.spatialReference);const a=new k(o,s,this._context.layerViewUid,e.uid);if(a.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(a),this._create3DShapeGeometries(a),this._logGeometryCreationWarnings(a.renderData,i.rings,"rings","WaterSymbol3DLayer"),0===a.outGeometries.length)return null;const l=new L({geometries:a.outGeometries,castShadow:!1,layerViewUid:this._context.layerViewUid,graphicUid:r}),c=new b(this,l,null,v,t);return c.alignedSampledElevation=a.renderData.sampledElevation,c.needsElevationUpdates=_(t.mode),c}_create3DShapeGeometries(e){const t=e.renderData.polygons,i=e.uvCoords;for(const{count:o,index:n,position:s,mapPositions:a,holeIndices:c}of t){if(null!=this._context.clippingExtent&&(l(a,W),!h(W,this._context.clippingExtent)))continue;const t=r(a,c,3);if(0===t.length)continue;const p=f(i,2*n,2*o),m=C({material:this._materials[0],indices:t,mapPositions:a,attributeData:{position:s,uv0:p}},e.olidColor);e.outGeometries.push(m)}}_createAsOverlay(e){const t=S(e.geometry);if(null==t)return null;this._materials[0].renderPriority=this._renderPriority;const r=P(t,this._context.overlaySR),i=r.position.length/3,o=y(2*i);R(o,r.position,i,this._context.overlaySR);const n=new F(r,o,this._context.layerViewUid,e.uid);return n.olidColor=this._context.stage.renderView?.getObjectAndLayerIdColor(n),n.outBoundingBox=p(),this._createAsOverlayWater(n),this._logGeometryCreationWarnings(n.renderData,t.rings,"rings","WaterSymbol3DLayer"),0===n.outGeometries.length?null:new w(this,n.outGeometries,n.outBoundingBox,this._context.drapeSourceRenderer)}_createAsOverlayWater(e){const t=e.uvCoords,i=e.renderData.polygons;for(const{position:o,holeIndices:n,index:s,count:a}of i){if(l(o,W),!h(W,this._context.clippingExtent))continue;m(e.outBoundingBox,W);const i=r(o,n,3);if(0===i.length)continue;const c=f(t,2*s,2*a),p=C({material:this._materials[0],indices:i,attributeData:{position:o,uv0:c}},e.olidColor);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 M(e){const t=n(),r=a(e);return t[0]=Math.sin(r),t[1]=Math.cos(r),t}function R(e,r,o,n){const a=t(n);u(z);for(let t=0;t<o;t++)i(I,r[3*t],r[3*t+1]),g(z,I);s(z,z,a);const l=z[0]%B.unitSizeOfTexture,c=z[1]%B.unitSizeOfTexture;V[0]=z[0]-l,V[1]=z[1]-c;for(let t=0;t<o;t++)e[2*t]=(r[3*t]*a-V[0])/B.unitSizeOfTexture,e[2*t+1]=(r[3*t+1]*a-V[1])/B.unitSizeOfTexture}const V=n(),z=d(),I=n(),W=c();class k extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}class F extends j{constructor(e,t,r,i){super(e,r,i),this.uvCoords=t}}export{B as Graphics3DWaterSymbolLayer,M as headingVectorFromAngle};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DirectRenderer as n}from"./DirectRenderer.js";import{LodRenderer as o}from"./LodRenderer.js";import{Texture as l}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as c}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as m}from"../../../../webgl-engine/materials/pbrUtils.js";let h=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach(e=>e.destroy())}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new l(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.addTexture(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}_destroyTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=1===r.state.viewingMode;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new c(r,{spherical:t});i.setParameters({cullFace:i.transparent?0:2}),s=i;break}case"hud":{const r=e.parameters;s=new u(r,t)}}this._materials.set(e.materialId,s)}async destroyMaterial(e){this._materials.delete(e)}async updateMaterial(e){}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new n({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async destroyDirectRenderer(e){const r=this._directRenderers.get(e);if(null==r)return;const t=this.view;t.stage.removeRenderPlugin(r),this._directRenderers.delete(e),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new o({view:this.view,layerViewUid:this.layerViewUid}),d=e=>this._materials.get(e);if(await i.doLoad(r,d,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async destroyLoDRenderer(e,r){const t=this._lodRenderers.get(e);null!=t&&(t.destroy(),this._lodRenderers.delete(e))}_destroyLodRenderer({rendererId:e}){const r=this._lodRenderers.get(e);null!=r&&(r.destroy(),this._lodRenderers.delete(e))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"destroy-texture":this._destroyTexture(r.textureId);break;case"update-material":this._updateMaterial(r);break;case"destroy-material":this._destroyMaterial(r);break;case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"destroy-lod-renderer":this._destroyLodRenderer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_updateMaterial({materialId:e,parameters:r}){const t=this._materials.get(e);null!=t?t.setParameters(r):console.error("material not found")}_destroyMaterial({materialId:e}){null!=this._materials.get(e)?this._materials.delete(e):console.error("material not found")}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function
|
|
5
|
+
import{__decorate as e}from"tslib";import r from"../../../../../../core/Accessor.js";import"../../../../../../core/has.js";import{createAbortError as t}from"../../../../../../core/promiseUtils.js";import{property as s}from"../../../../../../core/accessorSupport/decorators/property.js";import"../../../../../../core/Logger.js";import"../../../../../../core/RandomLCG.js";import{subclass as i}from"../../../../../../core/accessorSupport/decorators/subclass.js";import{ONES as d}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as a}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{DirectRenderer as n}from"./DirectRenderer.js";import{LodRenderer as o}from"./LodRenderer.js";import{Texture as l}from"../../../../webgl-engine/lib/Texture.js";import{DefaultMaterial as c}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as u}from"../../../../webgl-engine/materials/HUDMaterial.js";import{schematicMRRFactors as m}from"../../../../webgl-engine/materials/pbrUtils.js";let h=class extends r{constructor(e){super(),this.view=null,this.layerViewUid=null,this._stage=null,this._materials=new Map,this._textures=new Map,this._directRenderers=new Map,this._lodRenderers=new Map,this.totalFeatures=0,this.view=e.view,this.layerViewUid=e.layerViewUid}initialize(){this._stage=this.view.stage}destroy(){this.removeAllHandles(),this._lodRenderers.forEach(e=>e.destroy())}async createTexture(e,r){const{_textures:t,_stage:s}=this,i=new l(e,r);return t.set(i.id,i),s&&(i.load(s.renderView.renderingContext),s.addTexture(i)),i.id}async releaseTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}_destroyTexture(e){const{_textures:r,_stage:t}=this,s=r.get(e);s&&(t&&(s.unload(),t.removeTexture(s)),r.delete(e))}async createMaterial(e){const{view:r}=this,t=1===r.state.viewingMode;let s=null;switch(e.type){case"default":{const r=e.parameters,i=new c(r,{spherical:t});i.setParameters({cullFace:i.transparent?0:2}),s=i;break}case"hud":{const r=e.parameters;s=new u(r,t)}}this._materials.set(e.materialId,s)}async destroyMaterial(e){this._materials.delete(e)}async updateMaterial(e){}async createDirectRenderer(e){if(this._directRenderers.has(e))return;const r=this._materials.get(e);if(null==r)throw new Error(`material not found ${e}`);const{view:t}=this,s=new n({material:r,layerViewUid:this.layerViewUid});this._directRenderers.set(e,s),t.stage.addRenderPlugin(s),t.stage.renderView.renderer.updateHasFlags()}async destroyDirectRenderer(e){const r=this._directRenderers.get(e);if(null==r)return;const t=this.view;t.stage.removeRenderPlugin(r),this._directRenderers.delete(e),t.stage.renderView.renderer.updateHasFlags()}async createLoDRenderer(e,r,s){const i=new o({view:this.view,layerViewUid:this.layerViewUid}),d=e=>this._materials.get(e);if(await i.doLoad(r,d,s),s?.aborted)throw i.destroy(),t();this._lodRenderers.set(e,i)}async destroyLoDRenderer(e,r){const t=this._lodRenderers.get(e);null!=t&&(t.destroy(),this._lodRenderers.delete(e))}_destroyLodRenderer({rendererId:e}){const r=this._lodRenderers.get(e);null!=r&&(r.destroy(),this._lodRenderers.delete(e))}async executeRenderCommands(e){for(const r of e)switch(r.id){case"destroy-texture":this._destroyTexture(r.textureId);break;case"update-material":this._updateMaterial(r);break;case"destroy-material":this._destroyMaterial(r);break;case"add-direct-renderer-geometry-buffer":this._addDirectRendererGeometryBuffer(r);break;case"update-direct-renderer-geometry-buffer":this._updateDirectRendererGeometryBuffer(r);break;case"remove-direct-renderer-geometry-buffer":this._removeDirectRendererGeometryBuffer(r);break;case"destroy-lod-renderer":this._destroyLodRenderer(r);break;case"add-lod-instances":this._addLodInstances(r);break;case"remove-lod-instances":this._removeLodInstances(r);break;case"update-lod-instance-data":this._updateLodInstanceData(r);break;case"update-visibility":this._updateVisibility(r)}e.length>0&&this._updateFeatureCount()}_updateFeatureCount(){let e=0;for(const r of this._directRenderers.values())e+=r.numFeatures;for(const r of this._lodRenderers.values())e+=r.numFeatures;this._set("totalFeatures",e)}get usedMemory(){let e=0;for(const r of this._directRenderers.values())e+=r.usedMemory;for(const r of this._lodRenderers.values())e+=r.usedMemory;return e}_updateMaterial({materialId:e,parameters:r}){const t=this._materials.get(e);null!=t?t.setParameters(r):console.error("material not found")}_destroyMaterial({materialId:e}){null!=this._materials.get(e)?this._materials.delete(e):console.error("material not found")}_addDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.addRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_updateDirectRendererGeometryBuffer({groupId:e,rendererId:r,renderGeometryBuffer:t,renderGeometryBufferItems:s,localOrigin:i}){const d=this._directRenderers.get(r);null!=d?(d.updateRenderGeometryBuffer(e,t,s,i),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_removeDirectRendererGeometryBuffer({groupId:e,rendererId:r}){const t=this._directRenderers.get(r);null!=t?(t.removeRenderGeometryBuffer(e),this.view.stage.renderView.requestRender()):console.error("no renderer assigned to provided material")}_addLodInstances({rendererId:e,groupId:r,data:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("no lod renderer assigned to provided lod renderer Id");s.addInstances(r,t),this.view.stage.renderView.requestRender()}_removeLodInstances({rendererId:e,groupId:r}){const t=this._lodRenderers.get(e);if(null==t)throw new Error("no lod renderer assigned to provided lod renderer Id");t.removeInstances(r),this.view.stage.renderView.requestRender()}_updateLodInstanceData({rendererId:e,groupId:r,globalTransforms:t}){const s=this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");null!=t&&s.updateGlobalTransforms(r,t),this.view.stage.renderView.requestRender()}_updateVisibility({rendererId:e,groupId:r,visibility:t}){const s=this._directRenderers.get(e)??this._lodRenderers.get(e);if(null==s)throw new Error("No renderer found with the provided id");s.updateVisibility(r,t),this.view.stage.renderView.requestRender()}};function p(e,r,t){const s={usePBR:r.physicalBasedRenderingEnabled,isSchematic:!0,mrrFactors:m,ambient:d,diffuse:d,hasSlicePlane:r.slicePlaneEnabled,castShadows:r.castShadows,offsetTransparentBackfaces:!r.isPrimitive};r.screenSizePerspectiveEnabled&&(s.screenSizePerspective=e.screenSizePerspective.parameters),s.externalColor=a,s.instanced=!0;const i=new c(s,{spherical:t});return i.setParameters({cullFace:i.transparent?0:2}),i}e([s({readOnly:!0})],h.prototype,"totalFeatures",void 0),h=e([i("esri.views.3d.layers.graphics.pipeline.rendering.FeaturePipelineRenderManager")],h);export{h as FeaturePipelineRenderManager,p as createDefaultMaterial};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as n,computeInvDir as s,intersectAabbInvDir as r}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(e,o,a,c,d,u){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=e.results,p=2===e.options.store,w=this.layerView.view.stage.renderView.componentObjectCollection,f=new n(u,e.options.normalRequired),h=s(a,c,l),y=(n,s,r
|
|
5
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Tiles3DTarget as i}from"../i3s/Intersector.js";import{IntersectorResult as t}from"../../webgl-engine/lib/IntersectorResult.js";import{MeshIntersectionOptions as n,computeInvDir as s,intersectAabbInvDir as r}from"../../webgl-engine/lib/RayIntersections.js";class o{constructor(e){this.type=8,this.slicePlaneEnabled=!1,this.isGround=!0,this.layerView=e,this.layerViewUid=e.uid}intersect(e,o,a,c,d,u){if(e.options.filteredLayerViewUids.includes(this.layerView.uid))return;const m=e.results,p=2===e.options.store,w=this.layerView.view.stage.renderView.componentObjectCollection,f=new n(u,e.options.normalRequired),h=s(a,c,l),y=(n,s,r)=>{if(s>=0){if(null!=o&&!o(a,c,s))return;const n=e=>{const t=new i(this.layerView.layer.uid);e.set(this.type,t,s,r)};if(this.isGround&&(null==m.ground.distance||s<m.ground.distance)&&n(m.ground),e.options.isFiltered)return;if((null==m.min.distance||s<m.min.distance)&&n(m.min),(null==m.max.distance||s>m.max.distance)&&n(m.max),p){const i=new t(e.ray);n(i),e.results.all.push(i)}}};this.layerView.forEachVisibleComponentObject(i=>{i.intersectionGeometry&&r(i.aabbInWorldCoordinates,a,h,0)&&w.intersect(i,a,c,e.tolerance,null,f,y)})}}const l=e();export{o as Tiles3DIntersectionHandler};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../core/Accessor.js";import{deg2rad as a,lerp as r,clamp as s}from"../../../core/mathUtils.js";import{watch as i,syncAndInitial as l}from"../../../core/reactiveUtils.js";import{property as c}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as n}from"../../../core/accessorSupport/decorators/subclass.js";import{c as o}from"../../../chunks/boundedPlane.js";import{c as u,b as m,d as p}from"../../../chunks/sphere.js";import{ScreenSizePerspectiveParameters as f}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";let d=class extends t{get parameters(){return this._parameters}get labelParameters(){return this._labelParameters}get _calculations(){return this.view.state.isGlobal?new h(this.view.renderCoordsHelper?.referenceEllipsoid.radius??0):new v}constructor(e){super(e),this._parameters=new f,this._labelParameters=new f}initialize(){this.addHandles([i(()=>({distance:this.view.pointsOfInterest?.centerOnSurfaceInfrequent?.distance??0,fovY:this.view.state.camera.fovY}),e=>this._update(e),l)])}_update(e){const t=this._updateParameters(this._parameters,g,e),a=this._updateParameters(this._labelParameters,P,e);return t||a}_updateParameters(e,t,a){if(e&&e.camera.fovY===a.fovY&&e.camera.distance===a.distance)return!1;const{scaleStart:r,scaleFallOffRange:s}=t,{fovY:i,distance:l}=a;this._calculations.calculateCurvatureDependentParameters(_,t,a);const c=this._calculations.surfaceCoverageCompensation(a,_),{tiltAngle:n,scaleFallOffFactor:o}=_,u=Math.sin(n)*l,m=.5*Math.PI-n-i*(.5-r*c),p=u/Math.cos(m),f=m+i*s*c,d=(p-o*(u/Math.cos(f)))/(1-o);return e.camera.fovY=a.fovY,e.camera.distance=a.distance,e.offset=d,e.divisor=p-d,e.minPixelSize=t.minPixelSize,!0}};e([c({constructOnly:!0})],d.prototype,"view",void 0),e([c()],d.prototype,"_calculations",null),d=e([n("esri.views.3d.state.ScreenSizePerspective")],d);class v{surfaceCoverageCompensation(e,t){return o(t.tiltAngle,e.fovY)}calculateCurvatureDependentParameters(e,t){e.tiltAngle=t.curvatureDependent.min.tiltAngle,e.scaleFallOffFactor=t.curvatureDependent.min.scaleFallOffFactor}}class h{constructor(e){this._ellipsoidRadius=e}surfaceCoverageCompensation(e,t){return m(O,this._ellipsoidRadius),p(O,t.tiltAngle,e.distance,e.fovY)}calculateCurvatureDependentParameters(e,t,a){const i=t.curvatureDependent,l=1+a.distance/this._ellipsoidRadius,c=Math.sqrt(l*l-1),[n,o]=[i.min.curvature,i.max.curvature],u=s((c-n)/(o-n),0,1),[m,p]=[i.min,i.max];e.tiltAngle=r(m.tiltAngle,p.tiltAngle,u),e.scaleFallOffFactor=r(m.scaleFallOffFactor,p.scaleFallOffFactor,u)}}class F{constructor(){this.tiltAngle=0,this.scaleFallOffFactor=0}}const g={curvatureDependent:{min:{curvature:a(10),tiltAngle:a(12),scaleFallOffFactor:.5},max:{curvature:a(70),tiltAngle:a(40),scaleFallOffFactor:.8}},scaleStart:.3,scaleFallOffRange:.65,minPixelSize:0},P={...g,curvatureDependent:{min:{...g.curvatureDependent.min,scaleFallOffFactor:.7},max:{...g.curvatureDependent.max,scaleFallOffFactor:.95}},minPixelSize:14},_=new F,O=u();export{d as ScreenSizePerspective};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s,createRenderScreenPointArray3 as o}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as a,distance as m}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as h,u as c,l as _,d as p,n as u,f as l,g as d,e as g}from"../../../../chunks/vec32.js";import{create as P}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as v}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as C}from"../../../../geometry/support/axisAngle.js";import{create as w,fromPositionAndNormal as M,getNormal as b}from"../../../../geometry/support/plane.js";import{c as S,n as f,a as j}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as E,applyAll as R}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as A}from"../../input/util.js";import{InteractiveController as O}from"./InteractiveController.js";import{PanPlanarMomentumController as x}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as k}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as z}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as F}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as H}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as T,excludeTerrain as D,navigationMode as U,sphereOrPlanePointFromScreenPoint as G,maxPanDistanceModifier as I,minPinchAndPanCameraHeight as Z,pivotSearchAreaSize as L,intersectPlaneFromScreenPointAtEye as V,applyZoomOnSphere as q,shouldPreserveHeading as B,applyPanSphericalPreserveHeading as J,applyPanSphericalDirectRotation as K,normalizeRotationDelta as N,applyRotation as Q,applyPanPlanar as W,applyZoomToPoint as X}from"../utils/navigationUtils.js";import Y from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as $}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as tt}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as it}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as et}from"../../../navigation/ZoomMomentumEstimator.js";let nt=class extends O{constructor(){super(...arguments),this._smoothRotation=new A(.05),this._rotationAxis=P(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=w(),this._beginRadius=0,this._smoothScaling=new A(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new et,this._rotationMomentumEstimator=new it,this._panSphericalMomentumEstimator=new tt,this._panPlanarMomentumEstimator=new $,this._adjustedSphere=S(),this._tmp3d=P(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=P(),this._screenPickPoint=n(),this._scenePickPoint=P(),this._navMode=1,this._sphere=S(),this._pointerCount=0,this._tmpInteractionDirection=P(),this._beginCamera=new Y,this._constraintOptions=new y(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),a(this._beginScreenPoint,this._screenPickPoint);const n=T(this._intersectionHelper,this.startCamera,this._screenPickPoint,v(this.view.spatialReference).radius,1,this.view.basemapTerrain.invisible?D:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,h(this._beginScenePoint,this._scenePickPoint),this._navMode=U(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navMode&&this._preparePlanarPanMode(t,n.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navMode?new H({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new F({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new z({view:this.view,momentum:e,center:f(this._sphere,P()),axis:this._rotationAxis});if(1===this._navMode){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new k({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=c(this._tmp3d,this.startCamera.viewForward);M(this._scenePickPoint,e,this._panningPlane);const r=n(this._screenPickPoint[0],0),a=P(),m=_(this.startCamera.eye);this._adjustedSphere[3]=m<this._sphere[3]?m-100:this._sphere[3],G(this._adjustedSphere,this.startCamera,r,a);const v=o();this.startCamera.projectToRenderScreen(a,v);const C=P(),w=P(),S=P();p(C,this._scenePickPoint,this.currentCamera.eye);const f=_(C);u(C,C);const j=I*Math.max(Math.abs(this.view.camera.position.z),Z),E=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,L);let R=null!=E?E:j;i&&(R=Math.min(R,f)),h(S,l(w,this.currentCamera.eye,d(w,C,R))),this._panningPlane[3]=-g(b(this._panningPlane),S),this.startCamera.center=l(w,this.startCamera.eye,d(w,this.startCamera.viewForward,R));const y=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.startCamera,y,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),q(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);G(this._sphere,this.currentCamera,i,this._tmp3d),B(this._beginScenePoint,g(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(K(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._screenPickPoint,i)),R(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){u(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+N(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*e),R(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);V(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(W(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=E(m(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),R(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),X(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=E(t.radius-this._beginRadius),R(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){h(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||c(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=N(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),Q(this.currentCamera,j(this._sphere),C(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=E(t.radius*o),R(this.view,this.currentCamera,this._constraintOptions)}};nt=t([r("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],nt);export{nt as PinchAndPanControllerGlobal};
|
|
5
|
+
import{__decorate as t}from"tslib";import{cyclicalPI as i}from"../../../../core/Cyclical.js";import{deg2rad as e}from"../../../../core/mathUtils.js";import{createScreenPointArray as n,screenPointObjectToArray as s}from"../../../../core/screenUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{copy as r,distance as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{c as m,u as h,l as c,d as _,n as p,f as u,g as l,e as d}from"../../../../chunks/vec32.js";import{create as g}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as P}from"../../../../geometry/ellipsoidUtils.js";import{wrapAxisAngle as v}from"../../../../geometry/support/axisAngle.js";import{create as C,fromPositionAndNormal as w,getNormal as M}from"../../../../geometry/support/plane.js";import{c as b,n as S,a as f}from"../../../../chunks/sphere.js";import{pixelDistanceToInteractionFactor as j,applyAll as E}from"../../camera/constraintUtils.js";import{ConstraintOptions as y}from"../../camera/constraintUtils/ConstraintOptions.js";import{ExponentialFalloff as A}from"../../input/util.js";import{InteractiveController as O}from"./InteractiveController.js";import{PanPlanarMomentumController as R}from"./momentum/PanPlanarMomentumController.js";import{PanSphericalMomentumController as x}from"./momentum/PanSphericalMomentumController.js";import{RotationMomentumController as k}from"./momentum/RotationMomentumController.js";import{ZoomPlanarMomentumController as z}from"./momentum/ZoomPlanarMomentumController.js";import{ZoomSphericalMomentumController as F}from"./momentum/ZoomSphericalMomentumController.js";import{pickPointAndInitSphere as H,excludeTerrain as D,navigationMode as T,sphereOrPlanePointFromScreenPoint as U,maxPanDistanceModifier as G,minPinchAndPanCameraHeight as I,pivotSearchAreaSize as Z,intersectPlaneFromScreenPointAtEye as L,applyZoomOnSphere as V,shouldPreserveHeading as q,applyPanSphericalPreserveHeading as B,applyPanSphericalDirectRotation as J,normalizeRotationDelta as K,applyRotation as N,applyPanPlanar as Q,applyZoomToPoint as W}from"../utils/navigationUtils.js";import X from"../../webgl/RenderCamera.js";import{PanPlanarMomentumEstimator as Y}from"../../../navigation/PanPlanarMomentumEstimator.js";import{PanSphericalMomentumEstimator as $}from"../../../navigation/PanSphericalMomentumEstimator.js";import{RotationMomentumEstimator as tt}from"../../../navigation/RotationMomentumEstimator.js";import{ZoomMomentumEstimator as it}from"../../../navigation/ZoomMomentumEstimator.js";let et=class extends O{constructor(){super(...arguments),this._smoothRotation=new A(.05),this._rotationAxis=g(),this._beginAngle=0,this._beginHeading=0,this._panningPlane=C(),this._beginRadius=0,this._smoothScaling=new A(.05),this._zoomCenterScreen=n(),this._zoomMomentumEstimator=new it,this._rotationMomentumEstimator=new tt,this._panSphericalMomentumEstimator=new $,this._panPlanarMomentumEstimator=new Y,this._adjustedSphere=b(),this._tmp3d=g(),this._tmpScreenPointArray=n(),this._beginScreenPoint=n(),this._beginScenePoint=g(),this._screenPickPoint=n(),this._scenePickPoint=g(),this._navMode=1,this._sphere=b(),this._pointerCount=0,this._tmpInteractionDirection=g(),this._beginCamera=new X,this._constraintOptions=new y(15,0,0,this._beginCamera)}get _intersectionHelper(){return this.view.sceneIntersectionHelper}begin(t){if(!this.running)return;this._zoomMomentumEstimator.enabled=this._rotationMomentumEstimator.enabled=this._panPlanarMomentumEstimator.enabled=this._panSphericalMomentumEstimator.enabled=this.view.navigation.momentumEnabled,this._beginHeading=-i.normalize(e(this.view.camera.heading)),this._beginRadius=t.radius,this._pointerCount=t.pointers.size,this._beginAngle=t.angle,this._smoothRotation.reset(),s(t.center,this._screenPickPoint),r(this._beginScreenPoint,this._screenPickPoint);const n=H(this._intersectionHelper,this.startCamera,this._screenPickPoint,P(this.view.spatialReference).radius,1,this.view.basemapTerrain.invisible?D:{});null!=n.scenePickPoint&&(this._scenePickPoint=n.scenePickPoint,this._sphere=n.sphere,m(this._beginScenePoint,this._scenePickPoint),this._navMode=T(this.startCamera,this._screenPickPoint,this.view.renderCoordsHelper,this.view.viewingMode),0===this._navMode&&this._preparePlanarPanMode(t,n.hasGeometryIntersection),this._beginCamera.copyFrom(this.startCamera))}update(t){if(!this.running)return;this.currentCamera.copyFrom(this.startCamera);const i=t.pointers.size>1;1===this._navMode?(i&&this._zoomSpherical(t),this._panningSpherical(t),i&&this._rotateSpherical(t)):(i&&this._zoomPlanar(t),this._panningPlanar(t),i&&this._rotatePlanar(t)),this.commitCamera()}end(t){t.pointers.size===this._pointerCount&&this.update(t),this.finishController();const i=this._zoomMomentumEstimator.evaluateMomentum();if(i)return 1===this._navMode?new F({view:this.view,momentum:i,screenCenter:this._zoomCenterScreen,sceneCenter:this._beginScenePoint,radius:this._sphere[3]}):new z({view:this.view,momentum:i,zoomCenter:this._beginScenePoint});const e=this._rotationMomentumEstimator.evaluateMomentum();if(e)return new k({view:this.view,momentum:e,center:S(this._sphere,g()),axis:this._rotationAxis});if(1===this._navMode){const t=this._panSphericalMomentumEstimator.evaluateMomentum();if(t)return new x({view:this.view,momentum:t})}else{const t=this._panPlanarMomentumEstimator.evaluateMomentum();if(t)return new R({view:this.view,momentum:t})}return null}_preparePlanarPanMode(t,i){const e=h(this._tmp3d,this.startCamera.viewForward);w(this._scenePickPoint,e,this._panningPlane);const o=n(this._screenPickPoint[0],0),r=g(),a=c(this.startCamera.eye);this._adjustedSphere[3]=a<this._sphere[3]?a-100:this._sphere[3],U(this._adjustedSphere,this.startCamera,o,r);const P=g(),v=g(),C=g();_(P,this._scenePickPoint,this.currentCamera.eye);const b=c(P);p(P,P);const S=G*Math.max(Math.abs(this.view.camera.position.z),I),f=this.view.stage.renderView.getMinimalDepthForArea(null,this._screenPickPoint[0],this._screenPickPoint[1],this.view.state.camera,Z);let j=null!=f?f:S;i&&(j=Math.min(j,b)),m(C,u(v,this.currentCamera.eye,l(v,P,j))),this._panningPlane[3]=-d(M(this._panningPlane),C),this.startCamera.center=u(v,this.startCamera.eye,l(v,this.startCamera.viewForward,j));const E=s(t.center,this._tmpScreenPointArray);L(this._panningPlane,this.startCamera,E,this._beginScenePoint)}_zoomSpherical(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),V(this._sphere,this.currentCamera,this._smoothScaling.value),s(t.center,this._zoomCenterScreen),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_panningSpherical(t){const i=s(t.center,this._tmpScreenPointArray);U(this._sphere,this.currentCamera,i,this._tmp3d),q(this._beginScenePoint,d(this.currentCamera.up,this._beginScenePoint),this._sphere[3],this._beginHeading,this.view.camera.tilt,this.startCamera.aboveGround)?(B(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this._beginHeading,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumPreserveHeading(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere,this._beginHeading,this.view.camera.tilt)):(J(this._sphere,this.currentCamera,this._beginScenePoint,this._tmp3d,this.view.camera.tilt,!1),this._panSphericalMomentumEstimator.addMomentumDirectRotation(i,this._tmp3d,.001*t.timestamp,this.startCamera,this._sphere[3],this.view.camera.tilt)),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=j(a(this._screenPickPoint,i)),E(this.view,this.currentCamera,this._constraintOptions)}_rotateSpherical(t){p(this._rotationAxis,this._scenePickPoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value,e=i+K(t.angle-i),n=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=n,this._smoothRotation.update(e);const s=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(s,.001*t.timestamp),N(this.currentCamera,f(this._sphere),v(this._rotationAxis,s)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=j(t.radius*e),E(this.view,this.currentCamera,this._constraintOptions)}_panningPlanar(t){const i=s(t.center,this._tmpScreenPointArray);L(this._panningPlane,this.currentCamera,i,this._tmp3d)&&(Q(this.currentCamera,this._beginScenePoint,this._tmp3d),this._panPlanarMomentumEstimator.add(i,this._tmp3d,.001*t.timestamp),this._constraintOptions.interactionType=4,this._constraintOptions.interactionFactor=j(a(this._beginScreenPoint,i)),this._constraintOptions.interactionDirection=this.view.renderCoordsHelper.worldUpAtPosition(this.currentCamera.eye,this._tmpInteractionDirection),E(this.view,this.currentCamera,this._constraintOptions),this._constraintOptions.interactionDirection=null)}_zoomPlanar(t){const i=this._beginRadius/t.radius,e=.001875*Math.min(Math.max(t.radius,40),120);this._smoothScaling.gain=e,this._smoothScaling.update(i),this._zoomMomentumEstimator.add(this._smoothScaling.value,.001*t.timestamp),W(this.currentCamera,this._beginScenePoint,this._smoothScaling.value,this.view.state.constraints.minimumPoiDistance),this._constraintOptions.interactionType=1,this._constraintOptions.interactionFactor=j(t.radius-this._beginRadius),E(this.view,this.currentCamera,this._constraintOptions)}_rotatePlanar(t){m(this._rotationAxis,this._beginScenePoint),this.currentCamera.aboveGround||h(this._rotationAxis,this._rotationAxis);const i=this._smoothRotation.value;let e=t.angle-i;e=K(e);const n=i+e,s=.00125*Math.min(Math.max(t.radius,40),120);this._smoothRotation.gain=s,this._smoothRotation.update(n);const o=this._smoothRotation.value-this._beginAngle;this._rotationMomentumEstimator.add(o,.001*t.timestamp),N(this.currentCamera,f(this._sphere),v(this._rotationAxis,o)),this._constraintOptions.interactionType=2,this._constraintOptions.interactionFactor=j(t.radius*o),E(this.view,this.currentCamera,this._constraintOptions)}};et=t([o("esri.views.3d.state.controllers.PinchAndPanControllerGlobal")],et);export{et as PinchAndPanControllerGlobal};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{createRenderScreenPointArray3 as t,castRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{f as i,n as s,e as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as p,expandPointInPlace as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{computeMapPointFromVec3d as g}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as w}from"../../support/geometryUtils/ray.js";import{defaultTolerance as R,Intersector as b}from"../../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as v}from"../../webgl-engine/lib/IntersectorResult.js";import{sliceFilterPredicate as I}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as P}from"../../webgl-engine/materials/HUDMaterial.js";class j{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=R,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=new b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}destroy(){this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),L(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,L(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(F,r,n),F[0]+=.0466,F[1]-=.0123,_(e,F,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||v(n)&&2!==n.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=R){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>2===e.type?1:2===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>2===e.type?1:2===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return w(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,t,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=n(c.spatialReference),p=null!=t?t.mode:"absolute-height",d=f(t)/h,m=("on-the-ground"!==p?d+l:0)*h/u.unitInMeters,{camera:_}=c.state;if("absolute-height"===p){const t=u?.getAltitude(_.eye),r=o(s(E,e.direction),u.worldUpAtPosition(_.eye,V));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,E)){const e=g(c,E);return e.z??=0,e.z-=d,e}return null}const w=r(y.get())
|
|
5
|
+
import"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{createRenderScreenPointArray3 as t,castRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{getMetersPerVerticalUnitForSR as n}from"../../../../core/unitUtils.js";import{f as i,n as s,e as o}from"../../../../chunks/vec32.js";import{create as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as a,copy as c,negativeInfinity as u,width as h,height as p,expandPointInPlace as d}from"../../../../geometry/support/aaBoundingRect.js";import{create as m}from"../../../../geometry/support/ray.js";import{sv3d as y}from"../../../../geometry/support/vectorStacks.js";import{getElevationOffsetInMeters as f}from"../../../../support/elevationInfoUtils.js";import{computeMapPointFromVec3d as g}from"../../support/hitTest.js";import{fromRenderAtEye as _,fromScreen as w}from"../../support/geometryUtils/ray.js";import{defaultTolerance as R,Intersector as b}from"../../webgl-engine/lib/Intersector.js";import{isValidIntersectorResult as v}from"../../webgl-engine/lib/IntersectorResult.js";import{sliceFilterPredicate as I}from"../../webgl-engine/lib/intersectorUtils.js";import{HUDMaterial as P}from"../../webgl-engine/materials/HUDMaterial.js";class j{constructor(t,r,n){this.viewingMode=t,this._forEachLayer=r,this._view=n,this._externalIntersectionHandlers=new e,this._tolerance=R,this._tmpRay=m(),this._tmpRegion=a(),this._validateHUDIntersector=new b(this.viewingMode),this._validateHUDIntersector.options.hud=!1}destroy(){this._externalIntersectionHandlers.prune()}intersectScreen(e,t,r){return this.intersectRay(this._getPickRay(e,this._tmpRay),L(this.viewingMode),t,r)}intersectScreenFreePointFallback(e,t,r){return this.intersectRayFreePointFallback(this._getPickRay(e,this._tmpRay),t,r)}intersectRayFreePointFallback(e,t,r){return this.intersectRay(e,L(this.viewingMode),t,r)||this._intersectRayFreePointLocal(e,t)}intersectRay(e,t,r,n){return t.options.selectionMode=!1,t.options.store=0,this.computeIntersection(e,t,!1,n),!!t.results.min&&t.results.min.getIntersectionPoint(r)}getCenterRayWithSubpixelOffset(e,t,r=.5,n=.5){return e.getRenderCenter(F,r,n),F[0]+=.0466,F[1]-=.0123,_(e,F,t)}intersectIntersectorScreen(e,t,r){this.computeIntersection(this._getPickRay(e,this._tmpRay),t,!1,r)}intersectToolIntersectorScreen(e,t,r){const n=this._getPickRay(e,this._tmpRay);this.intersectToolIntersectorRay(n,t,r)}intersectToolIntersectorRay(e,t,r){t.options.selectionMode=!0,this.computeIntersection(e,t,!1,r);const n=t.results.min;!!this._view.basemapTerrain&&this._view.basemapTerrain.opaque||v(n)&&2!==n.intersector||(t.options.selectionMode=!1,this.computeIntersection(e,t,!1,r))}setTolerance(e=R){this._tolerance=e}addIntersectionHandler(e){this._externalIntersectionHandlers.push(e),this._externalIntersectionHandlers.sort((e,t)=>2===e.type?1:2===t.type?-1:0)}removeIntersectionHandler(e){null!=this._externalIntersectionHandlers.removeUnordered(e)&&this._externalIntersectionHandlers.sort((e,t)=>2===e.type?1:2===t.type?-1:0)}_getPickRay(e,t){const r=this._view.state.camera;return w(r,e,t)}_intersectRayFreePointLocal(e,t){return 2!==this.viewingMode||null==e||i(t,e.origin,s(y.get(),e.direction)),!1}intersectElevationFromScreen(e,t,r=0,n=null){return this._intersectElevation(this._getPickRay(e,this._tmpRay),t,r,n)}_intersectElevation(e,t,l=0,a=null){if(null==e)return null;const c=this._view,{renderCoordsHelper:u}=c,h=n(c.spatialReference),p=null!=t?t.mode:"absolute-height",d=f(t)/h,m=("on-the-ground"!==p?d+l:0)*h/u.unitInMeters,{camera:_}=c.state;if("absolute-height"===p){const t=u?.getAltitude(_.eye),r=o(s(E,e.direction),u.worldUpAtPosition(_.eye,V));if(t<m&&r<0||t>=m&&r>0)return null;if(u.intersectInfiniteManifold(e,m,E)){const e=g(c,E);return e.z??=0,e.z-=d,e}return null}const w=_.projectToRenderScreen(e.origin,r(y.get())),R=new k(null,this._forEachLayer),v=c.slice.plane,P=null!=v?I(v):null,j=new b(this.viewingMode);j.options.store=0,j.options.verticalOffset=m,j.options.normalRequired=!1;const U=e.origin,x=i(y.get(),U,e.direction);j.reset(U,x,_),j.point=w;let M=null;if(a&&"type"in a&&"graphics"===a.type){const e=c.allLayerViews.find(e=>e.layer===a)?.uid;M=e?t=>t.layerViewUid===e:null}else a&&(M=e=>e.graphicUid!==a.uid);switch(p){case"relative-to-scene":{const e=e=>(!M||M(e))&&!!e.lastValidElevationBB;j.intersect(R.layers,w,this._tolerance,null,e),this._externalIntersectionHandlers.forAll(e=>{if(4===e.type||2===e.type||8===e.type){const t=e.slicePlaneEnabled?P:null;e.intersect(j,t,j.rayBegin,j.rayEnd,w,!1)}});break}case"on-the-ground":case"relative-to-ground":this._externalIntersectionHandlers.forAll(e=>{if(e.isGround){const t=e.slicePlaneEnabled?P:null;e.intersect(j,t,j.rayBegin,j.rayEnd,w,!1)}})}if(j.results.min.getIntersectionPoint(E)){const e=g(c,E);return e.z=l,e}return null}computeIntersection(e,t,n,s){if(null==e)return;const o=this._view.state.camera,l=o.projectToRenderScreen(e.origin,r(y.get())),a=new k(s,this._forEachLayer);t.options.selectOpaqueTerrainOnly=!s||!("include"in s||"exclude"in s);const c=e.origin,u=i(y.get(),e.origin,e.direction);t.reset(c,u,o),t.intersect(a.layers,l,this._tolerance);const h=this._view.slice.plane,p=null!=h?I(h):null;t.intersect(a.sliceableLayers,l,this._tolerance,p);const d=s&&(s.requiresGroundFeedback||s.enableDraped);this._externalIntersectionHandlers.forAll(e=>{const r=e.layerViewUid,i=e.sublayerId,s=Array.isArray(r),o=s?r:[r];s&&(t.options.filteredLayerViewUids=[]);let h=!1;for(const n of o)a.filterLayerViewUid(n,i)?h=!0:s&&t.options.filteredLayerViewUids.push(n);if(t.options.isFiltered=!h,e.isGround&&d||!t.options.isFiltered){const r=e.slicePlaneEnabled?p:null;e.intersect(t,r,c,u,l,n)}});const m=y.get(),f=this._view.basemapTerrain;if(s&&s.enableDraped&&null!=f.spatialReference&&t.results.ground.getIntersectionPoint(m)){const e=f.overlayManager.renderer,r=this._view.renderCoordsHelper.spatialReference,n=y.get();this._view.renderCoordsHelper.fromRenderCoords(m,n,f.spatialReference),n[2]=this._view.elevationProvider?.getElevation(m[0],m[1],m[2],r,"ground")??0,e.intersect(t,n,t.results.ground,e=>a.filterRenderGeometry(e))}t.sortResults(),this._processHUDResults(t)}_processHUDResults(e){const t=e.results.hud;c(this._tmpRegion,u);const r=this._view.state.camera,n=[],i=this._tmpRegion,s=e=>{const t=new M(e),s=t.result.target.object.geometries.every(e=>e.material instanceof P&&e.material.parameters.occlusionTest);n.push({item:t,occlusionTest:s}),s&&(r.projectToRenderScreen(e.target.center,t.screenPoint),t.screenPoint[0]=Math.floor(t.screenPoint[0]),t.screenPoint[1]=Math.floor(t.screenPoint[1]),d(i,t.screenPoint))};e.sortResults(t.all),null!=t.min.distance&&s(t.min);for(const c of t.all)t.min.target.object!==c.target.object&&t.max.target.object!==c.target.object&&s(c);if(null!=t.max.distance&&t.max.target.object!==t.min.target.object&&s(t.max),!n.length)return;i[0]===i[2]&&(i[2]+=1),i[1]===i[3]&&(i[3]+=1);const o=r.fullWidth,l=r.fullHeight,a=Math.max(0,i[0]-U),m=Math.max(0,i[1]-U),y=Math.min(h(i)+2*U,o-a),f=Math.min(p(i)+2*U,l-m),g=y>0&&f>0?new Uint8Array(y*f*4):null;g&&this._view.stage.renderer.readHUDVisibility(a,m,y,f,g);let _=!0;const w=null==e.results.max.distance;let R=0;for(const{item:c,occlusionTest:u}of n){let t=!u;if(u&&g)for(const e of x){const r=4*(Math.min(c.screenPoint[0]+e[0],o)-i[0]+(Math.min(c.screenPoint[1]+e[1],l)-i[1])*y);if(r>=0&&r<g.length&&g[r]){t=!0;break}}t&&(_&&(e.results.min.copy(c.result),_=!1),w&&e.results.max.copy(c.result),2===e.options.store&&e.results.all.splice(R++,0,c.result))}}}const U=1,x=(()=>{const e=[],t=U;for(let r=-t;r<=t;r++)for(let n=-t;n<=t;n++)e.push([n+t,r+t]);return e})();class M{constructor(e){this.result=e,this.screenPoint=t()}}let H;function L(e){return H&&H.viewingMode===e||(H=new b(e)),H}class k{constructor(e,t){this.layers=new Array,this.sliceableLayers=new Array,this.include=e?.include,this.exclude=e?.exclude,t(e=>{e.pickable&&this.filterLayerViewUid(e.apiLayerViewUid)&&(e.sliceable?this.sliceableLayers:this.layers).push(e)})}filterLayerViewUid(e,t){const{include:r,exclude:n}=this;if(null==e)return null==r&&null==n;const i=r instanceof Map?r.get(e)??!1:r?.has(e),s=n instanceof Map?n.get(e)??!1:n?.has(e);return(null==i||("boolean"==typeof i?i:null!=t&&i.has(t)))&&(null==s||!("boolean"==typeof s?s:null!=t&&s.has(t)))}filterRenderGeometry(e){return this.filterLayerViewUid(e.layerViewUid)}}function T(e){return"object"==typeof e&&"intersect"in e}const E=l(),V=l(),F=t();export{j as SceneIntersectionHelper,T as isIntersectionHandler};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{ObjectResourceCache as e}from"../layers/graphics/ObjectResourceCache.js";import{StreamTextureCollection as r}from"./StreamTextureCollection.js";class t{constructor(t){this.streamDataRequester=null,this.cimSymbolRasterizer=null,this.streamDataRequester=t.resourceController.createStreamDataRequester(4),this.objectResourceCache=new e((e,r)=>t.resourceController.memoryController.newCache(e,r)),this.textures=new r(this.streamDataRequester,t.view.stage,t.resourceController.scheduler)}destroy(){this.textures.destroy(),this.streamDataRequester=null}}export{t as SharedSymbolResources};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import{destroyHandle as s}from"../../../core/handleUtils.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{
|
|
5
|
+
import{__decorate as o}from"tslib";import r from"../../../core/Accessor.js";import{destroyHandle as s}from"../../../core/handleUtils.js";import{property as e}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as t}from"../../../core/accessorSupport/decorators/subclass.js";import{a as p,d as i}from"../../../chunks/boundedPlane.js";import{PropertiesPool as c}from"../../support/PropertiesPool.js";let a=class extends r{constructor(){super(),this._propertiesPool=new c({plane:()=>p()},this),this.isDecoration=!0,this.addHandles(s(this._propertiesPool))}set plane(o){if(!o)return void this._set("plane",o);const r=this._propertiesPool.get("plane");i(o,r),this._set("plane",r)}};o([e()],a.prototype,"plane",null),o([e()],a.prototype,"isDecoration",void 0),a=o([t("esri.views.3d.support.ViewSlice")],a);export{a as ViewSlice};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as
|
|
5
|
+
import{set as t,dist as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{ONES as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as a}from"../../../../geometry/projection/projectors.js";import{newDoubleArray as i}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as l}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as u}from"../../../../geometry/support/HalfFloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{Attribute as c}from"../../webgl-engine/lib/Attribute.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";function p(t,e,r=null){const o=[],n=e.mapPositions;m(e,o);const a=o[0][1].data,i=o[0][1].indices.length,l=s(i);return h(e,o,l),y(e,o,l),g(e,o,l),b(e,o,l),D(e,o,l),w(e,o),j(e,o,l),F(e,o,a),new f(t,o,n,2,r)}function m(t,e){const{attributeData:{position:r},removeDuplicateStartEnd:o}=t,n=d(r)&&o,a=r.length/3-(n?1:0),i=new Array(2*(a-1)),l=n?r.slice(0,-3):r;let u=0;for(let s=0;s<a-1;s++)i[u++]=s,i[u++]=s+1;e.push(["position",new c(l,i,3,n)])}function h(t,e,r){if(null!=t.attributeData.colorFeature)return;const n=t.attributeData.color;e.push(["color",new c(n??o,r,4)])}function g(t,e,r){t.attributeData.normal&&e.push(["normal",new c(t.attributeData.normal,r,3)])}function b(t,e,r){null!=t.attributeData.colorFeature&&e.push(["colorFeatureAttribute",new c([t.attributeData.colorFeature],r,1,!0)])}function y(t,e,r){null==t.attributeData.sizeFeature&&e.push(["size",new c([t.attributeData.size??1],r,1,!0)])}function D(t,e,r){null!=t.attributeData.sizeFeature&&e.push(["sizeFeatureAttribute",new c([t.attributeData.sizeFeature],r,1,!0)])}function w(t,e){const{attributeData:{position:r,timeStamps:o}}=t;if(!o)return;const n=r.length/3,a=new Array(2*(n-1));let i=0;for(let l=0;l<n-1;l++)a[i++]=l,a[i++]=l+1;e.push(["timeStamps",new c(o,a,S,!0)])}function j(t,e,r){null!=t.attributeData.opacityFeature&&e.push(["opacityFeatureAttribute",new c([t.attributeData.opacityFeature],r,1,!0)])}function F(r,o,u){if(null==r.overlayInfo||1!==r.overlayInfo.renderCoordsHelper.viewingMode||!r.overlayInfo.spatialReference.isGeographic)return;const s=i(u.length),f=n(r.overlayInfo.spatialReference);for(let t=0;t<s.length;t+=3)a(u,t,s,t,f);const p=u.length/3,m=l(p+1);let h=v,g=A,b=0,y=0;t(h,s[y++],s[y++]),y++,m[0]=0;for(let n=1;n<p+1;++n)n===p&&(y=0),t(g,s[y++],s[y++]),y++,b+=e(h,g),m[n]=b,[h,g]=[g,h];o.push(["distanceToStart",new c(m,o[0][1].indices,1,!0)])}function d(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const v=r(),A=r(),S=4;function z(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach(t=>{const o=t.length,n=i(3*o);t.forEach((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]});const a={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(a)}),r}function E(t,e,r){if(null==t||0===t.length)return[];const o=z(t,e);return t.forEach((t,e)=>{const n=r?.[e],a=null!=n?x(n.timeStamps,n.streamlineType):void 0;o[e].attributeData.timeStamps=a}),o}function I(t,e=0,r=.01){const o=u(t.length);o[0]=0;for(let a=1;a<t.length;a++){const e=t[a-1],r=t[a],n=Math.sqrt((r[0]-e[0])**2+(r[1]-e[1])**2+(r[2]-e[2])**2);o[a]=o[a-1]+n}const n=o.map(t=>t*r);if(0!==e&&e<n.length){const t=n[e];for(let e=0;e<n.length;e++)n[e]-=t}return n}function x(t,e){const r=u(t.length*S),o=t[0],n=t[t.length-1];for(let a=0;a<t.length;a++)r[a*S]=t[a],r[a*S+1]=o,r[a*S+2]=n,r[a*S+3]=e;return r}export{E as animatedLineStripsToParameters,p as createGeometry,I as getLinearTimeStamps,z as lineStripsToParameters,S as numTimeStampValuesPerVertex,x as timeStampsToAttribute};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{createFlowFieldFromData as
|
|
5
|
+
import{__decorate as t}from"tslib";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{createFlowFieldFromData as s,traceFlowPaths as r}from"../../../2d/engine/flow/dataUtils.js";import{createFlowFieldFromDataTiled as i}from"./loadUtils.js";let o=class{constructor(){this._tileData=new Map}async generateStreamlines(t){const{flowData:e,simulationSettings:r,size:i}=t,o=l(s(r,e),r,i);return{result:{streamlines:o},transferList:o?.map(t=>t.vertices.buffer)}}async generateTiledStreamlines(t){const{simulationSettings:e,size:s,reset:r,flowDataTiles:o,extent:a,pixelSize:n}=t;this._updateTileData(o,r);const c=l(i(e,this._tileData,s,a,n),e,s);return{result:{streamlines:c},transferList:c?.map(t=>t.vertices.buffer)??[]}}_updateTileData(t,e){e&&this._tileData.forEach((e,s)=>{null==t.get(s)&&this._tileData.delete(s)}),t.forEach((t,e)=>{"delete"===t?this._tileData.delete(e):"on-worker"!==t&&this._tileData.set(e,t)})}};o=t([e("esri.views.3d.support.flow.FlowWorker")],o);const a=o;function l(t,e,s){if(null==t)return;const i=r(e,t,s[0],s[1],{positions:[]}),o=[];for(const{vertices:r,stage:a}of i){const t=new Float32Array(3*r.length);for(let e=0;e<r.length;e++)t[3*e]=r[e].x,t[3*e+1]=r[e].y,t[3*e+2]=r[e].t;o.push({vertices:t,stage:a})}return o}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import t from"../../../../Color.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newHalfFloatArray as
|
|
5
|
+
import t from"../../../../Color.js";import{fromValues as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newHalfFloatArray as r}from"../../../../geometry/support/HalfFloatArray.js";import{zValueInAbsoluteHeightMode as o}from"../../../../support/elevationInfoUtils.js";import{animatedLineStripsToParameters as n,createGeometry as i}from"../engineContent/line.js";import{drapedZ as s}from"../../terrain/OverlayRenderer.js";function l(t,e,{vertices:o,stage:l},a,c,p){const{spatialReference:u}=e.extent,h=[];for(let r=0;r<o.length;r+=3){const n=[o[r],o[r+1]],[i,l]=m(n,e),c=p?[i,l,s]:f(i,l,u,t,a);h.push(c)}const d=Math.floor(o.length/3),g=r(d);for(let r=0;r<d;r++)g[r]=o[3*r+2];const j=n([h],void 0,[{timeStamps:g,streamlineType:l}]);return i(c,j[0])}function a(e,r,o){if(null==e)return{};const n=t.toUnitRGBA(e.color);return n[3]*=r,{color:n,width:e.trailWidth,cap:2,animationSpeed:e.flowSpeed,trailLength:e.trailLength,animation:3,emissiveStrength:o}}function m([t,e],r){const{extent:o,size:[n,i]}=r;return[t/n*o.width+o.xmin,(i-e)/i*o.height+o.ymin]}function f(t,r,n,i,s){const{absoluteZ:l}=o(t,r,0,n,i,s),a=e(t,r,l);return i.renderCoordsHelper.toRenderCoords(a,n,a),a}export{l as createStreamlineGeometry,a as materialParametersFromRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{castRenderScreenPointArray3 as r,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{n as t,d as o,c as i,i as c}from"../../../../chunks/vec32.js";import{create as
|
|
5
|
+
import{castRenderScreenPointArray3 as r,screenPointObjectToArray as e}from"../../../../core/screenUtils.js";import{copy as n}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{n as t,d as o,c as i,i as c}from"../../../../chunks/vec32.js";import{create as u}from"../../../../geometry/support/ray.js";import{sv3d as s}from"../../../../geometry/support/vectorStacks.js";function l(r,n,o=u()){return m(r,e(n),o),t(o.direction,o.direction),o}function m(e,n,t){return g(e,e.screenToRender(n,r(s.get())),t)}function g(e,t,i){if(null==t)return null;const c=r(n(s.get(),t));if(c[2]=0,!e.unprojectFromRenderScreen(c,i.origin))return null;const u=r(n(s.get(),t));u[2]=1;const l=e.unprojectFromRenderScreen(u,s.get());return null==l?null:(o(i.direction,l,i.origin),i)}function p(e,n,t){return f(e,e.screenToRender(n,r(s.get())),t)}function f(r,e,n){i(n.origin,r.eye);const t=c(s.get(),e[0],e[1],1),u=r.unprojectFromRenderScreen(t,s.get());return null==u?null:(o(n.direction,u,n.origin),n)}export{g as fromRender,f as fromRenderAtEye,m as fromScreen,p as fromScreenAtEye,l as fromScreenNormalized};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,j as n,g as c,f as u,q as l,k as d}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PropertiesPool as y}from"../../../support/PropertiesPool.js";import{Yield as A}from"../../../support/Yield.js";let j=class extends g{constructor(t){super(t),this._propertiesPool=new y({location:()=>new f,renderLocation:()=>p()},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool
|
|
5
|
+
import{__decorate as t}from"tslib";import{clamp as e}from"../../../../core/mathUtils.js";import{removeMaybe as r,destroyMaybe as s}from"../../../../core/maybe.js";import{property as i}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{c as a,j as n,g as c,f as u,q as l,k as d}from"../../../../chunks/vec32.js";import{create as p}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../../geometry/ellipsoidUtils.js";import f from"../../../../geometry/Point.js";import{projectBoundingRect as m}from"../../../../geometry/projection/projectBoundingRect.js";import{create as _}from"../../../../geometry/support/aaBoundingRect.js";import{debugFlags as S}from"../debugFlags.js";import{PointOfInterest as g}from"./PointOfInterest.js";import{PropertiesPool as y}from"../../../support/PropertiesPool.js";import{Yield as A}from"../../../support/Yield.js";let j=class extends g{constructor(t){super(t),this._propertiesPool=new y({location:()=>new f,renderLocation:()=>p()},this),this._currentSurfaceAltitude=0,this._latestSurfaceAltitude=0,this.distance=0,this.renderLocation=p(),this.updating=!1}initialize(){this._frameWorker=this.scheduler.registerTask(this.task,this),this.runTask()}destroy(){this._frameWorker=r(this._frameWorker),this._propertiesPool=s(this._propertiesPool)}get _camera(){return this.state.contentCamera}get location(){const t=this._propertiesPool?.get("location");return t?(t.spatialReference=this.state.spatialReference,this.renderCoordsHelper.fromRenderCoords(this.renderLocation,t),t):new f}updateRenderLocation(){this.updating=!0,this._updateRenderLocation()}get estimatedSurfaceAltitude(){return this._latestSurfaceAltitude}get readyToRun(){return this.updating}runTask(){return this._latestSurfaceAltitude=this.estimateSurfaceAltitudeAtCenter(),this._updateRenderLocation(),this.updating=!1,A}_updateRenderLocation(){const t=R;let e=this._calculateSurfaceIntersection(this._currentSurfaceAltitude,t);const r=this._currentSurfaceAltitude!==this._latestSurfaceAltitude;!e&&r&&(e=this._calculateSurfaceIntersection(this._latestSurfaceAltitude,t),e&&(this._currentSurfaceAltitude=this._latestSurfaceAltitude));const s=C;e&&this._latestSurfaceAltitudeChangesDistanceSignificantly(t,s)&&(a(t,s),this._currentSurfaceAltitude=this._latestSurfaceAltitude),e?this.distance=n(this._camera.eye,t):(c(t,this._camera.viewForward,this._get("distance")),u(t,t,this._camera.eye)),l(this._get("renderLocation"),t)||this._set("renderLocation",a(this._propertiesPool.get("renderLocation"),t))}_calculateSurfaceIntersection(t,r){const s=this._camera;if(!this.renderCoordsHelper.intersectInfiniteManifold(s.ray,t,r))return!1;if(this.state.isGlobal){const e=h(this.renderCoordsHelper.spatialReference).radius,i=e+t,o=d(s.eye),a=o<i*i,l=n(s.eye,r);if(a&&l>e/4){const t=i-Math.sqrt(o);return c(r,s.viewForward,t),u(r,r,s.eye),!0}}else{const t=this.surface?.ready?this.surface.extent:null;null!=t&&m(t,this.surface?.spatialReference,v,this.renderCoordsHelper.spatialReference)&&(r[0]=e(r[0],v[0],v[2]),r[1]=e(r[1],v[1],v[3]))}return!0}_latestSurfaceAltitudeChangesDistanceSignificantly(t,e){if(this._latestSurfaceAltitude===this._currentSurfaceAltitude||null==t)return!1;if(this._calculateSurfaceIntersection(this._latestSurfaceAltitude,e)){if(S.TESTS_DISABLE_OPTIMIZATIONS)return!0;const r=this._camera.eye,s=n(r,t),i=n(r,e);if(Math.abs(i-s)/s>L)return!0}return!1}};t([i({constructOnly:!0})],j.prototype,"scheduler",void 0),t([i({constructOnly:!0})],j.prototype,"task",void 0),t([i()],j.prototype,"distance",void 0),t([i({constructOnly:!0})],j.prototype,"estimateSurfaceAltitudeAtCenter",void 0),t([i({readOnly:!0})],j.prototype,"location",null),t([i({readOnly:!0})],j.prototype,"renderLocation",void 0),t([i()],j.prototype,"updating",void 0),j=t([o("esri.views.3d.support.pointsOfInterest.CenterOnSurface")],j);const L=.05,R=p(),C=p(),v=_();export{j as CenterOnSurface};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as _,fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as T}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as v}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{IteratorPreorder as O,sortTiles as w,compareTiles as S}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as D,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{getOverlayContentForOutputTerrain as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as E,ConsumesDepth as j,ConsumesNone as F}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as q}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as A}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as k,MeshIntersectionOptions as M,intersectTriangles as N}from"../webgl-engine/lib/RayIntersections.js";import{getSettings as G}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{terrainId as z,getVerticalOffsetTerrain as U}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as V}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as H}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as W}from"../../webgl/enums.js";const Y=7,Q=10,Z=m();let J=class extends E{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a,o){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this._compressionTracker=a,this.type=2,this.isGround=!0,this._passParameters=new L,this._drawParameters=new I,this._renderDataPool=new s(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new O,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=1,this.produces=new Map([[1,()=>this._produces()&&0===this.transparency],[6,()=>this._produces()&&(1===this.transparency||2===this.transparency)],[9,()=>this._produces()&&this.renderOccludedFlags===T]]),this._tileSize=256,this._configuration=new H(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>o.newCache(e,t),"TileTexture"),this.tileGeometryCache=new v(o)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.renderOccludedFlags,e=>{this.renderOccludedFlags=e,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?j:F}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}get layerViewUid(){return z}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=Q-Y,i=Math.max(0,Math.floor((e.level-t)/Y)*Y);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=K,n=X;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=U(e.verticalOffset),f=e.tolerance;let p,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,x=T.normalRequired||!T.backfacesTerrain,v=new M(!1,x),R=d=>{const _=d.renderData;if(!_?.vao)return;const R=_.geometry;b(Z,R.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(Z));const O=Z;if($[0]=i[0]-P[0],$[1]=i[1]-P[1],$[2]=i[2]-P[2],!k(O,$,n,f,m))return;const w=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},S=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&w(l,n,d),T.isFiltered)return;2===T.store&&(null==p?(p=new A(e.ray),w(p,n,d),e.results.all.push(p)):n<p.distance&&w(p,n,d)),(null==a.distance||n<a.distance)&&w(a,n,d),0!==T.store&&(null==o.distance||n>o.distance)&&w(o,n,d)}},C=ee;c(C,r,P);const{indices:E,indexCount:j}=R,F=R.vertexAttributes,M=F.getField("position",y),G=new q(M.typedBuffer,3,F.stride/4),z=j/3;if(!g&&z>D){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(E,0,z,G)),e.intersectionData.intersectRay($,C,v,S)}else N($,C,0,z,E,G,g,v,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,m)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0);const r=e.bind.cutFillEnabled;if(this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),9===e.bind.slot){if(0===(e.renderOccludedMask&T))return null}else{const t=0===this.transparency?1:6;if(e.bind.slot!==t)return null}if(3===this.transparency)return null;const s=this._configuration;switch(s.screenSpaceReflections=s.cloudReflections=s.receiveShadows=s.receiveAmbientOcclusion=s.renderOccluded=s.hasHighlightMixTexture=!1,s.overlayMode=this._overlayRenderer.mode,e.output){case 0:case 1:{s.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,s.cloudReflections=null!=e.bind.clouds.data;const t=9===e.bind.slot;return s.receiveShadows=e.bind.shadowMap.ready&&!t,s.renderOccluded=t,s.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case 4:case 6:return this._castShadows?this._acquireTechnique(4):null;case 7:return this._inViewshed?this._acquireTechnique(7):null;case 8:return this._cutFillEnabled?this._acquireTechnique(8):null;case 2:case 3:return this._acquireTechnique(e.output);case 10:return this._acquireTechnique(10);case 9:return s.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(9):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=C(e.output,e.bind),e.output){case 0:case 1:this._renderMaterialPass(e,t);break;case 2:case 3:case 10:this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break;case 9:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 4:case 6:case 7:case 8:this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=g(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,0)),this._configuration.tileBlendInput=i.backgroundIsGrid?2:null!=i.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(e=>{this._drawParameters.origin=e[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<e.length;i++)this._renderPatch(r,t,e[i],W.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e;i.bindTechnique(t,r,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=r.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=G(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=9===r.slot;o&&(n.bindTexture("tex",i.emptyTexture),n.setUniform3fv("textureOpacities",u),n.setUniform4fv("texOffsetAndScale",p));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;1===this._configuration.tileBlendInput&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?W.LINES:W.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",i.emptyTexture);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const e=h[0].renderData.localOrigin;this._drawParameters.origin=e,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const e=r.renderData,s=e.textureReference;if(null!=s){if(!o){n.setUniform4fv("texOffsetAndScale",s.offsetAndScale),n.bindTexture("tex",s.texture.texture);const t=e.textureFadeFactor,i=t<1?e.nextTextureReference:null;this._configuration.textureFadingEnabled&&i&&t<1?(n.setUniform1f("fadeFactor",t),n.setUniform4fv("nextTexOffsetAndScale",i.offsetAndScale),n.setUniform3fv("nextTexOpacities",i.opacities),n.bindTexture("texNext",i.texture.texture)):n.setUniform1f("fadeFactor",1),e.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",s.opacities)}this._renderPatch(i,t,r,c,a),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(V,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],J.prototype,"visibleTiles",null),e([o({readOnly:!0})],J.prototype,"_isGlobal",null),e([o()],J.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],J.prototype,"renderingDisabled",null),e([o({value:!0})],J.prototype,"visible",null),e([o()],J.prototype,"renderPatchBorders",null),e([o()],J.prototype,"visualizeNormals",null),e([o()],J.prototype,"cullBackFaces",null),e([o()],J.prototype,"wireframe",null),J=e([l("esri.views.3d.terrain.TerrainRenderer")],J);const K=_(),X=_(),$=_(),ee=_();export{J as TerrainRenderer};
|
|
5
|
+
import{__decorate as e}from"tslib";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{d as c,i as d,e as h}from"../../../chunks/vec32.js";import{ZEROS as u,create as _,fromValues as g}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as f,ZEROS as p}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as y}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as b}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as T}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as v}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as O}from"./TileRenderer.js";import{IteratorPreorder as P,sortTiles as w,compareTiles as D}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as S,ComponentIntersectionData as B}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{getOverlayContentForOutputTerrain as C}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as E,ConsumesDepth as j,ConsumesNone as F}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as q}from"../webgl-engine/lib/Attribute.js";import{IntersectorResult as A}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as k,MeshIntersectionOptions as M,intersectTriangles as N}from"../webgl-engine/lib/RayIntersections.js";import{terrainId as G,getVerticalOffsetTerrain as U}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as z}from"../webgl-engine/materials/DrawParameters.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as I}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as V}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as H}from"../../webgl/enums.js";const W=7,Q=10,Z=m();let J=class extends E{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._compressionTracker=n,this.type=2,this.isGround=!0,this._passParameters=new L,this._drawParameters=new z,this._renderDataPool=new s(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=1,this.produces=new Map([[1,()=>this._produces()&&0===this.transparency],[6,()=>this._produces()&&(1===this.transparency||2===this.transparency)],[9,()=>this._produces()&&this.renderOccludedFlags===T]]),this._tileSize=256,this._configuration=new V(1===t.viewingMode),this._tileTextureCache=new r((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new v(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n(()=>this._overlayRenderer.renderOccludedFlags,e=>{this.renderOccludedFlags=e,this.setNeedsRender()},a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?j:F}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}get layerViewUid(){return G}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const t=e.parent;if(!t)return!1;const i=f(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=Q-W,i=Math.max(0,Math.floor((e.level-t)/W)*W);if(this._isGlobal&&0===i)return u;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new O(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=K,n=X;c(s,r,i),d(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=U(e.verticalOffset),f=e.tolerance;let p,m=u&&null!=a.distance?a.distance:1/0;const T=e.options,x=T.normalRequired||!T.backfacesTerrain,v=new M(!1,x),R=d=>{const _=d.renderData;if(!_?.vao)return;const R=_.geometry;y(Z,R.boundingBox);const O=_.localOrigin;null!=g&&(g.localOrigin=O,g.applyToAabb(Z));const P=Z;if(Y[0]=i[0]-O[0],Y[1]=i[1]-O[1],Y[2]=i[2]-O[2],!k(P,Y,n,f,m))return;const w=(e,t,i)=>{e.set(this.type,d,t,i),m=u&&null!=a.distance?a.distance:1/0},D=(n,c,d)=>{if((!x||null!=d)&&n>=0&&(T.backfacesTerrain||h(d,s)<0)&&(T.invisibleTerrain||!T.selectionMode||null==t||t(i,r,n))){if((null==l.distance||n<l.distance)&&w(l,n,d),T.isFiltered)return;2===T.store&&(null==p?(p=new A(e.ray),w(p,n,d),e.results.all.push(p)):n<p.distance&&w(p,n,d)),(null==a.distance||n<a.distance)&&w(a,n,d),0!==T.store&&(null==o.distance||n>o.distance)&&w(o,n,d)}},C=$;c(C,r,O);const{indices:E,indexCount:j}=R,F=R.vertexAttributes,M=F.getField("position",b),G=new q(M.typedBuffer,3,F.stride/4),U=j/3;if(!g&&U>S){const e=d.renderData;null==e.intersectionData&&(e.intersectionData=new B(E,0,U,G)),e.intersectionData.intersectRay(Y,C,v,D)}else N(Y,C,0,U,E,G,g,v,D)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,m)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}acquireTechniques(e){const t=!!has("enable-feature:terrain-shadows")&&e.bind.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bind.viewshedEnabled;this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0);const r=e.bind.cutFillEnabled;if(this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),9===e.bind.slot){if(0===(e.renderOccludedMask&T))return null}else{const t=0===this.transparency?1:6;if(e.bind.slot!==t)return null}if(3===this.transparency)return null;const s=this._configuration;switch(s.screenSpaceReflections=s.cloudReflections=s.receiveShadows=s.receiveAmbientOcclusion=s.renderOccluded=s.hasHighlightMixTexture=!1,s.overlayMode=this._overlayRenderer.mode,e.output){case 0:case 1:{s.screenSpaceReflections=null!=e.bind.ssr.lastFrameColor,s.cloudReflections=null!=e.bind.clouds.data;const t=9===e.bind.slot;return s.receiveShadows=e.bind.shadowMap.ready&&!t,s.renderOccluded=t,s.receiveAmbientOcclusion=!t&&null!=e.bind.ssao,this._acquireTechnique(e.output)}case 4:case 6:return this._castShadows?this._acquireTechnique(4):null;case 7:return this._inViewshed?this._acquireTechnique(7):null;case 8:return this._cutFillEnabled?this._acquireTechnique(8):null;case 2:case 3:return this._acquireTechnique(e.output);case 10:return this._acquireTechnique(10);case 9:return s.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(9):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,this._passParameters.overlayContent=C(e.output,e.bind),e.output){case 0:case 1:this._renderMaterialPass(e,t);break;case 2:case 3:case 10:this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break;case 9:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 4:case 6:case 7:case 8:this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=g(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll(e=>i.updateTileTexture(e,0)),this._configuration.tileBlendInput=i.backgroundIsGrid?2:null!=i.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)w(i,t);e.sort((e,t)=>D(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(e=>{this._drawParameters.origin=e[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let i=0;i<e.length;i++)this._renderPatch(r,t,e[i],H.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e;i.bindTechnique(t,r,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=t.program,n=this._stencilEnabledLayerExtents.length>0,a=9===r.slot;a&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",u),s.setUniform4fv("texOffsetAndScale",p));const o=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:u;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",o);const l=this.wireframe?H.LINES:H.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const d of c.values()){const e=d[0].renderData.localOrigin;this._drawParameters.origin=e,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of d){const e=r.renderData,o=e.textureReference;if(null!=o){if(!a){s.setUniform4fv("texOffsetAndScale",o.offsetAndScale),s.bindTexture("tex",o.texture.texture);const t=e.textureFadeFactor,i=t<1?e.nextTextureReference:null;this._configuration.textureFadingEnabled&&i&&t<1?(s.setUniform1f("fadeFactor",t),s.setUniform4fv("nextTexOffsetAndScale",i.offsetAndScale),s.setUniform3fv("nextTexOpacities",i.opacities),s.bindTexture("texNext",i.texture.texture)):s.setUniform1f("fadeFactor",1),e.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",o.opacities)}this._renderPatch(i,t,r,l,n),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(I,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([o({readOnly:!0})],J.prototype,"visibleTiles",null),e([o({readOnly:!0})],J.prototype,"_isGlobal",null),e([o()],J.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],J.prototype,"renderingDisabled",null),e([o({value:!0})],J.prototype,"visible",null),e([o()],J.prototype,"renderPatchBorders",null),e([o()],J.prototype,"visualizeNormals",null),e([o()],J.prototype,"cullBackFaces",null),e([o()],J.prototype,"wireframe",null),J=e([l("esri.views.3d.terrain.TerrainRenderer")],J);const K=_(),X=_(),Y=_(),$=_();export{J as TerrainRenderer};
|