@loaders.gl/gltf 4.0.0-alpha.12 → 4.0.0-alpha.14
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/es5/index.js.map +1 -1
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/es5/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/es5/lib/types/gltf-types.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/esm/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/esm/lib/types/gltf-types.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -1
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +1 -0
- package/dist/lib/types/gltf-json-schema.d.ts +152 -79
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/dist/lib/types/gltf-types.d.ts +1 -1
- package/dist/lib/types/gltf-types.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +22 -4
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +26 -24
- package/src/lib/types/gltf-json-schema.ts +183 -107
- package/src/lib/types/gltf-types.ts +1 -3
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/* eslint-disable camelcase */
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
GLTF,
|
|
4
|
+
GLTF_EXT_feature_metadata_Class,
|
|
5
|
+
GLTF_EXT_feature_metadata_ClassProperty,
|
|
6
|
+
GLTF_EXT_feature_metadata_FeatureTable,
|
|
7
|
+
GLTF_EXT_feature_metadata_FeatureTableProperty,
|
|
8
|
+
GLTF_EXT_feature_metadata_FeatureTexture,
|
|
9
|
+
GLTF_EXT_feature_metadata_GLTF,
|
|
10
|
+
GLTF_EXT_feature_metadata_TextureAccessor
|
|
11
|
+
} from '../../types/gltf-json-schema';
|
|
3
12
|
import {GLTFScenegraph} from '../../api/gltf-scenegraph';
|
|
4
13
|
import {getImageData} from '@loaders.gl/images';
|
|
5
|
-
import {
|
|
6
|
-
ClassProperty,
|
|
7
|
-
EXT_feature_metadata_class_object,
|
|
8
|
-
EXT_feature_metadata_feature_table,
|
|
9
|
-
FeatureTableProperty,
|
|
10
|
-
GLTF_EXT_feature_metadata,
|
|
11
|
-
EXT_feature_metadata_feature_texture,
|
|
12
|
-
FeatureTextureProperty,
|
|
13
|
-
GLTFMeshPrimitive
|
|
14
|
-
} from '../../types/gltf-json-schema';
|
|
14
|
+
import {GLTFMeshPrimitive} from '../../types/gltf-json-schema';
|
|
15
15
|
import {getComponentTypeFromArray} from '../../gltf-utils/gltf-utils';
|
|
16
16
|
import {GLTFLoaderOptions} from '../../../gltf-loader';
|
|
17
17
|
|
|
@@ -30,7 +30,8 @@ export async function decode(gltfData: {json: GLTF}, options: GLTFLoaderOptions)
|
|
|
30
30
|
* @param scenegraph
|
|
31
31
|
*/
|
|
32
32
|
function decodeExtFeatureMetadata(scenegraph: GLTFScenegraph, options: GLTFLoaderOptions): void {
|
|
33
|
-
const extension:
|
|
33
|
+
const extension: GLTF_EXT_feature_metadata_GLTF | null =
|
|
34
|
+
scenegraph.getExtension(EXT_FEATURE_METADATA);
|
|
34
35
|
if (!extension) return;
|
|
35
36
|
|
|
36
37
|
const schemaClasses = extension.schema?.classes;
|
|
@@ -68,8 +69,8 @@ function decodeExtFeatureMetadata(scenegraph: GLTFScenegraph, options: GLTFLoade
|
|
|
68
69
|
*/
|
|
69
70
|
function handleFeatureTableProperties(
|
|
70
71
|
scenegraph: GLTFScenegraph,
|
|
71
|
-
featureTable:
|
|
72
|
-
schemaClass:
|
|
72
|
+
featureTable: GLTF_EXT_feature_metadata_FeatureTable,
|
|
73
|
+
schemaClass: GLTF_EXT_feature_metadata_Class
|
|
73
74
|
): void {
|
|
74
75
|
for (const propertyName in schemaClass.properties) {
|
|
75
76
|
const schemaProperty = schemaClass.properties[propertyName];
|
|
@@ -97,8 +98,8 @@ function handleFeatureTableProperties(
|
|
|
97
98
|
*/
|
|
98
99
|
function handleFeatureTextureProperties(
|
|
99
100
|
scenegraph: GLTFScenegraph,
|
|
100
|
-
featureTexture:
|
|
101
|
-
schemaClass:
|
|
101
|
+
featureTexture: GLTF_EXT_feature_metadata_FeatureTexture,
|
|
102
|
+
schemaClass: GLTF_EXT_feature_metadata_Class
|
|
102
103
|
): void {
|
|
103
104
|
const attributeName = featureTexture.class;
|
|
104
105
|
|
|
@@ -121,9 +122,9 @@ function handleFeatureTextureProperties(
|
|
|
121
122
|
*/
|
|
122
123
|
function getPropertyDataFromBinarySource(
|
|
123
124
|
scenegraph: GLTFScenegraph,
|
|
124
|
-
schemaProperty:
|
|
125
|
+
schemaProperty: GLTF_EXT_feature_metadata_ClassProperty,
|
|
125
126
|
numberOfFeatures: number,
|
|
126
|
-
featureTableProperty:
|
|
127
|
+
featureTableProperty: GLTF_EXT_feature_metadata_FeatureTableProperty
|
|
127
128
|
): Uint8Array | string[] {
|
|
128
129
|
const bufferView = featureTableProperty.bufferView;
|
|
129
130
|
// TODO think maybe we shouldn't get data only in Uint8Array format.
|
|
@@ -151,7 +152,7 @@ function getPropertyDataFromBinarySource(
|
|
|
151
152
|
*/
|
|
152
153
|
function getPropertyDataFromTexture(
|
|
153
154
|
scenegraph: GLTFScenegraph,
|
|
154
|
-
featureTextureProperty:
|
|
155
|
+
featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,
|
|
155
156
|
attributeName: string
|
|
156
157
|
): number[] {
|
|
157
158
|
const json = scenegraph.gltf.json;
|
|
@@ -182,10 +183,11 @@ function getPropertyDataFromTexture(
|
|
|
182
183
|
* @param featureTextureTable
|
|
183
184
|
* @param primitive
|
|
184
185
|
*/
|
|
186
|
+
// eslint-disable-next-line max-statements
|
|
185
187
|
function processPrimitiveTextures(
|
|
186
188
|
scenegraph: GLTFScenegraph,
|
|
187
189
|
attributeName: string,
|
|
188
|
-
featureTextureProperty:
|
|
190
|
+
featureTextureProperty: GLTF_EXT_feature_metadata_TextureAccessor,
|
|
189
191
|
featureTextureTable: number[],
|
|
190
192
|
primitive: GLTFMeshPrimitive
|
|
191
193
|
): void {
|
|
@@ -342,9 +344,9 @@ function emod(n: number): number {
|
|
|
342
344
|
* @param schemaClassName
|
|
343
345
|
*/
|
|
344
346
|
function findFeatureTableByName(
|
|
345
|
-
featureTables: {[key: string]:
|
|
347
|
+
featureTables: {[key: string]: GLTF_EXT_feature_metadata_FeatureTable},
|
|
346
348
|
schemaClassName: string
|
|
347
|
-
):
|
|
349
|
+
): GLTF_EXT_feature_metadata_FeatureTable | null {
|
|
348
350
|
for (const featureTableName in featureTables) {
|
|
349
351
|
const featureTable = featureTables[featureTableName];
|
|
350
352
|
|
|
@@ -357,9 +359,9 @@ function findFeatureTableByName(
|
|
|
357
359
|
}
|
|
358
360
|
|
|
359
361
|
function findFeatureTextureByName(
|
|
360
|
-
featureTextures: {[key: string]:
|
|
362
|
+
featureTextures: {[key: string]: GLTF_EXT_feature_metadata_FeatureTexture},
|
|
361
363
|
schemaClassName: string
|
|
362
|
-
):
|
|
364
|
+
): GLTF_EXT_feature_metadata_FeatureTexture | null {
|
|
363
365
|
for (const featureTexturesName in featureTextures) {
|
|
364
366
|
const featureTable = featureTextures[featureTexturesName];
|
|
365
367
|
|
|
@@ -709,6 +709,20 @@ export type GLTF = {
|
|
|
709
709
|
[k: string]: unknown;
|
|
710
710
|
};
|
|
711
711
|
|
|
712
|
+
export type GLTFObject =
|
|
713
|
+
| GLTFAccessor
|
|
714
|
+
| GLTFBuffer
|
|
715
|
+
| GLTFBufferView
|
|
716
|
+
| GLTFMeshPrimitive
|
|
717
|
+
| GLTFMesh
|
|
718
|
+
| GLTFNode
|
|
719
|
+
| GLTFMaterial
|
|
720
|
+
| GLTFSampler
|
|
721
|
+
| GLTFScene
|
|
722
|
+
| GLTFSkin
|
|
723
|
+
| GLTFTexture
|
|
724
|
+
| GLTFImage;
|
|
725
|
+
|
|
712
726
|
// GLTF Extensions
|
|
713
727
|
/* eslint-disable camelcase */
|
|
714
728
|
|
|
@@ -780,50 +794,98 @@ export type GLTF_MSFT_texture_dds = {
|
|
|
780
794
|
};
|
|
781
795
|
|
|
782
796
|
/**
|
|
783
|
-
*
|
|
784
|
-
*
|
|
797
|
+
* EXT_mesh_features extension types
|
|
798
|
+
* This is a primitive-level extension
|
|
799
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features
|
|
800
|
+
*
|
|
801
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/mesh.primitive.EXT_mesh_features.schema.json
|
|
802
|
+
* An object describing feature IDs for a mesh primitive.
|
|
785
803
|
*/
|
|
786
804
|
export type GLTF_EXT_mesh_features = {
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
label: string;
|
|
791
|
-
attribute: any;
|
|
792
|
-
texture: any;
|
|
793
|
-
propertyTable: number;
|
|
794
|
-
}[];
|
|
795
|
-
extensions?: any;
|
|
805
|
+
/** An array of feature ID sets. */
|
|
806
|
+
featureIds: GLTF_EXT_mesh_features_featureId[];
|
|
807
|
+
extensions?: Record<string, any>;
|
|
796
808
|
extras?: any;
|
|
797
|
-
[key: string]: any;
|
|
798
809
|
};
|
|
799
810
|
|
|
800
811
|
/**
|
|
812
|
+
* JSON Schema https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/featureId.schema.json
|
|
813
|
+
* Feature IDs stored in an attribute or texture.
|
|
814
|
+
*/
|
|
815
|
+
export type GLTF_EXT_mesh_features_featureId = {
|
|
816
|
+
/** The number of unique features in the attribute or texture. */
|
|
817
|
+
featureCount: number;
|
|
818
|
+
/** A value that indicates that no feature is associated with this vertex or texel. */
|
|
819
|
+
nullFeatureId: number;
|
|
820
|
+
/** A label assigned to this feature ID set. Labels must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */
|
|
821
|
+
label: string;
|
|
822
|
+
/**
|
|
823
|
+
* An attribute containing feature IDs. When `attribute` and `texture` are omitted the feature IDs are assigned to vertices by their index.
|
|
824
|
+
* Schema https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdAttribute.schema.json
|
|
825
|
+
* An integer value used to construct a string in the format `_FEATURE_ID_<set index>` which is a reference to a key in `mesh.primitives.attributes`
|
|
826
|
+
* (e.g. a value of `0` corresponds to `_FEATURE_ID_0`).
|
|
827
|
+
*/
|
|
828
|
+
attribute: number;
|
|
829
|
+
/** A texture containing feature IDs. */
|
|
830
|
+
texture: any;
|
|
831
|
+
/** The index of the property table containing per-feature property values. Only applicable when using the `EXT_structural_metadata` extension. */
|
|
832
|
+
propertyTable: number;
|
|
833
|
+
extensions?: Record<string, any>;
|
|
834
|
+
extras?: any;
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* JSON Schema https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdTexture.schema.json
|
|
839
|
+
* Feature ID Texture in EXT_mesh_features
|
|
840
|
+
*/
|
|
841
|
+
export type GLTF_EXT_mesh_features_featureIdTexture = {
|
|
842
|
+
/**
|
|
843
|
+
* Texture channels containing feature IDs, identified by index. Feature IDs may be packed into multiple channels if a single channel does not have sufficient
|
|
844
|
+
* bit depth to represent all feature ID values. The values are packed in little-endian order.
|
|
845
|
+
*/
|
|
846
|
+
channels: number[];
|
|
847
|
+
/** Texture index in the glTF textures array */
|
|
848
|
+
index: number;
|
|
849
|
+
/** Textcoord index in the primitive attribute (eg. 0 for TEXTCOORD_0, 1 for TEXTCOORD_1 etc...) */
|
|
850
|
+
texCoord: number;
|
|
851
|
+
extensions: Record<string, any>;
|
|
852
|
+
extras: any;
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
/**
|
|
856
|
+
* EXT_feature_metadata extension types
|
|
857
|
+
* This extension has glTF-level metadata and primitive-level feature indexing and segmentation metadata
|
|
858
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata
|
|
859
|
+
*
|
|
860
|
+
* glTF-level metadata
|
|
801
861
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#gltf-extension-1
|
|
862
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/glTF.EXT_feature_metadata.schema.json
|
|
802
863
|
*/
|
|
803
|
-
export type
|
|
864
|
+
export type GLTF_EXT_feature_metadata_GLTF = {
|
|
804
865
|
/** An object defining classes and enums. */
|
|
805
|
-
schema?:
|
|
866
|
+
schema?: GLTF_EXT_feature_metadata_Schema;
|
|
806
867
|
/** A uri to an external schema file. */
|
|
807
868
|
schemaUri?: string;
|
|
808
869
|
/** An object containing statistics about features. */
|
|
809
|
-
statistics?:
|
|
870
|
+
statistics?: GLTF_EXT_feature_metadata_Statistics;
|
|
810
871
|
/** A dictionary, where each key is a feature table ID and each value is an object defining the feature table. */
|
|
811
872
|
featureTables?: {
|
|
812
|
-
[key: string]:
|
|
873
|
+
[key: string]: GLTF_EXT_feature_metadata_FeatureTable;
|
|
813
874
|
};
|
|
814
875
|
/** A dictionary, where each key is a feature texture ID and each value is an object defining the feature texture. */
|
|
815
876
|
featureTextures?: {
|
|
816
|
-
[key: string]:
|
|
877
|
+
[key: string]: GLTF_EXT_feature_metadata_FeatureTexture;
|
|
817
878
|
};
|
|
818
879
|
extensions?: Record<string, any>;
|
|
819
880
|
extras?: any;
|
|
820
|
-
[key: string]: any;
|
|
821
881
|
};
|
|
822
882
|
|
|
823
883
|
/**
|
|
884
|
+
* An object defining classes and enums.
|
|
824
885
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#schema
|
|
886
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/schema.schema.json
|
|
825
887
|
*/
|
|
826
|
-
type
|
|
888
|
+
export type GLTF_EXT_feature_metadata_Schema = {
|
|
827
889
|
/** The name of the schema. */
|
|
828
890
|
name?: string;
|
|
829
891
|
/** The description of the schema. */
|
|
@@ -832,38 +894,40 @@ type ExtFeatureMetadataSchema = {
|
|
|
832
894
|
version?: string;
|
|
833
895
|
/** A dictionary, where each key is a class ID and each value is an object defining the class. */
|
|
834
896
|
classes?: {
|
|
835
|
-
[key: string]:
|
|
897
|
+
[key: string]: GLTF_EXT_feature_metadata_Class;
|
|
836
898
|
};
|
|
837
899
|
/** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */
|
|
838
900
|
enums?: {
|
|
839
|
-
[key: string]:
|
|
901
|
+
[key: string]: GLTF_EXT_feature_metadata_Enum;
|
|
840
902
|
};
|
|
841
903
|
extensions?: Record<string, any>;
|
|
842
904
|
extras?: any;
|
|
843
|
-
[key: string]: any;
|
|
844
905
|
};
|
|
845
906
|
|
|
846
907
|
/**
|
|
908
|
+
* A class containing a set of properties.
|
|
847
909
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class
|
|
910
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/class.schema.json
|
|
848
911
|
*/
|
|
849
|
-
export type
|
|
912
|
+
export type GLTF_EXT_feature_metadata_Class = {
|
|
850
913
|
/** The name of the class, e.g. for display purposes. */
|
|
851
914
|
name?: string;
|
|
852
915
|
/** The description of the class. */
|
|
853
916
|
description?: string;
|
|
854
917
|
/** A dictionary, where each key is a property ID and each value is an object defining the property. */
|
|
855
918
|
properties: {
|
|
856
|
-
[key: string]:
|
|
919
|
+
[key: string]: GLTF_EXT_feature_metadata_ClassProperty;
|
|
857
920
|
};
|
|
858
921
|
extensions?: Record<string, any>;
|
|
859
922
|
extras?: any;
|
|
860
|
-
[key: string]: any;
|
|
861
923
|
};
|
|
862
924
|
|
|
863
925
|
/**
|
|
864
|
-
*
|
|
926
|
+
* A class property.
|
|
927
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-property
|
|
928
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/class.property.schema.json
|
|
865
929
|
*/
|
|
866
|
-
export type
|
|
930
|
+
export type GLTF_EXT_feature_metadata_ClassProperty = {
|
|
867
931
|
/** The name of the property, e.g. for display purposes. */
|
|
868
932
|
name?: string;
|
|
869
933
|
/** The description of the property. */
|
|
@@ -873,7 +937,22 @@ export type ClassProperty = {
|
|
|
873
937
|
* If ARRAY is used, then componentType must also be specified.
|
|
874
938
|
* ARRAY is a fixed-length array when componentCount is defined, and variable-length otherwise.
|
|
875
939
|
*/
|
|
876
|
-
type:
|
|
940
|
+
type:
|
|
941
|
+
| 'INT8'
|
|
942
|
+
| 'UINT8'
|
|
943
|
+
| 'INT16'
|
|
944
|
+
| 'UINT16'
|
|
945
|
+
| 'INT32'
|
|
946
|
+
| 'UINT32'
|
|
947
|
+
| 'INT64'
|
|
948
|
+
| 'UINT64'
|
|
949
|
+
| 'FLOAT32'
|
|
950
|
+
| 'FLOAT64'
|
|
951
|
+
| 'BOOLEAN'
|
|
952
|
+
| 'STRING'
|
|
953
|
+
| 'ENUM'
|
|
954
|
+
| 'ARRAY'
|
|
955
|
+
| string;
|
|
877
956
|
/**
|
|
878
957
|
* An enum ID as declared in the enums dictionary.
|
|
879
958
|
* This value must be specified when type or componentType is ENUM.
|
|
@@ -896,7 +975,8 @@ export type ClassProperty = {
|
|
|
896
975
|
| 'FLOAT64'
|
|
897
976
|
| 'BOOLEAN'
|
|
898
977
|
| 'STRING'
|
|
899
|
-
| 'ENUM'
|
|
978
|
+
| 'ENUM'
|
|
979
|
+
| string;
|
|
900
980
|
/** The number of components per element for ARRAY elements. */
|
|
901
981
|
componentCount?: number;
|
|
902
982
|
/**
|
|
@@ -923,7 +1003,6 @@ export type ClassProperty = {
|
|
|
923
1003
|
* The normalized property has no effect on these values: they always correspond to the integer values.
|
|
924
1004
|
*/
|
|
925
1005
|
min?: number | number[];
|
|
926
|
-
|
|
927
1006
|
/**
|
|
928
1007
|
* A default value to use when the property value is not defined.
|
|
929
1008
|
* If used, optional must be set to true.
|
|
@@ -942,32 +1021,14 @@ export type ClassProperty = {
|
|
|
942
1021
|
semantic?: string;
|
|
943
1022
|
extensions?: Record<string, any>;
|
|
944
1023
|
extras?: any;
|
|
945
|
-
[key: string]: any;
|
|
946
1024
|
};
|
|
947
1025
|
|
|
948
1026
|
/**
|
|
949
|
-
*
|
|
950
|
-
*/
|
|
951
|
-
type ClassPropertyType =
|
|
952
|
-
| 'INT8'
|
|
953
|
-
| 'UINT8'
|
|
954
|
-
| 'INT16'
|
|
955
|
-
| 'UINT16'
|
|
956
|
-
| 'INT32'
|
|
957
|
-
| 'UINT32'
|
|
958
|
-
| 'INT64'
|
|
959
|
-
| 'UINT64'
|
|
960
|
-
| 'FLOAT32'
|
|
961
|
-
| 'FLOAT64'
|
|
962
|
-
| 'BOOLEAN'
|
|
963
|
-
| 'STRING'
|
|
964
|
-
| 'ENUM'
|
|
965
|
-
| 'ARRAY';
|
|
966
|
-
|
|
967
|
-
/**
|
|
1027
|
+
* An object defining the values of an enum.
|
|
968
1028
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum
|
|
1029
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/enum.schema.json
|
|
969
1030
|
*/
|
|
970
|
-
type
|
|
1031
|
+
export type GLTF_EXT_feature_metadata_Enum = {
|
|
971
1032
|
/** The name of the enum, e.g. for display purposes. */
|
|
972
1033
|
name?: string;
|
|
973
1034
|
/** The description of the enum. */
|
|
@@ -975,16 +1036,18 @@ type ExtFeatureMetadataEnum = {
|
|
|
975
1036
|
/** The type of the integer enum value. */
|
|
976
1037
|
valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: "UINT16"
|
|
977
1038
|
/** An array of enum values. Duplicate names or duplicate integer values are not allowed. */
|
|
978
|
-
values:
|
|
1039
|
+
values: GLTF_EXT_feature_metadata_EnumValue[];
|
|
979
1040
|
extensions?: Record<string, any>;
|
|
980
1041
|
extras?: any;
|
|
981
1042
|
[key: string]: any;
|
|
982
1043
|
};
|
|
983
1044
|
|
|
984
1045
|
/**
|
|
1046
|
+
* An enum value.
|
|
985
1047
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#enum-value
|
|
1048
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata/schema/enum.value.schema.json
|
|
986
1049
|
*/
|
|
987
|
-
type
|
|
1050
|
+
export type GLTF_EXT_feature_metadata_EnumValue = {
|
|
988
1051
|
/** The name of the enum value. */
|
|
989
1052
|
name: string;
|
|
990
1053
|
/** The description of the enum value. */
|
|
@@ -997,10 +1060,11 @@ type EnumValue = {
|
|
|
997
1060
|
};
|
|
998
1061
|
|
|
999
1062
|
/**
|
|
1063
|
+
* A feature table defined by a class and property values stored in arrays.
|
|
1000
1064
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table
|
|
1065
|
+
* JSON Schenma - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.schema.json
|
|
1001
1066
|
*/
|
|
1002
|
-
export type
|
|
1003
|
-
featureTable: any;
|
|
1067
|
+
export type GLTF_EXT_feature_metadata_FeatureTable = {
|
|
1004
1068
|
/** The class that property values conform to. The value must be a class ID declared in the classes dictionary. */
|
|
1005
1069
|
class?: string;
|
|
1006
1070
|
/** The number of features, as well as the number of elements in each property array. */
|
|
@@ -1011,17 +1075,18 @@ export type EXT_feature_metadata_feature_table = {
|
|
|
1011
1075
|
* Optional properties may be excluded from this dictionary.
|
|
1012
1076
|
*/
|
|
1013
1077
|
properties?: {
|
|
1014
|
-
[key: string]:
|
|
1078
|
+
[key: string]: GLTF_EXT_feature_metadata_FeatureTableProperty;
|
|
1015
1079
|
};
|
|
1016
1080
|
extensions?: Record<string, any>;
|
|
1017
1081
|
extras?: any;
|
|
1018
|
-
[key: string]: any;
|
|
1019
1082
|
};
|
|
1020
1083
|
|
|
1021
1084
|
/**
|
|
1085
|
+
* An array of binary property values.
|
|
1022
1086
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-table-property
|
|
1087
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTable.property.schema.json
|
|
1023
1088
|
*/
|
|
1024
|
-
export type
|
|
1089
|
+
export type GLTF_EXT_feature_metadata_FeatureTableProperty = {
|
|
1025
1090
|
/**
|
|
1026
1091
|
* The index of the buffer view containing property values.
|
|
1027
1092
|
* The data type of property values is determined by the property definition:
|
|
@@ -1062,15 +1127,18 @@ export type FeatureTableProperty = {
|
|
|
1062
1127
|
* The buffer view byteOffset must be aligned to a multiple of 8 bytes in the same manner as the main bufferView.
|
|
1063
1128
|
*/
|
|
1064
1129
|
stringOffsetBufferView?: number;
|
|
1130
|
+
/** This is not part of the spec. GLTFLoader loads feature tables data into this property */
|
|
1131
|
+
data: any;
|
|
1065
1132
|
extensions?: Record<string, any>;
|
|
1066
1133
|
extras?: any;
|
|
1067
|
-
[key: string]: any;
|
|
1068
1134
|
};
|
|
1069
1135
|
|
|
1070
1136
|
/**
|
|
1137
|
+
* Features whose property values are stored directly in texture channels. This is not to be confused with feature ID textures which store feature IDs for use with a feature table.
|
|
1071
1138
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-texture
|
|
1139
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureTexture.schema.json
|
|
1072
1140
|
*/
|
|
1073
|
-
type
|
|
1141
|
+
export type GLTF_EXT_feature_metadata_FeatureTexture = {
|
|
1074
1142
|
/** The class this feature texture conforms to. The value must be a class ID declared in the classes dictionary. */
|
|
1075
1143
|
class: string;
|
|
1076
1144
|
/**
|
|
@@ -1078,48 +1146,51 @@ type FeatureTexture = {
|
|
|
1078
1146
|
* and each value describes the texture channels containing property values.
|
|
1079
1147
|
*/
|
|
1080
1148
|
properties: {
|
|
1081
|
-
[key: string]:
|
|
1149
|
+
[key: string]: GLTF_EXT_feature_metadata_TextureAccessor;
|
|
1082
1150
|
};
|
|
1083
1151
|
extensions?: Record<string, any>;
|
|
1084
1152
|
extras?: any;
|
|
1085
|
-
[key: string]: any;
|
|
1086
1153
|
};
|
|
1087
|
-
export type {FeatureTexture as EXT_feature_metadata_feature_texture};
|
|
1088
|
-
export type {TextureAccessor as FeatureTextureProperty};
|
|
1089
1154
|
|
|
1090
1155
|
/**
|
|
1156
|
+
* A description of how to access property values from the color channels of a texture.
|
|
1091
1157
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#texture-accessor
|
|
1158
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/textureAccessor.schema.json
|
|
1092
1159
|
*/
|
|
1093
|
-
type
|
|
1160
|
+
export type GLTF_EXT_feature_metadata_TextureAccessor = {
|
|
1094
1161
|
/** Texture channels containing property values. Channels are labeled by rgba and are swizzled with a string of 1-4 characters. */
|
|
1095
1162
|
channels: string;
|
|
1096
1163
|
/** The glTF texture and texture coordinates to use. */
|
|
1097
1164
|
texture: GLTFTextureInfo;
|
|
1165
|
+
/** This is not part of the spec. GLTFLoader loads feature tables data into this property */
|
|
1166
|
+
data: any;
|
|
1098
1167
|
extensions?: Record<string, any>;
|
|
1099
1168
|
extras?: any;
|
|
1100
|
-
[key: string]: any;
|
|
1101
1169
|
};
|
|
1102
1170
|
|
|
1103
1171
|
/**
|
|
1172
|
+
* Statistics about features.
|
|
1104
1173
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#statistics-1
|
|
1174
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.schema.json
|
|
1105
1175
|
*/
|
|
1106
|
-
type
|
|
1176
|
+
export type GLTF_EXT_feature_metadata_Statistics = {
|
|
1107
1177
|
/**
|
|
1108
1178
|
* A dictionary, where each key is a class ID declared in the classes dictionary
|
|
1109
1179
|
* and each value is an object containing statistics about features that conform to the class.
|
|
1110
1180
|
*/
|
|
1111
1181
|
classes?: {
|
|
1112
|
-
[key: string]:
|
|
1182
|
+
[key: string]: GLTF_EXT_feature_metadata_StatisticsClass;
|
|
1113
1183
|
};
|
|
1114
1184
|
extensions?: Record<string, any>;
|
|
1115
1185
|
extras?: any;
|
|
1116
|
-
[key: string]: any;
|
|
1117
1186
|
};
|
|
1118
1187
|
|
|
1119
1188
|
/**
|
|
1189
|
+
* Statistics about features that conform to the class.
|
|
1120
1190
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#class-statistics
|
|
1191
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.class.property.schema.json
|
|
1121
1192
|
*/
|
|
1122
|
-
type
|
|
1193
|
+
export type GLTF_EXT_feature_metadata_StatisticsClass = {
|
|
1123
1194
|
/** The number of features that conform to the class. */
|
|
1124
1195
|
count?: number;
|
|
1125
1196
|
/**
|
|
@@ -1127,22 +1198,22 @@ type ClassStatistics = {
|
|
|
1127
1198
|
* and each value is an object containing statistics about property values.
|
|
1128
1199
|
*/
|
|
1129
1200
|
properties?: {
|
|
1130
|
-
[key: string]:
|
|
1201
|
+
[key: string]: GLTF_EXT_feature_metadata_StatisticsClassProperty;
|
|
1131
1202
|
};
|
|
1132
1203
|
extensions?: Record<string, any>;
|
|
1133
1204
|
extras?: any;
|
|
1134
|
-
[key: string]: any;
|
|
1135
1205
|
};
|
|
1136
1206
|
|
|
1137
1207
|
/**
|
|
1138
|
-
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#property-statistics
|
|
1139
1208
|
* min, max, mean, median, standardDeviation, variance, sum are
|
|
1140
1209
|
* only applicable for numeric types and fixed-length arrays of numeric types.
|
|
1141
1210
|
* For numeric types this is a single number.
|
|
1142
1211
|
* For fixed-length arrays this is an array with componentCount number of elements.
|
|
1143
1212
|
* The normalized property has no effect on these values.
|
|
1213
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#property-statistics
|
|
1214
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/statistics.class.property.schema.json
|
|
1144
1215
|
*/
|
|
1145
|
-
type
|
|
1216
|
+
export type GLTF_EXT_feature_metadata_StatisticsClassProperty = {
|
|
1146
1217
|
/** The minimum property value. */
|
|
1147
1218
|
min?: number | number[];
|
|
1148
1219
|
/** The maximum property value. */
|
|
@@ -1167,42 +1238,48 @@ type StatisticsClassProperty = {
|
|
|
1167
1238
|
};
|
|
1168
1239
|
extensions?: Record<string, any>;
|
|
1169
1240
|
extras?: any;
|
|
1170
|
-
[key: string]: any;
|
|
1171
1241
|
};
|
|
1172
1242
|
|
|
1173
1243
|
/**
|
|
1174
|
-
*
|
|
1244
|
+
* EXT_feature_metadata extension types
|
|
1245
|
+
* This extension has glTF-level metadata and primitive-level (feature indexing and segmentation) metadata
|
|
1246
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata
|
|
1247
|
+
*
|
|
1248
|
+
* primitive-level metadata
|
|
1175
1249
|
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#primitive-extension
|
|
1250
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/mesh.primitive.EXT_feature_metadata.schema.json
|
|
1176
1251
|
*/
|
|
1177
|
-
export type
|
|
1252
|
+
export type GLTF_EXT_feature_metadata_Primitive = {
|
|
1178
1253
|
/** Feature ids definition in attributes */
|
|
1179
|
-
featureIdAttributes?:
|
|
1254
|
+
featureIdAttributes?: GLTF_EXT_feature_metadata_FeatureIdAttribute[];
|
|
1180
1255
|
/** Feature ids definition in textures */
|
|
1181
|
-
featureIdTextures?:
|
|
1256
|
+
featureIdTextures?: GLTF_EXT_feature_metadata_FeatureIdTexture[];
|
|
1182
1257
|
/** An array of IDs of feature textures from the root EXT_feature_metadata object. */
|
|
1183
1258
|
featureTextures?: string[];
|
|
1184
1259
|
extensions?: Record<string, any>;
|
|
1185
1260
|
extras?: any;
|
|
1186
|
-
[key: string]: any;
|
|
1187
1261
|
};
|
|
1188
1262
|
|
|
1189
1263
|
/**
|
|
1190
1264
|
* Attribute which described featureIds definition.
|
|
1265
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-id-attribute
|
|
1266
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdAttribute.schema.json
|
|
1191
1267
|
*/
|
|
1192
|
-
export type
|
|
1268
|
+
export type GLTF_EXT_feature_metadata_FeatureIdAttribute = {
|
|
1193
1269
|
/** Name of feature table */
|
|
1194
1270
|
featureTable: string;
|
|
1195
1271
|
/** Described how feature ids are defined */
|
|
1196
|
-
featureIds:
|
|
1272
|
+
featureIds: GLTF_EXT_feature_metadata_FeatureIdAttributeFeatureIds;
|
|
1197
1273
|
extensions?: Record<string, any>;
|
|
1198
1274
|
extras?: any;
|
|
1199
|
-
[key: string]: any;
|
|
1200
1275
|
};
|
|
1201
1276
|
|
|
1202
1277
|
/**
|
|
1203
1278
|
* Defining featureIds by attributes or implicitly.
|
|
1279
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#primitive-extensionfeatureidattributes
|
|
1280
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdAttribute.featureIds.schema.json
|
|
1204
1281
|
*/
|
|
1205
|
-
type
|
|
1282
|
+
export type GLTF_EXT_feature_metadata_FeatureIdAttributeFeatureIds = {
|
|
1206
1283
|
/** Name of attribute where featureIds are defined */
|
|
1207
1284
|
attribute?: string;
|
|
1208
1285
|
/** Sets a constant feature ID for each vertex. The default is 0. */
|
|
@@ -1213,32 +1290,31 @@ type ExtFeatureMetadataFeatureIds = {
|
|
|
1213
1290
|
* The default is 0
|
|
1214
1291
|
*/
|
|
1215
1292
|
divisor?: number;
|
|
1216
|
-
/** gLTF textureInfo object - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json */
|
|
1217
|
-
texture?: ExtFeatureMetadataTexture;
|
|
1218
|
-
/** Must be a single channel ("r", "g", "b", or "a") */
|
|
1219
|
-
channels?: 'r' | 'g' | 'b' | 'a';
|
|
1220
1293
|
};
|
|
1221
1294
|
|
|
1222
1295
|
/**
|
|
1223
|
-
*
|
|
1296
|
+
* An object describing a texture used for storing per-texel feature IDs.
|
|
1297
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#feature-id-texture
|
|
1298
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/featureIdTexture.schema.json
|
|
1224
1299
|
*/
|
|
1225
|
-
type
|
|
1226
|
-
/** The
|
|
1227
|
-
|
|
1228
|
-
/**
|
|
1229
|
-
|
|
1300
|
+
export type GLTF_EXT_feature_metadata_FeatureIdTexture = {
|
|
1301
|
+
/** The ID of the feature table in the model's root `EXT_feature_metadata.featureTables` dictionary. */
|
|
1302
|
+
featureTable: string;
|
|
1303
|
+
/** A description of the texture and channel to use for feature IDs. The `channels` property must have a single channel. Furthermore,
|
|
1304
|
+
* feature IDs must be whole numbers in the range `[0, count - 1]` (inclusive), where `count` is the total number of features
|
|
1305
|
+
* in the feature table. Texel values must be read as integers. Texture filtering should be disabled when fetching feature IDs.
|
|
1306
|
+
*/
|
|
1307
|
+
featureIds: GLTF_EXT_feature_metadata_FeatureIdTextureAccessor;
|
|
1230
1308
|
};
|
|
1231
1309
|
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
|
1242
|
-
|
|
1243
|
-
| GLTFTexture
|
|
1244
|
-
| GLTFImage;
|
|
1310
|
+
/**
|
|
1311
|
+
* A description of how to access property values from the color channels of a texture.
|
|
1312
|
+
* Spec - https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_feature_metadata#featureidtexturefeatureids
|
|
1313
|
+
* JSON Schema - https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_feature_metadata/schema/textureAccessor.schema.json
|
|
1314
|
+
*/
|
|
1315
|
+
export type GLTF_EXT_feature_metadata_FeatureIdTextureAccessor = {
|
|
1316
|
+
/** gLTF textureInfo object - https://github.com/CesiumGS/glTF/blob/3d-tiles-next/specification/2.0/schema/textureInfo.schema.json */
|
|
1317
|
+
texture: GLTFTextureInfo;
|
|
1318
|
+
/** Must be a single channel ("r", "g", "b", or "a") */
|
|
1319
|
+
channels: 'r' | 'g' | 'b' | 'a';
|
|
1320
|
+
};
|
|
@@ -48,9 +48,7 @@ export type {
|
|
|
48
48
|
GLTF_KHR_draco_mesh_compression,
|
|
49
49
|
GLTF_KHR_texture_basisu,
|
|
50
50
|
GLTF_EXT_meshopt_compression,
|
|
51
|
-
GLTF_EXT_texture_webp
|
|
52
|
-
GLTF_EXT_feature_metadata,
|
|
53
|
-
GLTF_EXT_mesh_features
|
|
51
|
+
GLTF_EXT_texture_webp
|
|
54
52
|
} from './gltf-json-schema';
|
|
55
53
|
|
|
56
54
|
export type {
|