@file-viewer/renderer-3d 3.1.2 → 3.2.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.
Files changed (73) hide show
  1. package/GEO3D.md +505 -0
  2. package/GEO3D_THIRD_PARTY_NOTICES.md +63 -0
  3. package/IFC.md +14 -1
  4. package/README.en.md +3 -35
  5. package/README.md +3 -35
  6. package/bin/copy-geo3d-assets.mjs +143 -0
  7. package/bin/copy-ifc-assets.mjs +53 -17
  8. package/dist/geo3d-workers/geotiff-worker.js +9 -0
  9. package/dist/geo3d-workers/las-worker.js +3858 -0
  10. package/dist/geo3d-workers/licenses/_giro3d_giro3d-LICENSE +10 -0
  11. package/dist/geo3d-workers/licenses/copc-license +21 -0
  12. package/dist/geo3d-workers/licenses/cross-fetch-LICENSE +21 -0
  13. package/dist/geo3d-workers/licenses/laz-perf-COPYING.txt +202 -0
  14. package/dist/geo3d-workers/licenses/mgrs-license.md +19 -0
  15. package/dist/geo3d-workers/licenses/ol-LICENSE.md +25 -0
  16. package/dist/geo3d-workers/licenses/proj4-LICENSE.md +29 -0
  17. package/dist/geo3d-workers/licenses/three-LICENSE +21 -0
  18. package/dist/geo3d-workers/licenses/wkt-parser-LICENSE.md +29 -0
  19. package/dist/geo3d-workers/manifest.json +203 -0
  20. package/dist/geo3d-workers/raster-licenses/_giro3d_giro3d-LICENSE +10 -0
  21. package/dist/geo3d-workers/raster-licenses/_petamoriken_float16-LICENSE +21 -0
  22. package/dist/geo3d-workers/raster-licenses/geotiff-LICENSE +22 -0
  23. package/dist/geo3d-workers/raster-licenses/lerc-LICENSE +101 -0
  24. package/dist/geo3d-workers/raster-licenses/lerc-NOTICE +23 -0
  25. package/dist/geo3d-workers/raster-licenses/pako-LICENSE +21 -0
  26. package/dist/geo3d-workers/raster-licenses/quick-lru-license +9 -0
  27. package/dist/geo3d-workers/raster-licenses/web-worker-LICENSE +201 -0
  28. package/dist/geo3d-workers/raster-licenses/xml-utils-LICENSE +121 -0
  29. package/dist/geo3d-workers/raster-licenses/zstddec-LICENSE +54 -0
  30. package/dist/geo3d-workers/texture-worker.js +1 -0
  31. package/dist/geo3d.d.ts +10 -0
  32. package/dist/geo3d.js +38 -0
  33. package/dist/geo3dArchive.d.ts +25 -0
  34. package/dist/geo3dArchive.js +393 -0
  35. package/dist/geo3dCityJson.d.ts +65 -0
  36. package/dist/geo3dCityJson.js +354 -0
  37. package/dist/geo3dCrs.d.ts +8 -0
  38. package/dist/geo3dCrs.js +18 -0
  39. package/dist/geo3dHooks.d.ts +4 -0
  40. package/dist/geo3dHooks.js +91 -0
  41. package/dist/geo3dInspect.d.ts +32 -0
  42. package/dist/geo3dInspect.js +410 -0
  43. package/dist/geo3dLasWorkers.d.ts +6 -0
  44. package/dist/geo3dLasWorkers.js +59 -0
  45. package/dist/geo3dOwnedWorkerPool.d.ts +31 -0
  46. package/dist/geo3dOwnedWorkerPool.js +209 -0
  47. package/dist/geo3dPointFactories.js +3835 -0
  48. package/dist/geo3dPointMaterial.d.ts +2 -0
  49. package/dist/geo3dPointMaterial.js +54 -0
  50. package/dist/geo3dRange.d.ts +11 -0
  51. package/dist/geo3dRange.js +151 -0
  52. package/dist/geo3dRasterFactories.js +32 -0
  53. package/dist/geo3dRasterWorkers.d.ts +14 -0
  54. package/dist/geo3dRasterWorkers.js +48 -0
  55. package/dist/geo3dRuntime.d.ts +144 -0
  56. package/dist/geo3dRuntime.js +378 -0
  57. package/dist/geo3dUrl.d.ts +1 -0
  58. package/dist/geo3dUrl.js +5 -0
  59. package/dist/ifc-import.worker.js +0 -2
  60. package/dist/ifc.d.ts +0 -9
  61. package/dist/ifc.js +0 -1
  62. package/dist/ifcRuntime.js +4 -9
  63. package/dist/ifcSettings.d.ts +0 -3
  64. package/dist/ifcSettings.js +0 -3
  65. package/dist/model.js +0 -4
  66. package/dist/occtModel.js +0 -2
  67. package/licenses/laz-perf-COPYING.txt +202 -0
  68. package/licenses/laz-perf-PROVENANCE.md +22 -0
  69. package/licenses/lerc-LICENSE +101 -0
  70. package/licenses/lerc-NOTICE +23 -0
  71. package/licenses/lerc-PROVENANCE.md +37 -0
  72. package/licenses/thatopen-components-MIT.txt +18 -0
  73. package/package.json +115 -29
