@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.
- package/dist/3d-tiles/3d-tiles-archive-loader.js +1 -1
- package/dist/3d-tiles/dist.dev.js +169 -581
- package/dist/3d-tiles/dist.min.js +16 -16
- package/dist/3d-tiles/index.cjs +115 -390
- package/dist/3d-tiles/index.cjs.map +3 -3
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts +1 -2
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js +3 -4
- package/dist/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.js.map +1 -1
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts +4 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.d.ts.map +1 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js +36 -0
- package/dist/3d-tiles/lib/classes/helpers/tile-component-types.js.map +1 -0
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js +3 -4
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.js.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-batch-table.d.ts +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts +9 -5
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.d.ts.map +1 -1
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js +15 -12
- package/dist/3d-tiles/lib/classes/tile-3d-feature-table.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +0 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js +2 -4
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js +7 -7
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js +0 -2
- package/dist/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js +1 -2
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-batched-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js +13 -13
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.js.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js +22 -23
- package/dist/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.js.map +1 -1
- package/dist/3d-tiles/lib/utils/version.js +1 -1
- package/dist/3d-tiles/types.d.ts +7 -3
- package/dist/3d-tiles/types.d.ts.map +1 -1
- package/dist/3d-tiles-archive-writer.cjs +1 -1
- package/dist/copc/copc-loader.d.ts.map +1 -1
- package/dist/copc/copc-loader.js +10 -7
- package/dist/copc/copc-loader.js.map +1 -1
- package/dist/copc/copc-writer.d.ts +5 -4
- package/dist/copc/copc-writer.d.ts.map +1 -1
- package/dist/copc/copc-writer.js +1 -1
- package/dist/copc/copc-writer.js.map +1 -1
- package/dist/copc/index.cjs +809 -124
- package/dist/copc/index.cjs.map +3 -3
- package/dist/dist.dev.js +45 -77
- package/dist/dist.min.js +10 -10
- package/dist/i3s/arcgis-webscene-loader.js +1 -1
- package/dist/i3s/dist.dev.js +11915 -12119
- package/dist/i3s/dist.min.js +25 -25
- package/dist/i3s/i3s-attribute-loader.js +1 -1
- package/dist/i3s/i3s-building-scene-layer-loader.js +1 -1
- package/dist/i3s/i3s-content-loader.js +1 -1
- package/dist/i3s/i3s-lepcc-loader-types.js +1 -1
- package/dist/i3s/i3s-loader.js +1 -1
- package/dist/i3s/i3s-mesh-attributes.d.ts +2 -2
- package/dist/i3s/i3s-mesh-attributes.d.ts.map +1 -1
- package/dist/i3s/i3s-mesh-attributes.js +6 -11
- package/dist/i3s/i3s-mesh-attributes.js.map +1 -1
- package/dist/i3s/i3s-mesh-writer.js +2 -3
- package/dist/i3s/i3s-mesh-writer.js.map +1 -1
- package/dist/i3s/i3s-node-page-loader.js +1 -1
- package/dist/i3s/i3s-slpk-loader.js +1 -1
- package/dist/i3s/i3s-slpk-writer.js +1 -1
- package/dist/i3s/index.cjs +314 -442
- package/dist/i3s/index.cjs.map +3 -3
- package/dist/i3s/lib/parsers/constants.d.ts +0 -3
- package/dist/i3s/lib/parsers/constants.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/constants.js +0 -8
- package/dist/i3s/lib/parsers/constants.js.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.d.ts.map +1 -1
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js +1 -2
- package/dist/i3s/lib/parsers/parse-i3s-tile-content.js.map +1 -1
- package/dist/i3s/types.d.ts +0 -1
- package/dist/i3s/types.d.ts.map +1 -1
- package/dist/i3s-content-worker-node.js +11 -11
- package/dist/i3s-content-worker-node.js.map +4 -4
- package/dist/i3s-content-worker.js +485 -879
- package/dist/i3s-lepcc-worker-node.js +2 -2
- package/dist/i3s-lepcc-worker.js +2 -2
- package/dist/i3s-mesh-writer.cjs +87 -206
- package/dist/i3s-mesh-writer.cjs.map +3 -3
- package/dist/i3s-slpk-writer.cjs +1 -1
- package/dist/index.cjs +44 -41
- package/dist/index.cjs.map +1 -1
- package/dist/point-cloud-tile-loader-types.js +1 -1
- package/dist/point-cloud-tile-loader.cjs +17 -28
- package/dist/point-cloud-tile-loader.cjs.map +1 -1
- package/dist/point-cloud-tile-source.cjs +16 -27
- package/dist/point-cloud-tile-source.cjs.map +1 -1
- package/dist/point-cloud-tile-source.js +2 -2
- package/dist/point-cloud-tile-source.js.map +1 -1
- package/dist/potree/dist.dev.js +985 -139
- package/dist/potree/dist.min.js +28 -28
- package/dist/potree/index.cjs +813 -140
- package/dist/potree/index.cjs.map +3 -3
- package/dist/potree/lib/potree-node-source.d.ts.map +1 -1
- package/dist/potree/lib/potree-node-source.js +2 -14
- package/dist/potree/lib/potree-node-source.js.map +1 -1
- package/dist/potree/parsers/parse-potree-bin.js +3 -3
- package/dist/potree/parsers/parse-potree-bin.js.map +1 -1
- package/dist/potree/potree-bin-loader.js +1 -1
- package/dist/potree/potree-hierarchy-chunk-loader.js +1 -1
- package/dist/potree/potree-loader-types.js +1 -1
- package/dist/potree/potree-writer.d.ts +3 -3
- package/dist/potree/potree-writer.d.ts.map +1 -1
- package/dist/potree/potree-writer.js +2 -2
- package/dist/potree/potree-writer.js.map +1 -1
- package/dist/potree/potree2-source.d.ts +1 -1
- package/dist/potree/potree2-source.d.ts.map +1 -1
- package/dist/potree/potree2-source.js +6 -3
- package/dist/potree/potree2-source.js.map +1 -1
- package/dist/potree-loader.cjs +817 -153
- package/dist/potree-loader.cjs.map +3 -3
- package/dist/tileset-3d/helpers/frame-state.d.ts +2 -1
- package/dist/tileset-3d/helpers/frame-state.d.ts.map +1 -1
- package/dist/tileset-3d/helpers/frame-state.js +41 -15
- package/dist/tileset-3d/helpers/frame-state.js.map +1 -1
- package/dist/types.d.ts +15 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/3d-tiles/lib/classes/helpers/tile-3d-accessor-utils.ts +3 -4
- package/src/3d-tiles/lib/classes/helpers/tile-component-types.ts +39 -0
- package/src/3d-tiles/lib/classes/tile-3d-batch-table-hierarchy.ts +3 -4
- package/src/3d-tiles/lib/classes/tile-3d-feature-table.ts +38 -14
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-colors.ts +2 -5
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-normals.ts +10 -10
- package/src/3d-tiles/lib/parsers/helpers/normalize-3d-tile-positions.ts +0 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-batched-model.ts +1 -2
- package/src/3d-tiles/lib/parsers/parse-3d-tile-instanced-model.ts +19 -19
- package/src/3d-tiles/lib/parsers/parse-3d-tile-point-cloud.ts +22 -23
- package/src/3d-tiles/types.ts +4 -3
- package/src/copc/copc-loader.ts +8 -8
- package/src/copc/copc-writer.ts +6 -5
- package/src/i3s/i3s-mesh-attributes.ts +9 -17
- package/src/i3s/i3s-mesh-writer.ts +4 -3
- package/src/i3s/lib/parsers/constants.ts +0 -9
- package/src/i3s/lib/parsers/parse-i3s-tile-content.ts +1 -2
- package/src/i3s/types.ts +0 -1
- package/src/point-cloud-tile-source.ts +2 -2
- package/src/potree/lib/potree-node-source.ts +2 -15
- package/src/potree/parsers/parse-potree-bin.ts +3 -3
- package/src/potree/potree-writer.ts +6 -11
- package/src/potree/potree2-source.ts +6 -3
- package/src/tileset-3d/helpers/frame-state.ts +43 -15
- package/src/types.ts +15 -0
|
@@ -8148,7 +8148,7 @@ var init_i3s_lepcc_loader_types = __esm({
|
|
|
8148
8148
|
"dist/i3s/i3s-lepcc-loader-types.js"() {
|
|
8149
8149
|
"use strict";
|
|
8150
8150
|
init_i3s_format();
|
|
8151
|
-
VERSION2 = true ? "5.0.0-beta.
|
|
8151
|
+
VERSION2 = true ? "5.0.0-beta.11" : "latest";
|
|
8152
8152
|
I3SLEPCCLoader = {
|
|
8153
8153
|
...I3SLEPCCFormat2,
|
|
8154
8154
|
dataType: null,
|
|
@@ -12553,7 +12553,7 @@ var I3SBuildingSceneLayerFormat = json(
|
|
|
12553
12553
|
);
|
|
12554
12554
|
|
|
12555
12555
|
// src/i3s/i3s-lepcc-loader-types.ts
|
|
12556
|
-
var VERSION3 = true ? "5.0.0-beta.
|
|
12556
|
+
var VERSION3 = true ? "5.0.0-beta.11" : "latest";
|
|
12557
12557
|
var I3SLEPCCLoader2 = {
|
|
12558
12558
|
...I3SLEPCCFormat,
|
|
12559
12559
|
dataType: null,
|
package/dist/i3s-lepcc-worker.js
CHANGED
|
@@ -568,7 +568,7 @@
|
|
|
568
568
|
"dist/i3s/i3s-lepcc-loader-types.js"() {
|
|
569
569
|
"use strict";
|
|
570
570
|
init_i3s_format();
|
|
571
|
-
VERSION = true ? "5.0.0-beta.
|
|
571
|
+
VERSION = true ? "5.0.0-beta.11" : "latest";
|
|
572
572
|
I3SLEPCCLoader = {
|
|
573
573
|
...I3SLEPCCFormat2,
|
|
574
574
|
dataType: null,
|
|
@@ -2241,7 +2241,7 @@
|
|
|
2241
2241
|
);
|
|
2242
2242
|
|
|
2243
2243
|
// src/i3s/i3s-lepcc-loader-types.ts
|
|
2244
|
-
var VERSION2 = true ? "5.0.0-beta.
|
|
2244
|
+
var VERSION2 = true ? "5.0.0-beta.11" : "latest";
|
|
2245
2245
|
var I3SLEPCCLoader2 = {
|
|
2246
2246
|
...I3SLEPCCFormat,
|
|
2247
2247
|
dataType: null,
|
package/dist/i3s-mesh-writer.cjs
CHANGED
|
@@ -1251,16 +1251,6 @@ var init_memory_conversion_utils = __esm({
|
|
|
1251
1251
|
}
|
|
1252
1252
|
});
|
|
1253
1253
|
|
|
1254
|
-
// ../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts
|
|
1255
|
-
function makeTableScanBatch(table) {
|
|
1256
|
-
return { ...table, batchType: "data", length: table.data.numRows };
|
|
1257
|
-
}
|
|
1258
|
-
var init_table_scan_batch = __esm({
|
|
1259
|
-
"../core/src/loader-utils/lib/scan-utils/table-scan-batch.ts"() {
|
|
1260
|
-
"use strict";
|
|
1261
|
-
}
|
|
1262
|
-
});
|
|
1263
|
-
|
|
1264
1254
|
// ../core/src/loader-utils/index.ts
|
|
1265
1255
|
var init_loader_utils = __esm({
|
|
1266
1256
|
"../core/src/loader-utils/index.ts"() {
|
|
@@ -1281,7 +1271,6 @@ var init_loader_utils = __esm({
|
|
|
1281
1271
|
init_text_iterators();
|
|
1282
1272
|
init_async_iteration();
|
|
1283
1273
|
init_memory_conversion_utils();
|
|
1284
|
-
init_table_scan_batch();
|
|
1285
1274
|
}
|
|
1286
1275
|
});
|
|
1287
1276
|
|
|
@@ -3147,7 +3136,7 @@ var init_convert_arrow_schema = __esm({
|
|
|
3147
3136
|
});
|
|
3148
3137
|
|
|
3149
3138
|
// ../core/src/lib/loader-utils/native-arrow.ts
|
|
3150
|
-
function
|
|
3139
|
+
function isArrowTable(value) {
|
|
3151
3140
|
return Boolean(
|
|
3152
3141
|
value && typeof value === "object" && "schema" in value && "batches" in value && Array.isArray(value.batches) && "numRows" in value && typeof value.numRows === "number" && "getChildAt" in value && typeof value.getChildAt === "function"
|
|
3153
3142
|
);
|
|
@@ -3196,11 +3185,20 @@ function mergeTypeMetadata(previous, next) {
|
|
|
3196
3185
|
}
|
|
3197
3186
|
return next;
|
|
3198
3187
|
}
|
|
3188
|
+
function snapshotArrowBatch(batch, schema) {
|
|
3189
|
+
const snapshot = new arrow2.RecordBatch(
|
|
3190
|
+
snapshotArrowSchema(schema),
|
|
3191
|
+
batch.data,
|
|
3192
|
+
new Map(batch.metadata)
|
|
3193
|
+
);
|
|
3194
|
+
if (snapshot.numRows !== batch.numRows) {
|
|
3195
|
+
Object.defineProperty(snapshot, "data", { value: batch.data });
|
|
3196
|
+
}
|
|
3197
|
+
return snapshot;
|
|
3198
|
+
}
|
|
3199
3199
|
function updateArrowTableSchema(table, schema) {
|
|
3200
3200
|
const snapshot = snapshotArrowSchema(schema);
|
|
3201
|
-
const batches = table.batches.map(
|
|
3202
|
-
(batch) => new arrow2.RecordBatch(snapshotArrowSchema(snapshot), batch.data, new Map(batch.metadata))
|
|
3203
|
-
);
|
|
3201
|
+
const batches = table.batches.map((batch) => snapshotArrowBatch(batch, snapshot));
|
|
3204
3202
|
return new arrow2.Table(
|
|
3205
3203
|
snapshot,
|
|
3206
3204
|
batches.length ? batches : [new arrow2.RecordBatch(snapshotArrowSchema(snapshot), void 0)]
|
|
@@ -3212,14 +3210,9 @@ function makeArrowMetadataBatch(schema) {
|
|
|
3212
3210
|
async function* refineArrowTableBatches(batches) {
|
|
3213
3211
|
let schema;
|
|
3214
3212
|
let bounds;
|
|
3215
|
-
for await (const
|
|
3216
|
-
const
|
|
3217
|
-
|
|
3218
|
-
yield batch;
|
|
3219
|
-
continue;
|
|
3220
|
-
}
|
|
3221
|
-
const localBounds = table.data.schema.metadata.get("boundingBox");
|
|
3222
|
-
const nextSchema = snapshotArrowSchema(table.data.schema);
|
|
3213
|
+
for await (const table of batches) {
|
|
3214
|
+
const localBounds = table.schema.metadata.get("boundingBox");
|
|
3215
|
+
const nextSchema = snapshotArrowSchema(table.schema);
|
|
3223
3216
|
if (localBounds) {
|
|
3224
3217
|
const nextBounds = JSON.parse(localBounds);
|
|
3225
3218
|
bounds = bounds ? [
|
|
@@ -3229,11 +3222,11 @@ async function* refineArrowTableBatches(batches) {
|
|
|
3229
3222
|
nextSchema.metadata.set("boundingBox", JSON.stringify(bounds));
|
|
3230
3223
|
}
|
|
3231
3224
|
schema = mergeArrowSchemas(schema, nextSchema);
|
|
3232
|
-
const data = updateArrowTableSchema(table
|
|
3225
|
+
const data = updateArrowTableSchema(table, schema);
|
|
3233
3226
|
if (localBounds) {
|
|
3234
3227
|
for (const recordBatch of data.batches) recordBatch.metadata.set("boundingBox", localBounds);
|
|
3235
3228
|
}
|
|
3236
|
-
yield
|
|
3229
|
+
yield data;
|
|
3237
3230
|
}
|
|
3238
3231
|
}
|
|
3239
3232
|
var arrow2;
|
|
@@ -3440,7 +3433,7 @@ var init_arrow_fixed_size_list_utils = __esm({
|
|
|
3440
3433
|
});
|
|
3441
3434
|
|
|
3442
3435
|
// ../core/src/schema-utils/lib/mesh/convert-mesh-to-table.ts
|
|
3443
|
-
function
|
|
3436
|
+
function convertMeshToArrowTable(mesh) {
|
|
3444
3437
|
var _a;
|
|
3445
3438
|
return makeMeshArrowTable(mesh.attributes, {
|
|
3446
3439
|
schema: mesh.schema,
|
|
@@ -3463,22 +3456,14 @@ function makeMeshArrowTable(attributes, options = {}) {
|
|
|
3463
3456
|
fields.push(
|
|
3464
3457
|
getAttributeArrowField(options.schema, attributeName, column, attribute.componentType)
|
|
3465
3458
|
);
|
|
3466
|
-
if (attributeName ===
|
|
3459
|
+
if (attributeName === attributeNames[0] && ((_b = (_a = options.indices) == null ? void 0 : _a.value) == null ? void 0 : _b.length)) {
|
|
3467
3460
|
const indicesField = indexedMeshArrowSchema.fields.find((field) => field.name === "indices");
|
|
3468
3461
|
columns.indices = getIndicesVector(options.indices.value, column.length, indicesField.type);
|
|
3469
3462
|
fields.push(indicesField);
|
|
3470
3463
|
}
|
|
3471
3464
|
}
|
|
3472
3465
|
const arrowSchema = new arrow5.Schema(fields, getMeshArrowMetadata(options));
|
|
3473
|
-
|
|
3474
|
-
const schema = serializeArrowSchema(table.schema);
|
|
3475
|
-
return {
|
|
3476
|
-
shape: "arrow-table",
|
|
3477
|
-
schema,
|
|
3478
|
-
data: table,
|
|
3479
|
-
topology: options.topology || "point-list",
|
|
3480
|
-
indices: options.indices
|
|
3481
|
-
};
|
|
3466
|
+
return ((_c = columns[attributeNames[0]]) == null ? void 0 : _c.length) === 0 ? new arrow5.Table(arrowSchema) : new arrow5.Table(arrowSchema, columns);
|
|
3482
3467
|
}
|
|
3483
3468
|
function getAttributeArrowVector(value, size, componentType) {
|
|
3484
3469
|
if (componentType === "float16") {
|
|
@@ -3605,19 +3590,11 @@ var init_convert_mesh_to_table = __esm({
|
|
|
3605
3590
|
|
|
3606
3591
|
// ../core/src/schema-utils/lib/mesh/convert-table-to-mesh.ts
|
|
3607
3592
|
function convertTableToMesh(table) {
|
|
3608
|
-
if (
|
|
3609
|
-
|
|
3610
|
-
// case 'columnar-table':
|
|
3611
|
-
// return convertColumnarTableToMesh(table);
|
|
3612
|
-
case "arrow-table":
|
|
3613
|
-
return convertArrowTableToMesh(table);
|
|
3614
|
-
default:
|
|
3615
|
-
throw new Error(table.shape);
|
|
3616
|
-
}
|
|
3593
|
+
if (isArrowTable(table)) return convertArrowTableToMesh(table);
|
|
3594
|
+
throw new Error(table.shape);
|
|
3617
3595
|
}
|
|
3618
|
-
function convertArrowTableToMesh(
|
|
3596
|
+
function convertArrowTableToMesh(arrowTable) {
|
|
3619
3597
|
var _a, _b;
|
|
3620
|
-
const arrowTable = isNativeArrowTable(table) ? table : table.data;
|
|
3621
3598
|
const schema = serializeArrowSchema(arrowTable.schema);
|
|
3622
3599
|
const localBounds = arrowTable.batches.length === 1 ? arrowTable.batches[0].metadata.get("boundingBox") : void 0;
|
|
3623
3600
|
if (localBounds) schema.metadata = { ...schema.metadata, boundingBox: localBounds };
|
|
@@ -3722,13 +3699,18 @@ function getAttributeTypedArray(attributeData, size) {
|
|
|
3722
3699
|
if (!(attributeData.type instanceof arrow6.FixedSizeList)) {
|
|
3723
3700
|
return attributeData.toArray();
|
|
3724
3701
|
}
|
|
3725
|
-
|
|
3702
|
+
if (attributeData.length === 0) {
|
|
3703
|
+
const EmptyStorage = attributeData.type.valueType.ArrayType;
|
|
3704
|
+
return new EmptyStorage(0);
|
|
3705
|
+
}
|
|
3706
|
+
const values = attributeData.data.find((chunk) => chunk.length > 0).children[0].values;
|
|
3726
3707
|
const TypedArrayConstructor = values.constructor;
|
|
3727
3708
|
const typedArray = new TypedArrayConstructor(attributeData.length * size);
|
|
3728
3709
|
let targetOffset = 0;
|
|
3729
3710
|
for (const data of attributeData.data) {
|
|
3730
|
-
const child = data.children[0];
|
|
3731
3711
|
const sourceLength = data.length * size;
|
|
3712
|
+
if (sourceLength === 0) continue;
|
|
3713
|
+
const child = data.children[0];
|
|
3732
3714
|
const sourceOffset = child.offset || data.offset * size;
|
|
3733
3715
|
const sourceStart = sourceOffset + sourceLength <= child.values.length ? sourceOffset : 0;
|
|
3734
3716
|
const source = child.values.subarray(sourceStart, sourceStart + sourceLength);
|
|
@@ -6116,27 +6098,6 @@ var init_obj_format = __esm({
|
|
|
6116
6098
|
});
|
|
6117
6099
|
|
|
6118
6100
|
// ../core/src/arrow-worker-transport.ts
|
|
6119
|
-
function serializeArrowWorkerTable(result) {
|
|
6120
|
-
if (!isArrowTableWrapper(result)) {
|
|
6121
|
-
throw new Error("Workers require Arrow table output");
|
|
6122
|
-
}
|
|
6123
|
-
const { data, shape: _shape, ...metadata3 } = result;
|
|
6124
|
-
return {
|
|
6125
|
-
transport: "arrow-column-envelope",
|
|
6126
|
-
metadata: structuredClone(metadata3),
|
|
6127
|
-
...serializeWorkerColumns(data, { copy: "all" })
|
|
6128
|
-
};
|
|
6129
|
-
}
|
|
6130
|
-
function deserializeArrowWorkerTable(result) {
|
|
6131
|
-
if (isArrowWorkerEnvelope(result)) {
|
|
6132
|
-
return { ...result.metadata, shape: "arrow-table", data: hydrateWorkerTable(result) };
|
|
6133
|
-
}
|
|
6134
|
-
if (isLegacyArrowWorkerEnvelope(result)) {
|
|
6135
|
-
const { arrowBatchMetadata: _snapshots, data: _columns, ...metadata3 } = result;
|
|
6136
|
-
return { ...metadata3, data: hydrateWorkerTable(result) };
|
|
6137
|
-
}
|
|
6138
|
-
throw new Error("Workers require Arrow column transport");
|
|
6139
|
-
}
|
|
6140
6101
|
function serializeNativeArrowWorkerResult(result, options = { copy: "all" }) {
|
|
6141
6102
|
const batch = result instanceof arrow7.RecordBatch;
|
|
6142
6103
|
if (!batch && !(result instanceof arrow7.Table)) {
|
|
@@ -6161,63 +6122,27 @@ function deserializeNativeArrowWorkerResult(result) {
|
|
|
6161
6122
|
function serializeArrowWorkerResult(result, options) {
|
|
6162
6123
|
var _a;
|
|
6163
6124
|
const workerOptions = options;
|
|
6164
|
-
const
|
|
6165
|
-
|
|
6166
|
-
return serializeNativeArrowWorkerResult(result, { copy: bufferCopyMode ?? "all" });
|
|
6167
|
-
}
|
|
6168
|
-
if (!isArrowTableWrapper(result)) {
|
|
6169
|
-
return result;
|
|
6170
|
-
}
|
|
6171
|
-
const { data, shape: _shape, ...metadata3 } = result;
|
|
6172
|
-
return {
|
|
6173
|
-
transport: "arrow-column-envelope",
|
|
6174
|
-
metadata: structuredClone(metadata3),
|
|
6175
|
-
...serializeWorkerColumns(data, bufferCopyMode ? { copy: bufferCopyMode } : void 0)
|
|
6176
|
-
};
|
|
6125
|
+
const copy = ((_a = workerOptions == null ? void 0 : workerOptions.core) == null ? void 0 : _a.workerTransferBufferCopy) ?? (workerOptions == null ? void 0 : workerOptions.workerTransferBufferCopy);
|
|
6126
|
+
return result instanceof arrow7.Table || result instanceof arrow7.RecordBatch ? serializeNativeArrowWorkerResult(result, { copy: copy ?? "all" }) : result;
|
|
6177
6127
|
}
|
|
6178
6128
|
function deserializeArrowWorkerResult(result) {
|
|
6179
6129
|
const transport = result == null ? void 0 : result.transport;
|
|
6180
|
-
|
|
6181
|
-
return deserializeNativeArrowWorkerResult(result);
|
|
6182
|
-
}
|
|
6183
|
-
return isArrowWorkerEnvelope(result) || isLegacyArrowWorkerEnvelope(result) ? deserializeArrowWorkerTable(result) : result;
|
|
6184
|
-
}
|
|
6185
|
-
function isArrowTableWrapper(value) {
|
|
6186
|
-
const table = value;
|
|
6187
|
-
return Boolean(
|
|
6188
|
-
table && table.shape === "arrow-table" && table.data && typeof table.data === "object" && "batches" in table.data
|
|
6189
|
-
);
|
|
6130
|
+
return transport === "arrow-table-columns" || transport === "arrow-record-batch" ? deserializeNativeArrowWorkerResult(result) : result;
|
|
6190
6131
|
}
|
|
6191
6132
|
function hasArrowWorkerColumns(value) {
|
|
6192
6133
|
var _a;
|
|
6193
6134
|
const columns = value;
|
|
6194
6135
|
return ((_a = columns == null ? void 0 : columns.data) == null ? void 0 : _a.transport) === "arrow-js" && Array.isArray(columns.data.batches);
|
|
6195
6136
|
}
|
|
6196
|
-
function isArrowWorkerEnvelope(value) {
|
|
6197
|
-
return (value == null ? void 0 : value.transport) === "arrow-column-envelope" && hasArrowWorkerColumns(value);
|
|
6198
|
-
}
|
|
6199
|
-
function isLegacyArrowWorkerEnvelope(value) {
|
|
6200
|
-
return (value == null ? void 0 : value.shape) === "arrow-table" && hasArrowWorkerColumns(value);
|
|
6201
|
-
}
|
|
6202
6137
|
function serializeWorkerColumns(table, options) {
|
|
6203
6138
|
return {
|
|
6204
6139
|
arrowBatchMetadata: snapshotBatchMetadata(table),
|
|
6205
|
-
data:
|
|
6140
|
+
data: (0, import_arrow.dehydrateArrowTable)(table, options)
|
|
6206
6141
|
};
|
|
6207
6142
|
}
|
|
6208
|
-
function dehydrateWorkerTable(table, options) {
|
|
6209
|
-
const payload = (0, import_arrow.dehydrateArrowTable)(table, options);
|
|
6210
|
-
if (table.numCols === 0) {
|
|
6211
|
-
for (const [index, batch] of table.batches.entries()) {
|
|
6212
|
-
payload.batches[index].length = batch.numRows;
|
|
6213
|
-
}
|
|
6214
|
-
}
|
|
6215
|
-
return payload;
|
|
6216
|
-
}
|
|
6217
6143
|
function snapshotBatchMetadata(table) {
|
|
6218
6144
|
return table.batches.map((batch) => ({
|
|
6219
|
-
schema: arrow7.tableToIPC(new arrow7.Table(batch.schema, []))
|
|
6220
|
-
metadata: Array.from(batch.metadata)
|
|
6145
|
+
schema: arrow7.tableToIPC(new arrow7.Table(batch.schema, []))
|
|
6221
6146
|
}));
|
|
6222
6147
|
}
|
|
6223
6148
|
function hydrateWorkerTable(result) {
|
|
@@ -6225,18 +6150,11 @@ function hydrateWorkerTable(result) {
|
|
|
6225
6150
|
const table = (0, import_arrow.hydrateArrowTable)(data);
|
|
6226
6151
|
const batches = table.batches.map((batch, index) => {
|
|
6227
6152
|
const snapshot = arrowBatchMetadata == null ? void 0 : arrowBatchMetadata[index];
|
|
6228
|
-
|
|
6153
|
+
return snapshot ? (0, import_arrow.createRecordBatchWithMetadata)(
|
|
6229
6154
|
arrow7.tableFromIPC(snapshot.schema).schema,
|
|
6230
6155
|
batch.data,
|
|
6231
|
-
new Map(snapshot.metadata)
|
|
6156
|
+
snapshot.metadata ? new Map(snapshot.metadata) : (0, import_arrow.getRecordBatchMetadata)(batch)
|
|
6232
6157
|
) : batch;
|
|
6233
|
-
const rowCount = data.batches[index].length;
|
|
6234
|
-
if (restored.numCols === 0 && restored.numRows !== rowCount) {
|
|
6235
|
-
Object.defineProperty(restored, "data", {
|
|
6236
|
-
value: new arrow7.Data(new arrow7.Struct([]), 0, rowCount, 0, void 0, [])
|
|
6237
|
-
});
|
|
6238
|
-
}
|
|
6239
|
-
return restored;
|
|
6240
6158
|
});
|
|
6241
6159
|
return new arrow7.Table(table.schema, batches);
|
|
6242
6160
|
}
|
|
@@ -6729,12 +6647,11 @@ var init_parse_obj = __esm({
|
|
|
6729
6647
|
// ../scene/src/obj/obj-loader.ts
|
|
6730
6648
|
var obj_loader_exports = {};
|
|
6731
6649
|
__export(obj_loader_exports, {
|
|
6732
|
-
OBJColumnLoader: () => OBJColumnLoader,
|
|
6733
6650
|
OBJLoaderWithParser: () => OBJLoaderWithParser
|
|
6734
6651
|
});
|
|
6735
6652
|
function convertOBJMesh(mesh, options) {
|
|
6736
6653
|
var _a;
|
|
6737
|
-
const table =
|
|
6654
|
+
const table = convertMeshToArrowTable(mesh);
|
|
6738
6655
|
return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertTableToMesh(table) : table;
|
|
6739
6656
|
}
|
|
6740
6657
|
function getNumericBatchSize(options) {
|
|
@@ -6748,11 +6665,11 @@ function hasOBJGeometryRecords(text) {
|
|
|
6748
6665
|
return trimmedLine.startsWith("f ") || trimmedLine.startsWith("l ");
|
|
6749
6666
|
});
|
|
6750
6667
|
}
|
|
6751
|
-
function* parseOBJPointCloudInBatches(text,
|
|
6668
|
+
function* parseOBJPointCloudInBatches(text, batchSize) {
|
|
6752
6669
|
const vertexLines = text.split(/\r?\n/).filter((line) => line.trimStart().startsWith("v "));
|
|
6753
|
-
yield* makeOBJPointCloudBatches(vertexLines,
|
|
6670
|
+
yield* makeOBJPointCloudBatches(vertexLines, batchSize);
|
|
6754
6671
|
}
|
|
6755
|
-
async function* parseOBJPointCloudLinesInBatches(lines,
|
|
6672
|
+
async function* parseOBJPointCloudLinesInBatches(lines, batchSize) {
|
|
6756
6673
|
const normalizedBatchSize = batchSize || 1e3;
|
|
6757
6674
|
let vertexLines = [];
|
|
6758
6675
|
for await (const line of lines) {
|
|
@@ -6761,21 +6678,21 @@ async function* parseOBJPointCloudLinesInBatches(lines, options, batchSize) {
|
|
|
6761
6678
|
}
|
|
6762
6679
|
vertexLines.push(line);
|
|
6763
6680
|
if (vertexLines.length >= normalizedBatchSize) {
|
|
6764
|
-
yield
|
|
6681
|
+
yield convertMeshToArrowTable(parseOBJPointCloudMesh(vertexLines));
|
|
6765
6682
|
vertexLines = [];
|
|
6766
6683
|
}
|
|
6767
6684
|
}
|
|
6768
6685
|
if (vertexLines.length > 0) {
|
|
6769
|
-
yield
|
|
6686
|
+
yield convertMeshToArrowTable(parseOBJPointCloudMesh(vertexLines));
|
|
6770
6687
|
}
|
|
6771
6688
|
}
|
|
6772
|
-
function* makeOBJPointCloudBatches(vertexLines,
|
|
6689
|
+
function* makeOBJPointCloudBatches(vertexLines, batchSize) {
|
|
6773
6690
|
const normalizedBatchSize = batchSize || vertexLines.length || 1;
|
|
6774
6691
|
for (let rowIndex = 0; rowIndex < vertexLines.length; rowIndex += normalizedBatchSize) {
|
|
6775
6692
|
const mesh = parseOBJPointCloudMesh(
|
|
6776
6693
|
vertexLines.slice(rowIndex, rowIndex + normalizedBatchSize)
|
|
6777
6694
|
);
|
|
6778
|
-
yield
|
|
6695
|
+
yield convertMeshToArrowTable(mesh);
|
|
6779
6696
|
}
|
|
6780
6697
|
}
|
|
6781
6698
|
function parseOBJPointCloudMesh(vertexLines) {
|
|
@@ -6810,31 +6727,20 @@ function parseOBJPointCloudMesh(vertexLines) {
|
|
|
6810
6727
|
attributes
|
|
6811
6728
|
};
|
|
6812
6729
|
}
|
|
6813
|
-
function
|
|
6814
|
-
|
|
6815
|
-
const table = convertMeshToArrowTableWrapper(mesh);
|
|
6816
|
-
if (((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh") {
|
|
6817
|
-
const convertedMesh = convertTableToMesh(table);
|
|
6818
|
-
return {
|
|
6819
|
-
shape: "mesh",
|
|
6820
|
-
batchType: "data",
|
|
6821
|
-
data: convertedMesh,
|
|
6822
|
-
length: ((_b = convertedMesh.header) == null ? void 0 : _b.vertexCount) || 0
|
|
6823
|
-
};
|
|
6824
|
-
}
|
|
6825
|
-
return makeTableScanBatch(table);
|
|
6730
|
+
function convertOBJBatchToMesh(table) {
|
|
6731
|
+
return { shape: "mesh", batchType: "data", data: convertTableToMesh(table), length: table.numRows };
|
|
6826
6732
|
}
|
|
6827
6733
|
function deserializeOBJWorkerResult(result, options) {
|
|
6828
6734
|
var _a;
|
|
6829
|
-
const table =
|
|
6735
|
+
const table = deserializeNativeArrowWorkerResult(result);
|
|
6736
|
+
if (!isArrowTable(table)) throw new Error("OBJ worker requires an Arrow table");
|
|
6830
6737
|
return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertTableToMesh(table) : table;
|
|
6831
6738
|
}
|
|
6832
6739
|
function deserializeOBJWorkerBatch(result, options) {
|
|
6833
6740
|
var _a;
|
|
6834
|
-
const
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
return { shape: "mesh", batchType: "data", data: mesh, length: table.length };
|
|
6741
|
+
const chunk = deserializeNativeArrowWorkerResult(result);
|
|
6742
|
+
const batch = isArrowTable(chunk) ? chunk.batches[0] ?? makeArrowMetadataBatch(chunk.schema) : chunk;
|
|
6743
|
+
return ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh" ? convertOBJBatchToMesh(new import_apache_arrow.Table(batch.schema, [batch])) : batch;
|
|
6838
6744
|
}
|
|
6839
6745
|
async function* parseOBJWithMetadataInBatches(arrayBuffer, options) {
|
|
6840
6746
|
var _a;
|
|
@@ -6842,28 +6748,23 @@ async function* parseOBJWithMetadataInBatches(arrayBuffer, options) {
|
|
|
6842
6748
|
if ((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.pointCloud) {
|
|
6843
6749
|
const textIterator = makeTextDecoderIterator(arrayBuffer);
|
|
6844
6750
|
const lineIterator = makeLineIterator(textIterator);
|
|
6845
|
-
yield* parseOBJPointCloudLinesInBatches(lineIterator,
|
|
6751
|
+
yield* parseOBJPointCloudLinesInBatches(lineIterator, batchSize);
|
|
6846
6752
|
return;
|
|
6847
6753
|
}
|
|
6848
6754
|
const data = await concatenateArrayBuffersAsync(arrayBuffer);
|
|
6849
6755
|
const text = new TextDecoder().decode(data);
|
|
6850
6756
|
if (hasOBJGeometryRecords(text)) {
|
|
6851
|
-
yield
|
|
6757
|
+
yield convertMeshToArrowTable(parseOBJ(text, options));
|
|
6852
6758
|
return;
|
|
6853
6759
|
}
|
|
6854
|
-
yield* parseOBJPointCloudInBatches(text,
|
|
6760
|
+
yield* parseOBJPointCloudInBatches(text, batchSize);
|
|
6855
6761
|
}
|
|
6856
|
-
|
|
6857
|
-
if ("shape" in result && result.shape === "arrow-table") {
|
|
6858
|
-
return result.data;
|
|
6859
|
-
}
|
|
6860
|
-
return result;
|
|
6861
|
-
}
|
|
6862
|
-
var _OBJLoaderPreload, OBJLoaderMetadataWithoutPreload, OBJColumnLoader, OBJLoaderWithParser;
|
|
6762
|
+
var import_apache_arrow, _OBJLoaderPreload, OBJLoaderMetadataWithoutPreload, OBJLoaderWithParser;
|
|
6863
6763
|
var init_obj_loader = __esm({
|
|
6864
6764
|
"../scene/src/obj/obj-loader.ts"() {
|
|
6865
6765
|
"use strict";
|
|
6866
6766
|
init_schema_utils();
|
|
6767
|
+
import_apache_arrow = require("apache-arrow");
|
|
6867
6768
|
init_loader_utils();
|
|
6868
6769
|
init_arrow_worker_transport();
|
|
6869
6770
|
init_schema_utils();
|
|
@@ -6871,37 +6772,24 @@ var init_obj_loader = __esm({
|
|
|
6871
6772
|
init_parse_obj();
|
|
6872
6773
|
init_obj_loader_types();
|
|
6873
6774
|
({ preload: _OBJLoaderPreload, ...OBJLoaderMetadataWithoutPreload } = OBJLoader);
|
|
6874
|
-
|
|
6775
|
+
OBJLoaderWithParser = {
|
|
6875
6776
|
...OBJLoaderMetadataWithoutPreload,
|
|
6876
|
-
dataType: null,
|
|
6877
|
-
batchType: null,
|
|
6878
6777
|
parse: async (arrayBuffer, options) => convertOBJMesh(parseOBJ(new TextDecoder().decode(arrayBuffer), options), options),
|
|
6879
6778
|
parseTextSync: (text, options) => convertOBJMesh(parseOBJ(text, options), options),
|
|
6880
|
-
parseInBatches: (input, options) => refineArrowTableBatches(parseOBJWithMetadataInBatches(input, options)),
|
|
6881
|
-
serializeWorkerResult: serializeArrowWorkerTable,
|
|
6882
|
-
deserializeWorkerResult: deserializeOBJWorkerResult,
|
|
6883
|
-
serializeWorkerBatch: serializeArrowWorkerTable,
|
|
6884
|
-
deserializeWorkerBatch: deserializeOBJWorkerBatch
|
|
6885
|
-
};
|
|
6886
|
-
OBJLoaderWithParser = {
|
|
6887
|
-
...OBJColumnLoader,
|
|
6888
|
-
dataType: OBJLoader.dataType,
|
|
6889
|
-
batchType: OBJLoader.batchType,
|
|
6890
|
-
parse: async (input, options) => unwrapOBJTable(await OBJColumnLoader.parse(input, options)),
|
|
6891
|
-
parseTextSync: (input, options) => unwrapOBJTable(OBJColumnLoader.parseTextSync(input, options)),
|
|
6892
6779
|
async *parseInBatches(input, options) {
|
|
6893
|
-
|
|
6894
|
-
|
|
6895
|
-
|
|
6896
|
-
|
|
6897
|
-
|
|
6780
|
+
var _a;
|
|
6781
|
+
for await (const chunk of refineArrowTableBatches(
|
|
6782
|
+
parseOBJWithMetadataInBatches(input, options)
|
|
6783
|
+
)) {
|
|
6784
|
+
if (((_a = options == null ? void 0 : options.obj) == null ? void 0 : _a.shape) === "mesh") yield convertOBJBatchToMesh(chunk);
|
|
6785
|
+
else if (chunk.batches.length) yield* chunk.batches;
|
|
6786
|
+
else yield makeArrowMetadataBatch(chunk.schema);
|
|
6898
6787
|
}
|
|
6899
6788
|
},
|
|
6900
|
-
|
|
6901
|
-
|
|
6902
|
-
|
|
6903
|
-
|
|
6904
|
-
}
|
|
6789
|
+
serializeWorkerResult: (result) => serializeNativeArrowWorkerResult(result),
|
|
6790
|
+
deserializeWorkerResult: deserializeOBJWorkerResult,
|
|
6791
|
+
serializeWorkerBatch: (batch) => serializeNativeArrowWorkerResult(batch),
|
|
6792
|
+
deserializeWorkerBatch: deserializeOBJWorkerBatch
|
|
6905
6793
|
};
|
|
6906
6794
|
}
|
|
6907
6795
|
});
|
|
@@ -6919,7 +6807,6 @@ var init_obj_loader_types = __esm({
|
|
|
6919
6807
|
"../scene/src/obj/obj-loader-types.ts"() {
|
|
6920
6808
|
"use strict";
|
|
6921
6809
|
init_obj_format();
|
|
6922
|
-
init_arrow_worker_transport();
|
|
6923
6810
|
VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
6924
6811
|
OBJLoader = {
|
|
6925
6812
|
defaultShape: "arrow",
|
|
@@ -6931,7 +6818,6 @@ var init_obj_loader_types = __esm({
|
|
|
6931
6818
|
worker: true,
|
|
6932
6819
|
/** Enables the stateful input/output batch protocol on the built-in worker. */
|
|
6933
6820
|
workerInBatches: true,
|
|
6934
|
-
serializeWorkerResult: serializeArrowWorkerTable,
|
|
6935
6821
|
text: true,
|
|
6936
6822
|
testText: testOBJFile,
|
|
6937
6823
|
options: {
|
|
@@ -7165,7 +7051,7 @@ function normalizeMeshArrowTable(data) {
|
|
|
7165
7051
|
if (!("attributes" in data)) {
|
|
7166
7052
|
return data;
|
|
7167
7053
|
}
|
|
7168
|
-
return
|
|
7054
|
+
return convertMeshToArrowTable(data);
|
|
7169
7055
|
}
|
|
7170
7056
|
function getRequiredAttribute(mesh, attributeName) {
|
|
7171
7057
|
const attribute = mesh.attributes[attributeName];
|
|
@@ -12806,7 +12692,7 @@ async function parseDraco(arrayBuffer, options, loadDecoderModule, context) {
|
|
|
12806
12692
|
const mesh = dracoParser.parseSync(arrayBuffer, options == null ? void 0 : options.draco);
|
|
12807
12693
|
reportProgress == null ? void 0 : reportProgress({ phase: "decode", completed: 1, total: 1, unit: "tasks" });
|
|
12808
12694
|
if (((_b = options == null ? void 0 : options.draco) == null ? void 0 : _b.shape) === "arrow") {
|
|
12809
|
-
return
|
|
12695
|
+
return convertMeshToArrowTable(mesh);
|
|
12810
12696
|
}
|
|
12811
12697
|
return mesh;
|
|
12812
12698
|
} finally {
|
|
@@ -17472,7 +17358,7 @@ function throwIfAborted(signal) {
|
|
|
17472
17358
|
throw error;
|
|
17473
17359
|
}
|
|
17474
17360
|
function normalizeDracoMesh(data) {
|
|
17475
|
-
if (
|
|
17361
|
+
if (isArrowTable(data)) {
|
|
17476
17362
|
return convertTableToMesh(data);
|
|
17477
17363
|
}
|
|
17478
17364
|
if (isDracoBuilderMesh(data)) {
|
|
@@ -17481,9 +17367,6 @@ function normalizeDracoMesh(data) {
|
|
|
17481
17367
|
const { indices, ...attributes } = data;
|
|
17482
17368
|
return { attributes, ...indices ? { indices } : {} };
|
|
17483
17369
|
}
|
|
17484
|
-
function isMeshArrowTable(data) {
|
|
17485
|
-
return typeof data === "object" && data !== null && "shape" in data && data.shape === "arrow-table";
|
|
17486
|
-
}
|
|
17487
17370
|
function isDracoBuilderMesh(data) {
|
|
17488
17371
|
return typeof data === "object" && data !== null && "attributes" in data && typeof data.attributes === "object" && data.attributes !== null && !ArrayBuffer.isView(data.attributes);
|
|
17489
17372
|
}
|
|
@@ -20059,8 +19942,8 @@ init_schema_utils();
|
|
|
20059
19942
|
function encodeI3SMeshAttributes(features, maxResourceBytes) {
|
|
20060
19943
|
var _a;
|
|
20061
19944
|
const batches = (features == null ? void 0 : features.batches) || [];
|
|
20062
|
-
const schema = (_a = batches[0]) == null ? void 0 : _a.schema;
|
|
20063
|
-
const count = batches.reduce((total, batch) => total + batch.
|
|
19945
|
+
const schema = ((_a = batches[0]) == null ? void 0 : _a.schema) && convertArrowToSchema(batches[0].schema);
|
|
19946
|
+
const count = batches.reduce((total, batch) => total + batch.numRows, 0);
|
|
20064
19947
|
if (features && (!schema || count === 0 || !schema.fields.length)) {
|
|
20065
19948
|
throw new Error("I3S features require nonempty explicit-schema Arrow batches");
|
|
20066
19949
|
}
|
|
@@ -20081,13 +19964,10 @@ function encodeI3SMeshAttributes(features, maxResourceBytes) {
|
|
|
20081
19964
|
}
|
|
20082
19965
|
const identifiers = /* @__PURE__ */ new Set();
|
|
20083
19966
|
for (const batch of batches) {
|
|
20084
|
-
if (JSON.stringify(batch.schema) !== JSON.stringify(schema)
|
|
20085
|
-
throw new Error("I3S feature batches must share an explicit schema
|
|
19967
|
+
if (JSON.stringify(convertArrowToSchema(batch.schema)) !== JSON.stringify(schema)) {
|
|
19968
|
+
throw new Error("I3S feature batches must share an explicit schema");
|
|
20086
19969
|
}
|
|
20087
|
-
const
|
|
20088
|
-
if (JSON.stringify(actualFields.map((field) => [field.name, field.type])) !== JSON.stringify(schema.fields.map((field) => [field.name, field.type])))
|
|
20089
|
-
throw new Error("I3S declared feature schema must match the Arrow column types");
|
|
20090
|
-
const column = batch.data.getChild(features.featureIdField);
|
|
19970
|
+
const column = batch.getChild(features.featureIdField);
|
|
20091
19971
|
if (!column)
|
|
20092
19972
|
throw new Error("Missing Arrow feature identifier column");
|
|
20093
19973
|
for (let index = 0; index < column.length; index++) {
|
|
@@ -20103,7 +19983,7 @@ function encodeI3SMeshAttributes(features, maxResourceBytes) {
|
|
|
20103
19983
|
throw new Error("I3S fields require unique identifiers other than reserved OBJECTID");
|
|
20104
19984
|
}
|
|
20105
19985
|
const values = batches.flatMap((batch) => {
|
|
20106
|
-
const column = batch.
|
|
19986
|
+
const column = batch.getChild(field.name);
|
|
20107
19987
|
if (!column)
|
|
20108
19988
|
throw new Error(`Missing Arrow column ${field.name}`);
|
|
20109
19989
|
return Array.from({ length: column.length }, (_, index) => column.get(index));
|
|
@@ -20285,7 +20165,7 @@ async function encodeI3SMeshLayerWithDraco(mesh, options, libraryOptions = {}) {
|
|
|
20285
20165
|
return compressMeshLayer(prepared, maxResourceBytes);
|
|
20286
20166
|
}
|
|
20287
20167
|
function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
20288
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j
|
|
20168
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
20289
20169
|
if (!Number.isFinite(options.maxPositionError) || options.maxPositionError < 0 || !Number.isSafeInteger(options.maxResourceBytes) || options.maxResourceBytes < 1 || options.maxResourceBytes > 4294967294) {
|
|
20290
20170
|
throw new Error("I3S mesh writing requires valid maxPositionError and maxResourceBytes");
|
|
20291
20171
|
}
|
|
@@ -20437,11 +20317,12 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20437
20317
|
}
|
|
20438
20318
|
};
|
|
20439
20319
|
const material = encodeMaterial(options.material);
|
|
20320
|
+
const featureClass = (_e = (_d = options.features) == null ? void 0 : _d.batches[0]) == null ? void 0 : _e.schema.metadata.get("loaders.gl:feature-class");
|
|
20440
20321
|
const layer = {
|
|
20441
20322
|
id: 0,
|
|
20442
20323
|
version: "1",
|
|
20443
20324
|
name: options.name || "Converted mesh",
|
|
20444
|
-
description:
|
|
20325
|
+
description: featureClass ? `Source feature metadata class: ${featureClass}` : void 0,
|
|
20445
20326
|
layerType: "3DObject",
|
|
20446
20327
|
spatialReference: { wkid: 4326 },
|
|
20447
20328
|
heightModelInfo: { heightModel: "ellipsoidal", heightUnit: "meter" },
|
|
@@ -20457,7 +20338,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20457
20338
|
"3dNodeIndexDocument",
|
|
20458
20339
|
"Geometry",
|
|
20459
20340
|
"Attributes",
|
|
20460
|
-
...((
|
|
20341
|
+
...((_f = options.material) == null ? void 0 : _f.baseColorTexture) ? ["Texture"] : []
|
|
20461
20342
|
],
|
|
20462
20343
|
extent,
|
|
20463
20344
|
indexCRS: "http://www.opengis.net/def/crs/EPSG/0/4326",
|
|
@@ -20468,7 +20349,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20468
20349
|
nodePages: { rootIndex: 0, nodesPerPage: 64, lodSelectionMetricType: "maxScreenThresholdSQ" },
|
|
20469
20350
|
geometryDefinitions: [{ topology: "triangle", geometryBuffers: [geometryBuffer] }],
|
|
20470
20351
|
materialDefinitions: [material],
|
|
20471
|
-
...((
|
|
20352
|
+
...((_g = options.material) == null ? void 0 : _g.baseColorTexture) ? {
|
|
20472
20353
|
textureSetDefinitions: [
|
|
20473
20354
|
{
|
|
20474
20355
|
formats: [
|
|
@@ -20491,7 +20372,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20491
20372
|
children: [],
|
|
20492
20373
|
parentNode: { id: "root", href: "../root", mbs, obb },
|
|
20493
20374
|
geometryData: [{ href: "./geometries/0" }],
|
|
20494
|
-
...((
|
|
20375
|
+
...((_h = options.material) == null ? void 0 : _h.baseColorTexture) ? { textureData: [{ href: "./textures/0" }] } : {},
|
|
20495
20376
|
attributeData: attributes.buffers.map((_, index) => ({ href: `./attributes/f_${index}/0` }))
|
|
20496
20377
|
};
|
|
20497
20378
|
const root = {
|
|
@@ -20513,7 +20394,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20513
20394
|
lodThreshold: 0,
|
|
20514
20395
|
children: [],
|
|
20515
20396
|
mesh: {
|
|
20516
|
-
material: { definition: 0, ...((
|
|
20397
|
+
material: { definition: 0, ...((_i = options.material) == null ? void 0 : _i.baseColorTexture) ? { resource: 1 } : {} },
|
|
20517
20398
|
geometry: { definition: 0, resource: 1, vertexCount: outputVertexCount, featureCount },
|
|
20518
20399
|
attribute: { resource: 1 }
|
|
20519
20400
|
}
|
|
@@ -20540,7 +20421,7 @@ function prepareMeshLayer(mesh, options, geometryEncoding = "raw") {
|
|
|
20540
20421
|
const objectIdView = new DataView(objectIds);
|
|
20541
20422
|
for (let index = 0; index < featureCount; index++)
|
|
20542
20423
|
objectIdView.setUint32(4 + index * 4, objectIdOffset + index, true);
|
|
20543
|
-
if ((
|
|
20424
|
+
if ((_j = options.material) == null ? void 0 : _j.baseColorTexture) {
|
|
20544
20425
|
const texture = options.material.baseColorTexture;
|
|
20545
20426
|
rawFiles[`nodes/1/textures/0.${texture.mimeType === "image/png" ? "png" : "jpg"}`] = new Uint8Array(texture.data).buffer;
|
|
20546
20427
|
}
|