@equinor/videx-3d 5.1.0-beta

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 (235) hide show
  1. package/LICENSE.md +21 -0
  2. package/README.md +120 -0
  3. package/dist/chunk-BX-cez1_.js +23 -0
  4. package/dist/chunk-CnY6Tmof.js +358 -0
  5. package/dist/chunk-MFzFdEWm.js +591 -0
  6. package/dist/chunk-iY0wQ9Z6.js +887 -0
  7. package/dist/generators.js +711 -0
  8. package/dist/main.js +8405 -0
  9. package/dist/sdk.js +610 -0
  10. package/dist/shaderLib/color-conversion.glsl +33 -0
  11. package/dist/shaderLib/colors.glsl +8 -0
  12. package/dist/shaderLib/glyphs.glsl +78 -0
  13. package/dist/shaderLib/random.glsl +3 -0
  14. package/dist/shaderLib/remap.glsl +13 -0
  15. package/dist/shaderLib/render-number.glsl +74 -0
  16. package/dist/shaderLib/render-text.glsl +66 -0
  17. package/dist/shaderLib/rotation.glsl +19 -0
  18. package/dist/shaderLib/sdf-functions.glsl +18 -0
  19. package/dist/textures/normal_map.jpg +0 -0
  20. package/dist/types/common/color-ramps.d.ts +5 -0
  21. package/dist/types/common/types.d.ts +25 -0
  22. package/dist/types/components/Annotations/Annotations.d.ts +42 -0
  23. package/dist/types/components/Annotations/AnnotationsHMTL.d.ts +1 -0
  24. package/dist/types/components/Annotations/AnnotationsLayer.d.ts +46 -0
  25. package/dist/types/components/Annotations/AutoUpdate.d.ts +3 -0
  26. package/dist/types/components/Annotations/DefaultLabelComponent.d.ts +11 -0
  27. package/dist/types/components/Annotations/TestAnnotations.d.ts +12 -0
  28. package/dist/types/components/Annotations/annotations-renderer.d.ts +26 -0
  29. package/dist/types/components/Annotations/annotations-state.d.ts +88 -0
  30. package/dist/types/components/Annotations/helpers.d.ts +11 -0
  31. package/dist/types/components/Annotations/index.d.ts +8 -0
  32. package/dist/types/components/Annotations/types.d.ts +80 -0
  33. package/dist/types/components/Annotations/update-annotations.d.ts +12 -0
  34. package/dist/types/components/CameraTargetMarker/CameraTargetMarker.d.ts +29 -0
  35. package/dist/types/components/Distance/Distance.d.ts +35 -0
  36. package/dist/types/components/Distance/DistanceContext.d.ts +12 -0
  37. package/dist/types/components/Distance/index.d.ts +2 -0
  38. package/dist/types/components/EventEmitter/EventEmitter.d.ts +20 -0
  39. package/dist/types/components/EventEmitter/EventEmitterContext.d.ts +90 -0
  40. package/dist/types/components/EventEmitter/index.d.ts +3 -0
  41. package/dist/types/components/EventEmitter/picking-helper.d.ts +32 -0
  42. package/dist/types/components/EventEmitter/picking-material.d.ts +11 -0
  43. package/dist/types/components/Grids/BoxGrid/BoxGrid.d.ts +52 -0
  44. package/dist/types/components/Grids/Grid/Grid.d.ts +62 -0
  45. package/dist/types/components/Grids/Grid/GridAxesLabels.d.ts +24 -0
  46. package/dist/types/components/Grids/Grid/UtmGrid.d.ts +30 -0
  47. package/dist/types/components/Grids/Grid/grid-helpers.d.ts +2 -0
  48. package/dist/types/components/Grids/index.d.ts +5 -0
  49. package/dist/types/components/Highlighter/Highlighter.d.ts +23 -0
  50. package/dist/types/components/Highlighter/highlight-state.d.ts +43 -0
  51. package/dist/types/components/Highlighter/index.d.ts +2 -0
  52. package/dist/types/components/Html/DepthSelector.d.ts +1 -0
  53. package/dist/types/components/Html/OutputPanel/OutputPanel.d.ts +10 -0
  54. package/dist/types/components/Html/OutputPanel/index.d.ts +2 -0
  55. package/dist/types/components/Html/OutputPanel/output-panel-state.d.ts +38 -0
  56. package/dist/types/components/Html/Panel/Panel.d.ts +20 -0
  57. package/dist/types/components/Html/WellMap/ActiveTrack.d.ts +9 -0
  58. package/dist/types/components/Html/WellMap/DepthCursor.d.ts +8 -0
  59. package/dist/types/components/Html/WellMap/DepthReadout.d.ts +6 -0
  60. package/dist/types/components/Html/WellMap/Schematic.d.ts +15 -0
  61. package/dist/types/components/Html/WellMap/Track.d.ts +13 -0
  62. package/dist/types/components/Html/WellMap/WellMap.d.ts +47 -0
  63. package/dist/types/components/Html/WellMap/addons/WellMapCasingShoes.d.ts +14 -0
  64. package/dist/types/components/Html/WellMap/addons/WellMapCompletionIntervals.d.ts +15 -0
  65. package/dist/types/components/Html/WellMap/addons/WellMapFormations.d.ts +14 -0
  66. package/dist/types/components/Html/WellMap/addons/WellMapTvd.d.ts +14 -0
  67. package/dist/types/components/Html/WellMap/addons/index.d.ts +4 -0
  68. package/dist/types/components/Html/WellMap/index.d.ts +4 -0
  69. package/dist/types/components/Html/WellMap/themes.d.ts +13 -0
  70. package/dist/types/components/Html/WellMap/well-map-context.d.ts +34 -0
  71. package/dist/types/components/Html/WellMap/well-map-state.d.ts +38 -0
  72. package/dist/types/components/Html/index.d.ts +5 -0
  73. package/dist/types/components/ObservableGroup/ObservableGroup.d.ts +38 -0
  74. package/dist/types/components/SDFTest/SDFTest.d.ts +12 -0
  75. package/dist/types/components/Surfaces/Surface.d.ts +46 -0
  76. package/dist/types/components/Surfaces/SurfaceMaterial.d.ts +53 -0
  77. package/dist/types/components/Surfaces/index.d.ts +4 -0
  78. package/dist/types/components/Surfaces/surface-defs.d.ts +7 -0
  79. package/dist/types/components/Symbol/Symbol.d.ts +45 -0
  80. package/dist/types/components/Symbol/index.d.ts +1 -0
  81. package/dist/types/components/UtmArea/UtmArea.d.ts +37 -0
  82. package/dist/types/components/UtmArea/UtmAreaContext.d.ts +32 -0
  83. package/dist/types/components/UtmArea/UtmPosition.d.ts +26 -0
  84. package/dist/types/components/UtmArea/Wgs84Position.d.ts +26 -0
  85. package/dist/types/components/UtmArea/index.d.ts +4 -0
  86. package/dist/types/components/Wellbores/BasicTrajectory/BasicTrajectory.d.ts +27 -0
  87. package/dist/types/components/Wellbores/BasicTrajectory/basic-trajectory-defs.d.ts +3 -0
  88. package/dist/types/components/Wellbores/BasicTrajectory/index.d.ts +2 -0
  89. package/dist/types/components/Wellbores/Casings/CasingAnnotations/CasingAnnotations.d.ts +9 -0
  90. package/dist/types/components/Wellbores/Casings/CasingAnnotations/CasingLabel.d.ts +9 -0
  91. package/dist/types/components/Wellbores/Casings/CasingAnnotations/casing-annotations-defs.d.ts +1 -0
  92. package/dist/types/components/Wellbores/Casings/Casings.d.ts +42 -0
  93. package/dist/types/components/Wellbores/Casings/casings-defs.d.ts +6 -0
  94. package/dist/types/components/Wellbores/Casings/index.d.ts +5 -0
  95. package/dist/types/components/Wellbores/CompletionTools/CompletionAnnotations/CompletionAnnotations.d.ts +9 -0
  96. package/dist/types/components/Wellbores/CompletionTools/CompletionAnnotations/completion-annotations-defs.d.ts +1 -0
  97. package/dist/types/components/Wellbores/CompletionTools/CompletionTools.d.ts +31 -0
  98. package/dist/types/components/Wellbores/CompletionTools/Screen/screen-material.d.ts +8 -0
  99. package/dist/types/components/Wellbores/CompletionTools/completion-tools-defs.d.ts +4 -0
  100. package/dist/types/components/Wellbores/CompletionTools/index.d.ts +5 -0
  101. package/dist/types/components/Wellbores/DepthMarkers/DepthMarkerLabel.d.ts +11 -0
  102. package/dist/types/components/Wellbores/DepthMarkers/DepthMarkers.d.ts +27 -0
  103. package/dist/types/components/Wellbores/DepthMarkers/depth-markers-defs.d.ts +1 -0
  104. package/dist/types/components/Wellbores/DepthMarkers/index.d.ts +3 -0
  105. package/dist/types/components/Wellbores/FormationMarkers/FormationMarkerLabel.d.ts +10 -0
  106. package/dist/types/components/Wellbores/FormationMarkers/FormationMarkers.d.ts +33 -0
  107. package/dist/types/components/Wellbores/FormationMarkers/formation-markers-defs.d.ts +3 -0
  108. package/dist/types/components/Wellbores/FormationMarkers/index.d.ts +3 -0
  109. package/dist/types/components/Wellbores/Perforations/Perforations.d.ts +32 -0
  110. package/dist/types/components/Wellbores/Perforations/index.d.ts +2 -0
  111. package/dist/types/components/Wellbores/Perforations/perforations-defs.d.ts +3 -0
  112. package/dist/types/components/Wellbores/Perimeter/Perimeter.d.ts +29 -0
  113. package/dist/types/components/Wellbores/Perimeter/index.d.ts +2 -0
  114. package/dist/types/components/Wellbores/Perimeter/perimeter-defs.d.ts +3 -0
  115. package/dist/types/components/Wellbores/PositionMarkers/PositionMarkers.d.ts +12 -0
  116. package/dist/types/components/Wellbores/PositionMarkers/position-markers-defs.d.ts +3 -0
  117. package/dist/types/components/Wellbores/Shoes/Shoes.d.ts +34 -0
  118. package/dist/types/components/Wellbores/Shoes/index.d.ts +2 -0
  119. package/dist/types/components/Wellbores/Shoes/shoes-defs.d.ts +3 -0
  120. package/dist/types/components/Wellbores/TubeTrajectory/TubeTrajectory.d.ts +25 -0
  121. package/dist/types/components/Wellbores/TubeTrajectory/index.d.ts +2 -0
  122. package/dist/types/components/Wellbores/TubeTrajectory/tube-geometry-defs.d.ts +3 -0
  123. package/dist/types/components/Wellbores/Wellbore/Wellbore.d.ts +45 -0
  124. package/dist/types/components/Wellbores/Wellbore/WellboreContext.d.ts +19 -0
  125. package/dist/types/components/Wellbores/Wellbore/index.d.ts +2 -0
  126. package/dist/types/components/Wellbores/WellboreBounds/WellboreBounds.d.ts +47 -0
  127. package/dist/types/components/Wellbores/WellboreBounds/index.d.ts +2 -0
  128. package/dist/types/components/Wellbores/WellboreBounds/wellbore-bounds-defs.d.ts +1 -0
  129. package/dist/types/components/Wellbores/WellboreFormationColumn/WellboreFormationColumn.d.ts +30 -0
  130. package/dist/types/components/Wellbores/WellboreFormationColumn/index.d.ts +2 -0
  131. package/dist/types/components/Wellbores/WellboreFormationColumn/wellbore-formation-column-defs.d.ts +3 -0
  132. package/dist/types/components/Wellbores/WellboreLabel/WellboreAnnotationLabel.d.ts +10 -0
  133. package/dist/types/components/Wellbores/WellboreLabel/WellboreLabel.d.ts +25 -0
  134. package/dist/types/components/Wellbores/WellboreLabel/index.d.ts +3 -0
  135. package/dist/types/components/Wellbores/WellboreLabel/wellbore-label-defs.d.ts +1 -0
  136. package/dist/types/components/Wellbores/WellboreRibbon/WellboreRibbon.d.ts +22 -0
  137. package/dist/types/components/Wellbores/WellboreRibbon/WellboreRibbonContext.d.ts +16 -0
  138. package/dist/types/components/Wellbores/WellboreRibbon/index.d.ts +4 -0
  139. package/dist/types/components/Wellbores/WellboreRibbon/stripes/FormationsStripe.d.ts +30 -0
  140. package/dist/types/components/Wellbores/WellboreRibbon/stripes/MeasuredDepthStripe.d.ts +28 -0
  141. package/dist/types/components/Wellbores/WellboreSeismicSection/WellboreSeismicSection.d.ts +34 -0
  142. package/dist/types/components/Wellbores/WellboreSeismicSection/index.d.ts +2 -0
  143. package/dist/types/components/Wellbores/WellboreSeismicSection/wellbore-seismic-section-defs.d.ts +12 -0
  144. package/dist/types/components/Wellbores/Wells/Wells.d.ts +43 -0
  145. package/dist/types/components/Wellbores/Wells/index.d.ts +1 -0
  146. package/dist/types/contexts/DataContext.d.ts +15 -0
  147. package/dist/types/contexts/DataContextProvider.d.ts +33 -0
  148. package/dist/types/contexts/GeneratorsContext.d.ts +13 -0
  149. package/dist/types/contexts/GeneratorsContextProvider.d.ts +34 -0
  150. package/dist/types/contexts/GlyphsContext.d.ts +19 -0
  151. package/dist/types/contexts/GlyphsContextProvider.d.ts +29 -0
  152. package/dist/types/events/camera-events.d.ts +34 -0
  153. package/dist/types/events/depth-events.d.ts +22 -0
  154. package/dist/types/events/interaction-events.d.ts +7 -0
  155. package/dist/types/events/wellbore-events.d.ts +46 -0
  156. package/dist/types/generators/basic-trajectory-generator.d.ts +2 -0
  157. package/dist/types/generators/casing-annotations-generator.d.ts +8 -0
  158. package/dist/types/generators/casings-generator.d.ts +4 -0
  159. package/dist/types/generators/completion-annotations-generator.d.ts +7 -0
  160. package/dist/types/generators/completion-tools-generator.d.ts +2 -0
  161. package/dist/types/generators/depth-markers-generator.d.ts +3 -0
  162. package/dist/types/generators/formation-markers-generator.d.ts +2 -0
  163. package/dist/types/generators/index.d.ts +20 -0
  164. package/dist/types/generators/perforations-generator.d.ts +2 -0
  165. package/dist/types/generators/perimieter-generator.d.ts +2 -0
  166. package/dist/types/generators/position-markers-generator.d.ts +2 -0
  167. package/dist/types/generators/shoes-generator.d.ts +2 -0
  168. package/dist/types/generators/surface-generator.d.ts +4 -0
  169. package/dist/types/generators/tube-trajectory-generator.d.ts +2 -0
  170. package/dist/types/generators/wellbore-bounds-generator.d.ts +2 -0
  171. package/dist/types/generators/wellbore-formation-column-generator.d.ts +2 -0
  172. package/dist/types/generators/wellbore-label-generator.d.ts +7 -0
  173. package/dist/types/generators/wellbore-seismic-section-generator.d.ts +3 -0
  174. package/dist/types/hooks/useData.d.ts +25 -0
  175. package/dist/types/hooks/useGenerator.d.ts +43 -0
  176. package/dist/types/hooks/useWellboreContext.d.ts +13 -0
  177. package/dist/types/layers/layers.d.ts +6 -0
  178. package/dist/types/main.d.ts +48 -0
  179. package/dist/types/rendering/fullscreen-renderer.d.ts +9 -0
  180. package/dist/types/rendering/index.d.ts +2 -0
  181. package/dist/types/rendering/render-passes.d.ts +16 -0
  182. package/dist/types/sdk/data/DataLoader.d.ts +54 -0
  183. package/dist/types/sdk/data/GeneratorRegistry.d.ts +15 -0
  184. package/dist/types/sdk/data/Store.d.ts +29 -0
  185. package/dist/types/sdk/data/helpers/formations-helpers.d.ts +24 -0
  186. package/dist/types/sdk/data/helpers/well-helpers.d.ts +9 -0
  187. package/dist/types/sdk/data/types/Casing.d.ts +8 -0
  188. package/dist/types/sdk/data/types/CompletionTool.d.ts +11 -0
  189. package/dist/types/sdk/data/types/DepthReferencePoint.d.ts +1 -0
  190. package/dist/types/sdk/data/types/Formation.d.ts +32 -0
  191. package/dist/types/sdk/data/types/PerforationInterval.d.ts +9 -0
  192. package/dist/types/sdk/data/types/Pick.d.ts +8 -0
  193. package/dist/types/sdk/data/types/PositionLog.d.ts +17 -0
  194. package/dist/types/sdk/data/types/StratColumn.d.ts +18 -0
  195. package/dist/types/sdk/data/types/SurfaceMeta.d.ts +23 -0
  196. package/dist/types/sdk/data/types/SurfaceValues.d.ts +1 -0
  197. package/dist/types/sdk/data/types/Symbol.d.ts +6 -0
  198. package/dist/types/sdk/data/types/VerticalSlice.d.ts +9 -0
  199. package/dist/types/sdk/data/types/WellboreHeader.d.ts +15 -0
  200. package/dist/types/sdk/data/types/index.d.ts +11 -0
  201. package/dist/types/sdk/geometries/curve/curve-3d.d.ts +46 -0
  202. package/dist/types/sdk/geometries/curve/tube-geometry.d.ts +34 -0
  203. package/dist/types/sdk/geometries/delatin.d.ts +44 -0
  204. package/dist/types/sdk/geometries/fence.d.ts +3 -0
  205. package/dist/types/sdk/geometries/packing.d.ts +46 -0
  206. package/dist/types/sdk/geometries/triangulate-grid-delaunay.d.ts +8 -0
  207. package/dist/types/sdk/geometries/triangulate-grid.d.ts +28 -0
  208. package/dist/types/sdk/index.d.ts +39 -0
  209. package/dist/types/sdk/managers/CameraManager.d.ts +11 -0
  210. package/dist/types/sdk/managers/WellboreManager.d.ts +18 -0
  211. package/dist/types/sdk/materials/depth-material.d.ts +4 -0
  212. package/dist/types/sdk/materials/ribbon-material.d.ts +24 -0
  213. package/dist/types/sdk/materials/tube-material.d.ts +7 -0
  214. package/dist/types/sdk/materials/uv-material.d.ts +2 -0
  215. package/dist/types/sdk/projection/crs.d.ts +37 -0
  216. package/dist/types/sdk/types/common.d.ts +4 -0
  217. package/dist/types/sdk/utils/array.d.ts +0 -0
  218. package/dist/types/sdk/utils/colors.d.ts +2 -0
  219. package/dist/types/sdk/utils/conversions.d.ts +5 -0
  220. package/dist/types/sdk/utils/depth-reader.d.ts +5 -0
  221. package/dist/types/sdk/utils/elevation-map.d.ts +15 -0
  222. package/dist/types/sdk/utils/glyphs.d.ts +50 -0
  223. package/dist/types/sdk/utils/irapbin-parser.d.ts +17 -0
  224. package/dist/types/sdk/utils/num-array.d.ts +2 -0
  225. package/dist/types/sdk/utils/numbers.d.ts +5 -0
  226. package/dist/types/sdk/utils/packing.d.ts +1 -0
  227. package/dist/types/sdk/utils/scene.d.ts +2 -0
  228. package/dist/types/sdk/utils/segments.d.ts +4 -0
  229. package/dist/types/sdk/utils/strings.d.ts +2 -0
  230. package/dist/types/sdk/utils/trajectory.d.ts +59 -0
  231. package/dist/types/sdk/utils/trigonometry.d.ts +12 -0
  232. package/dist/types/sdk/utils/typed-2d-array.d.ts +52 -0
  233. package/dist/types/sdk/utils/typed-array.d.ts +2 -0
  234. package/dist/types/sdk/utils/vector-operations.d.ts +29 -0
  235. package/package.json +127 -0
