molstar 3.0.0-dev.7 → 3.0.0-dev.8

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 (245) hide show
  1. package/build/viewer/index.html +4 -0
  2. package/build/viewer/molstar.js +1 -1
  3. package/lib/apps/viewer/index.d.ts +1 -0
  4. package/lib/apps/viewer/index.html +4 -0
  5. package/lib/apps/viewer/index.js +2 -0
  6. package/lib/commonjs/apps/viewer/index.d.ts +1 -0
  7. package/lib/commonjs/apps/viewer/index.js +2 -0
  8. package/lib/commonjs/examples/alpha-orbitals/index.js +1 -1
  9. package/lib/commonjs/extensions/geo-export/mesh-exporter.js +4 -4
  10. package/lib/commonjs/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
  11. package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +1 -1
  12. package/lib/commonjs/mol-canvas3d/canvas3d.js +33 -29
  13. package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +13 -1
  14. package/lib/commonjs/mol-canvas3d/passes/draw.js +16 -15
  15. package/lib/commonjs/mol-canvas3d/passes/image.js +3 -2
  16. package/lib/commonjs/mol-canvas3d/passes/marking.js +1 -1
  17. package/lib/commonjs/mol-canvas3d/passes/multi-sample.d.ts +9 -2
  18. package/lib/commonjs/mol-canvas3d/passes/multi-sample.js +14 -12
  19. package/lib/commonjs/mol-canvas3d/passes/pick.js +3 -3
  20. package/lib/commonjs/mol-geo/geometry/color-data.d.ts +1 -1
  21. package/lib/commonjs/mol-geo/geometry/color-data.js +22 -0
  22. package/lib/commonjs/mol-geo/geometry/cylinders/cylinders.js +1 -1
  23. package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.d.ts +5 -38
  24. package/lib/commonjs/mol-geo/geometry/direct-volume/direct-volume.js +21 -66
  25. package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
  26. package/lib/commonjs/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
  27. package/lib/commonjs/mol-geo/geometry/image/image.js +1 -1
  28. package/lib/commonjs/mol-geo/geometry/lines/lines.js +1 -1
  29. package/lib/commonjs/mol-geo/geometry/marker-data.js +13 -5
  30. package/lib/commonjs/mol-geo/geometry/mesh/mesh.js +1 -1
  31. package/lib/commonjs/mol-geo/geometry/points/points.js +1 -1
  32. package/lib/commonjs/mol-geo/geometry/size-data.js +5 -5
  33. package/lib/commonjs/mol-geo/geometry/spheres/spheres.js +1 -1
  34. package/lib/commonjs/mol-geo/geometry/text/text.js +1 -1
  35. package/lib/commonjs/mol-geo/geometry/texture-mesh/texture-mesh.js +1 -1
  36. package/lib/commonjs/mol-gl/compute/histogram-pyramid/sum.js +2 -2
  37. package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
  38. package/lib/commonjs/mol-gl/compute/marching-cubes/isosurface.js +10 -9
  39. package/lib/commonjs/mol-gl/renderable/cylinders.d.ts +1 -0
  40. package/lib/commonjs/mol-gl/renderable/direct-volume.d.ts +6 -10
  41. package/lib/commonjs/mol-gl/renderable/direct-volume.js +1 -1
  42. package/lib/commonjs/mol-gl/renderable/image.d.ts +1 -0
  43. package/lib/commonjs/mol-gl/renderable/lines.d.ts +1 -0
  44. package/lib/commonjs/mol-gl/renderable/mesh.d.ts +1 -0
  45. package/lib/commonjs/mol-gl/renderable/points.d.ts +1 -0
  46. package/lib/commonjs/mol-gl/renderable/schema.d.ts +1 -0
  47. package/lib/commonjs/mol-gl/renderable/schema.js +2 -2
  48. package/lib/commonjs/mol-gl/renderable/spheres.d.ts +1 -0
  49. package/lib/commonjs/mol-gl/renderable/text.d.ts +1 -0
  50. package/lib/commonjs/mol-gl/renderable/texture-mesh.d.ts +1 -1
  51. package/lib/commonjs/mol-gl/renderable/texture-mesh.js +1 -1
  52. package/lib/commonjs/mol-gl/renderer.js +12 -19
  53. package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
  54. package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
  55. package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
  56. package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
  57. package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
  58. package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
  59. package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
  60. package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
  61. package/lib/commonjs/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
  62. package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +1 -1
  63. package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
  64. package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
  65. package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
  66. package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
  67. package/lib/commonjs/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  68. package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +1 -1
  69. package/lib/commonjs/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
  70. package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +1 -1
  71. package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
  72. package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
  73. package/lib/commonjs/mol-gl/shader/image.frag.d.ts +1 -1
  74. package/lib/commonjs/mol-gl/shader/image.frag.js +1 -1
  75. package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
  76. package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
  77. package/lib/commonjs/mol-gl/shader/mesh.vert.d.ts +1 -1
  78. package/lib/commonjs/mol-gl/shader/mesh.vert.js +1 -1
  79. package/lib/commonjs/mol-gl/shader-code.js +1 -1
  80. package/lib/commonjs/mol-math/geometry/gaussian-density/gpu.js +2 -2
  81. package/lib/commonjs/mol-plugin/behavior/dynamic/representation.js +4 -6
  82. package/lib/commonjs/mol-plugin/config.d.ts +0 -1
  83. package/lib/commonjs/mol-plugin/config.js +4 -25
  84. package/lib/commonjs/mol-plugin/features.d.ts +9 -0
  85. package/lib/commonjs/mol-plugin/features.js +38 -0
  86. package/lib/commonjs/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
  87. package/lib/commonjs/mol-plugin-state/manager/structure/selection.js +3 -1
  88. package/lib/commonjs/mol-plugin-state/transforms/representation.js +2 -2
  89. package/lib/commonjs/mol-repr/structure/complex-representation.js +1 -1
  90. package/lib/commonjs/mol-repr/structure/complex-visual.d.ts +1 -19
  91. package/lib/commonjs/mol-repr/structure/params.d.ts +1 -19
  92. package/lib/commonjs/mol-repr/structure/registry.d.ts +1 -19
  93. package/lib/commonjs/mol-repr/structure/representation/gaussian-surface.js +1 -1
  94. package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.d.ts +4 -58
  95. package/lib/commonjs/mol-repr/structure/representation/gaussian-volume.js +2 -7
  96. package/lib/commonjs/mol-repr/structure/representation/label.js +1 -1
  97. package/lib/commonjs/mol-repr/structure/representation/molecular-surface.js +1 -1
  98. package/lib/commonjs/mol-repr/structure/units-representation.js +1 -1
  99. package/lib/commonjs/mol-repr/structure/units-visual.d.ts +1 -19
  100. package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -38
  101. package/lib/commonjs/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
  102. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
  103. package/lib/commonjs/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
  104. package/lib/commonjs/mol-repr/structure/visual/label-text.js +1 -2
  105. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
  106. package/lib/commonjs/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
  107. package/lib/commonjs/mol-repr/structure/visual/util/common.d.ts +3 -2
  108. package/lib/commonjs/mol-repr/structure/visual/util/common.js +2 -5
  109. package/lib/commonjs/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
  110. package/lib/commonjs/mol-repr/structure/visual/util/gaussian.js +12 -12
  111. package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
  112. package/lib/commonjs/mol-repr/structure/visual/util/molecular-surface.js +4 -4
  113. package/lib/commonjs/mol-repr/volume/direct-volume.d.ts +3 -57
  114. package/lib/commonjs/mol-repr/volume/direct-volume.js +8 -12
  115. package/lib/commonjs/mol-repr/volume/isosurface.js +11 -2
  116. package/lib/commonjs/mol-repr/volume/registry.d.ts +1 -19
  117. package/lib/commonjs/mol-repr/volume/slice.js +2 -2
  118. package/lib/commonjs/mol-repr/volume/util.js +2 -2
  119. package/lib/commonjs/mol-theme/color/volume-value.d.ts +17 -0
  120. package/lib/commonjs/mol-theme/color/volume-value.js +57 -0
  121. package/lib/commonjs/mol-theme/color.d.ts +3 -0
  122. package/lib/commonjs/mol-theme/color.js +2 -0
  123. package/lib/commonjs/mol-util/number-packing.d.ts +11 -0
  124. package/lib/commonjs/mol-util/{float-packing.js → number-packing.js} +10 -19
  125. package/lib/examples/alpha-orbitals/index.js +1 -1
  126. package/lib/extensions/geo-export/mesh-exporter.js +4 -4
  127. package/lib/extensions/rcsb/assembly-symmetry/behavior.d.ts +2 -2
  128. package/lib/mol-canvas3d/canvas3d.d.ts +1 -1
  129. package/lib/mol-canvas3d/canvas3d.js +33 -29
  130. package/lib/mol-canvas3d/passes/draw.d.ts +13 -1
  131. package/lib/mol-canvas3d/passes/draw.js +16 -15
  132. package/lib/mol-canvas3d/passes/image.js +3 -2
  133. package/lib/mol-canvas3d/passes/marking.js +1 -1
  134. package/lib/mol-canvas3d/passes/multi-sample.d.ts +9 -2
  135. package/lib/mol-canvas3d/passes/multi-sample.js +14 -12
  136. package/lib/mol-canvas3d/passes/pick.js +2 -2
  137. package/lib/mol-geo/geometry/color-data.d.ts +1 -1
  138. package/lib/mol-geo/geometry/color-data.js +22 -0
  139. package/lib/mol-geo/geometry/cylinders/cylinders.js +1 -1
  140. package/lib/mol-geo/geometry/direct-volume/direct-volume.d.ts +5 -38
  141. package/lib/mol-geo/geometry/direct-volume/direct-volume.js +22 -67
  142. package/lib/mol-geo/geometry/direct-volume/transfer-function.d.ts +2 -4
  143. package/lib/mol-geo/geometry/direct-volume/transfer-function.js +4 -7
  144. package/lib/mol-geo/geometry/image/image.js +1 -1
  145. package/lib/mol-geo/geometry/lines/lines.js +1 -1
  146. package/lib/mol-geo/geometry/marker-data.js +13 -5
  147. package/lib/mol-geo/geometry/mesh/mesh.js +1 -1
  148. package/lib/mol-geo/geometry/points/points.js +1 -1
  149. package/lib/mol-geo/geometry/size-data.js +5 -5
  150. package/lib/mol-geo/geometry/spheres/spheres.js +1 -1
  151. package/lib/mol-geo/geometry/text/text.js +1 -1
  152. package/lib/mol-geo/geometry/texture-mesh/texture-mesh.js +1 -1
  153. package/lib/mol-gl/compute/histogram-pyramid/sum.js +2 -2
  154. package/lib/mol-gl/compute/marching-cubes/isosurface.d.ts +2 -2
  155. package/lib/mol-gl/compute/marching-cubes/isosurface.js +10 -9
  156. package/lib/mol-gl/renderable/cylinders.d.ts +1 -0
  157. package/lib/mol-gl/renderable/direct-volume.d.ts +6 -10
  158. package/lib/mol-gl/renderable/direct-volume.js +1 -1
  159. package/lib/mol-gl/renderable/image.d.ts +1 -0
  160. package/lib/mol-gl/renderable/lines.d.ts +1 -0
  161. package/lib/mol-gl/renderable/mesh.d.ts +1 -0
  162. package/lib/mol-gl/renderable/points.d.ts +1 -0
  163. package/lib/mol-gl/renderable/schema.d.ts +1 -0
  164. package/lib/mol-gl/renderable/schema.js +2 -2
  165. package/lib/mol-gl/renderable/spheres.d.ts +1 -0
  166. package/lib/mol-gl/renderable/text.d.ts +1 -0
  167. package/lib/mol-gl/renderable/texture-mesh.d.ts +1 -1
  168. package/lib/mol-gl/renderable/texture-mesh.js +1 -1
  169. package/lib/mol-gl/renderer.js +12 -19
  170. package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.d.ts +1 -1
  171. package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +1 -1
  172. package/lib/mol-gl/shader/chunks/assign-group.glsl.d.ts +1 -1
  173. package/lib/mol-gl/shader/chunks/assign-group.glsl.js +1 -1
  174. package/lib/mol-gl/shader/chunks/assign-position.glsl.d.ts +1 -1
  175. package/lib/mol-gl/shader/chunks/assign-position.glsl.js +1 -1
  176. package/lib/mol-gl/shader/chunks/assign-size.glsl.d.ts +1 -1
  177. package/lib/mol-gl/shader/chunks/assign-size.glsl.js +1 -1
  178. package/lib/mol-gl/shader/chunks/common.glsl.d.ts +1 -1
  179. package/lib/mol-gl/shader/chunks/common.glsl.js +1 -1
  180. package/lib/mol-gl/shader/chunks/wboit-write.glsl.d.ts +1 -1
  181. package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +1 -1
  182. package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.d.ts +1 -1
  183. package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +1 -1
  184. package/lib/mol-gl/shader/direct-volume.frag.d.ts +1 -1
  185. package/lib/mol-gl/shader/direct-volume.frag.js +1 -1
  186. package/lib/mol-gl/shader/gaussian-density.frag.d.ts +1 -1
  187. package/lib/mol-gl/shader/gaussian-density.frag.js +1 -1
  188. package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.d.ts +1 -1
  189. package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +1 -1
  190. package/lib/mol-gl/shader/image.frag.d.ts +1 -1
  191. package/lib/mol-gl/shader/image.frag.js +1 -1
  192. package/lib/mol-gl/shader/marching-cubes/isosurface.frag.d.ts +1 -1
  193. package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +1 -1
  194. package/lib/mol-gl/shader/mesh.vert.d.ts +1 -1
  195. package/lib/mol-gl/shader/mesh.vert.js +1 -1
  196. package/lib/mol-gl/shader-code.js +1 -1
  197. package/lib/mol-math/geometry/gaussian-density/gpu.js +2 -2
  198. package/lib/mol-plugin/behavior/dynamic/representation.js +4 -6
  199. package/lib/mol-plugin/config.d.ts +0 -1
  200. package/lib/mol-plugin/config.js +3 -23
  201. package/lib/mol-plugin/features.d.ts +9 -0
  202. package/lib/mol-plugin/features.js +35 -0
  203. package/lib/mol-plugin/version.js +2 -2
  204. package/lib/mol-plugin-state/builder/structure/representation-preset.d.ts +4 -4
  205. package/lib/mol-plugin-state/manager/structure/selection.js +3 -1
  206. package/lib/mol-plugin-state/transforms/representation.js +2 -2
  207. package/lib/mol-repr/structure/complex-representation.js +1 -1
  208. package/lib/mol-repr/structure/complex-visual.d.ts +1 -19
  209. package/lib/mol-repr/structure/params.d.ts +1 -19
  210. package/lib/mol-repr/structure/registry.d.ts +1 -19
  211. package/lib/mol-repr/structure/representation/gaussian-surface.js +1 -1
  212. package/lib/mol-repr/structure/representation/gaussian-volume.d.ts +4 -58
  213. package/lib/mol-repr/structure/representation/gaussian-volume.js +2 -7
  214. package/lib/mol-repr/structure/representation/label.js +1 -1
  215. package/lib/mol-repr/structure/representation/molecular-surface.js +1 -1
  216. package/lib/mol-repr/structure/units-representation.js +1 -1
  217. package/lib/mol-repr/structure/units-visual.d.ts +1 -19
  218. package/lib/mol-repr/structure/visual/gaussian-density-volume.d.ts +2 -38
  219. package/lib/mol-repr/structure/visual/gaussian-density-volume.js +8 -6
  220. package/lib/mol-repr/structure/visual/gaussian-surface-mesh.js +11 -8
  221. package/lib/mol-repr/structure/visual/gaussian-surface-wireframe.js +1 -1
  222. package/lib/mol-repr/structure/visual/label-text.js +1 -2
  223. package/lib/mol-repr/structure/visual/molecular-surface-mesh.js +1 -1
  224. package/lib/mol-repr/structure/visual/molecular-surface-wireframe.js +1 -1
  225. package/lib/mol-repr/structure/visual/util/common.d.ts +3 -2
  226. package/lib/mol-repr/structure/visual/util/common.js +2 -5
  227. package/lib/mol-repr/structure/visual/util/gaussian.d.ts +7 -6
  228. package/lib/mol-repr/structure/visual/util/gaussian.js +12 -12
  229. package/lib/mol-repr/structure/visual/util/molecular-surface.d.ts +2 -1
  230. package/lib/mol-repr/structure/visual/util/molecular-surface.js +4 -4
  231. package/lib/mol-repr/volume/direct-volume.d.ts +3 -57
  232. package/lib/mol-repr/volume/direct-volume.js +8 -12
  233. package/lib/mol-repr/volume/isosurface.js +11 -2
  234. package/lib/mol-repr/volume/registry.d.ts +1 -19
  235. package/lib/mol-repr/volume/slice.js +2 -2
  236. package/lib/mol-repr/volume/util.js +2 -2
  237. package/lib/mol-theme/color/volume-value.d.ts +17 -0
  238. package/lib/mol-theme/color/volume-value.js +52 -0
  239. package/lib/mol-theme/color.d.ts +3 -0
  240. package/lib/mol-theme/color.js +2 -0
  241. package/lib/mol-util/number-packing.d.ts +11 -0
  242. package/lib/mol-util/{float-packing.js → number-packing.js} +7 -14
  243. package/package.json +1 -1
  244. package/lib/commonjs/mol-util/float-packing.d.ts +0 -15
  245. package/lib/mol-util/float-packing.d.ts +0 -15
