molstar 3.0.0-dev.3 → 3.0.0-dev.4

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 (379) hide show
  1. package/LICENSE +20 -20
  2. package/README.md +187 -187
  3. package/build/viewer/embedded.html +43 -43
  4. package/build/viewer/index.html +95 -94
  5. package/build/viewer/molstar.css +1 -1
  6. package/build/viewer/molstar.js +1 -1
  7. package/lib/apps/docking-viewer/index.html +36 -36
  8. package/lib/apps/docking-viewer/viewport.js +2 -1
  9. package/lib/apps/viewer/embedded.html +43 -43
  10. package/lib/apps/viewer/index.html +95 -94
  11. package/lib/commonjs/apps/docking-viewer/viewport.js +2 -1
  12. package/lib/commonjs/examples/lighting/index.js +2 -1
  13. package/lib/commonjs/extensions/anvil/behavior.d.ts +3 -0
  14. package/lib/commonjs/extensions/anvil/representation.d.ts +13 -0
  15. package/lib/commonjs/extensions/cellpack/representation.d.ts +3 -0
  16. package/lib/commonjs/extensions/dnatco/confal-pyramids/representation.d.ts +9 -0
  17. package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +3 -0
  18. package/lib/commonjs/extensions/rcsb/assembly-symmetry/representation.d.ts +3 -0
  19. package/lib/commonjs/extensions/rcsb/validation-report/representation.d.ts +15 -0
  20. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +6 -0
  21. package/lib/commonjs/mol-canvas3d/helper/camera-helper.d.ts +3 -0
  22. package/lib/commonjs/mol-canvas3d/helper/handle-helper.d.ts +3 -0
  23. package/lib/commonjs/mol-canvas3d/helper/helper.d.ts +4 -0
  24. package/lib/commonjs/mol-canvas3d/passes/image.d.ts +3 -0
  25. package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +1 -0
  26. package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +4 -2
  27. package/lib/commonjs/mol-geo/geometry/base.d.ts +2 -0
  28. package/lib/commonjs/mol-geo/geometry/base.js +2 -0
  29. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +4 -1
  30. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +4 -2
  31. package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.d.ts +1 -0
  32. package/lib/commonjs/mol-geo/geometry/image/image.d.ts +1 -0
  33. package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +1 -0
  34. package/lib/commonjs/mol-geo/geometry/mesh/color-smoothing.js +1 -1
  35. package/lib/commonjs/mol-geo/geometry/mesh/mesh.d.ts +3 -0
  36. package/lib/commonjs/mol-geo/geometry/mesh/mesh.js +4 -2
  37. package/lib/commonjs/mol-geo/geometry/points/points.d.ts +2 -1
  38. package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +3 -0
  39. package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +4 -2
  40. package/lib/commonjs/mol-geo/geometry/substance-data.js +3 -3
  41. package/lib/commonjs/mol-geo/geometry/text/text.d.ts +1 -0
  42. package/lib/commonjs/mol-geo/geometry/texture-mesh/color-smoothing.js +3 -3
  43. package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +3 -0
  44. package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.js +4 -2
  45. package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +31 -28
  46. package/lib/commonjs/mol-gl/renderable/cylinders.js +2 -2
  47. package/lib/commonjs/mol-gl/renderable/direct-volume.d.ts +1 -0
  48. package/lib/commonjs/mol-gl/renderable/image.d.ts +1 -0
  49. package/lib/commonjs/mol-gl/renderable/lines.d.ts +1 -0
  50. package/lib/commonjs/mol-gl/renderable/mesh.d.ts +28 -25
  51. package/lib/commonjs/mol-gl/renderable/mesh.js +2 -2
  52. package/lib/commonjs/mol-gl/renderable/points.d.ts +1 -0
  53. package/lib/commonjs/mol-gl/renderable/schema.d.ts +1 -0
  54. package/lib/commonjs/mol-gl/renderable/schema.js +3 -3
  55. package/lib/commonjs/mol-gl/renderable/spheres.d.ts +31 -28
  56. package/lib/commonjs/mol-gl/renderable/spheres.js +2 -2
  57. package/lib/commonjs/mol-gl/renderable/text.d.ts +1 -0
  58. package/lib/commonjs/mol-gl/renderable/texture-mesh.d.ts +3 -0
  59. package/lib/commonjs/mol-gl/renderable/texture-mesh.js +1 -1
  60. package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
  61. package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
  62. package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
  63. package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
  64. package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.d.ts +1 -1
  65. package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.js +1 -1
  66. package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.d.ts +1 -1
  67. package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.js +1 -1
  68. package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.d.ts +1 -1
  69. package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.js +1 -1
  70. package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.d.ts +1 -1
  71. package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.js +1 -1
  72. package/lib/commonjs/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
  73. package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +1 -1
  74. package/lib/commonjs/mol-gl/shader/chunks/light-frag-params.glsl.d.ts +1 -1
  75. package/lib/commonjs/mol-gl/shader/chunks/light-frag-params.glsl.js +1 -1
  76. package/lib/commonjs/mol-gl/shader/cylinders.frag.d.ts +1 -1
  77. package/lib/commonjs/mol-gl/shader/cylinders.frag.js +1 -1
  78. package/lib/commonjs/mol-gl/shader/mesh.frag.d.ts +1 -1
  79. package/lib/commonjs/mol-gl/shader/mesh.frag.js +1 -1
  80. package/lib/commonjs/mol-gl/shader/postprocessing.frag.d.ts +1 -1
  81. package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +1 -1
  82. package/lib/commonjs/mol-gl/shader/spheres.frag.d.ts +1 -1
  83. package/lib/commonjs/mol-gl/shader/spheres.frag.js +1 -1
  84. package/lib/commonjs/mol-model/structure/model/model.js +7 -3
  85. package/lib/commonjs/mol-model-formats/shape/ply.d.ts +6 -0
  86. package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +3 -0
  87. package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +3 -0
  88. package/lib/commonjs/mol-model-props/computed/representations/interactions.d.ts +9 -0
  89. package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/representation.d.ts +12 -0
  90. package/lib/commonjs/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
  91. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
  92. package/lib/commonjs/mol-plugin/commands.d.ts +3 -0
  93. package/lib/commonjs/mol-plugin/config.d.ts +1 -0
  94. package/lib/commonjs/mol-plugin/config.js +9 -3
  95. package/lib/commonjs/mol-plugin/util/viewport-screenshot.d.ts +9 -0
  96. package/lib/commonjs/mol-plugin-state/manager/structure/component.d.ts +2 -0
  97. package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +22 -0
  98. package/lib/commonjs/mol-plugin-ui/controls/parameters.d.ts +3 -2
  99. package/lib/commonjs/mol-plugin-ui/controls/parameters.js +11 -6
  100. package/lib/commonjs/mol-plugin-ui/hooks/use-behavior.d.ts +1 -1
  101. package/lib/commonjs/mol-plugin-ui/hooks/use-behavior.js +8 -17
  102. package/lib/commonjs/mol-plugin-ui/plugin.d.ts +1 -1
  103. package/lib/commonjs/mol-plugin-ui/plugin.js +76 -10
  104. package/lib/commonjs/mol-repr/shape/loci/angle.d.ts +3 -0
  105. package/lib/commonjs/mol-repr/shape/loci/common.d.ts +1 -0
  106. package/lib/commonjs/mol-repr/shape/loci/dihedral.d.ts +3 -0
  107. package/lib/commonjs/mol-repr/shape/loci/distance.d.ts +1 -0
  108. package/lib/commonjs/mol-repr/shape/loci/label.d.ts +1 -0
  109. package/lib/commonjs/mol-repr/shape/loci/orientation.d.ts +3 -0
  110. package/lib/commonjs/mol-repr/shape/loci/plane.d.ts +3 -0
  111. package/lib/commonjs/mol-repr/shape/model/unitcell.d.ts +3 -0
  112. package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +12 -0
  113. package/lib/commonjs/mol-repr/structure/params.d.ts +16 -0
  114. package/lib/commonjs/mol-repr/structure/registry.d.ts +35 -1
  115. package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +9 -0
  116. package/lib/commonjs/mol-repr/structure/representation/backbone.js +2 -1
  117. package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +9 -0
  118. package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.js +2 -1
  119. package/lib/commonjs/mol-repr/structure/representation/carbohydrate.d.ts +9 -0
  120. package/lib/commonjs/mol-repr/structure/representation/carbohydrate.js +2 -1
  121. package/lib/commonjs/mol-repr/structure/representation/cartoon.d.ts +9 -0
  122. package/lib/commonjs/mol-repr/structure/representation/cartoon.js +2 -1
  123. package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +9 -0
  124. package/lib/commonjs/mol-repr/structure/representation/ellipsoid.js +2 -1
  125. package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +9 -0
  126. package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.js +2 -1
  127. package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
  128. package/lib/commonjs/mol-repr/structure/representation/label.d.ts +6 -3
  129. package/lib/commonjs/mol-repr/structure/representation/line.d.ts +3 -0
  130. package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +9 -0
  131. package/lib/commonjs/mol-repr/structure/representation/molecular-surface.js +2 -1
  132. package/lib/commonjs/mol-repr/structure/representation/orientation.d.ts +9 -0
  133. package/lib/commonjs/mol-repr/structure/representation/orientation.js +2 -1
  134. package/lib/commonjs/mol-repr/structure/representation/point.d.ts +3 -0
  135. package/lib/commonjs/mol-repr/structure/representation/putty.d.ts +9 -0
  136. package/lib/commonjs/mol-repr/structure/representation/putty.js +2 -1
  137. package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +9 -0
  138. package/lib/commonjs/mol-repr/structure/representation/spacefill.js +2 -1
  139. package/lib/commonjs/mol-repr/structure/units-visual.d.ts +16 -0
  140. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +6 -0
  141. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
  142. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +6 -0
  143. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
  144. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +3 -0
  145. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +3 -0
  146. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +3 -0
  147. package/lib/commonjs/mol-repr/structure/visual/element-cross.d.ts +1 -0
  148. package/lib/commonjs/mol-repr/structure/visual/element-point.d.ts +1 -0
  149. package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +6 -0
  150. package/lib/commonjs/mol-repr/structure/visual/ellipsoid-mesh.d.ts +3 -0
  151. package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
  152. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +12 -0
  153. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
  154. package/lib/commonjs/mol-repr/structure/visual/label-text.d.ts +3 -2
  155. package/lib/commonjs/mol-repr/structure/visual/label-text.js +2 -2
  156. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +3 -0
  157. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
  158. package/lib/commonjs/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +3 -0
  159. package/lib/commonjs/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +3 -0
  160. package/lib/commonjs/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +3 -0
  161. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +6 -0
  162. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +6 -0
  163. package/lib/commonjs/mol-repr/structure/visual/polymer-direction-wedge.d.ts +3 -0
  164. package/lib/commonjs/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +3 -0
  165. package/lib/commonjs/mol-repr/structure/visual/polymer-trace-mesh.d.ts +3 -0
  166. package/lib/commonjs/mol-repr/structure/visual/polymer-tube-mesh.d.ts +3 -0
  167. package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +3 -0
  168. package/lib/commonjs/mol-repr/volume/isosurface.d.ts +16 -0
  169. package/lib/commonjs/mol-repr/volume/isosurface.js +2 -1
  170. package/lib/commonjs/mol-repr/volume/registry.d.ts +5 -0
  171. package/lib/commonjs/mol-repr/volume/representation.d.ts +1 -0
  172. package/lib/commonjs/mol-repr/volume/slice.d.ts +3 -0
  173. package/lib/commonjs/mol-script/language/builder.d.ts +1 -0
  174. package/lib/commonjs/mol-theme/color/illustrative.d.ts +2 -0
  175. package/lib/commonjs/mol-theme/color/illustrative.js +2 -2
  176. package/lib/commonjs/mol-theme/color.d.ts +1 -0
  177. package/lib/commonjs/mol-util/material.d.ts +5 -1
  178. package/lib/commonjs/mol-util/material.js +9 -7
  179. package/lib/examples/alpha-orbitals/index.html +60 -60
  180. package/lib/examples/basic-wrapper/index.html +136 -136
  181. package/lib/examples/lighting/index.html +86 -86
  182. package/lib/examples/lighting/index.js +2 -1
  183. package/lib/examples/proteopedia-wrapper/index.html +235 -235
  184. package/lib/extensions/anvil/behavior.d.ts +3 -0
  185. package/lib/extensions/anvil/representation.d.ts +13 -0
  186. package/lib/extensions/cellpack/representation.d.ts +3 -0
  187. package/lib/extensions/dnatco/confal-pyramids/representation.d.ts +9 -0
  188. package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +3 -0
  189. package/lib/extensions/rcsb/assembly-symmetry/representation.d.ts +3 -0
  190. package/lib/extensions/rcsb/validation-report/representation.d.ts +15 -0
  191. package/lib/mol-canvas3d/canvas3d.d.ts +6 -0
  192. package/lib/mol-canvas3d/helper/camera-helper.d.ts +3 -0
  193. package/lib/mol-canvas3d/helper/handle-helper.d.ts +3 -0
  194. package/lib/mol-canvas3d/helper/helper.d.ts +4 -0
  195. package/lib/mol-canvas3d/passes/image.d.ts +3 -0
  196. package/lib/mol-canvas3d/passes/postprocessing.d.ts +1 -0
  197. package/lib/mol-canvas3d/passes/postprocessing.js +4 -2
  198. package/lib/mol-geo/geometry/base.d.ts +2 -0
  199. package/lib/mol-geo/geometry/base.js +2 -0
  200. package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +4 -1
  201. package/lib/mol-geo/geometry/cylinders/cylinders.js +4 -2
  202. package/lib/mol-geo/geometry/direct-volume/direct-volume.d.ts +1 -0
  203. package/lib/mol-geo/geometry/image/image.d.ts +1 -0
  204. package/lib/mol-geo/geometry/lines/lines.d.ts +1 -0
  205. package/lib/mol-geo/geometry/mesh/color-smoothing.js +1 -1
  206. package/lib/mol-geo/geometry/mesh/mesh.d.ts +3 -0
  207. package/lib/mol-geo/geometry/mesh/mesh.js +4 -2
  208. package/lib/mol-geo/geometry/points/points.d.ts +2 -1
  209. package/lib/mol-geo/geometry/spheres/spheres.d.ts +3 -0
  210. package/lib/mol-geo/geometry/spheres/spheres.js +4 -2
  211. package/lib/mol-geo/geometry/substance-data.js +3 -3
  212. package/lib/mol-geo/geometry/text/text.d.ts +1 -0
  213. package/lib/mol-geo/geometry/texture-mesh/color-smoothing.js +3 -3
  214. package/lib/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +3 -0
  215. package/lib/mol-geo/geometry/texture-mesh/texture-mesh.js +4 -2
  216. package/lib/mol-gl/renderable/cylinders.d.ts +31 -28
  217. package/lib/mol-gl/renderable/cylinders.js +3 -3
  218. package/lib/mol-gl/renderable/direct-volume.d.ts +1 -0
  219. package/lib/mol-gl/renderable/image.d.ts +1 -0
  220. package/lib/mol-gl/renderable/lines.d.ts +1 -0
  221. package/lib/mol-gl/renderable/mesh.d.ts +28 -25
  222. package/lib/mol-gl/renderable/mesh.js +3 -3
  223. package/lib/mol-gl/renderable/points.d.ts +1 -0
  224. package/lib/mol-gl/renderable/schema.d.ts +1 -0
  225. package/lib/mol-gl/renderable/schema.js +3 -3
  226. package/lib/mol-gl/renderable/spheres.d.ts +31 -28
  227. package/lib/mol-gl/renderable/spheres.js +3 -3
  228. package/lib/mol-gl/renderable/text.d.ts +1 -0
  229. package/lib/mol-gl/renderable/texture-mesh.d.ts +3 -0
  230. package/lib/mol-gl/renderable/texture-mesh.js +1 -1
  231. package/lib/mol-gl/shader/chunks/apply-light-color.glsl.d.ts +1 -1
  232. package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +1 -1
  233. package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
  234. package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
  235. package/lib/mol-gl/shader/chunks/assign-material-color.glsl.d.ts +1 -1
  236. package/lib/mol-gl/shader/chunks/assign-material-color.glsl.js +1 -1
  237. package/lib/mol-gl/shader/chunks/color-frag-params.glsl.d.ts +1 -1
  238. package/lib/mol-gl/shader/chunks/color-frag-params.glsl.js +1 -1
  239. package/lib/mol-gl/shader/chunks/color-vert-params.glsl.d.ts +1 -1
  240. package/lib/mol-gl/shader/chunks/color-vert-params.glsl.js +1 -1
  241. package/lib/mol-gl/shader/chunks/common-frag-params.glsl.d.ts +1 -1
  242. package/lib/mol-gl/shader/chunks/common-frag-params.glsl.js +1 -1
  243. package/lib/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
  244. package/lib/mol-gl/shader/chunks/common.glsl.js +1 -1
  245. package/lib/mol-gl/shader/chunks/light-frag-params.glsl.d.ts +1 -1
  246. package/lib/mol-gl/shader/chunks/light-frag-params.glsl.js +1 -1
  247. package/lib/mol-gl/shader/cylinders.frag.d.ts +1 -1
  248. package/lib/mol-gl/shader/cylinders.frag.js +1 -1
  249. package/lib/mol-gl/shader/mesh.frag.d.ts +1 -1
  250. package/lib/mol-gl/shader/mesh.frag.js +1 -1
  251. package/lib/mol-gl/shader/postprocessing.frag.d.ts +1 -1
  252. package/lib/mol-gl/shader/postprocessing.frag.js +1 -1
  253. package/lib/mol-gl/shader/spheres.frag.d.ts +1 -1
  254. package/lib/mol-gl/shader/spheres.frag.js +1 -1
  255. package/lib/mol-model/structure/model/model.js +7 -3
  256. package/lib/mol-model-formats/shape/ply.d.ts +6 -0
  257. package/lib/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +3 -0
  258. package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +3 -0
  259. package/lib/mol-model-props/computed/representations/interactions.d.ts +9 -0
  260. package/lib/mol-model-props/integrative/cross-link-restraint/representation.d.ts +12 -0
  261. package/lib/mol-plugin/behavior/dynamic/selection/structure-focus-representation.d.ts +1 -0
  262. package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +2 -3
  263. package/lib/mol-plugin/commands.d.ts +3 -0
  264. package/lib/mol-plugin/config.d.ts +1 -0
  265. package/lib/mol-plugin/config.js +8 -3
  266. package/lib/mol-plugin/util/viewport-screenshot.d.ts +9 -0
  267. package/lib/mol-plugin/version.js +2 -2
  268. package/lib/mol-plugin-state/manager/structure/component.d.ts +2 -0
  269. package/lib/mol-plugin-state/transforms/representation.d.ts +22 -0
  270. package/lib/mol-plugin-ui/controls/parameters.d.ts +3 -2
  271. package/lib/mol-plugin-ui/controls/parameters.js +12 -7
  272. package/lib/mol-plugin-ui/hooks/use-behavior.d.ts +1 -1
  273. package/lib/mol-plugin-ui/hooks/use-behavior.js +9 -18
  274. package/lib/mol-plugin-ui/plugin.d.ts +1 -1
  275. package/lib/mol-plugin-ui/plugin.js +76 -10
  276. package/lib/mol-plugin-ui/skin/base/base.scss +32 -32
  277. package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
  278. package/lib/mol-plugin-ui/skin/base/components/controls.scss +418 -418
  279. package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
  280. package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
  281. package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
  282. package/lib/mol-plugin-ui/skin/base/components/misc.scss +643 -616
  283. package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
  284. package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
  285. package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
  286. package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
  287. package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
  288. package/lib/mol-plugin-ui/skin/base/components/viewport.scss +127 -127
  289. package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
  290. package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
  291. package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
  292. package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
  293. package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
  294. package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
  295. package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
  296. package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
  297. package/lib/mol-plugin-ui/skin/base/variables.scss +85 -85
  298. package/lib/mol-plugin-ui/skin/blue.scss +1 -1
  299. package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
  300. package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
  301. package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
  302. package/lib/mol-plugin-ui/skin/dark.scss +1 -1
  303. package/lib/mol-plugin-ui/skin/light.scss +1 -1
  304. package/lib/mol-repr/shape/loci/angle.d.ts +3 -0
  305. package/lib/mol-repr/shape/loci/common.d.ts +1 -0
  306. package/lib/mol-repr/shape/loci/dihedral.d.ts +3 -0
  307. package/lib/mol-repr/shape/loci/distance.d.ts +1 -0
  308. package/lib/mol-repr/shape/loci/label.d.ts +1 -0
  309. package/lib/mol-repr/shape/loci/orientation.d.ts +3 -0
  310. package/lib/mol-repr/shape/loci/plane.d.ts +3 -0
  311. package/lib/mol-repr/shape/model/unitcell.d.ts +3 -0
  312. package/lib/mol-repr/structure/complex-visual.d.ts +12 -0
  313. package/lib/mol-repr/structure/params.d.ts +16 -0
  314. package/lib/mol-repr/structure/registry.d.ts +35 -1
  315. package/lib/mol-repr/structure/representation/backbone.d.ts +9 -0
  316. package/lib/mol-repr/structure/representation/backbone.js +2 -1
  317. package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +9 -0
  318. package/lib/mol-repr/structure/representation/ball-and-stick.js +2 -1
  319. package/lib/mol-repr/structure/representation/carbohydrate.d.ts +9 -0
  320. package/lib/mol-repr/structure/representation/carbohydrate.js +2 -1
  321. package/lib/mol-repr/structure/representation/cartoon.d.ts +9 -0
  322. package/lib/mol-repr/structure/representation/cartoon.js +2 -1
  323. package/lib/mol-repr/structure/representation/ellipsoid.d.ts +9 -0
  324. package/lib/mol-repr/structure/representation/ellipsoid.js +2 -1
  325. package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +9 -0
  326. package/lib/mol-repr/structure/representation/gaussian-surface.js +2 -1
  327. package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +3 -0
  328. package/lib/mol-repr/structure/representation/label.d.ts +6 -3
  329. package/lib/mol-repr/structure/representation/line.d.ts +3 -0
  330. package/lib/mol-repr/structure/representation/molecular-surface.d.ts +9 -0
  331. package/lib/mol-repr/structure/representation/molecular-surface.js +2 -1
  332. package/lib/mol-repr/structure/representation/orientation.d.ts +9 -0
  333. package/lib/mol-repr/structure/representation/orientation.js +2 -1
  334. package/lib/mol-repr/structure/representation/point.d.ts +3 -0
  335. package/lib/mol-repr/structure/representation/putty.d.ts +9 -0
  336. package/lib/mol-repr/structure/representation/putty.js +2 -1
  337. package/lib/mol-repr/structure/representation/spacefill.d.ts +9 -0
  338. package/lib/mol-repr/structure/representation/spacefill.js +2 -1
  339. package/lib/mol-repr/structure/units-visual.d.ts +16 -0
  340. package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +6 -0
  341. package/lib/mol-repr/structure/visual/bond-inter-unit-line.d.ts +1 -0
  342. package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +6 -0
  343. package/lib/mol-repr/structure/visual/bond-intra-unit-line.d.ts +1 -0
  344. package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +3 -0
  345. package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +3 -0
  346. package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +3 -0
  347. package/lib/mol-repr/structure/visual/element-cross.d.ts +1 -0
  348. package/lib/mol-repr/structure/visual/element-point.d.ts +1 -0
  349. package/lib/mol-repr/structure/visual/element-sphere.d.ts +6 -0
  350. package/lib/mol-repr/structure/visual/ellipsoid-mesh.d.ts +3 -0
  351. package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -0
  352. package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +12 -0
  353. package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.d.ts +1 -0
  354. package/lib/mol-repr/structure/visual/label-text.d.ts +3 -2
  355. package/lib/mol-repr/structure/visual/label-text.js +2 -2
  356. package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +3 -0
  357. package/lib/mol-repr/structure/visual/molecular-surface-wireframe.d.ts +1 -0
  358. package/lib/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +3 -0
  359. package/lib/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +3 -0
  360. package/lib/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +3 -0
  361. package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +6 -0
  362. package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +6 -0
  363. package/lib/mol-repr/structure/visual/polymer-direction-wedge.d.ts +3 -0
  364. package/lib/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +3 -0
  365. package/lib/mol-repr/structure/visual/polymer-trace-mesh.d.ts +3 -0
  366. package/lib/mol-repr/structure/visual/polymer-tube-mesh.d.ts +3 -0
  367. package/lib/mol-repr/volume/direct-volume.d.ts +3 -0
  368. package/lib/mol-repr/volume/isosurface.d.ts +16 -0
  369. package/lib/mol-repr/volume/isosurface.js +2 -1
  370. package/lib/mol-repr/volume/registry.d.ts +5 -0
  371. package/lib/mol-repr/volume/representation.d.ts +1 -0
  372. package/lib/mol-repr/volume/slice.d.ts +3 -0
  373. package/lib/mol-script/language/builder.d.ts +1 -0
  374. package/lib/mol-theme/color/illustrative.d.ts +2 -0
  375. package/lib/mol-theme/color/illustrative.js +2 -2
  376. package/lib/mol-theme/color.d.ts +1 -0
  377. package/lib/mol-util/material.d.ts +5 -1
  378. package/lib/mol-util/material.js +9 -7
  379. package/package.json +162 -160
