@loaders.gl/tiles-3d 5.0.0-beta.10 → 5.0.0-beta.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (154) hide show
  1. package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
  2. package/dist/3d-tiles/dist.dev.js +169 -581
  3. package/dist/3d-tiles/dist.min.js +16 -16
  4. package/dist/3d-tiles/index.cjs +115 -390
  5. package/dist/3d-tiles/index.cjs.map +3 -3
  6. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
  7. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
  8. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
  9. package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
  10. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
  11. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
  12. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
  13. package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
  14. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
  15. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
  16. package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
  17. package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
  18. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
  19. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
  20. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
  21. package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
  22. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
  23. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
  24. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
  25. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
  26. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
  27. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
  28. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
  29. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
  30. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
  31. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
  32. package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
  33. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
  34. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
  35. package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
  36. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
  37. package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
  38. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
  39. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
  40. package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
  41. package/dist/3d-tiles/lib/utils/version.js +1 -1
  42. package/dist/3d-tiles/types.d.ts +7 -3
  43. package/dist/3d-tiles/types.d.ts.map +1 -1
  44. package/dist/3d-tiles-archive-writer.cjs +1 -1
  45. package/dist/copc/copc-loader.d.ts.map +1 -1
  46. package/dist/copc/copc-loader.js +10 -7
  47. package/dist/copc/copc-loader.js.map +1 -1
  48. package/dist/copc/copc-writer.d.ts +5 -4
  49. package/dist/copc/copc-writer.d.ts.map +1 -1
  50. package/dist/copc/copc-writer.js +1 -1
  51. package/dist/copc/copc-writer.js.map +1 -1
  52. package/dist/copc/index.cjs +809 -124
  53. package/dist/copc/index.cjs.map +3 -3
  54. package/dist/dist.dev.js +45 -77
  55. package/dist/dist.min.js +10 -10
  56. package/dist/i3s/arcgis-webscene-loader.js +1 -1
  57. package/dist/i3s/dist.dev.js +11915 -12119
  58. package/dist/i3s/dist.min.js +25 -25
  59. package/dist/i3s/i3s-attribute-loader.js +1 -1
  60. package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
  61. package/dist/i3s/i3s-content-loader.js +1 -1
  62. package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
  63. package/dist/i3s/i3s-loader.js +1 -1
  64. package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
  65. package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
  66. package/dist/i3s/i3s-mesh-attributes.js +6 -11
  67. package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
  68. package/dist/i3s/i3s-mesh-writer.js +2 -3
  69. package/dist/i3s/i3s-mesh-writer.js.map +1 -1
  70. package/dist/i3s/i3s-node-page-loader.js +1 -1
  71. package/dist/i3s/i3s-slpk-loader.js +1 -1
  72. package/dist/i3s/i3s-slpk-writer.js +1 -1
  73. package/dist/i3s/index.cjs +314 -442
  74. package/dist/i3s/index.cjs.map +3 -3
  75. package/dist/i3s/lib/parsers/constants.d.ts +0 -3
  76. package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
  77. package/dist/i3s/lib/parsers/constants.js +0 -8
  78. package/dist/i3s/lib/parsers/constants.js.map +1 -1
  79. package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
  80. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
  81. package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
  82. package/dist/i3s/types.d.ts +0 -1
  83. package/dist/i3s/types.d.ts.map +1 -1
  84. package/dist/i3s-content-worker-node.js +11 -11
  85. package/dist/i3s-content-worker-node.js.map +4 -4
  86. package/dist/i3s-content-worker.js +485 -879
  87. package/dist/i3s-lepcc-worker-node.js +2 -2
  88. package/dist/i3s-lepcc-worker.js +2 -2
  89. package/dist/i3s-mesh-writer.cjs +87 -206
  90. package/dist/i3s-mesh-writer.cjs.map +3 -3
  91. package/dist/i3s-slpk-writer.cjs +1 -1
  92. package/dist/index.cjs +44 -41
  93. package/dist/index.cjs.map +1 -1
  94. package/dist/point-cloud-tile-loader-types.js +1 -1
  95. package/dist/point-cloud-tile-loader.cjs +17 -28
  96. package/dist/point-cloud-tile-loader.cjs.map +1 -1
  97. package/dist/point-cloud-tile-source.cjs +16 -27
  98. package/dist/point-cloud-tile-source.cjs.map +1 -1
  99. package/dist/point-cloud-tile-source.js +2 -2
  100. package/dist/point-cloud-tile-source.js.map +1 -1
  101. package/dist/potree/dist.dev.js +985 -139
  102. package/dist/potree/dist.min.js +28 -28
  103. package/dist/potree/index.cjs +813 -140
  104. package/dist/potree/index.cjs.map +3 -3
  105. package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
  106. package/dist/potree/lib/potree-node-source.js +2 -14
  107. package/dist/potree/lib/potree-node-source.js.map +1 -1
  108. package/dist/potree/parsers/parse-potree-bin.js +3 -3
  109. package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
  110. package/dist/potree/potree-bin-loader.js +1 -1
  111. package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
  112. package/dist/potree/potree-loader-types.js +1 -1
  113. package/dist/potree/potree-writer.d.ts +3 -3
  114. package/dist/potree/potree-writer.d.ts.map +1 -1
  115. package/dist/potree/potree-writer.js +2 -2
  116. package/dist/potree/potree-writer.js.map +1 -1
  117. package/dist/potree/potree2-source.d.ts +1 -1
  118. package/dist/potree/potree2-source.d.ts.map +1 -1
  119. package/dist/potree/potree2-source.js +6 -3
  120. package/dist/potree/potree2-source.js.map +1 -1
  121. package/dist/potree-loader.cjs +817 -153
  122. package/dist/potree-loader.cjs.map +3 -3
  123. package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
  124. package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
  125. package/dist/tileset-3d/helpers/frame-state.js +41 -15
  126. package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
  127. package/dist/types.d.ts +15 -0
  128. package/dist/types.d.ts.map +1 -1
  129. package/package.json +13 -13
  130. package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
  131. package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
  132. package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
  133. package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
  134. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
  135. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
  136. package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
  137. package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
  138. package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
  139. package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
  140. package/src/3d-tiles/types.ts +4 -3
  141. package/src/copc/copc-loader.ts +8 -8
  142. package/src/copc/copc-writer.ts +6 -5
  143. package/src/i3s/i3s-mesh-attributes.ts +9 -17
  144. package/src/i3s/i3s-mesh-writer.ts +4 -3
  145. package/src/i3s/lib/parsers/constants.ts +0 -9
  146. package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
  147. package/src/i3s/types.ts +0 -1
  148. package/src/point-cloud-tile-source.ts +2 -2
  149. package/src/potree/lib/potree-node-source.ts +2 -15
  150. package/src/potree/parsers/parse-potree-bin.ts +3 -3
  151. package/src/potree/potree-writer.ts +6 -11
  152. package/src/potree/potree2-source.ts +6 -3
  153. package/src/tileset-3d/helpers/frame-state.ts +43 -15
  154. package/src/types.ts +15 -0