@@ -10,11 +10,6 @@ import { AttributeSpec, Values, UniformSpec, TextureSpec, ElementsSpec, DefineSp
10
10
  export declare const DirectVolumeSchema: {
11
11
  aPosition: AttributeSpec<"float32">;
12
12
  elements: ElementsSpec<"uint32">;
13
- uColor: UniformSpec<"v3">;
14
- uColorTexDim: UniformSpec<"v2">;
15
- tColor: TextureSpec<"image-uint8">;
16
- dColorType: DefineSpec<"string">;
17
- uIsoValue: UniformSpec<"v2">;
18
13
  uBboxMin: UniformSpec<"v3">;
19
14
  uBboxMax: UniformSpec<"v3">;
20
15
  uBboxSize: UniformSpec<"v3">;
@@ -23,8 +18,6 @@ export declare const DirectVolumeSchema: {
23
18
  uJumpLength: UniformSpec<"f">;
24
19
  uTransform: UniformSpec<"m4">;
25
20
  uGridDim: UniformSpec<"v3">;
26
- dRenderMode: DefineSpec<"string">;
27
- dSingleLayer: DefineSpec<"boolean">;
28
21
  tTransferTex: TextureSpec<"image-uint8">;
29
22
  uTransferScale: UniformSpec<"f">;
30
23
  dGridTexType: DefineSpec<"string">;
@@ -35,9 +28,7 @@ export declare const DirectVolumeSchema: {
35
28
  uCartnToUnit: UniformSpec<"m4">;
36
29
  uUnitToCartn: UniformSpec<"m4">;
37
30
  dPackedGroup: DefineSpec<"boolean">;
38
- uDoubleSided: UniformSpec<"b">;
39
- dFlipSided: DefineSpec<"boolean">;
40
- dFlatShaded: DefineSpec<"boolean">;
31
+ dAxisOrder: DefineSpec<"string">;
41
32
  dIgnoreLight: DefineSpec<"boolean">;
42
33
  dXrayShaded: DefineSpec<"boolean">;
43
34
  dLightCount: DefineSpec<"number">;
@@ -97,11 +88,16 @@ export declare const DirectVolumeSchema: {
97
88
  tMarker: TextureSpec<"image-uint8">;
98
89
  markerAverage: import("./schema").ValueSpec<"number">;
99
90
  markerStatus: import("./schema").ValueSpec<"number">;
91
+ uColor: UniformSpec<"v3">;
92
+ uColorTexDim: UniformSpec<"v2">;
100
93
  uColorGridDim: UniformSpec<"v3">;
101
94
  uColorGridTransform: UniformSpec<"v4">;
95
+ tColor: TextureSpec<"image-uint8">;
102
96
  tPalette: TextureSpec<"image-uint8">;
103
97
  tColorGrid: TextureSpec<"texture">;
98
+ dColorType: DefineSpec<"string">;
104
99
  dUsePalette: DefineSpec<"boolean">;
100
+ dGeometryType: DefineSpec<"string">;
105
101
  };
106
102
  export declare type DirectVolumeSchema = typeof DirectVolumeSchema;
107
103
  export declare type DirectVolumeValues = Values<DirectVolumeSchema>;
@@ -12,7 +12,7 @@ var render_item_1 = require("../webgl/render-item");
12
12
  var schema_1 = require("./schema");
13
13
  var shader_code_1 = require("../shader-code");
14
14
  var mol_util_1 = require("../../mol-util");
15
- exports.DirectVolumeSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.BaseSchema), { aPosition: (0, schema_1.AttributeSpec)('float32', 3, 0), elements: (0, schema_1.ElementsSpec)('uint32'), uColor: (0, schema_1.UniformSpec)('v3'), uColorTexDim: (0, schema_1.UniformSpec)('v2'), tColor: (0, schema_1.TextureSpec)('image-uint8', 'rgb', 'ubyte', 'nearest'), dColorType: (0, schema_1.DefineSpec)('string', ['uniform', 'attribute', 'instance', 'group', 'groupInstance', 'vertex', 'vertexInstance']), uIsoValue: (0, schema_1.UniformSpec)('v2'), uBboxMin: (0, schema_1.UniformSpec)('v3'), uBboxMax: (0, schema_1.UniformSpec)('v3'), uBboxSize: (0, schema_1.UniformSpec)('v3'), uMaxSteps: (0, schema_1.UniformSpec)('i'), uStepScale: (0, schema_1.UniformSpec)('f'), uJumpLength: (0, schema_1.UniformSpec)('f'), uTransform: (0, schema_1.UniformSpec)('m4'), uGridDim: (0, schema_1.UniformSpec)('v3'), dRenderMode: (0, schema_1.DefineSpec)('string', ['isosurface', 'volume']), dSingleLayer: (0, schema_1.DefineSpec)('boolean'), tTransferTex: (0, schema_1.TextureSpec)('image-uint8', 'rgba', 'ubyte', 'linear'), uTransferScale: (0, schema_1.UniformSpec)('f'), dGridTexType: (0, schema_1.DefineSpec)('string', ['2d', '3d']), uGridTexDim: (0, schema_1.UniformSpec)('v3'), tGridTex: (0, schema_1.TextureSpec)('texture', 'rgba', 'ubyte', 'linear'), uGridStats: (0, schema_1.UniformSpec)('v4'), uCellDim: (0, schema_1.UniformSpec)('v3'), uCartnToUnit: (0, schema_1.UniformSpec)('m4'), uUnitToCartn: (0, schema_1.UniformSpec)('m4'), dPackedGroup: (0, schema_1.DefineSpec)('boolean'), uDoubleSided: (0, schema_1.UniformSpec)('b'), dFlipSided: (0, schema_1.DefineSpec)('boolean'), dFlatShaded: (0, schema_1.DefineSpec)('boolean'), dIgnoreLight: (0, schema_1.DefineSpec)('boolean'), dXrayShaded: (0, schema_1.DefineSpec)('boolean') });
15
+ exports.DirectVolumeSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.BaseSchema), { aPosition: (0, schema_1.AttributeSpec)('float32', 3, 0), elements: (0, schema_1.ElementsSpec)('uint32'), uBboxMin: (0, schema_1.UniformSpec)('v3'), uBboxMax: (0, schema_1.UniformSpec)('v3'), uBboxSize: (0, schema_1.UniformSpec)('v3'), uMaxSteps: (0, schema_1.UniformSpec)('i'), uStepScale: (0, schema_1.UniformSpec)('f'), uJumpLength: (0, schema_1.UniformSpec)('f'), uTransform: (0, schema_1.UniformSpec)('m4'), uGridDim: (0, schema_1.UniformSpec)('v3'), tTransferTex: (0, schema_1.TextureSpec)('image-uint8', 'alpha', 'ubyte', 'linear'), uTransferScale: (0, schema_1.UniformSpec)('f'), dGridTexType: (0, schema_1.DefineSpec)('string', ['2d', '3d']), uGridTexDim: (0, schema_1.UniformSpec)('v3'), tGridTex: (0, schema_1.TextureSpec)('texture', 'rgba', 'ubyte', 'linear'), uGridStats: (0, schema_1.UniformSpec)('v4'), uCellDim: (0, schema_1.UniformSpec)('v3'), uCartnToUnit: (0, schema_1.UniformSpec)('m4'), uUnitToCartn: (0, schema_1.UniformSpec)('m4'), dPackedGroup: (0, schema_1.DefineSpec)('boolean'), dAxisOrder: (0, schema_1.DefineSpec)('string', ['012', '021', '102', '120', '201', '210']), dIgnoreLight: (0, schema_1.DefineSpec)('boolean'), dXrayShaded: (0, schema_1.DefineSpec)('boolean') });
16
16
  function DirectVolumeRenderable(ctx, id, values, state, materialId, variants) {
17
17
  var schema = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.GlobalUniformSchema), schema_1.GlobalTextureSchema), schema_1.InternalSchema), exports.DirectVolumeSchema);