@@ -1 +1 @@
1
- export declare const common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dRenderVariant_pickObject) || defined(dRenderVariant_pickInstance) || defined(dRenderVariant_pickGroup)\n #define dRenderVariant_pick\n#endif\n\n#if defined(dRenderVariant_markingDepth) || defined(dRenderVariant_markingMask)\n #define dRenderVariant_marking\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n#endif\n";
1
+ export declare const common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dRenderVariant_pickObject) || defined(dRenderVariant_pickInstance) || defined(dRenderVariant_pickGroup)\n #define dRenderVariant_pick\n#endif\n\n#if defined(dRenderVariant_markingDepth) || defined(dRenderVariant_markingMask)\n #define dRenderVariant_marking\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ( (x) != (x) )\n #define isInf(x) ( (x) == (x)+1. )\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.common = void 0;
4
- exports.common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dRenderVariant_pickObject) || defined(dRenderVariant_pickInstance) || defined(dRenderVariant_pickGroup)\n #define dRenderVariant_pick\n#endif\n\n#if defined(dRenderVariant_markingDepth) || defined(dRenderVariant_markingMask)\n #define dRenderVariant_marking\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n#endif\n";
4
+ exports.common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dRenderVariant_pickObject) || defined(dRenderVariant_pickInstance) || defined(dRenderVariant_pickGroup)\n #define dRenderVariant_pick\n#endif\n\n#if defined(dRenderVariant_markingDepth) || defined(dRenderVariant_markingMask)\n #define dRenderVariant_marking\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ( (x) != (x) )\n #define isInf(x) ( (x) == (x)+1. )\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
5
5
  //# sourceMappingURL=common.glsl.js.map
