@loaders.gl/3d-tiles 4.0.0-alpha.1 → 4.0.0-alpha.11

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 (393) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +2 -2
  4. package/dist/cesium-ion-loader.d.ts +6 -0
  5. package/dist/cesium-ion-loader.d.ts.map +1 -0
  6. package/dist/cesium-ion-loader.js +37 -32
  7. package/dist/dist.min.js +14805 -0
  8. package/dist/es5/bundle.js +6 -0
  9. package/dist/es5/bundle.js.map +1 -0
  10. package/dist/es5/cesium-ion-loader.js +77 -0
  11. package/dist/es5/cesium-ion-loader.js.map +1 -0
  12. package/dist/es5/index.js +63 -0
  13. package/dist/es5/index.js.map +1 -0
  14. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +114 -0
  15. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  16. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +180 -0
  17. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  18. package/dist/es5/lib/classes/tile-3d-batch-table.js +285 -0
  19. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -0
  20. package/dist/es5/lib/classes/tile-3d-feature-table.js +97 -0
  21. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -0
  22. package/dist/es5/lib/constants.js +32 -0
  23. package/dist/es5/lib/constants.js.map +1 -0
  24. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +49 -0
  25. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  26. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +30 -0
  27. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  28. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +47 -0
  29. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  30. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +48 -0
  31. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  32. package/dist/es5/lib/encoders/encode-3d-tile.js +35 -0
  33. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -0
  34. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +35 -0
  35. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  36. package/dist/es5/lib/ion/ion.js +170 -0
  37. package/dist/es5/lib/ion/ion.js.map +1 -0
  38. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +65 -0
  39. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  40. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +32 -0
  41. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  42. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +32 -0
  43. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  44. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js +280 -0
  45. package/dist/es5/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  46. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +110 -0
  47. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  48. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js +22 -0
  49. package/dist/es5/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  50. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js +145 -0
  51. package/dist/es5/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  52. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js +85 -0
  53. package/dist/es5/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  54. package/dist/es5/lib/parsers/helpers/parse-utils.js +28 -0
  55. package/dist/es5/lib/parsers/helpers/parse-utils.js.map +1 -0
  56. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js +51 -0
  57. package/dist/es5/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  58. package/dist/es5/lib/parsers/parse-3d-tile-composite.js +48 -0
  59. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  60. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js +52 -0
  61. package/dist/es5/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  62. package/dist/es5/lib/parsers/parse-3d-tile-header.js +289 -0
  63. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -0
  64. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +163 -0
  65. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  66. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +295 -0
  67. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  68. package/dist/es5/lib/parsers/parse-3d-tile.js +74 -0
  69. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -0
  70. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js +30 -0
  71. package/dist/es5/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  72. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js +44 -0
  73. package/dist/es5/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  74. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js +30 -0
  75. package/dist/es5/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  76. package/dist/es5/lib/utils/s2/converters/s2-to-region.js +52 -0
  77. package/dist/es5/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  78. package/dist/es5/lib/utils/s2/index.js +90 -0
  79. package/dist/es5/lib/utils/s2/index.js.map +1 -0
  80. package/dist/es5/lib/utils/s2/s2-geometry-functions.js +19 -0
  81. package/dist/es5/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  82. package/dist/es5/lib/utils/s2/s2-token-functions.js +41 -0
  83. package/dist/es5/lib/utils/s2/s2-token-functions.js.map +1 -0
  84. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js +22 -0
  85. package/dist/es5/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  86. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js +207 -0
  87. package/dist/es5/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  88. package/dist/es5/lib/utils/version.js +9 -0
  89. package/dist/es5/lib/utils/version.js.map +1 -0
  90. package/dist/es5/tile-3d-subtree-loader.js +22 -0
  91. package/dist/es5/tile-3d-subtree-loader.js.map +1 -0
  92. package/dist/es5/tile-3d-writer.js +26 -0
  93. package/dist/es5/tile-3d-writer.js.map +1 -0
  94. package/dist/es5/tiles-3d-loader.js +133 -0
  95. package/dist/es5/tiles-3d-loader.js.map +1 -0
  96. package/dist/es5/types.js +2 -0
  97. package/dist/es5/types.js.map +1 -0
  98. package/dist/esm/bundle.js +4 -0
  99. package/dist/esm/bundle.js.map +1 -0
  100. package/dist/esm/cesium-ion-loader.js +36 -0
  101. package/dist/esm/cesium-ion-loader.js.map +1 -0
  102. package/dist/esm/index.js +9 -0
  103. package/dist/esm/index.js.map +1 -0
  104. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +96 -0
  105. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  106. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +171 -0
  107. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  108. package/dist/esm/lib/classes/tile-3d-batch-table.js +231 -0
  109. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -0
  110. package/dist/esm/lib/classes/tile-3d-feature-table.js +70 -0
  111. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -0
  112. package/dist/esm/lib/constants.js +22 -0
  113. package/dist/esm/lib/constants.js.map +1 -0
  114. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +40 -0
  115. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  116. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +21 -0
  117. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  118. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +36 -0
  119. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  120. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +39 -0
  121. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  122. package/dist/esm/lib/encoders/encode-3d-tile.js +29 -0
  123. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -0
  124. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +28 -0
  125. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  126. package/dist/esm/lib/ion/ion.js +70 -0
  127. package/dist/esm/lib/ion/ion.js.map +1 -0
  128. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +58 -0
  129. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  130. package/{src → dist/esm}/lib/parsers/helpers/normalize-3d-tile-normals.js +5 -10
  131. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  132. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +26 -0
  133. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  134. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js +241 -0
  135. package/dist/esm/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +1 -0
  136. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +67 -0
  137. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  138. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +16 -0
  139. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  140. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +67 -0
  141. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  142. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +80 -0
  143. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  144. package/dist/esm/lib/parsers/helpers/parse-utils.js +20 -0
  145. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -0
  146. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +25 -0
  147. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  148. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +15 -0
  149. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  150. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js +20 -0
  151. package/dist/esm/lib/parsers/parse-3d-tile-gltf.js.map +1 -0
  152. package/dist/esm/lib/parsers/parse-3d-tile-header.js +181 -0
  153. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -0
  154. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +138 -0
  155. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  156. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +232 -0
  157. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  158. package/dist/esm/lib/parsers/parse-3d-tile.js +30 -0
  159. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -0
  160. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js +23 -0
  161. package/dist/esm/lib/utils/obb/s2-corners-to-obb.js.map +1 -0
  162. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js +40 -0
  163. package/dist/esm/lib/utils/s2/converters/s2-to-boundary.js.map +1 -0
  164. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js +24 -0
  165. package/dist/esm/lib/utils/s2/converters/s2-to-obb-points.js.map +1 -0
  166. package/dist/esm/lib/utils/s2/converters/s2-to-region.js +42 -0
  167. package/dist/esm/lib/utils/s2/converters/s2-to-region.js.map +1 -0
  168. package/dist/esm/lib/utils/s2/index.js +7 -0
  169. package/dist/esm/lib/utils/s2/index.js.map +1 -0
  170. package/dist/esm/lib/utils/s2/s2-geometry-functions.js +12 -0
  171. package/dist/esm/lib/utils/s2/s2-geometry-functions.js.map +1 -0
  172. package/dist/esm/lib/utils/s2/s2-token-functions.js +32 -0
  173. package/dist/esm/lib/utils/s2/s2-token-functions.js.map +1 -0
  174. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js +15 -0
  175. package/dist/esm/lib/utils/s2/s2geometry/s2-cell-utils.js.map +1 -0
  176. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js +186 -0
  177. package/dist/esm/lib/utils/s2/s2geometry/s2-geometry.js.map +1 -0
  178. package/dist/esm/lib/utils/version.js +2 -0
  179. package/dist/esm/lib/utils/version.js.map +1 -0
  180. package/dist/esm/tile-3d-subtree-loader.js +14 -0
  181. package/dist/esm/tile-3d-subtree-loader.js.map +1 -0
  182. package/dist/esm/tile-3d-writer.js +19 -0
  183. package/dist/esm/tile-3d-writer.js.map +1 -0
  184. package/dist/esm/tiles-3d-loader.js +68 -0
  185. package/dist/esm/tiles-3d-loader.js.map +1 -0
  186. package/dist/esm/types.js +2 -0
  187. package/dist/esm/types.js.map +1 -0
  188. package/dist/index.d.ts +11 -0
  189. package/dist/index.d.ts.map +1 -0
  190. package/dist/index.js +26 -8
  191. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +8 -0
  192. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -0
  193. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +106 -89
  194. package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts +10 -0
  195. package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -0
  196. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +184 -202
  197. package/dist/lib/classes/tile-3d-batch-table.d.ts +34 -0
  198. package/dist/lib/classes/tile-3d-batch-table.d.ts.map +1 -0
  199. package/dist/lib/classes/tile-3d-batch-table.js +223 -267
  200. package/dist/lib/classes/tile-3d-feature-table.d.ts +15 -0
  201. package/dist/lib/classes/tile-3d-feature-table.d.ts.map +1 -0
  202. package/dist/lib/classes/tile-3d-feature-table.js +64 -79
  203. package/dist/lib/constants.d.ts +22 -0
  204. package/dist/lib/constants.d.ts.map +1 -0
  205. package/dist/lib/constants.js +23 -18
  206. package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts +2 -0
  207. package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts.map +1 -0
  208. package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
  209. package/dist/lib/encoders/encode-3d-tile-composite.d.ts +2 -0
  210. package/dist/lib/encoders/encode-3d-tile-composite.d.ts.map +1 -0
  211. package/dist/lib/encoders/encode-3d-tile-composite.js +23 -24
  212. package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts +2 -0
  213. package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts.map +1 -0
  214. package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
  215. package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts +2 -0
  216. package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts.map +1 -0
  217. package/dist/lib/encoders/encode-3d-tile-point-cloud.js +36 -38
  218. package/dist/lib/encoders/encode-3d-tile.d.ts +2 -0
  219. package/dist/lib/encoders/encode-3d-tile.d.ts.map +1 -0
  220. package/dist/lib/encoders/encode-3d-tile.js +30 -32
  221. package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts +3 -0
  222. package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts.map +1 -0
  223. package/dist/lib/encoders/helpers/encode-3d-tile-header.js +28 -29
  224. package/dist/lib/ion/ion.d.ts +4 -0
  225. package/dist/lib/ion/ion.d.ts.map +1 -0
  226. package/dist/lib/ion/ion.js +60 -69
  227. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +9 -0
  228. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -0
  229. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +60 -62
  230. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +7 -0
  231. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -0
  232. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
  233. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts +2 -0
  234. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -0
  235. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +39 -28
  236. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +57 -0
  237. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -0
  238. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +266 -0
  239. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +10 -0
  240. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -0
  241. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +90 -63
  242. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +3 -0
  243. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -0
  244. package/dist/lib/parsers/helpers/parse-3d-tile-header.js +26 -15
  245. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +10 -0
  246. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -0
  247. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +104 -0
  248. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +5 -0
  249. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -0
  250. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +85 -81
  251. package/dist/lib/parsers/helpers/parse-utils.d.ts +4 -0
  252. package/dist/lib/parsers/helpers/parse-utils.d.ts.map +1 -0
  253. package/dist/lib/parsers/helpers/parse-utils.js +29 -16
  254. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +5 -0
  255. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -0
  256. package/dist/lib/parsers/parse-3d-tile-batched-model.js +30 -26
  257. package/dist/lib/parsers/parse-3d-tile-composite.d.ts +8 -0
  258. package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -0
  259. package/dist/lib/parsers/parse-3d-tile-composite.js +23 -16
  260. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +5 -0
  261. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -0
  262. package/dist/lib/parsers/parse-3d-tile-gltf.js +28 -0
  263. package/dist/lib/parsers/parse-3d-tile-header.d.ts +20 -0
  264. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -0
  265. package/dist/lib/parsers/parse-3d-tile-header.js +186 -71
  266. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +5 -0
  267. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -0
  268. package/dist/lib/parsers/parse-3d-tile-instanced-model.js +165 -170
  269. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +6 -0
  270. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -0
  271. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +372 -184
  272. package/dist/lib/parsers/parse-3d-tile.d.ts +5 -0
  273. package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -0
  274. package/dist/lib/parsers/parse-3d-tile.js +32 -27
  275. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts +15 -0
  276. package/dist/lib/utils/obb/s2-corners-to-obb.d.ts.map +1 -0
  277. package/dist/lib/utils/obb/s2-corners-to-obb.js +37 -0
  278. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +9 -0
  279. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -0
  280. package/dist/lib/utils/s2/converters/s2-to-boundary.js +61 -0
  281. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts +15 -0
  282. package/dist/lib/utils/s2/converters/s2-to-obb-points.d.ts.map +1 -0
  283. package/dist/lib/utils/s2/converters/s2-to-obb-points.js +36 -0
  284. package/dist/lib/utils/s2/converters/s2-to-region.d.ts +13 -0
  285. package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -0
  286. package/dist/lib/utils/s2/converters/s2-to-region.js +59 -0
  287. package/dist/lib/utils/s2/index.d.ts +8 -0
  288. package/dist/lib/utils/s2/index.d.ts.map +1 -0
  289. package/dist/lib/utils/s2/index.js +23 -0
  290. package/dist/lib/utils/s2/s2-geometry-functions.d.ts +14 -0
  291. package/dist/lib/utils/s2/s2-geometry-functions.d.ts.map +1 -0
  292. package/dist/lib/utils/s2/s2-geometry-functions.js +29 -0
  293. package/dist/lib/utils/s2/s2-token-functions.d.ts +23 -0
  294. package/dist/lib/utils/s2/s2-token-functions.d.ts.map +1 -0
  295. package/dist/lib/utils/s2/s2-token-functions.js +68 -0
  296. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +14 -0
  297. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -0
  298. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +32 -0
  299. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts +52 -0
  300. package/dist/lib/utils/s2/s2geometry/s2-geometry.d.ts.map +1 -0
  301. package/dist/lib/utils/s2/s2geometry/s2-geometry.js +260 -0
  302. package/dist/lib/utils/version.d.ts +2 -0
  303. package/dist/lib/utils/version.d.ts.map +1 -0
  304. package/dist/lib/utils/version.js +7 -2
  305. package/dist/tile-3d-subtree-loader.d.ts +7 -0
  306. package/dist/tile-3d-subtree-loader.d.ts.map +1 -0
  307. package/dist/tile-3d-subtree-loader.js +23 -0
  308. package/dist/tile-3d-writer.d.ts +6 -0
  309. package/dist/tile-3d-writer.d.ts.map +1 -0
  310. package/dist/tile-3d-writer.js +24 -17
  311. package/dist/tiles-3d-loader.d.ts +20 -0
  312. package/dist/tiles-3d-loader.d.ts.map +1 -0
  313. package/dist/tiles-3d-loader.js +69 -65
  314. package/dist/types.d.ts +335 -0
  315. package/dist/types.d.ts.map +1 -0
  316. package/dist/types.js +2 -2
  317. package/package.json +14 -13
  318. package/src/cesium-ion-loader.ts +1 -0
  319. package/src/index.ts +13 -1
  320. package/src/lib/classes/{tile-3d-batch-table.js → tile-3d-batch-table.ts} +14 -4
  321. package/src/lib/classes/{tile-3d-feature-table.js → tile-3d-feature-table.ts} +5 -2
  322. package/src/lib/{constants.js → constants.ts} +2 -1
  323. package/src/lib/parsers/helpers/{normalize-3d-tile-colors.js → normalize-3d-tile-colors.ts} +10 -4
  324. package/src/lib/parsers/helpers/normalize-3d-tile-normals.ts +35 -0
  325. package/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts +396 -0
  326. package/src/lib/parsers/helpers/{parse-3d-tile-gltf-view.js → parse-3d-tile-gltf-view.ts} +40 -16
  327. package/src/lib/parsers/helpers/{parse-3d-tile-header.js → parse-3d-tile-header.ts} +7 -1
  328. package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +148 -0
  329. package/src/lib/parsers/helpers/{parse-3d-tile-tables.js → parse-3d-tile-tables.ts} +33 -12
  330. package/src/lib/parsers/{parse-3d-tile-batched-model.js → parse-3d-tile-batched-model.ts} +18 -3
  331. package/src/lib/parsers/{parse-3d-tile-composite.js → parse-3d-tile-composite.ts} +20 -8
  332. package/src/lib/parsers/parse-3d-tile-gltf.ts +33 -0
  333. package/src/lib/parsers/parse-3d-tile-header.ts +253 -0
  334. package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts} +41 -30
  335. package/src/lib/parsers/{parse-3d-tile-point-cloud.js → parse-3d-tile-point-cloud.ts} +73 -14
  336. package/src/lib/parsers/{parse-3d-tile.js → parse-3d-tile.ts} +14 -1
  337. package/src/lib/utils/obb/s2-corners-to-obb.ts +51 -0
  338. package/src/lib/utils/s2/converters/s2-to-boundary.ts +67 -0
  339. package/src/lib/utils/s2/converters/s2-to-obb-points.ts +46 -0
  340. package/src/lib/utils/s2/converters/s2-to-region.ts +69 -0
  341. package/src/lib/utils/s2/index.ts +17 -0
  342. package/src/lib/utils/s2/s2-geometry-functions.ts +28 -0
  343. package/src/lib/utils/s2/s2-token-functions.ts +67 -0
  344. package/src/lib/utils/s2/s2geometry/s2-cell-utils.ts +33 -0
  345. package/src/lib/utils/s2/s2geometry/s2-geometry.ts +296 -0
  346. package/src/tile-3d-subtree-loader.ts +19 -0
  347. package/src/tiles-3d-loader.ts +68 -37
  348. package/src/types.ts +321 -13
  349. package/dist/bundle.js.map +0 -1
  350. package/dist/cesium-ion-loader.js.map +0 -1
  351. package/dist/index.js.map +0 -1
  352. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
  353. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
  354. package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
  355. package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
  356. package/dist/lib/constants.js.map +0 -1
  357. package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
  358. package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
  359. package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
  360. package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
  361. package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
  362. package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
  363. package/dist/lib/ion/ion.js.map +0 -1
  364. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
  365. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
  366. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
  367. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
  368. package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
  369. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
  370. package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
  371. package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
  372. package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
  373. package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
  374. package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
  375. package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
  376. package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
  377. package/dist/lib/utils/version.js.map +0 -1
  378. package/dist/tile-3d-writer.js.map +0 -1
  379. package/dist/tiles-3d-loader.js.map +0 -1
  380. package/dist/types.js.map +0 -1
  381. package/src/lib/parsers/parse-3d-tile-header.js +0 -69
  382. /package/src/lib/classes/helpers/{tile-3d-accessor-utils.js → tile-3d-accessor-utils.ts} +0 -0
  383. /package/src/lib/classes/{tile-3d-batch-table-hierarchy.js → tile-3d-batch-table-hierarchy.ts} +0 -0
  384. /package/src/lib/encoders/{encode-3d-tile-batched-model.js → encode-3d-tile-batched-model.ts} +0 -0
  385. /package/src/lib/encoders/{encode-3d-tile-composite.js → encode-3d-tile-composite.ts} +0 -0
  386. /package/src/lib/encoders/{encode-3d-tile-instanced-model.js → encode-3d-tile-instanced-model.ts} +0 -0
  387. /package/src/lib/encoders/{encode-3d-tile-point-cloud.js → encode-3d-tile-point-cloud.ts} +0 -0
  388. /package/src/lib/encoders/{encode-3d-tile.js → encode-3d-tile.ts} +0 -0
  389. /package/src/lib/encoders/helpers/{encode-3d-tile-header.js → encode-3d-tile-header.ts} +0 -0
  390. /package/src/lib/ion/{ion.js → ion.ts} +0 -0
  391. /package/src/lib/parsers/helpers/{normalize-3d-tile-positions.js → normalize-3d-tile-positions.ts} +0 -0
  392. /package/src/lib/parsers/helpers/{parse-utils.js → parse-utils.ts} +0 -0
  393. /package/src/lib/utils/{version.js → version.ts} +0 -0
