@file-viewer/geometry-engine 3.2.2 → 3.3.1
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.en.md +2 -0
- package/README.md +14 -12
- package/README.zh-CN.md +46 -0
- package/dist/vendor/occt.NOTICE.txt +138 -2
- package/package.json +3 -2
package/README.en.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# @file-viewer/geometry-engine
|
|
2
2
|
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.zh-CN.md)
|
|
4
|
+
|
|
3
5
|
Framework-neutral, UI-free geometry kernel for Flyfish File Viewer. It now decodes STEP / STP, IGES / IGS, and BREP directly in the browser: OCCT tessellation runs in a local worker, with no upload or server-side conversion. IFC and Rhino 3DM currently provide signature detection and accurate capability notices only; their full geometry renderers are not wired yet.
|
|
4
6
|
|
|
5
7
|
```ts
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# @file-viewer/geometry-engine
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Framework-neutral, UI-free geometry kernel for Flyfish File Viewer. It now decodes STEP / STP, IGES / IGS, and BREP directly in the browser: OCCT tessellation runs in a local worker, with no upload or server-side conversion. IFC and Rhino 3DM currently provide signature detection and accurate capability notices only; their full geometry renderers are not wired yet.
|
|
4
6
|
|
|
5
7
|
```ts
|
|
6
8
|
import { importOcctGeometryFile } from '@file-viewer/geometry-engine'
|
|
@@ -18,11 +20,11 @@ const result = await importOcctGeometryFile(buffer, 'step', {
|
|
|
18
20
|
})
|
|
19
21
|
```
|
|
20
22
|
|
|
21
|
-
`result`
|
|
23
|
+
`result` contains the OCCT assembly hierarchy, meshes, normals, indices, and face colors for conversion into Three.js or another rendering layer. Parsing uses a one-shot worker by default and transfers both source bytes and mesh buffers. The worker is released after success, cancellation, failure, or timeout. `timeoutMs` defaults to 120 seconds. Set `useWorker: false` only when workers are genuinely unavailable, because that fallback parses on the main thread.
|
|
22
24
|
|
|
23
|
-
##
|
|
25
|
+
## Offline Assets
|
|
24
26
|
|
|
25
|
-
|
|
27
|
+
The runtime never falls back to a CDN. Deploy these files with the viewer:
|
|
26
28
|
|
|
27
29
|
- `wasm/model/occt-worker.js`
|
|
28
30
|
- `wasm/model/occt-import-js.js`
|
|
@@ -30,15 +32,15 @@ const result = await importOcctGeometryFile(buffer, 'step', {
|
|
|
30
32
|
- `wasm/model/LICENSE.occt.txt`
|
|
31
33
|
- `wasm/model/LICENSE.occt-import-js.txt`
|
|
32
34
|
|
|
33
|
-
`@file-viewer/vite-plugin
|
|
35
|
+
`@file-viewer/vite-plugin`, full packages, and the repository build scripts copy these assets. A bare package integration must self-host them and provide `workerUrl`, `runtimeUrl`, and `wasmUrl`. For subpath deployments, asset domains, or controlled gateways, pass final absolute URLs or correctly prefixed URLs instead of relying on the site root.
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
A strict CSP must at least allow the asset origin in `worker-src`, `script-src`, and `connect-src` for the WASM fetch; some browsers also require `script-src 'wasm-unsafe-eval'` to compile WebAssembly. The classic worker loads the local runtime with `importScripts()`, so allowing only the WASM file is not sufficient.
|
|
36
38
|
|
|
37
|
-
##
|
|
39
|
+
## Boundaries
|
|
38
40
|
|
|
39
|
-
- `inspectGeometryKernelFile()`
|
|
40
|
-
- STEP / STP
|
|
41
|
-
- IFC
|
|
42
|
-
- OCCT
|
|
41
|
+
- `inspectGeometryKernelFile()` still offers prefix-only detection for common STEP / IGES / IFC / 3DM / BREP signatures.
|
|
42
|
+
- STEP / STP, IGES / IGS, and BREP use `occt-import-js` / OpenCascade and have a complete mesh-preview path.
|
|
43
|
+
- IFC still needs a dedicated `web-ifc` / That Open integration; 3DM still needs McNeel `rhino3dm`. Neither format is presented as fully previewable yet.
|
|
44
|
+
- The OCCT and `occt-import-js` license notices must ship with the offline assets.
|
|
43
45
|
|
|
44
|
-
|
|
46
|
+
Keeping this heavy path in a separate package lets `@file-viewer/core` stay small while worker, WASM, licensing, and real engineering-file regressions remain independently maintainable.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# @file-viewer/geometry-engine
|
|
2
|
+
|
|
3
|
+
[English](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.md) · [简体中文](https://github.com/flyfish-dev/file-viewer/blob/main/packages/renderers/geometry-engine/README.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
Flyfish File Viewer 的无 UI、框架无关几何内核包。它已经提供浏览器原生的 STEP / STP、IGES / IGS 和 BREP 解析:文件在本地 OCCT Worker 中完成三角化,不需要上传或服务端转换。IFC 和 Rhino 3DM 目前只提供格式识别与准确的能力提示,尚未接入完整几何渲染。
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { importOcctGeometryFile } from '@file-viewer/geometry-engine'
|
|
9
|
+
|
|
10
|
+
const result = await importOcctGeometryFile(buffer, 'step', {
|
|
11
|
+
workerUrl: '/viewer-assets/wasm/model/occt-worker.js',
|
|
12
|
+
runtimeUrl: '/viewer-assets/wasm/model/occt-import-js.js',
|
|
13
|
+
wasmUrl: '/viewer-assets/wasm/model/occt-import-js.wasm',
|
|
14
|
+
params: {
|
|
15
|
+
linearUnit: 'millimeter',
|
|
16
|
+
linearDeflectionType: 'bounding_box_ratio',
|
|
17
|
+
linearDeflection: 0.001,
|
|
18
|
+
angularDeflection: 0.5,
|
|
19
|
+
},
|
|
20
|
+
})
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`result` 包含 OCCT 输出的装配层级、网格、法线、索引和面颜色信息,可继续转换为 Three.js 或其他渲染对象。解析默认在一次性 Worker 中执行,文件字节和网格缓冲区使用 transferable 传递;完成、取消、报错或超时后 Worker 都会释放。`timeoutMs` 默认是 120 秒。只有 Worker 确实不可用时才建议设置 `useWorker: false`,因为回退会占用主线程。
|
|
24
|
+
|
|
25
|
+
## 离线资产
|
|
26
|
+
|
|
27
|
+
运行时不访问 CDN。部署时需要把下列文件放到同一套静态资源中:
|
|
28
|
+
|
|
29
|
+
- `wasm/model/occt-worker.js`
|
|
30
|
+
- `wasm/model/occt-import-js.js`
|
|
31
|
+
- `wasm/model/occt-import-js.wasm`
|
|
32
|
+
- `wasm/model/LICENSE.occt.txt`
|
|
33
|
+
- `wasm/model/LICENSE.occt-import-js.txt`
|
|
34
|
+
|
|
35
|
+
`@file-viewer/vite-plugin`、full 包和仓库构建脚本会复制这些资产。直接集成本包时,需要自行托管并传入 `workerUrl`、`runtimeUrl` 和 `wasmUrl`。应用部署在子路径、资源域名或受控网关下时,请传入最终可访问的绝对 URL 或带前缀 URL,不要依赖站点根路径。
|
|
36
|
+
|
|
37
|
+
严格 CSP 至少应允许资产来源出现在 `worker-src`、`script-src` 和用于获取 WASM 的 `connect-src` 中;部分浏览器还要求 `script-src 'wasm-unsafe-eval'` 才能编译 WebAssembly。Worker 使用本地 `importScripts()` 加载 runtime,因此不要只放行 WASM 而漏掉 runtime 脚本。
|
|
38
|
+
|
|
39
|
+
## 能力边界
|
|
40
|
+
|
|
41
|
+
- `inspectGeometryKernelFile()` 仍可只读取文件前缀,识别 STEP / IGES / IFC / 3DM / BREP 常见签名。
|
|
42
|
+
- STEP / STP、IGES / IGS 和 BREP 走 `occt-import-js` / OpenCascade,已经具备完整网格预览路径。
|
|
43
|
+
- IFC 仍需要独立的 `web-ifc` / That Open 集成;3DM 仍需要 McNeel `rhino3dm` 集成。当前不会把它们伪装成已支持预览。
|
|
44
|
+
- OCCT 与 `occt-import-js` 的许可证文件必须随离线资产一起分发。
|
|
45
|
+
|
|
46
|
+
把重型几何能力留在独立包中,可以让 `@file-viewer/core` 保持轻量,同时隔离 Worker、WASM、许可证和真实工程样本回归边界。
|
|
@@ -657,8 +657,19 @@ flag will run closure compiler from third_party/).
|
|
|
657
657
|
|
|
658
658
|
|
|
659
659
|
Original public toolchain material: https://raw.githubusercontent.com/emscripten-core/emscripten/40e6b046cf7d3d9d0789196a3e26689ccaec0948/system/lib/dlmalloc.c
|
|
660
|
-
SHA-256:
|
|
661
|
-
/*
|
|
660
|
+
SHA-256: e1877bb510d75deed3b84c6485d497953b9295bfa4f6d9aa64746c87a18682cf
|
|
661
|
+
/*
|
|
662
|
+
This is a version (aka dlmalloc) of malloc/free/realloc written by
|
|
663
|
+
Doug Lea and released to the public domain, as explained at
|
|
664
|
+
http://creativecommons.org/publicdomain/zero/1.0/ Send questions,
|
|
665
|
+
comments, complaints, performance data, etc to dl@cs.oswego.edu
|
|
666
|
+
|
|
667
|
+
* Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea
|
|
668
|
+
Note: There may be an updated version of this malloc obtainable at
|
|
669
|
+
ftp://gee.cs.oswego.edu/pub/misc/malloc.c
|
|
670
|
+
Check before installing!
|
|
671
|
+
|
|
672
|
+
|
|
662
673
|
|
|
663
674
|
Original public toolchain material: https://raw.githubusercontent.com/emscripten-core/emscripten/40e6b046cf7d3d9d0789196a3e26689ccaec0948/system/lib/emmalloc.c
|
|
664
675
|
SHA-256: 1a5b50aef8e92780b841df1d62529e9b670b3569c46eba3e3948251713892c50
|
|
@@ -2194,6 +2205,131 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
2194
2205
|
SOFTWARE.
|
|
2195
2206
|
|
|
2196
2207
|
|
|
2208
|
+
Original public toolchain material: https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt
|
|
2209
|
+
SHA-256: a2010f343487d3f7618affe54f789f5487602331c0a8d03f49e9a7c547cf0499
|
|
2210
|
+
Creative Commons Legal Code
|
|
2211
|
+
|
|
2212
|
+
CC0 1.0 Universal
|
|
2213
|
+
|
|
2214
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
2215
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
2216
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
2217
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
2218
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
2219
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
2220
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
2221
|
+
HEREUNDER.
|
|
2222
|
+
|
|
2223
|
+
Statement of Purpose
|
|
2224
|
+
|
|
2225
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
2226
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
2227
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
2228
|
+
authorship and/or a database (each, a "Work").
|
|
2229
|
+
|
|
2230
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
2231
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
2232
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
2233
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
2234
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
2235
|
+
and for any purposes, including without limitation commercial purposes.
|
|
2236
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
2237
|
+
culture and the further production of creative, cultural and scientific
|
|
2238
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
2239
|
+
part through the use and efforts of others.
|
|
2240
|
+
|
|
2241
|
+
For these and/or other purposes and motivations, and without any
|
|
2242
|
+
expectation of additional consideration or compensation, the person
|
|
2243
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
2244
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
2245
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
2246
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
2247
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
2248
|
+
|
|
2249
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
2250
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
2251
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
2252
|
+
limited to, the following:
|
|
2253
|
+
|
|
2254
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
2255
|
+
communicate, and translate a Work;
|
|
2256
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
2257
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
2258
|
+
likeness depicted in a Work;
|
|
2259
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
2260
|
+
subject to the limitations in paragraph 4(a), below;
|
|
2261
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
2262
|
+
in a Work;
|
|
2263
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
2264
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
2265
|
+
protection of databases, and under any national implementation
|
|
2266
|
+
thereof, including any amended or successor version of such
|
|
2267
|
+
directive); and
|
|
2268
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
2269
|
+
world based on applicable law or treaty, and any national
|
|
2270
|
+
implementations thereof.
|
|
2271
|
+
|
|
2272
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
2273
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
2274
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
2275
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
2276
|
+
of action, whether now known or unknown (including existing as well as
|
|
2277
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
2278
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
2279
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
2280
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
2281
|
+
including without limitation commercial, advertising or promotional
|
|
2282
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
2283
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
2284
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
2285
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
2286
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
2287
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
2288
|
+
|
|
2289
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
2290
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
2291
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
2292
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
2293
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
2294
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
2295
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
2296
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
2297
|
+
maximum duration provided by applicable law or treaty (including future
|
|
2298
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
2299
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
2300
|
+
limitation commercial, advertising or promotional purposes (the
|
|
2301
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
2302
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
2303
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
2304
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
2305
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
2306
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
2307
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
2308
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
2309
|
+
express Statement of Purpose.
|
|
2310
|
+
|
|
2311
|
+
4. Limitations and Disclaimers.
|
|
2312
|
+
|
|
2313
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
2314
|
+
surrendered, licensed or otherwise affected by this document.
|
|
2315
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
2316
|
+
warranties of any kind concerning the Work, express, implied,
|
|
2317
|
+
statutory or otherwise, including without limitation warranties of
|
|
2318
|
+
title, merchantability, fitness for a particular purpose, non
|
|
2319
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
2320
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
2321
|
+
the greatest extent permissible under applicable law.
|
|
2322
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
2323
|
+
that may apply to the Work or any use thereof, including without
|
|
2324
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
2325
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
2326
|
+
consents, permissions or other rights required for any use of the
|
|
2327
|
+
Work.
|
|
2328
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
2329
|
+
party to this document and has no duty or obligation with respect to
|
|
2330
|
+
this CC0 or use of the Work.
|
|
2331
|
+
|
|
2332
|
+
|
|
2197
2333
|
|
|
2198
2334
|
========================================
|
|
2199
2335
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@file-viewer/geometry-engine",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Framework-neutral geometry kernel boundary package for STEP, IGES, IFC, 3DM, and BREP preview routes in File Viewer.",
|
|
@@ -60,7 +60,8 @@
|
|
|
60
60
|
"dist/vendor/occt.NOTICE.txt",
|
|
61
61
|
"LICENSE",
|
|
62
62
|
"README.en.md",
|
|
63
|
-
"README.md"
|
|
63
|
+
"README.md",
|
|
64
|
+
"README.zh-CN.md"
|
|
64
65
|
],
|
|
65
66
|
"license": "Apache-2.0",
|
|
66
67
|
"dependencies": {
|