zincjs 2.4.1-beta.7 → 3.0.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 (60) hide show
  1. package/README.md +27 -22
  2. package/build/zinc.js +2 -2
  3. package/build/zinc.js.map +1 -1
  4. package/package.json +6 -2
  5. package/src/controls.js +1332 -1241
  6. package/src/geometryCSG.js +111 -115
  7. package/src/glyphsetCSG.js +51 -55
  8. package/src/loaders/GLTFToZincJSLoader.js +31 -33
  9. package/src/loaders/JSONLoader.js +339 -449
  10. package/src/loaders/OBJLoader.js +654 -851
  11. package/src/loaders/STLLoader.js +271 -329
  12. package/src/loaders/niftiReader.js +90 -59
  13. package/src/loaders/primitivesLoader.js +55 -52
  14. package/src/minimap.js +63 -43
  15. package/src/primitives/geometry.js +40 -44
  16. package/src/primitives/glyph.js +16 -19
  17. package/src/primitives/glyphset.js +229 -185
  18. package/src/primitives/label.js +29 -31
  19. package/src/primitives/lines.js +20 -20
  20. package/src/primitives/lines2.js +33 -39
  21. package/src/primitives/lod.js +43 -43
  22. package/src/primitives/marker.js +31 -32
  23. package/src/primitives/markerCluster.js +32 -35
  24. package/src/primitives/pointset.js +86 -83
  25. package/src/primitives/texturePrimitive.js +9 -10
  26. package/src/primitives/textureSlides.js +84 -97
  27. package/src/primitives/textureVolume.js +46 -49
  28. package/src/primitives/tubeLines.js +108 -108
  29. package/src/primitives/zincObject.js +176 -184
  30. package/src/region.js +145 -155
  31. package/src/renderRequests.js +3 -3
  32. package/src/renderer.js +635 -620
  33. package/src/scene.js +479 -419
  34. package/src/sceneExporter.js +22 -17
  35. package/src/sceneLoader.js +542 -296
  36. package/src/shaders/rgbVolumeRender.js +11 -18
  37. package/src/shaders/textureArray.js +5 -12
  38. package/src/shaders/textureSlide.js +10 -17
  39. package/src/shaders/volumeRender.js +11 -18
  40. package/src/shaders/volumeRender_old.js +11 -18
  41. package/src/shaders/volumeTexture.js +7 -14
  42. package/src/textSprite.js +23 -19
  43. package/src/texture/texture.js +14 -15
  44. package/src/texture/textureArray.js +14 -16
  45. package/src/three/InstancedPoints.js +2 -9
  46. package/src/three/Loader.js +334 -315
  47. package/src/three/line/Line.js +165 -215
  48. package/src/three/line/LineSegments.js +40 -55
  49. package/src/three/line/LineSegments2.js +322 -366
  50. package/src/three/line/LineSegmentsGeometry.js +239 -280
  51. package/src/three-js-csg.js +260 -252
  52. package/src/tsl/glyphRenderMaterial.js +12 -3
  53. package/src/tsl/glyphTransform.js +51 -29
  54. package/src/tsl/textureSlides.js +23 -24
  55. package/src/utilities.js +309 -371
  56. package/src/videoHandler.js +76 -83
  57. package/src/workers/geometryCSG.worker.js +33 -36
  58. package/src/workers/geometryCSGInternal.js +39 -44
  59. package/src/zinc.js +4 -7
  60. package/vite.config.js +7 -7
package/README.md CHANGED
@@ -10,19 +10,19 @@ Why ZincJS?
10
10
 
11
11
  General-purpose 3D libraries can draw meshes, but they know nothing about Zinc models. ZincJS adds the pieces needed for biomedical scaffolds:
12
12
 
13
- * **Direct pipeline from Zinc** – load scenes exported from PyZinc / the Argon scene exporter through a single metadata file, with no custom loader code.
14
- * **Region hierarchy and named groups** – objects are organised in a Zinc-like region tree and identified by anatomical group names, which makes it straightforward to link a 3D structure to search, highlighting and ontology terms.
15
- * **Time-varying models** – morph-target animation of geometry and field colours (for example a beating heart or gut motility), with scene-wide playback control.
16
- * **Primitives for scaffolds and fields** – surfaces, lines, tube lines, point sets, glyph sets for vector/tensor fields, labels, markers with clustering and level-of-detail switching.
17
- * **Imaging alongside models** – volume rendering and texture slices from NIfTI images in the same scene as the scaffold.
18
- * **Application features** – multiple scenes per renderer, picking, smooth camera transitions, auto-tumble, stereo, minimap, video synchronisation and glTF import/export.
13
+ - **Direct pipeline from Zinc** – load scenes exported from PyZinc / the Argon scene exporter through a single metadata file, with no custom loader code.
14
+ - **Region hierarchy and named groups** – objects are organised in a Zinc-like region tree and identified by anatomical group names, which makes it straightforward to link a 3D structure to search, highlighting and ontology terms.
15
+ - **Time-varying models** – morph-target animation of geometry and field colours (for example a beating heart or gut motility), with scene-wide playback control.
16
+ - **Primitives for scaffolds and fields** – surfaces, lines, tube lines, point sets, glyph sets for vector/tensor fields, labels, markers with clustering and level-of-detail switching.
17
+ - **Imaging alongside models** – volume rendering and texture slices from NIfTI images in the same scene as the scaffold.
18
+ - **Application features** – multiple scenes per renderer, picking, smooth camera transitions, auto-tumble, stereo, minimap, video synchronisation and glTF import/export.
19
19
 