@@ -1,289 +1,245 @@
1
- import { assert } from '@loaders.gl/loader-utils';
2
- import { createTypedArrayFromAccessor } from './helpers/tile-3d-accessor-utils';
3
- import { initializeHierarchy, traverseHierarchy } from './tile-3d-batch-table-hierarchy';
4
-
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");
5
8
  function defined(x) {
6
- return x !== undefined && x !== null;
9
+ return x !== undefined && x !== null;
7
10
  }
8
-
9
11
  const clone = (x, y) => x;
10
-
12
+ // These top level fields in the batch table json are not properties
11
13
  const IGNORED_PROPERTY_FIELDS = {
12
- HIERARCHY: true,
13
- extensions: true,
14
- extras: true
14
+ HIERARCHY: true,
15
+ extensions: true,
16
+ extras: true
15
17
  };
16
- export default class Tile3DBatchTableParser {
17
- constructor(json, binary, featureCount, options = {}) {
18
- var _this$json;
19
-
20
- assert(featureCount >= 0);
21
- this.json = json || {};
22
- this.binary = binary;
23
- this.featureCount = featureCount;
24
- this._extensions = ((_this$json = this.json) === null || _this$json === void 0 ? void 0 : _this$json.extensions) || {};
25
- this._properties = {};
26
-
27
- for (const propertyName in this.json) {
28
- if (!IGNORED_PROPERTY_FIELDS[propertyName]) {
29
- this._properties[propertyName] = this.json[propertyName];
30
- }
31
- }
32
-
33
- this._binaryProperties = this._initializeBinaryProperties();
34
-
35
- if (options['3DTILES_batch_table_hierarchy']) {
36
- this._hierarchy = initializeHierarchy(this, this.json, this.binary);
37
- }
38
- }
39
-
40
- getExtension(extensionName) {
41
- return this.json && this.json.extensions && this.json.extensions[extensionName];
42
- }
43
-
44
- memorySizeInBytes() {
45
- return 0;
46
- }
47
-
48
- isClass(batchId, className) {
49
- this._checkBatchId(batchId);
50
-
51
- assert(typeof className === 'string', className);
52
-
53
- if (this._hierarchy) {
54
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
55
- const classId = hierarchy.classIds[instanceIndex];
56
- const instanceClass = hierarchy.classes[classId];
57
- return instanceClass.name === className;
58
- });
59
- 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
+ }
60
38
  }