@@ -6,4 +6,4 @@
6
6
  * adapted from three.js (https://github.com/mrdoob/three.js/)
7
7
  * which under the MIT License, Copyright © 2010-2021 three.js authors
8
8
  */
9
- export declare const light_frag_params = "\nuniform vec3 uLightDirection[dLightCount];\nuniform vec3 uLightColor[dLightCount];\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n";
9
+ export declare const light_frag_params = "\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n";
@@ -9,5 +9,5 @@
9
9
  */
10
10
  Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.light_frag_params = void 0;
12
- exports.light_frag_params = "\nuniform vec3 uLightDirection[dLightCount];\nuniform vec3 uLightColor[dLightCount];\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n";
12
+ exports.light_frag_params = "\n#if dLightCount != 0\n uniform vec3 uLightDirection[dLightCount];\n uniform vec3 uLightColor[dLightCount];\n#endif\nuniform vec3 uAmbientColor;\n\nstruct PhysicalMaterial {\n vec3 diffuseColor;\n float roughness;\n vec3 specularColor;\n float specularF90;\n};\n\nstruct IncidentLight {\n vec3 color;\n vec3 direction;\n};\n\nstruct ReflectedLight {\n vec3 directDiffuse;\n vec3 directSpecular;\n vec3 indirectDiffuse;\n vec3 indirectSpecular;\n};\n\nstruct GeometricContext {\n vec3 position;\n vec3 normal;\n vec3 viewDir;\n};\n\nvec3 BRDF_Lambert(const in vec3 diffuseColor) {\n return RECIPROCAL_PI * diffuseColor;\n}\n\nvec3 F_Schlick(const in vec3 f0, const in float f90, const in float dotVH) {\n // Original approximation by Christophe Schlick '94\n // float fresnel = pow( 1.0 - dotVH, 5.0 );\n // Optimized variant (presented by Epic at SIGGRAPH '13)\n // https://cdn2.unrealengine.com/Resources/files/2013SiggraphPresentationsNotes-26915738.pdf\n float fresnel = exp2((-5.55473 * dotVH - 6.98316) * dotVH);\n return f0 * (1.0 - fresnel) + (f90 * fresnel);\n}\n\n// Moving Frostbite to Physically Based Rendering 3.0 - page 12, listing 2\n// https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\nfloat V_GGX_SmithCorrelated(const in float alpha, const in float dotNL, const in float dotNV) {\n float a2 = pow2(alpha);\n float gv = dotNL * sqrt(a2 + (1.0 - a2) * pow2(dotNV));\n float gl = dotNV * sqrt(a2 + (1.0 - a2) * pow2(dotNL));\n return 0.5 / max(gv + gl, EPSILON);\n}\n\n// Microfacet Models for Refraction through Rough Surfaces - equation (33)\n// http://graphicrants.blogspot.com/2013/08/specular-brdf-reference.html\n// alpha is \"roughness squared\" in Disney\u2019s reparameterization\nfloat D_GGX(const in float alpha, const in float dotNH) {\n float a2 = pow2(alpha);\n float denom = pow2(dotNH) * (a2 - 1.0) + 1.0; // avoid alpha = 0 with dotNH = 1\n return RECIPROCAL_PI * a2 / pow2(denom);\n}\n\n// GGX Distribution, Schlick Fresnel, GGX_SmithCorrelated Visibility\nvec3 BRDF_GGX(const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 f0, const in float f90, const in float roughness) {\n float alpha = pow2(roughness); // UE4's roughness\n vec3 halfDir = normalize( lightDir + viewDir);\n float dotNL = saturate(dot(normal, lightDir));\n float dotNV = saturate(dot(normal, viewDir));\n float dotNH = saturate(dot(normal, halfDir));\n float dotVH = saturate(dot(viewDir, halfDir));\n vec3 F = F_Schlick(f0, f90, dotVH);\n float V = V_GGX_SmithCorrelated(alpha, dotNL, dotNV);\n float D = D_GGX(alpha, dotNH);\n return F * (V * D);\n}\n\n// Analytical approximation of the DFG LUT, one half of the\n// split-sum approximation used in indirect specular lighting.\n// via 'environmentBRDF' from \"Physically Based Shading on Mobile\"\n// https://www.unrealengine.com/blog/physically-based-shading-on-mobile\nvec2 DFGApprox(const in vec3 normal, const in vec3 viewDir, const in float roughness) {\n float dotNV = saturate(dot(normal, viewDir));\n const vec4 c0 = vec4(-1, -0.0275, -0.572, 0.022);\n const vec4 c1 = vec4(1, 0.0425, 1.04, -0.04);\n vec4 r = roughness * c0 + c1;\n float a004 = min(r.x * r.x, exp2(-9.28 * dotNV)) * r.x + r.y;\n vec2 fab = vec2(-1.04, 1.04) * a004 + r.zw;\n return fab;\n}\n\n// Fdez-Ag\u00FCera's \"Multiple-Scattering Microfacet Model for Real-Time Image Based Lighting\"\n// Approximates multiscattering in order to preserve energy.\n// http://www.jcgt.org/published/0008/01/03/\nvoid computeMultiscattering(const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter) {\n vec2 fab = DFGApprox(normal, viewDir, roughness);\n vec3 FssEss = specularColor * fab.x + specularF90 * fab.y;\n float Ess = fab.x + fab.y;\n float Ems = 1.0 - Ess;\n vec3 Favg = specularColor + (1.0 - specularColor) * 0.047619; // 1/21\n vec3 Fms = FssEss * Favg / (1.0 - Ems * Favg);\n singleScatter += FssEss;\n multiScatter += Fms * Ems;\n}\n\nvoid RE_Direct_Physical(const in IncidentLight directLight, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n float dotNL = saturate(dot(geometry.normal, directLight.direction));\n vec3 irradiance = dotNL * directLight.color;\n reflectedLight.directSpecular += irradiance * BRDF_GGX(directLight.direction, geometry.viewDir, geometry.normal, material.specularColor, material.specularF90, material.roughness);\n reflectedLight.directDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectDiffuse_Physical(const in vec3 irradiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert(material.diffuseColor);\n}\n\nvoid RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in GeometricContext geometry, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {\n // Both indirect specular and indirect diffuse light accumulate here\n vec3 singleScattering = vec3(0.0);\n vec3 multiScattering = vec3(0.0);\n vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;\n computeMultiscattering(geometry.normal, geometry.viewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering);\n vec3 diffuse = material.diffuseColor * (1.0 - ( singleScattering + multiScattering));\n reflectedLight.indirectSpecular += radiance * singleScattering;\n reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;\n reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;\n}\n";
13
13
  //# sourceMappingURL=light-frag-params.glsl.js.map
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const cylinders_frag = "\nprecision highp float;\nprecision highp int;\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec4 intersection, out bool interior\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard*bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n } else if(bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n }\n\n #ifdef dDoubleSided\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n // TODO: handle inside caps???\n #endif\n\n return false;\n}\n\nvoid main() {\n #include clip_pixel\n\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec4 intersection;\n bool interior;\n bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);\n if (!hit) discard;\n\n vec3 vViewPosition = vModelPosition + intersection.x * rayDir;\n vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n\n // bugfix (mac only?)\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const cylinders_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\nuniform mat4 uInvView;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec4 intersection, out bool interior\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard*bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n } else if(bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n }\n\n #ifdef dDoubleSided\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n // TODO: handle inside caps???\n #endif\n\n return false;\n}\n\nvoid main() {\n #include clip_pixel\n\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec4 intersection;\n bool interior;\n bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);\n if (!hit) discard;\n\n vec3 vViewPosition = vModelPosition + intersection.x * rayDir;\n vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -6,5 +6,5 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.cylinders_frag = void 0;
9
- exports.cylinders_frag = "\nprecision highp float;\nprecision highp int;\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec4 intersection, out bool interior\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard*bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n } else if(bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n }\n\n #ifdef dDoubleSided\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n // TODO: handle inside caps???\n #endif\n\n return false;\n}\n\nvoid main() {\n #include clip_pixel\n\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec4 intersection;\n bool interior;\n bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);\n if (!hit) discard;\n\n vec3 vViewPosition = vModelPosition + intersection.x * rayDir;\n vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n\n // bugfix (mac only?)\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.cylinders_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\nuniform mat4 uView;\n\nvarying mat4 vTransform;\nvarying vec3 vStart;\nvarying vec3 vEnd;\nvarying float vSize;\nvarying float vCap;\n\nuniform vec3 uCameraDir;\nuniform vec3 uCameraPosition;\nuniform mat4 uInvView;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\n// adapted from https://www.shadertoy.com/view/4lcSRn\n// The MIT License, Copyright 2016 Inigo Quilez\nbool CylinderImpostor(\n in vec3 rayOrigin, in vec3 rayDir,\n in vec3 start, in vec3 end, in float radius,\n out vec4 intersection, out bool interior\n){\n vec3 ba = end - start;\n vec3 oc = rayOrigin - start;\n\n float baba = dot(ba, ba);\n float bard = dot(ba, rayDir);\n float baoc = dot(ba, oc);\n\n float k2 = baba - bard*bard;\n float k1 = baba * dot(oc, rayDir) - baoc * bard;\n float k0 = baba * dot(oc, oc) - baoc * baoc - radius * radius * baba;\n\n float h = k1 * k1 - k2 * k0;\n if (h < 0.0) return false;\n\n bool topCap = (vCap > 0.9 && vCap < 1.1) || vCap >= 2.9;\n bool bottomCap = (vCap > 1.9 && vCap < 2.1) || vCap >= 2.9;\n\n // body outside\n h = sqrt(h);\n float t = (-k1 - h) / k2;\n float y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = false;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n if (topCap && y < 0.0) {\n // top cap\n t = -baoc / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n } else if(bottomCap && y >= 0.0) {\n // bottom cap\n t = (baba - baoc) / bard;\n if (abs(k1 + k2 * t) < h) {\n interior = false;\n intersection = vec4(t, ba * sign(y) / baba);\n return true;\n }\n }\n\n #ifdef dDoubleSided\n // body inside\n h = -h;\n t = (-k1 - h) / k2;\n y = baoc + t * bard;\n if (y > 0.0 && y < baba) {\n interior = true;\n intersection = vec4(t, (oc + t * rayDir - ba * y / baba) / radius);\n return true;\n }\n\n // TODO: handle inside caps???\n #endif\n\n return false;\n}\n\nvoid main() {\n #include clip_pixel\n\n vec3 rayDir = mix(normalize(vModelPosition - uCameraPosition), uCameraDir, uIsOrtho);\n\n vec4 intersection;\n bool interior;\n bool hit = CylinderImpostor(vModelPosition, rayDir, vStart, vEnd, vSize, intersection, interior);\n if (!hit) discard;\n\n vec3 vViewPosition = vModelPosition + intersection.x * rayDir;\n vViewPosition = (uView * vec4(vViewPosition, 1.0)).xyz;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n mat3 normalMatrix = transpose3(inverse3(mat3(uView)));\n vec3 normal = normalize(normalMatrix * -normalize(intersection.yzw));\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
10
10
  //# sourceMappingURL=cylinders.frag.js.map
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n #ifdef dDoubleSided\n normal = normal * (float(frontFacing) * 2.0 - 1.0);\n #endif\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n #ifdef dDoubleSided\n normal = normal * (float(frontFacing) * 2.0 - 1.0);\n #endif\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -6,5 +6,5 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.mesh_frag = void 0;
9
- exports.mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n #ifdef dDoubleSided\n normal = normal * (float(frontFacing) * 2.0 - 1.0);\n #endif\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.mesh_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include normal_frag_params\n#include common_clip\n\nvoid main() {\n #include clip_pixel\n\n // Workaround for buggy gl_FrontFacing (e.g. on some integrated Intel GPUs)\n vec3 fdx = dFdx(vViewPosition);\n vec3 fdy = dFdy(vViewPosition);\n vec3 faceNormal = normalize(cross(fdx,fdy));\n bool frontFacing = dot(vNormal, faceNormal) > 0.0;\n\n #if defined(dFlipSided)\n interior = frontFacing;\n #else\n interior = !frontFacing;\n #endif\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n vec3 normal = -faceNormal;\n #else\n vec3 normal = -normalize(vNormal);\n #ifdef dDoubleSided\n normal = normal * (float(frontFacing) * 2.0 - 1.0);\n #endif\n #endif\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
10
10
  //# sourceMappingURL=mesh.frag.js.map
@@ -4,4 +4,4 @@
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  * @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
6
6
  */
7
- export declare const postprocessing_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform bool uTransparentBackground;\n\nuniform float uOcclusionBias;\nuniform float uOcclusionRadius;\n\nuniform float uMaxPossibleViewZDiff;\n\nconst vec3 occlusionColor = vec3(0.0);\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, out float closestTexel) {\n float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepth = getDepth(coords);\n float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return outline;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n\n #ifdef dOcclusionEnable\n float depth = getDepth(coords);\n if (!isBackground(depth)) {\n viewDist = abs(getViewZ(depth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, closestTexel);\n\n if (outline == 0.0) {\n color.rgb *= outline;\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(color.rgb, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n";
7
+ export declare const postprocessing_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform vec3 uOutlineColor;\nuniform bool uTransparentBackground;\n\nuniform float uOcclusionBias;\nuniform float uOcclusionRadius;\n\nuniform float uMaxPossibleViewZDiff;\n\nconst vec3 occlusionColor = vec3(0.0);\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, out float closestTexel) {\n float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepth = getDepth(coords);\n float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return outline;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n\n #ifdef dOcclusionEnable\n float depth = getDepth(coords);\n if (!isBackground(depth)) {\n viewDist = abs(getViewZ(depth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, closestTexel);\n\n if (outline == 0.0) {\n color.rgb = mix(uOutlineColor, color.rgb, outline);\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(color.rgb, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n";
@@ -7,5 +7,5 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.postprocessing_frag = void 0;
10
- exports.postprocessing_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform bool uTransparentBackground;\n\nuniform float uOcclusionBias;\nuniform float uOcclusionRadius;\n\nuniform float uMaxPossibleViewZDiff;\n\nconst vec3 occlusionColor = vec3(0.0);\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, out float closestTexel) {\n float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepth = getDepth(coords);\n float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return outline;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n\n #ifdef dOcclusionEnable\n float depth = getDepth(coords);\n if (!isBackground(depth)) {\n viewDist = abs(getViewZ(depth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, closestTexel);\n\n if (outline == 0.0) {\n color.rgb *= outline;\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(color.rgb, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n";
10
+ exports.postprocessing_frag = "\nprecision highp float;\nprecision highp int;\nprecision highp sampler2D;\n\nuniform sampler2D tSsaoDepth;\nuniform sampler2D tColor;\nuniform sampler2D tDepth;\nuniform sampler2D tOutlines;\nuniform vec2 uTexSize;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\nuniform vec3 uOutlineColor;\nuniform bool uTransparentBackground;\n\nuniform float uOcclusionBias;\nuniform float uOcclusionRadius;\n\nuniform float uMaxPossibleViewZDiff;\n\nconst vec3 occlusionColor = vec3(0.0);\n\n#include common\n\nfloat getViewZ(const in float depth) {\n #if dOrthographic == 1\n return orthographicDepthToViewZ(depth, uNear, uFar);\n #else\n return perspectiveDepthToViewZ(depth, uNear, uFar);\n #endif\n}\n\nfloat getDepth(const in vec2 coords) {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n}\n\nbool isBackground(const in float depth) {\n return depth == 1.0;\n}\n\nfloat getOutline(const in vec2 coords, out float closestTexel) {\n float backgroundViewZ = uFar + 3.0 * uMaxPossibleViewZDiff;\n vec2 invTexSize = 1.0 / uTexSize;\n\n float selfDepth = getDepth(coords);\n float selfViewZ = isBackground(selfDepth) ? backgroundViewZ : getViewZ(selfDepth);\n\n float outline = 1.0;\n closestTexel = 1.0;\n for (int y = -dOutlineScale; y <= dOutlineScale; y++) {\n for (int x = -dOutlineScale; x <= dOutlineScale; x++) {\n if (x * x + y * y > dOutlineScale * dOutlineScale) {\n continue;\n }\n\n vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;\n\n vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);\n float sampleOutline = sampleOutlineCombined.r;\n float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);\n\n if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel && abs(selfViewZ - sampleOutlineDepth) > uMaxPossibleViewZDiff) {\n outline = 0.0;\n closestTexel = sampleOutlineDepth;\n }\n }\n }\n return outline;\n}\n\nfloat getSsao(vec2 coords) {\n float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);\n if (rawSsao > 0.999) {\n return 1.0;\n } else if (rawSsao > 0.001) {\n return rawSsao;\n }\n // treat values close to 0.0 as errors and return no occlusion\n return 1.0;\n}\n\nvoid main(void) {\n vec2 coords = gl_FragCoord.xy / uTexSize;\n vec4 color = texture2D(tColor, coords);\n\n float viewDist;\n float fogFactor;\n\n #ifdef dOcclusionEnable\n float depth = getDepth(coords);\n if (!isBackground(depth)) {\n viewDist = abs(getViewZ(depth));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n float occlusionFactor = getSsao(coords);\n if (!uTransparentBackground) {\n color.rgb = mix(mix(occlusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);\n } else {\n color.rgb = mix(occlusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);\n }\n }\n #endif\n\n // outline needs to be handled after occlusion to keep them clean\n #ifdef dOutlineEnable\n float closestTexel;\n float outline = getOutline(coords, closestTexel);\n\n if (outline == 0.0) {\n color.rgb = mix(uOutlineColor, color.rgb, outline);\n viewDist = abs(getViewZ(closestTexel));\n fogFactor = smoothstep(uFogNear, uFogFar, viewDist);\n if (!uTransparentBackground) {\n color.rgb = mix(color.rgb, uFogColor, fogFactor);\n } else {\n color.a = 1.0 - fogFactor;\n }\n }\n #endif\n\n gl_FragColor = color;\n}\n";
11
11
  //# sourceMappingURL=postprocessing.frag.js.map
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n #ifndef dDoubleSided\n if (interior)\n discard;\n #endif\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n // bugfix (mac only?)\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n #ifndef dDoubleSided\n if (interior)\n discard;\n #endif\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -6,5 +6,5 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.spheres_frag = void 0;
9
- exports.spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n #ifndef dDoubleSided\n if (interior)\n discard;\n #endif\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n // bugfix (mac only?)\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.spheres_frag = "\nprecision highp float;\nprecision highp int;\n\n#define bumpEnabled\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include light_frag_params\n#include common_clip\n\nuniform mat4 uInvView;\n\nvarying float vRadius;\nvarying float vRadiusSq;\nvarying vec3 vPoint;\nvarying vec3 vPointViewPosition;\n\nvec3 cameraPos;\nvec3 cameraNormal;\n\nbool Impostor(out vec3 cameraPos, out vec3 cameraNormal){\n vec3 cameraSpherePos = -vPointViewPosition;\n cameraSpherePos.z += vRadius;\n\n vec3 rayOrigin = mix(vec3(0.0, 0.0, 0.0), vPoint, uIsOrtho);\n vec3 rayDirection = mix(normalize(vPoint), vec3(0.0, 0.0, 1.0), uIsOrtho);\n vec3 cameraSphereDir = mix(cameraSpherePos, rayOrigin - cameraSpherePos, uIsOrtho);\n\n float B = dot(rayDirection, cameraSphereDir);\n float det = B * B + vRadiusSq - dot(cameraSphereDir, cameraSphereDir);\n\n if (det < 0.0){\n discard;\n return false;\n }\n\n float sqrtDet = sqrt(det);\n float posT = mix(B + sqrtDet, B + sqrtDet, uIsOrtho);\n float negT = mix(B - sqrtDet, sqrtDet - B, uIsOrtho);\n\n cameraPos = rayDirection * negT + rayOrigin;\n\n\n if (calcDepth(cameraPos) <= 0.0) {\n cameraPos = rayDirection * posT + rayOrigin;\n interior = true;\n } else {\n interior = false;\n }\n\n cameraNormal = normalize(cameraPos - cameraSpherePos);\n cameraNormal *= float(!interior) * 2.0 - 1.0;\n\n return !interior;\n}\n\nvoid main(void){\n #include clip_pixel\n\n bool flag = Impostor(cameraPos, cameraNormal);\n #ifndef dDoubleSided\n if (interior)\n discard;\n #endif\n\n vec3 vViewPosition = cameraPos;\n gl_FragDepthEXT = calcDepth(vViewPosition);\n if (!flag && gl_FragDepthEXT >= 0.0) {\n gl_FragDepthEXT = 0.0 + (0.0000001 / vRadius);\n }\n\n vec3 vModelPosition = (uInvView * vec4(vViewPosition, 1.0)).xyz;\n\n if (gl_FragDepthEXT < 0.0) discard;\n if (gl_FragDepthEXT > 1.0) discard;\n\n float fragmentDepth = gl_FragDepthEXT;\n #include assign_material_color\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n gl_FragColor = material;\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n vec3 normal = -cameraNormal;\n #include apply_light_color\n #endif\n\n #include apply_interior_color\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
10
10
  //# sourceMappingURL=spheres.frag.js.map
@@ -204,9 +204,13 @@ var Model;
204
204
  if (!mmcif_1.MmcifFormat.is(model.sourceData))
205
205
  return false;
206
206
  var db = model.sourceData.data.db;
207
- return (db.database_2.database_id.isDefined ||
208
- // 4 character PDB id
209
- model.entryId.match(/^[1-9][a-z0-9]{3,3}$/i) !== null ||
207
+ for (var i = 0, il = db.database_2.database_id.rowCount; i < il; ++i) {
208
+ if (db.database_2.database_id.value(i) === 'PDB')
209
+ return true;
210
+ }
211
+ return (
212
+ // 4 character PDB id
213
+ model.entryId.match(/^[1-9][a-z0-9]{3,3}$/i) !== null ||
210
214
  // long PDB id
211
215
  model.entryId.match(/^pdb_[0-9]{4,4}[1-9][a-z0-9]{3,3}$/i) !== null);
212
216
  }
@@ -30,11 +30,14 @@ export declare const PlyShapeParams: {
30
30
  flatShaded: PD.BooleanParam;
31
31
  ignoreLight: PD.BooleanParam;
32
32
  xrayShaded: PD.BooleanParam;
33
+ bumpFrequency: PD.Numeric;
34
+ bumpAmplitude: PD.Numeric;
33
35
  alpha: PD.Numeric;
34
36
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
35
37
  material: PD.Group<PD.Normalize<{
36
38
  metalness: number;
37
39
  roughness: number;
40
+ bumpiness: number;
38
41
  }>>;
39
42
  };
40
43
  export declare type PlyShapeParams = typeof PlyShapeParams;
@@ -58,10 +61,13 @@ export declare function shapeFromPly(source: PlyFile, params?: {}): Task<ShapePr
58
61
  flatShaded: PD.BooleanParam;
59
62
  ignoreLight: PD.BooleanParam;
60
63
  xrayShaded: PD.BooleanParam;
64
+ bumpFrequency: PD.Numeric;
65
+ bumpAmplitude: PD.Numeric;
61
66
  alpha: PD.Numeric;
62
67
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
63
68
  material: PD.Group<PD.Normalize<{
64
69
  metalness: number;
65
70
  roughness: number;
71
+ bumpiness: number;
66
72
  }>>;
67
73
  }>>;
