@loaders.gl/3d-tiles 3.1.0-alpha.3 → 3.1.0-beta.2

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 (301) hide show
  1. package/dist/bundle.d.ts +2 -0
  2. package/dist/bundle.d.ts.map +1 -0
  3. package/dist/bundle.js +9972 -4
  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 +36 -32
  7. package/dist/es5/bundle.js +7 -0
  8. package/dist/es5/bundle.js.map +1 -0
  9. package/dist/es5/cesium-ion-loader.js +45 -0
  10. package/dist/es5/cesium-ion-loader.js.map +1 -0
  11. package/dist/es5/index.js +72 -0
  12. package/dist/es5/index.js.map +1 -0
  13. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js +108 -0
  14. package/dist/es5/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  15. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js +223 -0
  16. package/dist/es5/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  17. package/dist/es5/lib/classes/tile-3d-batch-table.js +312 -0
  18. package/dist/es5/lib/classes/tile-3d-batch-table.js.map +1 -0
  19. package/dist/es5/lib/classes/tile-3d-feature-table.js +103 -0
  20. package/dist/es5/lib/classes/tile-3d-feature-table.js.map +1 -0
  21. package/dist/es5/lib/constants.js +31 -0
  22. package/dist/es5/lib/constants.js.map +1 -0
  23. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js +56 -0
  24. package/dist/es5/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  25. package/dist/es5/lib/encoders/encode-3d-tile-composite.js +34 -0
  26. package/dist/es5/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  27. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js +48 -0
  28. package/dist/es5/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  29. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js +52 -0
  30. package/dist/es5/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  31. package/dist/es5/lib/encoders/encode-3d-tile.js +48 -0
  32. package/dist/es5/lib/encoders/encode-3d-tile.js.map +1 -0
  33. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js +41 -0
  34. package/dist/es5/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  35. package/dist/es5/lib/ion/ion.js +91 -0
  36. package/dist/es5/lib/ion/ion.js.map +1 -0
  37. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js +75 -0
  38. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  39. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js +40 -0
  40. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  41. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js +40 -0
  42. package/dist/es5/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  43. package/dist/es5/lib/parsers/helpers/parse-3d-tile-gltf-view.js +83 -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 +24 -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 +73 -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 +100 -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 +31 -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 +43 -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 +25 -0
  56. package/dist/es5/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  57. package/dist/es5/lib/parsers/parse-3d-tile-header.js +86 -0
  58. package/dist/es5/lib/parsers/parse-3d-tile-header.js.map +1 -0
  59. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js +195 -0
  60. package/dist/es5/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  61. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js +265 -0
  62. package/dist/es5/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  63. package/dist/es5/lib/parsers/parse-3d-tile.js +41 -0
  64. package/dist/es5/lib/parsers/parse-3d-tile.js.map +1 -0
  65. package/dist/es5/lib/utils/version.js +9 -0
  66. package/dist/es5/lib/utils/version.js.map +1 -0
  67. package/dist/es5/tile-3d-subtree-loader.js +26 -0
  68. package/dist/es5/tile-3d-subtree-loader.js.map +1 -0
  69. package/dist/es5/tile-3d-writer.js +32 -0
  70. package/dist/es5/tile-3d-writer.js.map +1 -0
  71. package/dist/es5/tiles-3d-loader.js +85 -0
  72. package/dist/es5/tiles-3d-loader.js.map +1 -0
  73. package/dist/es5/types.js +2 -0
  74. package/dist/{types.js.map → es5/types.js.map} +0 -0
  75. package/dist/esm/bundle.js +5 -0
  76. package/dist/esm/bundle.js.map +1 -0
  77. package/dist/esm/cesium-ion-loader.js +36 -0
  78. package/dist/esm/cesium-ion-loader.js.map +1 -0
  79. package/dist/esm/index.js +9 -0
  80. package/dist/esm/index.js.map +1 -0
  81. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js +96 -0
  82. package/dist/esm/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -0
  83. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js +215 -0
  84. package/dist/esm/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -0
  85. package/dist/esm/lib/classes/tile-3d-batch-table.js +304 -0
  86. package/dist/esm/lib/classes/tile-3d-batch-table.js.map +1 -0
  87. package/dist/esm/lib/classes/tile-3d-feature-table.js +94 -0
  88. package/dist/esm/lib/classes/tile-3d-feature-table.js.map +1 -0
  89. package/dist/esm/lib/constants.js +21 -0
  90. package/dist/esm/lib/constants.js.map +1 -0
  91. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js +46 -0
  92. package/dist/esm/lib/encoders/encode-3d-tile-batched-model.js.map +1 -0
  93. package/dist/esm/lib/encoders/encode-3d-tile-composite.js +25 -0
  94. package/dist/esm/lib/encoders/encode-3d-tile-composite.js.map +1 -0
  95. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js +38 -0
  96. package/dist/esm/lib/encoders/encode-3d-tile-instanced-model.js.map +1 -0
  97. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js +41 -0
  98. package/dist/esm/lib/encoders/encode-3d-tile-point-cloud.js.map +1 -0
  99. package/dist/esm/lib/encoders/encode-3d-tile.js +35 -0
  100. package/dist/esm/lib/encoders/encode-3d-tile.js.map +1 -0
  101. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js +31 -0
  102. package/dist/esm/lib/encoders/helpers/encode-3d-tile-header.js.map +1 -0
  103. package/dist/esm/lib/ion/ion.js +77 -0
  104. package/dist/esm/lib/ion/ion.js.map +1 -0
  105. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js +67 -0
  106. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -0
  107. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js +30 -0
  108. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -0
  109. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js +31 -0
  110. package/dist/esm/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -0
  111. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js +69 -0
  112. package/dist/esm/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +1 -0
  113. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js +17 -0
  114. package/dist/esm/lib/parsers/helpers/parse-3d-tile-header.js.map +1 -0
  115. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js +64 -0
  116. package/dist/esm/lib/parsers/helpers/parse-3d-tile-subtree.js.map +1 -0
  117. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js +89 -0
  118. package/dist/esm/lib/parsers/helpers/parse-3d-tile-tables.js.map +1 -0
  119. package/dist/esm/lib/parsers/helpers/parse-utils.js +19 -0
  120. package/dist/esm/lib/parsers/helpers/parse-utils.js.map +1 -0
  121. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js +29 -0
  122. package/dist/esm/lib/parsers/parse-3d-tile-batched-model.js.map +1 -0
  123. package/dist/esm/lib/parsers/parse-3d-tile-composite.js +17 -0
  124. package/dist/esm/lib/parsers/parse-3d-tile-composite.js.map +1 -0
  125. package/dist/esm/lib/parsers/parse-3d-tile-header.js +77 -0
  126. package/dist/esm/lib/parsers/parse-3d-tile-header.js.map +1 -0
  127. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js +177 -0
  128. package/dist/esm/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -0
  129. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js +245 -0
  130. package/dist/esm/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -0
  131. package/dist/esm/lib/parsers/parse-3d-tile.js +28 -0
  132. package/dist/esm/lib/parsers/parse-3d-tile.js.map +1 -0
  133. package/dist/esm/lib/utils/version.js +2 -0
  134. package/dist/esm/lib/utils/version.js.map +1 -0
  135. package/dist/esm/tile-3d-subtree-loader.js +14 -0
  136. package/dist/esm/tile-3d-subtree-loader.js.map +1 -0
  137. package/dist/esm/tile-3d-writer.js +20 -0
  138. package/dist/esm/tile-3d-writer.js.map +1 -0
  139. package/dist/esm/tiles-3d-loader.js +72 -0
  140. package/dist/esm/tiles-3d-loader.js.map +1 -0
  141. package/dist/esm/types.js +2 -0
  142. package/dist/esm/types.js.map +1 -0
  143. package/dist/index.d.ts +10 -0
  144. package/dist/index.d.ts.map +1 -0
  145. package/dist/index.js +26 -8
  146. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts +8 -0
  147. package/dist/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -0
  148. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +106 -89
  149. package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts +10 -0
  150. package/dist/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -0
  151. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +184 -202
  152. package/dist/lib/classes/tile-3d-batch-table.d.ts +34 -0
  153. package/dist/lib/classes/tile-3d-batch-table.d.ts.map +1 -0
  154. package/dist/lib/classes/tile-3d-batch-table.js +223 -267
  155. package/dist/lib/classes/tile-3d-feature-table.d.ts +15 -0
  156. package/dist/lib/classes/tile-3d-feature-table.d.ts.map +1 -0
  157. package/dist/lib/classes/tile-3d-feature-table.js +64 -79
  158. package/dist/lib/constants.d.ts +21 -0
  159. package/dist/lib/constants.d.ts.map +1 -0
  160. package/dist/lib/constants.js +22 -18
  161. package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts +2 -0
  162. package/dist/lib/encoders/encode-3d-tile-batched-model.d.ts.map +1 -0
  163. package/dist/lib/encoders/encode-3d-tile-batched-model.js +45 -45
  164. package/dist/lib/encoders/encode-3d-tile-composite.d.ts +2 -0
  165. package/dist/lib/encoders/encode-3d-tile-composite.d.ts.map +1 -0
  166. package/dist/lib/encoders/encode-3d-tile-composite.js +23 -24
  167. package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts +2 -0
  168. package/dist/lib/encoders/encode-3d-tile-instanced-model.d.ts.map +1 -0
  169. package/dist/lib/encoders/encode-3d-tile-instanced-model.js +37 -37
  170. package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts +2 -0
  171. package/dist/lib/encoders/encode-3d-tile-point-cloud.d.ts.map +1 -0
  172. package/dist/lib/encoders/encode-3d-tile-point-cloud.js +36 -38
  173. package/dist/lib/encoders/encode-3d-tile.d.ts +2 -0
  174. package/dist/lib/encoders/encode-3d-tile.d.ts.map +1 -0
  175. package/dist/lib/encoders/encode-3d-tile.js +30 -32
  176. package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts +3 -0
  177. package/dist/lib/encoders/helpers/encode-3d-tile-header.d.ts.map +1 -0
  178. package/dist/lib/encoders/helpers/encode-3d-tile-header.js +28 -29
  179. package/dist/lib/ion/ion.d.ts +4 -0
  180. package/dist/lib/ion/ion.d.ts.map +1 -0
  181. package/dist/lib/ion/ion.js +60 -69
  182. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +7 -0
  183. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -0
  184. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +60 -62
  185. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +6 -0
  186. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -0
  187. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +26 -26
  188. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts +2 -0
  189. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -0
  190. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +39 -28
  191. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +7 -0
  192. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -0
  193. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +82 -63
  194. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +2 -0
  195. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -0
  196. package/dist/lib/parsers/helpers/parse-3d-tile-header.js +26 -15
  197. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +9 -0
  198. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -0
  199. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +74 -0
  200. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +3 -0
  201. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -0
  202. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +85 -81
  203. package/dist/lib/parsers/helpers/parse-utils.d.ts +4 -0
  204. package/dist/lib/parsers/helpers/parse-utils.d.ts.map +1 -0
  205. package/dist/lib/parsers/helpers/parse-utils.js +25 -16
  206. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +2 -0
  207. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -0
  208. package/dist/lib/parsers/parse-3d-tile-batched-model.js +30 -26
  209. package/dist/lib/parsers/parse-3d-tile-composite.d.ts +2 -0
  210. package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -0
  211. package/dist/lib/parsers/parse-3d-tile-composite.js +25 -16
  212. package/dist/lib/parsers/parse-3d-tile-header.d.ts +3 -0
  213. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -0
  214. package/dist/lib/parsers/parse-3d-tile-header.js +59 -70
  215. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +2 -0
  216. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -0
  217. package/dist/lib/parsers/parse-3d-tile-instanced-model.js +179 -170
  218. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +3 -0
  219. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -0
  220. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +350 -184
  221. package/dist/lib/parsers/parse-3d-tile.d.ts +2 -0
  222. package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -0
  223. package/dist/lib/parsers/parse-3d-tile.js +33 -27
  224. package/dist/lib/utils/version.d.ts +2 -0
  225. package/dist/lib/utils/version.d.ts.map +1 -0
  226. package/dist/lib/utils/version.js +7 -2
  227. package/dist/tile-3d-subtree-loader.d.ts +7 -0
  228. package/dist/tile-3d-subtree-loader.d.ts.map +1 -0
  229. package/dist/tile-3d-subtree-loader.js +23 -0
  230. package/dist/tile-3d-writer.d.ts +6 -0
  231. package/dist/tile-3d-writer.d.ts.map +1 -0
  232. package/dist/tile-3d-writer.js +24 -17
  233. package/dist/tiles-3d-loader.d.ts +6 -0
  234. package/dist/tiles-3d-loader.d.ts.map +1 -0
  235. package/dist/tiles-3d-loader.js +63 -62
  236. package/dist/types.d.ts +75 -0
  237. package/dist/types.d.ts.map +1 -0
  238. package/dist/types.js +2 -2
  239. package/package.json +14 -12
  240. package/src/index.ts +1 -0
  241. package/src/lib/classes/helpers/{tile-3d-accessor-utils.js → tile-3d-accessor-utils.ts} +0 -0
  242. package/src/lib/classes/{tile-3d-batch-table-hierarchy.js → tile-3d-batch-table-hierarchy.ts} +0 -0
  243. package/src/lib/classes/{tile-3d-batch-table.js → tile-3d-batch-table.ts} +14 -4
  244. package/src/lib/classes/{tile-3d-feature-table.js → tile-3d-feature-table.ts} +5 -2
  245. package/src/lib/{constants.js → constants.ts} +0 -0
  246. package/src/lib/encoders/{encode-3d-tile-batched-model.js → encode-3d-tile-batched-model.ts} +0 -0
  247. package/src/lib/encoders/{encode-3d-tile-composite.js → encode-3d-tile-composite.ts} +0 -0
  248. package/src/lib/encoders/{encode-3d-tile-instanced-model.js → encode-3d-tile-instanced-model.ts} +0 -0
  249. package/src/lib/encoders/{encode-3d-tile-point-cloud.js → encode-3d-tile-point-cloud.ts} +0 -0
  250. package/src/lib/encoders/{encode-3d-tile.js → encode-3d-tile.ts} +0 -0
  251. package/src/lib/encoders/helpers/{encode-3d-tile-header.js → encode-3d-tile-header.ts} +0 -0
  252. package/src/lib/parsers/helpers/{normalize-3d-tile-colors.js → normalize-3d-tile-colors.ts} +1 -1
  253. package/src/lib/parsers/helpers/{normalize-3d-tile-normals.js → normalize-3d-tile-normals.ts} +0 -0
  254. package/src/lib/parsers/helpers/{normalize-3d-tile-positions.js → normalize-3d-tile-positions.ts} +0 -0
  255. package/src/lib/parsers/helpers/{parse-3d-tile-gltf-view.js → parse-3d-tile-gltf-view.ts} +1 -1
  256. package/src/lib/parsers/helpers/{parse-3d-tile-header.js → parse-3d-tile-header.ts} +0 -0
  257. package/src/lib/parsers/helpers/parse-3d-tile-subtree.ts +104 -0
  258. package/src/lib/parsers/helpers/{parse-3d-tile-tables.js → parse-3d-tile-tables.ts} +1 -1
  259. package/src/lib/parsers/helpers/{parse-utils.js → parse-utils.ts} +0 -0
  260. package/src/lib/parsers/{parse-3d-tile-batched-model.js → parse-3d-tile-batched-model.ts} +0 -0
  261. package/src/lib/parsers/{parse-3d-tile-composite.js → parse-3d-tile-composite.ts} +0 -0
  262. package/src/lib/parsers/{parse-3d-tile-header.js → parse-3d-tile-header.ts} +1 -1
  263. package/src/lib/parsers/{parse-3d-tile-instanced-model.js → parse-3d-tile-instanced-model.ts} +6 -0
  264. package/src/lib/parsers/{parse-3d-tile-point-cloud.js → parse-3d-tile-point-cloud.ts} +2 -2
  265. package/src/lib/parsers/{parse-3d-tile.js → parse-3d-tile.ts} +4 -0
  266. package/src/lib/utils/{version.js → version.ts} +0 -0
  267. package/src/tile-3d-subtree-loader.ts +19 -0
  268. package/src/types.ts +33 -0
  269. package/dist/bundle.js.map +0 -1
  270. package/dist/cesium-ion-loader.js.map +0 -1
  271. package/dist/dist.min.js +0 -2
  272. package/dist/dist.min.js.map +0 -1
  273. package/dist/index.js.map +0 -1
  274. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
  275. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
  276. package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
  277. package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
  278. package/dist/lib/constants.js.map +0 -1
  279. package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
  280. package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
  281. package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
  282. package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
  283. package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
  284. package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
  285. package/dist/lib/ion/ion.js.map +0 -1
  286. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
  287. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
  288. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
  289. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
  290. package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
  291. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
  292. package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
  293. package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
  294. package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
  295. package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
  296. package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
  297. package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
  298. package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
  299. package/dist/lib/utils/version.js.map +0 -1
  300. package/dist/tile-3d-writer.js.map +0 -1
  301. package/dist/tiles-3d-loader.js.map +0 -1
