@margoengine/tiles 0.0.0-stage → 0.1.0

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.
Files changed (54) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +307 -3
  4. package/dist/bounds-CgKJT3Pg.js +161 -0
  5. package/dist/bounds.d.ts +66 -0
  6. package/dist/data-uri-DbGLVHq5.js +132 -0
  7. package/dist/data-uri.d.ts +2 -0
  8. package/dist/errors-D5_2oB8I.js +7 -0
  9. package/dist/fade.d.ts +34 -0
  10. package/dist/fade.js +129 -0
  11. package/dist/feature-texture.d.ts +19 -0
  12. package/dist/features.d.ts +78 -0
  13. package/dist/features.js +401 -0
  14. package/dist/formats-NNuOXg-1.js +390 -0
  15. package/dist/formats.d.ts +124 -0
  16. package/dist/glb-BU81jlYZ.js +25 -0
  17. package/dist/height.d.ts +20 -0
  18. package/dist/height.js +31 -0
  19. package/dist/i3dm.d.ts +16 -0
  20. package/dist/i3dm.js +85 -0
  21. package/dist/imagery.d.ts +108 -0
  22. package/dist/imagery.js +325 -0
  23. package/dist/implicit.d.ts +42 -0
  24. package/dist/index.d.ts +9 -0
  25. package/dist/index.js +849 -0
  26. package/dist/ion.d.ts +106 -0
  27. package/dist/ion.js +152 -0
  28. package/dist/json-BQoirgm5.js +4 -0
  29. package/dist/matrix-DcI5oFrD.js +89 -0
  30. package/dist/matrix.d.ts +32 -0
  31. package/dist/memory.d.ts +44 -0
  32. package/dist/metadata.d.ts +147 -0
  33. package/dist/metadata.js +285 -0
  34. package/dist/properties.d.ts +94 -0
  35. package/dist/properties.js +320 -0
  36. package/dist/queue.d.ts +37 -0
  37. package/dist/raw-accessor.d.ts +4 -0
  38. package/dist/renderer.d.ts +193 -0
  39. package/dist/s2.d.ts +37 -0
  40. package/dist/s2.js +181 -0
  41. package/dist/scene-scope-DufD_3B6.js +42 -0
  42. package/dist/screen-door-CMv5Jko4.js +11 -0
  43. package/dist/shared/screen-door.d.ts +9 -0
  44. package/dist/splats.d.ts +80 -0
  45. package/dist/splats.js +187 -0
  46. package/dist/style.d.ts +61 -0
  47. package/dist/style.js +609 -0
  48. package/dist/terrain.d.ts +96 -0
  49. package/dist/terrain.js +434 -0
  50. package/dist/tileset.d.ts +316 -0
  51. package/dist/uv-transform.d.ts +11 -0
  52. package/dist/wgs84-C5btsGGY.js +18 -0
  53. package/dist/wgs84.d.ts +24 -0
  54. package/package.json +124 -6