61
-
62
- return false;
63
- }
64
-
65
- isExactClass(batchId, className) {
66
- assert(typeof className === 'string', className);
67
- return this.getExactClassName(batchId) === className;
68
- }
69
-
70
- getExactClassName(batchId) {
71
- this._checkBatchId(batchId);
72
-
73
- if (this._hierarchy) {
74
- const classId = this._hierarchy.classIds[batchId];
75
- const instanceClass = this._hierarchy.classes[classId];
76
- return instanceClass.name;
39
+ getExtension(extensionName) {
40
+ return this.json && this.json.extensions && this.json.extensions[extensionName];
77
41
  }
78
-
79
- return undefined;
80
- }
81
-
82
- hasProperty(batchId, name) {
83
- this._checkBatchId(batchId);
84
-
85
- assert(typeof name === 'string', name);
86
- return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);
87
- }
88
-
89
- getPropertyNames(batchId, results) {
90
- this._checkBatchId(batchId);
91
-
92
- results = defined(results) ? results : [];
93
- results.length = 0;
94
- const propertyNames = Object.keys(this._properties);
95
- results.push(...propertyNames);
96
-
97
- if (this._hierarchy) {
98
- this._getPropertyNamesInHierarchy(batchId, results);
42
+ memorySizeInBytes() {
43
+ return 0;
99
44
  }
100
-
101
- return results;
102
- }
103
-
104
- getProperty(batchId, name) {
105
- this._checkBatchId(batchId);
106
-
107
- assert(typeof name === 'string', name);
108
-
109
- if (this._binaryProperties) {
110
- const binaryProperty = this._binaryProperties[name];
111
-
112
- if (defined(binaryProperty)) {
113
- return this._getBinaryProperty(binaryProperty, batchId);
114
- }
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;
115
61
  }
116
-
117
- const propertyValues = this._properties[name];
118
-
119
- if (defined(propertyValues)) {
120
- 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;
121
65
  }
122
-
123
- if (this._hierarchy) {
124
- const hierarchyProperty = this._getHierarchyProperty(batchId, name);
125
-
126
- if (defined(hierarchyProperty)) {
127
- return hierarchyProperty;
128
- }
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;
129
75
  }
130
-
131
- return undefined;
132
- }
133
-
134
- setProperty(batchId, name, value) {
135
- const featureCount = this.featureCount;
136
-
137
- this._checkBatchId(batchId);
138
-
139
- assert(typeof name === 'string', name);
140
-
141
- if (this._binaryProperties) {
142
- const binaryProperty = this._binaryProperties[name];
143
-
144
- if (binaryProperty) {
145
- this._setBinaryProperty(binaryProperty, batchId, value);
146
-
147
- return;
148
- }
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);
149
80
  }
150
-
151
- if (this._hierarchy) {
152
- if (this._setHierarchyProperty(this, batchId, name, value)) {
153
- return;
154
- }
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;
155
91
  }
156
-
157
- let propertyValues = this._properties[name];
158
-
159
- if (!defined(propertyValues)) {
160
- this._properties[name] = new Array(featureCount);
161
- 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;
162
113
  }
163
-
164
- propertyValues[batchId] = clone(value, true);
165
- }
166
-
167
- _checkBatchId(batchId) {
168
- const valid = batchId >= 0 && batchId < this.featureCount;
169
-
170
- if (!valid) {
171
- 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);
172
138
  }