@@ -25,11 +25,14 @@ export declare const InteractionsInterUnitParams: {
25
25
  flatShaded: PD.BooleanParam;
26
26
  ignoreLight: PD.BooleanParam;
27
27
  xrayShaded: PD.BooleanParam;
28
+ bumpFrequency: PD.Numeric;
29
+ bumpAmplitude: PD.Numeric;
28
30
  alpha: PD.Numeric;
29
31
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
30
32
  material: PD.Group<PD.Normalize<{
31
33
  metalness: number;
32
34
  roughness: number;
35
+ bumpiness: number;
33
36
  }>>;
34
37
  };
35
38
  export declare type InteractionsInterUnitParams = typeof InteractionsInterUnitParams;
@@ -25,11 +25,14 @@ export declare const InteractionsIntraUnitParams: {
25
25
  flatShaded: PD.BooleanParam;
26
26
  ignoreLight: PD.BooleanParam;
27
27
  xrayShaded: PD.BooleanParam;
28
+ bumpFrequency: PD.Numeric;
29
+ bumpAmplitude: PD.Numeric;
28
30
  alpha: PD.Numeric;
29
31
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
30
32
  material: PD.Group<PD.Normalize<{
31
33
  metalness: number;
32
34
  roughness: number;
35
+ bumpiness: number;
33
36
  }>>;
34
37
  };
