molstar 4.2.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (339) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +197 -197
  3. package/build/viewer/embedded.html +52 -52
  4. package/build/viewer/index.html +129 -129
  5. package/build/viewer/molstar.js +1 -1
  6. package/build/viewer/molstar.js.LICENSE.txt +9 -0
  7. package/lib/apps/docking-viewer/index.html +36 -36
  8. package/lib/apps/mesoscale-explorer/index.html +100 -100
  9. package/lib/apps/mesoscale-explorer/style.scss +33 -33
  10. package/lib/apps/viewer/app.d.ts +2 -1
  11. package/lib/apps/viewer/app.js +2 -1
  12. package/lib/apps/viewer/embedded.html +52 -52
  13. package/lib/apps/viewer/index.html +129 -129
  14. package/lib/cli/chem-comp-dict/create-ions.js +9 -9
  15. package/lib/cli/chem-comp-dict/create-saccharides.js +9 -9
  16. package/lib/cli/cifschema/util/generate.js +12 -12
  17. package/lib/cli/lipid-params/index.js +9 -9
  18. package/lib/commonjs/apps/viewer/app.d.ts +2 -1
  19. package/lib/commonjs/apps/viewer/app.js +1 -0
  20. package/lib/commonjs/cli/chem-comp-dict/create-ions.js +9 -9
  21. package/lib/commonjs/cli/chem-comp-dict/create-saccharides.js +9 -9
  22. package/lib/commonjs/cli/cifschema/util/generate.js +12 -12
  23. package/lib/commonjs/cli/lipid-params/index.js +9 -9
  24. package/lib/commonjs/examples/alpha-orbitals/example-data.js +160 -160
  25. package/lib/commonjs/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
  26. package/lib/commonjs/extensions/assembly-symmetry/prop.js +24 -24
  27. package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.js +5 -5
  28. package/lib/commonjs/extensions/dnatco/ntc-tube/behavior.js +5 -5
  29. package/lib/commonjs/extensions/geo-export/usdz-exporter.js +41 -41
  30. package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +1 -0
  31. package/lib/commonjs/extensions/mp4-export/encoder.js +1 -1
  32. package/lib/commonjs/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
  33. package/lib/commonjs/extensions/mvs/components/custom-label/representation.d.ts +2 -2
  34. package/lib/commonjs/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
  35. package/lib/commonjs/extensions/sb-ncbr/index.d.ts +8 -0
  36. package/lib/commonjs/extensions/sb-ncbr/index.js +14 -1
  37. package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
  38. package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.js +89 -0
  39. package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
  40. package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.js +474 -0
  41. package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
  42. package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.js +96 -0
  43. package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
  44. package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.js +28 -0
  45. package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
  46. package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.js +54 -0
  47. package/lib/commonjs/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
  48. package/lib/commonjs/extensions/sb-ncbr/tunnels/props.js +26 -0
  49. package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
  50. package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.js +99 -0
  51. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +17 -0
  52. package/lib/commonjs/mol-canvas3d/canvas3d.js +4 -0
  53. package/lib/commonjs/mol-canvas3d/passes/dof.d.ts +34 -0
  54. package/lib/commonjs/mol-canvas3d/passes/dof.js +167 -0
  55. package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +2 -0
  56. package/lib/commonjs/mol-canvas3d/passes/draw.js +31 -8
  57. package/lib/commonjs/mol-canvas3d/passes/image.d.ts +8 -0
  58. package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +8 -0
  59. package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +5 -0
  60. package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
  61. package/lib/commonjs/mol-gl/shader/background.frag.js +95 -95
  62. package/lib/commonjs/mol-gl/shader/background.vert.js +11 -11
  63. package/lib/commonjs/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
  64. package/lib/commonjs/mol-gl/shader/bloom/blur.frag.js +28 -28
  65. package/lib/commonjs/mol-gl/shader/bloom/composite.frag.js +33 -33
  66. package/lib/commonjs/mol-gl/shader/bloom/luminosity.frag.js +52 -52
  67. package/lib/commonjs/mol-gl/shader/cas.frag.js +144 -144
  68. package/lib/commonjs/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
  69. package/lib/commonjs/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
  70. package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
  71. package/lib/commonjs/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
  72. package/lib/commonjs/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
  73. package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
  74. package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
  75. package/lib/commonjs/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
  76. package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
  77. package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
  78. package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
  79. package/lib/commonjs/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
  80. package/lib/commonjs/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
  81. package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
  82. package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
  83. package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
  84. package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
  85. package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
  86. package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
  87. package/lib/commonjs/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
  88. package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +234 -234
  89. package/lib/commonjs/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
  90. package/lib/commonjs/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
  91. package/lib/commonjs/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
  92. package/lib/commonjs/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
  93. package/lib/commonjs/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
  94. package/lib/commonjs/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
  95. package/lib/commonjs/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
  96. package/lib/commonjs/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
  97. package/lib/commonjs/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
  98. package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
  99. package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
  100. package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
  101. package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
  102. package/lib/commonjs/mol-gl/shader/compose.frag.js +12 -12
  103. package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
  104. package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
  105. package/lib/commonjs/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
  106. package/lib/commonjs/mol-gl/shader/copy.frag.js +11 -11
  107. package/lib/commonjs/mol-gl/shader/cylinders.frag.js +266 -266
  108. package/lib/commonjs/mol-gl/shader/cylinders.vert.js +89 -89
  109. package/lib/commonjs/mol-gl/shader/depth-merge.frag.js +23 -23
  110. package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +362 -362
  111. package/lib/commonjs/mol-gl/shader/direct-volume.vert.js +41 -41
  112. package/lib/commonjs/mol-gl/shader/dof.frag.d.ts +7 -0
  113. package/lib/commonjs/mol-gl/shader/dof.frag.js +122 -0
  114. package/lib/commonjs/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
  115. package/lib/commonjs/mol-gl/shader/evaluate-wboit.frag.js +17 -17
  116. package/lib/commonjs/mol-gl/shader/fxaa.frag.js +228 -228
  117. package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +49 -49
  118. package/lib/commonjs/mol-gl/shader/gaussian-density.vert.js +27 -27
  119. package/lib/commonjs/mol-gl/shader/hi-z.frag.js +18 -18
  120. package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
  121. package/lib/commonjs/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
  122. package/lib/commonjs/mol-gl/shader/image.frag.js +169 -169
  123. package/lib/commonjs/mol-gl/shader/image.vert.js +21 -21
  124. package/lib/commonjs/mol-gl/shader/lines.frag.js +42 -42
  125. package/lib/commonjs/mol-gl/shader/lines.vert.js +117 -117
  126. package/lib/commonjs/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
  127. package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
  128. package/lib/commonjs/mol-gl/shader/marking/edge.frag.js +28 -28
  129. package/lib/commonjs/mol-gl/shader/marking/overlay.frag.js +26 -26
  130. package/lib/commonjs/mol-gl/shader/mesh.frag.js +65 -65
  131. package/lib/commonjs/mol-gl/shader/mesh.vert.js +49 -49
  132. package/lib/commonjs/mol-gl/shader/outlines.frag.js +95 -95
  133. package/lib/commonjs/mol-gl/shader/points.frag.js +59 -59
  134. package/lib/commonjs/mol-gl/shader/points.vert.js +38 -38
  135. package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +150 -150
  136. package/lib/commonjs/mol-gl/shader/quad.vert.js +10 -10
  137. package/lib/commonjs/mol-gl/shader/shadows.frag.js +123 -123
  138. package/lib/commonjs/mol-gl/shader/smaa/blend.frag.js +56 -56
  139. package/lib/commonjs/mol-gl/shader/smaa/blend.vert.js +25 -25
  140. package/lib/commonjs/mol-gl/shader/smaa/edges.frag.js +66 -66
  141. package/lib/commonjs/mol-gl/shader/smaa/edges.vert.js +26 -26
  142. package/lib/commonjs/mol-gl/shader/smaa/weights.frag.js +206 -206
  143. package/lib/commonjs/mol-gl/shader/smaa/weights.vert.js +32 -32
  144. package/lib/commonjs/mol-gl/shader/spheres.frag.js +148 -148
  145. package/lib/commonjs/mol-gl/shader/spheres.vert.js +132 -132
  146. package/lib/commonjs/mol-gl/shader/ssao-blur.frag.js +97 -97
  147. package/lib/commonjs/mol-gl/shader/ssao.frag.js +211 -211
  148. package/lib/commonjs/mol-gl/shader/text.frag.js +85 -85
  149. package/lib/commonjs/mol-gl/shader/text.vert.js +85 -85
  150. package/lib/commonjs/mol-gl/shader/util/grid3d-template.frag.js +46 -46
  151. package/lib/commonjs/mol-gl/shader-code.js +15 -15
  152. package/lib/commonjs/mol-gl/webgl/compat.js +12 -12
  153. package/lib/commonjs/mol-gl/webgl/context.js +1 -0
  154. package/lib/commonjs/mol-gl/webgl/timer.d.ts +1 -1
  155. package/lib/commonjs/mol-gl/webgl/timer.js +8 -1
  156. package/lib/commonjs/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
  157. package/lib/commonjs/mol-plugin/animation-loop.d.ts +1 -0
  158. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
  159. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
  160. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
  161. package/lib/commonjs/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
  162. package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.js +3 -0
  163. package/lib/commonjs/servers/common/swagger-ui/indexTemplate.js +66 -66
  164. package/lib/commonjs/servers/volume/config.js +5 -5
  165. package/lib/examples/alpha-orbitals/example-data.js +160 -160
  166. package/lib/examples/alpha-orbitals/index.html +72 -72
  167. package/lib/examples/basic-wrapper/index.html +137 -137
  168. package/lib/examples/lighting/index.html +88 -88
  169. package/lib/examples/proteopedia-wrapper/index.html +236 -236
  170. package/lib/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
  171. package/lib/extensions/assembly-symmetry/prop.js +24 -24
  172. package/lib/extensions/dnatco/confal-pyramids/behavior.js +5 -5
  173. package/lib/extensions/dnatco/ntc-tube/behavior.js +5 -5
  174. package/lib/extensions/geo-export/usdz-exporter.js +41 -41
  175. package/lib/extensions/meshes/mesh-extension.d.ts +1 -0
  176. package/lib/extensions/mp4-export/encoder.js +1 -1
  177. package/lib/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
  178. package/lib/extensions/mvs/components/custom-label/representation.d.ts +2 -2
  179. package/lib/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
  180. package/lib/extensions/sb-ncbr/index.d.ts +8 -0
  181. package/lib/extensions/sb-ncbr/index.js +8 -0
  182. package/lib/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
  183. package/lib/extensions/sb-ncbr/tunnels/actions.js +86 -0
  184. package/lib/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
  185. package/lib/extensions/sb-ncbr/tunnels/algorithm.js +469 -0
  186. package/lib/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
  187. package/lib/extensions/sb-ncbr/tunnels/behavior.js +92 -0
  188. package/lib/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
  189. package/lib/extensions/sb-ncbr/tunnels/data-model.js +23 -0
  190. package/lib/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
  191. package/lib/extensions/sb-ncbr/tunnels/examples.js +49 -0
  192. package/lib/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
  193. package/lib/extensions/sb-ncbr/tunnels/props.js +22 -0
  194. package/lib/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
  195. package/lib/extensions/sb-ncbr/tunnels/representation.js +96 -0
  196. package/lib/mol-canvas3d/canvas3d.d.ts +17 -0
  197. package/lib/mol-canvas3d/canvas3d.js +4 -0
  198. package/lib/mol-canvas3d/passes/dof.d.ts +34 -0
  199. package/lib/mol-canvas3d/passes/dof.js +163 -0
  200. package/lib/mol-canvas3d/passes/draw.d.ts +2 -0
  201. package/lib/mol-canvas3d/passes/draw.js +31 -8
  202. package/lib/mol-canvas3d/passes/image.d.ts +8 -0
  203. package/lib/mol-canvas3d/passes/postprocessing.d.ts +8 -0
  204. package/lib/mol-canvas3d/passes/postprocessing.js +5 -0
  205. package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
  206. package/lib/mol-gl/shader/background.frag.js +95 -95
  207. package/lib/mol-gl/shader/background.vert.js +11 -11
  208. package/lib/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
  209. package/lib/mol-gl/shader/bloom/blur.frag.js +28 -28
  210. package/lib/mol-gl/shader/bloom/composite.frag.js +33 -33
  211. package/lib/mol-gl/shader/bloom/luminosity.frag.js +52 -52
  212. package/lib/mol-gl/shader/cas.frag.js +144 -144
  213. package/lib/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
  214. package/lib/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
  215. package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
  216. package/lib/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
  217. package/lib/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
  218. package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
  219. package/lib/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
  220. package/lib/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
  221. package/lib/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
  222. package/lib/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
  223. package/lib/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
  224. package/lib/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
  225. package/lib/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
  226. package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
  227. package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
  228. package/lib/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
  229. package/lib/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
  230. package/lib/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
  231. package/lib/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
  232. package/lib/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
  233. package/lib/mol-gl/shader/chunks/common.glsl.js +234 -234
  234. package/lib/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
  235. package/lib/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
  236. package/lib/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
  237. package/lib/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
  238. package/lib/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
  239. package/lib/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
  240. package/lib/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
  241. package/lib/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
  242. package/lib/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
  243. package/lib/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
  244. package/lib/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
  245. package/lib/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
  246. package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
  247. package/lib/mol-gl/shader/compose.frag.js +12 -12
  248. package/lib/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
  249. package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
  250. package/lib/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
  251. package/lib/mol-gl/shader/copy.frag.js +11 -11
  252. package/lib/mol-gl/shader/cylinders.frag.js +266 -266
  253. package/lib/mol-gl/shader/cylinders.vert.js +89 -89
  254. package/lib/mol-gl/shader/depth-merge.frag.js +23 -23
  255. package/lib/mol-gl/shader/direct-volume.frag.js +362 -362
  256. package/lib/mol-gl/shader/direct-volume.vert.js +41 -41
  257. package/lib/mol-gl/shader/dof.frag.d.ts +7 -0
  258. package/lib/mol-gl/shader/dof.frag.js +119 -0
  259. package/lib/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
  260. package/lib/mol-gl/shader/evaluate-wboit.frag.js +17 -17
  261. package/lib/mol-gl/shader/fxaa.frag.js +228 -228
  262. package/lib/mol-gl/shader/gaussian-density.frag.js +49 -49
  263. package/lib/mol-gl/shader/gaussian-density.vert.js +27 -27
  264. package/lib/mol-gl/shader/hi-z.frag.js +18 -18
  265. package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
  266. package/lib/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
  267. package/lib/mol-gl/shader/image.frag.js +169 -169
  268. package/lib/mol-gl/shader/image.vert.js +21 -21
  269. package/lib/mol-gl/shader/lines.frag.js +42 -42
  270. package/lib/mol-gl/shader/lines.vert.js +117 -117
  271. package/lib/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
  272. package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
  273. package/lib/mol-gl/shader/marking/edge.frag.js +28 -28
  274. package/lib/mol-gl/shader/marking/overlay.frag.js +26 -26
  275. package/lib/mol-gl/shader/mesh.frag.js +65 -65
  276. package/lib/mol-gl/shader/mesh.vert.js +49 -49
  277. package/lib/mol-gl/shader/outlines.frag.js +95 -95
  278. package/lib/mol-gl/shader/points.frag.js +59 -59
  279. package/lib/mol-gl/shader/points.vert.js +38 -38
  280. package/lib/mol-gl/shader/postprocessing.frag.js +150 -150
  281. package/lib/mol-gl/shader/quad.vert.js +10 -10
  282. package/lib/mol-gl/shader/shadows.frag.js +123 -123
  283. package/lib/mol-gl/shader/smaa/blend.frag.js +56 -56
  284. package/lib/mol-gl/shader/smaa/blend.vert.js +25 -25
  285. package/lib/mol-gl/shader/smaa/edges.frag.js +66 -66
  286. package/lib/mol-gl/shader/smaa/edges.vert.js +26 -26
  287. package/lib/mol-gl/shader/smaa/weights.frag.js +206 -206
  288. package/lib/mol-gl/shader/smaa/weights.vert.js +32 -32
  289. package/lib/mol-gl/shader/spheres.frag.js +148 -148
  290. package/lib/mol-gl/shader/spheres.vert.js +132 -132
  291. package/lib/mol-gl/shader/ssao-blur.frag.js +97 -97
  292. package/lib/mol-gl/shader/ssao.frag.js +211 -211
  293. package/lib/mol-gl/shader/text.frag.js +85 -85
  294. package/lib/mol-gl/shader/text.vert.js +85 -85
  295. package/lib/mol-gl/shader/util/grid3d-template.frag.js +46 -46
  296. package/lib/mol-gl/shader-code.js +15 -15
  297. package/lib/mol-gl/webgl/compat.js +12 -12
  298. package/lib/mol-gl/webgl/context.js +1 -0
  299. package/lib/mol-gl/webgl/timer.d.ts +1 -1
  300. package/lib/mol-gl/webgl/timer.js +8 -1
  301. package/lib/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
  302. package/lib/mol-plugin/animation-loop.d.ts +1 -0
  303. package/lib/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
  304. package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
  305. package/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
  306. package/lib/mol-plugin/version.js +2 -2
  307. package/lib/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
  308. package/lib/mol-plugin-ui/skin/base/base.scss +37 -37
  309. package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
  310. package/lib/mol-plugin-ui/skin/base/components/controls.scss +445 -445
  311. package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
  312. package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
  313. package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
  314. package/lib/mol-plugin-ui/skin/base/components/misc.scss +663 -663
  315. package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
  316. package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
  317. package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
  318. package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
  319. package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
  320. package/lib/mol-plugin-ui/skin/base/components/viewport.scss +194 -194
  321. package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
  322. package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
  323. package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
  324. package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
  325. package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
  326. package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
  327. package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
  328. package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
  329. package/lib/mol-plugin-ui/skin/base/variables.scss +88 -88
  330. package/lib/mol-plugin-ui/skin/blue.scss +1 -1
  331. package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
  332. package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
  333. package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
  334. package/lib/mol-plugin-ui/skin/dark.scss +1 -1
  335. package/lib/mol-plugin-ui/skin/light.scss +1 -1
  336. package/lib/mol-plugin-ui/viewport/simple-settings.js +3 -0
  337. package/lib/servers/common/swagger-ui/indexTemplate.js +66 -66
  338. package/lib/servers/volume/config.js +5 -5
  339. package/package.json +196 -195