18
18
  if (!ctx.isWebGL2) {
@@ -82,6 +82,7 @@ export declare const ImageSchema: {
82
82
  tColorGrid: TextureSpec<"texture">;
83
83
  dColorType: DefineSpec<"string">;
84
84
  dUsePalette: DefineSpec<"boolean">;
85
+ dGeometryType: DefineSpec<"string">;
85
86
  };
86
87
  export declare type ImageSchema = typeof ImageSchema;
87
88
  export declare type ImageValues = Values<ImageSchema>;
@@ -87,6 +87,7 @@ export declare const LinesSchema: {
87
87
  tColorGrid: import("./schema").TextureSpec<"texture">;
88
88
  dColorType: DefineSpec<"string">;
89
89
  dUsePalette: DefineSpec<"boolean">;
90
+ dGeometryType: DefineSpec<"string">;
90
91
  };
91
92
  export declare type LinesSchema = typeof LinesSchema;
92
93
  export declare type LinesValues = Values<LinesSchema>;
@@ -86,6 +86,7 @@ export declare const MeshSchema: {
86
86
  readonly tColorGrid: import("./schema").TextureSpec<"texture">;
87
87
  readonly dColorType: DefineSpec<"string">;
88
88
  readonly dUsePalette: DefineSpec<"boolean">;
89
+ readonly dGeometryType: DefineSpec<"string">;
89
90
  };
90
91
  export declare type MeshSchema = typeof MeshSchema;
91
92
  export declare type MeshValues = Values<MeshSchema>;
@@ -83,6 +83,7 @@ export declare const PointsSchema: {
83
83
  tColorGrid: import("./schema").TextureSpec<"texture">;
84
84
  dColorType: DefineSpec<"string">;
85
85
  dUsePalette: DefineSpec<"boolean">;
86
+ dGeometryType: DefineSpec<"string">;
86
87
  };
87
88
  export declare type PointsSchema = typeof PointsSchema;
88
89
  export declare type PointsValues = Values<PointsSchema>;
@@ -289,6 +289,7 @@ export declare const BaseSchema: {
289
289
  readonly tColorGrid: TextureSpec<"texture">;
290
290
  readonly dColorType: DefineSpec<"string">;
291
291
  readonly dUsePalette: DefineSpec<"boolean">;
292
+ readonly dGeometryType: DefineSpec<"string">;
292
293
  };
293
294
  export declare type BaseSchema = typeof BaseSchema;
294
295
  export declare type BaseValues = Values<BaseSchema>;
@@ -125,7 +125,7 @@ exports.ColorSchema = {
125
125
  tColor: TextureSpec('image-uint8', 'rgb', 'ubyte', 'nearest'),
126
126
  tPalette: TextureSpec('image-uint8', 'rgb', 'ubyte', 'nearest'),
127
127
  tColorGrid: TextureSpec('texture', 'rgb', 'ubyte', 'linear'),
128
- dColorType: DefineSpec('string', ['uniform', 'attribute', 'instance', 'group', 'groupInstance', 'vertex', 'vertexInstance', 'volume', 'volumeInstance']),
128
+ dColorType: DefineSpec('string', ['uniform', 'attribute', 'instance', 'group', 'groupInstance', 'vertex', 'vertexInstance', 'volume', 'volumeInstance', 'direct']),
129
129
  dUsePalette: DefineSpec('boolean'),
130
130
  };
131
131
  exports.SizeSchema = {
@@ -176,7 +176,7 @@ exports.ClippingSchema = {
176
176
  tClipping: TextureSpec('image-uint8', 'alpha', 'ubyte', 'nearest'),
177
177
  dClipping: DefineSpec('boolean'),
178
178
  };
179
- exports.BaseSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, exports.ColorSchema), exports.MarkerSchema), exports.OverpaintSchema), exports.TransparencySchema), exports.SubstanceSchema), exports.ClippingSchema), { dLightCount: DefineSpec('number'), dClipObjectCount: DefineSpec('number'), dClipVariant: DefineSpec('string', ['instance', 'pixel']), uClipObjectType: UniformSpec('i[]'), uClipObjectInvert: UniformSpec('b[]'), uClipObjectPosition: UniformSpec('v3[]'), uClipObjectRotation: UniformSpec('v4[]'), uClipObjectScale: UniformSpec('v3[]'), aInstance: AttributeSpec('float32', 1, 1),
179
+ exports.BaseSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({ dGeometryType: DefineSpec('string', ['cylinders', 'directVolume', 'image', 'lines', 'mesh', 'points', 'spheres', 'text', 'textureMesh']) }, exports.ColorSchema), exports.MarkerSchema), exports.OverpaintSchema), exports.TransparencySchema), exports.SubstanceSchema), exports.ClippingSchema), { dLightCount: DefineSpec('number'), dClipObjectCount: DefineSpec('number'), dClipVariant: DefineSpec('string', ['instance', 'pixel']), uClipObjectType: UniformSpec('i[]'), uClipObjectInvert: UniformSpec('b[]'), uClipObjectPosition: UniformSpec('v3[]'), uClipObjectRotation: UniformSpec('v4[]'), uClipObjectScale: UniformSpec('v3[]'), aInstance: AttributeSpec('float32', 1, 1),
180
180
  /**
181
181
  * final per-instance transform calculated for instance `i` as
182
182
  * `aTransform[i] = matrix * transform[i] * extraTransform[i]`
@@ -89,6 +89,7 @@ export declare const SpheresSchema: {
89
89
  tColorGrid: import("./schema").TextureSpec<"texture">;
90
90
  dColorType: DefineSpec<"string">;
91
91
  dUsePalette: DefineSpec<"boolean">;
92
+ dGeometryType: DefineSpec<"string">;
92
93
  };
93
94
  export declare type SpheresSchema = typeof SpheresSchema;
94
95
  export declare type SpheresValues = Values<SpheresSchema>;
@@ -94,6 +94,7 @@ export declare const TextSchema: {
94
94
  tColorGrid: TextureSpec<"texture">;
95
95
  dColorType: import("./schema").DefineSpec<"string">;
96
96
  dUsePalette: import("./schema").DefineSpec<"boolean">;
97
+ dGeometryType: import("./schema").DefineSpec<"string">;
97
98
  };
98
99
  export declare type TextSchema = typeof TextSchema;
99
100
  export declare type TextValues = Values<TextSchema>;
@@ -17,7 +17,6 @@ export declare const TextureMeshSchema: {
17
17
  dFlipSided: DefineSpec<"boolean">;
18
18
  dIgnoreLight: DefineSpec<"boolean">;
19
19
  dXrayShaded: DefineSpec<"boolean">;
20
- dGeoTexture: DefineSpec<"boolean">;
21
20
  uBumpFrequency: UniformSpec<"f">;
22
21
  uBumpAmplitude: UniformSpec<"f">;
23
22
  meta: ValueSpec<"unknown">;
@@ -87,6 +86,7 @@ export declare const TextureMeshSchema: {
87
86
  tColorGrid: TextureSpec<"texture">;
88
87
  dColorType: DefineSpec<"string">;
89
88
  dUsePalette: DefineSpec<"boolean">;
89
+ dGeometryType: DefineSpec<"string">;
90
90
  };
91
91
  export declare type TextureMeshSchema = typeof TextureMeshSchema;
92
92
  export declare type TextureMeshValues = Values<TextureMeshSchema>;
@@ -12,7 +12,7 @@ var render_item_1 = require("../webgl/render-item");
12
12
  var schema_1 = require("./schema");
13
13
  var shader_code_1 = require("../shader-code");
14
14
  var mol_util_1 = require("../../mol-util");
15
- exports.TextureMeshSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.BaseSchema), { uGeoTexDim: (0, schema_1.UniformSpec)('v2', 'buffered'), tPosition: (0, schema_1.TextureSpec)('texture', 'rgb', 'float', 'nearest'), tGroup: (0, schema_1.TextureSpec)('texture', 'alpha', 'float', 'nearest'), tNormal: (0, schema_1.TextureSpec)('texture', 'rgb', 'float', 'nearest'), dFlatShaded: (0, schema_1.DefineSpec)('boolean'), uDoubleSided: (0, schema_1.UniformSpec)('b'), dFlipSided: (0, schema_1.DefineSpec)('boolean'), dIgnoreLight: (0, schema_1.DefineSpec)('boolean'), dXrayShaded: (0, schema_1.DefineSpec)('boolean'), dGeoTexture: (0, schema_1.DefineSpec)('boolean'), uBumpFrequency: (0, schema_1.UniformSpec)('f'), uBumpAmplitude: (0, schema_1.UniformSpec)('f'), meta: (0, schema_1.ValueSpec)('unknown') });
15
+ exports.TextureMeshSchema = (0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.BaseSchema), { uGeoTexDim: (0, schema_1.UniformSpec)('v2', 'buffered'), tPosition: (0, schema_1.TextureSpec)('texture', 'rgb', 'float', 'nearest'), tGroup: (0, schema_1.TextureSpec)('texture', 'alpha', 'float', 'nearest'), tNormal: (0, schema_1.TextureSpec)('texture', 'rgb', 'float', 'nearest'), dFlatShaded: (0, schema_1.DefineSpec)('boolean'), uDoubleSided: (0, schema_1.UniformSpec)('b'), dFlipSided: (0, schema_1.DefineSpec)('boolean'), dIgnoreLight: (0, schema_1.DefineSpec)('boolean'), dXrayShaded: (0, schema_1.DefineSpec)('boolean'), uBumpFrequency: (0, schema_1.UniformSpec)('f'), uBumpAmplitude: (0, schema_1.UniformSpec)('f'), meta: (0, schema_1.ValueSpec)('unknown') });
16
16
  function TextureMeshRenderable(ctx, id, values, state, materialId, variants) {
17
17
  var schema = (0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)((0, tslib_1.__assign)({}, schema_1.GlobalUniformSchema), schema_1.GlobalTextureSchema), schema_1.InternalSchema), exports.TextureMeshSchema);
18
18
  var internalValues = {
@@ -23,8 +23,8 @@ exports.RendererParams = {
23
23
  interiorColor: param_definition_1.ParamDefinition.Color(color_1.Color.fromNormalizedRgb(0.3, 0.3, 0.3)),
24
24
  highlightColor: param_definition_1.ParamDefinition.Color(color_1.Color.fromNormalizedRgb(1.0, 0.4, 0.6)),
25
25
  selectColor: param_definition_1.ParamDefinition.Color(color_1.Color.fromNormalizedRgb(0.2, 1.0, 0.1)),
26
- highlightStrength: param_definition_1.ParamDefinition.Numeric(0.7, { min: 0.0, max: 1.0, step: 0.1 }),
27
- selectStrength: param_definition_1.ParamDefinition.Numeric(0.7, { min: 0.0, max: 1.0, step: 0.1 }),
26
+ highlightStrength: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0.0, max: 1.0, step: 0.1 }),
27
+ selectStrength: param_definition_1.ParamDefinition.Numeric(0.3, { min: 0.0, max: 1.0, step: 0.1 }),
28
28
  markerPriority: param_definition_1.ParamDefinition.Select(1, [[1, 'Highlight'], [2, 'Select']]),
29
29
  xrayEdgeFalloff: param_definition_1.ParamDefinition.Numeric(1, { min: 0.0, max: 3.0, step: 0.1 }),
30
30
  light: param_definition_1.ParamDefinition.ObjectList({
@@ -61,7 +61,7 @@ var Renderer;
61
61
  (function (Renderer) {
62
62
  function create(ctx, props) {
63
63
  if (props === void 0) { props = {}; }
64
- var gl = ctx.gl, state = ctx.state, stats = ctx.stats, fragDepth = ctx.extensions.fragDepth;
64
+ var gl = ctx.gl, state = ctx.state, stats = ctx.stats;
65
65
  var p = param_definition_1.ParamDefinition.merge(exports.RendererParams, param_definition_1.ParamDefinition.getDefaultValues(exports.RendererParams), props);
66
66
  var light = getLight(p.light);
67
67
  var viewport = (0, util_1.Viewport)();
@@ -148,24 +148,17 @@ var Renderer;
148
148
  program.setUniforms(globalUniformList);
149
149
  globalUniformsNeedUpdate = false;
150
150
  }
151
- if (r.values.dRenderMode) { // indicates direct-volume
152
- if ((variant === 'pick' || variant === 'depth') && r.values.dRenderMode.ref.value === 'volume') {
153
- return; // no picking/depth in volume mode
151
+ if (r.values.dGeometryType.ref.value === 'directVolume') {
152
+ if (variant !== 'colorWboit' && variant !== 'colorBlended') {
153
+ return; // only color supported
154
154
  }
155
155
  // culling done in fragment shader
156
156
  state.disable(gl.CULL_FACE);
157
157
  state.frontFace(gl.CCW);
158
158
  if (variant === 'colorBlended') {
159
159
  // depth test done manually in shader against `depthTexture`
160
- // still need to enable when fragDepth can be used to write depth
161
- if (r.values.dRenderMode.ref.value === 'volume' || !fragDepth) {
162
- state.disable(gl.DEPTH_TEST);
163
- state.depthMask(false);
164
- }
165
- else {
166
- state.enable(gl.DEPTH_TEST);
167
- state.depthMask(r.values.uAlpha.ref.value === 1.0);
168
- }
160
+ state.disable(gl.DEPTH_TEST);
161
+ state.depthMask(false);
169
162
  }
170
163
  }
171
164
  else {
@@ -358,7 +351,7 @@ var Renderer;
358
351
  }
359
352
  };
360
353
  var renderWboitOpaque = function (group, camera, depthTexture) {
361
- var _a, _b, _c;
354
+ var _a, _b;
362
355
  state.disable(gl.BLEND);
363
356
  state.enable(gl.DEPTH_TEST);
364
357
  state.depthMask(true);
@@ -369,13 +362,13 @@ var Renderer;
369
362
  // TODO: simplify, handle in renderable.state???
370
363
  // uAlpha is updated in "render" so we need to recompute it here
371
364
  var alpha = (0, interpolate_1.clamp)(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
372
- if (alpha === 1 && r.values.transparencyAverage.ref.value !== 1 && ((_a = r.values.dRenderMode) === null || _a === void 0 ? void 0 : _a.ref.value) !== 'volume' && ((_b = r.values.dPointStyle) === null || _b === void 0 ? void 0 : _b.ref.value) !== 'fuzzy' && !((_c = r.values.dXrayShaded) === null || _c === void 0 ? void 0 : _c.ref.value)) {
365
+ if (alpha === 1 && r.values.transparencyAverage.ref.value !== 1 && r.values.dGeometryType.ref.value !== 'directVolume' && ((_a = r.values.dPointStyle) === null || _a === void 0 ? void 0 : _a.ref.value) !== 'fuzzy' && !((_b = r.values.dXrayShaded) === null || _b === void 0 ? void 0 : _b.ref.value)) {
373
366
  renderObject(r, 'colorWboit');
374
367
  }
375
368
  }
376
369
  };
377
370
  var renderWboitTransparent = function (group, camera, depthTexture) {
378
- var _a, _b, _c;
371
+ var _a, _b;
379
372
  updateInternal(group, camera, depthTexture, true, false);
380
373
  var renderables = group.renderables;
381
374
  for (var i = 0, il = renderables.length; i < il; ++i) {
@@ -383,7 +376,7 @@ var Renderer;
383
376
  // TODO: simplify, handle in renderable.state???
384
377
  // uAlpha is updated in "render" so we need to recompute it here
385
378
  var alpha = (0, interpolate_1.clamp)(r.values.alpha.ref.value * r.state.alphaFactor, 0, 1);
386
- if (alpha < 1 || r.values.transparencyAverage.ref.value > 0 || ((_a = r.values.dRenderMode) === null || _a === void 0 ? void 0 : _a.ref.value) === 'volume' || ((_b = r.values.dPointStyle) === null || _b === void 0 ? void 0 : _b.ref.value) === 'fuzzy' || !!r.values.uBackgroundColor || ((_c = r.values.dXrayShaded) === null || _c === void 0 ? void 0 : _c.ref.value)) {
379
+ if (alpha < 1 || r.values.transparencyAverage.ref.value > 0 || r.values.dGeometryType.ref.value === 'directVolume' || ((_a = r.values.dPointStyle) === null || _a === void 0 ? void 0 : _a.ref.value) === 'fuzzy' || !!r.values.uBackgroundColor || ((_b = r.values.dXrayShaded) === null || _b === void 0 ? void 0 : _b.ref.value)) {
387
380
  renderObject(r, 'colorWboit');
388
381
  }
389
382
  }
@@ -1 +1 @@
1
- export declare const assign_color_varying = "\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_pick)\n if (uPickType == 1) {\n vColor = vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(encodeFloatRGB(aInstance), 1.0);\n } else {\n vColor = vec4(encodeFloatRGB(group), 1.0);\n }\n#endif\n\n#ifdef dTransparency\n vGroup = group;\n\n #if defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n#endif\n";
1
+ export declare const assign_color_varying = "\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_pick)\n if (uPickType == 1) {\n vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(packIntToRGB(aInstance), 1.0);\n } else {\n vColor = vec4(packIntToRGB(group), 1.0);\n }\n#endif\n\n#ifdef dTransparency\n vGroup = group;\n\n #if defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n#endif\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign_color_varying = void 0;
4
- exports.assign_color_varying = "\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_pick)\n if (uPickType == 1) {\n vColor = vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(encodeFloatRGB(aInstance), 1.0);\n } else {\n vColor = vec4(encodeFloatRGB(group), 1.0);\n }\n#endif\n\n#ifdef dTransparency\n vGroup = group;\n\n #if defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n#endif\n";
4
+ exports.assign_color_varying = "\n#if defined(dRenderVariant_color)\n #if defined(dColorType_attribute)\n vColor.rgb = aColor;\n #elif defined(dColorType_instance)\n vColor.rgb = readFromTexture(tColor, aInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n vColor.rgb = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n vColor.rgb = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n vColor.rgb = readFromTexture(tColor, VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_vertexInstance)\n vColor.rgb = readFromTexture(tColor, int(aInstance) * uVertexCount + VertexID, uColorTexDim).rgb;\n #elif defined(dColorType_volume)\n vec3 cgridPos = (uColorGridTransform.w * (position - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #elif defined(dColorType_volumeInstance)\n vec3 cgridPos = (uColorGridTransform.w * (vModelPosition - uColorGridTransform.xyz)) / uColorGridDim;\n vColor.rgb = texture3dFrom2dLinear(tColorGrid, cgridPos, uColorGridDim, uColorTexDim).rgb;\n #endif\n\n #ifdef dUsePalette\n vPaletteV = ((vColor.r * 256.0 * 256.0 * 255.0 + vColor.g * 256.0 * 255.0 + vColor.b * 255.0) - 1.0) / 16777215.0;\n #endif\n\n #ifdef dOverpaint\n #if defined(dOverpaintType_groupInstance)\n vOverpaint = readFromTexture(tOverpaint, aInstance * float(uGroupCount) + group, uOverpaintTexDim);\n #elif defined(dOverpaintType_vertexInstance)\n vOverpaint = readFromTexture(tOverpaint, int(aInstance) * uVertexCount + VertexID, uOverpaintTexDim);\n #elif defined(dOverpaintType_volumeInstance)\n vec3 ogridPos = (uOverpaintGridTransform.w * (vModelPosition - uOverpaintGridTransform.xyz)) / uOverpaintGridDim;\n vOverpaint = texture3dFrom2dLinear(tOverpaintGrid, ogridPos, uOverpaintGridDim, uOverpaintTexDim);\n #endif\n\n // pre-mix to avoid darkening due to empty overpaint\n #ifdef dColorType_uniform\n vOverpaint.rgb = mix(uColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #else\n vOverpaint.rgb = mix(vColor.rgb, vOverpaint.rgb, vOverpaint.a);\n #endif\n #endif\n\n #ifdef dSubstance\n #if defined(dSubstanceType_groupInstance)\n vSubstance = readFromTexture(tSubstance, aInstance * float(uGroupCount) + group, uSubstanceTexDim);\n #elif defined(dSubstanceType_vertexInstance)\n vSubstance = readFromTexture(tSubstance, int(aInstance) * uVertexCount + VertexID, uSubstanceTexDim);\n #elif defined(dSubstanceType_volumeInstance)\n vec3 sgridPos = (uSubstanceGridTransform.w * (vModelPosition - uSubstanceGridTransform.xyz)) / uSubstanceGridDim;\n vSubstance = texture3dFrom2dLinear(tSubstanceGrid, sgridPos, uSubstanceGridDim, uSubstanceTexDim);\n #endif\n\n // pre-mix to avoid artifacts due to empty substance\n vSubstance.rgb = mix(vec3(uMetalness, uRoughness, uBumpiness), vSubstance.rgb, vSubstance.a);\n #endif\n#elif defined(dRenderVariant_pick)\n if (uPickType == 1) {\n vColor = vec4(packIntToRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n vColor = vec4(packIntToRGB(aInstance), 1.0);\n } else {\n vColor = vec4(packIntToRGB(group), 1.0);\n }\n#endif\n\n#ifdef dTransparency\n vGroup = group;\n\n #if defined(dTransparencyType_groupInstance)\n vTransparency = readFromTexture(tTransparency, aInstance * float(uGroupCount) + group, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_vertexInstance)\n vTransparency = readFromTexture(tTransparency, int(aInstance) * uVertexCount + VertexID, uTransparencyTexDim).a;\n #elif defined(dTransparencyType_volumeInstance)\n vec3 tgridPos = (uTransparencyGridTransform.w * (vModelPosition - uTransparencyGridTransform.xyz)) / uTransparencyGridDim;\n vTransparency = texture3dFrom2dLinear(tTransparencyGrid, tgridPos, uTransparencyGridDim, uTransparencyTexDim).a;\n #endif\n#endif\n";
5
5
  //# sourceMappingURL=assign-color-varying.glsl.js.map
@@ -1 +1 @@
1
- export declare const assign_group = "\n#ifdef dGeoTexture\n float group = decodeFloatRGB(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n";
1
+ export declare const assign_group = "\n#ifdef dGeometryType_textureMesh\n float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign_group = void 0;
4
- exports.assign_group = "\n#ifdef dGeoTexture\n float group = decodeFloatRGB(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n";
4
+ exports.assign_group = "\n#ifdef dGeometryType_textureMesh\n float group = unpackRGBToInt(readFromTexture(tGroup, VertexID, uGeoTexDim).rgb);\n#else\n float group = aGroup;\n#endif\n";
5
5
  //# sourceMappingURL=assign-group.glsl.js.map
@@ -1 +1 @@
1
- export declare const assign_position = "\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeoTexture\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n";
1
+ export declare const assign_position = "\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeometryType_textureMesh\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign_position = void 0;
4
- exports.assign_position = "\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeoTexture\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n";
4
+ exports.assign_position = "\nmat4 model = uModel * aTransform;\nmat4 modelView = uView * model;\n#ifdef dGeometryType_textureMesh\n vec3 position = readFromTexture(tPosition, VertexID, uGeoTexDim).xyz;\n#else\n vec3 position = aPosition;\n#endif\nvec4 position4 = vec4(position, 1.0);\n// for accessing tColorGrid in vert shader and for clipping in frag shader\nvModelPosition = (model * position4).xyz;\nvec4 mvPosition = modelView * position4;\nvViewPosition = mvPosition.xyz;\ngl_Position = uProjection * mvPosition;\n";
5
5
  //# sourceMappingURL=assign-position.glsl.js.map
@@ -1 +1 @@
1
- export declare const assign_size = "\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = decodeFloatRGB(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = decodeFloatRGB(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = decodeFloatRGB(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n";
1
+ export declare const assign_size = "\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.assign_size = void 0;
4
- exports.assign_size = "\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = decodeFloatRGB(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = decodeFloatRGB(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = decodeFloatRGB(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n";
4
+ exports.assign_size = "\n#if defined(dSizeType_uniform)\n float size = uSize;\n#elif defined(dSizeType_attribute)\n float size = aSize;\n#elif defined(dSizeType_instance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance, uSizeTexDim).rgb);\n#elif defined(dSizeType_group)\n float size = unpackRGBToInt(readFromTexture(tSize, group, uSizeTexDim).rgb);\n#elif defined(dSizeType_groupInstance)\n float size = unpackRGBToInt(readFromTexture(tSize, aInstance * float(uGroupCount) + group, uSizeTexDim).rgb);\n#endif\n\n#if defined(dSizeType_instance) || defined(dSizeType_group) || defined(dSizeType_groupInstance)\n size /= 100.0; // NOTE factor also set in TypeScript\n#endif\n\nsize *= uSizeFactor;\n";
5
5
  //# sourceMappingURL=assign-size.glsl.js.map
@@ -1 +1 @@
1
- export declare const common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
1
+ export declare const common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\n#if __VERSION__ == 100\n #define round(x) floor((x) + 0.5)\n#endif\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nvec3 packIntToRGB(in float value) {\n value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat unpackRGBToInt(const in vec3 rgb) {\n return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.common = void 0;
4
- exports.common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nconst float maxFloat = 10000.0; // NOTE constant also set in TypeScript\nconst float floatLogFactor = 9.210440366976517; // log(maxFloat + 1.0);\nfloat encodeFloatLog(const in float value) { return log(value + 1.0) / floatLogFactor; }\nfloat decodeFloatLog(const in float value) { return exp(value * floatLogFactor) - 1.0; }\n\nvec3 encodeFloatRGB(in float value) {\n value = clamp(value, 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat decodeFloatRGB(const in vec3 rgb) {\n return (rgb.r * 256.0 * 256.0 * 255.0 + rgb.g * 256.0 * 255.0 + rgb.b * 255.0) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
4
+ exports.common = "\n// TODO find a better place for these convenience defines\n\n#if defined(dRenderVariant_colorBlended) || defined(dRenderVariant_colorWboit)\n #define dRenderVariant_color\n#endif\n\n#if defined(dColorType_instance) || defined(dColorType_group) || defined(dColorType_groupInstance) || defined(dColorType_vertex) || defined(dColorType_vertexInstance)\n #define dColorType_texture\n#endif\n\n#if defined(dColorType_volume) || defined(dColorType_volumeInstance)\n #define dColorType_grid\n#endif\n\n#if defined(dColorType_attribute) || defined(dColorType_texture) || defined(dColorType_grid)\n #define dColorType_varying\n#endif\n\n//\n\n#define PI 3.14159265\n#define RECIPROCAL_PI 0.31830988618\n#define EPSILON 1e-6\n\n#define saturate(a) clamp(a, 0.0, 1.0)\n\n#if __VERSION__ == 100\n #define round(x) floor((x) + 0.5)\n#endif\n\nfloat intDiv(const in float a, const in float b) { return float(int(a) / int(b)); }\nvec2 ivec2Div(const in vec2 a, const in vec2 b) { return vec2(ivec2(a) / ivec2(b)); }\nfloat intMod(const in float a, const in float b) { return a - b * float(int(a) / int(b)); }\nint imod(const in int a, const in int b) { return a - b * (a / b); }\n\nfloat pow2(const in float x) { return x * x; }\n\nvec3 packIntToRGB(in float value) {\n value = clamp(round(value), 0.0, 16777216.0 - 1.0) + 1.0;\n vec3 c = vec3(0.0);\n c.b = mod(value, 256.0);\n value = floor(value / 256.0);\n c.g = mod(value, 256.0);\n value = floor(value / 256.0);\n c.r = mod(value, 256.0);\n return c / 255.0;\n}\nfloat unpackRGBToInt(const in vec3 rgb) {\n return (floor(rgb.r * 255.0 + 0.5) * 256.0 * 256.0 + floor(rgb.g * 255.0 + 0.5) * 256.0 + floor(rgb.b * 255.0 + 0.5)) - 1.0;\n}\n\nvec2 packUnitIntervalToRG(const in float v) {\n vec2 enc;\n enc.xy = vec2(fract(v * 256.0), v);\n enc.y -= enc.x * (1.0 / 256.0);\n enc.xy *= 256.0 / 255.0;\n\n return enc;\n}\n\nfloat unpackRGToUnitInterval(const in vec2 enc) {\n return dot(enc, vec2(255.0 / (256.0 * 256.0), 255.0 / 256.0));\n}\n\nvec3 screenSpaceToViewSpace(const in vec3 ssPos, const in mat4 invProjection) {\n vec4 p = vec4(ssPos * 2.0 - 1.0, 1.0);\n p = invProjection * p;\n return p.xyz / p.w;\n}\n\nconst float PackUpscale = 256.0 / 255.0; // fraction -> 0..1 (including 1)\nconst float UnpackDownscale = 255.0 / 256.0; // 0..1 -> fraction (excluding 1)\nconst vec3 PackFactors = vec3(256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0);\nconst vec4 UnpackFactors = UnpackDownscale / vec4(PackFactors, 1.0);\nconst float ShiftRight8 = 1.0 / 256.0;\n\nvec4 packDepthToRGBA(const in float v) {\n vec4 r = vec4(fract(v * PackFactors), v);\n r.yzw -= r.xyz * ShiftRight8; // tidy overflow\n return r * PackUpscale;\n}\nfloat unpackRGBAToDepth(const in vec4 v) {\n return dot(v, UnpackFactors);\n}\n\nvec4 sRGBToLinear(const in vec4 c) {\n return vec4(mix(pow(c.rgb * 0.9478672986 + vec3(0.0521327014), vec3(2.4)), c.rgb * 0.0773993808, vec3(lessThanEqual(c.rgb, vec3(0.04045)))), c.a);\n}\nvec4 linearTosRGB(const in vec4 c) {\n return vec4(mix(pow(c.rgb, vec3(0.41666)) * 1.055 - vec3(0.055), c.rgb * 12.92, vec3(lessThanEqual(c.rgb, vec3(0.0031308)))), c.a);\n}\n\nfloat linearizeDepth(const in float depth, const in float near, const in float far) {\n return (2.0 * near) / (far + near - depth * (far - near));\n}\n\nfloat perspectiveDepthToViewZ(const in float invClipZ, const in float near, const in float far) {\n return (near * far) / ((far - near) * invClipZ - far);\n}\n\nfloat orthographicDepthToViewZ(const in float linearClipZ, const in float near, const in float far) {\n return linearClipZ * (near - far) - near;\n}\n\nfloat depthToViewZ(const in float isOrtho, const in float linearClipZ, const in float near, const in float far) {\n return isOrtho == 1.0 ? orthographicDepthToViewZ(linearClipZ, near, far) : perspectiveDepthToViewZ(linearClipZ, near, far);\n}\n\n#if __VERSION__ == 100\n // transpose\n\n float transpose(const in float m) {\n return m;\n }\n\n mat2 transpose2(const in mat2 m) {\n return mat2(\n m[0][0], m[1][0],\n m[0][1], m[1][1]\n );\n }\n\n mat3 transpose3(const in mat3 m) {\n return mat3(\n m[0][0], m[1][0], m[2][0],\n m[0][1], m[1][1], m[2][1],\n m[0][2], m[1][2], m[2][2]\n );\n }\n\n mat4 transpose4(const in mat4 m) {\n return mat4(\n m[0][0], m[1][0], m[2][0], m[3][0],\n m[0][1], m[1][1], m[2][1], m[3][1],\n m[0][2], m[1][2], m[2][2], m[3][2],\n m[0][3], m[1][3], m[2][3], m[3][3]\n );\n }\n\n // inverse\n\n float inverse(const in float m) {\n return 1.0 / m;\n }\n\n mat2 inverse2(const in mat2 m) {\n return mat2(m[1][1],-m[0][1],\n -m[1][0], m[0][0]) / (m[0][0]*m[1][1] - m[0][1]*m[1][0]);\n }\n\n mat3 inverse3(const in mat3 m) {\n float a00 = m[0][0], a01 = m[0][1], a02 = m[0][2];\n float a10 = m[1][0], a11 = m[1][1], a12 = m[1][2];\n float a20 = m[2][0], a21 = m[2][1], a22 = m[2][2];\n\n float b01 = a22 * a11 - a12 * a21;\n float b11 = -a22 * a10 + a12 * a20;\n float b21 = a21 * a10 - a11 * a20;\n\n float det = a00 * b01 + a01 * b11 + a02 * b21;\n\n return mat3(b01, (-a22 * a01 + a02 * a21), (a12 * a01 - a02 * a11),\n b11, (a22 * a00 - a02 * a20), (-a12 * a00 + a02 * a10),\n b21, (-a21 * a00 + a01 * a20), (a11 * a00 - a01 * a10)) / det;\n }\n\n mat4 inverse4(const in mat4 m) {\n float\n a00 = m[0][0], a01 = m[0][1], a02 = m[0][2], a03 = m[0][3],\n a10 = m[1][0], a11 = m[1][1], a12 = m[1][2], a13 = m[1][3],\n a20 = m[2][0], a21 = m[2][1], a22 = m[2][2], a23 = m[2][3],\n a30 = m[3][0], a31 = m[3][1], a32 = m[3][2], a33 = m[3][3],\n\n b00 = a00 * a11 - a01 * a10,\n b01 = a00 * a12 - a02 * a10,\n b02 = a00 * a13 - a03 * a10,\n b03 = a01 * a12 - a02 * a11,\n b04 = a01 * a13 - a03 * a11,\n b05 = a02 * a13 - a03 * a12,\n b06 = a20 * a31 - a21 * a30,\n b07 = a20 * a32 - a22 * a30,\n b08 = a20 * a33 - a23 * a30,\n b09 = a21 * a32 - a22 * a31,\n b10 = a21 * a33 - a23 * a31,\n b11 = a22 * a33 - a23 * a32,\n\n det = b00 * b11 - b01 * b10 + b02 * b09 + b03 * b08 - b04 * b07 + b05 * b06;\n\n return mat4(\n a11 * b11 - a12 * b10 + a13 * b09,\n a02 * b10 - a01 * b11 - a03 * b09,\n a31 * b05 - a32 * b04 + a33 * b03,\n a22 * b04 - a21 * b05 - a23 * b03,\n a12 * b08 - a10 * b11 - a13 * b07,\n a00 * b11 - a02 * b08 + a03 * b07,\n a32 * b02 - a30 * b05 - a33 * b01,\n a20 * b05 - a22 * b02 + a23 * b01,\n a10 * b10 - a11 * b08 + a13 * b06,\n a01 * b08 - a00 * b10 - a03 * b06,\n a30 * b04 - a31 * b02 + a33 * b00,\n a21 * b02 - a20 * b04 - a23 * b00,\n a11 * b07 - a10 * b09 - a12 * b06,\n a00 * b09 - a01 * b07 + a02 * b06,\n a31 * b01 - a30 * b03 - a32 * b00,\n a20 * b03 - a21 * b01 + a22 * b00) / det;\n }\n\n #define isNaN(x) ((x) != (x))\n #define isInf(x) ((x) == (x) + 1.0)\n#else\n #define transpose2(m) transpose(m)\n #define transpose3(m) transpose(m)\n #define transpose4(m) transpose(m)\n\n #define inverse2(m) inverse(m)\n #define inverse3(m) inverse(m)\n #define inverse4(m) inverse(m)\n\n #define isNaN isnan\n #define isInf isinf\n#endif\n";
5
5
  //# sourceMappingURL=common.glsl.js.map
@@ -4,4 +4,4 @@
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  * @author Áron Samuel Kovács <aron.kovacs@mail.muni.cz>
6
6
  */
7
- export declare const wboit_write = "\n#if defined(dRenderVariant_colorWboit)\n if (!uRenderWboit) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderWboit) {\n // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth\n if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n";
7
+ export declare const wboit_write = "\n#if defined(dRenderVariant_colorWboit)\n if (!uRenderWboit) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderWboit) {\n // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth\n if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #ifndef dGeometryType_directVolume\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n";
@@ -7,5 +7,5 @@
7
7
  */
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
9
  exports.wboit_write = void 0;
10
- exports.wboit_write = "\n#if defined(dRenderVariant_colorWboit)\n if (!uRenderWboit) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderWboit) {\n // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth\n if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #if !defined(dRenderMode_volume) && !defined(dRenderMode_isosurface)\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n";
10
+ exports.wboit_write = "\n#if defined(dRenderVariant_colorWboit)\n if (!uRenderWboit) {\n if (preFogAlpha < 1.0) {\n discard;\n }\n } else if (uRenderWboit) {\n // the 'fragmentDepth > 0.99' check is to handle precision issues with packed depth\n if (preFogAlpha != 1.0 && !interior && (fragmentDepth < getDepth(gl_FragCoord.xy / uDrawingBufferSize) || fragmentDepth > 0.99)) {\n float alpha = gl_FragColor.a;\n float wboitWeight = alpha * clamp(pow(1.0 - fragmentDepth, 2.0), 0.01, 1.0);\n gl_FragColor = vec4(gl_FragColor.rgb * alpha * wboitWeight, alpha);\n // extra alpha is to handle pre-multiplied alpha\n #ifndef dGeometryType_directVolume\n gl_FragData[1] = vec4((uTransparentBackground ? alpha : 1.0) * alpha * wboitWeight);\n #else\n gl_FragData[1] = vec4(alpha * alpha * wboitWeight);\n #endif\n } else {\n discard;\n }\n }\n#endif\n";
11
11
  //# sourceMappingURL=wboit-write.glsl.js.map
@@ -3,4 +3,4 @@
3
3
  *
4
4
  * @author Alexander Rose <alexander.rose@weirdbyte.de>
5
5
  */
6
- export declare const accumulate_vert = "\nprecision highp float;\n\n#include common\n#include read_from_texture\n\nuniform int uTotalCount;\nuniform int uGroupCount;\n\nattribute float aSample;\n#define SampleID int(aSample)\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform vec2 uGeoTexDim;\nuniform sampler2D tPosition;\nuniform sampler2D tGroup;\n\nuniform vec2 uColorTexDim;\nuniform sampler2D tColor;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;\n float group = decodeFloatRGB(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);\n\n position = (aTransform * vec4(position, 1.0)).xyz;\n gl_PointSize = 7.0;\n vPosition = (position - uBboxMin) / uResolution;\n gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n\n #if defined(dColorType_group)\n vColor = readFromTexture(tColor, group, uColorTexDim);\n #elif defined(dColorType_groupInstance)\n vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);\n #endif\n}\n";
6
+ export declare const accumulate_vert = "\nprecision highp float;\n\n#include common\n#include read_from_texture\n\nuniform int uTotalCount;\nuniform int uGroupCount;\n\nattribute float aSample;\n#define SampleID int(aSample)\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform vec2 uGeoTexDim;\nuniform sampler2D tPosition;\nuniform sampler2D tGroup;\n\nuniform vec2 uColorTexDim;\nuniform sampler2D tColor;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;\n float group = unpackRGBToInt(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);\n\n position = (aTransform * vec4(position, 1.0)).xyz;\n gl_PointSize = 7.0;\n vPosition = (position - uBboxMin) / uResolution;\n gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n\n #if defined(dColorType_group)\n vColor = readFromTexture(tColor, group, uColorTexDim);\n #elif defined(dColorType_groupInstance)\n vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);\n #endif\n}\n";
@@ -6,5 +6,5 @@
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
8
  exports.accumulate_vert = void 0;
9
- exports.accumulate_vert = "\nprecision highp float;\n\n#include common\n#include read_from_texture\n\nuniform int uTotalCount;\nuniform int uGroupCount;\n\nattribute float aSample;\n#define SampleID int(aSample)\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform vec2 uGeoTexDim;\nuniform sampler2D tPosition;\nuniform sampler2D tGroup;\n\nuniform vec2 uColorTexDim;\nuniform sampler2D tColor;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;\n float group = decodeFloatRGB(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);\n\n position = (aTransform * vec4(position, 1.0)).xyz;\n gl_PointSize = 7.0;\n vPosition = (position - uBboxMin) / uResolution;\n gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n\n #if defined(dColorType_group)\n vColor = readFromTexture(tColor, group, uColorTexDim);\n #elif defined(dColorType_groupInstance)\n vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);\n #endif\n}\n";
9
+ exports.accumulate_vert = "\nprecision highp float;\n\n#include common\n#include read_from_texture\n\nuniform int uTotalCount;\nuniform int uGroupCount;\n\nattribute float aSample;\n#define SampleID int(aSample)\n\nattribute mat4 aTransform;\nattribute float aInstance;\n\nuniform vec2 uGeoTexDim;\nuniform sampler2D tPosition;\nuniform sampler2D tGroup;\n\nuniform vec2 uColorTexDim;\nuniform sampler2D tColor;\n\nvarying vec3 vPosition;\nvarying vec4 vColor;\n\nuniform vec3 uBboxSize;\nuniform vec3 uBboxMin;\nuniform float uResolution;\n\nvoid main() {\n vec3 position = readFromTexture(tPosition, SampleID, uGeoTexDim).xyz;\n float group = unpackRGBToInt(readFromTexture(tGroup, SampleID, uGeoTexDim).rgb);\n\n position = (aTransform * vec4(position, 1.0)).xyz;\n gl_PointSize = 7.0;\n vPosition = (position - uBboxMin) / uResolution;\n gl_Position = vec4(((position - uBboxMin) / uBboxSize) * 2.0 - 1.0, 1.0);\n\n #if defined(dColorType_group)\n vColor = readFromTexture(tColor, group, uColorTexDim);\n #elif defined(dColorType_groupInstance)\n vColor = readFromTexture(tColor, aInstance * float(uGroupCount) + group, uColorTexDim);\n #endif\n}\n";
10
10
  //# sourceMappingURL=accumulate.vert.js.map
@@ -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 vec2 uIsoValue;\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;\nbool interior;\n\nuniform bool uRenderWboit;\nuniform bool uDoubleSided;\nuniform int uPickType;\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(dRenderVariant_color)\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 dSubstance\n #if defined(dSubstanceType_groupInstance) || defined(dSubstanceType_vertexInstance)\n uniform vec2 uSubstanceTexDim;\n uniform sampler2D tSubstance;\n #endif\n #endif\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\nvec4 transferFunction(float value) {\n return texture2D(tTransferTex, vec2(value, 0.0));\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 #if defined(dRenderVariant_color) && !defined(dIgnoreLight)\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n #endif\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 bool hit = false;\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 vec3 isoPos;\n\n vec3 nextPos;\n float nextValue;\n\n vec3 color = vec3(0.45, 0.55, 0.8);\n vec4 overpaint = vec4(0.0);\n vec3 substance = vec3(0.0);\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 if (hit) break;\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 #if defined(dRenderMode_isosurface)\n if (prevValue > 0.0 && ( // there was a prev Value\n (prevValue < uIsoValue.x && value > uIsoValue.x) || // entering isosurface\n (prevValue > uIsoValue.x && value < uIsoValue.x) // leaving isosurface\n )) {\n isoPos = v3m4(mix(pos - step, pos, ((prevValue - uIsoValue.x) / ((prevValue - uIsoValue.x) - (value - uIsoValue.x)))), cartnToUnit);\n\n vec4 mvPosition = modelViewTransform * vec4(isoPos * uGridDim, 1.0);\n\n #if defined(dClipVariant_pixel) && dClipObjectCount != 0\n vec3 vModelPosition = v3m4(isoPos * uGridDim, modelTransform);\n if (clipTest(vec4(vModelPosition, 0.0), 0)) {\n prevValue = value;\n pos += step;\n continue;\n }\n #endif\n\n float depth = calcDepth(mvPosition.xyz);\n if (depth > getDepth(gl_FragCoord.xy / uDrawingBufferSize))\n break;\n\n #ifdef enabledFragDepth\n if (!hit) {\n gl_FragDepthEXT = depth;\n }\n #endif\n\n #if defined(dRenderVariant_pick)\n if (uPickType == 1) {\n return vec4(encodeFloatRGB(float(uObjectId)), 1.0);\n } else if (uPickType == 2) {\n return vec4(encodeFloatRGB(vInstance), 1.0);\n } else {\n #ifdef dPackedGroup\n return vec4(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb, 1.0);\n #else\n vec3 g = floor(isoPos * uGridDim + 0.5);\n return vec4(encodeFloatRGB(g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y), 1.0);\n #endif\n }\n #elif defined(dRenderVariant_depth)\n #ifdef enabledFragDepth\n return packDepthToRGBA(gl_FragDepthEXT);\n #else\n return packDepthToRGBA(depth);\n #endif\n #elif defined(dRenderVariant_color)\n #ifdef dPackedGroup\n float group = decodeFloatRGB(textureGroup(floor(isoPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(isoPos * uGridDim + 0.5);\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;\n #endif\n\n #if defined(dColorType_uniform)\n color = uColor;\n #elif defined(dColorType_instance)\n color = readFromTexture(tColor, vInstance, uColorTexDim).rgb;\n #elif defined(dColorType_group)\n color = readFromTexture(tColor, group, uColorTexDim).rgb;\n #elif defined(dColorType_groupInstance)\n color = readFromTexture(tColor, vInstance * float(uGroupCount) + group, uColorTexDim).rgb;\n #elif defined(dColorType_vertex)\n color = texture3dFrom1dTrilinear(tColor, isoPos, uGridDim, uColorTexDim, 0.0).rgb;\n #elif defined(dColorType_vertexInstance)\n color = 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 color = mix(color, overpaint.rgb, overpaint.a);\n #endif\n\n // handle flipping and negative isosurfaces\n #ifdef dFlipSided\n bool flipped = value < uIsoValue.y; // flipped\n #else\n bool flipped = value > uIsoValue.y;\n #endif\n interior = value < uIsoValue.x && flipped;\n if (uDoubleSided) {\n if (interior) {\n prevValue = value;\n pos += step;\n continue;\n }\n }\n vec3 vViewPosition = mvPosition.xyz;\n vec4 material = vec4(color, uAlpha);\n\n #ifdef dIgnoreLight\n gl_FragColor = material;\n #else\n #if defined(dFlatShaded)\n // nearest grid point\n isoPos = floor(isoPos * uGridDim + 0.5) / uGridDim;\n #endif\n #ifdef dPackedGroup\n // compute gradient by central differences\n gradient.x = textureVal(isoPos - dx).a - textureVal(isoPos + dx).a;\n gradient.y = textureVal(isoPos - dy).a - textureVal(isoPos + dy).a;\n gradient.z = textureVal(isoPos - dz).a - textureVal(isoPos + dz).a;\n #else\n gradient = textureVal(isoPos).xyz * 2.0 - 1.0;\n #endif\n vec3 normal = -normalize(normalMatrix * normalize(gradient));\n normal = normal * (float(flipped) * 2.0 - 1.0);\n normal = normal * -(float(interior) * 2.0 - 1.0);\n #ifdef dSubstance\n #if defined(dSubstanceType_groupInstance)\n substance = readFromTexture(tSubstance, vInstance * float(uGroupCount) + group, uSubstanceTexDim).rgb;\n #elif defined(dSubstanceType_vertexInstance)\n substance = texture3dFrom1dTrilinear(tSubstance, isoPos, uGridDim, uSubstanceTexDim, vInstance * float(uVertexCount)).rgb;\n #endif\n metalness = mix(metalness, substance.r, substance.b);\n roughness = mix(roughness, substance.g, substance.b);\n #endif\n #include apply_light_color\n #endif\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_interior_color\n #include apply_marker_color\n\n preFogAlphaBlended = (1.0 - preFogAlphaBlended) * gl_FragColor.a + preFogAlphaBlended;\n fragmentDepth = depth;\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 #endif\n\n #ifdef dSingleLayer\n break;\n #endif\n\n hit = true;\n }\n prevValue = value;\n #elif defined(dRenderMode_volume)\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 #if defined(dRenderVariant_color)\n vec3 vViewPosition = mvPosition.xyz;\n vec4 material = transferFunction(value);\n\n #ifdef dIgnoreLight\n gl_FragColor.rgb = material.rgb;\n #else\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 #endif\n\n gl_FragColor.a = material.a * uAlpha * uTransferScale;\n\n float marker = uMarker;\n if (uMarker == -1.0) {\n #ifdef dPackedGroup\n float group = decodeFloatRGB(textureGroup(floor(unitPos * uGridDim + 0.5) / uGridDim).rgb);\n #else\n vec3 g = floor(unitPos * uGridDim + 0.5);\n float group = g.z + g.y * uGridDim.z + g.x * uGridDim.z * uGridDim.y;\n #endif\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 #endif\n #endif\n\n // break if the color is opaque enough\n if (dst.a > 0.95)\n break;\n\n pos += step;\n }\n\n #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)\n // ensure depth is written everywhere\n if (!hit)\n gl_FragDepthEXT = 1.0;\n #endif\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 #ifdef dRenderVariant_marking\n // not supported\n discard;\n #endif\n\n #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)\n #if defined(dRenderMode_volume)\n // always ignore pick & depth for volume\n discard;\n #elif defined(dRenderMode_isosurface)\n if (uAlpha < uPickingAlphaThreshold)\n discard; // ignore so the element below can be picked\n #endif\n #endif\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 #if defined(dRenderVariant_pick) || defined(dRenderVariant_depth)\n // discard when nothing was hit\n if (gl_FragColor == vec4(0.0))\n discard;\n #endif\n\n #if defined(dRenderVariant_color)\n #if defined(dRenderMode_isosurface) && defined(enabledFragDepth)\n float fragmentDepth = gl_FragDepthEXT;\n #else\n float fragmentDepth = calcDepth((uModelView * vec4(start, 1.0)).xyz);\n #endif\n float preFogAlpha = clamp(preFogAlphaBlended, 0.0, 1.0);\n interior = false;\n #include wboit_write\n #endif\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 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 #if !defined(dIgnoreLight)\n mat3 normalMatrix = transpose3(inverse3(mat3(uModelView * vTransform)));\n #endif\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 #ifdef dIgnoreLight\n gl_FragColor.rgb = material.rgb;\n #else\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 #endif\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";