35
38
  export declare type InteractionsIntraUnitParams = typeof InteractionsIntraUnitParams;
@@ -29,11 +29,14 @@ export declare const InteractionsParams: {
29
29
  flatShaded: PD.BooleanParam;
30
30
  ignoreLight: PD.BooleanParam;
31
31
  xrayShaded: PD.BooleanParam;
32
+ bumpFrequency: PD.Numeric;
33
+ bumpAmplitude: PD.Numeric;
32
34
  alpha: PD.Numeric;
33
35
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
34
36
  material: PD.Group<PD.Normalize<{
35
37
  metalness: number;
36
38
  roughness: number;
39
+ bumpiness: number;
37
40
  }>>;
38
41
  };
39
42
  export declare type InteractionsParams = typeof InteractionsParams;
@@ -58,11 +61,14 @@ export declare function getInteractionParams(ctx: ThemeRegistryContext, structur
58
61
  flatShaded: PD.BooleanParam;
59
62
  ignoreLight: PD.BooleanParam;
60
63
  xrayShaded: PD.BooleanParam;
64
+ bumpFrequency: PD.Numeric;
65
+ bumpAmplitude: PD.Numeric;
61
66
  alpha: PD.Numeric;
62
67
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
63
68
  material: PD.Group<PD.Normalize<{
64
69
  metalness: number;
65
70
  roughness: number;
71
+ bumpiness: number;
66
72
  }>>;
67
73
  };
