@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,177 +1,186 @@
1
- import { Vector3, Matrix3, Matrix4, Quaternion } from '@math.gl/core';
2
- import { Ellipsoid } from '@math.gl/geospatial';
3
- import { GL } from '@loaders.gl/math';
4
- import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
5
- import Tile3DBatchTable from '../classes/tile-3d-batch-table';
6
- import { parse3DTileHeaderSync } from './helpers/parse-3d-tile-header';
7
- import { parse3DTileTablesHeaderSync, parse3DTileTablesSync } from './helpers/parse-3d-tile-tables';
8
- import { parse3DTileGLTFViewSync, extractGLTF } from './helpers/parse-3d-tile-gltf-view';
9
- export async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
10
- byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
11
- await extractGLTF(tile, tile.gltfFormat, options, context);
12
- return byteOffset;
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
+ var __importDefault = (this && this.__importDefault) || function (mod) {
5
+ return (mod && mod.__esModule) ? mod : { "default": mod };
6
+ };
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.parseInstancedModel3DTile = void 0;
9
+ const core_1 = require("@math.gl/core");
10
+ const geospatial_1 = require("@math.gl/geospatial");
11
+ const math_1 = require("@loaders.gl/math"); // 'math.gl/geometry';
12
+ const tile_3d_feature_table_1 = __importDefault(require("../classes/tile-3d-feature-table"));
13
+ const tile_3d_batch_table_1 = __importDefault(require("../classes/tile-3d-batch-table"));
14
+ const parse_3d_tile_header_1 = require("./helpers/parse-3d-tile-header");
15
+ const parse_3d_tile_tables_1 = require("./helpers/parse-3d-tile-tables");
16
+ const parse_3d_tile_gltf_view_1 = require("./helpers/parse-3d-tile-gltf-view");
17
+ async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
18
+ byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
19
+ await (0, parse_3d_tile_gltf_view_1.extractGLTF)(tile, tile.gltfFormat, options, context);
20
+ return byteOffset;
13
21
  }
14
-
22
+ exports.parseInstancedModel3DTile = parseInstancedModel3DTile;
15
23
  function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