@@ -0,0 +1,163 @@
1
+ /**
2
+ * Copyright (c) 2024 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ *
4
+ * @author Ludovic Autin <autin@scripps.edu>
5
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
+ */
7
+ import { QuadSchema, QuadValues } from '../../mol-gl/compute/util';
8
+ import { createComputeRenderable } from '../../mol-gl/renderable';
9
+ import { TextureSpec, UniformSpec, DefineSpec } from '../../mol-gl/renderable/schema';
10
+ import { ShaderCode } from '../../mol-gl/shader-code';
11
+ import { createComputeRenderItem } from '../../mol-gl/webgl/render-item';
12
+ import { createNullTexture } from '../../mol-gl/webgl/texture';
13
+ import { Mat4, Vec2, Vec3, Vec4 } from '../../mol-math/linear-algebra';
14
+ import { ValueCell } from '../../mol-util';
15
+ import { ParamDefinition as PD } from '../../mol-util/param-definition';
16
+ import { quad_vert } from '../../mol-gl/shader/quad.vert';
17
+ import { dof_frag } from '../../mol-gl/shader/dof.frag';
18
+ import { isTimingMode } from '../../mol-util/debug';
19
+ export const DofParams = {
20
+ blurSize: PD.Numeric(9, { min: 1, max: 32, step: 1 }),
21
+ blurSpread: PD.Numeric(1.0, { min: 0.0, max: 10.0, step: 0.1 }),
22
+ inFocus: PD.Numeric(0.0, { min: -5000.0, max: 5000.0, step: 1.0 }, { description: 'Distance from the scene center that will be in focus' }),
23
+ PPM: PD.Numeric(20.0, { min: 0.0, max: 5000.0, step: 0.1 }, { description: 'Size of the area that will be in focus' }),
24
+ center: PD.Select('camera-target', PD.arrayToOptions(['scene-center', 'camera-target'])),
25
+ mode: PD.Select('plane', PD.arrayToOptions(['plane', 'sphere'])),
26
+ };
27
+ export class DofPass {
28
+ static isEnabled(props) {
29
+ return props.dof.name !== 'off';
30
+ }
31
+ constructor(webgl, width, height) {
32
+ this.webgl = webgl;
33
+ this.target = webgl.createRenderTarget(width, height, false);
34
+ const nullTexture = createNullTexture();
35
+ this.renderable = getDofRenderable(webgl, nullTexture, nullTexture, nullTexture);
36
+ }
37
+ updateState(viewport) {
38
+ const { gl, state } = this.webgl;
39
+ state.enable(gl.SCISSOR_TEST);
40
+ state.disable(gl.BLEND);
41
+ state.disable(gl.DEPTH_TEST);
42
+ state.depthMask(false);
43
+ const { x, y, width, height } = viewport;
44
+ state.viewport(x, y, width, height);
45
+ state.scissor(x, y, width, height);
46
+ state.clearColor(0, 0, 0, 1);
47
+ gl.clear(gl.COLOR_BUFFER_BIT);
48
+ }
49
+ setSize(width, height) {
50
+ const w = this.target.texture.getWidth();
51
+ const h = this.target.texture.getHeight();
52
+ if (width !== w || height !== h) {
53
+ this.target.setSize(width, height);
54
+ ValueCell.update(this.renderable.values.uTexSize, Vec2.set(this.renderable.values.uTexSize.ref.value, width, height));
55
+ }
56
+ }
57
+ update(camera, input, depthOpaque, depthTransparent, props, sphere) {
58
+ let needsUpdate = false;
59
+ if (this.renderable.values.tColor.ref.value !== input) {
60
+ ValueCell.update(this.renderable.values.tColor, input);
61
+ needsUpdate = true;
62
+ }
63
+ if (this.renderable.values.tDepthOpaque.ref.value !== depthOpaque) {
64
+ ValueCell.update(this.renderable.values.tDepthOpaque, depthOpaque);
65
+ needsUpdate = true;
66
+ }
67
+ if (this.renderable.values.tDepthTransparent.ref.value !== depthTransparent) {
68
+ ValueCell.update(this.renderable.values.tDepthTransparent, depthTransparent);
69
+ needsUpdate = true;
70
+ }
71
+ const orthographic = camera.state.mode === 'orthographic' ? 1 : 0;
72
+ const invProjection = this.renderable.values.uInvProjection.ref.value;
73
+ Mat4.invert(invProjection, camera.projection);
74
+ const [w, h] = this.renderable.values.uTexSize.ref.value;
75
+ const v = camera.viewport;
76
+ ValueCell.update(this.renderable.values.uProjection, camera.projection);
77
+ ValueCell.update(this.renderable.values.uInvProjection, invProjection);
78
+ ValueCell.update(this.renderable.values.uMode, props.mode === 'sphere' ? 1 : 0);
79
+ Vec4.set(this.renderable.values.uBounds.ref.value, v.x / w, v.y / h, (v.x + v.width) / w, (v.y + v.height) / h);
80
+ ValueCell.update(this.renderable.values.uBounds, this.renderable.values.uBounds.ref.value);
81
+ ValueCell.updateIfChanged(this.renderable.values.uNear, camera.near);
82
+ ValueCell.updateIfChanged(this.renderable.values.uFar, camera.far);
83
+ ValueCell.updateIfChanged(this.renderable.values.dOrthographic, orthographic);
84
+ if (this.renderable.values.dBlurSize.ref.value !== props.blurSize) {
85
+ ValueCell.update(this.renderable.values.dBlurSize, props.blurSize);
86
+ needsUpdate = true;
87
+ }
88
+ const wolrdCenter = (props.center === 'scene-center' ? sphere.center : camera.state.target);
89
+ const distance = Vec3.distance(camera.state.position, wolrdCenter);
90
+ const inFocus = distance + props.inFocus;
91
+ ValueCell.updateIfChanged(this.renderable.values.uInFocus, inFocus);
92
+ // transform center in view space
93
+ const center = this.renderable.values.uCenter.ref.value;
94
+ Vec3.transformMat4(center, wolrdCenter, camera.view);
95
+ ValueCell.update(this.renderable.values.uCenter, center);
96
+ ValueCell.updateIfChanged(this.renderable.values.uBlurSpread, props.blurSpread);
97
+ ValueCell.updateIfChanged(this.renderable.values.uPPM, props.PPM);
98
+ if (needsUpdate) {
99
+ this.renderable.update();
100
+ }
101
+ }
102
+ render(viewport, target) {
103
+ if (isTimingMode)
104
+ this.webgl.timer.mark('DofPass.render');
105
+ if (target) {
106
+ target.bind();
107
+ }
108
+ else {
109
+ this.webgl.unbindFramebuffer();
110
+ }
111
+ this.updateState(viewport);
112
+ this.renderable.render();
113
+ if (isTimingMode)
114
+ this.webgl.timer.markEnd('DofPass.render');
115
+ }
116
+ }
117
+ //
118
+ const DofSchema = {
119
+ ...QuadSchema,
120
+ tDepthOpaque: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
121
+ tDepthTransparent: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
122
+ tColor: TextureSpec('texture', 'rgba', 'ubyte', 'nearest'),
123
+ uTexSize: UniformSpec('v2'),
124
+ uProjection: UniformSpec('m4'),
125
+ uInvProjection: UniformSpec('m4'),
126
+ uBounds: UniformSpec('v4'),
127
+ uCenter: UniformSpec('v3'),
128
+ uMode: UniformSpec('i'),
129
+ dOrthographic: DefineSpec('number'),
130
+ uNear: UniformSpec('f'),
131
+ uFar: UniformSpec('f'),
132
+ dBlurSize: DefineSpec('number'),
133
+ uBlurSpread: UniformSpec('f'),
134
+ uInFocus: UniformSpec('f'),
135
+ uPPM: UniformSpec('f'),
136
+ };
137
+ const DofShaderCode = ShaderCode('dof', quad_vert, dof_frag);
138
+ function getDofRenderable(ctx, colorTexture, depthTextureOpaque, depthTextureTransparent) {
139
+ const width = colorTexture.getWidth();
140
+ const height = colorTexture.getHeight();
141
+ const values = {
142
+ ...QuadValues,
143
+ tDepthOpaque: ValueCell.create(depthTextureOpaque),
144
+ tDepthTransparent: ValueCell.create(depthTextureTransparent),
145
+ tColor: ValueCell.create(colorTexture),
146
+ uTexSize: ValueCell.create(Vec2.create(width, height)),
147
+ uProjection: ValueCell.create(Mat4.identity()),
148
+ uInvProjection: ValueCell.create(Mat4.identity()),
149
+ uBounds: ValueCell.create(Vec4()),
150
+ uCenter: ValueCell.create(Vec3()),
151
+ uMode: ValueCell.create(0),
152
+ dOrthographic: ValueCell.create(0),
153
+ uNear: ValueCell.create(1),
154
+ uFar: ValueCell.create(10000),
155
+ dBlurSize: ValueCell.create(5),
156
+ uBlurSpread: ValueCell.create(300.0),
157
+ uInFocus: ValueCell.create(20.0),
158
+ uPPM: ValueCell.create(20.0),
159
+ };
160
+ const schema = { ...DofSchema };
161
+ const renderItem = createComputeRenderItem(ctx, 'triangles', DofShaderCode, schema, values);
162
+ return createComputeRenderable(renderItem, values);
163
+ }
@@ -18,6 +18,7 @@ import { DpoitPass } from './dpoit';
18
18
  import { AntialiasingPass, PostprocessingPass, PostprocessingProps } from './postprocessing';