20
20
  Applications built with ZincJS:
21
21
 
22
- * [SPARC Portal](https://sparc.science/maps?type=wholebody)
23
- * [ScaffoldVuer](https://mapcore-demo.org/current/scaffoldvuer)
24
- * [Scaffold Maker](https://mapcore-demo.org/2019/colon/scaffold.html)
25
- * [Fitzlet](https://sites.bioeng.auckland.ac.nz/mwu035/fitzlet/)
22
+ - [SPARC Portal](https://sparc.science/maps?type=wholebody)
23
+ - [ScaffoldVuer](https://mapcore-demo.org/current/scaffoldvuer)
24
+ - [Scaffold Maker](https://mapcore-demo.org/2019/colon/scaffold.html)
25
+ - [Fitzlet](https://sites.bioeng.auckland.ac.nz/mwu035/fitzlet/)
26
26
 
27
27
  Installation
28
28
  ------------
@@ -67,15 +67,15 @@ Camera movement, playback, loading, changes made through the ZincJS APIs and cha
67
67
 
68
68
  Useful links:
69
69
 
70
- * [Examples](https://github.com/alan-wu/ZincJS-Examples/)
71
- * [Tutorials](https://github.com/alan-wu/ZincJS-Tutorials/)
72
- * [API documentation](https://abi-software.github.io/ZincJS/)
70
+ - [Examples](https://github.com/alan-wu/ZincJS-Examples/)
71
+ - [Tutorials](https://github.com/alan-wu/ZincJS-Tutorials/)
72
+ - [API documentation](https://abi-software.github.io/ZincJS/)
73
73
 
74
74
  Exporting models to ZincJS
75
75
  --------------------------
76
76
 
77
- * **Mapping Tools users** – use the [Argon scene exporter](https://abi-mapping-tools.readthedocs.io/en/v1.2.1/mapclientplugins.argonsceneexporterstep/docs/index.html) step.
78
- * **PyZinc users** – see [PyZinc2ZincJS](https://github.com/alan-wu/PyZinc2ZincJS/).
77
+ - **Mapping Tools users** – use the [Argon scene exporter](https://abi-mapping-tools.readthedocs.io/en/v1.2.1/mapclientplugins.argonsceneexporterstep/docs/index.html) step.
78
+ - **PyZinc users** – see [PyZinc2ZincJS](https://github.com/alan-wu/PyZinc2ZincJS/).
79
79
 
80
80
  Both produce a metadata JSON file plus the files it references. Keep them in the same folder and pass the metadata file's URL to `scene.loadMetadataURL`.
81
81
 
@@ -87,8 +87,13 @@ Both produce a metadata JSON file plus the files it references. Keep them in the
87
87
  3. Adjust the view, then run `gfx list win 1` and copy the eye point, interest point, up vector, near plane and far plane into a view file:
88
88
 
89
89
  ```json
90
- {"farPlane": 601.12, "nearPlane": 14.81, "upVector": [0.0, 1.0, 0.0],
91
- "targetPosition": [9.70, 6.39, -5.00], "eyePosition": [9.70, 6.39, 291.20]}
90
+ {
91
+ "farPlane": 601.12,
92
+ "nearPlane": 14.81,
93
+ "upVector": [0.0, 1.0, 0.0],
94
+ "targetPosition": [9.7, 6.39, -5.0],
95
+ "eyePosition": [9.7, 6.39, 291.2]
96
+ }
92
97
  ```
93
98
 
94
99
  4. The first exported file (`[filename_prefix]_1.json`) is the metadata file. Add an entry for the view file to it:
@@ -102,11 +107,11 @@ Both produce a metadata JSON file plus the files it references. Keep them in the
102
107
  Controls
103
108
  --------
104
109
 
105
- | Action | Mouse | Touch |
106
- |-----------|---------------------|------------------------|
107
- | Rotate | Left button drag | One-finger drag |
108
- | Zoom | Middle button drag / scroll wheel | Two-finger pinch |
109
- | Pan | Right button drag | Three-finger drag |
110
+ | Action | Mouse | Touch |
111
+ | ------ | --------------------------------- | ----------------- |
112
+ | Rotate | Left button drag | One-finger drag |
113
+ | Zoom | Middle button drag / scroll wheel | Two-finger pinch |
114
+ | Pan | Right button drag | Three-finger drag |
110
115
 
111
116
  Building from source
112
117
  --------------------