@loaders.gl/3d-tiles 4.0.0-alpha.5 → 4.0.0-alpha.6

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.
Files changed (313) hide show
  1. package/dist/bundle.js +2 -2
  2. package/dist/cesium-ion-loader.d.ts.map +1 -1
  3. package/dist/cesium-ion-loader.js +37 -32
  4. package/dist/dist.min.js +3850 -1551
  5. package/dist/es5/bundle.js +6 -0
  6. package/dist/es5/bundle.js.map +1 -0
  7. package/dist/es5/cesium-ion-loader.js +77 -0
  8. package/dist/es5/cesium-ion-loader.js.map +1 -0
  9. package/dist/es5/index.js +63 -0
  10. package/dist/es5/index.js.map +1 -0
  11. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +114 -0
  12. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  13. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +180 -0
  14. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  15. package/dist/es5/lib/classes/tile-3d-batch-table.js +285 -0
  16. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -0
  17. package/dist/es5/lib/classes/tile-3d-feature-table.js +97 -0
  18. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -0
  19. package/dist/es5/lib/constants.js +32 -0
  20. package/dist/es5/lib/constants.js.map +1 -0
  21. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +49 -0
  22. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  23. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +30 -0
  24. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  25. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +47 -0
  26. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  27. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +48 -0
  28. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  29. package/dist/es5/lib/encoders/encode-3d-tile.js +35 -0
  30. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -0
  31. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +35 -0
  32. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  33. package/dist/es5/lib/ion/ion.js +170 -0
  34. package/dist/es5/lib/ion/ion.js.map +1 -0
  35. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +64 -0
  36. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  37. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +32 -0
  38. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  39. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +32 -0
  40. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  41. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +280 -0
  42. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +96 -0
  44. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  45. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +22 -0
  46. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  47. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +145 -0
  48. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  49. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +85 -0
  50. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  51. package/dist/es5/lib/parsers/helpers/parse-utils.js +28 -0
  52. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -0
  53. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +51 -0
  54. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  55. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +48 -0
  56. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  57. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +35 -0
  58. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  59. package/dist/es5/lib/parsers/parse-3d-tile-header.js +271 -0
  60. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -0
  61. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +172 -0
  62. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  63. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +271 -0
  64. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  65. package/dist/es5/lib/parsers/parse-3d-tile.js +74 -0
  66. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -0
  67. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +30 -0
  68. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  69. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +44 -0
  70. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  71. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +30 -0
  72. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  73. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +52 -0
  74. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  75. package/dist/es5/lib/utils/s2/index.js +90 -0
  76. package/dist/es5/lib/utils/s2/index.js.map +1 -0
  77. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +19 -0
  78. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  79. package/dist/es5/lib/utils/s2/s2-token-functions.js +41 -0
  80. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
  81. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +22 -0
  82. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  83. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +207 -0
  84. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  85. package/dist/es5/lib/utils/version.js +9 -0
  86. package/dist/es5/lib/utils/version.js.map +1 -0
  87. package/dist/es5/tile-3d-subtree-loader.js +22 -0
  88. package/dist/es5/tile-3d-subtree-loader.js.map +1 -0
  89. package/dist/es5/tile-3d-writer.js +26 -0
  90. package/dist/es5/tile-3d-writer.js.map +1 -0
  91. package/dist/es5/tiles-3d-loader.js +134 -0
  92. package/dist/es5/tiles-3d-loader.js.map +1 -0
  93. package/dist/es5/types.js +2 -0
  94. package/dist/es5/types.js.map +1 -0
  95. package/dist/esm/bundle.js +4 -0
  96. package/dist/esm/bundle.js.map +1 -0
  97. package/dist/esm/cesium-ion-loader.js +36 -0
  98. package/dist/esm/cesium-ion-loader.js.map +1 -0
  99. package/dist/esm/index.js +9 -0
  100. package/dist/esm/index.js.map +1 -0
  101. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +96 -0
  102. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  103. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +171 -0
  104. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  105. package/dist/esm/lib/classes/tile-3d-batch-table.js +231 -0
  106. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -0
  107. package/dist/esm/lib/classes/tile-3d-feature-table.js +70 -0
  108. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -0
  109. package/dist/esm/lib/constants.js +22 -0
  110. package/dist/esm/lib/constants.js.map +1 -0
  111. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +40 -0
  112. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  113. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +21 -0
  114. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  115. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +36 -0
  116. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  117. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +39 -0
  118. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  119. package/dist/esm/lib/encoders/encode-3d-tile.js +29 -0
  120. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -0
  121. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +28 -0
  122. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  123. package/dist/esm/lib/ion/ion.js +70 -0
  124. package/dist/esm/lib/ion/ion.js.map +1 -0
  125. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +58 -0
  126. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  127. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -0
  128. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  129. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +26 -0
  130. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  131. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +241 -0
  132. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  133. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +59 -0
  134. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  135. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +16 -0
  136. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  137. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +67 -0
  138. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  139. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +80 -0
  140. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  141. package/dist/esm/lib/parsers/helpers/parse-utils.js +20 -0
  142. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -0
  143. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +25 -0
  144. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  145. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +15 -0
  146. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  147. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +10 -0
  148. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  149. package/dist/esm/lib/parsers/parse-3d-tile-header.js +164 -0
  150. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -0
  151. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +147 -0
  152. package/dist/{lib → esm/lib}/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  153. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +211 -0
  154. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  155. package/dist/esm/lib/parsers/parse-3d-tile.js +30 -0
  156. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -0
  157. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +23 -0
  158. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  159. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +40 -0
  160. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  161. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +24 -0
  162. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  163. package/dist/esm/lib/utils/s2/converters/s2-to-region.js +42 -0
  164. package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  165. package/dist/esm/lib/utils/s2/index.js +7 -0
  166. package/dist/esm/lib/utils/s2/index.js.map +1 -0
  167. package/dist/esm/lib/utils/s2/s2-geometry-functions.js +12 -0
  168. package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  169. package/dist/esm/lib/utils/s2/s2-token-functions.js +32 -0
  170. package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
  171. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +15 -0
  172. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  173. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +186 -0
  174. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  175. package/dist/esm/lib/utils/version.js +2 -0
  176. package/dist/esm/lib/utils/version.js.map +1 -0
  177. package/dist/esm/tile-3d-subtree-loader.js +14 -0
  178. package/dist/esm/tile-3d-subtree-loader.js.map +1 -0
  179. package/dist/esm/tile-3d-writer.js +19 -0
  180. package/dist/esm/tile-3d-writer.js.map +1 -0
  181. package/dist/esm/tiles-3d-loader.js +64 -0
  182. package/dist/esm/tiles-3d-loader.js.map +1 -0
  183. package/dist/esm/types.js +2 -0
  184. package/dist/esm/types.js.map +1 -0
  185. package/dist/index.d.ts +1 -1
  186. package/dist/index.d.ts.map +1 -1
  187. package/dist/index.js +26 -9
  188. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -1
  189. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +106 -89
  190. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +184 -202
  191. package/dist/lib/classes/tile-3d-batch-table.d.ts +1 -1
  192. package/dist/lib/classes/tile-3d-batch-table.js +223 -282
  193. package/dist/lib/classes/tile-3d-feature-table.js +64 -86
  194. package/dist/lib/constants.js +23 -19
  195. package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
  196. package/dist/lib/encoders/encode-3d-tile-composite.js +23 -24
  197. package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
  198. package/dist/lib/encoders/encode-3d-tile-point-cloud.js +36 -38
  199. package/dist/lib/encoders/encode-3d-tile.js +30 -32
  200. package/dist/lib/encoders/helpers/encode-3d-tile-header.js +28 -29
  201. package/dist/lib/ion/ion.js +60 -69
  202. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +60 -62
  203. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
  204. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +39 -28
  205. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +11 -0
  206. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  207. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +247 -203
  208. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +82 -63
  209. package/dist/lib/parsers/helpers/parse-3d-tile-header.js +26 -15
  210. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +2 -1
  211. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
  212. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +98 -58
  213. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +84 -80
  214. package/dist/lib/parsers/helpers/parse-utils.js +29 -16
  215. package/dist/lib/parsers/parse-3d-tile-batched-model.js +30 -26
  216. package/dist/lib/parsers/parse-3d-tile-composite.js +25 -16
  217. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +1 -1
  218. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
  219. package/dist/lib/parsers/parse-3d-tile-gltf.js +17 -9
  220. package/dist/lib/parsers/parse-3d-tile-header.d.ts +5 -4
  221. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  222. package/dist/lib/parsers/parse-3d-tile-header.js +166 -138
  223. package/dist/lib/parsers/parse-3d-tile-instanced-model.js +179 -170
  224. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +350 -184
  225. package/dist/lib/parsers/parse-3d-tile.js +36 -31
  226. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
  227. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
  228. package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
  229. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
  230. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
  231. package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
  232. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
  233. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
  234. package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
  235. package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
  236. package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
  237. package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
  238. package/dist/lib/utils/s2/index.d.ts +8 -0
  239. package/dist/lib/utils/s2/index.d.ts.map +1 -0
  240. package/dist/lib/utils/s2/index.js +23 -0
  241. package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
  242. package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
  243. package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
  244. package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
  245. package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
  246. package/dist/lib/utils/s2/s2-token-functions.js +68 -0
  247. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
  248. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
  249. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
  250. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
  251. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
  252. package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
  253. package/dist/lib/utils/version.js +7 -2
  254. package/dist/tile-3d-subtree-loader.js +22 -13
  255. package/dist/tile-3d-writer.js +24 -17
  256. package/dist/tiles-3d-loader.d.ts.map +1 -1
  257. package/dist/tiles-3d-loader.js +63 -69
  258. package/dist/types.d.ts +28 -15
  259. package/dist/types.d.ts.map +1 -1
  260. package/dist/types.js +2 -2
  261. package/package.json +12 -11
  262. package/src/cesium-ion-loader.ts +1 -0
  263. package/src/index.ts +1 -1
  264. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +104 -27
  265. package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +50 -7
  266. package/src/lib/parsers/parse-3d-tile-header.ts +91 -23
  267. package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
  268. package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
  269. package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
  270. package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
  271. package/src/lib/utils/s2/index.ts +17 -0
  272. package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
  273. package/src/lib/utils/s2/s2-token-functions.ts +67 -0
  274. package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
  275. package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
  276. package/src/tiles-3d-loader.ts +2 -16
  277. package/src/types.ts +20 -5
  278. package/dist/bundle.js.map +0 -1
  279. package/dist/cesium-ion-loader.js.map +0 -1
  280. package/dist/index.js.map +0 -1
  281. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
  282. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
  283. package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
  284. package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
  285. package/dist/lib/constants.js.map +0 -1
  286. package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
  287. package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
  288. package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
  289. package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
  290. package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
  291. package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
  292. package/dist/lib/ion/ion.js.map +0 -1
  293. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
  294. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
  295. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
  296. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
  297. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
  298. package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
  299. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
  300. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
  301. package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
  302. package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
  303. package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
  304. package/dist/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
  305. package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
  306. package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
  307. package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
  308. package/dist/lib/utils/version.js.map +0 -1
  309. package/dist/tile-3d-subtree-loader.js.map +0 -1
  310. package/dist/tile-3d-writer.js.map +0 -1
  311. package/dist/tiles-3d-loader.js.map +0 -1
  312. package/dist/types.js.map +0 -1
  313. /package/src/lib/parsers/{parse-3d-tile-gltf.js → parse-3d-tile-gltf.ts} +0 -0