19
19
  import { MarkingPass, MarkingProps } from './marking';
20
20
  import { AssetManager } from '../../mol-util/assets';
21
+ import { DofPass } from './dof';
21
22
  import { BloomPass } from './bloom';
22
23
  type Props = {
23
24
  postprocessing: PostprocessingProps;
@@ -49,6 +50,7 @@ export declare class DrawPass {
49
50
  readonly postprocessing: PostprocessingPass;
50
51
  readonly antialiasing: AntialiasingPass;
51
52
  readonly bloom: BloomPass;
53
+ readonly dof: DofPass;
52
54
  private transparencyMode;
53
55
  setTransparency(transparency: 'wboit' | 'dpoit' | 'blended'): void;
54
56
  get transparency(): TransparencyMode;
@@ -15,6 +15,7 @@ import { AntialiasingPass, PostprocessingPass } from './postprocessing';
15
15
  import { MarkingPass } from './marking';
16
16
  import { createCopyRenderable } from '../../mol-gl/compute/util';
17
17
  import { isDebugMode, isTimingMode } from '../../mol-util/debug';
18
+ import { DofPass } from './dof';
18
19
  import { BloomPass } from './bloom';
19
20
  export class DrawPass {
20
21
  setTransparency(transparency) {
@@ -58,6 +59,7 @@ export class DrawPass {
58
59
  this.postprocessing = new PostprocessingPass(webgl, assetManager, this);
59
60
  this.antialiasing = new AntialiasingPass(webgl, width, height);
60
61
  this.bloom = new BloomPass(webgl, width, height);
62
+ this.dof = new DofPass(webgl, width, height);
61
63
  this.copyFboTarget = createCopyRenderable(webgl, this.colorTarget.texture);
62
64
  this.copyFboPostprocessing = createCopyRenderable(webgl, this.postprocessing.target.texture);
63
65
  this.setTransparency(transparency);
@@ -90,6 +92,7 @@ export class DrawPass {
90
92
  this.marking.setSize(width, height);
91
93
  this.postprocessing.setSize(width, height);
92
94
  this.antialiasing.setSize(width, height);
95
+ this.dof.setSize(width, height);
93
96
  this.bloom.setSize(width, height);
94
97
  }
95
98
  _renderDpoit(renderer, camera, scene, iterations, transparentBackground, postprocessingProps) {
@@ -102,7 +105,7 @@ export class DrawPass {
102
105
  renderer.renderDpoitOpaque(scene.primitives, camera, null);
103
106
  }
104
107
  if (PostprocessingPass.isEnabled(postprocessingProps)) {
105
- if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps)) {
108
+ if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps) || DofPass.isEnabled(postprocessingProps)) {
106
109
  this.depthTargetTransparent.bind();
107
110
  renderer.clearDepth(true);
108
111
  if (scene.opacityAverage < 1) {
@@ -147,7 +150,7 @@ export class DrawPass {
147
150
  renderer.renderWboitOpaque(scene.primitives, camera, null);
148
151
  }
149
152
  if (PostprocessingPass.isEnabled(postprocessingProps)) {
150
- if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps)) {
153
+ if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps) || DofPass.isEnabled(postprocessingProps)) {
151
154
  this.depthTargetTransparent.bind();
152
155
  renderer.clearDepth(true);
153
156
  if (scene.opacityAverage < 1) {
@@ -208,7 +211,7 @@ export class DrawPass {
208
211
  else {
209
212
  (_a = this.colorTarget.depthRenderbuffer) === null || _a === void 0 ? void 0 : _a.detachFramebuffer(this.postprocessing.target.framebuffer);
210
213
  }
211
- if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps)) {
214
+ if (PostprocessingPass.isTransparentOutlineEnabled(postprocessingProps) || DofPass.isEnabled(postprocessingProps)) {
212
215
  this.depthTargetTransparent.bind();
213
216
  renderer.clearDepth(true);
214
217
  if (scene.opacityAverage < 1) {
@@ -248,11 +251,12 @@ export class DrawPass {
248
251
  }
249
252
  }
250
253
  _render(renderer, camera, scene, helper, toDrawingBuffer, transparentBackground, props) {
251
- var _a;
254
+ var _a, _b;
252
255
  const volumeRendering = scene.volumes.renderables.length > 0;
253
256
  const postprocessingEnabled = PostprocessingPass.isEnabled(props.postprocessing);
254
257
  const antialiasingEnabled = AntialiasingPass.isEnabled(props.postprocessing);
255
258
  const markingEnabled = MarkingPass.isEnabled(props.marking);
259
+ const dofEnabled = DofPass.isEnabled(props.postprocessing);
256
260
  const { x, y, width, height } = camera.viewport;
257
261
  renderer.setViewport(x, y, width, height);
258
262
  renderer.update(camera, scene);
@@ -305,13 +309,29 @@ export class DrawPass {
305
309
  renderer.update(helper.camera.camera, helper.camera.scene);
306
310
  renderer.renderBlended(helper.camera.scene, helper.camera.camera);
307
311
  }
312
+ let needsTargetCopy = false;
308
313
  if (antialiasingEnabled) {
309
314
  const input = PostprocessingPass.isEnabled(props.postprocessing)
310
315
  ? this.postprocessing.target.texture
311
316
  : this.colorTarget.texture;
312
- this.antialiasing.render(camera, input, toDrawingBuffer, props.postprocessing);
317
+ this.antialiasing.render(camera, input, toDrawingBuffer && !dofEnabled, props.postprocessing);
313
318
  }
314
- else if (toDrawingBuffer) {
319
+ else if (toDrawingBuffer && !DofPass.isEnabled(props.postprocessing)) {
320
+ needsTargetCopy = true;
321
+ }
322
+ if (props.postprocessing.dof.name === 'on') {
323
+ const input = AntialiasingPass.isEnabled(props.postprocessing)
324
+ ? this.antialiasing.target.texture
325
+ : PostprocessingPass.isEnabled(props.postprocessing)
326
+ ? this.postprocessing.target.texture
327
+ : this.colorTarget.texture;
328
+ this.dof.update(camera, input, ((_a = this.depthTargetOpaque) === null || _a === void 0 ? void 0 : _a.texture) || this.depthTextureOpaque, this.depthTextureTransparent, props.postprocessing.dof.params, scene.boundingSphereVisible);
329
+ this.dof.render(camera.viewport, toDrawingBuffer ? undefined : this.getColorTarget(props.postprocessing));
330
+ }
331
+ else if (toDrawingBuffer && !AntialiasingPass.isEnabled(props.postprocessing)) {
332
+ needsTargetCopy = true;
333
+ }
334
+ if (needsTargetCopy) {
315
335
  this.drawTarget.bind();
316
336
  this.webgl.state.disable(this.webgl.gl.DEPTH_TEST);
317
337
  if (postprocessingEnabled) {
@@ -330,7 +350,7 @@ export class DrawPass {
330
350
  renderer.renderEmissive(scene.primitives, camera, null);
331
351
  }
332
352
  if (!emissiveBloom || scene.emissiveAverage > 0) {
333
- this.bloom.update(this.colorTarget.texture, this.bloom.emissiveTarget.texture, ((_a = this.depthTargetOpaque) === null || _a === void 0 ? void 0 : _a.texture) || this.depthTextureOpaque, props.postprocessing.bloom.params);
353
+ this.bloom.update(this.colorTarget.texture, this.bloom.emissiveTarget.texture, ((_b = this.depthTargetOpaque) === null || _b === void 0 ? void 0 : _b.texture) || this.depthTextureOpaque, props.postprocessing.bloom.params);
334
354
  this.bloom.render(camera.viewport, toDrawingBuffer ? undefined : this.getColorTarget(props.postprocessing));
335
355
  }
336
356
  }
@@ -364,7 +384,10 @@ export class DrawPass {
364
384
  this.webgl.timer.markEnd('DrawPass.render');
365
385
  }
366
386
  getColorTarget(postprocessingProps) {
367
- if (AntialiasingPass.isEnabled(postprocessingProps)) {
387
+ if (DofPass.isEnabled(postprocessingProps)) {
388
+ return this.dof.target;
389
+ }
390
+ else if (AntialiasingPass.isEnabled(postprocessingProps)) {
368
391
  return this.antialiasing.target;
369
392
  }
370
393
  else if (PostprocessingPass.isEnabled(postprocessingProps)) {
@@ -42,6 +42,14 @@ export declare const ImageParams: {
42
42
  color: any;
43
43
  includeTransparent: any;
44
44
  }>, "on">;
45
+ dof: PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
46
+ blurSize: any;
47
+ blurSpread: any;
48
+ inFocus: any;
49
+ PPM: any;
50
+ center: any;
51
+ mode: any;
52
+ }>, "on">;
45
53
  antialiasing: PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
46
54
  edgeThreshold: any;
47
55
  maxSearchSteps: any;
@@ -60,6 +60,14 @@ export declare const PostprocessingParams: {
60
60
  color: Color;
61
61
  includeTransparent: boolean;
62
62
  }>, "on">>;
63
+ dof: PD.Mapped<PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
64
+ blurSize: number;
65
+ blurSpread: number;
66
+ inFocus: number;
67
+ PPM: number;
68
+ center: string;
69
+ mode: string;
70
+ }>, "on">>;
63
71
  antialiasing: PD.Mapped<PD.NamedParams<PD.Normalize<unknown>, "off"> | PD.NamedParams<PD.Normalize<{
64
72
  edgeThreshold: number;
65
73
  maxSearchSteps: number;
@@ -25,6 +25,7 @@ import { isTimingMode } from '../../mol-util/debug';
25
25
  import { BackgroundParams, BackgroundPass } from './background';
26
26
  import { shadows_frag } from '../../mol-gl/shader/shadows.frag';
27
27
  import { CasParams, CasPass } from './cas';
28
+ import { DofParams } from './dof';
28
29
  import { BloomParams } from './bloom';
29
30
  export const OutlinesSchema = {
30
31
  ...QuadSchema,
@@ -314,6 +315,10 @@ export const PostprocessingParams = {
314
315
  }),
315
316
  off: PD.Group({})
316
317
  }, { cycle: true, description: 'Draw outline around 3D objects' }),
318
+ dof: PD.MappedStatic('off', {
319
+ on: PD.Group(DofParams),
320
+ off: PD.Group({})
321
+ }, { cycle: true, description: 'DOF' }),
317
322
  antialiasing: PD.MappedStatic('smaa', {
318
323
  fxaa: PD.Group(FxaaParams),
319
324
  smaa: PD.Group(SmaaParams),
@@ -42,7 +42,6 @@ export declare namespace Lines {
42
42
  alpha: PD.Numeric;
43
43
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
44
44
  material: PD.Group<PD.Normalize<{
45
- /** Wide line */
46
45
  metalness: number;
47
46
  roughness: number;
48
47
  bumpiness: number;
@@ -1,96 +1,96 @@
1
- export const background_frag = `
2
- precision mediump float;
3
- precision mediump samplerCube;
4
- precision mediump sampler2D;
5
-
6
- #if defined(dVariant_skybox)
7
- uniform samplerCube tSkybox;
8
- uniform mat4 uViewDirectionProjectionInverse;
9
- uniform float uBlur;
10
- uniform float uOpacity;
11
- uniform float uSaturation;
12
- uniform float uLightness;
13
- uniform mat3 uRotation;
14
- #elif defined(dVariant_image)
15
- uniform sampler2D tImage;
16
- uniform vec2 uImageScale;
17
- uniform vec2 uImageOffset;
18
- uniform float uBlur;
19
- uniform float uOpacity;
20
- uniform float uSaturation;
21
- uniform float uLightness;
22
- #elif defined(dVariant_horizontalGradient) || defined(dVariant_radialGradient)
23
- uniform vec3 uGradientColorA;
24
- uniform vec3 uGradientColorB;
25
- uniform float uGradientRatio;
26
- #endif
27
-
28
- uniform vec2 uTexSize;
29
- uniform vec4 uViewport;
30
- uniform bool uViewportAdjusted;
31
- varying vec4 vPosition;
32
-
33
- // TODO: add as general pp option to remove banding?
34
- // Iestyn's RGB dither from http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
35
- vec3 ScreenSpaceDither(vec2 vScreenPos) {
36
- vec3 vDither = vec3(dot(vec2(171.0, 231.0), vScreenPos.xy));
37
- vDither.rgb = fract(vDither.rgb / vec3(103.0, 71.0, 97.0));
38
- return vDither.rgb / 255.0;
39
- }
40
-
41
- vec3 saturateColor(vec3 c, float amount) {
42
- // https://www.w3.org/TR/WCAG21/#dfn-relative-luminance
43
- const vec3 W = vec3(0.2125, 0.7154, 0.0721);
44
- vec3 intensity = vec3(dot(c, W));
45
- return mix(intensity, c, 1.0 + amount);
46
- }
47
-
48
- vec3 lightenColor(vec3 c, float amount) {
49
- return c + amount;
50
- }
51
-
52
- void main() {
53
- #if defined(dVariant_skybox)
54
- vec4 t = uViewDirectionProjectionInverse * vPosition;
55
- #ifdef enabledShaderTextureLod
56
- gl_FragColor = textureCubeLodEXT(tSkybox, uRotation * normalize(t.xyz / t.w), uBlur * 8.0);
57
- #else
58
- gl_FragColor = textureCube(tSkybox, uRotation * normalize(t.xyz / t.w));
59
- #endif
60
- gl_FragColor.a = uOpacity;
61
- gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);
62
- #elif defined(dVariant_image)
63
- vec2 coords;
64
- if (uViewportAdjusted) {
65
- coords = ((gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uImageScale) + uImageOffset;
66
- } else {
67
- coords = (gl_FragCoord.xy / uImageScale) + uImageOffset;
68
- }
69
- #ifdef enabledShaderTextureLod
70
- gl_FragColor = texture2DLodEXT(tImage, vec2(coords.x, 1.0 - coords.y), uBlur * 8.0);
71
- #else
72
- gl_FragColor = texture2D(tImage, vec2(coords.x, 1.0 - coords.y));
73
- #endif
74
- gl_FragColor.a = uOpacity;
75
- gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);
76
- #elif defined(dVariant_horizontalGradient)
77
- float d;
78
- if (uViewportAdjusted) {
79
- d = ((gl_FragCoord.y - uViewport.y) * (uTexSize.y / uViewport.w) / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);
80
- } else {
81
- d = (gl_FragCoord.y / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);
82
- }
83
- gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, clamp(d, 0.0, 1.0)), 1.0);
84
- gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);
85
- #elif defined(dVariant_radialGradient)
86
- float d;
87
- if (uViewportAdjusted) {
88
- d = distance(vec2(0.5), (gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uTexSize) + uGradientRatio - 0.5;
89
- } else {
90
- d = distance(vec2(0.5), gl_FragCoord.xy / uTexSize) + uGradientRatio - 0.5;
91
- }
92
- gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, 1.0 - clamp(d, 0.0, 1.0)), 1.0);
93
- gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);
94
- #endif
95
- }
1
+ export const background_frag = `
2
+ precision mediump float;
3
+ precision mediump samplerCube;
4
+ precision mediump sampler2D;
5
+
6
+ #if defined(dVariant_skybox)
7
+ uniform samplerCube tSkybox;
8
+ uniform mat4 uViewDirectionProjectionInverse;
9
+ uniform float uBlur;
10
+ uniform float uOpacity;
11
+ uniform float uSaturation;
12
+ uniform float uLightness;
13
+ uniform mat3 uRotation;
14
+ #elif defined(dVariant_image)
15
+ uniform sampler2D tImage;
16
+ uniform vec2 uImageScale;
17
+ uniform vec2 uImageOffset;
18
+ uniform float uBlur;
19
+ uniform float uOpacity;
20
+ uniform float uSaturation;
21
+ uniform float uLightness;
22
+ #elif defined(dVariant_horizontalGradient) || defined(dVariant_radialGradient)
23
+ uniform vec3 uGradientColorA;
24
+ uniform vec3 uGradientColorB;
25
+ uniform float uGradientRatio;
26
+ #endif
27
+
28
+ uniform vec2 uTexSize;
29
+ uniform vec4 uViewport;
30
+ uniform bool uViewportAdjusted;
31
+ varying vec4 vPosition;
32
+
33
+ // TODO: add as general pp option to remove banding?
34
+ // Iestyn's RGB dither from http://alex.vlachos.com/graphics/Alex_Vlachos_Advanced_VR_Rendering_GDC2015.pdf
35
+ vec3 ScreenSpaceDither(vec2 vScreenPos) {
36
+ vec3 vDither = vec3(dot(vec2(171.0, 231.0), vScreenPos.xy));
37
+ vDither.rgb = fract(vDither.rgb / vec3(103.0, 71.0, 97.0));
38
+ return vDither.rgb / 255.0;
39
+ }
40
+
41
+ vec3 saturateColor(vec3 c, float amount) {
42
+ // https://www.w3.org/TR/WCAG21/#dfn-relative-luminance
43
+ const vec3 W = vec3(0.2125, 0.7154, 0.0721);
44
+ vec3 intensity = vec3(dot(c, W));
45
+ return mix(intensity, c, 1.0 + amount);
46
+ }
47
+
48
+ vec3 lightenColor(vec3 c, float amount) {
49
+ return c + amount;
50
+ }
51
+
52
+ void main() {
53
+ #if defined(dVariant_skybox)
54
+ vec4 t = uViewDirectionProjectionInverse * vPosition;
55
+ #ifdef enabledShaderTextureLod
56
+ gl_FragColor = textureCubeLodEXT(tSkybox, uRotation * normalize(t.xyz / t.w), uBlur * 8.0);
57
+ #else
58
+ gl_FragColor = textureCube(tSkybox, uRotation * normalize(t.xyz / t.w));
59
+ #endif
60
+ gl_FragColor.a = uOpacity;
61
+ gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);
62
+ #elif defined(dVariant_image)
63
+ vec2 coords;
64
+ if (uViewportAdjusted) {
65
+ coords = ((gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uImageScale) + uImageOffset;
66
+ } else {
67
+ coords = (gl_FragCoord.xy / uImageScale) + uImageOffset;
68
+ }
69
+ #ifdef enabledShaderTextureLod
70
+ gl_FragColor = texture2DLodEXT(tImage, vec2(coords.x, 1.0 - coords.y), uBlur * 8.0);
71
+ #else
72
+ gl_FragColor = texture2D(tImage, vec2(coords.x, 1.0 - coords.y));
73
+ #endif
74
+ gl_FragColor.a = uOpacity;
75
+ gl_FragColor.rgb = lightenColor(saturateColor(gl_FragColor.rgb, uSaturation), uLightness);
76
+ #elif defined(dVariant_horizontalGradient)
77
+ float d;
78
+ if (uViewportAdjusted) {
79
+ d = ((gl_FragCoord.y - uViewport.y) * (uTexSize.y / uViewport.w) / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);
80
+ } else {
81
+ d = (gl_FragCoord.y / uTexSize.y) + 1.0 - (uGradientRatio * 2.0);
82
+ }
83
+ gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, clamp(d, 0.0, 1.0)), 1.0);
84
+ gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);
85
+ #elif defined(dVariant_radialGradient)
86
+ float d;
87
+ if (uViewportAdjusted) {
88
+ d = distance(vec2(0.5), (gl_FragCoord.xy - uViewport.xy) * (uTexSize / uViewport.zw) / uTexSize) + uGradientRatio - 0.5;
89
+ } else {
90
+ d = distance(vec2(0.5), gl_FragCoord.xy / uTexSize) + uGradientRatio - 0.5;
91
+ }
92
+ gl_FragColor = vec4(mix(uGradientColorB, uGradientColorA, 1.0 - clamp(d, 0.0, 1.0)), 1.0);
93
+ gl_FragColor.rgb += ScreenSpaceDither(gl_FragCoord.xy);
94
+ #endif
95
+ }
96
96
  `;
@@ -1,12 +1,12 @@
1
- export const background_vert = `
2
- precision mediump float;
3
-
4
- attribute vec2 aPosition;
5
-
6
- varying vec4 vPosition;
7
-
8
- void main() {
9
- vPosition = vec4(aPosition, 1.0, 1.0);
10
- gl_Position = vec4(aPosition, 1.0, 1.0);
11
- }
1
+ export const background_vert = `
2
+ precision mediump float;
3
+
4
+ attribute vec2 aPosition;
5
+
6
+ varying vec4 vPosition;
7
+
8
+ void main() {
9
+ vPosition = vec4(aPosition, 1.0, 1.0);
10
+ gl_Position = vec4(aPosition, 1.0, 1.0);
11
+ }
12
12
  `;
@@ -3,17 +3,17 @@
3
3
  *
4
4
  * @author Gianluca Tomasello <giagitom@gmail.com>
5
5
  */
6
- export const blendBackDpoit_frag = `
7
- precision highp float;
8
-
9
- uniform sampler2D tDpoitBackColor;
10
- uniform vec2 uTexSize;
11
-
12
- void main() {
13
- vec2 coords = gl_FragCoord.xy / uTexSize;
14
- gl_FragColor = texture2D(tDpoitBackColor, coords);
15
- if (gl_FragColor.a == 0.0) {
16
- discard;
17
- }
18
- }
6
+ export const blendBackDpoit_frag = `
7
+ precision highp float;
8
+
9
+ uniform sampler2D tDpoitBackColor;
10
+ uniform vec2 uTexSize;
11
+
12
+ void main() {
13
+ vec2 coords = gl_FragCoord.xy / uTexSize;
14
+ gl_FragColor = texture2D(tDpoitBackColor, coords);
15
+ if (gl_FragColor.a == 0.0) {
16
+ discard;
17
+ }
18
+ }
19
19
  `;
@@ -1,29 +1,29 @@
1
- export const blur_frag = `
2
- precision highp float;
3
- precision highp int;
4
- precision highp sampler2D;
5
-
6
- uniform sampler2D tInput;
7
- uniform vec2 uTexSizeInv;
8
-
9
- uniform vec2 uDirection;
10
- uniform float uGaussianCoefficients[dKernelRadius];
11
-
12
- void main(void) {
13
- vec2 coords = gl_FragCoord.xy * uTexSizeInv;
14
- float weightSum = uGaussianCoefficients[0];
15
- vec4 diffuseSum = texture2D(tInput, coords) * weightSum;
16
-
17
- for(int i = 1; i < dKernelRadius; ++i) {
18
- float x = float(i);
19
- float w = uGaussianCoefficients[i];
20
- vec2 offset = uDirection * uTexSizeInv * x;
21
- vec4 sample1 = texture2D(tInput, coords + offset);
22
- vec4 sample2 = texture2D(tInput, coords - offset);
23
- diffuseSum += (sample1 + sample2) * w;
24
- weightSum += 2.0 * w;
25
- }
26
-
27
- gl_FragColor = diffuseSum / weightSum;
28
- }
1
+ export const blur_frag = `
2
+ precision highp float;
3
+ precision highp int;
4
+ precision highp sampler2D;
5
+
6
+ uniform sampler2D tInput;
7
+ uniform vec2 uTexSizeInv;
8
+
9
+ uniform vec2 uDirection;
10
+ uniform float uGaussianCoefficients[dKernelRadius];
11
+
12
+ void main(void) {
13
+ vec2 coords = gl_FragCoord.xy * uTexSizeInv;
14
+ float weightSum = uGaussianCoefficients[0];
15
+ vec4 diffuseSum = texture2D(tInput, coords) * weightSum;
16
+
17
+ for(int i = 1; i < dKernelRadius; ++i) {
18
+ float x = float(i);
19
+ float w = uGaussianCoefficients[i];
20
+ vec2 offset = uDirection * uTexSizeInv * x;
21
+ vec4 sample1 = texture2D(tInput, coords + offset);
22
+ vec4 sample2 = texture2D(tInput, coords - offset);
23
+ diffuseSum += (sample1 + sample2) * w;
24
+ weightSum += 2.0 * w;
25
+ }
26
+
27
+ gl_FragColor = diffuseSum / weightSum;
28
+ }
29
29
  `;