@@ -8,7 +8,7 @@
8
8
  import {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';
9
9
  import {Ellipsoid} from '@math.gl/geospatial';
10
10
  import {eastNorthUpToFixedFrame} from '@math.gl/geospatial';
11
- import {GL, octDecodeInRange} from '@math.gl/geometry';
11
+ import {octDecodeInRange} from '@math.gl/geometry';
12
12
  import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
13
13
  import Tile3DBatchTable from '../classes/tile-3d-batch-table';
14
14
 
@@ -70,7 +70,7 @@ function parseInstancedModel(
70
70
  }
71
71
 
72
72
  tile.eastNorthUp = featureTable.getGlobalProperty('EAST_NORTH_UP');
73
- tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);
73
+ tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', Float32Array, 3);
74
74
 
75
75
  const batchTable = new Tile3DBatchTable(
76
76
  tile.batchTableJson,
@@ -111,11 +111,11 @@ function extractInstancedAttributes(
111
111
 
112
112
  // Get the instance position
113
113
  if (featureTable.hasProperty('POSITION')) {
114
- position = featureTable.getProperty('POSITION', GL.FLOAT, 3, i, instancePosition);
114
+ position = featureTable.getProperty('POSITION', Float32Array, 3, i, instancePosition);
115
115
  } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
116
116
  position = featureTable.getProperty(
117
117
  'POSITION_QUANTIZED',
118
- GL.UNSIGNED_SHORT,
118
+ Uint16Array,
119
119
  3,
120
120
  i,
121
121
  instancePosition
@@ -123,7 +123,7 @@ function extractInstancedAttributes(
123
123
 
124
124
  const quantizedVolumeOffset = featureTable.getGlobalProperty(
125
125
  'QUANTIZED_VOLUME_OFFSET',
126
- GL.FLOAT,
126
+ Float32Array,
127
127
  3
128
128
  );
129
129
  if (!quantizedVolumeOffset) {
@@ -134,7 +134,7 @@ function extractInstancedAttributes(
134
134
 
135
135
  const quantizedVolumeScale = featureTable.getGlobalProperty(
136
136
  'QUANTIZED_VOLUME_SCALE',
137
- GL.FLOAT,
137
+ Float32Array,
138
138
  3
139
139
  );
140
140
  if (!quantizedVolumeScale) {
@@ -159,8 +159,8 @@ function extractInstancedAttributes(
159
159
  instanceTranslationRotationScale.translation = instancePosition;
160
160
 
161
161
  // Get the instance rotation
162
- const normalUp = featureTable.getProperty('NORMAL_UP', GL.FLOAT, 3, i, scratch1);
163
- const normalRight = featureTable.getProperty('NORMAL_RIGHT', GL.FLOAT, 3, i, scratch2);
162
+ const normalUp = featureTable.getProperty('NORMAL_UP', Float32Array, 3, i, scratch1);
163
+ const normalRight = featureTable.getProperty('NORMAL_RIGHT', Float32Array, 3, i, scratch2);
164
164
  tile.normalUp = normalUp;
165
165
  tile.normalRight = normalRight;
166
166
 
@@ -174,16 +174,10 @@ function extractInstancedAttributes(
174
174
  tile.hasCustomOrientation = true;
175
175
  hasCustomOrientation = true;
176
176
  } else {
177
- const octNormalUp = featureTable.getProperty(
178
- 'NORMAL_UP_OCT32P',
179
- GL.UNSIGNED_SHORT,
180
- 2,
181
- i,
182
- scratch1
183
- );
177
+ const octNormalUp = featureTable.getProperty('NORMAL_UP_OCT32P', Uint16Array, 2, i, scratch1);
184
178
  const octNormalRight = featureTable.getProperty(
185
179
  'NORMAL_RIGHT_OCT32P',
186
- GL.UNSIGNED_SHORT,
180
+ Uint16Array,
187
181
  2,
188
182
  i,
189
183
  scratch2
@@ -224,11 +218,17 @@ function extractInstancedAttributes(
224
218
 
225
219
  // Get the instance scale
226
220
  instanceScale.set(1.0, 1.0, 1.0);
227
- const scale = featureTable.getProperty('SCALE', GL.FLOAT, 1, i, scratch3);
221
+ const scale = featureTable.getProperty('SCALE', Float32Array, 1, i, scratch3);
228
222
  if (Number.isFinite(scale)) {
229
223
  instanceScale.multiplyByScalar(scale);
230
224
  }
231
- const nonUniformScale = featureTable.getProperty('SCALE_NON_UNIFORM', GL.FLOAT, 3, i, scratch1);
225
+ const nonUniformScale = featureTable.getProperty(
226
+ 'SCALE_NON_UNIFORM',
227
+ Float32Array,
228
+ 3,
229
+ i,
230
+ scratch1
231
+ );
232
232
  if (nonUniformScale) {
233
233
  instanceScale.scale(nonUniformScale);
234
234
  }
@@ -237,7 +237,7 @@ function extractInstancedAttributes(
237
237
  instanceTranslationRotationScale.scale = instanceScale;
238
238
 
239
239
  // Get the batchId
240
- let batchId = featureTable.getProperty('BATCH_ID', GL.UNSIGNED_SHORT, 1, i, scratch4);
240
+ let batchId = featureTable.getProperty('BATCH_ID', Uint16Array, 1, i, scratch4);
241
241
  if (batchId === undefined) {
242
242
  // If BATCH_ID semantic is undefined, batchId is just the instance number
243
243
  batchId = i;
@@ -8,7 +8,6 @@
8
8
  import {DracoLoader} from '@loaders.gl/scene';
9
9
  import type {DracoMesh} from '@loaders.gl/scene';
10
10
  import {LoaderContext, parseFromContext} from '@loaders.gl/core/loader-utils';
11
- import {GL} from '@math.gl/geometry';
12
11
  import {Vector3} from '@math.gl/core';
13
12
 
14
13
  import Tile3DFeatureTable from '../classes/tile-3d-feature-table';
@@ -46,7 +45,7 @@ export async function parsePointCloud3DTile(
46
45
  }
47
46
 
48
47
  function initializeTile(tile: Tiles3DTileContent): void {
49
- // Initialize point cloud tile defaults
48
+ tile.topology = 'point-list';
50
49
  tile.attributes = {
51
50
  positions: null,
52
51
  colors: null,
@@ -75,7 +74,7 @@ function parsePointCloudTables(tile: Tiles3DTileContent): {
75
74
  tile.pointsLength = pointsLength;
76
75
  tile.pointCount = pointsLength;
77
76
 
78
- tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', GL.FLOAT, 3);
77
+ tile.rtcCenter = featureTable.getGlobalProperty('RTC_CENTER', Float32Array, 3);
79
78
 
80
79
  const batchTable = parseBatchIds(tile, featureTable);
81
80
 
@@ -95,16 +94,16 @@ function parsePositions(
95
94
  };
96
95
  if (!tile.attributes.positions) {
97
96
  if (featureTable.hasProperty('POSITION')) {
98
- tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);
97
+ tile.attributes.positions = featureTable.getPropertyArray('POSITION', Float32Array, 3);
99
98
  } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
100
- const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);
99
+ const positions = featureTable.getPropertyArray('POSITION_QUANTIZED', Uint16Array, 3);
101
100
 
102
101
  tile.isQuantized = true;
103
102
  tile.quantizedRange = (1 << 16) - 1;
104
103
 
105
104
  tile.quantizedVolumeScale = featureTable.getGlobalProperty(
106
105
  'QUANTIZED_VOLUME_SCALE',
107
- GL.FLOAT,
106
+ Float32Array,
108
107
  3
109
108
  );
110
109
  if (!tile.quantizedVolumeScale) {
@@ -113,7 +112,7 @@ function parsePositions(
113
112
 
114
113
  tile.quantizedVolumeOffset = featureTable.getGlobalProperty(
115
114
  'QUANTIZED_VOLUME_OFFSET',
116
- GL.FLOAT,
115
+ Float32Array,
117
116
  3
118
117
  );
119
118
  if (!tile.quantizedVolumeOffset) {
@@ -144,12 +143,12 @@ function parseColors(
144
143
  if (!tile.attributes.colors) {
145
144
  let colors = null;
146
145
  if (featureTable.hasProperty('RGBA')) {
147
- colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);
146
+ colors = featureTable.getPropertyArray('RGBA', Uint8Array, 4);
148
147
  tile.isTranslucent = true;
149
148
  } else if (featureTable.hasProperty('RGB')) {
150
- colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);
149
+ colors = featureTable.getPropertyArray('RGB', Uint8Array, 3);
151
150
  } else if (featureTable.hasProperty('RGB565')) {
152
- colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);
151
+ colors = featureTable.getPropertyArray('RGB565', Uint16Array, 1);
153
152
  tile.isRGB565 = true;
154
153
  }
155
154
 
@@ -157,7 +156,7 @@ function parseColors(
157
156
  }
158
157
 
159
158
  if (featureTable.hasProperty('CONSTANT_RGBA')) {
160
- tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);
159
+ tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', Uint8Array, 4);
161
160
  }
162
161
  }
163
162
 
@@ -171,9 +170,9 @@ function parseNormals(tile: Tiles3DTileContent, featureTable: Tile3DFeatureTable
171
170
  if (!tile.attributes.normals) {
172
171
  let normals = null;
173
172
  if (featureTable.hasProperty('NORMAL')) {
174
- normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);
173
+ normals = featureTable.getPropertyArray('NORMAL', Float32Array, 3);
175
174
  } else if (featureTable.hasProperty('NORMAL_OCT16P')) {
176
- normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);
175
+ normals = featureTable.getPropertyArray('NORMAL_OCT16P', Uint8Array, 2);
177
176
  tile.isOctEncoded16P = true;
178
177
  }
179
178
 
@@ -187,7 +186,7 @@ function parseBatchIds(
187
186
  ): Tile3DBatchTable | null {
188
187
  let batchTable: Tile3DBatchTable | null = null;
189
188
  if (!tile.batchIds && featureTable.hasProperty('BATCH_ID')) {
190
- tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
189
+ tile.batchIds = featureTable.getPropertyArray('BATCH_ID', Uint16Array, 1);
191
190
 
192
191
  if (tile.batchIds) {
193
192
  const batchFeatureLength = featureTable.getGlobalProperty('BATCH_LENGTH');
@@ -351,35 +350,35 @@ export async function loadDraco(
351
350
 
352
351
  if (!tile.attributes.positions) {
353
352
  if (featureTable.hasProperty('POSITION')) {
354
- tile.attributes.positions = featureTable.getPropertyArray('POSITION', GL.FLOAT, 3);
353
+ tile.attributes.positions = featureTable.getPropertyArray('POSITION', Float32Array, 3);
355
354
  } else if (featureTable.hasProperty('POSITION_QUANTIZED')) {
356
- tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', GL.UNSIGNED_SHORT, 3);
355
+ tile.attributes.positions = featureTable.getPropertyArray('POSITION_QUANTIZED', Uint16Array, 3);
357
356
 
358
357
 
359
358
  if (!tile.colors) {
360
359
  if (featureTable.hasProperty('RGBA')) {
361
- tile.colors = featureTable.getPropertyArray('RGBA', GL.UNSIGNED_BYTE, 4);
360
+ tile.colors = featureTable.getPropertyArray('RGBA', Uint8Array, 4);
362
361
  tile.isTranslucent = true;
363
362
  } else if (featureTable.hasProperty('RGB')) {
364
- tile.colors = featureTable.getPropertyArray('RGB', GL.UNSIGNED_BYTE, 3);
363
+ tile.colors = featureTable.getPropertyArray('RGB', Uint8Array, 3);
365
364
  } else if (featureTable.hasPropertry('RGB565')) {
366
- tile.colors = featureTable.getPropertyArray('RGB565', GL.UNSIGNED_SHORT, 1);
365
+ tile.colors = featureTable.getPropertyArray('RGB565', Uint16Array, 1);
367
366
  tile.isRGB565 = true;
368
367
  }
369
368
  }
370
369
 
371
370
  if (!tile.attributes.normals) {
372
371
  if (featureTable.getPropertry('NORMAL')) {
373
- tile.attributes.normals = featureTable.getPropertyArray('NORMAL', GL.FLOAT, 3);
372
+ tile.attributes.normals = featureTable.getPropertyArray('NORMAL', Float32Array, 3);
374
373
  } else if (featureTable.getProperty('NORMAL_OCT16P')) {
375
- tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', GL.UNSIGNED_BYTE, 2);
374
+ tile.attributes.normals = featureTable.getPropertyArray('NORMAL_OCT16P', Uint8Array, 2);
376
375
  tile.isOctEncoded16P = true;
377
376
  }
378
377
  }
379
378
 
380
379
  if (!tile.batchIds) {
381
380
  if (featureTable.hasProperty('BATCH_ID')) {
382
- tile.batchIds = featureTable.getPropertyArray('BATCH_ID', GL.UNSIGNED_SHORT, 1);
381
+ tile.batchIds = featureTable.getPropertyArray('BATCH_ID', Uint16Array, 1);
383
382
  }
384
383
  }
385
384
 
@@ -388,7 +387,7 @@ export async function loadDraco(
388
387
  }
389
388
 
390
389
  if (featureTable.getPropertry('CONSTANT_RGBA')) {
391
- tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', GL.UNSIGNED_BYTE, 4);
390
+ tile.constantRGBA = featureTable.getGlobalProperty('CONSTANT_RGBA', Uint8Array, 4);
392
391
  }
393
392
 
394
393
  if (tile.batchIds) {
@@ -360,20 +360,21 @@ export type Tiles3DTileContent = {
360
360
  batchId: number;
361
361
  }[];
362
362
 
363
+ /** Primitive topology of decoded point cloud tiles. */
364
+ topology?: 'point-list';
363
365
  /** For Pointcloud tiles */
364
366
  attributes?: {
365
- positions: null | number[] | TypedArray;
367
+ positions: null | number[] | TypedArray | {value: Uint16Array; size: number; normalized: true};
366
368
  colors:
367
369
  | null
368
370
  | number[]
369
371
  | {
370
- type: number;
371
372
  value: TypedArray | number[];
372
373
  size: number;
373
374
  normalized: boolean;
374
375
  componentType?: 'float16';
375
376
  };
376
- normals: null | number[] | TypedArray | {type: number; size: number; value: TypedArray};
377
+ normals: null | number[] | TypedArray | {size: number; value: TypedArray};
377
378
  batchIds: null | number[] | TypedArray;
378
379
  };
379
380
  constantRGBA?: number[];
@@ -10,7 +10,7 @@ import {
10
10
  makeMeshArrowTable,
11
11
  type MeshArrowAttributes
12
12
  } from '@loaders.gl/core/schema-utils';
13
- import {deserializeArrowWorkerTable} from '@loaders.gl/core/arrow-worker-transport';
13
+ import {deserializeNativeArrowWorkerResult} from '@loaders.gl/core/arrow-worker-transport';
14
14
  import type {
15
15
  CoreAPI,
16
16
  SourceLoader,
@@ -499,7 +499,7 @@ export class COPCTileSource
499
499
  const columns = Object.fromEntries(
500
500
  columnNames.map(columnName => [columnName, [] as unknown[]])
501
501
  );
502
- const positionVector = content.data.data.getChild('POSITION');
502
+ const positionVector = content.data.getChild('POSITION');
503
503
  for (let pointIndex = 0; pointIndex < content.pointCount; pointIndex++) {
504
504
  const offsetPosition = readArrowListValue(positionVector?.get(pointIndex));
505
505
  const projectedPosition = [
@@ -1123,7 +1123,9 @@ export class COPCTileSource
1123
1123
  undefined,
1124
1124
  signal
1125
1125
  );
1126
- const mesh = convertTableToMesh(deserializeArrowWorkerTable(result));
1126
+ const nativeTable = deserializeNativeArrowWorkerResult((result as {columns: unknown}).columns);
1127
+ if (!('batches' in nativeTable)) throw new Error('COPC LAS worker must return an Arrow table');
1128
+ const mesh = convertTableToMesh(nativeTable);
1127
1129
  const nativePositions = mesh.attributes.POSITION?.value;
1128
1130
  const colors = mesh.attributes.COLOR_0?.value || null;
1129
1131
  if (
@@ -1355,7 +1357,7 @@ export class COPCTileSource
1355
1357
  attributes[attribute.name] = {value: attribute.value, size: attribute.size};
1356
1358
  }
1357
1359
 
1358
- return makeMeshArrowTable(attributes, {topology: 'point-list', mode: 0});
1360
+ return makeMeshArrowTable(attributes, {topology: 'point-list'});
1359
1361
  }
1360
1362
 
1361
1363
  protected async ensureHierarchyLoaded(tileId: string): Promise<void> {
@@ -1712,13 +1714,11 @@ function getCOPCScanValue(
1712
1714
  if (columnName === 'Z') return sourcePosition[2];
1713
1715
 
1714
1716
  if (columnName === 'Red' || columnName === 'Green' || columnName === 'Blue') {
1715
- const color = readArrowListValue(data.data.getChild('COLOR_0')?.get(pointIndex));
1717
+ const color = readArrowListValue(data.getChild('COLOR_0')?.get(pointIndex));
1716
1718
  return color[columnName === 'Red' ? 0 : columnName === 'Green' ? 1 : 2];
1717
1719
  }
1718
1720
  const decoderColumn = COPC_SCAN_COLUMN_MAP[columnName];
1719
- const value = normalizeArrowValue(
1720
- data.data.getChild(decoderColumn || columnName)?.get(pointIndex)
1721
- );
1721
+ const value = normalizeArrowValue(data.getChild(decoderColumn || columnName)?.get(pointIndex));
1722
1722
  if (COPC_BOOLEAN_COLUMN_NAMES.has(columnName) && typeof value === 'number') {
1723
1723
  return value !== 0;
1724
1724
  }
@@ -11,7 +11,8 @@ import {
11
11
  type WriterWithEncoder
12
12
  } from '@loaders.gl/core/loader-utils';
13
13
  import {LASWriter, type LASExtraBytesWriter} from '@loaders.gl/pointclouds/las';
14
- import type {Mesh, MeshArrowTable} from '@loaders.gl/core/schema';
14
+ import type {Mesh} from '@loaders.gl/core/schema';
15
+ import type {Table} from 'apache-arrow';
15
16
  import type {WKTCRSDefinition} from '@math.gl/geospatial/crs';
16
17
  import {COPCFormat} from './copc-format';
17
18
 
@@ -57,7 +58,7 @@ export type COPCWriterOptions = WriterOptions & {
57
58
  /** Writer metadata for COPC point cloud output. */
58
59
  export const COPCWriter = {
59
60
  ...COPCFormat,
60
- dataType: null as unknown as Mesh | MeshArrowTable,
61
+ dataType: null as unknown as Mesh | Table,
61
62
  batchType: null as never,
62
63
  version: VERSION,
63
64
  extensions: ['copc.laz', 'laz'],
@@ -66,10 +67,10 @@ export const COPCWriter = {
66
67
  },
67
68
  encode: async (data, options) => encodeCOPCSync(data, options),
68
69
  encodeSync: encodeCOPCSync
69
- } as const satisfies WriterWithEncoder<Mesh | MeshArrowTable, never, COPCWriterOptions>;
70
+ } as const satisfies WriterWithEncoder<Mesh | Table, never, COPCWriterOptions>;
70
71
 
71
72
  /** Encode a mesh or Arrow table as COPC. */
72
- function encodeCOPCSync(data: Mesh | MeshArrowTable, options: COPCWriterOptions = {}): ArrayBuffer {
73
+ function encodeCOPCSync(data: Mesh | Table, options: COPCWriterOptions = {}): ArrayBuffer {
73
74
  const nodePointLimit = options.copc?.nodePointLimit ?? DEFAULT_NODE_POINT_LIMIT;
74
75
  const maximumDepth = options.copc?.maximumDepth ?? DEFAULT_MAXIMUM_DEPTH;
75
76
  const hierarchyPageDepth = options.copc?.hierarchyPageDepth ?? DEFAULT_HIERARCHY_PAGE_DEPTH;
@@ -240,7 +241,7 @@ type OctreeContext = {
240
241
  };
241
242
 
242
243
  /** Encode input data once as uncompressed LAS 1.4 point records. */
243
- function encodeRawLAS(data: Mesh | MeshArrowTable, options: COPCWriterOptions): RawLASData {
244
+ function encodeRawLAS(data: Mesh | Table, options: COPCWriterOptions): RawLASData {
244
245
  const arrayBuffer = LASWriter.encodeSync(data, {
245
246
  las: {
246
247
  version: '1.4',
@@ -3,12 +3,13 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {convertArrowToSchema} from '@loaders.gl/core/schema-utils';
6
- import type {ArrowTableBatch, Field} from '@loaders.gl/core/schema';
6
+ import type {Field} from '@loaders.gl/core/schema';
7
+ import type {RecordBatch} from 'apache-arrow';
7
8
 
8
9
  /** One feature table with an explicit triangle-to-row association. */
9
10
  export interface I3SMeshFeatures {
10
11
  /** Explicit-schema Arrow batches for a single metadata class, in row order. */
11
- readonly batches: readonly ArrowTableBatch[];
12
+ readonly batches: readonly RecordBatch[];
12
13
  /** One zero-based table row per triangle, in the original index/vertex order. */
13
14
  readonly triangleFeatureIndices: Uint32Array;
14
15
  /** Non-null stable identifier column; geometry uses separate local OIDs. */
@@ -37,8 +38,8 @@ export function encodeI3SMeshAttributes(
37
38
  maxResourceBytes: number
38
39
  ): EncodedI3SMeshAttributes {
39
40
  const batches = features?.batches || [];
40
- const schema = batches[0]?.schema;
41
- const count = batches.reduce((total, batch) => total + batch.data.numRows, 0);
41
+ const schema = batches[0]?.schema && convertArrowToSchema(batches[0].schema);
42
+ const count = batches.reduce((total, batch) => total + batch.numRows, 0);
42
43
  if (features && (!schema || count === 0 || !schema.fields.length)) {
43
44
  throw new Error('I3S features require nonempty explicit-schema Arrow batches');
44
45
  }
@@ -67,19 +68,10 @@ export function encodeI3SMeshAttributes(
67
68
  }
68
69
  const identifiers = new Set<string | number | bigint>();
69
70
  for (const batch of batches) {
70
- if (
71
- JSON.stringify(batch.schema) !== JSON.stringify(schema) ||
72
- batch.length !== batch.data.numRows
73
- ) {
74
- throw new Error('I3S feature batches must share an explicit schema and correct row counts');
71
+ if (JSON.stringify(convertArrowToSchema(batch.schema)) !== JSON.stringify(schema)) {
72
+ throw new Error('I3S feature batches must share an explicit schema');
75
73
  }
76
- const actualFields = convertArrowToSchema(batch.data.schema).fields;
77
- if (
78
- JSON.stringify(actualFields.map(field => [field.name, field.type])) !==
79
- JSON.stringify(schema.fields.map(field => [field.name, field.type]))
80
- )
81
- throw new Error('I3S declared feature schema must match the Arrow column types');
82
- const column = batch.data.getChild(features.featureIdField);
74
+ const column = batch.getChild(features.featureIdField);
83
75
  if (!column) throw new Error('Missing Arrow feature identifier column');
84
76
  for (let index = 0; index < column.length; index++) {
85
77
  const identifier = column.get(index);
@@ -101,7 +93,7 @@ export function encodeI3SMeshAttributes(
101
93
  throw new Error('I3S fields require unique identifiers other than reserved OBJECTID');
102
94
  }
103
95
  const values = batches.flatMap(batch => {
104
- const column = batch.data.getChild(field.name);
96
+ const column = batch.getChild(field.name);
105
97
  if (!column) throw new Error(`Missing Arrow column ${field.name}`);
106
98
  return Array.from({length: column.length}, (_, index) => column.get(index));
107
99
  });
@@ -452,13 +452,14 @@ function prepareMeshLayer(
452
452
  }
453
453
  };
454
454
  const material = encodeMaterial(options.material);
455
+ const featureClass = options.features?.batches[0]?.schema.metadata.get(
456
+ 'loaders.gl:feature-class'
457
+ );
455
458
  const layer = {
456
459
  id: 0,
457
460
  version: '1',
458
461
  name: options.name || 'Converted mesh',
459
- description: options.features?.batches[0]?.schema?.metadata?.['loaders.gl:feature-class']
460
- ? `Source feature metadata class: ${options.features.batches[0].schema!.metadata!['loaders.gl:feature-class']}`
461
- : undefined,
462
+ description: featureClass ? `Source feature metadata class: ${featureClass}` : undefined,
462
463
  layerType: '3DObject',
463
464
  spatialReference: {wkid: 4326},
464
465
  heightModelInfo: {heightModel: 'ellipsoidal', heightUnit: 'meter'},
@@ -2,8 +2,6 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import {GL} from '@math.gl/geometry';
6
-
7
5
  export function getConstructorForDataFormat(dataType: string) {
8
6
  switch (dataType) {
9
7
  case 'UInt8':
@@ -21,13 +19,6 @@ export function getConstructorForDataFormat(dataType: string) {
21
19
  }
22
20
  }
23
21
 
24
- export const GL_TYPE_MAP: {[key: string]: number} = {
25
- UInt8: GL.UNSIGNED_BYTE,
26
- UInt16: GL.UNSIGNED_SHORT,
27
- Float32: GL.FLOAT,
28
- UInt32: GL.UNSIGNED_INT,
29
- UInt64: GL.DOUBLE
30
- };
31
22
  /**
32
23
  * Returns how many bytes a type occupies
33
24
  * @param dataType
@@ -29,7 +29,7 @@ import {
29
29
  } from '../../types';
30
30
  import {getUrlWithSearchParams, getUrlWithToken} from '../utils/url-utils';
31
31
 
32
- import {GL_TYPE_MAP, getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';
32
+ import {getConstructorForDataFormat, sizeOf, COORDINATE_SYSTEM} from './constants';
33
33
  import {I3SLoaderOptions} from '../../i3s-loader';
34
34
 
35
35
  const scratchVector = new Vector3([0, 0, 0]);
@@ -717,7 +717,6 @@ function normalizeAttributes(
717
717
 
718
718
  attributes[attribute] = {
719
719
  value,
720
- type: GL_TYPE_MAP[valueType],
721
720
  size: valuesPerElement
722
721
  };
723
722
 
package/src/i3s/types.ts CHANGED
@@ -1036,7 +1036,6 @@ export type I3SMeshAttributes = {
1036
1036
  [key: string]: I3SMeshAttribute;
1037
1037
  };
1038
1038
  export interface I3SMeshAttribute extends MeshAttribute {
1039
- type?: number;
1040
1039
  metadata?: any;
1041
1040
  }
1042
1041
  /** https://github.com/Esri/i3s-spec/blob/master/docs/1.8/heightModelInfo.cmn.md */
@@ -5,7 +5,7 @@
5
5
  import {DataSource, type CoreAPI} from '@loaders.gl/core/loader-utils';
6
6
  import {
7
7
  PointCloudTiler,
8
- convertMeshToArrowTableWrapper,
8
+ convertMeshToArrowTable,
9
9
  type PointCloudTilerNode
10
10
  } from '@loaders.gl/core/schema-utils';
11
11
  import type {
@@ -75,7 +75,7 @@ export class PointCloudTileSource
75
75
  const mesh = await this.tiler.getTileMesh(tile.id);
76
76
  if (!mesh.header!.vertexCount) return null;
77
77
  return {
78
- data: convertMeshToArrowTableWrapper(mesh),
78
+ data: convertMeshToArrowTable(mesh),
79
79
  pointCount: mesh.header!.vertexCount,
80
80
  cartographicOrigin: [0, 0, 0],
81
81
  coordinateSystem: 'cartesian',
@@ -27,7 +27,7 @@ import {
27
27
  } from '@loaders.gl/core/loader-utils';
28
28
  import {LASLoader} from '@loaders.gl/pointclouds/las';
29
29
  import type {DataType, Field, Mesh, MeshArrowTable, Schema} from '@loaders.gl/core/schema';
30
- import {ArrowTableBuilder, convertMeshToArrowTableWrapper} from '@loaders.gl/core/schema-utils';
30
+ import {ArrowTableBuilder, makeMeshArrowTable} from '@loaders.gl/core/schema-utils';
31
31
  import {PotreeBoundingBox, PotreeMetadata} from '../types/potree-metadata';
32
32
  import {
33
33
  POTreeNode,
@@ -1069,20 +1069,7 @@ export class PotreeNodesSource
1069
1069
  attributes.NORMAL = mesh.attributes.normals;
1070
1070
  }
1071
1071
 
1072
- return convertMeshToArrowTableWrapper({
1073
- topology: 'point-list',
1074
- mode: 0,
1075
- header: {
1076
- vertexCount:
1077
- mesh.header?.vertexCount ||
1078
- mesh.attributes.positions.value.length / mesh.attributes.positions.size
1079
- },
1080
- schema: {
1081
- fields: [],
1082
- metadata: {}
1083
- },
1084
- attributes
1085
- });
1072
+ return makeMeshArrowTable(attributes, {topology: 'point-list'});
1086
1073
  }
1087
1074
 
1088
1075
  /**
@@ -6,7 +6,7 @@ import type {LoaderOptions} from '@loaders.gl/core/loader-utils';
6
6
  import type {Table} from 'apache-arrow';
7
7
  import type {Mesh, MeshAttributes} from '@loaders.gl/core/schema';
8
8
  import {convertColorArrayToFloat16, convertColorArrayToFloat32} from '@loaders.gl/core/schema';
9
- import {convertMeshToArrowTableWrapper, convertTableToMesh} from '@loaders.gl/core/schema-utils';
9
+ import {convertMeshToArrowTable, convertTableToMesh} from '@loaders.gl/core/schema-utils';
10
10
  import {parseVersion} from '../utils/parse-version';
11
11
  import type {PotreeAttribute} from '../types/potree-metadata';
12
12
 
@@ -228,9 +228,9 @@ export function parsePotreeBin(
228
228
  };
229
229
 
230
230
  const formattedMesh = formatPotreeMeshColors(mesh, resolvedOptions.colorFormat);
231
- const table = convertMeshToArrowTableWrapper(formattedMesh);
231
+ const table = convertMeshToArrowTable(formattedMesh);
232
232
  if (options?.potree?.shape === 'arrow') {
233
- return table.data;
233
+ return table;
234
234
  }
235
235
  return {
236
236
  ...convertTableToMesh(table),
@@ -2,12 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
- import type {
6
- Mesh,
7
- MeshArrowTable,
8
- MeshArrowTableData,
9
- MeshAttribute
10
- } from '@loaders.gl/core/schema';
5
+ import type {Mesh, MeshArrowTable, MeshAttribute} from '@loaders.gl/core/schema';
11
6
  import {convertTableToMesh} from '@loaders.gl/core/schema-utils';
12
7
  import type {WriterOptions, WriterWithEncoder} from '@loaders.gl/core/loader-utils';
13
8
  import type {PotreeAttribute, PotreeMetadata} from './types/potree-metadata';
@@ -18,7 +13,7 @@ export type PotreeWriterNode = {
18
13
  /** Root r followed by XYZ octant digits 4/2/1. */
19
14
  readonly id: string;
20
15
  /** Decoded rows belonging exclusively to this node. */
21
- readonly mesh: Mesh | MeshArrowTable | MeshArrowTableData;
16
+ readonly mesh: Mesh | MeshArrowTable;
22
17
  };
23
18
 
24
19
  /** Complete typed file collection; applications own storage or archive packaging. */
@@ -108,9 +103,9 @@ const WIRE_TYPES: [Potree2AttributeType, new (length: number) => WireArray, numb
108
103
  ];
109
104
 
110
105
  /** Validates decoded rows and layouts before writing any point bytes. */
111
- function getMesh(input: Mesh | MeshArrowTable | MeshArrowTableData): Mesh {
106
+ function getMesh(input: Mesh | MeshArrowTable): Mesh {
112
107
  if (!('attributes' in input)) {
113
- const table = 'shape' in input ? input.data : input;
108
+ const table = input;
114
109
  /** Rejects null rows and components before Arrow conversion can replace them. */
115
110
  type NullableColumn = {nullCount: number; children: readonly NullableColumn[]};
116
111
  const checkNulls = (data: NullableColumn): void => {
@@ -446,7 +441,7 @@ function getDirectory(id: string, step: number): string {
446
441
  * Version 2.0 output uses DEFAULT encoding; readers also accept upstream BROTLI data.
447
442
  */
448
443
  export async function encodePotreeDataset(
449
- input: Mesh | MeshArrowTable | MeshArrowTableData | readonly PotreeWriterNode[],
444
+ input: Mesh | MeshArrowTable | readonly PotreeWriterNode[],
450
445
  options: PotreeWriterOptions = {}
451
446
  ): Promise<PotreeDataset> {
452
447
  const settings = options.potree || {};
@@ -477,7 +472,7 @@ export async function encodePotreeDataset(
477
472
  settings.signal?.throwIfAborted();
478
473
  const supplied = Array.isArray(input)
479
474
  ? (input as readonly PotreeWriterNode[])
480
- : [{id: 'r', mesh: input as Mesh | MeshArrowTable | MeshArrowTableData}];
475
+ : [{id: 'r', mesh: input as Mesh | MeshArrowTable}];
481
476
  if (!supplied.length || supplied.length > maxNodes)
482
477
  throw new Error('Potree writer node budget exceeded');
483
478
  const nodes = supplied
@@ -3,7 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
5
  import {DataSource, readRangeResponse, type CoreAPI} from '@loaders.gl/core/loader-utils';
6
- import {convertMeshToArrowTableWrapper} from '@loaders.gl/core/schema-utils';
6
+ import {makeMeshArrowTable} from '@loaders.gl/core/schema-utils';
7
7
  import type {PotreeLoaderOptions} from './potree-source-options';
8
8
  import type {Potree2HierarchyNode, Potree2Metadata} from './potree2-types';
9
9
  import {
@@ -152,9 +152,12 @@ export class Potree2Source extends DataSource<string, PotreeLoaderOptions> {
152
152
  );
153
153
  this.signal.throwIfAborted();
154
154
  const header = this.createHeader(node);
155
- mesh.header!.boundingBox = header.boundingVolume.cartographicBounds;
156
155
  return {
157
- data: convertMeshToArrowTableWrapper(mesh),
156
+ data: makeMeshArrowTable(mesh.attributes, {
157
+ schema: mesh.schema,
158
+ topology: mesh.topology,
159
+ boundingBox: header.boundingVolume.cartographicBounds
160
+ }),
158
161
  pointCount: node.pointCount,
159
162
  coordinateSystem: 'cartesian' as const,
160
163
  cartographicOrigin: [0, 0, 0],