@arcgis/core 5.2.0-next.25 → 5.2.0-next.27
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/0098544169e429dd98d2.js +1 -0
- package/assets/esri/core/workers/chunks/{b419fd36337e76e2d4a3.js → 045f178fecc23839bfa8.js} +2 -2
- package/assets/esri/core/workers/chunks/0d3c9112ae07fa4a97d6.js +1 -0
- package/assets/esri/core/workers/chunks/{75df436e6e9773bdcfc2.js → 11f47a012dd8881e3d55.js} +18 -18
- package/assets/esri/core/workers/chunks/1849f72f23b434e6c78d.js +1 -0
- package/assets/esri/core/workers/chunks/{8ba3e0462a9bdaae5f40.js → 25fd4d5d3af887536b3b.js} +1 -1
- package/assets/esri/core/workers/chunks/{a8310f55de4749f973d0.js → 35c87b0a4d4ee7ce302d.js} +1 -1
- package/assets/esri/core/workers/chunks/47d88e1b003c4519b7b6.js +1 -0
- package/assets/esri/core/workers/chunks/4e16d7fa2e6f11d082b5.js +261 -0
- package/assets/esri/core/workers/chunks/5260f623438bd84f2caa.js +1 -0
- package/assets/esri/core/workers/chunks/5396a894e6f8030ca088.js +1 -0
- package/assets/esri/core/workers/chunks/{30298f84bd414f9dea64.js → 5728d8440aca205e4f53.js} +1 -1
- package/assets/esri/core/workers/chunks/{c9ce408675dae6a0edd1.js → 76ed8e455f6bd79e561c.js} +1 -1
- package/assets/esri/core/workers/chunks/8980767c5b626e4dc3b9.js +1 -0
- package/assets/esri/core/workers/chunks/{502464c4eab7667f6566.js → 937e347d130d469518ce.js} +1 -1
- package/assets/esri/core/workers/chunks/9508fa53da5f92a0ab70.js +30 -0
- package/assets/esri/core/workers/chunks/9dcb2cbf89dcb7558432.js +1 -0
- package/assets/esri/core/workers/chunks/a9d477f90e5046400dd5.js +1 -0
- package/assets/esri/core/workers/chunks/b87aca8ad281870ae970.js +1 -0
- package/assets/esri/core/workers/chunks/{790462ab5f21491a4f75.js → c193b4a175a544c4fcd6.js} +1 -1
- package/assets/esri/core/workers/chunks/c8b7ffc5cb3f1493129e.js +1 -0
- package/assets/esri/core/workers/chunks/{2d6d01913096f7cb5ff8.js → d25c37f169577a33db46.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dec8c453fdee1968d12.js → db279d5d9c7deec554bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{d41eed41916ed0422059.js → de0c94defb90e1805081.js} +1 -1
- package/assets/esri/core/workers/chunks/{7dbaa089c7472825b80c.js → e38d1ba15babc238b151.js} +1 -1
- package/assets/esri/core/workers/chunks/{a533d066cac26124c5ce.js → e84c13ac59e5381b77e2.js} +1 -1
- package/assets/esri/core/workers/chunks/ef5d11581a98fb333ad2.js +1 -0
- package/assets/esri/core/workers/chunks/{353c67da4b25c29360db.js → f5125925f83c979edde7.js} +2 -2
- package/assets/esri/core/workers/chunks/f912c173c58ae4299cbe.js +1 -0
- package/assets/esri/themes/base/colors/scss/variables.scss +131 -131
- package/assets/esri/themes/base/colors/scss/variables_dark.scss +131 -133
- package/assets/esri/themes/base/icons/style.scss +4 -5
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/layers/Lyr3DWasmPerSceneView.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/video/VideoController.js +1 -1
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/2d/engine/webgl/shaders/sources/shaderRepository.js +1 -1
- package/views/3d/layers/I3SMeshView3D.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/layers/graphics/DrivenProperties.js +2 -0
- package/views/3d/layers/graphics/Graphics3DObjectSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/Graphics3DSymbolLayer.js +1 -1
- package/views/3d/layers/i3s/I3SIntersectionHandler.js +1 -1
- package/views/3d/layers/i3s/LayerElevationProvider.js +1 -1
- package/views/3d/layers/i3s/PointCloudRenderer.js +1 -1
- package/views/3d/layers/support/Tiles3DMeshIntersectionHandler.js +1 -1
- package/views/3d/state/helpers/SceneIntersectionHelper.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatIntersectionHandler.js +1 -1
- package/views/3d/terrain/OverlayRenderer.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectCollection.js +1 -1
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorInterfaces.js +1 -1
- package/views/3d/webgl-engine/lib/IntersectorResult.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/lib/PolygonIntersectionResults.js +2 -0
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SortedRenderGeometryRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodResources.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonIntersectionUtils.js +2 -0
- 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/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/TriangleMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/IndexLayout.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedBuffer.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/assets/esri/core/workers/chunks/10112bf4b385f1955a3d.js +0 -1
- package/assets/esri/core/workers/chunks/15fd30908d5db7f7136e.js +0 -261
- package/assets/esri/core/workers/chunks/1b5001bdfeecf78c33ce.js +0 -1
- package/assets/esri/core/workers/chunks/1d2609ce6220b5af5526.js +0 -1
- package/assets/esri/core/workers/chunks/2e7b83c8ba78cb06d611.js +0 -1
- package/assets/esri/core/workers/chunks/3529afab0c2444275d91.js +0 -1
- package/assets/esri/core/workers/chunks/3b4fc67f6cb7393fbd97.js +0 -1
- package/assets/esri/core/workers/chunks/5b654e0dc901a7f06a9f.js +0 -1
- package/assets/esri/core/workers/chunks/7e23de8d9b2d938808f6.js +0 -1
- package/assets/esri/core/workers/chunks/856cf872d29eeaf11a71.js +0 -1
- package/assets/esri/core/workers/chunks/8f25d91ea7b99597124e.js +0 -1
- package/assets/esri/core/workers/chunks/9434c76ad39c936dba90.js +0 -1
- package/assets/esri/core/workers/chunks/affc972757798b6db002.js +0 -1
- package/assets/esri/core/workers/chunks/b91a15522692781560b4.js +0 -30
- package/assets/esri/core/workers/chunks/f2a268c69f2a5566381b.js +0 -1
- /package/assets/esri/core/workers/chunks/{353c67da4b25c29360db.js.LICENSE.txt → f5125925f83c979edde7.js.LICENSE.txt} +0 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as h}from"../../terrain/Intersector.js";import{ChangeSet as c,RenderGeometryUpdate as l}from"./ChangeSet.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{RendererBase as u}from"./RendererBase.js";import{noBudget as g}from"../../../support/Scheduler.js";let m=class extends u{constructor(e){super(e),this._pending=new y,this._changes=new c,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,g,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new l;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere.center[0]-n.boundingSphere.radius<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere.center[0]+n.boundingSphere.radius>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.
|
|
2
|
+
import{__decorate as e}from"tslib";import{addMany as r,filterInPlace as t}from"../../../../core/arrayUtils.js";import"../../../../core/has.js";import{someMap as s,everyMap as i}from"../../../../core/MapUtils.js";import n from"../../../../core/PooledArray.js";import{property as o,subclass as d}from"../../../../core/accessorSupport/decorators.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{OverlayTarget as h}from"../../terrain/Intersector.js";import{ChangeSet as c,RenderGeometryUpdate as l}from"./ChangeSet.js";import{IntersectorResult as p}from"./IntersectorResult.js";import{RendererBase as u}from"./RendererBase.js";import{noBudget as g}from"../../../support/Scheduler.js";let m=class extends u{constructor(e){super(e),this._pending=new y,this._changes=new c,this._sortedRenderers=new n,this._geometries=new Map,this._hasHighlights=!1,this._hasWater=!1}destroy(){this.destroyed||(this._changes.prune(),this._sortedRenderers.prune(),this._geometries.clear(),this._pending.clear())}get updating(){return!this._pending.empty||this._changes.updates.length>0}get rctx(){return this.rendererContext.rctx}get _localOriginFactory(){return this.rendererContext.localOriginFactory}get hasHighlights(){return this._hasHighlights}hasHighlight(e){return s(this.renderers,r=>r.hasHighlight(e))}get hasWater(){return this._hasWater}get hasOccluders(){return this.renderers&&s(this.renderers,e=>e.hasOnlyOccluders)}get hasOnlyOccluders(){return i(this.renderers,e=>e.hasOnlyOccluders)}get isEmpty(){return!this.updating&&0===this.renderers.size&&0===this._geometries.size}get sortedRenderers(){return this._sortedRenderers}commitChanges(){return!!this.updating&&(this._processAddsRemoves(),this.commit(this._changes,g,this.rendererContext.pluginContext)&&(this._updateSortedMaterialRenderers(),this._hasHighlights=s(this.renderers,e=>{const r=e.produces.get(18);return!!r&&r(10)}),this._hasWater=s(this.renderers,e=>{const r=e.produces.get(19);return!!r&&r(4)})),this.notifyChange("updating"),!0)}addRenderer(){this._sortedRenderers.clear()}removeRenderer(){this._sortedRenderers.clear()}addGeometries(e,r){if(0===e.length)return;const t=this._validateRenderGeometries(e);for(const i of t)this._geometries.set(i.id,i);const s=this._pending.empty;for(const i of t)this._pending.adds.add(i);switch(s&&this.notifyChange("updating"),r){case 0:this._notifyGraphicVisibilityChanged(e);break;case 1:this._notifyGraphicGeometryChanged(e)}}removeGeometries(e,r){if(this.destroyed)return;const t=this._pending.empty,s=this._pending.adds;for(const i of e)s.has(i)?(this._pending.removed.add(i),s.delete(i)):this._pending.removed.has(i)||this._pending.removes.add(i),this._geometries.delete(i.id);t&&!this._pending.empty&&this.notifyChange("updating"),1===r&&this._notifyGraphicGeometryChanged(e)}modifyGeometries(e,r){const t=0===this._changes.updates.length;for(const s of e){const e=new l;this._changes.updates.push(e),e.renderGeometry=this._ensureValidRenderGeometry(s),e.updateType=r}switch(t&&this._changes.updates.length>0&&this.notifyChange("updating"),r){case 4:case 2:return this._notifyGraphicGeometryChanged(e);case 1:return this._notifyGraphicVisibilityChanged(e)}}updateAnimation(e){let r=!1;return this._sortedRenderers.forAll(t=>r=!!t.updateAnimation&&t.updateAnimation(e)||r),r}precompile(e){return this._sortedRenderers.reduce((r,t)=>t.precompile(e)||r,!1)}render(e){this._sortedRenderers.forAll(r=>{const t=r.acquireTechniques(e);t&&r.render(e,t)})}intersect(e,r,t,s,i){for(const n of this._geometries.values()){if(!s(n))continue;this._intersectRenderGeometry(n,t,r,0,e,i);const o=this.rendererContext.longitudeCyclical;o&&(n.boundingSphere.center[0]-n.boundingSphere.radius<o.min&&this._intersectRenderGeometry(n,t,r,o.range,e,i),n.boundingSphere.center[0]+n.boundingSphere.radius>o.max&&this._intersectRenderGeometry(n,t,r,-o.range,e,i)),i++}return i}_updateSortedMaterialRenderers(){if(!(this._sortedRenderers.length>0)){for(const e of this.renderers.values())this._sortedRenderers.push(e);this._sortedRenderers.sort((e,r)=>r.material?.renderPriority===e.material?.renderPriority?e.drapedPriority-r.drapedPriority:(r.material?.renderPriority||0)-(e.material?.renderPriority||0))}}_processAddsRemoves(){this._changes.adds.length=0,this._changes.removes.length=0,r(this._changes.adds,Array.from(this._pending.adds)),r(this._changes.removes,Array.from(this._pending.removes)),t(this._changes.updates,({renderGeometry:e})=>!this._pending.has(e)),this._pending.clear()}_intersectRenderGeometry(e,r,t,s,i,n){if(!e.visible||!e.material.visible||!e.material.intersectRayDraped)return;let o=0;s+=e.transformation[12],o=e.transformation[13],f[0]=t[0]-s,f[1]=t[1]-o,e.screenToWorldRatio=this.rendererContext.screenToWorldRatio,e.material.intersectRayDraped(e,i,f,(t,s,o)=>{_(r,o,n,e.material.renderPriority,i,e.layerViewUid,e.graphicUid)},r)}_notifyGraphicGeometryChanged(e){if(null==this.drapeSource.notifyGraphicGeometryChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicGeometryChanged(t),r=t)}_notifyGraphicVisibilityChanged(e){if(null==this.drapeSource.notifyGraphicVisibilityChanged)return;let r;for(const{graphicUid:t}of e)null!=t&&t!==r&&(this.drapeSource.notifyGraphicVisibilityChanged(t),r=t)}_validateRenderGeometries(e){for(const r of e)this._ensureValidRenderGeometry(r);return e}_ensureValidRenderGeometry(e){return null==e.localOrigin&&(e.localOrigin=this._localOriginFactory.getOrigin(e.boundingSphere.center)),e}get test(){}};e([o({constructOnly:!0})],m.prototype,"drapeSource",void 0),e([o({constructOnly:!0})],m.prototype,"rendererContext",void 0),e([o()],m.prototype,"updating",null),e([o()],m.prototype,"rctx",null),e([o()],m.prototype,"_localOriginFactory",null),e([o({readOnly:!0})],m.prototype,"isEmpty",null),e([o()],m.prototype,"_geometries",void 0),m=e([d("esri.views.3d.webgl-engine.lib.SortedRenderGeometryRenderer")],m);class y{constructor(){this.adds=new Set,this.removes=new Set,this.removed=new Set}get empty(){return 0===this.adds.size&&0===this.removes.size&&0===this.removed.size}has(e){return this.adds.has(e)||this.removes.has(e)||this.removed.has(e)}clear(){this.adds.clear(),this.removes.clear(),this.removed.clear()}}function _(e,r,t,s,i,n,o){const d=new h(n,o,r),a=r=>{r.set(5,d,e.distance,e.normal,e.transformation,t,s)};if((null==i.results.min.drapedLayerOrder||t>=i.results.min.drapedLayerOrder)&&(null==i.results.min.distance||i.results.ground.distance<=i.results.min.distance)&&a(i.results.min),0!==i.options.store&&(null==i.results.max.drapedLayerOrder||t<i.results.max.drapedLayerOrder)&&(null==i.results.max.distance||i.results.ground.distance>i.results.max.distance)&&a(i.results.max),2===i.options.store){const e=new p(i.ray);a(e),i.results.all.push(e)}}const f=a();export{m as SortedRenderGeometryRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as s,getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as O}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as A}from"../../../../support/HighlightDefaults.js";import{TaskPriority as M,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as B}from"../../../../webgl/Util.js";import{fromLayout as F}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new S(t,r)};let H=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(M.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==A&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const s=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,n=e.triangleCount;t.push({renderedInstances:s,renderedTriangles:s*n,trianglesPerInstance:n})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const s=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,r))),n=s.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||n.length!==s.length){n.forEach(e=>e.destroy()),o(r);for(const e of s)if("rejected"===e.status)throw e.reason}this._levels=n,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return s(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(A))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,s=this.levels;return t.forEach(t=>s.forEach(({components:s},n)=>s.forEach(s=>r.push(this._beginComponent(e,t[n],s))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let s=0;const n=this.levels;r.forEach(r=>n.forEach(({components:n},a)=>n.forEach(n=>this._renderComponent(e,t[s++],r[a],n,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,s=10===t,n=6===t,a=7!==t;if(!s&&!n)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(s){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(A);return n?e?[e]:null:Array.from(i.values())}return null}intersect(e,t,r,s){if(!this.baseMaterial.visible||null==this._octree)return;const n=f();d(n,s,r);const a=n=>{this._instanceData.getCombinedModelTransform(n,W),e.transform.set(W),m(k,r,e.transform.inverse),m(Y,s,e.transform.inverse);const a=this._instanceData.getState(n),i=this._instanceData.getLodLevel(n),o=this._levels.length;4&a&&(R(!!(18&a),"invalid instance state"),R(i>=0&&i<o,"invaid lod level"),this._levels[i].intersect(e,t,k,Y,n,this.metadata,o))};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,n,a)}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),s=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==s)return new D;const n=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,G),d(G,G,n);const i=u(G,t)-G[3];a.boundingSphere.getVec(s,G),d(G,G,n);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:s,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),s)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const s=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=n(u,t,s);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);P(a[e],o,h)}f|=16}else P(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const s=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return s?.beginSlot(e.bind)}_renderComponent(e,t,r,s,n){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,s.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(s.vao,F(l)),i.bindVAO(s.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(n,Z.length-1)]),o.setUniform1i("symbolColorMixMode",U.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,n)=>{B(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,s.numVertices,n-e)};s.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function P(e,t,r){const s=e.allocateHead();z(t,r,e.view,s)}function z(e,t,r,s){O(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,s),r.model.copyFrom(s,e.model,t),r.modelNormal.copyFrom(s,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(s,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(s,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(s,e.featureAttribute,t)}e([l({constructOnly:!0})],H.prototype,"symbol",void 0),e([l({constructOnly:!0})],H.prototype,"metadata",void 0),e([l({constructOnly:!0})],H.prototype,"shaderTransformation",void 0),e([l()],H.prototype,"_instanceData",void 0),e([l()],H.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],H.prototype,"_enableLevelSelection",null),e([l()],H.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],H.prototype,"readyToRun",null),H=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],H);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{H as LodRenderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../../core/arrayUtils.js";import r from"../../../../../core/Error.js";import{someMap as n,getOrCreateMapValue as s}from"../../../../../core/MapUtils.js";import{destroyMaybe as a}from"../../../../../core/maybe.js";import{isAborted as i,throwIfAborted as o}from"../../../../../core/promiseUtils.js";import{property as l,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{create as h}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{subtract as d,dot as u,transformMat4 as m}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as _,freeze as p}from"../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{debugFlags as g}from"../../../support/debugFlags.js";import{glLayout as y}from"../../../support/buffer/glUtil.js";import v from"../../../webgl/RenderCamera.js";import{isColor as b}from"../../core/shaderLibrary/ShaderOutput.js";import{AsyncRenderPlugin as I}from"../../effects/RenderPlugin.js";import{getEmissions as C}from"../../effects/emissive/emissions.js";import{DepthRange as D}from"../DepthRange.js";import{assert as R}from"../Util.js";import{InstanceData as E}from"./InstanceData.js";import{InstanceOctree as x}from"./InstanceOctree.js";import{LevelSelector as S}from"./LevelSelector.js";import{LodLevel as w}from"./LodLevel.js";import{getRenderInstanceDataLayout as L,RenderInstanceData as j}from"./RenderInstanceData.js";import{colorMixModes as U}from"../../materials/internal/MaterialUtil.js";import{encodeDoubleVec3 as O}from"../../materials/renderers/utils.js";import{DefaultMaterialDrawParameters as T}from"../../shaders/DefaultMaterialTechnique.js";import{defaultHighlightName as A}from"../../../../support/HighlightDefaults.js";import{TaskPriority as M,noBudget as q}from"../../../../support/Scheduler.js";import{bindVertexBufferLayout as B}from"../../../../webgl/Util.js";import{fromLayout as F}from"../../../../webgl/VertexAttributeLocations.js";const V=e=>{const t=e.baseBoundingSphere.radius,r=e.levels.map(e=>e.minScreenSpaceRadius);return new S(t,r)};let H=class extends I{constructor(e,t){super(e),this.type=3,this.isGround=!1,this._levels=[],this._defaultRenderInstanceData=new Array,this._highlightRenderInstanceDatas=new Map,this._instanceIndex=0,this._cycleStartIndex=0,this._slicePlane=!1,this._camera=new v,this._updateCyclesWithStaticCamera=-1,this._needFullCycle=!1,this.produces=new Map([[2,e=>this._produces(e)],[4,e=>!!this._hasTransparentLevels()&&this._produces(e)]]),this._instanceData=new E({shaderTransformation:e.shaderTransformation},e.symbol.materialParameters),this.addHandles(t.registerTask(M.LOD_RENDERER,this))}initialize(){this._instanceBufferLayout=L(this.symbol.materialParameters),this._glInstanceBufferLayout=y(this._instanceBufferLayout,1),this.addHandles([this._instanceData.events.on("instances-changed",()=>this._requestUpdateCycle()),this._instanceData.events.on("instance-transform-changed",({index:e})=>{this._requestUpdateCycle(),this.metadata.notifyGraphicGeometryChanged(e)}),this._instanceData.events.on("instance-visibility-changed",({index:e})=>{this._requestUpdateCycle(!0),this.metadata.notifyGraphicVisibilityChanged(e)}),this._instanceData.events.on("instance-highlight-changed",()=>this._requestUpdateCycle(!0))])}get _allRenderInstanceData(){return[this._defaultRenderInstanceData,...this._highlightRenderInstanceDatas.values()]}get _allRenderInstanceDataExceptHighlightShadow(){const e=[this._defaultRenderInstanceData];for(const t of this._highlightRenderInstanceDatas)t[0]!==A&&e.push(t[1]);return e}hasHighlight(e){return this._highlightRenderInstanceDatas.has(e)}get _enableLevelSelection(){return this.symbol.levels.length>1}get levels(){return this._levels}get baseBoundingBox(){return this._levels[this._levels.length-1].boundingBox}get baseBoundingSphere(){return this._levels[this._levels.length-1].boundingSphere}get baseMaterial(){return this._levels[this._levels.length-1].components[0].material}get slicePlaneEnabled(){return this._slicePlane}set slicePlaneEnabled(e){this._slicePlane=e}get layerViewUid(){return this.metadata.layerViewUid}get instanceData(){return this._instanceData}get emissions(){return C(this._levels)}get usedMemory(){return this._allRenderInstanceData.reduce((e,t)=>t.reduce((e,t)=>e+t.usedMemory,e),this._levels.reduce((e,t)=>e+t.components.reduce((e,t)=>e+t.usedMemory,0),0))}get renderStats(){const e=this._instanceData.size,t=[];return this._levels.forEach((e,r)=>{const n=this._allRenderInstanceData[0][r].size+this._allRenderInstanceData[1][r].size,s=e.triangleCount;t.push({renderedInstances:n,renderedTriangles:n*s,trianglesPerInstance:s})}),{totalInstances:e,renderedInstances:t.reduce((e,t)=>e+t.renderedInstances,0),renderedTriangles:t.reduce((e,t)=>e+t.renderedTriangles,0),levels:t}}_createRenderInstanceDataArray(){const{rctx:e}=this._context.renderContext;return this.symbol.levels.map(t=>new j(e,this._instanceBufferLayout))}async initializeRenderContext(e,r){this._context=e,this._defaultRenderInstanceData=this._createRenderInstanceDataArray();const n=await Promise.allSettled(this.symbol.levels.map(t=>w.create(e,t,r))),s=n.map(e=>"fulfilled"===e.status?e.value:null).filter(t);if(i(r)||s.length!==n.length){s.forEach(e=>e.destroy()),o(r);for(const e of n)if("rejected"===e.status)throw e.reason}this._levels=s,this._levelSelector=V(this)}uninitializeRenderContext(){this._invalidateOctree(),this._levels.forEach(e=>e.destroy()),this._defaultRenderInstanceData.forEach(e=>e.destroy()),this._highlightRenderInstanceDatas.forEach(e=>e.forEach(e=>e.destroy()))}_hasTransparentLevels(){return this._levels.some(e=>e.components.some(e=>{const t=e.material.produces.get(4);return t?.(0)}))}hasHighlights(){return n(this._highlightRenderInstanceDatas,e=>e.some(e=>e.size>0))}_produces(e){return(10!==e||this.hasHighlights())&&(6!==e||this.hasHighlight(A))}prepareRender(e){if(!g.LOD_INSTANCE_RENDERER_DISABLE_UPDATES){if(this._enableLevelSelection){const t=e.bind.contentCamera.equals(this._camera);this._camera.copyFrom(e.bind.contentCamera),t||this._requestUpdateCycle()}this._needFullCycle&&(this.runTask(q),this._needFullCycle=!1)}}acquireTechniques(e){if(!this.baseMaterial.visible||!this.baseMaterial.isVisibleForOutput(e.output))return null;const t=this._getInstanceDatas(e);if(!t)return null;const r=new Array,n=this.levels;return t.forEach(t=>n.forEach(({components:n},s)=>n.forEach(n=>r.push(this._beginComponent(e,t[s],n))))),r}render(e,t){const r=this._getInstanceDatas(e);if(!r||null==t)return;let n=0;const s=this.levels;r.forEach(r=>s.forEach(({components:s},a)=>s.forEach(s=>this._renderComponent(e,t[n++],r[a],s,a)))),e.rctx.unbindBuffer(34962),e.rctx.bindVAO(null)}_getInstanceDatas(e){const{output:t,bind:r}=e,n=10===t,s=6===t,a=7!==t;if(!n&&!s)return a?this._allRenderInstanceData:this._allRenderInstanceDataExceptHighlightShadow;const{_highlightRenderInstanceDatas:i}=this;if(a){if(n){const e=r.highlight?.name;if(!e)return null;const t=i.get(e);return t?[t]:null}const e=i.get(A);return s?e?[e]:null:Array.from(i.values())}return null}intersectRay(e,t,r,n){if(!this.baseMaterial.visible||null==this._octree)return;const s=f();d(s,n,r);const a=s=>{this._withIntersectableInstance(e,s,(a,i)=>{m(k,r,e.transform.inverse),m(Y,n,e.transform.inverse),a.intersect(e,t,k,Y,s,this.metadata,i)})};this.baseMaterial.parameters.verticalOffset?this._octree.forEach(a):this._octree.forEachAlongRay(r,s,a)}_withIntersectableInstance(e,t,r){const n=this._instanceData.getState(t);if(!(4&n))return;const s=this._instanceData.getLodLevel(t),a=this._levels.length;R(!!(18&n),"invalid instance state"),R(s>=0&&s<a,"invaid lod level");const i=this._levels[s];null!=i&&(this._instanceData.getCombinedModelTransform(t,W),e.transform.set(W),r(i,a))}notifyShaderTransformationChanged(){this._invalidateOctree(),this._requestUpdateCycle()}get _octree(){if(null==this._octreeCached){const e=this._instanceData,t=e.view?.state;if(!t)return null;this._octreeCached=new x(e,this.baseBoundingSphere);for(let r=0;r<e.capacity;++r)18&t.get(r)&&this._octreeCached.addInstance(r)}return this._octreeCached}_invalidateOctree(){this._octreeCached=a(this._octreeCached)}queryDepthRange(e){if(null==this._octree)return new D;const t=e.viewForward,r=this._octree.findClosest(t,1,e.frustum),n=this._octree.findClosest(t,-1,e.frustum);if(null==r||null==n)return new D;const s=e.eye,a=this._instanceData.view;a.boundingSphere.getVec(r,G),d(G,G,s);const i=u(G,t)-G[3];a.boundingSphere.getVec(n,G),d(G,G,s);const o=u(G,t)+G[3];return new D(i,o)}_requestUpdateCycle(e=!1){this._updateCyclesWithStaticCamera=-1,this._cycleStartIndex=this._instanceIndex,e&&(this._needFullCycle=!0,this._context.requestRender())}_startUpdateCycle(){this._updateCyclesWithStaticCamera++,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.startUpdateCycle()))}get readyToRun(){return this._instanceData.size>0&&this._updateCyclesWithStaticCamera<1}runTask(e){const{_enableLevelSelection:t,_camera:n,_levelSelector:a}=this;this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.beginUpdate()));const i=this._instanceData,o=i.view;let l=i.size;const c=i.capacity;let h=this._instanceIndex;const d=Math.ceil(c/500),{_highlightRenderInstanceDatas:u}=this;for(let m=0;m<l&&!e.done;++m){h===this._cycleStartIndex&&this._startUpdateCycle();const m=o.state.get(h);let f=0;if(!(1&m)){h=h+1===c?0:h+1,l++;continue}const _=o.lodLevel.get(h);if(2&m&&this._defaultRenderInstanceData[_].freeTail(),16&m){const e=i.geHighlightOptionsPrev(h);if(e){const t=u.get(e);if(!t)throw new r("internal:lod-renderer","Internal error in lodRenderer");t[_].freeTail(),t.every(e=>e.isEmpty)&&(t.forEach(e=>e.destroy()),u.delete(e))}}if(32&m)i.freeInstance(h);else if(4&m){let e=0;if(t&&(o.modelOrigin.getVec(h,N),e=a.selectLevel(N,i.getCombinedMedianScaleFactor(h),n)),f=-83&m,e>=0)if(8&m){const t=i.getHighlightName(h);if(t){const n=()=>{const e=this._createRenderInstanceDataArray();return e.forEach(e=>e.beginUpdate()),e},a=s(u,t,n);if(e>=a.length)throw new r("internal:lod-renderer",`LodRenderer internal error - missing lodLevel ${e}`);P(a[e],o,h)}f|=16}else P(this._defaultRenderInstanceData[e],o,h),f|=2;o.state.set(h,f),o.lodLevel.set(h,e)}else f=-83&m,o.state.set(h,f);const p=!!(18&m),g=!!(18&f);null!=this._octreeCached&&(!p&&g?this._octreeCached.addInstance(h):p&&!g?this._octreeCached.removeInstance(h):p&&g&&64&m&&(this._octreeCached.removeInstance(h),this._octreeCached.addInstance(h))),h=h+1===c?0:h+1,h%d===0&&e.madeProgress(),p!==g&&this.metadata.notifyGraphicVisibilityChanged(h),g&&64&m&&this.metadata.notifyGraphicGeometryChanged(h)}this._instanceIndex=h,this._allRenderInstanceData.forEach(e=>e.forEach(e=>e.endUpdate())),this._context.requestRender()}_beginComponent(e,t,r){if(0===t.size)return null;const n=r.glMaterialLoader.load(e.rctx,e.bind.slot,e.output);return n?.beginSlot(e.bind)}_renderComponent(e,t,r,n,s){if(!t)return;const{bind:a,rctx:i}=e,o=i.bindTechnique(t,a,n.material.parameters,$),l=this._glInstanceBufferLayout;o.assertCompatibleVertexAttributeLocations(n.vao,F(l)),i.bindVAO(n.vao),g.LOD_INSTANCE_RENDERER_COLORIZE_BY_LEVEL&&b(e.output)&&(o.setUniform4fv("externalColor",Z[Math.min(s,Z.length-1)]),o.setUniform1i("symbolColorMixMode",U.replace));const c=r.capacity,h=r.headIndex,d=r.tailIndex,u=r.firstIndex,m=(e,s)=>{B(i,o.locations,r.buffer,e),i.drawArraysInstanced(t.primitiveType,0,n.numVertices,s-e)};n.material.transparent&&null!=u?h>d?(R(u>=d&&u<=h,"invalid firstIndex"),m(u,h),m(d,u)):h<d&&(u<=h?(R(u>=0&&u<=h,"invalid firstIndex"),m(u,h),m(d,c),m(0,u)):(R(u>=d&&u<=c,"invalid firstIndex"),m(u,c),m(0,h),m(d,u))):h>d?m(d,h):h<d&&(m(0,h),m(d,c))}};function P(e,t,r){const n=e.allocateHead();z(t,r,e.view,n)}function z(e,t,r,n){O(e.modelOrigin,t,r.modelOriginHi,r.modelOriginLo,n),r.model.copyFrom(n,e.model,t),r.modelNormal.copyFrom(n,e.modelNormal,t),e.color&&r.color&&r.color.copyFrom(n,e.color,t),e.olidColor&&r.olidColor&&r.olidColor.copyFrom(n,e.olidColor,t),e.featureAttribute&&r.featureAttribute&&r.featureAttribute.copyFrom(n,e.featureAttribute,t)}e([l({constructOnly:!0})],H.prototype,"symbol",void 0),e([l({constructOnly:!0})],H.prototype,"metadata",void 0),e([l({constructOnly:!0})],H.prototype,"shaderTransformation",void 0),e([l()],H.prototype,"_instanceData",void 0),e([l()],H.prototype,"_cycleStartIndex",void 0),e([l({readOnly:!0})],H.prototype,"_enableLevelSelection",null),e([l()],H.prototype,"_updateCyclesWithStaticCamera",void 0),e([l({readOnly:!0})],H.prototype,"readyToRun",null),H=e([c("esri.views.3d.webgl-engine.lib.lodRendering.LodRenderer")],H);const N=f(),G=_(),W=h(),k=f(),Y=f(),Z=[p(1,0,1,1),p(0,0,1,1),p(0,1,0,1),p(1,1,0,1),p(1,0,0,1)],$=new T;export{H as LodRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),u=o.layout,m=o.elementCount(s),a=u.createBuffer(m);o.write(null,null,s,null,{buffer:a,offset:0}),this.renderGeometry=new i(t,a.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const a=this.engineGeometry;this.material.
|
|
2
|
+
import{unique as e}from"../../../../../core/arrayUtils.js";import{estimateNumberArrayMemory as t,baseTypedArrayMemory as r}from"../../../../../core/memoryEstimations.js";import{IntersectorResult as s}from"../IntersectorResult.js";import{LodTarget as n}from"./Intersector.js";class i{constructor(e,t,r,s){this.material=e,this.buffer=t,this.numVertices=r,this.boundingInfo=s,this.bufferWriter=e.createBufferWriter()}get layout(){return this.bufferWriter.layout}get numTriangles(){return this.numVertices/3}computeUsedMemory(){return this.buffer.byteLength+r}get renderGeometry(){return this}}class o{constructor(e){this.engineGeometry=e;const t=this.material,r=this.engineGeometry,s=r.attributes,n=r.boundingInfo,o=t.createBufferWriter(),u=o.layout,m=o.elementCount(s),a=u.createBuffer(m);o.write(null,null,s,null,{buffer:a,offset:0}),this.renderGeometry=new i(t,a.buffer,m,n)}get material(){return this.engineGeometry.material}get numVertices(){return this.engineGeometry.indexCount}get numTriangles(){return this.numVertices/3}get boundingInfo(){return this.engineGeometry.boundingInfo}computeUsedMemory(){return Array.from(this.engineGeometry.attributes.values()).reduce((e,r)=>e+t(r.data,r.indices),0)}intersect(e,t,r,s,n,i,o,m){const a=this.engineGeometry;this.material.intersectRay(a,e.transform.transform,e,r,s,(r,s,a)=>u(r,s,a,e,t,i,o,n,m))}}function u(e,t,r,i,o,u,m,a,c){if(e<0)return;if(o&&!o(i.rayBegin,i.rayEnd,e))return;const l=new n(u.layerViewUid,u.graphicUid(a),r,m,c);if((null==i.results.min.distance||e<i.results.min.distance)&&i.results.min.set(3,l,e,t,i.transform.transform),(null==i.results.max.distance||e>i.results.max.distance)&&i.results.max.set(3,l,e,t,i.transform.transform),2===i.options.store){const r=new s(i.results.min.ray);r.set(3,l,e,t,i.transform.transform),i.results.all.push(r)}}class m{constructor(e,t=null){this.geometry=e,this.textures=t}get material(){return this.geometry.material}get numTriangles(){return this.geometry.numTriangles}}class a{constructor(t,r,s){this.components=t,this.minScreenSpaceRadius=r,this.pivotOffset=s;const n=e(this.components.map(e=>e.geometry));this.numVertices=n.reduce((e,t)=>e+t.numVertices,0)}}class c{constructor(e){this.levels=e,this.levels.sort((e,t)=>e.minScreenSpaceRadius===t.minScreenSpaceRadius?e.numVertices-t.numVertices:e.minScreenSpaceRadius-t.minScreenSpaceRadius)}get materialParameters(){return this.levels[0].components[0].geometry.material.parameters}getMaterials(){const t=[];return this.levels.forEach(e=>e.components.forEach(e=>t.push(e.geometry.material))),e(t)}getTextures(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{null!=e.textures&&t.push(...e.textures)})),e(t)}getGeometries(){const t=new Array;return this.levels.forEach(e=>e.components.forEach(e=>{t.push(e.geometry)})),e(t)}getEngineGeometries(){return this.getGeometries().map(e=>e.engineGeometry).filter(e=>null!=e)}computeUsedMemory(){const e=this.getGeometries(),t=this.getTextures(),r=e.reduce((e,t)=>e+t.computeUsedMemory(),0);return t.reduce((e,t)=>e+t.usedMemory,0)+r}}export{o as LodComponentEngineGeometry,i as LodComponentRenderGeometry,m as LodComponentResources,a as LodLevelResources,c as LodResources};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{isPromiseLike as t}from"../../../../core/promiseUtils.js";import{createScreenPointArray as r}from"../../../../core/screenUtils.js";import{copy as e,add as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import n from"../../../../geometry/SpatialReference.js";import{expandWithNestedArray as s,create as i,negativeInfinity as l}from"../../../../geometry/support/aaBoundingRect.js";import{create as c,computePlanes as a,createPoints as u}from"../../../../geometry/support/frustum.js";import{create as m}from"../../../../geometry/support/ray.js";import{fromScreen as p}from"../../support/geometryUtils/ray.js";import{ScreenPolygonIntersectionQuery as f,ScreenPolygonTessellation as g}from"./IntersectorInterfaces.js";async function y(t,r){const e=j(r);if(null==e)return null;const o=s(i(l),e),n=h(t,o);return null==n?null:await f.create(e,o,n,()=>w(e))}function j(t){const e=new Array;for(const o of t){const t=e[e.length-1];null!=t&&t[0]===o[0]&&t[1]===o[1]||e.push(r(o[0],o[1]))}if(e.length>1){const t=e[0],r=e[e.length-1];t[0]===r[0]&&t[1]===r[1]&&e.pop()}return e.length<3?null:e}function h(t,n){const s=[r(n[0],n[3]),r(n[2],n[3]),r(n[2],n[1]),r(n[0],n[1])],i=u();for(let r=0;r<s.length;r++){const n=p(t,s[r],R);if(null==n)return null;e(i[r],n.origin),o(i[r+4],n.origin,n.direction)}const l=c();return a(l,i),l}const d=(()=>{let t;return async()=>await(t??=import("../../layers/graphics/tessellationUtils.js"))})();async function w(r){const{ringsToOutlinedTessellationInfo:e,tessellateOrLoad:o}=await d(),s=e([r],{hasZ:!1,ccwRingsAsHoles:!1,spatialReference:n.WebMercator});let i=o(s);if(t(i)&&(await i,i=o(s)),t(i)||!i.succeeded)return null;const{positions:l,indices:c,vertexCount:a}=i;return new g(l,c,a)}const R=m();export{y as prepareScreenPolygonIntersectionQuery};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as T}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./PolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as w}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as
|
|
2
|
+
import{exactEquals as e,set as t,copy as r,normalize as s,subtract as i,length as a,scale as o,dot as n,transformMat3 as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as u,create as c,fromValues as h}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{is3DGeometryOrShadowLike as m,isColor as p}from"../core/shaderLibrary/ShaderOutput.js";import{GLTextureMaterial as d}from"../lib/GLTextureMaterial.js";import{Material as f}from"../lib/Material.js";import{intersectTriangleGeometry as x}from"../lib/RayIntersections.js";import{getVerticalOffsetObject3D as T}from"../lib/verticalOffsetUtils.js";import{DefaultBufferWriter as g}from"./DefaultBufferWriter.js";import{intersectWithPolygonOffset as v}from"./PolygonOffset.js";import{verticalOffsetAtDistance as S}from"./internal/MaterialUtil.js";import{getLayout as b,DefaultMaterialPassParameters as M,DefaultMaterialTechnique as O}from"../shaders/DefaultMaterialTechnique.js";import{DefaultMaterialTechniqueConfiguration as w}from"../shaders/DefaultMaterialTechniqueConfiguration.js";import{RealisticTreeTechnique as y}from"../shaders/RealisticTreeTechnique.js";import{hasShadowHighlights as C}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as R}from"../../../../webscene/support/AlphaCutoff.js";class P extends f{constructor(e,t){super(e,I),this.materialType="default",this.supportsEdges=!0,this.intersectRayDraped=void 0,this.produces=new Map([[2,e=>m(e)&&!this.transparent],[4,e=>m(e)&&this.transparent&&this.parameters.writeDepth],[8,e=>m(e)&&this.transparent&&!this.parameters.writeDepth]]),this._layout=b(this.parameters),this._configuration=new w(t.spherical)}isVisibleForOutput(e){return 5!==e&&7!==e&&6!==e||this.parameters.castShadows}get visible(){const{layerOpacity:e,colorMixMode:t,opacity:r,externalColor:s}=this.parameters;return e*("replace"===t?1:r)*("ignore"===t||isNaN(s[3])?1:s[3])>=R}get _hasEmissiveBase(){return!!this.parameters.emissiveTextureId||!e(this.parameters.emissiveBaseColor,u)}get emissions(){return this.parameters.emissiveStrength>0&&(0===this.parameters.emissiveSource&&this._hasEmissiveBase||1===this.parameters.emissiveSource)?this.transparent?2:1:0}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:r}=this;r.hasNormalTexture=t.hasNormalTexture,r.hasColorTexture=t.hasColorTexture,r.hasMetallicRoughnessTexture=t.hasMetallicRoughnessTexture,r.hasOcclusionTexture=t.hasOcclusionTexture;const{treeRendering:s,doubleSided:i,doubleSidedType:a}=t;r.hasVertexTangents=!s&&t.hasVertexTangents,r.instanced=t.instanced,r.instancedDoublePrecision=t.instancedDoublePrecision,r.hasVVColor=!!t.vvColor,r.hasVVSize=!!t.vvSize,r.hasVerticalOffset=null!=t.verticalOffset,r.hasScreenSizePerspective=null!=t.screenSizePerspective,r.hasSlicePlane=t.hasSlicePlane,r.alphaDiscardMode=t.textureAlphaMode,r.normalType=s?0:t.normalType,r.transparent=this.transparent,r.enableOITOffset=e.enableOITOffset,r.writeDepth=t.writeDepth,r.customDepthTest=t.customDepthTest??0,r.hasOccludees=e.hasOccludees,r.cullFace=t.hasSlicePlane?0:t.cullFace,r.hasModelTransformation=!s&&null!=t.modelTransformation,r.hasVertexColors=t.hasVertexColors,r.hasSymbolColors=t.hasSymbolColors,r.doubleSidedMode=s?2:i&&"normal"===a?1:i&&"winding-order"===a?2:0,r.instancedFeatureAttribute=t.instancedFeatureAttribute,r.instancedColor=t.instancedColor,p(e.output)?(r.receiveShadows=t.receiveShadows,r.hasShadowHighlights=C(r,e),r.receiveAmbientOcclusion=t.receiveAmbientOcclusion&&null!=e.ssao,r.receiveGlobalIllumination=t.receiveAmbientOcclusion&&e.globalIlluminationEnabled):r.receiveShadows=r.hasShadowHighlights=r.receiveAmbientOcclusion=!1,r.textureAlphaPremultiplied=!!t.textureAlphaPremultiplied,r.pbrMode=t.usePBR?t.isSchematic?2:1:0,r.emissionSource=t.emissionSource,r.offsetBackfaces=!(!this.transparent||!t.offsetTransparentBackfaces),r.snowCover=e.snowCover>0,r.hasColorTextureTransform=!!t.colorTextureTransformMatrix,r.hasNormalTextureTransform=!!t.normalTextureTransformMatrix,r.hasEmissionTextureTransform=!!t.emissiveTextureTransformMatrix,r.hasOcclusionTextureTransform=!!t.occlusionTextureTransformMatrix,r.hasMetallicRoughnessTextureTransform=!!t.metallicRoughnessTextureTransformMatrix}intersectRay(e,u,c,h,m,p){if(null!=this.parameters.verticalOffset){const e=c.camera;t(N,u[12],u[13],u[14]);let p=null;switch(c.viewingMode){case 1:p=s(_,N);break;case 2:p=r(_,V)}const d=i(z,N,e.eye),f=a(d),x=o(d,d,1/f);let T=null;this.parameters.screenSizePerspective&&(T=n(p,x));const g=S(e,f,this.parameters.verticalOffset,T??0,this.parameters.screenSizePerspective,null);o(p,p,g),l(B,p,c.transform.inverseRotation),h=i(D,h,B),m=i(A,m,B)}p=v(p,this._configuration,h,m),x(e,c,h,m,T(c.verticalOffset),p)}intersectScreenPolygon(){}createGLMaterial(e){return new j(e)}createBufferWriter(){return new g(this._layout)}get transparent(){const{drivenOpacity:e,opacity:t,externalColor:r,layerOpacity:s,texture:i,textureId:a,textureAlphaMode:o,colorMixMode:n}=this.parameters,l=r[3];return e||t<1&&"replace"!==n||l<1&&"ignore"!==n||s<1||(null!=i||null!=a)&&1!==o&&2!==o&&"replace"!==n}}class j extends d{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){this._material.setParameters({receiveShadows:e.shadowMap.enabled});const r=this._material.parameters;this.updateTexture(r.textureId);const s=e.camera.viewInverseTransposeMatrix;return t(r.origin,s[3],s[7],s[11]),this._material.setParameters(this.textureBindParameters),this.getTechnique(r.treeRendering?y:O,e)}}class I extends M{constructor(){super(...arguments),this.treeRendering=!1,this.useIndexing=!1,this.hasVertexTangents=!1}get hasNormalTexture(){return!this.treeRendering&&!!this.normalTextureId}get hasColorTexture(){return!!this.textureId}get hasMetallicRoughnessTexture(){return!this.treeRendering&&!!this.metallicRoughnessTextureId}get hasOcclusionTexture(){return!this.treeRendering&&!!this.occlusionTextureId}get emissiveStrength(){return this.emissiveStrengthFromSymbol*this.emissiveStrengthKHR}get emissionSource(){return null!=this.emissiveTextureId&&0===this.emissiveSource?3:0===this.emissiveSource?2:1}get hasTextures(){return this.hasColorTexture||this.hasNormalTexture||this.hasMetallicRoughnessTexture||3===this.emissionSource||this.hasOcclusionTexture}}const D=c(),A=c(),V=h(0,0,1),_=c(),B=c(),N=c(),z=c();export{j as DefaultGLMaterial,P as DefaultMaterial,I as DefaultMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f,transformMat4 as u,normalize as h,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as C,ONES as P,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as D}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as R}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as F,isOIT as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as _}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as L,GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as E}from"../lib/screenSizePerspectiveUtils.js";import{assert as I}from"../lib/Util.js";import{writePosition as W,writeNormal as H,writeColor as N,writeBufferVec2 as G,writeBufferFloat as q,writeBufferVec3 as X,writeBufferZeros as Y,writeBufferVec4 as k,writeOlidColor as J}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as K}from"./internal/MaterialUtil.js";import{a as Q}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Z,getInstanceLayout as $,HUDMaterialTechnique as ee}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as te}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as se}from"../../../../webscene/support/AlphaCutoff.js";class re extends B{constructor(e,t,s=!1){super(e,Pe),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new te(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,F(e.output)&&(s.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&U(e.output)}intersect(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const P=e.attributes.get("featureAttribute"),j=null==P?null:C(P.data,Se),{scaleX:D,scaleY:R}=De(j,V,z.pixelRatio),w=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),F=e.attributes.get("rotation"),U=e.attributes.get("centerOffset"),_=this.parameters.size;I(w.size>=3);const L="screen"===this.parameters.centerOffsetUnits;for(let C=0;C<w.data.length/w.size;C++){const e=C*w.size;if(f(ce,w.data[e],w.data[e+1],w.data[e+2]),u(ce,ce,t),u(ce,ce,z.viewMatrix),U){const e=C*U.size;f(ve,U.data[e],U.data[e+1],U.data[e+2])}else f(ve,0,0,0);if(!L&&(ce[0]+=ve[0],ce[1]+=ve[1],0!==ve[2])){const e=ve[2];h(ve,ce),m(ce,ce,d(ve,ve,e))}const a=C*M.size;f(pe,M.data[a],M.data[a+1],M.data[a+2]),g(pe,pe,s(ge,t));const{normal:n,cosAngle:l}=ne(pe,z,Oe),c=we(this.parameters,ce,l,z,le);if(b(ce,ce,n,c),z.applyProjection(ce,fe),fe[0]>-1){if(L&&(ve[0]||ve[1])&&(fe[0]+=ve[0]*z.pixelRatio,0!==ve[1]&&(fe[1]+=le.alignmentEvaluator.apply(ve[1])*z.pixelRatio),z.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),Ve[0]=_[0],Ve[1]=_[1],null!=A){const e=C*A.size;Ve[0]*=A.data[e],Ve[1]*=A.data[e+1]}le.evaluator.applyVec2(Ve,Ve);const e=ze*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*Ve[0])*z.pixelRatio/2}Ve[0]*=D,Ve[1]*=R;const s=V.rotation+(null!=F?F.data[C*F.size]:0),a=Q(V);if(oe(O,fe[0],fe[1],Ve,e,t,s,V,a)){const e=r.ray;if(u(he,ce,i(be,z.viewMatrix)),fe[0]=O[0],fe[1]=O[1],z.unprojectFromRenderScreen(fe,ce)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,ce)*s,t,-1,he)}}}}}intersectDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=l.size,p=e.attributes.get("featureAttribute"),f=null==p?null:C(p.data,Se),{scaleX:u,scaleY:h}=De(f,l,e.screenToWorldRatio),m=ye*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,p=a.data[t],f=a.data[t+1];if(Ve[0]=c[0],Ve[1]=c[1],null!=n){const e=d*n.size;Ve[0]*=n.data[e],Ve[1]*=n.data[e+1]}let g=0;if(l.textureIsSignedDistanceField){g=Math.min(l.outlineSize,.5*Ve[0])*e.screenToWorldRatio/2}Ve[0]*=u,Ve[1]*=h;const b=l.rotation+(null!=o?o.data[d*o.size]:0),v=Q(l);oe(s,p,f,Ve,m,g,b,l,v)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new je(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(ue,r,s(ge,i));const c=ne(ue,o,Oe),p=Re(x(t),o),f=we(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,f+p),b(e,e,ue,f+p);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(h(pe,s),O(s,s,d(pe,pe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=se||t>=se&&s[3]>=se;return this._visible&&r}createGLMaterial(e){return new ie(e)}calculateRelativeScreenBounds(e,t,s=D()){return ae(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class ie extends T{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ee,e)}}function ae(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ne(e,t,s){return u(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Ce),s}function oe(e,s,r,i,a,l,c,p,f){let u=s-a-i[0]*f[0],h=u+i[0]+2*a,m=r-a-i[1]*f[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(u+=i[0]*g[0],m+=i[1]*g[1],h-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),u-=l,h+=l,m-=l,d+=l),n(de,s,r),o(me,e,de,t(c)),me[0]>u&&me[0]<h&&me[1]>m&&me[1]<d}const le=new E,ce=y(),pe=y(),fe=j(),ue=y(),he=y(),me=p(),de=p(),ge=r(),be=a(),ve=y(),xe=y(),Se=j(),Oe={normal:y(),cosAngle:0},ze=1,ye=2,Ve=c(0,0),Ce=V(0,0,1);class Pe extends L{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=P,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=P,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class je{constructor(e){this.baseInstanceLayout=Z,this.layout=$(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:p,rotation:f,centerOffset:u,groundDistance:h,featureAttribute:m,uvi:d}=a;W(s.get("position"),e,o,n),H(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;d.setValues(a,t,s,r,i)}}}if(c&&N(s.get("color"),4,c,n),p&&G(s.get("size"),p,n),f&&q(s.get("rotation"),f,n),u&&(s.get("centerOffset")?X(s.get("centerOffset"),u,n):Y(u,n,g)),s.get("groundDistance")?q(s.get("groundDistance"),h,n):Y(h,n,g),m&&(s.get("featureAttribute")?k(s.get("featureAttribute"),m,n):Y(m,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",R);J(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;G(e.get("uv0"),s,0)}}function De(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(w(xe,t,e),{scaleX:xe[0]*s,scaleY:xe[1]*s})}function Re(e,t){const s=t.computeRenderPixelSizeAtDist(e)*_;return(t.aboveGround?1:-1)*s}function we(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=K(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{re as HUDMaterial,Pe as Parameters};
|
|
2
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as s}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as i}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{set as n,rotate as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{ONES as l,fromValues as c,create as p}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{set as f,transformMat4 as u,normalize as h,subtract as m,scale as d,transformMat3 as g,scaleAndAdd as b,copy as v,length as x,distance as S,sub as O,dot as z}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as y,fromValues as V}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as P,ONES as C,create as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as R}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorHighlightOrOLID as M,isColor as F,isOIT as U}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as _}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as L,GLTextureMaterial as T}from"../lib/GLTextureMaterial.js";import{Material as B}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as E}from"../lib/screenSizePerspectiveUtils.js";import{assert as I}from"../lib/Util.js";import{writePosition as W,writeNormal as H,writeColor as N,writeBufferVec2 as G,writeBufferFloat as q,writeBufferVec3 as X,writeBufferZeros as Y,writeBufferVec4 as k,writeOlidColor as J}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as K}from"./internal/MaterialUtil.js";import{a as Q}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Z,getInstanceLayout as $,HUDMaterialTechnique as ee}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as te}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as se}from"../../../../webscene/support/AlphaCutoff.js";class re extends B{constructor(e,t,s=!1){super(e,Ce),this.produces=new Map([[12,e=>M(e)&&!this.parameters.drawAsLabel&&!this._configuration.transparentOccluded],[13,e=>M(e)&&!this.parameters.drawAsLabel&&this._configuration.transparentOccluded],[14,e=>M(e)&&this.parameters.drawAsLabel],[18,e=>this.parameters.draped&&M(e)]]),this._visible=!0,this._configuration=new te(t,s)}updateConfiguration(e){super.updateConfiguration(e);const{parameters:t,_configuration:s}=this,r=t.draped;s.enableOITOffset=e.enableOITOffset,s.hasSlicePlane=this.parameters.hasSlicePlane,s.hasVerticalOffset=!!this.parameters.verticalOffset,s.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,s.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,s.polygonOffset=this.parameters.polygonOffset,s.draped=r,s.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,s.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,s.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,s.hasRotation=this.parameters.hasRotation,s.hasVVSize=!!this.parameters.vvSize,s.hasVVColor=!!this.parameters.vvColor,s.occludedFragmentFade=!r&&!!this.parameters.occludedFragmentOpacity,s.hasFocusAreaStyle=null!=this.parameters.focusAreaStyle,s.depthTestEnabled=this.parameters.depthEnabled,s.hasVertexColor=this.parameters.hasVertexColor,s.hasVertexSize=this.parameters.hasVertexSize,s.hasVertexRotation=this.parameters.hasVertexRotation,s.hasVertexUVi=this.parameters.hasVertexUVi,s.hasVertexCenterOffset=this.parameters.hasVertexCenterOffset,F(e.output)&&(s.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),s.hasOcclusionTexture=!t.drawAsLabel&&s.transparentOccluded&&U(e.output)}intersectRay(e,t,r,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:p},point:O,camera:z}=r,{parameters:V}=this;if(!l||!c||p&&V.isLabel||!e.visible||!O||!z)return;const C=e.attributes.get("featureAttribute"),j=null==C?null:P(C.data,Se),{scaleX:R,scaleY:D}=Re(j,V,z.pixelRatio),w=e.attributes.get("position"),A=e.attributes.get("size"),M=e.attributes.get("normal"),F=e.attributes.get("rotation"),U=e.attributes.get("centerOffset"),_=this.parameters.size;I(w.size>=3);const L="screen"===this.parameters.centerOffsetUnits;for(let P=0;P<w.data.length/w.size;P++){const e=P*w.size;if(f(ce,w.data[e],w.data[e+1],w.data[e+2]),u(ce,ce,t),u(ce,ce,z.viewMatrix),U){const e=P*U.size;f(ve,U.data[e],U.data[e+1],U.data[e+2])}else f(ve,0,0,0);if(!L&&(ce[0]+=ve[0],ce[1]+=ve[1],0!==ve[2])){const e=ve[2];h(ve,ce),m(ce,ce,d(ve,ve,e))}const a=P*M.size;f(pe,M.data[a],M.data[a+1],M.data[a+2]),g(pe,pe,s(ge,t));const{normal:n,cosAngle:l}=ne(pe,z,Oe),c=we(this.parameters,ce,l,z,le);if(b(ce,ce,n,c),z.applyProjection(ce,fe),fe[0]>-1){if(L&&(ve[0]||ve[1])&&(fe[0]+=ve[0]*z.pixelRatio,0!==ve[1]&&(fe[1]+=le.alignmentEvaluator.apply(ve[1])*z.pixelRatio),z.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*z.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*z.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),Ve[0]=_[0],Ve[1]=_[1],null!=A){const e=P*A.size;Ve[0]*=A.data[e],Ve[1]*=A.data[e+1]}le.evaluator.applyVec2(Ve,Ve);const e=ze*z.pixelRatio;let t=0;if(V.textureIsSignedDistanceField){t=Math.min(V.outlineSize,.5*Ve[0])*z.pixelRatio/2}Ve[0]*=R,Ve[1]*=D;const s=V.rotation+(null!=F?F.data[P*F.size]:0),a=Q(V);if(oe(O,fe[0],fe[1],Ve,e,t,s,V,a)){const e=r.ray;if(u(he,ce,i(be,z.viewMatrix)),fe[0]=O[0],fe[1]=O[1],z.unprojectFromRenderScreen(fe,ce)){const t=y();v(t,e.direction);const s=1/x(t);d(t,t,s);o(S(e.origin,ce)*s,t,-1,he)}}}}}intersectScreenPolygon(){}intersectRayDraped(e,t,s,r,i){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=l.size,p=e.attributes.get("featureAttribute"),f=null==p?null:P(p.data,Se),{scaleX:u,scaleY:h}=Re(f,l,e.screenToWorldRatio),m=ye*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,p=a.data[t],f=a.data[t+1];if(Ve[0]=c[0],Ve[1]=c[1],null!=n){const e=d*n.size;Ve[0]*=n.data[e],Ve[1]*=n.data[e+1]}let g=0;if(l.textureIsSignedDistanceField){g=Math.min(l.outlineSize,.5*Ve[0])*e.screenToWorldRatio/2}Ve[0]*=u,Ve[1]*=h;const b=l.rotation+(null!=o?o.data[d*o.size]:0),v=Q(l);oe(s,p,f,Ve,m,g,b,l,v)&&r(i.distance,i.normal,-1)}}createBufferWriter(){return new je(this.parameters)}applyShaderOffsets(e,t,r,i,a,n,o,l){g(ue,r,s(ge,i));const c=ne(ue,o,Oe),p=De(x(t),o),f=we(this.parameters,t,c.cosAngle,o,l);b(t,t,c.normal,f+p),b(e,e,ue,f+p);const u=n+f;this._applyPolygonOffsetView(t,c,u,o,t),this._applyCenterOffsetView(t,a,t)}applyShaderOffsetsNDC(e,t,s,r,i,a){return this._applyCenterOffsetNDC(e,t,r,i),null!=a&&v(a,i),this._applyPolygonOffsetNDC(i,s,r,i),i}_applyPolygonOffsetView(t,s,r,i,a){const n=i.aboveGround?1:-1;let o=Math.sign(r);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return v(a,t);const c=e(Math.abs(s.cosAngle),.01,1),p=1-Math.sqrt(1-c*c)/c/i.viewport[2];return d(a,t,l>0?p:1/p),a}_applyCenterOffsetView(e,t,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&v(s,e),r&&(s[0]+=t[0],s[1]+=t[1],t[2]&&(h(pe,s),O(s,s,d(pe,pe,t[2])))),s}_applyCenterOffsetNDC(e,t,s,r){const i="screen"!==this.parameters.centerOffsetUnits;return r!==e&&v(r,e),i||(r[0]+=t[0]/s.fullWidth*2,r[1]+=t[1]/s.fullHeight*2),r}_applyPolygonOffsetNDC(e,t,s,r){const i=this.parameters.shaderPolygonOffset;if(e!==r&&v(r,e),i){const e=s.aboveGround?1:-1,a=e*Math.sign(t);r[2]-=(a||e)*i}return r}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:s}=this.parameters,r=e[3]>=se||t>=se&&s[3]>=se;return this._visible&&r}createGLMaterial(e){return new ie(e)}calculateRelativeScreenBounds(e,t,s=R()){return ae(this.parameters,e,t,s),s[2]=s[0]+e[0],s[3]=s[1]+e[1],s}}class ie extends T{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(ee,e)}}function ae(e,t,s,r){r[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*s,r[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*s}function ne(e,t,s){return u(s.normal,e,t.viewInverseTransposeMatrix),s.cosAngle=z(s.normal,Pe),s}function oe(e,s,r,i,a,l,c,p,f){let u=s-a-i[0]*f[0],h=u+i[0]+2*a,m=r-a-i[1]*f[1],d=m+i[1]+2*a;const g=p.distanceFieldBoundingBox;return p.textureIsSignedDistanceField&&null!=g&&(u+=i[0]*g[0],m+=i[1]*g[1],h-=i[0]*(1-g[2]),d-=i[1]*(1-g[3]),u-=l,h+=l,m-=l,d+=l),n(de,s,r),o(me,e,de,t(c)),me[0]>u&&me[0]<h&&me[1]>m&&me[1]<d}const le=new E,ce=y(),pe=y(),fe=j(),ue=y(),he=y(),me=p(),de=p(),ge=r(),be=a(),ve=y(),xe=y(),Se=j(),Oe={normal:y(),cosAngle:0},ze=1,ye=2,Ve=c(0,0),Pe=V(0,0,1);class Ce extends L{constructor(){super(...arguments),this.renderOccluded=1,this.testsTransparentRenderOrder=0,this.isDecoration=!1,this.color=C,this.size=l,this.polygonOffset=0,this.anchorPosition=c(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=C,this.outlineSize=0,this.distanceFieldBoundingBox=j(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.hasVertexColor=!1,this.hasVertexSize=!1,this.hasVertexRotation=!1,this.hasVertexUVi=!1,this.hasVertexCenterOffset=!1,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.focusAreaStyle=null,this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class je{constructor(e){this.baseInstanceLayout=Z,this.layout=$(e)}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,s,r,i){const{buffer:a,offset:n}=i,{position:o,normal:l,color:c,size:p,rotation:f,centerOffset:u,groundDistance:h,featureAttribute:m,uvi:d}=a;W(s.get("position"),e,o,n),H(s.get("normal"),t,l,n);const g=s.get("position").indices.length;if(d){const e=s.get("uvi")?.data;if(e&&e.length>=4){const[t,s,r,i]=e;for(let e=0;e<g;++e){const a=n+e;d.setValues(a,t,s,r,i)}}}if(c&&N(s.get("color"),4,c,n),p&&G(s.get("size"),p,n),f&&q(s.get("rotation"),f,n),u&&(s.get("centerOffset")?X(s.get("centerOffset"),u,n):Y(u,n,g)),s.get("groundDistance")?q(s.get("groundDistance"),h,n):Y(h,n,g),m&&(s.get("featureAttribute")?k(s.get("featureAttribute"),m,n):Y(m,n,g)),null!=r){const e=s.get("position")?.indices;if(e){const t=e.length,s=a.getField("olidColor",D);J(r,s,t,n)}}}writeBaseInstance(e,t){const{uv0:s}=t;G(e.get("uv0"),s,0)}}function Re(e,t,s){return null==e||null==t.vvSize?{scaleX:s,scaleY:s}:(w(xe,t,e),{scaleX:xe[0]*s,scaleY:xe[1]*s})}function De(e,t){const s=t.computeRenderPixelSizeAtDist(e)*_;return(t.aboveGround?1:-1)*s}function we(e,t,s,r,i){if(!e.verticalOffset?.screenLength){const r=x(t);return i.update(s,r,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),0}const a=x(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=K(r,a,e.verticalOffset,s,n,e.screenSizePerspectiveMinPixelReferenceSize);return i.update(s,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),o}export{re as HUDMaterial,Ce as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class b extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends a{constructor(t){super(t,b),this.visible=!0,this.produces=new Map([[18,t=>r(t)]]),this._configuration=new p}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}
|
|
2
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as a}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as o}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as u,instanceLayout as c,HeatmapDensityPassParameters as l,HeatmapDensityTechnique as f,baseLayout as m}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as p}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class b extends l{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class d extends a{constructor(t){super(t,b),this.visible=!0,this.produces=new Map([[18,t=>r(t)]]),this._configuration=new p}updateConfiguration(t){super.updateConfiguration(t),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats}createGLMaterial(t){return new g(t)}intersectRay(){}intersectRayDraped(s,r,i,a,n){const o=s.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=s,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const s=h*o.size,r=t(v,o.data[s],o.data[s+1]);e(r,i)<m&&a(n.distance,n.normal,-1)}}intersectScreenPolygon(){}createBufferWriter(){return new j(this.parameters.isAttributeDriven?u:c)}}class g extends i{beginSlot(t){return this.getTechnique(f,t)}}class j{constructor(t){this.layout=t,this.baseInstanceLayout=m}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,s,r,i){const{buffer:a,offset:u}=i;n(s.get("position"),t,a.position,u);const c="featureAttribute"in a?a.featureAttribute:null;c&&o(s.get("featureAttribute"),c,u)}writeBaseInstance(t,e){const s=e.uv0;s.setValues(0,-1,-1),s.setValues(1,-1,1),s.setValues(2,1,-1),s.setValues(3,1,1)}}const v=s();export{d as HeatmapDensityMaterial,b as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.
|
|
2
|
+
import{safeToString as e}from"../../../../core/string.js";import{fromValues as t}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as r}from"../core/shaderLibrary/ShaderOutput.js";import i from"../lib/GLMaterial.js";import{Material as s,MaterialParameters as n}from"../lib/Material.js";import{writeBufferVec2 as a,writePosition as o,writeNormal as c,writeBufferVec3 as l,writeBufferFloat as u}from"./internal/bufferWriterUtils.js";import{LineCalloutTechnique as h,layout as f,baseLayout as p}from"../shaders/LineCalloutTechnique.js";import{LineCalloutTechniqueConfiguration as d}from"../shaders/LineCalloutTechniqueConfiguration.js";import{alphaCutoff as g}from"../../../../webscene/support/AlphaCutoff.js";class m extends s{constructor(e,t){super(e,$),this.intersectRayDraped=void 0,this.produces=new Map([[15,e=>r(e)],[16,e=>r(e)]]),this._configuration=new d(t),this._uniqueMaterialIdentifier=S(this.parameters)}passParameters(){return this.parameters}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasVerticalOffset=null!=this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective,this._configuration.hudDepth=16===e.slot,this._configuration.hudDepthAlignStart=!!this.parameters.hudDepthAlignStart,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane}get visible(){return this.parameters.color[3]>=g||(this.parameters.borderColor?.[3]??0)>=g}intersectRay(){}intersectScreenPolygon(){}createGLMaterial(e){return new O(e)}createBufferWriter(){return new b}validateParameters(e){this._uniqueMaterialIdentifier=S(e)}get uniqueMaterialIdentifier(){return this._uniqueMaterialIdentifier}}function S({renderOccluded:t,isDecoration:r,horizontalScreenOffset:i,color:s,size:n,shaderPolygonOffset:a,hudDepthAlignStart:o,centerOffsetUnits:c,hasSlicePlane:l,screenSizePerspective:u,verticalOffset:h,borderColor:f}){return e`${t}:${r}:${i}:[${s}]:${n}:${a}:${o}:${c}:${l}:${null!=u}:{${h?.screenLength}:${h?.minWorldLength}:${h?.maxWorldLength}}:[${f}]`}class O extends i{beginSlot(e){return this.getTechnique(h,e)}}class $ extends n{constructor(){super(...arguments),this.horizontalScreenOffset=0,this.color=t(0,0,0,1),this.size=1,this.shaderPolygonOffset=1e-5,this.hudDepthAlignStart=!1,this.centerOffsetUnits="world",this.hasSlicePlane=!1}}class b{constructor(){this.layout=f,this.baseInstanceLayout=p}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}writeBaseInstance(e,t){const{uv0:r}=t;a(e.get("uv0"),r,0)}write(e,t,r,i,s){const{buffer:n,offset:a}=s;o(r.get("position"),e,n.position,a),c(r.get("normal"),t,n.normal,a),l(r.get("centerOffset"),n.centerOffset,a),u(r.get("groundDistance"),n.groundDistance,a)}}export{m as LineCalloutMaterial,$ as Parameters,S as uniqueMaterialIdentifier};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as l,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>h(e)&&8===this.parameters.renderOccluded],[11,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[8,e=>a(e)&&!this.parameters.writeDepth],[18,e=>a(e)||10===e]]),this.
|
|
2
|
+
import{set as e,equals as t,transformMat4 as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{makeFloat16Array as s}from"../../../../geometry/support/float16.js";import{isColor as a,isDepth as o,isColorHighlightOLIDOrDepth as h}from"../core/shaderLibrary/ShaderOutput.js";import n from"../lib/GLMaterial.js";import{Material as c}from"../lib/Material.js";import{VisualVariablePassParameters as p}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as m}from"./internal/bufferWriterUtils.js";import{getLayout as l,LineMarkerTechnique as u}from"../shaders/LineMarkerTechnique.js";import{LineMarkerTechniqueConfiguration as d}from"../shaders/LineMarkerTechniqueConfiguration.js";import{alphaCutoff as f}from"../../../../webscene/support/AlphaCutoff.js";class g extends c{constructor(e,t){super(e,v),this.produces=new Map([[2,e=>10===e||a(e)&&8===this.parameters.renderOccluded],[3,e=>o(e)],[10,e=>h(e)&&8===this.parameters.renderOccluded],[11,e=>h(e)&&8===this.parameters.renderOccluded],[4,e=>a(e)&&this.parameters.writeDepth],[8,e=>a(e)&&!this.parameters.writeDepth],[18,e=>a(e)||10===e]]),this.intersectRayDraped=void 0,this._configuration=new d(t)}updateConfiguration(e){super.updateConfiguration(e),this._configuration.space=18===e.slot?0:this.parameters.worldSpace?2:1,this._configuration.hideOnShortSegments=this.parameters.hideOnShortSegments,this._configuration.hasCap=0!==this.parameters.cap,this._configuration.anchor=this.parameters.anchor,this._configuration.hasTip=this.parameters.hasTip,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasOccludees=e.hasOccludees,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.hasScreenSizePerspective=null!=this.parameters.screenSizePerspective}get visible(){return this.parameters.color[3]>=f}intersectRay(){}intersectScreenPolygon(){}createBufferWriter(){return new S(l(this.parameters),this.parameters)}createGLMaterial(e){return new _(e)}}class _ extends n{dispose(){super.dispose(),this._markerTextures?.release(this._markerPrimitive),this._markerPrimitive=null}beginSlot(e){const t=this._material.parameters.markerPrimitive;return t!==this._markerPrimitive&&(this._material.setParameters({markerTexture:this._markerTextures.swap(t,this._markerPrimitive)}),this._markerPrimitive=t),this.getTechnique(u,e)}}class v extends p{constructor(){super(...arguments),this.width=0,this.color=[1,1,1,1],this.markerPrimitive="arrow",this.placement="end",this.cap=0,this.anchor=0,this.hasTip=!1,this.worldSpace=!1,this.hideOnShortSegments=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.stipplePattern=null,this.markerTexture=null}}class S{constructor(e,t){this.layout=e,this._parameters=t}elementCount(){return"begin-end"===this._parameters.placement?12:6}write(i,a,o,h,n){const{buffer:c,offset:p}=n,l=o.get("position").data,u=l.length/3;let d=[1,0,0];const f=o.get("normal");this._parameters.worldSpace&&null!=f&&(d=f.data);let g=1,_=0;this._parameters.vvSize?_=o.get("sizeFeatureAttribute").data[0]:o.has("size")&&(g=o.get("size").data[0]);let v=[1,1,1,1],S=0;this._parameters.vvColor?S=o.get("colorFeatureAttribute").data[0]:o.has("color")&&(v=o.get("color").data);let P=0;this._parameters.vvOpacity&&(P=o.get("opacityFeatureAttribute").data[0]);const y=new Float32Array(c.buffer),O=s(c.buffer),T=new Uint8Array(c.buffer);let V=p*(this.layout.stride/4);const k=y.BYTES_PER_ELEMENT/O.BYTES_PER_ELEMENT,j=4/k,M=(e,t,r,i)=>{y[V++]=e[0],y[V++]=e[1],y[V++]=e[2],m(t,e,O,V*k),V+=j;let s=V*k;if(O[s++]=r[0],O[s++]=r[1],V=Math.ceil(s/k),this._parameters.vvColor)y[V++]=S;else{const e=Math.min(4*i,v.length-4),t=4*V++;T[t]=255*v[e],T[t+1]=255*v[e+1],T[t+2]=255*v[e+2],T[t+3]=255*v[e+3]}this._parameters.vvOpacity&&(y[V++]=P),s=V*k,this._parameters.vvSize?(y[V++]=_,s+=2):O[s++]=g,this._parameters.worldSpace&&(O[s++]=d[0],O[s++]=d[1],O[s++]=d[2]),V=Math.ceil(s/k)},x=(s,a)=>{const o=e(b,l[3*s],l[3*s+1],l[3*s+2]),h=w;let n=s+a;do{e(h,l[3*n],l[3*n+1],l[3*n+2]),n+=a}while(t(o,h)&&n>=0&&n<u);i&&(r(o,o,i),r(h,h,i)),M(o,h,[-1,-1],s),M(o,h,[1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,-1],s),M(o,h,[1,1],s),M(o,h,[-1,1],s)},C=this._parameters.placement;"begin"!==C&&"begin-end"!==C||x(0,1),"end"!==C&&"begin-end"!==C||x(u-1,-1)}}const b=i(),w=i();export{g as LineMarkerMaterial,v as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as u}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends p{constructor(t){super(t,b),this._configuration=new m,this.
|
|
2
|
+
import{set as t,normalize as e,subtract as r,cross as s,distance as o,transformMat4 as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as a}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isColor as c}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as p,MaterialParameters as u}from"../lib/Material.js";import{MeasurementArrowTechnique as f,layout as h}from"../shaders/MeasurementArrowTechnique.js";import{MeasurementArrowTechniqueConfiguration as m}from"../shaders/MeasurementArrowTechniqueConfiguration.js";import{alphaCutoff as d}from"../../../../webscene/support/AlphaCutoff.js";class g extends p{constructor(t){super(t,b),this._configuration=new m,this.intersectRayDraped=void 0,this.produces=new Map([[2,t=>!this._transparent&&c(t)],[8,t=>this._transparent&&c(t)]])}updateConfiguration(t){super.updateConfiguration(t),this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.transparent=this._transparent,this._configuration.writeDepth=2===t.slot}get visible(){const{outlineColor:t,stripeEvenColor:e,stripeOddColor:r}=this.parameters;return t[3]>=d||e[3]>=d||r[3]>=d}intersectRay(){}intersectScreenPolygon(){}createGLMaterial(t){return new C(t)}createBufferWriter(){return new _}get _transparent(){const{parameters:t}=this;return t.outlineColor[3]<1||t.stripeEvenColor[3]<1||t.stripeOddColor[3]<1}}class C extends l{beginSlot(t){return this.getTechnique(f,t)}}class b extends u{constructor(){super(...arguments),this.width=32,this.outlineSize=.2,this.outlineColor=a(1,.5,0,1),this.stripeEvenColor=a(1,1,1,1),this.stripeOddColor=a(1,.5,0,1),this.stripeLength=1}}const w=n(),j=n(),v=n(),M=n(),O=n();class _{constructor(){this.layout=h}elementCount(t){return 2*(t.get("position").indices.length/2+1)}write(n,a,c,l,p){const{buffer:u,offset:f}=p,{data:h,indices:m}=c.get("position"),d=c.get("normal").data,g=h.length/3;m&&m.length!==2*(g-1)&&console.warn("MeasurementArrowMaterial does not support indices");const C=w,b=j,_=v,x=M,y=O,T=u.position,A=u.normal,L=u.uv0;let S=0;for(let w=0;w<g;++w){const c=3*w;if(t(C,h[c],h[c+1],h[c+2]),w<g-1){const o=3*(w+1);t(b,h[o],h[o+1],h[o+2]),t(y,d[o],d[o+1],d[o+2]),e(y,y),r(_,b,C),e(_,_),s(x,y,_),e(x,x)}const l=o(C,b);n&&a&&(i(C,C,n),i(b,b,n),i(x,x,a));const p=f+2*w,u=p+1;T.setVec(p,C),T.setVec(u,C),A.setVec(p,x),A.setVec(u,x),L.set(p,0,S),L.set(p,1,-1),L.set(u,0,S),L.set(u,1,1),w<g-1&&(S+=l)}const V=u.length;for(let t=0;t<2*g;++t)V.set(f+t,S)}}export{g as MeasurementArrowMaterial,b as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{copy as o}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as i,subtract as s,dot as n,scale as a,add as c,copy as l,length as m,distance as u}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as f}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ONES as p}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{distance2 as h,fromPoints as g,closestLineSegmentPoint as d,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as b,signedDistance as y,getNormal as x,create as L}from"../../../../geometry/support/plane.js";import{isColorHighlightOrOLID as S}from"../core/shaderLibrary/ShaderOutput.js";import v from"../lib/GLMaterial.js";import{Material as M,MaterialParameters as w}from"../lib/Material.js";import{isTranslationMatrix as C}from"../lib/Util.js";import{DefaultBufferWriter as R}from"./DefaultBufferWriter.js";import{PositionColorLayout as T,PositionLayout as _}from"./DefaultLayouts.js";import{NativeLineTechnique as A}from"../shaders/NativeLineTechnique.js";import{NativeLineTechniqueConfiguration as V}from"../shaders/NativeLineTechniqueConfiguration.js";import{alphaCutoff as N}from"../../../../webscene/support/AlphaCutoff.js";class U extends M{constructor(e){super(e,E),this._configuration=new V,this.produces=new Map([[2,e=>S(e)]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVertexColors=this.parameters.hasVertexColors,this._configuration.transparent=this.parameters.color[3]<1||this.parameters.width<1,this._configuration.hasOccludees=e.hasOccludees}get visible(){return this.parameters.color[3]>=N}intersectRay(t,r,f,p,j,L){const{options:S,camera:v,rayBegin:M,rayEnd:w}=f;if(!S.selectionMode||!t.visible||!v)return;if(!C(r))return void e.getLogger("esri.views.3d.webgl-engine.materials.NativeLineMaterial").error("intersection assumes a translation-only matrix");const R=t.attributes.get("position").data,T=H;o(T,f.point);const _=2;i(I[0],T[0]-_,T[1]+_,0),i(I[1],T[0]+_,T[1]+_,0),i(I[2],T[0]+_,T[1]-_,0),i(I[3],T[0]-_,T[1]-_,0);for(let e=0;e<4;e++)if(!v.unprojectFromRenderScreen(I[e],J[e]))return;b(v.eye,J[0],J[1],K),b(v.eye,J[1],J[2],Q),b(v.eye,J[2],J[3],Y),b(v.eye,J[3],J[0],Z);let A=Number.MAX_VALUE,V=0;for(let e=0;e<R.length-5;e+=3){if(q[0]=R[e]+r[12],q[1]=R[e+1]+r[13],q[2]=R[e+2]+r[14],B[0]=R[e+3]+r[12],B[1]=R[e+4]+r[13],B[2]=R[e+5]+r[14],y(K,q)<0&&y(K,B)<0||y(Q,q)<0&&y(Q,B)<0||y(Y,q)<0&&y(Y,B)<0||y(Z,q)<0&&y(Z,B)<0)continue;const t=v.projectToRenderScreen(q,W),o=v.projectToRenderScreen(B,X);if(null==t||null==o)continue;if(t[2]<0&&o[2]>0){s(D,q,B);const e=v.frustum,r=-y(e[4],q)/n(D,x(e[4]));if(a(D,D,r),c(q,q,D),!v.projectToRenderScreen(q,t))continue}else if(t[2]>0&&o[2]<0){s(D,B,q);const e=v.frustum,t=-y(e[4],B)/n(D,x(e[4]));if(a(D,D,t),c(B,B,D),!v.projectToRenderScreen(B,o))continue}else if(t[2]<0&&o[2]<0)continue;t[2]=0,o[2]=0;const i=h(g(t,o,F),T);i<A&&(A=i,l(G,q),l(z,B),V=e/3)}if(A<_*_){let e=Number.MAX_VALUE;if(d(g(G,z,F),g(M,w,k),O)){s(O,O,M);const t=m(O);a(O,O,1/t),e=t/u(M,w)}L(e,O,V)}}intersectScreenPolygon(){}intersectRayDraped(e,r,o,i,s){if(!r.options.selectionMode)return;const n=e.attributes.get("position").data,a=e.attributes.get("size"),c=a?a.data[0]:0,l=o[0],m=o[1],u=((c+1)/2+4)*e.screenToWorldRatio;let f=Number.MAX_VALUE,p=0;for(let h=0;h<n.length-5;h+=3){const e=n[h],r=n[h+1],o=l-e,i=m-r,s=n[h+3]-e,a=n[h+4]-r,c=t((s*o+a*i)/(s*s+a*a),0,1),u=s*c-o,g=a*c-i,d=u*u+g*g;d<f&&(f=d,p=h/3)}f<u*u&&i(s.distance,s.normal,p)}createGLMaterial(e){return new P(e)}createBufferWriter(){const e=this.parameters.hasVertexColors?T:_;return new R(e)}}class P extends v{beginSlot(e){return this.getTechnique(A,e)}}class E extends w{constructor(){super(...arguments),this.color=p,this.hasVertexColors=!1,this.hasSlicePlane=!1,this.width=1}}const q=f(),B=f(),D=f(),O=f(),W=r(),X=r(),G=f(),z=f(),F=j(),k=j(),H=f(),I=[r(),r(),r(),r()],J=[f(),f(),f(),f()],K=L(),Q=L(),Y=L(),Z=L();export{U as NativeLineMaterial,E as Parameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as a,BufferViewVec2Snorm16 as o,BufferViewSnorm16 as n,BufferViewFloat16 as h,BufferViewFloat as p}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as g}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as d,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{assert as y}from"../lib/Util.js";import{getLayout as S,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as V,PathTechnique as w}from"./PathTechnique.js";import{PathTechniqueConfiguration as z}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as F}from"./TriangleMaterial.js";import{writeAttributes as j,writePosition as v,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as
|
|
2
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{clone as e}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{fromValues as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as r}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewUint32 as s,BufferViewVec3f as a,BufferViewVec2Snorm16 as o,BufferViewSnorm16 as n,BufferViewFloat16 as h,BufferViewFloat as p}from"../../../../geometry/support/buffer/BufferView.js";import{maxPathFrameIndex as c}from"../../layers/graphics/Graphics3DPathSymbolLayerConstants.js";import{isShadowLike as u,is3DGeometry as f,isColor as l}from"../core/shaderLibrary/ShaderOutput.js";import m from"../lib/GLMaterial.js";import{isPathGeometry as g}from"../lib/PathGeometry.js";import{offsetPathVertexInfoFrameIndex as b}from"../lib/PathVertexInfo.js";import{MeshIntersectionOptions as d,intersectAabbInvDir as _}from"../lib/RayIntersections.js";import{assert as y}from"../lib/Util.js";import{getLayout as S,getTextureLayout as x}from"./PathLayouts.js";import{PathPassParameters as V,PathTechnique as w}from"./PathTechnique.js";import{PathTechniqueConfiguration as z}from"./PathTechniqueConfiguration.js";import{TriangleMaterial as F}from"./TriangleMaterial.js";import{writeAttributes as j,writePosition as v,writeBufferVec2 as M,writeBufferInt16 as C,writeBufferFloat16 as R,writeBufferFloat as P}from"./internal/bufferWriterUtils.js";import{hasShadowHighlights as A}from"../shaders/ReceiveShadowsConfiguration.js";import{alphaCutoff as B}from"../../../../webscene/support/AlphaCutoff.js";class O extends F{constructor(t,e){super(t,I),this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,t=>(this.parameters.castShadows&&u(t)||f(t))&&!this.transparent],[4,t=>(this.parameters.castShadows&&u(t)||f(t))&&this.transparent]]),this._configuration=new z(e.spherical)}get emissions(){return this.parameters.emissiveStrength>0?this.transparent?2:1:0}updateConfiguration(t){super.updateConfiguration(t),this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.transparent,this._configuration.hasOccludees=t.hasOccludees,this._configuration.cullFace=this.parameters.hasSlicePlane?0:this.parameters.cullFace,this._configuration.offsetBackfaces=this.transparent,l(t.output)?(this._configuration.receiveShadows=t.shadowMap.enabled,this._configuration.hasShadowHighlights=A(this._configuration,t),this._configuration.receiveAmbientOcclusion=null!=t.ssao):this._configuration.receiveShadows=this._configuration.hasShadowHighlights=this._configuration.receiveAmbientOcclusion=!1,this._configuration.pbrMode=this.parameters.usePBR?2:0,this._configuration.emissionSource=this.parameters.usePBR?1:0,this._configuration.snowCover=t.snowCover>0,this._configuration.upVectorAlignment=this.parameters.upVectorAlignment,this._configuration.pathCapType=this.parameters.pathCapType,this._configuration.pathProfileType=this.parameters.profile.type}isVisibleForOutput(t){return 5!==t&&7!==t&&6!==t||this.parameters.castShadows}get visible(){return this.parameters.opacity>=B}intersectRay(t,e,i,r,s,a){this._intersect(t,i,r,s,a)}intersectRayDraped(t,e,i,r){return this._pp0[0]=this._pp1[0]=i[0],this._pp0[1]=this._pp1[1]=i[1],this._intersect(t,e,this._pp0,this._pp1,r)}_intersect(i,s,a,o,n){const h=i;if(!g(h))return;const p=h.path,c=e(this.parameters.size);if(this.parameters.vvSize){const{offset:e,factor:i,minSize:r,maxSize:s,fallback:a}=this.parameters.vvSize,o=p.sizeAttributeValue;Number.isNaN(o)?(c[0]*=a[0],c[1]*=a[2]):(c[0]*=t(e[0]+o*i[0],r[0],s[0]),c[1]*=t(e[2]+o*i[2],r[2],s[2]))}const u=new d(s.tolerance,!1,s.options.normalRequired),f=Math.max(c[0],c[1]),l=i.boundingInfo;if(null==l)return void k(p,c,a,o,u,n);const m=r(l.bbMin[0]-f,l.bbMin[1]-f,l.bbMin[2]-f,l.bbMax[0]+f,l.bbMax[1]+f,l.bbMax[2]+f),b=[o[0]-a[0],o[1]-a[1],o[2]-a[2]],y=Math.sqrt(b[0]*b[0]+b[1]*b[1]+b[2]*b[2]),S=[y/b[0],y/b[1],y/b[2]];_(m,a,S,s.tolerance)&&k(p,c,a,o,u,n)}createBufferWriter(){return new U(S(),x(this.parameters))}createGLMaterial(t){return new T(t)}get transparent(){const{parameters:t}=this;return t.drivenOpacity||t.opacity<1}}class T extends m{beginSlot(t){return this.getTechnique(w,t)}}function k(t,e,i,r,s,a){t.baked.size&&t.baked.size[0]===e[0]&&t.baked.size[1]===e[1]||t.baked.bake(e),t.baked.intersect(i,r,s,a)}class I extends V{constructor(){super(...arguments),this.polygonOffset=0,this.castShadows=!0,this.hasSlicePlane=!1,this.drivenOpacity=!1,this.usePBR=!1,this.upVectorAlignment=0,this.pathCapType=1,this.cullFace=2}}class U{constructor(t,e){this.layout=t,this.textureBufferLayout=e,this.maxTextureBufferItemIndex=c}elementCount(t){return t.get("pathVertexInfo")?.indices.length??0}elementCountTextureBuffer(t){return t.get("position")?.indices.length??0}write(t,e,i,r,c,u){y(null!=u,"Texture buffer is required for path material"),j(i,r,this.layout,t,e,c);const f=u.offset,l=u.textureBufferRange.from,m=c.buffer.getField("pathVertexInfo",s),g=i.get("pathVertexInfo");if(m&&g){y(1===g.size);const{data:t,stride:e,indices:i}=g;for(let r=0;r<i.length;++r){const s=t[e*i[r]];m.set(c.offset+r,b(s,l))}}const d=u.buffer.getField("position",a),_=i.get("position");d&&_&&(y(3===_.size),v(_,t,d,f));const S=u.buffer.getField("profileRight",o),x=i.get("profileRight");S&&x&&(y(2===x.size),M(x,S,f));const V=u.buffer.getField("profileUp",o),w=i.get("profileUp");V&&w&&(y(2===w.size),M(w,V,f));const z=u.buffer.getField("profileRotation",n),F=i.get("profileRotation");z&&F&&(y(1===F.size),C(F,z,f));const A=u.buffer.getField("pathRotationUp",o),B=i.get("pathRotationUp");A&&B&&(y(2===B.size),M(B,A,f));const O=u.buffer.getField("pathMaxStretchDistance",h),T=i.get("pathMaxStretchDistance");O&&T&&(y(1===T.size),R(T,O,f));const k=u.buffer.getField("sizeFeatureAttribute",p),I=i.get("sizeFeatureAttribute");k&&I&&P(I,k,f);const U=u.buffer.getField("opacityFeatureAttribute",p),q=i.get("opacityFeatureAttribute");U&&q&&P(q,U,f);const L=u.buffer.getField("colorFeatureAttribute",p),D=i.get("colorFeatureAttribute");L&&D&&P(D,L,f)}}export{I as Parameters,U as PathBufferWriter,O as PathMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as _}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as S,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as O,isColor as R,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>O(e)||R(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>R(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>R(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersect(r,i,s,f,d,g){const{options:b,camera:_,rayBegin:S,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!_)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*_.pixelRatio,M=4*_.pixelRatio,O=C/2+M;n(je[0],L[0]-O,L[1]+O,0),n(je[1],L[0]+O,L[1]+O,0),n(je[2],L[0]+O,L[1]-O,0),n(je[3],L[0]-O,L[1]-O,0);for(let e=0;e<4;e++)if(!_.unprojectFromRenderScreen(je[e],ze[e]))return;z(_.eye,ze[0],ze[1],Te),z(_.eye,ze[1],ze[2],Ae),z(_.eye,ze[2],ze[3],Le),z(_.eye,ze[3],ze[0],Ce);let R=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=_.projectToRenderScreen(le,ge),s=_.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=_.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!_.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=_.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!_.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=R)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,_,j,M);if(n>=e*e)continue}R=n,h(_e,le),h(Se,pe),V=e/3}}if(R<O*O){let e=Number.MAX_VALUE;if(x(y(_e,Se,ve),y(S,v,Pe),fe)){o(fe,fe,S);const t=m(fe);p(fe,fe,1/t),e=t/u(S,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=S,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,S=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],O=0,R=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?O=e.data[0]:R=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=S?(e,t,r)=>Q=S[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=R?.[o]??O;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&_(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&_(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;_(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),_e=b(),Se=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
|
|
2
|
+
import e from"../../../../core/Logger.js";import{clamp as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as r}from"../../../../core/screenUtils.js";import{secondsFromMilliseconds as i,Seconds as s}from"../../../../core/time.js";import{copy as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{set as n,subtract as o,dot as l,scale as p,add as c,copy as h,length as m,distance as u,lerp as f,transformMat4 as d,normalize as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as b}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{set as S}from"../../../../core/libs/gl-matrix-2/math/vec4.js";import{ONES as _,create as v}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{makeFloat16Array as P}from"../../../../geometry/support/float16.js";import{fromPoints as y,distance2 as E,closestLineSegmentPoint as x,projectPointFraction as w,create as j}from"../../../../geometry/support/lineSegment.js";import{fromPoints as z,signedDistance as T,getNormal as A,create as L}from"../../../../geometry/support/plane.js";import{BufferViewUint32 as C,BufferViewVec3f as M}from"../../../../geometry/support/buffer/BufferView.js";import{isHighlightOrOLID as R,isColor as O,isDepth as V,isColorHighlightOLIDOrDepth as F,is2DGeometryOutput as B}from"../core/shaderLibrary/ShaderOutput.js";import{olidEnabled as U}from"../effects/geometry/olidUtils.js";import N from"../lib/GLMaterial.js";import{Material as k}from"../lib/Material.js";import{ScreenSizePerspectiveEvaluator as W}from"../lib/screenSizePerspectiveUtils.js";import{isTranslationMatrix as I,assert as D}from"../lib/Util.js";import{isImagePattern as Y}from"./lineStippleUtils.js";import{VisualVariablePassParameters as J}from"./VisualVariablePassParameters.js";import{writeDeltaF16Vector as q}from"./internal/bufferWriterUtils.js";import{r as X}from"../../../../chunks/RibbonLine.glsl.js";import{getLayout as G,getTextureBufferLayout as H}from"../shaders/RibbonLineLayouts.js";import{RibbonLineTechnique as K}from"../shaders/RibbonLineTechnique.js";import{RibbonLineTechniqueConfiguration as Q}from"../shaders/RibbonLineTechniqueConfiguration.js";import{alphaCutoff as Z}from"../../../../webscene/support/AlphaCutoff.js";class $ extends k{constructor(e,t){super(e,te),this.produces=new Map([[2,e=>R(e)||O(e)&&8===this.parameters.renderOccluded],[3,e=>V(e)],[10,e=>F(e)&&8===this.parameters.renderOccluded],[11,e=>F(e)&&8===this.parameters.renderOccluded],[4,e=>O(e)&&this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[8,e=>O(e)&&!this.parameters.writeDepth&&8!==this.parameters.renderOccluded],[18,e=>B(e)]]),this._configuration=new Q(t)}updateConfiguration(e){super.updateConfiguration(e);const t=18===e.slot,r=null!=this.parameters.stipplePattern&&null!=this.parameters.stippleTexture&&10!==e.output,i=r&&t&&this.parameters.isImagePattern();this._configuration.draped=t,this._configuration.polygonOffset=this.parameters.polygonOffset,this._configuration.stippleEnabled=r,this._configuration.stippleOffColorEnabled=r&&null!=this.parameters.stippleOffColor,this._configuration.stipplePreferContinuous=r&&this.parameters.stipplePreferContinuous,this._configuration.numJoinSubdivisions=ne(this.parameters.join,r),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.roundJoins="round"===this.parameters.join,this._configuration.capType=this.parameters.cap,this._configuration.applyMarkerOffset=null!=this.parameters.markerParameters&&ae(this.parameters.markerParameters),this._configuration.polygonOffsetIndex=this.parameters.polygonOffsetIndex,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.hasVVSize=this.parameters.hasVVSize,this._configuration.hasVVColor=this.parameters.hasVVColor,this._configuration.hasVVOpacity=this.parameters.hasVVOpacity,this._configuration.innerColorEnabled=this.parameters.innerWidth>0&&null!=this.parameters.innerColor,this._configuration.falloffEnabled=this.parameters.falloff>0,this._configuration.hasOccludees=e.hasOccludees,this._configuration.occluder=8===this.parameters.renderOccluded,this._configuration.wireframe=this.parameters.wireframe,this._configuration.animation=this.parameters.animation,this._configuration.emissionSource=this.emissions?1:0,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective&&!i,this._configuration.worldSizedImagePattern=i}get visible(){return this.parameters.color[3]>=Z||null!=this.parameters.stipplePattern&&(this.parameters.stippleOffColor?.[3]??0)>Z}get emissions(){return this.parameters.emissiveStrength>0?8!==this.parameters.renderOccluded?2:1:0}setParameters(e,t){e.animation=this.parameters.animation,super.setParameters(e,t)}intersectScreenPolygon(){}intersectRayDraped({attributes:e,screenToWorldRatio:r},i,s,a,n){if(!i.options.selectionMode)return;const o=e.get("size");let l=this.parameters.width;if(this.parameters.vvSize){const r=e.get("sizeFeatureAttribute").data[0];Number.isNaN(r)?l*=this.parameters.vvSize.fallback[0]:l*=t(this.parameters.vvSize.offset[0]+r*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0])}else o&&(l*=o.data[0]);const p=s[0],c=s[1],h=(l/2+4)*r;let m=Number.MAX_VALUE,u=0;const f=e.get("position").data,d=se(this.parameters,e)?f.length-2:f.length-5;for(let g=0;g<d;g+=3){const e=f[g],r=f[g+1],i=(g+3)%f.length,s=p-e,a=c-r,n=f[i]-e,o=f[i+1]-r,l=t((n*s+o*a)/(n*n+o*o),0,1),h=n*l-s,d=o*l-a,b=h*h+d*d;b<m&&(m=b,u=g/3)}m<h*h&&a(n.distance,n.normal,u)}intersectRay(r,i,s,f,d,g){const{options:b,camera:S,rayBegin:_,rayEnd:v}=s;if(!b.selectionMode||!r.visible||!S)return;if(!I(i))return void e.getLogger("esri.views.3d.webgl-engine.materials.RibbonLineMaterial").error("intersection assumes a translation-only matrix");const P=r.attributes,w=P.get("position").data;let j=this.parameters.width;if(this.parameters.vvSize){const e=P.get("sizeFeatureAttribute").data[0];Number.isNaN(e)||(j*=t(this.parameters.vvSize.offset[0]+e*this.parameters.vvSize.factor[0],this.parameters.vvSize.minSize[0],this.parameters.vvSize.maxSize[0]))}else P.has("size")&&(j*=P.get("size").data[0]);const L=de;a(L,s.point);const C=j*S.pixelRatio,M=4*S.pixelRatio,R=C/2+M;n(je[0],L[0]-R,L[1]+R,0),n(je[1],L[0]+R,L[1]+R,0),n(je[2],L[0]+R,L[1]-R,0),n(je[3],L[0]-R,L[1]-R,0);for(let e=0;e<4;e++)if(!S.unprojectFromRenderScreen(je[e],ze[e]))return;z(S.eye,ze[0],ze[1],Te),z(S.eye,ze[1],ze[2],Ae),z(S.eye,ze[2],ze[3],Le),z(S.eye,ze[3],ze[0],Ce);let O=Number.MAX_VALUE,V=0;const F=se(this.parameters,P)?w.length-2:w.length-5;for(let e=0;e<F;e+=3){le[0]=w[e]+i[12],le[1]=w[e+1]+i[13],le[2]=w[e+2]+i[14];const t=(e+3)%w.length;if(pe[0]=w[t]+i[12],pe[1]=w[t+1]+i[13],pe[2]=w[t+2]+i[14],T(Te,le)<0&&T(Te,pe)<0||T(Ae,le)<0&&T(Ae,pe)<0||T(Le,le)<0&&T(Le,pe)<0||T(Ce,le)<0&&T(Ce,pe)<0)continue;const r=S.projectToRenderScreen(le,ge),s=S.projectToRenderScreen(pe,be);if(null==r||null==s)continue;if(r[2]<0&&s[2]>0){o(ue,le,pe);const e=S.frustum,t=-T(e[4],le)/l(ue,A(e[4]));if(p(ue,ue,t),c(le,le,ue),!S.projectToRenderScreen(le,r))continue}else if(r[2]>0&&s[2]<0){o(ue,pe,le);const e=S.frustum,t=-T(e[4],pe)/l(ue,A(e[4]));if(p(ue,ue,t),c(pe,pe,ue),!S.projectToRenderScreen(pe,s))continue}else if(r[2]<0&&s[2]<0)continue;r[2]=0,s[2]=0;const a=y(r,s,ve),n=E(a,L);if(!(n>=O)){if(this.parameters.screenSizePerspective){const e=this.computeScreenSizePerspectiveWidth(a,le,pe,L,S,j,M);if(n>=e*e)continue}O=n,h(Se,le),h(_e,pe),V=e/3}}if(O<R*R){let e=Number.MAX_VALUE;if(x(y(Se,_e,ve),y(_,v,Pe),fe)){o(fe,fe,_);const t=m(fe);p(fe,fe,1/t),e=t/u(_,v)}g(e,fe,V)}}createBufferWriter(){return new re(G(this.parameters),H(this.parameters),this.parameters)}createGLMaterial(e){return new ee(e)}validateParameters(e){"miter"!==e.join&&(e.miterLimit=0),null!=e.markerParameters&&(e.markerScale=e.markerParameters.width/e.width)}update(e){return!!this.parameters.hasAnimation&&(this.setParameters({timeElapsed:i(e.time)},!1),0!==e.dt)}computeScreenSizePerspectiveWidth(e,t,r,i,s,a,n){const o=w(e,i);f(ce,t,r,o),d(he,ce,s.viewMatrix);const l=m(he),p=this.computeCameraAbsCosAngle(ce,s,this._configuration.spherical);oe.update(p,l,this.parameters.screenSizePerspective,this.parameters.screenSizePerspectiveMinPixelReferenceSize);return oe.apply(a)*s.pixelRatio/2+n}computeCameraAbsCosAngle(e,t,r){return r?g(fe,e):n(fe,0,0,1),o(me,e,t.eye),g(me,me),Math.abs(l(fe,me))}}class ee extends N{constructor(){super(...arguments),this._stipplePattern=null}dispose(){super.dispose(),this._stippleTextures?.release(this._stipplePattern),this._stipplePattern=null}beginSlot(e){const{stipplePattern:t}=this._material.parameters;return this._stipplePattern!==t&&(this._material.setParameters({stippleTexture:this._stippleTextures.swap(t,this._stipplePattern)}),this._stipplePattern=t),this.getTechnique(K,e)}}class te extends J{constructor(){super(...arguments),this._width=0,this.color=_,this.join="miter",this.cap=0,this.miterLimit=5,this.writeDepth=!0,this.polygonOffset=0,this.polygonOffsetIndex=0,this.stippleTexture=null,this.stipplePreferContinuous=!0,this.markerParameters=null,this.markerScale=1,this.hasSlicePlane=!1,this.vvFastUpdate=!1,this.isClosed=!1,this.falloff=0,this.innerWidth=0,this.wireframe=!1,this.timeElapsed=s(0),this.animation=0,this.animationSpeed=1,this.trailLength=1,this.startTime=s(0),this.endTime=s(1/0),this.emissiveStrength=0}get width(){return this.isImagePattern()?this.stipplePattern.width:this._width}set width(e){this._width=e}get transparent(){return this.color[3]<1||this.hasAnimation||null!=this.stipplePattern&&(this.stippleOffColor?.[3]??0)<1}get hasAnimation(){return 0!==this.animation}isImagePattern(){return Y(this.stipplePattern)&&null!=this.stippleTexture}}class re{constructor(e,t,r){this.layout=e,this.textureBufferLayout=t,this._parameters=r,this.numJoinSubdivisions=ne(this._parameters.join,null!=this._parameters.stipplePattern)}_isClosed(e){return se(this._parameters,e)}allocate(e){return this.layout.createBuffer(e)}elementCountTextureBuffer(e){return e.get("position").data.length/3}elementCount(e){const t=2,r=e.get("position").indices.length/2+1,i=this._isClosed(e);let s=i?2:2*t;return s+=((i?r:r-1)-(i?0:1))*(2*this.numJoinSubdivisions+4),s+=2,this._parameters.wireframe&&(s=2+4*(s-2)),s}write(e,t,r,i,s,a){const{buffer:o,offset:l}=s,{layout:p,textureBufferLayout:c}=this,m=r.get("position"),f=m.indices,g=m.data.length/3,b=g,_=r.get("distanceToStart")?.data;f&&f.length!==2*(g-1)&&console.warn("RibbonLineMaterial does not support indices");const v=o.getField("textureElementIndex",C);D(null!=v,"Missing texture buffer index field"),D(null!==a,"Expected texture buffer target"),D(null!==c,"Expected valid textureBufferLayout");const{textureBufferRange:y,offset:E}=a;D(null!=y,"Using a texture layout, but the texture range for this instance was not provided");const x=y.from;D(y.numElements===b,"Expected number of elements in TextureBuffer to equal number of points");const{buffer:w}=a,j=w.getField("position",M);D(null!==j,"Expected valid position field in texture buffer");const z=p.fields.has("sizeFeatureAttribute");let T=1,A=null;if(z){const e=r.get("sizeFeatureAttribute");1===e.data.length?T=e.data[0]:A=e.data}else T=r.get("size")?.data[0]??1;let L=[1,1,1,1],R=0,O=null;const V=p.fields.has("colorFeatureAttribute");if(V){const e=r.get("colorFeatureAttribute");1===e.data.length?R=e.data[0]:O=e.data}else L=r.get("color")?.data??L;const F=r.get("timeStamps")?.data,B=F&&p.fields.has("timeStamps"),N=p.fields.has("opacityFeatureAttribute");let k=0,W=null;if(N){const e=r.get("opacityFeatureAttribute");1===e.data.length?k=e.data[0]:W=e.data}const I=new Float32Array(o.buffer),Y=P(o.buffer),J=new Uint8Array(o.buffer),X=new Uint32Array(o.buffer),G=p.stride/4;let H=l*G;const K=H;let Q=0;const Z=_?(e,t,r)=>Q=_[r]:(e,t,r)=>Q+=u(e,t),$=I.BYTES_PER_ELEMENT/Y.BYTES_PER_ELEMENT,ee=4/$,te=U(),re=(e,t,r,s,a,n,o,l)=>{const p=o;X[H]=x+p,H++,j.setVec(E+p,t),q(e,t,Y,H*$),H+=ee,q(r,t,Y,H*$),H+=ee,I[H++]=l;let c=H*$;if(Y[c++]=a,Y[c++]=n,H=Math.ceil(c/$),V)I[H]=O?.[o]??R;else{const e=Math.min(4*o,L.length-4),t=4*H;J[t]=255*L[e],J[t+1]=255*L[e+1],J[t+2]=255*L[e+2],J[t+3]=255*L[e+3]}if(H++,I[H++]=A?.[o]??T,N&&(I[H++]=W?.[o]??k),te){let e=4*H;i?(J[e++]=i[0],J[e++]=i[1],J[e++]=i[2],J[e++]=i[3]):(J[e++]=0,J[e++]=0,J[e++]=0,J[e++]=0),H=Math.ceil(.25*e)}B&&(c=H*$,Y[c++]=s[0],Y[c++]=s[1],Y[c++]=s[2],Y[c++]=s[3],H=Math.ceil(c/$))};H+=G,n(Ee,m.data[0],m.data[1],m.data[2]),B&&S(we,F[0],F[1],F[2],F[3]),e&&d(Ee,Ee,e);const se=this._isClosed(r);if(se){const t=m.data.length-3;n(ye,m.data[t],m.data[t+1],m.data[t+2]),e&&d(ye,ye,e)}else n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),re(Ee,Ee,xe,we,1,-4,0,0),re(Ee,Ee,xe,we,1,4,0,0),h(ye,Ee),h(Ee,xe),B&&S(we,F[4],F[5],F[6],F[7]);const ae=se?0:1,ne=se?g:g-1;for(let u=ae;u<ne;u++){const t=(u+1)%g*3;n(xe,m.data[t],m.data[t+1],m.data[t+2]),e&&d(xe,xe,e),Z(ye,Ee,u),re(ye,Ee,xe,we,0,-1,u,Q),re(ye,Ee,xe,we,0,1,u,Q);const r=this.numJoinSubdivisions;for(let e=0;e<r;++e){const t=(e+1)/(r+1);re(ye,Ee,xe,we,t,-1,u,Q),re(ye,Ee,xe,we,t,1,u,Q)}if(re(ye,Ee,xe,we,1,-2,u,Q),re(ye,Ee,xe,we,1,2,u,Q),h(ye,Ee),h(Ee,xe),B){const e=(u+1)%g*4;S(we,F[e],F[e+1],F[e+2],F[e+3])}}se?(n(xe,m.data[3],m.data[4],m.data[5]),e&&d(xe,xe,e),Q=Z(ye,Ee,ne),re(ye,Ee,xe,we,0,-1,ae,Q),re(ye,Ee,xe,we,0,1,ae,Q)):(Q=Z(ye,Ee,ne),re(ye,Ee,Ee,we,0,-5,ne,Q),re(ye,Ee,Ee,we,0,5,ne,Q)),ie(I,K+G,I,K,G);H=ie(I,H-G,I,H,G),this._parameters.wireframe&&this._addWireframeVertices(o,K,H,G)}_addWireframeVertices(e,t,r,i){const s=new Uint8Array(e.buffer,r*Float32Array.BYTES_PER_ELEMENT),a=new Uint8Array(e.buffer,t*Float32Array.BYTES_PER_ELEMENT,(r-t)*Float32Array.BYTES_PER_ELEMENT),n=i*Float32Array.BYTES_PER_ELEMENT;let o=0;const l=e=>o=ie(a,e,s,o,n);for(let p=0;p<=a.length-4*n;p+=2*n)l(p),l(p+2*n),l(p+1*n),l(p+2*n),l(p+1*n),l(p+3*n)}}function ie(e,t,r,i,s){for(let a=0;a<s;a++)r[i++]=e[t++];return i}function se(e,t){if(!e.isClosed)return!1;return t.get("position").indices.length>2}function ae(e){return 1===e.anchor&&e.hideOnShortSegments&&"begin-end"===e.placement&&e.worldSpace}function ne(e,t){const r=t?1:0;switch(e){case"miter":case"bevel":return r;case"round":return X+r}}const oe=new W,le=b(),pe=b(),ce=b(),he=b(),me=b(),ue=b(),fe=b(),de=b(),ge=r(),be=r(),Se=b(),_e=b(),ve=j(),Pe=j(),ye=b(),Ee=b(),xe=b(),we=v(),je=[r(),r(),r(),r()],ze=[b(),b(),b(),b()],Te=L(),Ae=L(),Le=L(),Ce=L();export{te as Parameters,$ as RibbonLineMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{normalize as e,set as t,scale as r,add as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{intersectWithPolygonOffset as g}from"./PolygonOffset.js";import{writeAttributes as b,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as _,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as
|
|
2
|
+
import{normalize as e,set as t,scale as r,add as s}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as i,create as a}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as o}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{center as n,scale as p}from"../../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as c}from"../../../../geometry/support/buffer/BufferView.js";import{isColorOrOLID as h}from"../core/shaderLibrary/ShaderOutput.js";import l from"../lib/GLMaterial.js";import{Material as f,MaterialParameters as m}from"../lib/Material.js";import{intersectTriangleGeometry as u}from"../lib/RayIntersections.js";import{assert as d}from"../lib/Util.js";import{intersectWithPolygonOffset as g}from"./PolygonOffset.js";import{writeAttributes as b,writePosition as S}from"./internal/bufferWriterUtils.js";import{getLayout as _,ShadedColorMaterialTechnique as j}from"../shaders/ShadedColorMaterialTechnique.js";import{ShadedColorMaterialTechniqueConfiguration as w}from"../shaders/ShadedColorMaterialTechniqueConfiguration.js";import{alphaCutoff as y}from"../../../../webscene/support/AlphaCutoff.js";class x extends f{constructor(e){super(e,E),this._configuration=new w,this.supportsEdges=!0,this._pp0=i(0,0,1),this._pp1=i(0,0,0),this.produces=new Map([[2,e=>10===e||h(e)&&!this.parameters.transparent],[4,e=>h(e)&&this.parameters.transparent&&this.parameters.writeDepth],[8,e=>h(e)&&this.parameters.transparent&&!this.parameters.writeDepth]])}updateConfiguration(e){super.updateConfiguration(e),this._configuration.cullFace=this.parameters.cullFace,this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.transparent=this.parameters.transparent,this._configuration.writeDepth=this.parameters.writeDepth,this._configuration.screenSizeEnabled=this.parameters.screenSizeEnabled,this._configuration.shadingEnabled=this.parameters.shadingEnabled}get visible(){return this.parameters.color[3]>=y}intersectRay(e,t,r,s,i,a){this._intersect(e,r,s,i,a)}intersectScreenPolygon(){}intersectRayDraped(e,t,r,s){return this._pp0[0]=this._pp1[0]=r[0],this._pp0[1]=this._pp1[1]=r[1],this._intersect(e,t,this._pp0,this._pp1,s)}_intersect(e,i,a,o,c){const h=g(c,this._configuration,a,o);if(this.parameters.screenSizeEnabled){const c=e.attributes.get("offset"),l={applyToVertex:(e,a,o,n)=>{const p=t(T,c.data[3*n],c.data[3*n+1],c.data[3*n+2]),h=t(C,e,a,o);return r(p,p,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(p)??1)),s(h,h,p),[h[0],h[1],h[2]]},applyToAabb:e=>{const t=n(e,T);return p(e,this.parameters.screenSizeScale*(i.camera?.computeScreenPixelSizeAt(t)??1))}};u(e,i,a,o,l,h)}else u(e,i,a,o,void 0,h)}createGLMaterial(e){return new z(e)}createBufferWriter(){return new M(_(this.parameters))}}class z extends l{beginSlot(e){return this.getTechnique(j,e)}}class E extends m{constructor(){super(...arguments),this.color=o(1,1,1,1),this.shadingTint=o(0,0,0,.25),this.shadingDirection=e(a(),[.5,-.5,-.5]),this.screenSizeScale=14,this.forceTransparentMode=!1,this.writeDepth=!0,this.hasSlicePlane=!1,this.cullFace=0,this.screenSizeEnabled=!1,this.shadingEnabled=!0}get transparent(){return this.color[3]<1||this.forceTransparentMode}}class M{constructor(e){this.layout=e}elementCount(e){return e.get("position").indices.length}write(e,t,r,s,i){const{buffer:a,offset:o}=i;b(r,s,this.layout,e,t,i);const n=a.getField("offset",c);if(n&&r.has("offset")){const e=r.get("offset");d(3===e.size),S(e,t,n,o)}}}const T=a(),C=a();export{E as Parameters,x as ShadedColorMaterial};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as n,intersectTriangleGeometry2D as r}from"../lib/RayIntersections.js";import{intersectWithPolygonOffset as s}from"./PolygonOffset.js";class o extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}
|
|
2
|
+
import{Material as t,MaterialParameters as e}from"../lib/Material.js";import{intersectTriangleGeometry as n,intersectTriangleGeometry2D as r}from"../lib/RayIntersections.js";import{intersectWithPolygonOffset as s}from"./PolygonOffset.js";class o extends t{updateConfiguration(t){super.updateConfiguration(t),this._configuration.transparent=this.transparent,this._configuration.enableOITOffset=t.enableOITOffset,this._configuration.polygonOffset=this.parameters.polygonOffset}intersectRay(t,e,r,o,i,a){return a=s(a,this._configuration,o,i),n(t,r,o,i,null,a)}intersectScreenPolygon(){}intersectRayDraped(t,e,n,s){return r(n[0],n[1],t,s)}}class i extends e{constructor(){super(...arguments),this.polygonOffset=0}}export{o as TriangleMaterial,i as TriangleMaterialParameters};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{maxUint8 as t,maxUint16 as r,maxUint32 as e}from"../../../../../core/typedArrayUtil.js";import{assert as i}from"../../lib/Util.js";import{DataType as s}from"../../../../webgl/enums.js";class a{constructor(i){switch(this.bufferConstructor=i,i){case Uint8Array:this.dataType=s.UNSIGNED_BYTE,this.primitiveRestart=t;break;case Uint16Array:this.dataType=s.UNSIGNED_SHORT,this.primitiveRestart=r;break;default:this.dataType=s.UNSIGNED_INT,this.primitiveRestart=e}}get stride(){return this.bufferConstructor.BYTES_PER_ELEMENT}createView(t,r){return new this.bufferConstructor(t,r)}}const n=new a(Uint8Array),u=new a(Uint16Array),c=new a(Uint32Array);function o(t){switch(t){case s.UNSIGNED_BYTE:return n;case s.UNSIGNED_SHORT:return u;case s.UNSIGNED_INT:case void 0:case null:return c;default:i(!1,`Invalid dataType ${t}`)}}function N(t){return o(t).stride}function f(e){return null==e?c:e<t?n:e<r?u:c}export{a as IndexLayout,o as getIndexLayoutForDataType,f as getIndexLayoutForMaxIndex,N as getStrideForDataType};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as s,filterInPlace as o}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{NestedMap as r}from"../../../../../core/NestedMap.js";import{nullUid as a}from"../../../../../core/uid.js";import{property as i,subclass as
|
|
2
|
+
import{__decorate as e}from"tslib";import t from"../../../../../core/Accessor.js";import{removeUnordered as s,filterInPlace as o}from"../../../../../core/arrayUtils.js";import"../../../../../core/has.js";import{getOrCreateMapValue as n}from"../../../../../core/MapUtils.js";import{NestedMap as r}from"../../../../../core/NestedMap.js";import{nullUid as a}from"../../../../../core/uid.js";import{property as i,subclass as c}from"../../../../../core/accessorSupport/decorators.js";import{assert as l}from"../../lib/Util.js";import{bufferRangePool as f,mergeAdjacentRanges as u}from"./BufferRange.js";import{PerBaseInstanceData as d}from"./PerBaseInstanceData.js";import{PerBufferData as h,hasVao as m}from"./PerBufferData.js";import{PerOriginData as p}from"./PerOriginData.js";import{VaoWriter as g}from"./VaoWriter.js";let y=class extends t{constructor(e){super(e),this._vaoWriter=null,this._useMetalWorkaround=!1,this._hasOccludees=!1}destroy(){for(const e of this.dataByBaseInstance.values()){for(const t of e.dataByOrigin.values())for(const e of t.buffers)this._vaoWriter?.deleteBuffer(e);e.dispose()}this.dataByBaseInstance.clear(),this.uninitializeRenderContext()}initializeRenderContext(e){this._useMetalWorkaround=e.renderContext.rctx.isAssumedMetalDriver,this._vaoWriter=new g(this.material,e.renderContext.rctx)}uninitializeRenderContext(){this._useMetalWorkaround=!1,this._vaoWriter=null}get hasOccludees(){return this._hasOccludees}modify(e,t){this._applyUpdates(e,t),this._applyAddsAndRemoves(e),this._updateDrawCommands()}get canCompact(){for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())if(t.buffers.some(e=>e.holes.geometry.length>1))return!0;return!1}compact(e){if(!this.canCompact)return!1;let t=!1;for(const o of this.dataByBaseInstance.values())for(const n of o.dataByOrigin.values()){const r=new Array;for(let t=0;t<n.buffers.length&&!e.done;){const o=n.buffers[t];o.holes.geometry.length<=1?++t:(o.instances.forEach(({geometry:e})=>r.push(e)),this._vaoWriter?.deleteBuffer(o),s(n.buffers,o,void 0,{last:t}),e.madeProgress())}if(r.length>0){const{baseInstanceData:e}=o;for(const t of n.buffers)this._applyAdds(e,t,r),t.updateDirtyDrawCommands(this.highlightOrderMap);const s=null!=e;for(;r.length>0;)n.buffers.push(this._applyAndRebuild(e,new h(s,this._vaoWriter.targetBuffers),r,null));t=!0}}return t}updateHighlights(e){this.highlightOrderMap=e;for(const t of this.dataByBaseInstance.values())for(const s of t.dataByOrigin.values())for(const t of s.buffers)t.updateHighlights(e)}_applyUpdates(e,t){const o=this._vaoWriter;if(null==o)return void e.clearUpdates();let n;const r=this._useMetalWorkaround?(e,t)=>{n??=new Map;let s=n.get(t);s||(s=[],n.set(t,s)),s.push(e)}:(e,t)=>o.updateInstance(e,t);for(const i of e.updates){if(t.done)return;const{renderGeometry:o,updateType:n}=i;s(e.pending.updates,i),t.madeProgress();const c=this.dataByBaseInstance.get(o.geometry.baseGeometry?.id??a),l=c?.dataByOrigin.get(o.localOrigin.id)?.findBuffer(o.id);if(null==l)return;const f=l.instances.get(o.id);6&n&&r(f,l),25&n&&(l.drawCommandsDirty=!0)}n&&o.updateInstancesMetal(n)}_computeDeltas(e,t){const s=new Map;for(const o of e){const e=o.localOrigin;if(null==e)continue;const t=o.geometry.baseGeometry,r=n(s,t??null,I);let a=r.get(e,null);null==a&&(a=new v(e.vec3,t),r.set(e,null,a)),a.changes.push(o)}for(const o of t){const e=o.localOrigin;if(null==e)continue;const t=o.geometry.baseGeometry,r=this.dataByBaseInstance.get(t?.id??a),i=r?.dataByOrigin.get(e.id)?.findBuffer(o.id);if(null==i)continue;const c=n(s,t??null,I);let l=c.get(e,i);null==l&&(l=new v(e.vec3,t),c.set(e,i,l)),l.changes.push(o)}return s}_applyAddsAndRemoves(e){const{_vaoWriter:t,dataByBaseInstance:o}=this;if(null==t)return void e.clearAddsAndRemoves();const r=this._computeDeltas(e.adds,e.removes);for(const[i,c]of r){const e=n(o,i?.id??a,()=>new d(t.createBaseInstanceData(i)));for(const[o,r]of c.outerMap()){const a=r.get(null),i=a?.changes??[];c.delete(o,null);const f=n(e.dataByOrigin,o.id,()=>new p(o.vec3));for(const[n,u]of r){if(c.delete(o,n),null==n&&l(!1,"No VAO for removed geometries"),n.instances.size===u.changes.length){t.deleteBuffer(n),s(f.buffers,n),0===f.buffers.length&&0===i.length&&e.dataByOrigin.delete(o.id);continue}switch(t.evaluateBufferAllocation(n.numElements.geometry,i,u.changes,n)){case 0:u.changes.forEach(({id:e})=>n.deleteInstance(e)),n.instances.forEach(({geometry:e})=>i.push(e)),t.deleteBuffer(n),s(f.buffers,n);break;case 1:this._applyAndRebuild(e.baseInstanceData,n,i,u);break;case 2:this._applyRemoves(n,u)}}if(i.length>0){const{baseInstanceData:s}=e,o=null!=s;for(const e of f.buffers)this._applyAdds(s,e,i);const{targetBuffers:n}=t;for(;i.length>0;)f.buffers.push(this._applyAndRebuild(s,new h(o,n),i,null))}}0===e.dataByOrigin.size&&(e.dispose(),o.delete(e.id))}e.clearAddsAndRemoves()}_updateDrawCommands(){this._hasOccludees=!1;for(const e of this.dataByBaseInstance.values())for(const t of e.dataByOrigin.values())for(const e of t.buffers)e.updateDirtyDrawCommands(this.highlightOrderMap),this._hasOccludees||=e.hasOccludees}_applyAndRebuild(e,t,s,o){if(o)for(const l of o.changes)t.deleteInstance(l.id);const n=this._vaoWriter,{targetBuffers:r}=n,a={},i={};for(const l of r)a[l]=n.maxElements(l),i[l]=t.numElements[l];for(;s.length>0;){const e=s.pop(),o={};for(const t of r)o[t]=n.elementCount(e.geometry,t);if(r.some(e=>i[e]+o[e]>a[e]&&i[e]>0)){s.push(e);break}for(const t of r)i[t]+=o[t];t.createInstance(e,this.highlightOrderMap)}t.resetInstanceSummary(),n.reallocateBuffer(e,t,i);const c=n.rebuildInstances(i,t.writeableInstances.values(),t);t.updateInstances(),t.clearHoles();for(const l of r)t.holes[l].push(f.acquire(c[l],t.endElements[l]));return t.updateDrawCommands(this.highlightOrderMap),t}_applyRemoves(e,t){const{_vaoWriter:s}=this;if(0===t.changes.length||null==s)return;const{targetBuffers:o}=s,n={},r={};for(const a of o)n[a]=[],r[a]=f.acquire(1/0,-1/0);for(const a of t.changes){const t=a.id,s=e.instances.get(t);if(s){if(this._useMetalWorkaround)for(const e of o){const t=s.targetRanges[e],o=r[e];o.from=Math.min(o.from,t.from),o.to=Math.max(o.to,t.to)}for(const e of o){const t=s.targetRanges[e],o=n[e],r=o.at(-1);r?.to===t.from?r.to=t.to:r?.from===t.to?r.from=t.from:o.push(f.acquire(t.from,t.to))}e.deleteInstance(t)}}for(const a of o)u(n[a]);this._useMetalWorkaround?s.clearHolesMetal(e.instances.values(),r,e):s.clearHoles(n,e);for(const a of o)f.release(r[a]);for(const a of o){const t=e.holes[a];for(const e of n[a])t.push(e)}e.drawCommandsDirty=!0}_applyAdds(e,t,s){if(0===s.length||null==this._vaoWriter)return;if(!m(t))return void this._applyAndRebuild(e,t,s,null);const n=this._vaoWriter,{targetBuffers:r}=n,a={};for(const o of r){const e=t.numElements[o],r=s.reduce((e,{geometry:t})=>e+n.elementCount(t,o),0);a[o]=Math.min(e+r,n.maxElements(o))}if(n.canGrow(t,a))return void this._applyAndRebuild(e,t,s,null);t.mergeHoles();const i={},c={};for(const o of r)i[o]=[],c[o]=f.acquire(1/0,-1/0);for(const{geometry:o}of s){const e={},s={};for(const a of r)e[a]=n.elementCount(o,a),s[a]=_(t.holes[a],e[a]);if(r.every(e=>null!=s[e]))for(const o of r){const n=s[o],r=b(t.holes[o],n,e[o]);if(i[o].push(r),this._useMetalWorkaround){const t=c[o];t.from=Math.min(t.from,r),t.to=Math.max(t.to,r+e[o])}}else for(const t of r)i[t].push(null)}const l=this._addInstances(s,t,i);if(this._useMetalWorkaround){if(r.some(e=>!Number.isFinite(c[e].from)||!Number.isFinite(c[e].to)))return;for(const e of l);n.writeInstanceRangeMetal(c,t.instances.values(),t)}else n.writeRandomInstances(a,l,t);o(s,(e,t)=>r.some(e=>null==i[e][t]))}*_addInstances(e,t,s){const o=e.length,n=this._vaoWriter,{targetBuffers:r}=n;for(let a=0;a<o;++a){const o=e[a];if(r.some(e=>null==s[e][a]))continue;const i={};for(const e of r){const t=s[e][a];i[e]=f.acquire(t,t+n.elementCount(o.geometry,e))}const c=t.createInstance(o,this.highlightOrderMap,i);t.drawCommandsDirty=!0,yield c}}static prune(){g.prune()}get test(){}};e([i({constructOnly:!0})],y.prototype,"dataByBaseInstance",void 0),e([i({constructOnly:!0})],y.prototype,"material",void 0),e([i()],y.prototype,"highlightOrderMap",void 0),y=e([c("esri.views.3d.webgl-engine.materials.renderers.MergedBuffer")],y);class v{constructor(e,t){this.origin=e,this.baseInstance=t,this.changes=new Array}}const B=Symbol("no-op");function _(e,t){return 0===t?B:e.find(e=>e.numElements>=t)}function b(e,t,o){if(t===B)return 0;const n=t.from;return t.from+=o,t.numElements<=0&&(s(e,t),f.release(t)),n}function I(){return new r}export{y as MergedBuffer};
|