@loaders.gl/gltf 4.0.0-alpha.22 → 4.0.0-alpha.23
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 +3577 -3025
- 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 +386 -0
- package/dist/es5/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/es5/lib/extensions/data-processing.js +181 -0
- package/dist/es5/lib/extensions/data-processing.js.map +1 -0
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js +6 -9
- package/dist/es5/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- 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 +320 -0
- package/dist/esm/lib/extensions/EXT_structural_metadata.js.map +1 -0
- package/dist/esm/lib/extensions/data-processing.js +146 -0
- package/dist/esm/lib/extensions/data-processing.js.map +1 -0
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js +4 -7
- package/dist/esm/lib/extensions/deprecated/EXT_feature_metadata.js.map +1 -1
- 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/index.js +7 -1
- package/dist/lib/api/gltf-extensions.d.ts.map +1 -1
- package/dist/lib/api/gltf-extensions.js +5 -0
- 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_mesh_features.js +89 -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/EXT_structural_metadata.js +504 -0
- package/dist/lib/extensions/data-processing.d.ts +34 -0
- package/dist/lib/extensions/data-processing.d.ts.map +1 -0
- package/dist/lib/extensions/data-processing.js +212 -0
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.d.ts.map +1 -1
- package/dist/lib/extensions/deprecated/EXT_feature_metadata.js +8 -17
- 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-mesh-features-schema.js +2 -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-ext-structural-metadata-schema.js +2 -0
- package/dist/lib/types/gltf-json-schema.d.ts +11 -57
- 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 +730 -0
- package/src/lib/extensions/data-processing.ts +264 -0
- package/src/lib/extensions/deprecated/EXT_feature_metadata.ts +6 -17
- package/src/lib/types/gltf-ext-mesh-features-schema.ts +48 -0
- package/src/lib/types/gltf-ext-structural-metadata-schema.ts +357 -0
- package/src/lib/types/gltf-json-schema.ts +12 -60
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.primitivePropertyDataToAttributes = exports.getPrimitiveTextureData = exports.convertRawBufferToMetadataArray = exports.getArrayElementByteSize = void 0;
|
|
4
|
+
const gltf_utils_1 = require("../gltf-utils/gltf-utils");
|
|
5
|
+
const images_1 = require("@loaders.gl/images");
|
|
6
|
+
const math_1 = require("@loaders.gl/math");
|
|
7
|
+
const ATTRIBUTE_TYPE_TO_COMPONENTS = {
|
|
8
|
+
SCALAR: 1,
|
|
9
|
+
VEC2: 2,
|
|
10
|
+
VEC3: 3,
|
|
11
|
+
VEC4: 4,
|
|
12
|
+
MAT2: 4,
|
|
13
|
+
MAT3: 9,
|
|
14
|
+
MAT4: 16,
|
|
15
|
+
BOOLEAN: 1,
|
|
16
|
+
STRING: 1,
|
|
17
|
+
ENUM: 1
|
|
18
|
+
};
|
|
19
|
+
const ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY = {
|
|
20
|
+
INT8: Int8Array,
|
|
21
|
+
UINT8: Uint8Array,
|
|
22
|
+
INT16: Int16Array,
|
|
23
|
+
UINT16: Uint16Array,
|
|
24
|
+
INT32: Int32Array,
|
|
25
|
+
UINT32: Uint32Array,
|
|
26
|
+
INT64: BigInt64Array,
|
|
27
|
+
UINT64: BigUint64Array,
|
|
28
|
+
FLOAT32: Float32Array,
|
|
29
|
+
FLOAT64: Float64Array
|
|
30
|
+
};
|
|
31
|
+
const ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE = {
|
|
32
|
+
INT8: 1,
|
|
33
|
+
UINT8: 1,
|
|
34
|
+
INT16: 2,
|
|
35
|
+
UINT16: 2,
|
|
36
|
+
INT32: 4,
|
|
37
|
+
UINT32: 4,
|
|
38
|
+
INT64: 8,
|
|
39
|
+
UINT64: 8,
|
|
40
|
+
FLOAT32: 4,
|
|
41
|
+
FLOAT64: 8
|
|
42
|
+
};
|
|
43
|
+
function getArrayElementByteSize(attributeType, componentType) {
|
|
44
|
+
return (ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType] *
|
|
45
|
+
ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType]);
|
|
46
|
+
}
|
|
47
|
+
exports.getArrayElementByteSize = getArrayElementByteSize;
|
|
48
|
+
/**
|
|
49
|
+
* Converts raw bytes that are in the buffer to an array of the type defined by the schema.
|
|
50
|
+
* @param {Uint8Array} typedArray - raw bytes in the buffer
|
|
51
|
+
* @param {string} attributeType - SCALAR, VECN, MATN
|
|
52
|
+
* @param {string} componentType - type of the component in elements, e.g. 'UINT8' or 'FLOAT32'
|
|
53
|
+
* @param {number} elementCount - number of elements in the array. Default value is 1.
|
|
54
|
+
* @returns {TypedArray} Data array
|
|
55
|
+
*/
|
|
56
|
+
function convertRawBufferToMetadataArray(typedArray, attributeType, componentType, elementCount = 1) {
|
|
57
|
+
const numberOfComponents = ATTRIBUTE_TYPE_TO_COMPONENTS[attributeType];
|
|
58
|
+
const ArrayType = ATTRIBUTE_COMPONENT_TYPE_TO_ARRAY[componentType];
|
|
59
|
+
const length = elementCount * numberOfComponents;
|
|
60
|
+
const size = ATTRIBUTE_COMPONENT_TYPE_TO_BYTE_SIZE[componentType];
|
|
61
|
+
// the buffer view `byteOffset` must be aligned to a multiple of the `componentType` size.
|
|
62
|
+
const offset = typedArray.byteOffset % size
|
|
63
|
+
? Math.ceil(typedArray.byteOffset / size) * size
|
|
64
|
+
: typedArray.byteOffset;
|
|
65
|
+
return new ArrayType(typedArray.buffer, offset, length);
|
|
66
|
+
}
|
|
67
|
+
exports.convertRawBufferToMetadataArray = convertRawBufferToMetadataArray;
|
|
68
|
+
/**
|
|
69
|
+
* Processes data encoded in the texture associated with the primitive.
|
|
70
|
+
* If Ext_mesh_featues is combined with the Ext_structural_metadata, propertyTable will also be processed.
|
|
71
|
+
* @param {GLTFScenegraph} scenegraph - Instance of the class for structured access to GLTF data.
|
|
72
|
+
* @param {GLTFTextureInfoMetadata} textureInfo - reference to the texture where extension data are stored.
|
|
73
|
+
* @param {GLTFMeshPrimitive} primitive - primitive object in the mesh
|
|
74
|
+
* @returns {number[] | null} Array of data taken. Null if data can't be taken from the texture.
|
|
75
|
+
*/
|
|
76
|
+
function getPrimitiveTextureData(scenegraph, textureInfo, primitive) {
|
|
77
|
+
/*
|
|
78
|
+
texture.index is an index for the "textures" array.
|
|
79
|
+
The texture object referenced by this index looks like this:
|
|
80
|
+
{
|
|
81
|
+
"sampler": 0,
|
|
82
|
+
"source": 0
|
|
83
|
+
}
|
|
84
|
+
"sampler" is an index for the "samplers" array
|
|
85
|
+
"source" is an index for the "images" array that contains data. These data are stored in rgba channels of the image.
|
|
86
|
+
|
|
87
|
+
texture.texCoord is a number-suffix (like 1) for an attribute like "TEXCOORD_1" in meshes.primitives
|
|
88
|
+
The value of "TEXCOORD_1" is an accessor that is used to get coordinates. These coordinates are being used to get data from the image.
|
|
89
|
+
*/
|
|
90
|
+
const json = scenegraph.gltf.json;
|
|
91
|
+
const texCoordAccessorKey = `TEXCOORD_${textureInfo.texCoord || 0}`;
|
|
92
|
+
const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];
|
|
93
|
+
const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);
|
|
94
|
+
const texCoordArray = scenegraph.getTypedArrayForBufferView(texCoordBufferView);
|
|
95
|
+
// textureCoordinates array contains UV coordinates of the actual data stored in the texture
|
|
96
|
+
const textureCoordinates = new Float32Array(texCoordArray.buffer, texCoordArray.byteOffset, texCoordArray.length / 4);
|
|
97
|
+
const textureIndex = textureInfo.index;
|
|
98
|
+
const imageIndex = json.textures?.[textureIndex]?.source;
|
|
99
|
+
if (typeof imageIndex !== 'undefined') {
|
|
100
|
+
const mimeType = json.images?.[imageIndex]?.mimeType;
|
|
101
|
+
const parsedImage = scenegraph.gltf.images?.[imageIndex];
|
|
102
|
+
// Checking for width is to prevent handling Un-processed images (e.g. [analyze] stage, where loadImages option is set to false)
|
|
103
|
+
if (parsedImage && typeof parsedImage.width !== 'undefined') {
|
|
104
|
+
const textureData = [];
|
|
105
|
+
for (let index = 0; index < textureCoordinates.length; index += 2) {
|
|
106
|
+
const value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, textureInfo.channels);
|
|
107
|
+
textureData.push(value);
|
|
108
|
+
}
|
|
109
|
+
return textureData;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
exports.getPrimitiveTextureData = getPrimitiveTextureData;
|
|
115
|
+
/**
|
|
116
|
+
* Puts property data to attributes.
|
|
117
|
+
* It creates corresponding buffer, bufferView and accessor
|
|
118
|
+
* so the data can be accessed like regular data stored in buffers.
|
|
119
|
+
* @param {GLTFScenegraph} scenegraph - scenegraph object
|
|
120
|
+
* @param {string} attributeName - name of the attribute
|
|
121
|
+
* @param {number[]} propertyData - property data to store
|
|
122
|
+
* @param {number[]} featureTable - an array where unique data from the property data are being stored
|
|
123
|
+
* @param {GLTFMeshPrimitive} primitive - primitive object
|
|
124
|
+
*/
|
|
125
|
+
function primitivePropertyDataToAttributes(scenegraph, attributeName, propertyData, featureTable, primitive) {
|
|
126
|
+
if (propertyData === null)
|
|
127
|
+
return;
|
|
128
|
+
/*
|
|
129
|
+
featureTable will contain unique values, e.g.
|
|
130
|
+
propertyData = [24, 35, 28, 24]
|
|
131
|
+
featureTable = [24, 35, 28]
|
|
132
|
+
featureIndices will contain indices that refer featureTextureTable, e.g.
|
|
133
|
+
featureIndices = [0, 1, 2, 0]
|
|
134
|
+
*/
|
|
135
|
+
const featureIndices = [];
|
|
136
|
+
for (const texelData of propertyData) {
|
|
137
|
+
let index = featureTable.findIndex((item) => item === texelData);
|
|
138
|
+
if (index === -1) {
|
|
139
|
+
index = featureTable.push(texelData) - 1;
|
|
140
|
+
}
|
|
141
|
+
featureIndices.push(index);
|
|
142
|
+
}
|
|
143
|
+
const typedArray = new Uint32Array(featureIndices);
|
|
144
|
+
const bufferIndex = scenegraph.gltf.buffers.push({
|
|
145
|
+
arrayBuffer: typedArray.buffer,
|
|
146
|
+
byteOffset: typedArray.byteOffset,
|
|
147
|
+
byteLength: typedArray.byteLength
|
|
148
|
+
}) - 1;
|
|
149
|
+
const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);
|
|
150
|
+
const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {
|
|
151
|
+
size: 1,
|
|
152
|
+
componentType: (0, gltf_utils_1.getComponentTypeFromArray)(typedArray),
|
|
153
|
+
count: typedArray.length
|
|
154
|
+
});
|
|
155
|
+
primitive.attributes[attributeName] = accessorIndex;
|
|
156
|
+
}
|
|
157
|
+
exports.primitivePropertyDataToAttributes = primitivePropertyDataToAttributes;
|
|
158
|
+
/**
|
|
159
|
+
* Gets the value from the texture by coordinates provided.
|
|
160
|
+
* @param {ImageType} parsedImage - image where the data are stored.
|
|
161
|
+
* @param {string | undefined} mimeType - MIME type
|
|
162
|
+
* @param {Float32Array} textureCoordinates - uv coordinates to access data in the image.
|
|
163
|
+
* @param {number} index - index of uv coordinates in the array textureCoordinates
|
|
164
|
+
* @param {channels} channels - image channels where data are stored. Channels of an RGBA texture are numbered 0..3 respectively.
|
|
165
|
+
* @returns {number} Value taken from the image.
|
|
166
|
+
*/
|
|
167
|
+
function getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, channels = [0]) {
|
|
168
|
+
const CHANNELS_MAP = [
|
|
169
|
+
{ offset: 0, shift: 0 },
|
|
170
|
+
{ offset: 1, shift: 8 },
|
|
171
|
+
{ offset: 2, shift: 16 },
|
|
172
|
+
{ offset: 3, shift: 24 }
|
|
173
|
+
];
|
|
174
|
+
const u = textureCoordinates[index];
|
|
175
|
+
const v = textureCoordinates[index + 1];
|
|
176
|
+
let components = 1;
|
|
177
|
+
if (mimeType && (mimeType.indexOf('image/jpeg') !== -1 || mimeType.indexOf('image/png') !== -1))
|
|
178
|
+
components = 4;
|
|
179
|
+
const offset = coordinatesToOffset(u, v, parsedImage, components);
|
|
180
|
+
let value = 0;
|
|
181
|
+
for (const c of channels) {
|
|
182
|
+
const map = CHANNELS_MAP[c];
|
|
183
|
+
const imageOffset = offset + map.offset;
|
|
184
|
+
const imageData = (0, images_1.getImageData)(parsedImage);
|
|
185
|
+
if (imageData.data.length <= imageOffset) {
|
|
186
|
+
throw new Error(`${imageData.data.length} <= ${imageOffset}`);
|
|
187
|
+
}
|
|
188
|
+
const imageValue = imageData.data[imageOffset];
|
|
189
|
+
value |= imageValue << map.shift;
|
|
190
|
+
}
|
|
191
|
+
return value;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Retrieves the offset in the image where the data are stored
|
|
195
|
+
* @param u - u-coordinate
|
|
196
|
+
* @param v - v-coordinate
|
|
197
|
+
* @param parsedImage - image where the data are stored
|
|
198
|
+
* @param componentsCount - number of components the data consists of.
|
|
199
|
+
* @returns offset in the image where the data are stored
|
|
200
|
+
*/
|
|
201
|
+
function coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {
|
|
202
|
+
const w = parsedImage.width;
|
|
203
|
+
const iX = (0, math_1.emod)(u) * (w - 1);
|
|
204
|
+
const indX = Math.round(iX);
|
|
205
|
+
const h = parsedImage.height;
|
|
206
|
+
const iY = (0, math_1.emod)(v) * (h - 1);
|
|
207
|
+
const indY = Math.round(iY);
|
|
208
|
+
const components = parsedImage.components ? parsedImage.components : componentsCount;
|
|
209
|
+
// components is a number of channels in the image
|
|
210
|
+
const offset = (indY * w + indX) * components;
|
|
211
|
+
return offset;
|
|
212
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EXT_feature_metadata.d.ts","sourceRoot":"","sources":["../../../../src/lib/extensions/deprecated/EXT_feature_metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAQL,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAKvD,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"EXT_feature_metadata.d.ts","sourceRoot":"","sources":["../../../../src/lib/extensions/deprecated/EXT_feature_metadata.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,IAAI,EAQL,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AAKvD,eAAO,MAAM,IAAI,yBAA4B,CAAC;AAE9C,wBAAsB,MAAM,CAAC,QAAQ,EAAE;IAAC,IAAI,EAAE,IAAI,CAAA;CAAC,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAG9F"}
|
|
@@ -4,9 +4,10 @@ exports.decode = exports.name = void 0;
|
|
|
4
4
|
const gltf_scenegraph_1 = require("../../api/gltf-scenegraph");
|
|
5
5
|
const images_1 = require("@loaders.gl/images");
|
|
6
6
|
const gltf_utils_1 = require("../../gltf-utils/gltf-utils");
|
|
7
|
+
const math_1 = require("@loaders.gl/math");
|
|
7
8
|
/** Extension name */
|
|
8
|
-
const
|
|
9
|
-
exports.name =
|
|
9
|
+
const EXT_FEATURE_METADATA_NAME = 'EXT_feature_metadata';
|
|
10
|
+
exports.name = EXT_FEATURE_METADATA_NAME;
|
|
10
11
|
async function decode(gltfData, options) {
|
|
11
12
|
const scenegraph = new gltf_scenegraph_1.GLTFScenegraph(gltfData);
|
|
12
13
|
decodeExtFeatureMetadata(scenegraph, options);
|
|
@@ -17,7 +18,7 @@ exports.decode = decode;
|
|
|
17
18
|
* @param scenegraph
|
|
18
19
|
*/
|
|
19
20
|
function decodeExtFeatureMetadata(scenegraph, options) {
|
|
20
|
-
const extension = scenegraph.getExtension(
|
|
21
|
+
const extension = scenegraph.getExtension(EXT_FEATURE_METADATA_NAME);
|
|
21
22
|
if (!extension)
|
|
22
23
|
return;
|
|
23
24
|
const schemaClasses = extension.schema?.classes;
|
|
@@ -43,7 +44,7 @@ function decodeExtFeatureMetadata(scenegraph, options) {
|
|
|
43
44
|
}
|
|
44
45
|
}
|
|
45
46
|
/**
|
|
46
|
-
*
|
|
47
|
+
* Navigates through all properies in feature table and gets properties data.
|
|
47
48
|
* @param scenegraph
|
|
48
49
|
* @param featureTable
|
|
49
50
|
* @param schemaClass
|
|
@@ -60,7 +61,7 @@ function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
|
|
|
60
61
|
}
|
|
61
62
|
}
|
|
62
63
|
/**
|
|
63
|
-
*
|
|
64
|
+
* Navigates through all properies in feature texture and gets properties data.
|
|
64
65
|
* Data will be stored in featureTexture.properties[propertyName].data
|
|
65
66
|
* @param scenegraph
|
|
66
67
|
* @param featureTexture
|
|
@@ -224,26 +225,16 @@ function getVal(parsedImage, offset) {
|
|
|
224
225
|
}
|
|
225
226
|
function coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {
|
|
226
227
|
const w = parsedImage.width;
|
|
227
|
-
const iX = emod(u) * (w - 1);
|
|
228
|
+
const iX = (0, math_1.emod)(u) * (w - 1);
|
|
228
229
|
const indX = Math.round(iX);
|
|
229
230
|
const h = parsedImage.height;
|
|
230
|
-
const iY = emod(v) * (h - 1);
|
|
231
|
+
const iY = (0, math_1.emod)(v) * (h - 1);
|
|
231
232
|
const indY = Math.round(iY);
|
|
232
233
|
const components = parsedImage.components ? parsedImage.components : componentsCount;
|
|
233
234
|
// components is a number of channels in the image
|
|
234
235
|
const offset = (indY * w + indX) * components;
|
|
235
236
|
return offset;
|
|
236
237
|
}
|
|
237
|
-
// The following is taken from tile-converter\src\i3s-converter\helpers\batch-ids-extensions.ts
|
|
238
|
-
/**
|
|
239
|
-
* Handle UVs if they are out of range [0,1].
|
|
240
|
-
* @param n
|
|
241
|
-
* @param m
|
|
242
|
-
*/
|
|
243
|
-
function emod(n) {
|
|
244
|
-
const a = ((n % 1) + 1) % 1;
|
|
245
|
-
return a;
|
|
246
|
-
}
|
|
247
238
|
/**
|
|
248
239
|
* Find the feature table by class name.
|
|
249
240
|
* @param featureTables
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { GLTFTextureInfoMetadata } from './gltf-json-schema';
|
|
2
|
+
/**
|
|
3
|
+
* EXT_mesh_features extension types
|
|
4
|
+
* This is a primitive-level extension
|
|
5
|
+
* @see https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features
|
|
6
|
+
* or https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/mesh.primitive.EXT_mesh_features.schema.json
|
|
7
|
+
* An object describing feature IDs for a mesh primitive.
|
|
8
|
+
*/
|
|
9
|
+
export type GLTF_EXT_mesh_features = {
|
|
10
|
+
/** An array of feature ID sets. */
|
|
11
|
+
featureIds: GLTF_EXT_mesh_features_featureId[];
|
|
12
|
+
extensions?: Record<string, unknown>;
|
|
13
|
+
extras?: unknown;
|
|
14
|
+
/** For internal usage */
|
|
15
|
+
dataAttributeNames?: string[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* @see https://github.com/CesiumGS/glTF/blob/c38f7f37e894004353c15cd0481bc5b7381ce841/extensions/2.0/Vendor/EXT_mesh_features/schema/featureId.schema.json
|
|
19
|
+
* Feature IDs stored in an attribute or texture.
|
|
20
|
+
*/
|
|
21
|
+
export type GLTF_EXT_mesh_features_featureId = {
|
|
22
|
+
/** The number of unique features in the attribute or texture. */
|
|
23
|
+
featureCount: number;
|
|
24
|
+
/** A value that indicates that no feature is associated with this vertex or texel. */
|
|
25
|
+
nullFeatureId?: number;
|
|
26
|
+
/** A label assigned to this feature ID set. Labels must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */
|
|
27
|
+
label?: string;
|
|
28
|
+
/**
|
|
29
|
+
* An attribute containing feature IDs.
|
|
30
|
+
* When `attribute` and `texture` are omitted the feature IDs are assigned to vertices by their index.
|
|
31
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_mesh_features/schema/featureIdAttribute.schema.json
|
|
32
|
+
* 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`
|
|
33
|
+
* (e.g. a value of `0` corresponds to `_FEATURE_ID_0`).
|
|
34
|
+
*/
|
|
35
|
+
attribute?: number;
|
|
36
|
+
/** A texture containing feature IDs. */
|
|
37
|
+
texture?: GLTFTextureInfoMetadata;
|
|
38
|
+
/** The index of the property table containing per-feature property values. Only applicable when using the `EXT_structural_metadata` extension. */
|
|
39
|
+
propertyTable?: number;
|
|
40
|
+
extensions?: Record<string, unknown>;
|
|
41
|
+
extras?: unknown;
|
|
42
|
+
/** For internal usage */
|
|
43
|
+
data?: unknown;
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=gltf-ext-mesh-features-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-ext-mesh-features-schema.d.ts","sourceRoot":"","sources":["../../../src/lib/types/gltf-ext-mesh-features-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAG3D;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,mCAAmC;IACnC,UAAU,EAAE,gCAAgC,EAAE,CAAC;IAC/C,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,yBAAyB;IACzB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gCAAgC,GAAG;IAC7C,iEAAiE;IACjE,YAAY,EAAE,MAAM,CAAC;IACrB,sFAAsF;IACtF,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mJAAmJ;IACnJ,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,uBAAuB,CAAC;IAClC,kJAAkJ;IAClJ,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,yBAAyB;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { GLTFTextureInfoMetadata } from './gltf-json-schema';
|
|
2
|
+
/**
|
|
3
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/glTF.EXT_structural_metadata.schema.json
|
|
4
|
+
*/
|
|
5
|
+
export type GLTF_EXT_structural_metadata = {
|
|
6
|
+
/** An object defining classes and enums. */
|
|
7
|
+
schema?: GLTF_EXT_structural_metadata_Schema;
|
|
8
|
+
/** A uri to an external schema file. */
|
|
9
|
+
schemaUri?: string;
|
|
10
|
+
/** An array of property table definitions, which may be referenced by index. */
|
|
11
|
+
propertyTables?: GLTF_EXT_structural_metadata_PropertyTable[];
|
|
12
|
+
/** An array of property texture definitions, which may be referenced by index. */
|
|
13
|
+
propertyTextures?: GLTF_EXT_structural_metadata_PropertyTexture[];
|
|
14
|
+
/** "An array of property attribute definitions, which may be referenced by index. */
|
|
15
|
+
propertyAttributes?: GLTF_EXT_structural_metadata_PropertyAttribute[];
|
|
16
|
+
/** For internal usage */
|
|
17
|
+
dataAttributeNames?: string[];
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/schema.schema.json
|
|
21
|
+
*/
|
|
22
|
+
export type GLTF_EXT_structural_metadata_Schema = {
|
|
23
|
+
/** Unique identifier for the schema. Schema IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`. */
|
|
24
|
+
id: string;
|
|
25
|
+
/** The name of the schema. */
|
|
26
|
+
name?: string;
|
|
27
|
+
/** The description of the schema. */
|
|
28
|
+
description?: string;
|
|
29
|
+
/** Application-specific version of the schema. */
|
|
30
|
+
version?: string;
|
|
31
|
+
/** A dictionary, where each key is a class ID and each value is an object defining the class. */
|
|
32
|
+
classes?: {
|
|
33
|
+
[key: string]: GLTF_EXT_structural_metadata_Class;
|
|
34
|
+
};
|
|
35
|
+
/** A dictionary, where each key is an enum ID and each value is an object defining the values for the enum. */
|
|
36
|
+
enums?: {
|
|
37
|
+
[key: string]: GLTF_EXT_structural_metadata_Enum;
|
|
38
|
+
};
|
|
39
|
+
extensions?: Record<string, any>;
|
|
40
|
+
extras?: any;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* An object defining the values of an enum.
|
|
44
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.schema.json
|
|
45
|
+
*/
|
|
46
|
+
export type GLTF_EXT_structural_metadata_Enum = {
|
|
47
|
+
/** The name of the enum, e.g. for display purposes. */
|
|
48
|
+
name?: string;
|
|
49
|
+
/** The description of the enum. */
|
|
50
|
+
description?: string;
|
|
51
|
+
/** The type of the integer enum value. */
|
|
52
|
+
valueType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64';
|
|
53
|
+
/** An array of enum values. Duplicate names or duplicate integer values are not allowed. */
|
|
54
|
+
values: GLTF_EXT_structural_metadata_EnumValue[];
|
|
55
|
+
extensions?: Record<string, any>;
|
|
56
|
+
extras?: any;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/enum.value.schema.json
|
|
60
|
+
*/
|
|
61
|
+
export type GLTF_EXT_structural_metadata_EnumValue = {
|
|
62
|
+
/** The name of the enum value. */
|
|
63
|
+
name: string;
|
|
64
|
+
/** The description of the enum value. */
|
|
65
|
+
description?: string;
|
|
66
|
+
/** The integer enum value. */
|
|
67
|
+
value: number;
|
|
68
|
+
extensions?: Record<string, any>;
|
|
69
|
+
extras?: any;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.schema.json
|
|
73
|
+
*/
|
|
74
|
+
export type GLTF_EXT_structural_metadata_Class = {
|
|
75
|
+
/** The name of the class, e.g. for display purposes. */
|
|
76
|
+
name?: string;
|
|
77
|
+
/** The description of the class. */
|
|
78
|
+
description?: string;
|
|
79
|
+
/**
|
|
80
|
+
* A dictionary, where each key is a property ID and each value is an object defining the property.
|
|
81
|
+
* Property IDs must be alphanumeric identifiers matching the regular expression `^[a-zA-Z_][a-zA-Z0-9_]*$`.
|
|
82
|
+
*/
|
|
83
|
+
properties: {
|
|
84
|
+
[key: string]: GLTF_EXT_structural_metadata_ClassProperty;
|
|
85
|
+
};
|
|
86
|
+
extensions?: Record<string, any>;
|
|
87
|
+
extras?: any;
|
|
88
|
+
};
|
|
89
|
+
/**
|
|
90
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/class.property.schema.json
|
|
91
|
+
*/
|
|
92
|
+
export type GLTF_EXT_structural_metadata_ClassProperty = {
|
|
93
|
+
/** The name of the property, e.g. for display purposes. */
|
|
94
|
+
name?: string;
|
|
95
|
+
/** The description of the property. */
|
|
96
|
+
description?: string;
|
|
97
|
+
/** The element type. */
|
|
98
|
+
type: 'SCALAR' | 'VEC2' | 'VEC3' | 'VEC4' | 'MAT2' | 'MAT3' | 'MAT4' | 'BOOLEAN' | 'STRING' | 'ENUM';
|
|
99
|
+
/** The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types. */
|
|
100
|
+
componentType?: 'INT8' | 'UINT8' | 'INT16' | 'UINT16' | 'INT32' | 'UINT32' | 'INT64' | 'UINT64' | 'FLOAT32' | 'FLOAT64';
|
|
101
|
+
/** Enum ID as declared in the `enums` dictionary. Required when `type` is `ENUM`. */
|
|
102
|
+
enumType?: string;
|
|
103
|
+
/**
|
|
104
|
+
* Whether the property is an array.
|
|
105
|
+
* When `count` is defined the property is a fixed-length array. Otherwise the property is a variable-length array.
|
|
106
|
+
*/
|
|
107
|
+
array?: boolean;
|
|
108
|
+
/** The number of array elements. May only be defined when `array` is true. */
|
|
109
|
+
count?: number;
|
|
110
|
+
/**
|
|
111
|
+
* Specifies whether integer values are normalized.
|
|
112
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types with integer component types.
|
|
113
|
+
* For unsigned integer component types, values are normalized between `[0.0, 1.0]`.
|
|
114
|
+
* For signed integer component types, values are normalized between `[-1.0, 1.0]`.
|
|
115
|
+
* For all other component types, this property must be false.
|
|
116
|
+
*/
|
|
117
|
+
normalized?: boolean;
|
|
118
|
+
/**
|
|
119
|
+
* An offset to apply to property values.
|
|
120
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
121
|
+
*/
|
|
122
|
+
offset?: number | number[];
|
|
123
|
+
/**
|
|
124
|
+
* A scale to apply to property values.
|
|
125
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
126
|
+
*/
|
|
127
|
+
scale?: number | number[];
|
|
128
|
+
/**
|
|
129
|
+
* Maximum allowed value for the property.
|
|
130
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
131
|
+
* This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
132
|
+
*/
|
|
133
|
+
max?: number | number[];
|
|
134
|
+
/**
|
|
135
|
+
* Minimum allowed value for the property.
|
|
136
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
137
|
+
* This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
138
|
+
*/
|
|
139
|
+
min?: number | number[];
|
|
140
|
+
default?: boolean | number | string | number[];
|
|
141
|
+
/**
|
|
142
|
+
* If required, the property must be present in every entity conforming to the class.
|
|
143
|
+
* If not required, individual entities may include `noData` values, or the entire property may be omitted.
|
|
144
|
+
* As a result, `noData` has no effect on a required property.
|
|
145
|
+
* Client implementations may use required properties to make performance optimizations.
|
|
146
|
+
*/
|
|
147
|
+
required?: boolean;
|
|
148
|
+
/**
|
|
149
|
+
* A `noData` value represents missing data — also known as a sentinel value — wherever it appears.
|
|
150
|
+
* `BOOLEAN` properties may not specify `noData` values.
|
|
151
|
+
* This is given as the plain property value, without the transforms from the `normalized`, `offset`, and `scale` properties.
|
|
152
|
+
* Must not be defined if `required` is true.
|
|
153
|
+
*/
|
|
154
|
+
noData?: number | string | number[] | string[];
|
|
155
|
+
/**
|
|
156
|
+
* An identifier that describes how this property should be interpreted.
|
|
157
|
+
* The semantic cannot be used by other properties in the class.
|
|
158
|
+
*/
|
|
159
|
+
semantic?: string;
|
|
160
|
+
extensions?: Record<string, any>;
|
|
161
|
+
extras?: any;
|
|
162
|
+
};
|
|
163
|
+
export type GLTF_EXT_structural_metadata_PropertyTable = {
|
|
164
|
+
/** The name of the property table, e.g. for display purposes. */
|
|
165
|
+
name?: string;
|
|
166
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
167
|
+
class: string;
|
|
168
|
+
/** The number of elements in each property array. */
|
|
169
|
+
count: number;
|
|
170
|
+
/**
|
|
171
|
+
* A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
172
|
+
* and each value is an object describing where property values are stored.
|
|
173
|
+
* Required properties must be included in this dictionary.
|
|
174
|
+
*/
|
|
175
|
+
properties?: {
|
|
176
|
+
[key: string]: GLTF_EXT_structural_metadata_PropertyTable_Property;
|
|
177
|
+
};
|
|
178
|
+
extensions?: Record<string, any>;
|
|
179
|
+
extras?: any;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTable.property.schema.json
|
|
183
|
+
*/
|
|
184
|
+
export type GLTF_EXT_structural_metadata_PropertyTable_Property = {
|
|
185
|
+
/**
|
|
186
|
+
* The index of the buffer view containing property values.
|
|
187
|
+
* The data type of property values is determined by the property definition:
|
|
188
|
+
* When `type` is `BOOLEAN` values are packed into a bitstream.
|
|
189
|
+
* When `type` is `STRING` values are stored as byte sequences and decoded as UTF-8 strings.
|
|
190
|
+
* When `type` is `SCALAR`, `VECN`, or `MATN` the values are stored as the provided `componentType`
|
|
191
|
+
* and the buffer view `byteOffset` must be aligned to a multiple of the `componentType` size.
|
|
192
|
+
* When `type` is `ENUM` values are stored as the enum's `valueType`
|
|
193
|
+
* and the buffer view `byteOffset` must be aligned to a multiple of the `valueType` size.
|
|
194
|
+
* Each enum value in the array must match one of the allowed values in the enum definition.
|
|
195
|
+
* `arrayOffsets` is required for variable-length arrays and `stringOffsets` is required for strings (for variable-length arrays of strings, both are required).
|
|
196
|
+
*/
|
|
197
|
+
values: number;
|
|
198
|
+
/**
|
|
199
|
+
* The index of the buffer view containing offsets for variable-length arrays.
|
|
200
|
+
* The number of offsets is equal to the property table `count` plus one.
|
|
201
|
+
* The offsets represent the start positions of each array, with the last offset representing the position after the last array.
|
|
202
|
+
* The array length is computed using the difference between the subsequent offset and the current offset.
|
|
203
|
+
* 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`).
|
|
204
|
+
* The data type of these offsets is determined by `arrayOffsetType`.
|
|
205
|
+
* The buffer view `byteOffset` must be aligned to a multiple of the `arrayOffsetType` size.
|
|
206
|
+
*/
|
|
207
|
+
arrayOffsets?: number;
|
|
208
|
+
/**
|
|
209
|
+
* The index of the buffer view containing offsets for strings.
|
|
210
|
+
* The number of offsets is equal to the number of string elements plus one.
|
|
211
|
+
* 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.
|
|
212
|
+
* The string byte length is computed using the difference between the subsequent offset and the current offset.
|
|
213
|
+
* The data type of these offsets is determined by `stringOffsetType`.
|
|
214
|
+
* The buffer view `byteOffset` must be aligned to a multiple of the `stringOffsetType` size.
|
|
215
|
+
*/
|
|
216
|
+
stringOffsets?: number;
|
|
217
|
+
/**
|
|
218
|
+
* The type of values in `arrayOffsets`.
|
|
219
|
+
*/
|
|
220
|
+
arrayOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64';
|
|
221
|
+
/**
|
|
222
|
+
* The type of values in `stringOffsets`.
|
|
223
|
+
*/
|
|
224
|
+
stringOffsetType?: 'UINT8' | 'UINT16' | 'UINT32' | 'UINT64';
|
|
225
|
+
/**
|
|
226
|
+
* An offset to apply to property values.
|
|
227
|
+
* Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
228
|
+
* Overrides the class property's `offset` if both are defined.
|
|
229
|
+
*/
|
|
230
|
+
offset?: number | number[];
|
|
231
|
+
/**
|
|
232
|
+
* A scale to apply to property values.
|
|
233
|
+
* Only applicable when the component type is `FLOAT32` or `FLOAT64`, or when the property is `normalized`.
|
|
234
|
+
* Overrides the class property's `scale` if both are defined.
|
|
235
|
+
*/
|
|
236
|
+
scale?: number | number[];
|
|
237
|
+
/**
|
|
238
|
+
* Maximum value present in the property values.
|
|
239
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
240
|
+
* This is the maximum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
241
|
+
*/
|
|
242
|
+
max?: number | number[];
|
|
243
|
+
/**
|
|
244
|
+
* Minimum value present in the property values.
|
|
245
|
+
* Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
246
|
+
* This is the minimum of all property values, after the transforms based on the `normalized`, `offset`, and `scale` properties have been applied.
|
|
247
|
+
*/
|
|
248
|
+
min?: number | number[];
|
|
249
|
+
extensions?: Record<string, any>;
|
|
250
|
+
extras?: any;
|
|
251
|
+
/** For internal usage */
|
|
252
|
+
data?: unknown;
|
|
253
|
+
};
|
|
254
|
+
/**
|
|
255
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyTexture.schema.json
|
|
256
|
+
*/
|
|
257
|
+
export type GLTF_EXT_structural_metadata_PropertyTexture = {
|
|
258
|
+
/** The name of the property texture, e.g. for display purposes. */
|
|
259
|
+
name?: string;
|
|
260
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
261
|
+
class: string;
|
|
262
|
+
/**
|
|
263
|
+
* A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
264
|
+
* and each value is an object describing where property values are stored.
|
|
265
|
+
* Required properties must be included in this dictionary.
|
|
266
|
+
*
|
|
267
|
+
* https://github.com/CesiumGS/glTF/tree/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata
|
|
268
|
+
* Each property that is defined in the propertyTexture object extends the glTF textureInfo object.
|
|
269
|
+
* The texCoord specifies a texture coordinate set in the referring primitive.
|
|
270
|
+
* The index is the index of the glTF texture object that stores the actual data. Additionally,
|
|
271
|
+
* each property specifies an array of channels, which are the indices of the texture channels providing data for the respective property.
|
|
272
|
+
* Channels of an RGBA texture are numbered 0..3 respectively.
|
|
273
|
+
*/
|
|
274
|
+
properties?: {
|
|
275
|
+
[key: string]: GLTFTextureInfoMetadata;
|
|
276
|
+
};
|
|
277
|
+
extensions?: Record<string, any>;
|
|
278
|
+
extras?: any;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* @see https://github.com/CesiumGS/glTF/blob/3d-tiles-next/extensions/2.0/Vendor/EXT_structural_metadata/schema/propertyAttribute.schema.json
|
|
282
|
+
*/
|
|
283
|
+
export type GLTF_EXT_structural_metadata_PropertyAttribute = {
|
|
284
|
+
/** The name of the property attribute, e.g. for display purposes. */
|
|
285
|
+
name?: string;
|
|
286
|
+
/** The class that property values conform to. The value must be a class ID declared in the `classes` dictionary. */
|
|
287
|
+
class: string;
|
|
288
|
+
/**
|
|
289
|
+
* "A dictionary, where each key corresponds to a property ID in the class' `properties` dictionary
|
|
290
|
+
* and each value is an object describing where property values are stored.
|
|
291
|
+
* Required properties must be included in this dictionary.
|
|
292
|
+
*/
|
|
293
|
+
properties?: {
|
|
294
|
+
[key: string]: any;
|
|
295
|
+
};
|
|
296
|
+
extensions?: Record<string, any>;
|
|
297
|
+
extras?: any;
|
|
298
|
+
};
|
|
299
|
+
/**
|
|
300
|
+
* @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
|
|
301
|
+
*/
|
|
302
|
+
export type GLTF_EXT_structural_metadata_Primitive = {
|
|
303
|
+
/** An array of indexes of property textures in the root `EXT_structural_metadata` object. */
|
|
304
|
+
propertyTextures?: number[];
|
|
305
|
+
/** An array of indexes of property attributes in the root `EXT_structural_metadata` object. */
|
|
306
|
+
propertyAttributes?: number[];
|
|
307
|
+
extensions?: Record<string, any>;
|
|
308
|
+
extras?: any;
|
|
309
|
+
};
|
|
310
|
+
//# sourceMappingURL=gltf-ext-structural-metadata-schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gltf-ext-structural-metadata-schema.d.ts","sourceRoot":"","sources":["../../../src/lib/types/gltf-ext-structural-metadata-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAC,MAAM,oBAAoB,CAAC;AAI3D;;GAEG;AACH,MAAM,MAAM,4BAA4B,GAAG;IACzC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,mCAAmC,CAAC;IAC7C,wCAAwC;IACxC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gFAAgF;IAChF,cAAc,CAAC,EAAE,0CAA0C,EAAE,CAAC;IAC9D,kFAAkF;IAClF,gBAAgB,CAAC,EAAE,4CAA4C,EAAE,CAAC;IAClE,qFAAqF;IACrF,kBAAkB,CAAC,EAAE,8CAA8C,EAAE,CAAC;IACtE,yBAAyB;IACzB,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAChD,gJAAgJ;IAChJ,EAAE,EAAE,MAAM,CAAC;IACX,8BAA8B;IAC9B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kDAAkD;IAClD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iGAAiG;IACjG,OAAO,CAAC,EAAE;QACR,CAAC,GAAG,EAAE,MAAM,GAAG,kCAAkC,CAAC;KACnD,CAAC;IACF,+GAA+G;IAC/G,KAAK,CAAC,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,iCAAiC,CAAC;KAClD,CAAC;IACF,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACjC,MAAM,CAAC,EAAE,GAAG,CAAC;CACd,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,iC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