molstar 3.5.0 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (284) hide show
  1. package/build/viewer/index.html +1 -1
  2. package/build/viewer/molstar.js +1 -1
  3. package/build/viewer/molstar.js.LICENSE.txt +12 -14
  4. package/lib/apps/docking-viewer/index.js +1 -1
  5. package/lib/apps/viewer/app.js +1 -1
  6. package/lib/apps/viewer/index.html +1 -1
  7. package/lib/cli/chem-comp-dict/util.d.ts +20 -20
  8. package/lib/cli/cifschema/util/cif-dic.d.ts +1 -1
  9. package/lib/cli/cifschema/util/cif-dic.js +7 -5
  10. package/lib/cli/cifschema/util/generate.d.ts +1 -1
  11. package/lib/cli/cifschema/util/generate.js +12 -3
  12. package/lib/cli/cifschema/util/schema.d.ts +3 -3
  13. package/lib/cli/cifschema/util/schema.js +1 -1
  14. package/lib/commonjs/apps/docking-viewer/index.js +2 -2
  15. package/lib/commonjs/apps/viewer/app.js +2 -2
  16. package/lib/commonjs/cli/chem-comp-dict/util.d.ts +20 -20
  17. package/lib/commonjs/cli/cifschema/util/cif-dic.d.ts +1 -1
  18. package/lib/commonjs/cli/cifschema/util/cif-dic.js +7 -5
  19. package/lib/commonjs/cli/cifschema/util/generate.d.ts +1 -1
  20. package/lib/commonjs/cli/cifschema/util/generate.js +12 -3
  21. package/lib/commonjs/cli/cifschema/util/schema.d.ts +3 -3
  22. package/lib/commonjs/cli/cifschema/util/schema.js +1 -1
  23. package/lib/commonjs/examples/alpha-orbitals/index.js +2 -2
  24. package/lib/commonjs/examples/basic-wrapper/index.js +2 -2
  25. package/lib/commonjs/examples/lighting/index.js +2 -2
  26. package/lib/commonjs/examples/proteopedia-wrapper/index.js +2 -2
  27. package/lib/commonjs/extensions/anvil/behavior.d.ts +1 -0
  28. package/lib/commonjs/extensions/anvil/representation.d.ts +4 -0
  29. package/lib/commonjs/extensions/cellpack/representation.d.ts +1 -0
  30. package/lib/commonjs/extensions/dnatco/confal-pyramids/representation.d.ts +3 -0
  31. package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +1 -0
  32. package/lib/commonjs/extensions/rcsb/assembly-symmetry/representation.d.ts +1 -0
  33. package/lib/commonjs/extensions/rcsb/validation-report/representation.d.ts +5 -0
  34. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +2 -0
  35. package/lib/commonjs/mol-canvas3d/helper/camera-helper.d.ts +1 -0
  36. package/lib/commonjs/mol-canvas3d/helper/handle-helper.d.ts +1 -0
  37. package/lib/commonjs/mol-canvas3d/helper/helper.d.ts +2 -0
  38. package/lib/commonjs/mol-canvas3d/passes/image.d.ts +1 -0
  39. package/lib/commonjs/mol-data/db/column.d.ts +10 -3
  40. package/lib/commonjs/mol-data/db/column.js +39 -17
  41. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.d.ts +4 -2
  42. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +2 -2
  43. package/lib/commonjs/mol-geo/geometry/mesh/mesh.d.ts +2 -1
  44. package/lib/commonjs/mol-geo/geometry/mesh/mesh.js +2 -2
  45. package/lib/commonjs/mol-geo/geometry/spheres/spheres.d.ts +2 -1
  46. package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +2 -2
  47. package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +2 -1
  48. package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.js +2 -2
  49. package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.d.ts +2 -2
  50. package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +2 -2
  51. package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  52. package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
  53. package/lib/commonjs/mol-gl/shader/image.frag.d.ts +2 -2
  54. package/lib/commonjs/mol-gl/shader/image.frag.js +2 -2
  55. package/lib/commonjs/mol-gl/shader/lines.frag.d.ts +2 -2
  56. package/lib/commonjs/mol-gl/shader/lines.frag.js +2 -2
  57. package/lib/commonjs/mol-gl/shader/points.frag.d.ts +2 -2
  58. package/lib/commonjs/mol-gl/shader/points.frag.js +2 -2
  59. package/lib/commonjs/mol-gl/shader/text.frag.d.ts +2 -2
  60. package/lib/commonjs/mol-gl/shader/text.frag.js +2 -2
  61. package/lib/commonjs/mol-gl/webgl/buffer.d.ts +2 -2
  62. package/lib/commonjs/mol-gl/webgl/buffer.js +12 -12
  63. package/lib/commonjs/mol-gl/webgl/program.d.ts +1 -1
  64. package/lib/commonjs/mol-gl/webgl/program.js +10 -4
  65. package/lib/commonjs/mol-io/reader/cif/schema/bird.d.ts +8 -8
  66. package/lib/commonjs/mol-io/reader/cif/schema/bird.js +12 -11
  67. package/lib/commonjs/mol-io/reader/cif/schema/ccd-extras.d.ts +1 -1
  68. package/lib/commonjs/mol-io/reader/cif/schema/ccd.d.ts +12 -12
  69. package/lib/commonjs/mol-io/reader/cif/schema/ccd.js +13 -12
  70. package/lib/commonjs/mol-io/reader/cif/schema/mmcif-extras.d.ts +5 -5
  71. package/lib/commonjs/mol-io/reader/cif/schema/mmcif-extras.js +2 -2
  72. package/lib/commonjs/mol-io/reader/cif/schema/mmcif.d.ts +30 -26
  73. package/lib/commonjs/mol-io/reader/cif/schema/mmcif.js +44 -39
  74. package/lib/commonjs/mol-io/reader/cif/schema.d.ts +1 -1
  75. package/lib/commonjs/mol-io/reader/cif/schema.js +22 -2
  76. package/lib/commonjs/mol-io/writer/mol/encoder.js +1 -1
  77. package/lib/commonjs/mol-model/structure/model/model.js +14 -6
  78. package/lib/commonjs/mol-model/structure/model/properties/common.js +1 -1
  79. package/lib/commonjs/mol-model/structure/model/types.d.ts +19 -17
  80. package/lib/commonjs/mol-model/structure/model/types.js +30 -31
  81. package/lib/commonjs/mol-model/structure/query/queries/generators.js +1 -1
  82. package/lib/commonjs/mol-model/structure/structure/properties.d.ts +1 -1
  83. package/lib/commonjs/mol-model/structure/structure/unit/bonds/inter-compute.js +2 -4
  84. package/lib/commonjs/mol-model/structure/structure/unit/bonds/intra-compute.js +1 -3
  85. package/lib/commonjs/mol-model/structure/structure/unit/rings.js +3 -0
  86. package/lib/commonjs/mol-model-formats/shape/ply.d.ts +2 -0
  87. package/lib/commonjs/mol-model-formats/structure/basic/entities.js +1 -1
  88. package/lib/commonjs/mol-model-formats/structure/basic/schema.d.ts +2 -2
  89. package/lib/commonjs/mol-model-formats/structure/common/component.d.ts +3 -3
  90. package/lib/commonjs/mol-model-formats/structure/common/component.js +46 -46
  91. package/lib/commonjs/mol-model-formats/structure/pdb/atom-site.d.ts +2 -2
  92. package/lib/commonjs/mol-model-formats/structure/pdb/atom-site.js +72 -7
  93. package/lib/commonjs/mol-model-formats/structure/pdb/secondary-structure.js +11 -11
  94. package/lib/commonjs/mol-model-formats/structure/pdb/to-cif.js +7 -2
  95. package/lib/commonjs/mol-model-formats/structure/property/bonds/chem_comp.js +1 -1
  96. package/lib/commonjs/mol-model-formats/structure/property/bonds/struct_conn.js +1 -1
  97. package/lib/commonjs/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +1 -0
  98. package/lib/commonjs/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +1 -0
  99. package/lib/commonjs/mol-model-props/computed/representations/interactions.d.ts +3 -0
  100. package/lib/commonjs/mol-model-props/integrative/cross-link-restraint/representation.d.ts +4 -0
  101. package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/util.js +3 -2
  102. package/lib/commonjs/mol-plugin/commands.d.ts +1 -0
  103. package/lib/commonjs/mol-plugin/util/viewport-screenshot.d.ts +3 -0
  104. package/lib/commonjs/mol-plugin-state/actions/structure.d.ts +6 -6
  105. package/lib/commonjs/mol-plugin-state/helpers/structure-selection-query.d.ts +1 -1
  106. package/lib/commonjs/mol-plugin-state/helpers/structure-selection-query.js +1 -1
  107. package/lib/commonjs/mol-plugin-state/transforms/representation.d.ts +6 -0
  108. package/lib/commonjs/mol-plugin-ui/react18.d.ts +11 -0
  109. package/lib/commonjs/mol-plugin-ui/react18.js +38 -0
  110. package/lib/commonjs/mol-plugin-ui/structure/focus.d.ts +1 -1
  111. package/lib/commonjs/mol-plugin-ui/structure/focus.js +2 -2
  112. package/lib/commonjs/mol-repr/shape/loci/angle.d.ts +1 -0
  113. package/lib/commonjs/mol-repr/shape/loci/dihedral.d.ts +1 -0
  114. package/lib/commonjs/mol-repr/shape/loci/orientation.d.ts +1 -0
  115. package/lib/commonjs/mol-repr/shape/loci/plane.d.ts +1 -0
  116. package/lib/commonjs/mol-repr/shape/model/unitcell.d.ts +1 -0
  117. package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +3 -0
  118. package/lib/commonjs/mol-repr/structure/params.d.ts +4 -0
  119. package/lib/commonjs/mol-repr/structure/registry.d.ts +10 -0
  120. package/lib/commonjs/mol-repr/structure/representation/backbone.d.ts +3 -0
  121. package/lib/commonjs/mol-repr/structure/representation/ball-and-stick.d.ts +3 -0
  122. package/lib/commonjs/mol-repr/structure/representation/carbohydrate.d.ts +3 -0
  123. package/lib/commonjs/mol-repr/structure/representation/cartoon.d.ts +3 -0
  124. package/lib/commonjs/mol-repr/structure/representation/ellipsoid.d.ts +3 -0
  125. package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
  126. package/lib/commonjs/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
  127. package/lib/commonjs/mol-repr/structure/representation/orientation.d.ts +3 -0
  128. package/lib/commonjs/mol-repr/structure/representation/putty.d.ts +3 -0
  129. package/lib/commonjs/mol-repr/structure/representation/spacefill.d.ts +3 -0
  130. package/lib/commonjs/mol-repr/structure/units-visual.d.ts +4 -0
  131. package/lib/commonjs/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +2 -0
  132. package/lib/commonjs/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +2 -0
  133. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +1 -0
  134. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +1 -0
  135. package/lib/commonjs/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +1 -0
  136. package/lib/commonjs/mol-repr/structure/visual/element-sphere.d.ts +2 -0
  137. package/lib/commonjs/mol-repr/structure/visual/ellipsoid-mesh.d.ts +1 -0
  138. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
  139. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
  140. package/lib/commonjs/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +1 -0
  141. package/lib/commonjs/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +1 -0
  142. package/lib/commonjs/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +1 -0
  143. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
  144. package/lib/commonjs/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
  145. package/lib/commonjs/mol-repr/structure/visual/polymer-direction-wedge.d.ts +1 -0
  146. package/lib/commonjs/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +1 -0
  147. package/lib/commonjs/mol-repr/structure/visual/polymer-trace-mesh.d.ts +1 -0
  148. package/lib/commonjs/mol-repr/structure/visual/polymer-tube-mesh.d.ts +1 -0
  149. package/lib/commonjs/mol-repr/util.d.ts +2 -1
  150. package/lib/commonjs/mol-repr/util.js +2 -2
  151. package/lib/commonjs/mol-repr/volume/isosurface.d.ts +5 -0
  152. package/lib/commonjs/mol-repr/volume/registry.d.ts +1 -0
  153. package/lib/examples/alpha-orbitals/index.js +1 -1
  154. package/lib/examples/basic-wrapper/index.js +1 -1
  155. package/lib/examples/lighting/index.js +1 -1
  156. package/lib/examples/proteopedia-wrapper/index.js +1 -1
  157. package/lib/extensions/anvil/behavior.d.ts +1 -0
  158. package/lib/extensions/anvil/representation.d.ts +4 -0
  159. package/lib/extensions/cellpack/representation.d.ts +1 -0
  160. package/lib/extensions/dnatco/confal-pyramids/representation.d.ts +3 -0
  161. package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +1 -0
  162. package/lib/extensions/rcsb/assembly-symmetry/representation.d.ts +1 -0
  163. package/lib/extensions/rcsb/validation-report/representation.d.ts +5 -0
  164. package/lib/mol-canvas3d/canvas3d.d.ts +2 -0
  165. package/lib/mol-canvas3d/helper/camera-helper.d.ts +1 -0
  166. package/lib/mol-canvas3d/helper/handle-helper.d.ts +1 -0
  167. package/lib/mol-canvas3d/helper/helper.d.ts +2 -0
  168. package/lib/mol-canvas3d/passes/image.d.ts +1 -0
  169. package/lib/mol-data/db/column.d.ts +10 -3
  170. package/lib/mol-data/db/column.js +39 -18
  171. package/lib/mol-geo/geometry/cylinders/cylinders.d.ts +4 -2
  172. package/lib/mol-geo/geometry/cylinders/cylinders.js +2 -2
  173. package/lib/mol-geo/geometry/mesh/mesh.d.ts +2 -1
  174. package/lib/mol-geo/geometry/mesh/mesh.js +2 -2
  175. package/lib/mol-geo/geometry/spheres/spheres.d.ts +2 -1
  176. package/lib/mol-geo/geometry/spheres/spheres.js +2 -2
  177. package/lib/mol-geo/geometry/texture-mesh/texture-mesh.d.ts +2 -1
  178. package/lib/mol-geo/geometry/texture-mesh/texture-mesh.js +2 -2
  179. package/lib/mol-gl/shader/chunks/wboit-write.glsl.d.ts +2 -2
  180. package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +2 -2
  181. package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  182. package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
  183. package/lib/mol-gl/shader/image.frag.d.ts +2 -2
  184. package/lib/mol-gl/shader/image.frag.js +2 -2
  185. package/lib/mol-gl/shader/lines.frag.d.ts +2 -2
  186. package/lib/mol-gl/shader/lines.frag.js +2 -2
  187. package/lib/mol-gl/shader/points.frag.d.ts +2 -2
  188. package/lib/mol-gl/shader/points.frag.js +2 -2
  189. package/lib/mol-gl/shader/text.frag.d.ts +2 -2
  190. package/lib/mol-gl/shader/text.frag.js +2 -2
  191. package/lib/mol-gl/webgl/buffer.d.ts +2 -2
  192. package/lib/mol-gl/webgl/buffer.js +12 -12
  193. package/lib/mol-gl/webgl/program.d.ts +1 -1
  194. package/lib/mol-gl/webgl/program.js +10 -4
  195. package/lib/mol-io/reader/cif/schema/bird.d.ts +8 -8
  196. package/lib/mol-io/reader/cif/schema/bird.js +12 -11
  197. package/lib/mol-io/reader/cif/schema/ccd-extras.d.ts +1 -1
  198. package/lib/mol-io/reader/cif/schema/ccd.d.ts +12 -12
  199. package/lib/mol-io/reader/cif/schema/ccd.js +13 -12
  200. package/lib/mol-io/reader/cif/schema/mmcif-extras.d.ts +5 -5
  201. package/lib/mol-io/reader/cif/schema/mmcif-extras.js +2 -2
  202. package/lib/mol-io/reader/cif/schema/mmcif.d.ts +30 -26
  203. package/lib/mol-io/reader/cif/schema/mmcif.js +44 -39
  204. package/lib/mol-io/reader/cif/schema.d.ts +1 -1
  205. package/lib/mol-io/reader/cif/schema.js +22 -2
  206. package/lib/mol-io/writer/mol/encoder.js +1 -1
  207. package/lib/mol-model/structure/model/model.js +14 -6
  208. package/lib/mol-model/structure/model/properties/common.js +1 -1
  209. package/lib/mol-model/structure/model/types.d.ts +19 -17
  210. package/lib/mol-model/structure/model/types.js +30 -31
  211. package/lib/mol-model/structure/query/queries/generators.js +1 -1
  212. package/lib/mol-model/structure/structure/properties.d.ts +1 -1
  213. package/lib/mol-model/structure/structure/unit/bonds/inter-compute.js +2 -4
  214. package/lib/mol-model/structure/structure/unit/bonds/intra-compute.js +1 -3
  215. package/lib/mol-model/structure/structure/unit/rings.js +3 -0
  216. package/lib/mol-model-formats/shape/ply.d.ts +2 -0
  217. package/lib/mol-model-formats/structure/basic/entities.js +1 -1
  218. package/lib/mol-model-formats/structure/basic/schema.d.ts +2 -2
  219. package/lib/mol-model-formats/structure/common/component.d.ts +3 -3
  220. package/lib/mol-model-formats/structure/common/component.js +46 -46
  221. package/lib/mol-model-formats/structure/pdb/atom-site.d.ts +2 -2
  222. package/lib/mol-model-formats/structure/pdb/atom-site.js +72 -7
  223. package/lib/mol-model-formats/structure/pdb/secondary-structure.js +11 -11
  224. package/lib/mol-model-formats/structure/pdb/to-cif.js +7 -2
  225. package/lib/mol-model-formats/structure/property/bonds/chem_comp.js +1 -1
  226. package/lib/mol-model-formats/structure/property/bonds/struct_conn.js +1 -1
  227. package/lib/mol-model-props/computed/representations/interactions-inter-unit-cylinder.d.ts +1 -0
  228. package/lib/mol-model-props/computed/representations/interactions-intra-unit-cylinder.d.ts +1 -0
  229. package/lib/mol-model-props/computed/representations/interactions.d.ts +3 -0
  230. package/lib/mol-model-props/integrative/cross-link-restraint/representation.d.ts +4 -0
  231. package/lib/mol-plugin/behavior/dynamic/volume-streaming/util.js +3 -2
  232. package/lib/mol-plugin/commands.d.ts +1 -0
  233. package/lib/mol-plugin/util/viewport-screenshot.d.ts +3 -0
  234. package/lib/mol-plugin/version.js +2 -2
  235. package/lib/mol-plugin-state/actions/structure.d.ts +6 -6
  236. package/lib/mol-plugin-state/helpers/structure-selection-query.d.ts +1 -1
  237. package/lib/mol-plugin-state/helpers/structure-selection-query.js +1 -1
  238. package/lib/mol-plugin-state/transforms/representation.d.ts +6 -0
  239. package/lib/mol-plugin-ui/react18.d.ts +11 -0
  240. package/lib/mol-plugin-ui/react18.js +34 -0
  241. package/lib/mol-plugin-ui/structure/focus.d.ts +1 -1
  242. package/lib/mol-plugin-ui/structure/focus.js +2 -2
  243. package/lib/mol-repr/shape/loci/angle.d.ts +1 -0
  244. package/lib/mol-repr/shape/loci/dihedral.d.ts +1 -0
  245. package/lib/mol-repr/shape/loci/orientation.d.ts +1 -0
  246. package/lib/mol-repr/shape/loci/plane.d.ts +1 -0
  247. package/lib/mol-repr/shape/model/unitcell.d.ts +1 -0
  248. package/lib/mol-repr/structure/complex-visual.d.ts +3 -0
  249. package/lib/mol-repr/structure/params.d.ts +4 -0
  250. package/lib/mol-repr/structure/registry.d.ts +10 -0
  251. package/lib/mol-repr/structure/representation/backbone.d.ts +3 -0
  252. package/lib/mol-repr/structure/representation/ball-and-stick.d.ts +3 -0
  253. package/lib/mol-repr/structure/representation/carbohydrate.d.ts +3 -0
  254. package/lib/mol-repr/structure/representation/cartoon.d.ts +3 -0
  255. package/lib/mol-repr/structure/representation/ellipsoid.d.ts +3 -0
  256. package/lib/mol-repr/structure/representation/gaussian-surface.d.ts +3 -0
  257. package/lib/mol-repr/structure/representation/molecular-surface.d.ts +3 -0
  258. package/lib/mol-repr/structure/representation/orientation.d.ts +3 -0
  259. package/lib/mol-repr/structure/representation/putty.d.ts +3 -0
  260. package/lib/mol-repr/structure/representation/spacefill.d.ts +3 -0
  261. package/lib/mol-repr/structure/units-visual.d.ts +4 -0
  262. package/lib/mol-repr/structure/visual/bond-inter-unit-cylinder.d.ts +2 -0
  263. package/lib/mol-repr/structure/visual/bond-intra-unit-cylinder.d.ts +2 -0
  264. package/lib/mol-repr/structure/visual/carbohydrate-link-cylinder.d.ts +1 -0
  265. package/lib/mol-repr/structure/visual/carbohydrate-symbol-mesh.d.ts +1 -0
  266. package/lib/mol-repr/structure/visual/carbohydrate-terminal-link-cylinder.d.ts +1 -0
  267. package/lib/mol-repr/structure/visual/element-sphere.d.ts +2 -0
  268. package/lib/mol-repr/structure/visual/ellipsoid-mesh.d.ts +1 -0
  269. package/lib/mol-repr/structure/visual/gaussian-surface-mesh.d.ts +4 -0
  270. package/lib/mol-repr/structure/visual/molecular-surface-mesh.d.ts +1 -0
  271. package/lib/mol-repr/structure/visual/nucleotide-block-mesh.d.ts +1 -0
  272. package/lib/mol-repr/structure/visual/nucleotide-ring-mesh.d.ts +1 -0
  273. package/lib/mol-repr/structure/visual/orientation-ellipsoid-mesh.d.ts +1 -0
  274. package/lib/mol-repr/structure/visual/polymer-backbone-cylinder.d.ts +2 -0
  275. package/lib/mol-repr/structure/visual/polymer-backbone-sphere.d.ts +2 -0
  276. package/lib/mol-repr/structure/visual/polymer-direction-wedge.d.ts +1 -0
  277. package/lib/mol-repr/structure/visual/polymer-gap-cylinder.d.ts +1 -0
  278. package/lib/mol-repr/structure/visual/polymer-trace-mesh.d.ts +1 -0
  279. package/lib/mol-repr/structure/visual/polymer-tube-mesh.d.ts +1 -0
  280. package/lib/mol-repr/util.d.ts +2 -1
  281. package/lib/mol-repr/util.js +2 -2
  282. package/lib/mol-repr/volume/isosurface.d.ts +5 -0
  283. package/lib/mol-repr/volume/registry.d.ts +1 -0
  284. package/package.json +8 -6