16
- byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
17
-
18
- if (tile.version !== 1) {
19
- throw new Error("Instanced 3D Model version ".concat(tile.version, " is not supported"));
20
- }
21
-
22
- byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);
23
- const view = new DataView(arrayBuffer);
24
- tile.gltfFormat = view.getUint32(byteOffset, true);
25
- byteOffset += 4;
26
- byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
27
- byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);
28
-
29
- if (tile.featureTableJsonByteLength === 0) {
30
- throw new Error('i3dm parser: featureTableJsonByteLength is zero.');
31
- }
32
-
33
- const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
34
- const instancesLength = featureTable.getGlobalProperty('INSTANCES_LENGTH');
35
- featureTable.featuresLength = instancesLength;
36
-
37
- if (!Number.isFinite(instancesLength)) {
38
- throw new Error('i3dm parser: INSTANCES_LENGTH must be defined');
39
- }
40
-
41
- tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');
42
- tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);
43
- const batchTable = new Tile3DBatchTable(tile.batchTableJson, tile.batchTableBinary, instancesLength);
44
- extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);
45
- return byteOffset;
46
- }
47
-
48
- function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
49
- const collectionOptions = {
50
- instances: new Array(instancesLength),
51
- batchTable: tile._batchTable,
52
- cull: false,
53
- url: undefined,
54
- gltf: undefined,
55
- basePath: undefined,
56
- incrementallyLoadTextures: false,
57
- forwardAxis: [1, 0, 0]
58
- };
59
- const instances = collectionOptions.instances;
60
- const instancePosition = new Vector3();
61
- const instanceNormalRight = new Vector3();
62
- const instanceNormalUp = new Vector3();
63
- const instanceNormalForward = new Vector3();
64
- const instanceRotation = new Matrix3();
65
- const instanceQuaternion = new Quaternion();
66
- const instanceScale = new Vector3();
67
- const instanceTranslationRotationScale = {};
68
- const instanceTransform = new Matrix4();
69
- const scratch1 = [];
70
- const scratch2 = [];
71
- const scratchVector1 = new Vector3();
72
- const scratchVector2 = new Vector3();
73
-
74
- for (let i = 0; i < instancesLength; i++) {
75
- let position;
76
-
77
- if (featureTable.hasProperty('POSITION')) {
78
- position = featureTable.getProperty('POSITION', GL.FLOAT, 3, i, instancePosition);
79
- } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
80
- position = featureTable.getProperty('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3, i, instancePosition);
81
- const quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', GL.FLOAT, 3, scratchVector1);
82
-
83
- if (!quantizedVolumeOffset) {
84
- throw new Error('i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');
85
- }
86
-
87
- const quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', GL.FLOAT, 3, scratchVector2);
88
-
89
- if (!quantizedVolumeScale) {
90
- throw new Error('i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');
91
- }
92
-
93
- const MAX_UNSIGNED_SHORT = 65535.0;
94
-
95
- for (let j = 0; j < 3; j++) {
96
- position[j] = position[j] / MAX_UNSIGNED_SHORT * quantizedVolumeScale[j] + quantizedVolumeOffset[j];
97
- }
98
- }
99
-
100
- if (!position) {
101
- throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.');
102
- }
103
-
104
- instancePosition.copy(position);
105
- instanceTranslationRotationScale.translation = instancePosition;
106
- tile.normalUp = featureTable.getProperty('NORMAL_UP', GL.FLOAT, 3, i, scratch1);
107
- tile.normalRight = featureTable.getProperty('NORMAL_RIGHT', GL.FLOAT, 3, i, scratch2);
108
- const hasCustomOrientation = false;
109
-
110
- if (tile.normalUp) {
111
- if (!tile.normalRight) {
112
- throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.');
113
- }
114
-
115
- tile.hasCustomOrientation = true;
116
- } else {
117
- tile.octNormalUp = featureTable.getProperty('NORMAL_UP_OCT32P', GL.UNSIGNED_SHORT, 2, scratch1);
118
- tile.octNormalRight = featureTable.getProperty('NORMAL_RIGHT_OCT32P', GL.UNSIGNED_SHORT, 2, scratch2);
119
-
120
- if (tile.octNormalUp) {
121
- if (!tile.octNormalRight) {
122
- throw new Error('i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P');
123
- }
124
-
125
- throw new Error('i3dm: oct-encoded orientation not implemented');
126
- } else if (tile.eastNorthUp) {
127
- Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);
128
- instanceTransform.getRotationMatrix3(instanceRotation);
129
- } else {
130
- instanceRotation.identity();
131
- }
24
+ byteOffset = (0, parse_3d_tile_header_1.parse3DTileHeaderSync)(tile, arrayBuffer, byteOffset);
25
+ if (tile.version !== 1) {
26
+ throw new Error(`Instanced 3D Model version ${tile.version} is not supported`);
132
27
  }
133
-
134
- if (hasCustomOrientation) {
135
- instanceNormalForward.copy(instanceNormalRight).cross(instanceNormalUp).normalize();
136
- instanceRotation.setColumn(0, instanceNormalRight);
137
- instanceRotation.setColumn(1, instanceNormalUp);
138
- instanceRotation.setColumn(2, instanceNormalForward);
28
+ byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesHeaderSync)(tile, arrayBuffer, byteOffset);
29
+ const view = new DataView(arrayBuffer);
30
+ tile.gltfFormat = view.getUint32(byteOffset, true);
31
+ byteOffset += 4;
32
+ // PARSE FEATURE TABLE
33
+ byteOffset = (0, parse_3d_tile_tables_1.parse3DTileTablesSync)(tile, arrayBuffer, byteOffset, options);
34
+ byteOffset = (0, parse_3d_tile_gltf_view_1.parse3DTileGLTFViewSync)(tile, arrayBuffer, byteOffset, options);
35
+ // TODO - Is the feature table sometimes optional or can check be moved into table header parser?
36
+ if (tile.featureTableJsonByteLength === 0) {
37
+ throw new Error('i3dm parser: featureTableJsonByteLength is zero.');
139
38
  }
140
-
141
- instanceQuaternion.fromMatrix3(instanceRotation);
142
- instanceTranslationRotationScale.rotation = instanceQuaternion;
143
- instanceScale.set(1.0, 1.0, 1.0);
144
- const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i);
145
-
146
- if (Number.isFinite(scale)) {
147
- instanceScale.multiplyByScalar(scale);
39
+ const featureTable = new tile_3d_feature_table_1.default(tile.featureTableJson, tile.featureTableBinary);
40
+ const instancesLength = featureTable.getGlobalProperty('INSTANCES_LENGTH');
41
+ featureTable.featuresLength = instancesLength;
42
+ if (!Number.isFinite(instancesLength)) {
43
+ throw new Error('i3dm parser: INSTANCES_LENGTH must be defined');
148
44
  }
149
-
150
- const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', GL.FLOAT, 3, i, scratch1);
151
-
152
- if (nonUniformScale) {
153
- instanceScale.scale(nonUniformScale);
154
- }
155
-
156
- instanceTranslationRotationScale.scale = instanceScale;
157
- let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i);
158
-
159
- if (batchId === undefined) {
160
- batchId = i;
161
- }
162
-
163
- const rotationMatrix = new Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);
164
- instanceTransform.identity();
165
- instanceTransform.translate(instanceTranslationRotationScale.translation);
166
- instanceTransform.multiplyRight(rotationMatrix);
167
- instanceTransform.scale(instanceTranslationRotationScale.scale);
168
- const modelMatrix = instanceTransform.clone();
169
- instances[i] = {
170
- modelMatrix,
171
- batchId
45
+ tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');
46
+ tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', math_1.GL.FLOAT, 3);
47
+ const batchTable = new tile_3d_batch_table_1.default(tile.batchTableJson, tile.batchTableBinary, instancesLength);
48
+ extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);
49
+ return byteOffset;
50
+ }
51
+ // eslint-disable-next-line max-statements, complexity
52
+ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
53
+ // Create model instance collection
54
+ const collectionOptions = {
55
+ instances: new Array(instancesLength),
56
+ batchTable: tile._batchTable,
57
+ cull: false,
58
+ url: undefined,
59
+ // requestType: RequestType.TILES3D,
60
+ gltf: undefined,
61
+ basePath: undefined,
62
+ incrementallyLoadTextures: false,
63
+ // TODO - tileset is not available at this stage, tile is parsed independently
64
+ // upAxis: (tileset && tileset._gltfUpAxis) || [0, 1, 0],
65
+ forwardAxis: [1, 0, 0]
172
66
  };