package/LICENSE.md ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright © 2023-2025 Equinor videx-3d authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ [![SCM Compliance](https://scm-compliance-api.radix.equinor.com/repos/equinor/videx-wellog/badge)](https://scm-compliance-api.radix.equinor.com/repos/equinor/videx-wellog/badge)
2
+ ![](https://img.shields.io/npm/v/videx-3d)
3
+ # Introduction
4
+ The purpose of this library is to help you add 3D visualizations of sub surface data to your web applications. It offers a paradigm for connecting data to React components, utilizing Three js and React Three Fiber.
5
+
6
+ <img src="documents/videx-3d.png" alt="" width="800px">
7
+
8
+ The library includes a variety of components, both for visualizing and managing data, including:
9
+ - Wellbore trajectories
10
+ - Wellbore data (such as casings, completion tools, formations, shoes etc.)
11
+ - Horizons/surfaces
12
+ - Generic support for pointer events (click, move, enter, exit)
13
+ - A flexible point-feature label system
14
+ - HTML well map schematic
15
+
16
+ ## Overview
17
+ This library contains multiple exports:
18
+ - `videx-3d` main export containing the components
19
+ - `videx-3d/sdk` shared code and declarations
20
+ - `videx-3d/generators` generator functions required by the included components
21
+
22
+ ### Dependencies
23
+ This library has dependencies to the following libs:
24
+ - React and react-dom
25
+ - THREE js (javascript 3d rendering library using WebGL)
26
+ - React Three Fiber (bridge React and THREE js)
27
+ - Comlink (simplifies working with web workers)
28
+
29
+ ## Install
30
+ ```
31
+ npm i videx-3d
32
+ ```
33
+
34
+ You also need to install the required peer-dependencies.
35
+
36
+ First, if not already installed, you'll need React version 18 or later:
37
+ ```
38
+ // react
39
+ npm i react react-dom
40
+ ```
41
+
42
+ React Three Fiber (R3F):
43
+ ```
44
+ // react three fiber
45
+ npm i @react-three/fiber
46
+ ```
47
+ Note that if using React 18, you need `@react-three/fiber` version 8.
48
+
49
+ Depending on your needs you might consider installing the following additional packages:
50
+ ```
51
+ // three js
52
+ npm i three
53
+
54
+ // drei
55
+ npm i @react-three/drei
56
+
57
+ // comlink - if using web workers
58
+ npm i comlink
59
+ ```
60
+ Note that if using React 18, you need `@react-three/drei` version 9.
61
+
62
+ ## Configure
63
+ Rendering complex scenes in the browser (single threaded) can quickly become bottlenecked, degrading user experience. For this reason, most of the components have been decoupled from data management and processing, by depending on a _store interface_ and _generator_ functions. This allows the heavy work to be offloaded to web workers (but not required).
64
+
65
+ The recommended setup is to run the data store implementation and generator registry in seperate web workers, and then pass a proxy for these instances to the respective providers. You need to use [Comlink](https://github.com/GoogleChromeLabs/comlink) for this to work.
66
+
67
+ For example, assuming you have created a class `DataStore` (implementing the `Store` interface) you can _expose_ an instance of this class so that it can be run in isolation by a web worker:
68
+
69
+ ```ts
70
+ // set up worker endpoint: remote-store.ts
71
+ import { expose } from 'comlink'
72
+ import { MyStore } from './DataStore'
73
+
74
+ const store = new DataStore()
75
+
76
+ expose(store)
77
+ ```
78
+
79
+ Then we do the same exercise for the `GeneratorRegistry`:
80
+
81
+ ```ts
82
+ // set up registry endpoint: remote-registry.ts
83
+ const registry = new GeneratorRegistry()
84
+
85
+ // add all the ganerators you need
86
+ registry.add('generatorName', generatorFunction)
87
+
88
+ expose(registry)
89
+ ```
90
+
91
+ We then need to create the workers and point them to the scripts we exposed using Comlink. Using the `wrap` function will do this for us and return a proxy class instance that we can pass to the respective providers:
92
+
93
+ ```tsx
94
+ import { DataProvider, Store } from 'videx3d/sdk'
95
+ import { Remote, wrap } from 'comlink'
96
+
97
+ const store: Remote<Store> = wrap(new Worker(new URL('workers/remote-store.ts', import.meta.url), { type: 'module'}))
98
+
99
+ const registry: Remote<Store> = wrap(new Worker(new URL('workers/remote-registry.ts', import.meta.url), { type: 'module'}))
100
+
101
+ const ExampleApp = () => (
102
+ <>
103
+ { ... }
104
+ <DataProvider store={store}>
105
+ <RegistryProvider registry={registry}>
106
+ { ... }
107
+ </RegistryProvider>
108
+ </DataProvider>
109
+ { ... }
110
+ <>
111
+ )
112
+ ```
113
+ If instead you want to run the data store and/or registry on the main thread, simply create and pass an instance directly to the provider.
114
+
115
+ For more information see the documentation section below.
116
+
117
+ ## Documentation
118
+ - [Getting Started](https://github.com/equinor/videx-3d/blob/main/documents/getting-started.md)
119
+ - [Storybooks](https://equinor.github.io/videx-3d/)
120
+ - [API docs](https://equinor.github.io/videx-3d/docs)
@@ -0,0 +1,23 @@
1
+ const s = "casings", e = {
2
+ Shoe: 0,
3
+ Casing: 1,
4
+ Generic: 2
5
+ }, a = "completionTools", n = {
6
+ "blank pipe": 0,
7
+ tube: 1,
8
+ packer: 2,
9
+ gauge: 3,
10
+ plug: 4,
11
+ pbr: 5,
12
+ "safety valve": 6,
13
+ spm: 7,
14
+ screen: 8,
15
+ tracer: 9,
16
+ unknown: 10
17
+ };
18
+ export {
19
+ a,
20
+ e as b,
21
+ s as c,
22
+ n as d
23
+ };
@@ -0,0 +1,358 @@
1
+ import Q from "proj4";
2
+ import { DataTexture as z, RedFormat as $, FloatType as I, LinearFilter as T, UniformsGroup as O, Uniform as h, Vector4 as Y, Vector3 as Z, Vector2 as J, RedIntegerFormat as j, UnsignedShortType as q, ShaderMaterial as K, UniformsUtils as X, ShaderLib as ee } from "three";
3
+ import "comlink";
4
+ import "p-limit";
5
+ import "curve-interpolator";
6
+ import { a3 as B, aa as ne, ah as A, F as te } from "./chunk-iY0wQ9Z6.js";
7
+ import "three/src/math/MathUtils.js";
8
+ function ge(e, n, r) {
9
+ const t = /* @__PURE__ */ new Map(), l = {};
10
+ n.sort((o, s) => o.id === r ? -1 : s.id === r ? 1 : o.drilled && s.drilled ? s.drilled.getTime() - o.drilled.getTime() : o.name.localeCompare(s.name));
11
+ for (let o = 0; o < n.length; o++) {
12
+ const s = n[o];
13
+ if (!s) continue;
14
+ let u = s.parent && s.kickoffDepthMsl !== null ? s.kickoffDepthMsl : -s.depthReferenceElevation;
15
+ if (t.has(s.id))
16
+ u = t.get(s.id);
17
+ else {
18
+ let m = s.parent;
19
+ for (; m; ) {
20
+ const a = e[m];
21
+ if (!a) break;
22
+ if (t.has(a.id)) {
23
+ const i = t.get(a.id);
24
+ u >= i && (t.set(a.id, u), u = i);
25
+ break;
26
+ } else
27
+ t.set(a.id, u), u = a.parent && a.kickoffDepthMsl !== null ? a.kickoffDepthMsl : -a.depthReferenceElevation;
28
+ m = a.parent;
29
+ }
30
+ }
31
+ l[s.id] = [u, o], t.set(s.id, s.depthMdMsl);
32
+ }
33
+ return l;
34
+ }
35
+ const re = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
36
+ class me {
37
+ utmDef;
38
+ originWgs84;
39
+ originUtm;
40
+ _projection;
41
+ constructor(n, r, t = "lnglat") {
42
+ this.utmDef = n, this._projection = Q(re, n), t === "lnglat" ? (this.originWgs84 = r, this.originUtm = this.wgs84ToUtm(r)) : (this.originWgs84 = this.utmToWgs84(r), this.originUtm = r);
43
+ }
44
+ utmToWgs84(n) {
45
+ return this._projection.inverse(n);
46
+ }
47
+ wgs84ToUtm(n) {
48
+ return this._projection.forward(n);
49
+ }
50
+ utmToWorld(n, r, t) {
51
+ return {
52
+ x: n - this.originUtm[0],
53
+ y: t,
54
+ z: this.originUtm[1] - r
55
+ };
56
+ }
57
+ worldToUtm(n, r, t) {
58
+ return {
59
+ easting: n + this.originUtm[0],
60
+ altitude: r,
61
+ northing: this.originUtm[1] - t
62
+ };
63
+ }
64
+ wgs84ToWorld(n, r, t = 0) {
65
+ const l = this.wgs84ToUtm([n, r]);
66
+ return this.utmToWorld(l[0], l[1], t);
67
+ }
68
+ worldToWgs84(n, r, t) {
69
+ const l = this.worldToUtm(n, r, t), o = this.utmToWgs84([l.easting, l.northing]);
70
+ return {
71
+ lng: o[0],
72
+ lat: o[1],
73
+ alt: r
74
+ };
75
+ }
76
+ }
77
+ function pe(e) {
78
+ const [, n, r] = new RegExp(/^([0-9]{2})([N|S]?)$/).exec(e) || [];
79
+ return `+proj=utm +zone=${n}${r === "S" ? " +south" : ""} +ellps=intl +towgs84=-87,-98,-121,0,0,0,0 +units=m +no_defs`;
80
+ }
81
+ function he([e, n]) {
82
+ if (n > 55 && n < 64 && e > 2 && e < 6)
83
+ return "32N";
84
+ if (n > 71 && e >= 6 && e < 9)
85
+ return "31N";
86
+ if (n > 71 && (e >= 9 && e < 12 || e >= 18 && e < 21))
87
+ return "33N";
88
+ if (n > 71 && (e >= 21 && e < 24 || e >= 30 && e < 33))
89
+ return "35N";
90
+ if (e >= -180 && e <= 180) {
91
+ const r = Math.floor((e + 180) / 6) % 60 + 1;
92
+ return n < 0 ? `${r}S` : `${r}N`;
93
+ }
94
+ throw new Error(
95
+ `getUtmZoneFromLatLng: Cannot figure out UTM zone from give Lat: ${n}, Lng: ${e}`
96
+ );
97
+ }
98
+ function b(e, n, r) {
99
+ const t = A(e, n), l = A(e, r);
100
+ return B(te(t, l));
101
+ }
102
+ function ve(e, n, r, t, l = 0, o = -1) {
103
+ const s = e.length / n, u = n - 1, m = s - 1, a = new Uint8Array(u * m * 4);
104
+ let i = 0;
105
+ const d = (c, g) => e[g * n + c];
106
+ for (let c = 0; c < m; c++) {
107
+ const g = c + 1, p = c + 0.5;
108
+ for (let f = 0; f < u; f++) {
109
+ const v = f + 1, w = f + 0.5, _ = d(f, c);
110
+ if (_ !== o) {
111
+ const V = d(f, g), F = d(v, c), M = d(v, g), D = (_ + V + F + M) / 4, G = [f * r, c * t, _], L = [f * r, g * t, V], P = [v * r, c * t, F], E = [v * r, g * t, M], x = [w * r, p * t, D], C = b(x, G, P), R = b(x, P, E), H = b(x, E, L), U = b(x, L, G), S = B([
112
+ C[0] + R[0] + H[0] + U[0],
113
+ C[2] + R[2] + H[2] + U[2],
114
+ C[1] + R[1] + H[1] + U[1]
115
+ ]), y = ne(S, [0, 1, 0], l * (Math.PI / 180)), W = Math.floor((y[0] + 1) / 2 * 255), N = Math.floor((y[1] + 1) / 2 * 255), k = Math.floor((y[2] + 1) / 2 * 255);
116
+ a[i] = W, a[i + 1] = N, a[i + 2] = k, a[i + 3] = 255;
117
+ } else
118
+ a[i] = 0, a[i + 1] = 0, a[i + 2] = 0, a[i + 3] = 0;
119
+ i += 4;
120
+ }
121
+ }
122
+ return a;
123
+ }
124
+ function _e(e, n, r) {
125
+ const t = new z(e, n, r);
126
+ return t.minFilter = T, t.magFilter = T, t.flipY = !0, t.anisotropy = 4, t.needsUpdate = !0, t;
127
+ }
128
+ function we(e, n, r) {
129
+ const t = new z(
130
+ e,
131
+ n,
132
+ r,
133
+ $,
134
+ I
135
+ );
136
+ return t.minFilter = T, t.magFilter = T, t.needsUpdate = !0, t.flipY = !0, t;
137
+ }
138
+ function xe(e) {
139
+ const n = new Map(
140
+ e.chars.map((i, d) => [i.id, { index: d, spacing: i.xadvance }])
141
+ ), r = 32, t = (i) => {
142
+ const d = [];
143
+ let c = 0;
144
+ for (let g = 0; g < i.length; g++) {
145
+ let p = i.charCodeAt(g);
146
+ n.has(p) || (p = r);
147
+ const f = n.get(p);
148
+ f && (d.push(f.index), c += f.spacing);
149
+ }
150
+ return {
151
+ indices: d,
152
+ width: c
153
+ };
154
+ }, l = (i) => {
155
+ i = Array.isArray(i) ? i : [i];
156
+ const d = [], c = [];
157
+ for (let f = 0; f < i.length; f++) {
158
+ const v = i[f], w = t(v), _ = c.length;
159
+ c.push(...w.indices), d.push([_, c.length, w.width]);
160
+ }
161
+ c.length || c.push(0);
162
+ const g = c.length;
163
+ d.forEach((f) => c.push(...f));
164
+ const p = new z(
165
+ new Uint16Array(c),
166
+ c.length,
167
+ 1,
168
+ j,
169
+ q
170
+ );
171
+ return p.needsUpdate = !0, { texture: p, textPointersOffset: g, textPointersCount: d.length };
172
+ }, o = new O();
173
+ o.setName("GlyphData");
174
+ const s = [], u = [];
175
+ e.chars.forEach((i) => {
176
+ s.push(
177
+ new h(new Y(i.x, i.y, i.width, i.height))
178
+ ), u.push(
179
+ new h(new Z(i.xoffset, i.yoffset, i.xadvance))
180
+ );
181
+ }), o.add(s), o.add(u), o.add(
182
+ new h(new J(e.common.scaleW, e.common.scaleH))
183
+ ), o.add(new h(e.info.size)), o.add(new h(e.distanceField.distanceRange)), o.add(new h(e.common.lineHeight)), o.add(new h(e.common.base));
184
+ const m = () => {
185
+ o.dispose();
186
+ };
187
+ return {
188
+ glyphsCount: e.chars.length,
189
+ glyphData: o,
190
+ encodeText: t,
191
+ encodeTextTexture: l,
192
+ dispose: m
193
+ };
194
+ }
195
+ function be(e, n, r) {
196
+ if (e.length === 0) return [];
197
+ e.sort((o, s) => n(o) - n(s));
198
+ const t = [];
199
+ let l = { start: n(e[0]), end: r(e[0]) };
200
+ for (let o = 1; o < e.length; o += 1)
201
+ n(e[o]) === l.end ? l.end = r(e[o]) : (t.push(l), l = { start: n(e[o]), end: r(e[o]) });
202
+ return t.push(l), t;
203
+ }
204
+ var oe = `#define TRAJECTORY_MATERIAL
205
+
206
+ uniform vec3 diffuse;
207
+ uniform float opacity;
208
+
209
+ #ifndef FLAT_SHADED
210
+ varying vec3 vNormal;
211
+ #endif
212
+ varying vec3 vViewPosition;
213
+ #include <common>
214
+ #include <color_pars_fragment>
215
+ #include <uv_pars_fragment>
216
+ #include <map_pars_fragment>
217
+ #include <fog_pars_fragment>
218
+ #include <logdepthbuf_pars_fragment>
219
+ #include <clipping_planes_pars_fragment>
220
+
221
+ vec3 hue2rgb(in float H) {
222
+ float R = abs(H * 6. - 3.) - 1.;
223
+ float G = 2. - abs(H * 6. - 2.);
224
+ float B = 2. - abs(H * 6. - 4.);
225
+ return saturate(vec3(R, G, B));
226
+ }
227
+
228
+ vec3 hsl2rgb(in vec3 HSL) {
229
+ vec3 RGB = hue2rgb(HSL.x);
230
+ float C = (1. - abs(2. * HSL.z - 1.)) * HSL.y;
231
+ return (RGB - 0.5) * C + HSL.z;
232
+ }
233
+
234
+ vec3 rgb2hsv(in vec3 RGB) {
235
+
236
+ vec4 P = (RGB.g < RGB.b) ? vec4(RGB.bg, -1.0, 2.0 / 3.0) : vec4(RGB.gb, 0.0, -1.0 / 3.0);
237
+ vec4 Q = (RGB.r < P.x) ? vec4(P.xyw, RGB.r) : vec4(RGB.r, P.yzx);
238
+ float C = Q.x - min(Q.w, Q.y);
239
+ float H = abs((Q.w - Q.y) / (6. * C + EPSILON) + Q.z);
240
+ return vec3(H, C, Q.x);
241
+ }
242
+
243
+ vec3 rgb2hsl(in vec3 RGB) {
244
+ vec3 HCV = rgb2hsv(RGB);
245
+ float L = HCV.z - HCV.y * 0.5;
246
+ float S = HCV.y / (1. - abs(L * 2. - 1.) + EPSILON);
247
+ return vec3(HCV.x, S, L);
248
+ }
249
+
250
+ vec3 hsv2rgb(in vec3 HSV) {
251
+ vec3 RGB = hue2rgb(HSV.x);
252
+ return ((RGB - 1.) * HSV.y + 1.) * HSV.z;
253
+ }
254
+
255
+ void main() {
256
+ #include <clipping_planes_fragment>
257
+
258
+ vec3 color = diffuse.rgb;
259
+
260
+ vec4 diffuseColor = vec4(color.rgb, opacity);
261
+
262
+ #include <logdepthbuf_fragment>
263
+ #include <map_fragment>
264
+ #include <color_fragment>
265
+ #include <normal_fragment_begin>
266
+
267
+ #ifdef DEPTH_SHADE
268
+ float depthFactor = clamp(dot(normalize(vNormal), normalize(vViewPosition)), 0.0, 1.0);
269
+ float darkenFactor = clamp(vViewPosition.z / 5000.0, 0.1, 0.8);
270
+ vec3 hsv = rgb2hsv(diffuseColor.rgb);
271
+ hsv.z = hsv.z * darkenFactor;
272
+ vec3 mixColor = hsv2rgb(hsv);
273
+ diffuseColor.rgb = mix(mixColor, diffuseColor.rgb, pow(depthFactor, 0.8));
274
+ #else
275
+ float alphaFactor = clamp(vViewPosition.z / 100000.0, 0.0, 0.9);
276
+
277
+ diffuseColor.a = 1.0 - alphaFactor;
278
+ #endif
279
+
280
+ gl_FragColor = diffuseColor.rgba;
281
+
282
+ #include <tonemapping_fragment>
283
+ #include <colorspace_fragment>
284
+ #include <fog_fragment>
285
+
286
+ #ifdef OPAQUE
287
+
288
+ gl_FragColor.a = 1.0;
289
+
290
+ #endif
291
+ }`, ie = `#define TRAJECTORY_MATERIAL
292
+
293
+ varying vec3 vViewPosition;
294
+
295
+ #include <common>
296
+ #include <batching_pars_vertex>
297
+ #include <uv_pars_vertex>
298
+ #include <envmap_pars_vertex>
299
+ #include <color_pars_vertex>
300
+ #include <fog_pars_vertex>
301
+ #include <normal_pars_fragment>
302
+ #include <logdepthbuf_pars_vertex>
303
+ #include <clipping_planes_pars_vertex>
304
+
305
+ void main() {
306
+
307
+ #include <uv_vertex>
308
+ #include <color_vertex>
309
+ #include <batching_vertex>
310
+ #include <beginnormal_vertex>
311
+ #include <defaultnormal_vertex>
312
+ #include <normal_vertex>
313
+
314
+ #include <begin_vertex>
315
+ #include <project_vertex>
316
+ #include <logdepthbuf_vertex>
317
+ #include <clipping_planes_vertex>
318
+
319
+ vViewPosition = - mvPosition.xyz;
320
+
321
+ #include <worldpos_vertex>
322
+ #include <fog_vertex>
323
+ }`;
324
+ class Te extends K {
325
+ isTubeMaterial = !0;
326
+ constructor(n) {
327
+ super({
328
+ vertexShader: ie,
329
+ fragmentShader: oe,
330
+ uniforms: X.clone(ee.basic.uniforms),
331
+ defines: {
332
+ DEPTH_SHADE: !0
333
+ },
334
+ clipping: !0,
335
+ fog: !0
336
+ }), n && this.setValues(n);
337
+ }
338
+ get color() {
339
+ return this.uniforms.diffuse.value;
340
+ }
341
+ set color(n) {
342
+ this.uniforms.diffuse.value.set(n);
343
+ }
344
+ }
345
+ export {
346
+ me as C,
347
+ Te as T,
348
+ we as a,
349
+ xe as b,
350
+ ge as c,
351
+ _e as d,
352
+ ve as e,
353
+ he as f,
354
+ pe as g,
355
+ b as h,
356
+ be as t,
357
+ re as w
358
+ };