@arcgis/core 4.28.0-next.20230712 → 4.28.0-next.20230713
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/08ee2bd914867fd2cbd5.js +1 -0
- package/assets/esri/core/workers/chunks/{4f92fd5167e22c602e8a.js → 169b04f05f5c875c5083.js} +1 -1
- package/assets/esri/core/workers/chunks/55109f141c9f120833f6.js +1 -0
- package/assets/esri/core/workers/chunks/8c5a8c1dfb086069bb06.js +1 -0
- package/assets/esri/core/workers/chunks/{f156387d6c645b18a8dd.js → b2a0e3e1dfccda7ed12e.js} +1 -1
- package/assets/esri/core/workers/chunks/d4881b238c8a93390cde.js +1 -0
- package/assets/esri/core/workers/chunks/dcb004dfba27335c7c3c.js +1 -0
- package/assets/esri/core/workers/chunks/{ad38aede3ec854191511.js → f6e24113643784bc6731.js} +1 -1
- package/assets/esri/core/workers/chunks/{3a0e2535f6cdb2e65667.js → fb610982b1366cdbc0c3.js} +1 -1
- package/assets/esri/core/workers/chunks/{5583921a498172edd5ac.js → fcab431f13b4a9f92dbf.js} +1 -1
- package/core/Collection.js +1 -1
- package/core/accessorSupport/ensureType.js +1 -1
- package/core/accessorSupport/set.js +1 -1
- package/layers/VoxelWasmPerSceneView.js +1 -1
- package/layers/support/rasterDatasets/ImageServerRaster.js +1 -1
- package/layers/support/rasterDatasets/multipartParser.js +1 -1
- package/layers/support/wmtsUtils.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/3d/environment/EnvironmentRenderer.js +1 -1
- package/views/3d/externalRenderers/ExternalRendererStore.js +1 -1
- package/views/3d/layers/i3s/PointRenderer.js +1 -1
- package/views/3d/support/LaserLineRenderer.js +1 -1
- package/views/3d/support/engineContent/line.js +1 -1
- package/views/3d/terrain/PatchRenderData.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/terrain/TileRenderer.js +1 -1
- package/views/3d/webgl-engine/core/renderPasses/RenderPassManager.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/LineStipple.glsl.js +17 -21
- package/views/3d/webgl-engine/lib/GLMaterialRepository.js +1 -1
- package/views/3d/webgl-engine/lib/GLMaterials.js +1 -1
- package/views/3d/webgl-engine/lib/RenderPluginManager.js +1 -1
- package/views/3d/webgl-engine/lib/Renderer.js +1 -1
- package/views/3d/webgl-engine/lib/SmaaRenderPass.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/CheckerBoardMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/DefaultMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HUDMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/HeatmapDensityMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ImageMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineCalloutMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/LineMarkerMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/MeasurementArrowMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/NativeLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/PatternMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/RibbonLineMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/ShadedColorMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/SlicePlaneMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/WaterMaterial.js +1 -1
- package/views/3d/webgl-engine/materials/renderers/MergedRenderer.js +1 -1
- package/views/3d/webgl-engine/materials/stippleTextureRepository.js +1 -1
- package/widgets/ElevationProfile/support/ProfileGenerationError.js +1 -1
- package/widgets/ElevationProfile/support/chartUtils.js +1 -1
- package/assets/esri/core/workers/chunks/00b023cb63f23bc074b8.js +0 -1
- package/assets/esri/core/workers/chunks/1e413a44b35bfecbfa59.js +0 -1
- package/assets/esri/core/workers/chunks/71c029f95cb4666ae207.js +0 -1
- package/assets/esri/core/workers/chunks/c9ef45225947ccc2bd4c.js +0 -1
- package/assets/esri/core/workers/chunks/dda6fab95d50c1215808.js +0 -1
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const t=5e4;function n(t){const n=r(t);return n?{isMultipart:!0,data:n.boundary?e(t.data,n,0):null}:{isMultipart:!1,data:null}}function e(n,e,r=0){const a="--"+e.boundary,i=[];for(let t=0;t<a.length;t++)i.push(a.charCodeAt(t));const s=[],c="\n--"+e.boundary+"--";for(let t=0;t<c.length;t++)s.push(c.charCodeAt(t));const l=[10],f=[13,10],u=[],h=i.length,g=new Uint8Array(n,r),p=Math.min(t,g.length-h);let d=0,y=0;for(let t=0;t<p;t++){for(y=0;y<h&&g[t+y]===i[y];y++);y===h&&(d&&u.push(o(g.subarray(d,t),e)),t+=h-1,g[t+1]===l[0]?t+=1:g[t+1]===f[0]&&g[t+2]===f[1]&&(t+=2),d=t+1)}const b=s.length;for(let t=g.length-b-10;t<g.length-b;t++){for(y=0;y<b&&g[t+y]===s[y];y++);if(y===b){u.push(o(g.subarray(d,t),e));break}}return u}function r(t){const n=t.getHeader?.("Content-Type")?.split(";");if(!(n?.[0].trim()??"").startsWith("multipart/"))return null;const e={boundary:"",start:"",type:""};for(let r=1;r<n.length;r++){const t=n[r].indexOf("=");if(t>0){const o=n[r].slice(0,t).trim(),a=n[r].slice(t+1).trim();e[o]=a.startsWith('"')?a.slice(1
|
|
5
|
+
const t=5e4;function n(t){const n=r(t);return n?{isMultipart:!0,data:n.boundary?e(t.data,n,0):null}:{isMultipart:!1,data:null}}function e(n,e,r=0){const a="--"+e.boundary,i=[];for(let t=0;t<a.length;t++)i.push(a.charCodeAt(t));const s=[],c="\n--"+e.boundary+"--";for(let t=0;t<c.length;t++)s.push(c.charCodeAt(t));const l=[10],f=[13,10],u=[],h=i.length,g=new Uint8Array(n,r),p=Math.min(t,g.length-h);let d=0,y=0;for(let t=0;t<p;t++){for(y=0;y<h&&g[t+y]===i[y];y++);y===h&&(d&&u.push(o(g.subarray(d,t),e)),t+=h-1,g[t+1]===l[0]?t+=1:g[t+1]===f[0]&&g[t+2]===f[1]&&(t+=2),d=t+1)}const b=s.length;for(let t=g.length-b-10;t<g.length-b;t++){for(y=0;y<b&&g[t+y]===s[y];y++);if(y===b){u.push(o(g.subarray(d,t),e));break}}return u}function r(t){const n=t.getHeader?.("Content-Type")?.split(";");if(!(n?.[0].trim()??"").startsWith("multipart/"))return null;const e={boundary:"",start:"",type:""};for(let r=1;r<n.length;r++){const t=n[r].indexOf("=");if(t>0){const o=n[r].slice(0,t).trim(),a=n[r].slice(t+1).trim();e[o]=a.startsWith('"')?a.slice(1,-1):a}}return e}function o(t,n){const e=String.fromCharCode.apply(null,t.subarray(0,Math.min(300,t.length))).split("\n"),r=Math.min(e.length,7),o={contentDisposition:"inline"};let a=0;for(let i=0;i<r;i++)if(e[i].length<4)a=a+e[i].length+1;else if("content"===e[i].slice(0,7).toLowerCase()){if(a=a+e[i].length+1,!e[i].includes(":"))continue;const t=e[i].substring(0,e[i].indexOf(":")).trim(),n=e[i].substring(e[i].indexOf(":")+1).trim();switch(t.toLowerCase()){case"content-type":o.contentType=n;break;case"content-description":o.contentDescription=n;break;case"content-transfer-encoding":o.contentTransferEncoding=n;break;case"content-id":o.contentID=n;break;case"content-disposition":o.contentDisposition=n;break;case"content-location":o.contentLocation=n}}else{if(o.contentDisposition.toLowerCase().includes("inline")&&e[i].length>=4&&o.contentType?.toLowerCase().indexOf("image")>-1){let n=!0,e=t.subarray(a,t.length);if(o.contentType.toLowerCase().indexOf("tif")>0){if("base64"===o.contentTransferEncoding){let t="";const n=e;for(let e=0;e<n.length;e+=65535){const r=n.subarray(e,e+65535>n.length-1?n.length-1:e+65535);t+=String.fromCharCode.apply(null,r)}const r=atob(t);e=new Uint8Array(r.length);for(let o=0;o<e.length;o++)e[o]=r.charCodeAt(o)}n=73===e[0]&&73===e[1]||77===e[0]&&77===e[1]}if(n){let n=e.buffer;"base64"!==o.contentTransferEncoding&&(n=new ArrayBuffer(t.length-a),e=new Uint8Array(n),e.set(t.subarray(a,t.length))),o.contentData=n}break}if((""===n.start||o.contentID===n.start)&&o.contentType){if(o.contentType.includes("text")||o.contentType.includes("xml")){o.contentData=String.fromCharCode.apply(null,t.subarray(a,t.length));break}o.contentData=t.subarray(a,t.length)}}return o}export{n as parse};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{getReferenceEllipsoidFromWKID as n}from"../../geometry/ellipsoidUtils.js";import i from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import l from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as o}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./LOD.js";import c from"./TileInfo.js";const u=90.71428571428571;function p(e){const n=e.replaceAll(/ows:/gi,"");if(!g("Contents",(new DOMParser).parseFromString(n,"text/xml").documentElement))throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function f(e,n){e=e.replaceAll(/ows:/gi,"");const i=(new DOMParser).parseFromString(e,"text/xml").documentElement,r=new Map,l=new Map,o=g("Contents",i);if(!o)throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=g("OperationsMetadata",i),a=s?.querySelector("[name='GetTile']"),c=a?.getElementsByTagName("Get"),u=c&&Array.prototype.slice.call(c),p=n.url?.indexOf("https"),f=void 0!==p&&p>-1;let d,m,h=n.serviceMode,T=n?.url;if(u&&u.length&&u.some((e=>{const t=g("Constraint",e);return!t||C("AllowedValues","Value",h,t)?(T=e.attributes[0].nodeValue,!0):(!t||C("AllowedValues","Value","RESTful",t)||C("AllowedValues","Value","REST",t)?m=e.attributes[0].nodeValue:t&&!C("AllowedValues","Value","KVP",t)||(d=e.attributes[0].nodeValue),!1)})),!T)if(m)T=m,h="RESTful";else if(d)T=d,h="KVP";else{const e=g("ServiceMetadataURL",i);T=e?.getAttribute("xlink:href")}const y=T.indexOf("1.0.0/");-1===y&&"RESTful"===h?T+="/":y>-1&&(T=T.substring(0,y)),"KVP"===h&&(T+=y>-1?"":"?"),f&&(T=T.replace(/^http:/i,"https:"));const R=w("ServiceIdentification>ServiceTypeVersion",i),S=w("ServiceIdentification>AccessConstraints",i),A=S&&/^none$/i.test(S)?null:S,V=x("Layer",o),b=x("TileMatrixSet",o),E=V.map((e=>{const t=w("Identifier",e);return r.set(t,e),M(t,e,b,f,R)}));return{copyright:A,dimensionMap:l,layerMap:r,layers:E,serviceMode:h,tileUrl:T}}function d(e){return e.layers.forEach((e=>{e.tileMatrixSets?.forEach((e=>{const t=e.tileInfo;t&&96!==t.dpi&&(t.lods?.forEach((n=>{n.scale=96*n.scale/t.dpi,n.resolution=j(t.spatialReference?.wkid,n.scale*u/96,e.id)})),t.dpi=96)}))})),e}function m(e){return e.nodeType===Node.ELEMENT_NODE}function g(e,t){for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];if(m(i)&&i.nodeName===e)return i}return null}function x(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];m(r)&&r.nodeName===e&&n.push(r)}return n}function h(t,n){const i=[];for(let e=0;e<n.childNodes.length;e++){const r=n.childNodes[e];m(r)&&r.nodeName===t&&i.push(r)}return i.map((e=>e.textContent)).filter(e)}function w(e,t){return e.split(">").forEach((e=>{t&&(t=g(e,t))})),t&&t.textContent}function C(e,t,n,i){let r;return Array.prototype.slice.call(i.childNodes).some((i=>{if(i.nodeName.includes(e)){const e=g(t,i),l=e&&e.textContent;if(l===n||n.split(":")&&n.split(":")[1]===l)return r=i,!0}return!1})),r}function M(e,t,n,i,r){const l=w("Abstract",t),o=h("Format",t);return{id:e,fullExtent:A(t),fullExtents:V(t),description:l,formats:o,styles:b(t,i),title:w("Title",t),tileMatrixSets:E(r,t,n)}}function T(e,t){const n=[],i=e.layerMap?.get(t);if(!i)return null;const r=x("ResourceURL",i),l=x("Dimension",i);let o,s,a,c;return l.length&&(o=w("Identifier",l[0]),s=h("Default",l[0])||h("Value",l[0])),l.length>1&&(a=w("Identifier",l[1]),c=h("Default",l[1])||h("Value",l[1])),e.dimensionMap.set(t,{dimensions:s,dimensions2:c}),r.forEach((e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(o&&s.length)if(t.includes("{"+o+"}"))t=t.replace("{"+o+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+o.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue}"+t.substring(e+o.length+2))}if(a&&c.length)if(t.includes("{"+a+"}"))t=t.replace("{"+a+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+a.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue2}"+t.substring(e+a.length+2))}n.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}})),n}function y(e,t,n,i,r,l,o,s){const a=R(e,t,i);if(!(a?.length>0))return"";const{dimensionMap:c}=e,u=c.get(t).dimensions?.[0],p=c.get(t).dimensions2?.[0];return a[o%a.length].template.replaceAll(/\{Style\}/gi,r??"").replaceAll(/\{TileMatrixSet\}/gi,n??"").replaceAll(/\{TileMatrix\}/gi,l).replaceAll(/\{TileRow\}/gi,""+o).replaceAll(/\{TileCol\}/gi,""+s).replaceAll(/\{dimensionValue\}/gi,u).replaceAll(/\{dimensionValue2\}/gi,p)}function R(e,t,n){const i=T(e,t),r=i?.filter((e=>e.format===n));return(r?.length?r:i)??[]}function S(e,t,n,i){const{dimensionMap:r}=e,l=T(e,t);let o="";if(l&&l.length>0){const e=r.get(t).dimensions&&r.get(t).dimensions[0],s=r.get(t).dimensions2&&r.get(t).dimensions2[0];o=l[0].template,o.indexOf(".xxx")===o.length-4&&(o=o.slice(0
|
|
5
|
+
import{isSome as e}from"../../core/arrayUtils.js";import t from"../../core/Error.js";import{getReferenceEllipsoidFromWKID as n}from"../../geometry/ellipsoidUtils.js";import i from"../../geometry/Extent.js";import r from"../../geometry/Point.js";import l from"../../geometry/support/WKIDUnitConversion.js";import{isAxesOrderReversedForWkid as o}from"../ogc/crsUtils.js";import{visitXML as s}from"../ogc/xmlUtils.js";import a from"./LOD.js";import c from"./TileInfo.js";const u=90.71428571428571;function p(e){const n=e.replaceAll(/ows:/gi,"");if(!g("Contents",(new DOMParser).parseFromString(n,"text/xml").documentElement))throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid","the wmts get capabilities response is not compliant",{text:e})}function f(e,n){e=e.replaceAll(/ows:/gi,"");const i=(new DOMParser).parseFromString(e,"text/xml").documentElement,r=new Map,l=new Map,o=g("Contents",i);if(!o)throw new t("wmtslayer:wmts-capabilities-xml-is-not-valid");const s=g("OperationsMetadata",i),a=s?.querySelector("[name='GetTile']"),c=a?.getElementsByTagName("Get"),u=c&&Array.prototype.slice.call(c),p=n.url?.indexOf("https"),f=void 0!==p&&p>-1;let d,m,h=n.serviceMode,T=n?.url;if(u&&u.length&&u.some((e=>{const t=g("Constraint",e);return!t||C("AllowedValues","Value",h,t)?(T=e.attributes[0].nodeValue,!0):(!t||C("AllowedValues","Value","RESTful",t)||C("AllowedValues","Value","REST",t)?m=e.attributes[0].nodeValue:t&&!C("AllowedValues","Value","KVP",t)||(d=e.attributes[0].nodeValue),!1)})),!T)if(m)T=m,h="RESTful";else if(d)T=d,h="KVP";else{const e=g("ServiceMetadataURL",i);T=e?.getAttribute("xlink:href")}const y=T.indexOf("1.0.0/");-1===y&&"RESTful"===h?T+="/":y>-1&&(T=T.substring(0,y)),"KVP"===h&&(T+=y>-1?"":"?"),f&&(T=T.replace(/^http:/i,"https:"));const R=w("ServiceIdentification>ServiceTypeVersion",i),S=w("ServiceIdentification>AccessConstraints",i),A=S&&/^none$/i.test(S)?null:S,V=x("Layer",o),b=x("TileMatrixSet",o),E=V.map((e=>{const t=w("Identifier",e);return r.set(t,e),M(t,e,b,f,R)}));return{copyright:A,dimensionMap:l,layerMap:r,layers:E,serviceMode:h,tileUrl:T}}function d(e){return e.layers.forEach((e=>{e.tileMatrixSets?.forEach((e=>{const t=e.tileInfo;t&&96!==t.dpi&&(t.lods?.forEach((n=>{n.scale=96*n.scale/t.dpi,n.resolution=j(t.spatialReference?.wkid,n.scale*u/96,e.id)})),t.dpi=96)}))})),e}function m(e){return e.nodeType===Node.ELEMENT_NODE}function g(e,t){for(let n=0;n<t.childNodes.length;n++){const i=t.childNodes[n];if(m(i)&&i.nodeName===e)return i}return null}function x(e,t){const n=[];for(let i=0;i<t.childNodes.length;i++){const r=t.childNodes[i];m(r)&&r.nodeName===e&&n.push(r)}return n}function h(t,n){const i=[];for(let e=0;e<n.childNodes.length;e++){const r=n.childNodes[e];m(r)&&r.nodeName===t&&i.push(r)}return i.map((e=>e.textContent)).filter(e)}function w(e,t){return e.split(">").forEach((e=>{t&&(t=g(e,t))})),t&&t.textContent}function C(e,t,n,i){let r;return Array.prototype.slice.call(i.childNodes).some((i=>{if(i.nodeName.includes(e)){const e=g(t,i),l=e&&e.textContent;if(l===n||n.split(":")&&n.split(":")[1]===l)return r=i,!0}return!1})),r}function M(e,t,n,i,r){const l=w("Abstract",t),o=h("Format",t);return{id:e,fullExtent:A(t),fullExtents:V(t),description:l,formats:o,styles:b(t,i),title:w("Title",t),tileMatrixSets:E(r,t,n)}}function T(e,t){const n=[],i=e.layerMap?.get(t);if(!i)return null;const r=x("ResourceURL",i),l=x("Dimension",i);let o,s,a,c;return l.length&&(o=w("Identifier",l[0]),s=h("Default",l[0])||h("Value",l[0])),l.length>1&&(a=w("Identifier",l[1]),c=h("Default",l[1])||h("Value",l[1])),e.dimensionMap.set(t,{dimensions:s,dimensions2:c}),r.forEach((e=>{let t=e.getAttribute("template");if("tile"===e.getAttribute("resourceType")){if(o&&s.length)if(t.includes("{"+o+"}"))t=t.replace("{"+o+"}","{dimensionValue}");else{const e=t.toLowerCase().indexOf("{"+o.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue}"+t.substring(e+o.length+2))}if(a&&c.length)if(t.includes("{"+a+"}"))t=t.replace("{"+a+"}","{dimensionValue2}");else{const e=t.toLowerCase().indexOf("{"+a.toLowerCase()+"}");e>-1&&(t=t.substring(0,e)+"{dimensionValue2}"+t.substring(e+a.length+2))}n.push({template:t,format:e.getAttribute("format"),resourceType:"tile"})}})),n}function y(e,t,n,i,r,l,o,s){const a=R(e,t,i);if(!(a?.length>0))return"";const{dimensionMap:c}=e,u=c.get(t).dimensions?.[0],p=c.get(t).dimensions2?.[0];return a[o%a.length].template.replaceAll(/\{Style\}/gi,r??"").replaceAll(/\{TileMatrixSet\}/gi,n??"").replaceAll(/\{TileMatrix\}/gi,l).replaceAll(/\{TileRow\}/gi,""+o).replaceAll(/\{TileCol\}/gi,""+s).replaceAll(/\{dimensionValue\}/gi,u).replaceAll(/\{dimensionValue2\}/gi,p)}function R(e,t,n){const i=T(e,t),r=i?.filter((e=>e.format===n));return(r?.length?r:i)??[]}function S(e,t,n,i){const{dimensionMap:r}=e,l=T(e,t);let o="";if(l&&l.length>0){const e=r.get(t).dimensions&&r.get(t).dimensions[0],s=r.get(t).dimensions2&&r.get(t).dimensions2[0];o=l[0].template,o.indexOf(".xxx")===o.length-4&&(o=o.slice(0,-4)),o=o.replaceAll(/\{Style\}/gi,i),o=o.replaceAll(/\{TileMatrixSet\}/gi,n),o=o.replaceAll(/\{TileMatrix\}/gi,"{level}"),o=o.replaceAll(/\{TileRow\}/gi,"{row}"),o=o.replaceAll(/\{TileCol\}/gi,"{col}"),o=o.replaceAll(/\{dimensionValue\}/gi,e),o=o.replaceAll(/\{dimensionValue2\}/gi,s)}return o}function A(e){const t=g("WGS84BoundingBox",e),n=t?w("LowerCorner",t).split(" "):["-180","-90"],i=t?w("UpperCorner",t).split(" "):["180","90"];return{xmin:parseFloat(n[0]),ymin:parseFloat(n[1]),xmax:parseFloat(i[0]),ymax:parseFloat(i[1]),spatialReference:{wkid:4326}}}function V(e){const t=[];return s(e,{BoundingBox:e=>{if(!e.getAttribute("crs"))return;const n=e.getAttribute("crs").toLowerCase(),i=I(n),r=n.includes("epsg")&&o(i.wkid);let l,a,c,u;s(e,{LowerCorner:e=>{[l,a]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([l,a]=[a,l])},UpperCorner:e=>{[c,u]=e.textContent.split(" ").map((e=>Number.parseFloat(e))),r&&([c,u]=[u,c])}}),t.push({xmin:l,ymin:a,xmax:c,ymax:u,spatialReference:i})}}),t}function b(e,t){return x("Style",e).map((e=>{const n=g("LegendURL",e),i=g("Keywords",e),r=i?h("Keyword",i):[];let l=n&&n.getAttribute("xlink:href");t&&(l=l&&l.replace(/^http:/i,"https:"));return{abstract:w("Abstract",e),id:w("Identifier",e),isDefault:"true"===e.getAttribute("isDefault"),keywords:r,legendUrl:l,title:w("Title",e)}}))}function E(e,t,n){return x("TileMatrixSetLink",t).map((t=>L(e,t,n)))}function L(e,t,n){const i=g("TileMatrixSet",t).textContent,r=h("TileMatrix",t),l=n.find((e=>{const t=g("Identifier",e),n=t&&t.textContent;return!!(n===i||i.split(":")&&i.split(":")[1]===n)})),o=g("TileMatrixSetLimits",t),s=o&&x("TileMatrixLimits",o),a=new Map;if(s?.length)for(const c of s){const e=g("TileMatrix",c).textContent,t=+g("MinTileRow",c).textContent,n=+g("MaxTileRow",c).textContent,i=+g("MinTileCol",c).textContent,r=+g("MaxTileCol",c).textContent;a.set(e,{minCol:i,maxCol:r,minRow:t,maxRow:n})}const u=w("SupportedCRS",l).toLowerCase(),p=N(l,u),f=p.spatialReference,d=g("TileMatrix",l),m=[parseInt(w("TileWidth",d),10),parseInt(w("TileHeight",d),10)],M=[];if(r.length)r.forEach(((e,t)=>{const n=C("TileMatrix","Identifier",e,l);M.push(k(n,u,t,i,a))}));else{x("TileMatrix",l).forEach(((e,t)=>{M.push(k(e,u,t,i,a))}))}const T=F(e,l,p,m,M[0]).toJSON(),y=new c({dpi:96,spatialReference:f,size:m,origin:p,lods:M}).toJSON();return{id:i,fullExtent:T,tileInfo:y}}function I(e){e=e.toLowerCase();let t=parseInt(e.split(":").pop(),10);900913!==t&&3857!==t||(t=102100);const n=D(e);return null!=n&&(t=n),{wkid:t}}function N(e,t){return v(g("TileMatrix",e),t)}function v(e,t){const n=I(t),[i,l]=w("TopLeftCorner",e).split(" ").map((e=>parseFloat(e))),s=t.includes("epsg")&&o(n.wkid);return new r(s?{x:l,y:i,spatialReference:n}:{x:i,y:l,spatialReference:n})}function F(e,t,n,r,l){const o=g("BoundingBox",t);let s,a,c,u,p,f;if(o&&(s=w("LowerCorner",o).split(" "),a=w("UpperCorner",o).split(" ")),s&&s.length>1&&a&&a.length>1)c=parseFloat(s[0]),p=parseFloat(s[1]),u=parseFloat(a[0]),f=parseFloat(a[1]);else{const e=g("TileMatrix",t),i=parseInt(w("MatrixWidth",e),10),o=parseInt(w("MatrixHeight",e),10);c=n.x,f=n.y,u=c+i*r[0]*l.resolution,p=f-o*r[1]*l.resolution}return O(e,n.spatialReference,n)?new i(p,c,f,u,n.spatialReference):new i(c,p,u,f,n.spatialReference)}function O(e,t,n){return"1.0.0"===e&&o(t.wkid)&&!(n.spatialReference.isGeographic&&n.x<-90&&n.y>=-90)}var U;function D(e){return e.includes("crs84")||e.includes("crs:84")?U.CRS84:e.includes("crs83")||e.includes("crs:83")?U.CRS83:e.includes("crs27")||e.includes("crs:27")?U.CRS27:null}function k(e,t,n,i,r){const l=I(t),o=w("Identifier",e);let s=parseFloat(w("ScaleDenominator",e));const c=j(l.wkid,s,i);s*=96/u;const p=+w("MatrixWidth",e),f=+w("MatrixHeight",e),{maxCol:d=p-1,maxRow:m=f-1,minCol:g=0,minRow:x=0}=r.get(o)??{},{x:h,y:C}=v(e,t);return new a({cols:[g,d],level:n,levelValue:o,origin:[h,C],scale:s,resolution:c,rows:[x,m]})}function j(e,t,i){let r;return r=l.hasOwnProperty(""+e)?l.values[l[e]]:"default028mm"===i?6370997*Math.PI/180:n(e).metersPerDegree,7*t/25e3/r}!function(e){e[e.CRS84=4326]="CRS84",e[e.CRS83=4269]="CRS83",e[e.CRS27=4267]="CRS27"}(U||(U={}));export{y as getTileUrlFromResourceUrls,S as getTileUrlTemplateFromResourceUrls,R as getTileUrlTemplates,f as parseCapabilities,d as parseResourceInfo,p as validateCapabilities};
|
package/package.json
CHANGED
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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
const
|
|
5
|
+
const b="20230713",d="2b13e3558c55ddd1bac2956b5a677fb9ed430119";export{b as buildDate,d 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.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,sync as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as d,c as p,h as u}from"../../../chunks/vec3.js";import{f as m}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as g,isMars as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as P}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as b,CloudsRenderingStages as R}from"./CloudsData.js";import{CloudsGenerator as A}from"./CloudsGenerator.js";import{FadeMode as x}from"./CloudsParameters.js";import{cloudPresets as F}from"./CloudsPresets.js";import{Fog as N,FogParameters as C}from"./Fog.js";import{LocalAtmosphere as E}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as W}from"./Precipitation.js";import{Stars as S}from"./Stars.js";import{weatherHeightLimit as O}from"./weather.js";import{ShaderOutput as M}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends t{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:y.None}get canRender(){return!(null===this._atmosphere&&null===this._stars)}get needsLinearDepth(){return this._atmosphereType===y.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return d(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=O}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return t&&null!=this._context?null!=s?s:new S({view:e,requestRender:()=>this._setNeedsRender()}):(r(s),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return r(e),null;const t=this.view,s=this._context;return null!=e&&e.context===s?e:(r(e),new W({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context;return r(e),new A({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new v({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new N({context:s,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([i((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),a),i((()=>this._stars),t),i((()=>this._precipitation),t),i((()=>this._clouds),(()=>this._updateWeather()),o),i((()=>this._fog),(()=>this._updateFogHaze()),o),i((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),n),i((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=b(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===R.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===M.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(F[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),p(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,V),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==y.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=r(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=r(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case y.Realistic:return P;case y.Local:return E;case y.Mars:return j;default:case y.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?y.None:s===f.Local?y.Local:null!=this._context&&P.isSupported(this._context)&&g(this.view.spatialReference)?y.Realistic:w(this.view.spatialReference)?y.Mars:y.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{k=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=k}}}};e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({readOnly:!0})],U.prototype,"atmosphere",null),e([h({readOnly:!0})],U.prototype,"_atmosphereType",null),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([h({readOnly:!0})],U.prototype,"weatherVisible",null),e([h()],U.prototype,"_context",void 0),e([h()],U.prototype,"_atmosphere",void 0),e([h({readOnly:!0})],U.prototype,"_stars",null),e([h({readOnly:!0})],U.prototype,"_precipitation",null),e([h({readOnly:!0})],U.prototype,"_clouds",null),e([h({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([h({readOnly:!0})],U.prototype,"_fog",null),e([h({readOnly:!0})],U.prototype,"weatherEnabled",null),e([h({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([h({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([l("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new C,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,p(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.hazeAmount=s(e.hazeAmount,t.hazeAmount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const D=m(.5,.5,.5),V=m(1.5,1.5,1.5);let k;export{U as EnvironmentRenderer,I as WeatherParameters};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../core/Accessor.js";import"../../../core/has.js";import{lerp as s}from"../../../core/mathUtils.js";import{destroyMaybe as r}from"../../../core/maybe.js";import{watch as i,syncAndInitial as a,initial as o,sync as n}from"../../../core/reactiveUtils.js";import{property as h}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import{subclass as l}from"../../../core/accessorSupport/decorators/subclass.js";import{l as d,c as p,h as u}from"../../../chunks/vec3.js";import{f as m}from"../../../chunks/vec3f64.js";import{getReferenceEllipsoid as c}from"../../../geometry/ellipsoidUtils.js";import{isMoon as _,isEarth as g,isMars as w}from"../../../geometry/support/spatialReferenceUtils.js";import{ViewingMode as f}from"../../ViewingMode.js";import{AtmosphereType as y}from"./AtmosphereType.js";import{ChapmanAtmosphere as P}from"./ChapmanAtmosphere.js";import{CloudsComposition as v}from"./CloudsComposition.js";import{isReadyCloudsData as b,CloudsRenderingStages as R}from"./CloudsData.js";import{CloudsGenerator as A}from"./CloudsGenerator.js";import{FadeMode as x}from"./CloudsParameters.js";import{cloudPresets as F}from"./CloudsPresets.js";import{Fog as N,FogParameters as C}from"./Fog.js";import{LocalAtmosphere as E}from"./LocalAtmosphere.js";import j from"./MarsAtmosphere.js";import{Precipitation as W}from"./Precipitation.js";import{Stars as O}from"./Stars.js";import{weatherHeightLimit as S}from"./weather.js";import{ShaderOutput as M}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as T}from"../webgl-engine/lib/RenderSlot.js";import{Update as z}from"../webgl-engine/lib/Update.js";var L;let U=L=class extends t{constructor(e){super(e),this.renderSlots=[T.POSTPROCESSING_ENVIRONMENT_OPAQUE,T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT],this._context=null,this._atmosphere=null,this._oldWeatherParameters=new I,this._newWeatherParameters=new I,this._fadedWeatherParameters=new I,this._weatherParameters=this._newWeatherParameters}initialize(){this.view._stage.addRenderPlugin(this)}destroy(){this.removeHandles(),this.uninitializeRenderContext(),null!=this.view?._stage&&this.view._stage.removeRenderPlugin(this),this._set("view",null)}get atmosphere(){return this._atmosphere}get _atmosphereType(){return null!=this.atmosphere?this.atmosphere.type:y.None}canRender(){return!(null===this._atmosphere&&null===this._stars)}requiresOutput(e){return e===M.Depth&&this._atmosphereType===y.Realistic}updateAnimation(e){return null!=this._precipitation&&this._precipitation.update(e)}get updating(){return null!=this._stars&&this._stars.updating||null!=this._clouds&&this._clouds.running}get weatherVisible(){return d(this.view.state.camera.eye)-c(this.view.spatialReference).radius<=S}get usedMemory(){return this._clouds?.usedMemory??0}get _stars(){const e=this.view,t=e.environment?.starsEnabled??!1,s=this._get("_stars");return t&&null!=this._context?null!=s?s:new O({view:e,requestRender:()=>this._setNeedsRender()}):(r(s),null)}get _precipitation(){const e=this._get("_precipitation");if(!this._precipitationEnabled||null==this._context)return r(e),null;const t=this.view,s=this._context;return null!=e&&e.context===s?e:(r(e),new W({context:s,view:t}))}get _clouds(){const e=this._get("_clouds");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context;return r(e),new A({context:s,view:t,requestRender:()=>this._setNeedsRender()})}get _cloudsComposition(){const e=this._get("_cloudsComposition");if(!this.weatherEnabled||null==this._context)return r(e),null;const t=this.view.state.viewingMode,s=this._context.renderContext.rctx,i=c(this.view.spatialReference).radius;return null!=e&&e.viewingMode===t&&e.planetRadius===i?e:(r(e),new v({rctx:s,viewingMode:t,planetRadius:i,requestRender:()=>this._setNeedsRender()}))}get _fog(){const e=this._get("_fog");if(!this.weatherEnabled||null==this._context)return r(e),null;if(null!=e)return e;const t=this.view,s=this._context,i=this._context.renderContext.rctx,a=this.view.state.viewingMode;return new N({context:s,view:t,rctx:i,viewingMode:a})}get weatherEnabled(){return!!this.view?.environmentManager?.weatherEnabled}get _precipitationEnabled(){return this.weatherEnabled&&("rainy"===this.view.environment.weather.type||"snowy"===this.view.environment.weather.type)}initializeRenderContext(e=null){this._context=e;const t=()=>this._setNeedsRender();this.addHandles([i((()=>({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled})),(e=>this._updateAtmosphere(e)),a),i((()=>this._stars),t),i((()=>this._precipitation),t),i((()=>this._clouds),(()=>this._updateWeather()),o),i((()=>this._fog),(()=>this._updateFogHaze()),o),i((()=>this.view.state.mode),(()=>{this._setNeedsRender()}),n),i((()=>this._weatherUpdateParameters),(()=>{this._updateWeather(),this._updateFogHaze()}),a)])}uninitializeRenderContext(){this._context=null,this._atmosphere=r(this._atmosphere),this._set("_stars",r(this._stars)),this._set("_precipitation",r(this._precipitation)),this._set("_clouds",r(this._clouds)),this._set("_cloudsComposition",r(this._cloudsComposition)),this._set("_fog",r(this._fog))}prepareRender(e){e.bindParameters.cloudsFade.data=b(this._clouds)?this._clouds:null,"local"!==this.view.viewingMode&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&(this._updateWeatherFading(e.bindParameters,e.time),e.bindParameters.cloudsFade.renderingStage===R.FINISHED&&null!=this._clouds&&0===this._clouds.coverage&&!1===this._clouds.running&&(this._clouds.destroyFrameBufferCube(),e.bindParameters.cloudsFade.data=null))}render(e){if(e.output===M.Color)switch(e.bindParameters.slot){case T.POSTPROCESSING_ENVIRONMENT_OPAQUE:null!=this._stars&&this._stars.render(e),null!=this.atmosphere&&(this.atmosphere.render(e,this.view?._stage?.renderer?.fullResolutionAtmosphere),null!=this._cloudsComposition&&null!=e.bindParameters.cloudsFade.data&&(this.weatherVisible&&null!=this._clouds&&this._clouds.updateWeatherTile(),this._cloudsComposition.render(e)),e.bindParameters.cloudsFade.isFading&&null!=this._context&&null!=e.bindParameters.cloudsFade.data?.cubeMap&&this._context.requestRender());break;case T.POSTPROCESSING_ENVIRONMENT_TRANSPARENT:if(null!=this.atmosphere&&(this.atmosphere.renderHaze(e,this._weatherParameters.hazeAmount,this.view?._stage?.renderer?.fullResolutionAtmosphere),this._weatherParameters.fog.amount>0&&null!=this._fog&&this._fog.render(e,this._weatherParameters.fog),null!=this._precipitation)){const t=this.view.environment.weather;"rainy"!==t.type&&"snowy"!==t.type||this._precipitation.render(e,t.precipitation,t.type)}}}updateLightSources(e,t,s,r){if(null!=this._context){const i=this._context.renderContext;i.bindParameters.oldLighting.copyFrom(i.bindParameters.lighting),i.bindParameters.newLighting.noonFactor=t,i.bindParameters.newLighting.globalFactor=s,i.bindParameters.newLighting.set(e);r===z.Faded||i.bindParameters.weatherFading?i.bindParameters.fadeLighting(0):i.bindParameters.fadeLighting(1),this._context.requestRender()}}get _weatherUpdateParameters(){const e=this.weatherEnabled?this.view.environment.weather:null;return null==e?null:"rainy"===e.type||"snowy"===e.type?{type:e.type,weatherAdjustment:e.cloudCover,effect:e.precipitation}:{type:e.type,weatherAdjustment:"foggy"===e.type?e.fogStrength:e.cloudCover}}_updateWeatherFading(e,t){e.cloudsFade.updateFading(e.camera,this.view.state.mode,t,this.view.qualitySettings.fadeDuration),e.cloudsFade.updateParallax(e.camera),e.weatherFading&&(this._updateLighting(e),this._updateFogAtmoshpere(e))}_updateLighting(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?e.fadeLighting(0):e.fadeLighting(e.cloudsFade.fadeFactor)}_updateFogAtmoshpere(e){e.cloudsFade.fadeMode!==x.CROSS_FADE&&e.cloudsFade.fadeMode!==x.FADE_IN?this._fadeWeather(0):this._fadeWeather(e.cloudsFade.fadeFactor)}_fadeWeather(e){const{_newWeatherParameters:t,_oldWeatherParameters:s}=this;e>=1?this._weatherParameters=t:(this._fadedWeatherParameters.lerp(s,t,e),this._weatherParameters=this._fadedWeatherParameters)}_updateWeather(){const e=this._weatherUpdateParameters;null!=e&&null!=this._clouds&&(this._clouds.applyPreset(F[e.type],e.weatherAdjustment),this._setNeedsRender())}_setNeedsRender(){null!=this._context&&this._context.requestRender()}_updateFogHaze(){const e=this._weatherUpdateParameters;if(null==this._fog||null==e||null==this._context)return;const t=this._context.renderContext.bindParameters;switch(this._oldWeatherParameters.copyFrom(this._weatherParameters),e.type){case"foggy":this._newWeatherParameters.fog.strength=s(3e-5,.005,e.weatherAdjustment**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;case"rainy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,q),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=0,this._setNeedsRender();break;case"snowy":this._newWeatherParameters.fog.strength=s(4e-6,2e-4,(e.effect??0)**3),p(this._newWeatherParameters.fog.color,D),this._newWeatherParameters.fog.amount=1,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender();break;default:this._newWeatherParameters.fog.strength=0,this._newWeatherParameters.fog.amount=0,this._newWeatherParameters.hazeAmount=1,this._setNeedsRender()}t.weatherFading?this._fadeWeather(0):this._fadeWeather(1)}_updateAtmosphere(e){const t=this._selectAtmosphereType(e);if(t!==y.None&&this._context){if(!this._atmosphere||this._atmosphere.type!==t){this._atmosphere=r(this._atmosphere);const e=this._getAtmosphereClass(t);e&&(this._atmosphere=new e(this.view,this._context))}}else this._atmosphere=r(this._atmosphere);this._setNeedsRender()}_getAtmosphereClass(e){switch(e){case y.Realistic:return P;case y.Local:return E;case y.Mars:return j;default:case y.None:return null}}_selectAtmosphereType(e){const{enabled:t,viewingMode:s}=e;return!t||_(this.view.spatialReference)?y.None:s===f.Local?y.Local:null!=this._context&&P.isSupported(this._context)&&g(this.view.spatialReference)?y.Realistic:w(this.view.spatialReference)?y.Mars:y.None}get test(){return{atmosphere:this._atmosphere,clouds:this._clouds,selectAtmosphereType:()=>this._selectAtmosphereType({viewingMode:this.view.state.viewingMode,enabled:this.view.environment.atmosphereEnabled}),stubGetAtmosphereClass:e=>{V=L.prototype._getAtmosphereClass,L.prototype._getAtmosphereClass=e},restoreGetAtmosphereClass:()=>{L.prototype._getAtmosphereClass=V}}}};e([h({constructOnly:!0})],U.prototype,"view",void 0),e([h({readOnly:!0})],U.prototype,"atmosphere",null),e([h({readOnly:!0})],U.prototype,"_atmosphereType",null),e([h({type:Boolean,readOnly:!0})],U.prototype,"updating",null),e([h({readOnly:!0})],U.prototype,"weatherVisible",null),e([h()],U.prototype,"_context",void 0),e([h()],U.prototype,"_atmosphere",void 0),e([h({readOnly:!0})],U.prototype,"_stars",null),e([h({readOnly:!0})],U.prototype,"_precipitation",null),e([h({readOnly:!0})],U.prototype,"_clouds",null),e([h({readOnly:!0})],U.prototype,"_cloudsComposition",null),e([h({readOnly:!0})],U.prototype,"_fog",null),e([h({readOnly:!0})],U.prototype,"weatherEnabled",null),e([h({readOnly:!0})],U.prototype,"_precipitationEnabled",null),e([h({readOnly:!0})],U.prototype,"_weatherUpdateParameters",null),U=L=e([l("esri.views.3d.environment.EnvironmentRenderer")],U);class I{constructor(){this.fog=new C,this.hazeAmount=1}copyFrom(e){this.fog.amount=e.fog.amount,this.hazeAmount=e.hazeAmount,this.fog.strength=e.fog.strength,p(this.fog.color,e.fog.color)}lerp(e,t,r){this.fog.amount=s(e.fog.amount,t.fog.amount,r),this.hazeAmount=s(e.hazeAmount,t.hazeAmount,r),this.fog.strength=s(e.fog.strength,t.fog.strength,r),u(this.fog.color,e.fog.color,t.fog.color,r)}}const q=m(.5,.5,.5),D=m(1.5,1.5,1.5);let V;export{U as EnvironmentRenderer,I as WeatherParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import e from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import i from"./RenderContext.js";import{ShaderOutput as d}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as o}from"../webgl-engine/lib/RenderSlot.js";class a{constructor(){this._renderers=new e}add(e,t){this._findOrCreateStageRenderer(e).add(t)}remove(e,t){const r=this._findStageRenderer(e);r&&(r.remove(t),0===r.renderers.length&&(r.destroy(),this._renderers.remove(r)))}_findStageRenderer(e){return this._renderers.find((t=>t.view===e))}_findOrCreateStageRenderer(e){let t=this._findStageRenderer(e);return t||(t=new h(e),this._renderers.add(t)),t}}class h{constructor(t){this.view=t,this.
|
|
5
|
+
import e from"../../../core/Collection.js";import t from"../../../core/Logger.js";import{removeMaybe as r}from"../../../core/maybe.js";import{watch as n,initial as s}from"../../../core/reactiveUtils.js";import i from"./RenderContext.js";import{ShaderOutput as d}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{RenderSlot as o}from"../webgl-engine/lib/RenderSlot.js";class a{constructor(){this._renderers=new e}add(e,t){this._findOrCreateStageRenderer(e).add(t)}remove(e,t){const r=this._findStageRenderer(e);r&&(r.remove(t),0===r.renderers.length&&(r.destroy(),this._renderers.remove(r)))}_findStageRenderer(e){return this._renderers.find((t=>t.view===e))}_findOrCreateStageRenderer(e){let t=this._findStageRenderer(e);return t||(t=new h(e),this._renderers.add(t)),t}}class h{canRender(e){return e!==o.TRANSPARENT_MATERIAL||this.renderers.some((e=>"function"==typeof e.renderTransparent))}requiresOutput(){return!1}constructor(t){this.view=t,this.renderers=new e,this.context=null,this.renderSlots=[o.OPAQUE_MATERIAL,o.TRANSPARENT_MATERIAL],this._readyWatchHandle=n((()=>t.ready),(e=>{e?(this.context=new i(this.view),this.view._stage.addRenderPlugin(this)):(this.renderers.forEach((e=>c(e,"dispose",this.context))),this.context=null)}),s)}destroy(){this.renderers.drain((e=>{this.context&&c(e,"dispose",this.context)})),this.view._stage?.removeRenderPlugin(this),this._readyWatchHandle=r(this._readyWatchHandle),this.context=null}add(e){this.renderers.includes(e)?t.getLogger("esri.views.3d.externalRenderers.ExternalRendererStore").warn("add(): Cannot add external renderer: renderer has already been added"):(this.renderers.add(e),this.context&&(this._webglStateReset(),c(e,"setup",this.context),this.view._stage.renderView.requestRender()))}remove(e){const t=this.renderers.indexOf(e);-1!==t&&(this.renderers.removeAt(t),this.context&&(c(e,"dispose",this.context),this.view._stage.renderView.requestRender()))}initializeRenderContext(e){this.context.rctx=e.renderContext.rctx,this.renderers.length>0&&this._webglStateReset(),this.renderers.forEach((e=>c(e,"setup",this.context)))}uninitializeRenderContext(){}render(e){0===this.renderers.length||e.output!==d.Color||e.bindParameters.slot!==o.OPAQUE_MATERIAL&&e.bindParameters.slot!==o.TRANSPARENT_MATERIAL||(this._updateContext(e),this._webglStateReset(),this.renderers.forEach((t=>{switch(e.bindParameters.slot){case o.OPAQUE_MATERIAL:c(t,"render",this.context);break;case o.TRANSPARENT_MATERIAL:c(t,"renderTransparent",this.context)}})))}_updateContext(e){this.context.camera.copyFrom(e.bindParameters.camera),this.context.sunLight=e.bindParameters.lighting.legacy,this.context._renderTargetHelper=e.offscreenRenderingHelper}_webglStateReset(){this.context.rctx.resetState(),this.context._renderTargetHelper?.bindFbo()}}function c(e,t,r){"function"==typeof e[t]&&null!=r&&e[t]?.(r)}export{a as default};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{b as s,l as i,g as r,o as n,e as o,p as a}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as c,offset as u,contains as d,containsPoint as p,set as m,POSITIVE_INFINITY as g,equals as _}from"../../../../geometry/support/aaBoundingBox.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as P}from"../../../../geometry/support/ray.js";import{PclTarget as b}from"./Intersector.js";import{PointHighlights as S}from"./PointHighlights.js";import{minimumDistancePlane as x,maximumDistancePlane as z,intersectLine as R,toAaBoundingBox as
|
|
5
|
+
import{disposeMaybe as e}from"../../../../core/maybe.js";import t from"../../../../core/PooledArray.js";import{b as s,l as i,g as r,o as n,e as o,p as a}from"../../../../chunks/vec3.js";import{c as h}from"../../../../chunks/vec3f64.js";import{s as l}from"../../../../chunks/vec4.js";import{create as c,offset as u,contains as d,containsPoint as p,set as m,POSITIVE_INFINITY as g,equals as _}from"../../../../geometry/support/aaBoundingBox.js";import{create as f}from"../../../../geometry/support/plane.js";import{fromPoints as P}from"../../../../geometry/support/ray.js";import{PclTarget as b}from"./Intersector.js";import{PointHighlights as S}from"./PointHighlights.js";import{minimumDistancePlane as x,maximumDistancePlane as z,intersectLine as R,toAaBoundingBox as q}from"../../support/orientedBoundingBox.js";import{ShaderOutput as w}from"../../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{Default3D as A}from"../../webgl-engine/lib/DefaultVertexAttributeLocations.js";import{newIntersectorResult as y}from"../../webgl-engine/lib/Intersector.js";import{IntersectorType as j,StoreResults as I}from"../../webgl-engine/lib/IntersectorInterfaces.js";import{RenderSlot as E}from"../../webgl-engine/lib/RenderSlot.js";import{VertexArrayObject as F}from"../../webgl-engine/lib/VertexArrayObject.js";import{VertexAttribute as v}from"../../webgl-engine/lib/VertexAttribute.js";import{P as C,a as O,g as H}from"../../../../chunks/PointRenderer.glsl.js";import{PointRendererTechnique as L}from"../../webgl-engine/shaders/PointRendererTechnique.js";import{PointRendererTechniqueConfiguration as N}from"../../webgl-engine/shaders/PointRendererTechniqueConfiguration.js";import{BufferObject as T}from"../../../webgl/BufferObject.js";import{DataType as B,PrimitiveType as M,Usage as D}from"../../../webgl/enums.js";import{VertexElementDescriptor as U}from"../../../webgl/VertexElementDescriptor.js";const V={positions:[new U(v.POSITION,3,B.FLOAT,0,12)],colors:[new U(v.COLOR,3,B.UNSIGNED_BYTE,0,3,!0)]};class W{canRender(){return!0}requiresOutput(e){return e===w.Highlight&&this._highlights.hasHighlights}constructor(e){this._params=e,this.type=j.PCL,this.isGround=!1,this.renderSlots=[E.OPAQUE_MATERIAL],this._passParameters=new C,this._highlights=new S({forEachNode:e=>this.forEachNode(e),addHighlight:(e,t,s)=>this._addHighlight(e,t,s),removeHighlight:(e,t)=>this._removeHighlight(e,t)}),this.layerUid="",this._slicePlaneEnabled=!1,this._techniqueConfig=new N,this._nodes=new t}initializeRenderContext(e){this._context=e,this._techniqueRepository=this._context.techniqueRepository,e.requestRender()}uninitializeRenderContext(){}intersect(e,t,m,g){const _=h(),S=h(),w=h(),A=h(),j=f(),E=e.camera.perScreenPixelRatio/2,F=e.camera.near;s(S,g,m);const v=1/i(S);r(S,S,v),n(w,S),l(j,S[0],S[1],S[2],-o(S,m));const C=new $,O=new $,H=new Array,L=c(),N=c(this._passParameters.clipBox);u(N,-m[0],-m[1],-m[2],N),this._nodes.forAll((i=>{const r=i.splatSize*this._passParameters.scaleFactor;let n=x(i.obb,j),h=z(i.obb,j);n-=Y(r,n+F,this._passParameters,E,i.isLeaf),h-=Y(r,h+F,this._passParameters,E,i.isLeaf);const l=h<0,c=null!=C.dist&&null!=O.dist&&C.dist<n*v&&O.dist>h*v;if(l||c)return;const f=Q(r,h+F,this._passParameters,E,i.isLeaf);if(!R(i.obb,m,S,f))return;const P=f*f;q(i.obb,L),u(L,-m[0],-m[1],-m[2],L);const b=!d(N,L);s(A,i.origin,m);const y=i.coordinates.length/3;for(let s=0;s<y;s++){if(_[0]=A[0]+i.coordinates[3*s],_[1]=A[1]+i.coordinates[3*s+1],_[2]=A[2]+i.coordinates[3*s+2],b&&!p(N,_))continue;const n=o(_,S),h=a(_)-n*n;if(h>P)continue;let l=n+F;const c=Y(r,l,this._passParameters,E,i.isLeaf);if(n-c<0)continue;l-=c;const u=Q(r,l,this._passParameters,E,i.isLeaf);if(h>u*u)continue;const d=(n-c)*v,f=e=>(e.point=J(i,s,e.point),e.dist=d,e.normal=w,e.node=i,e.pointId=s,e.layerUid=this.layerUid,e);if((null==C.dist||d<C.dist)&&(null==t||t(m,g,d))&&f(C),e.options.store!==I.MIN&&(null==O.dist||d>O.dist)&&(null==t||t(m,g,d))&&f(O),e.options.store===I.ALL&&(null==t||t(m,g,d))){const e=new $;H.push(f(e))}}}));const T=e=>{const{layerUid:t,node:s,pointId:i}=e;return new b(e.point,t,i,(()=>this._params.createGraphic(s,i,e.point)))},B=(e,t)=>{const s=T(t);e.set(this.type,s,t.dist,t.normal)};if(ee(C)){const t=e.results.min;(null==t.dist||C.dist<t.dist)&&B(t,C)}if(ee(O)&&e.options.store!==I.MIN){const t=e.results.max;(null==t.dist||O.dist>t.dist)&&B(t,O)}if(e.options.store===I.ALL){const t=P(m,g);for(const s of H){const i=y(t);B(i,s),e.results.all.push(i)}}}prepareTechnique(e){return 0===this._nodes.length||e.output!==w.Color&&e.output!==w.Depth&&e.output!==w.Highlight?null:(this._nodes.forAll((t=>{null==t.vao&&this._initNode(e,t)})),this._techniqueConfig.drawScreenSize=this._passParameters.drawScreenSpace,this._techniqueConfig.useFixedSizes=this._passParameters.useFixedSizes,this._techniqueConfig.hasSlicePlane=this._slicePlaneEnabled,this._techniqueConfig.hasOccludees=e.bindParameters.hasOccludees,this._techniqueConfig.clippingEnabled=this._clippingEnabled,this._techniqueConfig.output=e.output===w.Depth?w.Depth:e.output===w.Highlight?w.Highlight:w.Color,this._techniqueRepository.releaseAndAcquire(L,this._techniqueConfig,this._technique))}render(e,t){const s=e.rctx,i=s.bindTechnique(t,this._passParameters,e.bindParameters),r=e.output===w.Highlight;this._nodes.forAll((t=>{0===t.coordinates.length||r&&!t.highlights||(i.bindDraw(t,e.bindParameters,this._passParameters),s.bindVAO(t.vao),r?this._renderHighlightFragments(s,t):s.drawArrays(M.POINTS,0,t.coordinates.length/3))}))}_renderHighlightFragments(e,t){const s=t.highlights;if(null==s)return;let i=s[0].component,r=i+1;for(let o=1;o<s.length;o++){const t=s[o].component;if(t!==r){const s=r-i;s>0&&e.drawArrays(M.POINTS,i,s),i=t}r=t+1}const n=r-i;n>0&&e.drawArrays(M.POINTS,i,n)}set useFixedSizes(e){this._passParameters.useFixedSizes!==e&&(this._passParameters.useFixedSizes=e,this._requestRender())}get useFixedSizes(){return this._passParameters.useFixedSizes}set scaleFactor(e){this._passParameters.scaleFactor!==e&&(this._passParameters.scaleFactor=e,this._requestRender())}get scaleFactor(){return this._passParameters.scaleFactor}set minSizePx(e){this._passParameters.minSizePx!==e&&(this._passParameters.minSizePx=e,this._requestRender())}get minSizePx(){return this._passParameters.minSizePx}set useRealWorldSymbolSizes(e){this._passParameters.useRealWorldSymbolSizes!==e&&(this._passParameters.useRealWorldSymbolSizes=e,this._requestRender())}get useRealWorldSymbolSizes(){return this._passParameters.useRealWorldSymbolSizes}set size(e){this._passParameters.size!==e&&(this._passParameters.size=e,this._requestRender())}get size(){return this._passParameters.size}set sizePx(e){this._passParameters.sizePx!==e&&(this._passParameters.sizePx=e,this._requestRender())}get sizePx(){return this._passParameters.sizePx}set clippingBox(e){m(this._passParameters.clipBox,e||g)}get _clippingEnabled(){return!_(this._passParameters.clipBox,g,((e,t)=>e===t))}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this._requestRender())}addNode(e){this._nodes.push(e),this._highlights.nodeAdded(e),this._requestRender()}removeNode(t){let s=null;return this._nodes.filterInPlace((i=>i.id!==t||(s=i,i.vao=e(i.vao),this._highlights.nodeRemoved(i),!1))),this._requestRender(),s}forEachNode(e){this._nodes.forAll(e)}removeAll(){this._nodes.forAll((t=>t.vao=e(t.vao))),this._highlights.removeAll(),this._nodes.clear(),this._requestRender()}highlight(e){return this._highlights.add(e)}_addHighlight(e,t,s){e.highlights=X(e.highlights,t,s),this._requestRender()}_removeHighlight(e,t){e.highlights=Z(e.highlights,t),this._requestRender()}_initNode(e,t){const s=e.rctx;t.vao=new F(s,A,V,{positions:T.createVertex(s,D.STATIC_DRAW,t.coordinates),colors:T.createVertex(s,D.STATIC_DRAW,t.rgb)})}_requestRender(){this._context&&this._context.requestRender()}}class k extends O{constructor(e,t,s,i,r,n,o,a,h=null,l=null){super(s,r,t),this.id=e,this.obb=i,this.coordinates=n,this.rgb=o,this.attributes=a,this.pointIdFilterMap=h,this.highlights=l}}function G(e){return e.hasOwnProperty("splatSize")}function Q(e,t,s,i,r){if(s.drawScreenSpace)return s.fixedSize*t*i;const n=H(r)*t*i;return s.useFixedSizes?Math.min(s.fixedSize/2,n):s.screenMinSize>0?Math.min(Math.max(s.screenMinSize*t*i,e/2),n):Math.min(e/2,n)}function Y(e,t,s,i,r){return s.drawScreenSpace?0:Q(e,t,s,i,r)}function J(e,t,s){return null==s&&(s=h()),s[0]=e.origin[0]+e.coordinates[3*t],s[1]=e.origin[1]+e.coordinates[3*t+1],s[2]=e.origin[2]+e.coordinates[3*t+2],s}function K(e){return null!=e.component?e.component:-1}function X(e,t,s){null==e&&(e=[]);const i={component:t,id:s};e.push(i);const r=K(i);let n=e.length-1;for(;n>0&&r<K(e[n-1]);)[e[n-1],e[n]]=[e[n],e[n-1]],--n;return e}function Z(e,t){if(null==e)return e;const s=e.filter((e=>e.id!==t));return 0===s.length?null:s}class ${constructor(){this.node=null,this.pointId=null,this.point=null,this.dist=null,this.normal=null,this.layerUid=""}}function ee(e){return null!=e.dist&&null!=e.point&&null!=e.pointId&&null!=e.node}export{W as PointRenderer,k as PointRendererNode,G as isInstanceOfNode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{c as i,a as n}from"../../../chunks/vec3.js";import{create as s,fromRay as a,getStart as r,getEnd as h}from"../../../geometry/support/clipRay.js";import{intersectClipRay as l}from"../../../geometry/support/frustum.js";import{copy as c}from"../../../geometry/support/lineSegment.js";import{wrap as o}from"../../../geometry/support/ray.js";import{ViewingMode as d}from"../../ViewingMode.js";import{LaserlinePathData as _}from"./LaserlinePathData.js";import{
|
|
5
|
+
import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{c as i,a as n}from"../../../chunks/vec3.js";import{create as s,fromRay as a,getStart as r,getEnd as h}from"../../../geometry/support/clipRay.js";import{intersectClipRay as l}from"../../../geometry/support/frustum.js";import{copy as c}from"../../../geometry/support/lineSegment.js";import{wrap as o}from"../../../geometry/support/ray.js";import{ViewingMode as d}from"../../ViewingMode.js";import{LaserlinePathData as _}from"./LaserlinePathData.js";import{ShaderOutput as p}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{createQuadVAO as u}from"../webgl-engine/lib/glUtil3D.js";import{RenderSlot as g}from"../webgl-engine/lib/RenderSlot.js";import{copyParameters as m,updateParameters as P}from"../webgl-engine/materials/internal/MaterialUtil.js";import{LaserlinePathTechnique as b}from"../webgl-engine/shaders/LaserlinePathTechnique.js";import{LaserlinePathTechniqueConfiguration as f}from"../webgl-engine/shaders/LaserlinePathTechniqueConfiguration.js";import{LaserlinePassParameters as E,LaserlineTechnique as q}from"../webgl-engine/shaders/LaserlineTechnique.js";import{LaserlineTechniqueConfiguration as L}from"../webgl-engine/shaders/LaserlineTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";class R{constructor(e,t={contrastControlEnabled:!1,isDecoration:!0}){this._config=t,this._technique=null,this._heightManifoldEnabled=!1,this._pointDistanceEnabled=!1,this._lineVerticalPlaneEnabled=!1,this._intersectsLineEnabled=!1,this._intersectsLineInfinite=!1,this._viewingMode=d.Local,this._pathVerticalPlaneEnabled=!1,this._pathVerticalPlaneData=null,this._pathTechnique=null,this._passParameters=m(e,new E)}get renderSlots(){return[this._config.contrastControlEnabled?g.LASERLINES_CONTRAST_CONTROL:g.LASERLINES]}canRender(){return!0}requiresOutput(e){return e===p.Depth}get isDecoration(){return this._config.isDecoration}get heightManifoldEnabled(){return this._heightManifoldEnabled}set heightManifoldEnabled(e){this._heightManifoldEnabled!==e&&(this._heightManifoldEnabled=e,this._requestRender())}get heightManifoldTarget(){return this._passParameters.heightManifoldTarget}set heightManifoldTarget(e){i(this._passParameters.heightManifoldTarget,e),this._requestRender()}get pointDistanceEnabled(){return this._pointDistanceEnabled}set pointDistanceEnabled(e){e!==this._pointDistanceEnabled&&(this._pointDistanceEnabled=e,this._requestRender())}get pointDistanceTarget(){return this._passParameters.pointDistanceTarget}set pointDistanceTarget(e){i(this._passParameters.pointDistanceTarget,e),this._requestRender()}get pointDistanceOrigin(){return this._passParameters.pointDistanceOrigin}set pointDistanceOrigin(e){i(this._passParameters.pointDistanceOrigin,e),this._requestRender()}get lineVerticalPlaneEnabled(){return this._lineVerticalPlaneEnabled}set lineVerticalPlaneEnabled(e){e!==this._lineVerticalPlaneEnabled&&(this._lineVerticalPlaneEnabled=e,this._requestRender())}get lineVerticalPlaneSegment(){return this._passParameters.lineVerticalPlaneSegment}set lineVerticalPlaneSegment(e){c(e,this._passParameters.lineVerticalPlaneSegment),this._requestRender()}get intersectsLineEnabled(){return this._intersectsLineEnabled}set intersectsLineEnabled(e){e!==this._intersectsLineEnabled&&(this._intersectsLineEnabled=e,this._requestRender())}get intersectsLineSegment(){return this._passParameters.intersectsLineSegment}set intersectsLineSegment(e){c(e,this._passParameters.intersectsLineSegment),this._requestRender()}get intersectsLineRadius(){return this._passParameters.intersectsLineRadius}set intersectsLineRadius(e){e!==this._passParameters.intersectsLineRadius&&(this._passParameters.intersectsLineRadius=e,this._requestRender())}get intersectsLineInfinite(){return this._intersectsLineInfinite}set intersectsLineInfinite(e){e!==this._intersectsLineInfinite&&(this._intersectsLineInfinite=e,this._requestRender())}get viewingMode(){return this._viewingMode}set viewingMode(e){e!==this._viewingMode&&(this._viewingMode=e,this._requestRender())}get pathVerticalPlaneEnabled(){return this._pathVerticalPlaneEnabled}set pathVerticalPlaneEnabled(e){e!==this._pathVerticalPlaneEnabled&&(this._pathVerticalPlaneEnabled=e,null!=this._pathVerticalPlaneData&&this._requestRender())}set pathVerticalPlaneVertices(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.vertices=e,this.pathVerticalPlaneEnabled&&this._requestRender()}set pathVerticalPlaneBuffers(e){null==this._pathVerticalPlaneData&&(this._pathVerticalPlaneData=new _(this._passParameters.renderCoordsHelper)),this._pathVerticalPlaneData.buffers=e,this.pathVerticalPlaneEnabled&&this._requestRender()}setParameters(e){P(this._passParameters,e)&&this._requestRender()}initializeRenderContext(e){this._context=e;const t=e.renderContext.rctx;this._quadVAO=u(t),this._techniqueRepository=e.techniqueRepository,this._techniqueConfig=new L;const i=new f;i.contrastControlEnabled=this._config.contrastControlEnabled,this._pathTechnique=this._techniqueRepository.acquire(b,i)}uninitializeRenderContext(){this._quadVAO=e(this._quadVAO),this._technique=t(this._technique),this._pathVerticalPlaneData=e(this._pathVerticalPlaneData),this._pathTechnique=t(this._pathTechnique)}prepareTechnique(){return this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled?(this._techniqueConfig.heightManifoldEnabled=this.heightManifoldEnabled,this._techniqueConfig.lineVerticalPlaneEnabled=this.lineVerticalPlaneEnabled,this._techniqueConfig.pointDistanceEnabled=this.pointDistanceEnabled,this._techniqueConfig.intersectsLineEnabled=this.intersectsLineEnabled,this._techniqueConfig.contrastControlEnabled=this._config.contrastControlEnabled,this._techniqueConfig.spherical=this._viewingMode===d.Global,this._technique=this._techniqueRepository.releaseAndAcquire(q,this._techniqueConfig,this._technique),this._technique):this._pathTechnique}render(e,t){(this.heightManifoldEnabled||this.pointDistanceEnabled||this.lineVerticalPlaneSegment||this.intersectsLineEnabled)&&this._renderUnified(e,t),this.pathVerticalPlaneEnabled&&this._renderPath(e)}_renderUnified(e,t){const i=e.rctx;this._updatePassParameters(e),i.bindTechnique(t,this._passParameters,e.bindParameters),i.bindVAO(this._quadVAO),i.drawArrays(V.TRIANGLE_STRIP,0,4)}_renderPath(e){if(null==this._pathVerticalPlaneData||null==this._pathTechnique)return;const t=e.rctx,i=this._pathTechnique;t.bindTechnique(i,{...this._passParameters,origin:this._pathVerticalPlaneData.origin},e.bindParameters),this._pathVerticalPlaneData.draw(e.rctx)}_updatePassParameters(e){if(!this._intersectsLineEnabled)return;const t=e.bindParameters.camera;if(this._intersectsLineInfinite){if(a(o(this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector),D),D.c0=-Number.MAX_VALUE,!l(t.frustum,D))return;r(D,this._passParameters.lineStartWorld),h(D,this._passParameters.lineEndWorld)}else i(this._passParameters.lineStartWorld,this._passParameters.intersectsLineSegment.origin),n(this._passParameters.lineEndWorld,this._passParameters.intersectsLineSegment.origin,this._passParameters.intersectsLineSegment.vector)}_requestRender(){this._context&&this._context.requestRender()}}const D=s();export{R as LaserLineRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as c}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function
|
|
5
|
+
import{p as t}from"../../../../chunks/vec2.js";import{s as e}from"../../../../chunks/vec3.js";import{c as r}from"../../../../chunks/vec3f64.js";import{O as o}from"../../../../chunks/vec4f64.js";import{getReferenceEllipsoid as n}from"../../../../geometry/ellipsoidUtils.js";import{lonLatToWebMercatorComparable as i}from"../../../../geometry/projection.js";import{newDoubleArray as a}from"../../../../geometry/support/DoubleArray.js";import{newFloatArray as u}from"../../../../geometry/support/FloatArray.js";import{getZeroIndexArray as s}from"../../../../geometry/support/Indices.js";import{ViewingMode as l}from"../../../ViewingMode.js";import{Attribute as p}from"../../webgl-engine/lib/Attribute.js";import{ContentObjectType as c}from"../../webgl-engine/lib/ContentObjectType.js";import{Geometry as f}from"../../webgl-engine/lib/Geometry.js";import{VertexAttribute as m}from"../../webgl-engine/lib/VertexAttribute.js";function T(t,e,r=null){const o=[],n=[],i=e.mapPositions;h(e,n,o);const a=n[0][1].data,u=o[0][1].length,l=s(u);return b(e,n,o,l),A(e,n,o,l),E(e,n,o,l),g(e,n,o,l),I(e,n,o,l),O(e,n,o,l),R(e,n,o,a),new f(t,n,o,i,c.Line,r)}function h(t,e,r){const{attributeData:{position:o},removeDuplicateStartEnd:n}=t,i=D(o)&&n,a=o.length/3-(i?1:0),u=new Array(2*(a-1)),s=i?o.slice(0,-3):o;let l=0;for(let p=0;p<a-1;p++)u[l++]=p,u[l++]=p+1;e.push([m.POSITION,new p(s,3,i)]),r.push([m.POSITION,u])}function b(t,e,r,n){if(null!=t.attributeData.colorFeature)return;const i=t.attributeData.color;e.push([m.COLOR,new p(i??o,4)]),r.push([m.COLOR,n])}function E(t,e,r,o){if(null==t.attributeData.normal)return;const n=t.attributeData.normal;e.push([m.NORMAL,new p(n,3)]),r.push([m.NORMAL,o])}function g(t,e,r,o){null!=t.attributeData.colorFeature&&(e.push([m.COLORFEATUREATTRIBUTE,new p([t.attributeData.colorFeature],1,!0)]),r.push([m.COLOR,o]))}function A(t,e,r,o){null==t.attributeData.sizeFeature&&(e.push([m.SIZE,new p([t.attributeData.size??1],1,!0)]),r.push([m.SIZE,o]))}function I(t,e,r,o){null!=t.attributeData.sizeFeature&&(e.push([m.SIZEFEATUREATTRIBUTE,new p([t.attributeData.sizeFeature],1,!0)]),r.push([m.SIZEFEATUREATTRIBUTE,o]))}function O(t,e,r,o){const n=t.attributeData.opacityFeature;null!=n&&(e.push([m.OPACITYFEATUREATTRIBUTE,new p([n],1,!0)]),r.push([m.OPACITYFEATUREATTRIBUTE,o]))}function R(r,o,s,c){if(null==r.overlayInfo||r.overlayInfo.renderCoordsHelper.viewingMode!==l.Global||!r.overlayInfo.spatialReference.isGeographic)return;const f=a(c.length),T=n(r.overlayInfo.spatialReference);for(let t=0;t<f.length;t+=3)i(c,t,f,t,T);const h=c.length/3,b=u(h+1);let E=j,g=w,A=0,I=0;e(E,f[I++],f[I++],f[I++]),b[0]=0;for(let n=1;n<h+1;++n)n===h&&(I=0),e(g,f[I++],f[I++],f[I++]),A+=t(E,g),b[n]=A,[E,g]=[g,E];o.push([m.DISTANCETOSTART,new p(b,1,!0)]),s.push([m.DISTANCETOSTART,s[0][1]])}function D(t){const e=t.length;return t[0]===t[e-3]&&t[1]===t[e-2]&&t[2]===t[e-1]}const j=r(),w=r();function y(t,e){if(null==t||0===t.length)return[];const r=[];return t.forEach((t=>{const o=t.length,n=a(3*o);t.forEach(((t,e)=>{n[3*e]=t[0],n[3*e+1]=t[1],n[3*e+2]=t[2]}));const i={attributeData:{position:n,normal:e},removeDuplicateStartEnd:!1};r.push(i)})),r}export{T as createGeometry,y as lineStripsToParameters};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{i as r,j as i,B as s,b as a,n as o,e as n,A as l,G as h}from"../../../chunks/vec3.js";import{c as d,a as g}from"../../../chunks/vec3f64.js";import{empty as u}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as c}from"../../../geometry/support/aaBoundingRect.js";import{earth as m}from"../../../geometry/support/Ellipsoid.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{GeometryState as y}from"./GeometryState.js";import{NeighborIndex as f}from"./ITile.js";import{LayerClass as _}from"./LayerClass.js";import{PatchGeometry as x,releaseGeometry as D}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v,internalAssert as C,neighborEdgeIndices as S,oppositeEdge as $,neighborCornerIndices as E,v32s as b,lij2s as T}from"./terrainUtils.js";import{TextureFader as A,ActivationTime as V}from"./TextureFader.js";import{isEdgeNeighbor as j}from"./Tile.js";import R from"./TileOverlayData.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{VertexArrayObject as L}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as P}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as N}from"../../webgl/BufferObject.js";class G{constructor(){this.geometry=new x,this.intersectionData=null,this.geometryState=null,this._textureRef=new A((()=>this.tile.surface.textureFadeDuration)),this.overlay=new R,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const t=this.geometry;t.indices=null,t.vertexAttributes=null,u(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new y,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),v&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)C(this.geometry.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const r=this.tile,i=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const t=r.surface.extent;if(null!=t&&(0===e&&r.extent[3]>t[3]||1===e&&r.extent[2]>t[2]||2===e&&r.extent[1]<t[1]||3===e&&r.extent[0]<t[0]))return i}const s=r.level,a=S[e];if(!t)return C(null==r.surface?.rootTiles||r.surface.updatingRootTiles||!r.shouldHaveNeighbor(a)),i;if(t.isLoaded){const r=t,a=r.renderData.geometryState,o=s-r.level;if(C(o>=0),0===o){const e=a.numVerticesPerSide-1;return Math.max(e,i)}const n=2**o,l=a.neighborData.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}C(!t.isLeaf);let o=i;return t.forAllSubtreeOnSide($(a),(e=>e===r||(e.isLoaded?(o=Math.max(o,2**(e.level-s)),!0):(C(!e.isLeaf),!1)))),o}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,a=r.edgePeerNeighborSamplerVersions;for(let n=0;n<4;++n){const o=e.findNeighborTile(S[n],i),l=H(e,o),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[n],g=l!==H(e,d),u=a[n]!==h;s[n]=o,(g||u)&&(a[n]=h,this._markEdgeDirty(n));const c=r.edgeResolutions[n],m=this._calculateEdgeResolution(n,o);C(t(m)),C(m>=1),r.edgeResolutions[n]=m,c!==m&&this._markEdgeResolutionDirty(n)}const o=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const a=e.findNeighborTile(E[t],i);o[t]=a;const n=H(e,s[t]),l=H(e,s[(t+1)%4]),h=H(e,a);X[t]=h,X[(t+1)%4]=l,X[(t+2)%4]=e,X[(t+3)%4]=n,C(X.some((t=>t?.isLoaded||t===e)));const d=X.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);X.forEach(((e,t)=>{e&&e?.level>d&&(X[t]=null)})),C(X.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,u=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=X[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,a=!s&&u[e]!==i;(s||a)&&(g[e]=r,u[e]=i,this._markCornerDirty(t))}C(g.some((t=>t?.isLoaded||t===e)))}v&&C(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)X[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;v&&C(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometry.vertexAttributes,s=!r||!i||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,a=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),o=!a&&0!==this._dirtyCorners;s?(this.releaseGeometry(),this._createGeometry(e)):a||o?t.updateEdgeElevations():o?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao.dispose(),this._vao=null,D(this.geometry),!0)}ensureTexture(e,t){return null!=this._texture&&this._texture.descriptor.width!==e&&this.releaseTexture(),null==this._texture&&(this._texture=t(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){null!=this._texture&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerSide(),s=Math.max(i,5);let a=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(a=null);const o=this.geometryState;let n=!1;o.numVerticesPerSide!==s&&(this._numVerticesPerSideChanged=!0,o.numVerticesPerSide=s,o.samplerDataVersion++,n=!0),t.changed&&(this._samplerDataChanged=!0,o.samplerData=t.samplerData,o.samplerDataVersion++,n=!0),e(o.clippingArea,a)||(this._clippingAreaChanged=!0,o.clippingArea=a,n=!0);const l=r.surface.wireframe;return o.wireframe!==l&&(this._wireframeChanged=!0,o.wireframe=l,n=!0),this._geometryStateChangedSinceLastUpdate||=n,n&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometry.vertexAttributes,r=this.geometry.indices,i=e.gl;this._vao=new L(e,P,{geometry:p(t.layout)},{geometry:N.createVertex(e,i.STATIC_DRAW,t.buffer)},N.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=V.Immediate){null!=e&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[_.ELEVATION],r=t.length,i=new Array(r);let s=0,a=0,o=!1;for(let h=0;h<r;h++){const r=t[h];if(null!=r.upsampleInfo){const t=r.upsampleInfo.tile,n=t.layerInfo[_.ELEVATION][h].data,l=n&&n.samplerData;e&&e[s]===l||(o=!0),i[s++]=l,a=Math.max(a,t.lij[0])}else if(r.data){const t=this.tile.surface.layerViewByIndex(h,_.ELEVATION);if(w(this.tile,t.layer,!1)){const t=r.data;e&&e[s]===t.samplerData||(o=!0),i[s++]=t.samplerData,a=this.tile.level}}}null!=e&&e.length!==s&&(o=!0);const n=s>0,l=n?i:null;return n&&(i.length=s),{changed:o,samplerData:l,maxTileLevel:a}}get estimatedGeometryMemoryUsage(){const e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!v)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||0===e.level)return void C(e?.isLoaded);const u=e.surface.extent;if(null!=u&&!e.intersectsExtent(u))return;const p=S.map(((t,r)=>null!=u&&(r<2?-1:1)*(e.extent[3-r]-u[3-r])<0)),y=e.level;C(0===this._dirtyCorners),C(0===this._dirtyEdges),C(0===this._dirtyEdgeResolutions),C(!this._numVerticesPerSideChanged),C(!this._samplerDataChanged),C(!this._clippingAreaChanged),C(!this._wireframeChanged);const _=E.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),x=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=x.cornerPeerNeighbors[t],i=_[t];C(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}S.forEach(((u,_)=>{if(p[_])return;const x=e.findNeighborTile(u,(e=>(e.level===y||e?.isLoaded)&&e?.intersectsClippingArea));if(!x){const t=!e.surface.updatingRootTiles&&null!=e.surface.rootTiles&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(u);return void C(!t)}C(x.isLoaded||x.level===e.level),C(x===this.geometryState.neighborData.edgePeerNeighbors[_]);const D=y-x.level;if(!x.isLoaded)return C(!x.isLeaf),void C(0===D);const v=x.renderData;C(j(e,x,u)),C(D>=0);const S=2**D;if(D<0)return void C(!1);const $=e.renderData,E=$.geometry,A=E.outerEdges[_],V=E.numVerticesPerSide-1,R=v.geometry;if(!R)return void C(!1);const w=this.geometryState.neighborData.edgePeerNeighbors[_];if(w?.isLoaded){const e=w.renderData;C(w==w),C($.geometryState.neighborData.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion),C(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion)}const L=(_+2)%4,P=R.outerEdges[L],N=A.count-1,G=P.count-1;C(N*S===G,`Tile[${e.lij}]:e${_},res=${N} edgeRes mismatch with Neighbor[${x.lij}]:e${L},res=${G} (expected:${N*S})`);const X=e.extent,H=u===f.NORTH||u===f.SOUTH,W=P.count-1,q=W/2**D,z=A.count-1;if(q<1)return void C(1===z);C(q===z),C(t(q));const J=R.numVerticesPerSide-1;C(D>0||q===Math.max(J,V));const K=e.getNeighborEdgeStartVertexIndex(_,x);C(0<=K&&K<S);const Q=K*q;C(0<=Q&&Q<=W-q);let Y=0,Z=Q;A.getVertexPos(I,0),A.getVertexPos(M,A.count-1);const ee=r(I,M),te=Math.max(F,1e-4*ee);for(let t=0;t<=q;++t){A.getVertexPos(I,Y),P.getVertexPos(M,Z);const r=t/q,p=H?X[0]+r*(X[2]-X[0]):u===f.WEST?X[0]:X[2],y=H?u===f.SOUTH?X[1]:X[3]:X[1]+r*(X[3]-X[1]),D=e.surface.extent;if(null==D||c(D,p,y)){const t=i(I,M),r=s(I)-m.radius,u=s(M)-m.radius,c=t<te;if(!c){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${_}[${Y}/${A.count}] and [${x.lij}].edge${L}[${Z}/${P.count}]`),null!=D&&console.warn(" surface extent= ",D," x,y=",p,",",y);const i=d();a(i,$.localOrigin,v.localOrigin),s(i)>0&&console.warn(` localOrigins: ${$.localOrigin} vs ${v.localOrigin} d=${s(i)} [${i}]`);(()=>{const t=g(I),r=g(M);e.updateEdgeElevations(),x.updateEdgeElevations(),A.getVertexPos(I,Y),P.getVertexPos(M,Z);const i=d();l(i,I,t),s(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${I} d=${s(i)} [${i}]`),l(i,M,r),s(i)>0&&console.warn(` XXX Neighbor[${x.lij}] edge out of date: ${r} vs ${M} d=${s(i)} [${i}]`)})(),C(c,`Mismatch in tile [${e.lij}].edge[${_}][${Y}/${A.count}] vs neighbor [${x.lij}].edge[${L}][${Z}/${P.count}] ${b(I)} vs ${b(M)} dist=${t} h(t|n|d)=${r}|${u}|${u-r}`)}A.getNormal(O,Y),P.getNormal(U,Z),o(k,O),o(B,U);const f=n(k,B),S=1-f<.01||!1||e===x;if(!S){const t=d();l(t,O,U);const r=()=>`Mismatch in tile edge normal ${T(e.lij)} (${Y}/${A.count-1}) edge ${_} vs neighbor ${T(x.lij)} (${Z}/${P.count-1}) nedge ${L} :${b(O)} vs ${b(U)} dot = ${f} : ${b(t)}`;console.warn("Mismatch in tile edge normal: ",r());{e.updateEdgeElevations(),x.updateEdgeElevations();const t=d(),r=d();A.getNormal(t,Y),P.getNormal(r,Z),h(O,t)||console.warn("Missing update in tile normal: ",b(O)," => ",b(t)),h(U,r)||console.warn("Missing update in neighbor normal: ",b(U)," => ",b(r))}C(S,r())}}Y+=1,Z+=1}}))}}const I=d(),M=d(),O=d(),U=d(),k=d(),B=d(),F=1,X=[null,null,null,null];function H(e,t){return t?.isLoaded||t===e?t:null}export{V as ActivationTime,G as PatchRenderData,H as neighborTileIfLoadedOrSelf};
|
|
5
|
+
import{equals as e}from"../../../core/arrayUtils.js";import{isPowerOfTwo as t}from"../../../core/mathUtils.js";import{i as r,j as i,B as s,b as o,n as a,e as n,A as l,G as h}from"../../../chunks/vec3.js";import{c as d,a as g}from"../../../chunks/vec3f64.js";import{empty as u}from"../../../geometry/support/aaBoundingBox.js";import{containsXY as c}from"../../../geometry/support/aaBoundingRect.js";import{earth as m}from"../../../geometry/support/Ellipsoid.js";import{glLayout as p}from"../support/buffer/glUtil.js";import{GeometryState as y}from"./GeometryState.js";import{NeighborIndex as f}from"./ITile.js";import{LayerClass as _}from"./LayerClass.js";import{PatchGeometry as x,releaseGeometry as D}from"./PatchGeometry.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as v,internalAssert as C,neighborEdgeIndices as S,oppositeEdge as $,neighborCornerIndices as E,v32s as b,lij2s as T}from"./terrainUtils.js";import{TextureFader as A,ActivationTime as j}from"./TextureFader.js";import{isEdgeNeighbor as V}from"./Tile.js";import R from"./TileOverlayData.js";import{fallsWithinLayer as w}from"./tileUtils.js";import{VertexArrayObject as L}from"../webgl-engine/lib/VertexArrayObject.js";import{terrainVertexAttributeLocations as P}from"../webgl-engine/shaders/TerrainTechnique.js";import{BufferObject as N}from"../../webgl/BufferObject.js";import{PixelFormat as G}from"../../webgl/enums.js";class I{constructor(){this.geometry=new x,this.intersectionData=null,this.geometryState=null,this._textureRef=new A((()=>this.tile.surface.textureFadeDuration)),this.overlay=new R,this._geometryStateChangedSinceLastUpdate=!0,this._hasGeometry=!1,this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._clippingAreaChanged=!1,this._wireframeChanged=!1,this._dirtyEdgeResolutions=15,this._dirtyEdges=15,this._dirtyCorners=15}get tile(){return this._tile}init(e){this.clear(),this._tile=e;const t=this.geometry;t.indices=null,t.vertexAttributes=null,u(t.boundingBox),t.indexCount=0,t.numVerticesPerSide=0,this.intersectionData=null,this.geometryState=new y,this.localOrigin=null,this.overlay.clear()}clear(){this.releaseGeometry(),this.releaseTexture(),this._textureRef.clear(),this._tile=null,this.intersectionData=null,this.geometryState=null}updateGeometryIfNeeded(e){if((!this._vao||this._geometryStateChangedSinceLastUpdate||this._wireframeChanged||this._clippingAreaChanged||this._samplerDataChanged||this._numVerticesPerSideChanged||this._dirtyCorners||this._dirtyEdgeResolutions||this._dirtyEdges)&&(this._updateGeometry(e),this._geometryStateChangedSinceLastUpdate=!1),v&&this.tile.intersectsClippingArea)for(let t=0;t<4;++t)C(this.geometry.outerEdges[t].count===this.geometryState.neighborData.edgeResolutions[t]+1)}_calculateEdgeResolution(e,t){const r=this.tile,i=this.geometryState.numVerticesPerSide-1;if(!r.surface.isGlobal){const t=r.surface.extent;if(null!=t&&(0===e&&r.extent[3]>t[3]||1===e&&r.extent[2]>t[2]||2===e&&r.extent[1]<t[1]||3===e&&r.extent[0]<t[0]))return i}const s=r.level,o=S[e];if(!t)return C(null==r.surface?.rootTiles||r.surface.updatingRootTiles||!r.shouldHaveNeighbor(o)),i;if(t.isLoaded){const r=t,o=r.renderData.geometryState,a=s-r.level;if(C(a>=0),0===a){const e=o.numVerticesPerSide-1;return Math.max(e,i)}const n=2**a,l=o.neighborData.edgeResolutions[(e+2)%4]/n;return Math.max(1,l)}C(!t.isLeaf);let a=i;return t.forAllSubtreeOnSide($(o),(e=>e===r||(e.isLoaded?(a=Math.max(a,2**(e.level-s)),!0):(C(!e.isLeaf),!1)))),a}updateNeighborData(){const e=this.tile;if(!e.intersectsClippingArea)return;const r=e.renderData.geometryState.neighborData,i=t=>(t.isLoaded||t.level===e.level)&&t?.intersectsClippingArea,s=r.edgePeerNeighbors,o=r.edgePeerNeighborSamplerVersions;for(let n=0;n<4;++n){const a=e.findNeighborTile(S[n],i),l=W(e,a),h=l?.renderData?.geometryState.samplerDataVersion??-1,d=s[n],g=l!==W(e,d),u=o[n]!==h;s[n]=a,(g||u)&&(o[n]=h,this._markEdgeDirty(n));const c=r.edgeResolutions[n],m=this._calculateEdgeResolution(n,a);C(t(m)),C(m>=1),r.edgeResolutions[n]=m,c!==m&&this._markEdgeResolutionDirty(n)}const a=r.cornerPeerNeighbors;for(let t=0;t<4;++t){const o=e.findNeighborTile(E[t],i);a[t]=o;const n=W(e,s[t]),l=W(e,s[(t+1)%4]),h=W(e,o);H[t]=h,H[(t+1)%4]=l,H[(t+2)%4]=e,H[(t+3)%4]=n,C(H.some((t=>t?.isLoaded||t===e)));const d=H.reduce(((e,t)=>Math.min(e,t?.level??1/0)),1/0);H.forEach(((e,t)=>{e&&e?.level>d&&(H[t]=null)})),C(H.some((t=>t?.isLoaded||t===e)));const g=r.cornerNeighborData[t].cornerTiles,u=r.cornerNeighborData[t].cornerTileSamplerVersions;for(let e=0;e<4;++e){const r=H[e],i=r?.renderData.geometryState.samplerDataVersion??-1,s=g[e]!==r,o=!s&&u[e]!==i;(s||o)&&(g[e]=r,u[e]=i,this._markCornerDirty(t))}C(g.some((t=>t?.isLoaded||t===e)))}v&&C(this.geometryState.neighborData.edgeResolutions.every((e=>e>0)));for(let t=0;t<4;++t)H[t]=null}_updateGeometry(e){if(!this.tile.intersectsClippingArea)return;v&&C(!this.tile.intersectsClippingArea||this.geometryState.neighborData.edgeResolutions.every((e=>e>0))),this.intersectionData=null;const t=this.tile,r=this._vao,i=this.geometry.vertexAttributes,s=!r||!i||this._wireframeChanged||this._numVerticesPerSideChanged||this._samplerDataChanged||this._clippingAreaChanged||this._dirtyEdgeResolutions,o=!s&&(0!==this._dirtyEdges||0!==this._dirtyEdgeResolutions),a=!o&&0!==this._dirtyCorners;s?(this.releaseGeometry(),this._createGeometry(e)):o||a?t.updateEdgeElevations():a?t.updateCornerElevations():console.warn("Update for no reason?"),this._numVerticesPerSideChanged=!1,this._samplerDataChanged=!1,this._dirtyEdgeResolutions=0,this._dirtyEdges=0,this._dirtyCorners=0,this._clippingAreaChanged=!1,this._wireframeChanged=!1}get hasGeometry(){return this._hasGeometry}releaseGeometry(){return this._hasGeometry=!1,this.intersectionData=null,!!this._vao&&(this._vao.dispose(),this._vao=null,D(this.geometry),!0)}ensureTexture(e,t,r){const i=t?G.RGBA:G.RGB;return null==this._texture||this._texture.descriptor.width===e&&this._texture.descriptor.pixelFormat===i||this.releaseTexture(),null==this._texture&&(this._texture=r(),this.tile.setMemoryDirty()),this._texture}releaseTexture(){null!=this._texture&&(this._texture.release(),this._texture=null,this.tile.setMemoryDirty())}_markCornerDirty(e){const t=1<<e;this._dirtyCorners|=t}_markEdgeDirty(e){const t=1<<e;this._dirtyEdges|=t,this._markCornerDirty((e+0)%4),this._markCornerDirty((e+3)%4)}_markEdgeResolutionDirty(e){const t=1<<e;this._dirtyEdgeResolutions|=t,this._markEdgeDirty(e)}_markAllEdgesAndCornersDirty(){this._dirtyCorners=15,this._dirtyEdges=15,this._dirtyEdgeResolutions=15}updateGeometryState(){const t=this._getElevationInfo(),r=this.tile,i=t.samplerData?r.getElevationVerticesPerSide(t.maxTileLevel):r.getDefaultVerticesPerSide(),s=Math.max(i,5);let o=r.clippingArea;r.intersectsClippingArea&&!r.isWithinClippingArea||(o=null);const a=this.geometryState;let n=!1;a.numVerticesPerSide!==s&&(this._numVerticesPerSideChanged=!0,a.numVerticesPerSide=s,a.samplerDataVersion++,n=!0),t.changed&&(this._samplerDataChanged=!0,a.samplerData=t.samplerData,a.samplerDataVersion++,n=!0),e(a.clippingArea,o)||(this._clippingAreaChanged=!0,a.clippingArea=o,n=!0);const l=r.surface.wireframe;return a.wireframe!==l&&(this._wireframeChanged=!0,a.wireframe=l,n=!0),this._geometryStateChangedSinceLastUpdate||=n,n&&this._markAllEdgesAndCornersDirty(),this._hasGeometry=!0,this._geometryStateChangedSinceLastUpdate}_createGeometry(e){this.tile.createGeometry();const t=this.geometry.vertexAttributes,r=this.geometry.indices,i=e.gl;this._vao=new L(e,P,{geometry:p(t.layout)},{geometry:N.createVertex(e,i.STATIC_DRAW,t.buffer)},N.createIndex(e,i.STATIC_DRAW,r)),this._hasGeometry=!0}get vao(){return this._vao}setTextureReference(e,t=j.Immediate){null!=e&&e.texture!==this._texture&&this.releaseTexture(),this._textureRef.push(e,t)}get textureReference(){return this._textureRef.current}get nextTextureReference(){return this._textureRef.next}get textureFadeFactor(){return this._textureRef.fadeFactor}get textureIsFading(){return this._textureRef.isFading}_getElevationInfo(){const e=this.geometryState.samplerData,t=this.tile.layerInfo[_.ELEVATION],r=t.length,i=new Array(r);let s=0,o=0,a=!1;for(let h=0;h<r;h++){const r=t[h];if(null!=r.upsampleInfo){const t=r.upsampleInfo.tile,n=t.layerInfo[_.ELEVATION][h].data,l=n&&n.samplerData;e&&e[s]===l||(a=!0),i[s++]=l,o=Math.max(o,t.lij[0])}else if(r.data){const t=this.tile.surface.layerViewByIndex(h,_.ELEVATION);if(w(this.tile,t.layer,!1)){const t=r.data;e&&e[s]===t.samplerData||(a=!0),i[s++]=t.samplerData,o=this.tile.level}}}null!=e&&e.length!==s&&(a=!0);const n=s>0,l=n?i:null;return n&&(i.length=s),{changed:a,samplerData:l,maxTileLevel:o}}get estimatedGeometryMemoryUsage(){const e=this.intersectionData?.estimatedMemoryUsage??0;return(this.geometry.indices?.byteLength??0)+(this.geometry.vertexAttributes?.byteLength??0)+e}get texture(){return this._texture}get test(){return{hasTexture:null!=this._texture}}checkGeometryWaterproofness(){if(!v)return;const e=this.tile;if(!e.isLoaded||!e.intersectsClippingArea||0===e.level)return void C(e?.isLoaded);const u=e.surface.extent;if(null!=u&&!e.intersectsExtent(u))return;const p=S.map(((t,r)=>null!=u&&(r<2?-1:1)*(e.extent[3-r]-u[3-r])<0)),y=e.level;C(0===this._dirtyCorners),C(0===this._dirtyEdges),C(0===this._dirtyEdgeResolutions),C(!this._numVerticesPerSideChanged),C(!this._samplerDataChanged),C(!this._clippingAreaChanged),C(!this._wireframeChanged);const _=E.map((t=>e.findNeighborCornerTileExact(t,(t=>!t.intersectsClippingArea||t.isLoaded||t.level===e.level))??null)).map((e=>e?.intersectsClippingArea?e:null)),x=this.geometryState.neighborData;for(let t=0;t<4;++t){const r=x.cornerPeerNeighbors[t],i=_[t];C(i===r,`Tile[${e.lij}].corner[${t}] out of date: cur=[${r?.lij}] exp=[${i?.lij}]`)}S.forEach(((u,_)=>{if(p[_])return;const x=e.findNeighborTile(u,(e=>(e.level===y||e?.isLoaded)&&e?.intersectsClippingArea));if(!x){const t=!e.surface.updatingRootTiles&&null!=e.surface.rootTiles&&e.surface.rootTiles.length>0&&e.shouldHaveNeighbor(u);return void C(!t)}C(x.isLoaded||x.level===e.level),C(x===this.geometryState.neighborData.edgePeerNeighbors[_]);const D=y-x.level;if(!x.isLoaded)return C(!x.isLeaf),void C(0===D);const v=x.renderData;C(V(e,x,u)),C(D>=0);const S=2**D;if(D<0)return void C(!1);const $=e.renderData,E=$.geometry,A=E.outerEdges[_],j=E.numVerticesPerSide-1,R=v.geometry;if(!R)return void C(!1);const w=this.geometryState.neighborData.edgePeerNeighbors[_];if(w?.isLoaded){const e=w.renderData;C(w==w),C($.geometryState.neighborData.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion),C(this.geometryState.neighborData.edgePeerNeighborSamplerVersions[_]===e.geometryState.samplerDataVersion)}const L=(_+2)%4,P=R.outerEdges[L],N=A.count-1,G=P.count-1;C(N*S===G,`Tile[${e.lij}]:e${_},res=${N} edgeRes mismatch with Neighbor[${x.lij}]:e${L},res=${G} (expected:${N*S})`);const I=e.extent,H=u===f.NORTH||u===f.SOUTH,W=P.count-1,q=W/2**D,z=A.count-1;if(q<1)return void C(1===z);C(q===z),C(t(q));const J=R.numVerticesPerSide-1;C(D>0||q===Math.max(J,j));const K=e.getNeighborEdgeStartVertexIndex(_,x);C(0<=K&&K<S);const Q=K*q;C(0<=Q&&Q<=W-q);let Y=0,Z=Q;A.getVertexPos(M,0),A.getVertexPos(O,A.count-1);const ee=r(M,O),te=Math.max(X,1e-4*ee);for(let t=0;t<=q;++t){A.getVertexPos(M,Y),P.getVertexPos(O,Z);const r=t/q,p=H?I[0]+r*(I[2]-I[0]):u===f.WEST?I[0]:I[2],y=H?u===f.SOUTH?I[1]:I[3]:I[1]+r*(I[3]-I[1]),D=e.surface.extent;if(null==D||c(D,p,y)){const t=i(M,O),r=s(M)-m.radius,u=s(O)-m.radius,c=t<te;if(!c){console.warn(`Tile edge vertex position mismatch: between [${e.lij}].edge${_}[${Y}/${A.count}] and [${x.lij}].edge${L}[${Z}/${P.count}]`),null!=D&&console.warn(" surface extent= ",D," x,y=",p,",",y);const i=d();o(i,$.localOrigin,v.localOrigin),s(i)>0&&console.warn(` localOrigins: ${$.localOrigin} vs ${v.localOrigin} d=${s(i)} [${i}]`);(()=>{const t=g(M),r=g(O);e.updateEdgeElevations(),x.updateEdgeElevations(),A.getVertexPos(M,Y),P.getVertexPos(O,Z);const i=d();l(i,M,t),s(i)>0&&console.warn(` XXX Tile[${e.lij}] edge out of date: ${t} vs ${M} d=${s(i)} [${i}]`),l(i,O,r),s(i)>0&&console.warn(` XXX Neighbor[${x.lij}] edge out of date: ${r} vs ${O} d=${s(i)} [${i}]`)})(),C(c,`Mismatch in tile [${e.lij}].edge[${_}][${Y}/${A.count}] vs neighbor [${x.lij}].edge[${L}][${Z}/${P.count}] ${b(M)} vs ${b(O)} dist=${t} h(t|n|d)=${r}|${u}|${u-r}`)}A.getNormal(U,Y),P.getNormal(k,Z),a(B,U),a(F,k);const f=n(B,F),S=1-f<.01||!1||e===x;if(!S){const t=d();l(t,U,k);const r=()=>`Mismatch in tile edge normal ${T(e.lij)} (${Y}/${A.count-1}) edge ${_} vs neighbor ${T(x.lij)} (${Z}/${P.count-1}) nedge ${L} :${b(U)} vs ${b(k)} dot = ${f} : ${b(t)}`;console.warn("Mismatch in tile edge normal: ",r());{e.updateEdgeElevations(),x.updateEdgeElevations();const t=d(),r=d();A.getNormal(t,Y),P.getNormal(r,Z),h(U,t)||console.warn("Missing update in tile normal: ",b(U)," => ",b(t)),h(k,r)||console.warn("Missing update in neighbor normal: ",b(k)," => ",b(r))}C(S,r())}}Y+=1,Z+=1}}))}}const M=d(),O=d(),U=d(),k=d(),B=d(),F=d(),X=1,H=[null,null,null,null];function W(e,t){return t?.isLoaded||t===e?t:null}export{j as ActivationTime,I as PatchRenderData,W as neighborTileIfLoadedOrSelf};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import r from"../../../core/Accessor.js";import{disposeMaybe as i}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as a}from"../../../chunks/mat4f64.js";import{b as l,s as h,e as u}from"../../../chunks/vec3.js";import{Z as c,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as g}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlaySource as R}from"./Overlay.js";import{overlayRenderOccludedFlag as x}from"./OverlayRenderer.js";import{clearCaches as O}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as D}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as q,compareTiles as A}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as w,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as G}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as I}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as L}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{Attribute as F}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as k}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as B}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as M,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as W}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Q,getVerticalOffsetTerrain as X}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as Z}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as K,intersectTriangles as J}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as $}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ee}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as te}from"../../webgl/enums.js";const re=7,ie=10,se=f();var ne;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(ne||(ne={}));let oe=class extends r{get _isGlobal(){return this._stage.viewingMode===b.Global}constructor(e){super(e),this.type=M.TERRAIN,this.isGround=!0,this.renderSlots=[H.OPAQUE_TERRAIN,H.TRANSPARENT_TERRAIN,H.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new ee,this._passParameters=new I,this._rctx=null,this._renderDataPool=new s(C),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=ne.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),O()}get canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ne.TransparentWithDraped||e===ne.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get needsLinearDepth(){return this._overlayRenderer.hasWater}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Q}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?x:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const r of e.layerInfo[T.ELEVATION])r.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&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=ie-re,r=Math.max(0,Math.floor((e.level-t)/re)*re);if(this._isGlobal&&0===r)return c;for(;e.parent&&e.level>r;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}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=U.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=U.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=U.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._rctx=e.renderContext.rctx,this._techniqueRepository=e.techniqueRepository,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniqueRepository),this.updateTileBackground(),this._emptyTex=k(this._rctx)}uninitializeRenderContext(){this._emptyTex=i(this._emptyTex),this._tileRenderer=i(this._tileRenderer)}intersect(e,t,r,i){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ne.Opaque)return;const s=ae,n=le;l(s,i,r),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,c=e.results.max,d=e.results.ground,p=e.options.store===z.MIN,_=!!e.results.ground.target,f=X(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=o.dist?o.dist:1/0;const R=h=>{const _=h.renderData;if(!_?.vao)return;const R=_.geometry;m(se,R.boundingBox);const x=_.localOrigin;null!=f&&(f.localOrigin=x,f.applyToAabb(se));const O=se;if(he[0]=r[0]-x[0],he[1]=r[1]-x[1],he[2]=r[2]-x[2],!K(O,he,n,b,T))return;const C=(e,t,r)=>{e.set(this.type,h,t,r,a),T=p&&null!=o.dist?o.dist:1/0},v=(n,a)=>{if(null!=a&&n>=0&&(e.options.backfacesTerrain||u(a,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(r,i,n))){if((null==d.dist||n<d.dist)&&C(d,n,a),e.options.isFiltered)return;e.options.store===z.ALL&&(null==y?(y=B(e.ray),C(y,n,a),e.results.all.push(y)):n<y.dist&&C(y,n,a)),(null==o.dist||n<o.dist)&&C(o,n,a),e.options.store!==z.MIN&&(null==c.dist||n>c.dist)&&C(c,n,a)}},D=ue;l(D,i,x);const P=R.indices,S=R.vertexAttributes,E=S.getField(Y.POSITION,g),q=new F(E.typedBuffer,3,!1,S.stride/4),A=R.indexCount/3;if(!f&&A>w){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(P,0,A,q)),e.intersectionData.intersectRay({r0:he,r1:D},v)}else J(he,D,0,A,P,q,null,f,v)},x=this._rootTiles;if(null!=x){(()=>{const t=this._tileIterator;t.reset(x);const i=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||i&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(r,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const r of t)null!=r.renderData?.textureReference&&e.queriesForTile(r);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===H.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&x))return null}else{const t=this.transparency===ne.Opaque?H.OPAQUE_TERRAIN:H.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case j.Color:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty?G.Disabled:this._overlayRenderer.hasWater?G.EnabledWithWater:G.Enabled,this._updateTechnique(j.Color,e.bindParameters.slot===H.OCCLUDED_TERRAIN));case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1));case j.Normal:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1));case j.ObjectAndLayerIdColor:return this.transparency===ne.Empty?null:this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this.transparency!==ne.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const r=e.bindParameters.slot===H.OCCLUDED_TERRAIN?R.Occluded:R.ColorAndWater;this._renderMaterialPass(e,t,r);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,R.ColorAndWater);break;case j.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,R.None);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,r){const{rctx:i}=e;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,r)}_renderAuxiliaryPass(e,t,r){const i=e.rctx;this._passParameters.overlaySource=r,i.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,r)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const r=this._tileRenderer;let i=null;if(null!=e){const r=t.toUnitRGBA(e);i=d(r[0]||0,r[1]||0,r[2]||0)}r.setBackground(i),this._allTiles.forAll((e=>r.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=r.backgroundIsGrid?L.GridComposite:null!=r.backgroundColor?L.ColorComposite:L.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const r of e)q(this.renderOrder,r,t);e.sort(((e,t)=>A(e[0],t[0],this.renderOrder))),this._patchGroups=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._patchGroups.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(),r=e.renderData;if(!r){this._numTilesCulled++;continue}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const i=r.localOrigin;let s=this._patchGroups.get(i);s||(s=new Array,this._patchGroups.set(i,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,r){const i=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new Z(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],te.TRIANGLES,i,r)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,r){const i=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=W(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:i.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=r===R.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",c),s.setUniform4fv("texOffsetAndScale",_));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:c;this._techniqueConfiguration.tileBlendInput===L.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?te.LINES:te.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const u of h.values()){const i=u[0].renderData.localOrigin;t.program.bindDraw(new Z(i),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of u){const i=a.renderData,h=i.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),i.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,r),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,r,i,s,n){const o=r.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(D&&console.error("Rendered tile with no indices: ",r.lij," : ",o));const h=t.program;n===R.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(r),t.bindPipelineState(e.rctx,e.bindParameters.slot));const u=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(i,u,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire($,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({constructOnly:!0})],oe.prototype,"_overlayRenderer",void 0),e([n({constructOnly:!0})],oe.prototype,"_stage",void 0),e([n({readOnly:!0})],oe.prototype,"_isGlobal",null),e([n({constructOnly:!0})],oe.prototype,"_allTiles",void 0),e([n({constructOnly:!0})],oe.prototype,"_ellipsoidRadius",void 0),e([n({value:!1})],oe.prototype,"renderingDisabled",null),e([n()],oe.prototype,"renderPatchBorders",null),e([n()],oe.prototype,"visualizeNormals",null),e([n()],oe.prototype,"cullBackFaces",null),e([n({value:v.FRONT_TO_BACK})],oe.prototype,"renderOrder",null),e([n()],oe.prototype,"wireframe",null),oe=e([o("esri.views.3d.terrain.TerrainRenderer")],oe);const ae=p(),le=p(),he=p(),ue=p();export{oe as TerrainRenderer,ne as TransparencyMode};
|
|
5
|
+
import{_ as e}from"../../../chunks/tslib.es6.js";import t from"../../../Color.js";import i from"../../../core/Accessor.js";import{disposeMaybe as r}from"../../../core/maybe.js";import s from"../../../core/ObjectPool.js";import{property as n}from"../../../core/accessorSupport/decorators/property.js";import"../../../core/accessorSupport/ensureType.js";import"../../../core/arrayUtils.js";import"../../../core/has.js";import{subclass as o}from"../../../core/accessorSupport/decorators/subclass.js";import{I as a}from"../../../chunks/mat4f64.js";import{b as l,s as h,e as u}from"../../../chunks/vec3.js";import{Z as c,f as d,c as p}from"../../../chunks/vec3f64.js";import{Z as _}from"../../../chunks/vec4f64.js";import{create as f,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as g}from"../../../geometry/support/buffer/BufferView.js";import{ViewingMode as b}from"../../ViewingMode.js";import{TextureUpdate as y}from"./interfaces.js";import{LayerClass as T}from"./LayerClass.js";import{OverlaySource as R}from"./Overlay.js";import{overlayRenderOccludedFlag as O}from"./OverlayRenderer.js";import{clearCaches as x}from"./PatchGeometry.js";import{PatchRenderData as C}from"./PatchRenderData.js";import{RenderOrder as v}from"./RenderOrder.js";import{ENABLE_TERRAIN_INTERNAL_CHECKS as D}from"./terrainUtils.js";import{TileRenderer as P}from"./TileRenderer.js";import{TileUpdate as S}from"./TileUpdate.js";import{IteratorPreorder as E,sortTiles as q,compareTiles as A}from"./tileUtils.js";import{componentMinimalSizeForIntersectionData as w,ComponentIntersectionData as N}from"../webgl-engine/collections/Component/ComponentIntersectionData.js";import{ShaderOutput as j}from"../webgl-engine/core/shaderLibrary/ShaderOutput.js";import{OverlayMode as G}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{T as I}from"../../../chunks/Terrain.glsl.js";import{TileBlendInput as L}from"../webgl-engine/core/shaderLibrary/terrain/TileBlendInput.js";import{Attribute as F}from"../webgl-engine/lib/Attribute.js";import{RenderRequestType as U}from"../webgl-engine/lib/basicInterfaces.js";import{createEmptyTexture as k}from"../webgl-engine/lib/glUtil3D.js";import{newIntersectorResult as B}from"../webgl-engine/lib/Intersector.js";import{IntersectorType as M,StoreResults as z}from"../webgl-engine/lib/IntersectorInterfaces.js";import{RenderOccludedFlag as V}from"../webgl-engine/lib/Material.js";import{RenderSlot as H}from"../webgl-engine/lib/RenderSlot.js";import{getSettings as W}from"../webgl-engine/lib/screenSizePerspectiveUtils.js";import{VertexAttribute as Y}from"../webgl-engine/lib/VertexAttribute.js";import{TERRAIN_ID as Q,getVerticalOffsetTerrain as X}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as Z}from"../webgl-engine/materials/DrawParameters.js";import{intersectAabbInvDirBefore as K,intersectTriangles as J}from"../webgl-engine/materials/internal/MaterialUtil.js";import{TerrainTechnique as $}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as ee}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as te}from"../../webgl/enums.js";const ie=7,re=10,se=f();var ne;!function(e){e[e.Opaque=0]="Opaque",e[e.Semitransparent=1]="Semitransparent",e[e.TransparentWithDraped=2]="TransparentWithDraped",e[e.Empty=3]="Empty"}(ne||(ne={}));let oe=class extends i{get _isGlobal(){return this._stage.viewingMode===b.Global}constructor(e){super(e),this.type=M.TERRAIN,this.isGround=!0,this.renderSlots=[H.OPAQUE_TERRAIN,H.TRANSPARENT_TERRAIN,H.OCCLUDED_TERRAIN],this._tileSize=256,this._techniqueConfiguration=new ee,this._passParameters=new I,this._rctx=null,this._renderDataPool=new s(C),this._patchGroups=new Map,this._patchGroupsDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new E,this._highestVisibleLODTile=null,this._visible=!0,this._transparencyState=ne.Opaque,this._castShadows=!0,this._emptyTex=null,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.needsHighlight=!1,this.renderOccludedFlags=V.Occlude}initialize(){this._stage.addRenderPlugin(this)}destroy(){this._stage.removeRenderPlugin(this),x()}canRender(){return this._visible&&!!this._rootTiles&&!this.renderingDisabled}requiresOutput(e){return e===j.Depth&&this._overlayRenderer.hasWater||e===j.Highlight&&this.needsHighlight}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set transparency(e){this._transparencyState!==e&&(this._techniqueConfiguration.invisible=e===ne.TransparentWithDraped||e===ne.Empty,this._transparencyState=e,this.setNeedsRender())}get transparency(){return this._transparencyState}get renderPatchBorders(){return!!this._techniqueConfiguration.tileBorders}set renderPatchBorders(e){this._techniqueConfiguration.tileBorders!==e&&(this._techniqueConfiguration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get visualizeNormals(){return!!this._techniqueConfiguration.visualizeNormals}set visualizeNormals(e){this._techniqueConfiguration.visualizeNormals!==e&&(this._techniqueConfiguration.visualizeNormals=e,this.setNeedsRender(),this.notifyChange("visualizeNormals"))}get cullBackFaces(){return this._techniqueConfiguration.backfaceCullingEnabled}set cullBackFaces(e){this._techniqueConfiguration.backfaceCullingEnabled!==e&&(this._techniqueConfiguration.backfaceCullingEnabled=e,this.notifyChange("cullBackFaces"),this.setNeedsRender())}set renderOrder(e){this._set("renderOrder",e),this._setSortingDirty()}get layerUid(){return Q}get slicePlaneEnabled(){return this._techniqueConfiguration.hasSlicePlane}set slicePlaneEnabled(e){this._techniqueConfiguration.hasSlicePlane!==e&&(this._techniqueConfiguration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._techniqueConfiguration.textureFadingEnabled!==e&&(this._techniqueConfiguration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._techniqueConfiguration.pbrMode!==e&&(this._techniqueConfiguration.pbrMode=e,this.setNeedsRender())}setDebugScreenSizePerspective(e){this._techniqueConfiguration.screenSizePerspective!==e&&(this._techniqueConfiguration.screenSizePerspective=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setNeedsHighlight(e){this.needsHighlight=e,this.setNeedsRender()}setRenderOccludedOverlay(e){this.renderOccludedFlags=e?O:V.Occlude,this.setNeedsRender()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}setTileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}_prepareTileForLoading(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e),e.renderData.localOrigin=this._getLocalOriginOfTile(e))}loadTile(e){this._prepareTileForLoading(e),this.updateTileGeometryState(e),this.updateTileTexture(e,S.TEXTURE_FADING)}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,t===S.TEXTURE_FADING?y.FADING:y.UNFADED),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[T.ELEVATION])i.pendingUpdates&=~S.GEOMETRY;e.resetPendingUpdate(S.GEOMETRY);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.isLoaded&&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=re-ie,i=Math.max(0,Math.floor((e.level-t)/ie)*ie);if(this._isGlobal&&0===i)return c;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}setVisibility(e){this._visible=e,this.setDirty()}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=U.UPDATE){this._patchGroupsDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=U.UPDATE){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=U.UPDATE){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._rctx=e.renderContext.rctx,this._techniqueRepository=e.techniqueRepository,this._tileRenderer=new P(this._rctx,this._tileSize,this._techniqueRepository),this.updateTileBackground(),this._emptyTex=k(this._rctx)}uninitializeRenderContext(){this._emptyTex=r(this._emptyTex),this._tileRenderer=r(this._tileRenderer)}intersect(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&this.transparency!==ne.Opaque)return;const s=ae,n=le;l(s,r,i),h(n,1/s[0],1/s[1],1/s[2]);const o=e.results.min,c=e.results.max,d=e.results.ground,p=e.options.store===z.MIN,_=!!e.results.ground.target,f=X(e.verticalOffset),b=e.tolerance;let y,T=p&&null!=o.dist?o.dist:1/0;const R=h=>{const _=h.renderData;if(!_?.vao)return;const R=_.geometry;m(se,R.boundingBox);const O=_.localOrigin;null!=f&&(f.localOrigin=O,f.applyToAabb(se));const x=se;if(he[0]=i[0]-O[0],he[1]=i[1]-O[1],he[2]=i[2]-O[2],!K(x,he,n,b,T))return;const C=(e,t,i)=>{e.set(this.type,h,t,i,a),T=p&&null!=o.dist?o.dist:1/0},v=(n,a)=>{if(null!=a&&n>=0&&(e.options.backfacesTerrain||u(a,s)<0)&&(e.options.invisibleTerrain||!e.options.selectionMode||null==t||t(i,r,n))){if((null==d.dist||n<d.dist)&&C(d,n,a),e.options.isFiltered)return;e.options.store===z.ALL&&(null==y?(y=B(e.ray),C(y,n,a),e.results.all.push(y)):n<y.dist&&C(y,n,a)),(null==o.dist||n<o.dist)&&C(o,n,a),e.options.store!==z.MIN&&(null==c.dist||n>c.dist)&&C(c,n,a)}},D=ue;l(D,r,O);const P=R.indices,S=R.vertexAttributes,E=S.getField(Y.POSITION,g),q=new F(E.typedBuffer,3,!1,S.stride/4),A=R.indexCount/3;if(!f&&A>w){const e=h.renderData;null==e.intersectionData&&(e.intersectionData=new N(P,0,A,q)),e.intersectionData.intersectRay({r0:he,r1:D},v)}else J(he,D,0,A,P,q,null,f,v)},O=this._rootTiles;if(null!=O){(()=>{const t=this._tileIterator;t.reset(O);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==f&&!e.intersectsRay(i,s,b,T)||_&&this._useStencilForTile(e)?t.skipSubtree():R(e)})()}}processScaleRangeQueries(e,t){if(!t.done)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._patchGroups.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}prepareTechnique(e){if(e.bindParameters.slot===H.OCCLUDED_TERRAIN){if(0==(e.renderOccludedMask&O))return null}else{const t=this.transparency===ne.Opaque?H.OPAQUE_TERRAIN:H.TRANSPARENT_TERRAIN;if(e.bindParameters.slot!==t)return null}switch(e.output){case j.Color:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.hasScreenSpaceReflections=null!=e.bindParameters.ssr.lastFrameColor,this._techniqueConfiguration.hasCloudsReflections=null!=e.bindParameters.cloudsFade.data,this._techniqueConfiguration.receiveShadows=e.bindParameters.shadowMap.ready,this._techniqueConfiguration.receiveAmbientOcclusion=e.bindParameters.ssaoHelper.active,this._techniqueConfiguration.overlayMode=this._overlayRenderer.isEmpty?G.Disabled:this._overlayRenderer.hasWater?G.EnabledWithWater:G.Enabled,this._updateTechnique(j.Color,e.bindParameters.slot===H.OCCLUDED_TERRAIN));case j.Shadow:case j.ShadowExcludeHighlight:return this._castShadows&&1===e.bindParameters.lighting.globalFactor?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Shadow,!1)):null;case j.Depth:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Depth,!1));case j.Normal:return this.transparency===ne.Empty?null:(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Normal,!1));case j.ObjectAndLayerIdColor:return this.transparency===ne.Empty?null:this._updateTechnique(j.ObjectAndLayerIdColor,!1);case j.Highlight:return this.transparency!==ne.Empty&&this.needsHighlight?(this._techniqueConfiguration.receiveShadows=this._techniqueConfiguration.receiveAmbientOcclusion=!1,this._updateTechnique(j.Highlight,!1)):null}return null}render(e,t){switch(this._updatePatchGroups(),t.useStencil=!1,e.output){case j.Color:{const i=e.bindParameters.slot===H.OCCLUDED_TERRAIN?R.Occluded:R.ColorAndWater;this._renderMaterialPass(e,t,i);break}case j.Depth:case j.Normal:this._renderAuxiliaryPass(e,t,R.ColorAndWater);break;case j.Highlight:this._renderAuxiliaryPass(e,t,R.Highlight);break;case j.Shadow:case j.ShadowExcludeHighlight:this._renderAuxiliaryPass(e,t,R.None);break;case j.ObjectAndLayerIdColor:this._renderAuxiliaryPass(e,t,R.ObjectAndLayerIdColor)}}_renderMaterialPass(e,t,i){const{rctx:r}=e;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this._renderPatchGroups(e,t,i)}_renderAuxiliaryPass(e,t,i){const r=e.rctx;this._passParameters.overlaySource=i,r.bindTechnique(t,this._passParameters,e.bindParameters),this._renderPatchGroupsAuxiliary(e,t,i)}updateTileBackground(e=null){if(null==this._tileRenderer)return;const i=this._tileRenderer;let r=null;if(null!=e){const i=t.toUnitRGBA(e);r=d(i[0]||0,i[1]||0,i[2]||0)}i.setBackground(r),this._allTiles.forAll((e=>i.updateTileTexture(e,y.FADING))),this._techniqueConfiguration.tileBlendInput=i.backgroundIsGrid?L.GridComposite:null!=i.backgroundColor?L.ColorComposite:L.LayerOnly,this.setNeedsRender()}_updatePatchGroups(){if(this._patchGroupsDirty&&(this._highestVisibleLODTile=null,this._rebuildPatchGroups(),this._patchGroupsDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty&&this.renderOrder!==v.NONE){const e=Array.from(this._patchGroups.values()),t=this._stencilEnabledLayerExtents;for(const i of e)q(this.renderOrder,i,t);e.sort(((e,t)=>A(e[0],t[0],this.renderOrder))),this._patchGroups=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._patchGroups.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}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}const r=i.localOrigin;let s=this._patchGroups.get(r);s||(s=new Array,this._patchGroups.set(r,s)),s.push(e),(!this._highestVisibleLODTile||e.elevationLevel>this._highestVisibleLODTile.elevationLevel)&&(this._highestVisibleLODTile=e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderPatchGroupsAuxiliary(e,t,i){const r=this._stencilEnabledLayerExtents.length>0;this._patchGroups.forEach((s=>{const n=s[0].renderData.localOrigin;t.program.bindDraw(new Z(n),e.bindParameters,this._passParameters);for(let o=0;o<s.length;o++)this._renderPatch(e,t,s[o],te.TRIANGLES,r,i)})),e.rctx.bindVAO(null)}_renderPatchGroups(e,t,i){const r=e.bindParameters.camera,s=t.program;if(this._techniqueConfiguration.screenSizePerspective&&this.pointsOfInterest){const e=W(this._stage.viewingMode,this._ellipsoidRadius),t=this.pointsOfInterest.centerOnSurfaceFrequent.distance;e.update({distance:t,fovY:r.fovY})}const n=this._stencilEnabledLayerExtents.length>0,o=i===R.Occluded;o&&(s.bindTexture("tex",this._emptyTex),s.setUniform3fv("textureOpacities",c),s.setUniform4fv("texOffsetAndScale",_));const a=null!=this._tileRenderer&&null!=this._tileRenderer.backgroundColor?this._tileRenderer.backgroundColor:c;this._techniqueConfiguration.tileBlendInput===L.ColorComposite&&s.setUniform3fv("backgroundColor",a);const l=this.wireframe?te.LINES:te.TRIANGLES;this._techniqueConfiguration.textureFadingEnabled&&s.bindTexture("texNext",this._emptyTex);const h=this._patchGroups;for(const u of h.values()){const r=u[0].renderData.localOrigin;t.program.bindDraw(new Z(r),e.bindParameters,this._passParameters),this._numOriginsRendered++;for(const a of u){const r=a.renderData,h=r.textureReference;if(null!=h){if(!o){s.setUniform4fv("texOffsetAndScale",h.offsetAndScale),s.bindTexture("tex",h.texture.texture);const e=r.textureFadeFactor,t=e<1?r.nextTextureReference:null;this._techniqueConfiguration.textureFadingEnabled&&null!=t&&e<1?(s.setUniform1f("fadeFactor",e),s.setUniform4fv("nextTexOffsetAndScale",t.offsetAndScale),s.setUniform3fv("nextTexOpacities",t.opacities),s.bindTexture("texNext",t.texture.texture)):s.setUniform1f("fadeFactor",1),r.textureIsFading&&this.setNeedsRender(),s.setUniform3fv("textureOpacities",h.opacities)}this._renderPatch(e,t,a,l,n,i),a.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}e.rctx.bindVAO(null)}_renderPatch(e,t,i,r,s,n){const o=i.renderData,a=o.vao,l=a.indexBuffer;if(null==l)return void(D&&console.error("Rendered tile with no indices: ",i.lij," : ",o));const h=t.program;n===R.None||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(h,o.overlay),s&&(t.useStencil=this._useStencilForTile(i),t.bindPipelineState(e.rctx,e.bindParameters.slot));const u=o.geometry.indexCount;e.rctx.bindVAO(a),h.assertCompatibleVertexAttributeLocations(a),e.rctx.drawElements(r,u,l.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_updateTechnique(e,t){return this._techniqueConfiguration.output=e,this._techniqueConfiguration.renderOccluded=t,this._shaderTechnique=this._techniqueRepository.releaseAndAcquire($,this._techniqueConfiguration,this._shaderTechnique),this._shaderTechnique}get test(){return{tileRenderer:this._tileRenderer}}};e([n({constructOnly:!0})],oe.prototype,"_overlayRenderer",void 0),e([n({constructOnly:!0})],oe.prototype,"_stage",void 0),e([n({readOnly:!0})],oe.prototype,"_isGlobal",null),e([n({constructOnly:!0})],oe.prototype,"_allTiles",void 0),e([n({constructOnly:!0})],oe.prototype,"_ellipsoidRadius",void 0),e([n({value:!1})],oe.prototype,"renderingDisabled",null),e([n()],oe.prototype,"renderPatchBorders",null),e([n()],oe.prototype,"visualizeNormals",null),e([n()],oe.prototype,"cullBackFaces",null),e([n({value:v.FRONT_TO_BACK})],oe.prototype,"renderOrder",null),e([n()],oe.prototype,"wireframe",null),oe=e([o("esri.views.3d.terrain.TerrainRenderer")],oe);const ae=p(),le=p(),he=p(),ue=p();export{oe as TerrainRenderer,ne as TransparencyMode};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{s as r,j as s}from"../../../chunks/vec2.js";import{Z as o}from"../../../chunks/vec2f64.js";import{isBaseLayer as a,isGroupLayer as i}from"../../../layers/support/layerUtils.js";import{ImageWithType as n}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{TextureUpdate as c}from"./interfaces.js";import{NeighborIndex as l}from"./ITile.js";import{LayerClass as p}from"./LayerClass.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as _,isRasterTileRenderInfo as f,isTextureTileRenderInfo as T,isVectorTilePerLayerInfo as y}from"./terrainUtils.js";import{ActivationTime as g}from"./TextureFader.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as x}from"./TileCompositor.js";import{TileRenderInfo as
|
|
5
|
+
import{disposeMaybe as e,releaseMaybe as t}from"../../../core/maybe.js";import{s as r,j as s}from"../../../chunks/vec2.js";import{Z as o}from"../../../chunks/vec2f64.js";import{isBaseLayer as a,isGroupLayer as i}from"../../../layers/support/layerUtils.js";import{ImageWithType as n}from"../support/StreamDataLoader.js";import{BlendLayersPassParameters as u}from"./BlendLayersTechnique.js";import{TextureUpdate as c}from"./interfaces.js";import{NeighborIndex as l}from"./ITile.js";import{LayerClass as p}from"./LayerClass.js";import{isBlendableLayerView as h,isVectorTileLayerView as d,isVectorTileRenderInfo as m,isImageryTileRenderInfo as _,isRasterTileRenderInfo as f,isTextureTileRenderInfo as T,isVectorTilePerLayerInfo as y}from"./terrainUtils.js";import{ActivationTime as g}from"./TextureFader.js";import{TextureReference as b}from"./TextureReference.js";import{TileCompositor as x}from"./TileCompositor.js";import{TileRenderInfo as w}from"./TileRenderInfo.js";import I from"./TileTexture.js";import{TileUpdate as k}from"./TileUpdate.js";import{blendModeFromString as A}from"../webgl-engine/core/shaderLibrary/output/BlendOptions.js";import{BaseOpacityMode as P,BlendLayersOutput as R}from"../webgl-engine/core/shaderLibrary/terrain/TileBackground.glsl.js";import{createColorTexture as E,createEmptyTexture as M}from"../webgl-engine/lib/glUtil3D.js";import{TextureSamplingMode as D,TextureWrapMode as O,PixelFormat as j}from"../../webgl/enums.js";import{Texture as L}from"../../webgl/Texture.js";import{TextureDescriptor as N}from"../../webgl/TextureDescriptor.js";class C{constructor(e,t,r,s){this.start=e,this.end=t,this.blendMode=r,this.opacity=s}}class S{constructor(e,t,r){this._rctx=e,this.tileSize=t,this._techniqueRepository=r,this._passParameters=new u,this._backgroundTexture=null,this._backgroundColor=null,this._backgroundDirty=!1,this._maxAnisotropy=this._rctx.parameters.maxMaxAnisotropy,this._composition=new x(this._rctx,this._techniqueRepository),this._blackTex=new I(E(this._rctx,[0,0,0,1])),this._ensureBackgroundTexture(this.tileSize)}dispose(){this._composition=e(this._composition),this._backgroundTexture=t(this._backgroundTexture),this._blackTex=t(this._blackTex)}get backgroundIsGrid(){return null==this._backgroundColor}get backgroundColor(){return this._backgroundColor}updateTileTexture(e,t){if(!e.renderData)return;const r=e.surface,s=r.baseOpacity;let o=0,n=0,u=this.tileSize,c=!1;const l=r.view.state.contentPixelRatio;let m=!1;H.clear(),X.length=0;const _=e.layerInfo[p.MAP];let f=_.length,T=0,y=null;for(;T<_.length;T++){const t=r.layerViewByIndex(T,p.MAP),g=t.layer.opacity;q[T]=g;const b=t.fullOpacity;if(v[T]=b,a(t.layer)&&f>=_.length&&(f=T),h(t)){z[T]=t.layer.blendMode;let e="normal"!==t.layer.blendMode;if(i(t.layer.parent)){const r=B(t.layer.parent);null!=r&&""!==r&&(e=G(t.layer.parent)||e)}e&&(m=e,c=!1)}if(0===g&&!m){_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING);continue}++n;const x=U(e,T);if(x){if(_[T].pendingUpdates&=~(k.TEXTURE_NOFADING&k.TEXTURE_FADING),i(t.layer.parent)){const e=B(t.layer.parent);null!=e&&""!==e&&F(t.layer.parent,T)}d(t)?u=Math.max(u,this.tileSize*l):1===s&&1===b&&(t.isOpaque||this._dataToTexture(x)&&x.sourceLayerInfo.data.descriptor.isOpaque)&&(c=!0),++o,null===y&&(y=T)}}const g=u/this.tileSize;0!==o&&null!==y?1===o&&!m&&this._useLayerTexture(e,y,f,v[y])||this._composeMapLayers(e,t,T-1,f,q,z,u,g,!c||m,H,m):this._useBackgroundTexture(e,n)}_ensureBackgroundTexture(e){return null==this._backgroundTexture&&(this._backgroundTexture=this._buildTexture(e,!1),this._backgroundDirty=!0),this._backgroundDirty&&(this._composition.bind(e),this._passParameters.offset=o,this._passParameters.scale=1,this._passParameters.opacity=1,null!=this.backgroundColor&&(this._passParameters.backgroundColor=this.backgroundColor),this._composition.drawBackground(this._passParameters,null!=this.backgroundColor),this._composition.copyFBOToTexture(this._backgroundTexture),this._composition.unbind(),this._backgroundDirty=!1),this._backgroundTexture}_useBackgroundTexture(e,t){const r=this._ensureBackgroundTexture(this.tileSize);let s=g.Immediate;(e.surface.view.layerViewManager.updating||t>0)&&(s=g.Delayed);const o=e.renderData;null==o.textureReference&&(s=g.Immediate),o.setTextureReference(new b(r,c.FADING,W,e.surface.baseOpacity,0,1),s)}_useLayerTexture(e,t,r,s){const o=t<r,a=o?1:e.surface.baseOpacity,i=o?e.surface.baseOpacity:1,n=U(e,t);return!!this._dataToTexture(n)&&(e.renderData.setTextureReference(new b(n.sourceLayerInfo.data,c.FADING,n,a,i,s)),!0)}_composeMapLayers(e,t,r,s,a,i,n,u,c,l,p){this._composition.ensureBuffer(n);const h=e.surface.baseOpacity;let d=!1,f=D.LINEAR_MIPMAP_LINEAR,T=!1,y=0;for(let b=r;b>=0;b--){const t=U(e,b);if(!t||0===a[b]&&!p)continue;const r=b<s&&h<1&&!d;r&&(d=!0),this._passParameters.baseOpacity=r?h:1;const g=this._passParameters.baseOpacity<1?P.Required:P.NotRequired;let x=!1;l.forEach((e=>{e.start===b&&(X.push(e),this._composition.openGroup(n),x=!0)}));const w=0===y,I=x?R.GroupBackgroundComposite:c&&w?this.backgroundIsGrid?R.GridComposite:R.ColorComposite:R.Composite,k=A[i[b]];for(m(t)?(this._passParameters.opacity=a[b],T=this._composition.drawVectorData(this._passParameters,I,n,k,g,t,u,this.tileSize,T)):_(t)?(this._passParameters.opacity=a[b],this._composition.drawImageryTileData(this._passParameters,I,n,k,g,t),this._hasNearestInterpolation(t)&&(f=D.NEAREST)):this._dataToTexture(t)&&(this._passParameters.texture=t.sourceLayerInfo.data.texture,this._passParameters.offset=t.offset,this._passParameters.scale=t.scale,this._passParameters.opacity=a[b],this._composition.drawRasterData(this._passParameters,I,n,k,g));X.length>0&&X[X.length-1].end===b;){const e=X.pop();this._passParameters.opacity=e.opacity,this._passParameters.offset=o,this._passParameters.scale=1;const t=c&&w?this.backgroundIsGrid?R.GridComposite:R.ColorComposite:R.Composite;this._composition.drawGroup(this._passParameters,t,n,A[e.blendMode],g)}y++}const g=e.renderData,x=p||d&&h<1,w=g.ensureTexture(n,x,(()=>this._buildTexture(n,x,f)));this._composition.copyFBOToTexture(w),this._composition.unbind(),g.setTextureReference(new b(w,t,W,d?1:h,0,1))}_hasNearestInterpolation(e){const t=e.sourceLayerInfo.data;return!!t.source&&"nearest"===t.interpolation}_dataToTexture(e){if(f(e)){const t=e.sourceLayerInfo;t.data=this._buildTexture(t.data,!0),e.tile.setMemoryDirty()}return T(e)}setBackground(e){this._backgroundColor!==e&&(this._backgroundColor=e,this._backgroundDirty=!0)}_buildTexture(e,t,r=D.LINEAR_MIPMAP_LINEAR){if(null==e)return null;const s=new N;s.wrapMode=O.CLAMP_TO_EDGE,s.samplingMode=r,s.maxAnisotropy=this._maxAnisotropy,s.preMultiplyAlpha=!0,s.flipped=!0,s.hasMipmap=!0,t||(s.pixelFormat=j.RGB);const o=this._rctx;let a;if("number"==typeof e)s.width=s.height=e,a=new I(new L(o,s));else if(e instanceof n)s.isOpaque=e.isOpaque,s.isOpaque&&(s.pixelFormat=j.RGB),a=new I(new L(o,s,e.image)),e.release();else try{s.width=e.width,s.height=e.height,a=new I(new L(o,s,e))}catch(u){a=new I(M(o)),console.warn("TileRenderer: failed to execute 'texImage2D', cross-origin image may not be loaded.")}const i=o.bindTexture(a.texture,L.TEXTURE_UNIT_FOR_UPDATES);return a.generateMipmap(),o.bindTexture(i,L.TEXTURE_UNIT_FOR_UPDATES),a}get test(){return{backgroundTexture:this._backgroundTexture}}}function U(e,t){V.layerIndex=t,V.vtlNeighborInfos.clear();const o=e.layerInfo[p.MAP][t];if(o.data)return r(V.offset,0,0),V.tile=e,V.scale=1,V.sourceLod=e.lij,V.sourceLayerInfo=o,m(V)&&e.forEachLoadedNeighbor(((r,s)=>{if(r.level!==e.level)return;const a=r.layerInfo[p.MAP][t];if(!y(a)||o.data===a.data)return;const i=V.vtlNeighborInfos.pushNew();i.offset=Z[s],i.sourceLod=r.lij,i.sourceLayerInfo=a})),V;const a=o.upsampleInfo;if(a){const e=a.tile.layerInfo[p.MAP][t];return V.tile=a.tile,s(V.offset,a.offset),V.scale=a.scale,V.sourceLod=a.tile.lij,V.sourceLayerInfo=e,V}return null}function B(e){return e.uid}function G(e){let t="normal"!==e.blendMode;return i(e.parent)&&(t=G(e.parent)||t),t}function F(e,t){i(e.parent)&&F(e.parent,t);const r=B(e);if(null!=r&&""!==r){const s=H.get(r);s?s.start=t:H.set(r,new C(t,t,e.blendMode,e.opacity))}}const q=new Array,v=new Array,z=new Array,H=new Map,X=new Array,V=new w,W={offset:[0,0],scale:1},Z=new Array;Z[l.NORTH]=[0,-1],Z[l.NORTH_EAST]=[-1,-1],Z[l.EAST]=[-1,0],Z[l.SOUTH_EAST]=[-1,1],Z[l.SOUTH]=[0,1],Z[l.SOUTH_WEST]=[1,1],Z[l.WEST]=[1,0],Z[l.NORTH_WEST]=[1,-1];export{C as GroupInfo,S as TileRenderer};
|
|
@@ -2,4 +2,4 @@
|
|
|
2
2
|
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
|
|
3
3
|
See https://js.arcgis.com/4.28/esri/copyright.txt for details.
|
|
4
4
|
*/
|
|
5
|
-
import{f as s,t as e,e as t}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{c as r}from"../../../../../chunks/mat4.js";import{s as i,c as h}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{MaterialPassParameters as n,ShadowMapPassParameters as m,HighlightPassParameters as l,RenderPassIdentifier as c}from"./AllRenderPasses.js";import{RenderPass as p,RenderPassSorting as u}from"./RenderPass.js";import{ShaderOutput as d}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as
|
|
5
|
+
import{f as s,t as e,e as t}from"../../../../../chunks/mat3.js";import{c as a}from"../../../../../chunks/mat3f64.js";import{c as r}from"../../../../../chunks/mat4.js";import{s as i,c as h}from"../../../../../chunks/vec3.js";import{c as o}from"../../../../../chunks/vec3f64.js";import{MaterialPassParameters as n,ShadowMapPassParameters as m,HighlightPassParameters as l,RenderPassIdentifier as c}from"./AllRenderPasses.js";import{RenderPass as p,RenderPassSorting as u}from"./RenderPass.js";import{ShaderOutput as d}from"../shaderLibrary/ShaderOutput.js";import{TwoVectorPosition as _}from"../util/TwoVectorPosition.js";import{union as g}from"../../lib/depthRange.js";import{RenderSlot as P}from"../../lib/RenderSlot.js";class w{constructor(s,e){this.rctx=s,this.shaderTechniqueRepository=e,this._materialPassParameters=new n,this._shadowPassParameters=new m,this._highlightPassParameters=new l,this._systems=new Set,this._passes={materialOpaque:new p(s,e),materialTransparent:new p(s,e,u.BackToFront),materialIntegratedMesh:new p(s,e),shadowMap:new p(s,e),highlight:new p(s,e),highlightIntegratedMesh:new p(s,e),highlightShadowMap:new p(s,e),defaultShadowMap:new p(s,e)}}destroy(){this._context=null,this._systems.clear()}register(s){this._systems.add(s)}canRender(s){return s!==P.TRANSPARENT_MATERIAL||this._passes.materialTransparent.count>0}requiresOutput(s){return s===d.Highlight&&(this._passes.highlight.count>0||this._passes.highlightIntegratedMesh.count>0)}prepareRender(s){if(0!==this._systems.size){for(const s of Object.values(this._passes))s.prepareSubmit();this._systems.forEach((e=>e.submit(this._passes,s.bindParameters)));for(const s of Object.values(this._passes))s.finishSubmit();this.shaderTechniqueRepository.frameUpdate()}}prepareTechniques(s){return 0===this._systems.size?null:(this._configure(s),this._materialPassParameters.output=s.output,this._invoke(s,((e,t)=>e.prepare(t,s.bindParameters))))}render(s,e){this._invoke(s,((t,a)=>t.dispatch(a,s.bindParameters,e)))}_invoke(s,e){switch(s.bindParameters.slot){case P.OPAQUE_MATERIAL:switch(s.output){case d.Color:case d.Depth:case d.Normal:case d.ObjectAndLayerIdColor:return e(this._passes.materialOpaque,this._materialPassParameters);case d.Highlight:return e(this._passes.highlight,this._highlightPassParameters);case d.Shadow:return e(this._passes.shadowMap,this._shadowPassParameters);case d.ShadowHighlight:return e(this._passes.highlightShadowMap,this._shadowPassParameters);case d.ShadowExcludeHighlight:return e(this._passes.defaultShadowMap,this._shadowPassParameters)}break;case P.TRANSPARENT_MATERIAL:switch(s.output){case d.Color:case d.Alpha:case d.Depth:case d.Normal:case d.ObjectAndLayerIdColor:return e(this._passes.materialTransparent,this._materialPassParameters)}break;case P.INTEGRATED_MESH:switch(s.output){case d.Color:case d.Depth:case d.Normal:case d.ObjectAndLayerIdColor:return e(this._passes.materialIntegratedMesh,this._materialPassParameters);case d.Highlight:return e(this._passes.highlightIntegratedMesh,this._highlightPassParameters)}}return null}notifyDirty(){this._context.requestRender()}get renderSlots(){return[P.OPAQUE_MATERIAL,P.TRANSPARENT_MATERIAL,P.INTEGRATED_MESH]}initializeRenderContext(s){this._context=s}uninitializeRenderContext(){}queryDepthRange(s){const e={near:1/0,far:-1/0};return this._systems.forEach((t=>{const a=t.queryShadowCasterDepthRange(s);null!=a&&g(e,a,e)})),e}_configure(s){const e=s.output===d.Shadow||s.output===d.ShadowHighlight||s.output===d.ShadowExcludeHighlight?this._shadowPassParameters:s.output===d.Highlight?this._highlightPassParameters:this._materialPassParameters;this._updateParameters(s,e)}_updateParameters(a,o){const n=a.bindParameters.camera,m=n.viewInverseTransposeMatrix;i(f,m[3],m[7],m[11]),T.set(f),h(o.transformWorldFromViewTH,T.high),h(o.transformWorldFromViewTL,T.low),h(o.slicePlaneLocalOrigin,f),s(o.transformViewFromCameraRelativeRS,n.viewMatrix),r(o.transformProjFromView,n.projectionMatrix),o.identifier===c.Material&&(this._materialPassParameters.transparent=a.bindParameters.slot===P.TRANSPARENT_MATERIAL,this._materialPassParameters.integratedMesh=a.bindParameters.slot===P.INTEGRATED_MESH,e(R,o.transformViewFromCameraRelativeRS),t(o.transformNormalViewFromGlobal,R))}}const f=o(),R=a(),T=new _;export{w as RenderPassManager};
|