68
74
  export declare type InteractionRepresentation = StructureRepresentation<InteractionsParams>;
@@ -88,10 +94,13 @@ export declare const InteractionsRepresentationProvider: StructureRepresentation
88
94
  flatShaded: PD.BooleanParam;
89
95
  ignoreLight: PD.BooleanParam;
90
96
  xrayShaded: PD.BooleanParam;
97
+ bumpFrequency: PD.Numeric;
98
+ bumpAmplitude: PD.Numeric;
91
99
  alpha: PD.Numeric;
92
100
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
93
101
  material: PD.Group<PD.Normalize<{
94
102
  metalness: number;
95
103
  roughness: number;
104
+ bumpiness: number;
96
105
  }>>;
97
106
  }, "interactions">;
@@ -30,11 +30,14 @@ export declare const CrossLinkRestraintCylinderParams: {
30
30
  flatShaded: PD.BooleanParam;
31
31
  ignoreLight: PD.BooleanParam;
32
32
  xrayShaded: PD.BooleanParam;
33
+ bumpFrequency: PD.Numeric;
34
+ bumpAmplitude: PD.Numeric;
33
35
  alpha: PD.Numeric;
34
36
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
35
37
  material: PD.Group<PD.Normalize<{
36
38
  metalness: number;
37
39
  roughness: number;
40
+ bumpiness: number;
38
41
  }>>;
39
42
  };