173
- }
174
-
175
- _getBinaryProperty(binaryProperty, index) {
176
- return binaryProperty.unpack(binaryProperty.typedArray, index);
177
- }
178
-
179
- _setBinaryProperty(binaryProperty, index, value) {
180
- binaryProperty.pack(value, binaryProperty.typedArray, index);
181
- }
182
-
183
- _initializeBinaryProperties() {
184
- let binaryProperties = null;
185
-
186
- for (const name in this._properties) {
187
- const property = this._properties[name];
188
-
189
- const binaryProperty = this._initializeBinaryProperty(name, property);
190
-
191
- if (binaryProperty) {
192
- binaryProperties = binaryProperties || {};
193
- binaryProperties[name] = binaryProperty;
194
- }
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
+ }
195
145
  }
196
-
197
- return binaryProperties;
198
- }
199
-
200
- _initializeBinaryProperty(name, property) {
201
- if ('byteOffset' in property) {
202
- const tile3DAccessor = property;
203
- assert(this.binary, "Property ".concat(name, " requires a batch table binary."));
204
- assert(tile3DAccessor.type, "Property ".concat(name, " requires a type."));
205
- const accessor = createTypedArrayFromAccessor(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
206
- return {
207
- typedArray: accessor.values,
208
- componentCount: accessor.size,
209
- unpack: accessor.unpacker,
210
- pack: accessor.packer
211
- };
146
+ _getBinaryProperty(binaryProperty, index) {
147
+ return binaryProperty.unpack(binaryProperty.typedArray, index);
212
148
  }
213
-
214
- return null;
215
- }
216
-
217
- _hasPropertyInHierarchy(batchId, name) {
218
- if (!this._hierarchy) {
219
- return false;
149
+ _setBinaryProperty(binaryProperty, index, value) {
150
+ binaryProperty.pack(value, binaryProperty.typedArray, index);
220
151
  }
221
-
222
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
223
- const classId = hierarchy.classIds[instanceIndex];
224
- const instances = hierarchy.classes[classId].instances;
225
- return defined(instances[name]);
226
- });
227
- return defined(result);
228
- }
229
-
230
- _getPropertyNamesInHierarchy(batchId, results) {
231
- traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
232
- const classId = hierarchy.classIds[instanceIndex];
233
- const instances = hierarchy.classes[classId].instances;
234
-
235
- for (const name in instances) {
236
- if (instances.hasOwnProperty(name)) {
237
- if (results.indexOf(name) === -1) {
238
- results.push(name);
239
- }
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
+ }
240
163
  }
241
- }
242
- });
243
- }
244
-
245
- _getHierarchyProperty(batchId, name) {
246
- return traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
247
- const classId = hierarchy.classIds[instanceIndex];
248
- const instanceClass = hierarchy.classes[classId];
249
- const indexInClass = hierarchy.classIndexes[instanceIndex];
250
- const propertyValues = instanceClass.instances[name];
251
-
252
- if (defined(propertyValues)) {
253
- if (defined(propertyValues.typedArray)) {
254
- 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
+ };
255
181
  }
256
-
257
- return clone(propertyValues[indexInClass], true);
258
- }
259
-
260
- return null;
261
- });
262
- }
263
-
264
- _setHierarchyProperty(batchTable, batchId, name, value) {
265
- const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
266
- const classId = hierarchy.classIds[instanceIndex];
267
- const instanceClass = hierarchy.classes[classId];
268
- const indexInClass = hierarchy.classIndexes[instanceIndex];
269
- const propertyValues = instanceClass.instances[name];
270
-
271
- if (defined(propertyValues)) {
272
- assert(instanceIndex === batchId, "Inherited property \"".concat(name, "\" is read-only."));
273
-
274
- if (defined(propertyValues.typedArray)) {
275
- this._setBinaryProperty(propertyValues, indexInClass, value);
276
- } else {
277
- 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;
278
188
  }
279
-
280
- return true;
281
- }
282
-
283
- return false;
284
- });
285
- return defined(result);
286
- }
287
-
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
+ }
288
244
  }
