@ifc-lite/geometry 1.18.5 → 2.0.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.
- package/README.md +1 -1
- package/dist/geometry-coordinate.d.ts +0 -5
- package/dist/geometry-coordinate.d.ts.map +1 -1
- package/dist/geometry-coordinate.js +8 -19
- package/dist/geometry-coordinate.js.map +1 -1
- package/dist/geometry-parallel.d.ts +4 -26
- package/dist/geometry-parallel.d.ts.map +1 -1
- package/dist/geometry-parallel.js +5 -23
- package/dist/geometry-parallel.js.map +1 -1
- package/dist/geometry.worker.d.ts +0 -1
- package/dist/geometry.worker.d.ts.map +1 -1
- package/dist/geometry.worker.js.map +1 -1
- package/dist/ifc-lite-bridge.d.ts +2 -58
- package/dist/ifc-lite-bridge.d.ts.map +1 -1
- package/dist/ifc-lite-bridge.js +5 -127
- package/dist/ifc-lite-bridge.js.map +1 -1
- package/dist/index.d.ts +17 -46
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +100 -293
- package/dist/index.js.map +1 -1
- package/dist/platform-bridge.d.ts +6 -3
- package/dist/platform-bridge.d.ts.map +1 -1
- package/dist/platform-bridge.js +7 -7
- package/dist/platform-bridge.js.map +1 -1
- package/dist/progressive-loader.d.ts +5 -56
- package/dist/progressive-loader.d.ts.map +1 -1
- package/dist/progressive-loader.js +7 -132
- package/dist/progressive-loader.js.map +1 -1
- package/dist/types.d.ts +8 -29
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -20
- package/dist/default-materials.d.ts +0 -22
- package/dist/default-materials.d.ts.map +0 -1
- package/dist/default-materials.js +0 -124
- package/dist/default-materials.js.map +0 -1
- package/dist/geometry-controller.worker.d.ts +0 -4
- package/dist/geometry-controller.worker.d.ts.map +0 -1
- package/dist/geometry-controller.worker.js +0 -402
- package/dist/geometry-controller.worker.js.map +0 -1
- package/dist/geometry-deduplicator.d.ts +0 -42
- package/dist/geometry-deduplicator.d.ts.map +0 -1
- package/dist/geometry-deduplicator.js +0 -80
- package/dist/geometry-deduplicator.js.map +0 -1
- package/dist/ifc-lite-mesh-collector.d.ts +0 -111
- package/dist/ifc-lite-mesh-collector.d.ts.map +0 -1
- package/dist/ifc-lite-mesh-collector.js +0 -447
- package/dist/ifc-lite-mesh-collector.js.map +0 -1
- package/dist/lod.d.ts +0 -60
- package/dist/lod.d.ts.map +0 -1
- package/dist/lod.js +0 -113
- package/dist/lod.js.map +0 -1
- package/dist/style-cache.d.ts +0 -36
- package/dist/style-cache.d.ts.map +0 -1
- package/dist/style-cache.js +0 -127
- package/dist/style-cache.js.map +0 -1
- package/dist/wasm-bridge.d.ts +0 -22
- package/dist/wasm-bridge.d.ts.map +0 -1
- package/dist/wasm-bridge.js +0 -120
- package/dist/wasm-bridge.js.map +0 -1
- package/dist/wasm-memory-manager.d.ts +0 -178
- package/dist/wasm-memory-manager.d.ts.map +0 -1
- package/dist/wasm-memory-manager.js +0 -86
- package/dist/wasm-memory-manager.js.map +0 -1
- package/dist/zero-copy-collector.d.ts +0 -158
- package/dist/zero-copy-collector.d.ts.map +0 -1
- package/dist/zero-copy-collector.js +0 -224
- package/dist/zero-copy-collector.js.map +0 -1
package/dist/style-cache.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Style Index Cache - Caches style index to IndexedDB for faster subsequent loads
|
|
3
|
-
*/
|
|
4
|
-
export interface StyleIndexData {
|
|
5
|
-
[geometryExpressID: number]: [number, number, number, number];
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Style index cache using IndexedDB
|
|
9
|
-
*/
|
|
10
|
-
export declare class StyleIndexCache {
|
|
11
|
-
private dbName;
|
|
12
|
-
private dbVersion;
|
|
13
|
-
private db;
|
|
14
|
-
/**
|
|
15
|
-
* Initialize IndexedDB
|
|
16
|
-
*/
|
|
17
|
-
init(): Promise<void>;
|
|
18
|
-
/**
|
|
19
|
-
* Get cached style index for file hash
|
|
20
|
-
*/
|
|
21
|
-
get(fileHash: string): Promise<StyleIndexData | null>;
|
|
22
|
-
/**
|
|
23
|
-
* Cache style index for file hash
|
|
24
|
-
*/
|
|
25
|
-
set(fileHash: string, index: StyleIndexData): Promise<void>;
|
|
26
|
-
/**
|
|
27
|
-
* Calculate file hash and get/set cache
|
|
28
|
-
*/
|
|
29
|
-
getCached(buffer: ArrayBuffer): Promise<StyleIndexData | null>;
|
|
30
|
-
setCached(buffer: ArrayBuffer, index: StyleIndexData): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Clear old cache entries (older than maxAgeDays)
|
|
33
|
-
*/
|
|
34
|
-
cleanup(maxAgeDays?: number): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=style-cache.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style-cache.d.ts","sourceRoot":"","sources":["../src/style-cache.ts"],"names":[],"mappings":"AAIA;;GAEG;AAEH,MAAM,WAAW,cAAc;IAC7B,CAAC,iBAAiB,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/D;AAYD;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAA0B;IACxC,OAAO,CAAC,SAAS,CAAK;IACtB,OAAO,CAAC,EAAE,CAA4B;IAEtC;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAmB3B;;OAEG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAuB3D;;OAEG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAwBjE;;OAEG;IACG,SAAS,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC;IAK9D,SAAS,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1E;;OAEG;IACG,OAAO,CAAC,UAAU,GAAE,MAAW,GAAG,OAAO,CAAC,IAAI,CAAC;CA8BtD"}
|
package/dist/style-cache.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
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
|
-
* Calculate simple hash of buffer for cache key
|
|
6
|
-
*/
|
|
7
|
-
async function calculateFileHash(buffer) {
|
|
8
|
-
// Use Web Crypto API for fast hashing
|
|
9
|
-
const hashBuffer = await crypto.subtle.digest('SHA-256', buffer);
|
|
10
|
-
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
11
|
-
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Style index cache using IndexedDB
|
|
15
|
-
*/
|
|
16
|
-
export class StyleIndexCache {
|
|
17
|
-
dbName = 'ifc-lite-style-cache';
|
|
18
|
-
dbVersion = 1;
|
|
19
|
-
db = null;
|
|
20
|
-
/**
|
|
21
|
-
* Initialize IndexedDB
|
|
22
|
-
*/
|
|
23
|
-
async init() {
|
|
24
|
-
return new Promise((resolve, reject) => {
|
|
25
|
-
const request = indexedDB.open(this.dbName, this.dbVersion);
|
|
26
|
-
request.onerror = () => reject(request.error);
|
|
27
|
-
request.onsuccess = () => {
|
|
28
|
-
this.db = request.result;
|
|
29
|
-
resolve();
|
|
30
|
-
};
|
|
31
|
-
request.onupgradeneeded = (event) => {
|
|
32
|
-
const db = event.target.result;
|
|
33
|
-
if (!db.objectStoreNames.contains('styles')) {
|
|
34
|
-
db.createObjectStore('styles', { keyPath: 'hash' });
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Get cached style index for file hash
|
|
41
|
-
*/
|
|
42
|
-
async get(fileHash) {
|
|
43
|
-
if (!this.db) {
|
|
44
|
-
await this.init();
|
|
45
|
-
}
|
|
46
|
-
return new Promise((resolve, reject) => {
|
|
47
|
-
if (!this.db) {
|
|
48
|
-
resolve(null);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const transaction = this.db.transaction(['styles'], 'readonly');
|
|
52
|
-
const store = transaction.objectStore('styles');
|
|
53
|
-
const request = store.get(fileHash);
|
|
54
|
-
request.onerror = () => reject(request.error);
|
|
55
|
-
request.onsuccess = () => {
|
|
56
|
-
const result = request.result;
|
|
57
|
-
resolve(result ? result.index : null);
|
|
58
|
-
};
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
/**
|
|
62
|
-
* Cache style index for file hash
|
|
63
|
-
*/
|
|
64
|
-
async set(fileHash, index) {
|
|
65
|
-
if (!this.db) {
|
|
66
|
-
await this.init();
|
|
67
|
-
}
|
|
68
|
-
return new Promise((resolve, reject) => {
|
|
69
|
-
if (!this.db) {
|
|
70
|
-
resolve();
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const transaction = this.db.transaction(['styles'], 'readwrite');
|
|
74
|
-
const store = transaction.objectStore('styles');
|
|
75
|
-
const request = store.put({
|
|
76
|
-
hash: fileHash,
|
|
77
|
-
index,
|
|
78
|
-
timestamp: Date.now(),
|
|
79
|
-
});
|
|
80
|
-
request.onerror = () => reject(request.error);
|
|
81
|
-
request.onsuccess = () => resolve();
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Calculate file hash and get/set cache
|
|
86
|
-
*/
|
|
87
|
-
async getCached(buffer) {
|
|
88
|
-
const hash = await calculateFileHash(buffer);
|
|
89
|
-
return this.get(hash);
|
|
90
|
-
}
|
|
91
|
-
async setCached(buffer, index) {
|
|
92
|
-
const hash = await calculateFileHash(buffer);
|
|
93
|
-
await this.set(hash, index);
|
|
94
|
-
}
|
|
95
|
-
/**
|
|
96
|
-
* Clear old cache entries (older than maxAgeDays)
|
|
97
|
-
*/
|
|
98
|
-
async cleanup(maxAgeDays = 30) {
|
|
99
|
-
if (!this.db) {
|
|
100
|
-
await this.init();
|
|
101
|
-
}
|
|
102
|
-
return new Promise((resolve, reject) => {
|
|
103
|
-
if (!this.db) {
|
|
104
|
-
resolve();
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
const transaction = this.db.transaction(['styles'], 'readwrite');
|
|
108
|
-
const store = transaction.objectStore('styles');
|
|
109
|
-
const request = store.openCursor();
|
|
110
|
-
const cutoffTime = Date.now() - maxAgeDays * 24 * 60 * 60 * 1000;
|
|
111
|
-
request.onerror = () => reject(request.error);
|
|
112
|
-
request.onsuccess = (event) => {
|
|
113
|
-
const cursor = event.target.result;
|
|
114
|
-
if (cursor) {
|
|
115
|
-
if (cursor.value.timestamp < cutoffTime) {
|
|
116
|
-
cursor.delete();
|
|
117
|
-
}
|
|
118
|
-
cursor.continue();
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
resolve();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
});
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
//# sourceMappingURL=style-cache.js.map
|
package/dist/style-cache.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"style-cache.js","sourceRoot":"","sources":["../src/style-cache.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAU/D;;GAEG;AACH,KAAK,UAAU,iBAAiB,CAAC,MAAmB;IAClD,sCAAsC;IACtC,MAAM,UAAU,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IACjE,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IACzD,OAAO,SAAS,CAAC,GAAG,CA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CAAC,UAAU,EAAE,CAAC;YACnC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,UAAU,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;YAEjE,OAAO,CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAC9C,OAAO,CAAC,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE;gBAC5B,MAAM,MAAM,GAAI,KAAK,CAAC,MAAyC,CAAC,MAAM,CAAC;gBACvE,IAAI,MAAM,EAAE,CAAC;oBACX,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,UAAU,EAAE,CAAC;wBACxC,MAAM,CAAC,MAAM,EAAE,CAAC;oBAClB,CAAC;oBACD,MAAM,CAAC,QAAQ,EAAE,CAAC;gBACpB,CAAC;qBAAM,CAAC;oBACN,OAAO,EAAE,CAAC;gBACZ,CAAC;YACH,CAAC,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/wasm-bridge.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WASM Bridge Implementation
|
|
3
|
-
*
|
|
4
|
-
* Uses @ifc-lite/wasm for geometry processing in web browsers.
|
|
5
|
-
* This is the existing implementation wrapped in the IPlatformBridge interface.
|
|
6
|
-
*/
|
|
7
|
-
import type { IPlatformBridge, GeometryProcessingResult, GeometryStats, StreamingOptions } from './platform-bridge.js';
|
|
8
|
-
/**
|
|
9
|
-
* WASM-based platform bridge for web browsers
|
|
10
|
-
*/
|
|
11
|
-
export declare class WasmBridge implements IPlatformBridge {
|
|
12
|
-
private bridge;
|
|
13
|
-
private initialized;
|
|
14
|
-
constructor();
|
|
15
|
-
init(): Promise<void>;
|
|
16
|
-
isInitialized(): boolean;
|
|
17
|
-
private toIfcContent;
|
|
18
|
-
processGeometry(content: string | Uint8Array): Promise<GeometryProcessingResult>;
|
|
19
|
-
processGeometryStreaming(content: string | Uint8Array, options: StreamingOptions): Promise<GeometryStats>;
|
|
20
|
-
getApi(): unknown;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=wasm-bridge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-bridge.d.ts","sourceRoot":"","sources":["../src/wasm-bridge.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,gBAAgB,EACjB,MAAM,sBAAsB,CAAC;AAK9B;;GAEG;AACH,qBAAa,UAAW,YAAW,eAAe;IAChD,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAS;;IAMtB,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAM3B,aAAa,IAAI,OAAO;IAIxB,OAAO,CAAC,YAAY;IASd,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,wBAAwB,CAAC;IA0ChF,wBAAwB,CAC5B,OAAO,EAAE,MAAM,GAAG,UAAU,EAC5B,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,aAAa,CAAC;IAyDzB,MAAM,IAAI,OAAO;CAGlB"}
|
package/dist/wasm-bridge.js
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
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 { IfcLiteBridge } from './ifc-lite-bridge.js';
|
|
5
|
-
import { IfcLiteMeshCollector } from './ifc-lite-mesh-collector.js';
|
|
6
|
-
/**
|
|
7
|
-
* WASM-based platform bridge for web browsers
|
|
8
|
-
*/
|
|
9
|
-
export class WasmBridge {
|
|
10
|
-
bridge;
|
|
11
|
-
initialized = false;
|
|
12
|
-
constructor() {
|
|
13
|
-
this.bridge = new IfcLiteBridge();
|
|
14
|
-
}
|
|
15
|
-
async init() {
|
|
16
|
-
if (this.initialized)
|
|
17
|
-
return;
|
|
18
|
-
await this.bridge.init();
|
|
19
|
-
this.initialized = true;
|
|
20
|
-
}
|
|
21
|
-
isInitialized() {
|
|
22
|
-
return this.initialized;
|
|
23
|
-
}
|
|
24
|
-
toIfcContent(content) {
|
|
25
|
-
if (typeof content === 'string') {
|
|
26
|
-
return content;
|
|
27
|
-
}
|
|
28
|
-
const decoder = new TextDecoder();
|
|
29
|
-
return decoder.decode(content);
|
|
30
|
-
}
|
|
31
|
-
async processGeometry(content) {
|
|
32
|
-
if (!this.initialized) {
|
|
33
|
-
await this.init();
|
|
34
|
-
}
|
|
35
|
-
const startTime = performance.now();
|
|
36
|
-
const collector = new IfcLiteMeshCollector(this.bridge.getApi(), this.toIfcContent(content));
|
|
37
|
-
const meshes = collector.collectMeshes();
|
|
38
|
-
const buildingRotation = collector.getBuildingRotation();
|
|
39
|
-
const endTime = performance.now();
|
|
40
|
-
// Calculate totals
|
|
41
|
-
let totalVertices = 0;
|
|
42
|
-
let totalTriangles = 0;
|
|
43
|
-
for (const mesh of meshes) {
|
|
44
|
-
totalVertices += mesh.positions.length / 3;
|
|
45
|
-
totalTriangles += mesh.indices.length / 3;
|
|
46
|
-
}
|
|
47
|
-
// Default coordinate info (coordinate handling is done by GeometryProcessor)
|
|
48
|
-
const coordinateInfo = {
|
|
49
|
-
originShift: { x: 0, y: 0, z: 0 },
|
|
50
|
-
originalBounds: {
|
|
51
|
-
min: { x: 0, y: 0, z: 0 },
|
|
52
|
-
max: { x: 0, y: 0, z: 0 },
|
|
53
|
-
},
|
|
54
|
-
shiftedBounds: {
|
|
55
|
-
min: { x: 0, y: 0, z: 0 },
|
|
56
|
-
max: { x: 0, y: 0, z: 0 },
|
|
57
|
-
},
|
|
58
|
-
hasLargeCoordinates: false,
|
|
59
|
-
buildingRotation,
|
|
60
|
-
};
|
|
61
|
-
return {
|
|
62
|
-
meshes,
|
|
63
|
-
totalVertices,
|
|
64
|
-
totalTriangles,
|
|
65
|
-
coordinateInfo,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
async processGeometryStreaming(content, options) {
|
|
69
|
-
if (!this.initialized) {
|
|
70
|
-
await this.init();
|
|
71
|
-
}
|
|
72
|
-
const startTime = performance.now();
|
|
73
|
-
const collector = new IfcLiteMeshCollector(this.bridge.getApi(), this.toIfcContent(content));
|
|
74
|
-
let totalMeshes = 0;
|
|
75
|
-
let totalVertices = 0;
|
|
76
|
-
let totalTriangles = 0;
|
|
77
|
-
try {
|
|
78
|
-
for await (const item of collector.collectMeshesStreaming(50)) {
|
|
79
|
-
// Handle color update events (skip them for streaming stats)
|
|
80
|
-
if (item && typeof item === 'object' && 'type' in item && item.type === 'colorUpdate') {
|
|
81
|
-
continue;
|
|
82
|
-
}
|
|
83
|
-
// Handle mesh batches
|
|
84
|
-
const batch = item;
|
|
85
|
-
totalMeshes += batch.length;
|
|
86
|
-
for (const mesh of batch) {
|
|
87
|
-
totalVertices += mesh.positions.length / 3;
|
|
88
|
-
totalTriangles += mesh.indices.length / 3;
|
|
89
|
-
}
|
|
90
|
-
options.onBatch?.({
|
|
91
|
-
meshes: batch,
|
|
92
|
-
progress: {
|
|
93
|
-
processed: totalMeshes,
|
|
94
|
-
total: totalMeshes, // We don't know total upfront with WASM
|
|
95
|
-
currentType: 'processing',
|
|
96
|
-
},
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
catch (error) {
|
|
101
|
-
options.onError?.(error instanceof Error ? error : new Error(String(error)));
|
|
102
|
-
throw error;
|
|
103
|
-
}
|
|
104
|
-
const endTime = performance.now();
|
|
105
|
-
const totalTime = endTime - startTime;
|
|
106
|
-
const stats = {
|
|
107
|
-
totalMeshes,
|
|
108
|
-
totalVertices,
|
|
109
|
-
totalTriangles,
|
|
110
|
-
parseTimeMs: totalTime * 0.3, // Estimate
|
|
111
|
-
geometryTimeMs: totalTime * 0.7, // Estimate
|
|
112
|
-
};
|
|
113
|
-
options.onComplete?.(stats);
|
|
114
|
-
return stats;
|
|
115
|
-
}
|
|
116
|
-
getApi() {
|
|
117
|
-
return this.bridge.getApi();
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
//# sourceMappingURL=wasm-bridge.js.map
|
package/dist/wasm-bridge.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-bridge.js","sourceRoot":"","sources":["../src/wasm-bridge.ts"],"names":[],"mappings":"AAAA;;+DAE+D;AAe/D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAkC,MAAM,8BAA8B,CAAC;AAGpG;;GAEG;AACH,MAAM,OAAO,UAAU;IACb,MAAM,CAAgB;IACtB,WAAW,GAAG,KAAK,CAAC;IAE5B;QACE,IAAI,CAAC,MAAM,GAAG,IAAI,aAAa,EAAE,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,IAAI;QACR,IAAI,IAAI,CAAC,WAAW;YAAE,OAAO;QAC7B,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QACzB,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;IAC1B,CAAC;IAED,aAAa;QACX,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAEO,YAAY,CAAC,OAA4B;QAC/C,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;QAClC,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IACjC,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,OAA4B;QAChD,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YACtB,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACpB,CAAC;Q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EAAE,WAAW;wBACtB,KAAK,EAAE,WAAW,EAAE,wCAAwC;wBAC5D,WAAW,EAAE,YAAY;qBAC1B;iBACF,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,OAAO,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAC7E,MAAM,KAAK,CAAC;QACd,CAAC;QAED,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;QAClC,MAAM,SAAS,GAAG,OAAO,GAAG,SAAS,CAAC;QAEtC,MAAM,KAAK,GAAkB;YAC3B,WAAW;YACX,aAAa;YACb,cAAc;YACd,WAAW,EAAE,SAAS,GAAG,GAAG,EAAE,WAAW;YACzC,cAAc,EAAE,SAAS,GAAG,GAAG,EAAE,WAAW;SAC7C,CAAC;QAEF,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* WASM Memory Manager - manages zero-copy views into WASM linear memory
|
|
3
|
-
*
|
|
4
|
-
* This module provides safe access to WASM memory for zero-copy GPU uploads.
|
|
5
|
-
* Views are created directly into WASM linear memory, avoiding data copies.
|
|
6
|
-
*
|
|
7
|
-
* IMPORTANT: Views become INVALID when WASM memory grows (any allocation).
|
|
8
|
-
* Use the "immediate upload" pattern:
|
|
9
|
-
* 1. Create view
|
|
10
|
-
* 2. Upload to GPU immediately
|
|
11
|
-
* 3. Discard view reference
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```typescript
|
|
15
|
-
* const manager = new WasmMemoryManager(api.getMemory());
|
|
16
|
-
*
|
|
17
|
-
* // SAFE: View created and used immediately
|
|
18
|
-
* const vertexView = manager.createFloat32View(ptr, len);
|
|
19
|
-
* device.queue.writeBuffer(gpuBuffer, 0, vertexView);
|
|
20
|
-
* // View may be invalid now, but we're done with it
|
|
21
|
-
*
|
|
22
|
-
* // UNSAFE: Don't store views across async boundaries!
|
|
23
|
-
* const view = manager.createFloat32View(ptr, len);
|
|
24
|
-
* await someAsyncOp(); // WASM could allocate here!
|
|
25
|
-
* // view might be INVALID now - use would crash!
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export interface WasmMemory {
|
|
29
|
-
buffer: ArrayBuffer;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Manages zero-copy TypedArray views into WASM linear memory
|
|
33
|
-
*/
|
|
34
|
-
export declare class WasmMemoryManager {
|
|
35
|
-
private memory;
|
|
36
|
-
private cachedBuffer;
|
|
37
|
-
constructor(memory: WasmMemory);
|
|
38
|
-
/**
|
|
39
|
-
* Get current memory buffer, detecting if it has changed (grown)
|
|
40
|
-
*/
|
|
41
|
-
private getBuffer;
|
|
42
|
-
/**
|
|
43
|
-
* Create a Float32Array view directly into WASM memory (NO COPY!)
|
|
44
|
-
*
|
|
45
|
-
* WARNING: View becomes invalid if WASM memory grows!
|
|
46
|
-
* Use immediately and discard.
|
|
47
|
-
*
|
|
48
|
-
* @param byteOffset Byte offset into WASM memory (ptr value from Rust)
|
|
49
|
-
* @param length Number of f32 elements (not bytes)
|
|
50
|
-
*/
|
|
51
|
-
createFloat32View(byteOffset: number, length: number): Float32Array;
|
|
52
|
-
/**
|
|
53
|
-
* Create a Uint32Array view directly into WASM memory (NO COPY!)
|
|
54
|
-
*
|
|
55
|
-
* @param byteOffset Byte offset into WASM memory
|
|
56
|
-
* @param length Number of u32 elements (not bytes)
|
|
57
|
-
*/
|
|
58
|
-
createUint32View(byteOffset: number, length: number): Uint32Array;
|
|
59
|
-
/**
|
|
60
|
-
* Create a Float64Array view directly into WASM memory (NO COPY!)
|
|
61
|
-
*
|
|
62
|
-
* @param byteOffset Byte offset into WASM memory
|
|
63
|
-
* @param length Number of f64 elements (not bytes)
|
|
64
|
-
*/
|
|
65
|
-
createFloat64View(byteOffset: number, length: number): Float64Array;
|
|
66
|
-
/**
|
|
67
|
-
* Create a Uint8Array view directly into WASM memory (NO COPY!)
|
|
68
|
-
*
|
|
69
|
-
* @param byteOffset Byte offset into WASM memory
|
|
70
|
-
* @param length Number of bytes
|
|
71
|
-
*/
|
|
72
|
-
createUint8View(byteOffset: number, length: number): Uint8Array;
|
|
73
|
-
/**
|
|
74
|
-
* Check if a view is still valid (memory hasn't grown)
|
|
75
|
-
*/
|
|
76
|
-
isViewValid(view: ArrayBufferView): boolean;
|
|
77
|
-
/**
|
|
78
|
-
* Get raw ArrayBuffer (for advanced use cases)
|
|
79
|
-
*/
|
|
80
|
-
getRawBuffer(): ArrayBuffer;
|
|
81
|
-
/**
|
|
82
|
-
* Check if memory has grown since last access
|
|
83
|
-
*/
|
|
84
|
-
hasMemoryGrown(): boolean;
|
|
85
|
-
}
|
|
86
|
-
/**
|
|
87
|
-
* GPU-ready geometry data with pointer access
|
|
88
|
-
* Wraps the WASM GpuGeometry struct for TypeScript use
|
|
89
|
-
*/
|
|
90
|
-
export interface GpuGeometryHandle {
|
|
91
|
-
/** Pointer to interleaved vertex data [px,py,pz,nx,ny,nz,...] */
|
|
92
|
-
vertexDataPtr: number;
|
|
93
|
-
/** Length of vertex data in f32 elements */
|
|
94
|
-
vertexDataLen: number;
|
|
95
|
-
/** Byte length of vertex data (for GPU buffer creation) */
|
|
96
|
-
vertexDataByteLength: number;
|
|
97
|
-
/** Pointer to index data */
|
|
98
|
-
indicesPtr: number;
|
|
99
|
-
/** Length of indices in u32 elements */
|
|
100
|
-
indicesLen: number;
|
|
101
|
-
/** Byte length of indices */
|
|
102
|
-
indicesByteLength: number;
|
|
103
|
-
/** Number of meshes in this geometry batch */
|
|
104
|
-
meshCount: number;
|
|
105
|
-
/** Total vertex count */
|
|
106
|
-
totalVertexCount: number;
|
|
107
|
-
/** Total triangle count */
|
|
108
|
-
totalTriangleCount: number;
|
|
109
|
-
/** Check if geometry is empty */
|
|
110
|
-
isEmpty: boolean;
|
|
111
|
-
/** Get metadata for a specific mesh */
|
|
112
|
-
getMeshMetadata(index: number): GpuMeshMetadataHandle | undefined;
|
|
113
|
-
/** Free the geometry (allows WASM to reuse memory) */
|
|
114
|
-
free(): void;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Mesh metadata for draw calls and selection
|
|
118
|
-
*/
|
|
119
|
-
export interface GpuMeshMetadataHandle {
|
|
120
|
-
expressId: number;
|
|
121
|
-
ifcTypeIdx: number;
|
|
122
|
-
vertexOffset: number;
|
|
123
|
-
vertexCount: number;
|
|
124
|
-
indexOffset: number;
|
|
125
|
-
indexCount: number;
|
|
126
|
-
color: number[];
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* GPU-ready instanced geometry with pointer access
|
|
130
|
-
*/
|
|
131
|
-
export interface GpuInstancedGeometryHandle {
|
|
132
|
-
/** Geometry ID (hash for deduplication) */
|
|
133
|
-
geometryId: bigint;
|
|
134
|
-
/** Pointer to interleaved vertex data */
|
|
135
|
-
vertexDataPtr: number;
|
|
136
|
-
vertexDataLen: number;
|
|
137
|
-
vertexDataByteLength: number;
|
|
138
|
-
/** Pointer to index data */
|
|
139
|
-
indicesPtr: number;
|
|
140
|
-
indicesLen: number;
|
|
141
|
-
indicesByteLength: number;
|
|
142
|
-
/** Pointer to instance data [transform(16) + color(4)] per instance */
|
|
143
|
-
instanceDataPtr: number;
|
|
144
|
-
instanceDataLen: number;
|
|
145
|
-
instanceDataByteLength: number;
|
|
146
|
-
/** Pointer to express IDs for each instance */
|
|
147
|
-
instanceExpressIdsPtr: number;
|
|
148
|
-
instanceCount: number;
|
|
149
|
-
/** Vertex and triangle counts */
|
|
150
|
-
vertexCount: number;
|
|
151
|
-
triangleCount: number;
|
|
152
|
-
}
|
|
153
|
-
/**
|
|
154
|
-
* Collection of instanced geometries with pointer access
|
|
155
|
-
*/
|
|
156
|
-
export interface GpuInstancedGeometryCollectionHandle {
|
|
157
|
-
length: number;
|
|
158
|
-
get(index: number): GpuInstancedGeometryHandle | undefined;
|
|
159
|
-
getRef(index: number): GpuInstancedGeometryRefHandle | undefined;
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Reference to instanced geometry (avoids cloning)
|
|
163
|
-
*/
|
|
164
|
-
export interface GpuInstancedGeometryRefHandle {
|
|
165
|
-
geometryId: bigint;
|
|
166
|
-
vertexDataPtr: number;
|
|
167
|
-
vertexDataLen: number;
|
|
168
|
-
vertexDataByteLength: number;
|
|
169
|
-
indicesPtr: number;
|
|
170
|
-
indicesLen: number;
|
|
171
|
-
indicesByteLength: number;
|
|
172
|
-
instanceDataPtr: number;
|
|
173
|
-
instanceDataLen: number;
|
|
174
|
-
instanceDataByteLength: number;
|
|
175
|
-
instanceExpressIdsPtr: number;
|
|
176
|
-
instanceCount: number;
|
|
177
|
-
}
|
|
178
|
-
//# sourceMappingURL=wasm-memory-manager.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-memory-manager.d.ts","sourceRoot":"","sources":["../src/wasm-memory-manager.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,WAAW,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,iBAAiB;IAC5B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,YAAY,CAA4B;gBAEpC,MAAM,EAAE,UAAU;IAI9B;;OAEG;IACH,OAAO,CAAC,SAAS;IASjB;;;;;;;;OAQG;IACH,iBAAiB,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,YAAY;IAKnE;;;;;OAKG;IACH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AAa,EAAE,MAAM,CAAC;CACvB"}
|
|
@@ -1,86 +0,0 @@
|
|
|
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
|
-
* Manages zero-copy TypedArray views into WASM linear memory
|
|
6
|
-
*/
|
|
7
|
-
export class WasmMemoryManager {
|
|
8
|
-
memory;
|
|
9
|
-
cachedBuffer = null;
|
|
10
|
-
constructor(memory) {
|
|
11
|
-
this.memory = memory;
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Get current memory buffer, detecting if it has changed (grown)
|
|
15
|
-
*/
|
|
16
|
-
getBuffer() {
|
|
17
|
-
const currentBuffer = this.memory.buffer;
|
|
18
|
-
if (this.cachedBuffer !== currentBuffer) {
|
|
19
|
-
// Memory has grown - all existing views are invalid!
|
|
20
|
-
this.cachedBuffer = currentBuffer;
|
|
21
|
-
}
|
|
22
|
-
return currentBuffer;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Create a Float32Array view directly into WASM memory (NO COPY!)
|
|
26
|
-
*
|
|
27
|
-
* WARNING: View becomes invalid if WASM memory grows!
|
|
28
|
-
* Use immediately and discard.
|
|
29
|
-
*
|
|
30
|
-
* @param byteOffset Byte offset into WASM memory (ptr value from Rust)
|
|
31
|
-
* @param length Number of f32 elements (not bytes)
|
|
32
|
-
*/
|
|
33
|
-
createFloat32View(byteOffset, length) {
|
|
34
|
-
const buffer = this.getBuffer();
|
|
35
|
-
return new Float32Array(buffer, byteOffset, length);
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Create a Uint32Array view directly into WASM memory (NO COPY!)
|
|
39
|
-
*
|
|
40
|
-
* @param byteOffset Byte offset into WASM memory
|
|
41
|
-
* @param length Number of u32 elements (not bytes)
|
|
42
|
-
*/
|
|
43
|
-
createUint32View(byteOffset, length) {
|
|
44
|
-
const buffer = this.getBuffer();
|
|
45
|
-
return new Uint32Array(buffer, byteOffset, length);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Create a Float64Array view directly into WASM memory (NO COPY!)
|
|
49
|
-
*
|
|
50
|
-
* @param byteOffset Byte offset into WASM memory
|
|
51
|
-
* @param length Number of f64 elements (not bytes)
|
|
52
|
-
*/
|
|
53
|
-
createFloat64View(byteOffset, length) {
|
|
54
|
-
const buffer = this.getBuffer();
|
|
55
|
-
return new Float64Array(buffer, byteOffset, length);
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Create a Uint8Array view directly into WASM memory (NO COPY!)
|
|
59
|
-
*
|
|
60
|
-
* @param byteOffset Byte offset into WASM memory
|
|
61
|
-
* @param length Number of bytes
|
|
62
|
-
*/
|
|
63
|
-
createUint8View(byteOffset, length) {
|
|
64
|
-
const buffer = this.getBuffer();
|
|
65
|
-
return new Uint8Array(buffer, byteOffset, length);
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Check if a view is still valid (memory hasn't grown)
|
|
69
|
-
*/
|
|
70
|
-
isViewValid(view) {
|
|
71
|
-
return view.buffer === this.memory.buffer;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Get raw ArrayBuffer (for advanced use cases)
|
|
75
|
-
*/
|
|
76
|
-
getRawBuffer() {
|
|
77
|
-
return this.getBuffer();
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Check if memory has grown since last access
|
|
81
|
-
*/
|
|
82
|
-
hasMemoryGrown() {
|
|
83
|
-
return this.cachedBuffer !== null && this.cachedBuffer !== this.memory.buffer;
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
//# sourceMappingURL=wasm-memory-manager.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"wasm-memory-manager.js","sourceRoot":"","sources":["../src/wasm-memory-manager.ts"],"names":[],"mappings":"AAAA;;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