@ifc-lite/geometry 7.5.2 → 7.7.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 (87) hide show
  1. package/README.md +10 -0
  2. package/dist/analytic-descriptions.d.ts +54 -0
  3. package/dist/analytic-descriptions.d.ts.map +1 -0
  4. package/dist/analytic-descriptions.js +5 -0
  5. package/dist/analytic-descriptions.js.map +1 -0
  6. package/dist/byte-streaming-prepass-result.d.ts +3 -0
  7. package/dist/byte-streaming-prepass-result.d.ts.map +1 -1
  8. package/dist/domain-export-call.d.ts +4 -0
  9. package/dist/domain-export-call.d.ts.map +1 -0
  10. package/dist/domain-export-call.js +19 -0
  11. package/dist/domain-export-call.js.map +1 -0
  12. package/dist/geometry-coordinate.d.ts.map +1 -1
  13. package/dist/geometry-coordinate.js +3 -0
  14. package/dist/geometry-coordinate.js.map +1 -1
  15. package/dist/geometry-parallel.d.ts.map +1 -1
  16. package/dist/geometry-parallel.js +12 -41
  17. package/dist/geometry-parallel.js.map +1 -1
  18. package/dist/geometry.worker.d.ts +3 -0
  19. package/dist/geometry.worker.d.ts.map +1 -1
  20. package/dist/geometry.worker.js +31 -17
  21. package/dist/geometry.worker.js.map +1 -1
  22. package/dist/huge-file-error.d.ts +1 -2
  23. package/dist/huge-file-error.d.ts.map +1 -1
  24. package/dist/huge-file-error.js +4 -5
  25. package/dist/huge-file-error.js.map +1 -1
  26. package/dist/ifc-lite-bridge.d.ts +12 -16
  27. package/dist/ifc-lite-bridge.d.ts.map +1 -1
  28. package/dist/ifc-lite-bridge.js +21 -28
  29. package/dist/ifc-lite-bridge.js.map +1 -1
  30. package/dist/index.d.ts +13 -16
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +24 -37
  33. package/dist/index.js.map +1 -1
  34. package/dist/map-normalization-capability.d.ts +7 -0
  35. package/dist/map-normalization-capability.d.ts.map +1 -0
  36. package/dist/map-normalization-capability.js +32 -0
  37. package/dist/map-normalization-capability.js.map +1 -0
  38. package/dist/mesh-specular.d.ts +15 -0
  39. package/dist/mesh-specular.d.ts.map +1 -0
  40. package/dist/mesh-specular.js +20 -0
  41. package/dist/mesh-specular.js.map +1 -0
  42. package/dist/native-bridge.d.ts +1 -0
  43. package/dist/native-bridge.d.ts.map +1 -1
  44. package/dist/native-bridge.js +1 -0
  45. package/dist/native-bridge.js.map +1 -1
  46. package/dist/packed-instanced-decoder.d.ts +9 -0
  47. package/dist/packed-instanced-decoder.d.ts.map +1 -1
  48. package/dist/packed-instanced-decoder.js +12 -1
  49. package/dist/packed-instanced-decoder.js.map +1 -1
  50. package/dist/platform-bridge.d.ts +2 -0
  51. package/dist/platform-bridge.d.ts.map +1 -1
  52. package/dist/platform-bridge.js.map +1 -1
  53. package/dist/remesh/index.d.ts +7 -0
  54. package/dist/remesh/index.d.ts.map +1 -0
  55. package/dist/remesh/index.js +10 -0
  56. package/dist/remesh/index.js.map +1 -0
  57. package/dist/remesh/remesh-client.d.ts +60 -0
  58. package/dist/remesh/remesh-client.d.ts.map +1 -0
  59. package/dist/remesh/remesh-client.js +135 -0
  60. package/dist/remesh/remesh-client.js.map +1 -0
  61. package/dist/remesh/remesh-core.d.ts +96 -0
  62. package/dist/remesh/remesh-core.d.ts.map +1 -0
  63. package/dist/remesh/remesh-core.js +112 -0
  64. package/dist/remesh/remesh-core.js.map +1 -0
  65. package/dist/remesh/remesh-protocol.d.ts +56 -0
  66. package/dist/remesh/remesh-protocol.d.ts.map +1 -0
  67. package/dist/remesh/remesh-protocol.js +32 -0
  68. package/dist/remesh/remesh-protocol.js.map +1 -0
  69. package/dist/remesh/remesh.worker.d.ts +2 -0
  70. package/dist/remesh/remesh.worker.d.ts.map +1 -0
  71. package/dist/remesh/remesh.worker.js +117 -0
  72. package/dist/remesh/remesh.worker.js.map +1 -0
  73. package/dist/shard-style-merge.d.ts +27 -0
  74. package/dist/shard-style-merge.d.ts.map +1 -0
  75. package/dist/shard-style-merge.js +54 -0
  76. package/dist/shard-style-merge.js.map +1 -0
  77. package/dist/style-finishes.d.ts +25 -0
  78. package/dist/style-finishes.d.ts.map +1 -0
  79. package/dist/style-finishes.js +32 -0
  80. package/dist/style-finishes.js.map +1 -0
  81. package/dist/types.d.ts +11 -0
  82. package/dist/types.d.ts.map +1 -1
  83. package/dist/types.js.map +1 -1
  84. package/dist/worker-prepass-source.d.ts +9 -0
  85. package/dist/worker-prepass-source.d.ts.map +1 -1
  86. package/dist/worker-prepass-source.js.map +1 -1
  87. package/package.json +10 -5
