@arcgis/core 4.34.0-next.80 → 4.34.0-next.81
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/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementDisplayUnits.js +5 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.d.ts +4 -0
- package/analysis/VolumeMeasurement/VolumeMeasurementInputUnits.js +5 -0
- package/analysis/VolumeMeasurementAnalysis.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{c90571063bd2bb57a5a7.js → 1d491447b13f2f2b4399.js} +1 -1
- package/assets/esri/core/workers/chunks/264a9a916e1e972b69d7.js +1 -0
- package/assets/esri/core/workers/chunks/30c85a1a4f118cc45a25.js +1 -0
- package/assets/esri/core/workers/chunks/3192b68675ff2afcb1d6.js +1 -0
- package/assets/esri/core/workers/chunks/365d63c2aed3a49918f2.js +1 -0
- package/assets/esri/core/workers/chunks/3ef8a7468d7e3b2f0b69.js +351 -0
- package/assets/esri/core/workers/chunks/{ede479faa4e6920fe673.js → a99752aec4602b5eeeaf.js} +6 -6
- package/assets/esri/core/workers/chunks/{b815c2f61fb9c58a2956.js → b6c4712e00fce87bd0f4.js} +1 -1
- package/assets/esri/core/workers/chunks/{22bd4255b6b511a43b66.js → c2bc70b65f5c2a2c9671.js} +1 -1
- package/assets/esri/core/workers/chunks/cc579c94438f48a0dbab.js +1 -0
- package/assets/esri/core/workers/chunks/f6513ec888a7d927d948.js +1 -0
- package/assets/esri/core/workers/chunks/{23a13fbab9984953a7c6.js → fc06014fb484fc8c697e.js} +1 -1
- package/assets/esri/libs/dracoMeshDecoder/draco_mesh_decoder.wasm +0 -0
- package/chunks/GaussianSplat.glsl.js +2 -2
- package/chunks/HUDMaterial.glsl.js +4 -6
- package/chunks/draco_mesh_decoder.js +5 -0
- package/config.js +1 -1
- package/core/unitUtils.js +1 -1
- package/interfaces.d.ts +116 -12
- package/kernel.js +1 -1
- package/layers/CSVLayer.js +1 -1
- package/layers/FeatureLayer.js +1 -1
- package/layers/IntegratedMesh3DTilesLayer.js +1 -1
- package/layers/OrientedImageryLayer.js +1 -1
- package/layers/support/FieldConfiguration.js +1 -1
- package/libs/dracoMeshDecoder/dracoMeshDecoder.js +5 -0
- package/package.json +1 -1
- package/portal/schemas/definitions.js +1 -1
- package/rest/featureService/FeatureService.js +1 -1
- package/support/revision.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementCutFillController.js +1 -1
- package/views/3d/analysis/VolumeMeasurement/VolumeMeasurementShiftTool.js +1 -1
- package/views/3d/analysis/VolumeMeasurementAnalysisView3D.js +1 -1
- package/views/3d/glTF/internal/Resource.js +1 -1
- package/views/3d/glTF/loader.js +1 -1
- package/views/3d/layers/FlowSubView3D.js +1 -1
- package/views/3d/layers/GaussianSplatLayerView3D.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorker.js +1 -1
- package/views/3d/layers/graphics/pipeline/Feature3DPipelineWorkerHandle.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/DirectRenderer.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/FeaturePipelineRenderManager.js +1 -1
- package/views/3d/layers/graphics/pipeline/rendering/RenderCommandContext.js +1 -1
- package/views/3d/layers/graphics/pipeline/symbolization/IconSymbolLayerRenderer.js +1 -1
- package/views/3d/layers/support/HeatmapFeatureProcessor.js +1 -1
- package/views/3d/support/buffer/InterleavedLayout.js +1 -1
- package/views/3d/support/flow/FlowSubViewTiles3D.js +1 -1
- package/views/3d/support/flow/constants.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatDataStore.js +1 -1
- package/views/3d/support/gaussianSplatting/GaussianSplatQualitySettings.js +5 -0
- package/views/3d/support/gaussianSplatting/GaussianSplatTextureAtlas.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderNode.js +1 -1
- package/views/3d/webgl-engine/lib/GeometryUtil.js +1 -1
- package/views/3d/webgl-engine/lib/OrderIndependentTransparency.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterialBaseInstance.js +5 -0
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/VaoWriter.js +1 -1
- package/views/3d/webgl-engine/shaders/HUDMaterialTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/HeatmapDensityTechnique.js +1 -1
- package/views/3d/webgl-engine/shaders/ImageMaterialTechnique.js +1 -1
- package/views/webgl/VertexArrayObject.js +1 -1
- package/widgets/Attribution/AttributionViewModel.js +1 -1
- package/widgets/Feature/FeatureMedia/FeatureMediaViewModel.js +1 -1
- package/widgets/Legend/LegendViewModel.js +1 -1
- package/widgets/Legend/support/ActiveLayerInfo.js +1 -1
- package/assets/esri/core/workers/chunks/49486c2e12e768b347ed.js +0 -1
- package/assets/esri/core/workers/chunks/66e0bc4acb18f00a433d.js +0 -1
- package/assets/esri/core/workers/chunks/76db75337044de8218c9.js +0 -353
- package/assets/esri/core/workers/chunks/978fab0f0b10edde4ff8.js +0 -1
- package/assets/esri/core/workers/chunks/a07321a901d6847d1a6b.js +0 -1
- package/assets/esri/core/workers/chunks/ae8dce1a43ca7019f81d.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t){const{materialId:
|
|
5
|
+
import{copy as e,invert as r,transpose as t}from"../../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as n}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{getContinuousIndexArray as a}from"../../../../../../geometry/support/Indices.js";import{PipelineCommand as i}from"../PipelineCommand.js";import{generateId as s}from"../utils.js";import{BoundingInfo as o}from"../../../../webgl-engine/lib/BoundingInfo.js";import{DefaultMaterial as d}from"../../../../webgl-engine/materials/DefaultMaterial.js";import{HUDMaterial as m}from"../../../../webgl-engine/materials/HUDMaterial.js";class f{constructor(e,r){this._mainThreadDelegate=r,this._bufferWriters=new Map,this.globalViewingMode=1===e}createRenderCommandBuffer(e=[],r=[]){return{commands:e,transferList:r}}mergeRenderCommandBuffers(e){const r=this.createRenderCommandBuffer();for(const t of e)null!=t&&(r.commands.push(...t.commands),r.transferList.push(...t.transferList));return r}async createTexture(e){const{data:r,parameters:t}=e();return await this._mainThreadDelegate.createTexture(r,t)}async releaseTexture(e){const r=this._destroyTexture(e);return new i(this,r,[])}_destroyTexture(e){return{commands:[{id:"destroy-texture",textureId:e}],transferList:[]}}async createMaterial(e){const{type:r,parameters:t}=e,n=s("material");let a,i;switch(r){case"default":a=new d(e.parameters,{spherical:this.globalViewingMode}),i={type:r,materialId:n,parameters:e.parameters};break;case"hud":a=new m(t,this.globalViewingMode),i={type:r,materialId:n,parameters:e.parameters}}return this._bufferWriters.set(n,a.createBufferWriter()),await this._mainThreadDelegate.createMaterial(i),n}destroyMaterial(e){return{commands:[{id:"destroy-material",materialId:e}],transferList:[]}}updateMaterial(e){return{commands:[{...e,id:"update-material"}],transferList:[]}}async createDirectRenderer(e){return await this._mainThreadDelegate.createDirectRenderer(e),e}async destroyDirectRenderer(e){await this._mainThreadDelegate.destroyDirectRenderer(e)}addDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.addDirectRendererGeometryBuffer(a,e,i,s,t)}updateDirectRendererGeometry(e,r,t,n){const{materialId:a}=r;if(null==this._bufferWriters.get(a))throw new Error(`no bufferwriter found for material ${a}`);const{renderGeometryBuffer:i,renderGeometryBufferItems:s}=this.createRenderGeometryBuffer(r,t,n);return this.updateDirectRendererGeometryBuffer(a,e,i,s,t)}addDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"add-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}updateDirectRendererGeometryBuffer(e,r,t,n,a){const{objectIds:i,visibilities:s}=n;return{commands:[{id:"update-direct-renderer-geometry-buffer",rendererId:e,groupId:r,renderGeometryBuffer:t,renderGeometryBufferItems:n,localOrigin:a}],transferList:[t.data,i.buffer,s.buffer]}}removeDirectRendererGeometryBuffer(e,r){return{commands:[{id:"remove-direct-renderer-geometry-buffer",rendererId:e,groupId:r}],transferList:[]}}async createLodRenderer(e){const r=s("lod-renderer"),t=new Set,n={levels:e.levels.map(e=>({components:e.components.map(e=>{const r=e.attributes.get("position");if(!r||0===r.indices.length)throw new Error("positions attribute expected");const n=3,i=a(r.indices.length/n),s=new o(i,n,r);if(null==this._bufferWriters.get(e.materialId))throw new Error("writer not found");const{renderGeometryBuffer:d}=this.createRenderGeometryBuffer(e,null);t.add(d.data);return{materialId:e.materialId,renderGeometryBuffer:d,boundingInfo:{bbMax:s.bbMax,bbMin:s.bbMin}}}),minScreenSpaceRadius:e.minScreenSpaceRadius}))};return await this._mainThreadDelegate.createLodRenderer(r,n,Array.from(t)),r}destroyLodRenderer(e){return{commands:[{id:"destroy-lod-renderer",rendererId:e}],transferList:[]}}addLodInstances(e,r,t){return{commands:[{id:"add-lod-instances",rendererId:e,groupId:r,data:t}],transferList:[t.featureIds.buffer,t.globalTransforms.buffer,t.localTransforms.buffer,t.visibility.buffer]}}removeLodInstances(e,r){return{commands:[{id:"remove-lod-instances",rendererId:e,groupId:r}],transferList:[]}}updateLodInstancesData(e,r,t){return{commands:[{id:"update-lod-instance-data",rendererId:e,groupId:r,globalTransforms:t}],transferList:[t.buffer]}}updateVisibility(e,r,t){return{commands:[{id:"update-visibility",rendererId:e,groupId:r,visibility:t}],transferList:[t.buffer]}}async dispatchRenderCommands(e){0!==e.commands.length&&await this._mainThreadDelegate.executeRenderCommands(e)}createRenderGeometryBuffer(n,a,i){const{materialId:s,visibilities:o,objectIds:d}=n,m=this._bufferWriters.get(s);if(null==m)throw new Error("no registered bufferWriter for material found");let f=null;if(n.transformation&&a)e(u,n.transformation),u[12]-=a[0],u[13]-=a[1],u[14]-=a[2],f=u;else{if(a)throw new Error("not implemented");n.transformation&&(f=n.transformation)}let b=null;f&&(r(l,u),t(l,l),b=l);const y=n.attributes,h=m.elementCount(y),p=i?m.instanceLayout:m.layout;if(!p)throw new Error("Missing layout");const g=p.stride/4;h>Math.floor(c/g)&&console.warn("geometry with very large number of elements encountered");const I=p.createBuffer(h),w=0,B=m.write(f,b,y,n.olidColor,I,w);if(null==B)throw new Error("Bufferwriter.write does not provide item information.");if(o.length!==B.numItems||d.length!==B.numItems)throw new Error("Unexpected mismatch between number of RenderGeometryBufferItems and provided objectIds/visibility flags.");return{renderGeometryBuffer:{data:I.buffer,elementCount:h},renderGeometryBufferItems:{objectIds:d,visibilities:o,ranges:{numVertices:B.numVerticesPerItem,numItems:B.numItems}}}}async setBaseInstance(e,r){await this._mainThreadDelegate.setBaseInstance(e,r)}}const u=n(),l=n(),c=16777216/4;export{f as RenderCommandContext};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")};this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r);return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0
|
|
5
|
+
import e from"../../../../../../Color.js";import{create as t}from"../../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as r}from"../../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as i}from"../../../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{defaultPrimitive as n}from"../../../../../../symbols/support/IconSymbol3DLayerResource.js";import{mixinColorAndOpacity as o}from"../../graphicUtils.js";import{namedAnchorToHUDMaterialAnchorPos as a}from"../../placementUtils.js";import{PipelineCommand as l}from"../PipelineCommand.js";import{computeTileCenterRenderCoordinates as s,readObjectIds as m,readMapCoordinates as c,projectToRenderCoordinates as d}from"../featureData/processingUtils.js";import{inputAttributesToAttributesMap as u}from"./symbolizationUtils.js";import{createTextureInfo as y,requiresHalfTexelOffset as p,defaultBoundingBox as _}from"../../../../support/engineContent/sdfPrimitives.js";import{Attribute as C}from"../../../../webgl-engine/lib/Attribute.js";class h{constructor(e,t){this._context=null,this._symbolLayer=null,this._draped=!1,this._loaded=!1,this._loadingPromise=null,this._iconTextureID=null,this._materialId=null,this._context=t,this._symbolLayer=e}get loaded(){return this._loaded}load(){return null==this._loadingPromise&&(this._loadingPromise=this._load()),this._loadingPromise}_destroy(){this._iconTextureID=null}async _load(){const e=this._context.renderCommandContext,t=await e.createTexture(()=>y("circle"));this._iconTextureID=t;const r={anchorPosition:a.center,occlusionTest:!0,hasSlicePlane:!1,color:this._getFillColor(),outlineColor:this._getOutlineColor(),outlineSize:1,distanceFieldBoundingBox:_,textureId:t,textureIsSignedDistanceField:!0,sampleSignedDistanceFieldTexelCenter:p("circle")},i=new Uint8Array(8),n=0,o=255;i[0]=n,i[1]=n,i[2]=n,i[3]=o,i[4]=o,i[5]=n,i[6]=o,i[7]=o,this._materialId=await e.createMaterial({type:"hud",parameters:r}),await e.createDirectRenderer(this._materialId),await e.setBaseInstance(this._materialId,{data:i.buffer,elementCount:4}),this._loaded=!0}async createAddCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r;if(null==t)throw new Error("expected material not to be null");const n=await this._createGeometry(e);if(null==n)return r.createPipelineCommand();const o=s(e,r),a=!0;return r.createPipelineCommand(i.addDirectRendererGeometry(e.id,n,o,a))}async _createGeometry(e){const{_materialId:r,_context:i}=this,{mainThreadDelegate:n}=i,{featureCount:o}=e;if(0===o||null==r)return null;const a=m(e),l=c(e),s=await n.applyElevationAlignmentTo(l),y=d(s,i),p=new Float64Array([0,0,1]),_=new Float64Array([255,255,255,255]),h=new Float64Array([24,24]),f=new Float64Array([0,0,0,1]),g=new Float64Array([0]),x=new Uint32Array(o);for(let t=0;t<o;++t)x[t]=t;const w=new Uint32Array(o);for(let t=0;t<o;++t)w[t]=0;const b=[["position",new C(y,x,3,!0)],["normal",new C(p,w,3,!0)],["color",new C(_,w,4,!0)],["rotation",new C(g,w,1,!0)],["size",new C(h,w,2,!0)],["centerOffsetAndDistance",new C(f,w,4,!0)]],I=new Uint8Array(o);e.getVisibilityArray(I);return{attributes:u(b),olidColor:void 0,transformation:t(),materialId:r,objectIds:a,visibilities:I}}async createRemoveCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;return null==t?r.createPipelineCommand():r.createPipelineCommand(i.removeDirectRendererGeometryBuffer(t,e))}async createUpdateVisibilityCommand(e){const{_materialId:t,_context:r}=this,i=r.renderCommandContext;if(null==t)return r.createPipelineCommand();const n=new Uint8Array(e.featureCount);return e.getVisibilityArray(n),r.createPipelineCommand(i.updateVisibility(t,e.id,n))}async createUpdateLayerViewOpacityCommand(e){const{_context:t,_materialId:r}=this,i=t.renderCommandContext;return null==r?t.createPipelineCommand():t.createPipelineCommand(i.updateMaterial({type:"hud",materialId:r,parameters:{color:this._getFillColor(),outlineColor:this._getOutlineColor()}}))}async createUpdateElevationCommand(e){const{_materialId:t,_context:r}=this,{renderCommandContext:i}=r,{featureCount:n,id:o}=e;if(null==t||0===n)return r.createPipelineCommand();const a=await this._createGeometry(e);if(null==a)return r.createPipelineCommand();const l=s(e,r),m=!0;return r.createPipelineCommand(i.updateDirectRendererGeometry(o,a,l,m))}async createDestroyCommand(){const{_iconTextureID:e,_context:t}=this,r=t.renderCommandContext;let i;return i=null!=e?await r.releaseTexture(e):l.create(r),i.appendPipelineStateCommand(()=>this._destroy()),i}_getOutlineColor(){const t=this._getLayerOpacity(),r=this._symbolLayer,i=r?.outline?.color;if(null!=i){const r=e.toUnitRGB(i),n=i.a*t;return[r[0],r[1],r[2],n]}return[0,0,0,0]}_getFillColor(){if(f(this._getPrimitive()))return w;const e=null==this._getPrimitive(),t=this._symbolLayer?.material?.color;return this._getCombinedOpacityAndColor(t,{hasIntrinsicColor:e})}_getLayerOpacity(){return this._context.layerViewInfo.fullOpacity}_getCombinedOpacity(e,t=x){const r=this._draped?1:this._getLayerOpacity();return e?r*e.a:t.hasIntrinsicColor?r:0}_getCombinedOpacityAndColor(t,i=x){const n=this._getCombinedOpacity(t,i),a=null!=t?e.toUnitRGB(t):r;return o(a,n)}_getPrimitive(){return g(this._symbolLayer)}}function f(e){return null!=e&&("cross"===e||"x"===e)}function g(e){return e.resource?.href?null:e.resource?.primitive??n}const x={hasIntrinsicColor:!1},w=i;export{h as IconSymbolLayerRenderer,x as defaultMaterialOptions,g as getPrimitive,f as isOutlineOnly,w as transparentUnit};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as v}from"../../../../layers/graphics/OptimizedFeature.js";import b from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as j}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as G}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as V}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as T}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as A}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as I}from"../../webgl-engine/lib/Geometry.js";import{RenderGeometry as N}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as H}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as O,isScaleRangeActive as U}from"../../../support/layerViewUtils.js";import{PixelType as L}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as C,fallBackHeatmapConfiguration as D}from"../../../webgl/heatmapTextureUtils.js";const E=112;let W=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=L.HALF_FLOAT,this._pixelFormat=6408,this._updatingHandles=new y}initialize(){let e;try{e=C(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=D}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==L.FLOAT,u=this.view.basemapTerrain.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new A(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new H({usesHalfFloats:n}),this._materialWithField=new H({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new V({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},p),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([d(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),d(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy()}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new j(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!O(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===L.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new G(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return U(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return x}highlightByObjectIds(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>R(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new v(F(new b,a),t,i?F(new b,i):null,R(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=T;const a=g(1),s=[["position",new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new M([o?e.attributes[t]??0:0],a,1)]);const n=new N(new I(r,s,null,1),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>E&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${E} pt for HeatmapRenderer.`),Math.min(e,E)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],W.prototype,"type",void 0),e([h({constructOnly:!0})],W.prototype,"owner",void 0),e([h()],W.prototype,"layer",null),e([h()],W.prototype,"featureStore",null),e([h()],W.prototype,"updating",null),e([h()],W.prototype,"updatingRemaining",null),e([h()],W.prototype,"suspendInfo",null),e([h()],W.prototype,"legendEnabled",null),e([h()],W.prototype,"filterVisibility",null),e([h()],W.prototype,"displayFeatureLimit",null),e([h()],W.prototype,"preferredUpdatePolicy",void 0),e([h()],W.prototype,"hasZ",null),e([h()],W.prototype,"hasM",null),e([h()],W.prototype,"dataExtent",void 0),e([h()],W.prototype,"view",null),e([h()],W.prototype,"fullOpacity",null),e([h()],W.prototype,"updatePolicy",null),e([h()],W.prototype,"drapeSourceType",void 0),e([h()],W.prototype,"scaleVisibilitySuspended",null),e([h()],W.prototype,"renderer",null),e([h()],W.prototype,"_featureStore",void 0),e([h()],W.prototype,"_filterVisibility",void 0),e([h()],W.prototype,"_overlayRenderer",null),e([h()],W.prototype,"_overlaySpatialReference",null),e([h()],W.prototype,"_rendererParameters",null),e([h()],W.prototype,"_materialParameters",null),e([h()],W.prototype,"_densityParameters",null),e([h()],W.prototype,"_radiusParameter",null),e([h()],W.prototype,"_resolutionForScaleParameter",null),e([h()],W.prototype,"_colorRampParameter",null),e([h()],W.prototype,"_pixelRatioParameter",null),e([h()],W.prototype,"_densityMapPixelRatio",null),e([h()],W.prototype,"_renderGeometries",void 0),e([h()],W.prototype,"_material",void 0),e([h()],W.prototype,"_materialWithField",void 0),e([h()],W.prototype,"_renderView",null),e([h()],W.prototype,"_featuresArePoints",null),e([h()],W.prototype,"_loadedPointGraphics",null),e([h()],W.prototype,"_heatmapRenderer",null),e([h()],W.prototype,"_heatmapRendererFieldName",null),e([h()],W.prototype,"_heatmapRendererField",null),e([h()],W.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],W.prototype,"_fieldTotal",void 0),e([h()],W.prototype,"_drapeSourceRenderer",void 0),e([h()],W.prototype,"_isScaleRangeActive",null),W=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],W);export{W as HeatmapFeatureProcessor,E as maxRadiusPt};
|
|
5
|
+
import{__decorate as e}from"tslib";import{isSome as t}from"../../../../core/arrayUtils.js";import{makeHandle as r}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import i from"../../../../core/Logger.js";import{estimateAttributesMemory as a,estimateFixedArrayMemory as s,estimateNumberMemory as o}from"../../../../core/memoryEstimations.js";import{EsriPromise as n}from"../../../../core/Promise.js";import{initial as l,sync as p,watch as d}from"../../../../core/reactiveUtils.js";import{pt2px as u}from"../../../../core/screenUtils.js";import{property as h}from"../../../../core/accessorSupport/decorators/property.js";import{subclass as m}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{UpdatingHandles as y}from"../../../../core/support/UpdatingHandles.js";import{projectPointToVector as _}from"../../../../geometry/projection/projectPointToVector.js";import{getContinuousIndexArray as g}from"../../../../geometry/support/Indices.js";import{getResolutionForScale as f}from"../../../../geometry/support/scaleUtils.js";import{getObjectId as R}from"../../../../layers/graphics/dehydratedFeatures.js";import{convertFromPoint as F}from"../../../../layers/graphics/featureConversionUtils.js";import{OptimizedFeature as b}from"../../../../layers/graphics/OptimizedFeature.js";import v from"../../../../layers/graphics/OptimizedGeometry.js";import w from"../../../../layers/graphics/data/FeatureStore.js";import{isNumericField as S}from"../../../../layers/support/fieldUtils.js";import{generateGradient as P}from"../../../../renderers/support/heatmapUtils.js";import{DisplayFeatureLimit as j}from"../graphics/DisplayFeatureLimit.js";import{GraphicsCorePerformanceInfo as G}from"../graphics/GraphicsCorePerformanceInfo.js";import{FeatureVisibilityFilter as V}from"./FeatureVisibilityFilter.js";import{emptyHighlightHandle as x}from"./highlightUtils.js";import{drapedZ as T}from"../../terrain/OverlayRenderer.js";import{Attribute as M}from"../../webgl-engine/lib/Attribute.js";import{DrapedHeatmapRenderer as I}from"../../webgl-engine/lib/DrapedHeatmapRenderer.js";import{Geometry as A}from"../../webgl-engine/lib/Geometry.js";import{GeometryBaseInstance as N}from"../../webgl-engine/lib/GeometryBaseInstance.js";import{RenderGeometry as H}from"../../webgl-engine/lib/RenderGeometry.js";import{HeatmapDensityMaterial as O}from"../../webgl-engine/materials/HeatmapDensityMaterial.js";import{scaleBoundsPredicate as U,isScaleRangeActive as L}from"../../../support/layerViewUtils.js";import{PixelType as C}from"../../../webgl/enums.js";import{loadHeatmapTextureConfiguration as D,fallBackHeatmapConfiguration as E}from"../../../webgl/heatmapTextureUtils.js";const W=112;let Z=class extends n{constructor(e){super(e),this.type="heatmap",this.preferredUpdatePolicy=0,this.dataExtent=null,this.drapeSourceType=1,this._renderGeometries=new Map,this._fieldTotal=0,this._drapeSourceRenderer=null,this._dataType=C.HALF_FLOAT,this._pixelFormat=6408,this._baseInstance=new N([]),this._updatingHandles=new y}initialize(){let e;try{e=D(this._renderView.renderingContext,i.getLogger(this))}catch(m){this.addResolvingPromise(Promise.reject(m)),e=E}const{dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o}=e;this._featureStore=new w({geometryType:"esriGeometryPoint",hasZ:this.hasZ,hasM:this.hasM}),this._dataType=t,this._pixelFormat=s;const n=t!==C.FLOAT,u=this.view.basemapTerrain.overlayManager,h={...this._rendererParameters,stage:this.view.stage,dataType:t,samplingMode:a,pixelFormat:s,internalFormat:o,rendererContext:u.renderer,drapeSource:this};this._drapeSourceRenderer=new I(h),u.registerDrapeSource(this,this._drapeSourceRenderer),this._material=new O({usesHalfFloats:n}),this._materialWithField=new O({usesHalfFloats:n,isAttributeDriven:!0}),this._filterVisibility=new V({context:{configuration:this.owner,featureStore:this.featureStore,getFeatureCount:()=>this._loadedPointGraphics.length,setAllFeaturesVisibility:e=>this._setAllFeaturesVisibility(e),clearFeaturesVisibility:()=>this._setAllFeaturesVisibility(!0),updateFeatureVisibilities:e=>this._updateFeatureVisibilities(e)}}),this._updatingHandles.addOnCollectionChange(()=>this._loadedPointGraphics,e=>this._onLoadedFeaturesChange(e),l),this._updatingHandles.addWhen(()=>this._materialParameters,e=>this._forEachMaterial(t=>t.setParameters(e)),l),this._updatingHandles.add(()=>this._rendererParameters,e=>this._drapeSourceRenderer.set(e)),this._updatingHandles.add(()=>this._heatmapRendererField,()=>{this._recreate()},p),this._updatingHandles.add(()=>({fieldName:this._heatmapRendererFieldName,numeric:this._heatmapRendererFieldIsNumeric}),({fieldName:e,numeric:t})=>{if(null!=e&&t){let t=0;this._featureStore.forEach(r=>t+=r.attributes[e]??0),this._fieldTotal=t}else this._fieldTotal=this._featureStore.numFeatures},l),this.addHandles([d(()=>({fieldName:this._heatmapRendererFieldName,field:this._heatmapRendererField}),({fieldName:e,field:t})=>{e&&!t&&i.getLogger(this).warn(`Heatmap renderer field '${e}' for layer '${this.layer.title??this.layer.id}' not found`)}),d(()=>({field:this._heatmapRendererField,numeric:this._heatmapRendererFieldIsNumeric}),({field:e,numeric:t})=>{null==e||t||i.getLogger(this).warn(`Heatmap renderer field '${e.name}' for layer '${this.layer.title??this.layer.id}' does not contain numeric values and cannot be used to drive the heatmap density`)}),r(()=>this.view.basemapTerrain.overlayManager.unregisterDrapeSource(this))])}destroy(){this._renderGeometries.clear(),this._material=null,this._materialWithField=null,this._featureStore.clear(),this._featureStore=null,this._updatingHandles.destroy(),this._baseInstance=null}get layer(){return this.owner.layer}get featureStore(){return this._featureStore}get updating(){return this._updatingHandles.updating||this.filterVisibility.updating}get updatingRemaining(){return 0}get suspendInfo(){return{}}get legendEnabled(){return!0}get filterVisibility(){return this._filterVisibility}get displayFeatureLimit(){const e=this.owner?.view?.quality??1,t=this.owner?.view?.qualitySettings,r=t?Math.ceil(t.heatmap.maxTotalNumberOfFeatures*e):0;return new j(r*6,r)}get hasZ(){return"hasZ"in this.layer&&!0===this.layer.hasZ}get hasM(){return"hasM"in this.layer&&this.layer.hasM}get view(){return this.owner.view}get fullOpacity(){return this.owner.fullOpacity}get updatePolicy(){return this.owner.updatePolicy}get scaleVisibilitySuspended(){if(!this._isScaleRangeActive)return!1;const{minScale:e,maxScale:t}=this.layer.effectiveScaleRange,{scale:r}=this.view;return!U(r,e??0,t??0)}get usedMemory(){const e=this.usedMemoryPerFeature*this._featureStore.numFeatures,t=6403===this._pixelFormat?1:4,r=this._dataType===C.FLOAT?4:2,i=Math.ceil((this._overlayRenderer?.overlays[0]?.resolution??0)*this._densityMapPixelRatio)??0;return i*i*t*r+e}get usedMemoryPerFeature(){const e=this._loadedPointGraphics.find(()=>!0);if(null==e)return 0;const t=a(e),r=6;return r*s([0,0,0],o)+r*s([0,0],o)+(this._heatmapRendererFieldIsNumeric?r*o:0)+t}get loadedFeatures(){return this._featureStore.numFeatures}get unprocessedMemoryEstimate(){return 0}get performanceInfo(){return new G(this._renderGeometries.size,this._visibleFeatures,0,0)}get renderer(){return this._heatmapRenderer}get _overlayRenderer(){return this.view.basemapTerrain.overlayManager.renderer}get _overlaySpatialReference(){return this._overlayRenderer.spatialReference}get _rendererParameters(){return{...this._radiusParameter,...this._densityParameters,...this._colorRampParameter,...this._pixelRatioParameter}}get _materialParameters(){return{...this._radiusParameter,...this._resolutionForScaleParameter}}get _densityParameters(){const e=this._heatmapRenderer;if(null==e)return null;const{minDensity:t,maxDensity:r}=e;return{minDensity:t,maxDensity:r,fieldTotal:this._fieldTotal}}get _radiusParameter(){const e=this._heatmapRenderer;return e?{searchRadius:u(this._clampSearchRadius(e.radius))}:null}get _resolutionForScaleParameter(){const e=this._heatmapRenderer;if(!e)return null;const{referenceScale:t}=e;return{resolutionForScale:0===t?0:f(t,this.view.spatialReference)}}get _colorRampParameter(){const e=this._heatmapRenderer;return e?{colorRampData:P(e.colorStops)}:null}get _pixelRatioParameter(){return{pixelRatio:this._densityMapPixelRatio}}get _densityMapPixelRatio(){return this.owner?.view?.qualitySettings.heatmap.pixelRatio??1}get _renderView(){return this.view.stage.renderView}get _featuresArePoints(){return"point"===this.layer.geometryType}get _loadedPointGraphics(){return this.owner.loadedGraphics}get _heatmapRenderer(){const e=this.layer.renderer;return"heatmap"===e?.type?e:null}get _heatmapRendererFieldName(){return this._heatmapRenderer?.field}get _heatmapRendererField(){const e=this._heatmapRendererFieldName;return null!=e?this.layer.fieldsIndex.get(e):null}get _heatmapRendererFieldIsNumeric(){const e=this._heatmapRendererField;return null!=e&&S(e)}get _isScaleRangeActive(){const{layer:e}=this;if(!("effectiveScaleRange"in e))return!1;const{minScale:t,maxScale:r}=e.effectiveScaleRange;return L(t,r)}get _visibleFeatures(){return Array.from(this._renderGeometries.values()).reduce((e,{visible:t})=>e+(t?1:0),0)}async whenGraphicBounds(){return null}computeAttachmentOrigin(){return null}highlightByGraphics(){return x}highlightByObjectIds(){return x}maskOccludee(){return r()}setObjectIdVisibility(){}refreshFilter(){this.filterVisibility.reapply()}_onLoadedFeaturesChange(e){if(!this._featuresArePoints)return;const{objectIdField:r}=this.layer;this._featureStore.removeManyById(e.removed.map(e=>R(e,r))),this._featureStore.addMany(e.added.map(e=>{const{attributes:t,centroid:i,geometry:a}=e,s=new b(F(new v,a),t,i?F(new v,i):null,R(e,r));return s.displayId=e.uid,s}));const i=e.added,a=e.removed;this._fieldTotal+=this._computeFieldTotalChange(i,a);const s=a.map(({uid:e})=>{const t=this._renderGeometries.get(e);return this._renderGeometries.delete(e),t}).filter(t),o=i.map(e=>{const t=this._pointGraphicToRenderGeometry(e);return this._renderGeometries.set(e.uid,t),t});s.length>0&&this._drapeSourceRenderer.removeGeometries(s,2),o.length>0&&this._drapeSourceRenderer.addGeometries(o,0),(o.length>0||s.length>0)&&(this.filterVisibility.reapply(),this._renderView.requestRender())}_recreate(){if(!this._loadedPointGraphics)return;const e=this._loadedPointGraphics.toArray();this._onLoadedFeaturesChange({added:e,removed:e})}_pointGraphicToRenderGeometry(e){const t=this._heatmapRendererFieldName,r=null!=t?this._materialWithField:this._material,i=c();_(e.geometry,i,this._overlaySpatialReference),i[2]=T;const a=g(1),s=[["position",new M(i,a,i.length)]],o=this._heatmapRendererFieldIsNumeric;null!=t&&s.push(["featureAttribute",new M([o?e.attributes[t]??0:0],a,1)]);const n=new H(new A(r,s,null,1,null,void 0,this._baseInstance),{layerViewUid:this.owner.layerViewUid,graphicUid:e.uid});return n.visible=this.filterVisibility.defaultVisibility,n}_forEachMaterial(e){e(this._material),e(this._materialWithField)}_computeFieldTotalChange(e,t){if(null==this._heatmapRendererFieldName||!this._heatmapRendererFieldIsNumeric)return e.length-t.length;const r=this._heatmapRendererFieldName,i=(e,t)=>e+(t.attributes[r]??0);return e.reduce(i,0)-t.reduce(i,0)}_clampSearchRadius(e){return e>W&&i.getLogger(this).warnOnce(`SceneView supports a maximum radius of ${W} pt for HeatmapRenderer.`),Math.min(e,W)}_updateFeatureVisibilities(e){const t=[];this._featureStore.forEach(({objectId:r,displayId:i})=>{const a=e(r),s=this._renderGeometries.get(i);s&&s.visible!==a&&(t.push(s),s.visible=a)}),this._drapeSourceRenderer.modifyGeometries(t,1)}_setAllFeaturesVisibility(e){const t=[];for(const r of this._renderGeometries.values())r.visible!==e&&(t.push(r),r.visible=e);this._drapeSourceRenderer.modifyGeometries(t,1)}get test(){}};e([h()],Z.prototype,"type",void 0),e([h({constructOnly:!0})],Z.prototype,"owner",void 0),e([h()],Z.prototype,"layer",null),e([h()],Z.prototype,"featureStore",null),e([h()],Z.prototype,"updating",null),e([h()],Z.prototype,"updatingRemaining",null),e([h()],Z.prototype,"suspendInfo",null),e([h()],Z.prototype,"legendEnabled",null),e([h()],Z.prototype,"filterVisibility",null),e([h()],Z.prototype,"displayFeatureLimit",null),e([h()],Z.prototype,"preferredUpdatePolicy",void 0),e([h()],Z.prototype,"hasZ",null),e([h()],Z.prototype,"hasM",null),e([h()],Z.prototype,"dataExtent",void 0),e([h()],Z.prototype,"view",null),e([h()],Z.prototype,"fullOpacity",null),e([h()],Z.prototype,"updatePolicy",null),e([h()],Z.prototype,"drapeSourceType",void 0),e([h()],Z.prototype,"scaleVisibilitySuspended",null),e([h()],Z.prototype,"renderer",null),e([h()],Z.prototype,"_featureStore",void 0),e([h()],Z.prototype,"_filterVisibility",void 0),e([h()],Z.prototype,"_overlayRenderer",null),e([h()],Z.prototype,"_overlaySpatialReference",null),e([h()],Z.prototype,"_rendererParameters",null),e([h()],Z.prototype,"_materialParameters",null),e([h()],Z.prototype,"_densityParameters",null),e([h()],Z.prototype,"_radiusParameter",null),e([h()],Z.prototype,"_resolutionForScaleParameter",null),e([h()],Z.prototype,"_colorRampParameter",null),e([h()],Z.prototype,"_pixelRatioParameter",null),e([h()],Z.prototype,"_densityMapPixelRatio",null),e([h()],Z.prototype,"_renderGeometries",void 0),e([h()],Z.prototype,"_material",void 0),e([h()],Z.prototype,"_materialWithField",void 0),e([h()],Z.prototype,"_renderView",null),e([h()],Z.prototype,"_featuresArePoints",null),e([h()],Z.prototype,"_loadedPointGraphics",null),e([h()],Z.prototype,"_heatmapRenderer",null),e([h()],Z.prototype,"_heatmapRendererFieldName",null),e([h()],Z.prototype,"_heatmapRendererField",null),e([h()],Z.prototype,"_heatmapRendererFieldIsNumeric",null),e([h()],Z.prototype,"_fieldTotal",void 0),e([h()],Z.prototype,"_drapeSourceRenderer",void 0),e([h()],Z.prototype,"_isScaleRangeActive",null),Z=e([m("esri.views.3d.layers.support.HeatmapFeatureProcessor")],Z);export{Z as HeatmapFeatureProcessor,W as maxRadiusPt};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{hasNativeFloat16Array as e}from"../../../../geometry/support/float16.js";import{BufferViewVec2f16 as t,BufferViewVec2f as i,BufferViewVec2f64 as r,BufferViewVec3f16 as s,BufferViewVec3f as n,BufferViewVec3f64 as h,BufferViewVec4f16 as d,BufferViewVec4f as u,BufferViewVec4f64 as f,BufferViewMat3f as o,BufferViewMat3f64 as
|
|
5
|
+
import{hasNativeFloat16Array as e}from"../../../../geometry/support/float16.js";import{BufferViewVec2f16 as t,BufferViewVec2f as i,BufferViewVec2f64 as r,BufferViewVec3f16 as s,BufferViewVec3f as n,BufferViewVec3f64 as h,BufferViewVec4f16 as d,BufferViewVec4f as u,BufferViewVec4f64 as f,BufferViewMat3f as o,BufferViewMat3f64 as p,BufferViewMat4f as l,BufferViewMat4f64 as a,BufferViewVec4u8 as c,BufferViewFloat16 as _,BufferViewFloat as m,BufferViewFloat64 as F,BufferViewUint8 as y,BufferViewUint16 as g,BufferViewInt8 as b,BufferViewVec2i8 as w,BufferViewVec2i16 as v,BufferViewVec2u8 as E,BufferViewVec2u16 as A,BufferViewVec4u16 as M,BufferViewVec4i16 as T,BufferViewUint32 as j,BufferViewVec3u8 as U,BufferViewVec3u16 as B,BufferViewVec2u32 as L,BufferViewVec3u32 as x,BufferViewVec4u32 as C,BufferViewVec3i8 as z,BufferViewVec4i8 as V,BufferViewInt16 as $,BufferViewVec3i16 as k,BufferViewInt32 as q,BufferViewVec2i32 as D,BufferViewVec3i32 as G,BufferViewVec4i32 as H}from"../../../../geometry/support/buffer/BufferView.js";import{elementTypeSize as I}from"../../../../geometry/support/buffer/types.js";import{glLayout as J}from"./glUtil.js";import{assert as K}from"../../webgl-engine/lib/Util.js";import{fromLayout as N}from"../../../webgl/VertexAttributeLocations.js";class O{constructor(e,t){this.layout=e,this.buffer="number"==typeof t?new ArrayBuffer(t*e.stride):t;for(const i of e.fields.keys()){const t=e.fields.get(i);this[i]=new t.constructor(this.buffer,t.offset,this.stride)}}get stride(){return this.layout.stride}get count(){return this.buffer.byteLength/this.stride}get byteLength(){return this.buffer.byteLength}getField(e,t){const i=this[e];return i&&i.elementCount===t.ElementCount&&i.elementType===t.ElementType?i:null}slice(e,t){return new O(this.layout,this.buffer.slice(e*this.stride,t*this.stride))}copyFrom(e,t=0,i=0,r=e.count){const s=this.stride;if(s%4==0){const n=new Uint32Array(e.buffer,t*s,r*s/4);new Uint32Array(this.buffer,i*s,r*s/4).set(n)}else{const n=new Uint8Array(e.buffer,t*s,r*s);new Uint8Array(this.buffer,i*s,r*s).set(n)}return this}get usedMemory(){return this.byteLength}dispose(){}}class P{constructor(e){this._stride=0,this._fields=new Map,e&&(this._stride=e.stride,e.fields.forEach(e=>this._fields.set(e[0],{...e[1],constructor:X(e[1].constructor)})))}freeze(){return this}get locations(){return N(J(this))}vec2f16(r,s){return this._appendField(r,e?t:i,s),this}vec2f(e,t){return this._appendField(e,i,t),this}vec2f64(e,t){return this._appendField(e,r,t),this}vec3f16(t,i){return this._appendField(t,e?s:n,i),this}vec3f(e,t){return this._appendField(e,n,t),this}vec3f64(e,t){return this._appendField(e,h,t),this}vec4f16(t,i){return this._appendField(t,e?d:u,i),this}vec4f(e,t){return this._appendField(e,u,t),this}vec4f64(e,t){return this._appendField(e,f,t),this}mat3f(e,t){return this._appendField(e,o,t),this}mat3f64(e,t){return this._appendField(e,p,t),this}mat4f(e,t){return this._appendField(e,l,t),this}mat4f64(e,t){return this._appendField(e,a,t),this}vec4u8(e,t){return this._appendField(e,c,t),this}f16(t,i){return this._appendField(t,e?_:m,i),this}f32(e,t){return this._appendField(e,m,t),this}f64(e,t){return this._appendField(e,F,t),this}u8(e,t){return this._appendField(e,y,t),this}u16(e,t){return this._appendField(e,g,t),this}i8(e,t){return this._appendField(e,b,t),this}vec2i8(e,t){return this._appendField(e,w,t),this}vec2i16(e,t){return this._appendField(e,v,t),this}vec2u8(e,t){return this._appendField(e,E,t),this}vec2u16(e,t){return this._appendField(e,A,t),this}vec4u16(e,t){return this._appendField(e,M,t),this}vec4i16(e,t){return this._appendField(e,T,t),this}u32(e,t){return this._appendField(e,j,t),this}_appendField(e,t,i){this._fields.has(e)&&K(!1,`${e} already added to vertex buffer layout`);const r=t.ElementCount*I(t.ElementType),s=this._stride;this._fields.set(e,{constructor:t,size:r,offset:s,optional:i}),this._alignFields()}_alignFields(){let e=0,t=1;this._fields.forEach(i=>{const r=I(i.constructor.ElementType);e=Math.floor((e+r-1)/r)*r,i.offset=e,e+=i.size,t=Math.max(t,r)}),e=Math.floor((e+t-1)/t)*t,this._stride=e}createBuffer(e){return new O(this,e)}createView(e){return new O(this,e)}clone(){const e=new P;return e._stride=this._stride,e._fields=new Map,this._fields.forEach((t,i)=>e._fields.set(i,t)),e.BufferType=this.BufferType,e}get stride(){return this._stride}get fields(){return this._fields}}function Q(){return new P}class R{constructor(e){this.fields=new Array,e.fields.forEach((e,t)=>{const i={...e,constructor:W(e.constructor)};this.fields.push([t,i])}),this.stride=e.stride}}const S=[m,i,n,u,o,l,F,r,h,f,p,a,y,E,U,c,g,A,B,M,j,L,x,C,b,w,z,V,$,v,k,T,q,D,G,H];function W(e){return`${e.ElementType}_${e.ElementCount}`}function X(e){return Y.get(e)}const Y=new Map;S.forEach(e=>Y.set(W(e),e));export{O as InterleavedBuffer,P as InterleavedLayout,R as PackedLayout,Q as newLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{throttle as e}from"../../../../core/throttle.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as
|
|
5
|
+
import{__decorate as t}from"tslib";import{throttle as e}from"../../../../core/throttle.js";import{property as s}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/has.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as r}from"../../../../core/accessorSupport/decorators/subclass.js";import{fromExtent as i,clone as a}from"../../../../geometry/support/aaBoundingRect.js";import{toFlowData as o}from"../../../2d/engine/flow/dataUtils.js";import l from"../../layers/FlowSubView3D.js";import{tilesWaitingTime as n}from"./constants.js";import{tileToKey as d,FlowDataTile as h}from"./loadUtils.js";import{isRasterTile as u}from"../../terrain/TerrainData.js";let g=class extends l{constructor(t){super(t),this._flowDataTiles=c(),this._resetTileData=!0,this._throttledTriggerLoad=null,this._throttling=!1}initialize(){this.addHandles([this.surface.on("tile-data-changed",({tile:t,layerIndex:e,layerClass:s})=>{const{renderedTiles:r}=this;null!=r&&e===this._layerIndex&&1===s&&this._updateFlowDataTile(t)})]),this._throttledTriggerLoad=e(()=>{super.triggerLoad(),this._throttling=!1},()=>this._throttling=!0,n,this),this.addHandles(this._throttledTriggerLoad),this.updatingHandles.add(()=>this.renderedTiles,t=>{const e=c();t?.forEach(t=>{const s=this._flowDataTiles.get(d(t)),r=null==s||"delete"===s?this._getFlowDataCopy(t):s;null!=r&&e.set(d(t),r)}),this._flowDataTiles=e,this._resetTileData=!0,this.triggerLoad()})}abort(){super.abort(),this._throttling=!1}get _layerIndex(){return this.surface.getLayerIndexByUID(1,this.layerView.uid)}get updating(){return this.requireLoad||this.updatingHandles.updating||this._throttling}triggerLoad(){const t=this._numberLoadedTiles===this.renderedTiles?.size,{_throttledTriggerLoad:e}=this;t?(e.hasPendingUpdates()||e(),e.forceUpdate()):e()}async fetchDataAndGenerateStreamlines(t,e){const{needsMagnitude:s,simulationSettings:r,_flowDataTiles:a,workerHandle:o}=this,{size:l}=t;if(null==r||null==o)return;const n=i(t.extent),d=this._resetTileData;this._resetTileData=!1;const h=c();a.forEach((t,e)=>{"delete"===t?(h.set(e,"delete"),a.delete(e)):(d||"on-worker"!==t)&&(h.set(e,t),a.set(e,"on-worker"))});const u={simulationSettings:r,size:l,flowDataTiles:h,reset:d,extent:n,pixelSize:this.surface.tilingScheme.pixelSize,needsMagnitude:s,startPositions:this.startPositions(t)},{streamlines:g}=await o.generateTiledStreamlines(u,e);return g}_getFlowDataCopy(t){const{_layerIndex:e}=this,s=null==t.surface;if(null==e||s)return null;const r=t.getLayerInfo(e,1);if(null==r)return null;if(!t.visible&&null==r.requestAbort)return r.requestAbort=new AbortController,this.surface.requestTileData(t,e,1,r.requestAbort),null;if(r.dataMissing||!t.hasLayerData(e,1))return null;const{data:i}=r;if(!u(i))return null;const l=o(this.layer.serviceRasterInfo.dataType,i.source),n=new Uint8Array(l.width*l.height);for(let a=0;a<n.length;a++)n[a]=l.mask[a];return new h(l.data,n,l.width,l.height,t.lij,a(t.extent))}_updateFlowDataTile(t){const e=this.renderedTiles?.has(t)?this._getFlowDataCopy(t)??"delete":"delete";this._setTileData(t,e)&&this.triggerLoad()}_setTileData(t,e){const s=d(t);return(null!=this._flowDataTiles.get(s)||"delete"!==e)&&(this._flowDataTiles.set(s,e),!0)}get _numberLoadedTiles(){let t=0;for(const e of this._flowDataTiles.values())"delete"!==e&&t++;return t}get test(){return{...super.test,loadedTiles:this._flowDataTiles}}};function c(){return new Map}t([s()],g.prototype,"_throttling",void 0),t([s()],g.prototype,"updating",null),g=t([r("esri.views.3d.support.flow.FlowSubViewTiles3D")],g);export{g as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const e=.1,o=1,t=1,c=1e3,n=3,p=1;export{e as averageLoadingTimeSmoothingFactor,p as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,c as tilesWaitingTime,n as transitionDurationFactor};
|
|
5
|
+
const e=.1,o=1,t=1,c=1e3,n=3,p=1,r=1.1;export{e as averageLoadingTimeSmoothingFactor,p as defaultTransitionDuration,t as fadeInTime,o as fadeOutTime,r as thresholdForLoadingAllTiles,c as tilesWaitingTime,n as transitionDurationFactor};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e
|
|
5
|
+
import{reallocGrowthFactor as e}from"../../../../core/arrayUtils.js";import{makeScheduleFunction as s}from"../../layers/support/makeScheduleFunction.js";import{GaussianSplatSortWorkerHandle as r}from"../GaussianSplatWorkerHandle.js";import{GaussianSplatOrderTexture as t}from"./GaussianSplatOrderTexture.js";import{GaussianSplatTextureAtlas as i}from"./GaussianSplatTextureAtlas.js";class a{constructor(e){this.visibleGaussians=0,this._visibleGaussianTiles=new Array,this._workerHandle=null,this._isSorting=!1,this._pendingSortTask=!1,this._bufferCapacity=0,this._renderer=e,this._orderTexture=new t(this._renderer.renderingContext),this._textureAtlas=new i(this._renderer.renderingContext,this._renderer.view.resourceController.memoryController,this._renderer.fboCache);const{resourceController:a}=this._renderer.view;this._workerHandle=new r(s(a))}get textureAtlas(){return this._textureAtlas}get orderTexture(){return this._orderTexture}get visibleGaussianTiles(){return this._visibleGaussianTiles}updateGaussianVisibility(e){this._visibleGaussianTiles=e,this.requestSort()}requestSort(){this._isSorting?this._pendingSortTask=!0:(this._isSorting=!0,this._pendingSortTask=!1,this._sortOnWorker().then(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}).catch(()=>{this._isSorting=!1,this._pendingSortTask&&this.requestSort()}))}destroy(){this._workerHandle?.destroyWorkerAndSelf(),this._textureAtlas.destroy(),this._orderTexture.destroy()}_clearBuffersAndTextures(){this._bufferCapacity=0,this._orderTexture.clear(),this._textureAtlas.clear()}_ensureBufferCapacity(s){if(this._bufferCapacity<s){const r=Math.ceil(s*e);this._atlasIndicesBuffer=new Uint32Array(r),this._sortedAtlasIndicesBuffer=new Uint32Array(r),this._bufferCapacity=r}}async _sortOnWorker(){let e=0;if(this._visibleGaussianTiles.forEach(s=>e+=s.gaussianAtlasIndices.length),0===e)return this.visibleGaussians=0,this._clearBuffersAndTextures(),void this._renderer.requestRender(1);this._ensureBufferCapacity(e),this._textureAtlas.ensureTextureAtlas();const s=this._renderer.camera.ray.direction,r=s[0],t=s[1],i=s[2],n=1/Math.sqrt(r*r+t*t+i*i),o=r*n,l=t*n,u=i*n,h=this._atlasIndicesBuffer.subarray(0,e),d=new Float64Array(e);let _=0;this._visibleGaussianTiles.forEach(e=>{const s=e.gaussianAtlasIndices,r=e.positions;for(let t=0;t<s.length;t++){h[_]=s[t];const e=3*t,i=r[e],a=r[e+1],n=r[e+2];d[_]=i*o+a*l+n*u,_++}});const c=new Uint32Array(e);for(let a=0;a<e;a++)c[a]=a;const f={distances:d,sortOrderIndices:c};await(this._workerHandle?.sort(f).then(s=>{const r=this._sortedAtlasIndicesBuffer.subarray(0,e);for(let t=0;t<e;t++)r[t]=h[s.sortedOrderIndices[t]];this._orderTexture.setData(r,e),this.visibleGaussians=Math.min(e,a.maxAllowedVisibleGaussians),this._renderer.requestRender(1)}))}static{this.maxAllowedVisibleGaussians=4194304}}export{a as GaussianSplatDataStore};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
const i=new Map([["low",{minimumSplatPixelRadius:2,minimumOpacity:.05}],["medium",{minimumSplatPixelRadius:1,minimumOpacity:.02}],["high",{minimumSplatPixelRadius:.5,minimumOpacity:.005}]]);function m(m){return i.get(m)}export{m as getGaussianSplatQualitySettings};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import"../../../webgl/BufferObject.js";import{FramebufferObject as e}from"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as
|
|
5
|
+
import{reallocGrowthFactor as t}from"../../../../core/arrayUtils.js";import"../../../webgl/BufferObject.js";import{FramebufferObject as e}from"../../../webgl/FramebufferObject.js";import"../../../webgl/Program.js";import"../../../../core/has.js";import"../../../webgl/Renderbuffer.js";import{Texture as r}from"../../../webgl/Texture.js";import"../../../../core/Logger.js";import{PixelType as s,SizedPixelFormat as a}from"../../../webgl/enums.js";import"../../../webgl/checkWebGLError.js";import{initialSplatAtlasTextureHeight as i,GaussianSplatAtlasPages as o,splatAtlasTextureWidth as l,elementsPerSplatPage as h}from"./GaussianSplatAtlasPages.js";import{TextureDescriptor as u}from"../../../webgl/TextureDescriptor.js";class p{constructor(t,e,r){this._splatAtlasTextureHeight=i,this.texture=null,this._rctx=t,this._fboCache=r,this.pageAllocator=new o,this._cache=e.newCache("gaussian texture cache",t=>t.dispose())}ensureTextureAtlas(){if(this.texture)return;const t=this._cache.pop("splatTextureAtlas");if(t)return void(this.texture=t);const e=new u;e.height=this._splatAtlasTextureHeight,e.width=l,e.pixelFormat=36249,e.dataType=s.UNSIGNED_INT,e.internalFormat=a.RGBA32UI,e.samplingMode=9728,e.wrapMode=33071,this.texture=new r(this._rctx,e),this._updatePageAllocator()}grow(){if(!this.texture)return this.ensureTextureAtlas(),!1;const r=Math.floor(this._splatAtlasTextureHeight*t);if(r*l>this._rctx.parameters.maxPreferredTexturePixels)return!1;const s=new e(this._rctx,this.texture),a=this._fboCache.acquire(l,r,"gaussian splat atlas resize",11);return this._rctx.blitFramebuffer(s,a.fbo,16384,9728,0,0,l,this._splatAtlasTextureHeight,0,0,l,this._splatAtlasTextureHeight),this.texture?.dispose(),this.texture=a.fbo?.detachColorTexture(),s.dispose(),a.dispose(),this._splatAtlasTextureHeight=r,this._updatePageAllocator(),!0}requestPage(){let t=this.pageAllocator.findFirstFreePage();return null===t&&this.grow()&&(t=this.pageAllocator.findFirstFreePage()),null!==t&&this.pageAllocator.allocate(t),t}freePage(t){this.pageAllocator.free(t)}update(t,e,r){this.ensureTextureAtlas(),this.texture.updateData(0,t,e,h,1,r)}_updatePageAllocator(){const t=l*this._splatAtlasTextureHeight/h;this.pageAllocator.pageCount!==t&&this.pageAllocator.resize(t)}clear(){this.texture&&(this._cache.put("splatTextureAtlas",this.texture),this.texture=null)}destroy(){this._cache.destroy(),this.texture?.dispose()}}export{p as GaussianSplatTextureAtlas};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as r,l as n,g as o,u as
|
|
5
|
+
import{__decorate as t}from"tslib";import{watch as s}from"../../../../core/reactiveUtils.js";import"../../../../core/Logger.js";import"../../../../core/has.js";import"../../../../core/RandomLCG.js";import"../../../../core/Error.js";import{subclass as e}from"../../../../core/accessorSupport/decorators/subclass.js";import{set as i}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{d as r,l as n,g as o,u as l,e as h,k as c,J as m,c as p}from"../../../../chunks/vec32.js";import{create as u,clone as d}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{s as g}from"../../../../chunks/vec42.js";import{create as _}from"../../../../geometry/support/plane.js";import{fromPoints as f}from"../../../../geometry/support/ray.js";import{j as b,i as P}from"../../../../chunks/sphere.js";import{RenderCategory as S}from"../../webgl.js";import{GaussianSplatTarget as C}from"../../layers/i3s/Intersector.js";import{GaussianSplatDataStore as v}from"../../support/gaussianSplatting/GaussianSplatDataStore.js";import{getGaussianSplatQualitySettings as j}from"../../support/gaussianSplatting/GaussianSplatQualitySettings.js";import q from"../../webgl/RenderNode.js";import{IntersectorResult as w}from"./IntersectorResult.js";import{G as y}from"../../../../chunks/GaussianSplat.glsl.js";import{G as D}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as x}from"../shaders/GaussianSplatCompositionTechnique.js";import{G}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as T}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatDepthTechnique as R}from"../shaders/GaussianSplatDepthTechnique.js";import{GaussianSplatTechnique as A}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as V}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{DepthStencilAttachment as E,PrimitiveType as I}from"../../../webgl/enums.js";var M;let k=class extends q{constructor(){super(...arguments),this.gaussianPosition=u(),this.intersectionRayDir=u(),this.intersectionPlane=_(),this._slicePlaneEnabled=!1,this._data=null,this.produces=S.OPAQUE,this.type=0,this.isGround=!1,this.layerViewUid="",this._gaussianSplatParameters=new y,this._gaussianSplatCompositionParameters=new D,this._gaussianSplatDepthCompositionParameters=new G,this._splatDepthTechniqueConfiguration=new V(!0),this._previousCameraPosition=u(),this._previousCameraDirection=u(),this._tanFov=a(),this._tempVec=u(),this._cameraDelta=u(),this._coarseCameraPosition=u()}static{M=this}async initialize(){this._data=new v(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this),this.addHandles([s(()=>this.view.state.camera,()=>this._onCameraChange())])}precompile(){this.techniques.precompile(A),this.techniques.precompile(R,this._splatDepthTechniqueConfiguration),this.techniques.precompile(x),this.techniques.precompile(T)}render(t){const s=t.find(({name:t})=>t===S.OPAQUE);if(!this._data.visibleGaussians||!this._data.orderTexture.texture||!this._data.textureAtlas.texture)return s;const e=this.techniques.get(A),a=this.techniques.get(R,this._splatDepthTechniqueConfiguration),r=this.techniques.get(x),n=this.techniques.get(T);if(!(e.compiled&&a.compiled&&n.compiled&&r.compiled))return this.requestRender(1),s;const{fullWidth:o,fullHeight:l}=this.bindParameters.camera,h=this.fboCache,c=h.acquire(o,l,"gaussian color output");c.attachDepth(s.getAttachment(E));const m=this.renderingContext;m.bindFramebuffer(c.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this._gaussianSplatParameters.totalGaussians=this._data.visibleGaussians,this._gaussianSplatParameters.splatOrder=this._data.orderTexture.texture,this._gaussianSplatParameters.splatAtlas=this._data.textureAtlas.texture;const p=Math.tan(.5*this.camera.fovY),u=p/l*o;i(this._tanFov,u,p);const d=l/(2*p);this._gaussianSplatParameters.focalLength=d,this._gaussianSplatParameters.tanFov=this._tanFov;const g=j(this.view.qualityProfile),_=g.minimumSplatPixelRadius*Math.sqrt(o*l)/Math.sqrt(2073600);this._gaussianSplatParameters.minSplatRadius=_,this._gaussianSplatParameters.minSplatOpacity=g.minimumOpacity,this._prepareHighPrecisionCameraPosition(),this.renderingContext.bindTechnique(e,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(I.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const f=h.acquire(o,l,"splat depth",8);f.attachDepth(s.getAttachment(E)),m.bindFramebuffer(f.fbo),m.setClearColor(0,0,0,0),m.clear(16384),this.renderingContext.bindTechnique(a,this.bindParameters,this._gaussianSplatParameters),this.renderingContext.drawArraysInstanced(I.TRIANGLE_STRIP,0,4,this._data.visibleGaussians);const b=h.acquire(o,l,this.produces);return this._gaussianSplatDepthCompositionParameters.splatDepth=f.getTexture(),b.attachDepth(s.getAttachment(E)),m.bindFramebuffer(b.fbo),m.bindTechnique(n,this.bindParameters,this._gaussianSplatDepthCompositionParameters),m.screen.draw(),this._gaussianSplatCompositionParameters.color=s.getTexture(),this._gaussianSplatCompositionParameters.splatColor=c.getTexture(),m.bindFramebuffer(b.fbo),m.bindTechnique(r,this.bindParameters,this._gaussianSplatCompositionParameters),m.screen.draw(),c.release(),f.release(),b}intersect(t,s,e,i){const{gaussianPosition:a,intersectionRayDir:m,intersectionPlane:p,layerViewUid:_}=this,S=f(e,i);r(m,i,e);const v=1/n(m);o(m,m,v);const j=u();l(j,m),g(p,m[0],m[1],m[2],-h(m,e));const q=new U,y=new U,D=new Array;this._data.visibleGaussianTiles.forEach(r=>{const{maxScale:n}=r,o=r.obb.minimumDistancePlane(p),l=r.obb.maximumDistancePlane(p),u=l<0,g=null!=q.dist&&null!=y.dist&&q.dist<o*v&&y.dist>l*v;if(u||g)return;const f=b(r.obb.center,r.obb.radius+n);if(!P(f,S,null))return;if(!r.obb.intersectRay(e,m,n))return;const{positions:C,squaredScales:w,gaussianAtlasIndices:x}=r,G=x.length;for(let p=0;p<G;p++){const r=3*p;a[0]=C[r]-e[0],a[1]=C[r+1]-e[1],a[2]=C[r+2]-e[2];const n=w[p],o=h(a,m),l=o*o;if(c(a)-l>n)continue;const u=o*v,g=t=>(t.point=t.point?t.point.fill(a[0],a[1],a[2]):d(a),t.dist=u,t.normal=j,t.layerViewUid=_,t);if((null==q.dist||u<q.dist)&&(null==s||s(e,i,u))&&g(q),0!==t.options.store&&(null==y.dist||u>y.dist)&&(null==s||s(e,i,u))&&g(y),2===t.options.store&&(null==s||s(e,i,u))){const t=new U;D.push(g(t))}}});const x=(t,s)=>{const{layerViewUid:e}=s,i=new C(s.point,e);t.set(0,i,s.dist,s.normal)};if(F(q)){const s=t.results.min;(null==s.distance||q.dist<s.distance)&&x(s,q)}if(F(y)&&0!==t.options.store){const s=t.results.max;(null==s.distance||y.dist>s.distance)&&x(s,y)}if(2===t.options.store)for(const r of D){const s=new w(S);x(s,r),t.results.all.push(s)}}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(t){this._slicePlaneEnabled!==t&&(this._slicePlaneEnabled=t,this.requestRender(1))}get data(){return this._data}destroy(){this._data.destroy(),super.destroy()}_onCameraChange(){const t=this.view.state.camera.eye,s=this.view.state.camera.ray.direction,e=.001;(Math.abs(t[0]-this._previousCameraPosition[0])>e||Math.abs(t[1]-this._previousCameraPosition[1])>e||Math.abs(t[2]-this._previousCameraPosition[2])>e||Math.abs(s[0]-this._previousCameraDirection[0])>e||Math.abs(s[1]-this._previousCameraDirection[1])>e||Math.abs(s[2]-this._previousCameraDirection[2])>e)&&this._data.requestSort()}_prepareHighPrecisionCameraPosition(){o(this._tempVec,this.camera.eye,1/M.tileSize),m(this._tempVec,this._tempVec),p(this._coarseCameraPosition,this._tempVec),this._gaussianSplatParameters.cameraPos8k=this._coarseCameraPosition,o(this._tempVec,this._tempVec,M.tileSize),r(this._cameraDelta,this.camera.eye,this._tempVec),this._gaussianSplatParameters.cameraDelta=this._cameraDelta}static{this.tileSize=2.048}};function F(t){return null!=t.dist&&null!=t.point}k=M=t([e("esri.views.3d.webgl-engine.lib.GaussianSplatRenderNode")],k);class U{constructor(){this.point=null,this.dist=null,this.normal=null,this.layerViewUid=""}}export{k as GaussianSplatRenderNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{i as t,d as n,n as o,c as e,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as a,clone as c,create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as y}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{timeStampsToAttribute as I,numTimeStampValuesPerVertex as P}from"../../support/engineContent/line.js";import{Attribute as x}from"./Attribute.js";import{scale as z,length as D,normalize as S,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";const O=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],V=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],k=[0,0,1,0,1,1,0,1],G=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],U=new Array(36);for(let It=0;It<6;It++)for(let t=0;t<6;t++)U[6*It+t]=It;const B=new Array(36);for(let It=0;It<6;It++)B[6*It]=0,B[6*It+1]=1,B[6*It+2]=2,B[6*It+3]=2,B[6*It+4]=3,B[6*It+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=O[e][0]*n[0],o[3*e+1]=O[e][1]*n[1],o[3*e+2]=O[e][2]*n[2];return new C(t,[["position",new x(o,G,3,!0)],["normal",new x(V,U,3)],["uv0",new x(k,B,2)]])}const H=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],J=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],K=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],L=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function N(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=H[e][0]*n[0],o[3*e+1]=H[e][1]*n[1],o[3*e+2]=H[e][2]*n[2];return new C(t,[["position",new x(o,K,3,!0)],["normal",new x(J,L,3)]])}const Q=a(-.5,0,-.5),R=a(.5,0,-.5),T=a(0,0,.5),W=a(0,.5,0),X=i(),Y=i(),Z=i(),$=i(),_=i();n(X,Q,W),n(Y,Q,R),l(Z,X,Y),o(Z,Z),n(X,R,W),n(Y,R,T),l($,X,Y),o($,$),n(X,T,W),n(Y,T,Q),l(_,X,Y),o(_,_);const tt=[Q,R,T,W],nt=[0,-1,0,Z[0],Z[1],Z[2],$[0],$[1],$[2],_[0],_[1],_[2]],ot=[0,1,2,3,1,0,3,2,1,3,0,2],et=[0,0,0,1,1,1,2,2,2,3,3,3];function st(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=tt[e][0]*n[0],o[3*e+1]=tt[e][1]*n[1],o[3*e+2]=tt[e][2]*n[2];return new C(t,[["position",new x(o,ot,3,!0)],["normal",new x(nt,et,3)]])}function rt(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,a=Math.max(3,Math.floor(o)),c=Math.max(2,Math.floor(e)),i=(a+1)*(c+1),p=m(3*i),f=m(3*i),w=m(2*i),g=[];let M=0;for(let m=0;m<=c;m++){const t=[],o=m/c,e=h+o*u,s=Math.cos(e);for(let h=0;h<=a;h++){const u=h/a,c=r+u*l,i=Math.cos(c)*s,g=Math.sin(e),m=-Math.sin(c)*s;p[3*M]=i*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=i,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const A=new Array;for(let m=0;m<c;m++)for(let t=0;t<a;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(A.push(n),A.push(e),A.push(s)):m===c-1?(A.push(n),A.push(o),A.push(e)):(A.push(n),A.push(o),A.push(e),A.push(e),A.push(s),A.push(n))}const b=[["position",new x(p,A,3,!0)],["normal",new x(f,A,3,!0)]];return s.uv&&b.push(["uv0",new x(w,A,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new x(Float64Array.from(s.offset),y(A.length),3,!0)])),new C(t,b)}function lt(t,n,o,e){const s=ht(n,o,e);return new C(t,s)}function ht(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<s.length;a+=3)z(s,a,t/D(s,a));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),z(s,r,t/D(s,r)),r/=3,l[e]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),a=h(s,t),c=4*o;n[c]=t,n[c+1]=l,n[c+2]=a,n[c+3]=e,n[c+4]=u,n[c+5]=l,n[c+6]=s,n[c+7]=a,n[c+8]=u,n[c+9]=l,n[c+10]=u,n[c+11]=a}r=n,l={}}const u=M(s);for(let a=0;a<u.length;a+=3)S(u,a);return[["position",new x(M(s),r,3,!0)],["normal",new x(u,r,3,!0)]]}function ut(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,olidColor:a=null}={}){const c=o?f(o):p(),i=n?f(n):w(0,0,1),g=e?[e[0],e[1],e[2],e.length>3?e[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],M=null!=s?[s]:[0],A=y(1),b=[["position",new x(c,A,3,!0)],["normal",new x(i,A,3,!0)],["color",new x(g,A,4,!0)],["size",new x(m,A,2)],["rotation",new x(M,A,1,!0)]];if(h&&b.push(["uvi",new x(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];b.push(["centerOffsetAndDistance",new x(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];b.push(["featureAttribute",new x(t,A,4)])}return new C(t,b,null,1,a)}const at=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=at){const o=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)o[3*a+t]=n[a][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new x(o,e,3,!0)],["normal",new x(s,r,3,!0)],["uv0",new x(l,e,2,!0)],["color",new x(h,r,4,!0)]];return new C(t,u)}function it(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let c=a(0,l,0),i=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,i=a(0,0,0),c=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[i,c],g=[p,f],M=o+2,A=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(e)}const y=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)y.push(1),y.push(t-1),y.push(t),b.push(0),b.push(0),b.push(0);y.push(w.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)y.push(t),y.push(t-1),y.push(0),b.push(t),b.push(t-1),b.push(1);y.push(0),y.push(2),y.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new x(j,y,3,!0)],["normal",new x(d,b,3,!0)]]}function pt(t,n,o,e,s,r=!0,l=!0){return new C(t,it(n,o,e,s,r,l))}function ft(n,e,h,p,f,w,g){const M=f?c(f):a(1,0,0),A=w?c(w):a(0,0,0);g??=!0;const y=i();o(y,M);const b=i();s(b,y,Math.abs(e));const j=i();s(j,b,-.5),r(j,j,A);const d=a(0,1,0);Math.abs(1-u(y,d))<.2&&t(d,0,0,1);const v=i();l(v,y,d),o(v,v),l(d,v,y);const I=2*p+(g?2:0),P=p+(g?2:0),z=m(3*I),D=m(3*P),S=m(2*I),q=new Array(3*p*(g?4:2)),F=new Array(3*p*(g?4:2));g&&(z[3*(I-2)]=j[0],z[3*(I-2)+1]=j[1],z[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,z[3*(I-1)]=z[3*(I-2)]+b[0],z[3*(I-1)+1]=z[3*(I-2)+1]+b[1],z[3*(I-1)+2]=z[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,D[3*(P-2)]=-y[0],D[3*(P-2)+1]=-y[1],D[3*(P-2)+2]=-y[2],D[3*(P-1)]=y[0],D[3*(P-1)+1]=y[1],D[3*(P-1)+2]=y[2]);const O=(t,n,o)=>{q[t]=n,F[t]=o};let V=0;const k=i(),G=i();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(k,d,Math.sin(n)),s(G,v,Math.cos(n)),r(k,k,G),D[3*t]=k[0],D[3*t+1]=k[1],D[3*t+2]=k[2],s(k,k,h),r(k,k,j),z[3*t]=k[0],z[3*t+1]=k[1],z[3*t+2]=k[2],S[2*t]=t/p,S[2*t+1]=0,z[3*(t+p)]=z[3*t]+b[0],z[3*(t+p)+1]=z[3*t+1]+b[1],z[3*(t+p)+2]=z[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;O(V++,t,t),O(V++,t+p,t),O(V++,o,o),O(V++,o,o),O(V++,t+p,t),O(V++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;O(V++,I-2,P-2),O(V++,t,P-2),O(V++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;O(V++,t+p,P-1),O(V++,I-1,P-1),O(V++,n+p,P-1)}}const U=[["position",new x(z,q,3,!0)],["normal",new x(D,F,3,!0)],["uv0",new x(S,q,2,!0)]];return new C(n,U)}function wt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let a=0;a<e;a++){h.push([0,-a-1,-(a+1)%e-1]);const t=a/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return gt(t,u,n,l,h,s,r)}function gt(h,u,c,i,f,w,g=a(0,0,0)){const M=u.length,A=m(c.length*M*3+(6*i.length||0)),y=m(c.length*M*3+(i?6:0)),I=new Array,P=new Array;let z=0,D=0;const S=p(),q=p(),F=p(),O=p(),V=p(),k=p(),G=p(),U=p(),B=p(),E=p(),H=p(),J=p(),K=p(),L=b();t(B,0,1,0),n(q,c[1],c[0]),o(q,q),w?(r(U,c[0],g),o(F,U)):t(F,0,0,1),jt(q,F,B,B,V,F,dt),e(O,F),e(J,V);for(let t=0;t<i.length;t++)s(k,V,i[t][0]),s(U,F,i[t][2]),r(k,k,U),r(k,k,c[0]),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2];y[D++]=-q[0],y[D++]=-q[1],y[D++]=-q[2];for(let t=0;t<f.length;t++)I.push(f[t][0]>0?f[t][0]:-f[t][0]-1+i.length),I.push(f[t][1]>0?f[t][1]:-f[t][1]-1+i.length),I.push(f[t][2]>0?f[t][2]:-f[t][2]-1+i.length),P.push(0),P.push(0),P.push(0);let N=i.length;const Q=i.length-1;for(let t=0;t<c.length;t++){let h=!1;if(t>0){e(S,q),t<c.length-1?(n(q,c[t+1],c[t]),o(q,q)):h=!0,r(E,S,q),o(E,E),r(H,c[t-1],O),j(c[t],E,L);d(L,v(H,S),U)?(n(U,U,c[t]),o(F,U),l(V,E,F),o(V,V)):jt(E,O,J,B,V,F,dt),e(O,F),e(J,V)}w&&(r(U,c[t],g),o(K,U));for(let n=0;n<M;n++)if(s(k,V,u[n][0]),s(U,F,u[n][1]),r(k,k,U),o(G,k),y[D++]=G[0],y[D++]=G[1],y[D++]=G[2],r(k,k,c[t]),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2],!h){const t=(n+1)%M;I.push(N+n),I.push(N+M+n),I.push(N+t),I.push(N+t),I.push(N+M+n),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=c[c.length-1];for(let t=0;t<i.length;t++)s(k,V,i[t][0]),s(U,F,i[t][1]),r(k,k,U),r(k,k,R),A[z++]=k[0],A[z++]=k[1],A[z++]=k[2];const T=D/3;y[D++]=q[0],y[D++]=q[1],y[D++]=q[2];const W=N-M;for(let t=0;t<f.length;t++)I.push(f[t][0]>=0?N+f[t][0]:-f[t][0]-1+W),I.push(f[t][2]>=0?N+f[t][2]:-f[t][2]-1+W),I.push(f[t][1]>=0?N+f[t][1]:-f[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new x(A,I,3,!0)],["normal",new x(y,P,3,!0)]];return new C(h,X)}function mt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let c=0;c<n.length;c++){for(let t=0;t<3;t++)r[h++]=n[c][t];c>0&&(l[u++]=c-1,l[u++]=c)}const a=[["position",new x(r,l,3,!0)]];if(o&&o.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];a.push(["normal",new x(t,l,3,!0)])}if(e&&a.push(["color",new x(e,A(e.length/4),4)]),s&&s.length===n.length){const t=I(s,1);a.push(["timeStamps",new x(t,l,P,!0)])}return new C(t,a,null,2)}function Mt(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let a=0;a<6;a++)l[3*a]=h[a][0],l[3*a+1]=h[a][1],l[3*a+2]=h[a][2];return new C(t,[["position",new x(l,u,3,!0)]])}function At(n,o){const e=n.getMutableAttribute("position").data;for(let s=0;s<e.length;s+=3){const n=e[s],r=e[s+1],l=e[s+2];t(vt,n,r,l),h(vt,vt,o),e[s]=vt[0],e[s+1]=vt[1],e[s+2]=vt[2]}}function yt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function bt(t,n,e,s,r){return!(Math.abs(u(n,t))>r)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function jt(t,n,o,e,s,r,l){return bt(t,n,s,r,l)||bt(t,o,s,r,l)||bt(t,e,s,r,l)}const dt=.99619469809,vt=p();export{yt as cgToGIS,E as createBoxGeometry,pt as createConeGeometry,it as createConeGeometryData,ft as createCylinderGeometry,N as createDiamondGeometry,Mt as createExtrudedTriangle,gt as createPathExtrusionGeometry,ut as createPointGeometry,ht as createPolySphereData,lt as createPolySphereGeometry,mt as createPolylineGeometry,rt as createSphereGeometry,ct as createSquareGeometry,st as createTetrahedronGeometry,wt as createTubeGeometry,jt as makeOrthoBasisDirUpFallback,At as transformInPlace};
|
|
5
|
+
import{i as t,d as n,n as o,c as e,g as s,f as r,h as l,t as h,e as u}from"../../../../chunks/vec32.js";import{fromValues as a,clone as i,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec3f32.js";import{create as p,clone as f,fromValues as w}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{newDoubleArray as g}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as m,floatArrayFrom as M}from"../../../../geometry/support/FloatArray.js";import{getContinuousIndexArray as A,getZeroIndexArray as y}from"../../../../geometry/support/Indices.js";import{create as b,fromPositionAndNormal as j,intersectRay as d}from"../../../../geometry/support/plane.js";import{wrap as v}from"../../../../geometry/support/ray.js";import{timeStampsToAttribute as I,numTimeStampValuesPerVertex as P}from"../../support/engineContent/line.js";import{Attribute as x}from"./Attribute.js";import{scale as D,length as z,normalize as S,add as q}from"./bufferVectorMath.js";import{Geometry as C}from"./Geometry.js";import{assert as F}from"./Util.js";import{getHUDMaterialBaseInstance as O}from"../materials/HUDMaterialBaseInstance.js";const U=[[-.5,-.5,.5],[.5,-.5,.5],[.5,.5,.5],[-.5,.5,.5],[-.5,-.5,-.5],[.5,-.5,-.5],[.5,.5,-.5],[-.5,.5,-.5]],V=[0,0,1,-1,0,0,1,0,0,0,-1,0,0,1,0,0,0,-1],k=[0,0,1,0,1,1,0,1],B=[0,1,2,2,3,0,4,0,3,3,7,4,1,5,6,6,2,1,1,0,4,4,5,1,3,2,6,6,7,3,5,4,7,7,6,5],G=new Array(36);for(let Pt=0;Pt<6;Pt++)for(let t=0;t<6;t++)G[6*Pt+t]=Pt;const H=new Array(36);for(let Pt=0;Pt<6;Pt++)H[6*Pt]=0,H[6*Pt+1]=1,H[6*Pt+2]=2,H[6*Pt+3]=2,H[6*Pt+4]=3,H[6*Pt+5]=0;function E(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(24);for(let e=0;e<8;e++)o[3*e]=U[e][0]*n[0],o[3*e+1]=U[e][1]*n[1],o[3*e+2]=U[e][2]*n[2];return new C(t,[["position",new x(o,B,3,!0)],["normal",new x(V,G,3)],["uv0",new x(k,H,2)]])}const J=[[-.5,0,-.5],[.5,0,-.5],[.5,0,.5],[-.5,0,.5],[0,-.5,0],[0,.5,0]],K=[0,1,-1,1,1,0,0,1,1,-1,1,0,0,-1,-1,1,-1,0,0,-1,1,-1,-1,0],L=[5,1,0,5,2,1,5,3,2,5,0,3,4,0,1,4,1,2,4,2,3,4,3,0],N=[0,0,0,1,1,1,2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7];function Q(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(18);for(let e=0;e<6;e++)o[3*e]=J[e][0]*n[0],o[3*e+1]=J[e][1]*n[1],o[3*e+2]=J[e][2]*n[2];return new C(t,[["position",new x(o,L,3,!0)],["normal",new x(K,N,3)]])}const R=a(-.5,0,-.5),T=a(.5,0,-.5),W=a(0,0,.5),X=a(0,.5,0),Y=c(),Z=c(),$=c(),_=c(),tt=c();n(Y,R,X),n(Z,R,T),l($,Y,Z),o($,$),n(Y,T,X),n(Z,T,W),l(_,Y,Z),o(_,_),n(Y,W,X),n(Z,W,R),l(tt,Y,Z),o(tt,tt);const nt=[R,T,W,X],ot=[0,-1,0,$[0],$[1],$[2],_[0],_[1],_[2],tt[0],tt[1],tt[2]],et=[0,1,2,3,1,0,3,2,1,3,0,2],st=[0,0,0,1,1,1,2,2,2,3,3,3];function rt(t,n){Array.isArray(n)||(n=[n,n,n]);const o=new Array(12);for(let e=0;e<4;e++)o[3*e]=nt[e][0]*n[0],o[3*e+1]=nt[e][1]*n[1],o[3*e+2]=nt[e][2]*n[2];return new C(t,[["position",new x(o,et,3,!0)],["normal",new x(ot,st,3)]])}function lt(t,n,o,e,s={uv:!0}){const r=-Math.PI,l=2*Math.PI,h=-Math.PI/2,u=Math.PI,a=Math.max(3,Math.floor(o)),i=Math.max(2,Math.floor(e)),c=(a+1)*(i+1),p=m(3*c),f=m(3*c),w=m(2*c),g=[];let M=0;for(let m=0;m<=i;m++){const t=[],o=m/i,e=h+o*u,s=Math.cos(e);for(let h=0;h<=a;h++){const u=h/a,i=r+u*l,c=Math.cos(i)*s,g=Math.sin(e),m=-Math.sin(i)*s;p[3*M]=c*n,p[3*M+1]=g*n,p[3*M+2]=m*n,f[3*M]=c,f[3*M+1]=g,f[3*M+2]=m,w[2*M]=u,w[2*M+1]=o,t.push(M),++M}g.push(t)}const A=new Array;for(let m=0;m<i;m++)for(let t=0;t<a;t++){const n=g[m][t],o=g[m][t+1],e=g[m+1][t+1],s=g[m+1][t];0===m?(A.push(n),A.push(e),A.push(s)):m===i-1?(A.push(n),A.push(o),A.push(e)):(A.push(n),A.push(o),A.push(e),A.push(e),A.push(s),A.push(n))}const b=[["position",new x(p,A,3,!0)],["normal",new x(f,A,3,!0)]];return s.uv&&b.push(["uv0",new x(w,A,2,!0)]),s.offset&&(b[0][0]="offset",b.push(["position",new x(Float64Array.from(s.offset),y(A.length),3,!0)])),new C(t,b)}function ht(t,n,o,e){const s=ut(n,o,e);return new C(t,s)}function ut(t,n,o){const e=t;let s,r;if(o)s=[0,-1,0,1,0,0,0,0,1,-1,0,0,0,0,-1,0,1,0],r=[0,1,2,0,2,3,0,3,4,0,4,1,1,5,2,2,5,3,3,5,4,4,5,1];else{const t=e*(1+Math.sqrt(5))/2;s=[-e,t,0,e,t,0,-e,-t,0,e,-t,0,0,-e,t,0,e,t,0,-e,-t,0,e,-t,t,0,-e,t,0,e,-t,0,-e,-t,0,e],r=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1]}for(let a=0;a<s.length;a+=3)D(s,a,t/z(s,a));let l={};function h(n,o){n>o&&([n,o]=[o,n]);const e=n.toString()+"."+o.toString();if(l[e])return l[e];let r=s.length;return s.length+=3,q(s,3*n,s,3*o,s,r),D(s,r,t/z(s,r)),r/=3,l[e]=r,r}for(let a=0;a<n;a++){const t=r.length,n=new Array(4*t);for(let o=0;o<t;o+=3){const t=r[o],e=r[o+1],s=r[o+2],l=h(t,e),u=h(e,s),a=h(s,t),i=4*o;n[i]=t,n[i+1]=l,n[i+2]=a,n[i+3]=e,n[i+4]=u,n[i+5]=l,n[i+6]=s,n[i+7]=a,n[i+8]=u,n[i+9]=l,n[i+10]=u,n[i+11]=a}r=n,l={}}const u=M(s);for(let a=0;a<u.length;a+=3)S(u,a);return[["position",new x(M(s),r,3,!0)],["normal",new x(u,r,3,!0)]]}function at(t,{normal:n,position:o,color:e,rotation:s,size:r,centerOffsetAndDistance:l,uvi:h,featureAttribute:u,olidColor:a=null}={}){const i=o?f(o):p(),c=n?f(n):w(0,0,1),g=e?[e[0],e[1],e[2],e.length>3?e[3]:255]:[255,255,255,255],m=null!=r&&2===r.length?r:[1,1],M=null!=s?[s]:[0],A=y(1),b=[["position",new x(i,A,3,!0)],["normal",new x(c,A,3,!0)],["color",new x(g,A,4,!0)],["size",new x(m,A,2)],["rotation",new x(M,A,1,!0)]];if(h&&b.push(["uvi",new x(h,A,h.length)]),null!=l){const t=[l[0],l[1],l[2],l[3]];b.push(["centerOffsetAndDistance",new x(t,A,4)])}if(u){const t=[u[0],u[1],u[2],u[3]];b.push(["featureAttribute",new x(t,A,4)])}return new C(t,b,null,1,a,void 0,O())}const it=[[-1,-1,0],[1,-1,0],[1,1,0],[-1,1,0]];function ct(t,n=it){const o=new Array(12);for(let a=0;a<4;a++)for(let t=0;t<3;t++)o[3*a+t]=n[a][t];const e=[0,1,2,2,3,0],s=[0,0,1],r=[0,0,0,0,0,0],l=[0,0,1,0,1,1,0,1],h=[255,255,255,255],u=[["position",new x(o,e,3,!0)],["normal",new x(s,r,3,!0)],["uv0",new x(l,e,2,!0)],["color",new x(h,r,4,!0)]];return new C(t,u)}function pt(t,n,o,e,s=!0,r=!0){let l=0;const h=n,u=t;let i=a(0,l,0),c=a(0,l+u,0),p=a(0,-1,0),f=a(0,1,0);e&&(l=u,c=a(0,0,0),i=a(0,l,0),p=a(0,1,0),f=a(0,-1,0));const w=[c,i],g=[p,f],M=o+2,A=Math.sqrt(u*u+h*h);if(e)for(let m=o-1;m>=0;m--){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,-h/A,u*Math.sin(t)/A);g.push(e)}else for(let m=0;m<o;m++){const t=m*(2*Math.PI/o),n=a(Math.cos(t)*h,l,Math.sin(t)*h);w.push(n);const e=a(u*Math.cos(t)/A,h/A,u*Math.sin(t)/A);g.push(e)}const y=new Array,b=new Array;if(s){for(let t=3;t<w.length;t++)y.push(1),y.push(t-1),y.push(t),b.push(0),b.push(0),b.push(0);y.push(w.length-1),y.push(2),y.push(1),b.push(0),b.push(0),b.push(0)}if(r){for(let t=3;t<w.length;t++)y.push(t),y.push(t-1),y.push(0),b.push(t),b.push(t-1),b.push(1);y.push(0),y.push(2),y.push(w.length-1),b.push(1),b.push(2),b.push(g.length-1)}const j=m(3*M);for(let a=0;a<M;a++)j[3*a]=w[a][0],j[3*a+1]=w[a][1],j[3*a+2]=w[a][2];const d=m(3*M);for(let a=0;a<M;a++)d[3*a]=g[a][0],d[3*a+1]=g[a][1],d[3*a+2]=g[a][2];return[["position",new x(j,y,3,!0)],["normal",new x(d,b,3,!0)]]}function ft(t,n,o,e,s,r=!0,l=!0){return new C(t,pt(n,o,e,s,r,l))}function wt(n,e,h,p,f,w,g){const M=f?i(f):a(1,0,0),A=w?i(w):a(0,0,0);g??=!0;const y=c();o(y,M);const b=c();s(b,y,Math.abs(e));const j=c();s(j,b,-.5),r(j,j,A);const d=a(0,1,0);Math.abs(1-u(y,d))<.2&&t(d,0,0,1);const v=c();l(v,y,d),o(v,v),l(d,v,y);const I=2*p+(g?2:0),P=p+(g?2:0),D=m(3*I),z=m(3*P),S=m(2*I),q=new Array(3*p*(g?4:2)),F=new Array(3*p*(g?4:2));g&&(D[3*(I-2)]=j[0],D[3*(I-2)+1]=j[1],D[3*(I-2)+2]=j[2],S[2*(I-2)]=0,S[2*(I-2)+1]=0,D[3*(I-1)]=D[3*(I-2)]+b[0],D[3*(I-1)+1]=D[3*(I-2)+1]+b[1],D[3*(I-1)+2]=D[3*(I-2)+2]+b[2],S[2*(I-1)]=1,S[2*(I-1)+1]=1,z[3*(P-2)]=-y[0],z[3*(P-2)+1]=-y[1],z[3*(P-2)+2]=-y[2],z[3*(P-1)]=y[0],z[3*(P-1)+1]=y[1],z[3*(P-1)+2]=y[2]);const O=(t,n,o)=>{q[t]=n,F[t]=o};let U=0;const V=c(),k=c();for(let t=0;t<p;t++){const n=t*(2*Math.PI/p);s(V,d,Math.sin(n)),s(k,v,Math.cos(n)),r(V,V,k),z[3*t]=V[0],z[3*t+1]=V[1],z[3*t+2]=V[2],s(V,V,h),r(V,V,j),D[3*t]=V[0],D[3*t+1]=V[1],D[3*t+2]=V[2],S[2*t]=t/p,S[2*t+1]=0,D[3*(t+p)]=D[3*t]+b[0],D[3*(t+p)+1]=D[3*t+1]+b[1],D[3*(t+p)+2]=D[3*t+2]+b[2],S[2*(t+p)]=t/p,S[2*t+1]=1;const o=(t+1)%p;O(U++,t,t),O(U++,t+p,t),O(U++,o,o),O(U++,o,o),O(U++,t+p,t),O(U++,o+p,o)}if(g){for(let t=0;t<p;t++){const n=(t+1)%p;O(U++,I-2,P-2),O(U++,t,P-2),O(U++,n,P-2)}for(let t=0;t<p;t++){const n=(t+1)%p;O(U++,t+p,P-1),O(U++,I-1,P-1),O(U++,n+p,P-1)}}const B=[["position",new x(D,q,3,!0)],["normal",new x(z,F,3,!0)],["uv0",new x(S,q,2,!0)]];return new C(n,B)}function gt(t,n,o,e,s,r){e=e||10,s=null==s||s,F(n.length>1);const l=[[0,0,0]],h=[],u=[];for(let a=0;a<e;a++){h.push([0,-a-1,-(a+1)%e-1]);const t=a/e*2*Math.PI;u.push([Math.cos(t)*o,Math.sin(t)*o])}return mt(t,u,n,l,h,s,r)}function mt(h,u,i,c,f,w,g=a(0,0,0)){const M=u.length,A=m(i.length*M*3+(6*c.length||0)),y=m(i.length*M*3+(c?6:0)),I=new Array,P=new Array;let D=0,z=0;const S=p(),q=p(),F=p(),O=p(),U=p(),V=p(),k=p(),B=p(),G=p(),H=p(),E=p(),J=p(),K=p(),L=b();t(G,0,1,0),n(q,i[1],i[0]),o(q,q),w?(r(B,i[0],g),o(F,B)):t(F,0,0,1),dt(q,F,G,G,U,F,vt),e(O,F),e(J,U);for(let t=0;t<c.length;t++)s(V,U,c[t][0]),s(B,F,c[t][2]),r(V,V,B),r(V,V,i[0]),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2];y[z++]=-q[0],y[z++]=-q[1],y[z++]=-q[2];for(let t=0;t<f.length;t++)I.push(f[t][0]>0?f[t][0]:-f[t][0]-1+c.length),I.push(f[t][1]>0?f[t][1]:-f[t][1]-1+c.length),I.push(f[t][2]>0?f[t][2]:-f[t][2]-1+c.length),P.push(0),P.push(0),P.push(0);let N=c.length;const Q=c.length-1;for(let t=0;t<i.length;t++){let h=!1;if(t>0){e(S,q),t<i.length-1?(n(q,i[t+1],i[t]),o(q,q)):h=!0,r(H,S,q),o(H,H),r(E,i[t-1],O),j(i[t],H,L);d(L,v(E,S),B)?(n(B,B,i[t]),o(F,B),l(U,H,F),o(U,U)):dt(H,O,J,G,U,F,vt),e(O,F),e(J,U)}w&&(r(B,i[t],g),o(K,B));for(let n=0;n<M;n++)if(s(V,U,u[n][0]),s(B,F,u[n][1]),r(V,V,B),o(k,V),y[z++]=k[0],y[z++]=k[1],y[z++]=k[2],r(V,V,i[t]),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2],!h){const t=(n+1)%M;I.push(N+n),I.push(N+M+n),I.push(N+t),I.push(N+t),I.push(N+M+n),I.push(N+M+t);for(let n=0;n<6;n++){const t=I.length-6;P.push(I[t+n]-Q)}}N+=M}const R=i[i.length-1];for(let t=0;t<c.length;t++)s(V,U,c[t][0]),s(B,F,c[t][1]),r(V,V,B),r(V,V,R),A[D++]=V[0],A[D++]=V[1],A[D++]=V[2];const T=z/3;y[z++]=q[0],y[z++]=q[1],y[z++]=q[2];const W=N-M;for(let t=0;t<f.length;t++)I.push(f[t][0]>=0?N+f[t][0]:-f[t][0]-1+W),I.push(f[t][2]>=0?N+f[t][2]:-f[t][2]-1+W),I.push(f[t][1]>=0?N+f[t][1]:-f[t][1]-1+W),P.push(T),P.push(T),P.push(T);const X=[["position",new x(A,I,3,!0)],["normal",new x(y,P,3,!0)]];return new C(h,X)}function Mt(t,n,o,e,s){const r=g(3*n.length),l=new Array(2*(n.length-1));let h=0,u=0;for(let i=0;i<n.length;i++){for(let t=0;t<3;t++)r[h++]=n[i][t];i>0&&(l[u++]=i-1,l[u++]=i)}const a=[["position",new x(r,l,3,!0)]];if(o&&o.length===n.length&&3===o[0].length){const t=m(3*o.length);let e=0;for(let s=0;s<n.length;s++)for(let n=0;n<3;n++)t[e++]=o[s][n];a.push(["normal",new x(t,l,3,!0)])}if(e&&a.push(["color",new x(e,A(e.length/4),4)]),s&&s.length===n.length){const t=I(s,1);a.push(["timeStamps",new x(t,l,P,!0)])}return new C(t,a,null,2)}function At(t,n,o,e,s,r=0){const l=new Array(18),h=[[-o,r,s/2],[e,r,s/2],[0,n+r,s/2],[-o,r,-s/2],[e,r,-s/2],[0,n+r,-s/2]],u=[0,1,2,3,0,2,2,5,3,1,4,5,5,2,1,1,0,3,3,4,1,4,3,5];for(let a=0;a<6;a++)l[3*a]=h[a][0],l[3*a+1]=h[a][1],l[3*a+2]=h[a][2];return new C(t,[["position",new x(l,u,3,!0)]])}function yt(n,o){const e=n.getMutableAttribute("position").data;for(let s=0;s<e.length;s+=3){const n=e[s],r=e[s+1],l=e[s+2];t(It,n,r,l),h(It,It,o),e[s]=It[0],e[s+1]=It[1],e[s+2]=It[2]}}function bt(t,n=t){const o=t.attributes,e=o.get("position").data,s=o.get("normal").data;if(s){const t=n.getMutableAttribute("normal").data;for(let n=0;n<s.length;n+=3){const o=s[n+1];t[n+1]=-s[n+2],t[n+2]=o}}if(e){const t=n.getMutableAttribute("position").data;for(let n=0;n<e.length;n+=3){const o=e[n+1];t[n+1]=-e[n+2],t[n+2]=o}}}function jt(t,n,e,s,r){return!(Math.abs(u(n,t))>r)&&(l(e,t,n),o(e,e),l(s,e,t),o(s,s),!0)}function dt(t,n,o,e,s,r,l){return jt(t,n,s,r,l)||jt(t,o,s,r,l)||jt(t,e,s,r,l)}const vt=.99619469809,It=p();export{bt as cgToGIS,E as createBoxGeometry,ft as createConeGeometry,pt as createConeGeometryData,wt as createCylinderGeometry,Q as createDiamondGeometry,At as createExtrudedTriangle,mt as createPathExtrusionGeometry,at as createPointGeometry,ut as createPolySphereData,ht as createPolySphereGeometry,Mt as createPolylineGeometry,lt as createSphereGeometry,ct as createSquareGeometry,rt as createTetrahedronGeometry,gt as createTubeGeometry,dt as makeOrthoBasisDirUpFallback,yt as transformInPlace};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as
|
|
5
|
+
import{isColorEmission as r}from"../core/shaderLibrary/ShaderOutput.js";import{ColorAttachment0 as e,ColorAttachment1 as t,ColorAttachment2 as n}from"../../../webgl/enums.js";import{defaultDepthWrite as s,separateBlendingParams as u,premultipliedAlpha as c,unpremultipliedAlphaToPremultipliedAlpha as o}from"../../../webgl/renderState.js";const f=u(1,0,1,771);function a(r,e=!1){switch(r){case 0:return e?c:o;case 1:return f;case 2:case 3:return null}}function i(r){if(r.draped)return null;switch(r.oitPass){case 0:case 2:return r.writeDepth?s:null;case 1:case 3:return null}}const l=5e5,b={factor:-1,units:-2};function m({oitPass:r,enableOffset:e}){return e&&1===r?b:null}function p(r,e=513){return 0===r||2===r?e:515}function d(s,u){const c=r(u);return 1===s?c?{buffers:[e,t,n]}:{buffers:[e,t]}:c?{buffers:[e,t]}:null}export{b as OITPolygonOffset,l as OITPolygonOffsetLimit,a as blending,f as blendingColorAlpha,i as depthWrite,d as getDrawBuffers,p as oitDepthTest,m as oitPolygonOffset};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}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{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as u,t as f,n as p,d as h,g as d,c as m,l as g,j as b,f as v,a as x,o as S,e as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as F}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D,BufferViewVec3f as R,BufferViewFloat as V,BufferViewVec2f as A,BufferViewVec4f as C}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as w}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as T}from"../../support/debugFlags.js";import{isColorEmissionHighlightOrOID as U,isColorOrColorEmission as E}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as L}from"../core/shaderLibrary/hud/HUD.glsl.js";import{olidEnabled as B}from"../effects/geometry/olidUtils.js";import{GLTextureMaterialBindParameters as I,GLTextureMaterial as q}from"../lib/GLTextureMaterial.js";import{Material as G}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as W}from"../lib/screenSizePerspectiveUtils.js";import{assert as H}from"../lib/Util.js";import{writePosition as N,writeNormal as X,writeColor as Y,writeBufferFloat as k,writeBufferVec4 as J,writeBufferVec4Zeros as K,writeOlidColor as Q}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as Z}from"./internal/MaterialUtil.js";import{c as $,f as ee}from"../../../../chunks/HUDMaterial.glsl.js";import{olidLayout as te,layout as ie,HUDMaterialTechnique as se}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as re}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as ae}from"../../../../webscene/support/AlphaCutoff.js";class ne extends G{constructor(e,t){super(e,Ce),this.produces=new Map([[13,e=>U(e)&&!this.parameters.drawAsLabel],[14,e=>U(e)&&this.parameters.drawAsLabel],[12,()=>this.parameters.occlusionTest],[18,e=>this.parameters.draped&&U(e)]]),this._visible=!0,this._configuration=new re(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=12===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||12===t.slot,E(e)&&(this._configuration.debugDrawLabelBorder=!!T.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,je),{scaleX:j,scaleY:M}=Te(P,y,S.pixelRatio);i(Se,t),e.attributes.has("featureAttribute")&&ue(Se);const F=e.attributes.get("position"),D=e.attributes.get("size"),R=e.attributes.get("normal"),V=e.attributes.get("rotation"),A=e.attributes.get("centerOffsetAndDistance");H(F.size>=3);const C=$(y),w="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<F.data.length/F.size;i++){const e=i*F.size;u(he,F.data[e],F.data[e+1],F.data[e+2]),f(he,he,t),f(he,he,S.viewMatrix);const a=i*A.size;if(u(_e,A.data[a],A.data[a+1],A.data[a+2]),!w&&(he[0]+=_e[0],he[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,he),h(he,he,d(_e,_e,e))}const n=i*R.size;if(u(de,R.data[n],R.data[n+1],R.data[n+2]),ce(de,Se,S,Me),Ue(this.parameters,he,Me,S,pe),S.applyProjection(he,me),me[0]>-1){w&&(_e[0]||_e[1])&&(me[0]+=_e[0]*S.pixelRatio,0!==_e[1]&&(me[1]+=pe.alignmentEvaluator.apply(_e[1])*S.pixelRatio),S.unapplyProjection(me,he)),me[0]+=this.parameters.screenOffset[0]*S.pixelRatio,me[1]+=this.parameters.screenOffset[1]*S.pixelRatio,me[0]=Math.floor(me[0]),me[1]=Math.floor(me[1]);const e=i*D.size;Re[0]=D.data[e],Re[1]=D.data[e+1],pe.evaluator.applyVec2(Re,Re);const t=Fe*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*Re[0])*S.pixelRatio/2}Re[0]*=j,Re[1]*=M;const n=i*V.size,l=y.rotation+V.data[n];if(fe(x,me[0],me[1],Re,t,a,l,y,C)){const e=s.ray;if(f(be,he,r(Oe,S.viewMatrix)),me[0]=x[0],me[1]=x[1],S.unprojectFromRenderScreen(me,he)){const t=O();m(t,e.direction);const i=1/g(t);d(t,t,i);o(b(e.origin,he)*i,t,-1,be)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=$(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,je),{scaleX:p,scaleY:h}=Te(f,l,e.screenToWorldRatio),d=De*e.screenToWorldRatio;for(let m=0;m<a.data.length/a.size;m++){const t=m*a.size,u=a.data[t],f=a.data[t+1],g=m*n.size;Re[0]=n.data[g],Re[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*Re[0])*e.screenToWorldRatio/2}Re[0]*=p,Re[1]*=h;const v=m*o.size,x=l.rotation+o.data[v];fe(i,u,f,Re,d,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new we}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ce(t,i,r,Me);return this._applyVerticalGroundOffsetView(e,o,r,n),Ue(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&m(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return m(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return d(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*L,o=d(he,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&m(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(de,i),x(i,i,d(de,de,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&m(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&m(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=ae||t>=ae&&i[3]>=ae;return this._visible&&s}createGLMaterial(e){return new oe(e)}calculateRelativeScreenBounds(e,t,i=F()){return le(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class oe extends q{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique(se,e)}}function le(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ce(e,t,s,r){return M(t)&&(t=i(ye,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(ge,Ae),r}function ue(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function fe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,d=s-a-r[1]*f[1],m=d+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],d+=r[1]*g[1],h-=r[0]*(1-g[2]),m-=r[1]*(1-g[3]),p-=l,h+=l,d-=l,m+=l),n(xe,i,s),o(ve,e,xe,t(c)),ve[0]>p&&ve[0]<h&&ve[1]>d&&ve[1]<m}const pe=new W,he=O(),de=O(),me=P(),ge=O(),be=O(),ve=c(),xe=c(),Se=s(),ye=s(),Oe=a(),ze=P(),_e=O(),Pe=O(),je=P(),Me={normal:ge,cosAngle:0},Fe=1,De=2,Re=l(0,0),Ve=6,Ae=z(0,0,1);class Ce extends I{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class we{constructor(){this.layout=B()?te:ie}elementCount(e){return e.get("position").indices.length*Ve}write(e,t,i,s,r,a){const{position:n,normal:o,uvi:l,color:c,size:u,rotation:f,centerOffsetAndDistance:p,featureAttribute:h}=r;N(i.get("position"),e,n,a,Ve),X(i.get("normal"),t,o,a,Ve);const d=i.get("uvi")?.data;let m=0,g=0,b=-1-ee,v=-1-ee;d&&d.length>=4&&(m=d[0],g=d[1],b=-1-d[2],v=-1-d[3]);let x=i.get("position").indices.length,S=a;for(let z=0;z<x;++z)l.set(S,0,m),l.set(S,1,g),S++,l.set(S,0,b),l.set(S,1,g),S++,l.set(S,0,b),l.set(S,1,v),S++,l.set(S,0,b),l.set(S,1,v),S++,l.set(S,0,m),l.set(S,1,v),S++,l.set(S,0,m),l.set(S,1,g),S++;Y(i.get("color"),4,c,a,Ve);const{data:y,indices:O}=i.get("size");x=O.length,S=a;for(let z=0;z<x;++z){const e=y[2*O[z]],t=y[2*O[z]+1];for(let i=0;i<Ve;++i)u.set(S,0,e),u.set(S,1,t),S++}if(k(i.get("rotation"),f,a,Ve),i.get("centerOffsetAndDistance")?J(i.get("centerOffsetAndDistance"),p,a,Ve):K(p,a,x*Ve),i.get("featureAttribute")?J(i.get("featureAttribute"),h,a,Ve):K(h,a,x*Ve),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);Q(s,i,t,a,Ve)}}return{numVerticesPerItem:Ve,numItems:x}}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.layout.createView(e),_=z.getField("position",R),P=z.getField("normal",R),j=z.getField("rotation",V),M=z.getField("size",A),F=z.getField("featureAttribute",C),D=z.getField("centerOffsetAndDistance",C),w="screen"===t.centerOffsetUnits,T=$(t);if(null==_||null==P||null==j||null==M||null==D||null==y)return;const U=null==F?null:F.getVec(0,je),{scaleX:E,scaleY:L}=Te(U,t,y.pixelRatio),B=_.count/Ve;for(let R=0;R<B;R++){const e=R*Ve;if(_.getVec(e,he),null!=i&&v(he,he,i),f(he,he,y.viewMatrix),D.getVec(e,ze),u(_e,ze[0],ze[1],ze[2]),!w&&(he[0]+=_e[0],he[1]+=_e[1],0!==_e[2])){const e=_e[2];p(_e,he),h(he,he,d(_e,_e,e))}if(P.getVec(e,de),ce(de,Se,y,Me),Ue(t,he,Me,y,pe),y.applyProjection(he,me),me[0]>-1){w&&(_e[0]||_e[1])&&(me[0]+=_e[0]*y.pixelRatio,0!==_e[1]&&(me[1]+=pe.alignmentEvaluator.apply(_e[1])*y.pixelRatio),y.unapplyProjection(me,he)),me[0]+=t.screenOffset[0]*y.pixelRatio,me[1]+=t.screenOffset[1]*y.pixelRatio,me[0]=Math.floor(me[0]),me[1]=Math.floor(me[1]),M.getVec(e,Re),pe.evaluator.applyVec2(Re,Re);const i=Fe*y.pixelRatio;let a=0;if(t.textureIsSignedDistanceField){a=Math.min(t.outlineSize,.5*Re[0])*y.pixelRatio/2}Re[0]*=E,Re[1]*=L;const n=j.get(e),l=t.rotation+n;if(fe(S,me[0],me[1],Re,i,a,l,t,T)){const e=s.ray;if(f(be,he,r(Oe,y.viewMatrix)),me[0]=S[0],me[1]=S[1],y.unprojectFromRenderScreen(me,he)){const t=O();m(t,e.direction);const i=1/g(t);d(t,t,i);o(b(e.origin,he)*i,t,R,be)}}}}}}function Te(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(w(Pe,t,e),{scaleX:Pe[0]*i,scaleY:Pe[1]*i})}function Ue(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=Z(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),d(i.normal,i.normal,o),v(t,t,i.normal)}export{ne as HUDMaterial,Ce as Parameters};
|
|
5
|
+
import{clamp as e,deg2rad as t}from"../../../../core/mathUtils.js";import{fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as r}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{fromValues as l,create as c}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{i as u,t as f,n as p,d as h,g as m,c as d,l as g,j as b,f as v,a as x,o as S,e as y}from"../../../../chunks/vec32.js";import{create as O,fromValues as z}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromArray as _,create as P,freeze as j}from"../../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{isMat4 as M}from"../../../../core/libs/gl-matrix-2/types/mat4.js";import{create as V}from"../../../../geometry/support/aaBoundingRect.js";import{BufferViewVec4u8 as D}from"../../../../geometry/support/buffer/BufferView.js";import{evaluateModelTransformScale as R}from"../../layers/support/FastSymbolUpdates.js";import{debugFlags as A}from"../../support/debugFlags.js";import{isColorEmissionHighlightOrOID as C,isColorOrColorEmission as w}from"../core/shaderLibrary/ShaderOutput.js";import{HUDVerticalPixelOffset as F}from"../core/shaderLibrary/hud/HUD.glsl.js";import{GLTextureMaterialBindParameters as T,GLTextureMaterial as L}from"../lib/GLTextureMaterial.js";import{Material as E}from"../lib/Material.js";import{SeparateScreenSizePerspectiveEvaluators as U}from"../lib/screenSizePerspectiveUtils.js";import{assert as B}from"../lib/Util.js";import{writePosition as I,writeNormal as q,writeColor as G,writeBufferVec2 as W,writeBufferFloat as H,writeBufferVec4 as N,writeBufferVec4Zeros as X,writeOlidColor as Y}from"./internal/bufferWriterUtils.js";import{verticalOffsetAtDistance as k}from"./internal/MaterialUtil.js";import{c as J,f as K}from"../../../../chunks/HUDMaterial.glsl.js";import{baseLayout as Q,getInstanceLayout as Z,HUDMaterialTechnique as $}from"../shaders/HUDMaterialTechnique.js";import{HUDMaterialTechniqueConfiguration as ee}from"../shaders/HUDMaterialTechniqueConfiguration.js";import{alphaCutoff as te}from"../../../../webscene/support/AlphaCutoff.js";class ie extends E{constructor(e,t){super(e,Ve),this.produces=new Map([[13,e=>C(e)&&!this.parameters.drawAsLabel],[14,e=>C(e)&&this.parameters.drawAsLabel],[12,()=>this.parameters.occlusionTest],[18,e=>this.parameters.draped&&C(e)]]),this._visible=!0,this._configuration=new ee(t)}getConfiguration(e,t){const i=this.parameters.draped;return super.getConfiguration(e,t,this._configuration),this._configuration.hasSlicePlane=this.parameters.hasSlicePlane,this._configuration.hasVerticalOffset=!!this.parameters.verticalOffset,this._configuration.hasScreenSizePerspective=!!this.parameters.screenSizePerspective,this._configuration.screenCenterOffsetUnitsEnabled="screen"===this.parameters.centerOffsetUnits,this._configuration.hasPolygonOffset=this.parameters.polygonOffset,this._configuration.draped=i,this._configuration.occlusionTestEnabled=this.parameters.occlusionTest,this._configuration.pixelSnappingEnabled=this.parameters.pixelSnappingEnabled,this._configuration.signedDistanceFieldEnabled=this.parameters.textureIsSignedDistanceField,this._configuration.sampleSignedDistanceFieldTexelCenter=this.parameters.sampleSignedDistanceFieldTexelCenter,this._configuration.hasRotation=this.parameters.hasRotation,this._configuration.hasVVSize=!!this.parameters.vvSize,this._configuration.hasVVColor=!!this.parameters.vvColor,this._configuration.occlusionPass=12===t.slot,this._configuration.occludedFragmentFade=!i&&this.parameters.occludedFragmentFade,this._configuration.horizonCullingEnabled=this.parameters.horizonCullingEnabled,this._configuration.isFocused=this.parameters.isFocused,this._configuration.depthTestEnabled=this.parameters.depthEnabled||12===t.slot,w(e)&&(this._configuration.debugDrawLabelBorder=!!A.LABELS_SHOW_BORDER),this._configuration.oitPass=t.oitPass,this._configuration.terrainDepthTest=t.terrainDepthTest,this._configuration.cullAboveTerrain=t.cullAboveTerrain,this._configuration}intersect(e,t,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:v},point:x,camera:S}=s,{parameters:y}=this;if(!l||!c||v&&y.isLabel||!e.visible||!x||!S)return;const z=e.attributes.get("featureAttribute"),P=null==z?null:_(z.data,Oe),{scaleX:j,scaleY:M}=Re(P,y,S.pixelRatio);i(ge,t),e.attributes.has("featureAttribute")&&ne(ge);const V=e.attributes.get("position"),D=e.attributes.get("size"),R=e.attributes.get("normal"),A=e.attributes.get("rotation"),C=e.attributes.get("centerOffsetAndDistance");B(V.size>=3);const w=J(y),F="screen"===this.parameters.centerOffsetUnits;for(let i=0;i<V.data.length/V.size;i++){const e=i*V.size;u(ce,V.data[e],V.data[e+1],V.data[e+2]),f(ce,ce,t),f(ce,ce,S.viewMatrix);const a=i*C.size;if(u(Se,C.data[a],C.data[a+1],C.data[a+2]),!F&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}const n=i*R.size;if(u(ue,R.data[n],R.data[n+1],R.data[n+2]),ae(ue,ge,S,ze),Ae(this.parameters,ce,ze,S,le),S.applyProjection(ce,fe),fe[0]>-1){F&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*S.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*S.pixelRatio),S.unapplyProjection(fe,ce)),fe[0]+=this.parameters.screenOffset[0]*S.pixelRatio,fe[1]+=this.parameters.screenOffset[1]*S.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]);const e=i*D.size;je[0]=D.data[e],je[1]=D.data[e+1],le.evaluator.applyVec2(je,je);const t=_e*S.pixelRatio;let a=0;if(y.textureIsSignedDistanceField){a=Math.min(y.outlineSize,.5*je[0])*S.pixelRatio/2}je[0]*=j,je[1]*=M;const n=i*A.size,l=y.rotation+A.data[n];if(oe(x,fe[0],fe[1],je,t,a,l,y,w)){const e=s.ray;if(f(he,ce,r(ve,S.viewMatrix)),fe[0]=x[0],fe[1]=x[1],S.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,-1,he)}}}}}intersectDraped(e,t,i,s,r){const a=e.attributes.get("position"),n=e.attributes.get("size"),o=e.attributes.get("rotation"),l=this.parameters,c=J(l),u=e.attributes.get("featureAttribute"),f=null==u?null:_(u.data,Oe),{scaleX:p,scaleY:h}=Re(f,l,e.screenToWorldRatio),m=Pe*e.screenToWorldRatio;for(let d=0;d<a.data.length/a.size;d++){const t=d*a.size,u=a.data[t],f=a.data[t+1],g=d*n.size;je[0]=n.data[g],je[1]=n.data[g+1];let b=0;if(l.textureIsSignedDistanceField){b=Math.min(l.outlineSize,.5*je[0])*e.screenToWorldRatio/2}je[0]*=p,je[1]*=h;const v=d*o.size,x=l.rotation+o.data[v];oe(i,u,f,je,m,b,x,l,c)&&s(r.distance,r.normal,-1)}}createBufferWriter(){return new De}applyShaderOffsetsView(e,t,i,s,r,a,n){const o=ae(t,i,r,ze);return this._applyVerticalGroundOffsetView(e,o,r,n),Ae(this.parameters,n,o,r,a),this._applyPolygonOffsetView(n,o,s[3],r,n),this._applyCenterOffsetView(n,s,n),n}applyShaderOffsetsNDC(e,t,i,s,r){return this._applyCenterOffsetNDC(e,t,i,s),null!=r&&d(r,s),this._applyPolygonOffsetNDC(s,t,i,s),s}_applyPolygonOffsetView(t,i,s,r,a){const n=r.aboveGround?1:-1;let o=Math.sign(s);0===o&&(o=n);const l=n*o;if(this.parameters.shaderPolygonOffset<=0)return d(a,t);const c=e(Math.abs(i.cosAngle),.01,1),u=1-Math.sqrt(1-c*c)/c/r.viewport[2];return m(a,t,l>0?u:1/u),a}_applyVerticalGroundOffsetView(e,t,i,s){const r=g(e),a=i.aboveGround?1:-1,n=i.computeRenderPixelSizeAtDist(r)*F,o=m(ce,t.normal,a*n);return v(s,e,o),s}_applyCenterOffsetView(e,t,i){const s="screen"!==this.parameters.centerOffsetUnits;return i!==e&&d(i,e),s&&(i[0]+=t[0],i[1]+=t[1],t[2]&&(p(ue,i),x(i,i,m(ue,ue,t[2])))),i}_applyCenterOffsetNDC(e,t,i,s){const r="screen"!==this.parameters.centerOffsetUnits;return s!==e&&d(s,e),r||(s[0]+=t[0]/i.fullWidth*2,s[1]+=t[1]/i.fullHeight*2),s}_applyPolygonOffsetNDC(e,t,i,s){const r=this.parameters.shaderPolygonOffset;if(e!==s&&d(s,e),r){const e=i.aboveGround?1:-1,a=e*Math.sign(t[3]);s[2]-=(a||e)*r}return s}set visible(e){this._visible=e}get visible(){const{color:e,outlineSize:t,outlineColor:i}=this.parameters,s=e[3]>=te||t>=te&&i[3]>=te;return this._visible&&s}createGLMaterial(e){return new se(e)}calculateRelativeScreenBounds(e,t,i=V()){return re(this.parameters,e,t,i),i[2]=i[0]+e[0],i[3]=i[1]+e[1],i}}class se extends L{constructor(e){super({...e,...e.material.parameters})}beginSlot(e){return this.updateTexture(this._material.parameters.textureId),this._material.setParameters(this.textureBindParameters),this.getTechnique($,e)}}function re(e,t,i,s){s[0]=e.anchorPosition[0]*-t[0]+e.screenOffset[0]*i,s[1]=e.anchorPosition[1]*-t[1]+e.screenOffset[1]*i}function ae(e,t,s,r){return M(t)&&(t=i(be,t)),S(r.normal,e,t),f(r.normal,r.normal,s.viewInverseTransposeMatrix),r.cosAngle=y(pe,Me),r}function ne(e){const t=e[0],i=e[1],s=e[2],r=e[3],a=e[4],n=e[5],o=e[6],l=e[7],c=e[8],u=1/Math.sqrt(t*t+i*i+s*s),f=1/Math.sqrt(r*r+a*a+n*n),p=1/Math.sqrt(o*o+l*l+c*c);return e[0]=t*u,e[1]=i*u,e[2]=s*u,e[3]=r*f,e[4]=a*f,e[5]=n*f,e[6]=o*p,e[7]=l*p,e[8]=c*p,e}function oe(e,i,s,r,a,l,c,u,f){let p=i-a-r[0]*f[0],h=p+r[0]+2*a,m=s-a-r[1]*f[1],d=m+r[1]+2*a;const g=u.distanceFieldBoundingBox;return u.textureIsSignedDistanceField&&null!=g&&(p+=r[0]*g[0],m+=r[1]*g[1],h-=r[0]*(1-g[2]),d-=r[1]*(1-g[3]),p-=l,h+=l,m-=l,d+=l),n(de,i,s),o(me,e,de,t(c)),me[0]>p&&me[0]<h&&me[1]>m&&me[1]<d}const le=new U,ce=O(),ue=O(),fe=P(),pe=O(),he=O(),me=c(),de=c(),ge=s(),be=s(),ve=a(),xe=P(),Se=O(),ye=O(),Oe=P(),ze={normal:pe,cosAngle:0},_e=1,Pe=2,je=l(0,0),Me=z(0,0,1);class Ve extends T{constructor(){super(...arguments),this.renderOccluded=1,this.isDecoration=!1,this.color=j(1,1,1,1),this.polygonOffset=!1,this.anchorPosition=l(.5,.5),this.screenOffset=[0,0],this.shaderPolygonOffset=1e-5,this.textureIsSignedDistanceField=!1,this.sampleSignedDistanceFieldTexelCenter=!1,this.outlineColor=j(1,1,1,1),this.outlineSize=0,this.distanceFieldBoundingBox=P(),this.rotation=0,this.hasRotation=!1,this.vvSizeEnabled=!1,this.vvSize=null,this.vvColor=null,this.vvOpacity=null,this.vvSymbolAnchor=null,this.vvSymbolRotationMatrix=null,this.hasSlicePlane=!1,this.pixelSnappingEnabled=!0,this.occlusionTest=!0,this.occludedFragmentFade=!1,this.horizonCullingEnabled=!1,this.centerOffsetUnits="world",this.drawAsLabel=!1,this.depthEnabled=!0,this.isFocused=!0,this.focusStyle="bright",this.draped=!1,this.isLabel=!1}get hasVVSize(){return!!this.vvSize}get hasVVColor(){return!!this.vvColor}get hasVVOpacity(){return!!this.vvOpacity}}class De{constructor(){this.layout=Q,this.instanceLayout=Z()}elementCount(e){return e.get("position").indices.length}elementCountBaseInstance(e){return e.get("uv0").indices.length}write(e,t,i,s,r,a){const{position:n,normal:o,color:l,size:c,rotation:u,centerOffsetAndDistance:f,featureAttribute:p,uvi:h}=r;I(i.get("position"),e,n,a),q(i.get("normal"),t,o,a);const m=i.get("position").indices.length;let d=0,g=0,b=K,v=K;const x=i.get("uvi")?.data;x&&x.length>=4&&(d=x[0],g=x[1],b=x[2],v=x[3]);for(let S=0;S<m;++S){const e=a+S;h.setValues(e,d,g,b,v)}if(G(i.get("color"),4,l,a),W(i.get("size"),c,a),H(i.get("rotation"),u,a),i.get("centerOffsetAndDistance")?N(i.get("centerOffsetAndDistance"),f,a):X(f,a,m),i.get("featureAttribute")?N(i.get("featureAttribute"),p,a):X(p,a,m),null!=s){const e=i.get("position")?.indices;if(e){const t=e.length,i=r.getField("olidColor",D);Y(s,i,t,a)}}return{numVerticesPerItem:1,numItems:m}}writeBaseInstance(e,t){const{uv0:i}=t;W(e.get("uv0"),i,0)}intersect(e,t,i,s,a,n,o){const{options:{selectionMode:l,hud:c,excludeLabels:x},point:S,camera:y}=s;if(!l||!c||x&&t.isLabel||!S)return;const z=this.instanceLayout.createView(e),{position:_,normal:P,rotation:j,size:M,featureAttribute:V,centerOffsetAndDistance:D}=z,R="screen"===t.centerOffsetUnits,A=J(t);if(null==_||null==P||null==j||null==M||null==D||null==y)return;const C=null==V?null:V.getVec(0,Oe),{scaleX:w,scaleY:F}=Re(C,t,y.pixelRatio),T=_.count;for(let L=0;L<T;L++){if(_.getVec(L,ce),null!=i&&v(ce,ce,i),f(ce,ce,y.viewMatrix),D.getVec(L,xe),u(Se,xe[0],xe[1],xe[2]),!R&&(ce[0]+=Se[0],ce[1]+=Se[1],0!==Se[2])){const e=Se[2];p(Se,ce),h(ce,ce,m(Se,Se,e))}if(P.getVec(L,ue),ae(ue,ge,y,ze),Ae(t,ce,ze,y,le),y.applyProjection(ce,fe),fe[0]>-1){R&&(Se[0]||Se[1])&&(fe[0]+=Se[0]*y.pixelRatio,0!==Se[1]&&(fe[1]+=le.alignmentEvaluator.apply(Se[1])*y.pixelRatio),y.unapplyProjection(fe,ce)),fe[0]+=t.screenOffset[0]*y.pixelRatio,fe[1]+=t.screenOffset[1]*y.pixelRatio,fe[0]=Math.floor(fe[0]),fe[1]=Math.floor(fe[1]),M.getVec(L,je),le.evaluator.applyVec2(je,je);const e=_e*y.pixelRatio;let i=0;if(t.textureIsSignedDistanceField){i=Math.min(t.outlineSize,.5*je[0])*y.pixelRatio/2}je[0]*=w,je[1]*=F;const a=j.get(L),n=t.rotation+a;if(oe(S,fe[0],fe[1],je,e,i,n,t,A)){const e=s.ray;if(f(he,ce,r(ve,y.viewMatrix)),fe[0]=S[0],fe[1]=S[1],y.unprojectFromRenderScreen(fe,ce)){const t=O();d(t,e.direction);const i=1/g(t);m(t,t,i);o(b(e.origin,ce)*i,t,L,he)}}}}}}function Re(e,t,i){return null==e||null==t.vvSize?{scaleX:i,scaleY:i}:(R(ye,t,e),{scaleX:ye[0]*i,scaleY:ye[1]*i})}function Ae(e,t,i,s,r){if(!e.verticalOffset?.screenLength){const s=g(t);return r.update(i.cosAngle,s,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),t}const a=g(t),n=e.screenSizePerspectiveAlignment??e.screenSizePerspective,o=k(s,a,e.verticalOffset,i.cosAngle,n,e.screenSizePerspectiveMinPixelReferenceSize);return r.update(i.cosAngle,a,e.screenSizePerspective,e.screenSizePerspectiveMinPixelReferenceSize,e.screenSizePerspectiveAlignment,null),m(i.normal,i.normal,o),v(t,t,i.normal)}export{ie as HUDMaterial,Ve as Parameters};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/*
|
|
2
|
+
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
|
+
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
|
+
*/
|
|
5
|
+
import{Attribute as t}from"../lib/Attribute.js";import{GeometryBaseInstance as n}from"../lib/GeometryBaseInstance.js";function e(){return o??=r(),o}function r(){const e=0,r=255,o=new t([e,e,e,r,r,e,r,r],[0,1,2,3],2,!0);return new n([["uv0",o]])}let o=null;export{e as getHUDMaterialBaseInstance};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as
|
|
5
|
+
import{set as t,squaredDistance as e}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import s from"../lib/GLMaterial.js";import{Material as i}from"../lib/Material.js";import{writePosition as n,writeBufferFloat as a}from"./internal/bufferWriterUtils.js";import{attributeDrivenInstanceLayout as o,instanceLayout as u,HeatmapDensityPassParameters as c,HeatmapDensityTechnique as l,baseLayout as f}from"../shaders/HeatmapDensityTechnique.js";import{HeatmapDensityTechniqueConfiguration as m}from"../shaders/HeatmapDensityTechniqueConfiguration.js";const h=2;class p extends c{constructor(){super(...arguments),this.isAttributeDriven=!1,this.usesHalfFloats=!1}}class g extends i{constructor(t){super(t,p),this.produces=new Map([[18,t=>0===t]]),this._configuration=new m}getConfiguration(t,e){return super.getConfiguration(t,e,this._configuration),this._configuration.isAttributeDriven=this.parameters.isAttributeDriven,this._configuration.usesHalfFloat=this.parameters.usesHalfFloats,this._configuration}get visible(){return!0}createGLMaterial(t){return new b(t)}intersect(){}intersectDraped(r,s,i,n,a){const o=r.attributes.get("position"),{parameters:u}=this,{searchRadius:c}=u,{screenToWorldRatio:l}=r,f=c*l+h*l,m=f*f,p=o.data.length/o.size;for(let h=0;h<p;h++){const r=h*o.size,s=t(v,o.data[r],o.data[r+1]);e(s,i)<m&&n(a.distance,a.normal,-1)}}createBufferWriter(){return new d(this.parameters.isAttributeDriven?o:u)}}class b extends s{beginSlot(t){return this.getTechnique(l,t)}}class d{constructor(t){this.instanceLayout=t,this.layout=f}elementCount(t){return t.get("position").indices.length}elementCountBaseInstance(){return 4}write(t,e,r,s,i,o){n(r.get("position"),t,i.position,o);const u="featureAttribute"in i?i.featureAttribute:null;return u&&a(r.get("featureAttribute"),u,o),null}writeBaseInstance(t,e){const r=e.uv0;r.setValues(0,-1,-1),r.setValues(1,-1,1),r.setValues(2,1,-1),r.setValues(3,1,1)}}const v=r();export{g as HeatmapDensityMaterial,p as Parameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as
|
|
5
|
+
import{nextHighestPowerOfTwo as t}from"../../../../../core/mathUtils.js";import{copy as e,invert as r,transpose as a}from"../../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{glLayout as s}from"../../../support/buffer/glUtil.js";import{assert as n}from"../../lib/Util.js";import{VertexArrayObject as i}from"../../lib/VertexArrayObject.js";import{DrawCommand as f}from"./DrawCommand.js";import{BaseInstanceData as u}from"./PerBaseInstanceData.js";import{VertexBuffer as l}from"../../../../webgl/VertexBuffer.js";class c{constructor(t,e){this._rctx=e,this._bufferWriter=t.createBufferWriter(),this._vaoCache=e.getVaoCache(s(this._bufferWriter.layout))}maxElements(t){return Math.floor(d/this._targetStrideFloats(t))}_targetStrideFloats(t){return this._targetStrideBytes(t)/4}_targetStrideBytes(t){return this._targetLayout(t)?.stride??0}_targetLayout(t){return"geometry"===t?this._bufferWriter.layout:this._bufferWriter.instanceLayout}endElement(t){return Math.floor((t.vao?.getByteLength(t.targetBuffer)??0)/this._targetStrideBytes(t.targetBuffer))}evaluateBufferAllocation(t,e,r,a){const o=this._targetStrideFloats(a.targetBuffer),s=e.reduce((t,{geometry:e})=>t+this.elementCount(e),0),n=r.reduce((t,{geometry:e})=>t+this.elementCount(e),0),i=Math.min((t+s-n)*o,d),f=a.vao?.buffer(a.targetBuffer),u=(f?.sizeBytes??0)/4;return i>h&&i<u/2?0:i>u?1:2}deleteBuffer(t){if("instances"===t.targetBuffer)return t.vao?.buffer("instances")?.dispose(),t.vao?.disposeVAOOnly(),void(t.vao=null);this._vaoCache.deleteVao(t.vao)}createBaseInstanceData(t){const{_bufferWriter:e}=this;if(null==t||null==e.writeBaseInstance||null==e.elementCountBaseInstance)return null;const r=e.layout,a=e.elementCountBaseInstance(t.attributes),o=a*this._targetStrideFloats("geometry"),n=new l(this._rctx,s(r));n.setSize(Math.ceil(4*o));const i=w(o),c=r.createView(i.buffer);e.writeBaseInstance(t.attributes,c),n.setSubData(i,0,0,o);const m=new f;return m.first=0,m.count=a,new u(t,n,m)}_allocateInstanceBuffer(t){const e=this._bufferWriter.instanceLayout;n(null!=e,"Trying to allocate an instance buffer, but the BufferWriter does not support instancing");const r=t*this._targetStrideFloats("instances"),a=new l(this._rctx,s(e,1));return a.setSize(S(r)),a}_createInstancedVao(t,e){return new i(this._rctx,new Map([["geometry",t],["instances",e]]))}reallocateBuffer(t,e,r){if(this.deleteBuffer(e),null!=t){const e=t.baseInstanceBuffer,a=this._allocateInstanceBuffer(r);return this._createInstancedVao(e,a)}const a=r*this._targetStrideFloats("geometry");return this._vaoCache.newVao(S(a))}elementCount(t){return this._bufferWriter.elementCount(t.attributes)}canGrow(t,e){const{targetBuffer:r,vao:a}=t;if(null==a)return!0;const o=4*(e*this._targetStrideFloats(r));return a.getByteLength(r)<S(d-h)&&o>a.getByteLength(r)}clearHoles(t,{vao:e,targetBuffer:r}){const a=this._targetStrideFloats(r),o=t.reduce((t,e)=>Math.max(t,e.numElements),0)*a,s=w(o);s.fill(0,0,o);const n=e.buffer(r);for(const i of t)n?.setSubData(s,i.from*a,0,i.numElements*a)}clearHolesMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=(r-e)*s,i=w(n),f=this._targetLayout(o).createView(i.buffer);i.fill(0,0,n);for(const u of t){if(!(u.from>=e&&u.to<=r))continue;const t=u.from-e;this._writeGeometry(u.geometry,f,t)}a.buffer(o)?.setSubData(i,e*s,0,n)}writeRandomInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0,f=0,u=0;const l=r.buffer(a);for(const m of e){if(!(u===m.from)){const t=u-f;t>0&&l?.setSubData(s,f*o,0,t*o),f=m.from,i=0}this._writeGeometry(m.geometry,n,i),i+=m.numElements,u=m.to}const c=u-f;c>0&&l?.setSubData(s,f*o,0,c*o)}writeInstanceRangeMetal(t,e,r,{vao:a,targetBuffer:o}){const s=this._targetStrideFloats(o),n=t-e,i=n*s,f=w(i),u=this._targetLayout(o).createView(f.buffer);f.fill(0,0,i);for(const l of r){if(!(l.from>=e&&l.to<=t))continue;const r=l.from-e;this._writeGeometry(l.geometry,u,r)}n>0&&a.buffer(o)?.setSubData(f,e*s,0,i)}rebuildInstances(t,e,{vao:r,targetBuffer:a}){const o=this._targetStrideFloats(a),s=w(t*o),n=this._targetLayout(a).createView(s.buffer);let i=0;for(const f of e){this._writeGeometry(f.geometry,n,i);const t=i;i+=this.elementCount(f.geometry.geometry),f.from=t,f.to=i}return r?.buffer(a)?.setSubData(s,0,0,i*o),i}updateInstance(t,{vao:e,targetBuffer:r}){const{_bufferWriter:a}=this,o=this._targetStrideFloats(r),s=w(a.elementCount(t.geometry.geometry.attributes)*o),n=this._targetLayout(r).createView(s.buffer);this._writeGeometry(t.geometry,n,0),e.buffer(r)?.setSubData(s,t.from*o,0,t.numElements*o)}_writeGeometry(t,o,s){const{_bufferWriter:n}=this;null!=n&&(e(m,t.transformation),m[12]-=t.localOrigin.vec3[0],m[13]-=t.localOrigin.vec3[1],m[14]-=t.localOrigin.vec3[2],r(g,m),a(g,g),n.write(m,g,t.geometry.attributes,t.geometry.olidColor,o,s))}static prune(){B=new Float32Array(h)}}const m=o(),g=o(),h=65536,_=4*h,y=1024,b=16777216,d=b/4;let B=new Float32Array(h);function w(t){return B.length<t&&(B=new Float32Array(t)),B}function S(e){const r=4*e;return r<=y?y:r<_?t(r):Math.max(Math.min(Math.ceil(1.5*r/_)*_,b),r)}export{c as VaoWriter};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{glLayout as e}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{isColorOrColorEmission as t}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as o}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{olidEnabled as i}from"../effects/geometry/olidUtils.js";import{getDrawBuffers as n,blending as l}from"../lib/OrderIndependentTransparency.js";import{H as u}from"../../../../chunks/HUDMaterial.glsl.js";import{PrimitiveType as a}from"../../../webgl/enums.js";import{makePipelineState as c,defaultColorWrite as f,defaultDepthWrite as p}from"../../../webgl/renderState.js";import{fromLayouts as m}from"../../../webgl/VertexAttributeLocations.js";class d extends s{constructor(r,t){super(r,t,new o(u,()=>import("./HUDMaterial.glsl.js")),m([v,g()].map(e))),this.primitiveType=t.occlusionPass?a.POINTS:a.TRIANGLE_STRIP}initializePipeline(e){const{oitPass:r,hasPolygonOffset:o,draped:s,output:i,depthTestEnabled:u,occlusionPass:a}=e,m=u&&!s&&!(1===r)&&!a&&!(9===i);return c({blending:t(i)?l(r,!0):null,depthTest:u&&!s?{func:515}:null,depthWrite:m?p:null,drawBuffers:n(r,i),colorWrite:f,polygonOffset:o?h:null})}}const h={factor:0,units:-4},v=r().vec2u8("uv0",{glNormalized:!0}),b=r().vec3f("position").vec3f("normal").vec4i16("uvi").vec4u8("color").vec2f("size").f32("rotation").vec4f("centerOffsetAndDistance").vec4f("featureAttribute"),j=b.clone().vec4u8("olidColor");function g(){return i()?j:b}export{d as HUDMaterialTechnique,v as baseLayout,g as getInstanceLayout,b as instanceLayout,j as olidInstanceLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{
|
|
5
|
+
import{glLayout as e}from"../../support/buffer/glUtil.js";import{newLayout as r}from"../../support/buffer/InterleavedLayout.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as s}from"../core/shaderTechnique/ShaderTechnique.js";import{MaterialParameters as i}from"../lib/Material.js";import{H as o}from"../../../../chunks/HeatmapDensity.glsl.js";import{PrimitiveType as l}from"../../../webgl/enums.js";import{makePipelineState as n,defaultColorWrite as p,add as u}from"../../../webgl/renderState.js";import{fromLayouts as a}from"../../../webgl/VertexAttributeLocations.js";class m extends i{constructor(){super(...arguments),this.searchRadius=128,this.resolutionForScale=0}}class c extends s{constructor(r,s){super(r,s,new t(o,()=>import("./HeatmapDensity.glsl.js")),a([d,s.isAttributeDriven?h:f].map(e))),this.primitiveType=l.TRIANGLE_STRIP}initializePipeline(){return n({blending:u,colorWrite:p,depthTest:null,depthWrite:null})}destroy(){super.destroy()}}const d=r().vec2i8("uv0"),f=r().vec3f("position"),h=f.clone().f32("featureAttribute");export{m as HeatmapDensityPassParameters,c as HeatmapDensityTechnique,h as attributeDrivenInstanceLayout,d as baseLayout,f as instanceLayout};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isColorOrColorEmission as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{oitPolygonOffset as r,getDrawBuffers as l,depthWrite as n,oitDepthTest as s,
|
|
5
|
+
import{isColorOrColorEmission as e}from"../core/shaderLibrary/ShaderOutput.js";import{ReloadableShaderModule as t}from"../core/shaderTechnique/ReloadableShaderModule.js";import{ShaderTechnique as i}from"../core/shaderTechnique/ShaderTechnique.js";import{oitPolygonOffset as r,getDrawBuffers as l,depthWrite as n,oitDepthTest as s,blending as o}from"../lib/OrderIndependentTransparency.js";import{stencilToolMaskBaseParams as a,stencilBaseAllZerosParams as p,stencilWriteMaskOn as c}from"../lib/StencilUtils.js";import{PositionUvLayout as u}from"../materials/DefaultLayouts.js";import{I as d}from"../../../../chunks/ImageMaterial.glsl.js";import{makePipelineState as m,defaultColorWrite as h,cullingParams as f}from"../../../webgl/renderState.js";class g extends i{constructor(e,i){super(e,i,new t(d,()=>import("./ImageMaterial.glsl.js")),j(i).locations)}_getPipelineState(t,i){const{oitPass:u,output:d,hasOccludees:g,cullFace:j}=t;return m({blending:e(d)?o(u,!0):null,culling:f(j),depthTest:{func:s(u)},depthWrite:n(t),drawBuffers:l(u,d),colorWrite:h,stencilWrite:g?c:null,stencilTest:g?i?a:p:null,polygonOffset:r(t)})}initializePipeline(e){return this._occludeePipeline=this._getPipelineState(e,!0),this._getPipelineState(e,!1)}getPipeline(e){return e?this._occludeePipeline:super.getPipeline()}}function j(e){let t=u;return e.perspectiveInterpolation&&(t=t.clone().f32("perspectiveDivide")),t}export{g as ImageMaterialTechnique,j as getLayout};
|