@@ -4,4 +4,4 @@
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  * @author Michael Krone <michael.krone@uni-tuebingen.de>
6
6
  */
7
- export declare const directVolume_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\nuniform float uHighlightStrength;\nuniform float uSelectStrength;\nuniform int uMarkerPriority;\n\nuniform float uMarker;\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\n\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\n\nuniform bool uRenderWboit;\nuniform bool uDoubleSided;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n if (!uRenderWboit) {\n // in case of opaque volumes (and depth texture support)\n return texture2D(tDepth, coords).r;\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n }\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n bool interior = false;\n #include wboit_write\n}\n";
7
+ export declare const directVolume_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\nuniform float uHighlightStrength;\nuniform float uSelectStrength;\nuniform int uMarkerPriority;\n\nuniform float uMarker;\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\n\nuniform bool uRenderWboit;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n if (!uRenderWboit) {\n // in case of opaque volumes (and depth texture support)\n return texture2D(tDepth, coords).r;\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n }\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n #include wboit_write\n}\n";
@@ -7,4 +7,4 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.directVolume_frag = void 0;
10
- exports.directVolume_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\nuniform float uHighlightStrength;\nuniform float uSelectStrength;\nuniform int uMarkerPriority;\n\nuniform float uMarker;\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\n\nuniform float uInteriorDarkening;\nuniform bool uInteriorColorFlag;\nuniform vec3 uInteriorColor;\n\nuniform bool uRenderWboit;\nuniform bool uDoubleSided;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n if (!uRenderWboit) {\n // in case of opaque volumes (and depth texture support)\n return texture2D(tDepth, coords).r;\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n }\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n bool interior = false;\n #include wboit_write\n}\n";
10
+ exports.directVolume_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include light_frag_params\n\n#if dClipObjectCount != 0\n uniform int uClipObjectType[dClipObjectCount];\n uniform bool uClipObjectInvert[dClipObjectCount];\n uniform vec3 uClipObjectPosition[dClipObjectCount];\n uniform vec4 uClipObjectRotation[dClipObjectCount];\n uniform vec3 uClipObjectScale[dClipObjectCount];\n#endif\n#include common_clip\n\n#include read_from_texture\n#include texture3d_from_1d_trilinear\n#include texture3d_from_2d_nearest\n#include texture3d_from_2d_linear\n\nuniform mat4 uProjection, uTransform, uModelView, uModel, uView;\nuniform vec3 uCameraDir;\n\nuniform sampler2D tDepth;\nuniform vec2 uDrawingBufferSize;\n\nvarying vec3 vOrigPos;\nvarying float vInstance;\nvarying vec4 vBoundingSphere;\nvarying mat4 vTransform;\n\nuniform mat4 uInvView;\nuniform vec3 uGridDim;\nuniform vec3 uBboxSize;\nuniform sampler2D tTransferTex;\nuniform float uTransferScale;\nuniform float uStepScale;\nuniform float uJumpLength;\n\nuniform int uObjectId;\nuniform int uVertexCount;\nuniform int uInstanceCount;\nuniform int uGroupCount;\n\nuniform vec3 uHighlightColor;\nuniform vec3 uSelectColor;\nuniform float uHighlightStrength;\nuniform float uSelectStrength;\nuniform int uMarkerPriority;\n\nuniform float uMarker;\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nuniform float uMetalness;\nuniform float uRoughness;\n\nuniform float uFogNear;\nuniform float uFogFar;\nuniform vec3 uFogColor;\n\nuniform float uAlpha;\nuniform float uPickingAlphaThreshold;\nuniform bool uTransparentBackground;\nuniform float uXrayEdgeFalloff;\n\nuniform bool uRenderWboit;\n\nuniform float uNear;\nuniform float uFar;\nuniform float uIsOrtho;\n\nuniform vec3 uCellDim;\nuniform vec3 uCameraPosition;\nuniform mat4 uCartnToUnit;\n\n#if __VERSION__ != 100\n // for webgl1 this is given as a 'define'\n uniform int uMaxSteps;\n#endif\n\n#if defined(dGridTexType_2d)\n precision highp sampler2D;\n uniform sampler2D tGridTex;\n uniform vec3 uGridTexDim;\n#elif defined(dGridTexType_3d)\n precision highp sampler3D;\n uniform sampler3D tGridTex;\n#endif\n\n#if defined(dColorType_uniform)\n uniform vec3 uColor;\n#elif defined(dColorType_texture)\n uniform vec2 uColorTexDim;\n uniform sampler2D tColor;\n#endif\n\n#ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance) || defined(dOverpaintType_vertexInstance)\n uniform vec2 uOverpaintTexDim;\n uniform sampler2D tOverpaint;\n #endif\n#endif\n\n#ifdef dUsePalette\n uniform sampler2D tPalette;\n#endif\n\n#if defined(dGridTexType_2d)\n vec4 textureVal(vec3 pos) {\n return texture3dFrom2dLinear(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n vec4 textureGroup(vec3 pos) {\n return texture3dFrom2dNearest(tGridTex, pos + (vec3(0.5, 0.5, 0.0) / uGridDim), uGridDim, uGridTexDim.xy);\n }\n#elif defined(dGridTexType_3d)\n vec4 textureVal(vec3 pos) {\n return texture(tGridTex, pos + (vec3(0.5) / uGridDim));\n }\n vec4 textureGroup(vec3 pos) {\n return texelFetch(tGridTex, ivec3(pos * uGridDim), 0);\n }\n#endif\n\nfloat calcDepth(const in vec3 pos) {\n vec2 clipZW = pos.z * uProjection[2].zw + uProjection[3].zw;\n return 0.5 + 0.5 * clipZW.x / clipZW.y;\n}\n\nfloat transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0)).a;\n}\n\nfloat getDepth(const in vec2 coords) {\n #ifdef depthTextureSupport\n if (!uRenderWboit) {\n // in case of opaque volumes (and depth texture support)\n return texture2D(tDepth, coords).r;\n } else {\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n }\n #else\n return unpackRGBAToDepth(texture2D(tDepth, coords));\n #endif\n}\n\nconst float gradOffset = 0.5;\n\nvec3 v3m4(vec3 p, mat4 m) {\n return (m * vec4(p, 1.0)).xyz;\n}\n\nfloat preFogAlphaBlended = 0.0;\n\nvec4 raymarch(vec3 startLoc, vec3 step, vec3 rayDir) {\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n mat4 cartnToUnit = uCartnToUnit * inverse4(vTransform);\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n mat4 modelTransform = uModel * vTransform * uTransform;\n #endif\n mat4 modelViewTransform = uModelView * vTransform * uTransform;\n\n vec3 scaleVol = vec3(1.0) / uGridDim;\n vec3 pos = startLoc;\n vec4 cell;\n float prevValue = -1.0;\n float value = 0.0;\n vec4 src = vec4(0.0);\n vec4 dst = vec4(0.0);\n float fragmentDepth;\n\n vec3 posMin = vec3(0.0);\n vec3 posMax = vec3(1.0) - vec3(1.0) / uGridDim;\n\n vec3 unitPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec4 material;\n vec4 overpaint;\n float metalness = uMetalness;\n float roughness = uRoughness;\n\n vec3 gradient = vec3(1.0);\n vec3 dx = vec3(gradOffset * scaleVol.x, 0.0, 0.0);\n vec3 dy = vec3(0.0, gradOffset * scaleVol.y, 0.0);\n vec3 dz = vec3(0.0, 0.0, gradOffset * scaleVol.z);\n\n float maxDist = min(vBoundingSphere.w * 2.0, uFar - uNear);\n float maxDistSq = maxDist * maxDist;\n\n for (int i = 0; i < uMaxSteps; ++i) {\n // break when beyond bounding-sphere or far-plane\n vec3 distVec = startLoc - pos;\n if (dot(distVec, distVec) > maxDistSq) break;\n\n unitPos = v3m4(pos, cartnToUnit);\n\n // continue when outside of grid\n if (unitPos.x > posMax.x || unitPos.y > posMax.y || unitPos.z > posMax.z ||\n unitPos.x < posMin.x || unitPos.y < posMin.y || unitPos.z < posMin.z\n ) {\n prevValue = value;\n pos += step;\n continue;\n }\n\n cell = textureVal(unitPos);\n value = cell.a; // current voxel value\n\n if (uJumpLength > 0.0 && value < 0.01) {\n nextPos = pos + rayDir * uJumpLength;\n nextValue = textureVal(v3m4(nextPos, cartnToUnit)).a;\n if (nextValue < 0.01) {\n prevValue = nextValue;\n pos = nextPos;\n continue;\n }\n }\n\n vec4 mvPosition = modelViewTransform * vec4(unitPos * uGridDim, 1.0);\n if (calcDepth(mvPosition.xyz) > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(unitPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n vec3 vViewPosition = mvPosition.xyz;\n material.a = transferFunction(value);\n\n #ifdef dPackedGroup\n float group = unpackRGBToInt(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n // note that we swap x and z because the texture is flipped around y\n #if defined(dAxisOrder_012)\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y; // 210\n #elif defined(dAxisOrder_021)\n float group = g.y + g.z * uGridDim.y + g.x * uGridDim.y * uGridDim.z; // 120\n #elif defined(dAxisOrder_102)\n float group = g.z + g.x * uGridDim.z + g.y * uGridDim.z * uGridDim.x; // 201\n #elif defined(dAxisOrder_120)\n float group = g.x + g.z * uGridDim.x + g.y * uGridDim.x * uGridDim.z; // 021\n #elif defined(dAxisOrder_201)\n float group = g.y + g.x * uGridDim.y + g.z * uGridDim.y * uGridDim.x; // 102\n #elif defined(dAxisOrder_210)\n float group = g.x + g.y * uGridDim.x + g.z * uGridDim.x * uGridDim.y; // 012\n #endif\n #endif\n\n #if defined(dColorType_direct) && defined(dUsePalette)\n material.rgb = texture2D(tPalette, vec2(value, 0.0)).rgb;\n #elif defined(dColorType_uniform)\n material.rgb = uColor;\n #elif defined(dColorType_instance)\n material.rgb = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n material.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n material.rgb = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n material.rgb = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n overpaint = readFromTexture(tOverpaint, vInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n overpaint = texture3dFrom1dTrilinear(tOverpaint, isoPos, uGridDim, uOverpaintTexDim, vInstance * float(uVertexCount));\n #endif\n\n material.rgb = mix(material.rgb, overpaint.rgb, overpaint.a);\n #endif\n\n if (material.a >= 0.01) {\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(unitPos - dx).a - textureVal(unitPos + dx).a;\n gradient.y = textureVal(unitPos - dy).a - textureVal(unitPos + dy).a;\n gradient.z = textureVal(unitPos - dz).a - textureVal(unitPos + dz).a;\n #else\n gradient = cell.xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n #include apply_light_color\n } else {\n gl_FragColor.rgb = material.rgb;\n }\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = calcDepth(mvPosition.xyz);\n #include apply_fog\n\n src = gl_FragColor;\n\n if (!uTransparentBackground) {\n // done in 'apply_fog' otherwise\n src.rgb *= src.a;\n }\n dst = (1.0 - dst.a) * src + dst; // standard blending\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n return dst;\n}\n\n// TODO: support float texture for higher precision values???\n// TODO: support clipping exclusion texture support\n\nvoid main() {\n if (gl_FrontFacing)\n discard;\n\n vec3 rayDir = mix(normalize(vOrigPos - uCameraPosition), uCameraDir, uIsOrtho);\n vec3 step = rayDir * uStepScale;\n\n float boundingSphereNear = distance(vBoundingSphere.xyz, uCameraPosition) - vBoundingSphere.w;\n float d = max(uNear, boundingSphereNear) - mix(0.0, distance(vOrigPos, uCameraPosition), uIsOrtho);\n vec3 start = mix(uCameraPosition, vOrigPos, uIsOrtho) + (d * rayDir);\n gl_FragColor = raymarch(start, step, rayDir);\n\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n #include wboit_write\n}\n";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.image_frag = void 0;
4
4
  /**
5
- * Copyright (c) 2020-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
5
+ * Copyright (c) 2020-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
6
6
  *
7
7
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
8
8
  */
9
- exports.image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.image_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include read_from_texture\n#include common_frag_params\n#include common_clip\n\nuniform vec2 uImageTexDim;\nuniform sampler2D tImageTex;\nuniform sampler2D tGroupTex;\n\nuniform vec2 uMarkerTexDim;\nuniform sampler2D tMarker;\n\nvarying vec2 vUv;\nvarying float vInstance;\n\n#if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell) || defined(dInterpolation_bspline)\n #define dInterpolation_cubic\n#endif\n\n#if defined(dInterpolation_cubic)\n #if defined(dInterpolation_catmulrom) || defined(dInterpolation_mitchell)\n #if defined(dInterpolation_catmulrom)\n const float B = 0.0;\n const float C = 0.5;\n #elif defined(dInterpolation_mitchell)\n const float B = 0.333;\n const float C = 0.333;\n #endif\n\n float cubicFilter(float x){\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f < 1.0) {\n return ((12.0 - 9.0 * B - 6.0 * C) * (f * f * f) +\n (-18.0 + 12.0 * B + 6.0 * C) * (f * f) +\n (6.0 - 2.0 * B)) / 6.0;\n }else if (f >= 1.0 && f < 2.0){\n return ((-B - 6.0 * C) * ( f * f * f)\n + (6.0 * B + 30.0 * C) * (f * f) +\n (-(12.0 * B) - 48.0 * C) * f +\n 8.0 * B + 24.0 * C) / 6.0;\n }else{\n return 0.0;\n }\n }\n #elif defined(dInterpolation_bspline)\n float cubicFilter(float x) {\n float f = x;\n if (f < 0.0) {\n f = -f;\n }\n if (f >= 0.0 && f <= 1.0){\n return (2.0 / 3.0) + (0.5) * (f * f * f) - (f * f);\n } else if (f > 1.0 && f <= 2.0) {\n return 1.0 / 6.0 * pow((2.0 - f), 3.0);\n }\n return 1.0;\n }\n #endif\n\n vec4 biCubic(sampler2D tex, vec2 texCoord) {\n vec2 texelSize = 1.0 / uImageTexDim;\n texCoord -= texelSize / 2.0;\n vec4 nSum = vec4(0.0);\n float nDenom = 0.0;\n vec2 cell = fract(texCoord * uImageTexDim);\n for (float m = -1.0; m <= 2.0; ++m) {\n for (float n = -1.0; n <= 2.0; ++n) {\n vec4 vecData = texture2D(tex, texCoord + texelSize * vec2(m, n));\n float c = cubicFilter(m - cell.x) * cubicFilter(-n + cell.y);\n nSum += vecData * c;\n nDenom += c;\n }\n }\n return nSum / nDenom;\n }\n#endif\n\nvoid main() {\n #include clip_pixel\n\n #if defined(dInterpolation_cubic)\n vec4 imageData = biCubic(tImageTex, vUv);\n #else\n vec4 imageData = texture2D(tImageTex, vUv);\n #endif\n imageData.a = clamp(imageData.a, 0.0, 1.0);\n if (imageData.a > 0.9) imageData.a = 1.0;\n\n float fragmentDepth = gl_FragCoord.z;\n\n #if defined(dRenderVariant_pick)\n if (imageData.a < 0.3)\n discard;\n if (uPickType == 1) {\n gl_FragColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n gl_FragColor = vec4(packIntToRGB(vInstance), 1.0);\n } else {\n gl_FragColor = vec4(texture2D(tGroupTex, vUv).rgb, 1.0);\n }\n #elif defined(dRenderVariant_depth)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n #elif defined(dRenderVariant_marking)\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n if (uMarkingType == 1) {\n if (marker > 0.0 || imageData.a < 0.05)\n discard;\n gl_FragColor = packDepthToRGBA(gl_FragCoord.z);\n } else {\n if (marker == 0.0 || imageData.a < 0.05)\n discard;\n float depthTest = 1.0;\n if (uMarkingDepthTest) {\n depthTest = (fragmentDepth >= getDepth(gl_FragCoord.xy / uDrawingBufferSize)) ? 1.0 : 0.0;\n }\n bool isHighlight = intMod(marker, 2.0) > 0.1;\n gl_FragColor = vec4(0.0, depthTest, isHighlight ? 1.0 : 0.0, 1.0);\n }\n #elif defined(dRenderVariant_color)\n if (imageData.a < 0.05)\n discard;\n gl_FragColor = imageData;\n gl_FragColor.a *= uAlpha;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n float group = unpackRGBToInt(texture2D(tGroupTex, vUv).rgb);\n marker = readFromTexture(tMarker, vInstance * float(uGroupCount) + group, uMarkerTexDim).a;\n marker = floor(marker * 255.0 + 0.5); // rounding required to work on some cards on win\n }\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const lines_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include clip_pixel\n\n bool interior = false;\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 gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const lines_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include clip_pixel\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 gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.lines_frag = void 0;
9
- exports.lines_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include clip_pixel\n\n bool interior = false;\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 gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.lines_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nvoid main(){\n #include clip_pixel\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 gl_FragColor = material;\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const points_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n #include assign_material_color\n\n #if defined(dPointStyle_circle)\n float dist = distance(gl_PointCoord, center);\n if (dist > radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\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 gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const points_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dPointStyle_circle)\n float dist = distance(gl_PointCoord, center);\n if (dist > radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\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 gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.points_frag = void 0;
9
- exports.points_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n #include assign_material_color\n\n #if defined(dPointStyle_circle)\n float dist = distance(gl_PointCoord, center);\n if (dist > radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\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 gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.points_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nconst vec2 center = vec2(0.5);\nconst float radius = 0.5;\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n #if defined(dPointStyle_circle)\n float dist = distance(gl_PointCoord, center);\n if (dist > radius) discard;\n #elif defined(dPointStyle_fuzzy)\n float dist = distance(gl_PointCoord, center);\n float fuzzyAlpha = 1.0 - smoothstep(0.0, radius, dist);\n if (fuzzyAlpha < 0.0001) discard;\n #endif\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 gl_FragColor = material;\n\n #if defined(dPointStyle_fuzzy)\n gl_FragColor.a *= fuzzyAlpha;\n #endif\n\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,6 +1,6 @@
1
1
  /**
2
- * Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const text_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n\n gl_FragColor = material;\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
6
+ export declare const text_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n\n gl_FragColor = material;\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2019-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2019-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.text_frag = void 0;
9
- exports.text_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n bool interior = false;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n\n gl_FragColor = material;\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
9
+ exports.text_frag = "\nprecision highp float;\nprecision highp int;\n\n#include common\n#include common_frag_params\n#include color_frag_params\n#include common_clip\n\nuniform sampler2D tFont;\n\nuniform vec3 uBorderColor;\nuniform float uBorderWidth;\nuniform vec3 uBackgroundColor;\nuniform float uBackgroundOpacity;\n\nvarying vec2 vTexCoord;\n\nconst float smoothness = 32.0;\nconst float gamma = 2.2;\n\nvoid main2(){\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n}\n\nvoid main(){\n #include clip_pixel\n\n float fragmentDepth = gl_FragCoord.z;\n #include assign_material_color\n\n if (vTexCoord.x > 1.0) {\n gl_FragColor = vec4(uBackgroundColor, uBackgroundOpacity * material.a);\n } else {\n // retrieve signed distance\n float sdf = texture2D(tFont, vTexCoord).a + uBorderWidth;\n\n // perform adaptive anti-aliasing of the edges\n float w = clamp(smoothness * (abs(dFdx(vTexCoord.x)) + abs(dFdy(vTexCoord.y))), 0.0, 0.5);\n float a = smoothstep(0.5 - w, 0.5 + w, sdf);\n\n // gamma correction for linear attenuation\n a = pow(a, 1.0 / gamma);\n\n if (a < 0.5) discard;\n material.a *= a;\n\n // add border\n float t = 0.5 + uBorderWidth;\n if (uBorderWidth > 0.0 && sdf < t) {\n material.xyz = mix(uBorderColor, material.xyz, smoothstep(t - w, t, sdf));\n }\n\n gl_FragColor = material;\n }\n\n #if defined(dRenderVariant_pick)\n #include check_picking_alpha\n #elif defined(dRenderVariant_depth)\n gl_FragColor = material;\n #elif defined(dRenderVariant_marking)\n gl_FragColor = material;\n #elif defined(dRenderVariant_color)\n #include apply_marker_color\n #include apply_fog\n #include wboit_write\n #endif\n}\n";
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
@@ -41,7 +41,7 @@ export interface Buffer {
41
41
  destroy: () => void;
42
42
  }
43
43
  export declare type AttributeItemSize = 1 | 2 | 3 | 4 | 16;
44
- export declare type AttributeKind = 'float32' | 'int32';
44
+ export declare type AttributeKind = 'float32';
45
45
  export declare function getAttribType(gl: GLRenderingContext, kind: AttributeKind, itemSize: AttributeItemSize): number;
46
46
  export declare type AttributeDefs = {
47
47
  [k: string]: {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
6
  */
@@ -9,6 +9,7 @@ exports.createElementsBuffer = exports.createAttributeBuffers = exports.createAt
9
9
  var tslib_1 = require("tslib");
10
10
  var id_factory_1 = require("../../mol-util/id-factory");
11
11
  var type_helpers_1 = require("../../mol-util/type-helpers");
12
+ var compat_1 = require("./compat");
12
13
  var getNextBufferId = (0, id_factory_1.idFactory)();
13
14
  function getUsageHint(gl, usageHint) {
14
15
  switch (usageHint) {
@@ -27,6 +28,7 @@ function getDataType(gl, dataType) {
27
28
  case 'uint32': return gl.UNSIGNED_INT;
28
29
  case 'int32': return gl.INT;
29
30
  case 'float32': return gl.FLOAT;
31
+ default: (0, type_helpers_1.assertUnreachable)(dataType);
30
32
  }
31
33
  }
32
34
  exports.getDataType = getDataType;
@@ -58,7 +60,13 @@ function getBufferType(gl, bufferType) {
58
60
  switch (bufferType) {
59
61
  case 'attribute': return gl.ARRAY_BUFFER;
60
62
  case 'elements': return gl.ELEMENT_ARRAY_BUFFER;
61
- case 'uniform': return gl.UNIFORM_BUFFER;
63
+ case 'uniform':
64
+ if ((0, compat_1.isWebGL2)(gl)) {
65
+ return gl.UNIFORM_BUFFER;
66
+ }
67
+ else {
68
+ throw new Error('WebGL2 is required for uniform buffers');
69
+ }
62
70
  }
63
71
  }
64
72
  exports.getBufferType = getBufferType;
@@ -114,14 +122,6 @@ function createBuffer(gl, array, usageHint, bufferType) {
114
122
  }
115
123
  function getAttribType(gl, kind, itemSize) {
116
124
  switch (kind) {
117
- case 'int32':
118
- switch (itemSize) {
119
- case 1: return gl.INT;
120
- case 2: return gl.INT_VEC2;
121
- case 3: return gl.INT_VEC3;
122
- case 4: return gl.INT_VEC4;
123
- }
124
- break;
125
125
  case 'float32':
126
126
  switch (itemSize) {
127
127
  case 1: return gl.FLOAT;
@@ -130,9 +130,9 @@ function getAttribType(gl, kind, itemSize) {
130
130
  case 4: return gl.FLOAT_VEC4;
131
131
  case 16: return gl.FLOAT_MAT4;
132
132
  }
133
- break;
133
+ default:
134
+ (0, type_helpers_1.assertUnreachable)(kind);
134
135
  }
135
- throw new Error("unknown attribute type for kind '".concat(kind, "' and itemSize '").concat(itemSize, "'"));
136
136
  }
137
137
  exports.getAttribType = getAttribType;
138
138
  function createAttributeBuffer(gl, state, extensions, array, itemSize, divisor, usageHint) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2018-2021 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2018-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
5
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
6
6
  */
@@ -11,6 +11,7 @@ var uniform_1 = require("./uniform");
11
11
  var buffer_1 = require("./buffer");
12
12
  var id_factory_1 = require("../../mol-util/id-factory");
13
13
  var debug_1 = require("../../mol-util/debug");
14
+ var compat_1 = require("./compat");
14
15
  var getNextProgramId = (0, id_factory_1.idFactory)();
15
16
  function getLocations(gl, program, schema) {
16
17
  var locations = {};
@@ -54,7 +55,7 @@ function checkActiveAttributes(gl, program, schema) {
54
55
  }
55
56
  var attribType = (0, buffer_1.getAttribType)(gl, spec.kind, spec.itemSize);
56
57
  if (attribType !== type) {
57
- throw new Error("unexpected attribute type for ".concat(name_1));
58
+ throw new Error("unexpected attribute type '".concat(attribType, "' for ").concat(name_1, ", expected '").concat(type, "'"));
58
59
  }
59
60
  }
60
61
  }
@@ -87,8 +88,13 @@ function checkActiveUniforms(gl, program, schema) {
87
88
  }
88
89
  }
89
90
  else if (spec.kind === 'volume-float32' || spec.kind === 'volume-uint8') {
90
- if (type !== gl.SAMPLER_3D) {
91
- throw new Error("unexpected sampler type for '".concat(name_2, "'"));
91
+ if ((0, compat_1.isWebGL2)(gl)) {
92
+ if (type !== gl.SAMPLER_3D) {
93
+ throw new Error("unexpected sampler type for '".concat(name_2, "'"));
94
+ }
95
+ }
96
+ else {
97
+ throw new Error("WebGL2 is required to use SAMPLER_3D");
92
98
  }
93
99
  }
94
100
  else {
@@ -1,7 +1,7 @@
1
1
  /**
2
- * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
2
+ * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
3
  *
4
- * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5.
4
+ * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.357, IHM 1.17, MA 1.3.6.
5
5
  *
6
6
  * @author molstar/ciftools package
7
7
  */
@@ -50,7 +50,7 @@ export declare const BIRD_Schema: {
50
50
  /**
51
51
  * Defines the structural classification of the entity.
52
52
  */
53
- type: Schema.Aliased<"Unknown" | "Amino acid" | "Aminoglycoside" | "Anthracycline" | "Anthraquinone" | "Ansamycin" | "Chalkophore" | "Chromophore" | "Glycopeptide" | "Cyclic depsipeptide" | "Cyclic lipopeptide" | "Cyclic peptide" | "Heterocyclic" | "Imino sugar" | "Keto acid" | "Lipoglycopeptide" | "Lipopeptide" | "Macrolide" | "Non-polymer" | "Nucleoside" | "Oligopeptide" | "Oligosaccharide" | "Peptaibol" | "Peptide-like" | "Polycyclic" | "Polypeptide" | "Polysaccharide" | "Quinolone" | "Thiolactone" | "Thiopeptide" | "Siderophore" | "Chalkophore, Polypeptide">;
53
+ type: Schema.Aliased<"unknown" | "non-polymer" | "peptide-like" | "macrolide" | "amino acid" | "aminoglycoside" | "anthracycline" | "anthraquinone" | "ansamycin" | "chalkophore" | "chromophore" | "glycopeptide" | "cyclic depsipeptide" | "cyclic lipopeptide" | "cyclic peptide" | "heterocyclic" | "imino sugar" | "keto acid" | "lipoglycopeptide" | "lipopeptide" | "nucleoside" | "oligopeptide" | "oligosaccharide" | "peptaibol" | "polycyclic" | "polypeptide" | "polysaccharide" | "quinolone" | "thiolactone" | "thiopeptide" | "siderophore" | "chalkophore, polypeptide">;
54
54
  /**
55
55
  * Evidence for the assignment of _pdbx_reference_molecule.type
56
56
  */
@@ -58,7 +58,7 @@ export declare const BIRD_Schema: {
58
58
  /**
59
59
  * Broadly defines the function of the entity.
60
60
  */
61
- class: Schema.Aliased<"Antagonist" | "Antibiotic" | "Anticancer" | "Anticoagulant" | "Antifungal" | "Antigen" | "Antiinflammatory" | "Antimicrobial" | "Antineoplastic" | "Antiparasitic" | "Antiretroviral" | "Anthelmintic" | "Antithrombotic" | "Antitumor" | "Antiviral" | "CASPASE inhibitor" | "Chaperone binding" | "Enzyme inhibitor" | "Drug delivery" | "Glycan component" | "Growth factor" | "Immunosuppressant" | "Inducer" | "Inhibitor" | "Lantibiotic" | "Metabolism" | "Metal transport" | "Nutrient" | "Oxidation-reduction" | "Protein binding" | "Receptor" | "Substrate analog" | "Synthetic opioid" | "Thrombin inhibitor" | "Transition state mimetic" | "Transport activator" | "Trypsin inhibitor" | "Toxin" | "Unknown" | "Water retention" | "Anticoagulant, Antithrombotic" | "Antibiotic, Antimicrobial" | "Antibiotic, Anthelmintic" | "Antibiotic, Antineoplastic" | "Antimicrobial, Antiretroviral" | "Antimicrobial, Antitumor" | "Antimicrobial, Antiparasitic, Antibiotic" | "Thrombin inhibitor, Trypsin inhibitor">;
61
+ class: Schema.Aliased<"unknown" | "antagonist" | "antibiotic" | "anticancer" | "anticoagulant" | "antifungal" | "antigen" | "antiinflammatory" | "antimicrobial" | "antineoplastic" | "antiparasitic" | "antiretroviral" | "anthelmintic" | "antithrombotic" | "antitumor" | "antiviral" | "caspase inhibitor" | "chaperone binding" | "enzyme inhibitor" | "drug delivery" | "glycan component" | "growth factor" | "immunosuppressant" | "inducer" | "inhibitor" | "lantibiotic" | "metabolism" | "metal transport" | "nutrient" | "oxidation-reduction" | "protein binding" | "receptor" | "substrate analog" | "synthetic opioid" | "thrombin inhibitor" | "transition state mimetic" | "transport activator" | "trypsin inhibitor" | "toxin" | "water retention" | "anticoagulant, antithrombotic" | "antibiotic, antimicrobial" | "antibiotic, anthelmintic" | "antibiotic, antineoplastic" | "antimicrobial, antiretroviral" | "antimicrobial, antitumor" | "antimicrobial, antiparasitic, antibiotic" | "thrombin inhibitor, trypsin inhibitor">;
62
62
  /**
63
63
  * Evidence for the assignment of _pdbx_reference_molecule.class
64
64
  */
@@ -91,7 +91,7 @@ export declare const BIRD_Schema: {
91
91
  /**
92
92
  * Defines the current PDB release status for this molecule definition.
93
93
  */
94
- release_status: Schema.Aliased<"WAIT" | "REL" | "HOLD" | "OBS">;
94
+ release_status: Schema.Aliased<"wait" | "rel" | "hold" | "obs">;
95
95
  /**
96
96
  * Assigns the identifier for the reference molecule which have been replaced
97
97
  * by this reference molecule.
@@ -392,11 +392,11 @@ export declare const BIRD_Schema: {
392
392
  /**
393
393
  * A flag to indicate that this monomer is observed in the instance example.
394
394
  */
395
- observed: Schema.Aliased<"N" | "Y">;
395
+ observed: Schema.Aliased<"y" | "n">;
396
396
  /**
397
397
  * A flag to indicate that sequence heterogeneity at this monomer position.
398
398
  */
399
- hetero: Schema.Aliased<"N" | "Y">;
399
+ hetero: Schema.Aliased<"y" | "n">;
400
400
  };
401
401
  /**
402
402
  * Additional features associated with the reference entity.
@@ -479,7 +479,7 @@ export declare const BIRD_Schema: {
479
479
  /**
480
480
  * An identifier for the wwPDB site creating or modifying the molecule.
481
481
  */
482
- processing_site: Schema.Aliased<"RCSB" | "PDBE" | "BMRB" | "PDBJ" | "PDBC">;
482
+ processing_site: Schema.Aliased<"RCSB" | "PDBE" | "PDBJ" | "BMRB" | "PDBC">;
483
483
  /**
484
484
  * The action associated with this audit record.
485
485
  */
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  /**
3
- * Copyright (c) 2017-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
3
+ * Copyright (c) 2017-2022 mol* contributors, licensed under MIT, See LICENSE file for more info.
4
4
  *
5
- * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.356, IHM 1.17, MA 1.3.5.
5
+ * Code-generated 'BIRD' schema file. Dictionary versions: mmCIF 5.357, IHM 1.17, MA 1.3.6.
6
6
  *
7
7
  * @author molstar/ciftools package
8
8
  */
@@ -12,6 +12,7 @@ var db_1 = require("../../../../mol-data/db");
12
12
  var Schema = db_1.Column.Schema;
13
13
  var str = Schema.str;
14
14
  var float = Schema.float;
15
+ var lstr = Schema.lstr;
15
16
  var Aliased = Schema.Aliased;
16
17
  var int = Schema.int;
17
18
  exports.BIRD_Schema = {
@@ -57,7 +58,7 @@ exports.BIRD_Schema = {
57
58
  /**
58
59
  * Defines the structural classification of the entity.
59
60
  */
60
- type: Aliased(str),
61
+ type: Aliased(lstr),
61
62
  /**
62
63
  * Evidence for the assignment of _pdbx_reference_molecule.type
63
64
  */
@@ -65,7 +66,7 @@ exports.BIRD_Schema = {
65
66
  /**
66
67
  * Broadly defines the function of the entity.
67
68
  */
68
- class: Aliased(str),
69
+ class: Aliased(lstr),
69
70
  /**
70
71
  * Evidence for the assignment of _pdbx_reference_molecule.class
71
72
  */
@@ -77,7 +78,7 @@ exports.BIRD_Schema = {
77
78
  /**
78
79
  * Defines how this entity is represented in PDB data files.
79
80
  */
80
- represent_as: Aliased(str),
81
+ represent_as: Aliased(lstr),
81
82
  /**
82
83
  * For entities represented as single molecules, the identifier
83
84
  * corresponding to the chemical definition for the molecule.
@@ -98,7 +99,7 @@ exports.BIRD_Schema = {
98
99
  /**
99
100
  * Defines the current PDB release status for this molecule definition.
100
101
  */
101
- release_status: Aliased(str),
102
+ release_status: Aliased(lstr),
102
103
  /**
103
104
  * Assigns the identifier for the reference molecule which have been replaced
104
105
  * by this reference molecule.
@@ -128,7 +129,7 @@ exports.BIRD_Schema = {
128
129
  /**
129
130
  * Defines the polymer characteristic of the entity.
130
131
  */
131
- type: Aliased(str),
132
+ type: Aliased(lstr),
132
133
  /**
133
134
  * Additional details about this entity.
134
135
  */
@@ -248,7 +249,7 @@ exports.BIRD_Schema = {
248
249
  /**
249
250
  * The bond order target for the chemical linkage.
250
251
  */
251
- value_order: Aliased(str),
252
+ value_order: Aliased(lstr),
252
253
  /**
253
254
  * The entity component identifier for the first of two entities containing the linkage.
254
255
  */
@@ -334,7 +335,7 @@ exports.BIRD_Schema = {
334
335
  /**
335
336
  * The bond order target for the non-standard linkage.
336
337
  */
337
- value_order: Aliased(str),
338
+ value_order: Aliased(lstr),
338
339
  },
339
340
  /**
340
341
  * Data items in the PDBX_REFERENCE_ENTITY_POLY category record details about
@@ -399,11 +400,11 @@ exports.BIRD_Schema = {
399
400
  /**
400
401
  * A flag to indicate that this monomer is observed in the instance example.
401
402
  */
402
- observed: Aliased(str),
403
+ observed: Aliased(lstr),
403
404
  /**
404
405
  * A flag to indicate that sequence heterogeneity at this monomer position.
405
406
  */
406
- hetero: Aliased(str),
407
+ hetero: Aliased(lstr),
407
408
  },
408
409
  /**
409
410
  * Additional features associated with the reference entity.
@@ -8,5 +8,5 @@ export declare const ccd_chemCompAtom_schema: {
8
8
  comp_id: import("../../../../mol-data/db/column").Column.Schema.Str;
9
9
  atom_id: import("../../../../mol-data/db/column").Column.Schema.Str;
10
10
  charge: import("../../../../mol-data/db/column").Column.Schema.Int;
11
- pdbx_stereo_config: import("../../../../mol-data/db/column").Column.Schema.Aliased<"N" | "R" | "S">;
11
+ pdbx_stereo_config: import("../../../../mol-data/db/column").Column.Schema.Aliased<"s" | "r" | "n">;
12
12
  };