@@ -0,0 +1,285 @@
1
+ import { a as e, i as t, n, t as r } from "./glb-BU81jlYZ.js";
2
+ import { t as i } from "./formats-NNuOXg-1.js";
3
+ //#region src/metadata.ts
4
+ var a = {
5
+ INT8: 1,
6
+ UINT8: 1,
7
+ INT16: 2,
8
+ UINT16: 2,
9
+ INT32: 4,
10
+ UINT32: 4,
11
+ INT64: 8,
12
+ UINT64: 8,
13
+ FLOAT32: 4,
14
+ FLOAT64: 8
15
+ }, o = {
16
+ SCALAR: 1,
17
+ VEC2: 2,
18
+ VEC3: 3,
19
+ VEC4: 4,
20
+ MAT2: 4,
21
+ MAT3: 9,
22
+ MAT4: 16,
23
+ ENUM: 1
24
+ }, s = {
25
+ INT8: 127,
26
+ UINT8: 255,
27
+ INT16: 32767,
28
+ UINT16: 65535,
29
+ INT32: 2147483647,
30
+ UINT32: 4294967295,
31
+ INT64: 0x8000000000000000,
32
+ UINT64: 0x10000000000000000
33
+ }, c = /* @__PURE__ */ new TextDecoder();
34
+ function l(e, t, n) {
35
+ switch (n) {
36
+ case "INT8": return e.getInt8(t);
37
+ case "UINT8": return e.getUint8(t);
38
+ case "INT16": return e.getInt16(t, !0);
39
+ case "UINT16": return e.getUint16(t, !0);
40
+ case "INT32": return e.getInt32(t, !0);
41
+ case "UINT32": return e.getUint32(t, !0);
42
+ case "INT64": return Number(e.getBigInt64(t, !0));
43
+ case "UINT64": return Number(e.getBigUint64(t, !0));
44
+ case "FLOAT32": return e.getFloat32(t, !0);
45
+ case "FLOAT64": return e.getFloat64(t, !0);
46
+ default: throw TypeError(`Unknown metadata componentType ${n}; use INT8 to UINT64, FLOAT32 or FLOAT64`);
47
+ }
48
+ }
49
+ var u = class {
50
+ constructor(e, t, n, r, i, s, c = "UINT16") {
51
+ this.name = e, this.definition = t, this.count = r, this.enumValues = s, this.enumType = c;
52
+ let l = t.type;
53
+ if (l !== "STRING" && l !== "BOOLEAN" && !o[l]) throw TypeError(`Property ${e}: unknown type ${l}; use SCALAR, VECn, MATn, STRING, BOOLEAN or ENUM`);
54
+ if ((l === "SCALAR" || l.startsWith("VEC") || l.startsWith("MAT")) && !a[t.componentType]) throw TypeError(`Property ${e}: ${l} needs a componentType (INT8 to UINT64, FLOAT32 or FLOAT64)`);
55
+ if (t.array && t.count === void 0 && n.arrayOffsets === void 0) throw TypeError(`Property ${e}: a variable-length array needs arrayOffsets`);
56
+ if (l === "STRING" && n.stringOffsets === void 0) throw TypeError(`Property ${e}: a STRING property needs stringOffsets`);
57
+ this.components = o[l] ?? 1;
58
+ let u = (e) => new DataView(e.buffer, e.byteOffset, e.byteLength);
59
+ this.values = u(i(n.values, `property ${e} values`)), n.arrayOffsets !== void 0 && (this.arrays = u(i(n.arrayOffsets, `property ${e} arrayOffsets`))), n.stringOffsets !== void 0 && (this.strings = u(i(n.stringOffsets, `property ${e} stringOffsets`))), this.arrayType = n.arrayOffsetType ?? "UINT32", this.stringType = n.stringOffsetType ?? "UINT32", this.offset = n.offset ?? t.offset, this.scale = n.scale ?? t.scale;
60
+ }
61
+ offsetAt(e, t, n, r) {
62
+ let i = a[n];
63
+ if ((t + 1) * i > e.byteLength) throw RangeError(`Property ${this.name}: ${r} ${t} is past its buffer view; the file is truncated or corrupt`);
64
+ return l(e, t * i, n);
65
+ }
66
+ range(e) {
67
+ let t = this.definition;
68
+ return t.array ? t.count === void 0 ? [this.offsetAt(this.arrays, e, this.arrayType, "array offset"), this.offsetAt(this.arrays, e + 1, this.arrayType, "array offset")] : [e * t.count, e * t.count + t.count] : [e, e + 1];
69
+ }
70
+ element(e) {
71
+ let t = this.definition, n = t.type;
72
+ if (n === "BOOLEAN") {
73
+ let t = e >> 3;
74
+ if (t >= this.values.byteLength) throw RangeError(`Property ${this.name}: boolean ${e} is past its buffer view; the file is truncated or corrupt, re-export it`);
75
+ return (this.values.getUint8(t) >> (e & 7) & 1) == 1;
76
+ }
77
+ if (n === "STRING") {
78
+ let t = this.offsetAt(this.strings, e, this.stringType, "string offset"), n = this.offsetAt(this.strings, e + 1, this.stringType, "string offset");
79
+ if (n < t || n > this.values.byteLength) throw RangeError(`Property ${this.name}: string ${e} is past its buffer view; the file is corrupt`);
80
+ return c.decode(new Uint8Array(this.values.buffer, this.values.byteOffset + t, n - t));
81
+ }
82
+ let r = n === "ENUM" ? this.enumType : t.componentType, i = a[r], o = this.components, s = e * o * i;
83
+ if (s + o * i > this.values.byteLength) throw RangeError(`Property ${this.name}: element ${e} is past its buffer view; the file is truncated or corrupt`);
84
+ let u = [];
85
+ for (let e = 0; e < o; e++) u.push(l(this.values, s + e * i, r));
86
+ return n === "ENUM" ? this.enumValues?.get(u[0]) ?? u[0] : o === 1 ? u[0] : u;
87
+ }
88
+ transform(e, t) {
89
+ let n = this.definition;
90
+ if (n.type === "STRING" || n.type === "BOOLEAN" || n.type === "ENUM") return e;
91
+ let r = n.normalized && s[n.componentType], i = n.componentType === "FLOAT32" || n.componentType === "FLOAT64";
92
+ if (!r && !i) return e;
93
+ let a = (e, r, i) => {
94
+ let a = e;
95
+ return Array.isArray(a) && n.array && n.count !== void 0 && (a = a[t]), Array.isArray(a) && (a = a[r]), typeof a == "number" ? a : i;
96
+ }, o = (e, t) => {
97
+ let i = e;
98
+ return r && (i = n.componentType.startsWith("U") ? i / r : Math.max(i / r, -1)), a(this.offset, t, 0) + a(this.scale, t, 1) * i;
99
+ };
100
+ return Array.isArray(e) ? e.map((e, t) => o(e, t)) : o(e, 0);
101
+ }
102
+ equals(e, t) {
103
+ return Array.isArray(e) && Array.isArray(t) ? e.length === t.length && e.every((e, n) => this.equals(e, t[n])) : e === t;
104
+ }
105
+ get(e) {
106
+ if (!Number.isInteger(e) || e < 0 || e >= this.count) return;
107
+ let t = this.definition, [n, r] = this.range(e);
108
+ if (r < n) throw RangeError(`Property ${this.name}: array ${e} ends before it starts; the file is corrupt`);
109
+ let i = Array.from({ length: r - n }, (e, t) => this.element(n + t)), a = t.array ? i : i[0];
110
+ return t.noData !== void 0 && this.equals(a, t.noData) ? t.default : t.array ? i.map((e, t) => this.transform(e, t)) : this.transform(a, 0);
111
+ }
112
+ }, d = class {
113
+ constructor(e, t, n) {
114
+ this.json = e, this.schema = t, this.columns = /* @__PURE__ */ new Map();
115
+ let r = t.classes?.[e.class];
116
+ if (!r) throw TypeError(`Property table ${e.name ?? ""} names class ${e.class}, which the schema lacks; add the class to the schema or fix the table`);
117
+ if (!Number.isInteger(e.count) || e.count < 0) throw TypeError(`Property table ${e.name ?? e.class}: count must be a whole number of 0 or more`);
118
+ let i = r.properties ?? {};
119
+ this.names = Object.keys(i);
120
+ for (let [r, a] of Object.entries(e.properties ?? {})) {
121
+ let o = i[r];
122
+ if (!o) throw TypeError(`Property table ${e.class}: property ${r} is not in the class; add it to the class or remove the column`);
123
+ let s = o.type === "ENUM" ? t.enums?.[o.enumType ?? ""] : void 0;
124
+ if (o.type === "ENUM" && !s) throw TypeError(`Property ${r}: enum ${o.enumType} is not in the schema; add the enum to the schema`);
125
+ this.columns.set(r, new u(r, o, a, e.count, n, s && new Map(s.values.map(({ name: e, value: t }) => [t, e])), s?.valueType));
126
+ }
127
+ }
128
+ get name() {
129
+ return this.json.name;
130
+ }
131
+ get class() {
132
+ return this.json.class;
133
+ }
134
+ get count() {
135
+ return this.json.count;
136
+ }
137
+ get(e, t) {
138
+ if (!Number.isInteger(e) || e < 0 || e >= this.json.count) return;
139
+ let n = this.columns.get(t);
140
+ return n ? n.get(e) : this.schema.classes?.[this.json.class]?.properties?.[t]?.default;
141
+ }
142
+ row(e) {
143
+ let t = {};
144
+ for (let n of this.names) t[n] = this.get(e, n);
145
+ return t;
146
+ }
147
+ };
148
+ function f(e) {
149
+ let t = /^data:[^,]*;base64,(.*)$/s.exec(e);
150
+ if (!t) return;
151
+ let n = atob(t[1]);
152
+ return Uint8Array.from(n, (e) => e.charCodeAt(0));
153
+ }
154
+ var p = {
155
+ 5120: [1, (e, t) => e.getInt8(t)],
156
+ 5121: [1, (e, t) => e.getUint8(t)],
157
+ 5122: [2, (e, t) => e.getInt16(t, !0)],
158
+ 5123: [2, (e, t) => e.getUint16(t, !0)],
159
+ 5125: [4, (e, t) => e.getUint32(t, !0)],
160
+ 5126: [4, (e, t) => e.getFloat32(t, !0)]
161
+ };
162
+ function m(i, a = {}) {
163
+ let o, s;
164
+ if (e(i)) {
165
+ let e = t(i), a = e.find((e) => e.type === n);
166
+ if (!a) throw TypeError("GLB has no JSON chunk; the file is not valid glTF 2.0");
167
+ o = JSON.parse(c.decode(a.data)), s = e.find((e) => e.type === r)?.data;
168
+ } else o = JSON.parse(c.decode(i));
169
+ let l = /* @__PURE__ */ new Map(), u = (e) => {
170
+ let t = l.get(e);
171
+ if (t) return t;
172
+ let n = o.buffers?.[e];
173
+ if (!n) throw TypeError(`glTF buffer ${e} does not exist; the file is corrupt`);
174
+ if (t = n.uri === void 0 ? s : f(n.uri) ?? a.buffer?.(e, n.uri), !t) throw TypeError(`glTF buffer ${e} (${n.uri ?? "GLB BIN"}) is missing; pass its bytes with the buffer option`);
175
+ return l.set(e, t), t;
176
+ }, m = (e, t) => {
177
+ let n = o.bufferViews?.[e];
178
+ if (!n) throw TypeError(`${t}: bufferView ${e} does not exist; the file is corrupt`);
179
+ let r = u(n.buffer), i = n.byteOffset ?? 0;
180
+ if (i + n.byteLength > r.byteLength) throw RangeError(`${t}: bufferView ${e} is past its buffer; the file is truncated or corrupt`);
181
+ return r.subarray(i, i + n.byteLength);
182
+ }, h = o.extensions?.EXT_structural_metadata, g = h?.schema;
183
+ if (h?.propertyTables?.length && !g) throw TypeError("EXT_structural_metadata uses schemaUri; only an embedded schema is read");
184
+ let _ = (h?.propertyTables ?? []).map((e) => new d(e, g, m)), v = (e, t) => {
185
+ let n = o.accessors?.[e];
186
+ if (!n || n.type !== "SCALAR" || !p[n.componentType]) throw TypeError(`Feature ID accessor ${e} must be a SCALAR of a glTF component type`);
187
+ let r = new Uint32Array(t);
188
+ if (a.accessor) {
189
+ let i = a.accessor(e), [o, s] = p[n.componentType], c = new DataView(i.buffer, i.byteOffset, i.byteLength);
190
+ if (n.count !== t || i.byteLength !== t * o) throw RangeError("Feature ID count must match vertices; correct the accessor");
191
+ for (let e = 0; e < t; e++) r[e] = s(c, e * o);
192
+ return r;
193
+ }
194
+ if (n.bufferView === void 0) return r;
195
+ let [i, s] = p[n.componentType], c = o.bufferViews[n.bufferView], l = m(n.bufferView, `feature ID accessor ${e}`), u = c?.byteStride ?? i, d = n.byteOffset ?? 0, f = new DataView(l.buffer, l.byteOffset, l.byteLength);
196
+ if (n.count > 0 && d + (n.count - 1) * u + i > l.byteLength) throw RangeError(`Feature ID accessor ${e} is past its buffer view; the file is corrupt`);
197
+ for (let e = 0; e < Math.min(t, n.count); e++) r[e] = s(f, d + e * u);
198
+ return r;
199
+ }, y = (o.meshes ?? []).map((e) => e.primitives.map((e) => {
200
+ let t = e.extensions?.EXT_mesh_features, n = e.attributes.POSITION, r = n === void 0 ? 0 : o.accessors?.[n]?.count ?? 0;
201
+ return (t?.featureIds ?? []).map((t) => {
202
+ if (t.propertyTable !== void 0 && !_[t.propertyTable]) throw TypeError(`Feature ID set names property table ${t.propertyTable}, which the glTF lacks; the file is corrupt, re-export it`);
203
+ let n;
204
+ if (t.attribute !== void 0) {
205
+ let i = e.attributes[`_FEATURE_ID_${t.attribute}`];
206
+ if (i === void 0) throw TypeError(`Feature ID set uses attribute _FEATURE_ID_${t.attribute}, which the primitive lacks; the file is corrupt, re-export it`);
207
+ n = v(i, r);
208
+ } else t.texture || (n = Uint32Array.from({ length: r }, (e, t) => t));
209
+ return {
210
+ ...t,
211
+ propertyTable: t.propertyTable === void 0 ? void 0 : _[t.propertyTable],
212
+ ids: n
213
+ };
214
+ });
215
+ }));
216
+ return {
217
+ schema: g,
218
+ propertyTables: _,
219
+ primitives: y,
220
+ feature(e, t, n, r = 0) {
221
+ let i = y[e]?.[t]?.[r], a = i?.ids?.[n];
222
+ if (!i || a === void 0 || a === i.nullFeatureId) return;
223
+ let o = i.propertyTable;
224
+ return {
225
+ id: a,
226
+ table: o,
227
+ properties: o?.row(a)
228
+ };
229
+ }
230
+ };
231
+ }
232
+ var h;
233
+ async function g() {
234
+ if (h) return h;
235
+ let { DracoPointsDecoder: e } = await import("@margoengine/decoders/draco-points");
236
+ return h ??= new e(), h;
237
+ }
238
+ async function _(e, t, n) {
239
+ let r = e.draco;
240
+ if (!r) return e;
241
+ let a = await (n ?? await g()).decode(r.bytes, { signal: t });
242
+ t?.throwIfAborted();
243
+ let o = a.pointCount;
244
+ if (o !== r.length) throw TypeError(`Draco pnts holds ${o} points but POINTS_LENGTH is ${r.length}; the file is corrupt, re-encode it`);
245
+ let s = (e, t, n) => {
246
+ if (t === void 0) return;
247
+ let r = a.attributes.find((e) => e.uniqueId === t);
248
+ if (!r) throw TypeError(`Draco pnts names attribute ${t} for ${e}, which the Draco buffer lacks; the file is corrupt, re-encode it`);
249
+ if (r.itemSize !== n || r.array.length < o * n) throw TypeError(`Draco pnts ${e} has ${r.itemSize} components per point; ${n} are needed`);
250
+ return r;
251
+ }, c = r.properties, l = s("POSITION", c.POSITION, 3), u = s("RGBA", c.RGBA, 4), d = u ? void 0 : s("RGB", c.RGB, 3), f = s("NORMAL", c.NORMAL, 3), p = s("BATCH_ID", c.BATCH_ID, 1);
252
+ if (!l) throw TypeError("Draco pnts must compress POSITION (3DTILES_draco_point_compression)");
253
+ let m = e.colors;
254
+ if (u || d) {
255
+ let e = u ?? d, t = u ? 4 : 3, n = e.array, r = n instanceof Uint8Array ? 255 : n instanceof Float32Array ? 1 : n instanceof Uint16Array ? 65535 : n instanceof Uint32Array ? 4294967295 : n instanceof Int8Array ? 127 : n instanceof Int16Array ? 32767 : 2147483647;
256
+ if (!(n instanceof Uint8Array) && !(n instanceof Float32Array) && !e.normalized) throw TypeError("Draco pnts colours are integers that are not normalized; re-encode them as bytes or normalized samples");
257
+ m = new Uint8Array(o * 4);
258
+ for (let e = 0; e < o; e++) {
259
+ for (let i = 0; i < t; i++) m[e * 4 + i] = Math.round(Math.min(1, Math.max(0, n[e * t + i] / r)) * 255);
260
+ t === 3 && (m[e * 4 + 3] = 255);
261
+ }
262
+ }
263
+ let h = e.batchTable;
264
+ if (r.batchProperties && h) {
265
+ let e = { ...h.json };
266
+ for (let [t, n] of Object.entries(r.batchProperties)) {
267
+ let r = a.attributes.find((e) => e.uniqueId === n);
268
+ if (!r) throw TypeError(`Draco pnts batch property ${t} names attribute ${n}, which the buffer lacks; the file is corrupt, re-encode it`);
269
+ let i = r.itemSize, s = Array.from(r.array);
270
+ e[t] = i === 1 ? s : Array.from({ length: o }, (e, t) => s.slice(t * i, t * i + i));
271
+ }
272
+ h = new i(e, h.binary, h.length);
273
+ }
274
+ return {
275
+ ...e,
276
+ positions: Float32Array.from(l.array),
277
+ colors: m,
278
+ normals: f ? Float32Array.from(f.array) : e.normals,
279
+ batchIds: p ? Uint32Array.from(p.array) : e.batchIds,
280
+ batchTable: h,
281
+ draco: void 0
282
+ };
283
+ }
284
+ //#endregion
285
+ export { d as PropertyTable, _ as dracoPoints, m as readStructuralMetadata };
@@ -0,0 +1,94 @@
1
+ // @ts-ignore optional peer: its types apply when it is installed
2
+ import type { GLTFAsset } from '@margoengine/gltf/pbr';
3
+ import { PropertyTable, type StructuralSchemaJSON } from './metadata.js';
4
+ /** Linear RGBA8 texture samples, top row first. No colour conversion or alpha premultiplication. */
5
+ export interface PropertyImage {
6
+ readonly width: number;
7
+ readonly height: number;
8
+ readonly data: Uint8Array | Uint8ClampedArray;
9
+ }
10
+ interface Transform {
11
+ offset?: unknown;
12
+ scale?: unknown;
13
+ }
14
+ interface TextureProperty extends Transform {
15
+ index: number;
16
+ texCoord?: number;
17
+ channels?: number[];
18
+ extensions?: {
19
+ KHR_texture_transform?: {
20
+ offset?: number[];
21
+ scale?: number[];
22
+ rotation?: number;
23
+ texCoord?: number;
24
+ };
25
+ };
26
+ }
27
+ interface TextureJSON {
28
+ class: string;
29
+ name?: string;
30
+ properties?: Record<string, TextureProperty>;
31
+ }
32
+ /** Synchronous property reader options; images are indexed by glTF texture, not image. */
33
+ export interface PropertyReadOptions {
34
+ schema?: StructuralSchemaJSON;
35
+ image?: (texture: number) => PropertyImage | undefined;
36
+ /** Original tightly packed bytes for a decoded accessor, when a codec's float cache loses raw sentinel precision. */
37
+ accessor?: (index: number) => Uint8Array | undefined;
38
+ /** Packed attribute allocation cap. Default: four times the asset's configured byte limit. */
39
+ maximumDecodedBytes?: number;
40
+ }
41
+ /** Network/resource options for loadPropertyMetadata. Existing asset buffers need no further loading. */
42
+ export interface PropertyLoadOptions extends PropertyReadOptions {
43
+ signal?: AbortSignal;
44
+ /** Defaults to asset.baseURL, then the current page. Required for relative resources in a parsed document in Node. */
45
+ baseURL?: string;
46
+ fetch?: (url: string, init?: {
47
+ signal?: AbortSignal;
48
+ }) => Promise<Response>;
49
+ /** Per schema or image resource. Default 64 MiB. */
50
+ maximumBytes?: number;
51
+ }
52
+ /** One schema class associated with attributes of a particular primitive. */
53
+ export declare class PropertyAttributes {
54
+ readonly table: PropertyTable;
55
+ readonly names: readonly string[];
56
+ constructor(table: PropertyTable);
57
+ get count(): number;
58
+ get class(): string;
59
+ /** Exact row value after noData/default, normalization and offset/scale. Out-of-range rows return undefined. */
60
+ get(vertex: number, name: string): unknown;
61
+ /** Every class property of one vertex, including default values. */
62
+ row(vertex: number): Record<string, unknown>;
63
+ }
64
+ type UV = readonly number[] | ((set: number) => readonly number[]);
65
+ /** One property texture. Queries read stored texels exactly; they do not interpolate encoded integer/float bytes. */
66
+ export declare class PropertyTextures {
67
+ readonly json: TextureJSON;
68
+ readonly schema: StructuralSchemaJSON;
69
+ private readonly asset;
70
+ readonly names: readonly string[];
71
+ private readonly decoders;
72
+ constructor(json: TextureJSON, schema: StructuralSchemaJSON, asset: GLTFAsset, options: PropertyReadOptions);
73
+ get class(): string;
74
+ /** Reads the nearest stored texel, with glTF wrapping, selected UV set and KHR_texture_transform. */
75
+ get(uv: UV, name: string): unknown;
76
+ /** Reads every class property. A UV callback supports properties using different coordinate sets. */
77
+ row(uv: UV): Record<string, unknown>;
78
+ }
79
+ /** Per-primitive property bindings and root texture definitions. */
80
+ export interface PropertyMetadata {
81
+ readonly schema: StructuralSchemaJSON;
82
+ readonly propertyTextures: readonly PropertyTextures[];
83
+ readonly primitives: readonly (readonly {
84
+ attributes: readonly PropertyAttributes[];
85
+ textures: readonly PropertyTextures[];
86
+ }[])[];
87
+ /** Properties at a triangle hit, using its barycentric UVs independently for each texture coordinate set. */
88
+ sample(mesh: number, primitive: number, triangle: number, barycoord: readonly number[]): readonly Record<string, unknown>[];
89
+ }
90
+ /** Reads property attributes and decoded property textures from a loaded glTF asset, without creating engine objects. */
91
+ export declare function readPropertyMetadata(asset: GLTFAsset, options?: PropertyReadOptions): PropertyMetadata;
92
+ /** Loads external schemas and referenced metadata images with cancellation, preserving raw PNG channels exactly. */
93
+ export declare function loadPropertyMetadata(asset: GLTFAsset, options?: PropertyLoadOptions): Promise<PropertyMetadata>;
94
+ export {};