@arcgis/core 4.31.0-next.20240705 → 4.31.0-next.20240708
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/arcade/functions/geomasync.js +1 -1
- package/arcade/functions/geomsync.js +1 -1
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/{734844c5bef28f609a8c.js → 17c37078ab65f8d4046b.js} +1 -1
- package/assets/esri/core/workers/chunks/{3edc527a24cb9a4868e5.js → 20d0390504e4cc9f93f4.js} +1 -1
- package/assets/esri/core/workers/chunks/291bdab5737152bc1825.js +1 -0
- package/assets/esri/core/workers/chunks/{ef8ba10380053ea4c4dd.js → 34ea46659c8cebec3ffa.js} +1 -1
- package/assets/esri/core/workers/chunks/3de4fe7458b7844e2aae.js +1 -0
- package/assets/esri/core/workers/chunks/413609b0aa85f2052154.js +1 -0
- package/assets/esri/core/workers/chunks/5089a12084a8a8fb93d8.js +1 -0
- package/assets/esri/core/workers/chunks/527932bf4c31cec46922.js +1 -0
- package/assets/esri/core/workers/chunks/65d34a9d408c678de2ca.js +1 -0
- package/assets/esri/core/workers/chunks/{5d0761c14d6ee53dd653.js → 7447883bb4a981e6d759.js} +1 -1
- package/assets/esri/core/workers/chunks/{86f3ef84cc27de6d8540.js → 87f33a60768801ca1ce8.js} +1 -1
- package/assets/esri/core/workers/chunks/{a734359619e3eb955399.js → b4d850e82a8ae902d684.js} +1 -1
- package/assets/esri/core/workers/chunks/d85c51abde781660b1f5.js +1 -0
- package/assets/esri/core/workers/chunks/{5afc1562bb5c20127ef1.js → e840e54455eb500b501d.js} +18 -18
- package/assets/esri/themes/base/widgets/_Tooltip.scss +4 -0
- package/assets/esri/themes/dark/main.css +1 -1
- package/assets/esri/themes/light/main.css +1 -1
- package/assets/esri/themes/light/view.css +1 -1
- package/chunks/ChapmanAtmosphere.glsl.js +1 -1
- package/chunks/ComponentShader.glsl.js +3 -3
- package/chunks/DefaultMaterial.glsl.js +1 -1
- package/chunks/EdgeShader.glsl.js +5 -6
- package/chunks/Heatmap.glsl.js +4 -4
- package/chunks/HighlightApply.glsl.js +172 -135
- package/chunks/LineCallout.glsl.js +4 -4
- package/chunks/MeasurementArrow.glsl.js +5 -5
- package/chunks/RealisticTree.glsl.js +2 -2
- package/chunks/Terrain.glsl.js +39 -39
- package/geometry/Polyline.js +1 -1
- package/geometry/SpatialReference.js +1 -1
- package/geometry/geometryEngine.js +1 -1
- package/geometry/support/geodesicUtils.js +1 -1
- package/geometry/support/meshUtils/exporters/gltf/gltf.js +1 -1
- package/layers/LinkChartLayer.js +1 -1
- package/layers/support/ElevationQuery.js +1 -1
- package/layers/video/videoUtils.js +1 -1
- package/package.json +1 -1
- package/rest/knowledgeGraph/wasmInterface/wasmToGeometryFactories.js +1 -1
- package/support/revision.js +1 -1
- package/views/2d/interactive/SnappingVisualizer2D.js +1 -1
- package/views/3d/environment/ChapmanAtmosphere.js +1 -1
- package/views/3d/environment/Fog.js +1 -1
- package/views/3d/layers/IntegratedMesh3DTilesLayerView3D.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TerrainSurface.js +1 -1
- package/views/3d/terrain/TransparencyMode.js +1 -1
- package/views/3d/webgl-engine/collections/Component/Material/shader/ComponentShader.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/Laserline.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/default/DefaultMaterialAuxiliaryPasses.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +11 -11
- package/views/3d/webgl-engine/core/shaderLibrary/terrain/Terrain.glsl.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlpha.glsl.js +9 -0
- package/views/3d/webgl-engine/effects/laserlines/LaserLineRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/BindParameters.js +1 -1
- package/views/3d/webgl-engine/lib/MainFramebuffer.js +5 -0
- package/views/3d/webgl-engine/lib/RenderContext.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/shaders/DefaultMaterial.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/Heatmap.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/HighlightApply.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/LineCallout.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/MeasurementArrow.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/RealisticTree.glsl.js +1 -1
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/EdgeShader.glsl.js +1 -1
- package/views/draw/support/Box.js +1 -1
- package/views/draw/support/Reshape.js +1 -1
- package/widgets/AreaMeasurement2D/AreaMeasurement2DTool.js +1 -1
- package/widgets/UtilityNetworkTrace/support/GeometryHandler.js +1 -1
- package/assets/esri/core/workers/chunks/164debfd5eac01ce3121.js +0 -1
- package/assets/esri/core/workers/chunks/1972e6be738a3b9289e8.js +0 -1
- package/assets/esri/core/workers/chunks/2e62e34c85d8505c98f4.js +0 -1
- package/assets/esri/core/workers/chunks/4ef2ce12499fae8b85c4.js +0 -1
- package/assets/esri/core/workers/chunks/5bf51ad34e2d729f9048.js +0 -1
- package/assets/esri/core/workers/chunks/9a9abefa8099aa1ebc3d.js +0 -1
- package/assets/esri/core/workers/chunks/da3af488df83bd8e153b.js +0 -1
- package/views/3d/webgl-engine/core/shaderLibrary/util/AlphaDiscard.glsl.js +0 -7
- package/views/3d/webgl-engine/core/shaderLibrary/util/DiscardOrAdjustAlphaBlend.glsl.js +0 -7
- package/views/3d/webgl-engine/lib/MainColor.js +0 -5
- package/views/3d/webgl-engine/shaders/sources/edgeRenderer/DiscardByCoverage.glsl.js +0 -5
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as i}from"../../core/maybe.js";import{whenOrAbort as n,throwIfAbortError as o}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../core/unitUtils.js";import s from"../../geometry/Multipoint.js";import a from"../../geometry/Point.js";import r from"../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../geometry/projection.js";import{fromExtent as h,create as f,contains as p}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as m}from"./ElevationSampler.js";import{ElevationTile as d}from"./ElevationTile.js";import{TileKey as y}from"./TileKey.js";class T{async queryAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const o=w.fromGeometry(i);let l=!1;n?.returnSampleInfo||(l=!0);const s={...R,...n,returnSampleInfo:!0},a=await this.query(e[e.length-1],o,s),r=await this._queryAllContinue(e,a,s);return r.geometry=r.geometry.export(),l&&delete r.sampleInfo,r}async query(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof w)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...R,...n},l=new x(e,i.spatialReference,o),s=o.signal;return await e.load({signal:s}),await q(l,i,s),await this._selectTiles(l,s),await F(l,s),j(l),b(l,s)}async createSampler(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n};return this._createSampler(e,i,o)}async createSamplerAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n,returnSampleInfo:!0},l=await this._createSampler(e[e.length-1],i,o);return this._createSamplerAllContinue(e,i,l,o)}async _createSampler(e,t,i,n){const o=i.signal;await e.load({signal:o});const l=t.spatialReference,s=e.tileInfo.spatialReference;l.equals(s)||(await c([{source:l,dest:s}],{signal:o}),t=u(t,s));const a=new _(e,t,i,n);return await this._selectTiles(a,o),await F(a,o),new m(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,n){if(e.pop(),!e.length)return i;const o=i.samplers.filter((e=>!e.tile.hasNoDataValues)).map((e=>h(e.extent))),l=await this._createSampler(e[e.length-1],t,n,o);if(0===l.samplers.length)return i;const s=i.samplers.concat(l.samplers),a=new m(s,n.noDataValue);return this._createSamplerAllContinue(e,t,a,n)}async _queryAllContinue(e,t,n){const o=e.pop(),l=t.geometry.coordinates,s=t.sampleInfo;i(s);const a=[],r=[];for(let i=0;i<l.length;i++){const t=s[i];t.demResolution>=0?t.source||(t.source=o):e.length&&(a.push(l[i]),r.push(i))}if(!e.length||0===a.length)return t;const c=t.geometry.clone(a),u=await this.query(e[e.length-1],c,n),h=u.sampleInfo;if(!h)throw new Error("no sampleInfo");return r.forEach(((e,t)=>{l[e].z=u.geometry.coordinates[t].z,s[e].demResolution=h[t].demResolution})),this._queryAllContinue(e,t,n)}async _selectTiles(e,i){"geometry"===e.type&&I(e);const n=e.options.demResolution;if("number"==typeof n)C(e,n);else if("finest-contiguous"===n)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==n)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${n}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}async _selectTilesFinestContiguous(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=E(i,n,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,o,t)}async _selectTilesFinestContiguousAt(e,i,l){const s=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=s.tilemapCache,r=e.getTilesToFetch();try{if(a&&!L(a))await n(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:l})))),l);else if(await F(e,l),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){o(c),await this._selectTilesFinestContiguousAt(e,i-1,l)}}async _selectTilesAuto(t,i){M(t),S(t);const l=t.layer.tilemapCache;if(!l||L(l))return this._selectTilesAutoPrefetchUpsample(t,i);const s=t.getTilesToFetch(),a={},r=s.map((async t=>{const n=new y(null,0,0,0,f()),s=await e(l.fetchAvailabilityUpsample(t.level,t.row,t.col,n,{signal:i}));!1!==s.ok?null!=t.id&&(a[t.id]=n):o(s.error)}));await n(Promise.all(r),i),t.remapTiles(a)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await F(e,t);let n=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?n=!0:t()})),n&&await this._selectTilesAutoPrefetchUpsample(e,t)}}class w{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new w;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>e.clone())),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await c([{source:this.spatialReference,dest:e}],{signal:t});const i=new s({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),n=u(i,e);if(!n)return null;const o=this.coordinates.map(((e,t)=>{const i=e.clone(),o=n.points[t];return i.x=o[0],i.y=o[1],i})),l=this.clone(o);return l.spatialReference=e,l}static fromGeometry(e){const t=new w;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof w)t.coordinates=e.coordinates.map((e=>e.clone())),t._exporter=(t,i)=>{const n=e.clone(t);return n.spatialReference=i,n};else switch(e.type){case"point":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?[new v(i.x,i.y,i.z,i.m)]:n?[new v(i.x,i.y,i.z)]:o?[new v(i.x,i.y,null,i.m)]:[new v(i.x,i.y)],t._exporter=(t,i)=>e.hasM?new a(t[0].x,t[0].y,t[0].z,t[0].m,i):new a(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?i.points.map((e=>new v(e[0],e[1],e[2],e[3]))):n?i.points.map((e=>new v(e[0],e[1],e[2]))):o?i.points.map((e=>new v(e[0],e[1],null,e[2]))):i.points.map((e=>new v(e[0],e[1]))),t._exporter=(t,i)=>e.hasM?new s({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatialReference:i}):new s(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,n=[],o=[],{hasZ:l,hasM:s}=e;let a=0;for(const e of i.paths)if(o.push([a,a+e.length]),a+=e.length,l&&s)for(const t of e)n.push(new v(t[0],t[1],t[2],t[3]));else if(l)for(const t of e)n.push(new v(t[0],t[1],t[2]));else if(s)for(const t of e)n.push(new v(t[0],t[1],null,t[2]));else for(const t of e)n.push(new v(t[0],t[1]));t.coordinates=n,t._exporter=(t,i)=>{const n=e.hasM?t.map((e=>[e.x,e.y,e.z,e.m])):t.map((e=>[e.x,e.y,e.z])),l=o.map((e=>n.slice(e[0],e[1])));return new r({paths:l,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class v{constructor(e,t,i=null,n=null,o=null,l=null){this.x=e,this.y=t,this.z=i,this.m=n,this.tile=o,this.elevationTile=l}clone(){return new v(this.x,this.y,this.z,this.m)}}class g{constructor(e,t){this.layer=e,this.options=t}}class x extends g{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>e.tile=null));else{const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i)[e].level;this.geometry.coordinates.forEach((e=>e.tile=t.tileAt(n,e.x,e.y)))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const n=i.tile;if(!n)continue;const o=i.tile?.id;i.elevationTile||!o||e[o]||(e[o]=n,t.push(n))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>{t.tile=null}))}}class _ extends g{constructor(e,t,i,n){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),n=Math.min(i,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i);if(!e)return n.length-1;const o=this.extent;if(null==o)return-1;for(let l=n.length-1;l>=0;l--){const i=n[l],s=i.resolution*t.size[0],a=i.resolution*t.size[1];if(Math.ceil(o.width/s)*Math.ceil(o.height/a)<=e)return l}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=z(this._candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach((i=>{if(this._fetchedCandidates.has(i))return void(t&&t(i));let n=!1;e(i,(()=>n=!0)),n?t&&t(i):this._candidateTiles.push(i)})),this._candidateTiles=z(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:i,tilemapCache:n}=this.layer,o=D(i,n)[e],l=i.tileAt(o.level,t.xmin,t.ymin),s=l.extent;if(null==s)return;const a=o.resolution*i.size[0],r=o.resolution*i.size[1],c=Math.ceil((t.xmax-s[0])/a),u=Math.ceil((t.ymax-s[1])/r);for(let h=0;h<u;h++)for(let e=0;e<c;e++){const t=new y(null,l.level,l.row-h,l.col+e);i.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>e.extent&&p(t,e.extent)))}}function E(e,t,i=0){const n=D(e,t);let o=n.length-1;if(i>0){const t=i/l(e.spatialReference),s=n.findIndex((e=>e.resolution<t));0===s?o=0:s>0&&(o=s-1)}return o}const R={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};async function q(e,i,n){let o;const l=e.layer.tileInfo.spatialReference;if(i instanceof w?o=await i.project(l,n):(await c([{source:i.spatialReference,dest:l}],{signal:n}),o=u(i,l)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${l.wkid}'`);e.geometry=w.fromGeometry(o)}function I(e){if(null==e.layer.fullExtent)return;const t=new d(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const i=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const n=e.x,o=e.y;(n<i.xmin||n>i.xmax||o<i.ymin||o>i.ymax)&&(e.elevationTile=t)}))}function A(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=t/l(i.spatialReference),s=D(i,n);let a=s[0],r=0;for(let l=1;l<s.length;l++){const e=s[l];Math.abs(e.resolution-o)<Math.abs(a.resolution-o)&&(a=e,r=l)}return r}function C(e,t){const i=A(e,t);e.selectTilesAtLOD(i)}function M(e){const{tileInfo:t,tilemapCache:i}=e.layer,n=E(t,i,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}function D(e,t){const i=e.lods;if(L(t)){const{effectiveMinLOD:e,effectiveMaxLOD:n}=t;return i.filter((t=>t.level>=e&&t.level<=n))}return i}async function F(e,t){const i=e.getTilesToFetch(),o={},l=e.options.cache,s=e.options.noDataValue,a=i.map((async i=>{if(null==i.id)return;const n=`${e.layer.uid}:${i.id}:${s}`,a=null!=l?l.get(n):null,r=null!=a?a:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:s,signal:t});null!=l&&l.put(n,r),o[i.id]=new d(i,r)}));await n(Promise.allSettled(a),t),e.populateElevationTiles(o)}function S(e){const t=e.layer.tileInfo;let i=0;const n={},o=e=>{null!=e.id&&(e.id in n?n[e.id]++:(n[e.id]=1,i++))},l=e=>{if(null==e.id)return;const t=n[e.id];1===t?(delete n[e.id],i--):n[e.id]=t-1};e.forEachTileToFetch(o,l);let s=!0;for(;s&&(s=!1,e.forEachTileToFetch((n=>{i<=e.options.maximumAutoTileRequests||(l(n),t.upsampleTile(n)&&(s=!0),o(n))}),l),s););}function j(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let n=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);null!=e?n=e:t.elevationTile=null}t.z=n}))}function z(e,t){const i={},n=[];for(const l of e){const e=l.id;e&&!i[e]?(i[e]=l,n.push(l)):t&&t(l)}const o=n.sort(((e,t)=>e.level-t.level));return o.filter(((e,i)=>{for(let n=0;n<i;n++){const i=o[n].extent;if(i&&e.extent&&p(i,e.extent))return t&&t(e),!1}return!0}))}async function b(e,t){const n=await e.geometry.project(e.outSpatialReference,t);i(n);const o={geometry:n.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(o.sampleInfo=k(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),o}function k(e){const t=e.layer.tileInfo,i=l(t.spatialReference);return e.geometry.coordinates.map((n=>{let o=-1;if(n.elevationTile&&n.elevationTile!==e.outsideExtentTile){o=t.lodAt(n.elevationTile.tile.level).resolution*i}return{demResolution:o}}))}function L(e){return null!=e?.tileInfo}export{T as ElevationQuery,w as GeometryDescriptor,E as getFinestLodIndex};
|
|
5
|
+
import{result as e}from"../../core/asyncUtils.js";import t from"../../core/Error.js";import{assertIsSome as i}from"../../core/maybe.js";import{whenOrAbort as n,throwIfAbortError as o}from"../../core/promiseUtils.js";import{getMetersPerUnitForSR as l}from"../../core/unitUtils.js";import s from"../../geometry/Multipoint.js";import a from"../../geometry/Point.js";import r from"../../geometry/Polyline.js";import{initializeProjection as c,project as u}from"../../geometry/projection.js";import{fromExtent as h,create as f,contains as p}from"../../geometry/support/aaBoundingRect.js";import{MultiTileElevationSampler as m}from"./ElevationSampler.js";import{ElevationTile as d}from"./ElevationTile.js";import{TileKey as y}from"./TileKey.js";class T{async queryAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");const o=w.fromGeometry(i);let l=!1;n?.returnSampleInfo||(l=!0);const s={...R,...n,returnSampleInfo:!0},a=await this.query(e[e.length-1],o,s),r=await this._queryAllContinue(e,a,s);return r.geometry=r.geometry.export(),l&&delete r.sampleInfo,r}async query(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||!(i instanceof w)&&"point"!==i.type&&"multipoint"!==i.type&&"polyline"!==i.type)throw new t("elevation-query:invalid-geometry","Only point, polyline and multipoint geometries can be used to query elevation");const o={...R,...n},l=new x(e,i.spatialReference,o),s=o.signal;return await e.load({signal:s}),await q(l,i,s),await this._selectTiles(l,s),await F(l,s),j(l),b(l,s)}async createSampler(e,i,n){if(!e)throw new t("elevation-query:invalid-layer","Elevation queries require an elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n};return this._createSampler(e,i,o)}async createSamplerAll(e,i,n){if(!(e=n?.ignoreInvisibleLayers?e.filter((e=>e.visible)):e.slice()).length)throw new t("elevation-query:invalid-layer","Elevation queries require at least one elevation layer to fetch tiles from");if(!i||"extent"!==i.type)throw new t("elevation-query:invalid-extent","Invalid or undefined extent");const o={...R,...n,returnSampleInfo:!0},l=await this._createSampler(e[e.length-1],i,o);return this._createSamplerAllContinue(e,i,l,o)}async _createSampler(e,t,i,n){const o=i.signal;await e.load({signal:o});const l=t.spatialReference,s=e.tileInfo.spatialReference;l.equals(s)||(await c([{source:l,dest:s}],{signal:o}),t=u(t,s));const a=new _(e,t,i,n);return await this._selectTiles(a,o),await F(a,o),new m(a.elevationTiles,a.layer.tileInfo,a.options.noDataValue)}async _createSamplerAllContinue(e,t,i,n){if(e.pop(),!e.length)return i;const o=i.samplers.filter((e=>!e.tile.hasNoDataValues)).map((e=>h(e.extent))),l=await this._createSampler(e[e.length-1],t,n,o);if(0===l.samplers.length)return i;const s=i.samplers.concat(l.samplers),a=new m(s,n.noDataValue);return this._createSamplerAllContinue(e,t,a,n)}async _queryAllContinue(e,t,n){const o=e.pop(),l=t.geometry.coordinates,s=t.sampleInfo;i(s);const a=[],r=[];for(let i=0;i<l.length;i++){const t=s[i];t.demResolution>=0?t.source||(t.source=o):e.length&&(a.push(l[i]),r.push(i))}if(!e.length||0===a.length)return t;const c=t.geometry.clone(a),u=await this.query(e[e.length-1],c,n),h=u.sampleInfo;if(!h)throw new Error("no sampleInfo");return r.forEach(((e,t)=>{l[e].z=u.geometry.coordinates[t].z,s[e].demResolution=h[t].demResolution})),this._queryAllContinue(e,t,n)}async _selectTiles(e,i){"geometry"===e.type&&I(e);const n=e.options.demResolution;if("number"==typeof n)C(e,n);else if("finest-contiguous"===n)await this._selectTilesFinestContiguous(e,i);else{if("auto"!==n)throw new t("elevation-query:invalid-dem-resolution",`Invalid dem resolution value '${n}', expected a number, "finest-contiguous" or "auto"`);await this._selectTilesAuto(e,i)}}async _selectTilesFinestContiguous(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=E(i,n,e.options.minDemResolution);await this._selectTilesFinestContiguousAt(e,o,t)}async _selectTilesFinestContiguousAt(e,i,l){const s=e.layer;if(e.selectTilesAtLOD(i),i<0)return;const a=s.tilemapCache,r=e.getTilesToFetch();try{if(a&&!L(a))await n(Promise.all(r.map((e=>a.fetchAvailability(e.level,e.row,e.col,{signal:l})))),l);else if(await F(e,l),!e.allElevationTilesFetched())throw e.clearElevationTiles(),new t("elevation-query:has-unavailable-tiles")}catch(c){o(c),await this._selectTilesFinestContiguousAt(e,i-1,l)}}async _selectTilesAuto(t,i){M(t),S(t);const l=t.layer.tilemapCache;if(!l||L(l))return this._selectTilesAutoPrefetchUpsample(t,i);const s=t.getTilesToFetch(),a={},r=s.map((async t=>{const n=new y(null,0,0,0,f()),s=await e(l.fetchAvailabilityUpsample(t.level,t.row,t.col,n,{signal:i}));!1!==s.ok?null!=t.id&&(a[t.id]=n):o(s.error)}));await n(Promise.all(r),i),t.remapTiles(a)}async _selectTilesAutoPrefetchUpsample(e,t){const i=e.layer.tileInfo;await F(e,t);let n=!1;e.forEachTileToFetch(((e,t)=>{i.upsampleTile(e)?n=!0:t()})),n&&await this._selectTilesAutoPrefetchUpsample(e,t)}}class w{export(){return this._exporter(this.coordinates,this.spatialReference)}clone(e){const t=new w;return t.geometry=this.geometry,t.spatialReference=this.spatialReference,t.coordinates=e||this.coordinates.map((e=>e.clone())),t._exporter=this._exporter,t}async project(e,t){if(this.spatialReference.equals(e))return this.clone();await c([{source:this.spatialReference,dest:e}],{signal:t});const i=new s({spatialReference:this.spatialReference,points:this.coordinates.map((e=>[e.x,e.y]))}),n=u(i,e);if(!n)return null;const o=this.coordinates.map(((e,t)=>{const i=e.clone(),o=n.points[t];return i.x=o[0],i.y=o[1],i})),l=this.clone(o);return l.spatialReference=e,l}static fromGeometry(e){const t=new w;if(t.geometry=e,t.spatialReference=e.spatialReference,e instanceof w)t.coordinates=e.coordinates.map((e=>e.clone())),t._exporter=(t,i)=>{const n=e.clone(t);return n.spatialReference=i,n};else switch(e.type){case"point":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?[new v(i.x,i.y,i.z,i.m)]:n?[new v(i.x,i.y,i.z)]:o?[new v(i.x,i.y,null,i.m)]:[new v(i.x,i.y)],t._exporter=(t,i)=>e.hasM?new a(t[0].x,t[0].y,t[0].z,t[0].m,i):new a(t[0].x,t[0].y,t[0].z,i);break}case"multipoint":{const i=e,{hasZ:n,hasM:o}=i;t.coordinates=n&&o?i.points.map((e=>new v(e[0],e[1],e[2],e[3]))):n?i.points.map((e=>new v(e[0],e[1],e[2]))):o?i.points.map((e=>new v(e[0],e[1],null,e[2]))):i.points.map((e=>new v(e[0],e[1]))),t._exporter=(t,i)=>e.hasM?new s({points:t.map((e=>[e.x,e.y,e.z,e.m])),hasZ:!0,hasM:!0,spatialReference:i}):new s(t.map((e=>[e.x,e.y,e.z])),i);break}case"polyline":{const i=e,n=[],o=[],{hasZ:l,hasM:s}=e;let a=0;for(const e of i.paths)if(o.push([a,a+e.length]),a+=e.length,l&&s)for(const t of e)n.push(new v(t[0],t[1],t[2],t[3]));else if(l)for(const t of e)n.push(new v(t[0],t[1],t[2]));else if(s)for(const t of e)n.push(new v(t[0],t[1],null,t[2]));else for(const t of e)n.push(new v(t[0],t[1]));t.coordinates=n,t._exporter=(t,i)=>{const n=e.hasM?t.map((e=>[e.x,e.y,e.z??0,e.m??0])):t.map((e=>[e.x,e.y,e.z??0])),l=o.map((e=>n.slice(e[0],e[1])));return new r({paths:l,hasM:e.hasM,hasZ:!0,spatialReference:i})};break}}return t}}class v{constructor(e,t,i=null,n=null,o=null,l=null){this.x=e,this.y=t,this.z=i,this.m=n,this.tile=o,this.elevationTile=l}clone(){return new v(this.x,this.y,this.z,this.m)}}class g{constructor(e,t){this.layer=e,this.options=t}}class x extends g{constructor(e,t,i){super(e,i),this.outSpatialReference=t,this.type="geometry"}selectTilesAtLOD(e){if(e<0)this.geometry.coordinates.forEach((e=>e.tile=null));else{const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i)[e].level;this.geometry.coordinates.forEach((e=>e.tile=t.tileAt(n,e.x,e.y)))}}allElevationTilesFetched(){return!this.geometry.coordinates.some((e=>!e.elevationTile))}clearElevationTiles(){for(const e of this.geometry.coordinates)e.elevationTile!==this.outsideExtentTile&&(e.elevationTile=null)}populateElevationTiles(e){for(const t of this.geometry.coordinates)!t.elevationTile&&t.tile?.id&&(t.elevationTile=e[t.tile.id])}remapTiles(e){for(const t of this.geometry.coordinates){const i=t.tile?.id;t.tile=i?e[i]:null}}getTilesToFetch(){const e={},t=[];for(const i of this.geometry.coordinates){const n=i.tile;if(!n)continue;const o=i.tile?.id;i.elevationTile||!o||e[o]||(e[o]=n,t.push(n))}return t}forEachTileToFetch(e){for(const t of this.geometry.coordinates)t.tile&&!t.elevationTile&&e(t.tile,(()=>{t.tile=null}))}}class _ extends g{constructor(e,t,i,n){super(e,i),this.type="extent",this.elevationTiles=[],this._candidateTiles=[],this._fetchedCandidates=new Set,this.extent=t.clone().intersection(e.fullExtent),this.maskExtents=n}selectTilesAtLOD(e,t){const i=this._maximumLodForRequests(t),n=Math.min(i,e);n<0?this._candidateTiles.length=0:this._selectCandidateTilesCoveringExtentAt(n)}_maximumLodForRequests(e){const{tileInfo:t,tilemapCache:i}=this.layer,n=D(t,i);if(!e)return n.length-1;const o=this.extent;if(null==o)return-1;for(let l=n.length-1;l>=0;l--){const i=n[l],s=i.resolution*t.size[0],a=i.resolution*t.size[1];if(Math.ceil(o.width/s)*Math.ceil(o.height/a)<=e)return l}return-1}allElevationTilesFetched(){return this._candidateTiles.length===this.elevationTiles.length}clearElevationTiles(){this.elevationTiles.length=0,this._fetchedCandidates.clear()}populateElevationTiles(e){for(const t of this._candidateTiles){const i=t.id&&e[t.id];i&&(this._fetchedCandidates.add(t),this.elevationTiles.push(i))}}remapTiles(e){this._candidateTiles=z(this._candidateTiles.map((t=>e[t.id])))}getTilesToFetch(){return this._candidateTiles}forEachTileToFetch(e,t){const i=this._candidateTiles;this._candidateTiles=[],i.forEach((i=>{if(this._fetchedCandidates.has(i))return void(t&&t(i));let n=!1;e(i,(()=>n=!0)),n?t&&t(i):this._candidateTiles.push(i)})),this._candidateTiles=z(this._candidateTiles,t)}_selectCandidateTilesCoveringExtentAt(e){this._candidateTiles.length=0;const t=this.extent;if(null==t)return;const{tileInfo:i,tilemapCache:n}=this.layer,o=D(i,n)[e],l=i.tileAt(o.level,t.xmin,t.ymin),s=l.extent;if(null==s)return;const a=o.resolution*i.size[0],r=o.resolution*i.size[1],c=Math.ceil((t.xmax-s[0])/a),u=Math.ceil((t.ymax-s[1])/r);for(let h=0;h<u;h++)for(let e=0;e<c;e++){const t=new y(null,l.level,l.row-h,l.col+e);i.updateTileInfo(t),this._tileIsMasked(t)||this._candidateTiles.push(t)}}_tileIsMasked(e){return!!this.maskExtents&&this.maskExtents.some((t=>e.extent&&p(t,e.extent)))}}function E(e,t,i=0){const n=D(e,t);let o=n.length-1;if(i>0){const t=i/l(e.spatialReference),s=n.findIndex((e=>e.resolution<t));0===s?o=0:s>0&&(o=s-1)}return o}const R={maximumAutoTileRequests:20,noDataValue:0,returnSampleInfo:!1,demResolution:"auto",minDemResolution:0};async function q(e,i,n){let o;const l=e.layer.tileInfo.spatialReference;if(i instanceof w?o=await i.project(l,n):(await c([{source:i.spatialReference,dest:l}],{signal:n}),o=u(i,l)),!o)throw new t("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${i.spatialReference.wkid}' on an elevation service in '${l.wkid}'`);e.geometry=w.fromGeometry(o)}function I(e){if(null==e.layer.fullExtent)return;const t=new d(null);t.sample=()=>e.options.noDataValue,e.outsideExtentTile=t;const i=e.layer.fullExtent;e.geometry.coordinates.forEach((e=>{const n=e.x,o=e.y;(n<i.xmin||n>i.xmax||o<i.ymin||o>i.ymax)&&(e.elevationTile=t)}))}function A(e,t){const{tileInfo:i,tilemapCache:n}=e.layer,o=t/l(i.spatialReference),s=D(i,n);let a=s[0],r=0;for(let l=1;l<s.length;l++){const e=s[l];Math.abs(e.resolution-o)<Math.abs(a.resolution-o)&&(a=e,r=l)}return r}function C(e,t){const i=A(e,t);e.selectTilesAtLOD(i)}function M(e){const{tileInfo:t,tilemapCache:i}=e.layer,n=E(t,i,e.options.minDemResolution);e.selectTilesAtLOD(n,e.options.maximumAutoTileRequests)}function D(e,t){const i=e.lods;if(L(t)){const{effectiveMinLOD:e,effectiveMaxLOD:n}=t;return i.filter((t=>t.level>=e&&t.level<=n))}return i}async function F(e,t){const i=e.getTilesToFetch(),o={},l=e.options.cache,s=e.options.noDataValue,a=i.map((async i=>{if(null==i.id)return;const n=`${e.layer.uid}:${i.id}:${s}`,a=null!=l?l.get(n):null,r=null!=a?a:await e.layer.fetchTile(i.level,i.row,i.col,{noDataValue:s,signal:t});null!=l&&l.put(n,r),o[i.id]=new d(i,r)}));await n(Promise.allSettled(a),t),e.populateElevationTiles(o)}function S(e){const t=e.layer.tileInfo;let i=0;const n={},o=e=>{null!=e.id&&(e.id in n?n[e.id]++:(n[e.id]=1,i++))},l=e=>{if(null==e.id)return;const t=n[e.id];1===t?(delete n[e.id],i--):n[e.id]=t-1};e.forEachTileToFetch(o,l);let s=!0;for(;s&&(s=!1,e.forEachTileToFetch((n=>{i<=e.options.maximumAutoTileRequests||(l(n),t.upsampleTile(n)&&(s=!0),o(n))}),l),s););}function j(e){e.geometry.coordinates.forEach((t=>{const i=t.elevationTile;let n=e.options.noDataValue;if(i){const e=i.sample(t.x,t.y);null!=e?n=e:t.elevationTile=null}t.z=n}))}function z(e,t){const i={},n=[];for(const l of e){const e=l.id;e&&!i[e]?(i[e]=l,n.push(l)):t&&t(l)}const o=n.sort(((e,t)=>e.level-t.level));return o.filter(((e,i)=>{for(let n=0;n<i;n++){const i=o[n].extent;if(i&&e.extent&&p(i,e.extent))return t&&t(e),!1}return!0}))}async function b(e,t){const n=await e.geometry.project(e.outSpatialReference,t);i(n);const o={geometry:n.export(),noDataValue:e.options.noDataValue};return e.options.returnSampleInfo&&(o.sampleInfo=k(e)),e.geometry.coordinates.forEach((e=>{e.tile=null,e.elevationTile=null})),o}function k(e){const t=e.layer.tileInfo,i=l(t.spatialReference);return e.geometry.coordinates.map((n=>{let o=-1;if(n.elevationTile&&n.elevationTile!==e.outsideExtentTile){o=t.lodAt(n.elevationTile.tile.level).resolution*i}return{demResolution:o}}))}function L(e){return null!=e?.tileInfo}export{T as ElevationQuery,w as GeometryDescriptor,E as getFinestLodIndex};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../geometry/Point.js";import t from"../../geometry/Polygon.js";import r from"../../geometry/Polyline.js";import n from"../support/TelemetryData.js";import i from"../support/VideoTimeExtent.js";const o={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,EsriFrameCenterLatitude:90050,EsriFrameCenterLongitude:90051,EsriCornerLatitudePt1:90052,EsriCornerLongitudePt1:90053,EsriCornerLatitudePt2:90054,EsriCornerLongitudePt2:90055,EsriCornerLatitudePt3:90056,EsriCornerLongitudePt3:90057,EsriCornerLatitudePt4:90058,EsriCornerLongitudePt4:90059,EsriFrameOutline:90060,EsriSensorPosition:90061,EsriHorizonPixelPack:90063,EsriGroundControlPoints:90064};function a(e){const{duration:t,end:r,start:n,timezone:o="UTC"}=e||{};return"number"!=typeof t?null:new i({duration:t||null,end:"number"==typeof r?new Date(r):null,start:"number"==typeof n?new Date(n):null,timezone:o})}function u(e,t){const r=[...t],n=r.findIndex((t=>t.equals(e)));return n>-1&&r.splice(n),r.push(e),r}function s(e){if(!e?.size)return new n;const t=c(e),r=g(e),i=L(e),o=E(t,r);return new n({frameCenter:r,frameOutline:i,lineOfSight:o,sensorLocation:t})}function l(e){if(!e?.size)return null;return e.get(o.EsriGroundControlPoints)?.value??null??null}function d(e){return e?.size?e.get(o.EsriHorizonPixelPack)?.value??null:null}function g(e){return f(e)??C(e)}function f(t){return t&&t.has(o.EsriFrameCenterLatitude)&&t.has(o.EsriFrameCenterLongitude)?new e({x:t.get(o.EsriFrameCenterLongitude).value,y:t.get(o.EsriFrameCenterLatitude).value,z:t.get(o.FrameCenterElevation).value}):null}function C(t){return t&&t.has(o.FrameCenterLatitude)&&t.has(o.FrameCenterLongitude)?new e({x:t.get(o.FrameCenterLongitude)?.value,y:t.get(o.FrameCenterLatitude)?.value,z:t.get(o.FrameCenterElevation)?.value}):null}function L(e){if(!e)return null;const r=e.get(o.EsriFrameOutline)?.value;return r?t.fromJSON(r.geometry):m(e)??P(e)}function m(e){if(!(e.has(o.EsriCornerLatitudePt1)&&e.has(o.EsriCornerLongitudePt1)&&e.has(o.EsriCornerLatitudePt2)&&e.has(o.EsriCornerLongitudePt2)&&e.has(o.EsriCornerLatitudePt3)&&e.has(o.EsriCornerLongitudePt3)&&e.has(o.EsriCornerLatitudePt4)&&e.has(o.EsriCornerLongitudePt4)))return null;const r=[e.get(o.EsriCornerLongitudePt1)?.value,e.get(o.EsriCornerLatitudePt1)?.value],n=[e.get(o.EsriCornerLongitudePt2)?.value,e.get(o.EsriCornerLatitudePt2)?.value],i=[e.get(o.EsriCornerLongitudePt3)?.value,e.get(o.EsriCornerLatitudePt3)?.value],a=[e.get(o.EsriCornerLongitudePt4)?.value,e.get(o.EsriCornerLatitudePt4)?.value];return new t({rings:[[r,n,i,a]]})}function P(e){if(!(e.has(o.OffsetCorner1Latitude)&&e.has(o.OffsetCorner1Longitude)&&e.has(o.OffsetCorner2Latitude)&&e.has(o.OffsetCorner2Longitude)&&e.has(o.OffsetCorner3Latitude)&&e.has(o.OffsetCorner3Longitude)&&e.has(o.OffsetCorner4Latitude)&&e.has(o.OffsetCorner4Longitude)&&e.has(o.FrameCenterLatitude)&&e.has(o.FrameCenterLongitude)))return null;const r=e.get(o.FrameCenterLatitude)?.value,n=e.get(o.FrameCenterLongitude)?.value,i=r+e.get(o.OffsetCorner1Latitude)?.value,a=n+e.get(o.OffsetCorner1Longitude)?.value,u=r+e.get(o.OffsetCorner2Latitude)?.value,s=n+e.get(o.OffsetCorner2Longitude)?.value,l=r+e.get(o.OffsetCorner3Latitude)?.value,d=n+e.get(o.OffsetCorner3Longitude)?.value,g=r+e.get(o.OffsetCorner4Latitude)?.value,f=n+e.get(o.OffsetCorner4Longitude)?.value;return new t({rings:[[[a,i],[s,u],[d,l],[f,g]]]})}function E(e,t){if(!e||!t)return null;const n=[e.x,e.y,e.z],i=[t.x,t.y,t.z];return new r({paths:[[n,i]]})}function c(t){if(!t?.size)return null;if(t.has(o.EsriSensorPosition)){const r=t.get(o.EsriSensorPosition)?.value;if(r)return e.fromJSON(r.geometry)}return t.has(o.SensorLongitude)&&t.has(o.SensorLatitude)&&t.has(o.SensorTrueAltitude)?new e({x:t.get(o.SensorLongitude)?.value,y:t.get(o.SensorLatitude)?.value,z:t.get(o.SensorTrueAltitude)?.value}):null}export{g as getFrameCenter,d as getFrameHorizonPoints,l as getGroundControlPoints,u as getSensorTrailPoints,s as getTelemetryData,a as readVideoTimeExtent,o as videoMetadataEntryId};
|
|
5
|
+
import e from"../../geometry/Point.js";import t from"../../geometry/Polygon.js";import r from"../../geometry/Polyline.js";import n from"../support/TelemetryData.js";import i from"../support/VideoTimeExtent.js";const o={UASDatalinkLocalSet:1e4,PrecisionTimeStamp:10002,MissionId:10003,PlatformTailNumber:10004,PlatformHeadingAngle:10005,PlatformPitchAngle:10006,PlatformRollAngle:10007,PlatformTrueAirspeed:10008,PlatformIndicatedAirspeed:10009,PlatformDesignation:10010,ImageSourceSensor:10011,ImageCoordinateSystem:10012,SensorLatitude:10013,SensorLongitude:10014,SensorTrueAltitude:10015,SensorHorizontalFOV:10016,SensorVerticalFOV:10017,SensorAzimuthAngle:10018,SensorElevationAngle:10019,SensorRollAngle:10020,PlatformSlantRange:10021,TargetWidth:10022,FrameCenterLatitude:10023,FrameCenterLongitude:10024,FrameCenterElevation:10025,OffsetCorner1Latitude:10026,OffsetCorner1Longitude:10027,OffsetCorner2Latitude:10028,OffsetCorner2Longitude:10029,OffsetCorner3Latitude:10030,OffsetCorner3Longitude:10031,OffsetCorner4Latitude:10032,OffsetCorner4Longitude:10033,TargetLocationLatitude:10040,TargetLocationLongitude:10041,TargetLocationElevation:10042,TargetTrackGateWidth:10043,TargetTrackGateHeight:10044,TargetErrorEstimateHorizontal:10045,TargetErrorEstimateLateral:10046,GenericFlagData:10047,PlatformGroundSpeed:10056,PlatformGroundRange:10057,PlatformRemainingFuel:10058,PlatformCallSign:10059,SensorFOVName:10063,PlatformMagneticHeading:10064,LDSVersionNumber:10065,AlternatePlatformName:10070,EventStartTimeUTC:10072,VMTIDataSet:10074,SensorEllipsoidHeight:10075,OperationalMode:10077,CornerLatitudePoint1:10082,CornerLongitudePoint1:10083,CornerLatitudePoint2:10084,CornerLongitudePoint2:10085,CornerLatitudePoint3:10086,CornerLongitudePoint3:10087,CornerLatitudePoint4:10088,CornerLongitudePoint4:10089,SARMotionImageryMetadata:10095,SecurityClassification:20001,SecurityClassifyingAuthority:20002,SecurityClassifyingCountry:20003,SecuritySCI:20004,SecurityCaveats:20005,SecurityReleaseInstructions:20006,SecurityLDSVersion:20022,EsriVideoWidth:90001,EsriVideoHeight:90002,EsriFrameCenterLatitude:90050,EsriFrameCenterLongitude:90051,EsriCornerLatitudePt1:90052,EsriCornerLongitudePt1:90053,EsriCornerLatitudePt2:90054,EsriCornerLongitudePt2:90055,EsriCornerLatitudePt3:90056,EsriCornerLongitudePt3:90057,EsriCornerLatitudePt4:90058,EsriCornerLongitudePt4:90059,EsriFrameOutline:90060,EsriSensorPosition:90061,EsriHorizonPixelPack:90063,EsriGroundControlPoints:90064};function a(e){const{duration:t,end:r,start:n,timezone:o="UTC"}=e||{};return"number"!=typeof t?null:new i({duration:t||null,end:"number"==typeof r?new Date(r):null,start:"number"==typeof n?new Date(n):null,timezone:o})}function u(e,t){const r=[...t],n=r.findIndex((t=>t.equals(e)));return n>-1&&r.splice(n),r.push(e),r}function s(e){if(!e?.size)return new n;const t=c(e),r=g(e),i=L(e),o=E(t,r);return new n({frameCenter:r,frameOutline:i,lineOfSight:o,sensorLocation:t})}function l(e){if(!e?.size)return null;return e.get(o.EsriGroundControlPoints)?.value??null??null}function d(e){return e?.size?e.get(o.EsriHorizonPixelPack)?.value??null:null}function g(e){return f(e)??C(e)}function f(t){return t&&t.has(o.EsriFrameCenterLatitude)&&t.has(o.EsriFrameCenterLongitude)?new e({x:t.get(o.EsriFrameCenterLongitude).value,y:t.get(o.EsriFrameCenterLatitude).value,z:t.get(o.FrameCenterElevation).value}):null}function C(t){return t&&t.has(o.FrameCenterLatitude)&&t.has(o.FrameCenterLongitude)?new e({x:t.get(o.FrameCenterLongitude)?.value,y:t.get(o.FrameCenterLatitude)?.value,z:t.get(o.FrameCenterElevation)?.value}):null}function L(e){if(!e)return null;const r=e.get(o.EsriFrameOutline)?.value;return r?t.fromJSON(r.geometry):m(e)??P(e)}function m(e){if(!(e.has(o.EsriCornerLatitudePt1)&&e.has(o.EsriCornerLongitudePt1)&&e.has(o.EsriCornerLatitudePt2)&&e.has(o.EsriCornerLongitudePt2)&&e.has(o.EsriCornerLatitudePt3)&&e.has(o.EsriCornerLongitudePt3)&&e.has(o.EsriCornerLatitudePt4)&&e.has(o.EsriCornerLongitudePt4)))return null;const r=[e.get(o.EsriCornerLongitudePt1)?.value,e.get(o.EsriCornerLatitudePt1)?.value],n=[e.get(o.EsriCornerLongitudePt2)?.value,e.get(o.EsriCornerLatitudePt2)?.value],i=[e.get(o.EsriCornerLongitudePt3)?.value,e.get(o.EsriCornerLatitudePt3)?.value],a=[e.get(o.EsriCornerLongitudePt4)?.value,e.get(o.EsriCornerLatitudePt4)?.value];return new t({rings:[[r,n,i,a]]})}function P(e){if(!(e.has(o.OffsetCorner1Latitude)&&e.has(o.OffsetCorner1Longitude)&&e.has(o.OffsetCorner2Latitude)&&e.has(o.OffsetCorner2Longitude)&&e.has(o.OffsetCorner3Latitude)&&e.has(o.OffsetCorner3Longitude)&&e.has(o.OffsetCorner4Latitude)&&e.has(o.OffsetCorner4Longitude)&&e.has(o.FrameCenterLatitude)&&e.has(o.FrameCenterLongitude)))return null;const r=e.get(o.FrameCenterLatitude)?.value,n=e.get(o.FrameCenterLongitude)?.value,i=r+e.get(o.OffsetCorner1Latitude)?.value,a=n+e.get(o.OffsetCorner1Longitude)?.value,u=r+e.get(o.OffsetCorner2Latitude)?.value,s=n+e.get(o.OffsetCorner2Longitude)?.value,l=r+e.get(o.OffsetCorner3Latitude)?.value,d=n+e.get(o.OffsetCorner3Longitude)?.value,g=r+e.get(o.OffsetCorner4Latitude)?.value,f=n+e.get(o.OffsetCorner4Longitude)?.value;return new t({rings:[[[a,i],[s,u],[d,l],[f,g]]]})}function E(e,t){if(!e||!t)return null;const n=[e.x,e.y,e.z??0],i=[t.x,t.y,t.z??0];return new r({paths:[[n,i]]})}function c(t){if(!t?.size)return null;if(t.has(o.EsriSensorPosition)){const r=t.get(o.EsriSensorPosition)?.value;if(r)return e.fromJSON(r.geometry)}return t.has(o.SensorLongitude)&&t.has(o.SensorLatitude)&&t.has(o.SensorTrueAltitude)?new e({x:t.get(o.SensorLongitude)?.value,y:t.get(o.SensorLatitude)?.value,z:t.get(o.SensorTrueAltitude)?.value}):null}export{g as getFrameCenter,d as getFrameHorizonPoints,l as getGroundControlPoints,u as getSensorTrailPoints,s as getTelemetryData,a as readVideoTimeExtent,o as videoMetadataEntryId};
|
package/package.json
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Error.js";import t from"../../../geometry/Multipoint.js";import o from"../../../geometry/Point.js";import
|
|
5
|
+
import e from"../../../core/Error.js";import t from"../../../geometry/Multipoint.js";import o from"../../../geometry/Point.js";import s from"../../../geometry/Polygon.js";import r from"../../../geometry/Polyline.js";import{WasmGeometryTypeCodes as n}from"./KnowledgeWasmInterface.js";function a(e,o){const s={spatialReference:o},r=c(e,s),n=e.lengths,a=e.coords,h=n[0];s.points=[];let l=0;for(let t=0;t<h;t++){const e=[];for(let t=0;t<r;t++)e[t]=a[l],l++;s.points.push(e)}return new t(s)}function h(e,t){const s={spatialReference:t};let r=2;c(e,s);const n=e.coords;return s.x=n[0],s.y=n[1],e.has_z&&(s.z=n[r],r++),e.has_m&&(s.m=n[r]),new o(s)}function l(e,t){const{paths:o,hasM:s,hasZ:a}=p(e,n.ESRI_GEOMETRY_POLYLINE);return new r({paths:o,hasM:s,hasZ:a,spatialReference:t})}function i(e,t){const{paths:o,hasM:r,hasZ:a}=p(e,n.ESRI_GEOMETRY_POLYGON);return new s({rings:o,hasM:r,hasZ:a,spatialReference:t})}function p(t,o){const s={paths:[],hasM:!1,hasZ:!1},r=c(t,s),{coords:n,geometry_type:a,lengths:h}=t;if(a.value!==o)throw new e("KnowledgeGraph:illegal-geometry-type","Illegal Geometry type for multipath conversion");let l=0;return h.forEach((e=>{const t=[];for(let o=0;o<e;o++){const e=[];for(let t=0;t<r;t++)e[t]=n[l],l++;t.push(e)}s.paths.push(t)})),s}function c(e,t){let o=2;return e.has_z?(t.hasZ=e.has_z,o++):t.hasZ=!1,e.has_m?(t.hasM=e.has_m,o++):t.hasM=!1,o}export{a as wasmToMultipointGeometry,h as wasmToPointGeometry,i as wasmToPolygonGeometry,l as wasmToPolylineGeometry};
|
package/support/revision.js
CHANGED
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const e="20240708",a="9ee0717e510087e1a276aef849bb9dd818674174";export{e as buildDate,a as commitHash};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import"../../../geometry.js";import e from"../../../Graphic.js";import"../../../symbols.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{px2pt as r}from"../../../core/screenUtils.js";import{subtract as
|
|
5
|
+
import"../../../geometry.js";import e from"../../../Graphic.js";import"../../../symbols.js";import{makeHandle as t}from"../../../core/handleUtils.js";import{px2pt as r}from"../../../core/screenUtils.js";import{ensureClass as i}from"../../../core/accessorSupport/ensureType.js";import{subtract as o,cross as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{create as a}from"../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{create as l}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{LineCapStyle as s,LineJoinStyle as m}from"../../../symbols/cim/enums.js";import{asVec2 as c}from"../../interactive/sketch/normalizedPoint.js";import{defaults as p}from"../../interactive/snapping/Settings.js";import{SnappingVisualizer as y}from"../../interactive/snapping/SnappingVisualizer.js";import g from"../../../geometry/Point.js";import b from"../../../geometry/Polyline.js";import h from"../../../geometry/SpatialReference.js";import S from"../../../symbols/CIMSymbol.js";import f from"../../../symbols/SimpleMarkerSymbol.js";import u from"../../../symbols/SimpleLineSymbol.js";class d extends y{constructor(e){super(),this._graphicsLayer=e,this._symbolPairingsByType=new Map}visualizeIntersectionPoint(e,t){return this._visualizeSnappingIndicator(new g({x:e.intersectionPoint[0],y:e.intersectionPoint[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("intersectionPoint",t.view.effectiveTheme.accentColor))}visualizePoint(e,t){return this._visualizeSnappingIndicator(new g({x:e.point[0],y:e.point[1],spatialReference:t.spatialReference}),this._getOrCreateSymbol("point",t.view.effectiveTheme.accentColor))}visualizeLine(e,t){return this._visualizeSnappingIndicator(new b({paths:[[[...e.lineStart],[...e.lineEnd]]],spatialReference:i(h,t.spatialReference)}),this._getOrCreateSymbol("line",t.view.effectiveTheme.accentColor))}visualizeParallelSign(e,t){return this._visualizeSnappingIndicator(new b({paths:[[[...e.lineStart],[...e.lineEnd]]],spatialReference:i(h,t.spatialReference)}),this._getOrCreateSymbol("parallelSign",t.view.effectiveTheme.accentColor))}visualizeRightAngleQuad(e,t){const r=a(),s=a(),m=l();o(r,c(e.centerVertex),c(e.previousVertex)),o(s,c(e.nextVertex),c(e.previousVertex)),n(m,r,s);const p=`rightAngleQuad${m[2]<0?45:225}`;return this._visualizeSnappingIndicator(new b({paths:[[[...e.previousVertex],[...e.centerVertex],[...e.nextVertex]]],spatialReference:i(h,t.spatialReference)}),this._getOrCreateSymbol(p,t.view.effectiveTheme.accentColor))}_visualizeSnappingIndicator(r,i){const o=new e({geometry:r,symbol:i});return this._graphicsLayer.add(o),t((()=>{this._graphicsLayer.remove(o)}))}_getOrCreateSymbol(e,t){const r=this._symbolPairingsByType;return r.get(e)?.color!==t&&r.set(e,{color:t,symbol:M(e,t)}),r.get(e).symbol}}function M(e,t){const i=[...t.toRgb(),255*t.a];switch(e){case"point":return new f({outline:{width:.5,color:[0,0,0,1]},size:10,color:t});case"intersectionPoint":return new f({outline:new u({width:1.5,color:t}),size:15,color:[0,0,0,0]});case"line":return new S({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:s.Butt,joinStyle:m.Round,miterLimit:10,width:r(p.lineHintWidthTarget),color:i}]}}});case"parallelSign":return new S({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:-1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,1.5],[7,1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:i}]}}],scaleSymbolsProportionally:!0,respectFrame:!0},{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:0,y:1,z:0},anchorPointUnits:"Relative",size:5,markerPlacement:{type:"CIMMarkerPlacementOnLine",placePerPart:!0,angleToLine:!0,relativeTo:"LineMiddle"},frame:{xmin:-5,ymin:-1.5,xmax:5,ymax:1.5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{rings:[[[7,0],[-7,0],[-7,-1.5],[7,-1.5]]]},symbol:{type:"CIMPolygonSymbol",symbolLayers:[{type:"CIMSolidFill",enable:!0,color:i}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}});case"rightAngleQuad45":case"rightAngleQuad225":{const o="rightAngleQuad45"===e?45:225;return new S({data:{type:"CIMSymbolReference",symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMVectorMarker",enable:!0,anchorPoint:{x:.5,y:.5,z:0},anchorPointUnits:"Relative",size:r(p.rightAngleHintSize),rotation:o,markerPlacement:{type:"CIMMarkerPlacementOnVertices",placePerPart:!0,angleToLine:!0,placeOnEndPoints:!1},frame:{xmin:-5,ymin:-5,xmax:5,ymax:5},markerGraphics:[{type:"CIMMarkerGraphic",geometry:{paths:[[[5,-5],[-5,-5],[-5,5],[5,5],[5,-5]]]},symbol:{type:"CIMLineSymbol",symbolLayers:[{type:"CIMSolidStroke",enable:!0,capStyle:"Butt",joinStyle:"Round",miterLimit:10,width:r(p.rightAngleHintOutlineSize),color:i},{type:"CIMSolidFill",enable:!0,color:[...t.toRgb(),255*t.a*.4]}]}}],scaleSymbolsProportionally:!0,respectFrame:!0}]}}})}}}export{d as SnappingVisualizer2D};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as
|
|
5
|
+
import{unitRGBAFromColor as e}from"../../../core/colorUtils.js";import t from"../../../core/Handles.js";import{clamp as s,lerp as i,smoothstep as r}from"../../../core/mathUtils.js";import{watch as a,syncAndInitial as o}from"../../../core/reactiveUtils.js";import{set as n}from"../../../core/libs/gl-matrix-2/math/vec2.js";import{s as h,l as m,q as u}from"../../../chunks/vec32.js";import{s as c}from"../../../chunks/vec42.js";import{ZEROS as d}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{earth as p}from"../../../geometry/support/Ellipsoid.js";import{AtmosphereType as l}from"./AtmosphereType.js";import{atmosphereHeight as _,innerAtmosphereDepth as f,computeInnerAltitudeFade as b}from"./atmosphereUtils.js";import{ChapmanAtmospherePassParameters as T,ChapmanAtmosphereTechnique as q}from"./ChapmanAtmosphereTechnique.js";import{ChapmanAtmosphereTechniqueConfiguration as g}from"./ChapmanAtmosphereTechniqueConfiguration.js";import{ColorFormat as v}from"../webgl/formats.js";import{Pos2Tex as w}from"../webgl-engine/lib/DefaultVertexBufferLayouts.js";import{createQuadVAO as P}from"../webgl-engine/lib/glUtil3D.js";import{applyTextureResizeModulo as x}from"../webgl-engine/lib/textureUtils.js";import{A as j}from"../../../chunks/AtmosphereCompositing.glsl.js";import{AtmosphereCompositingTechnique as R}from"../webgl-engine/shaders/AtmosphereCompositingTechnique.js";import{PrimitiveType as E}from"../../webgl/enums.js";import z from"../../../webscene/background/ColorBackground.js";class B{constructor(s,i){this._view=s,this._context=i,this.type=l.Realistic,this._handles=new t,this._compositingPassParameters=new j,this._passParameters=new T,this._rootTileElevationMin=NaN,this._lowerBoundEarthRadius=p.radius,this._fadeHaze=0,this._updateRadius(p.radius);const r=this._context.renderContext.rctx;this._updateRootTileElevationBounds(),this._handles.add([a((()=>this._view?.basemapTerrain?.rootTileElevationBounds),(()=>this._view?.basemapTerrain?this._updateRootTileElevationBounds():null)),a((()=>this._view?.basemapTerrain?.visibleElevationBounds),(()=>this._view?.basemapTerrain?this._updateVisibleElevationBounds():null)),a((()=>this._view?.environment.background),(t=>{const s=t instanceof z?e(t.color):d;h(this._passParameters.backgroundColor,s[0]*s[3],s[1]*s[3],s[2]*s[3])}),o)]);const n=new g;n.haze=!1,this._atmosphereTechnique=this._context.techniques.acquire(q,n),this._compositingTechnique=this._context.techniques.acquire(R,n),n.haze=!0,this._atmosphereHazeTechnique=this._context.techniques.acquire(q,n),this._compositingHazeTechnique=this._context.techniques.acquire(R,n),n.reduced=!0,n.haze=!1,this._atmosphereReducedTechnique=this._context.techniques.acquire(q,n),n.haze=!0,this._atmosphereHazeReducedTechnique=this._context.techniques.acquire(q,n),this._vao=P(r,w)}destroy(){this._handles.destroy(),this._compositingTechnique.release(),this._compositingHazeTechnique.release(),this._atmosphereTechnique.release(),this._atmosphereHazeTechnique.release(),this._atmosphereReducedTechnique.release(),this._atmosphereHazeReducedTechnique.release(),this._vao.dispose()}render(e,t){this._render(e,t?this._atmosphereTechnique:this._atmosphereReducedTechnique,t,!1)}renderHaze(e,t,s){this._fadeHaze=t,this._render(e,s?this._atmosphereHazeTechnique:this._atmosphereHazeReducedTechnique,s,!0)}_render(e,t,s,r){if(!e.bindParameters.mainDepth)return;const a=e.bindParameters.camera;this._update(a);const o=e.rctx,n=o.bindTechnique(t,e.bindParameters,this._passParameters),h=e.framebuffer;if(s)h.renderWithoutDepth((()=>this._renderCommon(n,o)));else{const t=o.getViewport(),s=m(a.eye)-p.radius;let u;if(s<_){const e=Math.min(1,Math.max(0,s/_));u=r?i(.4,.5,e):i(.2,.3,e)}else{const e=Math.min(1,Math.max(0,(s-_)/(15*_)));u=r?i(.5,1,e):i(.3,.6,e)}const c=x(Math.round(u*a.fullViewport[2])),d=x(Math.round(u*a.fullViewport[3]));o.setViewport(0,0,c,d);const l=this._context.fbos.acquire(c,d,r?"chapman haze":"chapman",v.RGBA);o.bindFramebuffer(l.fbo),o.clearFramebuffer([0,0,0,1],!0,!0),this._renderCommon(n,o),o.setViewport(t.x,t.y,t.width,t.height),this._compositingPassParameters.color=l.getTexture();const f=r?this._compositingHazeTechnique:this._compositingTechnique;o.bindTechnique(f,e.bindParameters,this._compositingPassParameters),h.renderWithoutDepth((()=>o.screen.draw())),l.release()}}_renderCommon(e,t){null!=this._vao&&(t.bindVAO(this._vao),e.assertCompatibleVertexAttributeLocations(this._vao),t.drawArrays(E.TRIANGLE_STRIP,0,4))}_updateRootTileElevationBounds(){const e=this._view.basemapTerrain.rootTileElevationBounds.min;e!==this._rootTileElevationMin&&(this._rootTileElevationMin=e,this._lowerBoundEarthRadius=p.radius,this._updateVisibleElevationBounds())}_updateVisibleElevationBounds(){const e=H(p.radius+this._view.basemapTerrain.visibleElevationBounds.min);e<this._lowerBoundEarthRadius&&this._updateRadius(e)}_updateRadius(e){this._lowerBoundEarthRadius=e,n(this._passParameters.radii,e,e+_),this._passParameters.innerFadeDistance=2*Math.sqrt((2*e-f)*f)}_update(e){if(!e)return;const t=u(e.eye),a=Math.sqrt(t),o=t-this._passParameters.radii[1]*this._passParameters.radii[1],n=s((a-this._passParameters.radii[0])/_,0,1);c(this._passParameters.heightParameters,a,t,o,n),this._passParameters.altitudeFade=b(a-this._lowerBoundEarthRadius),this._passParameters.hazeStrength=i(i(.6,1,r(9500,10500,a-p.radius)),1,this._fadeHaze)}}function H(e){return e*Math.cos(Math.PI/16/16)}export{B as ChapmanAtmosphere};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{smoothstep as e}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,m as a,j as n,o as c,l as m}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{atmosphereHeight as u}from"./atmosphereUtils.js";import{F as d}from"../../../chunks/Fog.glsl.js";import{FogTechnique as l}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";const f=.95,_=1;let j=class extends s{constructor(t){super(t),this._passParameters=new d,this._technique=new l(t);const s=h(t.view.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+u}destroy(){this._technique.release()}set strength(t){this._passParameters.fogStrength=t}get strength(){return this._passParameters.fogStrength}render(t,s){
|
|
5
|
+
import{_ as t}from"../../../chunks/tslib.es6.js";import s from"../../../core/Accessor.js";import{smoothstep as e}from"../../../core/mathUtils.js";import{property as r}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/has.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{n as i,m as a,j as n,o as c,l as m}from"../../../chunks/vec32.js";import{create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getReferenceEllipsoid as h}from"../../../geometry/ellipsoidUtils.js";import{atmosphereHeight as u}from"./atmosphereUtils.js";import{F as d}from"../../../chunks/Fog.glsl.js";import{FogTechnique as l}from"./FogTechnique.js";import{weatherHeightLimit as g}from"./weather.js";const f=.95,_=1;let j=class extends s{constructor(t){super(t),this._passParameters=new d,this._technique=new l(t);const s=h(t.view.spatialReference);this._planetRadius=s.radius,this._atmosphereRadius=s.radius+u}destroy(){this._technique.release()}set strength(t){this._passParameters.fogStrength=t}get strength(){return this._passParameters.fogStrength}render(t,s){this._update(t,s),this._passParameters.fogAmount<=0||(this._technique.compiled?t.framebuffer.renderWithoutDepth((()=>{t.rctx.bindTechnique(this._technique,t.bindParameters,this._passParameters),t.rctx.screen.draw()})):this.context.requestRender())}_update(t,s){const r=t.bindParameters.camera;i(P,r.eye);const o=Math.max(0,a(P,t.bindParameters.lighting.mainLight.direction)),p=s.color;n(v,p,.1),c(this._passParameters.fogColor,v,p,o);const h=m(r.eye),u=h*h;this._passParameters.atmosphereC=u-this._atmosphereRadius**2,this._passParameters.fogAmount=(1-e(f*g,_*g,Math.abs(h-this._planetRadius)))*s.amount,this._passParameters.fogStrength=s.strength}};t([r({constructOnly:!0})],j.prototype,"context",void 0),t([r({constructOnly:!0})],j.prototype,"view",void 0),t([r({constructOnly:!0})],j.prototype,"rctx",void 0),t([r({constructOnly:!0})],j.prototype,"viewingMode",void 0),j=t([o("esri.views.3d.environment.Fog")],j);class y{constructor(){this.color=p(),this.strength=0,this.amount=0}}const P=p(),v=p();export{j as Fog,y as FogParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,t as y}from"../../../chunks/vec32.js";import{fromArray as w,create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as V,BufferViewVec2f as I,BufferViewInt16 as H,BufferViewUint32 as R,BufferViewUint16 as A}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as F,wasmFailedToInit as S,Lyr3DPrimitiveType as L,Lyr3DLightingModel as D,Lyr3DUvWrapMode as k,Lyr3DImageFormat as B,Lyr3DPixelFormat as G,Lyr3DVtxAtrbSemantic as N,Lyr3DType as z}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as W}from"../../../support/elevationInfoUtils.js";import{ViewingMode as $}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as J}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as K}from"./LayerView3D.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as X,getLyr3DWasm as Y}from"./Lyr3DWasm.js";import{LayerElevationProvider as Z}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as ee,alphaModeConversion as te,faceCullingConversion as re,wrapModeConversion as ie,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as oe}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ne}from"../support/ElevationRange.js";import{Obb as ae,compute as le}from"../support/orientedBoundingBox.js";import{ObjectParameters as ce}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateAttributeType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{getEllipsoidMode as fe}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as ge}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as be,AlphaDiscardMode as ye,TextureEncodingMimeType as we}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as ve}from"../webgl-engine/lib/Normals.js";import{Texture as _e}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as xe}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as je}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Ce from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Te}from"../../support/layerViewUtils.js";var Me;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Me||(Me={}));class Pe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}totalMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function Oe(e){return Math.round(e/1048.576)/1e3}let Ue=class extends(K(Ce)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Me.Error),this._dbg(Me.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=Q(this).then((e=>{this._intersectionHandler=new oe(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Z({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([s((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=s((()=>this.suspended),(e=>{const t=Y(this.view);t&&t.setEnabled(this,!e)}),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===S)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Me.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=i(this._memCache),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=n((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?be.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){const t=Y(this.view);t&&t.setLayerOffset(this,W(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.totalMemory())})),e}get unloadedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.totalMemory())})),e}get visibleAtCurrentScale(){return Te(this.layer.effectiveScaleRange,this.view.terrainScale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach((n=>{n.isVisible?(e+=n.texMemoryUsage,t+=n.vboMemoryUsage,s++):(r+=n.texMemoryUsage,i+=n.vboMemoryUsage,o++)})),new J(this.usedMemory,s,o,Oe(t),Oe(e),Oe(i),Oe(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===$.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return W(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ne(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=Y(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),i=new Array,s=new Map,o=new Pe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,l;if("global"===this.view.viewingMode){const e=f();j(x,r,e,n),a=c(h(),e),l=m(h(),a)}else a=d,l=d;const M=f();u(M,M,r);const P=p(v(),M);let O=null;const U=v();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ae(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];if(this._dbg(Me.VerboseAPI,JSON.stringify(e)),e.ptype===L.Lines)continue;if(null==ee[e.ptype]||null==t.data){this._dbg(Me.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,u=!has("disable-feature:im-shading"),{positionView:p,positionAttr:f,normalsView:g,normalsAttr:w,colorAttr:x,texCoord0Attr:j,indicesView:M}=this.getBufferViews(e,t.data.buffer,a,u);if(null==f||null==p||null==M)continue;const E={colors:null!=x,textureCoordinates:null!=j?pe.Default:pe.None,hasNormals:null!=g,needsNormals:u},V=f.data.length/f.size,I=(e,t)=>!e||e.data.length/e.size===V||(this._dbg(Me.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(j,"numTexcoord")||!I(x,"numColors")||!I(w,"normals"))continue;const H=me(E);if(null!=O?O=O.clone():(O=le(f),b(U,O.center,r),O.center=U),a!==d)for(let t=0;t<p.count;t++)p.getVec(t,U),y(U,U,a),p.setVec(t,U);const R=H.createBuffer(f.data.length),A=new Map([[xe.POSITION,f]]);null!=j&&A.set(xe.UV0,j),null!=x&&A.set(xe.COLOR,x),null!=w&&A.set(xe.NORMALCOMPRESSED,w),A.forEach(((e,t)=>{null!=e&&je(t,e,null,null,R,0)}));const F=new Uint32Array([0,M.typedBuffer.length]),S={vertices:{data:R.buffer,count:R.byteLength/H.stride,layoutParameters:E},positionData:{positions:p.typedBuffer,indices:M.typedBuffer},indices:M.typedBuffer,componentOffsets:F};o.cpuMemoryUsage+=p.count,o.cpuMemoryUsage+=M.count;const k=this.view.renderSpatialReference,B=v(),G=[1,1,1];C(P,k,G,n)||this._dbg(Me.Error,"Unsupported coordinate system for IM overlay"),T(P,k,B,n);const N=this._collection.createObject(new ce(_(B[0],B[1],G[0],G[1]),new de(P,l),O,S));m&&this._collection.updateMaterial(N,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,s),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,s),e.emissionTexture=this._getTexture(m.emissiveTex,t,s),e.occlusionTexture=this._getTexture(m.occlusionTex,t,s),e.normalTexture=this._getTexture(m.normalTex,t,s)),e.objectOpacity=0,e.alphaDiscardMode=ye.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);i.push(n),n.then((()=>{e.alphaDiscardMode=te[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?re[m.faceCulling]:be.Back,this._initialCullFace.set(N,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??.1,e.alphaDiscardMode=te[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=fe(this.view.spatialReference)})),o.components.push(N),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(N)}if(await Promise.all(i),s.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o,o.totalMemory()),{memUsageBytes:o.totalMemory()}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o,o.totalMemory()))}}}_getTexture(e,t,r){let i=null;if(e&&t.desc?.images&&t.data?.buffer){const s=t.desc.images[e?.imageId];if(i=r.get(s),!i&&s){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=o>1,a=ie[e.wrapMode??k.None];let l=s.alpha?4:3;const c=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,d=null,h=null;switch(s.format){case B.Raw:s.pixelFormat===G.R8?(m=c.buffer,l=1,d=""):s.pixelFormat===G.Rgb8?(m=c.buffer,l=3,d=""):s.pixelFormat===G.Rgba8&&(m=c.buffer,l=4,d="");break;case B.Dxt1:m=c.buffer,l=3,d=we.DDS_ENCODING;break;case B.Dxt5:m=c.buffer,l=4,d=we.DDS_ENCODING;break;case B.Png:d="image/png",h=document.createElement("img");break;case B.Jpeg:d="image/jpeg",h=document.createElement("img");break;case B.Etc2:d="image/ktx",h=document.createElement("img");break;case B.Astc:this._dbg(Me.Error,"Astc texture not supported");break;case B.Pvrtc:this._dbg(Me.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(i=new _e(m,{mipmap:n,maxAnisotropy:o,encoding:d,wrap:a,components:l,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height}),this._stage.add(i),r.set(s,i))}}return i?new ue(this.view._stage.renderView.textures,i.id):null}getBufferViews(e,t,r,i){let s,o,n,a,l,c,m,d=null;for(let u=0;u<e.atrbs.length;u++){const m=e.atrbs[u],p=m.view,f=void 0,g=p.byteOffset+p.byteCount,b=p.byteCount/se[p.type],y=[...Array(b).keys()].map((e=>e));try{switch(m.sem){case N.Position:3!==p.ncomp||p.type!==z.F32?this._dbg(Me.Error,"[Unsupported Feature] Unsupported view for Position ("+p+")"):(s=new U(t,p.byteOffset,f,g),o=new ge(s.typedBuffer,y,3));break;case N.Normal:if(3!==p.ncomp||p.type!==z.F32)this._dbg(Me.Error,"[Unsupported Feature] Unsupported view for Normal ("+p+")");else if(i){const e=new U(t,p.byteOffset,f,g),i=ve(e.typedBuffer,r);l=new H(i),c=new ge(l.typedBuffer,y,2)}break;case N.TexCoord:2!==p.ncomp||p.type!==z.F32?this._dbg(Me.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+p+")"):void 0===a&&(a=new ge(new I(t,p.byteOffset,f,g).typedBuffer,y,2));break;case N.Color:4===p.ncomp?(p.type===z.F32&&(d=new M(t,p.byteOffset,f,g)),p.type===z.U8&&(d=new P(t,p.byteOffset,f,g)),p.type===z.U16&&(d=new O(t,p.byteOffset,f,g))):3===p.ncomp&&(p.type===z.F32&&(d=new U(t,p.byteOffset,f,g)),p.type===z.U8&&(d=new E(t,p.byteOffset,f,g)),p.type===z.U16&&(d=new V(t,p.byteOffset,f,g))),null==d?this._dbg(Me.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+p+")"):n=new ge(d.typedBuffer,y,p.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Me.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+m.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(Me.VerboseAPI,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case z.U16:m=new A(t,r.byteOffset,i,s);break;case z.U32:m=new R(t,r.byteOffset,i,s);break;case z.U8:default:this._dbg(Me.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==m&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);m=new A(t)}else{const t=new Uint32Array(e);m=new R(t)}for(let t=0;t<e;t++)m.set(t,t)}return{positionView:s,positionAttr:o,colorAttr:n,texCoord0Attr:a,indicesView:m,normalsView:l,normalsAttr:c}}_onRemoveFromCache(e){const t=Y(this.view);t&&t.onRenderableEvicted(this,e.handle,e.totalMemory()),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Me.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([a()],Ue.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],Ue.prototype,"layer",void 0),e([a({readOnly:!0})],Ue.prototype,"visibleAtCurrentScale",null),e([a()],Ue.prototype,"elevationOffset",null),Ue=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ue);const Ee=Ue;export{Ee as default};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Error.js";import has from"../../../core/has.js";import r from"../../../core/Logger.js";import{destroyMaybe as i}from"../../../core/maybe.js";import{watch as s,initial as o}from"../../../core/reactiveUtils.js";import{schedule as n}from"../../../core/scheduling.js";import{property as a}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{fromMat4 as c,invert as m}from"../../../core/libs/gl-matrix-2/math/mat3.js";import{IDENTITY as d,create as h}from"../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{translate as u,getTranslation as p}from"../../../core/libs/gl-matrix-2/math/mat4.js";import{create as f}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{fromValues as g}from"../../../core/libs/gl-matrix-2/factories/quatf64.js";import{g as b,t as y}from"../../../chunks/vec32.js";import{fromArray as w,create as v}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as _}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{SphericalECEFSpatialReferenceLike as x}from"../../../geometry/ellipsoidUtils.js";import{computeTranslationToOriginAndRotation as j}from"../../../geometry/projection/computeTranslationToOriginAndRotation.js";import{localLinearScaleFactors as C}from"../../../geometry/projection/localLinearScaleFactors.js";import{projectVectorToVector as T}from"../../../geometry/projection/projectVectorToVector.js";import{BufferViewVec4f as M,BufferViewVec4u8 as P,BufferViewVec4u16 as O,BufferViewVec3f as U,BufferViewVec3u8 as E,BufferViewVec3u16 as V,BufferViewVec2f as I,BufferViewInt16 as H,BufferViewUint32 as A,BufferViewUint16 as R}from"../../../geometry/support/buffer/BufferView.js";import{invalidLayerView as F,wasmFailedToInit as S,Lyr3DPrimitiveType as L,Lyr3DLightingModel as D,Lyr3DUvWrapMode as k,Lyr3DImageFormat as B,Lyr3DPixelFormat as G,Lyr3DVtxAtrbSemantic as N,Lyr3DType as z}from"../../../layers/ILyr3DWasmPerSceneView.js";import{getElevationOffsetInMeters as W}from"../../../support/elevationInfoUtils.js";import{ViewingMode as $}from"../../ViewingMode.js";import{IntegratedMesh3DTilesViewPerformanceInfo as J}from"./IntegratedMesh3DTilesViewPerformanceInfo.js";import{DrapeTargetType as q}from"./interfaces.js";import{LayerView3D as K}from"./LayerView3D.js";import{addLayerViewToWasm as Q,removeLayerViewFromWasm as X,getLyr3DWasm as Y}from"./Lyr3DWasm.js";import{LayerElevationProvider as Z}from"./i3s/LayerElevationProvider.js";import{primTypeConversion as ee,alphaModeConversion as te,faceCullingConversion as re,wrapModeConversion as ie,lyr3DTypeToByteSize as se}from"./support/lyr3dTypeConversions.js";import{Tiles3DIntersectionHandler as oe}from"./support/Tiles3DIntersectionHandler.js";import{ElevationRange as ne}from"../support/ElevationRange.js";import{Obb as ae,compute as le}from"../support/orientedBoundingBox.js";import{ObjectParameters as ce}from"../webgl-engine/collections/Component/ObjectParameters.js";import{createVertexBufferLayout as me}from"../webgl-engine/collections/Component/SourceGeometry.js";import{Transform as de}from"../webgl-engine/collections/Component/Transform.js";import{ComponentParameterSummary as he}from"../webgl-engine/collections/Component/Material/ComponentMaterial.js";import{RenderTexture as ue}from"../webgl-engine/core/material/RenderTexture.js";import{TextureCoordinateAttributeType as pe}from"../webgl-engine/core/shaderLibrary/attributes/TextureCoordinateAttribute.glsl.js";import{alphaCutoff as fe}from"../webgl-engine/core/shaderLibrary/util/AlphaCutoff.js";import{getEllipsoidMode as ge}from"../webgl-engine/core/shaderLibrary/util/EllipsoidMode.js";import{Attribute as be}from"../webgl-engine/lib/Attribute.js";import{CullFaceOptions as ye,AlphaDiscardMode as we,TextureEncodingMimeType as ve}from"../webgl-engine/lib/basicInterfaces.js";import{compressAndTransformNormals as _e}from"../webgl-engine/lib/Normals.js";import{Texture as xe}from"../webgl-engine/lib/Texture.js";import{VertexAttribute as je}from"../webgl-engine/lib/VertexAttribute.js";import{writeDefaultAttribute as Ce}from"../webgl-engine/materials/internal/bufferWriterUtils.js";import Te from"../../layers/LayerView.js";import{isInEffectiveScaleRange as Me}from"../../support/layerViewUtils.js";var Pe;!function(e){e[e.API=1]="API",e[e.VerboseAPI=2]="VerboseAPI",e[e.Error=3]="Error"}(Pe||(Pe={}));class Oe{constructor(){this.handle=0,this.isVisible=!1,this.components=[],this.texMemoryUsage=0,this.vboMemoryUsage=0,this.cpuMemoryUsage=0,this.textures=[]}totalMemory(){return this.texMemoryUsage+this.vboMemoryUsage+this.cpuMemoryUsage}}function Ue(e){return Math.round(e/1048.576)/1e3}let Ee=class extends(K(Te)){constructor(){super(...arguments),this.type="integrated-mesh-3dtiles",this._visibleGeometryChangedSchedulerHandle=null,this._wasmLayerId=-1,this.ignoresMemoryFactor=!1,this.drapeTargetType=q.WithoutRasterImage,this._lyrHandleToObjects=new Map,this._initialCullFace=new Map,this._suspendedHandle=null,this._dbgFlags=new Set}initialize(){if(this._dbgFlags.add(Pe.Error),this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D initialize() called"),!this._canProjectWithoutEngine())throw new t("layerview:spatial-reference-incompatible","The spatial reference of this scene layer is incompatible with the spatial reference of the view",{});const e=Q(this).then((e=>{this._intersectionHandler=new oe(this),this.view.sceneIntersectionHelper.addIntersectionHandler(this._intersectionHandler),this._updatingHandles.add((()=>this.slicePlaneEnabled),(e=>this._slicePlaneEnabledChange(e))),this._elevationProvider=new Z({view:this.view,layerElevationSource:this,intersectionHandler:this._intersectionHandler}),this.view.elevationProvider.register("im",this._elevationProvider),this.view.basemapTerrain.overlayManager.registerDrapeTarget(this),this._wasmLayerId=e;const t=this.view.resourceController.memoryController.newCache(`t3d-${this.uid}`,(e=>this._onRemoveFromCache(e)));this._memCache=t,this.addHandles([s((()=>this.layer.elevationInfo),(e=>this._elevationInfoChanged(e)))]),this._suspendedHandle=s((()=>this.suspended),(e=>{const t=Y(this.view);t&&t.setEnabled(this,!e)}),o)})).catch((e=>{if(X(this),this._wasmLayerId=-1,e===F)throw new t("tiles3d:addLayer-failure","The 3d tiles layer description was invalid.",{});if(e===S)throw new t("tiles3d:addLayer-failure","The 3d tiles layer web assembly module failed to download.",{})}));this.addResolvingPromise(e)}destroy(){this._dbg(Pe.VerboseAPI,"Tiles3DLayerView3D destroy() called"),X(this),this._suspendedHandle&&(this._suspendedHandle.remove(),this._suspendedHandle=null),this._intersectionHandler&&(this.view.sceneIntersectionHelper.removeIntersectionHandler(this._intersectionHandler),this._intersectionHandler=null),this._elevationProvider&&(this._elevationProvider.objectsChanged(this._obbs),this.view.elevationProvider.unregister(this._elevationProvider),this._elevationProvider=null),this.view.basemapTerrain.overlayManager.unregisterDrapeTarget(this),this._lyrHandleToObjects.forEach((e=>this.freeObject(e))),this._lyrHandleToObjects.clear(),this._initialCullFace.clear(),this._memCache=i(this._memCache),this._updatingHandles=i(this._updatingHandles),this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle.remove(),this._visibleGeometryChangedSchedulerHandle=null)}_visibleGeometryChanged(){null==this._visibleGeometryChangedSchedulerHandle&&(this._visibleGeometryChangedSchedulerHandle=n((()=>{this.emit("visible-geometry-changed"),this._visibleGeometryChangedSchedulerHandle=null})))}_slicePlaneEnabledChange(e){this._intersectionHandler&&(this._intersectionHandler.slicePlaneEnabled=e),this.objects.forEach((t=>{const r=this._collection.getMaterial(t);r.commonMaterialParameters.hasSlicePlane=e,r.commonMaterialParameters.cullFace=e?ye.None:this._initialCullFace.get(t)}))}_elevationInfoChanged(e){const t=Y(this.view);t&&t.setLayerOffset(this,W(e))}get _obbs(){return this.objects.map((e=>this._collection.getComponentObb(e)))}get wasmLayerId(){return this._wasmLayerId}get usedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible&&(e+=t.totalMemory())})),e}get unloadedMemory(){let e=0;return this._lyrHandleToObjects.forEach((t=>{t.isVisible||(e+=t.totalMemory())})),e}get visibleAtCurrentScale(){return Me(this.layer.effectiveScaleRange,this.view.terrainScale)}get performanceInfo(){let e=0,t=0,r=0,i=0,s=0,o=0;return this._lyrHandleToObjects.forEach((n=>{n.isVisible?(e+=n.texMemoryUsage,t+=n.vboMemoryUsage,s++):(r+=n.texMemoryUsage,i+=n.vboMemoryUsage,o++)})),new J(this.usedMemory,s,o,Ue(t),Ue(e),Ue(i),Ue(r))}_canProjectWithoutEngine(){if(this.view.state.viewingMode===$.Local){const e=this.view.renderSpatialReference?.isWebMercator?3857:this.view.renderSpatialReference?.wkid??-1;if(3857!==e&&32662!==e)return!1}return!0}get _stage(){return this.view._stage}get _collection(){return this._stage.renderView.componentObjectCollection}get elevationOffset(){return W(this.layer.elevationInfo)}get elevationRange(){const e=this.fullExtent;return e?.zmin&&e?.zmax?new ne(e.zmin,e.zmax):null}getElevationRange(e){return null}get fullExtent(){return this.layer.fullExtent}get objects(){return Array.from(this._lyrHandleToObjects.values()).reduce(((e,t)=>e.concat(t.components)),new Array)}isUpdating(){const e=Y(this.view);return!(this._wasmLayerId<0||null==e)&&e.isUpdating(this._wasmLayerId)}updatingFlagChanged(){this.notifyChange("updating")}async createRenderable(e){const t=e.meshData;if(null==t.data)throw new Error("meshData.data undefined");if(t.desc=JSON.parse(t.desc),null==t.desc)throw new Error("meshData.desc undefined");const r=w(t.desc.origin),i=new Array,s=new Map,o=new Oe;o.handle=e.handle,this._lyrHandleToObjects.set(e.handle,o);const n=this.view.basemapTerrain.spatialReference;let a,l;if("global"===this.view.viewingMode){const e=f();j(x,r,e,n),a=c(h(),e),l=m(h(),a)}else a=d,l=d;const M=f();u(M,M,r);const P=p(v(),M);let O=null;const U=v();if(t.desc.obb){const e=t.desc.obb.quaternion;O=new ae(t.desc.obb.center,t.desc.obb.halfSize,g(e[0],e[1],e[2],e[3]))}for(let c=0;c<t.desc.prims.length;c++){const e=t.desc.prims[c];if(this._dbg(Pe.VerboseAPI,JSON.stringify(e)),e.ptype===L.Lines)continue;if(null==ee[e.ptype]||null==t.data){this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported primitive mode ("+e.ptype+"). Skipping primitive.");continue}const m=t.desc?.materials&&null!=e.materialId?t.desc.materials[e.materialId]:null,h=null!=m?m.lightingModel:D.Unlit,u=!has("disable-feature:im-shading"),{positionView:p,positionAttr:f,normalsView:g,normalsAttr:w,colorAttr:x,texCoord0Attr:j,indicesView:M}=this.getBufferViews(e,t.data.buffer,a,u);if(null==f||null==p||null==M)continue;const E={colors:null!=x,textureCoordinates:null!=j?pe.Default:pe.None,hasNormals:null!=g,needsNormals:u},V=f.data.length/f.size,I=(e,t)=>!e||e.data.length/e.size===V||(this._dbg(Pe.Error,`${t} !== numPos. Skipping primitive.`),!1);if(!I(j,"numTexcoord")||!I(x,"numColors")||!I(w,"normals"))continue;const H=me(E);if(null!=O?O=O.clone():(O=le(f),b(U,O.center,r),O.center=U),a!==d)for(let t=0;t<p.count;t++)p.getVec(t,U),y(U,U,a),p.setVec(t,U);const A=H.createBuffer(f.data.length),R=new Map([[je.POSITION,f]]);null!=j&&R.set(je.UV0,j),null!=x&&R.set(je.COLOR,x),null!=w&&R.set(je.NORMALCOMPRESSED,w),R.forEach(((e,t)=>{null!=e&&Ce(t,e,null,null,A,0)}));const F=new Uint32Array([0,M.typedBuffer.length]),S={vertices:{data:A.buffer,count:A.byteLength/H.stride,layoutParameters:E},positionData:{positions:p.typedBuffer,indices:M.typedBuffer},indices:M.typedBuffer,componentOffsets:F};o.cpuMemoryUsage+=p.count,o.cpuMemoryUsage+=M.count;const k=this.view.renderSpatialReference,B=v(),G=[1,1,1];C(P,k,G,n)||this._dbg(Pe.Error,"Unsupported coordinate system for IM overlay"),T(P,k,B,n);const N=this._collection.createObject(new ce(_(B[0],B[1],G[0],G[1]),new de(P,l),O,S));m&&this._collection.updateMaterial(N,(e=>{e.baseColor=m.baseColorFactor,e.usePBR=h===D.Pbr,e.hasParametersFromSource=!1,e.baseColorTexture=this._getTexture(m.baseColorTex,t,s),e.usePBR&&(e.mrrFactors=[m.metallicFactor,m.roughnessFactor,0],e.emissiveFactor=m.emissiveFactor??[0,0,0],e.metallicRoughnessTexture=this._getTexture(m.metalTex,t,s),e.emissionTexture=this._getTexture(m.emissiveTex,t,s),e.occlusionTexture=this._getTexture(m.occlusionTex,t,s),e.normalTexture=this._getTexture(m.normalTex,t,s)),e.objectOpacity=0,e.alphaDiscardMode=we.Mask;const r=[];e.baseColorTexture&&r.push(e.baseColorTexture.loadPromise),e.usePBR&&e.metallicRoughnessTexture&&r.push(e.metallicRoughnessTexture.loadPromise),e.usePBR&&e.emissionTexture&&r.push(e.emissionTexture.loadPromise),e.usePBR&&e.occlusionTexture&&r.push(e.occlusionTexture.loadPromise),e.usePBR&&e.normalTexture&&r.push(e.normalTexture.loadPromise);const n=Promise.all(r);i.push(n),n.then((()=>{e.alphaDiscardMode=te[m.alphaMode],e.objectOpacity=1,o.texMemoryUsage+=e.baseColorTexture?.glTexture?.usedMemory||0,e.usePBR&&(o.texMemoryUsage+=e.metallicRoughnessTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.emissionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.occlusionTexture?.glTexture?.usedMemory||0,o.texMemoryUsage+=e.normalTexture?.glTexture?.usedMemory||0)})),e.commonMaterialParameters.doubleSided=m.isDoubleSided,e.commonMaterialParameters.cullFace=m.faceCulling?re[m.faceCulling]:ye.Back,this._initialCullFace.set(N,e.commonMaterialParameters.cullFace),e.commonMaterialParameters.hasSlicePlane=this.slicePlaneEnabled,e.componentParameters.castShadows=he.All,e.textureAlphaCutoff=m.alphaCutoff??fe,e.alphaDiscardMode=te[m.alphaMode],e.isIntegratedMesh=!0,e.polygonOffsetEnabled=!1,e.hasOccludees=!1,e.ellipsoidMode=ge(this.view.spatialReference)})),o.components.push(N),o.vboMemoryUsage+=this._collection.getObjectGPUMemoryUsage(N)}if(await Promise.all(i),s.forEach((e=>{o.textures.push(e)})),!this._memCache)throw new Error("no memCache");return this._memCache.put(`${o.handle}`,o,o.totalMemory()),{memUsageBytes:o.totalMemory()}}freeRenderable(e){const t=this._lyrHandleToObjects.get(e);t&&(this.freeObject(t),this._lyrHandleToObjects.delete(e))}freeObject(e){this._memCache&&this._memCache.pop(`${e.handle}`),e.components.forEach((t=>{e.textures.forEach((e=>{this._stage.remove(e)})),this._collection.destroyObject(t),this._initialCullFace.delete(t)}))}setRenderableVisibility(e,t,r){if(this._memCache){for(let i=0;i<r;++i){const r=e[i],s=t[i];if(!s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.pop(`${r}`))}for(let i=0;i<r;++i){const r=e[i],s=t[i];if(s)continue;const o=this._lyrHandleToObjects.get(r);o&&(this._visibleGeometryChanged(),o.isVisible=s,o.components.forEach((e=>{this._collection.setObjectVisibility(e,s),this._elevationProvider.objectChanged(this._collection.getComponentObb(e))})),this._memCache.put(`${r}`,o,o.totalMemory()))}}}_getTexture(e,t,r){let i=null;if(e&&t.desc?.images&&t.data?.buffer){const s=t.desc.images[e?.imageId];if(i=r.get(s),!i&&s){const o=this._stage.renderView.renderingContext.parameters.maxMaxAnisotropy,n=o>1,a=ie[e.wrapMode??k.None];let l=s.alpha?4:3;const c=new Uint8Array(t.data.buffer,s.data.byteOffset,s.data.byteCount);let m=null,d=null,h=null;switch(s.format){case B.Raw:s.pixelFormat===G.R8?(m=c.buffer,l=1,d=""):s.pixelFormat===G.Rgb8?(m=c.buffer,l=3,d=""):s.pixelFormat===G.Rgba8&&(m=c.buffer,l=4,d="");break;case B.Dxt1:m=c.buffer,l=3,d=ve.DDS_ENCODING;break;case B.Dxt5:m=c.buffer,l=4,d=ve.DDS_ENCODING;break;case B.Png:d="image/png",h=document.createElement("img");break;case B.Jpeg:d="image/jpeg",h=document.createElement("img");break;case B.Etc2:d="image/ktx",h=document.createElement("img");break;case B.Astc:this._dbg(Pe.Error,"Astc texture not supported");break;case B.Pvrtc:this._dbg(Pe.Error,"Pvrtc texture not supported")}if(h&&d){const e=new Blob([c],{type:d});h.src=URL.createObjectURL(e),m=h}m&&null!=d&&(i=new xe(m,{mipmap:n,maxAnisotropy:o,encoding:d,wrap:a,components:l,noUnpackFlip:!0,width:s.mip0Width,height:s.mip0Height}),this._stage.add(i),r.set(s,i))}}return i?new ue(this.view._stage.renderView.textures,i.id):null}getBufferViews(e,t,r,i){let s,o,n,a,l,c,m,d=null;for(let u=0;u<e.atrbs.length;u++){const m=e.atrbs[u],p=m.view,f=void 0,g=p.byteOffset+p.byteCount,b=p.byteCount/se[p.type],y=[...Array(b).keys()].map((e=>e));try{switch(m.sem){case N.Position:3!==p.ncomp||p.type!==z.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Position ("+p+")"):(s=new U(t,p.byteOffset,f,g),o=new be(s.typedBuffer,y,3));break;case N.Normal:if(3!==p.ncomp||p.type!==z.F32)this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Normal ("+p+")");else if(i){const e=new U(t,p.byteOffset,f,g),i=_e(e.typedBuffer,r);l=new H(i),c=new be(l.typedBuffer,y,2)}break;case N.TexCoord:2!==p.ncomp||p.type!==z.F32?this._dbg(Pe.Error,"[Unsupported Feature] Unsupported view for Texcoord ("+p+")"):void 0===a&&(a=new be(new I(t,p.byteOffset,f,g).typedBuffer,y,2));break;case N.Color:4===p.ncomp?(p.type===z.F32&&(d=new M(t,p.byteOffset,f,g)),p.type===z.U8&&(d=new P(t,p.byteOffset,f,g)),p.type===z.U16&&(d=new O(t,p.byteOffset,f,g))):3===p.ncomp&&(p.type===z.F32&&(d=new U(t,p.byteOffset,f,g)),p.type===z.U8&&(d=new E(t,p.byteOffset,f,g)),p.type===z.U16&&(d=new V(t,p.byteOffset,f,g))),null==d?this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported view for Color ("+p+")"):n=new be(d.typedBuffer,y,p.ncomp);break;case N.FeatureIndex:break;default:this._dbg(Pe.VerboseAPI,"[Unsupported Feature] Unsupported semantic ("+m.sem+"). Skipping vertex attribute.")}}catch(h){this._dbg(Pe.VerboseAPI,"Error Creating buffer ("+h+"). Skipping vertex attribute.")}}if(e.index){const r=e.index.view,i=void 0,s=r.byteOffset+r.byteCount;switch(e.index.view.type){case z.U16:m=new R(t,r.byteOffset,i,s);break;case z.U32:m=new A(t,r.byteOffset,i,s);break;case z.U8:default:this._dbg(Pe.Error,"[Unsupported Feature] index type not supported ("+r.type+").")}}if(null==m&&null!=s){const e=s.count;if(e<65535){const t=new Uint16Array(e);m=new R(t)}else{const t=new Uint32Array(e);m=new A(t)}for(let t=0;t<e;t++)m.set(t,t)}return{positionView:s,positionAttr:o,colorAttr:n,texCoord0Attr:a,indicesView:m,normalsView:l,normalsAttr:c}}_onRemoveFromCache(e){const t=Y(this.view);t&&t.onRenderableEvicted(this,e.handle,e.totalMemory()),this.freeRenderable(e.handle)}_dbg(e,t){this._dbgFlags.has(e)&&(e===Pe.Error?r.getLogger(this).error(t):r.getLogger(this).warn(t))}};e([a()],Ee.prototype,"_visibleGeometryChangedSchedulerHandle",void 0),e([a()],Ee.prototype,"layer",void 0),e([a({readOnly:!0})],Ee.prototype,"visibleAtCurrentScale",null),e([a()],Ee.prototype,"elevationOffset",null),Ee=e([l("esri.views.3d.layers.IntegratedMesh3DTilesLayerView3D")],Ee);const Ve=Ee;export{Ve 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.31/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as P}from"./OverlayRenderer.js";import{PatchRenderData as v}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as E}from"./TileRenderer.js";import{TileUpdate as A}from"./TileUpdate.js";import{IteratorPreorder as C,sortTiles as N,compareTiles as j}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as F}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as q,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ne}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as oe}from"../../webgl/enums.js";const le=7,ce=10,de=m();let he=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new ae,this._passParameters=new L,this._drawParameters=new se,this._renderDataPool=new s(v),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new C,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()],[$.TRANSPARENT_TERRAIN,()=>this._produces()],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?P:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.updateTileTexture(e,A.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===A.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~A.GEOMETRY;e.resetPendingUpdate(A.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ce-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new E(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=ue,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,T=_&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,x=new J(!1,R),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;b(de,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(de));const w=de;if(fe[0]=i[0]-v[0],fe[1]=i[1]-v[1],fe[2]=i[2]-v[2],!K(w,fe,n,g,T))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),T=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(O.backfacesTerrain||u(d,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),O.isFiltered)return;O.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),O.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},E=pe;d(E,r,v);const{indices:A,indexCount:C}=P,N=P.vertexAttributes,j=N.getField(te.POSITION,y),B=new z(j.typedBuffer,3,N.stride/4),F=C/3;if(!p&&F>I){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(A,0,F,B)),e.intersectionData.intersectRay(fe,E,x,S)}else Z(fe,E,0,F,A,B,p,x,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,T)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&P))return null}else{const t=this.transparency===B.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===B.Empty)return null;switch(e.output){case F.Color:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(F.Color,e.bindParameters.slot===$.OCCLUDED_TERRAIN);case F.Shadow:case F.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Shadow,!1)):null;case F.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.ViewshedShadow,!1)):null;case F.Depth:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Depth,!1);case F.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Normal,!1);case F.ObjectAndLayerIdColor:return this._updateTechnique(F.ObjectAndLayerIdColor,!1);case F.Highlight:return this._overlayRenderer.hasHighlights&&0===e.bindParameters.highlightLevel?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case F.Color:{const i=e.bindParameters.slot===$.OCCLUDED_TERRAIN?x.Occluded:x.Color;this._renderMaterialPass(e,t,i);break}case F.Depth:case F.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case F.Highlight:0===e.bindParameters.highlightLevel&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break;case F.Shadow:case F.ShadowExcludeHighlight:case F.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case F.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==w.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>j(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],oe.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===x.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",g));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;t.program.bindDraw(new se(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ne,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],he.prototype,"_isGlobal",null),e([o()],he.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],he.prototype,"renderingDisabled",null),e([o({value:!0})],he.prototype,"visible",null),e([o()],he.prototype,"renderPatchBorders",null),e([o()],he.prototype,"visualizeNormals",null),e([o()],he.prototype,"cullBackFaces",null),e([o({value:w.FRONT_TO_BACK})],he.prototype,"renderOrder",null),e([o()],he.prototype,"wireframe",null),he=e([l("esri.views.3d.terrain.TerrainRenderer")],he);const ue=p(),_e=p(),fe=p(),pe=p();export{he as TerrainRenderer};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import has from"../../../core/has.js";import{disposeMaybe as i}from"../../../core/maybe.js";import{MemCachePool as r}from"../../../core/MemCachePool.js";import s from"../../../core/ObjectPool.js";import{watch as n,sync as a}from"../../../core/reactiveUtils.js";import{property as o}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/Logger.js";import"../../../core/RandomLCG.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{IDENTITY as c}from"../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{f as d,s as h,m as u}from"../../../chunks/vec32.js";import{ZEROS as _,fromValues as f,create as p}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{ZEROS as g}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as m,set as b}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as T}from"../../ViewingMode.js";import{TextureUpdate as O}from"./interfaces.js";import{LayerClass as R}from"./LayerClass.js";import{OverlayContent as x}from"./OverlayContent.js";import{overlayRenderOccludedFlag as P}from"./OverlayRenderer.js";import{PatchRenderData as v}from"./PatchRenderData.js";import{RenderOrder as w}from"./RenderOrder.js";import{TerrainAttributesCache as D}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as S}from"./terrainUtils.js";import{TileRenderer as A}from"./TileRenderer.js";import{TileUpdate as E}from"./TileUpdate.js";import{IteratorPreorder as C,sortTiles as N,compareTiles as j}from"./tileUtils.js";import{TransparencyMode as B}from"./TransparencyMode.js";import{componentMinimalSizeForIntersectionData as I,ComponentIntersectionData as U}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as F}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{T as L}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as G}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{SyncPrepareRenderPlugin as q,ConsumesDepth as M,ConsumesNone as k}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as z}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as V}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as H}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as Y}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as Q,StoreResults as W}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as X}from"../webgl-engine/lib/Material.js";import{intersectAabbInvDirBefore as K,intersectTriangles as Z,MeshIntersectionOptions as J}from"../webgl-engine/lib/RayIntersections.js";import{RenderSlot as $}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as ee}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as te}from"../webgl-engine/lib/VertexAttribute.js";import{terrainId as ie,getVerticalOffsetTerrain as re}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as se}from"../webgl-engine/materials/DrawParameters.js";import{TerrainTechnique as ne}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ae}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as oe}from"../../webgl/enums.js";const le=7,ce=10,de=m();let he=class extends q{get _isGlobal(){return this._stage.viewingMode===T.Global}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}constructor(e,t,i,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=i,this._ellipsoidRadius=n,this.type=Q.TERRAIN,this.isGround=!0,this._tileSize=256,this._configuration=new ae,this._passParameters=new L,this._drawParameters=new se,this._renderDataPool=new s(v),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new C,this._castShadows=!1,this._inViewshed=!1,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.renderOccludedFlags=X.Occlude,this.produces=new Map([[$.OPAQUE_TERRAIN,()=>this._produces()],[$.TRANSPARENT_TERRAIN,()=>this._produces()],[$.OCCLUDED_TERRAIN,()=>this._produces()]]),this._tileTextureCache=new r(((e,t)=>a.newCache(e,t)),"TileTexture"),this.tileGeometryCache=new D(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(n((()=>this._overlayRenderer.rendersOccludedDraped),(e=>{this.renderOccludedFlags=e?P:X.Occlude,this.setNeedsRender()}),a))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy()}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}consumes(){return this._overlayRenderer.hasWater?M:k}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return!!this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._configuration.visualizeNormals}set visualizeNormals(e){this._configuration.visualizeNormals!==e&&(this._configuration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._configuration.backfaceCullingEnabled}set cullBackFaces(e){this._configuration.backfaceCullingEnabled!==e&&(this._configuration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return ie}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._configuration.screenSizePerspective!==e&&(this._configuration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.updateTileTexture(e,E.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===E.TEXTURE_FADING?O.FADING:O.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[R.ELEVATION])i.pendingUpdates&=~E.GEOMETRY;e.resetPendingUpdate(E.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=ce-le,i=Math.max(0,Math.floor((e.level-t)/le)*le);if(this._isGlobal&&0===i)return _;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=V.UPDATE){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=V.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=V.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new A(this._rctx,this._tileSize,this._techniques,this._tileTextureCache),this.updateTileBackground(),this._emptyTex=H(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==B.Opaque)return;const s=ue,n=_e;d(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,o=e.results.max,l=e.results.ground,_=e.options.store===W.MIN,f=!!e.results.ground.target,p=re(e.verticalOffset),g=e.tolerance;let m,T=_&&null!=a.dist?a.dist:1/0;const O=e.options,R=O.normalRequired||!O.backfacesTerrain,x=new J(!1,R),P=h=>{const f=h.renderData;if(!f?.vao)return;const P=f.geometry;b(de,P.boundingBox);const v=f.localOrigin;null!=p&&(p.localOrigin=v,p.applyToAabb(de));const w=de;if(fe[0]=i[0]-v[0],fe[1]=i[1]-v[1],fe[2]=i[2]-v[2],!K(w,fe,n,g,T))return;const D=(e,t,i)=>{e.set(this.type,h,t,i,c),T=_&&null!=a.dist?a.dist:1/0},S=(n,c,d)=>{if((!R||null!=d)&&n>=0&&(O.backfacesTerrain||u(d,s)<0)&&(O.invisibleTerrain||!O.selectionMode||null==t||t(i,r,n))){if((null==l.dist||n<l.dist)&&D(l,n,d),O.isFiltered)return;O.store===W.ALL&&(null==m?(m=Y(e.ray),D(m,n,d),e.results.all.push(m)):n<m.dist&&D(m,n,d)),(null==a.dist||n<a.dist)&&D(a,n,d),O.store!==W.MIN&&(null==o.dist||n>o.dist)&&D(o,n,d)}},A=pe;d(A,r,v);const{indices:E,indexCount:C}=P,N=P.vertexAttributes,j=N.getField(te.POSITION,y),B=new z(j.typedBuffer,3,N.stride/4),F=C/3;if(!p&&F>I){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new U(E,0,F,B)),e.intersectionData.intersectRay(fe,A,x,S)}else Z(fe,A,0,F,E,B,p,x,S)},v=this._rootTiles;if(null!=v){(()=>{const t=this._tileIterator;t.reset(v);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==p&&!e.intersectsRay(i,s,g,T)||f&&this._useStencilForTile(e)?t.skipSubtree():P(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){const t=has("enable-feature:terrain-shadows")&&e.bindParameters.shadowMap.enabled;t!==this._castShadows&&(this._castShadows=t,this._patchesByOriginDirty=!0);const i=e.bindParameters.viewshedEnabled;if(this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),e.bindParameters.slot===$.OCCLUDED_TERRAIN){if(!(e.renderOccludedMask&P))return null}else{const t=this.transparency===B.Opaque?$.OPAQUE_TERRAIN:$.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}if(this.transparency===B.Invisible)return null;switch(e.output){case F.Color:return this._configuration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._configuration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._configuration.receiveShadows=e.bindParameters.shadowMap.ready,this._configuration.receiveAmbientOcclusion=null!=e.bindParameters.ssao,this._configuration.overlayMode=this._overlayRenderer.mode,this._updateTechnique(F.Color,e.bindParameters.slot===$.OCCLUDED_TERRAIN);case F.Shadow:case F.ShadowExcludeHighlight:return this._castShadows?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Shadow,!1)):null;case F.ViewshedShadow:return this._inViewshed?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.ViewshedShadow,!1)):null;case F.Depth:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Depth,!1);case F.Normal:return this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Normal,!1);case F.ObjectAndLayerIdColor:return this._updateTechnique(F.ObjectAndLayerIdColor,!1);case F.Highlight:return this._overlayRenderer.hasHighlights&&0===e.bindParameters.highlightLevel?(this._configuration.receiveShadows=this._configuration.receiveAmbientOcclusion=!1,this._updateTechnique(F.Highlight,!1)):null}return null}renderNode(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case F.Color:{const i=e.bindParameters.slot===$.OCCLUDED_TERRAIN?x.Occluded:x.Color;this._renderMaterialPass(e,t,i);break}case F.Depth:case F.Normal:this._renderAuxiliaryPass(e,t,x.Color,this._visiblePatchesByOrigin);break;case F.Highlight:0===e.bindParameters.highlightLevel&&this._renderAuxiliaryPass(e,t,x.Highlight,this._visiblePatchesByOrigin);break;case F.Shadow:case F.ShadowExcludeHighlight:case F.ViewshedShadow:this._renderAuxiliaryPass(e,t,null,this._allPatchesByOrigin);break;case F.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,x.ObjectAndLayerIdColor,this._visiblePatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r;if(null!=e){const i=t.toUnitRGBA(e);r=f(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,O.FADING))),this._configuration.tileBlendInput=i.backgroundIsGrid?G.GridComposite:null!=i.backgroundColor?G.ColorComposite:G.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==w.NONE){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)N(this.renderOrder,i,t);e.sort(((e,t)=>j(e[0],t[0],this.renderOrder))),this._visiblePatchesByOrigin=new Map(e.map((e=>[e[0].renderData.localOrigin,e]))),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i,r){const s=e.rctx;this._passParameters.overlayContent=i,s.bindTechnique(t,e.bindParameters,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;r.forEach((r=>{this._drawParameters.origin=r[0].renderData.localOrigin,t.program.bindDraw(this._drawParameters,e.bindParameters,this._passParameters);for(let s=0;s<r.length;s++)this._renderPatch(e,t,r[s],oe.TRIANGLES,n,i)})),e.rctx.bindVAO(null)}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlayContent=i,r.bindTechnique(t,e.bindParameters,this._passParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const s=e.bindParameters.camera,n=t.program;if(this._configuration.screenSizePerspective&&this.pointsOfInterest){const e=ee(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:s.fovY})}const a=this._stencilEnabledLayerExtents.length>0,o=i===x.Occluded;o&&(n.bindTexture("tex",this._emptyTex),n.setUniform3fv("textureOpacities",_),n.setUniform4fv("texOffsetAndScale",g));const l=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:_;this._configuration.tileBlendInput===G.ColorComposite&&n.setUniform3fv("backgroundColor",l);const c=this.wireframe?oe.LINES:oe.TRIANGLES;this._configuration.textureFadingEnabled&&n.bindTexture("texNext",this._emptyTex);const d=this._visiblePatchesByOrigin;for(const h of d.values()){const r=h[0].renderData.localOrigin;t.program.bindDraw(new se(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const s of h){const r=s.renderData,l=r.textureReference;if(null!=l){if(!o){n.setUniform4fv("texOffsetAndScale",l.offsetAndScale),n.bindTexture("tex",l.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._configuration.textureFadingEnabled&&null!=t&&e<1?(n.setUniform1f("fadeFactor",e),n.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),n.setUniform3fv("nextTexOpacities",t.opacities),n.bindTexture("texNext",t.texture.texture)):n.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),n.setUniform3fv("textureOpacities",l.opacities)}this._renderPatch(e,t,s,c,a,i),s.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const a=i.renderData,o=a.vao,l=o?.indexBuffer;if(!o||null==l)return void(S&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;null==n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay),s&&(t.useStencil=this._useStencilForTile(i),e.rctx.setPipelineState(t.getPipeline()));const d=a.geometry.indexCount;e.rctx.bindVAO(o),c.assertCompatibleVertexAttributeLocations(o),e.rctx.drawElements(r,d,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._configuration.output=e,this._configuration.renderOccluded=t,this._shaderTechnique=this._techniques.releaseAndAcquire(ne,this._configuration,this._shaderTechnique),this._shaderTechnique}get test(){}};e([o({readOnly:!0})],he.prototype,"_isGlobal",null),e([o()],he.prototype,"renderOccludedFlags",void 0),e([o({value:!1})],he.prototype,"renderingDisabled",null),e([o({value:!0})],he.prototype,"visible",null),e([o()],he.prototype,"renderPatchBorders",null),e([o()],he.prototype,"visualizeNormals",null),e([o()],he.prototype,"cullBackFaces",null),e([o({value:w.FRONT_TO_BACK})],he.prototype,"renderOrder",null),e([o()],he.prototype,"wireframe",null),he=e([l("esri.views.3d.terrain.TerrainRenderer")],he);const ue=p(),_e=p(),fe=p(),pe=p();export{he as TerrainRenderer};
|