40
43
  export declare type CrossLinkRestraintCylinderParams = typeof CrossLinkRestraintCylinderParams;
@@ -59,11 +62,14 @@ export declare const CrossLinkRestraintParams: {
59
62
  flatShaded: PD.BooleanParam;
60
63
  ignoreLight: PD.BooleanParam;
61
64
  xrayShaded: PD.BooleanParam;
65
+ bumpFrequency: PD.Numeric;
66
+ bumpAmplitude: PD.Numeric;
62
67
  alpha: PD.Numeric;
63
68
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
64
69
  material: PD.Group<PD.Normalize<{
65
70
  metalness: number;
66
71
  roughness: number;
72
+ bumpiness: number;
67
73
  }>>;
68
74
  };
69
75
  export declare type CrossLinkRestraintParams = typeof CrossLinkRestraintParams;
@@ -87,11 +93,14 @@ export declare function getCrossLinkRestraintParams(ctx: ThemeRegistryContext, s
87
93
  flatShaded: PD.BooleanParam;
88
94
  ignoreLight: PD.BooleanParam;
89
95
  xrayShaded: PD.BooleanParam;
96
+ bumpFrequency: PD.Numeric;
97
+ bumpAmplitude: PD.Numeric;
90
98
  alpha: PD.Numeric;
91
99
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
92
100
  material: PD.Group<PD.Normalize<{
93
101
  metalness: number;
94
102
  roughness: number;
103
+ bumpiness: number;
95
104
  }>>;
96
105
  };