@@ -1,304 +1,245 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import { assert } from '@loaders.gl/loader-utils';
3
- import { createTypedArrayFromAccessor } from './helpers/tile-3d-accessor-utils';
4
- import { initializeHierarchy, traverseHierarchy } from './tile-3d-batch-table-hierarchy';
5
-
1
+ "use strict";
2
+ // This file is derived from the Cesium code base under Apache 2 license
3
+ // See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const loader_utils_1 = require("@loaders.gl/loader-utils");
6
+ const tile_3d_accessor_utils_1 = require("./helpers/tile-3d-accessor-utils");
7
+ const tile_3d_batch_table_hierarchy_1 = require("./tile-3d-batch-table-hierarchy");
6
8
  function defined(x) {
7
- return x !== undefined && x !== null;
9
+ return x !== undefined && x !== null;
8
10
  }
9
-
10
11
  const clone = (x, y) => x;
11
-
12
+ // These top level fields in the batch table json are not properties
12
13
  const IGNORED_PROPERTY_FIELDS = {
13
- HIERARCHY: true,
14
- extensions: true,
15
- extras: true
14
+ HIERARCHY: true,
15
+ extensions: true,
16
+ extras: true
16
17
  };
17
- export default class Tile3DBatchTableParser {
18
- constructor(json, binary, featureCount, options = {}) {
19
- var _this$json;
20
-
21
- _defineProperty(this, "json", void 0);
22
-
23
- _defineProperty(this, "binary", void 0);
24
-
25
- _defineProperty(this, "featureCount", void 0);
26
-
27
- _defineProperty(this, "_extensions", void 0);
28
-
29
- _defineProperty(this, "_properties", void 0);
30
-
31
- _defineProperty(this, "_binaryProperties", void 0);
32
-
33
- _defineProperty(this, "_hierarchy", void 0);
34
-
35
- assert(featureCount >= 0);
36
- this.json = json || {};
37
- this.binary = binary;
38
- this.featureCount = featureCount;
39
- this._extensions = ((_this$json = this.json) === null || _this$json === void 0 ? void 0 : _this$json.extensions) || {};
40
- this._properties = {};
41
-
42
- for (const propertyName in this.json) {
43
- if (!IGNORED_PROPERTY_FIELDS[propertyName]) {
44
- this._properties[propertyName] = this.json[propertyName];
45
- }
46
- }
47
-
48
- this._binaryProperties = this._initializeBinaryProperties();
49
-
50
- if (options['3DTILES_batch_table_hierarchy']) {
51
- this._hierarchy = initializeHierarchy(this, this.json, this.binary);
52
- }
53
- }
54
-
55
- getExtension(extensionName) {
56
- return this.json && this.json.extensions && this.json.extensions[extensionName];
57
- }
58
-
59
- memorySizeInBytes() {
60
- return 0;
61
- }
62
-
63
- isClass(batchId, className) {
64
- this._checkBatchId(batchId);
65
-
66
- assert(typeof className === 'string', className);
67
-
68
- if (this._hierarchy) {
69
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
70
- const classId = hierarchy.classIds[instanceIndex];
71
- const instanceClass = hierarchy.classes[classId];
72
- return instanceClass.name === className;
73
- });
74
- return defined(result);
18
+ // The size of this array equals the maximum instance count among all loaded tiles, which has the potential to be large.
19
+ class Tile3DBatchTableParser {
20
+ constructor(json, binary, featureCount, options = {}) {
21
+ (0, loader_utils_1.assert)(featureCount >= 0);
22
+ this.json = json || {};
23
+ this.binary = binary;
24
+ this.featureCount = featureCount;
25
+ this._extensions = this.json?.extensions || {};
26
+ // Copy all top-level property fields from the json object, ignoring special fields
27
+ this._properties = {};
28
+ for (const propertyName in this.json) {
29
+ if (!IGNORED_PROPERTY_FIELDS[propertyName]) {
30
+ this._properties[propertyName] = this.json[propertyName];
31
+ }
32
+ }
33
+ this._binaryProperties = this._initializeBinaryProperties();
34
+ // TODO: hierarchy support is only partially implemented and not tested
35
+ if (options['3DTILES_batch_table_hierarchy']) {
36
+ this._hierarchy = (0, tile_3d_batch_table_hierarchy_1.initializeHierarchy)(this, this.json, this.binary);
37
+ }
75
38
  }
76
-
77
- return false;
78
- }
79
-
80
- isExactClass(batchId, className) {
81
- assert(typeof className === 'string', className);
82
- return this.getExactClassName(batchId) === className;
83
- }
84
-
85
- getExactClassName(batchId) {
86
- this._checkBatchId(batchId);
87
-
88
- if (this._hierarchy) {
89
- const classId = this._hierarchy.classIds[batchId];
90
- const instanceClass = this._hierarchy.classes[classId];
91
- return instanceClass.name;
39
+ getExtension(extensionName) {
40
+ return this.json && this.json.extensions && this.json.extensions[extensionName];
92
41
  }
93
-
94
- return undefined;
95
- }
96
-
97
- hasProperty(batchId, name) {
98
- this._checkBatchId(batchId);
99
-
100
- assert(typeof name === 'string', name);
101
- return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);
102
- }
103
-
104
- getPropertyNames(batchId, results) {
105
- this._checkBatchId(batchId);
106
-
107
- results = defined(results) ? results : [];
108
- results.length = 0;
109
- const propertyNames = Object.keys(this._properties);
110
- results.push(...propertyNames);
111
-
112
- if (this._hierarchy) {
113
- this._getPropertyNamesInHierarchy(batchId, results);
42
+ memorySizeInBytes() {
43
+ return 0;
114
44
  }
115
-
116
- return results;
117
- }
118
-
119
- getProperty(batchId, name) {
120
- this._checkBatchId(batchId);
121
-
122
- assert(typeof name === 'string', name);
123
-
124
- if (this._binaryProperties) {
125
- const binaryProperty = this._binaryProperties[name];
126
-
127
- if (defined(binaryProperty)) {
128
- return this._getBinaryProperty(binaryProperty, batchId);
129
- }
45
+ isClass(batchId, className) {
46
+ this._checkBatchId(batchId);
47
+ (0, loader_utils_1.assert)(typeof className === 'string', className);
48
+ // extension: 3DTILES_batch_table_hierarchy
49
+ if (this._hierarchy) {
50
+ // PERFORMANCE_IDEA : cache results in the ancestor classes
51
+ // to speed up this check if this area becomes a hotspot
52
+ // PERFORMANCE_IDEA : treat class names as integers for faster comparisons
53
+ const result = (0, tile_3d_batch_table_hierarchy_1.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
54
+ const classId = hierarchy.classIds[instanceIndex];
55
+ const instanceClass = hierarchy.classes[classId];
56
+ return instanceClass.name === className;
57
+ });
58
+ return defined(result);
59
+ }
60
+ return false;
130
61
  }
131
-
132
- const propertyValues = this._properties[name];
133
-
134
- if (defined(propertyValues)) {
135
- return clone(propertyValues[batchId], true);
62
+ isExactClass(batchId, className) {
63
+ (0, loader_utils_1.assert)(typeof className === 'string', className);
64
+ return this.getExactClassName(batchId) === className;
136
65
  }
137
-
138
- if (this._hierarchy) {
139
- const hierarchyProperty = this._getHierarchyProperty(batchId, name);
140
-
141
- if (defined(hierarchyProperty)) {
142
- return hierarchyProperty;
143
- }
66
+ getExactClassName(batchId) {
67
+ this._checkBatchId(batchId);
68
+ // extension: 3DTILES_batch_table_hierarchy
69
+ if (this._hierarchy) {
70
+ const classId = this._hierarchy.classIds[batchId];
71
+ const instanceClass = this._hierarchy.classes[classId];
72
+ return instanceClass.name;
73
+ }
74
+ return undefined;
144
75
  }
145
-
146
- return undefined;
147
- }
148
-
149
- setProperty(batchId, name, value) {
150
- const featureCount = this.featureCount;
151
-
152
- this._checkBatchId(batchId);
153
-
154
- assert(typeof name === 'string', name);
155
-
156
- if (this._binaryProperties) {
157
- const binaryProperty = this._binaryProperties[name];
158
-
159
- if (binaryProperty) {
160
- this._setBinaryProperty(binaryProperty, batchId, value);
161
-
162
- return;
163
- }
76
+ hasProperty(batchId, name) {
77
+ this._checkBatchId(batchId);
78
+ (0, loader_utils_1.assert)(typeof name === 'string', name);
79
+ return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);
164
80
  }
165
-
166
- if (this._hierarchy) {
167
- if (this._setHierarchyProperty(this, batchId, name, value)) {
168
- return;
169
- }
81
+ getPropertyNames(batchId, results) {
82
+ this._checkBatchId(batchId);
83
+ results = defined(results) ? results : [];
84
+ results.length = 0;
85
+ const propertyNames = Object.keys(this._properties);
86
+ results.push(...propertyNames);
87
+ if (this._hierarchy) {
88
+ this._getPropertyNamesInHierarchy(batchId, results);
89
+ }
90
+ return results;
170
91
  }
171
-
172
- let propertyValues = this._properties[name];
173
-
174
- if (!defined(propertyValues)) {
175
- this._properties[name] = new Array(featureCount);
176
- propertyValues = this._properties[name];
92
+ getProperty(batchId, name) {
93
+ this._checkBatchId(batchId);
94
+ (0, loader_utils_1.assert)(typeof name === 'string', name);
95
+ if (this._binaryProperties) {
96
+ const binaryProperty = this._binaryProperties[name];
97
+ if (defined(binaryProperty)) {
98
+ return this._getBinaryProperty(binaryProperty, batchId);
99
+ }
100
+ }
101
+ const propertyValues = this._properties[name];
102
+ if (defined(propertyValues)) {
103
+ return clone(propertyValues[batchId], true);
104
+ }
105
+ // EXTENSION: 3DTILES_batch_table_hierarchy
106
+ if (this._hierarchy) {
107
+ const hierarchyProperty = this._getHierarchyProperty(batchId, name);
108
+ if (defined(hierarchyProperty)) {
109
+ return hierarchyProperty;
110
+ }
111
+ }
112
+ return undefined;
177
113
  }
178
-
179
- propertyValues[batchId] = clone(value, true);
180
- }
181
-
182
- _checkBatchId(batchId) {
183
- const valid = batchId >= 0 && batchId < this.featureCount;
184
-
185
- if (!valid) {
186
- throw new Error('batchId not in range [0, featureCount - 1].');
114
+ setProperty(batchId, name, value) {
115
+ const featureCount = this.featureCount;
116
+ this._checkBatchId(batchId);
117
+ (0, loader_utils_1.assert)(typeof name === 'string', name);
118
+ if (this._binaryProperties) {
119
+ const binaryProperty = this._binaryProperties[name];
120
+ if (binaryProperty) {
121
+ this._setBinaryProperty(binaryProperty, batchId, value);
122
+ return;
123
+ }
124
+ }
125
+ // EXTENSION: 3DTILES_batch_table_hierarchy
126
+ if (this._hierarchy) {
127
+ if (this._setHierarchyProperty(this, batchId, name, value)) {
128
+ return;
129
+ }
130
+ }
131
+ let propertyValues = this._properties[name];
132
+ if (!defined(propertyValues)) {
133
+ // Property does not exist. Create it.
134
+ this._properties[name] = new Array(featureCount);
135
+ propertyValues = this._properties[name];
136
+ }
137
+ propertyValues[batchId] = clone(value, true);
187
138
  }
188
- }
189
-
190
- _getBinaryProperty(binaryProperty, index) {
191
- return binaryProperty.unpack(binaryProperty.typedArray, index);
192
- }
193
-
194
- _setBinaryProperty(binaryProperty, index, value) {
195
- binaryProperty.pack(value, binaryProperty.typedArray, index);
196
- }
197
-
198
- _initializeBinaryProperties() {
199
- let binaryProperties = null;
200
-
201
- for (const name in this._properties) {
202
- const property = this._properties[name];
203
-
204
- const binaryProperty = this._initializeBinaryProperty(name, property);
205
-
206
- if (binaryProperty) {
207
- binaryProperties = binaryProperties || {};
208
- binaryProperties[name] = binaryProperty;
209
- }
139
+ // PRIVATE METHODS
140
+ _checkBatchId(batchId) {
141
+ const valid = batchId >= 0 && batchId < this.featureCount;
142
+ if (!valid) {
143
+ throw new Error('batchId not in range [0, featureCount - 1].');
144
+ }
210
145
  }
211
-
212
- return binaryProperties;
213
- }
214
-
215
- _initializeBinaryProperty(name, property) {
216
- if ('byteOffset' in property) {
217
- const tile3DAccessor = property;
218
- assert(this.binary, "Property ".concat(name, " requires a batch table binary."));
219
- assert(tile3DAccessor.type, "Property ".concat(name, " requires a type."));
220
- const accessor = createTypedArrayFromAccessor(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
221
- return {
222
- typedArray: accessor.values,
223
- componentCount: accessor.size,
224
- unpack: accessor.unpacker,
225
- pack: accessor.packer
226
- };
146
+ _getBinaryProperty(binaryProperty, index) {
147
+ return binaryProperty.unpack(binaryProperty.typedArray, index);
227
148
  }
228
-
229
- return null;
230
- }
231
-
232
- _hasPropertyInHierarchy(batchId, name) {
233
- if (!this._hierarchy) {
234
- return false;
149
+ _setBinaryProperty(binaryProperty, index, value) {
150
+ binaryProperty.pack(value, binaryProperty.typedArray, index);
235
151
  }
236
-
237
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
238
- const classId = hierarchy.classIds[instanceIndex];
239
- const instances = hierarchy.classes[classId].instances;
240
- return defined(instances[name]);
241
- });
242
- return defined(result);
243
- }
244
-
245
- _getPropertyNamesInHierarchy(batchId, results) {
246
- traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
247
- const classId = hierarchy.classIds[instanceIndex];
248
- const instances = hierarchy.classes[classId].instances;
249
-
250
- for (const name in instances) {
251
- if (instances.hasOwnProperty(name)) {
252
- if (results.indexOf(name) === -1) {
253
- results.push(name);
254
- }
152
+ _initializeBinaryProperties() {
153
+ let binaryProperties = null;
154
+ for (const name in this._properties) {
155
+ const property = this._properties[name];
156
+ const binaryProperty = this._initializeBinaryProperty(name, property);
157
+ // Store any information needed to access the binary data, including the typed array,
158
+ // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).
159
+ if (binaryProperty) {
160
+ binaryProperties = binaryProperties || {};
161
+ binaryProperties[name] = binaryProperty;
162
+ }
255
163
  }
256
- }
257
- });
258
- }
259
-
260
- _getHierarchyProperty(batchId, name) {
261
- return traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
262
- const classId = hierarchy.classIds[instanceIndex];
263
- const instanceClass = hierarchy.classes[classId];
264
- const indexInClass = hierarchy.classIndexes[instanceIndex];
265
- const propertyValues = instanceClass.instances[name];
266
-
267
- if (defined(propertyValues)) {
268
- if (defined(propertyValues.typedArray)) {
269
- return this._getBinaryProperty(propertyValues, indexInClass);
164
+ return binaryProperties;
165
+ }
166
+ _initializeBinaryProperty(name, property) {
167
+ if ('byteOffset' in property) {
168
+ // This is a binary property
169
+ const tile3DAccessor = property;
170
+ (0, loader_utils_1.assert)(this.binary, `Property ${name} requires a batch table binary.`);
171
+ (0, loader_utils_1.assert)(tile3DAccessor.type, `Property ${name} requires a type.`);
172
+ const accessor = (0, tile_3d_accessor_utils_1.createTypedArrayFromAccessor)(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
173
+ // Store any information needed to access the binary data, including the typed array,
174
+ // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).
175
+ return {
176
+ typedArray: accessor.values,
177
+ componentCount: accessor.size,
178
+ unpack: accessor.unpacker,
179
+ pack: accessor.packer
180
+ };
270
181
  }
271
-
272
- return clone(propertyValues[indexInClass], true);
273
- }
274
-
275
- return null;
276
- });
277
- }
278
-
279
- _setHierarchyProperty(batchTable, batchId, name, value) {
280
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
281
- const classId = hierarchy.classIds[instanceIndex];
282
- const instanceClass = hierarchy.classes[classId];
283
- const indexInClass = hierarchy.classIndexes[instanceIndex];
284
- const propertyValues = instanceClass.instances[name];
285
-
286
- if (defined(propertyValues)) {
287
- assert(instanceIndex === batchId, "Inherited property \"".concat(name, "\" is read-only."));
288
-
289
- if (defined(propertyValues.typedArray)) {
290
- this._setBinaryProperty(propertyValues, indexInClass, value);
291
- } else {
292
- propertyValues[indexInClass] = clone(value, true);
182
+ return null;
183
+ }
184
+ // EXTENSION SUPPORT: 3DTILES_batch_table_hierarchy
185
+ _hasPropertyInHierarchy(batchId, name) {
186
+ if (!this._hierarchy) {
187
+ return false;
293
188
  }
294
-
295
- return true;
296
- }
297
-
298
- return false;
299
- });
300
- return defined(result);
301
- }
302
-
189
+ const result = (0, tile_3d_batch_table_hierarchy_1.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
190
+ const classId = hierarchy.classIds[instanceIndex];
191
+ const instances = hierarchy.classes[classId].instances;
192
+ return defined(instances[name]);
193
+ });
194
+ return defined(result);
195
+ }
196
+ _getPropertyNamesInHierarchy(batchId, results) {
197
+ (0, tile_3d_batch_table_hierarchy_1.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
198
+ const classId = hierarchy.classIds[instanceIndex];
199
+ const instances = hierarchy.classes[classId].instances;
200
+ for (const name in instances) {
201
+ if (instances.hasOwnProperty(name)) {
202
+ if (results.indexOf(name) === -1) {
203
+ results.push(name);
204
+ }
205
+ }
206
+ }
207
+ });
208
+ }
209
+ _getHierarchyProperty(batchId, name) {
210
+ return (0, tile_3d_batch_table_hierarchy_1.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
211
+ const classId = hierarchy.classIds[instanceIndex];
212
+ const instanceClass = hierarchy.classes[classId];
213
+ const indexInClass = hierarchy.classIndexes[instanceIndex];
214
+ const propertyValues = instanceClass.instances[name];
215
+ if (defined(propertyValues)) {
216
+ if (defined(propertyValues.typedArray)) {
217
+ return this._getBinaryProperty(propertyValues, indexInClass);
218
+ }
219
+ return clone(propertyValues[indexInClass], true);
220
+ }
221
+ return null;
222
+ });
223
+ }
224
+ _setHierarchyProperty(batchTable, batchId, name, value) {
225
+ const result = (0, tile_3d_batch_table_hierarchy_1.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
226
+ const classId = hierarchy.classIds[instanceIndex];
227
+ const instanceClass = hierarchy.classes[classId];
228
+ const indexInClass = hierarchy.classIndexes[instanceIndex];
229
+ const propertyValues = instanceClass.instances[name];
230
+ if (defined(propertyValues)) {
231
+ (0, loader_utils_1.assert)(instanceIndex === batchId, `Inherited property "${name}" is read-only.`);
232
+ if (defined(propertyValues.typedArray)) {
233
+ this._setBinaryProperty(propertyValues, indexInClass, value);
234
+ }
235
+ else {
236
+ propertyValues[indexInClass] = clone(value, true);
237
+ }
238
+ return true;
239
+ }
240
+ return false;
241
+ });
242
+ return defined(result);
243
+ }
303
244
  }
304
- //# sourceMappingURL=tile-3d-batch-table.js.map
245
+ exports.default = Tile3DBatchTableParser;