289
- //# sourceMappingURL=tile-3d-batch-table.js.map
245
+ exports.default = Tile3DBatchTableParser;
@@ -0,0 +1,15 @@
1
+ export default class Tile3DFeatureTable {
2
+ json: any;
3
+ buffer: any;
4
+ featuresLength: number;
5
+ _cachedTypedArrays: {};
6
+ constructor(featureTableJson: any, featureTableBinary: any);
7
+ getExtension(extensionName: any): any;
8
+ hasProperty(propertyName: any): boolean;
9
+ getGlobalProperty(propertyName: any, componentType?: number, componentLength?: number): any;
10
+ getPropertyArray(propertyName: any, componentType: any, componentLength: any): any;
11
+ getProperty(propertyName: any, componentType: any, componentLength: any, featureId: any, result: any): any;
12
+ _getTypedArrayFromBinary(propertyName: any, componentType: any, componentLength: any, count: any, byteOffset: any): any;
13
+ _getTypedArrayFromArray(propertyName: any, componentType: any, array: any): any;
14
+ }
15
+ //# sourceMappingURL=tile-3d-feature-table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tile-3d-feature-table.d.ts","sourceRoot":"","sources":["../../../src/lib/classes/tile-3d-feature-table.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,OAAO,kBAAkB;IACrC,IAAI,MAAC;IACL,MAAM,MAAC;IACP,cAAc,SAAK;IACnB,kBAAkB,KAAM;gBAEZ,gBAAgB,KAAA,EAAE,kBAAkB,KAAA;IAKhD,YAAY,CAAC,aAAa,KAAA;IAI1B,WAAW,CAAC,YAAY,KAAA;IAIxB,iBAAiB,CAAC,YAAY,KAAA,EAAE,aAAa,SAAkB,EAAE,eAAe,SAAI;IAgBpF,gBAAgB,CAAC,YAAY,KAAA,EAAE,aAAa,KAAA,EAAE,eAAe,KAAA;IAmB7D,WAAW,CAAC,YAAY,KAAA,EAAE,aAAa,KAAA,EAAE,eAAe,KAAA,EAAE,SAAS,KAAA,EAAE,MAAM,KAAA;IAqB3E,wBAAwB,CAAC,YAAY,KAAA,EAAE,aAAa,KAAA,EAAE,eAAe,KAAA,EAAE,KAAK,KAAA,EAAE,UAAU,KAAA;IAexF,uBAAuB,CAAC,YAAY,KAAA,EAAE,aAAa,KAAA,EAAE,KAAK,KAAA;CAS3D"}