97
106
  export declare type CrossLinkRestraintRepresentation = StructureRepresentation<CrossLinkRestraintParams>;
@@ -116,10 +125,13 @@ export declare const CrossLinkRestraintRepresentationProvider: StructureRepresen
116
125
  flatShaded: PD.BooleanParam;
117
126
  ignoreLight: PD.BooleanParam;
118
127
  xrayShaded: PD.BooleanParam;
128
+ bumpFrequency: PD.Numeric;
129
+ bumpAmplitude: PD.Numeric;
119
130
  alpha: PD.Numeric;
120
131
  quality: PD.Select<"auto" | "medium" | "high" | "low" | "custom" | "highest" | "higher" | "lower" | "lowest">;
121
132
  material: PD.Group<PD.Normalize<{
122
133
  metalness: number;
123
134
  roughness: number;
135
+ bumpiness: number;
124
136
  }>>;
125
137
  }, CrossLinkRestraint.Tag>;
@@ -24,6 +24,7 @@ declare const StructureFocusRepresentationParams: (plugin: PluginContext) => {
24
24
  material: PD.Group<PD.Normalize<{
25
25
  metalness: number;
26
26
  roughness: number;
27
+ bumpiness: number;
27
28
  }>>;
28
29
  };
29
30
  declare type StructureFocusRepresentationProps = PD.ValuesFor<ReturnType<typeof StructureFocusRepresentationParams>>;
@@ -9,12 +9,12 @@ import { Volume } from '../../../../mol-model/volume';
9
9
  import { Structure } from '../../../../mol-model/structure';
10
10
  declare const VolumeServerInfo_base: {
11
11
  new (data: VolumeServerInfo.Data, props?: {
12
- label: string; /** Precision data the server can show. */
12
+ /** Precision data the server can show. */
13
+ label: string;
13
14
  description?: string | undefined;
14
15
  } | undefined): {
15
16
  id: import("../../../../mol-util/uuid").UUID;
16
17
  type: PluginStateObject.TypeInfo;
17
- /** The value are stored in blockSize^3 cubes */
18
18
  label: string;
19
19
  description?: string | undefined;
20
20
  data: VolumeServerInfo.Data;
@@ -23,7 +23,6 @@ declare const VolumeServerInfo_base: {
23
23
  is(obj?: import("../../../../mol-state/object").StateObject<any, import("../../../../mol-state/object").StateObject.Type<any>> | undefined): obj is {
24
24
  id: import("../../../../mol-util/uuid").UUID;
25
25
  type: PluginStateObject.TypeInfo;
26
- /** The value are stored in blockSize^3 cubes */
27
26
  label: string;
28
27
  description?: string | undefined;
29
28
  data: VolumeServerInfo.Data;
@@ -232,6 +232,7 @@ export declare const PluginCommands: {
232
232
  outline: import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<unknown>, "off"> | import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<{
233
233
  scale: any;
234
234
  threshold: any;
235
+ color: any;
235
236
  }>, "on">;
236
237
  antialiasing: import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<unknown>, "off"> | import("../mol-util/param-definition").ParamDefinition.NamedParams<import("../mol-util/param-definition").ParamDefinition.Normalize<{
237
238
  edgeThreshold: any;
@@ -329,6 +330,8 @@ export declare const PluginCommands: {
329
330
  flipSided: any;
330
331
  flatShaded: any;
331
332
  xrayShaded: any;
333
+ bumpFrequency: any;
334
+ bumpAmplitude: any;
332
335
  quality: any;
333
336
  material: any;
334
337
  }>, "on">;
@@ -16,6 +16,7 @@ export declare class PluginConfigItem<T = any> {
16
16
  constructor(key: string, defaultValue?: T | undefined);
17
17
  }
18
18
  declare function item<T>(key: string, defaultValue?: T): PluginConfigItem<T>;
19
+ export declare function preferWebGl1(): boolean;
19
20
  export declare const PluginConfig: {
20
21
  item: typeof item;
21
22
  General: {
@@ -6,7 +6,7 @@
6
6
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.PluginConfigManager = exports.PluginConfig = exports.PluginConfigItem = void 0;
9
+ exports.PluginConfigManager = exports.PluginConfig = exports.preferWebGl1 = exports.PluginConfigItem = void 0;
10
10
  var structure_1 = require("../mol-model/structure");
11
11
  var PluginConfigItem = /** @class */ (function () {
12
12
  function PluginConfigItem(key, defaultValue) {
@@ -22,9 +22,14 @@ function item(key, defaultValue) { return new PluginConfigItem(key, defaultValue
22
22
  function preferWebGl1() {
23
23
  if (typeof navigator === 'undefined' || typeof window === 'undefined')
24
24
  return false;
25
- // WebGL2 isn't working in MacOS 12.0.1 Safari 15.1 (but is working in Safari tech preview)
25
+ // WebGL2 isn't working in MacOS 12.0.1 Safari 15.1, 15.2. It is working in Safari 15.4 tech preview, so disabling all versions before that.
26
26
  // prefer webgl 1 based on the userAgent substring
27
- if (navigator.userAgent.indexOf('Version/15.1 Safari') > 0) {
27
+ var unpportedSafariVersions = [
28
+ 'Version/15.1 Safari',
29
+ 'Version/15.2 Safari',
30
+ 'Version/15.3 Safari'
31
+ ];
32
+ if (unpportedSafariVersions.some(function (v) { return navigator.userAgent.indexOf(v) > 0; })) {
28
33
  return true;
29
34
  }
30
35
  // Check for iOS device which enabled WebGL2 recently but it doesn't seem
@@ -35,6 +40,7 @@ function preferWebGl1() {
35
40
  var isTouchScreen = navigator.maxTouchPoints >= 4; // true for iOS 13 (and hopefully beyond)
36
41
  return !window.MSStream && (isIOS || (isAppleDevice && isTouchScreen));
37
42
  }
43
+ exports.preferWebGl1 = preferWebGl1;
38
44
  exports.PluginConfig = {
39
45
  item: item,
40
46
  General: {