@@ -0,0 +1,312 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _loaderUtils = require("@loaders.gl/loader-utils");
13
+
14
+ var _tile3dAccessorUtils = require("./helpers/tile-3d-accessor-utils");
15
+
16
+ var _tile3dBatchTableHierarchy = require("./tile-3d-batch-table-hierarchy");
17
+
18
+ function defined(x) {
19
+ return x !== undefined && x !== null;
20
+ }
21
+
22
+ const clone = (x, y) => x;
23
+
24
+ const IGNORED_PROPERTY_FIELDS = {
25
+ HIERARCHY: true,
26
+ extensions: true,
27
+ extras: true
28
+ };
29
+
30
+ class Tile3DBatchTableParser {
31
+ constructor(json, binary, featureCount, options = {}) {
32
+ var _this$json;
33
+
34
+ (0, _defineProperty2.default)(this, "json", void 0);
35
+ (0, _defineProperty2.default)(this, "binary", void 0);
36
+ (0, _defineProperty2.default)(this, "featureCount", void 0);
37
+ (0, _defineProperty2.default)(this, "_extensions", void 0);
38
+ (0, _defineProperty2.default)(this, "_properties", void 0);
39
+ (0, _defineProperty2.default)(this, "_binaryProperties", void 0);
40
+ (0, _defineProperty2.default)(this, "_hierarchy", void 0);
41
+ (0, _loaderUtils.assert)(featureCount >= 0);
42
+ this.json = json || {};
43
+ this.binary = binary;
44
+ this.featureCount = featureCount;
45
+ this._extensions = ((_this$json = this.json) === null || _this$json === void 0 ? void 0 : _this$json.extensions) || {};
46
+ this._properties = {};
47
+
48
+ for (const propertyName in this.json) {
49
+ if (!IGNORED_PROPERTY_FIELDS[propertyName]) {
50
+ this._properties[propertyName] = this.json[propertyName];
51
+ }
52
+ }
53
+
54
+ this._binaryProperties = this._initializeBinaryProperties();
55
+
56
+ if (options['3DTILES_batch_table_hierarchy']) {
57
+ this._hierarchy = (0, _tile3dBatchTableHierarchy.initializeHierarchy)(this, this.json, this.binary);
58
+ }
59
+ }
60
+
61
+ getExtension(extensionName) {
62
+ return this.json && this.json.extensions && this.json.extensions[extensionName];
63
+ }
64
+
65
+ memorySizeInBytes() {
66
+ return 0;
67
+ }
68
+
69
+ isClass(batchId, className) {
70
+ this._checkBatchId(batchId);
71
+
72
+ (0, _loaderUtils.assert)(typeof className === 'string', className);
73
+
74
+ if (this._hierarchy) {
75
+ const result = (0, _tile3dBatchTableHierarchy.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
76
+ const classId = hierarchy.classIds[instanceIndex];
77
+ const instanceClass = hierarchy.classes[classId];
78
+ return instanceClass.name === className;
79
+ });
80
+ return defined(result);
81
+ }
82
+
83
+ return false;
84
+ }
85
+
86
+ isExactClass(batchId, className) {
87
+ (0, _loaderUtils.assert)(typeof className === 'string', className);
88
+ return this.getExactClassName(batchId) === className;
89
+ }
90
+
91
+ getExactClassName(batchId) {
92
+ this._checkBatchId(batchId);
93
+
94
+ if (this._hierarchy) {
95
+ const classId = this._hierarchy.classIds[batchId];
96
+ const instanceClass = this._hierarchy.classes[classId];
97
+ return instanceClass.name;
98
+ }
99
+
100
+ return undefined;
101
+ }
102
+
103
+ hasProperty(batchId, name) {
104
+ this._checkBatchId(batchId);
105
+
106
+ (0, _loaderUtils.assert)(typeof name === 'string', name);
107
+ return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);
108
+ }
109
+
110
+ getPropertyNames(batchId, results) {
111
+ this._checkBatchId(batchId);
112
+
113
+ results = defined(results) ? results : [];
114
+ results.length = 0;
115
+ const propertyNames = Object.keys(this._properties);
116
+ results.push(...propertyNames);
117
+
118
+ if (this._hierarchy) {
119
+ this._getPropertyNamesInHierarchy(batchId, results);
120
+ }
121
+
122
+ return results;
123
+ }
124
+
125
+ getProperty(batchId, name) {
126
+ this._checkBatchId(batchId);
127
+
128
+ (0, _loaderUtils.assert)(typeof name === 'string', name);
129
+
130
+ if (this._binaryProperties) {
131
+ const binaryProperty = this._binaryProperties[name];
132
+
133
+ if (defined(binaryProperty)) {
134
+ return this._getBinaryProperty(binaryProperty, batchId);
135
+ }
136
+ }
137
+
138
+ const propertyValues = this._properties[name];
139
+
140
+ if (defined(propertyValues)) {
141
+ return clone(propertyValues[batchId], true);
142
+ }
143
+
144
+ if (this._hierarchy) {
145
+ const hierarchyProperty = this._getHierarchyProperty(batchId, name);
146
+
147
+ if (defined(hierarchyProperty)) {
148
+ return hierarchyProperty;
149
+ }
150
+ }
151
+
152
+ return undefined;
153
+ }
154
+
155
+ setProperty(batchId, name, value) {
156
+ const featureCount = this.featureCount;
157
+
158
+ this._checkBatchId(batchId);
159
+
160
+ (0, _loaderUtils.assert)(typeof name === 'string', name);
161
+
162
+ if (this._binaryProperties) {
163
+ const binaryProperty = this._binaryProperties[name];
164
+
165
+ if (binaryProperty) {
166
+ this._setBinaryProperty(binaryProperty, batchId, value);
167
+
168
+ return;
169
+ }
170
+ }
171
+
172
+ if (this._hierarchy) {
173
+ if (this._setHierarchyProperty(this, batchId, name, value)) {
174
+ return;
175
+ }
176
+ }
177
+
178
+ let propertyValues = this._properties[name];
179
+
180
+ if (!defined(propertyValues)) {
181
+ this._properties[name] = new Array(featureCount);
182
+ propertyValues = this._properties[name];
183
+ }
184
+
185
+ propertyValues[batchId] = clone(value, true);
186
+ }
187
+
188
+ _checkBatchId(batchId) {
189
+ const valid = batchId >= 0 && batchId < this.featureCount;
190
+
191
+ if (!valid) {
192
+ throw new Error('batchId not in range [0, featureCount - 1].');
193
+ }
194
+ }
195
+
196
+ _getBinaryProperty(binaryProperty, index) {
197
+ return binaryProperty.unpack(binaryProperty.typedArray, index);
198
+ }
199
+
200
+ _setBinaryProperty(binaryProperty, index, value) {
201
+ binaryProperty.pack(value, binaryProperty.typedArray, index);
202
+ }
203
+
204
+ _initializeBinaryProperties() {
205
+ let binaryProperties = null;
206
+
207
+ for (const name in this._properties) {
208
+ const property = this._properties[name];
209
+
210
+ const binaryProperty = this._initializeBinaryProperty(name, property);
211
+
212
+ if (binaryProperty) {
213
+ binaryProperties = binaryProperties || {};
214
+ binaryProperties[name] = binaryProperty;
215
+ }
216
+ }
217
+
218
+ return binaryProperties;
219
+ }
220
+
221
+ _initializeBinaryProperty(name, property) {
222
+ if ('byteOffset' in property) {
223
+ const tile3DAccessor = property;
224
+ (0, _loaderUtils.assert)(this.binary, "Property ".concat(name, " requires a batch table binary."));
225
+ (0, _loaderUtils.assert)(tile3DAccessor.type, "Property ".concat(name, " requires a type."));
226
+ const accessor = (0, _tile3dAccessorUtils.createTypedArrayFromAccessor)(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
227
+ return {
228
+ typedArray: accessor.values,
229
+ componentCount: accessor.size,
230
+ unpack: accessor.unpacker,
231
+ pack: accessor.packer
232
+ };
233
+ }
234
+
235
+ return null;
236
+ }
237
+
238
+ _hasPropertyInHierarchy(batchId, name) {
239
+ if (!this._hierarchy) {
240
+ return false;
241
+ }
242
+
243
+ const result = (0, _tile3dBatchTableHierarchy.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
244
+ const classId = hierarchy.classIds[instanceIndex];
245
+ const instances = hierarchy.classes[classId].instances;
246
+ return defined(instances[name]);
247
+ });
248
+ return defined(result);
249
+ }
250
+
251
+ _getPropertyNamesInHierarchy(batchId, results) {
252
+ (0, _tile3dBatchTableHierarchy.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
253
+ const classId = hierarchy.classIds[instanceIndex];
254
+ const instances = hierarchy.classes[classId].instances;
255
+
256
+ for (const name in instances) {
257
+ if (instances.hasOwnProperty(name)) {
258
+ if (results.indexOf(name) === -1) {
259
+ results.push(name);
260
+ }
261
+ }
262
+ }
263
+ });
264
+ }
265
+
266
+ _getHierarchyProperty(batchId, name) {
267
+ return (0, _tile3dBatchTableHierarchy.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
268
+ const classId = hierarchy.classIds[instanceIndex];
269
+ const instanceClass = hierarchy.classes[classId];
270
+ const indexInClass = hierarchy.classIndexes[instanceIndex];
271
+ const propertyValues = instanceClass.instances[name];
272
+
273
+ if (defined(propertyValues)) {
274
+ if (defined(propertyValues.typedArray)) {
275
+ return this._getBinaryProperty(propertyValues, indexInClass);
276
+ }
277
+
278
+ return clone(propertyValues[indexInClass], true);
279
+ }
280
+
281
+ return null;
282
+ });
283
+ }
284
+
285
+ _setHierarchyProperty(batchTable, batchId, name, value) {
286
+ const result = (0, _tile3dBatchTableHierarchy.traverseHierarchy)(this._hierarchy, batchId, (hierarchy, instanceIndex) => {
287
+ const classId = hierarchy.classIds[instanceIndex];
288
+ const instanceClass = hierarchy.classes[classId];
289
+ const indexInClass = hierarchy.classIndexes[instanceIndex];
290
+ const propertyValues = instanceClass.instances[name];
291
+
292
+ if (defined(propertyValues)) {
293
+ (0, _loaderUtils.assert)(instanceIndex === batchId, "Inherited property \"".concat(name, "\" is read-only."));
294
+
295
+ if (defined(propertyValues.typedArray)) {
296
+ this._setBinaryProperty(propertyValues, indexInClass, value);
297
+ } else {
298
+ propertyValues[indexInClass] = clone(value, true);
299
+ }
300
+
301
+ return true;
302
+ }
303
+
304
+ return false;
305
+ });
306
+ return defined(result);
307
+ }
308
+
309
+ }
310
+
311
+ exports.default = Tile3DBatchTableParser;
312
+ //# sourceMappingURL=tile-3d-batch-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/classes/tile-3d-batch-table.ts"],"names":["defined","x","undefined","clone","y","IGNORED_PROPERTY_FIELDS","HIERARCHY","extensions","extras","Tile3DBatchTableParser","constructor","json","binary","featureCount","options","_extensions","_properties","propertyName","_binaryProperties","_initializeBinaryProperties","_hierarchy","getExtension","extensionName","memorySizeInBytes","isClass","batchId","className","_checkBatchId","result","hierarchy","instanceIndex","classId","classIds","instanceClass","classes","name","isExactClass","getExactClassName","hasProperty","_hasPropertyInHierarchy","getPropertyNames","results","length","propertyNames","Object","keys","push","_getPropertyNamesInHierarchy","getProperty","binaryProperty","_getBinaryProperty","propertyValues","hierarchyProperty","_getHierarchyProperty","setProperty","value","_setBinaryProperty","_setHierarchyProperty","Array","valid","Error","index","unpack","typedArray","pack","binaryProperties","property","_initializeBinaryProperty","tile3DAccessor","type","accessor","buffer","byteOffset","values","componentCount","size","unpacker","packer","instances","hasOwnProperty","indexOf","indexInClass","classIndexes","batchTable"],"mappings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YAAMkD,YAAY,GAAGpD,SAAS,CAACqD,YAAV,CAAuBpD,aAAvB,CAArB;AACA,YAAMqB,cAAc,GAAGlB,aAAa,CAAC6C,SAAd,CAAwB3C,IAAxB,CAAvB;;AACA,UAAInC,OAAO,CAACmD,cAAD,CAAX,EAA6B;AAC3B,iCAAOrB,aAAa,KAAKL,OAAzB,iCAAyDU,IAAzD;;AACA,YAAInC,OAAO,CAACmD,cAAc,CAACY,UAAhB,CAAX,EAAwC;AACtC,eAAKP,kBAAL,CAAwBL,cAAxB,EAAwC8B,YAAxC,EAAsD1B,KAAtD;AACD,SAFD,MAEO;AACLJ,UAAAA,cAAc,CAAC8B,YAAD,CAAd,GAA+B9E,KAAK,CAACoD,KAAD,EAAQ,IAAR,CAApC;AACD;;AACD,eAAO,IAAP;AACD;;AACD,aAAO,KAAP;AACD,KAfc,CAAf;AAgBA,WAAOvD,OAAO,CAAC4B,MAAD,CAAd;AACD;;AA/RyC","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {assert} from '@loaders.gl/loader-utils';\n\nimport {createTypedArrayFromAccessor} from './helpers/tile-3d-accessor-utils';\nimport {initializeHierarchy, traverseHierarchy} from './tile-3d-batch-table-hierarchy';\n\nfunction defined(x) {\n return x !== undefined && x !== null;\n}\n\nconst clone = (x, y) => x;\n\n// These top level fields in the batch table json are not properties\nconst IGNORED_PROPERTY_FIELDS = {\n HIERARCHY: true, // Deprecated HIERARCHY property\n extensions: true,\n extras: true\n};\n\n// The size of this array equals the maximum instance count among all loaded tiles, which has the potential to be large.\nexport default class Tile3DBatchTableParser {\n json;\n binary;\n featureCount;\n _extensions;\n // Copy all top-level property fields from the json object, ignoring special fields\n _properties;\n _binaryProperties;\n // TODO: hierarchy support is only partially implemented and not tested\n _hierarchy;\n\n constructor(json, binary, featureCount, options = {}) {\n assert(featureCount >= 0);\n this.json = json || {};\n this.binary = binary;\n this.featureCount = featureCount;\n\n this._extensions = this.json?.extensions || {};\n\n // Copy all top-level property fields from the json object, ignoring special fields\n this._properties = {};\n for (const propertyName in this.json) {\n if (!IGNORED_PROPERTY_FIELDS[propertyName]) {\n this._properties[propertyName] = this.json[propertyName];\n }\n }\n\n this._binaryProperties = this._initializeBinaryProperties();\n\n // TODO: hierarchy support is only partially implemented and not tested\n if (options['3DTILES_batch_table_hierarchy']) {\n this._hierarchy = initializeHierarchy(this, this.json, this.binary);\n }\n }\n\n getExtension(extensionName) {\n return this.json && this.json.extensions && this.json.extensions[extensionName];\n }\n\n memorySizeInBytes(): number {\n return 0;\n }\n\n isClass(batchId, className: string): boolean {\n this._checkBatchId(batchId);\n assert(typeof className === 'string', className);\n\n // extension: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n // PERFORMANCE_IDEA : cache results in the ancestor classes\n // to speed up this check if this area becomes a hotspot\n // PERFORMANCE_IDEA : treat class names as integers for faster comparisons\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n return instanceClass.name === className;\n });\n return defined(result);\n }\n\n return false;\n }\n\n isExactClass(batchId, className) {\n assert(typeof className === 'string', className);\n\n return this.getExactClassName(batchId) === className;\n }\n\n getExactClassName(batchId) {\n this._checkBatchId(batchId);\n\n // extension: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n const classId = this._hierarchy.classIds[batchId];\n const instanceClass = this._hierarchy.classes[classId];\n return instanceClass.name;\n }\n\n return undefined;\n }\n\n hasProperty(batchId, name) {\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n\n return defined(this._properties[name]) || this._hasPropertyInHierarchy(batchId, name);\n }\n\n getPropertyNames(batchId, results) {\n this._checkBatchId(batchId);\n\n results = defined(results) ? results : [];\n results.length = 0;\n\n const propertyNames = Object.keys(this._properties);\n results.push(...propertyNames);\n\n if (this._hierarchy) {\n this._getPropertyNamesInHierarchy(batchId, results);\n }\n\n return results;\n }\n\n getProperty(batchId, name) {\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n\n if (this._binaryProperties) {\n const binaryProperty = this._binaryProperties[name];\n if (defined(binaryProperty)) {\n return this._getBinaryProperty(binaryProperty, batchId);\n }\n }\n\n const propertyValues = this._properties[name];\n if (defined(propertyValues)) {\n return clone(propertyValues[batchId], true);\n }\n\n // EXTENSION: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n const hierarchyProperty = this._getHierarchyProperty(batchId, name);\n if (defined(hierarchyProperty)) {\n return hierarchyProperty;\n }\n }\n\n return undefined;\n }\n\n setProperty(batchId, name, value) {\n const featureCount = this.featureCount;\n\n this._checkBatchId(batchId);\n assert(typeof name === 'string', name);\n\n if (this._binaryProperties) {\n const binaryProperty = this._binaryProperties[name];\n if (binaryProperty) {\n this._setBinaryProperty(binaryProperty, batchId, value);\n return;\n }\n }\n\n // EXTENSION: 3DTILES_batch_table_hierarchy\n if (this._hierarchy) {\n if (this._setHierarchyProperty(this, batchId, name, value)) {\n return;\n }\n }\n\n let propertyValues = this._properties[name];\n if (!defined(propertyValues)) {\n // Property does not exist. Create it.\n this._properties[name] = new Array(featureCount);\n propertyValues = this._properties[name];\n }\n\n propertyValues[batchId] = clone(value, true);\n }\n\n // PRIVATE METHODS\n\n _checkBatchId(batchId) {\n const valid = batchId >= 0 && batchId < this.featureCount;\n if (!valid) {\n throw new Error('batchId not in range [0, featureCount - 1].');\n }\n }\n\n _getBinaryProperty(binaryProperty, index) {\n return binaryProperty.unpack(binaryProperty.typedArray, index);\n }\n\n _setBinaryProperty(binaryProperty, index, value) {\n binaryProperty.pack(value, binaryProperty.typedArray, index);\n }\n\n _initializeBinaryProperties() {\n let binaryProperties: Record<string, any> | null = null;\n for (const name in this._properties) {\n const property = this._properties[name];\n const binaryProperty = this._initializeBinaryProperty(name, property);\n // Store any information needed to access the binary data, including the typed array,\n // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).\n if (binaryProperty) {\n binaryProperties = binaryProperties || {};\n binaryProperties[name] = binaryProperty;\n }\n }\n return binaryProperties;\n }\n\n _initializeBinaryProperty(name, property) {\n if ('byteOffset' in property) {\n // This is a binary property\n const tile3DAccessor = property;\n\n assert(this.binary, `Property ${name} requires a batch table binary.`);\n assert(tile3DAccessor.type, `Property ${name} requires a type.`);\n\n const accessor = createTypedArrayFromAccessor(\n tile3DAccessor,\n this.binary.buffer,\n this.binary.byteOffset | 0,\n this.featureCount\n );\n\n // Store any information needed to access the binary data, including the typed array,\n // componentCount (e.g. a VEC4 would be 4), and the type used to pack and unpack (e.g. Cartesian4).\n return {\n typedArray: accessor.values,\n componentCount: accessor.size,\n unpack: accessor.unpacker,\n pack: accessor.packer\n };\n }\n\n return null;\n }\n\n // EXTENSION SUPPORT: 3DTILES_batch_table_hierarchy\n\n _hasPropertyInHierarchy(batchId, name) {\n if (!this._hierarchy) {\n return false;\n }\n\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instances = hierarchy.classes[classId].instances;\n return defined(instances[name]);\n });\n\n return defined(result);\n }\n\n _getPropertyNamesInHierarchy(batchId, results) {\n traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instances = hierarchy.classes[classId].instances;\n for (const name in instances) {\n if (instances.hasOwnProperty(name)) {\n if (results.indexOf(name) === -1) {\n results.push(name);\n }\n }\n }\n });\n }\n\n _getHierarchyProperty(batchId, name) {\n return traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n const indexInClass = hierarchy.classIndexes[instanceIndex];\n const propertyValues = instanceClass.instances[name];\n if (defined(propertyValues)) {\n if (defined(propertyValues.typedArray)) {\n return this._getBinaryProperty(propertyValues, indexInClass);\n }\n return clone(propertyValues[indexInClass], true);\n }\n return null;\n });\n }\n\n _setHierarchyProperty(batchTable, batchId, name, value) {\n const result = traverseHierarchy(this._hierarchy, batchId, (hierarchy, instanceIndex) => {\n const classId = hierarchy.classIds[instanceIndex];\n const instanceClass = hierarchy.classes[classId];\n const indexInClass = hierarchy.classIndexes[instanceIndex];\n const propertyValues = instanceClass.instances[name];\n if (defined(propertyValues)) {\n assert(instanceIndex === batchId, `Inherited property \"${name}\" is read-only.`);\n if (defined(propertyValues.typedArray)) {\n this._setBinaryProperty(propertyValues, indexInClass, value);\n } else {\n propertyValues[indexInClass] = clone(value, true);\n }\n return true;\n }\n return false;\n });\n return defined(result);\n }\n}\n"],"file":"tile-3d-batch-table.js"}
@@ -0,0 +1,103 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
11
+
12
+ var _math = require("@loaders.gl/math");
13
+
14
+ class Tile3DFeatureTable {
15
+ constructor(featureTableJson, featureTableBinary) {
16
+ (0, _defineProperty2.default)(this, "json", void 0);
17
+ (0, _defineProperty2.default)(this, "buffer", void 0);
18
+ (0, _defineProperty2.default)(this, "featuresLength", 0);
19
+ (0, _defineProperty2.default)(this, "_cachedTypedArrays", {});
20
+ this.json = featureTableJson;
21
+ this.buffer = featureTableBinary;
22
+ }
23
+
24
+ getExtension(extensionName) {
25
+ return this.json.extensions && this.json.extensions[extensionName];
26
+ }
27
+
28
+ hasProperty(propertyName) {
29
+ return Boolean(this.json[propertyName]);
30
+ }
31
+
32
+ getGlobalProperty(propertyName, componentType = _math.GL.UNSIGNED_INT, componentLength = 1) {
33
+ const jsonValue = this.json[propertyName];
34
+
35
+ if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
36
+ return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, 1, jsonValue.byteOffset);
37
+ }
38
+
39
+ return jsonValue;
40
+ }
41
+
42
+ getPropertyArray(propertyName, componentType, componentLength) {
43
+ const jsonValue = this.json[propertyName];
44
+
45
+ if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
46
+ if ('componentType' in jsonValue) {
47
+ componentType = _math.GLType.fromName(jsonValue.componentType);
48
+ }
49
+
50
+ return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, this.featuresLength, jsonValue.byteOffset);
51
+ }
52
+
53
+ return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);
54
+ }
55
+
56
+ getProperty(propertyName, componentType, componentLength, featureId, result) {
57
+ const jsonValue = this.json[propertyName];
58
+
59
+ if (!jsonValue) {
60
+ return jsonValue;
61
+ }
62
+
63
+ const typedArray = this.getPropertyArray(propertyName, componentType, componentLength);
64
+
65
+ if (componentLength === 1) {
66
+ return typedArray[featureId];
67
+ }
68
+
69
+ for (let i = 0; i < componentLength; ++i) {
70
+ result[i] = typedArray[componentLength * featureId + i];
71
+ }
72
+
73
+ return result;
74
+ }
75
+
76
+ _getTypedArrayFromBinary(propertyName, componentType, componentLength, count, byteOffset) {
77
+ const cachedTypedArrays = this._cachedTypedArrays;
78
+ let typedArray = cachedTypedArrays[propertyName];
79
+
80
+ if (!typedArray) {
81
+ typedArray = _math.GLType.createTypedArray(componentType, this.buffer.buffer, this.buffer.byteOffset + byteOffset, count * componentLength);
82
+ cachedTypedArrays[propertyName] = typedArray;
83
+ }
84
+
85
+ return typedArray;
86
+ }
87
+
88
+ _getTypedArrayFromArray(propertyName, componentType, array) {
89
+ const cachedTypedArrays = this._cachedTypedArrays;
90
+ let typedArray = cachedTypedArrays[propertyName];
91
+
92
+ if (!typedArray) {
93
+ typedArray = _math.GLType.createTypedArray(componentType, array);
94
+ cachedTypedArrays[propertyName] = typedArray;
95
+ }
96
+
97
+ return typedArray;
98
+ }
99
+
100
+ }
101
+
102
+ exports.default = Tile3DFeatureTable;
103
+ //# sourceMappingURL=tile-3d-feature-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/classes/tile-3d-feature-table.ts"],"names":["Tile3DFeatureTable","constructor","featureTableJson","featureTableBinary","json","buffer","getExtension","extensionName","extensions","hasProperty","propertyName","Boolean","getGlobalProperty","componentType","GL","UNSIGNED_INT","componentLength","jsonValue","Number","isFinite","byteOffset","_getTypedArrayFromBinary","getPropertyArray","GLType","fromName","featuresLength","_getTypedArrayFromArray","getProperty","featureId","result","typedArray","i","count","cachedTypedArrays","_cachedTypedArrays","createTypedArray","array"],"mappings":";;;;;;;;;;;AAGA;;AAIe,MAAMA,kBAAN,CAAyB;AAMtCC,EAAAA,WAAW,CAACC,gBAAD,EAAmBC,kBAAnB,EAAuC;AAAA;AAAA;AAAA,0DAHjC,CAGiC;AAAA,8DAF7B,EAE6B;AAChD,SAAKC,IAAL,GAAYF,gBAAZ;AACA,SAAKG,MAAL,GAAcF,kBAAd;AACD;;AAEDG,EAAAA,YAAY,CAACC,aAAD,EAAgB;AAC1B,WAAO,KAAKH,IAAL,CAAUI,UAAV,IAAwB,KAAKJ,IAAL,CAAUI,UAAV,CAAqBD,aAArB,CAA/B;AACD;;AAEDE,EAAAA,WAAW,CAACC,YAAD,EAAe;AACxB,WAAOC,OAAO,CAAC,KAAKP,IAAL,CAAUM,YAAV,CAAD,CAAd;AACD;;AAEDE,EAAAA,iBAAiB,CAACF,YAAD,EAAeG,aAAa,GAAGC,SAAGC,YAAlC,EAAgDC,eAAe,GAAG,CAAlE,EAAqE;AACpF,UAAMC,SAAS,GAAG,KAAKb,IAAL,CAAUM,YAAV,CAAlB;;AAEA,QAAIO,SAAS,IAAIC,MAAM,CAACC,QAAP,CAAgBF,SAAS,CAACG,UAA1B,CAAjB,EAAwD;AACtD,aAAO,KAAKC,wBAAL,CACLX,YADK,EAELG,aAFK,EAGLG,eAHK,EAIL,CAJK,EAKLC,SAAS,CAACG,UALL,CAAP;AAOD;;AAED,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EAA8BG,eAA9B,EAA+CgB,KAA/C,EAAsDZ,UAAtD,EAAkE;AACxF,UAAMa,iBAAiB,GAAG,KAAKC,kBAA/B;AACA,QAAIJ,UAAU,GAAGG,iBAAiB,CAACvB,YAAD,CAAlC;;AACA,QAAI,CAACoB,UAAL,EAAiB;AACfA,MAAAA,UAAU,GAAGP,aAAOY,gBAAP,CACXtB,aADW,EAEX,KAAKR,MAAL,CAAYA,MAFD,EAGX,KAAKA,MAAL,CAAYe,UAAZ,GAAyBA,UAHd,EAIXY,KAAK,GAAGhB,eAJG,CAAb;AAMAiB,MAAAA,iBAAiB,CAACvB,YAAD,CAAjB,GAAkCoB,UAAlC;AACD;;AACD,WAAOA,UAAP;AACD;;AAEDJ,EAAAA,uBAAuB,CAAChB,YAAD,EAAeG,aAAf,EAA8BuB,KAA9B,EAAqC;AAC1D,UAAMH,iBAAiB,GAAG,KAAKC,kBAA/B;AACA,QAAIJ,UAAU,GAAGG,iBAAiB,CAACvB,YAAD,CAAlC;;AACA,QAAI,CAACoB,UAAL,EAAiB;AACfA,MAAAA,UAAU,GAAGP,aAAOY,gBAAP,CAAwBtB,aAAxB,EAAuCuB,KAAvC,CAAb;AACAH,MAAAA,iBAAiB,CAACvB,YAAD,CAAjB,GAAkCoB,UAAlC;AACD;;AACD,WAAOA,UAAP;AACD;;AAlGqC","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {GL, GLType} from '@loaders.gl/math';\n\n// Reference:\n// https://github.com/AnalyticalGraphicsInc/cesium/blob/1de96d087f0b17575eb1a3f736407b348c765d59/Source/Scene/Cesium3DTileFeatureTable.js\nexport default class Tile3DFeatureTable {\n json;\n buffer;\n featuresLength = 0;\n _cachedTypedArrays = {};\n\n constructor(featureTableJson, featureTableBinary) {\n this.json = featureTableJson;\n this.buffer = featureTableBinary;\n }\n\n getExtension(extensionName) {\n return this.json.extensions && this.json.extensions[extensionName];\n }\n\n hasProperty(propertyName) {\n return Boolean(this.json[propertyName]);\n }\n\n getGlobalProperty(propertyName, componentType = GL.UNSIGNED_INT, componentLength = 1) {\n const jsonValue = this.json[propertyName];\n\n if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {\n return this._getTypedArrayFromBinary(\n propertyName,\n componentType,\n componentLength,\n 1,\n jsonValue.byteOffset\n );\n }\n\n return jsonValue;\n }\n\n getPropertyArray(propertyName, componentType, componentLength) {\n const jsonValue = this.json[propertyName];\n\n if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {\n if ('componentType' in jsonValue) {\n componentType = GLType.fromName(jsonValue.componentType);\n }\n return this._getTypedArrayFromBinary(\n propertyName,\n componentType,\n componentLength,\n this.featuresLength,\n jsonValue.byteOffset\n );\n }\n\n return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);\n }\n\n getProperty(propertyName, componentType, componentLength, featureId, result) {\n const jsonValue = this.json[propertyName];\n if (!jsonValue) {\n return jsonValue;\n }\n\n const typedArray = this.getPropertyArray(propertyName, componentType, componentLength);\n\n if (componentLength === 1) {\n return typedArray[featureId];\n }\n\n for (let i = 0; i < componentLength; ++i) {\n result[i] = typedArray[componentLength * featureId + i];\n }\n\n return result;\n }\n\n // HELPERS\n\n _getTypedArrayFromBinary(propertyName, componentType, componentLength, count, byteOffset) {\n const cachedTypedArrays = this._cachedTypedArrays;\n let typedArray = cachedTypedArrays[propertyName];\n if (!typedArray) {\n typedArray = GLType.createTypedArray(\n componentType,\n this.buffer.buffer,\n this.buffer.byteOffset + byteOffset,\n count * componentLength\n );\n cachedTypedArrays[propertyName] = typedArray;\n }\n return typedArray;\n }\n\n _getTypedArrayFromArray(propertyName, componentType, array) {\n const cachedTypedArrays = this._cachedTypedArrays;\n let typedArray = cachedTypedArrays[propertyName];\n if (!typedArray) {\n typedArray = GLType.createTypedArray(componentType, array);\n cachedTypedArrays[propertyName] = typedArray;\n }\n return typedArray;\n }\n}\n"],"file":"tile-3d-feature-table.js"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.TILE3D_OPTIMIZATION_HINT = exports.MAGIC_ARRAY = exports.TILE3D_TYPES = exports.TILE3D_TYPE = void 0;
7
+ const TILE3D_TYPE = {
8
+ COMPOSITE: 'cmpt',
9
+ POINT_CLOUD: 'pnts',
10
+ BATCHED_3D_MODEL: 'b3dm',
11
+ INSTANCED_3D_MODEL: 'i3dm',
12
+ GEOMETRY: 'geom',
13
+ VECTOR: 'vect'
14
+ };
15
+ exports.TILE3D_TYPE = TILE3D_TYPE;
16
+ const TILE3D_TYPES = Object.keys(TILE3D_TYPE);
17
+ exports.TILE3D_TYPES = TILE3D_TYPES;
18
+ const MAGIC_ARRAY = {
19
+ BATCHED_MODEL: [98, 51, 100, 109],
20
+ INSTANCED_MODEL: [105, 51, 100, 109],
21
+ POINT_CLOUD: [112, 110, 116, 115],
22
+ COMPOSITE: [99, 109, 112, 116]
23
+ };
24
+ exports.MAGIC_ARRAY = MAGIC_ARRAY;
25
+ const TILE3D_OPTIMIZATION_HINT = {
26
+ NOT_COMPUTED: -1,
27
+ USE_OPTIMIZATION: 1,
28
+ SKIP_OPTIMIZATION: 0
29
+ };
30
+ exports.TILE3D_OPTIMIZATION_HINT = TILE3D_OPTIMIZATION_HINT;
31
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/lib/constants.ts"],"names":["TILE3D_TYPE","COMPOSITE","POINT_CLOUD","BATCHED_3D_MODEL","INSTANCED_3D_MODEL","GEOMETRY","VECTOR","TILE3D_TYPES","Object","keys","MAGIC_ARRAY","BATCHED_MODEL","INSTANCED_MODEL","TILE3D_OPTIMIZATION_HINT","NOT_COMPUTED","USE_OPTIMIZATION","SKIP_OPTIMIZATION"],"mappings":";;;;;;AAEO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,SAAS,EAAE,MADc;AAEzBC,EAAAA,WAAW,EAAE,MAFY;AAGzBC,EAAAA,gBAAgB,EAAE,MAHO;AAIzBC,EAAAA,kBAAkB,EAAE,MAJK;AAKzBC,EAAAA,QAAQ,EAAE,MALe;AAMzBC,EAAAA,MAAM,EAAE;AANiB,CAApB;;AASA,MAAMC,YAAY,GAAGC,MAAM,CAACC,IAAP,CAAYT,WAAZ,CAArB;;AAEA,MAAMU,WAAW,GAAG;AACzBC,EAAAA,aAAa,EAAE,CAAC,EAAD,EAAK,EAAL,EAAS,GAAT,EAAc,GAAd,CADU;AAEzBC,EAAAA,eAAe,EAAE,CAAC,GAAD,EAAM,EAAN,EAAU,GAAV,EAAe,GAAf,CAFQ;AAGzBV,EAAAA,WAAW,EAAE,CAAC,GAAD,EAAM,GAAN,EAAW,GAAX,EAAgB,GAAhB,CAHY;AAIzBD,EAAAA,SAAS,EAAE,CAAC,EAAD,EAAK,GAAL,EAAU,GAAV,EAAe,GAAf;AAJc,CAApB;;AAQA,MAAMY,wBAAwB,GAAG;AACtCC,EAAAA,YAAY,EAAE,CAAC,CADuB;AAEtCC,EAAAA,gBAAgB,EAAE,CAFoB;AAGtCC,EAAAA,iBAAiB,EAAE;AAHmB,CAAjC","sourcesContent":["// TILE TYPES\n\nexport const TILE3D_TYPE = {\n COMPOSITE: 'cmpt',\n POINT_CLOUD: 'pnts',\n BATCHED_3D_MODEL: 'b3dm',\n INSTANCED_3D_MODEL: 'i3dm',\n GEOMETRY: 'geom',\n VECTOR: 'vect'\n};\n\nexport const TILE3D_TYPES = Object.keys(TILE3D_TYPE);\n\nexport const MAGIC_ARRAY = {\n BATCHED_MODEL: [98, 51, 100, 109],\n INSTANCED_MODEL: [105, 51, 100, 109],\n POINT_CLOUD: [112, 110, 116, 115],\n COMPOSITE: [99, 109, 112, 116]\n};\n\n// TILE CONSTANTS\nexport const TILE3D_OPTIMIZATION_HINT = {\n NOT_COMPUTED: -1,\n USE_OPTIMIZATION: 1,\n SKIP_OPTIMIZATION: 0\n};\n"],"file":"constants.js"}
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.encodeBatchedModel3DTile = encodeBatchedModel3DTile;
7
+
8
+ var _loaderUtils = require("@loaders.gl/loader-utils");
9
+
10
+ var _constants = require("../constants");
11
+
12
+ var _encode3dTileHeader = require("./helpers/encode-3d-tile-header");
13
+
14
+ function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
15
+ const {
16
+ featuresLength = 0,
17
+ batchTable
18
+ } = tile;
19
+ const featureTableJson = {
20
+ BATCH_LENGTH: featuresLength
21
+ };
22
+ const featureTableJsonString = JSON.stringify(featureTableJson);
23
+ const batchTableJsonString = batchTable ? JSON.stringify(batchTable) : '';
24
+ const featureTableJsonByteLength = (0, _loaderUtils.padToNBytes)(featureTableJsonString.length, 8);
25
+ const batchTableJsonByteLength = batchTableJsonString ? (0, _loaderUtils.padToNBytes)(batchTableJsonString.length, 8) : 0;
26
+ tile = {
27
+ magic: _constants.MAGIC_ARRAY.BATCHED_MODEL,
28
+ ...tile
29
+ };
30
+ const byteOffsetStart = byteOffset;
31
+ byteOffset = (0, _encode3dTileHeader.encode3DTileHeader)(tile, dataView, byteOffset);
32
+
33
+ if (dataView) {
34
+ dataView.setUint32(12, featureTableJsonByteLength, true);
35
+ dataView.setUint32(16, 0, true);
36
+ dataView.setUint32(20, batchTableJsonByteLength, true);
37
+ dataView.setUint32(24, 0, true);
38
+ }
39
+
40
+ byteOffset += 16;
41
+ byteOffset = (0, _loaderUtils.copyPaddedStringToDataView)(dataView, byteOffset, featureTableJsonString, 8);
42
+
43
+ if (batchTable) {
44
+ byteOffset = (0, _loaderUtils.copyPaddedStringToDataView)(dataView, byteOffset, batchTableJsonString, 8);
45
+ }
46
+
47
+ const gltfEncoded = tile.gltfEncoded;
48
+
49
+ if (gltfEncoded) {
50
+ byteOffset = (0, _loaderUtils.copyBinaryToDataView)(dataView, byteOffset, gltfEncoded, gltfEncoded.byteLength);
51
+ }
52
+
53
+ (0, _encode3dTileHeader.encode3DTileByteLength)(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
54
+ return byteOffset;
55
+ }
56
+ //# sourceMappingURL=encode-3d-tile-batched-model.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/encoders/encode-3d-tile-batched-model.ts"],"names":["encodeBatchedModel3DTile","tile","dataView","byteOffset","options","featuresLength","batchTable","featureTableJson","BATCH_LENGTH","featureTableJsonString","JSON","stringify","batchTableJsonString","featureTableJsonByteLength","length","batchTableJsonByteLength","magic","MAGIC_ARRAY","BATCHED_MODEL","byteOffsetStart","setUint32","gltfEncoded","byteLength"],"mappings":";;;;;;;AAGA;;AAKA;;AACA;;AAGO,SAASA,wBAAT,CAAkCC,IAAlC,EAAwCC,QAAxC,EAAkDC,UAAlD,EAA8DC,OAA9D,EAAuE;AAC5E,QAAM;AAACC,IAAAA,cAAc,GAAG,CAAlB;AAAqBC,IAAAA;AAArB,MAAmCL,IAAzC;AAEA,QAAMM,gBAAgB,GAAG;AACvBC,IAAAA,YAAY,EAAEH;AADS,GAAzB;AAGA,QAAMI,sBAAsB,GAAGC,IAAI,CAACC,SAAL,CAAeJ,gBAAf,CAA/B;AACA,QAAMK,oBAAoB,GAAGN,UAAU,GAAGI,IAAI,CAACC,SAAL,CAAeL,UAAf,CAAH,GAAgC,EAAvE;AACA,QAAMO,0BAA0B,GAAG,8BAAYJ,sBAAsB,CAACK,MAAnC,EAA2C,CAA3C,CAAnC;AACA,QAAMC,wBAAwB,GAAGH,oBAAoB,GACjD,8BAAYA,oBAAoB,CAACE,MAAjC,EAAyC,CAAzC,CADiD,GAEjD,CAFJ;AAKAb,EAAAA,IAAI,GAAG;AAACe,IAAAA,KAAK,EAAEC,uBAAYC,aAApB;AAAmC,OAAGjB;AAAtC,GAAP;AAEA,QAAMkB,eAAe,GAAGhB,UAAxB;AAEAA,EAAAA,UAAU,GAAG,4CAAmBF,IAAnB,EAAyBC,QAAzB,EAAmCC,UAAnC,CAAb;;AAEA,MAAID,QAAJ,EAAc;AACZA,IAAAA,QAAQ,CAACkB,SAAT,CAAmB,EAAnB,EAAuBP,0BAAvB,EAAmD,IAAnD;AACAX,IAAAA,QAAQ,CAACkB,SAAT,CAAmB,EAAnB,EAAuB,CAAvB,EAA0B,IAA1B;AACAlB,IAAAA,QAAQ,CAACkB,SAAT,CAAmB,EAAnB,EAAuBL,wBAAvB,EAAiD,IAAjD;AACAb,IAAAA,QAAQ,CAACkB,SAAT,CAAmB,EAAnB,EAAuB,CAAvB,EAA0B,IAA1B;AACD;;AACDjB,EAAAA,UAAU,IAAI,EAAd;AAGAA,EAAAA,UAAU,GAAG,6CAA2BD,QAA3B,EAAqCC,UAArC,EAAiDM,sBAAjD,EAAyE,CAAzE,CAAb;;AAEA,MAAIH,UAAJ,EAAgB;AACdH,IAAAA,UAAU,GAAG,6CAA2BD,QAA3B,EAAqCC,UAArC,EAAiDS,oBAAjD,EAAuE,CAAvE,CAAb;AACD;;AAGD,QAAMS,WAAW,GAAGpB,IAAI,CAACoB,WAAzB;;AACA,MAAIA,WAAJ,EAAiB;AACflB,IAAAA,UAAU,GAAG,uCAAqBD,QAArB,EAA+BC,UAA/B,EAA2CkB,WAA3C,EAAwDA,WAAW,CAACC,UAApE,CAAb;AACD;;AAGD,kDAAuBpB,QAAvB,EAAiCiB,eAAjC,EAAkDhB,UAAU,GAAGgB,eAA/D;AAEA,SAAOhB,UAAP;AACD","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {\n padToNBytes,\n copyBinaryToDataView,\n copyPaddedStringToDataView\n} from '@loaders.gl/loader-utils';\nimport {MAGIC_ARRAY} from '../constants';\nimport {encode3DTileHeader, encode3DTileByteLength} from './helpers/encode-3d-tile-header';\n\n// Procedurally encode the tile array dataView for testing purposes\nexport function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {\n const {featuresLength = 0, batchTable} = tile;\n\n const featureTableJson = {\n BATCH_LENGTH: featuresLength\n };\n const featureTableJsonString = JSON.stringify(featureTableJson);\n const batchTableJsonString = batchTable ? JSON.stringify(batchTable) : '';\n const featureTableJsonByteLength = padToNBytes(featureTableJsonString.length, 8);\n const batchTableJsonByteLength = batchTableJsonString\n ? padToNBytes(batchTableJsonString.length, 8)\n : 0;\n\n // Add default magic for this tile type\n tile = {magic: MAGIC_ARRAY.BATCHED_MODEL, ...tile};\n\n const byteOffsetStart = byteOffset;\n\n byteOffset = encode3DTileHeader(tile, dataView, byteOffset);\n\n if (dataView) {\n dataView.setUint32(12, featureTableJsonByteLength, true); // featureTableJsonByteLength\n dataView.setUint32(16, 0, true); // featureTableBinaryByteLength\n dataView.setUint32(20, batchTableJsonByteLength, true); // batchTableJsonByteLength\n dataView.setUint32(24, 0, true); // batchTableBinaryByteLength\n }\n byteOffset += 16;\n\n // TODO feature table binary\n byteOffset = copyPaddedStringToDataView(dataView, byteOffset, featureTableJsonString, 8);\n\n if (batchTable) {\n byteOffset = copyPaddedStringToDataView(dataView, byteOffset, batchTableJsonString, 8);\n }\n\n // Add encoded GLTF to the end of data\n const gltfEncoded = tile.gltfEncoded;\n if (gltfEncoded) {\n byteOffset = copyBinaryToDataView(dataView, byteOffset, gltfEncoded, gltfEncoded.byteLength);\n }\n\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n\n return byteOffset;\n}\n"],"file":"encode-3d-tile-batched-model.js"}
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.encodeComposite3DTile = encodeComposite3DTile;
7
+
8
+ var _constants = require("../constants");
9
+
10
+ var _encode3dTileHeader = require("./helpers/encode-3d-tile-header");
11
+
12
+ function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile) {
13
+ tile = {
14
+ magic: _constants.MAGIC_ARRAY.COMPOSITE,
15
+ tiles: [],
16
+ ...tile
17
+ };
18
+ const byteOffsetStart = byteOffset;
19
+ byteOffset += (0, _encode3dTileHeader.encode3DTileHeader)(tile, dataView, byteOffset);
20
+
21
+ if (dataView) {
22
+ dataView.setUint32(byteOffset, tile.tiles.length, true);
23
+ }
24
+
25
+ byteOffset += 4;
26
+
27
+ for (let i = 0; i < tile.tiles.length; ++i) {
28
+ byteOffset += encode3DTile(tile.tiles[i], dataView, byteOffset, options);
29
+ }
30
+
31
+ (0, _encode3dTileHeader.encode3DTileByteLength)(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
32
+ return byteOffset;
33
+ }
34
+ //# sourceMappingURL=encode-3d-tile-composite.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/lib/encoders/encode-3d-tile-composite.ts"],"names":["encodeComposite3DTile","tile","dataView","byteOffset","options","encode3DTile","magic","MAGIC_ARRAY","COMPOSITE","tiles","byteOffsetStart","setUint32","length","i"],"mappings":";;;;;;;AAGA;;AACA;;AAEO,SAASA,qBAAT,CAA+BC,IAA/B,EAAqCC,QAArC,EAA+CC,UAA/C,EAA2DC,OAA3D,EAAoEC,YAApE,EAAkF;AAEvFJ,EAAAA,IAAI,GAAG;AAACK,IAAAA,KAAK,EAAEC,uBAAYC,SAApB;AAA+BC,IAAAA,KAAK,EAAE,EAAtC;AAA0C,OAAGR;AAA7C,GAAP;AAEA,QAAMS,eAAe,GAAGP,UAAxB;AAEAA,EAAAA,UAAU,IAAI,4CAAmBF,IAAnB,EAAyBC,QAAzB,EAAmCC,UAAnC,CAAd;;AAEA,MAAID,QAAJ,EAAc;AACZA,IAAAA,QAAQ,CAACS,SAAT,CAAmBR,UAAnB,EAA+BF,IAAI,CAACQ,KAAL,CAAWG,MAA1C,EAAkD,IAAlD;AACD;;AACDT,EAAAA,UAAU,IAAI,CAAd;;AAEA,OAAK,IAAIU,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAGZ,IAAI,CAACQ,KAAL,CAAWG,MAA/B,EAAuC,EAAEC,CAAzC,EAA4C;AAC1CV,IAAAA,UAAU,IAAIE,YAAY,CAACJ,IAAI,CAACQ,KAAL,CAAWI,CAAX,CAAD,EAAgBX,QAAhB,EAA0BC,UAA1B,EAAsCC,OAAtC,CAA1B;AACD;;AAGD,kDAAuBF,QAAvB,EAAiCQ,eAAjC,EAAkDP,UAAU,GAAGO,eAA/D;AAEA,SAAOP,UAAP;AACD","sourcesContent":["// This file is derived from the Cesium code base under Apache 2 license\n// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md\n\nimport {MAGIC_ARRAY} from '../constants';\nimport {encode3DTileHeader, encode3DTileByteLength} from './helpers/encode-3d-tile-header';\n\nexport function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile) {\n // Add default magic for this tile type\n tile = {magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile};\n\n const byteOffsetStart = byteOffset;\n\n byteOffset += encode3DTileHeader(tile, dataView, byteOffset);\n\n if (dataView) {\n dataView.setUint32(byteOffset, tile.tiles.length, true); // tilesLength\n }\n byteOffset += 4;\n\n for (let i = 0; i < tile.tiles.length; ++i) {\n byteOffset += encode3DTile(tile.tiles[i], dataView, byteOffset, options);\n }\n\n // Go \"back\" and rewrite the tile's `byteLength` now that we know the value\n encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);\n\n return byteOffset;\n}\n"],"file":"encode-3d-tile-composite.js"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.encodeInstancedModel3DTile = encodeInstancedModel3DTile;
7
+
8
+ var _loaderUtils = require("@loaders.gl/loader-utils");
9
+
10
+ var _constants = require("../constants");
11
+
12
+ var _encode3dTileHeader = require("./helpers/encode-3d-tile-header");
13
+
14
+ function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
15
+ const {
16
+ featuresLength = 1,
17
+ gltfFormat = 1,
18
+ gltfUri = ''
19
+ } = tile;
20
+ const gltfUriByteLength = gltfUri.length;
21
+ const featureTableJson = {
22
+ INSTANCES_LENGTH: featuresLength,
23
+ POSITION: new Array(featuresLength * 3).fill(0)
24
+ };
25
+ const featureTableJsonString = JSON.stringify(featureTableJson);
26
+ const featureTableJsonByteLength = featureTableJsonString.length;
27
+ tile = {
28
+ magic: _constants.MAGIC_ARRAY.INSTANCED_MODEL,
29
+ ...tile
30
+ };
31
+ const byteOffsetStart = byteOffset;
32
+ byteOffset = (0, _encode3dTileHeader.encode3DTileHeader)(tile, dataView, 0);
33
+
34
+ if (dataView) {
35
+ dataView.setUint32(12, featureTableJsonByteLength, true);
36
+ dataView.setUint32(16, 0, true);
37
+ dataView.setUint32(20, 0, true);
38
+ dataView.setUint32(24, 0, true);
39
+ dataView.setUint32(28, gltfFormat, true);
40
+ }
41
+
42
+ byteOffset += 20;
43
+ byteOffset += (0, _loaderUtils.copyStringToDataView)(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
44
+ byteOffset += (0, _loaderUtils.copyStringToDataView)(dataView, byteOffset, gltfUri, gltfUriByteLength);
45
+ (0, _encode3dTileHeader.encode3DTileByteLength)(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
46
+ return byteOffset;
47
+ }
48
+ //# sourceMappingURL=encode-3d-tile-instanced-model.js.map