package/GEO3D.md ADDED
@@ -0,0 +1,505 @@
1
+ # Optional streaming Geo3D viewer
2
+
3
+ The explicit `@file-viewer/renderer-3d/geo3d` entry follows the same opt-in
4
+ specialist pattern as IFC. It is not imported by `@file-viewer/renderer-3d`
5
+ and is not added to Full or engineering presets.
6
+
7
+ The `/geo3d` entry exposes the real Giro3D classes in its options, hooks and
8
+ returned viewer, so importing its declarations requires the Giro3D peer as well
9
+ as enabling its runtime. The ordinary package entry has no Giro3D type imports.
10
+ For dataset detection before choosing whether to enable the engine, use the
11
+ separate SDK-free inspection entry:
12
+
13
+ ```ts
14
+ import { inspectGeo3dDataset, isCopcLasBuffer } from '@file-viewer/renderer-3d/geo3d/inspect'
15
+ ```
16
+
17
+ This entry exports the dataset probes and their input/result types without
18
+ loading or referencing Giro3D declarations. It does not export renderer options,
19
+ SDK hooks or viewer instances. Import `/geo3d` after installing the supported
20
+ SDK when those APIs are required.
21
+
22
+ The integration previews LAS/LAZ, COPC, CityJSON, GeoTIFF/COG, 3D Tiles and
23
+ bounded 3TZ archives. Point clouds and rasters use source-owned decoder Workers
24
+ by default. The browser acceptance suite checks rendering, repeated teardown,
25
+ concurrent viewers and cancellation, both in the workspace and from installed
26
+ tarballs. See [Fixtures, licenses and verification](#fixtures-licenses-and-verification)
27
+ for reproducible checks and their scope.
28
+
29
+ COPC and remote COG use range-aware access. Plain LAS/LAZ, CityJSON and 3TZ are
30
+ bounded whole-file inputs. 3D Tiles retains its original URL so nested tiles,
31
+ glTF resources and textures remain relative to the dataset.
32
+
33
+ ## Install and self-host
34
+
35
+ Giro3D is an optional peer, matching the IFC specialist entry:
36
+
37
+ ```sh
38
+ npm install @file-viewer/renderer-3d @giro3d/giro3d@2.0.4
39
+ # Only required when 3TZ archives are enabled:
40
+ npm install jszip@3.10.2
41
+
42
+ npx file-viewer-geo3d-assets public/file-viewer/vendor/geo3d
43
+ ```
44
+
45
+ For strict TypeScript 6 consumers of this optional entry, install the compatible
46
+ Three type host as an ordinary development dependency:
47
+
48
+ ```sh
49
+ npm install --save-dev @types/three@0.185.0
50
+ ```
51
+
52
+ The NodeNext and Bundler consumer checks keep `strict: true` and
53
+ `skipLibCheck: false`, and exercise the real Giro3D classes and format-narrowed
54
+ hooks. Giro3D 2.0.4 requires the Three 0.180 runtime; the renderer retains its own
55
+ Three 0.186 dependency. Three type host 0.186 adds a `dispose` event that conflicts
56
+ with Giro3D's published `LayerNodeEventMap` and `TileMeshEventMap` declarations.
57
+ That upstream combination is not supported by the strict optional-entry check.
58
+
59
+ The asset command copies the static module Workers `workers/las-worker.js`,
60
+ `workers/geotiff-worker.js` and `workers/texture-worker.js`, laz-perf WASM,
61
+ Three.js DRACO and KTX2/Basis decoders, licenses, notices and content manifests.
62
+ Worker hashes are checked against the build manifest. Re-run asset-copy whenever
63
+ updating this renderer; updating JavaScript while retaining older public decoder
64
+ assets is not sufficient. Preserve `workers/licenses/`, `workers/raster-licenses/`,
65
+ `workers/manifest.json` and the root license/manifest files.
66
+
67
+ Decoder assets are resolved from the installed Giro3D peer graph. Reviewed,
68
+ SHA-256-pinned source transformations generate the point/raster factories during
69
+ the renderer build, without editing installed engine files. Factories and
70
+ Workers are shipped in `dist`; consumers of the compiled package do not need
71
+ its development adapter generators. The installed-consumer test verifies this
72
+ with source/build scripts absent, install scripts disabled, a physical npm
73
+ installation and both public TypeScript resolution modes. Retained laz-perf and
74
+ Lerc license fallbacks are version-specific and hash-checked, with no build-time
75
+ license download.
76
+
77
+ The renderer passes local decoder paths explicitly; no decoder CDN is required.
78
+ For a nested deployment, copy to the matching public path and use the same URL
79
+ prefix as `assetBaseUrl`. Browser checks build production fixtures and use the
80
+ real engine and Workers. The concurrent suite also enforces `worker-src 'self'`
81
+ with static decoder scripts under a nested custom asset path.
82
+
83
+ ## Usage
84
+
85
+ ```ts
86
+ import { modelRenderer } from '@file-viewer/renderer-3d'
87
+ import { createGeo3dRenderer } from '@file-viewer/renderer-3d/geo3d'
88
+
89
+ const geo3d = createGeo3dRenderer({
90
+ assetBaseUrl: '/file-viewer/vendor/geo3d/',
91
+ maxLasBytes: 512 * 1024 * 1024,
92
+ maxCityJsonBytes: 64 * 1024 * 1024,
93
+ max3tzBytes: 512 * 1024 * 1024,
94
+ archive: {
95
+ maxEntries: 4096,
96
+ maxExpandedBytes: 512 * 1024 * 1024,
97
+ maxEntryBytes: 128 * 1024 * 1024,
98
+ maxCompressionRatio: 200,
99
+ },
100
+ giro3d: {
101
+ instance: { logarithmicDepthBuffer: true },
102
+ view: { fitToDataset: true, controls: true },
103
+ sources: {
104
+ copc: { decimate: 1, pointSize: 4 },
105
+ las: { decimate: 1, pointSize: 4 },
106
+ geotiff: {},
107
+ cog: {},
108
+ cityjson: {
109
+ materialColor: '#b8c4d2',
110
+ // Optional: select a named texture theme present in the document.
111
+ // textureTheme: 'day',
112
+ },
113
+ '3d-tiles': { errorTarget: 8, pointSize: 4 },
114
+ },
115
+ },
116
+ configureInstance({ instance, signal }) {
117
+ // The actual, fully typed Giro3D Instance before instance.add().
118
+ // The required signal covers this viewer's entire lifetime.
119
+ // Return cleanup only for resources owned by this application.
120
+ },
121
+ configure(context) {
122
+ // Discriminating format narrows the real entity type, without a cast.
123
+ if (context.format === 'copc') {
124
+ context.entity.pointSize = 4
125
+ context.entity.opacity = 0.9
126
+ context.instance.notifyChange(context.entity)
127
+ }
128
+ },
129
+ })
130
+
131
+ const options = {
132
+ rendererMode: 'extend',
133
+ renderers: [modelRenderer, geo3d],
134
+ }
135
+ ```
136
+
137
+ ### Relative dataset URLs
138
+
139
+ Root-relative and document-relative dataset URLs are resolved against the viewer
140
+ container's owning document `baseURI`, including a host `<base href>`. The
141
+ normalized dataset URL is then used by the engine and as the base for relative
142
+ CityJSON textures and 3D Tiles resources. Absolute dataset URLs and their query
143
+ strings are preserved. Local File/buffer inputs are not assigned a network URL.
144
+
145
+ ### Local Blob sources
146
+
147
+ The headless `createViewer().load()` API retains the original File or Blob for
148
+ Geo3D. Local COPC reads only the requested slices rather than materializing the
149
+ whole file. The browser acceptance fixture verifies that behavior with a Blob
150
+ whose whole-file `arrayBuffer()` method throws.
151
+
152
+ ![Local COPC Blob rendered by the public headless API](docs/headless-blob-copc.png)
153
+
154
+ ## Advanced API and resource ownership
155
+
156
+ `configureInstance` exposes the actual Giro3D `Instance`. `configure` adds a
157
+ format-discriminated entity: PointCloud for LAS/LAZ/COPC, Map for GeoTIFF/COG,
158
+ Tiles3D for 3D Tiles/3TZ, and the rendered object group for CityJSON. The public
159
+ Instance/entity APIs are not replaced by narrow structural facades. Picking,
160
+ view changes, progress, memory observations and entity-specific public controls
161
+ remain accessible through these objects. The consumer fixture exercises the
162
+ installed declarations in both NodeNext and Bundler modes. This is not a claim
163
+ that every possible engine feature has its own visual regression.
164
+
165
+ Use trusted application code for these hooks and options. Dataset metadata must
166
+ not become executable configuration, arbitrary Worker/WASM paths, constructors,
167
+ fetch functions or disposers. Source options remain an explicit whitelist, not
168
+ an unrestricted `Record<string, any>` passed through to engine constructors.
169
+
170
+ File Viewer owns the Instance, initial entities/sources, controls, decoder pools,
171
+ fetch cancellation, archive URLs and created texture/bitmap resources. Hooks
172
+ must not dispose adapter-owned objects. Return cleanup for host-created layers,
173
+ listeners and other resources. Returned cleanup runs in reverse registration
174
+ order; a throwing callback does not prevent the remaining resources from being
175
+ released. Both hooks receive the required viewer AbortSignal.
176
+
177
+ Point requests are stopped before their source pool is cancelled. Queued work
178
+ cannot read a disposed source, and fulfilled results cannot create late geometry
179
+ after cancellation. Initialization retains its complete readiness Promise chain,
180
+ so a handled failure does not create an additional unhandled rejection. Public
181
+ cancellation reasons are preserved and genuine decoder errors remain visible.
182
+ Repeated `unmount()` returns the same cleanup Promise, including reentrant calls.
183
+
184
+ Explicit `enableWorkers: false` remains available for synchronous decoding.
185
+ The lazy owned pool creates no Worker in this mode; it is not the acceptance
186
+ path for asynchronous decoding. The default Worker path is tested separately
187
+ for points and rasters, with two viewers and a fresh viewer after final cleanup.
188
+
189
+ ### Native sources and the initial raster layer
190
+
191
+ `source` remains the original input descriptor (URL/File/buffer, filename and
192
+ relative-resource resolver). It is not the decoder. The post-load hook and the
193
+ returned viewer additionally expose read-only references to adapter-owned objects:
194
+
195
+ | Normalized format | `entity` | `nativeSource` | `colorLayer` |
196
+ | --- | --- | --- | --- |
197
+ | `copc` | PointCloud | COPCSource-compatible owned adapter | `null` |
198
+ | `las`, `laz` | PointCloud | LASSource-compatible owned adapter | `null` |
199
+ | `geotiff`, `cog` | Map | GeoTIFFSource-compatible owned adapter | Initial ColorLayer |
200
+ | `3d-tiles`, `3tz` | Tiles3D | `null` | `null` |
201
+ | `cityjson` | Rendered Group | `null` | `null` |
202
+
203
+ The source adapters preserve the reviewed engine's public source APIs while
204
+ owning their decoder pools. The read-only reference does not make the object
205
+ immutable: public setters remain usable. Do not dispose these objects from a
206
+ hook, replace their Worker/fetch machinery or transfer them to another viewer.
207
+
208
+ ```ts
209
+ const geo3d = createGeo3dRenderer({
210
+ // Zero is the engine's automatic point-size mode, not an invalid size.
211
+ giro3d: { sources: { copc: { pointSize: 0 }, las: { pointSize: 0 } } },
212
+ configure(context) {
213
+ if (context.format === 'copc') {
214
+ context.entity.pointBudget = 100_000
215
+ const attributes = context.entity.getSupportedAttributes()
216
+ if (attributes.some(attribute => attribute.name === 'Intensity')) {
217
+ context.entity.setColoringMode('attribute')
218
+ context.entity.setActiveAttribute('Intensity')
219
+ context.nativeSource.filters = [
220
+ { dimension: 'Intensity', operator: 'greaterequal', value: 0 },
221
+ ]
222
+ }
223
+ } else if (context.format === 'geotiff' || context.format === 'cog') {
224
+ context.colorLayer.opacity = 0.8
225
+ context.colorLayer.contrast = 1.1
226
+ // Channel selection depends on the dataset's available bands.
227
+ // context.nativeSource.channels = [2, 1, 0]
228
+ }
229
+ context.instance.notifyChange(context.entity)
230
+ },
231
+ })
232
+ ```
233
+
234
+ The consumer type fixture covers source-specific APIs and rejects mismatched
235
+ entities, invalid options and lost type information in NodeNext and Bundler.
236
+ The browser suite also uses real source/layer identities, intensity and
237
+ classification modes, filters, color maps, raster channel setters and layer
238
+ reattachment, Tiles styling accessors, picking and interactive camera controls.
239
+ These tests do not certify every possible dataset or every engine feature.
240
+
241
+ ### Cancellation of asynchronous application hooks
242
+
243
+ Both hook waits are cancellable even when the application Promise ignores its
244
+ AbortSignal or remains pending. Cancellation rejects the render with the original
245
+ reason and releases the viewer's existing resources without waiting for that
246
+ hook. A cleanup returned after cancellation is run exactly once. Returning it does
247
+ not restart the old viewer or repeat its teardown, so the adapter does not
248
+ clear a replacement viewer. Already available cleanups
249
+ run in reverse registration order; genuinely late cleanups necessarily run when
250
+ they become available.
251
+
252
+ A hook must return `undefined` or a cleanup function, synchronously or through a
253
+ Promise. Other values reject the render with TypeError. Synchronous exceptions
254
+ and pre-cancellation hook rejections remain render errors. Cleanup failures and
255
+ late hook failures are reported through `onExtensionError(error)`; without an
256
+ observer they use `globalThis.reportError`, or `console.error` where unavailable.
257
+ An observer failure is reported together with the original error. Reporting a
258
+ host cleanup failure does not skip remaining resource release.
259
+
260
+ Cancellation stops waiting for application code; it cannot terminate arbitrary
261
+ JavaScript running on the application's thread. Async hooks should still check
262
+ `context.signal` before mutating runtime objects after an await. Returned cleanup
263
+ functions may be asynchronous but must settle; the renderer awaits registered
264
+ cleanup functions during normal unmount. Release only host-owned resources.
265
+
266
+ Eight real browser regressions hold non-cooperative pre/post-load hooks for COPC
267
+ and COG, abort without releasing them, create a replacement in the same target,
268
+ and then resolve or reject the old hook. They verify survivor/replacement
269
+ rendering, exact cleanup/error delivery and no retained viewer resources. These
270
+ cases run against both workspace output and physical installed tarballs.
271
+
272
+ ### Pinned engine maintenance boundary
273
+
274
+ The ownership adapters deliberately depend on reviewed Giro3D 2.0.4 source.
275
+ Besides source-local pool injection, the PointCloud subclass overrides the
276
+ engine's internal loading method to link node and viewer cancellation. Source
277
+ initialization uses protected readiness fields. These are not an assertion of
278
+ compatibility with arbitrary future Giro3D versions. Exact source hashes fail
279
+ the build when those implementations change. An upgrade requires reviewing the
280
+ transformations and lifecycle contract, not merely replacing expected hashes.
281
+
282
+ The PNTS material adapter is also version-bound: it repairs classification
283
+ define names and flattens classification uniforms while preserving the engine
284
+ lookup textures, weights and public styling API. The build verifies the pinned
285
+ `src/renderer/shader/PointsVS.glsl` against the installed runtime material.
286
+
287
+ Raster sources track their own decoded-region cache entries and release them
288
+ on disposal, including stale entries. Pending reads cannot repopulate a closed
289
+ source's cache. Shared capacity and other live sources' entries are preserved.
290
+
291
+ No global Worker/URL prototype is patched by production code and no shared
292
+ engine pool is disposed to close an individual viewer. Test harnesses instrument
293
+ Worker/URL only to observe ownership. The explicit synchronous laz-perf setup
294
+ still uses the pinned engine's public decoder configuration. This maintenance
295
+ tradeoff is distinct from the public, typed application escape hatch.
296
+
297
+ ## Detection and routing
298
+
299
+ ### LAS / LAZ / COPC
300
+
301
+ `.las` and `.laz` are accepted directly. `*.copc.laz` and `.copc` identify COPC;
302
+ bounded LAS header/VLR inspection promotes generic LAS/LAZ sources containing
303
+ the COPC VLR. Header detection also supports generic downloads without the
304
+ expected filename extension.
305
+
306
+ Remote COPC uses strict byte ranges: HTTP 206, exposed and matching
307
+ `Content-Range`, expected body length and identity encoding are checked. Local
308
+ COPC uses `File.slice()`. Plain LAS/LAZ uses the derived Giro3D `LASSource` with a
309
+ bounded whole-file read controlled by `maxLasBytes`; it is not progressive.
310
+
311
+ The point-cloud scene CRS must match the dataset CRS. An incompatible scene is
312
+ rejected before application hooks; no runtime point-cloud reprojection is
313
+ performed. Reproject the dataset beforehand when a different scene is required.
314
+
315
+ ### GeoTIFF / COG versus ordinary TIFF
316
+
317
+ Installing Geo3D does not take all TIFF files away from the image renderer.
318
+ `.tif` / `.tiff` is inspected before final dispatch. The specialist route is
319
+ selected only when geographic TIFF metadata is found. Recognized tags include
320
+ ModelPixelScale (33550), ModelTiepoint (33922), ModelTransformation (34264),
321
+ GeoKeyDirectory (34735), GeoDoubleParams (34736) and GeoAsciiParams (34737).
322
+
323
+ Inspection reports `isCog`, CRS, bounding box, width, height, bands, tiling and
324
+ overviews. COG classification is separate from GeoTIFF detection and uses
325
+ structural evidence rather than extension or MIME alone. Incomplete evidence
326
+ can yield `unknown`; this heuristic is not an OGC conformance certificate.
327
+
328
+ Remote COG keeps its original URL in the owned `GeoTIFFSource` factory. Ordinary
329
+ TIFF remains on the existing image renderer. TIFF/BigTIFF probes have bounded
330
+ IFD, tag and byte budgets and propagate cancellation. Source coordinates retain
331
+ their native CRS; a different scene CRS transforms the map extent rather than
332
+ relabelling pixels. WGS84 UTM definitions and additional offline WKT/proj strings
333
+ through `crsDefinitions` require no online EPSG lookup. Do not use a CRS label
334
+ change as a substitute for a coordinate transformation.
335
+
336
+ ### CityJSON and external textures
337
+
338
+ CityJSON is recognized by `*.city.json`, `.cityjson`, `application/city+json`
339
+ or bounded JSON sniffing. Surface/solid geometry is triangulated in the browser
340
+ and added as a Three.js object. Transform and EPSG reference system are retained.
341
+ Mesh coordinates are relative to an origin stored in the object transform,
342
+ preserving precision for projected coordinates. An incompatible CityJSON scene
343
+ CRS is rejected instead of silently relabelling coordinates.
344
+
345
+ Textures are applied to the mesh, not merely exposed as metadata. Geometry rings
346
+ and UV pairs stay associated through triangulation, including holes. Selection
347
+ uses `textureTheme`, the document's default texture theme, or the first available
348
+ theme. A missing requested theme or invalid index/ring mapping is an error.
349
+
350
+ The supported preview subset accepts PNG/JPEG over HTTP(S) on the **dataset
351
+ origin**, with credentials omitted and redirects rejected. That origin may
352
+ differ from the viewer origin when CORS permits it. A local File with external
353
+ images needs a usable dataset URL; unresolved references are not silently
354
+ accepted as textured success.
355
+
356
+ Texture loading is cancellable and bounded: 64 used textures, 16 MiB per image,
357
+ 64 MiB total encoded data, 8,192 pixels per side, 16 million pixels per image and
358
+ 32 million pixels total. Dimensions are checked before decoding. Wrap, mirror,
359
+ clamp and none are supported; other modes are rejected. Failure, cancellation
360
+ and unmount release owned textures and ImageBitmaps. Advanced appearance
361
+ semantics remain outside this subset. Piero is reference material, not a runtime
362
+ dependency; the existence of another CityJSON implementation does not establish
363
+ that it meets these preview, security and ownership contracts. The rendered
364
+ group is exposed through the hook; Piero-style semantic picking and LoD
365
+ inspector UI are not part of this preview subset.
366
+
367
+ ### 3D Tiles and 3TZ
368
+
369
+ The exact basename `tileset.json` is claimed before generic JSON routing; content
370
+ sniffing also recognizes 3D Tiles metadata. Remote tilesets retain their original
371
+ URL and use locally copied DRACO and Basis decoder paths.
372
+
373
+ `.3tz` and `*.3dtiles.zip` are bounded whole-file archive inputs. Before exposing
374
+ the root `tileset.json`, the extractor checks central/local header agreement,
375
+ paths, duplicates, overlaps, encryption, entry counts, expanded sizes and
376
+ compression ratios. Actual extraction is bounded and CRC32 is checked. The
377
+ browser subset supports stored/DEFLATE entries and rejects unsupported ZIP64,
378
+ data-descriptor and other layouts.
379
+
380
+ The archive subset supports JSON tilesets, glTF/GLB models and PNTS tiles with
381
+ archive-local buffers, images and structural-metadata schemas. B3DM, I3DM and CMPT entries are rejected by
382
+ both extension and binary magic before URLs are exposed: their native loaders
383
+ can fetch nested resources outside the archive hook. GLB entries must retain
384
+ their `.glb` extension. Inline tile/model data URLs are rejected; inline glTF
385
+ buffers and images remain supported. These restrictions apply to 3TZ archives;
386
+ remote tilesets retain their normal resource-loading behavior.
387
+
388
+ Prepared archives use extension-preserving, per-archive virtual URLs for
389
+ models/tilesets and a narrow public `fetchData` hook returning validated local
390
+ Responses. Buffers, images and `EXT_structural_metadata.schemaUri` resources use
391
+ owned Blob URLs, including JSON schemas that the native plugin loads directly.
392
+ External schema references are rejected before the model reaches that plugin.
393
+ There is no remote fallback or
394
+ service worker. All archive-owned resources are released on teardown. A file-only
395
+ multi-resource tileset without an archive is rejected. Nested tileset/model
396
+ arrival wakes the on-demand render loop; its listeners are removed at teardown.
397
+
398
+ ## Optional preprocessing
399
+
400
+ LAS/LAZ to **COPC** preserves the point-cloud data model. GeoTIFF to **COG**
401
+ optimizes raster storage. External PDAL/GDAL tools can perform these operations;
402
+ neither is installed or invoked automatically by the renderer.
403
+
404
+ The repository also includes explicit LAS/LAZ/COPC **Z-to-COG rasterization**:
405
+
406
+ ```sh
407
+ python packages/renderers/3d/scripts/preprocess-geo3d.py \
408
+ input.laz elevation.cog.tif --resolution 1 --aggregation mean
409
+ ```
410
+
411
+ Use the pinned development-only Python requirements. Resolution is in projected
412
+ source CRS units; min/max/mean aggregation must be explicit. This loses
413
+ per-point information and is not a lossless conversion, ground classification
414
+ or interpolation. Allocation is limited, the source is preserved, unrequested
415
+ overwrite is refused and output pixels/CRS/layout are checked. It is not an
416
+ automatic conversion inside the browser.
417
+
418
+ ## Fixtures, licenses and verification
419
+
420
+ ### Input regression checks
421
+
422
+ After building the renderer, run the input checks independently with:
423
+
424
+ ```sh
425
+ node --test packages/renderers/3d/scripts/geo3d-inputs.test.mjs
426
+ ```
427
+
428
+ They are also included in `verify:geo3d`. They cover a bounded TIFF metadata
429
+ probe with 262,144 tile offsets, ordinary TIFF/GeoTIFF/COG routing, relative
430
+ source URLs in nested deployments, exact cancellation reasons (including
431
+ non-Error values), byte limits, and HTTP range behavior against a local server.
432
+ The large TIFF case contains metadata only; the inspector must not request pixel
433
+ data. These checks do not replace the real-engine browser and installed-consumer
434
+ suites described below.
435
+
436
+ The built input helpers can also run in Chromium with native File,
437
+ ReadableStream, iframe base URLs and Worker APIs, without network access:
438
+
439
+ ```sh
440
+ pnpm --filter @file-viewer/renderer-3d verify:geo3d-native-browser
441
+ ```
442
+
443
+ This focused browser command requires the normal build output and Playwright.
444
+ It loads production modules as data URLs and uses the committed fixture bytes;
445
+ it does not replace the renderer or codec with a substitute. On headless Linux,
446
+ a virtual display may be needed for SwiftShader/WebGL.
447
+ `PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH` selects an already installed Chromium;
448
+ `GEO3D_NATIVE_BROWSER_OUTPUT` overrides `output/geo3d-native-browser/`.
449
+ The screenshot is diagnostic: it shows input test results, **not** a rendered
450
+ dataset, and must not satisfy the PR's rendering-evidence requirement. These
451
+ checks do not validate HTTP/CORS, LAZ decoding, WASM assets or the full renderer's
452
+ offline/private-deployment behavior.
453
+
454
+
455
+ Fixtures are in `test/fixtures/geo3d/`. `probe.copc.laz` is an identifier/VLR
456
+ fixture, not a compressed rendering dataset. Real compressed MIT samples live
457
+ in `samples-mit/`. The five original binary variants remain in
458
+ `samples-mit/original-deliveries/`: 16,384-point COPC, 4,096-point LAS, ordinary
459
+ TIFF, striped GeoTIFF and overview COG. Their hashes, manifests and license are
460
+ preserved; compact samples are not replacements or production benchmarks.
461
+
462
+ Run these commands from the repository root with the pinned development
463
+ Python requirements and browser dependencies installed:
464
+
465
+ ```sh
466
+ pnpm install --frozen-lockfile
467
+
468
+ python packages/renderers/3d/scripts/restore-geo3d-originals.py \
469
+ --output packages/renderers/3d/test/fixtures/geo3d/samples-mit/original-deliveries \
470
+ --verify-only
471
+ python packages/renderers/3d/scripts/verify-geo3d-samples.py --range-smoke
472
+ python packages/renderers/3d/scripts/test-geo3d-compressed-samples.py
473
+
474
+ pnpm test:geo3d-entry
475
+ pnpm --filter @file-viewer/renderer-3d verify:geo3d-browser
476
+ pnpm build
477
+ pnpm type-check
478
+ pnpm test
479
+ pnpm docs:build
480
+ pnpm verify:github-governance
481
+ ```
482
+
483
+ The browser command runs the workspace dataset/concurrency suites and then packs
484
+ built output for a clean installed consumer. It needs npm registry access for
485
+ that installation; runtime browser requests remain limited to local test origins.
486
+ The consumer receives no source files or generator scripts, uses a retained npm
487
+ lockfile and repeats the dataset, concurrency/abort, non-cooperative hook,
488
+ advanced API, CRS, memory, elevation/no-data and PNTS classification suites.
489
+ Its module graph rejects runtime code resolved from the workspace. Build tools,
490
+ test instrumentation and input fixtures may still come from the checkout.
491
+
492
+ Browser reports and screenshots are generated under `output/geo3d-browser/`;
493
+ installed-consumer logs and package evidence are under
494
+ `output/geo3d-focused/installed-consumer/`. Keep generated results outside the
495
+ source change set. Resource cleanup, cache retention and visual classification
496
+ checks must remain enabled; test results apply only to the revision executed.
497
+
498
+ Giro3D and Three.js are MIT; JSZip is the optional archive peer. The asset copier
499
+ preserves licenses, NOTICE and manifests, including retained decoder notices.
500
+ Dataset redistribution is evaluated separately from example-code licensing.
501
+ Focused checks do not replace the repository-wide build, type-check, tests,
502
+ core/component integration, documentation, governance and demo-browser checks.
503
+ The larger synthetic workloads measure heap and cache behavior over repeated
504
+ open/close cycles; they do not certify an indefinitely flat JavaScript heap or
505
+ production-scale performance.
@@ -0,0 +1,63 @@
1
+ # Geo3D third-party notices
2
+
3
+ This notice covers the optional `@file-viewer/renderer-3d/geo3d` sub-entry.
4
+ The ordinary `@file-viewer/renderer-3d` entry does not import these optional
5
+ runtime packages.
6
+
7
+ ## Runtime packages
8
+
9
+ ### @giro3d/giro3d 2.0.4
10
+
11
+ - License: MIT
12
+ - Role: streaming/rendering engine for COPC, LAS/LAZ, GeoTIFF/COG and 3D Tiles.
13
+ - Installation: optional peer dependency.
14
+ - Runtime decoder assets are self-hosted by `file-viewer-geo3d-assets`.
15
+
16
+ Giro3D declares its own peer dependencies, including Three.js/OpenLayers/proj4.
17
+ Those remain Giro3D's dependency contract; File Viewer does not copy them into
18
+ its normal 3D entry.
19
+
20
+ ### jszip 3.10.2
21
+
22
+ - License: MIT OR GPL-3.0-or-later.
23
+ - File Viewer uses it under the MIT option.
24
+ - Role: extraction only after File Viewer's 3TZ central-directory safety
25
+ preflight has accepted the archive.
26
+ - Installation: optional peer dependency.
27
+
28
+ ### laz-perf 0.0.7
29
+
30
+ - License: Apache-2.0.
31
+ - Role: LAZ/COPC decoder WebAssembly used by Giro3D.
32
+ - It is a Giro3D runtime dependency, not imported directly by File Viewer.
33
+ - `file-viewer-geo3d-assets` copies the installed WASM and its license to the
34
+ application's self-hosted asset directory.
35
+
36
+ ### three
37
+
38
+ - License: MIT.
39
+ - Already a runtime dependency of the ordinary 3D renderer.
40
+ - Geo3D's Giro3D runtime follows Giro3D's own Three.js peer graph. The local
41
+ CityJSON adapter creates browser-preview geometry using File Viewer's existing
42
+ Three.js dependency and adds it as a regular Object3D, which Giro3D supports.
43
+
44
+ ## Reference-only projects
45
+
46
+ ### Piero
47
+
48
+ - Project: Giro3D/Piero.
49
+ - License: MIT.
50
+ - Used as architecture/reference material for CityJSON behavior.
51
+ - It is not a File Viewer runtime dependency.
52
+
53
+ ## Test data
54
+
55
+ Synthetic fixtures in `test/fixtures/geo3d` are generated for File Viewer and
56
+ contain no third-party/customer data.
57
+
58
+ The vendored CityJSON compatibility fixture under
59
+ `test/fixtures/geo3d/upstream` retains its upstream MIT license text.
60
+
61
+ Real LAZ/COPC validation URLs documented in `EXTERNAL_SAMPLES.md` come from
62
+ `PDAL/data`, which is licensed CC BY 4.0. Those large Git-LFS payloads are not
63
+ vendored in this package.
package/IFC.md CHANGED
@@ -5,6 +5,13 @@ orbit/pan/zoom, fit-to-model, element selection, basic properties and an advance
5
5
  That Open hook. It does not change the ordinary 3D entry or the frozen Full/Office
6
6
  presets. Applications opt in instead of paying the BIM dependency cost by default.
7
7
 
8
+ The optional `/ifc` entry exposes the actual Components and Fragments classes
9
+ in its hooks and selection data. Its TypeScript declarations therefore require
10
+ the same supported peers as its runtime. The ordinary package entry does not
11
+ import those declarations and remains usable without the IFC SDK. Install the
12
+ peers below before importing `/ifc`, including a type-only import; optional peer
13
+ metadata describes the base package, not an SDK-free version of the IFC API.
14
+
8
15
  ## Install and self-host
9
16
 
10
17
  ```sh
@@ -13,10 +20,12 @@ npm install -D esbuild@0.28.2
13
20
  npx file-viewer-ifc-assets public/file-viewer/vendor/ifc
14
21
  ```
15
22
 
16
- The asset command is local: it bundles the import Worker and copies the matching
23
+ The asset command is local: it bundles the published, compiled import Worker and copies the matching
17
24
  Fragments worker and Web-IFC WASM from installed packages. No CDN or online
18
25
  conversion service is used. Ship its entire output, including licenses and manifest.
19
26
  For a nested deployment use the same custom path in the command and `assetBaseUrl`.
27
+ Existing destination files owned by the host are preserved. The command rejects
28
+ symlinks or incompatible file types at its output paths before replacing assets.
20
29
  Use HTTP(S), module Workers and a browser with WebGL 2. CSP needs `worker-src 'self'
21
30
  blob:`, WASM execution via `script-src 'wasm-unsafe-eval'`, and the usual local script,
22
31
  style and data/blob-image permissions of the host. Neither COOP/COEP nor a threaded
@@ -154,3 +163,7 @@ The input files are unmodified. Test screenshots are rendered derivatives.
154
163
  Fixture bytes are supplied separately; the browser script checks their SHA-256.
155
164
  Run `pnpm --filter @file-viewer/renderer-3d verify:ifc-browser /path/to/fixtures`
156
165
  with `ifc4.ifc` and `ifc43.ifc` in that directory after building the package.
166
+ Run `pnpm --filter @file-viewer/renderer-3d verify:ifc-installed /path/to/fixtures`
167
+ to pack the normal packages, install them outside the checkout, exercise the npm
168
+ asset command and render both models from the installed entry. This also checks
169
+ nested paths, preserved host files, rejected output links and copied license bytes.
package/README.en.md CHANGED
@@ -1,39 +1,7 @@
1
1
  # @file-viewer/renderer-3d
2
2
 
3
- Standalone 3D model renderer for Flyfish File Viewer. It uses Three.js, OrbitControls, and lazy format-specific loaders for GLB / GLTF, OBJ, STL, PLY, FBX, DAE, 3DS, 3MF, AMF, USD, KMZ, PCD, VRML, XYZ, VTK, and related files. STEP / STP, IGES / IGS, and BREP use a local OCCT worker for real geometry decoding and rendering.
3
+ Runtime package version 3.2.1.
4
4
 
5
- ## Usage
5
+ Usage and API documentation: https://doc.file-viewer.app/guide/on-demand-renderers
6
6
 
7
- ```ts
8
- import FileViewer from '@file-viewer/vue3'
9
- import { modelRenderer } from '@file-viewer/renderer-3d'
10
-
11
- const options = {
12
- rendererMode: 'replace',
13
- renderers: modelRenderer,
14
- model: {
15
- workerUrl: '/viewer-assets/wasm/model/occt-worker.js',
16
- runtimeUrl: '/viewer-assets/wasm/model/occt-import-js.js',
17
- wasmUrl: '/viewer-assets/wasm/model/occt-import-js.wasm',
18
- workerTimeoutMs: 120_000,
19
- },
20
- }
21
- ```
22
-
23
- `modelRenderer` can be combined with CAD and other renderer packages, or consumed through `@file-viewer/preset-all`. Full packages and `@file-viewer/vite-plugin` prepare the default offline assets. A renderer-only integration must self-host the OCCT worker, runtime, WASM, and both license notices.
24
-
25
- Default paths:
26
-
27
- - `wasm/model/occt-worker.js`
28
- - `wasm/model/occt-import-js.js`
29
- - `wasm/model/occt-import-js.wasm`
30
-
31
- For subpath deployments or a dedicated asset origin, provide final URLs through `options.model.workerUrl`, `runtimeUrl`, and `wasmUrl`. There is no runtime CDN fallback. A strict CSP must allow that origin in `worker-src`, `script-src`, and `connect-src`; some browsers also require `script-src 'wasm-unsafe-eval'`.
32
-
33
- ## Boundaries
34
-
35
- - STEP / STP, IGES / IGS, and BREP are tessellated by `occt-import-js` / OpenCascade in a worker. Assembly hierarchy, instances, normals, and face colors are preserved when the Three.js scene is built.
36
- - General models support WebGL orbit controls, fit-to-view, grid, axes, wireframe, and auto-rotate. External textures or binary resources referenced by `gltf`, `dae`, and `fbx` continue to resolve against the original file URL directory.
37
- - Unified global zoom: the renderer registers the standard zoom provider, so the outer toolbar's zoom in, zoom out, reset, and fit actions control the camera. Wheel, trackpad, and pinch zoom also update the shared zoom state.
38
- - IFC and 3DM currently provide signature detection and explicit integration guidance only. They still need dedicated `web-ifc` / That Open and `rhino3dm` renderers and are not reported as successful previews.
39
- - `@file-viewer/core` does not bundle Three.js or a geometry kernel. Install this renderer, the matching preset, or a full package when model preview is required.
7
+ The package's own license is Apache-2.0. Included third-party notices apply to their respective components.