@@ -0,0 +1,112 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ import { restashWasmPanicLocation, takeWasmPanicStash } from '../wasm-panic-forward.js';
5
+ import { convertMeshCollectionToBatch } from '../geometry-coordinate.js';
6
+ /** Apply every config field, so a changed field can never be left stale. */
7
+ export function applyRemeshConfig(api, config) {
8
+ api.setMergeLayers(config.mergeLayers);
9
+ api.setTessellationQuality(config.tessellationQuality);
10
+ api.setSkipSmallCuts(config.skipSmallCuts);
11
+ api.setRectParamFastPath(config.rectParamFastPath);
12
+ }
13
+ /** Keep the `(id, start, end)` job triplets whose id is a target. */
14
+ export function filterJobsToTargets(jobs, targets) {
15
+ const wanted = new Set(targets);
16
+ const kept = [];
17
+ for (let i = 0; i + 2 < jobs.length; i += 3) {
18
+ if (wanted.has(jobs[i]))
19
+ kept.push(jobs[i], jobs[i + 1], jobs[i + 2]);
20
+ }
21
+ return Uint32Array.from(kept);
22
+ }
23
+ /**
24
+ * Narrow the model's style wire to the ids a subgraph holds. The engine
25
+ * builds a colour map from every entry it is sent, so sending a large model's
26
+ * whole wire costs a map build per re-mesh. The wire is keyed by item and
27
+ * element ids, and both are in the subgraph when they matter.
28
+ */
29
+ export function filterStyleWire(styleIds, styleColors, keep) {
30
+ const ids = [];
31
+ const colors = [];
32
+ for (let i = 0; i < styleIds.length; i++) {
33
+ if (!keep.has(styleIds[i]))
34
+ continue;
35
+ ids.push(styleIds[i]);
36
+ for (let c = 0; c < 4; c++)
37
+ colors.push(styleColors[i * 4 + c]);
38
+ }
39
+ return { styleIds: Uint32Array.from(ids), styleColors: Uint8Array.from(colors) };
40
+ }
41
+ /** Always clear the cache, preserving a primary operation failure if cleanup also fails. */
42
+ function withPrepassCache(api, operation) {
43
+ let result;
44
+ try {
45
+ result = operation();
46
+ }
47
+ catch (error) {
48
+ const realm = typeof self === 'undefined' ? globalThis : self;
49
+ const panic = takeWasmPanicStash(realm);
50
+ try {
51
+ api.clearPrePassCache();
52
+ }
53
+ catch (cleanupError) {
54
+ console.warn('[remesh] clearing the failed pre-pass cache also failed:', cleanupError);
55
+ }
56
+ takeWasmPanicStash(realm);
57
+ if (panic)
58
+ restashWasmPanicLocation(realm, panic.location, panic.at, error instanceof Error ? error.message : String(error));
59
+ throw error;
60
+ }
61
+ api.clearPrePassCache();
62
+ return result;
63
+ }
64
+ /**
65
+ * Pre-pass the subgraph, mesh the targets in the load frame, and release the
66
+ * pre-pass cache on every exit (the per-content caches are keyed to this
67
+ * buffer and would otherwise leak into the next request).
68
+ */
69
+ export function remeshOnApi(api, req, now = () => performance.now()) {
70
+ const start = now();
71
+ return withPrepassCache(api, () => {
72
+ // Inside the scope: a pre-pass that throws part-way may already have
73
+ // cached this buffer's index, which the next request must not inherit.
74
+ const prePass = api.buildPrePassOnce(req.buffer);
75
+ const prepassDone = now();
76
+ const jobs = filterJobsToTargets(prePass.jobs ?? new Uint32Array(), req.targets);
77
+ if (jobs.length === 0) {
78
+ return { meshes: [], csgFailures: 0, ms: { prepass: prepassDone - start, produce: 0 } };
79
+ }
80
+ const { frame } = req;
81
+ const collection = api.processGeometryBatch(req.buffer, jobs, prePass.unitScale, frame.x, frame.y, frame.z, frame.needsShift, prePass.voidKeys, prePass.voidCounts, prePass.voidValues, req.styleIds, req.styleColors, prePass.planeAngleToRadians, req.materialElementIds, req.materialColorCounts, req.materialColors);
82
+ // Read before conversion: `convertMeshCollectionToBatch` frees the collection.
83
+ let csgFailures;
84
+ try {
85
+ const diagnostics = collection.diagnostics;
86
+ csgFailures = diagnostics?.totalCsgFailures ?? 0;
87
+ }
88
+ catch (error) {
89
+ collection.free();
90
+ throw error;
91
+ }
92
+ const meshes = convertMeshCollectionToBatch(collection);
93
+ return { meshes, csgFailures, ms: { prepass: prepassDone - start, produce: now() - prepassDone } };
94
+ });
95
+ }
96
+ /**
97
+ * Pre-pass a whole model once and keep only its style wire, releasing the
98
+ * pre-pass cache. Copies each array so nothing aliases the wasm heap.
99
+ */
100
+ export function styleWireOnApi(api, source) {
101
+ return withPrepassCache(api, () => {
102
+ const prePass = api.buildPrePassOnce(source);
103
+ return {
104
+ styleIds: prePass.styleIds.slice(),
105
+ styleColors: prePass.styleColors.slice(),
106
+ materialElementIds: prePass.materialElementIds?.slice() ?? new Uint32Array(),
107
+ materialColorCounts: prePass.materialColorCounts?.slice() ?? new Uint32Array(),
108
+ materialColors: prePass.materialColors?.slice() ?? new Uint8Array(),
109
+ };
110
+ });
111
+ }
112
+ //# sourceMappingURL=remesh-core.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remesh-core.js","sourceRoot":"","sources":["../../src/remesh/remesh-core.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAgB/D,OAAO,EAAE,wBAAwB,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACxF,OAAO,EAAE,4BAA4B,EAAE,MAAM,2BAA2B,CAAC;AAuEzE,4EAA4E;AAC5E,MAAM,UAAU,iBAAiB,CAAC,GAAc,EAAE,MAAoB;IACpE,GAAG,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;IACvC,GAAG,CAAC,sBAAsB,CAAC,MAAM,CAAC,mBAAmB,CAAC,CAAC;IACvD,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;IAC3C,GAAG,CAAC,oBAAoB,C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AC;QACD,MAAM,MAAM,GAAG,4BAA4B,CAAC,UAAU,CAAC,CAAC;QACxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE,WAAW,GAAG,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,WAAW,EAAE,EAAE,CAAC;IACrG,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,GAAc,EAAE,MAAkB;IAC/D,OAAO,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE;QAChC,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAA+B,CAAC;QAC3E,OAAO;YACL,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,KAAK,EAAE;YAClC,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,KAAK,EAAE;YACxC,kBAAkB,EAAE,OAAO,CAAC,kBAAkB,EAAE,KAAK,EAAE,IAAI,IAAI,WAAW,EAAE;YAC5E,mBAAmB,EAAE,OAAO,CAAC,mBAAmB,EAAE,KAAK,EAAE,IAAI,IAAI,WAAW,EAAE;YAC9E,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,KAAK,EAAE,IAAI,IAAI,UAAU,EAAE;SACpE,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,56 @@
1
+ /** Messages between `RemeshClient` and `remesh.worker.ts` (#6232 WP1). */
2
+ import type { MeshData } from '../types.js';
3
+ import type { RemeshConfig, RemeshRequest, RemeshResult, StyleWire } from './remesh-core.js';
4
+ export type RemeshWorkerInbound = {
5
+ type: 'init';
6
+ config: RemeshConfig;
7
+ wasmModule?: WebAssembly.Module;
8
+ wasmUrl?: string;
9
+ } | {
10
+ type: 'config';
11
+ config: RemeshConfig;
12
+ } | {
13
+ type: 'remesh';
14
+ requestId: number;
15
+ request: RemeshRequest;
16
+ } | {
17
+ type: 'style-wire';
18
+ requestId: number;
19
+ source: Uint8Array;
20
+ };
21
+ export type RemeshWorkerOutbound = {
22
+ type: 'ready';
23
+ } | ({
24
+ type: 'init-error';
25
+ message: string;
26
+ } & RemeshPanicDetails) | {
27
+ type: 'result';
28
+ requestId: number;
29
+ result: RemeshResult;
30
+ } | {
31
+ type: 'style-wire';
32
+ requestId: number;
33
+ wire: StyleWire;
34
+ } | ({
35
+ type: 'error';
36
+ requestId: number;
37
+ message: string;
38
+ } & RemeshPanicDetails);
39
+ /** Source location only: Rust panic messages can contain confidential model data. */
40
+ interface RemeshPanicDetails {
41
+ wasmPanicLocation?: string;
42
+ wasmPanicAt?: number;
43
+ }
44
+ /** The large per-mesh buffers, moved rather than copied across the boundary. */
45
+ export declare function meshTransferables(meshes: readonly MeshData[]): ArrayBuffer[];
46
+ /** The wire's buffers, moved back to the caller. */
47
+ export declare function styleWireTransferables(wire: StyleWire): ArrayBuffer[];
48
+ /**
49
+ * Run `handle` for each message strictly in order. A handler that rejects is
50
+ * reported to `onError` and the queue moves on: chaining the next message
51
+ * onto a rejected promise would skip every later message for the life of the
52
+ * worker, so its callers would wait forever.
53
+ */
54
+ export declare function serialQueue<T>(handle: (message: T) => Promise<void>, onError: (error: unknown) => void): (message: T) => void;
55
+ export {};
56
+ //# sourceMappingURL=remesh-protocol.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remesh-protocol.d.ts","sourceRoot":"","sources":["../../src/remesh/remesh-protocol.ts"],"names":[],"mappings":"AAIA,0EAA0E;AAE1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7F,MAAM,MAAM,mBAAmB,GAC3B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,UAAU,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC;IAAC,OAAO,C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O,CAAC,IAAI,CAAC,EACrC,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,GAChC,CAAC,OAAO,EAAE,CAAC,KAAK,IAAI,CAKtB"}
@@ -0,0 +1,32 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /** The large per-mesh buffers, moved rather than copied across the boundary. */
5
+ export function meshTransferables(meshes) {
6
+ const buffers = new Set();
7
+ for (const mesh of meshes) {
8
+ for (const view of [mesh.positions, mesh.normals, mesh.indices, mesh.uvs]) {
9
+ if (view && view.buffer instanceof ArrayBuffer)
10
+ buffers.add(view.buffer);
11
+ }
12
+ }
13
+ return [...buffers];
14
+ }
15
+ /** The wire's buffers, moved back to the caller. */
16
+ export function styleWireTransferables(wire) {
17
+ return [wire.styleIds, wire.styleColors, wire.materialElementIds, wire.materialColorCounts, wire.materialColors]
18
+ .flatMap((view) => (view.buffer instanceof ArrayBuffer ? [view.buffer] : []));
19
+ }
20
+ /**
21
+ * Run `handle` for each message strictly in order. A handler that rejects is
22
+ * reported to `onError` and the queue moves on: chaining the next message
23
+ * onto a rejected promise would skip every later message for the life of the
24
+ * worker, so its callers would wait forever.
25
+ */
26
+ export function serialQueue(handle, onError) {
27
+ let tail = Promise.resolve();
28
+ return (message) => {
29
+ tail = tail.then(() => handle(message)).catch(onError);
30
+ };
31
+ }
32
+ //# sourceMappingURL=remesh-protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remesh-protocol.js","sourceRoot":"","sources":["../../src/remesh/remesh-protocol.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA0B/D,gFAAgF;AAChF,MAAM,UAAU,iBAAiB,CAAC,MAA2B;IAC3D,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;IACvC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,KAAK,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1E,IAAI,IAAI,IAAI,IAAI,CAAC,MAAM,YAAY,WAAW;gBAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC;IACD,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC;AACtB,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,sBAAsB,CAAC,IAAe;IACpD,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,mBAAmB,EAAE,IAAI,CAAC,cAAc,CAAC;SAC7G,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,YAAY,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAClF,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAAqC,EACrC,OAAiC;IAEjC,IAAI,IAAI,GAAkB,OAAO,CAAC,OAAO,EAAE,CAAC;IAC5C,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=remesh.worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remesh.worker.d.ts","sourceRoot":"","sources":["../../src/remesh/remesh.worker.ts"],"names":[],"mappings":""}
@@ -0,0 +1,117 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Long-lived re-mesh worker (#6232 WP1). Instantiates the wasm engine ONCE,
6
+ * then meshes subgraph buffers on request with `remeshOnApi`. Messages are
7
+ * handled strictly in order, so a `config` posted between two requests
8
+ * applies to the second and not the first.
9
+ *
10
+ * A failed request drops its `IfcAPI`: cleanup may trap independently of
11
+ * the primary error. The next request gets a fresh handle with current config.
12
+ */
13
+ import init, { initSync, IfcAPI } from '@ifc-lite/wasm';
14
+ import { initWasmWithRetry } from '../wasm-init-retry.js';
15
+ import { freeWasmInstanceQuietly } from '../wasm-instance-free.js';
16
+ import { restashWasmPanicLocation, takeWasmPanicStash } from '../wasm-panic-forward.js';
17
+ import { applyRemeshConfig, remeshOnApi, styleWireOnApi } from './remesh-core.js';
18
+ import { meshTransferables, serialQueue, styleWireTransferables, } from './remesh-protocol.js';
19
+ const scope = self;
20
+ let config = null;
21
+ let api = null;
22
+ function post(message, transfer = []) {
23
+ scope.postMessage(message, transfer);
24
+ }
25
+ function errorMessage(error) {
26
+ return error instanceof Error ? error.message : String(error);
27
+ }
28
+ function errorDetails(error) {
29
+ const panic = takeWasmPanicStash(scope);
30
+ return { message: errorMessage(error), wasmPanicLocation: panic?.location, wasmPanicAt: panic?.at };
31
+ }
32
+ function freeFailedApi(instance) {
33
+ freeWasmInstanceQuietly(instance);
34
+ takeWasmPanicStash(scope); // A cleanup panic must not label the next operation.
35
+ }
36
+ function currentApi() {
37
+ if (!config)
38
+ throw new Error('remesh worker used before init');
39
+ if (api)
40
+ return api;
41
+ const fresh = new IfcAPI();
42
+ try {
43
+ applyRemeshConfig(fresh, config);
44
+ }
45
+ catch (error) {
46
+ const panic = takeWasmPanicStash(scope);
47
+ freeFailedApi(fresh);
48
+ if (panic)
49
+ restashWasmPanicLocation(scope, panic.location, panic.at, errorMessage(error));
50
+ throw error;
51
+ }
52
+ api = fresh;
53
+ return fresh;
54
+ }
55
+ async function handle(message) {
56
+ switch (message.type) {
57
+ case 'init': {
58
+ config = message.config;
59
+ try {
60
+ if (message.wasmModule)
61
+ initSync({ module: message.wasmModule });
62
+ else
63
+ await initWasmWithRetry(() => init(message.wasmUrl), { label: 'remesh.worker' });
64
+ currentApi();
65
+ post({ type: 'ready' });
66
+ }
67
+ catch (error) {
68
+ post({ type: 'init-error', ...errorDetails(error) });
69
+ }
70
+ return;
71
+ }
72
+ case 'config': {
73
+ config = message.config;
74
+ try {
75
+ if (api)
76
+ applyRemeshConfig(api, config);
77
+ }
78
+ catch (error) {
79
+ // No request to answer yet: drop the half-configured handle, so the
80
+ // next request rebuilds it and reports this same failure to its caller.
81
+ console.error('[remesh.worker] config rejected:', errorMessage(error));
82
+ // This failure has no request to capture; don't label a later trap.
83
+ takeWasmPanicStash(scope);
84
+ freeFailedApi(api);
85
+ api = null;
86
+ }
87
+ return;
88
+ }
89
+ case 'remesh':
90
+ case 'style-wire': {
91
+ try {
92
+ if (message.type === 'remesh') {
93
+ const result = remeshOnApi(currentApi(), message.request);
94
+ post({ type: 'result', requestId: message.requestId, result }, meshTransferables(result.meshes));
95
+ }
96
+ else {
97
+ const wire = styleWireOnApi(currentApi(), message.source);
98
+ post({ type: 'style-wire', requestId: message.requestId, wire }, styleWireTransferables(wire));
99
+ }
100
+ }
101
+ catch (error) {
102
+ // Capture before freeing: cleanup of a poisoned handle can trap too.
103
+ const details = errorDetails(error);
104
+ // A non-trap primary error may hide a secondary cleanup trap.
105
+ freeFailedApi(api);
106
+ api = null;
107
+ post({ type: 'error', requestId: message.requestId, ...details });
108
+ }
109
+ return;
110
+ }
111
+ }
112
+ }
113
+ // `handle` answers every request itself; this only guards the queue against
114
+ // an escape it did not anticipate, which would otherwise stall it for good.
115
+ const enqueue = serialQueue(handle, (error) => console.error('[remesh.worker] unhandled:', errorMessage(error)));
116
+ scope.onmessage = (event) => enqueue(event.data);
117
+ //# sourceMappingURL=remesh.worker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CAAC,CAAC,CAAC;gBACjG,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,qEAAqE;gBACrE,MAAM,OAAO,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpC,8DAA8D;gBAC9D,aAAa,CAAC,GAAG,CAAC,CAAC;gBACnB,GAAG,GAAG,IAAI,CAAC;gBACX,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;YACpE,CAAC;YACD,OAAO;QACT,CAAC;IACH,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,4EAA4E;AAC5E,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,4BAA4B,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACjH,KAAK,CAAC,SAAS,GAAG,CAAC,KAAwC,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /** One worker's shard-resolved styled-item slice (`resolveStyledItemsShard`). */
2
+ export interface StylesSlice {
3
+ orphanIds: Uint32Array;
4
+ orphanColors: Float32Array;
5
+ geomIds: Uint32Array;
6
+ geomColors: Float32Array;
7
+ /** #5582 `[metallic, roughness]` per geometry id; absent from an older wasm. */
8
+ geomFinishes?: Float32Array;
9
+ error?: string;
10
+ }
11
+ /** The merged columns `finalizePrepassStyles` consumes. */
12
+ export interface MergedShardStyles {
13
+ orphanIds: Uint32Array;
14
+ orphanColors: Float32Array;
15
+ geomIds: Uint32Array;
16
+ geomColors: Float32Array;
17
+ /** Two floats per `geomIds` entry, NaN where a slice carried no finish. */
18
+ geomFinishes: Float32Array;
19
+ }
20
+ /**
21
+ * Merge the shard-resolved style maps IN SLICE ORDER with first-wins per id,
22
+ * reproducing the serial resolver's file-order precedence. A geometry id's
23
+ * finish comes from the same slice as its colour, so the winner's colour and
24
+ * finish can never come from two different styled items.
25
+ */
26
+ export declare function mergeShardStyleSlices(slices: readonly (StylesSlice | null)[]): MergedShardStyles;
27
+ //# sourceMappingURL=shard-style-merge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shard-style-merge.d.ts","sourceRoot":"","sources":["../src/shard-style-merge.ts"],"names":[],"mappings":"AAIA,iFAAiF;AACjF,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,WAAW,CAAC;IAAC,YAAY,EAAE,YAAY,CAAC;IACnD,OAAO,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,YAAY,CAAC;IAC/C,gFAAgF;IAChF,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,2DAA2D;AAC3D,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,WAAW,CAAC;IAAC,YAAY,EAAE,YAAY,CAAC;IACnD,OAAO,EAAE,WAAW,CAAC;IAAC,UAAU,EAAE,YAAY,CAAC;IAC/C,2EAA2E;IAC3E,YAAY,EAAE,YAAY,CAAC;CAC5B;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,CAAC,WAAW,GAAG,IAAI,CAAC,EAAE,GAAG,iBAAiB,CAkChG"}
@@ -0,0 +1,54 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ /**
5
+ * Merge the shard-resolved style maps IN SLICE ORDER with first-wins per id,
6
+ * reproducing the serial resolver's file-order precedence. A geometry id's
7
+ * finish comes from the same slice as its colour, so the winner's colour and
8
+ * finish can never come from two different styled items.
9
+ */
10
+ export function mergeShardStyleSlices(slices) {
11
+ const orphanSeen = new Set();
12
+ const geomSeen = new Set();
13
+ const orphanWin = [];
14
+ const geomWin = [];
15
+ for (const slice of slices) {
16
+ if (!slice)
17
+ continue;
18
+ if (slice.error)
19
+ console.warn(`[stream][shard] style slice failed (degraded colours possible): ${slice.error}`);
20
+ for (let i = 0; i < slice.orphanIds.length; i++) {
21
+ const id = slice.orphanIds[i];
22
+ if (!orphanSeen.has(id)) {
23
+ orphanSeen.add(id);
24
+ orphanWin.push([id, slice, i]);
25
+ }
26
+ }
27
+ for (let i = 0; i < slice.geomIds.length; i++) {
28
+ const id = slice.geomIds[i];
29
+ if (!geomSeen.has(id)) {
30
+ geomSeen.add(id);
31
+ geomWin.push([id, slice, i]);
32
+ }
33
+ }
34
+ }
35
+ const orphanIds = new Uint32Array(orphanWin.length);
36
+ const orphanColors = new Float32Array(orphanWin.length * 4);
37
+ orphanWin.forEach(([id, slice, i], k) => {
38
+ orphanIds[k] = id;
39
+ orphanColors.set(slice.orphanColors.subarray(i * 4, i * 4 + 4), k * 4);
40
+ });
41
+ const geomIds = new Uint32Array(geomWin.length);
42
+ const geomColors = new Float32Array(geomWin.length * 4);
43
+ const geomFinishes = new Float32Array(geomWin.length * 2).fill(NaN);
44
+ geomWin.forEach(([id, slice, i], k) => {
45
+ geomIds[k] = id;
46
+ geomColors.set(slice.geomColors.subarray(i * 4, i * 4 + 4), k * 4);
47
+ // Length-guarded: a short or missing finish column leaves this id NaN.
48
+ const finishes = slice.geomFinishes;
49
+ if (finishes && i * 2 + 1 < finishes.length)
50
+ geomFinishes.set(finishes.subarray(i * 2, i * 2 + 2), k * 2);
51
+ });
52
+ return { orphanIds, orphanColors, geomIds, geomColors, geomFinishes };
53
+ }
54
+ //# sourceMappingURL=shard-style-merge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shard-style-merge.js","sourceRoot":"","sources":["../src/shard-style-merge.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAmB/D;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CAAC,MAAuC;IAC3E,MAAM,UAAU,GAAG,IAAI,GAAG,E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AAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC;IACH,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AACxE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import type { ByteStreamingPrePassResult } from './byte-streaming-prepass-result.js';
2
+ /**
3
+ * #5582: how a prepass's `styleFinishes` reaches the batch. The
4
+ * `processGeometryBatch*` signatures carry only `styleIds` + `styleColors`, so
5
+ * the finish goes to the IfcAPI instance separately, via `setStyleFinishes`,
6
+ * before its first batch with that style wire. Optional: an older wasm has
7
+ * neither the method nor the array, and then nothing is sent.
8
+ */
9
+ export interface StyleFinishesApi {
10
+ setStyleFinishes?: (styleIds: Uint32Array, styleFinishes: Float32Array) => void;
11
+ }
12
+ /**
13
+ * Install `styleFinishes` on one IfcAPI instance, once. A repeat with the same
14
+ * array is a no-op: `setStyleFinishes` decodes the whole wire into a map, so
15
+ * re-sending it every batch would redo that decode every batch. A new
16
+ * instance (a recovery re-init) has no entry and gets the call. A missing
17
+ * array is sent as empty only when the instance holds another wire's
18
+ * finishes, so they cannot carry over.
19
+ */
20
+ export declare function applyStyleFinishes(api: object, styleIds: Uint32Array, styleFinishes: Float32Array | undefined): void;
21
+ /** `buildPrePassOnce`, then hand its finishes to the same instance. */
22
+ export declare function buildPrePassWithFinishes(api: {
23
+ buildPrePassOnce(data: Uint8Array): unknown;
24
+ }, buffer: Uint8Array): ByteStreamingPrePassResult;
25
+ //# sourceMappingURL=style-finishes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-finishes.d.ts","sourceRoot":"","sources":["../src/style-finishes.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAErF;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,gBAAgB,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,KAAK,IAAI,CAAC;CACjF;AAOD;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAChC,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,WAAW,EACrB,aAAa,EAAE,YAAY,GAAG,SAAS,GACtC,IAAI,CAQN;AAED,uEAAuE;AACvE,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IAAE,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAAA;CAAE,EACpD,MAAM,EAAE,UAAU,GACjB,0BAA0B,CAI5B"}
@@ -0,0 +1,32 @@
1
+ /* This Source Code Form is subject to the terms of the Mozilla Public
2
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
3
+ * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
+ const NO_FINISHES = new Float32Array(0);
5
+ /** The finishes array each IfcAPI instance currently holds. */
6
+ const appliedFinishes = new WeakMap();
7
+ /**
8
+ * Install `styleFinishes` on one IfcAPI instance, once. A repeat with the same
9
+ * array is a no-op: `setStyleFinishes` decodes the whole wire into a map, so
10
+ * re-sending it every batch would redo that decode every batch. A new
11
+ * instance (a recovery re-init) has no entry and gets the call. A missing
12
+ * array is sent as empty only when the instance holds another wire's
13
+ * finishes, so they cannot carry over.
14
+ */
15
+ export function applyStyleFinishes(api, styleIds, styleFinishes) {
16
+ const set = api.setStyleFinishes;
17
+ if (typeof set !== 'function')
18
+ return;
19
+ const next = styleFinishes ?? NO_FINISHES;
20
+ const prev = appliedFinishes.get(api);
21
+ if (prev === next || (prev === undefined && next.length === 0))
22
+ return;
23
+ set.call(api, styleIds, next);
24
+ appliedFinishes.set(api, next);
25
+ }
26
+ /** `buildPrePassOnce`, then hand its finishes to the same instance. */
27
+ export function buildPrePassWithFinishes(api, buffer) {
28
+ const prePass = api.buildPrePassOnce(buffer);
29
+ applyStyleFinishes(api, prePass.styleIds, prePass.styleFinishes);
30
+ return prePass;
31
+ }
32
+ //# sourceMappingURL=style-finishes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"style-finishes.js","sourceRoot":"","sources":["../src/style-finishes.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAe/D,MAAM,WAAW,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAExC,+DAA+D;AAC/D,MAAM,eAAe,GAAG,IAAI,OAAO,EAAwB,CAAC;AAE5D;;;;;;;GAOG;AACH,MAAM,UAAU,kBAAkB,CAChC,GAAW,EACX,QAAqB,EACrB,aAAuC;IAEvC,MAAM,GAAG,GAAI,GAAwB,CAAC,gBAAgB,CAAC;IACvD,IAAI,OAAO,GAAG,KAAK,UAAU;QAAE,OAAO;IACtC,MAAM,IAAI,GAAG,aAAa,IAAI,WAAW,CAAC;IAC1C,MAAM,IAAI,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACtC,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC;QAAE,OAAO;IACvE,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;IAC9B,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,uEAAuE;AACvE,MAAM,UAAU,wBAAwB,CACtC,GAAoD,EACpD,MAAkB;IAElB,MAAM,OAAO,GAAG,GAAG,CAAC,gBAAgB,CAAC,MAAM,CAA+B,CAAC;IAC3E,kBAAkB,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACjE,OAAO,OAAO,CAAC;AACjB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -75,6 +75,17 @@ export interface MeshData {
75
75
  * in `apps/viewer/src/hooks/useIfcLoader.ts`), so a value read off this
