@loaders.gl/gltf 4.0.0-alpha.22 → 4.0.0-alpha.24
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/dist.min.js +3626 -3028
- package/dist/es5/index.js +21 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/api/gltf-extensions.js +3 -1
- package/dist/es5/lib/api/gltf-extensions.js.map +1 -1
- package/dist/es5/lib/extensions/EXT_mesh_features.js +111 -0
- package/dist/es5/lib/extensions/EXT_mesh_features.js.map +1 -0
- package/dist/es5/lib/extensions/EXT_structural_metadata.js +388 -0
- package/dist/es5/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +32 -22
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/es5/lib/extensions/utils/3d-tiles-utils.js +200 -0
- package/dist/es5/lib/extensions/utils/3d-tiles-utils.js.map +1 -0
- package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js +2 -0
- package/dist/es5/lib/types/gltf-ext-mesh-features-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js +2 -0
- package/dist/es5/lib/types/gltf-ext-structural-metadata-schema.js.map +1 -0
- package/dist/es5/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/api/gltf-extensions.js +3 -1
- package/dist/esm/lib/api/gltf-extensions.js.map +1 -1
- package/dist/esm/lib/extensions/EXT_mesh_features.js +55 -0
- package/dist/esm/lib/extensions/EXT_mesh_features.js.map +1 -0
- package/dist/esm/lib/extensions/EXT_structural_metadata.js +324 -0
- package/dist/esm/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +30 -20
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- package/dist/esm/lib/extensions/utils/3d-tiles-utils.js +164 -0
- package/dist/esm/lib/extensions/utils/3d-tiles-utils.js.map +1 -0
- package/dist/esm/lib/types/gltf-ext-mesh-features-schema.js +2 -0
- package/dist/esm/lib/types/gltf-ext-mesh-features-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-ext-structural-metadata-schema.js +2 -0
- package/dist/esm/lib/types/gltf-ext-structural-metadata-schema.js.map +1 -0
- package/dist/esm/lib/types/gltf-json-schema.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/extensions/EXT_mesh_features.d.ts +7 -0
- package/dist/lib/extensions/EXT_mesh_features.d.ts.map +1 -0
- package/dist/lib/extensions/EXT_structural_metadata.d.ts +17 -0
- package/dist/lib/extensions/EXT_structural_metadata.d.ts.map +1 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -1
- package/dist/lib/extensions/utils/3d-tiles-utils.d.ts +52 -0
- package/dist/lib/extensions/utils/3d-tiles-utils.d.ts.map +1 -0
- package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts +45 -0
- package/dist/lib/types/gltf-ext-mesh-features-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-ext-structural-metadata-schema.d.ts +310 -0
- package/dist/lib/types/gltf-ext-structural-metadata-schema.d.ts.map +1 -0
- package/dist/lib/types/gltf-json-schema.d.ts +12 -58
- package/dist/lib/types/gltf-json-schema.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/index.ts +11 -3
- package/src/lib/api/gltf-extensions.ts +6 -2
- package/src/lib/extensions/EXT_mesh_features.ts +117 -0
- package/src/lib/extensions/EXT_structural_metadata.ts +797 -0
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +129 -36
- package/src/lib/extensions/utils/3d-tiles-utils.ts +325 -0
- package/src/lib/types/gltf-ext-mesh-features-schema.ts +48 -0
- package/src/lib/types/gltf-ext-structural-metadata-schema.ts +359 -0
- package/src/lib/types/gltf-json-schema.ts +13 -61
- package/dist/bundle.js +0 -5
- package/dist/glb-loader.js +0 -34
- package/dist/glb-writer.js +0 -35
- package/dist/gltf-loader.js +0 -50
- package/dist/gltf-writer.js +0 -32
- package/dist/index.js +0 -28
- package/dist/lib/api/gltf-extensions.js +0 -83
- package/dist/lib/api/gltf-scenegraph.js +0 -580
- package/dist/lib/api/normalize-gltf-v1.js +0 -299
- package/dist/lib/api/post-process-gltf.js +0 -433
- package/dist/lib/encoders/encode-glb.js +0 -72
- package/dist/lib/encoders/encode-gltf.js +0 -32
- package/dist/lib/extensions/EXT_meshopt_compression.js +0 -41
- package/dist/lib/extensions/EXT_texture_webp.js +0 -36
- package/dist/lib/extensions/KHR_binary_gltf.js +0 -39
- package/dist/lib/extensions/KHR_draco_mesh_compression.js +0 -137
- package/dist/lib/extensions/KHR_texture_basisu.js +0 -29
- package/dist/lib/extensions/KHR_texture_transform.js +0 -227
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +0 -291
- package/dist/lib/extensions/deprecated/KHR_lights_punctual.js +0 -59
- package/dist/lib/extensions/deprecated/KHR_materials_unlit.js +0 -44
- package/dist/lib/extensions/deprecated/KHR_techniques_webgl.js +0 -79
- package/dist/lib/gltf-utils/get-typed-array.js +0 -41
- package/dist/lib/gltf-utils/gltf-attribute-utils.js +0 -73
- package/dist/lib/gltf-utils/gltf-constants.js +0 -43
- package/dist/lib/gltf-utils/gltf-utils.js +0 -90
- package/dist/lib/gltf-utils/resolve-url.js +0 -18
- package/dist/lib/parsers/parse-glb.js +0 -166
- package/dist/lib/parsers/parse-gltf.js +0 -185
- package/dist/lib/types/glb-types.js +0 -2
- package/dist/lib/types/gltf-json-schema.js +0 -4
- package/dist/lib/types/gltf-postprocessed-schema.js +0 -4
- package/dist/lib/types/gltf-types.js +0 -3
- package/dist/lib/utils/assert.js +0 -12
- package/dist/lib/utils/version.js +0 -7
- package/dist/meshopt/meshopt-decoder.js +0 -118
- package/dist/webp/webp.js +0 -38
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import {GLTFTextureInfoMetadata} from './gltf-json-schema';
|
|
2
|
+
|
|
3
|
+
/* eslint-disable camelcase */
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/glTF.EXT_structural_metadata.schema.json
|
|
7
|
+
*/
|
|
8
|
+
export type GLTF_EXT_structural_metadata = {
|
|
9
|
+
/** An object defining classes and enums. */
|
|
10
|
+
schema?: GLTF_EXT_structural_metadata_Schema;
|
|
11
|
+
/** A uri to an external schema file. */
|
|
12
|
+
schemaUri?: string;
|
|
13
|
+
/** An array of property table definitions, which may be referenced by index. */
|
|
14
|
+
propertyTables?: GLTF_EXT_structural_metadata_PropertyTable[];
|
|
15
|
+
/** An array of property texture definitions, which may be referenced by index. */
|
|
16
|
+
propertyTextures?: GLTF_EXT_structural_metadata_PropertyTexture[];
|
|
17
|
+
/** "An array of property attribute definitions, which may be referenced by index. */
|
|
18
|
+
propertyAttributes?: GLTF_EXT_structural_metadata_PropertyAttribute[];
|
|
19
|
+
/** For internal usage */
|
|
20
|
+
dataAttributeNames?: string[];
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/schema.schema.json
|
|
25
|
+
*/
|
|
26
|
+
export type GLTF_EXT_structural_metadata_Schema = {
|
|
27
|
+
/** Unique identifier for the schema. Schema IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */
|
|
28
|
+
id: string;
|
|
29
|
+
/** The name of the schema. */
|
|
30
|
+
name?: string;
|
|
31
|
+
/** The description of the schema. */
|
|
32
|
+
description?: string;
|
|
33
|
+
/** Application-specific version of the schema. */
|
|
34
|
+
version?: string;
|
|
35
|
+
/** A dictionary, where each key is a class ID and each value is an object defining the class. */
|
|
36
|
+
classes?: {
|
|
37
|
+
[key: string]: GLTF_EXT_structural_metadata_Class;
|
|
38
|
+
};
|
|
39
|
+
/** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */
|
|
40
|
+
enums?: {
|
|
41
|
+
[key: string]: GLTF_EXT_structural_metadata_Enum;
|
|
42
|
+
};
|
|
43
|
+
extensions?: Record<string, any>;
|
|
44
|
+
extras?: any;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An object defining the values of an enum.
|
|
49
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.schema.json
|
|
50
|
+
*/
|
|
51
|
+
export type GLTF_EXT_structural_metadata_Enum = {
|
|
52
|
+
/** The name of the enum, e.g. for display purposes. */
|
|
53
|
+
name?: string;
|
|
54
|
+
/** The description of the enum. */
|
|
55
|
+
description?: string;
|
|
56
|
+
/** The type of the integer enum value. */
|
|
57
|
+
valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64'; // default: "UINT16"
|
|
58
|
+
/** An array of enum values. Duplicate names or duplicate integer values are not allowed. */
|
|
59
|
+
values: GLTF_EXT_structural_metadata_EnumValue[];
|
|
60
|
+
extensions?: Record<string, any>;
|
|
61
|
+
extras?: any;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.value.schema.json
|
|
66
|
+
*/
|
|
67
|
+
export type GLTF_EXT_structural_metadata_EnumValue = {
|
|
68
|
+
/** The name of the enum value. */
|
|
69
|
+
name: string;
|
|
70
|
+
/** The description of the enum value. */
|
|
71
|
+
description?: string;
|
|
72
|
+
/** The integer enum value. */
|
|
73
|
+
value: number;
|
|
74
|
+
extensions?: Record<string, any>;
|
|
75
|
+
extras?: any;
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.schema.json
|
|
80
|
+
*/
|
|
81
|
+
export type GLTF_EXT_structural_metadata_Class = {
|
|
82
|
+
/** The name of the class, e.g. for display purposes. */
|
|
83
|
+
name?: string;
|
|
84
|
+
/** The description of the class. */
|
|
85
|
+
description?: string;
|
|
86
|
+
/**
|
|
87
|
+
* A dictionary, where each key is a property ID and each value is an object defining the property.
|
|
88
|
+
* Property IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
|
|
89
|
+
*/
|
|
90
|
+
properties: {
|
|
91
|
+
[key: string]: GLTF_EXT_structural_metadata_ClassProperty;
|
|
92
|
+
};
|
|
93
|
+
extensions?: Record<string, any>;
|
|
94
|
+
extras?: any;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.property.schema.json
|
|
99
|
+
*/
|
|
100
|
+
export type GLTF_EXT_structural_metadata_ClassProperty = {
|
|
101
|
+
/** The name of the property, e.g. for display purposes. */
|
|
102
|
+
name?: string;
|
|
103
|
+
|
|
104
|
+
/** The description of the property. */
|
|
105
|
+
description?: string;
|
|
106
|
+
|
|
107
|
+
/** The element type. */
|
|
108
|
+
type:
|
|
109
|
+
| 'SCALAR'
|
|
110
|
+
| 'VEC2'
|
|
111
|
+
| 'VEC3'
|
|
112
|
+
| 'VEC4'
|
|
113
|
+
| 'MAT2'
|
|
114
|
+
| 'MAT3'
|
|
115
|
+
| 'MAT4'
|
|
116
|
+
| 'BOOLEAN'
|
|
117
|
+
| 'STRING'
|
|
118
|
+
| 'ENUM'
|
|
119
|
+
| string;
|
|
120
|
+
|
|
121
|
+
/** The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types. */
|
|
122
|
+
componentType?:
|
|
123
|
+
| 'INT8'
|
|
124
|
+
| 'UINT8'
|
|
125
|
+
| 'INT16'
|
|
126
|
+
| 'UINT16'
|
|
127
|
+
| 'INT32'
|
|
128
|
+
| 'UINT32'
|
|
129
|
+
| 'INT64'
|
|
130
|
+
| 'UINT64'
|
|
131
|
+
| 'FLOAT32'
|
|
132
|
+
| 'FLOAT64'
|
|
133
|
+
| string;
|
|
134
|
+
|
|
135
|
+
/** Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`. */
|
|
136
|
+
enumType?: string;
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Whether the property is an array.
|
|
140
|
+
* When `count` is defined the property is a fixed-length array. Otherwise the property is a variable-length array.
|
|
141
|
+
*/
|
|
142
|
+
array?: boolean;
|
|
143
|
+
|
|
144
|
+
/** The number of array elements. May only be defined when `array` is true. */
|
|
145
|
+
count?: number;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Specifies whether integer values are normalized.
|
|
149
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types with integer component types.
|
|
150
|
+
* For unsigned integer component types, values are normalized between `[0.0, 1.0]`.
|
|
151
|
+
* For signed integer component types, values are normalized between `[-1.0, 1.0]`.
|
|
152
|
+
* For all other component types, this property must be false.
|
|
153
|
+
*/
|
|
154
|
+
normalized?: boolean;
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* An offset to apply to property values.
|
|
158
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
159
|
+
*/
|
|
160
|
+
offset?: number | number[];
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* A scale to apply to property values.
|
|
164
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
165
|
+
*/
|
|
166
|
+
scale?: number | number[];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Maximum allowed value for the property.
|
|
170
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
171
|
+
* This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
172
|
+
*/
|
|
173
|
+
max?: number | number[];
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Minimum allowed value for the property.
|
|
177
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
178
|
+
* This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
179
|
+
*/
|
|
180
|
+
min?: number | number[];
|
|
181
|
+
|
|
182
|
+
default?: boolean | number | string | number[];
|
|
183
|
+
/**
|
|
184
|
+
* If required, the property must be present in every entity conforming to the class.
|
|
185
|
+
* If not required, individual entities may include `noData` values, or the entire property may be omitted.
|
|
186
|
+
* As a result, `noData` has no effect on a required property.
|
|
187
|
+
* Client implementations may use required properties to make performance optimizations.
|
|
188
|
+
*/
|
|
189
|
+
required?: boolean; // default false;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* A `noData` value represents missing data — also known as a sentinel value — wherever it appears.
|
|
193
|
+
* `BOOLEAN` properties may not specify `noData` values.
|
|
194
|
+
* This is given as the plain property value, without the transforms from the `normalized`, `offset`, and `scale` properties.
|
|
195
|
+
* Must not be defined if `required` is true.
|
|
196
|
+
*/
|
|
197
|
+
noData?: number | string | number[] | string[];
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* An identifier that describes how this property should be interpreted.
|
|
201
|
+
* The semantic cannot be used by other properties in the class.
|
|
202
|
+
*/
|
|
203
|
+
semantic?: string;
|
|
204
|
+
extensions?: Record<string, any>;
|
|
205
|
+
extras?: any;
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export type GLTF_EXT_structural_metadata_PropertyTable = {
|
|
209
|
+
/** The name of the property table, e.g. for display purposes. */
|
|
210
|
+
name?: string;
|
|
211
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
212
|
+
class: string;
|
|
213
|
+
/** The number of elements in each property array. */
|
|
214
|
+
count: number;
|
|
215
|
+
/**
|
|
216
|
+
* A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
217
|
+
* and each value is an object describing where property values are stored.
|
|
218
|
+
* Required properties must be included in this dictionary.
|
|
219
|
+
*/
|
|
220
|
+
properties?: {
|
|
221
|
+
[key: string]: GLTF_EXT_structural_metadata_PropertyTable_Property;
|
|
222
|
+
};
|
|
223
|
+
extensions?: Record<string, any>;
|
|
224
|
+
extras?: any;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json
|
|
229
|
+
*/
|
|
230
|
+
export type GLTF_EXT_structural_metadata_PropertyTable_Property = {
|
|
231
|
+
/**
|
|
232
|
+
* The index of the buffer view containing property values.
|
|
233
|
+
* The data type of property values is determined by the property definition:
|
|
234
|
+
* When `type` is `BOOLEAN` values are packed into a bitstream.
|
|
235
|
+
* When `type` is `STRING` values are stored as byte sequences and decoded as UTF-8 strings.
|
|
236
|
+
* When `type` is `SCALAR`, `VECN`, or `MATN` the values are stored as the provided `componentType`
|
|
237
|
+
* and the buffer view `byteOffset` must be aligned to a multiple of the `componentType` size.
|
|
238
|
+
* When `type` is `ENUM` values are stored as the enum's `valueType`
|
|
239
|
+
* and the buffer view `byteOffset` must be aligned to a multiple of the `valueType` size.
|
|
240
|
+
* Each enum value in the array must match one of the allowed values in the enum definition.
|
|
241
|
+
* `arrayOffsets` is required for variable-length arrays and `stringOffsets` is required for strings (for variable-length arrays of strings, both are required).
|
|
242
|
+
*/
|
|
243
|
+
values: number;
|
|
244
|
+
/**
|
|
245
|
+
* The index of the buffer view containing offsets for variable-length arrays.
|
|
246
|
+
* The number of offsets is equal to the property table `count` plus one.
|
|
247
|
+
* The offsets represent the start positions of each array, with the last offset representing the position after the last array.
|
|
248
|
+
* The array length is computed using the difference between the subsequent offset and the current offset.
|
|
249
|
+
* If `type` is `STRING` the offsets index into the string offsets array (stored in `stringOffsets`), otherwise they index into the property array (stored in `values`).
|
|
250
|
+
* The data type of these offsets is determined by `arrayOffsetType`.
|
|
251
|
+
* The buffer view `byteOffset` must be aligned to a multiple of the `arrayOffsetType` size.
|
|
252
|
+
*/
|
|
253
|
+
arrayOffsets?: number;
|
|
254
|
+
/**
|
|
255
|
+
* The index of the buffer view containing offsets for strings.
|
|
256
|
+
* The number of offsets is equal to the number of string elements plus one.
|
|
257
|
+
* The offsets represent the byte offsets of each string in the property array (stored in `values`), with the last offset representing the byte offset after the last string.
|
|
258
|
+
* The string byte length is computed using the difference between the subsequent offset and the current offset.
|
|
259
|
+
* The data type of these offsets is determined by `stringOffsetType`.
|
|
260
|
+
* The buffer view `byteOffset` must be aligned to a multiple of the `stringOffsetType` size.
|
|
261
|
+
*/
|
|
262
|
+
stringOffsets?: number;
|
|
263
|
+
/**
|
|
264
|
+
* The type of values in `arrayOffsets`.
|
|
265
|
+
*/
|
|
266
|
+
arrayOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* The type of values in `stringOffsets`.
|
|
270
|
+
*/
|
|
271
|
+
stringOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string;
|
|
272
|
+
/**
|
|
273
|
+
* An offset to apply to property values.
|
|
274
|
+
* Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
275
|
+
* Overrides the class property's `offset` if both are defined.
|
|
276
|
+
*/
|
|
277
|
+
offset?: number | number[];
|
|
278
|
+
/**
|
|
279
|
+
* A scale to apply to property values.
|
|
280
|
+
* Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
281
|
+
* Overrides the class property's `scale` if both are defined.
|
|
282
|
+
*/
|
|
283
|
+
scale?: number | number[];
|
|
284
|
+
/**
|
|
285
|
+
* Maximum value present in the property values.
|
|
286
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
287
|
+
* This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
288
|
+
*/
|
|
289
|
+
max?: number | number[];
|
|
290
|
+
/**
|
|
291
|
+
* Minimum value present in the property values.
|
|
292
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
293
|
+
* This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
294
|
+
*/
|
|
295
|
+
min?: number | number[];
|
|
296
|
+
extensions?: Record<string, any>;
|
|
297
|
+
extras?: any;
|
|
298
|
+
/** For internal usage */
|
|
299
|
+
data?: unknown;
|
|
300
|
+
};
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.schema.json
|
|
304
|
+
*/
|
|
305
|
+
export type GLTF_EXT_structural_metadata_PropertyTexture = {
|
|
306
|
+
/** The name of the property texture, e.g. for display purposes. */
|
|
307
|
+
name?: string;
|
|
308
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
309
|
+
class: string;
|
|
310
|
+
/**
|
|
311
|
+
* A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
312
|
+
* and each value is an object describing where property values are stored.
|
|
313
|
+
* Required properties must be included in this dictionary.
|
|
314
|
+
*
|
|
315
|
+
* https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
|
|
316
|
+
* Each property that is defined in the propertyTexture object extends the glTF textureInfo object.
|
|
317
|
+
* The texCoord specifies a texture coordinate set in the referring primitive.
|
|
318
|
+
* The index is the index of the glTF texture object that stores the actual data. Additionally,
|
|
319
|
+
* each property specifies an array of channels, which are the indices of the texture channels providing data for the respective property.
|
|
320
|
+
* Channels of an RGBA texture are numbered 0..3 respectively.
|
|
321
|
+
*/
|
|
322
|
+
properties?: {
|
|
323
|
+
[key: string]: GLTFTextureInfoMetadata;
|
|
324
|
+
};
|
|
325
|
+
extensions?: Record<string, any>;
|
|
326
|
+
extras?: any;
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyAttribute.schema.json
|
|
331
|
+
*/
|
|
332
|
+
export type GLTF_EXT_structural_metadata_PropertyAttribute = {
|
|
333
|
+
/** The name of the property attribute, e.g. for display purposes. */
|
|
334
|
+
name?: string;
|
|
335
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
336
|
+
class: string;
|
|
337
|
+
/**
|
|
338
|
+
* "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
339
|
+
* and each value is an object describing where property values are stored.
|
|
340
|
+
* Required properties must be included in this dictionary.
|
|
341
|
+
*/
|
|
342
|
+
properties?: {
|
|
343
|
+
[key: string]: any;
|
|
344
|
+
};
|
|
345
|
+
extensions?: Record<string, any>;
|
|
346
|
+
extras?: any;
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
/**
|
|
350
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/mesh.primitive.EXT_structural_metadata.schema.json
|
|
351
|
+
*/
|
|
352
|
+
export type GLTF_EXT_structural_metadata_Primitive = {
|
|
353
|
+
/** An array of indexes of property textures in the root `EXT_structural_metadata` object. */
|
|
354
|
+
propertyTextures?: number[];
|
|
355
|
+
/** An array of indexes of property attributes in the root `EXT_structural_metadata` object. */
|
|
356
|
+
propertyAttributes?: number[];
|
|
357
|
+
extensions?: Record<string, any>;
|
|
358
|
+
extras?: any;
|
|
359
|
+
};
|
|
@@ -365,6 +365,17 @@ export type GLTFTextureInfo = {
|
|
|
365
365
|
// [k: string]: any;
|
|
366
366
|
};
|
|
367
367
|
|
|
368
|
+
/**
|
|
369
|
+
* Extended GLTFTextureInfo that is used in EXT_structural_metadata and EXT_mesh_features
|
|
370
|
+
* https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
|
|
371
|
+
* https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features
|
|
372
|
+
*/
|
|
373
|
+
export type GLTFTextureInfoMetadata = GLTFTextureInfo & {
|
|
374
|
+
channels: number[];
|
|
375
|
+
/** For internal usage */
|
|
376
|
+
data?: unknown;
|
|
377
|
+
};
|
|
378
|
+
|
|
368
379
|
/**
|
|
369
380
|
* A set of parameter values that are used to define the metallic-roughness material model from Physically-Based Rendering (PBR) methodology.
|
|
370
381
|
*/
|
|
@@ -486,7 +497,7 @@ export type GLTFMeshPrimitive = {
|
|
|
486
497
|
targets?: {
|
|
487
498
|
[k: string]: GLTFId;
|
|
488
499
|
}[];
|
|
489
|
-
extensions?: Record<string,
|
|
500
|
+
extensions?: Record<string, unknown>;
|
|
490
501
|
extras?: any;
|
|
491
502
|
// [k: string]: any;
|
|
492
503
|
};
|
|
@@ -793,65 +804,6 @@ export type GLTF_MSFT_texture_dds = {
|
|
|
793
804
|
extras?: any;
|
|
794
805
|
};
|
|
795
806
|
|
|
796
|
-
/**
|
|
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.
|
|
803
|
-
*/
|
|
804
|
-
export type GLTF_EXT_mesh_features = {
|
|
805
|
-
/** An array of feature ID sets. */
|
|
806
|
-
featureIds: GLTF_EXT_mesh_features_featureId[];
|
|
807
|
-
extensions?: Record<string, any>;
|
|
808
|
-
extras?: any;
|
|
809
|
-
};
|
|
810
|
-
|
|
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
807
|
/**
|
|
856
808
|
* EXT_feature_metadata extension types
|
|
857
809
|
* This extension has glTF-level metadata and primitive-level feature indexing and segmentation metadata
|
|
@@ -1105,7 +1057,7 @@ export type GLTF_EXT_feature_metadata_FeatureTableProperty = {
|
|
|
1105
1057
|
bufferView: number;
|
|
1106
1058
|
|
|
1107
1059
|
/** The type of values in arrayOffsetBufferView and stringOffsetBufferView. */
|
|
1108
|
-
offsetType?: string; // default: "UINT32"
|
|
1060
|
+
offsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64' | string; // default: "UINT32"
|
|
1109
1061
|
/**
|
|
1110
1062
|
* The index of the buffer view containing offsets for variable-length arrays.
|
|
1111
1063
|
* The number of offsets is equal to the feature table count plus one.
|
package/dist/bundle.js
DELETED
package/dist/glb-loader.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GLBLoader = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const parse_glb_1 = require("./lib/parsers/parse-glb");
|
|
6
|
-
/**
|
|
7
|
-
* GLB Loader -
|
|
8
|
-
* GLB is the binary container format for GLTF
|
|
9
|
-
*/
|
|
10
|
-
exports.GLBLoader = {
|
|
11
|
-
name: 'GLB',
|
|
12
|
-
id: 'glb',
|
|
13
|
-
module: 'gltf',
|
|
14
|
-
version: version_1.VERSION,
|
|
15
|
-
extensions: ['glb'],
|
|
16
|
-
mimeTypes: ['model/gltf-binary'],
|
|
17
|
-
binary: true,
|
|
18
|
-
parse,
|
|
19
|
-
parseSync,
|
|
20
|
-
options: {
|
|
21
|
-
glb: {
|
|
22
|
-
strict: false // Enables deprecated XVIZ support (illegal CHUNK formats)
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
async function parse(arrayBuffer, options) {
|
|
27
|
-
return parseSync(arrayBuffer, options);
|
|
28
|
-
}
|
|
29
|
-
function parseSync(arrayBuffer, options) {
|
|
30
|
-
const { byteOffset = 0 } = options || {};
|
|
31
|
-
const glb = {};
|
|
32
|
-
(0, parse_glb_1.parseGLBSync)(glb, arrayBuffer, byteOffset, options?.glb);
|
|
33
|
-
return glb;
|
|
34
|
-
}
|
package/dist/glb-writer.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports._TypecheckGLBLoader = exports.GLBWriter = void 0;
|
|
5
|
-
const encode_glb_1 = require("./lib/encoders/encode-glb");
|
|
6
|
-
const version_1 = require("./lib/utils/version");
|
|
7
|
-
/**
|
|
8
|
-
* GLB exporter
|
|
9
|
-
* GLB is the binary container format for GLTF
|
|
10
|
-
*/
|
|
11
|
-
exports.GLBWriter = {
|
|
12
|
-
name: 'GLB',
|
|
13
|
-
id: 'glb',
|
|
14
|
-
module: 'gltf',
|
|
15
|
-
version: version_1.VERSION,
|
|
16
|
-
extensions: ['glb'],
|
|
17
|
-
mimeTypes: ['model/gltf-binary'],
|
|
18
|
-
binary: true,
|
|
19
|
-
encodeSync,
|
|
20
|
-
options: {
|
|
21
|
-
glb: {}
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
function encodeSync(glb, options) {
|
|
25
|
-
const { byteOffset = 0 } = options;
|
|
26
|
-
// Calculate length and allocate buffer
|
|
27
|
-
const byteLength = (0, encode_glb_1.encodeGLBSync)(glb, null, byteOffset, options);
|
|
28
|
-
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
29
|
-
// Encode into buffer
|
|
30
|
-
const dataView = new DataView(arrayBuffer);
|
|
31
|
-
(0, encode_glb_1.encodeGLBSync)(glb, dataView, byteOffset, options);
|
|
32
|
-
return arrayBuffer;
|
|
33
|
-
}
|
|
34
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
35
|
-
exports._TypecheckGLBLoader = exports.GLBWriter;
|
package/dist/gltf-loader.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parse = exports.GLTFLoader = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const parse_gltf_1 = require("./lib/parsers/parse-gltf");
|
|
6
|
-
/**
|
|
7
|
-
* GLTF loader
|
|
8
|
-
*/
|
|
9
|
-
exports.GLTFLoader = {
|
|
10
|
-
name: 'glTF',
|
|
11
|
-
id: 'gltf',
|
|
12
|
-
module: 'gltf',
|
|
13
|
-
version: version_1.VERSION,
|
|
14
|
-
extensions: ['gltf', 'glb'],
|
|
15
|
-
mimeTypes: ['model/gltf+json', 'model/gltf-binary'],
|
|
16
|
-
text: true,
|
|
17
|
-
binary: true,
|
|
18
|
-
tests: ['glTF'],
|
|
19
|
-
parse,
|
|
20
|
-
options: {
|
|
21
|
-
gltf: {
|
|
22
|
-
normalize: true,
|
|
23
|
-
loadBuffers: true,
|
|
24
|
-
loadImages: true,
|
|
25
|
-
decompressMeshes: true // Decompress Draco encoded meshes
|
|
26
|
-
},
|
|
27
|
-
// common?
|
|
28
|
-
log: console // eslint-disable-line
|
|
29
|
-
},
|
|
30
|
-
deprecatedOptions: {
|
|
31
|
-
fetchImages: 'gltf.loadImages',
|
|
32
|
-
createImages: 'gltf.loadImages',
|
|
33
|
-
decompress: 'gltf.decompressMeshes',
|
|
34
|
-
postProcess: 'gltf.postProcess',
|
|
35
|
-
gltf: {
|
|
36
|
-
decompress: 'gltf.decompressMeshes',
|
|
37
|
-
postProcess: 'removed in v4'
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
async function parse(arrayBuffer, options = {}, context) {
|
|
42
|
-
// Apps can call the parse method directly, we so apply default options here
|
|
43
|
-
options = { ...exports.GLTFLoader.options, ...options };
|
|
44
|
-
// @ts-ignore
|
|
45
|
-
options.gltf = { ...exports.GLTFLoader.options.gltf, ...options.gltf };
|
|
46
|
-
const { byteOffset = 0 } = options;
|
|
47
|
-
const gltf = {};
|
|
48
|
-
return await (0, parse_gltf_1.parseGLTF)(gltf, arrayBuffer, byteOffset, options, context);
|
|
49
|
-
}
|
|
50
|
-
exports.parse = parse;
|
package/dist/gltf-writer.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._TypecheckGLBLoader = exports.GLTFWriter = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const encode_gltf_1 = require("./lib/encoders/encode-gltf");
|
|
6
|
-
/**
|
|
7
|
-
* GLTF exporter
|
|
8
|
-
*/
|
|
9
|
-
exports.GLTFWriter = {
|
|
10
|
-
name: 'glTF',
|
|
11
|
-
id: 'gltf',
|
|
12
|
-
module: 'gltf',
|
|
13
|
-
version: version_1.VERSION,
|
|
14
|
-
extensions: ['glb'],
|
|
15
|
-
mimeTypes: ['model/gltf-binary'],
|
|
16
|
-
binary: true,
|
|
17
|
-
encodeSync,
|
|
18
|
-
options: {
|
|
19
|
-
gltf: {}
|
|
20
|
-
}
|
|
21
|
-
};
|
|
22
|
-
function encodeSync(gltf, options = {}) {
|
|
23
|
-
const { byteOffset = 0 } = options;
|
|
24
|
-
// Calculate length, then create arraybuffer and encode
|
|
25
|
-
const byteLength = (0, encode_gltf_1.encodeGLTFSync)(gltf, null, byteOffset, options);
|
|
26
|
-
const arrayBuffer = new ArrayBuffer(byteLength);
|
|
27
|
-
const dataView = new DataView(arrayBuffer);
|
|
28
|
-
(0, encode_gltf_1.encodeGLTFSync)(gltf, dataView, byteOffset, options);
|
|
29
|
-
return arrayBuffer;
|
|
30
|
-
}
|
|
31
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
32
|
-
exports._TypecheckGLBLoader = exports.GLTFWriter;
|
package/dist/index.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports._getMemoryUsageGLTF = exports.postProcessGLTF = exports.GLTFScenegraph = exports.GLBWriter = exports.GLBLoader = exports.GLTFWriter = exports.GLTFLoader = void 0;
|
|
4
|
-
// glTF loader/writer definition objects
|
|
5
|
-
var gltf_loader_1 = require("./gltf-loader");
|
|
6
|
-
Object.defineProperty(exports, "GLTFLoader", { enumerable: true, get: function () { return gltf_loader_1.GLTFLoader; } });
|
|
7
|
-
var gltf_writer_1 = require("./gltf-writer");
|
|
8
|
-
Object.defineProperty(exports, "GLTFWriter", { enumerable: true, get: function () { return gltf_writer_1.GLTFWriter; } });
|
|
9
|
-
// GLB Loader & Writer (for custom formats that want to leverage the GLB binary "envelope")
|
|
10
|
-
var glb_loader_1 = require("./glb-loader");
|
|
11
|
-
Object.defineProperty(exports, "GLBLoader", { enumerable: true, get: function () { return glb_loader_1.GLBLoader; } });
|
|
12
|
-
var glb_writer_1 = require("./glb-writer");
|
|
13
|
-
Object.defineProperty(exports, "GLBWriter", { enumerable: true, get: function () { return glb_writer_1.GLBWriter; } });
|
|
14
|
-
// glTF Data Access Helper Class
|
|
15
|
-
var gltf_scenegraph_1 = require("./lib/api/gltf-scenegraph");
|
|
16
|
-
Object.defineProperty(exports, "GLTFScenegraph", { enumerable: true, get: function () { return gltf_scenegraph_1.GLTFScenegraph; } });
|
|
17
|
-
var post_process_gltf_1 = require("./lib/api/post-process-gltf");
|
|
18
|
-
Object.defineProperty(exports, "postProcessGLTF", { enumerable: true, get: function () { return post_process_gltf_1.postProcessGLTF; } });
|
|
19
|
-
var gltf_utils_1 = require("./lib/gltf-utils/gltf-utils");
|
|
20
|
-
Object.defineProperty(exports, "_getMemoryUsageGLTF", { enumerable: true, get: function () { return gltf_utils_1.getMemoryUsageGLTF; } });
|
|
21
|
-
/** @deprecated */
|
|
22
|
-
// export type {GLTFMesh as Mesh} from './lib/types/gltf-json-schema';
|
|
23
|
-
/** @deprecated */
|
|
24
|
-
// export type {GLTFNodePostprocessed as Node} from './lib/types/gltf-postprocessed-schema';
|
|
25
|
-
/** @deprecated */
|
|
26
|
-
// export type {GLTFAccessorPostprocessed as Accessor} from './lib/types/gltf-postprocessed-schema';
|
|
27
|
-
// /** @deprecated */
|
|
28
|
-
// export type {GLTFImagePostprocessed as Image} from './lib/types/gltf-postprocessed-schema';
|