173
- }
174
-
175
- tile.instances = instances;
67
+ const instances = collectionOptions.instances;
68
+ const instancePosition = new core_1.Vector3();
69
+ const instanceNormalRight = new core_1.Vector3();
70
+ const instanceNormalUp = new core_1.Vector3();
71
+ const instanceNormalForward = new core_1.Vector3();
72
+ const instanceRotation = new core_1.Matrix3();
73
+ const instanceQuaternion = new core_1.Quaternion();
74
+ const instanceScale = new core_1.Vector3();
75
+ const instanceTranslationRotationScale = {};
76
+ const instanceTransform = new core_1.Matrix4();
77
+ const scratch1 = [];
78
+ const scratch2 = [];
79
+ const scratchVector1 = new core_1.Vector3();
80
+ const scratchVector2 = new core_1.Vector3();
81
+ for (let i = 0; i < instancesLength; i++) {
82
+ let position;
83
+ // Get the instance position
84
+ if (featureTable.hasProperty('POSITION')) {
85
+ position = featureTable.getProperty('POSITION', math_1.GL.FLOAT, 3, i, instancePosition);
86
+ }
87
+ else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
88
+ position = featureTable.getProperty('POSITION_QUANTIZED', math_1.GL.UNSIGNED_SHORT, 3, i, instancePosition);
89
+ const quantizedVolumeOffset = featureTable.getGlobalProperty('QUANTIZED_VOLUME_OFFSET', math_1.GL.FLOAT, 3, scratchVector1);
90
+ if (!quantizedVolumeOffset) {
91
+ throw new Error('i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.');
92
+ }
93
+ const quantizedVolumeScale = featureTable.getGlobalProperty('QUANTIZED_VOLUME_SCALE', math_1.GL.FLOAT, 3, scratchVector2);
94
+ if (!quantizedVolumeScale) {
95
+ throw new Error('i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.');
96
+ }
97
+ const MAX_UNSIGNED_SHORT = 65535.0;
98
+ for (let j = 0; j < 3; j++) {
99
+ position[j] =
100
+ (position[j] / MAX_UNSIGNED_SHORT) * quantizedVolumeScale[j] + quantizedVolumeOffset[j];
101
+ }
102
+ }
103
+ if (!position) {
104
+ throw new Error('i3dm: POSITION or POSITION_QUANTIZED must be defined for each instance.');
105
+ }
106
+ instancePosition.copy(position);
107
+ // @ts-expect-error
108
+ instanceTranslationRotationScale.translation = instancePosition;
109
+ // Get the instance rotation
110
+ tile.normalUp = featureTable.getProperty('NORMAL_UP', math_1.GL.FLOAT, 3, i, scratch1);
111
+ tile.normalRight = featureTable.getProperty('NORMAL_RIGHT', math_1.GL.FLOAT, 3, i, scratch2);
112
+ const hasCustomOrientation = false;
113
+ if (tile.normalUp) {
114
+ if (!tile.normalRight) {
115
+ throw new Error('i3dm: Custom orientation requires both NORMAL_UP and NORMAL_RIGHT.');
116
+ }
117
+ // Vector3.unpack(normalUp, 0, instanceNormalUp);
118
+ // Vector3.unpack(normalRight, 0, instanceNormalRight);
119
+ tile.hasCustomOrientation = true;
120
+ }
121
+ else {
122
+ tile.octNormalUp = featureTable.getProperty('NORMAL_UP_OCT32P', math_1.GL.UNSIGNED_SHORT, 2, scratch1);
123
+ tile.octNormalRight = featureTable.getProperty('NORMAL_RIGHT_OCT32P', math_1.GL.UNSIGNED_SHORT, 2, scratch2);
124
+ if (tile.octNormalUp) {
125
+ if (!tile.octNormalRight) {
126
+ throw new Error('i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P');
127
+ }
128
+ throw new Error('i3dm: oct-encoded orientation not implemented');
129
+ /*
130
+ AttributeCompression.octDecodeInRange(octNormalUp[0], octNormalUp[1], 65535, instanceNormalUp);
131
+ AttributeCompression.octDecodeInRange(octNormalRight[0], octNormalRight[1], 65535, instanceNormalRight);
132
+ hasCustomOrientation = true;
133
+ */
134
+ }
135
+ else if (tile.eastNorthUp) {
136
+ geospatial_1.Ellipsoid.WGS84.eastNorthUpToFixedFrame(instancePosition, instanceTransform);
137
+ instanceTransform.getRotationMatrix3(instanceRotation);
138
+ }
139
+ else {
140
+ instanceRotation.identity();
141
+ }
142
+ }
143
+ if (hasCustomOrientation) {
144
+ instanceNormalForward.copy(instanceNormalRight).cross(instanceNormalUp).normalize();
145
+ instanceRotation.setColumn(0, instanceNormalRight);
146
+ instanceRotation.setColumn(1, instanceNormalUp);
147
+ instanceRotation.setColumn(2, instanceNormalForward);
148
+ }
149
+ instanceQuaternion.fromMatrix3(instanceRotation);
150
+ // @ts-expect-error
151
+ instanceTranslationRotationScale.rotation = instanceQuaternion;
152
+ // Get the instance scale
153
+ instanceScale.set(1.0, 1.0, 1.0);
154
+ const scale = featureTable.getProperty('SCALE', math_1.GL.FLOAT, 1, i);
155
+ if (Number.isFinite(scale)) {
156
+ instanceScale.multiplyByScalar(scale);
157
+ }
158
+ const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', math_1.GL.FLOAT, 3, i, scratch1);
159
+ if (nonUniformScale) {
160
+ instanceScale.scale(nonUniformScale);
161
+ }
162
+ // @ts-expect-error
163
+ instanceTranslationRotationScale.scale = instanceScale;
164
+ // Get the batchId
165
+ let batchId = featureTable.getProperty('BATCH_ID', math_1.GL.UNSIGNED_SHORT, 1, i);
166
+ if (batchId === undefined) {
167
+ // If BATCH_ID semantic is undefined, batchId is just the instance number
168
+ batchId = i;
169
+ }
170
+ // @ts-expect-error
171
+ const rotationMatrix = new core_1.Matrix4().fromQuaternion(instanceTranslationRotationScale.rotation);
172
+ // Create the model matrix and the instance
173
+ instanceTransform.identity();
174
+ // @ts-expect-error
175
+ instanceTransform.translate(instanceTranslationRotationScale.translation);
176
+ instanceTransform.multiplyRight(rotationMatrix);
177
+ // @ts-expect-error
178
+ instanceTransform.scale(instanceTranslationRotationScale.scale);
179
+ const modelMatrix = instanceTransform.clone();
180
+ instances[i] = {
181
+ modelMatrix,
182
+ batchId
183
+ };
184
+ }
185
+ tile.instances = instances;
176
186
  }
177
- //# sourceMappingURL=parse-3d-tile-instanced-model.js.map