From 1346cadfab13f9f4cf752cc390580a2bda5f63cf Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Tue, 14 May 2024 12:20:30 +0200 Subject: [PATCH 1/5] Minor fix for API extractor --- src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts | 2 ++ src/tools/tilesetProcessing/TilesetCombiner.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts b/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts index f5c94f5..628867f 100644 --- a/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts +++ b/src/tools/gltfExtensionsUtils/StructuralMetadataMerger.ts @@ -29,6 +29,8 @@ function log(object: any) { /** * A class for merging two glTF-Transform documents that may contain * the `EXT_structural_metadata` extension. + * + * @internal */ export class StructuralMetadataMerger { /** diff --git a/src/tools/tilesetProcessing/TilesetCombiner.ts b/src/tools/tilesetProcessing/TilesetCombiner.ts index 0d11622..541a815 100644 --- a/src/tools/tilesetProcessing/TilesetCombiner.ts +++ b/src/tools/tilesetProcessing/TilesetCombiner.ts @@ -287,7 +287,7 @@ export class TilesetCombiner { * combined tileset JSON (with the given name) is added * to the target. * - * @param tilesetTargetJsonFileName The name of the target file + * @param tilesetTargetJsonFileName - The name of the target file * that will contain the combined tileset JSON */ private copyResources(tilesetTargetJsonFileName: string): void { From 11f20eddfc6b81a528219501a1ce04d8d67c22f6 Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Tue, 14 May 2024 12:20:40 +0200 Subject: [PATCH 2/5] Update auto-generated API file --- etc/3d-tiles-tools.api.md | 181 +++++++++++++++++++++++++------------- 1 file changed, 121 insertions(+), 60 deletions(-) diff --git a/etc/3d-tiles-tools.api.md b/etc/3d-tiles-tools.api.md index ad5a9e5..9a0e876 100644 --- a/etc/3d-tiles-tools.api.md +++ b/etc/3d-tiles-tools.api.md @@ -733,7 +733,7 @@ export class ElementStructuralMetadata extends ExtensionProperty; // (undocumented) - getIndex(): number; + getIndex(): number | null; // (undocumented) getPropertyTable(): StructuralMetadataPropertyTable | null; // (undocumented) @@ -743,7 +743,7 @@ export class ElementStructuralMetadata extends ExtensionProperty; + static merge(inputGlbBuffers: Buffer[], schemaUriResolver: (schemaUri: string) => Promise): Promise; static process(inputGlb: Buffer, ...transforms: Transform[]): Promise; } @@ -1144,15 +1145,20 @@ export class InstanceFeaturesFeatureId extends ExtensionProperty { // Warning: (ae-forgotten-export) The symbol "FeatureIdAttribute" needs to be exported by the entry point index.d.ts // // (undocumented) - getAttribute(): FeatureIdAttribute; + getAttribute(): FeatureIdAttribute | null; // (undocumented) - protected getDefaults(): Nullable; + protected getDefaults(): Nullable & { + nullFeatureId: null; + label: null; + attribute: null; + propertyTable: null; + }; // (undocumented) getFeatureCount(): number; // (undocumented) - getLabel(): string; + getLabel(): string | null; // (undocumented) - getNullFeatureId(): number; + getNullFeatureId(): number | null; // (undocumented) getPropertyTable(): StructuralMetadataPropertyTable | null; // (undocumented) @@ -1162,13 +1168,13 @@ export class InstanceFeaturesFeatureId extends ExtensionProperty { // (undocumented) propertyType: "FeatureId"; // (undocumented) - setAttribute(attribute: FeatureIdAttribute): this; + setAttribute(attribute: FeatureIdAttribute | null): this; // (undocumented) setFeatureCount(featureCount: number): this; // (undocumented) - setLabel(label: string): this; + setLabel(label: string | null): this; // (undocumented) - setNullFeatureId(nullFeatureId: number): this; + setNullFeatureId(nullFeatureId: number | null): this; // (undocumented) setPropertyTable(propertyTable: StructuralMetadataPropertyTable | null): this; } @@ -1280,15 +1286,21 @@ export class MeshFeaturesFeatureId extends ExtensionProperty { // Warning: (ae-forgotten-export) The symbol "FeatureIdAttribute_2" needs to be exported by the entry point index.d.ts // // (undocumented) - getAttribute(): FeatureIdAttribute_2; + getAttribute(): FeatureIdAttribute_2 | null; // (undocumented) - protected getDefaults(): Nullable; + protected getDefaults(): Nullable & { + nullFeatureId: null; + label: null; + attribute: null; + texture: null; + propertyTable: null; + }; // (undocumented) getFeatureCount(): number; // (undocumented) - getLabel(): string; + getLabel(): string | null; // (undocumented) - getNullFeatureId(): number; + getNullFeatureId(): number | null; // (undocumented) getPropertyTable(): StructuralMetadataPropertyTable | null; // (undocumented) @@ -1300,13 +1312,13 @@ export class MeshFeaturesFeatureId extends ExtensionProperty { // (undocumented) propertyType: "FeatureId"; // (undocumented) - setAttribute(attribute: FeatureIdAttribute_2): this; + setAttribute(attribute: FeatureIdAttribute_2 | null): this; // (undocumented) setFeatureCount(featureCount: number): this; // (undocumented) - setLabel(label: string): this; + setLabel(label: string | null): this; // (undocumented) - setNullFeatureId(nullFeatureId: number): this; + setNullFeatureId(nullFeatureId: number | null): this; // (undocumented) setPropertyTable(propertyTable: StructuralMetadataPropertyTable | null): this; // (undocumented) @@ -1832,6 +1844,8 @@ export class StructuralMetadata extends ExtensionProperty { extensionName: typeof NAME; // (undocumented) protected getDefaults(): Nullable & { + schema: null; + schemaUri: null; propertyTables: never[]; propertyTextures: never[]; propertyAttributes: never[]; @@ -1839,7 +1853,7 @@ export class StructuralMetadata extends ExtensionProperty { // (undocumented) getSchema(): StructuralMetadataSchema | null; // (undocumented) - getSchemaUri(): string; + getSchemaUri(): string | null; // (undocumented) protected init(): void; // (undocumented) @@ -1861,7 +1875,7 @@ export class StructuralMetadata extends ExtensionProperty { // (undocumented) setSchema(schema: StructuralMetadataSchema | null): this; // (undocumented) - setSchemaUri(name: string): this; + setSchemaUri(schemaUri: string | null): this; } // Warning: (ae-forgotten-export) The symbol "IClass" needs to be exported by the entry point index.d.ts @@ -1874,12 +1888,14 @@ export class StructuralMetadataClass extends ExtensionProperty { extensionName: typeof NAME; // (undocumented) protected getDefaults(): Nullable & { + objectName: null; + description: null; properties: {}; }; // (undocumented) - getDescription(): string; + getDescription(): string | null; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // (undocumented) getProperty(key: string): StructuralMetadataClassProperty | null; // (undocumented) @@ -1893,9 +1909,9 @@ export class StructuralMetadataClass extends ExtensionProperty { // (undocumented) propertyType: "Class"; // (undocumented) - setDescription(description: string): this; + setDescription(description: string | null): this; // (undocumented) - setObjectName(name: string): this; + setObjectName(name: string | null): this; // (undocumented) setProperty(key: string, value: StructuralMetadataClassProperty | null): this; } @@ -1913,21 +1929,32 @@ export class StructuralMetadataClassProperty extends ExtensionProperty & { - array: boolean; - normalized: boolean; - required: boolean; + objectName: null; + description: null; + componentType: null; + enumType: null; + array: null; + count: null; + normalized: null; + offset: null; + scale: null; + max: null; + min: null; + required: null; + noData: null; + default: null; }; // (undocumented) - getDescription(): string; + getDescription(): string | null; // (undocumented) - getEnumType(): string; + getEnumType(): string | null; // (undocumented) getMax(): any; // (undocumented) @@ -1937,7 +1964,7 @@ export class StructuralMetadataClassProperty extends ExtensionProperty { extensionName: typeof NAME; // (undocumented) protected getDefaults(): Nullable & { + objectName: null; + description: null; valueType: string; values: never[]; }; // (undocumented) - getDescription(): string; + getDescription(): string | null; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // Warning: (ae-forgotten-export) The symbol "EnumValueType" needs to be exported by the entry point index.d.ts // // (undocumented) @@ -2020,9 +2049,9 @@ export class StructuralMetadataEnum extends ExtensionProperty { // (undocumented) removeEnumValue(enumValue: StructuralMetadataEnumValue): this; // (undocumented) - setDescription(description: string): this; + setDescription(description: string | null): this; // (undocumented) - setObjectName(name: string): this; + setObjectName(name: string | null): this; // (undocumented) setValueType(valueType: EnumValueType): this; } @@ -2036,9 +2065,11 @@ export class StructuralMetadataEnumValue extends ExtensionProperty { // (undocumented) extensionName: typeof NAME; // (undocumented) - protected getDefaults(): Nullable; + protected getDefaults(): Nullable & { + description: null; + }; // (undocumented) - getDescription(): string; + getDescription(): string | null; // (undocumented) getObjectName(): string; // (undocumented) @@ -2050,13 +2081,19 @@ export class StructuralMetadataEnumValue extends ExtensionProperty { // (undocumented) propertyType: "EnumValue"; // (undocumented) - setDescription(description: string): this; + setDescription(description: string | null): this; // (undocumented) setObjectName(name: string): this; // (undocumented) setValue(value: number): this; } +// @public +export class StructuralMetadataMerger { + static mergeDocumentsWithStructuralMetadata(targetDocument: Document, sourceDocument: Document, schemaUriResolver: (schemaUri: string) => Promise): Promise; + static setMergedSchemaIdSuffix(mergedSchemaIdSuffix: string | undefined): void; +} + // Warning: (ae-forgotten-export) The symbol "IPropertyAttribute" needs to be exported by the entry point index.d.ts // // @internal @@ -2069,10 +2106,11 @@ export class StructuralMetadataPropertyAttribute extends ExtensionProperty & { + objectName: null; properties: {}; }; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // (undocumented) getProperty(key: string): StructuralMetadataPropertyAttributeProperty | null; // (undocumented) @@ -2088,7 +2126,7 @@ export class StructuralMetadataPropertyAttribute extends ExtensionProperty; + protected getDefaults(): Nullable & { + offset: null; + scale: null; + max: null; + min: null; + }; // (undocumented) getMax(): any; // (undocumented) @@ -2145,10 +2188,11 @@ export class StructuralMetadataPropertyTable extends ExtensionProperty & { + objectName: null; properties: {}; }; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // (undocumented) getProperty(key: string): StructuralMetadataPropertyTableProperty | null; // (undocumented) @@ -2166,7 +2210,7 @@ export class StructuralMetadataPropertyTable extends ExtensionProperty & { - arrayOffsetType: string; - stringOffsetType: string; + arrayOffsets: null; + stringOffsets: null; + arrayOffsetType: null; + stringOffsetType: null; + offset: null; + scale: null; + max: null; + min: null; }; // (undocumented) getMax(): any; @@ -2245,10 +2295,11 @@ export class StructuralMetadataPropertyTexture extends ExtensionProperty & { + objectName: null; properties: {}; }; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // (undocumented) getProperty(key: string): StructuralMetadataPropertyTextureProperty | null; // (undocumented) @@ -2264,7 +2315,7 @@ export class StructuralMetadataPropertyTexture extends ExtensionProperty { getClass(key: string): StructuralMetadataClass | null; // (undocumented) protected getDefaults(): Nullable & { + objectName: null; + description: null; + version: null; classes: {}; enums: {}; }; // (undocumented) - getDescription(): string; + getDescription(): string | null; // (undocumented) getEnum(key: string): StructuralMetadataEnum | null; // (undocumented) getId(): string; // (undocumented) - getObjectName(): string; + getObjectName(): string | null; // (undocumented) - getVersion(): string; + getVersion(): string | null; // (undocumented) protected init(): void; // (undocumented) @@ -2359,15 +2417,15 @@ export class StructuralMetadataSchema extends ExtensionProperty { // (undocumented) setClass(key: string, value: StructuralMetadataClass | null): this; // (undocumented) - setDescription(description: string): this; + setDescription(description: string | null): this; // (undocumented) setEnum(key: string, value: StructuralMetadataEnum | null): this; // (undocumented) setId(name: string): this; // (undocumented) - setObjectName(name: string): this; + setObjectName(name: string | null): this; // (undocumented) - setVersion(version: string): this; + setVersion(version: string | null): this; } // @internal @@ -2623,7 +2681,8 @@ export class TileFormats { export class TileFormatsMigration { static applyRtcCenter(document: Document, rtcCenter: number[]): void; static convertB3dmToGlb(b3dmBuffer: Buffer): Promise; - static convertI3dmToGlb(i3dmBuffer: Buffer, externalGlbResolver: (uri: string) => Promise): Promise; + static convertCmptToGlb(cmptBuffer: Buffer, externalResourceResolver: (uri: string) => Promise): Promise; + static convertI3dmToGlb(i3dmBuffer: Buffer, externalResourceResolver: (uri: string) => Promise): Promise; static convertPntsToGlb(pntsBuffer: Buffer): Promise; // (undocumented) static readonly DEBUG_LOG_FILE_CONTENT = false; @@ -2637,7 +2696,7 @@ export class TileFormatsMigrationB3dm { // @internal export class TileFormatsMigrationI3dm { - static convertI3dmToGlb(i3dmBuffer: Buffer, externalGlbResolver: (uri: string) => Promise): Promise; + static convertI3dmToGlb(i3dmBuffer: Buffer, externalResourceResolver: (uri: string) => Promise): Promise; } // @internal @@ -2724,6 +2783,7 @@ export class TilesetInMemory implements TilesetSource, TilesetTarget { // @internal export class TilesetJsonCreator { + static computeTransformFromCartographicPositionDegrees(cartographicPositionDegrees: number[]): number[]; static createTilesetFromContents(baseDir: string, contentUris: string[]): Promise; } @@ -2941,6 +3001,7 @@ export type TilesetUpgradeOptions = { upgradePntsToGlb: boolean; upgradeB3dmToGlb: boolean; upgradeI3dmToGlb: boolean; + upgradeCmptToGlb: boolean; }; // @internal @@ -2995,7 +3056,7 @@ export class TileTableDataPnts { // @internal export class TileTableDataToMeshFeatures { - static convertBatchIdToMeshFeatures(document: Document, primitive: Primitive): MeshFeaturesFeatureId; + static convertBatchIdToMeshFeatures(document: Document, primitive: Primitive, batchIdToFeatureIdAccessor: Map): MeshFeaturesFeatureId; } // @internal From e00ed496990074693cd459e1b44203043adb2551 Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Tue, 14 May 2024 12:20:57 +0200 Subject: [PATCH 3/5] Update CHANGES.md --- CHANGES.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index acd12f6..8283532 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,9 +1,12 @@ Change Log ========== -### 0.4.2 - yyyy-mm-dd +### 0.4.2 - 2024-05-15 -- The `createTilesetJson` command has been extended to receive an optional cartographic position, which serves as the position of generated tileset. +- When upgrading a tileset to version 1.1, then the `upgrade` command did not yet convert CMPT files into GLB. This functionality was now added via [#117](https://github.com/CesiumGS/3d-tiles-tools/pull/117), including an attempt to merge multiple GLB files that contain the Cesium glTF metadata extensions. Details of the merge process are not yet specified, but should cover the most common cases that appear during the conversion of CMPT files. +- When upgrading B3DM to GLB, it was possible that the GLB that was contained in the B3DM contained the same accessor for the batch ID attribute in multiple mesh primitives. This could cause the data to be duplicated during the conversion to feature IDs. This was fixed in [#124](https://github.com/CesiumGS/3d-tiles-tools/pull/124). +- Fixed a bug where the `combine` operation discarded the transforms and bounding volumes of the input tilesets ([#113](https://github.com/CesiumGS/3d-tiles-tools/pull/113)). +- The `createTilesetJson` command has been extended to receive an optional cartographic position, which serves as the position of generated tileset ([#105](https://github.com/CesiumGS/3d-tiles-tools/pull/105)). ### 0.4.1 - 2024-02-20 From 426521adc9c00ff09b4ad97f2a57cdc1b04818a6 Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Tue, 14 May 2024 12:21:08 +0200 Subject: [PATCH 4/5] Update version number in package JSON --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index cbddcbd..7b1ac2b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "3d-tiles-tools", - "version": "0.4.1", + "version": "0.4.2", "license": "Apache-2.0", "description": "3D Tiles tools", "author": { From d5d509b03c766e255b1f76b7dadc4b0129c52c16 Mon Sep 17 00:00:00 2001 From: Marco Hutter Date: Tue, 14 May 2024 12:22:50 +0200 Subject: [PATCH 5/5] Update auto-generated API definition file --- etc/3d-tiles-tools.api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/3d-tiles-tools.api.md b/etc/3d-tiles-tools.api.md index 9a0e876..09fa6cb 100644 --- a/etc/3d-tiles-tools.api.md +++ b/etc/3d-tiles-tools.api.md @@ -2088,7 +2088,7 @@ export class StructuralMetadataEnumValue extends ExtensionProperty { setValue(value: number): this; } -// @public +// @internal export class StructuralMetadataMerger { static mergeDocumentsWithStructuralMetadata(targetDocument: Document, sourceDocument: Document, schemaUriResolver: (schemaUri: string) => Promise): Promise; static setMergedSchemaIdSuffix(mergedSchemaIdSuffix: string | undefined): void;