@arcgis/core 5.2.0-next.49 → 5.2.0-next.50
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/{d1af0bd611a3dc549858.js → 0037a878499d8a512772.js} +1 -1
- package/assets/esri/core/workers/chunks/{172571397c66f992d08c.js → 0790bf0eb276cd9166f6.js} +1 -1
- package/assets/esri/core/workers/chunks/10b367563f894ceb9864.js +1 -0
- package/assets/esri/core/workers/chunks/{1b0557fcb058fc450230.js → 246cd372d4184233f48e.js} +1 -1
- package/assets/esri/core/workers/chunks/268ab65afc3fce775ad2.js +1 -0
- package/assets/esri/core/workers/chunks/{3af2b9d6d5466cb2b957.js → 3157f85bb319294878ca.js} +9 -9
- package/assets/esri/core/workers/chunks/{5dbd28fce73751d2d1aa.js → 3406a01dad6338e3c548.js} +1 -1
- package/assets/esri/core/workers/chunks/{18edf2846d7546285e5e.js → 34fbeeeeef4bd01672c6.js} +1 -1
- package/assets/esri/core/workers/chunks/{6ccd5fa5e35dc70fcd5d.js → 403f08e0c1a9203f7fba.js} +1 -1
- package/assets/esri/core/workers/chunks/478540265c86436da05e.js +1 -0
- package/assets/esri/core/workers/chunks/{547a2fe53139f705f95e.js → 4a340836ddbc856993f2.js} +1 -1
- package/assets/esri/core/workers/chunks/4d9bde9f66817a92ceca.js +1 -0
- package/assets/esri/core/workers/chunks/57b07448da06d0302a46.js +1 -0
- package/assets/esri/core/workers/chunks/5a9ff50fdcc99ae28cce.js +1 -0
- package/assets/esri/core/workers/chunks/{40f7bb0ebd918d76f078.js → 5eb6f37c74a217772eca.js} +1 -1
- package/assets/esri/core/workers/chunks/70452f6d63e9be8d03dd.js +1 -0
- package/assets/esri/core/workers/chunks/{99eccf9ce53582cfa5b5.js → 73aa1bfa6e1dc271c9d7.js} +1 -1
- package/assets/esri/core/workers/chunks/7889f4a17cf249f2acc5.js +1 -0
- package/assets/esri/core/workers/chunks/7a2dcd57849048c6e00d.js +1 -0
- package/assets/esri/core/workers/chunks/{801a664f21e0218bc705.js → 81accb1820e2735fa376.js} +1 -1
- package/assets/esri/core/workers/chunks/{ab5aa4280ed0cb7fcbe9.js → 83991475aa54fd5aa008.js} +1 -1
- package/assets/esri/core/workers/chunks/8bdca809dd88eab9e5d8.js +29 -0
- package/assets/esri/core/workers/chunks/91d133c04ca764d74934.js +1 -0
- package/assets/esri/core/workers/chunks/97c758f736f28c5dab84.js +1 -0
- package/assets/esri/core/workers/chunks/a5f058567419ea70dff6.js +1 -0
- package/assets/esri/core/workers/chunks/{ee7c8a7f384ea6393487.js → a615a644086e98a90579.js} +1 -1
- package/assets/esri/core/workers/chunks/{0b2ca406761c63529a6a.js → b0b37c67a14a4dfb6538.js} +1 -1
- package/assets/esri/core/workers/chunks/b5c7813495657f844171.js +1 -0
- package/assets/esri/core/workers/chunks/{78add8e6b54b51eaa299.js → b8e5d7aefddddbd0a10c.js} +1 -1
- package/assets/esri/core/workers/chunks/{e2e2162adbfb9b46bede.js → c16e83e448a32d13048f.js} +1 -1
- package/assets/esri/core/workers/chunks/dc24e80d061f7b063608.js +1 -0
- package/config.js +1 -1
- package/kernel.js +1 -1
- package/package.json +1 -1
- package/support/revision.js +1 -1
- package/views/2d/input/MapViewInputManager.js +1 -1
- package/views/2d/input/handlers/DragZoomBox.js +2 -0
- package/views/2d/navigation/MapViewNavigation.js +1 -1
- package/views/3d/input/SceneInputManager.js +1 -1
- package/views/3d/input/handlers/DragZoomBox.js +2 -0
- package/views/3d/layers/graphics/Graphics3DExtrudeSymbolLayer.js +1 -1
- package/views/3d/layers/graphics/objectResourceUtils.js +1 -1
- package/views/3d/layers/graphics/wosrLoader.js +1 -1
- package/views/3d/state/controllers/PointToPointAnimationController.js +1 -1
- package/views/3d/terrain/TerrainRenderer.js +1 -1
- package/views/3d/webgl-engine/collections/Component/ComponentObjectElevationAgnosticComponentGeometryBVH.js +1 -1
- package/views/3d/webgl-engine/lib/BoundingInfo.js +1 -1
- package/views/3d/webgl-engine/lib/GaussianSplatRenderer.js +1 -1
- package/views/3d/webgl-engine/lib/Geometry.js +1 -1
- package/views/3d/webgl-engine/lib/NavigationDepthCache.js +1 -1
- package/views/3d/webgl-engine/lib/NavigationDepthCacheStore.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/PathBuilder.js +1 -1
- package/views/3d/webgl-engine/lib/PathGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/PolygonIntersections2D.js +1 -1
- package/views/3d/webgl-engine/lib/PositionReader.js +2 -0
- package/views/3d/webgl-engine/lib/RayIntersections.js +1 -1
- package/views/3d/webgl-engine/lib/RenderGeometry.js +1 -1
- package/views/3d/webgl-engine/lib/TriangleIntersectionData.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/lib/geometryDataUtils.js +1 -1
- package/views/3d/webgl-engine/lib/lodRendering/LodLevel.js +1 -1
- package/views/3d/webgl-engine/lib/screenPolygonTriangleIntersections.js +1 -1
- package/views/3d/webgl-engine/materials/PathMaterial.js +1 -1
- package/views/3d/webgl-engine/parts/RenderView.js +1 -1
- package/views/MapView.d.ts +1 -0
- package/views/SceneView.d.ts +4 -2
- package/views/input/handlers/DragZoomBox.js +2 -0
- package/views/types.d.ts +10 -4
- package/assets/esri/core/workers/chunks/031ccf2e1583beebdf24.js +0 -1
- package/assets/esri/core/workers/chunks/382d9491c2a56c1925fe.js +0 -1
- package/assets/esri/core/workers/chunks/4ee7232ea41fa41c5ed4.js +0 -29
- package/assets/esri/core/workers/chunks/50674ba5f24129d61d89.js +0 -1
- package/assets/esri/core/workers/chunks/5ce09c4d06e98b1e9251.js +0 -1
- package/assets/esri/core/workers/chunks/5f54d927dc77e92cf145.js +0 -1
- package/assets/esri/core/workers/chunks/63e3d338751240479335.js +0 -1
- package/assets/esri/core/workers/chunks/6e520ef645c5edcd499a.js +0 -1
- package/assets/esri/core/workers/chunks/7b61f56d0f766421eaef.js +0 -1
- package/assets/esri/core/workers/chunks/9b7cb96acea388d86fa4.js +0 -1
- package/assets/esri/core/workers/chunks/b49952541d189b4b9f7e.js +0 -1
- package/assets/esri/core/workers/chunks/bb552089b34d6811fb03.js +0 -1
- package/assets/esri/core/workers/chunks/d560ed96dde5ca3a5583.js +0 -1
- package/assets/esri/core/workers/chunks/eac8cae89da9ce2f4946.js +0 -1
- package/assets/esri/core/workers/chunks/f244632f7934a4b72c91.js +0 -1
- package/views/2d/navigation/ZoomBox.js +0 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as x,create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as h,expandWithAABB as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as y}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as v,BufferViewVec4f as w,BufferViewVec4u8 as R,BufferViewVec4u16 as S,BufferViewVec3u8 as B,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,b as M,n as E,f as A}from"../../../../chunks/vec3.js";import{t as C,b as I}from"../../../../chunks/vec4.js";import{a as L}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as P}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as U}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as V}from"./ProcessedObjectResource.js";import{load as _,processLoadResult as H}from"./wosrLoader.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{Geometry as K}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as G}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as W}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as N,schematicMRRFactors as Q,esriSymbologyMRRFactors as $,advancedMRRFactors as z}from"../../webgl-engine/materials/pbrUtils.js";async function q(e,r){const o=J(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):_(o.url,r)),{engineResources:t,referenceBoundingBox:s}=H(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new P,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=X(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function J(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return{fileType:e.match(/(.*\.(json|json\.gz))$/)?"wosr":"unknown",url:e,specifiedLodIndex:null}}function X(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,te(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:$}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:z},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=h();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new V(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new W({},r):Y(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Z(e,t??new W({},r)),g=c.boundingInfo;null!=g&&0===s&&b(p,g.
|
|
2
|
+
import{delinearize as e,colorGamma as r}from"../../../../colorUtils.js";import{adjustStaticAGOUrl as t}from"../../../../core/devEnvironmentUtils.js";import{hasScaling as o}from"../../../../core/mathUtils.js";import{normalFromMat4 as s,fromMat4 as i}from"../../../../core/libs/gl-matrix-2/math/mat3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/mat3f64.js";import{invert as l}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as a}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{ONES as u}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as c,subtract as m,divide as f,length as d,normalize as p,lerp as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as x,create as T}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as h,expandWithAABB as b}from"../../../../geometry/support/aaBoundingBox.js";import{newFloatArray as y}from"../../../../geometry/support/FloatArray.js";import{BufferViewVec3f as v,BufferViewVec4f as w,BufferViewVec4u8 as R,BufferViewVec4u16 as S,BufferViewVec3u8 as B,BufferViewVec3u16 as j}from"../../../../geometry/support/buffer/BufferView.js";import{t as F,b as M,n as E,f as A}from"../../../../chunks/vec3.js";import{t as C,b as I}from"../../../../chunks/vec4.js";import{a as L}from"../../../../chunks/vec2.js";import{DefaultLoadingContext as P}from"../../glTF/DefaultLoadingContext.js";import{convertPrimitiveToTriangles as U}from"../../glTF/internal/indexUtils.js";import{isEncodedMeshTexture as O}from"../../glTF/internal/resourceUtils.js";import{getTransformMatrix as k}from"../../glTF/internal/TextureTransformUtils.js";import{ProcessedObjectResource as V}from"./ProcessedObjectResource.js";import{load as _,processLoadResult as H}from"./wosrLoader.js";import{Attribute as D}from"../../webgl-engine/lib/Attribute.js";import{Geometry as K}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as G}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as W}from"../../webgl-engine/materials/DefaultMaterial.js";import{useSchematicPBR as N,schematicMRRFactors as Q,esriSymbologyMRRFactors as $,advancedMRRFactors as z}from"../../webgl-engine/materials/pbrUtils.js";async function q(e,r){const o=J(t(e));if("wosr"===o.fileType){const e=await(r.cache?r.cache.loadWOSR(o.url,r):_(o.url,r)),{engineResources:t,referenceBoundingBox:s}=H(e,r);return{lods:t,referenceBoundingBox:s,isEsriSymbolResource:!1,isWosr:!0}}let s;if(r.cache)s=await r.cache.loadGLTF(o.url,r,!!r.usePBR,!!r.useEmissive);else{const{loadGLTF:e}=await import("../../glTF/loader.js");s=await e(new P,o.url,r,r.usePBR,r.useEmissive)}const{engineResources:i,referenceBoundingBox:n}=X(s,r,o.specifiedLodIndex);return{lods:i,referenceBoundingBox:n,isEsriSymbolResource:s.meta.isEsriSymbolResource,isWosr:!1}}function J(e){const r=e.match(/(.*\.(gltf|glb))(\?lod=([0-9]+))?$/);if(r)return{fileType:"gltf",url:r[1],specifiedLodIndex:null!=r[4]?Number(r[4]):null};return{fileType:e.match(/(.*\.(json|json\.gz))$/)?"wosr":"unknown",url:e,specifiedLodIndex:null}}function X(e,r,t){const o=e.model,s=e.meta,i=o.meta?.ESRI_proxyEllipsoid,n=s.isEsriSymbolResource&&null!=i&&"EsriRealisticTreesStyle"===s.ESRI_webstyle;n&&!e.customMeta.esriTreeRendering&&(e.customMeta.esriTreeRendering=!0,te(e,i));const l=!!r.usePBR,a=s.isEsriSymbolResource?{usePBR:l,isSchematic:!1,treeRendering:n,mrrFactors:$}:{usePBR:l,isSchematic:!1,treeRendering:!1,mrrFactors:z},u={...r.materialParameters,treeRendering:n},c=new Array,m=new Map,f=new Map,d=o.lods.length,p=h();return o.lods.forEach((e,s)=>{const i=!0===r.skipHighLods&&(d>1&&0===s||d>3&&1===s)||!1===r.skipHighLods&&null!=t&&s!==t;if(i&&0!==s)return;const l=new V(e.name,e.lodThreshold,[0,0,0]);e.parts.forEach(e=>{const t=i?new W({},r):Y(o,e,l,a,u,m,f,r,n),{geometry:c,vertexCount:d}=Z(e,t??new W({},r)),g=c.boundingInfo;null!=g&&0===s&&b(p,g.box),null!=t&&(l.stageResources.geometries.push(c),l.numberOfVertices+=d)}),i||c.push(l)}),{engineResources:c,referenceBoundingBox:p}}function Y(r,t,o,s,i,n,l,a,c){const m=r.materials.get(t.material);if(null==m)return null;const{normal:f,color:d,texCoord0:p,tangent:g}=t.attributes,T=t.material+(f?"_normal":"")+(d?"_color":"")+(p?"_texCoord0":"")+(g?"_tangent":""),h=null!=t.attributes.texCoord0,b=null!=t.attributes.normal,y=re(m.alphaMode);if(!n.has(T)){if(h){const e=(e,t=!1,o=!1)=>{if(null!=e&&!l.has(e)){const s=r.textures.get(e);if(s){const r=s.data,i=t&&!O(r)?a.compressionOptions:void 0;l.set(e,new G(O(r)?r.data:r,{...s.parameters,preMultiplyAlpha:!O(r)&&o,encoding:O(r)?r.encoding:void 0,compressionOptions:i}))}}},t=1!==y&&!c;e(m.colorTexture,t,1!==y),e(m.normalTexture),e(m.occlusionTexture,!0),e(m.emissiveTexture),e(m.metallicRoughnessTexture,!0)}const o=e(m.color[0]),f=e(m.color[1]),d=e(m.color[2]),p=null!=m.colorTexture&&h?l.get(m.colorTexture):null,g=N(m),v=null!=m.normalTextureTransform?.scale?m.normalTextureTransform?.scale:u;n.set(T,new W({...s,customDepthTest:1,textureAlphaMode:y,textureAlphaCutoff:m.alphaCutoff,diffuse:[o,f,d],ambient:[o,f,d],opacity:"OPAQUE"===m.alphaMode?1:m.opacity,doubleSided:m.doubleSided,doubleSidedType:"winding-order",cullFace:m.doubleSided?0:2,hasVertexColors:!!t.attributes.color,hasVertexTangents:!!t.attributes.tangent,normalType:b?0:2,castShadows:!0,receiveShadows:m.receiveShadows,receiveAmbientOcclusion:m.receiveAmbientOcclusion,unlit:m.unlit,textureId:null!=p?p.id:void 0,colorMixMode:m.colorMixMode,normalTextureId:null!=m.normalTexture&&h?l.get(m.normalTexture).id:void 0,textureAlphaPremultiplied:null!=p&&!!p.parameters.preMultiplyAlpha,occlusionTextureId:null!=m.occlusionTexture&&h?l.get(m.occlusionTexture).id:void 0,emissiveTextureId:null!=m.emissiveTexture&&h&&!m.unlit?l.get(m.emissiveTexture).id:void 0,metallicRoughnessTextureId:null!=m.metallicRoughnessTexture&&h?l.get(m.metallicRoughnessTexture).id:void 0,emissiveBaseColor:m.unlit?x:[m.emissiveFactor[0],m.emissiveFactor[1],m.emissiveFactor[2]],emissiveStrengthKHR:null!=m.emissiveStrengthKHR?m.emissiveStrengthKHR:1,emissiveStrengthFromSymbol:null!=i.emissiveStrengthFromSymbol?i.emissiveStrengthFromSymbol:void 0,mrrFactors:g?Q:[m.metallicFactor,m.roughnessFactor,s.mrrFactors[2]],isSchematic:g,colorTextureTransformMatrix:k(m.colorTextureTransform),normalTextureTransformMatrix:k(m.normalTextureTransform),scale:[v[0],v[1]],occlusionTextureTransformMatrix:k(m.occlusionTextureTransform),emissiveTextureTransformMatrix:k(m.emissiveTextureTransform),metallicRoughnessTextureTransformMatrix:k(m.metallicRoughnessTextureTransform),...i},a))}const v=n.get(T);if(o.stageResources.materials.push(v),h){const e=e=>{null!=e&&o.stageResources.textures.push(l.get(e))};e(m.colorTexture),e(m.normalTexture),e(m.occlusionTexture),e(m.emissiveTexture),e(m.metallicRoughnessTexture)}return v}function Z(e,r){const t=e.attributes.position.count,n=U(e.indices||t,e.primitiveType),l=y(3*t),{typedBuffer:a,typedBufferStride:u}=e.attributes.position;F(l,a,e.transform,3,u);const c=[["position",new D(l,n,3,!0)]];if(null!=e.attributes.normal){const r=y(3*t),{typedBuffer:i,typedBufferStride:l}=e.attributes.normal;s(ee,e.transform),M(r,i,ee,3,l),o(ee)&&E(r,r),c.push(["normal",new D(r,n,3,!0)])}if(null!=e.attributes.tangent){const r=y(4*t),{typedBuffer:s,typedBufferStride:l}=e.attributes.tangent;i(ee,e.transform),C(r,s,ee,4,l),o(ee)&&E(r,r,4),c.push(["tangent",new D(r,n,4,!0)])}if(null!=e.attributes.texCoord0){const r=y(2*t),{typedBuffer:o,typedBufferStride:s}=e.attributes.texCoord0;L(r,o,2,s),c.push(["uv0",new D(r,n,2,!0)])}const m=e.attributes.color;if(null!=m){const r=new Uint8Array(4*t);4===m.elementCount?m instanceof w?I(r,m,1,255):(m instanceof R||m instanceof S)&&I(r,m,1/255,255):(r.fill(255),m instanceof v?A(r,m.typedBuffer,1,255,4,m.typedBufferStride):(e.attributes.color instanceof B||e.attributes.color instanceof j)&&A(r,m.typedBuffer,1/255,255,4,e.attributes.color.typedBufferStride)),c.push(["color",new D(r,n,4,!0)])}return{geometry:new K(r,c),vertexCount:t}}const ee=n();function re(e){switch(e){case"BLEND":return 0;case"MASK":return 2;case"OPAQUE":case null:case void 0:return 1}}function te(e,t){for(let o=0;o<e.model.lods.length;++o){const s=e.model.lods[o];for(const i of s.parts){const s=i.attributes.normal;if(null==s)return;const n=i.attributes.position,u=n.count,x=T(),h=T(),b=T(),y=new Float32Array(4*u),R=new Float32Array(3*u),S=l(a(),i.transform);let B=0,j=0;for(let l=0;l<u;l++){n.getVec(l,h),s.getVec(l,x),c(h,h,i.transform),m(b,h,t.center),f(b,b,t.radius);const a=b[2],u=d(b),T=Math.min(.45+.55*u*u,1)**r;f(b,b,t.radius),null!==S&&c(b,b,S),p(b,b),o+1!==e.model.lods.length&&e.model.lods.length>1&&g(b,b,x,a>-1?.2:Math.min(-4*a-3.8,1)),R[B]=b[0],R[B+1]=b[1],R[B+2]=b[2],B+=3,y[j]=T,y[j+1]=T,y[j+2]=T,y[j+3]=1,j+=4}i.attributes.normal=new v(R.buffer),i.attributes.color=new w(y.buffer)}}}export{q as fetch,J as parseUrl};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import i from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithAABB as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../request/image.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{Geometry as d}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as g}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as y}from"../../webgl-engine/materials/DefaultMaterial.js";const w=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class x{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}async function h(e,t){const r=await b(e,t),n=await M(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new x(r,n,o+s(r))}async function b(r,n){const s=await t(e(r,n));if(s.ok)return s.value.data;a(s.error),v(s.error)}function v(e){throw new r("",`Request for object resource failed: ${e}`)}function A(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(w().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(w().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(w().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(w().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else w().warn("Indexed geometries must specify faces"),n=!1;break}default:w().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(w().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(w().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function j(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");E.validate(c);const p=u.model.name,w=u.model.geometries,x=u.materialDefinitions??{},h=e.textures;let b=0;const v=new Map;for(let o=0;o<w.length;o++){const e=w[o];if(!A(e))continue;const i=I(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},j=u.position,P=j.values.length/j.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,E=h&&h[M];if(E&&!v.has(M)){const{image:e,parameters:t}=E,r=new g(e,t);n.push(r),v.set(M,r)}const T=v.get(M),k=T?T.id:void 0,O=i.material;let
|
|
2
|
+
import e from"../../../../request.js";import{result as t}from"../../../../core/asyncUtils.js";import r from"../../../../core/Error.js";import n from"../../../../core/Logger.js";import{estimateNestedObjectMemory as s}from"../../../../core/memoryEstimations.js";import{NestedMap as o}from"../../../../core/NestedMap.js";import{throwIfAbortError as a}from"../../../../core/promiseUtils.js";import i from"../../../../core/Version.js";import{fromArray as l}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as u,expandWithAABB as c}from"../../../../geometry/support/aaBoundingBox.js";import{getContinuousIndexArray as m}from"../../../../geometry/support/Indices.js";import{requestImage as p}from"../../../../request/image.js";import{Attribute as f}from"../../webgl-engine/lib/Attribute.js";import{Geometry as d}from"../../webgl-engine/lib/Geometry.js";import{ManagedTexture as g}from"../../webgl-engine/lib/ManagedTexture.js";import{DefaultMaterial as y}from"../../webgl-engine/materials/DefaultMaterial.js";const w=()=>n.getLogger("esri.views.3d.layers.graphics.objectResourceUtils");class x{constructor(e,t,r){this.resource=e,this.textures=t,this.usedMemory=r}}async function h(e,t){const r=await b(e,t),n=await M(r.textureDefinitions??{},t);let o=0;for(const s in n)if(n.hasOwnProperty(s)){const e=n[s];o+=e?.image?e.image.width*e.image.height*4:0}return new x(r,n,o+s(r))}async function b(r,n){const s=await t(e(r,n));if(s.ok)return s.value.data;a(s.error),v(s.error)}function v(e){throw new r("",`Request for object resource failed: ${e}`)}function A(e){const t=e.params,r=t.topology;let n=!0;switch(t.vertexAttributes||(w().warn("Geometry must specify vertex attributes"),n=!1),t.topology){case"PerAttributeArray":break;case"Indexed":case null:case void 0:{const e=t.faces;if(e){if(t.vertexAttributes)for(const r in t.vertexAttributes){const t=e[r];t?.values?(null!=t.valueType&&"UInt32"!==t.valueType&&(w().warn(`Unsupported indexed geometry indices type '${t.valueType}', only UInt32 is currently supported`),n=!1),null!=t.valuesPerElement&&1!==t.valuesPerElement&&(w().warn(`Unsupported indexed geometry values per element '${t.valuesPerElement}', only 1 is currently supported`),n=!1)):(w().warn(`Indexed geometry does not specify face indices for '${r}' attribute`),n=!1)}}else w().warn("Indexed geometries must specify faces"),n=!1;break}default:w().warn(`Unsupported topology '${r}'`),n=!1}e.params.material||(w().warn("Geometry requires material"),n=!1);const s=e.params.vertexAttributes;for(const o in s){s[o].values||(w().warn("Geometries with externally defined attributes are not yet supported"),n=!1)}return n}function j(e,t){const r=new Array,n=new Array,s=new Array,a=new o,u=e.resource,c=i.parse(u.version||"1.0","wosr");E.validate(c);const p=u.model.name,w=u.model.geometries,x=u.materialDefinitions??{},h=e.textures;let b=0;const v=new Map;for(let o=0;o<w.length;o++){const e=w[o];if(!A(e))continue;const i=I(e),u=e.params.vertexAttributes,c=[],p=t=>{if("PerAttributeArray"===e.params.topology)return null;const r=e.params.faces;for(const e in r)if(e===t)return r[e].values;return null},j=u.position,P=j.values.length/j.valuesPerElement;for(const t in u){const e=u[t],r=e.values,n=p(t)??m(P);c.push([t,new f(r,n,e.valuesPerElement,!0)])}const M=i.texture,E=h&&h[M];if(E&&!v.has(M)){const{image:e,parameters:t}=E,r=new g(e,t);n.push(r),v.set(M,r)}const T=v.get(M),k=T?T.id:void 0,O=i.material;let C=a.get(O,M);if(null==C){const e=x[O.slice(O.lastIndexOf("/")+1)].params;1===e.transparency&&(e.transparency=0);const r=E?U(E.alphaChannelUsage):void 0,n={ambient:l(e.diffuse),diffuse:l(e.diffuse),opacity:1-(e.transparency||0),textureAlphaMode:r,textureAlphaCutoff:.33,textureId:k,doubleSided:!0,cullFace:0,colorMixMode:e.externalColorMixMode||"tint",textureAlphaPremultiplied:E?.parameters.preMultiplyAlpha??!1};t?.materialParameters&&Object.assign(n,t.materialParameters),C=new y(n,t),a.set(O,M,C)}s.push(C);const $=new d(C,c);b+=c.find(e=>"position"===e[0])?.[1]?.indices.length??0,r.push($)}return{engineResources:[{name:p,stageResources:{textures:n,materials:s,geometries:r},pivotOffset:u.model.pivotOffset,numberOfVertices:b,lodThreshold:null}],referenceBoundingBox:P(r)}}function P(e){const t=u();return e.forEach(e=>{const r=e.boundingInfo;null!=r&&c(t,r.box)}),t}async function M(e,t){const r=new Array;for(const o in e){const n=e[o],s=n.images[0].data;if(!s){w().warn("Externally referenced texture data is not yet supported");continue}const a=n.encoding+";base64,"+s,i="/textureDefinitions/"+o,l="rgba"===n.channels?n.alphaChannelUsage||"transparency":"none",u={noUnpackFlip:!0,wrap:{s:10497,t:10497},preMultiplyAlpha:1!==U(l)},c=t?.disableTextures?Promise.resolve(null):p(a,t);r.push(c.then(e=>({refId:i,image:e,parameters:u,alphaChannelUsage:l})))}const n=await Promise.all(r),s={};for(const o of n)s[o.refId]=o;return s}function U(e){switch(e){case"mask":return 2;case"maskAndTransparency":return 3;case"none":return 1;default:return 0}}function I(e){const t=e.params;return{id:1,material:t.material,texture:t.texture,region:t.texture}}const E=new i(1,2,"wosr");export{x as LoaderResultWOSR,M as createTextureResources,h as load,j as processLoadResult};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__decorate as i}from"tslib";import{property as t,subclass as e}from"../../../../core/accessorSupport/decorators.js";import{distance as n,add as o,scale as r}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import a from"../../../ViewAnimation.js";import{Animation as m}from"../../animation/pointToPoint/Animation.js";import{AnimationController as l}from"./AnimationController.js";import{pivotSearchAreaSize as c}from"../utils/navigationUtils.js";import h from"../../webgl/RenderCamera.js";import{Intersector as p}from"../../webgl-engine/lib/Intersector.js";import{EasingFunctions as u}from"../../../animation/easing.js";let f=class extends l{get _intersectionHelper(){return this.view.sceneIntersectionHelper}constructor(i){super(i),this.type="point-to-point",this.mode="interaction",this._target=null}initialize(){this.animation=new m(this.view.state.viewingMode),this.viewAnimation="interaction"===this.mode?null:new a}get isInteractive(){return"interaction"===this.mode}begin(i,t){this._target=i.clone(),this.stepController=(i,t)=>{this.animation.step(i,t),this.animation.finished&&this.finishController()};const e=this.animationSettings(t);d.copyFrom(this.view.state.camera);const s=this.view.stage.renderView.getMinimalDepthForArea(null,d.fullWidth/d.pixelRatio*.5,d.fullHeight/d.pixelRatio*.5,d,c),a=new p(this.view.state.viewingMode);let m;this._intersectionHelper.intersectRay(d.ray,a,g)&&(m=n(d.eye,g));const l=null!=s&&null!=m?Math.min(s,m):s??m;o(g,d.eye,r(g,d.viewForward,l??0)),d.center=g,this.animation.update(d,i,e),this.animation.finished&&this.finish()}finish(){this.animation.currentTime=this.animation.time,super.finish()}onControllerEnd(i){if(this.stepController){this.animation.currentTime/this.animation.time>=1&&this._target?i.copyFrom(this._target):this.animation.cameraAt(this.animation.currentTime/this.animation.time,i),this.animation.currentTime=this.animation.time}super.onControllerEnd(i),this.stepController=void 0}animationSettings(i={}){return{apex:i.liftOffDisabled?void 0:{maximumDistance:this.view.state.constraints.clampAltitude(1/0)/6,ascensionFactor:void 0,descensionFactor:void 0},...i,easing:"string"==typeof i.easing?u[i.easing]:i.easing}}};i([t({constructOnly:!0})],f.prototype,"mode",void 0),i([t({readOnly:!0})],f.prototype,"isInteractive",null),f=i([e("esri.views.3d.state.controllers.PointToPointAnimationController")],f);let d=new h;const g=s();function v(){d=new h}function w(i){return null!=i&&"type"in i&&"point-to-point"===i.type}export{f as PointToPointAnimationController,v as cleanupPointToPointAnimationController,w as isPointToPointAnimationController};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else C(X,D,0,U,B,I,g,R,S)},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&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(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
|
|
2
|
+
import{__decorate as e}from"tslib";import has from"../../../core/has.js";import{disposeMaybe as t}from"../../../core/maybe.js";import{MemCachePool as i}from"../../../core/MemCachePool.js";import r from"../../../core/ObjectPool.js";import{watch as s,sync as n}from"../../../core/reactiveUtils.js";import{property as a,subclass as l}from"../../../core/accessorSupport/decorators.js";import{subtract as o,set as c,dot as h}from"../../../core/libs/gl-matrix-2/math/vec3.js";import{ZEROS as d,fromValues as u,create as _}from"../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as g,ZEROS as f}from"../../../core/libs/gl-matrix-2/factories/vec4f64.js";import{create as p,set as m}from"../../../geometry/support/aaBoundingBox.js";import{BufferViewVec3f as y}from"../../../geometry/support/buffer/BufferView.js";import{overlayRenderOccludedFlag as b}from"./OverlayRenderer.js";import{PatchRenderData as x}from"./PatchRenderData.js";import{TerrainAttributesCache as T}from"./TerrainAttributesCache.js";import{enableTerrainInternalChecks as R}from"./terrainUtils.js";import{TileRenderer as v}from"./TileRenderer.js";import{IteratorPreorder as P,fallsWithinLayerView as w,sortTiles as O,compareTiles as S}from"./tileUtils.js";import{getOverlayContentForOutputTerrain as D}from"../webgl-engine/core/shaderLibrary/terrain/Overlay.glsl.js";import{SyncRenderPlugin as B}from"../webgl-engine/effects/RenderPlugin.js";import{Vertices as E}from"../webgl-engine/lib/Attribute.js";import{IntersectorResultRay as F}from"../webgl-engine/lib/IntersectorResult.js";import{intersectAabbInvDirBefore as j,MeshIntersectionOptions as q,intersectTriangles as C}from"../webgl-engine/lib/RayIntersections.js";import{TriangleIntersectionData as A}from"../webgl-engine/lib/TriangleIntersectionData.js";import{terrainId as M,getVerticalOffsetTerrain as G}from"../webgl-engine/lib/verticalOffsetUtils.js";import{DrawParameters as I}from"../webgl-engine/materials/DrawParameters.js";import{hasShadowHighlights as U}from"../webgl-engine/shaders/ReceiveShadowsConfiguration.js";import{T as k}from"../../../chunks/Terrain.glsl.js";import{TerrainTechnique as N}from"../webgl-engine/shaders/TerrainTechnique.js";import{TerrainTechniqueConfiguration as L}from"../webgl-engine/shaders/TerrainTechniqueConfiguration.js";import{PrimitiveType as V}from"../../webgl/enums.js";const H=7,z=10,Q=200,W=p();let Z=class extends B{get visibleTiles(){return Array.from(this._visiblePatchesByOrigin.values()).flat()}get _isGlobal(){return 1===this._stage.viewingMode}get _techniques(){return this._context.techniques}get _rctx(){return this._context.renderContext.rctx}get renderOccludedFlags(){return this._overlayRenderer.renderOccludedFlags}constructor(e,t,s,n,a){super({}),this._overlayRenderer=e,this._stage=t,this._allTiles=s,this._compressionTracker=n,this.type=7,this.isGround=!0,this._passParameters=new k,this._drawParameters=new I,this._renderDataPool=new r(()=>new x),this._visiblePatchesByOrigin=new Map,this._allPatchesByOrigin=new Map,this._patchesByOriginDirty=!0,this._patchSortingDirty=!0,this._tileIterator=new P,this._castShadows=!1,this._inViewshed=!1,this._cutFillEnabled=!1,this._tileRenderer=null,this._stencilEnabledLayerExtents=new Array,this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0,this.produces=new Map([[1,()=>1===this._desiredSlot],[7,()=>7===this._desiredSlot],[9,()=>this._produces()&&this.renderOccludedFlags===b]]),this._tileSize=256,this._configuration=new L(1===t.viewingMode),this._tileTextureCache=new i((e,t)=>a.newCache(e,t),"TileTexture"),this.tileGeometryCache=new T(a)}normalizeCtorArgs(){return{}}initialize(){this._stage.addRenderPlugin(this),this.addHandles(s(()=>this._overlayRenderer.renderOccludedFlags,()=>this.setNeedsRender(),n))}destroy(){this._stage.removeRenderPlugin(this),this._tileTextureCache.destroy(),this.tileGeometryCache.destroy(),this._allTiles.prune(),this._tileRenderer=null}_produces(){return this.visible&&!!this._rootTiles&&!this.renderingDisabled}set renderingDisabled(e){this._set("renderingDisabled",!!e),this.setDirty()}set visible(e){this._set("visible",!!e),this.setDirty()}updateHeading(e){this._tileRenderer?.updateHeading(e)}set transparency(e){this._configuration.transparencyMode!==e&&(this._configuration.transparencyMode=e,this.setNeedsRender())}get transparency(){return this._configuration.transparencyMode}get renderPatchBorders(){return this._configuration.tileBorders}set renderPatchBorders(e){this._configuration.tileBorders!==e&&(this._configuration.tileBorders=e,this.setNeedsRender(),this.notifyChange("renderPatchBorders"))}get layerViewUid(){return M}get slicePlaneEnabled(){return this._configuration.hasSlicePlane}set slicePlaneEnabled(e){this._configuration.hasSlicePlane!==e&&(this._configuration.hasSlicePlane=e,this.setNeedsRender())}set textureFadingEnabled(e){this._configuration.textureFadingEnabled!==e&&(this._configuration.textureFadingEnabled=e,this.setNeedsRender())}set pbrMode(e){this._configuration.pbrMode!==e&&(this._configuration.pbrMode=e,this.setNeedsRender())}setRootTiles(e){this._rootTiles=e,this.setDirty()}setStencilEnabledLayerExtents(e){this._stencilEnabledLayerExtents=e,this._setSortingDirty()}set tileSize(e){this._tileSize=e,null!=this._tileRenderer&&(this._tileRenderer.tileSize=e),this.setDirty()}get tileSize(){return this._tileSize}_ensureRenderData(e){e.renderData||(e.renderData=this._renderDataPool.acquire(),e.renderData.init(e,this._getLocalOriginOfTile(e)))}loadTile(e){this._ensureRenderData(e),this.updateTileGeometryState(e),this.reuseTextureFromParent(e)||this.updateTileTexture(e,32)}reuseTextureFromParent(e){const{parent:t}=e;if(!this._canReuseTextureFromParent(t,e))return!1;const i=g(1&e.lij[2]?.5:0,1&e.lij[1]?0:.5,.5,.5);return t.renderData?.reuseTexture(e.renderData,i)??!1}_canReuseTextureFromParent(e,t){if(!e)return!1;const{layerInfo:i,surface:r}=t;for(let s=0;s<i[1].length;s++){const i=r.layerViewByIndex(s,1);if(w(e,i)!==w(t,i))return!1}return!0}updateTileTexture(e,t){null!=this._tileRenderer&&(this._tileRenderer.updateTileTexture(e,32===t?0:2),this.setNeedsRender(),e.resetPendingUpdate(t))}updateTileGeometryState(e){for(const i of e.layerInfo[0])i.pendingUpdates&=-9;e.resetPendingUpdate(8);const t=e.renderData.updateGeometryState();return t&&this.setDirty(),t}updateGeometryIfNeeded(e){e.loaded&&e.renderData.updateGeometryIfNeeded(this._rctx)}unloadTile(e){const t=e.renderData;t&&(t.releaseGeometry(),this._renderDataPool.release(t),t.clear(),e.renderData=null,e.setMemoryDirty(),this.setDirty())}_getLocalOriginOfTile(e){const t=z-H,i=Math.max(0,Math.floor((e.level-t)/H)*H);if(this._isGlobal&&0===i)return d;for(;e.parent&&e.level>i;)e=e.parent;return e.centerAtSeaLevel}getStats(){return{numTilesRendered:this._numTilesRendered,numTilesCulled:this._numTilesCulled,numOriginsRendered:this._numOriginsRendered}}set wireframe(e){this._get("wireframe")!==e&&(this._set("wireframe",e),this.setNeedsRender())}setDirty(e=1){this._patchesByOriginDirty=!0,this._context.requestRender(e)}_setSortingDirty(e=1){this._patchSortingDirty=!0,this._context.requestRender(e)}setNeedsRender(e=1){this._context.requestRender(e)}initializeRenderContext(e){this._context=e,this._tileRenderer=new v(this._rctx,this._tileSize,this._techniques,this._tileTextureCache,this._compressionTracker),this.updateTileBackground()}uninitializeRenderContext(){this._tileRenderer=t(this._tileRenderer)}intersectRay(e,t,i,r){if(!this._rootTiles||e.options.selectOpaqueTerrainOnly&&e.options.selectionMode&&0!==this.transparency)return;const s=J,n=K;o(s,r,i),c(n,1/s[0],1/s[1],1/s[2]);const a=e.results.min,l=e.results.max,d=e.results.ground,u=0===e.options.store,_=!!e.results.ground.target,g=G(e.verticalOffset),f=e.tolerance;let p,b=u&&null!=a.distance?a.distance:1/0;const x=e.options,T=x.normalRequired||!x.backfacesTerrain,R=new q(f,!1,T),v=c=>{const _=c.renderData;if(!_?.vao)return;const v=_.geometry;m(W,v.boundingBox);const P=_.localOrigin;null!=g&&(g.localOrigin=P,g.applyToAabb(W));const w=W;if(X[0]=i[0]-P[0],X[1]=i[1]-P[1],X[2]=i[2]-P[2],!j(w,X,n,f,b))return;const O=(e,t,i)=>{e.set(this.type,c,t,i),b=u&&null!=a.distance?a.distance:1/0},S=(n,o,c)=>{if((!T||null!=o)&&n>=0&&(x.backfacesTerrain||h(o,s)<0)&&(x.invisibleTerrain||!x.selectionMode||null==t||t(i,r,n))){if((null==d.distance||n<d.distance)&&O(d,n,o),x.isFiltered)return;2===x.store&&(null==p?(p=new F(e.ray),O(p,n,o),e.results.all.push(p)):n<p.distance&&O(p,n,o)),(null==a.distance||n<a.distance)&&O(a,n,o),0!==x.store&&(null==l.distance||n>l.distance)&&O(l,n,o)}},D=Y;o(D,r,P);const{indices:B,indexCount:q}=v,M=v.vertexAttributes,G=M.getField("position",y),I=new E(G.typedBuffer,3,M.stride/4),U=q/3;if(!g&&U>Q){const e=c.renderData;e.intersectionData??=new A(B,U,I),e.intersectionData.intersectRay(X,D,R,S)}else{C(X,D,0,U,(e,t)=>G.getVec(B[t],e),g,R,S)}},P=this._rootTiles;if(null!=P){(()=>{const t=this._tileIterator;t.reset(P);const r=e.options.invisibleTerrain;for(let e=t.next();e;e=t.next())!(e.visible||r&&e.intersectsClippingArea)||null==g&&!e.intersectsRay(i,s,f,b)||_&&this._useStencilForTile(e)?t.skipSubtree():v(e)})()}}processScaleRangeQueries(e,t){if(!t.done&&e)for(this._updatePatchGroups();e.updating&&!t.done;){e.prepare();for(const t of this._visiblePatchesByOrigin.values())for(const i of t)null!=i.renderData?.textureReference&&e.queriesForTile(i);e.process(),t.madeProgress()}}get _desiredSlot(){if(!this._produces())return null;switch(this.transparency){case 0:return 1;case 1:case 2:return 7;case 3:case 4:return null}}acquireTechniques(e){const{shadowMap:t,viewshedEnabled:i,cutFillComputationEnabled:r,slot:s,hasEmission:n,useFloatBlend:a}=e.bind,l=!!has("enable-feature:terrain-shadows")&&t.enabled;if(l!==this._castShadows&&(this._castShadows=l,this._patchesByOriginDirty=!0),this._inViewshed!==i&&(this._inViewshed=i,this._patchesByOriginDirty=!0),this._cutFillEnabled!==r&&(this._cutFillEnabled=r,this._patchesByOriginDirty=!0),3===this.transparency)return null;if(9===s){if(0===(e.renderOccludedMask&b))return null}else if(s!==this._desiredSlot)return null;const o=this._configuration;switch(o.screenSpaceReflections=o.cloudReflections=o.receiveShadows=o.hasShadowHighlights=o.receiveAmbientOcclusion=o.renderOccluded=o.hasHighlightMixTexture=!1,o.hasEmission=n,o.overlayMode=this._overlayRenderer.mode,o.useFloatBlend=a.value,e.output){case 0:case 1:case 2:{const i=e.bind;o.screenSpaceReflections=i.hasScreenSpaceReflections,o.cloudReflections=null!=i.clouds.data;const r=9===s;return o.receiveShadows=t.ready&&!r,o.hasShadowHighlights=U(o,e.bind),o.renderOccluded=r,o.receiveAmbientOcclusion=!r&&null!=i.ssao,o.receiveGlobalIllumination=!r&&i.globalIlluminationEnabled,this._acquireTechnique(e.output)}case 5:case 7:return this._castShadows?this._acquireTechnique(5):null;case 8:return this._inViewshed?this._acquireTechnique(8):null;case 9:return this._cutFillEnabled?this._acquireTechnique(9):null;case 3:case 4:return this._acquireTechnique(e.output);case 11:return this._acquireTechnique(11);case 10:return o.hasHighlightMixTexture=null!=e.bind.highlightMixTexture,this._overlayRenderer.hasHighlights?this._acquireTechnique(10):null}return null}render(e,t){switch(this._updatePatchGroups(),this._passParameters.useStencil=!1,this._passParameters.overlayContent=D(e.output,e.bind),e.output){case 0:case 1:case 2:return this._renderMaterialPass(e,t);case 3:case 4:case 11:return this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);case 10:{const i=e.bind.highlight?.name;i&&this._overlayRenderer.hasHighlights&&this._overlayRenderer.renders(2)&&this._overlayRenderer.hasHighlight(i)&&this._renderAuxiliaryPass(e,t,this._visiblePatchesByOrigin);break}case 5:case 7:case 8:case 9:return this._renderAuxiliaryPass(e,t,this._allPatchesByOrigin)}}updateTileBackground(e){if(null==this._tileRenderer)return;const t=this._tileRenderer;let i;if(null!=e){const t=e.toUnitRGBA();i=u(t[0]||0,t[1]||0,t[2]||0)}t.setBackground(i),this._allTiles.forAll(e=>t.updateTileTexture(e,0)),this._configuration.tileBlendInput=t.backgroundIsGrid?2:null!=t.backgroundColor?1:0,this.setNeedsRender()}_updatePatchGroups(){if(this._patchesByOriginDirty&&(this._rebuildPatchGroups(),this._patchesByOriginDirty=!1,this._patchSortingDirty=!0),this._patchSortingDirty){const e=Array.from(this._visiblePatchesByOrigin.values()),t=this._stencilEnabledLayerExtents;for(const i of e)O(i,t);e.sort((e,t)=>S(e[0],t[0])),this._visiblePatchesByOrigin=new Map(e.map(e=>[e[0].renderData.localOrigin,e])),this.notifyChange("visibleTiles"),this._patchSortingDirty=!1}}_rebuildPatchGroups(){const e=this._rootTiles;if(null!=e){e[0]?.surface.checkAllTilesWaterproofness(),this._visiblePatchesByOrigin.clear(),this._allPatchesByOrigin.clear();for(const t of e)this._rebuildPatchGroupsForRootTile(t)}}_rebuildPatchGroupsForRootTile(e){const t=this._tileIterator;for(t.resetOne(e);!t.done;){const e=t.next(),i=e.renderData;if(!i){this._numTilesCulled++;continue}const r=i.localOrigin;if(this._castShadows||this._inViewshed||this._cutFillEnabled){let t=this._allPatchesByOrigin.get(r);t||(t=[],this._allPatchesByOrigin.set(r,t)),t.push(e)}if(!e.visible){this._numTilesCulled++,t.skipSubtree();continue}let s=this._visiblePatchesByOrigin.get(r);s||(s=[],this._visiblePatchesByOrigin.set(r,s)),s.push(e),t.skipSubtree()}}_useStencilForTile(e){for(const t of this._stencilEnabledLayerExtents)if(e.intersectsExtent(t))return!0;return!1}_renderAuxiliaryPass(e,t,i){const{rctx:r,bind:s}=e;r.bindTechnique(t,s,this._passParameters);const n=this._stencilEnabledLayerExtents.length>0;i.forEach(i=>{this._drawParameters.origin=i[0].renderData.localOrigin,t.program.bindDraw(s,this._passParameters,this._drawParameters);for(let r=0;r<i.length;r++)this._renderPatch(e,t,i[r],V.TRIANGLES,n,null===this._passParameters.overlayContent)}),r.bindVAO(null)}_renderMaterialPass(e,t){const{rctx:i,bind:r}=e,s=i.bindTechnique(t,r,this._passParameters);this._numTilesRendered=0,this._numTilesCulled=0,this._numOriginsRendered=0;const n=9===r.slot;n&&(s.bindTexture("tex",i.emptyTexture),s.setUniform3fv("textureOpacities",d),s.setUniform4fv("texOffsetAndScale",f));const a=null!=this._tileRenderer?.backgroundColor?this._tileRenderer.backgroundColor:d;1===this._configuration.tileBlendInput&&s.setUniform3fv("backgroundColor",a);const l=this._stencilEnabledLayerExtents.length>0,o=this.wireframe?V.LINES:V.TRIANGLES;this._configuration.textureFadingEnabled&&s.bindTexture("texNext",i.emptyTexture);const c=this._visiblePatchesByOrigin;for(const h of c.values()){const i=h[0].renderData.localOrigin;this._drawParameters.origin=i,t.program.bindDraw(r,this._passParameters,this._drawParameters),this._numOriginsRendered++;for(const r of h){const i=r.renderData,a=i.textureReference;if(null!=a){if(!n){s.setUniform4fv("texOffsetAndScale",a.offsetAndScale),s.bindTexture("tex",a.texture.texture);const e=i.textureFadeFactor,t=e<1?i.nextTextureReference:null;this._configuration.textureFadingEnabled&&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(2),s.setUniform3fv("textureOpacities",a.opacities)}this._renderPatch(e,t,r,o,l),r.renderOrder=this._numTilesRendered,this._numTilesRendered++}}}i.bindVAO(null)}_renderPatch(e,t,i,r,s,n=!1){const a=i.renderData,l=a.vao,o=l?.indexBuffer;if(!l||null==o)return void(R&&console.error("Rendered tile with no indices: ",i.lij," : ",a));const c=t.program;n||this._overlayRenderer.isEmpty||this._bindOverlayPatchData(c,a.overlay);const{rctx:h,bind:d}=e;s&&(this._passParameters.useStencil=this._useStencilForTile(i),h.setPipelineState(t.getPipeline(d,this._passParameters)));const u=a.geometry.indexCount;h.bindVAO(l),c.assertCompatibleVertexAttributeLocations(l),h.drawElements(r,u,o.indexType,0)}_bindOverlayPatchData(e,t){e.setUniform4fv("overlayTexOffset",t.offsets),e.setUniform4fv("overlayTexScale",t.scales)}_acquireTechnique(e){return this._configuration.output=e,this._techniques.get(N,this._configuration)}get test(){}hasHighlight(e){return this._overlayRenderer.hasHighlight(e)}};e([a({readOnly:!0})],Z.prototype,"visibleTiles",null),e([a({readOnly:!0})],Z.prototype,"_isGlobal",null),e([a()],Z.prototype,"renderOccludedFlags",null),e([a({value:!1})],Z.prototype,"renderingDisabled",null),e([a({value:!0})],Z.prototype,"visible",null),e([a()],Z.prototype,"renderPatchBorders",null),e([a()],Z.prototype,"wireframe",null),Z=e([l("esri.views.3d.terrain.TerrainRenderer")],Z);const J=_(),K=_(),X=_(),Y=_();export{Z as TerrainRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as r}from"../../../../../geometry/support/frustum.js";import{ElevationAgnosticBVH as o}from"./ElevationAgnosticBVH.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as
|
|
2
|
+
import{copy as e,sub as t}from"../../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as s,fromValues as i}from"../../../../../geometry/support/aaBoundingBox.js";import{intersectsTransformedAabb as r}from"../../../../../geometry/support/frustum.js";import{ElevationAgnosticBVH as o}from"./ElevationAgnosticBVH.js";import{createPositionReader as a}from"../../lib/PositionReader.js";import{intersectRayTrianglesWithVerticalOffsetENUGlobal as l,intersectRayTriangles as h}from"../../lib/RayIntersections.js";import{forEachTriangleRangeScreenPolygonHit as c,Hit as m}from"../../lib/screenPolygonTriangleIntersections.js";import{generateTriangleAabbsLocal as g,generateTriangleAabbsGlobal as y}from"../../lib/triangleIntersectionUtils.js";const u=()=>{};class _{constructor(e,t,s,i,r,a,l,h,c,m,g){this.componentIndex=e,this.vertexData=t,this.vertexStride=s,this.indexData=i,this.startTriangleNumber=r,this.endTriangleNumber=a,this.componentMinZ=l,this.componentMaxZ=h,this.geometryMinZ=c,this.planetCenterZ=m,this.localMode=g,this.maxBspNodeDepth=8,this.minElementCountForBVH=20,this.minBspNodeElementCount=10,this.rayDirection=n(),this.ray0=n(),this.isVerticalRay=!1,this._triangleHitCallback=b,this.totalElevationOffset=0,this.normalRequired=!1,this._screenPolygonDisplacement=null,this._screenPolygonIntersector=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonBestDistance=Number.POSITIVE_INFINITY,this._screenPolygonBestTriangleNumber=-1,this._screenPolygonHasNormal=!1,this._screenPolygonBestNormal=n(),this._screenPolygonBestPoint=n(),this.intersectRange=u,this._bvh=new o(a-r,this)}getAabbs2D(){return this.localMode?g(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride):y(this.startTriangleNumber,this.endTriangleNumber,this.indexData,this.vertexData,this.vertexStride,this.geometryMinZ,this.planetCenterZ)}get numTriangles(){return this.endTriangleNumber-this.startTriangleNumber}intersectRay(n,s,i,r,o,a){e(this.ray0,n),t(this.rayDirection,s,n),this.isVerticalRay=i,this.totalElevationOffset=r,this.normalRequired=a,this.intersectRange=this._intersectRangeRay,this._triangleHitCallback=o,this._bvh.intersectRay(n,s,i),this._triangleHitCallback=b,this.intersectRange=u}intersectScreenPolygon(e,t,n,s,i){this._screenPolygonIntersector=e,this._screenPolygonTransformation=t,this._screenPolygonQuery=n,this._screenPolygonDisplacement=s,this._screenPolygonBestDistance=Number.POSITIVE_INFINITY,this.intersectRange=this._intersectRangeScreenPolygon,this._bvh.intersectNodes(e=>this._couldIntersectScreenPolygonNode(e)),this._screenPolygonBestDistance<Number.POSITIVE_INFINITY&&i(this._screenPolygonBestDistance,this._screenPolygonBestTriangleNumber,this._screenPolygonBestPoint,this._screenPolygonHasNormal?this._screenPolygonBestNormal:null),this._screenPolygonDisplacement=null,this._screenPolygonQuery=null,this._screenPolygonTransformation=null,this._screenPolygonIntersector=null,this.intersectRange=u}_intersectRangeRay(e,t){const n=this._bvh.elementIndexMap;P(this.ray0,this.rayDirection,e,t,this.indexData,this.vertexData,this.vertexStride,this.totalElevationOffset,this.planetCenterZ,this.normalRequired,this._triangleHitCallback,n,this.startTriangleNumber)}_intersectRangeScreenPolygon(t,n){const{_screenPolygonQuery:s,_screenPolygonIntersector:i}=this;if(!s||!i)return;const r=this._bvh.elementIndexMap,o=p(i,this._screenPolygonTransformation,s,t,n,this.indexData,this.vertexData,this.vertexStride,this._screenPolygonDisplacement,r,this.startTriangleNumber);null!=o&&o.distance<this._screenPolygonBestDistance&&(this._screenPolygonBestDistance=o.distance,this._screenPolygonBestTriangleNumber=o.primitiveIndex,this._screenPolygonHasNormal=o.hasNormal,e(this._screenPolygonBestPoint,o.point),o.hasNormal&&e(this._screenPolygonBestNormal,o.normal))}getTriangleElevationOffset(e){return this.totalElevationOffset}_couldIntersectScreenPolygonNode(e){const t=this._screenPolygonQuery;if(null==t)return!1;const n=this._getNodeAabb3D(e,I);return this._screenPolygonDisplacement?.applyToAabb(n),r(t.broadPhaseFrustum,n,this._screenPolygonTransformation)}_getNodeAabb3D(e,t){const[n,s,r,o]=e.aabb2D;if(this.localMode)return i(n,s,this.componentMinZ,r,o,this.componentMaxZ,t);const a=this.geometryMinZ-this.planetCenterZ,l=(this.componentMinZ-this.planetCenterZ)/a,h=(this.componentMaxZ-this.planetCenterZ)/a,c=n*l,m=n*h,g=r*l,y=r*h,u=s*l,_=s*h,P=o*l,p=o*h;return i(Math.min(c,m,g,y),Math.min(u,_,P,p),this.componentMinZ,Math.max(c,m,g,y),Math.max(u,_,P,p),this.componentMaxZ,t)}}function P(e,t,n,s,i,r,o,a,c,m,g,y=null,u=0){0!==a?l(e,t,n,s,i,r,o,a,c,m,g,y,u):h(e,t,n,s,i,r,o,m,g,y,u)}function p(t,n,s,i,r,o,l,h,m,g=null,y=0){let u=Number.POSITIVE_INFINITY,_=-1,P=!1,p=!1;const b=a(l,o,h);for(const a of c(t,n,s,i,r,b,m,g,y))a.distance>=u||(u=a.distance,_=a.primitiveIndex,P=!0,p=a.hasNormal,e(d,a.point),a.hasNormal&&e(N,a.normal));return P?(f.update(u,_,d,p?N:null),f):null}function b(){}const d=n(),N=n(),f=new m(4),I=s();export{_ as ComponentObjectElevationAgnosticComponentGeometryBVH,P as intersectTriangleRangeForComponent,p as intersectTriangleRangeScreenPolygonForComponent};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import t from"../../../../core/PooledArray.js";import{
|
|
2
|
+
import t from"../../../../core/PooledArray.js";import{subtract as r,sqrLen as o,scaleAndAdd as i,min as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{empty as s,expandWithVec3 as c,center as l,width as h,depth as d,height as m,squareDiameter as a}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as f}from"../../../../geometry/support/sphere.js";import{assert as p}from"./Util.js";class u{constructor(t,e,n){this.primitiveIndices=t,this._numIndexPerPrimitive=e,this._readPosition=n,this._children=void 0,p(t.length>=1);const a=t.length;_.clear();const u=s();for(let r=0;r<a;++r){const o=e*t[r];for(let t=0;t<e;++t){const r=o+t;_.push(r),c(u,n(v,r))}}this.box=u;const g=new f,x=l(u,g.center);let P=.5*Math.max(h(u),d(u),m(u)),j=P*P;for(let s=0;s<_.length;++s){const t=n(v,_.at(s)),e=r(t,t,x),c=o(e);if(c<=j)continue;const l=Math.sqrt(c),h=.5*(l-P);P+=h,j=P*P;i(x,x,e,h/l)}g.radius=P,this.sphere=g,_.clear()}get children(){if(this._children)return this._children;const t=this.box;if(a(t)<=1)return;const{_readPosition:r,_numIndexPerPrimitive:o,primitiveIndices:i}=this,n=l(t,v),s=i.length,c=new Uint8Array(s),h=[0,0,0,0,0,0,0,0];for(let l=0;l<s;++l){const t=o*i[l],s=r(g,t);for(let i=1;i<o;++i)e(s,s,r(x,t+i));const d=(s[0]<n[0]?1:0)|(s[1]<n[1]?2:0)|(s[2]<n[2]?4:0);c[l]=d,++h[d]}let d=0;for(let e=0;e<8;++e)h[e]>0&&++d;if(d<2)return;const m=[void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0];for(let e=0;e<8;++e)h[e]>0&&(m[e]=new Uint32Array(h[e]));h.fill(0);for(let e=0;e<s;++e){const t=c[e];m[t][h[t]++]=i[e]}const f=new Array;for(let e=0;e<8;++e){const t=m[e];void 0!==t&&f.push(new u(t,o,r))}return this._children=f,this._children}static prune(){_.prune()}}const v=n(),g=n(),x=n(),_=new t({deallocator:null});export{u as BoundingInfo};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as
|
|
2
|
+
import{__decorate as e}from"tslib";import{watch as t}from"../../../../core/reactiveUtils.js";import{property as i,subclass as s}from"../../../../core/accessorSupport/decorators.js";import{set as a}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{copy as r,set as n,scale as o,floor as h,subtract as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{create as p,set as m,positiveInfinity as c,equals as d}from"../../../../geometry/support/aaBoundingBox.js";import{InternalRenderCategory as _}from"../../webgl.js";import{addWraparound as g}from"../../layers/i3s/I3SUtil.js";import C from"../../webgl/RenderNode.js";import{G as P}from"../../../../chunks/GaussianSplat.glsl.js";import{G as f}from"../../../../chunks/GaussianSplatComposition.glsl.js";import{GaussianSplatCompositionTechnique as b}from"../shaders/GaussianSplatCompositionTechnique.js";import{GaussianSplatCompositionTechniqueConfiguration as v}from"../shaders/GaussianSplatCompositionTechniqueConfiguration.js";import{G as S}from"../../../../chunks/GaussianSplatDepthComposition.glsl.js";import{GaussianSplatDepthCompositionTechnique as x}from"../shaders/GaussianSplatDepthCompositionTechnique.js";import{GaussianSplatTechnique as q}from"../shaders/GaussianSplatTechnique.js";import{GaussianSplatTechniqueConfiguration as R}from"../shaders/GaussianSplatTechniqueConfiguration.js";import{ColorAttachment1 as w,DepthStencilAttachment as E,PrimitiveType as T}from"../../../webgl/enums.js";var D;let y=class extends C{static{D=this}constructor(e){super(e),this.consumes={required:[_.GAUSSIAN_SPLAT]},this.produces=_.GAUSSIAN_SPLAT,this._slicePlaneEnabled=!1,this.layerView=null,this._passParameters=new P,this._compositionPassParameters=new f,this._depthCompositionPassParameters=new S,this._compositionConfiguration=new v,this._clipBox=p(),this._previousCameraDirection=u(),this._previousSortRequestCameraDirection=u(),this._tileCullingRevision=0,this._sortRequestDirectionEpsilon=.01,this._directionChangeEpsilon=.001,this._configuration=new R(e.view.state.isGlobal),m(this._clipBox,c)}async initialize(){this.addHandles([t(()=>this.view.state.camera,()=>this._onCameraChange()),t(()=>2===this.view.state.mode,()=>this.requestRender(1))])}precompile(){this._canRender&&(this._updateConfigurations(),this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=this.bindParameters.hasOpaqueEmission,this.techniques.precompile(q,this._configuration),this.techniques.precompile(b,this._compositionConfiguration),this.techniques.precompile(x))}render(){const e=this.input;if(this._updateConfigurations(),this._handleFading(),!this._canRender)return e;const t=e.getAttachment(w);this._compositionConfiguration.useFloatBlend=this.bindParameters.useFloatBlend.value,this._compositionConfiguration.hasEmission=null!=t;const{fullWidth:i,fullHeight:s}=this.bindParameters.camera;this._prepareParameters(s,i);const a=this.renderingContext,r=this.fboCache,n=r.acquire(i,s,"gaussian color output"),o=e.getAttachment(E);n.attachDepth(o);const h=this.techniques.get(q,this._configuration);this._renderGaussianColorAndDepth(n,h);const l=r.acquire(i,s,this.produces);this._depthCompositionPassParameters.splatDepth=n.getTexture(w),l.attachDepth(e.getAttachment(E)),a.bindFramebuffer(l.fbo);const u=this.techniques.get(x);a.bindTechnique(u,this.bindParameters,this._depthCompositionPassParameters),a.screen.draw(),this._compositionPassParameters.color=e.getTexture(),this._compositionPassParameters.splatColor=n.getTexture(),t?(l.acquireColor(w,8,"emissive"),this._compositionPassParameters.emission=e.getTexture(w)):this._compositionPassParameters.emission=null,a.bindFramebuffer(l.fbo);const p=this.techniques.get(b,this._compositionConfiguration);return a.bindTechnique(p,this.bindParameters,this._compositionPassParameters),a.screen.draw(),n.release(),l}get slicePlaneEnabled(){return this._slicePlaneEnabled}set slicePlaneEnabled(e){this._slicePlaneEnabled!==e&&(this._slicePlaneEnabled=e,this.requestRender(1))}set clippingBox(e){const t=e||c;this._hasSameClipBox(t)||(m(this._clipBox,t),this._tileCullingRevision=g(this._tileCullingRevision,1),this._data.requestSort(),this.requestRender(1))}get clippingBox(){return this._clippingEnabled?this._clipBox:null}get tileCullingRevision(){return this._tileCullingRevision}get _clippingEnabled(){return!d(this._clipBox,c,(e,t)=>e===t)}get _isIdle(){return 2===this.view.state.mode}get _data(){return this.layerView.data}get _canRender(){return this._data.visibleGaussians>0&&null!=this._data.orderTexture.texture&&null!=this._data.textureAtlas.texture&&null!=this._data.headerTexture.texture}get _fadeHelper(){return this.layerView.fadeHelper}_updateConfigurations(){const{idleMinimumOpacity:e,nonIdleMinimumOpacity:t}=this.view.qualitySettings.gaussianSplat;this._configuration.alphaCutoff=this._isIdle?e:t,this._configuration.fadingEnabled=this._fadeHelper.fadingEnabled,this._configuration.receiveShadows=this.bindParameters.shadowMap.ready,this._configuration.hasShadowHighlights=this._configuration.receiveShadows&&this.bindParameters.hasShadowHighlights,this._configuration.clippingEnabled=this._clippingEnabled,this._configuration.hasSlicePlane=this._slicePlaneEnabled&&null!=this.bindParameters.slicePlane}_onCameraChange(){this._tileCullingRevision=g(this._tileCullingRevision,1);const e=this.view.state.camera.ray.direction;if(!this._directionChanged(e))return;if(r(this._previousCameraDirection,e),!this._shouldRequestSort(e))return;this._data.requestSort()&&r(this._previousSortRequestCameraDirection,e)}_directionChanged(e){return Math.abs(e[0]-this._previousCameraDirection[0])>this._directionChangeEpsilon||Math.abs(e[1]-this._previousCameraDirection[1])>this._directionChangeEpsilon||Math.abs(e[2]-this._previousCameraDirection[2])>this._directionChangeEpsilon}_shouldRequestSort(e){return Math.abs(e[0]-this._previousSortRequestCameraDirection[0])>this._sortRequestDirectionEpsilon||Math.abs(e[1]-this._previousSortRequestCameraDirection[1])>this._sortRequestDirectionEpsilon||Math.abs(e[2]-this._previousSortRequestCameraDirection[2])>this._sortRequestDirectionEpsilon}_prepareParameters(e,t){this._passParameters.splatOrder=this._data.orderTexture.texture,this._passParameters.splatFading=this._data.fadingTexture.texture,this._passParameters.splatAtlas=this._data.textureAtlas.texture,this._passParameters.splatHeader=this._data.headerTexture.texture;const i=Math.tan(.5*this.camera.fovY),s=i/e*t;a(this._passParameters.tanFov,s,i),this._passParameters.focalLength=e/(2*i);const n=this.view.qualitySettings.gaussianSplat,o=this._isIdle?n.idleMinimumSplatPixelRadius:n.nonIdleMinimumSplatPixelRadius;this._passParameters.minSplatRadius=o*Math.sqrt(t*e)/Math.sqrt(2073600),r(this._passParameters.origin,this.bindParameters.camera.eye),this._prepareHighPrecisionCameraPosition(),this._updateSlicePlaneLocalOrigin(),this._updateClipUniforms()}_updateClipUniforms(){const e=this.clippingBox||c,[t,i,s,a,r,o]=e,[h,l,u]=this.camera.eye,{clipMinCameraRelative:p,clipMaxCameraRelative:m}=this._passParameters;n(p,t-h,i-l,s-u),n(m,a-h,r-l,o-u)}_updateSlicePlaneLocalOrigin(){this._passParameters.slicePlaneLocalOrigin=this.camera.eye}_hasSameClipBox(e){return d(this._clipBox,e,(e,t)=>e===t)}_renderGaussianColorAndDepth(e,t){const i=this.renderingContext;e.acquireColor(w,5,"gaussian depth output"),i.bindFramebuffer(e.fbo),i.setClearColor(0,0,0,0),i.clear(16384),this.renderingContext.bindTechnique(t,this.bindParameters,this._passParameters),this.renderingContext.drawArraysInstanced(T.TRIANGLE_STRIP,0,4,this._data.visibleGaussians)}_prepareHighPrecisionCameraPosition(){o(this._passParameters.tileCameraPosition,this.camera.eye,1/D.tileSize),h(this._passParameters.tileCameraPosition,this._passParameters.tileCameraPosition),o(this._passParameters.cameraDelta,this._passParameters.tileCameraPosition,D.tileSize),l(this._passParameters.cameraDelta,this.camera.eye,this._passParameters.cameraDelta)}_handleFading(){if(0===this._fadeHelper.numFadingTiles)return void(this._previousFrameStart=null);this._previousFrameStart??=this.view.stage.renderer.renderContext.time;const e=this.view.stage?.renderer.renderContext.time-this._previousFrameStart;this._fadeHelper.updateAllTileFading(e),this._previousFrameStart=this.view.stage.renderer.renderContext.time,this._data.fadingTexture.updateTexture(this._data.textureAtlas.pageAllocator.pageCount)}static{this.tileSize=2.048}};e([i()],y.prototype,"consumes",void 0),e([i()],y.prototype,"produces",void 0),e([i({constructOnly:!0})],y.prototype,"layerView",void 0),y=D=e([s("esri.views.3d.webgl-engine.lib.GaussianSplatRenderer")],y);export{y as GaussianSplatRenderer};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{
|
|
2
|
+
import{IDENTITY as t,clone as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as e}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as s}from"../../../../geometry/support/Indices.js";import{cloneAttributeData as n}from"./AttributeArray.js";import{BoundingInfo as o}from"./BoundingInfo.js";import{GeometryBaseInstance as r}from"./GeometryBaseInstance.js";import{computeAttachmentOriginTriangles as h,computeAttachmentOriginLines as a,computeAttachmentOriginPoints as u}from"./geometryDataUtils.js";import{Object3DHighlightStateID as g}from"./Object3DStateID.js";import{createPositionAttributeReader as l}from"./PositionReader.js";import{assert as d}from"./Util.js";import{webglDebugEnabled as c}from"../../../webgl/checkWebGLError.js";class m extends r{constructor(t,i,e=null,s=0,n=null,o=-1,r,h){super(i),this.material=t,this.mapPositions=e,this.type=s,this.olidColor=n,this.edgeIndicesLength=o,this.baseGeometry=r,this.drawIndices=h,this._readPrimitivePosition=null,this._vertexPositionIndicesCache=void 0,this._highlights=null,this._highlightOptionsCounts=null,this.visible=!0,this._boundingInfo=null,d((t?.useIndexing??!1)===(null!=h),"Material index requirement and Geometry must match"),this.edgeIndicesLength<0&&(this.edgeIndicesLength=this.indexCount)}get readPrimitivePosition(){return this._readPrimitivePosition??=l(this.positionAttribute,this.drawIndices),this._readPrimitivePosition}_invalidateReadPrimitivePosition(){this._readPrimitivePosition=null}instantiate(t={}){const i=new m(t.material||this.material,[],this.mapPositions,this.type,this.olidColor,this.edgeIndicesLength,this.baseGeometry,this.drawIndices);return this._attributes.forEach((t,e)=>{t.exclusive=!1,i._attributes.set(e,t)}),i._boundingInfo=this._boundingInfo,i.transformation=t.transformation||this.transformation,i}getMutableAttribute(t){let i=this._attributes.get(t);return i&&!i.exclusive&&(i={...i,exclusive:!0,data:n(i.data)},this._attributes.set(t,i),"position"===t&&this._invalidateReadPrimitivePosition()),i}setAttributeData(t,i){const e=this._attributes.get(t);e?(this._attributes.set(t,{...e,exclusive:!0,data:i}),"position"===t&&this._invalidateReadPrimitivePosition()):c()&&console.warn(`Setting undefined attribute ${t} data`)}get primitivePositionIndices(){return void 0!==this._vertexPositionIndicesCache||(this._vertexPositionIndicesCache=this._computePrimitivePositionIndices()),this._vertexPositionIndicesCache}_computePrimitivePositionIndices(){const{drawIndices:t}=this,i=this.positionAttribute;if(null!=t&&null!=i){const e=new Array;for(const s of t)e.push(i.indices[s]);return e}return i?.indices??null}get positionAttribute(){return this.attributes.get("position")??this.baseGeometry?.attributes.get("position")}get indexCount(){const t=this.drawIndices??this.positionAttribute?.indices;return t?.length??0}get faceCount(){return this.indexCount/3}get boundingInfo(){return this._boundingInfo??=this._calculateBoundingInfo(),this._boundingInfo}computeAttachmentOrigin(t){return!!this._calculateAttachmentOrigin(t)&&(null!=this._transformation&&e(t,t,this._transformation),!0)}_calculateAttachmentOrigin(t){return 0===this.type?this._computeAttachmentOriginTriangles(t):2===this.type?this._computeAttachmentOriginLines(t):this._computeAttachmentOriginPoints(t)}_computeAttachmentOriginTriangles(t){return h(t,this.readPrimitivePosition,this.indexCount/3)}_computeAttachmentOriginLines(t){const{indexCount:i}=this;return a(t,this.readPrimitivePosition,i,_(this.material.parameters,i))}_computeAttachmentOriginPoints(t){return u(t,this.readPrimitivePosition,this.indexCount)}invalidateBoundingInfo(){this._boundingInfo=null,this._vertexPositionIndicesCache=void 0}_calculateBoundingInfo(){const t=this.positionAttribute,i=this.indexCount;if(!t||0===i)return null;const e=0===this.type?3:1;d(i%e===0,"Indexing error: "+i+" not divisible by "+e);const n=s(i/e);return new o(n,e,this.readPrimitivePosition)}get transformation(){return this._transformation??t}set transformation(e){this._transformation=e&&e!==t?i(e):null}get highlights(){return this._highlights||p}get hasHighlights(){return(this._highlightOptionsCounts?.size??0)>0}foreachHighlightOptions(t){this._highlightOptionsCounts?.forEach((i,e)=>t(e))}allocateIdAndHighlight(t){const i=new g(t);return this.addHighlight(i)}addHighlight(t){this._ensureHighlights().add(t);const{highlightName:i}=t,e=(this._highlightOptionsCounts?.get(i)??0)+1;return this._ensureHighlightOptionsCounts().set(i,e),t}_ensureHighlights(){let t=this._highlights;return t||(t=new Set,this._highlights=t),t}_ensureHighlightOptionsCounts(){let t=this._highlightOptionsCounts;return t||(t=new Map,this._highlightOptionsCounts=t),t}removeHighlight(t){if(this._highlights?.delete(t)){const{highlightName:i}=t,e=this._highlightOptionsCounts?.get(i)??0;e<=1?this._highlightOptionsCounts?.delete(i):this._ensureHighlightOptionsCounts().set(i,e-1)}}}function _(t,i){return!(!("isClosed"in t)||!t.isClosed)&&i>2}const p=new Set;export{m as Geometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{recordPerformance as t}from"../../../../core/performance.js";import{createAbortError as
|
|
2
|
+
import"../../../../core/has.js";import{abortMaybe as e}from"../../../../core/maybe.js";import{recordPerformance as t}from"../../../../core/performance.js";import{createAbortError as r}from"../../../../core/promiseUtils.js";import{Milliseconds as s}from"../../../../core/time.js";import a from"../../webgl/RenderCamera.js";import{NavigationDepthCacheStore as i,navigationDepthReductionFactor as h}from"./NavigationDepthCacheStore.js";import{N as d}from"../../../../chunks/NavigationDepth.glsl.js";import{NavigationDepthTechnique as o}from"../shaders/NavigationDepthTechnique.js";import{PixelType as n}from"../../../webgl/enums.js";const c=h,_=s(250);class l{constructor(e,t,r,h){this._rctx=e,this._fboCache=t,this._techniques=r,this._requestRender=h,this._store=new i,this._passParameters=new d,this._updateWaiters=new Array,this._readbackCamera=new a,this._destroyed=!1,this._readbackPending=!1,this._lastUpdateTime=s(-1/0),this._immediateUpdateId=0,this._abortController=new AbortController}destroy(){this._destroyed=!0,this._withUpdateWaiters(e=>e.reject(r())),this._abortController=e(this._abortController),this._releaseReadbackHandles()}update(e,r,a){const{camera:i}=e;if(this._destroyed||this._readbackPending||a-this._lastUpdateTime<_||i.fullWidth<=0||i.fullHeight<=0)return;const h=this._techniques.getCompiled(o);if(!h)return void this._requestRender();const d=performance.now();this._lastUpdateTime=a;const l=Math.ceil(i.fullWidth/c),m=Math.ceil(i.fullHeight/c),p=Math.ceil(l/c),u=Math.ceil(m/c),f=p*u,b=this._ensureReadbackBuffer(f);this._readbackCamera.copyFrom(i);const g=this._fboCache.acquire(l,m,"navigation depth",7);this._readbackImmediateHandle=g;const k=this._fboCache.acquire(p,u,"navigation depth",10);this._readbackHandle=k,this._passParameters.depthTexture=r,this._passParameters.depthTextureSize=[i.fullWidth,i.fullHeight],this._passParameters.cellSize=c,this._passParameters.reduced=!1,this._rctx.bindFramebuffer(g.fbo),this._rctx.setViewport(0,0,l,m),this._rctx.bindTechnique(h,e,this._passParameters),this._rctx.screen.draw(),this._passParameters.depthTexture=g.getTexture(),this._passParameters.depthTextureSize=[l,m],this._passParameters.reduced=!0,this._rctx.bindFramebuffer(k.fbo),this._rctx.setViewport(0,0,p,u),this._rctx.bindTechnique(h,e,this._passParameters),this._rctx.screen.draw(),this._readbackPending=!0;const w=this._immediateUpdateId;k.fbo.readPixelsAsync(0,0,p,u,6403,n.FLOAT,b,this._abortController?.signal).then(()=>{this._destroyed||(this._store.setDepthData(b.slice(0,f),p,u,this._readbackCamera),w===this._immediateUpdateId?this._withUpdateWaiters(e=>e.resolve()):(this._lastUpdateTime=s(-1/0),this._requestRender()))}).catch(()=>this._withUpdateWaiters(e=>e.reject())).finally(()=>{this._releaseReadbackHandles(),this._readbackPending=!1,t("NavigationDepthCache update",d,performance.now(),"Maps SDK","Scheduling")}),i.setGLViewport(this._rctx)}getMinimalDepthForArea(e,t,r,s,a=s){return this._store.getMinimalDepthForArea(e,t,r,s,a)}async whenRepresentativeDepthForArea(e,t,r,s,a,i=1){const h=this._store.getRepresentativeDepthForArea(e,t,r,s,a,i);return null!=h?h:(await this._requestImmediateUpdate(),this._store.getRepresentativeDepthForArea(e,t,r,s,a,i))}_requestImmediateUpdate(){if(this._destroyed)return Promise.reject(r());const e=Promise.withResolvers();return this._updateWaiters.push(e),this._immediateUpdateId++,this._lastUpdateTime=s(-1/0),this._requestRender(),e.promise}_ensureReadbackBuffer(e){return(null==this._readbackBuffer||this._readbackBuffer.length<e)&&(this._readbackBuffer=new Float32Array(e)),this._readbackBuffer}_withUpdateWaiters(e){const t=this._updateWaiters.slice();this._updateWaiters.length=0;for(const r of t)e(r)}_releaseReadbackHandles(){this._readbackHandle?.release(),this._readbackHandle=null,this._readbackImmediateHandle?.release(),this._readbackImmediateHandle=null}get test(){return null}}export{l as NavigationDepthCache};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{floatEqualRelative as t}from"../../../../core/mathUtils.js";import{createRenderScreenPointArray3 as e}from"../../../../core/screenUtils.js";import{set as h,add as r,scale as i,subtract as a,transformMat4Z as l}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as n}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import s from"../../webgl/RenderCamera.js";const o=4,c=o*o,u=1,p=2*c,m=.5,f=.005,_=32,d=.2;class g{constructor(t,e){this.depth=t,this.weight=e}}class M{constructor(){this._camera=new s,this._weightedDepthSamples=new Array,this._width=0,this._height=0}setDepthData(t,e,h,r){this._data=t,this._width=e,this._height=h,this._camera.copyFrom(r),this._nearFar=[this._camera.nearFar[0],this._camera.nearFar[1]]}getMinimalDepthForArea(t,e,h,r,i=r){const a=this._weightedDepthSamples;if(null==this._collectDepthSamplesForArea(t,e,h,r,i,a,!1))return null;let l=Number.MAX_VALUE;for(const n of a)n.depth<l&&(l=n.depth);return l===Number.MAX_VALUE?null:l}getRepresentativeDepthForArea(e,h,r,i,a,l=1){const n=this._weightedDepthSamples,s=this._collectDepthSamplesForArea(e,h,r,i,a,n,!0);if(null==s)return null;n.sort((t,e)=>t.depth-e.depth);const o=t(n[0].depth,n[n.length-1].depth,f),c=s*l;let u=0;for(const t of n)if(u+=t.weight,u>=c)return{depth:t.depth,isUniform:o};return{depth:n[n.length-1].depth,isUniform:o}}_collectDepthSamplesForArea(t,e,h,r,i,a,l){if(null==this._data||null==this._nearFar||!this._hasCompatibleCameraResolution(h))return null;const n=h.constrainWindowSize(t,e,r*h.pixelRatio,i*h.pixelRatio),s=this._camera.fullWidth/h.fullWidth,o=this._camera.fullHeight/h.fullHeight,u=Math.max(Math.floor(n[0]*s/c),0),p=Math.max(Math.floor(n[1]*o/c),0),m=Math.min(Math.ceil((n[0]+n[2])*s/c),this._width),f=Math.min(Math.ceil((n[1]+n[3])*o/c),this._height),_=.5*(u+m),d=.5*(p+f),M=Math.max(.5*(m-u),1),D=Math.max(.5*(f-p),1);a.length=0;let S=0,w=0,j=0;for(let c=p;c<f;++c)for(let t=u;t<m;++t){const e=this._data[t+c*this._width];if(!R(e))continue;w++;const r=this._reprojectCachedDepth(e,t,c,h,n);if(null==r)continue;j++;const i=(t+.5-_)/M,s=(c+.5-d)/D,o=(l?1/(1+4*(i*i+s*s)):1)*(l?this._getScreenFacingWeight(this._data,t,c,r,h,n):1);a.push(new g(r,o)),S+=o}return this._hasSufficientReprojectedSamples(w,j)&&0!==a.length?S:null}_getScreenFacingWeight(t,e,h,r,i,a){const l=this._getDepthSlope(t,e,h,r,i,a,1,0),n=this._getDepthSlope(t,e,h,r,i,a,0,1),s=Math.hypot(l,n);return Math.max(d,1/(1+_*s))}_getDepthSlope(t,e,h,r,i,a,l,n){return Math.max(this._getReprojectedDepthDifference(t,e-l,h-n,r,i,a),this._getReprojectedDepthDifference(t,e+l,h+n,r,i,a))}_getReprojectedDepthDifference(t,e,h,r,i,a){if(e<0||e>=this._width||h<0||h>=this._height)return 0;const l=t[e+h*this._width];if(!R(l))return 0;const n=this._reprojectCachedDepth(l,e,h,i,a);return null!=n?Math.abs(n-r)/Math.max(Math.abs(r),Math.abs(n),1):0}_reprojectCachedDepth(t,e,n,s,o){const u=e*c,m=n*c,f=.5*(u+Math.min(u+c,this._camera.fullWidth)),_=.5*(m+Math.min(m+c,this._camera.fullHeight));if(h(D,f,_,0),h(S,f,_,1),null==this._camera.unprojectFromRenderScreen(D,j)||null==this._camera.unprojectFromRenderScreen(S,x))return null;r(F,j,i(x,a(x,x,j),t));const d=-l(F,s.viewMatrix);if(d<=s.near||d>=s.far)return null;const g=w;return null==s.projectToRenderScreen(F,g)?null:g[0]>=o[0]-p&&g[0]<=o[0]+o[2]+p&&g[1]>=o[1]-p&&g[1]<=o[1]+o[3]+p?d:null}_hasSufficientReprojectedSamples(t,e){if(0===t)return!1;return e>=Math.min(t,2)&&e/t>=m}_hasCompatibleCameraResolution(t){const{fullWidth:e,fullHeight:h}=this._camera;if(e<=0||h<=0||t.fullWidth<=0||t.fullHeight<=0)return!1;return Math.abs(e*t.fullHeight-h*t.fullWidth)<=Math.max(e,h,t.fullWidth,t.fullHeight)}}const D=e(),S=e(),w=e(),j=n(),x=n(),F=n();function R(t){return t>0&&t<u}export{M as NavigationDepthCacheStore,o as navigationDepthReductionFactor};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{lerp as a,transformMat4 as h,distance as n,set as m,add as d,exactEquals as l,copy as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as c,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getMin as _,getMax as f}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{maxScale as v}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as p,Object3DHighlightStateID as y}from"./Object3DStateID.js";import{assert as j}from"./Util.js";import{affectsGeometry as
|
|
2
|
+
import"../../../../core/has.js";import{generateUID as t}from"../../../../core/uid.js";import{multiply as i,copy as e,hasIdentityRotation as s}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as o,IDENTITY as r}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{lerp as a,transformMat4 as h,distance as n,set as m,add as d,exactEquals as l,copy as g}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{fromValues as c,create as u}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{getMin as _,getMax as f}from"../../../../geometry/support/aaBoundingBox.js";import{Sphere as b}from"../../../../geometry/support/sphere.js";import{maxScale as v}from"../../support/mathUtils.js";import{Object3DOccludeeStateID as p,Object3DHighlightStateID as y}from"./Object3DStateID.js";import{assert as j}from"./Util.js";import{affectsGeometry as x}from"./VertexAttribute.js";import{addObject3DStateID as V,removeObject3DStateID as S}from"../materials/renderers/utils.js";class W{constructor(i={}){this.id=t(),this._highlightIds=new Set,this._shaderTransformation=null,this._visible=!0,this.castShadow=i.castShadow??!0,this.usesVerticalDistanceToGround=i.usesVerticalDistanceToGround??!1,this.graphicUid=i.graphicUid,this.layerViewUid=i.layerViewUid,i.isElevationSource&&(this.lastValidElevationBB=new A),this._geometries=i.geometries?Array.from(i.geometries):[]}dispose(){this._geometries.length=0}get layer(){return this._layer}set layer(t){j(null==this._layer||null==t,"Object3D can only be added to a single Layer"),this._layer=t}addGeometry(t){t.visible=this._visible,this._geometries.push(t);for(const i of this._highlightIds)t.addHighlight(i);this._emit("geometryAdded",{object:this,geometry:t}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}removeGeometry(t){const i=this._geometries.splice(t,1)[0];if(i){for(const t of this._highlightIds)i.removeHighlight(t);this._emit("geometryRemoved",{object:this,geometry:i}),this._highlightIds.size&&this._emit("highlightChanged",this),this._invalidateBoundingVolume()}}removeAllGeometries(){for(;this._geometries.length>0;)this.removeGeometry(0)}geometryVertexAttributeUpdated(t,i,e=!1){this._emit("attributesChanged",{object:this,geometry:t,attribute:i,sync:e}),x(i)&&this._invalidateBoundingVolume()}get visible(){return this._visible}set visible(t){if(this._visible!==t){this._visible=t;for(const t of this._geometries)t.visible=this._visible;this._emit("visibilityChanged",this)}}maskOccludee(){const t=new p;for(const i of this._geometries)i.occludees=V(i.occludees,t);return this._emit("occlusionChanged",this),t}removeOcclude(t){for(const i of this._geometries)i.occludees=S(i.occludees,t);this._emit("occlusionChanged",this)}highlight(t){const i=new y(t);for(const e of this._geometries)e.addHighlight(i);return this._emit("highlightChanged",this),this._highlightIds.add(i),i}removeHighlight(t){this._highlightIds.delete(t);for(const i of this._geometries)i.removeHighlight(t);this._emit("highlightChanged",this)}removeStateID(t){0===t.channel?this.removeHighlight(t):this.removeOcclude(t)}getCombinedStaticTransformation(t,e){return i(e,this.transformation,t.transformation)}getCombinedShaderTransformation(t,e=o()){return i(e,this.effectiveTransformation,t.transformation)}get boundingVolumeWorldSpace(){return this._bvWorldSpace||(this._bvWorldSpace=new T,this._validateBoundingVolume(this._bvWorldSpace,0)),this._bvWorldSpace}get boundingVolumeObjectSpace(){return this._bvObjectSpace||(this._bvObjectSpace=new T,this._validateBoundingVolume(this._bvObjectSpace,1)),this._bvObjectSpace}_validateBoundingVolume(t,i){const e=1===i;for(const s of this._geometries){const i=s.boundingInfo;i&&B(i,t,e?s.transformation:this.getCombinedShaderTransformation(s))}a(t.bounds.center,t.min,t.max,.5);for(const s of this._geometries){const i=s.boundingInfo;if(null==i)continue;const o=e?s.transformation:this.getCombinedShaderTransformation(s),r=v(o);h(O,i.sphere.center,o);const a=n(O,t.bounds.center),m=i.sphere.radius*r;t.bounds.radius=Math.max(t.bounds.radius,a+m)}}_invalidateBoundingVolume(){const t=this._bvWorldSpace?.bounds;this._bvObjectSpace=this._bvWorldSpace=void 0,this.layer&&t&&this.layer.notifyObjectBBChanged(this,t)}_emit(t,i){this.layer?.events.emit(t,i)}get geometries(){return this._geometries}get transformation(){return this._transformation??r}set transformation(t){this._transformation=e(this._transformation??o(),t),this._invalidateBoundingVolume(),this._emit("transformationChanged",this)}get shaderTransformation(){return this._shaderTransformation}set shaderTransformation(t){this._shaderTransformation=t?e(this._shaderTransformation??o(),t):null,this._invalidateBoundingVolume(),this._emit("shaderTransformationChanged",this)}get effectiveTransformation(){return this.shaderTransformation??this.transformation}get test(){}}class A{constructor(){this._data=[Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE]}get min(){return c(this._data[0],this._data[1],this._data[2])}get max(){return c(this._data[3],this._data[4],this._data[5])}minWith(t){const{_data:i}=this;i[0]=Math.min(i[0],t[0]),i[1]=Math.min(i[1],t[1]),i[2]=Math.min(i[2],t[2])}maxWith(t){const{_data:i}=this;i[3]=Math.max(i[3],t[0]),i[4]=Math.max(i[4],t[1]),i[5]=Math.max(i[5],t[2])}assignMinMax(t,i){for(let e=0;e<3;++e)this._data[0+e]=t[e],this._data[3+e]=i[e]}isEmpty(){return this._data[3]<this._data[0]&&this._data[4]<this._data[1]&&this._data[5]<this._data[2]}}class T extends A{constructor(){super(...arguments),this.bounds=new b}}function B(t,i,e){const o=t.box,r=_(o,w),a=f(o,I);if(s(e)){const t=m(C,e[12],e[13],e[14]);return d(M,r,t),d(U,a,t),i.minWith(M),void i.maxWith(U)}if(h(M,r,e),l(r,a))return i.minWith(M),void i.maxWith(M);h(U,a,e),i.minWith(M),i.minWith(U),i.maxWith(M),i.maxWith(U);for(let s=0;s<3;++s)g(M,r),g(U,a),M[s]=a[s],U[s]=r[s],h(M,M,e),h(U,U,e),i.minWith(M),i.minWith(U),i.maxWith(M),i.maxWith(U)}const C=u(),M=u(),U=u(),O=u(),w=u(),I=u();export{T as BoundingVolume,W as Object3D};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{floatSubArray as t}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as e}from"../../../../geometry/support/HalfFloatArray.js";import{newIndexArray as i,compactIndices as s}from"../../../../geometry/support/Indices.js";import{newShortArray as r}from"../../../../geometry/support/ShortArray.js";import{compressNormal as o,encodeInt16 as n}from"./Normals.js";import{PathEvaluator as h}from"./PathEvaluator.js";import{encodePathVertexInfo as a}from"./PathVertexInfo.js";class u{constructor(s,o,n,a,u){this.path=s,this.profile=o,this.extruder=n,this.cap=a,this._extrusionVertexCount=0,this._extrusionFrameCount=0;const p=this.path.vertices.length-2;this.numExtrusionProfiles=n.numProfilesPerJoin()*p+2,this.numVerticesTotal=o.vertices.length*this.numExtrusionProfiles,this.numExtrusionFrames=this.path.vertices.length;const m=this.cap.numVertices;this.startCapVertexBufferStart=this.numVerticesTotal,this.numVerticesTotal+=m,this.endCapVertexBufferStart=this.numVerticesTotal,this.numVerticesTotal+=m,this.profileRightAxes=r(2*this.numExtrusionFrames),this.profileUpAxes=r(2*this.numExtrusionFrames);const l=1===u;this.profileRotationFrameUpAxes=l?r(2*this.numExtrusionFrames):null,this.pathMaxStretchDistances=e(this.numExtrusionFrames),this.profileRotations=r(this.numExtrusionFrames),this.framePositionIndices=i(this.numExtrusionFrames),this.pathVertexInfos=new Uint32Array(this.numVerticesTotal),this.positions=t(s.positions,s.offset,3*s.vertices.length),this._rebuildGeometry(),this._buildTopology(),this.evaluator=new h(this,o,this.extruder.numBendSubdivisions,a.type,n.cutoffAngle,u)}emitVertexDescriptor(t){const e=this._extrusionVertexCount;this.pathVertexInfos[e]=a(t),++this._extrusionVertexCount}emitExtrusionFrame(t,e){const{frame:i,rotationFrameUp:s,rotationAngle:r,maxStretchDistance:h}=t,a=this._extrusionFrameCount;return o(this.profileRightAxes,a,i.right[0],i.right[1],i.right[2]),o(this.profileUpAxes,a,i.up[0],i.up[1],i.up[2]),this.profileRotations[a]=n(r/Math.PI),this.profileRotationFrameUpAxes&&o(this.profileRotationFrameUpAxes,a,s[0],s[1],s[2]),this.pathMaxStretchDistances[a]=h,this.framePositionIndices[a]=e,this._extrusionFrameCount++}_rebuildGeometry(){this._extrusionVertexCount=0,this._extrusionFrameCount=0;const{
|
|
2
|
+
import{floatSubArray as t}from"../../../../geometry/support/FloatArray.js";import{newHalfFloatArray as e}from"../../../../geometry/support/HalfFloatArray.js";import{newIndexArray as i,compactIndices as s}from"../../../../geometry/support/Indices.js";import{newShortArray as r}from"../../../../geometry/support/ShortArray.js";import{compressNormal as o,encodeInt16 as n}from"./Normals.js";import{PathEvaluator as h}from"./PathEvaluator.js";import{encodePathVertexInfo as a}from"./PathVertexInfo.js";class u{constructor(s,o,n,a,u){this.path=s,this.profile=o,this.extruder=n,this.cap=a,this._extrusionVertexCount=0,this._extrusionFrameCount=0;const p=this.path.vertices.length-2;this.numExtrusionProfiles=n.numProfilesPerJoin()*p+2,this.numVerticesTotal=o.vertices.length*this.numExtrusionProfiles,this.numExtrusionFrames=this.path.vertices.length;const m=this.cap.numVertices;this.startCapVertexBufferStart=this.numVerticesTotal,this.numVerticesTotal+=m,this.endCapVertexBufferStart=this.numVerticesTotal,this.numVerticesTotal+=m,this.profileRightAxes=r(2*this.numExtrusionFrames),this.profileUpAxes=r(2*this.numExtrusionFrames);const l=1===u;this.profileRotationFrameUpAxes=l?r(2*this.numExtrusionFrames):null,this.pathMaxStretchDistances=e(this.numExtrusionFrames),this.profileRotations=r(this.numExtrusionFrames),this.framePositionIndices=i(this.numExtrusionFrames),this.pathVertexInfos=new Uint32Array(this.numVerticesTotal),this.positions=t(s.positions,s.offset,3*s.vertices.length),this._rebuildGeometry(),this._buildTopology(),this.evaluator=new h(this,o,this.extruder.numBendSubdivisions,a.type,n.cutoffAngle,u)}emitVertexDescriptor(t){const e=this._extrusionVertexCount;this.pathVertexInfos[e]=a(t),++this._extrusionVertexCount}emitExtrusionFrame(t,e){const{frame:i,rotationFrameUp:s,rotationAngle:r,maxStretchDistance:h}=t,a=this._extrusionFrameCount;return o(this.profileRightAxes,a,i.right[0],i.right[1],i.right[2]),o(this.profileUpAxes,a,i.up[0],i.up[1],i.up[2]),this.profileRotations[a]=n(r/Math.PI),this.profileRotationFrameUpAxes&&o(this.profileRotationFrameUpAxes,a,s[0],s[1],s[2]),this.pathMaxStretchDistances[a]=h,this.framePositionIndices[a]=e,this._extrusionFrameCount++}_rebuildGeometry(){this._extrusionVertexCount=0,this._extrusionFrameCount=0;const{vertices:t}=this.path,{profile:e}=this;this._updatePositions();for(let r=0;r<t.length;++r)this.emitExtrusionFrame(t[r],r);for(let r=0;r<e.vertices.length;++r)this.emitVertexDescriptor({frameIndex:0,sourceIndex:r,subdivision:0,type:1,capSide:0});const i=(t,e,i)=>{this.emitVertexDescriptor({frameIndex:t,sourceIndex:e,subdivision:i,type:0,capSide:0})};for(let r=1;r<t.length-1;++r)this.extruder.extrude(r,this.profile,i);const s=t.length-1;for(let r=0;r<e.vertices.length;++r)this.emitVertexDescriptor({frameIndex:s,sourceIndex:r,subdivision:0,type:1,capSide:1});this.cap.rebuildCapGeometry((t,e,i)=>this.emitVertexDescriptor({frameIndex:0,sourceIndex:t,subdivision:e,type:i,capSide:0})),this.cap.rebuildCapGeometry((t,e,i)=>this.emitVertexDescriptor({frameIndex:s,sourceIndex:t,subdivision:e,type:i,capSide:1}))}_updatePositions(){const{positions:t,offset:e,vertices:i}=this.path;if(!Array.isArray(t))return;const s=3*i.length,r=this.positions;for(let o=0;o<s;++o)r[o]=t[e+o]}_buildTopology(){const t=this.profile.vertices.length,e=this.profile.numSegments,i=this.numExtrusionProfiles-1,r=0,o=t*(this.numExtrusionProfiles-1),n=new Array,h=(t,e,i)=>{n.push(t),n.push(e),n.push(i)};for(let s=0;s<e;++s){const e=this.profile.indices[2*s],r=this.profile.indices[2*s+1];for(let s=0;s<i;++s){const i=s*t+e,o=(s+1)*t+r,n=s*t+r;h(i,(s+1)*t+e,o),h(i,o,n)}}this.cap.buildTopology(h,0,this.startCapVertexBufferStart,r),this.cap.buildTopology(h,1,this.endCapVertexBufferStart,o),this.vertexIndices=s(n)}onPathChanged(){this._rebuildGeometry()}}export{u as PathBuilder};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{clamp as t}from"../../../../core/mathUtils.js";import{
|
|
2
|
+
import{clamp as t}from"../../../../core/mathUtils.js";import{set as e,copy as i,exactEquals as s}from"../../../../core/libs/gl-matrix-2/math/vec2.js";import{create as o,clone as r}from"../../../../core/libs/gl-matrix-2/factories/vec2f64.js";import{transformMat4 as n}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{getContinuousIndexArray as a,getZeroIndexArray as l}from"../../../../geometry/support/Indices.js";import{Attribute as u}from"./Attribute.js";import{Geometry as h}from"./Geometry.js";import{getPathVertexFrameIndex as c}from"./PathVertexInfo.js";import{intersectTriangles as p}from"./RayIntersections.js";import{intersectTriangleReaderRangeScreenPolygon as m}from"./screenPolygonTriangleIntersections.js";class f extends h{constructor(t,e,i,s){const{vertexIndices:r,framePositionIndices:n,numExtrusionFrames:h}=e,c=a(h),p=l(h),m=[["position",new u(e.positions,n,3,!0)],["profileRight",new u(e.profileRightAxes,c,2,!0)],["profileUp",new u(e.profileUpAxes,c,2,!0)],["profileRotation",new u(e.profileRotations,c,1,!0)],["pathMaxStretchDistance",new u(e.pathMaxStretchDistances,c,1,!0)],["pathVertexInfo",new u(e.pathVertexInfos,r,1,!0)]];e.profileRotationFrameUpAxes&&m.push(["pathRotationUp",new u(e.profileRotationFrameUpAxes,c,2,!0)]),null!=i.sizeAttributeValue&&m.push(["sizeFeatureAttribute",new u([i.sizeAttributeValue],p,1,!0)]),null!=i.size&&m.push(["size",new u([...i.size],p,2,!0)]),null!=i.colorAttributeValue&&m.push(["colorFeatureAttribute",new u([i.colorAttributeValue],p,1,!0)]),null!=i.color&&m.push(["color",new u([...i.color],p,4,!0)]),null!=i.opacityAttributeValue&&m.push(["opacityFeatureAttribute",new u([i.opacityAttributeValue],p,1,!0)]),null!=i.opacity&&m.push(["opacity",new u([i.opacity],p,1,!0)]),super(t,m,null,0,s,0),this.builder=e,this.visualVariablesState=i,this._lastSize=o()}get indexCount(){return this.attributes.get("pathVertexInfo")?.indices.length??0}get readPrimitivePosition(){if(this._invalidateOnSizeChange(),null==this._readPrimitivePosition){const{builder:t,size:e}=this,{vertexIndices:i}=t;this._readPrimitivePosition=(s,o)=>(t.evaluator.evaluateVertexPosition(s,e,i[o],0),s)}return this._readPrimitivePosition}onPathChanged(){this.builder.onPathChanged(),this.invalidateBoundingInfo(),e(this._lastSize,-1,-1),this._invalidateReadPrimitivePosition()}get size(){const{parameters:e}=this.material,s=r(e.size);if(e.vvSize){const{offset:i,factor:o,minSize:r,maxSize:n,fallback:a}=e.vvSize,l=this.visualVariablesState.sizeAttributeValue??NaN;Number.isNaN(l)?(s[0]*=a[0],s[1]*=a[2]):(s[0]*=t(i[0]+l*o[0],r[0],n[0]),s[1]*=t(i[2]+l*o[2],r[2],n[2]))}else e.hasPathSize&&this.visualVariablesState.size&&i(s,this.visualVariablesState.size);return s}_computePrimitivePositionIndices(){const t=this.attributes.get("pathVertexInfo"),e=this.attributes.get("position");if(t&&e){const i=e.indices,s=t.indices,o=t.data;return s.map(e=>i[c(o[t.stride*e])])}return e?.indices??null}get boundingInfo(){return this._invalidateOnSizeChange(),super.boundingInfo}intersectRay(t,e,i,s){const{readPrimitivePosition:o,faceCount:r}=this;p(t,e,0,r,o,void 0,i,s)}intersectScreenPolygon(t,e,i){const{builder:s,size:o}=this,r=s.vertexIndices,a=r.length/3;return m(t,i,0,a,(t,i,a,l)=>{const u=3*l;return s.evaluator.evaluateVertexPosition(t,o,r[u],0),s.evaluator.evaluateVertexPosition(i,o,r[u+1],0),s.evaluator.evaluateVertexPosition(a,o,r[u+2],0),e&&(n(t,t,e),n(i,i,e),n(a,a,e)),l})}_invalidateOnSizeChange(){const{size:t}=this;s(t,this._lastSize)||(i(this._lastSize,t),this.invalidateBoundingInfo(),this._invalidateReadPrimitivePosition())}}function d(t){return t instanceof f}export{f as PathGeometry,d as isPathGeometry};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{fromValues as n,create as
|
|
2
|
+
import{create as o}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{fromValues as n,create as r}from"../../../../geometry/support/aaBoundingRect.js";import{screenPolygonIntersectsBounds as t,screenPolygonIntersectsTriangle as i}from"./screenPolygonOverlapUtils.js";function e(o,r,i){if(!i.visible)return null;const{boundingInfo:e}=i;if(e){const{box:i}=e;if(n(i[0]+r[0],i[1]+r[1],i[3]+r[0],i[4]+r[1],f),!t(o,f))return null}return s(o,r,0,i.faceCount,i.readPrimitivePosition)}function s(o,n,r,t,e){for(let s=r;s<t;++s){const r=3*s;if(c(u,n,e,r),c(l,n,e,r+1),c(a,n,e,r+2),i(o,u,l,a))return s}return null}function c(o,n,r,t){const[i,e]=r(m,t);o[0]=i+n[0],o[1]=e+n[1]}const f=r(),u=[0,0],l=[0,0],a=[0,0],m=o();export{e as intersectTriangleGeometryPolygon2D};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{assert as t}from"./Util.js";function n(n,o){const{data:e,indices:i,size:s,stride:u}=n;return t(3===s||4===s,"Position attribute must have 3 or 4 components"),null!=o?(t,n)=>{const r=i[o[n]]*u;return t[0]=e[r],t[1]=e[r+1],t[2]=e[r+2],t}:r(e,i,u)}function r(t,n,r){return(o,e)=>{const i=n[e]*r;return o[0]=t[i],o[1]=t[i+1],o[2]=t[i+2],o}}export{n as createPositionAttributeReader,r as createPositionReader};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{sub as n,set as t,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as
|
|
2
|
+
import{sub as n,set as t,cross as o,normalize as i}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{copy as c,create as r}from"../../../../geometry/support/aaBoundingBox.js";import{boundingInfoSubdivisionThreshold as s}from"./intersectionConstants.js";import{assert as u}from"./Util.js";class f{constructor(n=0,t=!1,o=!0){this.tolerance=n,this.isVerticalRay=t,this.normalRequired=o}}const a=r();function l(t,o,i,e,c,r){if(!t.visible)return;const s=n(z,e,i),{tolerance:a}=o,l=new f(a,!1,o.options.normalRequired);if(t.boundingInfo)u(0===t.type),p(t.readPrimitivePosition,t.boundingInfo,i,s,a,c,l,r);else{const n=t.readPrimitivePosition;v(i,s,0,t.faceCount,n,c,l,r)}}const m=e();function p(n,t,o,i,e,r,u,f){if(null==t)return;const l=B(i,m);if(c(a,t.box),null!=r&&r.applyToAabb(a),w(a,o,l,e)){const{primitiveIndices:c}=t,a=c.length;if(a>s){const c=t.children;if(void 0!==c){for(const t of c)p(n,t,o,i,e,r,u,f);return}}g(o,i,0,a,n,c,r,u,f)}}const h=e();function x(t,o,i,e,c,r,s,u){v(t,n(z,o,t),i,e,c,r,s,u)}function M(n,t,o,i){if(!o.visible)return;const{boundingInfo:e}=o;if(e){const{box:o}=e;if(n<o[0]||n>o[3]||t<o[1]||t>o[4])return}b(n,t,0,o.faceCount,o.readPrimitivePosition,i)}function b(n,t,o,i,e,c){for(let r=o;r<i;++r){const o=3*r,[i,s]=e(F,o),[u,f]=e(F,o+1),[a,l]=e(F,o+2),m=i-n,p=s-t,h=u-n,x=f-t,M=a-n,b=l-t,d=M*x-b*h,y=m*b-p*M,g=h*p-x*m;(d<0||y<0||g<0)&&(d>0||y>0||g>0)||c(0,null,r)}}function d(n,t,o,i,e,c,r,s,u,f=null,a=0){const l=n[0],m=n[1],p=n[2],x=t[0],M=t[1],b=t[2];for(let d=o;d<i;++d){const n=a+(f?.[d]??d),t=3*n,o=r*e[t],i=c[o],y=c[o+1],g=c[o+2],v=r*e[t+1],q=c[v],T=c[v+1],V=c[v+2],j=r*e[t+2],R=q-i,I=T-y,C=V-g,B=c[j]-i,w=c[j+1]-y,A=c[j+2]-g,U=M*A-w*b,z=b*B-A*x,D=x*w-B*M,E=R*U+I*z+C*D,F=E*E;if(F<=k)continue;const G=l-i,H=m-y,J=p-g,K=(G*U+H*z+J*D)*E;if(K<0||K>F)continue;const L=H*C-I*J,N=J*R-C*G,O=G*I-R*H,Q=(x*L+M*N+b*O)*E;if(Q<0||K+Q>F)continue;const S=(B*L+w*N+A*O)/E;if(S>=0){u(S,s?P(R,I,C,B,w,A,h):null,n)}}}function y(n,t,o,i,e,c,r,s,u,f,a,l=null,m=0){const p=n[0],x=n[1],M=n[2],b=t[0],d=t[1],y=t[2];for(let g=o;g<i;++g){const n=m+(l?.[g]??g),t=3*n,o=r*e[t],i=c[o],v=c[o+1],q=c[o+2],T=r*e[t+1],V=c[T],j=c[T+1],R=c[T+2],I=r*e[t+2],C=c[I],B=c[I+1],w=c[I+2],A=q-u,U=s/Math.sqrt(i*i+v*v+A*A),z=i+i*U,D=v+v*U,E=q+A*U,F=R-u,G=s/Math.sqrt(V*V+j*j+F*F),H=V+V*G,J=j+j*G,K=R+F*G,L=w-u,N=s/Math.sqrt(C*C+B*B+L*L),O=H-z,Q=J-D,S=K-E,W=C+C*N-z,X=B+B*N-D,Y=w+L*N-E,Z=d*Y-X*y,$=y*W-Y*b,_=b*X-W*d,nn=O*Z+Q*$+S*_,tn=nn*nn;if(tn<=k)continue;const on=p-z,en=x-D,cn=M-E,rn=(on*Z+en*$+cn*_)*nn;if(rn<0||rn>tn)continue;const sn=en*S-Q*cn,un=cn*O-S*on,fn=on*Q-O*en,an=(b*sn+d*un+y*fn)*nn;if(an<0||rn+an>tn)continue;const ln=(W*sn+X*un+Y*fn)/nn;if(ln>=0){a(ln,f?P(O,Q,S,W,X,Y,h):null,n)}}}function g(n,t,o,i,e,c,r,s,u){const f=n[0],a=n[1],l=n[2],m=t[0],p=t[1],x=t[2],{normalRequired:M}=s;for(let b=o;b<i;++b){const n=c[b],t=3*n;let[o,i,s]=e(F,t),[d,y,g]=e(F,t+1),[v,q,T]=e(F,t+2);null!=r&&([o,i,s]=r.applyToVertex(E,o,i,s,b),[d,y,g]=r.applyToVertex(E,d,y,g,b),[v,q,T]=r.applyToVertex(E,v,q,T,b));const V=d-o,j=y-i,R=g-s,I=v-o,C=q-i,B=T-s,w=p*B-C*x,A=x*I-B*m,U=m*C-I*p,z=V*w+j*A+R*U,D=z*z;if(D<=k)continue;const G=f-o,H=a-i,J=l-s,K=(G*w+H*A+J*U)*z;if(K<0||K>D)continue;const L=H*R-j*J,N=J*V-R*G,O=G*j-V*H,Q=(m*L+p*N+x*O)*z;if(Q<0||K+Q>D)continue;const S=(I*L+C*N+B*O)/z;if(S>=0){u(S,M?P(V,j,R,I,C,B,h):null,n)}}}function v(t,o,i,e,c,r,s,u){const f=o,a=D,l=Math.abs(f[0]),m=Math.abs(f[1]),p=Math.abs(f[2]),h=l>=m?l>=p?0:2:m>=p?1:2,x=h,M=f[x]<0?2:1,b=(h+M)%3,d=(h+(3-M))%3,y=f[b]/f[x],g=f[d]/f[x],v=1/f[x],P=q,R=T,I=V,{normalRequired:C}=s;for(let q=i;q<e;++q){const o=3*q;c(a[0],o),c(a[1],o+1),c(a[2],o+2),r&&(r.applyToVertex(a[0],a[0][0],a[0][1],a[0][2],q),r.applyToVertex(a[1],a[1][0],a[1][1],a[1][2],q),r.applyToVertex(a[2],a[2][0],a[2][1],a[2][2],q)),n(P,a[0],t),n(R,a[1],t),n(I,a[2],t);const i=P[b]-y*P[x],e=P[d]-g*P[x],s=R[b]-y*R[x],f=R[d]-g*R[x],l=I[b]-y*I[x],m=I[d]-g*I[x],p=l*f-m*s,h=i*m-e*l,M=s*e-f*i;if((p<0||h<0||M<0)&&(p>0||h>0||M>0))continue;const T=p+h+M;if(0===T)continue;const V=p*(v*P[x])+h*(v*R[x])+M*(v*I[x]);if(V*Math.sign(T)<0)continue;const B=V/T;if(B>=0){u(B,C?j(a):null,q)}}}const q=e(),T=e(),V=e();function P(n,e,c,r,s,u,f){return t(R,n,e,c),t(I,r,s,u),o(f,R,I),i(f,f),f}function j(t){return n(R,t[1],t[0]),n(I,t[2],t[0]),o(h,R,I),i(h,h),h}const R=e(),I=e();function C(n,o,i){return t(i,1/(o[0]-n[0]),1/(o[1]-n[1]),1/(o[2]-n[2]))}function B(n,o){return t(o,1/n[0],1/n[1],1/n[2])}function w(n,t,o,i){return A(n,t,o,i,1/0)}function A(n,t,o,i,e){const c=(n[0]-i-t[0])*o[0],r=(n[3]+i-t[0])*o[0];let s=Math.min(c,r),u=Math.max(c,r);const f=(n[1]-i-t[1])*o[1],a=(n[4]+i-t[1])*o[1];if(u=Math.min(u,Math.max(f,a)),u<0)return!1;if(s=Math.max(s,Math.min(f,a)),s>u)return!1;const l=(n[2]-i-t[2])*o[2],m=(n[5]+i-t[2])*o[2];return u=Math.min(u,Math.max(l,m)),!(u<0)&&(s=Math.max(s,Math.min(l,m)),!(s>u)&&s<e)}const U=1e-7,k=U*U,z=e(),D=[e(),e(),e()],E=e(),F=e();export{f as MeshIntersectionOptions,C as computeInvDir,w as intersectAabbInvDir,A as intersectAabbInvDirBefore,d as intersectRayTriangles,v as intersectRayTrianglesWithDisplacementWatertight,y as intersectRayTrianglesWithVerticalOffsetENUGlobal,l as intersectTriangleGeometry,M as intersectTriangleGeometry2D,x as intersectTriangles,b as intersectTriangles2d,U as triangleRayParallelTolerance};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as
|
|
2
|
+
import{generateUID as t}from"../../../../core/uid.js";import{copy as r,multiply as e}from"../../../../core/libs/gl-matrix-2/math/mat4.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as o}from"../../../../core/libs/gl-matrix-2/math/vec3.js";import{NullSphere as s,Sphere as n}from"../../../../geometry/support/sphere.js";import{maxScale as a}from"../../support/mathUtils.js";class h{constructor(r,e={}){this.geometry=r,this.screenToWorldRatio=1,this._transformation=i(),this._shaderTransformation=null,this._boundingSphere=null,this.id=t(),this.layerViewUid=e.layerViewUid,this.graphicUid=e.graphicUid,this.castShadow=e.castShadow??!1,e.objectShaderTransformation&&this.objectShaderTransformationChanged(e.objectShaderTransformation)}get indexCount(){return this.geometry.indexCount}get faceCount(){return this.geometry.faceCount}get transformation(){return this._transformation}set transformation(t){r(this._transformation,t),this._boundingSphere=null}get boundingInfo(){return this.geometry.boundingInfo}objectShaderTransformationChanged(t){null==t?this._shaderTransformation=null:(this._shaderTransformation??=i(),e(this._shaderTransformation,t,this.geometry.transformation)),this._boundingSphere=null}get boundingSphere(){return this.boundingInfo?(null==this._boundingSphere&&(this._boundingSphere??=new n,o(this._boundingSphere.center,this.boundingInfo.sphere.center,this.shaderTransformation),this._boundingSphere.radius=this.boundingInfo.sphere.radius*a(this.shaderTransformation)),this._boundingSphere):s}get material(){return this.geometry.material}get type(){return this.geometry.type}get shaderTransformation(){return this._shaderTransformation??this.transformation}get attributes(){return this.geometry.attributes}foreachHighlightOptions(t){this.geometry.foreachHighlightOptions(t)}get hasHighlights(){return this.geometry.hasHighlights}get occludees(){return this.geometry.occludees}get visible(){return this.geometry.visible}set visible(t){this.geometry.visible=t}get readPrimitivePosition(){return this.geometry.readPrimitivePosition}}class m extends h{}export{h as RenderGeometry,m as ValidatedRenderGeometry};
|