@arcgis/core 5.2.0-next.101 → 5.2.0-next.103
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/applications/Components/graphicOriginUtils.d.ts +17 -0
- package/applications/Components/graphicOriginUtils.js +2 -0
- package/arcgisGlobal.d.ts +1 -0
- package/assets/esri/core/workers/RemoteClient.js +1 -1
- package/assets/esri/core/workers/chunks/01fb22542820b7a8b848.js +1 -0
- package/assets/esri/core/workers/chunks/{4d13c1a04788e5222678.js → 03601be8b0763f82e88f.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e804bd6bb4b0ee44fa9.js → 045ff98313b06a2188b7.js} +1 -1
- package/assets/esri/core/workers/chunks/05584d8828ae7bca0fc5.js +1 -0
- package/assets/esri/core/workers/chunks/{eb222dc01344ed07719e.js → 056af594a1ef87066187.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1682e94cc714197ebb4.js → 05731c8bc8f63b388d72.js} +1 -1
- package/assets/esri/core/workers/chunks/{32aa1529e84b839d051d.js → 058d4c927486a361e633.js} +1 -1
- package/assets/esri/core/workers/chunks/{2524e2385f61a6898411.js → 06e7411c5bed0a414031.js} +1 -1
- package/assets/esri/core/workers/chunks/{de95dee8db92cf8f796f.js → 09a40fd0e462144c4640.js} +1 -1
- package/assets/esri/core/workers/chunks/0bd067a5c0bac96caeb5.js +1 -0
- package/assets/esri/core/workers/chunks/0bff8d589312be6588fe.js +1 -0
- package/assets/esri/core/workers/chunks/{4237a29c4ed5f86a15c2.js → 0c63d953f2dd1d5cc03d.js} +1 -1
- package/assets/esri/core/workers/chunks/{09cd91e56c856db6e01a.js → 0c74cf91b6b5292d32b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{e934ef66d130c212c05b.js → 0cdaba3ed074c06e225f.js} +1 -1
- package/assets/esri/core/workers/chunks/{6aaefd61505027267c9b.js → 0d69a18146722f792b5b.js} +1 -1
- package/assets/esri/core/workers/chunks/{900dad076347443b3ad9.js → 0de90b1ad8118457fd5a.js} +1 -1
- package/assets/esri/core/workers/chunks/{c0e073a77484b0dfd383.js → 0e1a067ab243900d0371.js} +1 -1
- package/assets/esri/core/workers/chunks/{33041e50ea02d99480b0.js → 0ee6109e6578395a7900.js} +1 -1
- package/assets/esri/core/workers/chunks/{8da08198c29acaabda6e.js → 0f1d5faddf8ef752470b.js} +1 -1
- package/assets/esri/core/workers/chunks/0f86c8a67c87f840fd39.js +1 -0
- package/assets/esri/core/workers/chunks/{6134a2c6983792787184.js → 0ff13f7a18b0123d253e.js} +1 -1
- package/assets/esri/core/workers/chunks/10fa8fbade8ae084c307.js +1 -0
- package/assets/esri/core/workers/chunks/1559213657665c053f8e.js +1 -0
- package/assets/esri/core/workers/chunks/{9c7fc1c97125ea2a7b7e.js → 164c604c1b2f728f32f2.js} +1 -1
- package/assets/esri/core/workers/chunks/19ac6f4664f97fb3821c.js +1 -0
- package/assets/esri/core/workers/chunks/{fd4d124c5bf810d9e352.js → 1a2f51d795b803d969c9.js} +1 -1
- package/assets/esri/core/workers/chunks/1eafb214519d8fc63ccb.js +1 -0
- package/assets/esri/core/workers/chunks/2165493d36c85b7c9a04.js +1 -0
- package/assets/esri/core/workers/chunks/{52422500ca3d6cf2e596.js → 2256036d5b91fa537805.js} +1 -1
- package/assets/esri/core/workers/chunks/{ad2b2214496e5a07db43.js → 2350f1eb70819cc06bb6.js} +1 -1
- package/assets/esri/core/workers/chunks/240bee7d0dc5e5dab826.js +1 -0
- package/assets/esri/core/workers/chunks/{822a5020afbca21df7f7.js → 25c5e1b14b184b1228a3.js} +1 -1
- package/assets/esri/core/workers/chunks/25c90092def215949db9.js +1 -0
- package/assets/esri/core/workers/chunks/{dd99bad9f91b0b62ba7c.js → 2a8168e109caa87d596f.js} +1 -1
- package/assets/esri/core/workers/chunks/{39254fdc41aaf61f23b0.js → 2b06e8507d71c4d9b5b5.js} +1 -1
- package/assets/esri/core/workers/chunks/{839feb913d1b6138fc78.js → 2b11e15bfa319dd32218.js} +1 -1
- package/assets/esri/core/workers/chunks/2d52386d69c218e29887.js +1 -0
- package/assets/esri/core/workers/chunks/{dda269a088275c823b40.js → 307297e025eed110095f.js} +1 -1
- package/assets/esri/core/workers/chunks/{05eb064f9b543890ae24.js → 33ba86b80426ddc88186.js} +1 -1
- package/assets/esri/core/workers/chunks/349e9f3d3e3267d02988.js +1 -0
- package/assets/esri/core/workers/chunks/{79088d5c9c2e6a780929.js → 34e04b24942da2b9b87c.js} +1 -1
- package/assets/esri/core/workers/chunks/3be33a129d3ae7dc4f06.js +1 -0
- package/assets/esri/core/workers/chunks/3daddcb106a7009c5a70.js +1 -0
- package/assets/esri/core/workers/chunks/{eae51e827f629ab37207.js → 3de6e54b6ed0feae1940.js} +1 -1
- package/assets/esri/core/workers/chunks/{9fe1db0762ab3326eab4.js → 3f5094828fbae7844117.js} +1 -1
- package/assets/esri/core/workers/chunks/{e02f02040b63d9c2e654.js → 3fb3b9fd06f78ee5cee6.js} +1 -1
- package/assets/esri/core/workers/chunks/{26e33c28028bf33936fc.js → 43436c7ccc6baefc885d.js} +1 -1
- package/assets/esri/core/workers/chunks/434c5b54e89ace974cbd.js +29 -0
- package/assets/esri/core/workers/chunks/472f3b80e1f26e09114a.js +1 -0
- package/assets/esri/core/workers/chunks/{dd8d19eb6b8e955c8067.js → 477136b747e02312abc4.js} +1 -1
- package/assets/esri/core/workers/chunks/{278e4d885ab03a51ef72.js → 47866b0b8604bf05c5ba.js} +1 -1
- package/assets/esri/core/workers/chunks/{b0ba081533100b021090.js → 48a53bfeef11c32dadcc.js} +1 -1
- package/assets/esri/core/workers/chunks/4a73f73f1698fad2df20.js +1 -0
- package/assets/esri/core/workers/chunks/4b0e3f83a5f2d3b0478a.js +1 -0
- package/assets/esri/core/workers/chunks/{4fbf4390c7eb0e11e3c9.js → 4b80c84fbd3d8dd90ca6.js} +1 -1
- package/assets/esri/core/workers/chunks/{a78781f79d828fc678a3.js → 4ba2276751083589570a.js} +1 -1
- package/assets/esri/core/workers/chunks/{20feca2fdd304b3e9664.js → 4c9df8ae9238454969b8.js} +1 -1
- package/assets/esri/core/workers/chunks/{0ffb5a1275d07dcd9115.js → 4c9e9925c02db48fa177.js} +1 -1
- package/assets/esri/core/workers/chunks/{60b1af54e7fc20fd9588.js → 546213fb53fa921a3928.js} +1 -1
- package/assets/esri/core/workers/chunks/{f6aa10a709017ac815a7.js → 547a073c789fdfb78310.js} +1 -1
- package/assets/esri/core/workers/chunks/{93c1d1e7c0935242071e.js → 54bb3678570ca032f051.js} +1 -1
- package/assets/esri/core/workers/chunks/{53a6bfebf3904dd7cad9.js → 55e40d3b460bacd200e6.js} +1 -1
- package/assets/esri/core/workers/chunks/567fb6a9b72bb232306d.js +1 -0
- package/assets/esri/core/workers/chunks/571cf99c3eab8e517542.js +1 -0
- package/assets/esri/core/workers/chunks/{abdcc224c8a8c72c86c4.js → 572d45353d74dcda1f09.js} +1 -1
- package/assets/esri/core/workers/chunks/{5bb8d9d887dd4211afd2.js → 573e8fa0af8711ffec45.js} +1 -1
- package/assets/esri/core/workers/chunks/{486f1a3b7269ce6c3911.js → 58528ccb7f72ae76d52b.js} +1 -1
- package/assets/esri/core/workers/chunks/{8599d2f2eb0fbb4a8bf5.js → 5c7f6721b37a4355e97a.js} +1 -1
- package/assets/esri/core/workers/chunks/{a10188c4d1904965898a.js → 5e1699d361d237bf0937.js} +1 -1
- package/assets/esri/core/workers/chunks/{aa7cb1531da1ccae8492.js → 5eb726317b6602f1e206.js} +1 -1
- package/assets/esri/core/workers/chunks/{42b5533f94ebcdc4befe.js → 5ed56ade84a0bea4a0c8.js} +1 -1
- package/assets/esri/core/workers/chunks/{bb8089929ded0613d8e7.js → 6010799e05d239073de0.js} +1 -1
- package/assets/esri/core/workers/chunks/{1de1cc0ed0f169a58aff.js → 60ad12fb732d529a4018.js} +1 -1
- package/assets/esri/core/workers/chunks/6395b3ec61b6550859a4.js +1 -0
- package/assets/esri/core/workers/chunks/{0e11bee9b56a7f51b012.js → 63f7141c71f29dbe8270.js} +1 -1
- package/assets/esri/core/workers/chunks/{7bb3411a86cdd736d555.js → 665e1901ec8dc182ba7a.js} +1 -1
- package/assets/esri/core/workers/chunks/{bc7ca87d3bfe8a4aec81.js → 66c46c5a7147550ea3ed.js} +1 -1
- package/assets/esri/core/workers/chunks/{762e9a15b2638475a2b4.js → 69921d068add041b5dcb.js} +1 -1
- package/assets/esri/core/workers/chunks/{486f1277fe834c0fc4c1.js → 6b5332e167c0553b1e6b.js} +1 -1
- package/assets/esri/core/workers/chunks/{d00c25ef8a378b24378d.js → 6cf881f793fd0ec93981.js} +1 -1
- package/assets/esri/core/workers/chunks/6e6cdff4bbe1ff2f44ac.js +1 -0
- package/assets/esri/core/workers/chunks/6e75f09fb9452bd5f9fb.js +1 -0
- package/assets/esri/core/workers/chunks/{601e44839fd46e449aa8.js → 6ef372f52a6ebd9aeb4a.js} +1 -1
- package/assets/esri/core/workers/chunks/{1a9f17781e0a3bc5106f.js → 718ed36a9f23993e1460.js} +1 -1
- package/assets/esri/core/workers/chunks/{f1f78bb3d34f973c19de.js → 719f0012f297a9a55d70.js} +1 -1
- package/assets/esri/core/workers/chunks/7261bbdbd084b4bb44f8.js +1 -0
- package/assets/esri/core/workers/chunks/{dd26a37f061ff658c5bd.js → 727dba20e01423c6ea77.js} +1 -1
- package/assets/esri/core/workers/chunks/{db8deb37048c71884575.js → 7285a37cd5359aa4bac5.js} +1 -1
- package/assets/esri/core/workers/chunks/{6e12e3c99b149cd7f567.js → 7ad62d16b380d80f7f3e.js} +1 -1
- package/assets/esri/core/workers/chunks/7adff63fd66fab505ae6.js +1 -0
- package/assets/esri/core/workers/chunks/7e42be27ead91a4cc0f1.js +1 -0
- package/assets/esri/core/workers/chunks/{94f62ff81cc6fb83e73f.js → 80cca2a377d51926e1a2.js} +1 -1
- package/assets/esri/core/workers/chunks/{9246e2468528650bdc7c.js → 80f16f5f15518013f7d0.js} +1 -1
- package/assets/esri/core/workers/chunks/{eb167f9f6132a6348d2e.js → 8328f79f064a68f3c1a3.js} +1 -1
- package/assets/esri/core/workers/chunks/847781aefed049493444.js +1 -0
- package/assets/esri/core/workers/chunks/84dc2afd89263a311b81.js +1 -0
- package/assets/esri/core/workers/chunks/8628c027198982baed7c.js +1 -0
- package/assets/esri/core/workers/chunks/{9d3cdfa08ef4d2805625.js → 88610ebfdf9c93ada781.js} +1 -1
- package/assets/esri/core/workers/chunks/{ed5ac1efd3cba49be756.js → 8bd187b48a4e4296e3d8.js} +1 -1
- package/assets/esri/core/workers/chunks/{862f7090ba4a56c07093.js → 8e102a2e134ce6ce0724.js} +1 -1
- package/assets/esri/core/workers/chunks/{3c0421a4a0ee3a3c63f8.js → 8edac3bbac401c8d6ecb.js} +1 -1
- package/assets/esri/core/workers/chunks/{22c477147421e68f7f00.js → 8fb4aa967d67abb6aba9.js} +1 -1
- package/assets/esri/core/workers/chunks/{e1c8767143f9f9d1f049.js → 93375f5f5bb754eca35f.js} +1 -1
- package/assets/esri/core/workers/chunks/{ea77654c8964cc39b9a6.js → 956432c9d45940983bc2.js} +1 -1
- package/assets/esri/core/workers/chunks/{b17a9853250ab626d58d.js → 96ebf76661b12128ddd5.js} +1 -1
- package/assets/esri/core/workers/chunks/98414a10f6de21107a03.js +1 -0
- package/assets/esri/core/workers/chunks/{4047208f9559e06d7102.js → 9a084a12afd6f0bbabce.js} +1 -1
- package/assets/esri/core/workers/chunks/9acaabe950319d031f2e.js +1 -0
- package/assets/esri/core/workers/chunks/{a24cecf2f775eaa69cf4.js → a10df3f51fe26d782aff.js} +1 -1
- package/assets/esri/core/workers/chunks/a34eee4c9d4c1c2b8c49.js +1 -0
- package/assets/esri/core/workers/chunks/a3f4818f4190fa92331d.js +1 -0
- package/assets/esri/core/workers/chunks/{680bef5e8237cc3bdd84.js → ac02df176f9ea94278bb.js} +1 -1
- package/assets/esri/core/workers/chunks/{5efc66be4576c6f67064.js → b1c1b7f98ee218f52b56.js} +1 -1
- package/assets/esri/core/workers/chunks/b4e5027c121d848c3d5a.js +1 -0
- package/assets/esri/core/workers/chunks/{d86044dbcd64323ff9f2.js → b7809ef3e1dabd921339.js} +1 -1
- package/assets/esri/core/workers/chunks/b9023cc3298ee4fddea7.js +1 -0
- package/assets/esri/core/workers/chunks/{63c43ebf46964c283b4d.js → b92b7d6c1e693c97a3eb.js} +1 -1
- package/assets/esri/core/workers/chunks/{fa91cece6daab2bec0e4.js → b941ec028abd44734902.js} +1 -1
- package/assets/esri/core/workers/chunks/{44ca13c874b5aa0ed5a0.js → bba3eb07a2a0065759f9.js} +1 -1
- package/assets/esri/core/workers/chunks/{4f89da01b67b66a92c01.js → be3421ffb5b391bca02e.js} +1 -1
- package/assets/esri/core/workers/chunks/be69e2dda75b079362b2.js +1 -0
- package/assets/esri/core/workers/chunks/{3721153202bd43c7fe0e.js → c116bd04e8910b5649d1.js} +1 -1
- package/assets/esri/core/workers/chunks/{fbf2d90240d36f8b423f.js → c2d19bb097d074a1ef21.js} +1 -1
- package/assets/esri/core/workers/chunks/c517e732cab41093b2e0.js +1 -0
- package/assets/esri/core/workers/chunks/{b0da2b089a89d643df1e.js → c53ecbdb47952eb47516.js} +1 -1
- package/assets/esri/core/workers/chunks/{cded34b161fcc790e672.js → c582441200ee1cdf51a7.js} +1 -1
- package/assets/esri/core/workers/chunks/{16f55c5d642a23c2547e.js → c63b0055a5008b1e5005.js} +1 -1
- package/assets/esri/core/workers/chunks/{33641947c388ce28b563.js → c6e771eff0603ece5d30.js} +1 -1
- package/assets/esri/core/workers/chunks/c7e6b5594fed5bb16691.js +1 -0
- package/assets/esri/core/workers/chunks/{d2387906b52624b4f7f1.js → c85fc0a9412e7debf166.js} +1 -1
- package/assets/esri/core/workers/chunks/{d7659d2b2aea0dd1202d.js → c91905b5808b8049f96d.js} +146 -126
- package/assets/esri/core/workers/chunks/cbd94998c619093b6426.js +1 -0
- package/assets/esri/core/workers/chunks/{86c3d3c7015f1cd55fac.js → ce3fb992f6c6ae7378a3.js} +1 -1
- package/assets/esri/core/workers/chunks/{e7fdad0c07beb3614b60.js → d13cf2e8b24e978ea77c.js} +1 -1
- package/assets/esri/core/workers/chunks/{c7f69d010f1cb32f5d37.js → d33d08cb6856cd2eb35e.js} +1 -1
- package/assets/esri/core/workers/chunks/d5defba320f2e49a377f.js +1 -0
- package/assets/esri/core/workers/chunks/{006146ad6d4a5cbf1a1f.js → d710c9d206bf46e031e8.js} +1 -1
- package/assets/esri/core/workers/chunks/{da6134c7883531f21afe.js → d922c54ea492cc771f63.js} +1 -1
- package/assets/esri/core/workers/chunks/{cf49a13522d61da31d8f.js → d9270f4935eb0d044db3.js} +1 -1
- package/assets/esri/core/workers/chunks/{8837fbcc0d484659b79c.js → da77257b517119578088.js} +1 -1
- package/assets/esri/core/workers/chunks/{3ca6ecdf9bdd84fef4d5.js → deb408bee61ca192b2ce.js} +1 -1
- package/assets/esri/core/workers/chunks/{d92540d3ffc4af980dd8.js → df79c00b5ddbef7148a0.js} +1 -1
- package/assets/esri/core/workers/chunks/e0f417992889a6c41095.js +1 -0
- package/assets/esri/core/workers/chunks/{c511af7afe08a78e2a4d.js → e18b8646c7378213b618.js} +1 -1
- package/assets/esri/core/workers/chunks/{a7e6382ecc91c876117f.js → e26be75ae40acb7473ee.js} +1 -1
- package/assets/esri/core/workers/chunks/e4d98eaa89d2c88c5139.js +1 -0
- package/assets/esri/core/workers/chunks/e5c88090d16459f55cb8.js +1 -0
- package/assets/esri/core/workers/chunks/{cc73ac8404615dc392d2.js → e6a4cef0af9be30ffe3d.js} +1 -1
- package/assets/esri/core/workers/chunks/{a40566a78d801b223d3d.js → ea068c797e3e462f4518.js} +1 -1
- package/assets/esri/core/workers/chunks/eab969d5c7d81f351250.js +1 -0
- package/assets/esri/core/workers/chunks/{3a9c6f58a1a065c14017.js → eaf1d38f09744b7e84f5.js} +1 -1
- package/assets/esri/core/workers/chunks/ebe7ba2557b50e18e547.js +1 -0
- package/assets/esri/core/workers/chunks/{1e3b07cf0e608431a277.js → ec5542d6ecc0622f7705.js} +1 -1
- package/assets/esri/core/workers/chunks/{0a4092578dc7578bcf76.js → f5a988bb850f7a7af143.js} +1 -1
- package/assets/esri/core/workers/chunks/{248df6fda489a9de5852.js → f5e8ccbd6b4c0a386903.js} +1 -1
- package/assets/esri/core/workers/chunks/f60d5ce49c173d5381ec.js +1 -0
- package/assets/esri/core/workers/chunks/{000f91a18c22377f8525.js → f94170f1e8c11c861e7b.js} +1 -1
- package/assets/esri/core/workers/chunks/{35d0a7597473d46866de.js → f9e5740b05de24ba81be.js} +1 -1
- package/assets/esri/core/workers/chunks/{10f4c5533f50c3693318.js → fa869977ac2abb063925.js} +1 -1
- package/assets/esri/core/workers/chunks/fae14e30fa7d81bf706e.js +1 -0
- package/assets/esri/core/workers/chunks/{ab3a6ce7bc2a27b92469.js → fb6f1b562ee0983c8c6e.js} +1 -1
- package/assets/esri/core/workers/chunks/{a26916de4c105859621e.js → fd808d38ae2d475ac442.js} +1 -1
- package/assets/esri/core/workers/chunks/{d6f7aa280f1bd201d4ef.js → ff673ea8e3291d12689e.js} +1 -1
- package/chunks/GlobalIllumination.glsl.js +8 -13
- package/config.js +1 -1
- package/core/libs/gl-matrix-2/math/quat.js +1 -1
- package/kernel.js +1 -1
- package/layers/IntegratedMeshLayer.d.ts +12 -0
- package/layers/IntegratedMeshLayer.js +1 -1
- package/layers/support/I3SIntegratedMeshElevationQuery.js +2 -0
- package/package.json +2 -2
- package/support/revision.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightEditTool.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightManipulators.js +1 -1
- package/views/3d/analysis/LineOfSight/LineOfSightTool.js +1 -1
- package/views/3d/interactive/editingTools/manipulatorUtils.js +1 -1
- package/views/3d/layers/i3s/I3SIndex.js +1 -1
- package/views/3d/layers/i3s/I3SNode.js +1 -1
- package/views/3d/webgl-engine/core/shaderLibrary/shading/EvaluateSceneLighting.glsl.js +29 -19
- package/views/3d/webgl-engine/core/shaderLibrary/shading/ScreenSpaceRayMarching.glsl.js +24 -9
- package/views/3d/webgl-engine/lib/BufferObject3D.js +2 -0
- package/views/3d/webgl-engine/lib/Intersector.js +1 -1
- package/views/3d/webgl-engine/lib/ModelDirtySet.js +1 -1
- package/views/3d/webgl-engine/lib/Object3D.js +1 -1
- package/views/3d/webgl-engine/lib/depthRangeUtils.js +1 -1
- package/views/3d/webgl-engine/parts/Model.js +1 -1
- package/views/analysis/ElevationProfile/ElevationProfileLineQueryComputation.js +1 -1
- package/views/support/Scheduler.js +1 -1
- package/assets/esri/core/workers/chunks/014eaccf2c2d357981f0.js +0 -1
- package/assets/esri/core/workers/chunks/0a242e76bc293b0ad04b.js +0 -1
- package/assets/esri/core/workers/chunks/0e65869a5dd5a3917da7.js +0 -1
- package/assets/esri/core/workers/chunks/0f15468ffefd3e9a17b8.js +0 -29
- package/assets/esri/core/workers/chunks/16ffbe484f6cd4736f79.js +0 -1
- package/assets/esri/core/workers/chunks/24a6b28db94e07a702a4.js +0 -1
- package/assets/esri/core/workers/chunks/2bd4b536e329112591c4.js +0 -1
- package/assets/esri/core/workers/chunks/3328a65c2bf1a0cbdb9d.js +0 -1
- package/assets/esri/core/workers/chunks/34f82b4ab11ff5642555.js +0 -1
- package/assets/esri/core/workers/chunks/3a9435569ba460ff7e3d.js +0 -1
- package/assets/esri/core/workers/chunks/3dd57a07c7a28e50d76e.js +0 -1
- package/assets/esri/core/workers/chunks/428f991c14ac12ae1b2c.js +0 -1
- package/assets/esri/core/workers/chunks/4717831effb1ac6d5f5d.js +0 -1
- package/assets/esri/core/workers/chunks/4d7f6c92041d52cc8732.js +0 -1
- package/assets/esri/core/workers/chunks/545a828002fd7da86c19.js +0 -1
- package/assets/esri/core/workers/chunks/58a52adc42fbe5cd12c6.js +0 -1
- package/assets/esri/core/workers/chunks/58b93f13316196d2e97d.js +0 -1
- package/assets/esri/core/workers/chunks/58f98bd89b644cfdafae.js +0 -1
- package/assets/esri/core/workers/chunks/625a692f00357629f609.js +0 -1
- package/assets/esri/core/workers/chunks/69688d521d5ba117e31c.js +0 -1
- package/assets/esri/core/workers/chunks/6f6ae6cf7f6e30b29013.js +0 -1
- package/assets/esri/core/workers/chunks/7fd54fa2f91cdab44ab3.js +0 -1
- package/assets/esri/core/workers/chunks/862eabda80ddb9e7a332.js +0 -1
- package/assets/esri/core/workers/chunks/8b24feffd5e084af2fa9.js +0 -1
- package/assets/esri/core/workers/chunks/925f83be3c1eb4b5c6af.js +0 -1
- package/assets/esri/core/workers/chunks/97aaff86e06380a68df8.js +0 -1
- package/assets/esri/core/workers/chunks/989937c120bdd676ec1e.js +0 -1
- package/assets/esri/core/workers/chunks/9cc14a41d4a90f6d626e.js +0 -1
- package/assets/esri/core/workers/chunks/a03e7333e3328036f478.js +0 -1
- package/assets/esri/core/workers/chunks/a34cadd486e7fcc79063.js +0 -1
- package/assets/esri/core/workers/chunks/a72983c3621810d4b1af.js +0 -1
- package/assets/esri/core/workers/chunks/a88aa26a7bee1fe7aea2.js +0 -1
- package/assets/esri/core/workers/chunks/a8e9aa5461c71c88e2e5.js +0 -1
- package/assets/esri/core/workers/chunks/a8f70cece5ce2b095cdd.js +0 -1
- package/assets/esri/core/workers/chunks/abd2f8fae6b918fbdd6d.js +0 -1
- package/assets/esri/core/workers/chunks/b2e5a89aca245263901c.js +0 -1
- package/assets/esri/core/workers/chunks/b2e692f52b9f02210e10.js +0 -1
- package/assets/esri/core/workers/chunks/b5fcf4165ac72654742d.js +0 -1
- package/assets/esri/core/workers/chunks/ba77a8892cb23c7a297d.js +0 -1
- package/assets/esri/core/workers/chunks/bf357afbabaa8dec4d75.js +0 -1
- package/assets/esri/core/workers/chunks/c07d2fb9940b2c6eda9f.js +0 -1
- package/assets/esri/core/workers/chunks/d179ec37d2612d65624f.js +0 -1
- package/assets/esri/core/workers/chunks/d2865c604849ce79183f.js +0 -1
- package/assets/esri/core/workers/chunks/e5d114f2b57d2b8e2f1c.js +0 -1
- package/assets/esri/core/workers/chunks/f2cbcd1b0e77e733a8e0.js +0 -1
- package/assets/esri/core/workers/chunks/f331c24247d132589859.js +0 -1
- package/assets/esri/core/workers/chunks/f8a6d8cdcabcd1d511b6.js +0 -1
- package/assets/esri/core/workers/chunks/ffa35ecc681ec1c4739a.js +0 -1
package/kernel.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.
|
|
2
|
+
import has from"./core/has.js";import{addQueryParameter as o}from"./core/urlUtils.js";export{buildDate,revision}from"./support/revision.js";Symbol.dispose??=Symbol("Symbol.dispose"),Symbol.asyncDispose??=Symbol("Symbol.asyncDispose");const e="5.2";let r,s=e;function i(o){r=o}function t(e){const s=r?.findCredential(e);return s?.token?o(e,"token",s.token):e}s="5.2.0-next.103",has("host-webworker")||globalThis.$arcgis||Object.defineProperty(globalThis,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),has("host-webworker");export{t as addTokenParameter,s as fullVersion,r as id,i as setId,e as version};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type Point from "../geometry/Point.js";
|
|
1
2
|
import type Layer from "./Layer.js";
|
|
2
3
|
import type SceneModifications from "./support/SceneModifications.js";
|
|
3
4
|
import type PortalItem from "../portal/PortalItem.js";
|
|
4
5
|
import type ElevationInfo from "../symbols/support/ElevationInfo.js";
|
|
6
|
+
import type SceneView from "../views/SceneView.js";
|
|
5
7
|
import type { ClonableMixin } from "../core/Clonable.js";
|
|
6
8
|
import type { MultiOriginJSONSupportMixin } from "../core/MultiOriginJSONSupport.js";
|
|
7
9
|
import type { APIKeyMixin, APIKeyMixinProperties } from "./mixins/APIKeyMixin.js";
|
|
@@ -11,6 +13,7 @@ import type { PortalLayer, PortalLayerProperties } from "./mixins/PortalLayer.js
|
|
|
11
13
|
import type { ScaleRangeLayer, ScaleRangeLayerProperties } from "./mixins/ScaleRangeLayer.js";
|
|
12
14
|
import type { SceneService, SceneServiceProperties } from "./mixins/SceneService.js";
|
|
13
15
|
import type { SaveAsOptions } from "./scene/types.js";
|
|
16
|
+
import type { ElevationQueryOptions, ElevationQueryResult } from "./support/types.js";
|
|
14
17
|
import type { SceneModificationsItems } from "./support/SceneModifications.js";
|
|
15
18
|
import type { ElevationInfoProperties } from "../symbols/support/ElevationInfo.js";
|
|
16
19
|
import type { LayerProperties } from "./Layer.js";
|
|
@@ -184,6 +187,15 @@ export default class IntegratedMeshLayer extends IntegratedMeshLayerSuperclass {
|
|
|
184
187
|
accessor title: string | null | undefined;
|
|
185
188
|
/** The layer type provides a convenient way to check the type of the layer without the need to import specific layer modules. */
|
|
186
189
|
get type(): "integrated-mesh";
|
|
190
|
+
/**
|
|
191
|
+
* Queries the integrated mesh layer for elevation values for the given geometry.
|
|
192
|
+
*
|
|
193
|
+
* @param view - The [SceneView](https://developers.arcgis.com/javascript/latest/references/core/views/SceneView/) whose scheduler runs the query.
|
|
194
|
+
* @param geometry - The point to query.
|
|
195
|
+
* @param options
|
|
196
|
+
* @returns A promise that resolves to the sampled elevation result.
|
|
197
|
+
*/
|
|
198
|
+
queryElevation(view: SceneView, geometry: Point, options?: ElevationQueryOptions): Promise<ElevationQueryResult<Point>>;
|
|
187
199
|
/**
|
|
188
200
|
* Saves the layer to its existing portal item in the [Portal](https://developers.arcgis.com/javascript/latest/references/core/portal/Portal/)
|
|
189
201
|
* authenticated within the user's current session. If the layer is not saved to a
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t,__decorate as o}from"tslib";import{isSome as r}from"../core/arrayUtils.js";import{ClonableMixin as i}from"../core/Clonable.js";import s from"../core/Error.js";import{abortHandle as n,disposable as a,makeHandle as l}from"../core/handleUtils.js";import p from"../core/Logger.js";import{MultiOriginJSONSupportMixin as d}from"../core/MultiOriginJSONSupport.js";import{throwIfAborted as y,throwIfAbortError as m}from"../core/promiseUtils.js";import{on as c,sync as u,watch as h}from"../core/reactiveUtils.js";import{property as f,subclass as v}from"../core/accessorSupport/decorators.js";import{persistable as g}from"../core/accessorSupport/decorators/persistable.js";import S from"./Layer.js";import{APIKeyMixin as _}from"./mixins/APIKeyMixin.js";import{ArcGISService as w}from"./mixins/ArcGISService.js";import{CustomParametersMixin as b}from"./mixins/CustomParametersMixin.js";import{OperationalLayer as j}from"./mixins/OperationalLayer.js";import{PortalLayer as Q}from"./mixins/PortalLayer.js";import{ScaleRangeLayer as I}from"./mixins/ScaleRangeLayer.js";import{SceneService as L}from"./mixins/SceneService.js";import{elevationInfo as x}from"./support/commonProperties.js";import{GeometryDescriptor as k}from"./support/GeometryDescriptor.js";import{queryIntegratedMeshElevation as A,defaultNoDataValue as D}from"./support/I3SIntegratedMeshElevationQuery.js";import{I3SNodePageDefinition as C,I3SMaterialDefinition as T,I3STextureSetDefinition as M,I3SGeometryDefinition as W}from"./support/I3SLayerDefinitions.js";import E from"./support/SceneModifications.js";import{logInvalidElevationInfoWarning as O,elevationModeRequiredMessage as U,featureExpressionUnsupportedMessage as G}from"../support/elevationInfoUtils.js";import{f as P}from"../chunks/persistableUrlUtils.js";import{SceneLayerWorkerHandle as N}from"../views/3d/layers/SceneLayerWorkerHandle.js";import{I3SDataRequester as R}from"../views/3d/layers/i3s/I3SDataRequester.js";import H from"../views/3d/layers/i3s/I3SNodeLoader.js";import{ImmediateTask as z}from"../views/support/Scheduler.js";import{reader as K}from"../core/accessorSupport/decorators/reader.js";let V=class extends(L(w(j(Q(I(d(b(_(i(S)))))))))){constructor(...e){super(...e),this.geometryType="mesh",this.operationalLayerType="IntegratedMeshLayer",this.type="integrated-mesh",this.nodePages=null,this.materialDefinitions=null,this.textureSetDefinitions=null,this.geometryDefinitions=null,this.serviceUpdateTimeStamp=null,this.profile="mesh-pyramids",this.modifications=null,this._modificationsSource=null,this.path=null,this.definitionExpression=null,this._elevationQueryAbortController=new AbortController,this._elevationQueryWorkerContext=`i3s-elevation-query-${this.uid}`,this._elevationQueryWorkerHandle=null,this._elevationQueryWorkerSetup=null,this._modificationsGeneration=0}destroy(){this._elevationQueryAbortController.abort();const e=this._elevationQueryWorkerHandle;this._elevationQueryWorkerHandle=null,this._elevationQueryWorkerSetup=null,null!=e&&e.destroyContextAndSelf(this._elevationQueryWorkerContext),super.destroy()}initialize(){this.addHandles([c(()=>this.modifications,"after-changes",()=>{this.modifications=this.modifications,this._modificationsGeneration++},u),h(()=>this.modifications,()=>this._modificationsGeneration++,u),h(()=>this.memoizedElevationQueryDependencies,()=>this._abortElevationQueriesAfterDependencyChange(),u)])}normalizeCtorArgs(e,t){return"string"==typeof e?{url:e,...t}:e}readModifications(e,t,o){this._modificationsSource={url:P(e,o),context:o}}set elevationInfo(e){null!=e&&"absolute-height"!==e.mode||this._set("elevationInfo",e),this._validateElevationInfo(e)}async load(e){return this.addResolvingPromise(this._doLoad(e)),this}get _elevationQueryWorker(){return this._elevationQueryWorkerHandle??=new N((e,t)=>z.schedule(e,t))}get memoizedElevationQueryDependencies(){return[this.elevationInfo?.offset,this._modificationsGeneration]}async queryElevation(o,i,s){const p={stack:[],error:void 0,hasError:!1};try{const t=s?.noDataValue??Number.MAX_VALUE,d=this._elevationQueryWorker,m=new AbortController;o.addHandles(n(m),m);e(p,a(l(()=>o.removeHandles(m))),!1);const c=AbortSignal.any([s?.signal,this._elevationQueryAbortController.signal,m.signal].filter(r));await this.load({signal:c}),y(c);const u=k.fromGeometry(i),h={signal:c,elevationOffset:this.elevationInfo?.offset??0,scheduler:o.resourceController.scheduler};if(null==this._elevationQueryWorkerSetup){const e=this.store?.defaultGeometrySchema;null!=e&&(this._elevationQueryWorkerSetup=d.setLegacySchema(this._elevationQueryWorkerContext,e))}const f=await A(this,u,h);y(c);const v=f.coordinates[0].z===D;v&&(f.coordinates[0].z=t);const g=await f.project(i.spatialReference,c);y(c);const S=g??u.clone(),_={geometry:S.export(),noDataValue:t};return s?.returnSampleInfo&&(_.sampleInfo=S.coordinates.map(()=>({demResolution:v?-1:1}))),_}catch(d){p.error=d,p.hasError=!0}finally{t(p)}}_abortElevationQueriesAfterDependencyChange(){const e=this._elevationQueryAbortController;this._elevationQueryAbortController=new AbortController,e.abort()}async processElevationQueryGeometry(e,t){return await this._elevationQueryWorkerSetup,y(t),this._elevationQueryWorker.invoke(e,t)}async _doLoad(e){const t=e?.signal;try{await this.loadFromPortal({supportedTypes:["Scene Service"]},e)}catch(o){m(o)}if(y(t),await this._fetchService(t),y(t),null!=this._modificationsSource){const o=await E.fromUrl(this._modificationsSource.url,this.spatialReference,e);y(t),this.setAtOrigin("modifications",o,this._modificationsSource.context.origin),this._modificationsSource=null}await this._fetchIndexAndUpdateExtent(this.nodePages,t),y(t)}beforeSave(){if(null!=this._modificationsSource)return this.load().then(()=>{},()=>{})}async saveAs(e,t){return this._debouncedSaveOperations(1,{...t,getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"},e)}async save(){const e={getTypeKeywords:()=>this._getTypeKeywords(),portalItemLayerType:"integrated-mesh"};return this._debouncedSaveOperations(0,e)}validateLayer(e){if(e.layerType&&"IntegratedMesh"!==e.layerType)throw new s("integrated-mesh-layer:layer-type-not-supported","IntegratedMeshLayer does not support this layer type",{layerType:e.layerType});if(isNaN(this.version.major)||isNaN(this.version.minor))throw new s("layer:service-version-not-supported","Service version is not supported.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"});if(this.version.major>1)throw new s("layer:service-version-too-new","Service version is too new.",{serviceVersion:this.version.versionString,supportedVersions:"1.x"})}_getTypeKeywords(){return["IntegratedMeshLayer"]}get elevationQueryDataRequester(){return new R(this.customParameters,this.apiKey)}get elevationQueryNodeLoader(){return new H(this,this.elevationQueryDataRequester,p.getLogger("esri.layers.IntegratedMeshLayer"),this.store?.defaultGeometrySchema,[],{loadFeatureData:!1,textureUsageMask:0})}_validateElevationInfo(e){const t="Integrated mesh layers";O(p.getLogger(this),U(t,"absolute-height",e)),O(p.getLogger(this),G(t,e))}};o([f({type:String,readOnly:!0})],V.prototype,"geometryType",void 0),o([f({type:["show","hide"]})],V.prototype,"listMode",void 0),o([f({type:["IntegratedMeshLayer"]})],V.prototype,"operationalLayerType",void 0),o([f({json:{read:!1},readOnly:!0})],V.prototype,"type",void 0),o([f({type:C,readOnly:!0,clonable:!1})],V.prototype,"nodePages",void 0),o([f({type:[T],readOnly:!0,clonable:!1})],V.prototype,"materialDefinitions",void 0),o([f({type:[M],readOnly:!0,clonable:!1})],V.prototype,"textureSetDefinitions",void 0),o([f({type:[W],readOnly:!0,clonable:!1})],V.prototype,"geometryDefinitions",void 0),o([f({readOnly:!0})],V.prototype,"serviceUpdateTimeStamp",void 0),o([f({type:E,clonable:e=>e?.clone()??e}),g({origins:["web-scene","portal-item"],type:"resource",prefix:"modifications"})],V.prototype,"modifications",void 0),o([f({clonable:e=>e?{...e}:null})],V.prototype,"_modificationsSource",void 0),o([K(["web-scene","portal-item"],"modifications")],V.prototype,"readModifications",null),o([f(x)],V.prototype,"elevationInfo",null),o([f({type:String,json:{origins:{"web-scene":{read:!0,write:!0},"portal-item":{read:!0,write:!0}},read:!1}})],V.prototype,"path",void 0),o([f({clonable:!1})],V.prototype,"_elevationQueryWorker",null),o([f()],V.prototype,"_modificationsGeneration",void 0),o([f()],V.prototype,"memoizedElevationQueryDependencies",null),o([f({clonable:!1})],V.prototype,"elevationQueryDataRequester",null),o([f({clonable:!1})],V.prototype,"elevationQueryNodeLoader",null),V=o([v("esri.layers.IntegratedMeshLayer")],V);const q=V;export{q as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import{__addDisposableResource as e,__disposeResources as t}from"tslib";import i from"../../core/Error.js";import{throwIfAborted as r}from"../../core/promiseUtils.js";import{invert as s}from"../../core/libs/gl-matrix-2/math/mat4.js";import{create as o}from"../../core/libs/gl-matrix-2/factories/mat4f64.js";import{transformMat4 as n,add as a,sub as l,scale as c}from"../../core/libs/gl-matrix-2/math/vec3.js";import{create as h,fromValues as u}from"../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as d}from"../../geometry/projection/projectBoundingSphere.js";import{getProjectorName as m}from"../../geometry/projection/projectors.js";import{projectVectorToVector as p}from"../../geometry/projection/projectVectorToVector.js";import{renderSRFromViewSR as _}from"../../geometry/support/coordinateSystem.js";import{fromPoints as f}from"../../geometry/support/ray.js";import{Sphere as g}from"../../geometry/support/sphere.js";import{Node as y}from"../../views/3d/layers/i3s/I3SNode.js";import{computeGlobalTransformation as b}from"../../views/3d/layers/i3s/I3SProjectionUtil.js";import{getIndexCrs as S,getVertexCrs as v}from"../../views/3d/layers/i3s/I3SUtil.js";import{Obb as R}from"../../views/3d/support/orientedBoundingBox.js";import{glLayout as w}from"../../views/3d/support/buffer/glUtil.js";import{createVertexBufferLayout as x,VertexBufferLayoutCreationParameters as N}from"../../views/3d/webgl-engine/collections/Component/SourceGeometry.js";import{intersectRayTriangles as j}from"../../views/3d/webgl-engine/lib/RayIntersections.js";import{TaskPriority as P}from"../../views/support/Scheduler.js";async function O(e,t,s){const o=await e.indexInfo;if(r(s.signal),null==o)throw new i("integrated-mesh-elevation-query:index-missing","I3S index information is missing.");return"page"===o.type?new T(e,t,s,o).promise:new q(e,t,s,o).promise}class I{constructor(e,t,i){this._layer=e,this._descriptor=t,this._options=i,this._subtaskAbortController=new AbortController,this._highest=-1/0,this._signal=AbortSignal.any([i.signal,this._subtaskAbortController.signal]),this._indexSpatialReference=S(e),this._vertexSpatialReference=v(e),this._intersectionSpaceSpatialReference=_(this._indexSpatialReference.isGeographic,this._indexSpatialReference),this._indexToVertexProjector=m(this._indexSpatialReference,this._vertexSpatialReference),this._vertexToIntersectionSpaceProjector=m(this._vertexSpatialReference,this._intersectionSpaceSpatialReference),this.frameTask=i.scheduler.registerTask(P.ELEVATION_QUERY),this.promise=this._run()}async _run(){const s={stack:[],error:void 0,hasError:!1};try{e(s,this.frameTask,!1);try{const e=this._descriptor;if("point"!==e.geometry.type)throw new i("elevation-query:invalid-geometry","Only point geometries can be used to query elevation");if(null==this._indexToVertexProjector||null==this._vertexToIntersectionSpaceProjector)throw new i("integrated-mesh-elevation-query:projection","Failed to create projection for elevation query.");const t=await e.project(this._indexSpatialReference,this._signal);r(this._signal),null==t&&this._throwSpatialReferenceMismatchError();const s=t.coordinates[0],o=D(s.x,s.y,this.getRootRayOriginZ(),this._indexSpatialReference,this._intersectionSpaceSpatialReference);return null==o&&this._throwSpatialReferenceMismatchError(),this._queryRay=o,await this.visitRoot(),r(this._signal),s.z=this._highest===-1/0?E:this._highest,t}catch(o){throw this._subtaskAbortController.abort(),o}}catch(n){s.error=n,s.hasError=!0}finally{t(s)}}_throwSpatialReferenceMismatchError(){throw new i("elevation-query:spatial-reference-mismatch",`Cannot query elevation in '${this._descriptor.spatialReference.wkid}' on an elevation service in '${this._indexSpatialReference.wkid}'`)}_intersectsQueryObb(e){const t=this._queryRay,i=new R;return e.transform(i,this._indexSpatialReference,this._intersectionSpaceSpatialReference),i.intersectRay(t.origin,t.direction)}intersectsQueryBounds(e){if(null==e)return!0;const t=this._queryRay;if(null!=e.obb)return this._intersectsQueryObb(R.fromJSON(e.obb));const i=new g;return!d(new g(e.mbs),this._indexSpatialReference,i,this._intersectionSpaceSpatialReference)||i.intersectRay(t)}async _processLeafNode(e){const t=await this._layer.elevationQueryNodeLoader.loadNodeData(e,this._signal);if(r(this._signal),null==t.geometryBuffer||null==t.geometryDescriptor)return;const i=await this.transformNode(e,t);r(this._signal),null!=i&&await this.frameTask.schedule(()=>{this._highest=this.intersectTransformedGeometry(i,this._highest,this._options.elevationOffset)},this._signal)}async transformNode(e,t){const i=e.serviceMbsInIndexSR;if(null==i)return null;const s=b(i,0,Q,this._indexSpatialReference,this._intersectionSpaceSpatialReference),o={context:`i3s-elevation-query-${this._layer.uid}`,geometryBuffer:t.geometryBuffer,geometryData:null,geometryDescriptor:t.geometryDescriptor,layouts:[k],globalTrafo:s,geometryElevationOffset:0,mbs:i.toJSON(),obbData:e.serviceObbInIndexSR?.data,elevationOffset:0,planetRadiusInGlobalMode:0,needNormals:!1,computeNormals:!1,normalReferenceFrame:Q,indexToVertexProjector:this._indexToVertexProjector,vertexToRenderProjector:this._vertexToIntersectionSpaceProjector},n=await this._layer.processElevationQueryGeometry(o,this._signal);return r(this._signal),n}intersectTransformedGeometry(e,t,i){const r=e.globalTrafo;if(null==s(A,r))return t;const o=this._queryRay,h=n(M,o.origin,A),u=a(B,o.origin,o.direction),d=n(J,u,A),m=l($,d,h),{data:_,indices:f}=e.transformedGeometry.positionData,g=f.length/3;let y=t;return j(h,m,0,g,f,_,3,!1,e=>{const t=c(C,m,e);a(t,t,h);const s=n(V,t,r),o=G;if(p(s,this._intersectionSpaceSpatialReference,o,this._layer.spatialReference)){const e=o[2]+i;y=Math.max(y,e)}}),y}async requestJSON(e){const t=await this._layer.elevationQueryDataRequester.request(e,"json",this._signal);return r(this._signal),t}}class T extends I{constructor(e,t,i,r){super(e,t,i),this._pendingPages=new Map,this._loadedPages=new Map,this._pageSize=r.pageSize,this._rootIndex=r.rootIndex,this._urlPrefix=r.urlPrefix;const s=this._pageId(this._rootIndex),o=this._rootIndex-s*this._pageSize,n=R.fromJSON(r.rootPage.nodes[o].obb);this._rootRayOriginZ=n.centerZ+n.radius+1,this._loadedPages.set(s,r.rootPage)}visitRoot(){return this._visitNode(this._rootIndex)}getRootRayOriginZ(){return this._rootRayOriginZ}_pageId(e){return Math.floor(e/this._pageSize)}getPage(e){const t=this._loadedPages.get(e);if(null!=t)return Promise.resolve(t);const i=this._pendingPages.get(e);if(null!=i)return i;const r=this.requestJSON(`${this._urlPrefix}${e}`);return this._pendingPages.set(e,r),r.then(t=>{this._loadedPages.set(e,t),this._pendingPages.delete(e)},()=>this._pendingPages.delete(e)),r}async _visitNode(e){const t=this._pageId(e),i=await this.getPage(t);r(this._signal);const s=i.nodes[e-t*this._pageSize],o=R.fromJSON(s.obb);if(!this._intersectsQueryObb(o))return;const{children:n}=s;if(null!=n&&n.length>0)return await Promise.all(n.map(e=>this._visitNode(e))),void r(this._signal);const a=this._createNode(e,s,o);null!=a&&(await this._processLeafNode(a),r(this._signal))}_createNode(e,t,i){const{mesh:r}=t;if(null==r?.geometry)return null;const s=new g(i.getCenter(h()),i.radius),{geometry:o,material:n}=r;return new y(`${e}`,e,s,t.children?.length??0,0,{hasSharedResource:!1,isEmpty:!1,geometry:`${o.resource}`,geometryDefinition:o.definition,materialDefinition:n?.definition??-1},"",0,0,o.featureCount??null,i)}}class q extends I{constructor(e,t,i,r){super(e,t,i),this._rootNode=r.rootNode,this._urlPrefix=r.urlPrefix}visitRoot(){return this.intersectsQueryBounds(this._rootNode)?this._visitNodeData(this._rootNode,null!=this._rootNode.obb):Promise.resolve()}getRootRayOriginZ(){return this._rootNode.mbs[2]+this._rootNode.mbs[3]+1}_visitNode(e){return this.intersectsQueryBounds(e)?this._visitNodeAsync(e):Promise.resolve()}async _visitNodeAsync(e){const t=await this.requestJSON(`${this._urlPrefix}${e.id}`);r(this._signal),await this._visitNodeData(t,null!=e.obb),r(this._signal)}async _visitNodeData(e,t){if(!t&&null!=e.obb&&!this._intersectsQueryObb(R.fromJSON(e.obb)))return;const{children:i}=e;if(null!=i&&i.length>0)return await Promise.all(i.map(e=>this._visitNode(e))),void r(this._signal);const s=this._createNode(e);null!=s&&(await this._processLeafNode(s),r(this._signal))}_createNode(e){const{geometryData:t,id:i}=e;if(null==t||0===t.length)return null;const r=null==e.obb?null:R.fromJSON(e.obb),s=new g(e.mbs);return new y(i,0,s,e.children?.length??0,0,{hasSharedResource:null!=e.sharedResource,isEmpty:!1,geometry:i,geometryDefinition:0},e.version??"",0,0,null,r)}}function D(e,t,i,r,s){const o=u(e,t,i),n=u(e,t,i-1e3),a=h(),l=h();return p(o,r,a,s)&&p(n,r,l,s)?f(a,l):null}const E=Number.MAX_VALUE,Q="none",k=w(x(new N(!1,!1,0))),A=o(),M=h(),B=h(),J=h(),$=h(),C=h(),V=h(),G=h();export{E as defaultNoDataValue,O as queryIntegratedMeshElevation};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/core",
|
|
3
|
-
"version": "5.2.0-next.
|
|
3
|
+
"version": "5.2.0-next.103",
|
|
4
4
|
"description": "ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@amcharts/amcharts5": "~5.20.4",
|
|
23
|
-
"@arcgis/toolkit": "5.2.0-next.
|
|
23
|
+
"@arcgis/toolkit": "5.2.0-next.103",
|
|
24
24
|
"@esri/arcgis-html-sanitizer": "~4.1.0",
|
|
25
25
|
"@esri/calcite-components": "^5.2.0-next.65",
|
|
26
26
|
"@vaadin/grid": "~25.2.9",
|
package/support/revision.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
const
|
|
2
|
+
const c="20260907",e="5e5e47c90aae63720c7c1425690c13a86d01ec8e";export{c as buildDate,e as revision};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{watch as i,
|
|
2
|
+
import{__decorate as t}from"tslib";import e from"../../../../core/Accessor.js";import{watch as i,syncAndInitial as s}from"../../../../core/reactiveUtils.js";import{property as o,subclass as n}from"../../../../core/accessorSupport/decorators.js";import{snapshotLineOfSightTargetState as l,restoreLineOfSightTargetState as r}from"./LineOfSightAuthoringUtils.js";import{LineOfSightItemManipulatedObject3D as a}from"./LineOfSightItemManipulatedObject3D.js";import{LineOfSightItemTool as h}from"./LineOfSightItemTool.js";import{discRadiusSmall as c}from"../../interactive/editingTools/manipulations/config.js";import{MoveTool3D as m}from"../../interactive/editingTools/move/MoveTool3D.js";import d from"../../../interactive/options/InteractiveToolOptions.js";let u=class extends e{get visible(){return this._get("visible")??!0}set visible(t){this._set("visible",t),this._itemTool.visible=t,this._moveTool.visible=t}get manipulatorsInteractive(){return this._get("manipulatorsInteractive")??!0}set manipulatorsInteractive(t){this._set("manipulatorsInteractive",t),this._itemTool.manipulatorsInteractive=t}constructor(t){super(t),this._selectedItem=null,this._objectByItem=new Map,this._undoStack=[],this._redoStack=[],this._itemTool=new h({analysisViewData:t.analysisViewData,snappingManager:t.snappingManager,view:t.view}),this._moveTool=new m({enableVisualElements:!1,manipulatorRadius:c,snappingManager:t.snappingManager,toolOptions:new d({tooltips:{enabled:!0}}),view:t.view})}initialize(){this.view.tools.add(this._itemTool),this.view.tools.add(this._moveTool),this._itemTool.visible=this.visible,this._moveTool.visible=this.visible,this._itemTool.manipulatorsInteractive=this.manipulatorsInteractive,this.addHandles([i(()=>({observer:this.analysis.observer,targets:this.analysis.targets.toArray()}),({observer:t,targets:e})=>this._syncObjects(t,e),s),this._itemTool.events.on("select-item",({item:t})=>this._setSelectedItem(t)),this._itemTool.events.on("selection-cleared",()=>{if(this._moveTool.hasFocusedManipulators){const t=null==this._selectedItem?null:this._objectByItem.get(this._selectedItem);this._itemTool.selectObject(t)}else this._setSelectedItem(null)}),this._itemTool.events.on("delete-item",({target:t})=>this._deleteTarget(t)),this._itemTool.events.on("record-undo",({record:t})=>this._recordHistory(_([t]))),this._moveTool.events.on("record-undo",({updates:t})=>this._recordHistory(_(t))),this._moveTool.events.on("move-start",({objects:t})=>{const e=t.at(0);null!=e&&this._itemTool.startMoveInteraction(e)}),this._moveTool.events.on("move-stop",()=>this._itemTool.stopMoveInteraction())])}destroy(){this.stop(),this.view.tools.remove(this._itemTool),this.view.tools.remove(this._moveTool),this._itemTool.destroy(),this._moveTool.destroy();for(const t of this._objectByItem.values())this.removeHandles(t),t.destroy();this._objectByItem.clear(),this._undoStack.length=0,this._redoStack.length=0}get active(){return this._itemTool.active||this._moveTool.active}get canRedo(){return this._redoStack.length>0}get canUndo(){return this._undoStack.length>0}get hasSelection(){return null!=this._selectedItem}get updating(){return this._itemTool.updating||this._moveTool.updating}get laserLineVisualElement(){return this._itemTool.laserLineVisualElement}get verticalLineVisualElement(){return this._itemTool.verticalLineVisualElement}selectItem(t){return!!this._objectByItem.has(t)&&(this._setSelectedItem(t),!0)}clearSelection(){return!!this.hasSelection&&(this._setSelectedItem(null),!0)}deleteSelectedItem(){const t=this._selectedItem;if(null==t)return!1;const e=this.analysis.targets.find(e=>e===t);return null!=e&&this._deleteTarget(e)}getObserverManipulator(){const t=this.analysis.observer,e=null==t?null:this._itemTool.getManipulator(t);return null!=e&&v(e)?e:null}getTargetManipulator(t){const e=this._itemTool.getManipulator(t);return null!=e&&p(e)?e:null}hasManipulatorAt(t,e){return this._itemTool.hasManipulatorAt(t,e)}redo(){const t=this._redoStack.pop();null!=t&&(t.redo()?(this._undoStack.push(t),this._notifyHistoryChanged()):this._redoStack.push(t))}setEditableFlag(t,e){this._itemTool.setEditableFlag(t,e),this._moveTool.setEditableFlag(t,e)}stop(){this.view.activeTool!==this._itemTool&&this.view.activeTool!==this._moveTool||(this.view.activeTool=null),this._itemTool.stopMoveInteraction(),this.snappingManager.doneSnapping(),this.clearSelection()}undo(){const t=this._undoStack.pop();null!=t&&(t.undo(),this._redoStack.push(t),this._notifyHistoryChanged())}_syncObjects(t,e){const i=new Set(null==t?e:[t,...e]);for(const[s,o]of this._objectByItem)i.has(s)||(this._selectedItem===s&&this._setSelectedItem(null),this.removeHandles(o),this._itemTool.removeObject(o),this._objectByItem.delete(s),o.destroy());null!=t&&this._ensureObject(t,"observer");for(const s of e)this._ensureObject(s,"target");this._setSelectedItem(this._selectedItem)}_ensureObject(t,e){if(this._objectByItem.has(t))return;const i=new a({analysisViewData:this.analysisViewData,intersector:this.intersector,item:t,itemType:e,view:this.view});this._objectByItem.set(t,i),this._itemTool.addObject(i),this.addHandles(i.on("modified-externally",()=>{this._selectedItem===t&&this._setSelectedItem(t)}),i)}_setSelectedItem(t){const e=null==t?null:this._objectByItem.get(t);this._selectedItem=null==e?null:t,this._itemTool.selectObject(e),this._moveTool.objects.removeAll(),null!=e&&this._moveTool.objects.add(e),this._itemTool.interacting=null!=this._selectedItem}_deleteTarget(t){if(this.analysis.targets.length<=1)return!1;const e=this.analysis.targets.indexOf(t);if(e<0)return!1;const i=l(t),s=this._selectedItem===t;return this.analysis.targets.remove(t),this._recordHistory({undo:()=>{r(i,t),this.analysis.targets.add(t,Math.min(e,this.analysis.targets.length)),s&&this._setSelectedItem(t)},redo:()=>!(this.analysis.targets.includes(t)&&this.analysis.targets.length<=1)&&(this.analysis.targets.remove(t),this._selectedItem===t&&this._setSelectedItem(null),!0)}),!0}_recordHistory(t){this._undoStack.push(t),this._redoStack.length=0,this._notifyHistoryChanged()}_notifyHistoryChanged(){this.notifyChange("canUndo"),this.notifyChange("canRedo")}get testInfo(){return{moveTooltip:this._moveTool.tooltip}}};function _(t){return{undo:()=>{for(let e=t.length-1;e>=0;e--)t[e].undo(null)},redo:()=>{for(const e of t)e.redo(null);return!0}}}function v(t){return"observer"===t.metadata.type}function p(t){return"target"===t.metadata.type}t([o({constructOnly:!0})],u.prototype,"analysisViewData",void 0),t([o({constructOnly:!0})],u.prototype,"analysis",void 0),t([o({constructOnly:!0})],u.prototype,"intersector",void 0),t([o({constructOnly:!0})],u.prototype,"snappingManager",void 0),t([o({constructOnly:!0})],u.prototype,"view",void 0),t([o()],u.prototype,"visible",null),t([o()],u.prototype,"manipulatorsInteractive",null),t([o()],u.prototype,"active",null),t([o()],u.prototype,"canRedo",null),t([o()],u.prototype,"canUndo",null),t([o()],u.prototype,"updating",null),u=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightEditTool")],u);export{u as LineOfSightEditTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as r,targetConfiguration as o,getInteractiveTargetRGBA as
|
|
2
|
+
import{watch as e}from"../../../../core/reactiveUtils.js";import{getObserverRGBA as t,observerConfiguration as r,targetConfiguration as o,getInteractiveTargetRGBA as s,lineOfSightTransparentRenderOrder as i}from"./LineOfSightConfiguration.js";import{Manipulator3D as n}from"../../interactive/Manipulator3D.js";import{createManipulatorMaterial as a}from"../../interactive/manipulatorUtils.js";import{RenderObject as c}from"../../interactive/RenderObject.js";import{createSphereGeometry as m}from"../../webgl-engine/lib/GeometryUtil.js";const d=128,f=256,l=512,u=1024,h=2048;class v extends n{constructor(o,s){const i=w(t(o.effectiveTheme)),n=m(i,r.size,32,32),a=new c(n);super({view:o,renderObjects:[a],metadata:s,elevationInfo:{mode:"absolute-height",offset:0}}),this.themeHandle=e(()=>({color:t(o.effectiveTheme)}),e=>{i.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}class p extends n{constructor(t,r){const{size:i,visibleColor:n,occludedColor:a,undefinedColor:v}=o,p=w(s(t.effectiveTheme)),b=[new c(m(p,i,32,32),u),g(i,n,h|d),g(i,a,h|f),g(i,v,h|l)];super({view:t,renderObjects:b,metadata:r,elevationInfo:{mode:"absolute-height",offset:0}}),this.themeHandle=e(()=>({color:s(t.effectiveTheme)}),e=>{p.setParameters(e)})}destroy(){this.themeHandle.remove(),super.destroy()}}const b={visible:h|d,occluded:h|f,undefined:h|l};function j(e){return e&~h|u}function g(e,t,r){return new c(m(w(t.toUnitRGBA()),e,32,32),r)}function w(e){const t=a(e);return t.setParameters({testsTransparentRenderOrder:i.manipulator}),t}export{v as LineOfSightObserverManipulator,p as LineOfSightTargetManipulator,b as LineOfSightTargetManipulatorState,j as getInteractiveLineOfSightTargetManipulatorState};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../../../core/accessorSupport/decorators.js";import a from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as l}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as r}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as c}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as
|
|
2
|
+
import{__decorate as t}from"tslib";import{makeHandle as e}from"../../../../core/handleUtils.js";import"../../../../core/has.js";import{watch as i,syncAndInitial as o}from"../../../../core/reactiveUtils.js";import{property as s,subclass as n}from"../../../../core/accessorSupport/decorators.js";import a from"../../../../symbols/support/ElevationInfo.js";import{LineOfSightEditTool as l}from"./LineOfSightEditTool.js";import{LineOfSightPlacementController as r}from"./LineOfSightPlacementController.js";import{LineOfSightRayIntersector as c}from"./LineOfSightRayIntersector.js";import{ExclusiveOperationManager as p}from"../../../analysis/ExclusiveOperationManager.js";import{ViewEventPriorities as h}from"../../../input/InputManager.js";import{AnalysisToolBase as d}from"../../../interactive/AnalysisToolBase.js";import{deactivateTool as v}from"../../../interactive/interactiveToolUtils.js";import{sketchKeys as u}from"../../../interactive/keybindings.js";import{acquire as _}from"../../../interactive/snapping/SnappingManagerPool.js";import{setupSnappingToggleHandles as g}from"../../../interactive/snapping/snappingUtils.js";const m={ready:"ready",creating:"creating",created:"created"};let y=class extends d{constructor(t){super(t),this._operationManager=new p,this._syncingActiveTool=!1,this.analysisViewData=null,this.removeIncompleteOnCancel=!1;const{snappingManager:e}=this._snappingManagerResult=_(t.view);this._editIntersector=new c({view:t.view}),this._editTool=new l({analysis:t.analysis,analysisViewData:t.analysisViewData,intersector:this._editIntersector,snappingManager:e,view:t.view}),this._placementController=new r({...t,parent:this,snappingManager:e,shouldPreventVertexAdd:(t,e)=>this._editTool.hasManipulatorAt(t,e)})}get active(){return this._editTool.active||this._placementController.active}get canRedo(){return this._activeUndoRedoComponent?.canRedo??!1}get canUndo(){return this._activeUndoRedoComponent?.canUndo??!1}get state(){return this._placementController.active?m.creating:null!=this.analysis.observer?.position?m.created:m.ready}get cursor(){return this._placementController.active?"crosshair":null}get updating(){return this._editTool.updating||this._placementController.updating}initialize(){g(this),this.addHandles([this._snappingManagerResult,this.view.on("key-down",t=>this._onKeyDown(t),h.WIDGET),i(()=>({editable:this.editable,interactive:this.analysisViewData.interactive,placementActive:this._placementController.active,valid:this.analysis.valid,visible:this.visible}),()=>this._syncActiveTool(),o),i(()=>this.state===m.created,t=>{t?this.finishToolCreation():this._set("created",!1)},o),i(()=>this.analysisViewData.visible,t=>{this.visible=t},o),i(()=>this.editable,t=>{this.analysisViewData.editable=t},o)])}destroy(){this._operationManager.destroy(),this._editTool.stop(),this._placementController.stop(),this._editTool.destroy(),this._placementController.destroy(),this._editIntersector.destroy()}place(t){return this.analysisViewData.interactive=!0,this._operationManager.start("place",async(s,n)=>{const{elevationInfo:a}=t??{},l=a&&"observer"in a?a.observer:a,r=a&&"targets"in a?a.targets:a;this._placementController.observerPlacementElevationInfo=f(l),this._placementController.targetPlacementElevationInfo=f(r);const c=this.analysis.clone();let p=!1,h=!1;const d=()=>{if(h)return;if(h=!0,this.stop(),!this.analysis.valid)return this.analysis.clear(),void s.reject();if(n.aborted||this.analysis.equals(c))return void s.reject();const t=this.analysis.targets.at(-1);null!=t&&this._editTool.selectItem(t),s.resolve({})};s.handles.push(e(()=>this.stop()),i(()=>this._placementController.active,t=>{t?p=!0:p&&d()},o)),this.continue()},t)}activate(){this.view.focus(),this.analysisViewData.interactive=!0,this._syncActiveTool(),this.analysis.valid||this._placementController.active||this.continue()}deactivate(){this.onDeactivate()}continue(){this.analysisViewData.interactive=!0,this._placementController.continue()}stop(){this._placementController.stop(),this._placementController.observerPlacementElevationInfo=null,this._placementController.targetPlacementElevationInfo=null,this._syncActiveTool()}redo(){this._activeUndoRedoComponent?.redo()}undo(){this._activeUndoRedoComponent?.undo()}get testInfo(){}get snappingOptions(){return this._snappingManager.options}set snappingOptions(t){this._snappingManager.options=t}get _snappingManager(){return this._snappingManagerResult.snappingManager}onEditableChange(){this.analysisViewData.editable=this.editable,this._editTool.setEditableFlag(1,!0),this._editTool.setEditableFlag(0,this.editable),this._syncActiveTool()}_hideEditTool(){this._editTool.stop(),this._editTool.visible=!1}_onKeyDown(t){const e=t.key;if(e===u.undo&&this.canUndo)t.stopPropagation(),this.undo();else if(e===u.redo&&this.canRedo)t.stopPropagation(),this.redo();else if(u.delete.includes(e)&&!this.active){this._editTool.deleteSelectedItem()&&t.stopPropagation()}else if(e===u.cancel&&!this.active){this._editTool.clearSelection()&&t.stopPropagation()}}get _activeUndoRedoComponent(){return this.analysisViewData.interactive?this._placementController.active||!this._canActivateEditTool?this._placementController.active?this._placementController:null:this._editTool:null}get _canActivateEditTool(){return this.visible&&this.editable&&this.analysis.valid&&null!=this.analysis.observer?.position}_syncActiveTool(){if(!this._syncingActiveTool){this._syncingActiveTool=!0;try{const t=this.analysisViewData.interactive,e=this._canActivateEditTool;if(this._placementController.visible=this.visible&&t,this._editTool.manipulatorsInteractive=t&&!this._placementController.active,!t)return this._placementController.stop(),this._hideEditTool(),this.analysisViewData.cursorTarget=null,void v(this.view,this);if(!this.visible)return this._editTool.stop(),this._editTool.visible=!0,void v(this.view,this);if(this._placementController.active)return this._editTool.stop(),this._editTool.visible=this.visible,void v(this.view,this);if(!e)return this._hideEditTool(),void v(this.view,this);this._editTool.visible=!0,this.analysisViewData.cursorTarget=null,v(this.view,this)}finally{this._syncingActiveTool=!1}}}};function f(t){if(null==t)return null;const{featureExpressionInfo:e,mode:i,offset:o,unit:s}=t;return new a({featureExpressionInfo:e,mode:i,offset:o,unit:s})}t([s({constructOnly:!0})],y.prototype,"view",void 0),t([s({constructOnly:!0})],y.prototype,"analysis",void 0),t([s({constructOnly:!0})],y.prototype,"analysisViewData",void 0),t([s()],y.prototype,"active",null),t([s()],y.prototype,"canRedo",null),t([s()],y.prototype,"canUndo",null),t([s()],y.prototype,"state",null),t([s()],y.prototype,"cursor",null),t([s()],y.prototype,"updating",null),t([s()],y.prototype,"removeIncompleteOnCancel",void 0),t([s()],y.prototype,"snappingOptions",null),t([s()],y.prototype,"_canActivateEditTool",null),y=t([n("esri.views.3d.analysis.LineOfSight.LineOfSightTool")],y);export{y as LineOfSightTool};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{
|
|
2
|
+
import{hasFeatureExpressionInfo as o}from"../../../../support/elevationInfoUtils.js";function t(o,t){return n(o?.data.coordinateHelper.hasZ(),t)}function n(t,n){return!!t&&"on-the-ground"!==n.mode&&!o(n)}export{t as canMoveZOperations};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as s}from"../../../../geometry/projection/projectBoundingSphere.js";import{Sphere as n}from"../../../../geometry/support/sphere.js";import{NodeBoundingData as o,Node as r,NodeTraversalState as d}from"./I3SNode.js";import{addWraparound as a}from"./I3SUtil.js";import{ValidatedNode as l}from"./ValidatedNode.js";import{ElevationRange as h}from"../../support/ElevationRange.js";import{Obb as u}from"../../support/orientedBoundingBox.js";class c{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this._boundingData=s,this.node=n,this.parentIndex=-1,this.useAsHole=0,this.filterImpact=2,this.traversalState=null}get nodeBoundingData(){return this._boundingData}destroy(){this._boundingData=null,this.node=null,this.traversalState=null}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.nodeBoundingData?.invalidateServiceBVsInRenderSR()}}class g{constructor(e=new Array,t=new Array){this._nodeDescriptors=e,this._children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}destroy(){for(const e of this._nodeDescriptors)e.destroy();this._nodeDescriptors.length=0,this._children.length=0}get nodes(){return this._nodeDescriptors}addNode(e){return this._nodeDescriptors.push(e),this._nodeDescriptors.length-1}setNodes(e,t){this._nodeDescriptors=e,this._children=t}get children(){return this._children}}class _{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,r,d,a,l,h,u,c,_,f,v,N){if(this.viewingMode=t,this._layer=i,this._requester=n,this._clientNodeLoader=r,this._viewportQueries=d,this._logger=a,this.holeFilling=l,this._isLoaded=h,this._isReloading=u,this._shouldLoadNode=c,this._enable=_,this._needsUpdate=f,this._computeVisibilityObb=v,this._computeNodeFiltering=N,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=0,this._lodConversion=e=>e,this._isEditable=!1,this.urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=p(0),this._visibilityCacheVersion=p(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._progressiveLoadPenaltyWeight=10,this._missingPagesAndNodes=new Set,this._prioritizedMissingNodeAndPageIds=new Array,this._prefetchNodes=new Set,this._prioritizedPrefetchNodes=new Array,this._updates=new m(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this._pageQueue=new Array,this._newPages=new Array,this._needsNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,"page"===s.type){const e=s.rootPage;switch(this.urlPrefix=s.urlPrefix,this._pageSize=s.pageSize,s.lodMetric){case"maxScreenThreshold":this._lodMetric=1;break;case"maxScreenThresholdSQ":this._lodMetric=1,this._lodConversion=E}if(this._isEditable){this._rootIndex=-1;const t=I(s.rootIndex,s.pageSize),i=e.nodes[t],n={nodes:[{index:this._rootIndex,children:[s.rootIndex],mesh:void 0,obb:i.obb,lodThreshold:i.lodThreshold}]};this._addPage(P(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=s.rootIndex;this._addPage(P(s.rootIndex,this._pageSize),e),this._updateParentsAndLevel()}else if("node"===s.type){this.urlPrefix=s.urlPrefix;const e=new g;if(this._nodePages.set(0,e),this._isEditable){this._clientNodePage=new g;const e={id:"-1",version:null,mbs:s.rootNode.mbs,obb:s.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:s.rootNode.mbs,obb:s.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new o(e.id),-1);const t=this._validateNode(e.id,e);t&&this._addNode(t,this._rootIndex)}else this._rootIndex=this._makeRefNode(new o(s.rootNode.id),-1);const t=this._validateNode(s.rootNode.id,s.rootNode);t&&this._addNode(t,0)}}addClientNodeToIndex(e,t){const i=-1,s=new o(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_canRequest(e){return!this._requester.isFull(e)}_loadPage(e){if(this._nodePages.has(e))return void this._logger.error(`Requested load page [${e}] already loaded`);if(this._loadingPages.has(e))return void this._logger.error(`Requested load page [${e}] already loading`);this._loadingPages.add(e);const i=this.urlPrefix+e;this._requester.request(i,"json").then(t=>{this._nodePages.has(e)?this._logger.error(`Queued page [${e}] already loaded`):this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this._needsNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this._needsNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parentIndex;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e?.elevationRangeValid&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this._getParentIndex(t)}})}}_addPage(e,t){if(this._nodePages.has(e))return void this._logger.error(`Page[${e}] reloaded`);const i=[],s=[],o=t.nodes.map((t,o)=>{const d=i.length,a=t.children?t.children.length:0;s.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=u.fromJSON(t.obb),g=new n(h.getCenter(A),h.radius),_=t.mesh?.attribute,f=t.mesh?.geometry,m=t.mesh?.material,p={hasSharedResource:!1,isEmpty:null==f,attributes:null!=_?.resource?`${_.resource}`:void 0,geometry:null!=f?.resource?`${f.resource}`:void 0,texture:null!=m?.resource?`${m.resource}`:void 0,geometryDefinition:f?f.definition:-1,materialDefinition:m?m.definition:-1},N=new r(l,x(o,e,this._pageSize),g,a,0,p,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),f?.featureCount??null);return N.serviceObbInIndexSR=h,N.visibilityObbInRenderSR=this._computeVisibilityObb(N),N.vertexCount=f?f.vertexCount:0,new c(d,a,v(this._visibilityCacheVersion),null,N)}),d=new g(o,i);-1===e?this._clientNodePage=d:this._nodePages.set(e,d)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=I(t,this._pageSize),r=n.nodes[o];r.parentIndex=null!=i?i:-1;const d=r.node;null!=d&&(d.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=P(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeDescriptor(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[I(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=R(e.lodSelection),d=this._getNodeDescriptor(t);if(null!=d.node)return this._logger.error(`Loaded node[${t}] already in descriptor`),d.node;const a=new r(e.id,t,e.mbs,d.childCount,s,e.resources,e.version,n,o,e.numFeatures);d.node=a,e.obb&&(a.serviceObbInIndexSR=u.fromJSON(e.obb)),a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=d.nodeBoundingData;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new c(0,0,v(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new c(0,0,v(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=I(e,this._pageSize),n=I(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const d=1;o.childCount+=d,null!=o.node&&(o.node.childCount+=d);for(const a of i.nodes)a.childOffset>r&&(a.childOffset+=d);i.nodes[n].parentIndex=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this._getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,d=e=>{const i=I(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)d(s.children[t]);const r=n.node?.id??n.nodeBoundingData?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};d(e);const a=s.nodes,l=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<a.length;++g){const e=a[g];if(o.has(e))continue;const t=u.length,s=x(g,-1,this._pageSize),n=x(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.nodeBoundingData?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=x(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=l[s];if(t>=0)c.push(t);else{const i=I(t,this._pageSize),s=a[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parentIndex=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.setNodes(u,c),this._updateParentBoundingInformation(h[I(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const i=this._clientNodeLoader.indexSR,o=this._clientNodeLoader.renderSR,r=this._getNodeDescriptor(t);if(null==r)return;for(let n=0;n<r.childCount;n++){const r=this.getChildIndex(t,n),d=this._getNodeDescriptor(r),a=null!=d?d.nodeBoundingData||d.node:null;if(null!=a?.serviceMbsInIndexSR&&a.serviceMbsInIndexSR.radius>0)if(null==e)e=M.copyFrom(a.serviceMbsInIndexSR);else{const t=D;s(a.serviceMbsInIndexSR,i,t,o);const n=V;s(e,i,n,o),s(t.union(n),o,e,i)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=new n,t.serviceMbsInIndexSR.copyFrom(e)):t.serviceMbsInIndexSR?.invalidate(),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(r.nodeBoundingData),d(r.node),this.invalidateNodeVisibilityCacheInternal(r),t=this._getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeDescriptor(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeDescriptor(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.nodeBoundingData&&i.nodeBoundingData.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[I(e,this._pageSize)];return i.children[s.childOffset+t]}_getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[I(e,this._pageSize)]?.parentIndex:null}getParent(e){const t=this._getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeDescriptor(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=p(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeDescriptor(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=v(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeDescriptor(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeDescriptor(e);if(null==t)return;if(!this._needsNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.nodeBoundingData;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeDescriptor(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeValid(e){if(!this._needsNodeElevationRange)return!0;const t=e?.node??e?.nodeBoundingData;return!t||t.elevationRangeValid}_updateElevationRange(e,t){const i=this._getNodeDescriptor(e);if(!i)return!1;const s=i?.node??i?.nodeBoundingData;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new h;let o=!1;for(let a=0;a<i.childCount;a++){const t=this.getChildIndex(e,a),i=this._updateElevationRange(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}n.minElevation!==1/0&&n.maxElevation!==-1/0||n.expandElevationRangeValues(0,0);const{minElevation:r,maxElevation:d}=s;return r===n.minElevation&&d===n.maxElevation?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.nodeBoundingData?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeDescriptor(e);if(null==t)return!0;const i=t.nodeBoundingData;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeValid(t)&&b(t.visibilityCache,this._visibilityCacheVersion))return y(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this._needsNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=N(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&2===t.filterImpact){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):0}const o=null!=s&&1===t.filterImpact;let r=!(null!=s&&2===s.imModificationImpact)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this._needsNodeElevationRange&&this._updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=N(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeDescriptor(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&4===t.node.imModificationImpact)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,d=new Array;for(let a=t.childOffset;a<r;++a){const e=o.children[a],t=this._getNodeDescriptor(e);null!=t?.node&&this.isGeometryVisible(e)&&d.push(t)}s/=d.length;for(const a of d){const e=a.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,a,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeDescriptor(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(b(t.useAsHole,this._version))return y(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=N(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=p(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=4,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=2;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this.resetUpdateState(e);let s=!0;const n=new w,o=new C,r=this._imModificationUncategorized;r.clear();const d=new Set;let a=0;const l=(d,l,h)=>{const u=e=>{this._shouldLoadNode(e)&&e.childCount&&(s=!1)};if(!l){const e=P(d,this._pageSize);let t=this._getNodeLoadPriority(d);return t===1/0&&(t=this._getNodeLoadPriority(h)),f.set(e,Math.max(t,f.get(e)||0)),this._loadingPages.has(e)||this._failedPages.has(e)||(this._missingPagesAndNodes.add(e),++a),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,t))}const{node:c,childCount:g}=l;if(this._updateNodeFeatureEstimate(c,o),!c){const e=this._getNodeLoadPriority(d);return this._loadingNodes.has(d)||this._failedNodes.has(d)||(this._missingPagesAndNodes.add(d),f.set(d,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(d);if(!this._useNodePages&&0===this._missingPagesAndNodes.size)for(let e=0;e<g;e++){const t=_.children[l.childOffset+e],i=this._getNodeDescriptor(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(f.set(t,this._getNodeLoadPriority(t)),this._prefetchNodes.add(t))}if(c.failed||c.resources.isEmpty)return void u(c);if(this._isLoaded(d)){if(n.known+=c.memory,++n.knownNodes,u(c),this._shouldLoadNode(c)||(n.unremoved+=c.memory),this._needsUpdate(c)){const e=this._getNodeLoadPriority(d);f.set(d,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(d)}return}if(c.memory&&(n.known+=c.memory,++n.knownNodes),!this._shouldLoadNode(c))return void(this._isReloading(d)&&this._updates.remove.push(d));if(u(c),c.memory?(n.missing+=c.memory,n.known+=c.memory,++n.knownNodes):++n.missingNodes,e.includes(c.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._getNodeLoadPriority(d)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==c.index));if(!t.done&&this._enable(c))return void t.madeProgress();const m=this._getNodeLoadPriority(d);f.set(d,m),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,m),this._updates.add.push(d),this.layerHasModifications&&i&&null!=c&&4===c.imModificationImpact&&r.push(d)};this.traverseVisible(l,d),this._frameNumber++,this._prioritizeMissingNodesAndPages(),this._removeUnusedNodePages(d,a),this._handleModifications(i,r),this._updateUnloadedMemoryEstimate(n),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>f.get(e)>=this._maxUnloadedPrio).sort((e,t)=>f.get(e)-f.get(t)),this._updates.update.sort((e,t)=>f.get(e)-f.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.size,this._dirty=this._indexMissing>0,f.clear()}_updateUnloadedMemoryEstimate(e){this._unloadedMemoryEstimate=e.missing-e.unremoved,e.knownNodes>3&&e.missingNodes>0&&(this._unloadedMemoryEstimate+=e.known/e.knownNodes*e.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate)}resetUpdateState(e){this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),f.clear()}_prioritizeMissingNodesAndPages(){const e=this._prioritizedMissingNodeAndPageIds;e.length=0,this._missingPagesAndNodes.forEach(t=>e.push(t)),e.sort((e,t)=>f.get(e)-f.get(t)),e.length>0&&(this._maxUnloadedPrio=f.get(e[e.length-1]),this._prefetchNodes.clear())}_handleModifications(e,t){this.layerHasModifications&&0!==this._updates.add.length&&(t.length>0&&e?.(t),this._updates.add.filterInPlace(e=>{const t=this._getNodeDescriptor(e),i=null==t?.node||2!==t.node.imModificationImpact;return i||this.invalidateNodeVisibilityCache(e),i}))}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new C;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=p(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>O&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=O})}}_updateFeatureEstimate(e,t){this._version=p(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._shouldLoadNode(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._prioritizedMissingNodeAndPageIds,this._missingPagesAndNodes)}prefetch(){const e=this._prioritizedPrefetchNodes;return this._prefetchNodes.forEach(t=>e.push(t)),e.sort((e,t)=>f.get(e)-f.get(t)),this._load(e,this._prefetchNodes)}_load(e,t){if(0===e.length||!this._canRequest(this.urlPrefix))return!1;for(;e.length>0&&this._canRequest(this.urlPrefix);){const i=e[e.length-1];e.length--,t.delete(i),this._useNodePages&&i>=0?this._loadPage(i):this._loadNode(i)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.size>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeDescriptor(t);if(!i)return null;let s=i?.traversalState;if(s&&b(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this._getParentIndex(t);if(null!=e){const t=this._getNodeDescriptor(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=N(!0,this._version),s):(s=new d(o,r,n,N(!0,this._version)),i.traversalState=s,s)}_loadNode(e){if(this._loadingNodes.has(e))return void this._logger.error(`Node[${e}] already loading`);this._loadingNodes.add(e);const i=this._getNodeDescriptor(e);if(i.node)return void this._logger.error(`Node[${e}] already in descriptor`);const s=i.nodeBoundingData;if(null==s)return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,r=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.size&&0===this._loadingNodes.size&&this.requestUpdate()};(e>=0?this._requester.request(o,"json"):this._clientNodeLoader.loadNodeJSON(n)).then(t=>{r();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}).catch(i=>{r(),t(i)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+o),this._failedNodes.add(e))})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,r=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${r?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const d=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,a=1===t.featureData?.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,h=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;const s=new o(`${t.id}`,new n(t.mbs));return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?u.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},c=Array.isArray(t.children)?t.children.map(h).filter(e=>null!=e):null,g=t.featureData?.length??!1,_=!0===t.isEmpty;return new l(e,new n(t.mbs),d,"string"==typeof t.version?t.version:null,{isEmpty:!g&&_,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},c,Array.isArray(t.lodSelection)?t.lodSelection:null,a)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_getNodeLoadPriority(e){const t=this._getNodeDescriptor(e),i=this._getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._getNodeLoadPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeDescriptor(i);s=e.traversalState?.lodLevel??0}const n=this._getHoleBonus(e);return-(this._viewportQueries.distToCameraPOIRay(t.nodeBoundingData??t.node)*(1+s)+s*this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI())+n}_getHoleBonus(e){return this._hasLoadedAncestor(e)?0:this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI()}_hasLoadedAncestor(e){let t=this._getParentIndex(e);for(;null!=t;){if(this._isLoaded(t))return!0;t=this._getParentIndex(t)}return!1}traverseVisible(e,t){const i=this._getNodeDescriptor(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=P(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const d=this._getPageFromPageIndex(o);for(let a=0;a<i.childCount;a++){const t=d.children[i.childOffset+a],o=this._getNodeDescriptor(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=P(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){for(const i of this.traverseValues(e,t));}*traverseValues(e,t){t(e)&&(yield e,yield*this._traverseDescendantValues(e,t))}*_traverseDescendantValues(e,t){const i=e.index,s=this._pageSize,n=P(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,d=this._nodePages,a=I(i,s),l=o.nodes[a],h=l.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=new Array;let g=0;{const{childOffset:e,childCount:t}=l,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],d=r.node;if(!d||!t(d))continue;yield d;const{childCount:a}=r;if(0===a)continue;const{childOffset:l}=r,h=l+a;for(let e=l;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,a=o,l=a.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=a;else{const e=n/s|0,t=d.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,a=o,l=a.nodes,i=s*e}const h=l[n-i],u=h.node;if(null==u||!1===t(u))continue;yield u;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,p=v+_;for(let e=v;e<p;++e)c[g]=m[e],++g}}else{const i=d.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;yield o;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const d=i.children,{childOffset:a}=n,l=a+r;for(let e=a;e<l;++e)c[g]=d[e],++g}}}}traverseDescendants(e,t){for(const i of this._traverseDescendantValues(e,t));}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this._needsNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.nodeBoundingData?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(P(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){if(!this._nodePages.has(e))return void this._logger.error(`Destroying non-existent page ${e}`);const t=this._nodePages.get(e);this._nodePages.delete(e),t?.destroy()}get test(){}}const f=new Map;class m{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function v(e){return a(e,-2)}function p(e){return a(e,2)}function N(e,t){return t+(e?1:0)}function b(e,t){return(-2&e)===t}function y(e){return!(1&~e)}function P(e,t){return e<0?-1:t>0?e/t|0:0}function I(e,t){return e<0?-e-1:0===t?e:e%t}function x(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const S=[["maxScreenThreshold",1],["screenSpaceRelative",2],["removedFeatureDiameter",3],["distanceRangeFromDefaultCamera",4]];function R(e){if(e)for(let t=0;t<e.length;t++)for(const i of S)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:0,maxError:0}}class w{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class C{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function E(e){return Math.sqrt(e*(4/Math.PI))}const M=new n,D=new n,V=new n,A=i(),O=has("esri-mobile")?100:300;export{_ as I3SIndex,R as selectErrorMetric};
|
|
2
|
+
import has from"../../../../core/has.js";import e from"../../../../core/PooledArray.js";import{isAbortError as t}from"../../../../core/promiseUtils.js";import{create as i}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{projectBoundingSphere as s}from"../../../../geometry/projection/projectBoundingSphere.js";import{Sphere as n}from"../../../../geometry/support/sphere.js";import{NodeBoundingData as o,Node as r,NodeTraversalState as d}from"./I3SNode.js";import{addWraparound as a}from"./I3SUtil.js";import{ValidatedNode as l}from"./ValidatedNode.js";import{ElevationRange as h}from"../../support/ElevationRange.js";import{Obb as u}from"../../support/orientedBoundingBox.js";class c{constructor(e,t,i,s,n){this.childOffset=e,this.childCount=t,this.visibilityCache=i,this._boundingData=s,this.node=n,this.parentIndex=-1,this.useAsHole=0,this.filterImpact=2,this.traversalState=null}get nodeBoundingData(){return this._boundingData}destroy(){this._boundingData=null,this.node=null,this.traversalState=null}invalidateBounds(){this.node?.invalidateServiceBVsInRenderSR(),this.nodeBoundingData?.invalidateServiceBVsInRenderSR()}}class g{constructor(e=new Array,t=new Array){this._nodeDescriptors=e,this._children=t,this.lastTraversed=0,this.numNodesWithLoadedChildren=0}destroy(){for(const e of this._nodeDescriptors)e.destroy();this._nodeDescriptors.length=0,this._children.length=0}get nodes(){return this._nodeDescriptors}addNode(e){return this._nodeDescriptors.push(e),this._nodeDescriptors.length-1}setNodes(e,t){this._nodeDescriptors=e,this._children=t}get children(){return this._children}}class _{get _useNodePages(){return this._pageSize>0}constructor(t,i,s,n,r,d,a,l,h,u,c,_,f,v,N){if(this.viewingMode=t,this._layer=i,this._requester=n,this._clientNodeLoader=r,this._viewportQueries=d,this._logger=a,this.holeFilling=l,this._isLoaded=h,this._isReloading=u,this._shouldLoadNode=c,this._enable=_,this._needsUpdate=f,this._computeVisibilityObb=v,this._computeNodeFiltering=N,this._dirty=!0,this._nodePages=new Map,this._clientNodePage=null,this._pageSize=0,this._rootIndex=0,this._lodMetric=0,this._lodConversion=e=>e,this._isEditable=!1,this.urlPrefix="",this._loadingNodes=new Set,this._loadingPages=new Set,this._failedNodes=new Set,this._failedPages=new Set,this._indexMissing=1,this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.POSITIVE_INFINITY,this._version=p(0),this._visibilityCacheVersion=p(0),this._maxLevel=1,this._featureEstimate={estimate:0,leavesReached:!1},this._unloadedMemoryEstimate=0,this._progressiveLoadPenaltyWeight=10,this._missingPagesAndNodes=new Set,this._prioritizedMissingNodeAndPageIds=new Array,this._prefetchNodes=new Set,this._prioritizedPrefetchNodes=new Array,this._updates=new m(this._missingPagesAndNodes),this._imModificationUncategorized=new e({deallocator:null}),this.ignoreServiceObb=!1,this._pageQueue=new Array,this._newPages=new Array,this._needsNodeElevationRange=!1,this.layerHasModifications=!1,this._layerHasFilter=!1,this._frameNumber=0,this._isEditable=null!=i.associatedLayer?.infoFor3D,i.serviceUpdateTimeStamp?.lastUpdate&&(this._lastUpdate=`${i.serviceUpdateTimeStamp.lastUpdate}`),this._maxLodLevel=this._viewportQueries?this._viewportQueries.maxLodLevel:1,"page"===s.type){const e=s.rootPage;switch(this.urlPrefix=s.urlPrefix,this._pageSize=s.pageSize,s.lodMetric){case"maxScreenThreshold":this._lodMetric=1;break;case"maxScreenThresholdSQ":this._lodMetric=1,this._lodConversion=E}if(this._isEditable){this._rootIndex=-1;const t=I(s.rootIndex,s.pageSize),i=e.nodes[t],n={nodes:[{index:this._rootIndex,children:[s.rootIndex],mesh:void 0,obb:i.obb,lodThreshold:i.lodThreshold}]};this._addPage(P(this._rootIndex,this._pageSize),n),this.getNode(-1).serviceObbInIndexSR=void 0}else this._rootIndex=s.rootIndex;this._addPage(P(s.rootIndex,this._pageSize),e),this._updateParentsAndLevel()}else if("node"===s.type){this.urlPrefix=s.urlPrefix;const e=new g;if(this._nodePages.set(0,e),this._isEditable){this._clientNodePage=new g;const e={id:"-1",version:null,mbs:s.rootNode.mbs,obb:s.rootNode.obb,sharedResource:null,geometryData:null,attributeData:null,featureData:null,children:[{id:"root",href:"../root",mbs:s.rootNode.mbs,obb:s.rootNode.obb}]};this._rootIndex=this._makeClientRefNode(new o(e.id),-1);const t=this._validateNode(e.id,e);t&&this._addNode(t,this._rootIndex)}else this._rootIndex=this._makeRefNode(new o(s.rootNode.id),-1);const t=this._validateNode(s.rootNode.id,s.rootNode);t&&this._addNode(t,0)}}addClientNodeToIndex(e,t){const i=-1,s=new o(e,t),n=this._makeClientRefNode(s,i);return this._linkChildToParentNode(i,n),this.requestUpdate(),n}removeClientNodeFromIndex(e,t,i){this._destroyClientRefNode(e,t,i),this.requestUpdate()}_canRequest(e){return!this._requester.isFull(e)}_loadPage(e){if(this._nodePages.has(e))return void this._logger.error(`Requested load page [${e}] already loaded`);if(this._loadingPages.has(e))return void this._logger.error(`Requested load page [${e}] already loading`);this._loadingPages.add(e);const i=this.urlPrefix+e;this._requester.request(i,"json").then(t=>{this._nodePages.has(e)?this._logger.error(`Queued page [${e}] already loaded`):this._pageQueue.push({pageIndex:e,page:t})}).catch(i=>{this._loadingPages.delete(e),t(i)||(this._failedPages.add(e),this._logger.error("#loadPage()",this._layer,`Error when loading page ${e}`,i))})}_addQueuedPages(e){for(;this._pageQueue.length>0&&!e.done;){const{pageIndex:t,page:i}=this._pageQueue.shift();this._addPage(t,i),this._loadingPages.delete(t),e.madeProgress(),this._needsNodeElevationRange&&this._newPages.push(t)}this._updateParentsAndLevel()}_invalidateElevationRangeForNewPages(e){if(this._needsNodeElevationRange)for(;this._newPages.length>0&&!e.done;){const e=this._nodePages.get(this._newPages.shift());e?.nodes.forEach(e=>{let t=e.parentIndex;for(;null!=t&&t!==this._rootIndex;){const e=this.getNode(t);e?.elevationRangeValid&&(e.invalidateElevationRange(),this.invalidateBoundingVolumeCache(t)),t=this._getParentIndex(t)}})}}_addPage(e,t){if(this._nodePages.has(e))return void this._logger.error(`Page[${e}] reloaded`);const i=[],s=[],o=t.nodes.map((t,o)=>{const d=i.length,a=t.children?t.children.length:0;s.push(this._rootIndex);for(let e=0;e<a;e++)i.push(t.children[e]);const l=`${t.index}`,h=u.fromJSON(t.obb),g=new n(h.getCenter(A),h.radius),_=t.mesh?.attribute,f=t.mesh?.geometry,m=t.mesh?.material,p={hasSharedResource:!1,isEmpty:null==f,attributes:null!=_?.resource?`${_.resource}`:void 0,geometry:null!=f?.resource?`${f.resource}`:void 0,texture:null!=m?.resource?`${m.resource}`:void 0,geometryDefinition:f?f.definition:-1,materialDefinition:m?m.definition:-1},N=new r(l,x(o,e,this._pageSize),g,a,0,p,this._lastUpdate,this._lodMetric,this._lodConversion(t.lodThreshold),f?.featureCount??null,h);return N.visibilityObbInRenderSR=this._computeVisibilityObb(N),N.vertexCount=f?f.vertexCount:0,new c(d,a,v(this._visibilityCacheVersion),null,N)}),d=new g(o,i);-1===e?this._clientNodePage=d:this._nodePages.set(e,d)}_updateParentsAndLevel(){const e=new Array,t=(t,i,s)=>{const n=this._getPage(t);if(null!=n){const o=I(t,this._pageSize),r=n.nodes[o];r.parentIndex=null!=i?i:-1;const d=r.node;null!=d&&(d.level=s,e.push(t))}};for(t(this._rootIndex,null,0);e.length;){const i=e.pop(),s=this.getNode(i);if(null!=s)for(let e=0;e<s.childCount;e++){t(this.getChildIndex(s.index,e),i,s.level+1),this._maxLevel=Math.max(this._maxLevel,s.level+1)}}}_getPage(e){const t=P(e,this._pageSize);return this._getPageFromPageIndex(t)}_getPageFromPageIndex(e){return e<0?this._clientNodePage:this._nodePages.get(e)}_getNodeDescriptor(e){const t=this._getPage(e);return null==t?null:(t.lastTraversed=this._frameNumber,t.nodes[I(e,this._pageSize)])}_addNode(e,t){e.children&&this.populateChildren(t,e.children);const i=this.getParent(t),s=null!=i?i.level+1:0;this._maxLevel=Math.max(this._maxLevel,e.children?s+1:s);const{lodMetric:n,maxError:o}=R(e.lodSelection),d=this._getNodeDescriptor(t);if(null!=d.node)return this._logger.error(`Loaded node[${t}] already in descriptor`),d.node;const a=new r(e.id,t,e.mbs,d.childCount,s,e.resources,e.version,n,o,e.numFeatures,e.obb?u.fromJSON(e.obb):null);d.node=a,a.visibilityObbInRenderSR=this._computeVisibilityObb(a);const l=d.nodeBoundingData;return null!=l&&(null==l.serviceMbsInIndexSR&&(l.serviceMbsInIndexSR=e.mbs),a.shareServiceBVsInRenderSRWith(l),l.visibilityObbInRenderSR=a.visibilityObbInRenderSR),a}_makeRefNode(e,t){const i=this._nodePages.get(0);if(t<-1)return this._makeClientRefNode(e,t);if(null==i)return-1;const s=i.nodes.length,n=new c(0,0,v(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_makeClientRefNode(e,t){const i=this._clientNodePage;if(null==i)return-1;if(t>=0)throw new Error("I3SIndex::client side nodes can not be made children of service side nodes.");const s=-(i.nodes.length+1),n=new c(0,0,v(this._visibilityCacheVersion),e,null);return i.addNode(n),n.parentIndex=t,e.invalidateServiceBVsInRenderSR(),s}_linkChildToParentNode(e,t){const i=this._clientNodePage;if(null==i||e>=0)return;const s=I(e,this._pageSize),n=I(t,this._pageSize),o=i.nodes[s],r=o.childOffset;i.children.splice(o.childOffset+o.childCount,0,t);const d=1;o.childCount+=d,null!=o.node&&(o.node.childCount+=d);for(const a of i.nodes)a.childOffset>r&&(a.childOffset+=d);i.nodes[n].parentIndex=e,this._updateParentBoundingInformation(e)}_destroyClientRefNode(e,t,i){const s=this._clientNodePage;if(null==s)return;const n=this._getParentIndex(e);if(null==n)return;const o=new Set,r=new Map,d=e=>{const i=I(e,this._pageSize),n=s.nodes[i];if(n.childCount>0)for(let t=n.childOffset;t<n.childOffset+n.childCount;++t)d(s.children[t]);const r=n.node?.id??n.nodeBoundingData?.id;if(null==r)throw new Error("Node has no id");t(r,e),o.add(n)};d(e);const a=s.nodes,l=s.children,h=s.nodes.map(()=>-1),u=[],c=[];for(let g=0;g<a.length;++g){const e=a[g];if(o.has(e))continue;const t=u.length,s=x(g,-1,this._pageSize),n=x(t,-1,this._pageSize);if(e.node&&(e.node.index=n),h[g]=n,u.push(e),s!==n){const t=e.node?.id??e.nodeBoundingData?.id;if(null==t)throw new Error("Node has no id");i(t,s,n),r.set(s,n)}}for(let g=0;g<u.length;++g){const e=x(g,-1,this._pageSize),t=u[g],i=c.length;for(let s=t.childOffset;s<t.childOffset+t.childCount;++s){const t=l[s];if(t>=0)c.push(t);else{const i=I(t,this._pageSize),s=a[i];if(o.has(s))continue;const n=h[i];c.push(n),s.parentIndex=e}}t.childOffset=i,t.childCount=c.length-i,t.node&&(t.node.childCount=t.childCount)}s.setNodes(u,c),this._updateParentBoundingInformation(h[I(n,this._pageSize)])}_updateParentBoundingInformation(e){let t=e;do{let e=null;const i=this._clientNodeLoader.indexSR,o=this._clientNodeLoader.renderSR,r=this._getNodeDescriptor(t);if(null==r)return;for(let n=0;n<r.childCount;n++){const r=this.getChildIndex(t,n),d=this._getNodeDescriptor(r),a=null!=d?d.nodeBoundingData||d.node:null;if(null!=a?.serviceMbsInIndexSR&&a.serviceMbsInIndexSR.radius>0)if(null==e)e=M.copyFrom(a.serviceMbsInIndexSR);else{const t=D;s(a.serviceMbsInIndexSR,i,t,o);const n=V;s(e,i,n,o),s(t.union(n),o,e,i)}}const d=t=>{null!=t&&(t.serviceObbInIndexSR=null,null!=e?(t.serviceMbsInIndexSR??=new n,t.serviceMbsInIndexSR.copyFrom(e)):t.serviceMbsInIndexSR?.invalidate(),t.invalidateServiceBVsInRenderSR(),t.geometryObbInRenderSR=null)};d(r.nodeBoundingData),d(r.node),this.invalidateNodeVisibilityCacheInternal(r),t=this._getParentIndex(t)}while(null!=t)}populateChildren(e,t){const i=this._getNodeDescriptor(e),s=this._getPage(e);i.childOffset=s.children.length,i.childCount=t.length;for(let n=0;n<t.length;n++){const i=this._makeRefNode(t[n],e);s.children.push(i)}}getNode(e){const t=this._getNodeDescriptor(e);return null!=t?t.node:null}getIndexById(e){let t;return this._forAllNodes((i,s)=>{(null!=i.node&&i.node.id===e||null!=i.nodeBoundingData&&i.nodeBoundingData.id===e)&&(t=s)}),t}getNodeById(e){const t=this.getIndexById(e);return null!=t&&t>=0?this.getNode(t):null}getChildIndex(e,t){const i=this._getPage(e);if(null==i)return-1;const s=i.nodes[I(e,this._pageSize)];return i.children[s.childOffset+t]}_getParentIndex(e){const t=this._getPage(e);return null!=t&&e!==this._rootIndex?t.nodes[I(e,this._pageSize)]?.parentIndex:null}getParent(e){const t=this._getParentIndex(e);return null!=t?this.getNode(t):null}isLeaf(e){const t=this._getNodeDescriptor(e);return null!=t&&0===t.childCount}get rootNode(){return this.getNode(this._rootIndex)}get isEditable(){return this._isEditable}removeAllGeometryObbs(){this._forAllNodes(e=>{null!=e.node&&(e.node.geometryObbInRenderSR=null)})}invalidateVisibilityCache(){this._visibilityCacheVersion=p(this._visibilityCacheVersion)}invalidateNodeVisibilityCache(e){const t=this._getNodeDescriptor(e);null!=t&&this.invalidateNodeVisibilityCacheInternal(t)}invalidateNodeVisibilityCacheInternal(e){e.visibilityCache=v(this._visibilityCacheVersion)}invalidateBoundingVolumeCache(e){const t=this._getNodeDescriptor(e);null!=t&&(t?.invalidateBounds(),this.invalidateNodeVisibilityCacheInternal(t))}updateElevationChanged(e){const t=this._getNodeDescriptor(e);if(null==t)return;if(!this._needsNodeElevationRange)return void this.invalidateBoundingVolumeCache(e);const i=null!=t.node?t.node:t.nodeBoundingData;null!=i&&i.invalidateElevationRange()}invalidateGeometryVisibility(e){const t=this._getNodeDescriptor(e),i=t?.node;i&&(i.geometryObbInRenderSR=null,i.invalidateServiceBVsInRenderSR())}invalidateVisibilityObbs(){null!=this.rootNode&&this.traverse(this.rootNode,e=>(e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.geometryObbInRenderSR=null,!0))}_isElevationRangeValid(e){if(!this._needsNodeElevationRange)return!0;const t=e?.node??e?.nodeBoundingData;return!t||t.elevationRangeValid}_updateElevationRange(e,t){const i=this._getNodeDescriptor(e);if(!i)return!1;const s=i?.node??i?.nodeBoundingData;if(!s)return!1;if(s.elevationRangeValid)return t?.expandElevationRange(s),!0;const n=new h;let o=!1;for(let a=0;a<i.childCount;a++){const t=this.getChildIndex(e,a),i=this._updateElevationRange(t,n);o=o||!i}if(0===i.childCount||o){const e=!i.node?.resources.isEmpty;this._viewportQueries.expandElevationRange(s,e,n)}n.minElevation!==1/0&&n.maxElevation!==-1/0||n.expandElevationRangeValues(0,0);const{minElevation:r,maxElevation:d}=s;return r===n.minElevation&&d===n.maxElevation?(t?.expandElevationRange(s),!0):(i.node?.setElevationRange(n),i.nodeBoundingData?.setElevationRange(n),this.invalidateBoundingVolumeCache(e),t?.expandElevationRange(s),!0)}isNodeVisible(e){const t=this._getNodeDescriptor(e);if(null==t)return!0;const i=t.nodeBoundingData;if(null!=i&&!i.serviceMbsInIndexSR)return!0;if(this._isElevationRangeValid(t)&&b(t.visibilityCache,this._visibilityCacheVersion))return y(t.visibilityCache);const s=t.node,n=this._viewportQueries;if(s){const e=n.ensureElevationAgnosticBoundingVolume(s),i=n.isElevationAgnosticBoundingVolumeVisible(e);let o=i;if(this._needsNodeElevationRange&&i){const t=n.getNodeObbInRenderSRIndependentOfElevationOffset(s);null!=t&&(o=n.isObbVisibleIndependentOfElevation(e,t))}if(!o)return t.visibilityCache=N(!1,this._visibilityCacheVersion),!1}if(this._layerHasFilter&&this._computeNodeFiltering&&(null!=s||null!=i)&&2===t.filterImpact){const e=null!=s?s.serviceMbsInIndexSR:null!=i?i.serviceMbsInIndexSR:null;t.filterImpact=null!=e?this._computeNodeFiltering(e):0}const o=null!=s&&1===t.filterImpact;let r=!(null!=s&&2===s.imModificationImpact)&&!o;if(r){const t=!s||i&&!s.visibilityObbInRenderSR?i??null:s;if(null!=t){this._needsNodeElevationRange&&this._updateElevationRange(e);r=n.isNodeVisible(t)}}return t.visibilityCache=N(r,this._visibilityCacheVersion),r}isGeometryVisible(e){if(!this.isNodeVisible(e))return!1;const t=this._getNodeDescriptor(e);return!!(null==t?.node?.geometryObbInRenderSR||this.layerHasModifications&&4===t.node.imModificationImpact)||this._viewportQueries.isGeometryVisible(t.node)}_traverseCoverage(e,t,i,s,n){const o=this._getPage(e);if(null==o||0===t.childCount)return;const r=t.childOffset+t.childCount,d=new Array;for(let a=t.childOffset;a<r;++a){const e=o.children[a],t=this._getNodeDescriptor(e);null!=t?.node&&this.isGeometryVisible(e)&&d.push(t)}s/=d.length;for(const a of d){const e=a.node.index;this._isLoaded(e)||this._isReloading(e)?(n.delta=Math.max(n.delta,i),n.coverage+=s):this._traverseCoverage(e,a,i+1,s,n)}}useNodeAsHole(e){if("off"===this.holeFilling)return!1;const t=this._getNodeDescriptor(e);if(null==t)return!1;if("always"===this.holeFilling)return!0;if(b(t.useAsHole,this._version))return y(t.useAsHole);const i={delta:0,coverage:0};this._traverseCoverage(e,t,0,1,i);const s=i.delta*i.coverage<=.5;return t.useAsHole=N(s,this._version),s}get maxLevel(){return this._maxLevel}get dirty(){return this._dirty}destroy(){this._updates.destroy(),this._nodePages.clear(),this._clientNodePage=null,this._layer=null,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._imModificationUncategorized.prune()}requestUpdate(){this._dirty=!0,this._indexMissing=1,this._version=p(this._version)}imModificationsChanged(e){this.layerHasModifications=e,this._forAllNodes(({node:e})=>{null!=e&&(e.imModificationImpact=4,e.visibilityObbInRenderSR=this._computeVisibilityObb(e),e.hasModifications&&this.invalidateGeometryVisibility(e.index))}),this.invalidateVisibilityCache()}layerFilterChanged(e){this._layerHasFilter=e,this._forAllNodes(e=>{if(null!=e){e.filterImpact=2;const t=e.node;null!=t&&this.invalidateNodeVisibilityCache(t.index)}}),this.invalidateVisibilityCache()}update(e,t,i){if(!this._dirty)return;this._pageQueue.length>0&&this._addQueuedPages(t),this._invalidateElevationRangeForNewPages(t),this.resetUpdateState(e);let s=!0;const n=new w,o=new C,r=this._imModificationUncategorized;r.clear();const d=new Set;let a=0;const l=(d,l,h)=>{const u=e=>{this._shouldLoadNode(e)&&e.childCount&&(s=!1)};if(!l){const e=P(d,this._pageSize);let t=this._getNodeLoadPriority(d);return t===1/0&&(t=this._getNodeLoadPriority(h)),f.set(e,Math.max(t,f.get(e)||0)),this._loadingPages.has(e)||this._failedPages.has(e)||(this._missingPagesAndNodes.add(e),++a),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,t))}const{node:c,childCount:g}=l;if(this._updateNodeFeatureEstimate(c,o),!c){const e=this._getNodeLoadPriority(d);return this._loadingNodes.has(d)||this._failedNodes.has(d)||(this._missingPagesAndNodes.add(d),f.set(d,e)),void(this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e))}const _=this._getPage(d);if(!this._useNodePages&&0===this._missingPagesAndNodes.size)for(let e=0;e<g;e++){const t=_.children[l.childOffset+e],i=this._getNodeDescriptor(t);null!=i&&!i.node&&!this._loadingNodes.has(t)&&!this._failedNodes.has(t)&&t>=0&&(f.set(t,this._getNodeLoadPriority(t)),this._prefetchNodes.add(t))}if(c.failed||c.resources.isEmpty)return void u(c);if(this._isLoaded(d)){if(n.known+=c.memory,++n.knownNodes,u(c),this._shouldLoadNode(c)||(n.unremoved+=c.memory),this._needsUpdate(c)){const e=this._getNodeLoadPriority(d);f.set(d,e),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,e),this._updates.update.push(d)}return}if(c.memory&&(n.known+=c.memory,++n.knownNodes),!this._shouldLoadNode(c))return void(this._isReloading(d)&&this._updates.remove.push(d));if(u(c),c.memory?(n.missing+=c.memory,n.known+=c.memory,++n.knownNodes):++n.missingNodes,e.includes(c.index))return this._maxProcessingPrio=Math.max(this._maxProcessingPrio,this._getNodeLoadPriority(d)),void(this._updates.cancel=this._updates.cancel.filter(e=>e!==c.index));if(!t.done&&this._enable(c))return void t.madeProgress();const m=this._getNodeLoadPriority(d);f.set(d,m),this._maxProcessingPrio=Math.max(this._maxProcessingPrio,m),this._updates.add.push(d),this.layerHasModifications&&i&&null!=c&&4===c.imModificationImpact&&r.push(d)};this.traverseVisible(l,d),this._frameNumber++,this._prioritizeMissingNodesAndPages(),this._removeUnusedNodePages(d,a),this._handleModifications(i,r),this._updateUnloadedMemoryEstimate(n),this._featureEstimate.estimate=this._computeFeatureEstimate(o),this._featureEstimate.leavesReached=s,this._updates.add.filterInPlace(e=>f.get(e)>=this._maxUnloadedPrio).sort((e,t)=>f.get(e)-f.get(t)),this._updates.update.sort((e,t)=>f.get(e)-f.get(t)),this._indexMissing=this._loadingPages.size+this._loadingNodes.size+this._missingPagesAndNodes.size,this._dirty=this._indexMissing>0,f.clear()}_updateUnloadedMemoryEstimate(e){this._unloadedMemoryEstimate=e.missing-e.unremoved,e.knownNodes>3&&e.missingNodes>0&&(this._unloadedMemoryEstimate+=e.known/e.knownNodes*e.missingNodes),this._unloadedMemoryEstimate=.8*Math.max(0,this._unloadedMemoryEstimate)}resetUpdateState(e){this._maxUnloadedPrio=Number.NEGATIVE_INFINITY,this._maxProcessingPrio=Number.NEGATIVE_INFINITY,this._missingPagesAndNodes.clear(),this._prefetchNodes.clear(),this._updates.reset(e),f.clear()}_prioritizeMissingNodesAndPages(){const e=this._prioritizedMissingNodeAndPageIds;e.length=0,this._missingPagesAndNodes.forEach(t=>e.push(t)),e.sort((e,t)=>f.get(e)-f.get(t)),e.length>0&&(this._maxUnloadedPrio=f.get(e[e.length-1]),this._prefetchNodes.clear())}_handleModifications(e,t){this.layerHasModifications&&0!==this._updates.add.length&&(t.length>0&&e?.(t),this._updates.add.filterInPlace(e=>{const t=this._getNodeDescriptor(e),i=null==t?.node||2!==t.node.imModificationImpact;return i||this.invalidateNodeVisibilityCache(e),i}))}checkFeatureTarget(e,t){const i=this._viewportQueries.updateScreenSpaceErrorBias(t);let s=t,n=t,o=i,r=10;for(;r--;){const i=new C;this._updateFeatureEstimate(s,i);if(this._computeFeatureEstimate(i)<=e){if(s>=t||i.missingNodes>0||0===r)break;o=s,s=.5*(s+n)}else n=s,s=.5*(s+o)}return this._version=p(this._version),this._viewportQueries.updateScreenSpaceErrorBias(i),Math.min(t,s)}_removeUnusedNodePages(e,t){if(!this._useNodePages)return;const i=e.size,s=this._nodePages,n=s.size+this._loadingPages.size+t;if(n>O&&n>i){const t=new Array;for(const[i,n]of s)0!==n.numNodesWithLoadedChildren||e.has(i)||t.push([n.lastTraversed,i]);t.sort((e,t)=>e[0]-t[0]).some(e=>{const t=e[1];return this._deleteNodePage(t),s.size<=O})}}_updateFeatureEstimate(e,t){this._version=p(this._version),this._viewportQueries.updateScreenSpaceErrorBias(e),this.traverseVisible((e,i)=>this._updateNodeFeatureEstimate(i?.node,t))}_updateNodeFeatureEstimate(e,t){null!=e&&!e.failed&&this._shouldLoadNode(e)&&(null!=e.numFeatures?(t.numFeatures+=e.numFeatures,++t.knownNodes):++t.missingNodes)}_computeFeatureEstimate(e){let t=e.numFeatures;return e.knownNodes>3&&e.missingNodes>0&&(t+=e.numFeatures/e.knownNodes*e.missingNodes),Math.max(0,t)}load(){return this._load(this._prioritizedMissingNodeAndPageIds,this._missingPagesAndNodes)}prefetch(){const e=this._prioritizedPrefetchNodes;return this._prefetchNodes.forEach(t=>e.push(t)),e.sort((e,t)=>f.get(e)-f.get(t)),this._load(e,this._prefetchNodes)}_load(e,t){if(0===e.length||!this._canRequest(this.urlPrefix))return!1;for(;e.length>0&&this._canRequest(this.urlPrefix);){const i=e[e.length-1];e.length--,t.delete(i),this._useNodePages&&i>=0?this._loadPage(i):this._loadNode(i)}return!0}get isLoading(){return this._indexMissing>0}get isPrefetching(){return this._prefetchNodes.size>0}get indexLoading(){return this._loadingPages.size+this._loadingNodes.size}get indexMissing(){return this._indexMissing}get unloadedMemoryEstimate(){return this._unloadedMemoryEstimate}get updates(){return this._updates}get featureEstimate(){return this._featureEstimate}get maxPriority(){return Math.max(this._maxProcessingPrio,this._maxUnloadedPrio)}nodeTraversalState(e){if(null==e)return null;const t=e.index,i=this._getNodeDescriptor(t);if(!i)return null;let s=i?.traversalState;if(s&&b(s.version,this._version))return s;const n=this._viewportQueries.getLodLevel(e),o=this._viewportQueries.hasLOD(e);let r=!0;if(o){const e=this._getParentIndex(t);if(null!=e){const t=this._getNodeDescriptor(e),i=t?.traversalState;r=!!i&&n>i.lodLevel}else r=n>0}else r=0===e.childCount;return s?(s.lodLevel=n,s.isChosen=r,s.version=N(!0,this._version),s):(s=new d(o,r,n,N(!0,this._version)),i.traversalState=s,s)}_loadNode(e){if(this._loadingNodes.has(e))return void this._logger.error(`Node[${e}] already loading`);this._loadingNodes.add(e);const i=this._getNodeDescriptor(e);if(i.node)return void this._logger.error(`Node[${e}] already in descriptor`);const s=i.nodeBoundingData;if(null==s)return void this._failedNodes.add(e);const n=s.id,o=this.urlPrefix+n,r=()=>{this._loadingNodes.delete(e),0===this._missingPagesAndNodes.size&&0===this._loadingNodes.size&&this.requestUpdate()};(e>=0?this._requester.request(o,"json"):this._clientNodeLoader.loadNodeJSON(n)).then(t=>{r();const i=this._validateNode(n,t);if(null==i)return;i.obb&&this.invalidateNodeVisibilityCache(e);const s=this._addNode(i,e);this.nodeTraversalState(s)}).catch(i=>{r(),t(i)||(this._logger.error("#loadNode()",this._layer,"Error loading node: "+o),this._failedNodes.add(e))})}_validateNode(e,t){if(null==t||"object"!=typeof t||t.id!==e)return this._logger.error("#validateNode()",this._layer,`Invalid node. Wrong type or wrong id "${e}"`),null;if(!Array.isArray(t.mbs))return this._logger.error("#validateNode()",this._layer,`Invalid bounding volume on node ${e}.`),null;t.sharedResource&&"./shared"!==t.sharedResource.href&&"./shared/"!==t.sharedResource.href&&this._logger.warn("#validateNode()",this._layer,`Invalid shared resource href on node "${e}"`);const i=t.geometryData;null==i||Array.isArray(i)&&0===i.length||Array.isArray(i)&&1===i.length&&"./geometries/0"===i[0].href||this._logger.warn("#validateNode()",this._layer,`Invalid geometry data on node "${e}"`);const s=t.attributeData,r=this._layer.attributeStorageInfo;null==s||Array.isArray(s)&&!s.some((e,t)=>e.href!==`./attributes/${r?.[t]?.key??`f_${t}`}/0`)||this._logger.warn("#validateNode()",this._layer,`Invalid attribute data on node "${e}"`),t.featureData&&t.featureData.length>1&&this._logger.warn("#validateNode()",this._layer,`Node ${e} has ${t.featureData.length} bundles. Only the first bundle will be loaded.`);const d=t.hasOwnProperty("obb")&&!this.ignoreServiceObb?t.obb:void 0,a=1===t.featureData?.length&&t.featureData[0].featureRange?t.featureData[0].featureRange[1]-t.featureData[0].featureRange[0]+1:void 0,h=t=>{if(null==t)return null;const i=t=>this._logger.error("#validateNode()",this._layer,`Invalid node reference on node ${e}: ${t}`);if("number"==typeof t.id)i(`id ${t.id} is a number instead of a string.`);else if("string"!=typeof t.id||!Array.isArray(t.mbs))return i("Missing or invalid id."),null;if(!Array.isArray(t.mbs))return i(`Invalid bounding volume on reference ${t.id}.`),null;const s=new o(`${t.id}`,new n(t.mbs));return s.serviceObbInIndexSR=!this.ignoreServiceObb&&t.hasOwnProperty("obb")&&t.obb?u.fromJSON(t.obb):null,s.visibilityObbInRenderSR=this._computeVisibilityObb(s),s},c=Array.isArray(t.children)?t.children.map(h).filter(e=>null!=e):null,g=t.featureData?.length??!1,_=!0===t.isEmpty;return new l(e,new n(t.mbs),d,"string"==typeof t.version?t.version:null,{isEmpty:!g&&_,hasSharedResource:null!=t.sharedResource,attributes:t.attributeData?e:void 0,texture:t.textureData&&t.textureData.length>0?e:void 0,geometry:null!=t.geometryData?e:void 0},c,Array.isArray(t.lodSelection)?t.lodSelection:null,a)}resetFailedNodes(){this._failedNodes.clear(),this._failedPages.clear(),this._forAllNodes(e=>{null!=e.node&&(e.node.failed=!1)})}_getNodeLoadPriority(e){const t=this._getNodeDescriptor(e),i=this._getParentIndex(e);if(null==t||null==i&&null==t.node)return null==i?1/0:this._getNodeLoadPriority(i);let s=0;if(t.node&&null!=i){const e=this._getNodeDescriptor(i);s=e.traversalState?.lodLevel??0}const n=this._getHoleBonus(e);return-(this._viewportQueries.distToCameraPOIRay(t.nodeBoundingData??t.node)*(1+s)+s*this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI())+n}_getHoleBonus(e){return this._hasLoadedAncestor(e)?0:this._progressiveLoadPenaltyWeight*this._viewportQueries.distCameraToPOI()}_hasLoadedAncestor(e){let t=this._getParentIndex(e);for(;null!=t;){if(this._isLoaded(t))return!0;t=this._getParentIndex(t)}return!1}traverseVisible(e,t){const i=this._getNodeDescriptor(this._rootIndex);null!=i?this._traverseVisible(this._rootIndex,null,i,e,t):e(this._rootIndex,null,null)}_traverseVisible(e,t,i,s,n){const o=P(e,this._pageSize);if(n&&n.add(o),i.node&&0===i.childCount)return void(this.isGeometryVisible(e)&&s(e,i,t));if(!this.isNodeVisible(e))return;if(s(e,i,t),null==i.node)return;const r=this.nodeTraversalState(i.node);if(r?.nodeHasLOD&&r.lodLevel===this._maxLodLevel)return;const d=this._getPageFromPageIndex(o);for(let a=0;a<i.childCount;a++){const t=d.children[i.childOffset+a],o=this._getNodeDescriptor(t);if(o)this._traverseVisible(t,e,o,s,n);else{if(n){const e=P(t,this._pageSize);n.add(e)}s(t,null,e)}}}traverse(e,t){for(const i of this.traverseValues(e,t));}*traverseValues(e,t){t(e)&&(yield e,yield*this._traverseDescendantValues(e,t))}*_traverseDescendantValues(e,t){const i=e.index,s=this._pageSize,n=P(i,s),o=this._getPageFromPageIndex(n);if(null==o)return;const r=this._frameNumber,d=this._nodePages,a=I(i,s),l=o.nodes[a],h=l.childCount;if(o.lastTraversed=r,0===h)return;const u=new Array,c=new Array;let g=0;{const{childOffset:e,childCount:t}=l,{children:i}=o;c.length=2**Math.ceil(Math.log2(g+t));for(let s=e;s<e+t;++s){const e=i[s];e>=0?(c[g]=e,++g):u.push(e)}}if(u.length>0){const e=this._clientNodePage;if(e){const i=e.children;let s=0;for(;s<u.length;){const n=u[s];++s;const o=-n-1,r=e.nodes[o],d=r.node;if(!d||!t(d))continue;yield d;const{childCount:a}=r;if(0===a)continue;const{childOffset:l}=r,h=l+a;for(let e=l;e<h;++e)u.push(i[e])}}}if(g>0){let e=0;if(s>0){let i=n*s,a=o,l=a.nodes;for(;e<g;){const n=c[e];let o;if(++e,i<=n&&n<i+s)o=a;else{const e=n/s|0,t=d.get(e);if(void 0===t)continue;o=t,o.lastTraversed=r,a=o,l=a.nodes,i=s*e}const h=l[n-i],u=h.node;if(null==u||!1===t(u))continue;yield u;const{childCount:_}=h;if(0===_)continue;const f=g+_;for(c.length<f&&(c.length=2**Math.ceil(Math.log2(g+_)));c.length<g+_;)c.length+=c.length;const m=o.children,{childOffset:v}=h,p=v+_;for(let e=v;e<p;++e)c[g]=m[e],++g}}else{const i=d.get(0);if(i)for(;e<g;){const s=c[e++],n=i.nodes[s],o=n.node;if(!o||!t(o))continue;yield o;const{childCount:r}=n;if(0===r)continue;c.length=Math.max(c.length,2**Math.ceil(Math.log2(g+r)));const d=i.children,{childOffset:a}=n,l=a+r;for(let e=a;e<l;++e)c[g]=d[e],++g}}}}traverseDescendants(e,t){for(const i of this._traverseDescendantValues(e,t));}updateChildrenLoaded(e,t){let i=this.getNode(e);for(;null!=i;){const e=i.childrenLoaded,s=e+t;i.childrenLoaded=s;const n=0===e?1:0===s?-1:0,o=i.index;if(0!==n){this._getPage(o).numNodesWithLoadedChildren+=n}i=this.getParent(o)}}checkChildrenLoadedInvariant(){return!0}updateElevationInfo(e,t){this._needsNodeElevationRange=t&&!!e&&("relative-to-ground"===e.mode||"relative-to-scene"===e.mode||"on-the-ground"===e.mode),this._viewportQueries.updateElevationInfo(e),this.invalidateAllElevationRanges()}invalidateAllElevationRanges(){this._forAllNodes(e=>{e?.invalidateBounds(),e.node?.invalidateElevationRange(),e.nodeBoundingData?.invalidateElevationRange()})}_forAllNodes(e){if(null!=this._clientNodePage){const t=this._clientNodePage;for(let i=0;i<t.nodes.length;i++)e(t.nodes[i],-(i+1))}for(const[t,i]of this._nodePages){const s=t*this._pageSize;for(let t=0;t<i.nodes.length;t++)e(i.nodes[t],s+t)}}clearCaches(){if(this._useNodePages){const e=this._nodePages,t=new Set;this.traverseVisible(e=>t.add(P(e,this._pageSize)));for(const[i,s]of e)if(0!==s.numNodesWithLoadedChildren||t.has(i))for(const e of s.nodes)e.traversalState=null;else this._deleteNodePage(i)}}_deleteNodePage(e){if(!this._nodePages.has(e))return void this._logger.error(`Destroying non-existent page ${e}`);const t=this._nodePages.get(e);this._nodePages.delete(e),t?.destroy()}get test(){}}const f=new Map;class m{constructor(t){this.missing=t,this.update=new e({deallocator:null}),this.add=new e({deallocator:null}),this.remove=new e({deallocator:null}),this.cancel=[]}destroy(){this.update.prune(),this.add.prune(),this.remove.prune(),this.cancel.length=0}reset(e){this.add.clear(),this.update.clear(),this.cancel=e}}function v(e){return a(e,-2)}function p(e){return a(e,2)}function N(e,t){return t+(e?1:0)}function b(e,t){return(-2&e)===t}function y(e){return!(1&~e)}function P(e,t){return e<0?-1:t>0?e/t|0:0}function I(e,t){return e<0?-e-1:0===t?e:e%t}function x(e,t,i){return-1===t?-(e+1):0===i?e:t*i+e}const S=[["maxScreenThreshold",1],["screenSpaceRelative",2],["removedFeatureDiameter",3],["distanceRangeFromDefaultCamera",4]];function R(e){if(e)for(let t=0;t<e.length;t++)for(const i of S)if(i[0]===e[t].metricType)return{lodMetric:i[1],maxError:e[t].maxError};return{lodMetric:0,maxError:0}}class w{constructor(){this.known=0,this.knownNodes=0,this.missing=0,this.missingNodes=0,this.unremoved=0}}class C{constructor(){this.numFeatures=0,this.knownNodes=0,this.missingNodes=0}}function E(e){return Math.sqrt(e*(4/Math.PI))}const M=new n,D=new n,V=new n,A=i(),O=has("esri-mobile")?100:300;export{_ as I3SIndex,R as selectErrorMetric};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as s}from"../../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as i,sphereIntersectsInfiniteVerticalCylinderConservative as t,finiteVerticalCylinderIntersectsFrustumConservative as n}from"../../support/ElevationAgnosticVisibility.js";import{ElevationRange as r}from"../../support/ElevationRange.js";class d extends r{constructor(e,i){super(NaN,NaN),this.id=e,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new s(0,0,0,-1),this._serviceMbsInRenderSR=new s(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class a extends d{constructor(e,s,i,t,n,r,d,a,o,h){super(e,i),this.index=s,this.childCount=t,this.level=n,this.resources=r,this.version=d,this.lodMetric=a,this.maxError=o,this.numFeatures=h,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new R}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class o{constructor(e,s,i,t){this.nodeHasLOD=e,this.isChosen=s,this.lodLevel=i,this.version=t}}class R{constructor(){this._data=[0,0,0,R.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=R.invalidRadius}get valid(){return this._data[3]!==R.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,s){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=s}intersectsFrustumConservative(e,s,r){if(!this.valid)return!0;const d=this.getAxis(h),{center:a,radius:o}=e.boundingSphere,R=o+r;return 1===s?this.radius>c||i(d,this.radius,a,R):t(d,this.radius,a,R)&&n(d,this.radius,a[2]-R,a[2]+R,e.planes)}}const h=e(),c=.9;export{R as ElevationAgnosticBoundingVolume,a as Node,d as NodeBoundingData,o as NodeTraversalState};
|
|
2
|
+
import{create as e}from"../../../../core/libs/gl-matrix-2/factories/vec3f64.js";import{Sphere as s}from"../../../../geometry/support/sphere.js";import{sphereIntersectsInfiniteRadialConeConservative as i,sphereIntersectsInfiniteVerticalCylinderConservative as t,finiteVerticalCylinderIntersectsFrustumConservative as n}from"../../support/ElevationAgnosticVisibility.js";import{ElevationRange as r}from"../../support/ElevationRange.js";class d extends r{constructor(e,i){super(NaN,NaN),this.id=e,this.serviceMbsInIndexSR=i,this._serviceMbsInRenderSRElevationAdjusted=new s(0,0,0,-1),this._serviceMbsInRenderSR=new s(0,0,0,-1),this._mbsConeInRenderSR=null}get serviceMbsInRenderSRElevationAdjusted(){return this._serviceMbsInRenderSRElevationAdjusted}updateServiceMbsInRenderSRElevationAdjusted(e){return this._serviceMbsInRenderSRElevationAdjusted.copyFrom(e),this._serviceMbsInRenderSRElevationAdjusted}get serviceMbsInRenderSR(){return this._serviceMbsInRenderSR}updateServiceMbsInRenderSR(e){return this._serviceMbsInRenderSR.copyFrom(e),this._serviceMbsInRenderSR}get mbsConeInRenderSR(){return this._mbsConeInRenderSR}updateMbsConeInRenderSR(e){return this._mbsConeInRenderSR=e.clone(),this._mbsConeInRenderSR}invalidateServiceBVsInRenderSR(){this._serviceMbsInRenderSRElevationAdjusted.invalidate(),this._serviceMbsInRenderSR.invalidate(),this._mbsConeInRenderSR=null,this.serviceObbInRenderSR?.invalidate()}shareServiceBVsInRenderSRWith(e){this.serviceObbInRenderSR=e.serviceObbInRenderSR,this._serviceMbsInRenderSRElevationAdjusted=e._serviceMbsInRenderSRElevationAdjusted,this._serviceMbsInRenderSR=e._serviceMbsInRenderSR,this._mbsConeInRenderSR=e._mbsConeInRenderSR}}class a extends d{constructor(e,s,i,t,n,r,d,a,o,h,c){super(e,i),this.index=s,this.childCount=t,this.level=n,this.resources=r,this.version=d,this.lodMetric=a,this.maxError=o,this.numFeatures=h,this.failed=!1,this.cacheState=0,this.vertexCount=0,this.memory=0,this.childrenLoaded=0,this.hasModifications=!1,this.imModificationImpact=4,this.elevationAgnosticBoundingVolume=new R,this.serviceObbInIndexSR=c}invalidateServiceBVsInRenderSR(){super.invalidateServiceBVsInRenderSR(),this.elevationAgnosticBoundingVolume.invalidate()}}class o{constructor(e,s,i,t){this.nodeHasLOD=e,this.isChosen=s,this.lodLevel=i,this.version=t}}class R{constructor(){this._data=[0,0,0,R.invalidRadius]}static{this.invalidRadius=-2}invalidate(){this._data[3]=R.invalidRadius}get valid(){return this._data[3]!==R.invalidRadius}get radius(){return this._data[3]}getAxis(e){return e[0]=this._data[0],e[1]=this._data[1],e[2]=this._data[2],e}set(e,s){this._data[0]=e[0],this._data[1]=e[1],this._data[2]=e[2],this._data[3]=s}intersectsFrustumConservative(e,s,r){if(!this.valid)return!0;const d=this.getAxis(h),{center:a,radius:o}=e.boundingSphere,R=o+r;return 1===s?this.radius>c||i(d,this.radius,a,R):t(d,this.radius,a,R)&&n(d,this.radius,a[2]-R,a[2]+R,e.planes)}}const h=e(),c=.9;export{R as ElevationAgnosticBoundingVolume,a as Node,d as NodeBoundingData,o as NodeTraversalState};
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as e}from"./Gamma.glsl.js";import{addMainLightDirection as t,addMainLightIntensity as a,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as s}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as d}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function
|
|
2
|
+
import{EvaluateAmbientLighting as i}from"./EvaluateAmbientLighting.glsl.js";import{EvaluateAmbientOcclusion as n}from"./EvaluateAmbientOcclusion.glsl.js";import{Gamma as e}from"./Gamma.glsl.js";import{addMainLightDirection as t,addMainLightIntensity as a,applyShading as o}from"./MainLighting.glsl.js";import{PhysicallyBasedRendering as l}from"./PhysicallyBasedRendering.glsl.js";import{PiUtils as r}from"./PiUtils.glsl.js";import{ReadGlobalIllumination as c}from"./ReadGlobalIllumination.glsl.js";import{BooleanBindUniform as s}from"../../shaderModules/BooleanBindUniform.js";import{FloatBindUniform as d}from"../../shaderModules/FloatBindUniform.js";import{glsl as m,If as u}from"../../shaderModules/glsl.js";import{ambientBoost as g}from"../../../lighting/SceneLighting.js";import{BlackLevelLightSoftCompression as h}from"../../../shaders/BlackLevelLightSoftCompression.glsl.js";import{ToneMapping as p}from"../../../shaders/ToneMapping.glsl.js";function f(i){i.constants.add("ambientBoostFactor","float",g)}function v(i){i.uniforms.add(new d("lightingGlobalFactor",i=>i.lighting.globalFactor))}function b(g,b){const{pbrMode:L,spherical:I,hasColorTexture:C,receiveGlobalIllumination:D}=b;g.include(e),g.include(c,b),g.include(n,b),0!==L&&g.include(l,b),g.include(i,b),g.include(r),g.include(p,b);const R=!(2===L&&!C);R&&g.include(h),f(g),v(g),t(g),g.code.add(m`
|
|
3
3
|
float additionalDirectedAmbientLight(float lightAlignment) {
|
|
4
4
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
float additionalDirectedAmbientLight(vec3 vPosWorld) {
|
|
8
|
-
float lightAlignment = dot(${
|
|
8
|
+
float lightAlignment = dot(${I?m`normalize(vPosWorld)`:m`vec3(0.0, 0.0, 1.0)`}, mainLightDirection);
|
|
9
9
|
return smoothstep(0.0, 1.0, clamp(lightAlignment * 2.5, 0.0, 1.0));
|
|
10
10
|
}
|
|
11
11
|
`),a(g),g.code.add(m`vec3 evaluateAdditionalLighting(float ambientOcclusion, vec3 vPosWorld) {
|
|
12
12
|
float additionalAmbientScale = additionalDirectedAmbientLight(vPosWorld);
|
|
13
13
|
return (1.0 - ambientOcclusion) * additionalAmbientScale * ambientBoostFactor * lightingGlobalFactor * mainLightIntensity;
|
|
14
|
-
}`);const y=D?"globalIlluminationOcclusion":"ssao",A=D?.75:1,S=D?1.5:1;switch(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
vec3 albedoLinear
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
vec3
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
}`);const y=D?"globalIlluminationOcclusion":"ssao",A=D?.75:1,S=D?1.5:1;switch(D&&g.code.add(m`vec3 evaluateGlobalIlluminationOcclusion() {
|
|
15
|
+
return min(1.2 * readGlobalIlluminationOcclusion(), 1.0);
|
|
16
|
+
}
|
|
17
|
+
vec3 evaluateGlobalIlluminationEmission(vec3 albedoLinear) {
|
|
18
|
+
return 2.25 * (0.75 * albedoLinear + 0.25) * readGlobalIlluminationEmission().rgb;
|
|
19
|
+
}`),L){case 0:case 4:case 3:g.include(o),g.code.add(m`
|
|
20
|
+
vec3 evaluateSceneLighting(vec3 normalWorld, vec3 albedo, float shadow, float ssao, vec3 additionalLight) {
|
|
21
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
22
|
+
|
|
23
|
+
vec3 mainLighting = ${D?`${m.float(A)} * `:""}applyShading(normalWorld, shadow);
|
|
24
|
+
vec3 ambientLighting = ${D?`${m.float(S)} * `:""}calculateAmbientIrradiance(normalWorld) * (1.0 - ${y});
|
|
25
|
+
vec3 albedoLinear = linearizeGamma(albedo);
|
|
26
|
+
|
|
27
|
+
vec3 totalLight = mainLighting + ambientLighting + additionalLight;
|
|
28
|
+
totalLight = min(totalLight, vec3(PI));
|
|
29
|
+
vec3 outColor = vec3((albedoLinear / PI) * totalLight);
|
|
30
|
+
${u(D,m`
|
|
31
|
+
outColor += evaluateGlobalIlluminationEmission(albedoLinear);`)}
|
|
32
|
+
return delinearizeGamma(outColor);
|
|
33
|
+
}
|
|
34
|
+
`);break;case 1:case 2:{const i=D?.35:.2;g.code.add(m`
|
|
23
35
|
const float fillLightIntensity = 0.25;
|
|
24
36
|
const float horizonLightDiffusion = 0.4;
|
|
25
37
|
const float additionalAmbientIrradianceFactor = 0.02;
|
|
@@ -30,8 +42,8 @@ return delinearizeGamma(outColor);
|
|
|
30
42
|
PBRShadingInfo inputs;
|
|
31
43
|
calculatePBRInputs(inputs, normal, viewDirection, upDirection, albedo, mrr);
|
|
32
44
|
|
|
33
|
-
|
|
34
|
-
`),
|
|
45
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
46
|
+
`),b.useFillLights?g.uniforms.add(new s("hasFillLights",i=>i.enableFillLights)):g.constants.add("hasFillLights","bool",!1),g.code.add(m`
|
|
35
47
|
vec3 ambientDir = vec3(5.0 * upDirection[1] - upDirection[0] * upDirection[2], - 5.0 * upDirection[0] - upDirection[2] * upDirection[1], upDirection[1] * upDirection[1] + upDirection[0] * upDirection[0]);
|
|
36
48
|
ambientDir = ambientDir != vec3(0.0) ? normalize(ambientDir) : normalize(vec3(5.0, -1.0, 0.0));
|
|
37
49
|
|
|
@@ -73,8 +85,7 @@ return delinearizeGamma(outColor);
|
|
|
73
85
|
vec3 outColorLinear = reflectedColorComponent + additionalMaterialReflectanceComponent;
|
|
74
86
|
|
|
75
87
|
${u(D,m`
|
|
76
|
-
|
|
77
|
-
outColorLinear += globalIlluminationEmission;`)}
|
|
88
|
+
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
78
89
|
|
|
79
90
|
${R?m`vec3 adjustedOutColorLinear = blackLevelSoftCompression(outColorLinear, inputs.averageAmbientRadiance);`:m`vec3 adjustedOutColorLinear = max(vec3(0.0), outColorLinear - 0.005 * inputs.averageAmbientRadiance);`}
|
|
80
91
|
|
|
@@ -88,7 +99,7 @@ return delinearizeGamma(outColor);
|
|
|
88
99
|
PBRShadingInfo inputs;
|
|
89
100
|
calculateSimplifiedInputs(inputs, normal, viewDirection, upDirection, albedo);
|
|
90
101
|
|
|
91
|
-
${u(D,m`vec3 globalIlluminationOcclusion =
|
|
102
|
+
${u(D,m`vec3 globalIlluminationOcclusion = evaluateGlobalIlluminationOcclusion();`)}
|
|
92
103
|
|
|
93
104
|
vec3 mainLightIrradianceComponent = ${m.float(n)} * (1.0 - shadow) * inputs.NdotL * mainLightIntensity;
|
|
94
105
|
vec3 ambientLightIrradianceComponent = ${m.float(e)} * calculateAmbientIrradiance(normal) * (1.0 - ${y}) + additionalLight;
|
|
@@ -105,9 +116,8 @@ return delinearizeGamma(outColor);
|
|
|
105
116
|
vec3 outColorLinear = outDiffColor + specularComponent;
|
|
106
117
|
|
|
107
118
|
${u(D,m`
|
|
108
|
-
|
|
109
|
-
outColorLinear += globalIlluminationEmission;`)}
|
|
119
|
+
outColorLinear += evaluateGlobalIlluminationEmission(inputs.albedoLinear);`)}
|
|
110
120
|
|
|
111
121
|
return delinearizeGamma(outColorLinear);
|
|
112
122
|
}
|
|
113
|
-
`);break}}}export{
|
|
123
|
+
`);break}}}export{b as EvaluateSceneLighting,f as addAmbientBoostFactor,v as addLightingGlobalFactor};
|