76
76
  * field is always safe to resolve the same way as `expressId` (#3525). */
77
77
  materialId?: number;
78
+ /** IFC-authored metallic/roughness (#5582): `IfcSurfaceStyleRendering`'s
79
+ * `SpecularColour` / `SpecularHighlight` / `ReflectanceMethod`, mapped in
80
+ * Rust (`ifc_lite_processing::style::extract_surface_style_specular`).
81
+ * Either field, or the whole object, is absent when the file authored no
82
+ * evidence for it — the renderer's `packMeshMaterial` then keeps its own
83
+ * default (a matte dielectric, or glass roughness when the authored colour
84
+ * is translucent). */
85
+ material?: {
86
+ metallic?: number;
87
+ roughness?: number;
88
+ };
78
89
  /** Per-vertex texture coordinates (u, v pairs, 1:1 with positions), present
79
90
  * only for textured meshes (issue #961). */
80
91
  uvs?: Float32Array;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,GAAG,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,QAAQ;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,YAAY,CAAC;IACxB,OAAO,EAAE,YAAY,CAAC;IACtB;;;iFAG6E;IAC7E,OAAO,EAAE,WAAW,CAAC;IACrB;;qFAEiF;IACjF,gBAAgB,CAAC,EAAE;QACjB,IAAI,EAAE,gBAAgB,CAAC;QACvB,wDAAwD;QACxD,OAAO,EAAE,WAAW,CAAC;QACrB,qEAAqE;QACrE,aAAa,EAAE,WAAW,CAAC;QAC3B,mFAAmF;QACnF,aAAa,CAAC,EAAE,WAAW,CAAC;KAC7B,CAAC;IACF;;qEAEiE;IACjE,KA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AE,GAAG,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;IACtD;;;;;;;;OAQG;IACH,wBAAwB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD;AASD,cAAc,qBAAqB,CAAC;AACpC,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA2W/D,8EAA8E;AAC9E,gCAAgC;AAChC,2EAA2E;AAC3E,8EAA8E;AAE9E,kFAAkF;AAClF,6EAA6E;AAC7E,cAAc,qBAAqB,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAsX/D,8EAA8E;AAC9E,gCAAgC;AAChC,2EAA2E;AAC3E,8EAA8E;AAE9E,kFAAkF;AAClF,6EAA6E;AAC7E,cAAc,qBAAqB,CAAC"}
@@ -18,6 +18,15 @@ export interface ShardStyles {
18
18
  orphanColors: Float32Array;
19
19
  geomIds: Uint32Array;
20
20
  geomColors: Float32Array;
21
+ /** #5582 `[metallic, roughness]` per geometry id (NaN = unauthored); older wasm omits it. */
22
+ geomFinishes?: Float32Array;
23
+ }
24
+ /** The byte-taking prepass-assist entry points, plus the optional #5582 stash
25
+ * that feeds `finalizePrepassStyles`'s `styleFinishes` (absent on older wasm). */
26
+ export interface BytePrepassApi {
27
+ resolveStyledItemsShard(data: Uint8Array, spans: Uint32Array): ShardStyles;
28
+ finalizePrepassStyles(data: Uint8Array, ...args: FinalizeStyleArgs): Record<string, unknown>;
29
+ setPrepassGeometryFinishes?: (geomIds: Uint32Array, geomFinishes: Float32Array) => void;
21
30
  }
22
31
  export type FinalizeStyleArgs = [
23
32
  orphanIds: Uint32Array,
@@ -1 +1 @@
1
- {"version":3,"file":"worker-prep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;IAC9B,SAAS,EAAE,WAAW;IAAE,YAAY,EAAE,YAAY;IAClD,OAAO,EAAE,WAAW;IAAE,UAAU,EAAE,YAAY;IAC9C,cAAc,EAAE,WAAW;IAAE,gBAAgB,EAAE,WAAW;IAC1D,gBAAgB,EAAE,WAAW;IAAE,SAAS,EAAE,WAAW;IACrD,UAAU,EAAE,WAAW;IAAE,cAAc,EAAE,WAAW;IACpD,mBAAmB,EAAE,MAAM;CAC5B,CAAC;AAEF;kFACkF;AAClF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE1G"}
@@ -1 +1 @@
1
- {"version":3,"file":"worker-prepass-source.js","sourceRoot":"","sources":["../src/worker-prepass-source.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAqC/D;kFACkF;AAClF,MAAM,UAAU,oBAAoB,CAAC,SAA6B,EAAE,SAA6B;IAC/F,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC;AAC5D,CAAC"}
1
+ {"version":3,"file":"worker-prepass-source.js","sourceRoot":"","sources":["../src/worker-prepass-source.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AA+C/D;kFACkF;AAClF,MAAM,UAAU,oBAAoB,CAAC,SAA6B,EAAE,SAA6B;IAC/F,OAAO,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,SAAS,CAAC;AAC5D,CAAC"}