molstar 4.2.0 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +20 -20
- package/README.md +197 -197
- package/build/viewer/embedded.html +52 -52
- package/build/viewer/index.html +129 -129
- package/build/viewer/molstar.js +1 -1
- package/build/viewer/molstar.js.LICENSE.txt +9 -0
- package/lib/apps/docking-viewer/index.html +36 -36
- package/lib/apps/mesoscale-explorer/index.html +100 -100
- package/lib/apps/mesoscale-explorer/style.scss +33 -33
- package/lib/apps/viewer/app.d.ts +2 -1
- package/lib/apps/viewer/app.js +2 -1
- package/lib/apps/viewer/embedded.html +52 -52
- package/lib/apps/viewer/index.html +129 -129
- package/lib/cli/chem-comp-dict/create-ions.js +9 -9
- package/lib/cli/chem-comp-dict/create-saccharides.js +9 -9
- package/lib/cli/cifschema/util/generate.js +12 -12
- package/lib/cli/lipid-params/index.js +9 -9
- package/lib/commonjs/apps/viewer/app.d.ts +2 -1
- package/lib/commonjs/apps/viewer/app.js +1 -0
- package/lib/commonjs/cli/chem-comp-dict/create-ions.js +9 -9
- package/lib/commonjs/cli/chem-comp-dict/create-saccharides.js +9 -9
- package/lib/commonjs/cli/cifschema/util/generate.js +12 -12
- package/lib/commonjs/cli/lipid-params/index.js +9 -9
- package/lib/commonjs/examples/alpha-orbitals/example-data.js +160 -160
- package/lib/commonjs/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
- package/lib/commonjs/extensions/assembly-symmetry/prop.js +24 -24
- package/lib/commonjs/extensions/dnatco/confal-pyramids/behavior.js +5 -5
- package/lib/commonjs/extensions/dnatco/ntc-tube/behavior.js +5 -5
- package/lib/commonjs/extensions/geo-export/usdz-exporter.js +41 -41
- package/lib/commonjs/extensions/meshes/mesh-extension.d.ts +1 -0
- package/lib/commonjs/extensions/mp4-export/encoder.js +1 -1
- package/lib/commonjs/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
- package/lib/commonjs/extensions/mvs/components/custom-label/representation.d.ts +2 -2
- package/lib/commonjs/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
- package/lib/commonjs/extensions/sb-ncbr/index.d.ts +8 -0
- package/lib/commonjs/extensions/sb-ncbr/index.js +14 -1
- package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/actions.js +89 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/algorithm.js +474 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/behavior.js +96 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/data-model.js +28 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/examples.js +54 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/props.js +26 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
- package/lib/commonjs/extensions/sb-ncbr/tunnels/representation.js +99 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.d.ts +17 -0
- package/lib/commonjs/mol-canvas3d/canvas3d.js +4 -0
- package/lib/commonjs/mol-canvas3d/passes/dof.d.ts +34 -0
- package/lib/commonjs/mol-canvas3d/passes/dof.js +167 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.d.ts +2 -0
- package/lib/commonjs/mol-canvas3d/passes/draw.js +31 -8
- package/lib/commonjs/mol-canvas3d/passes/image.d.ts +8 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.d.ts +8 -0
- package/lib/commonjs/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/commonjs/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/commonjs/mol-gl/shader/background.frag.js +95 -95
- package/lib/commonjs/mol-gl/shader/background.vert.js +11 -11
- package/lib/commonjs/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
- package/lib/commonjs/mol-gl/shader/bloom/blur.frag.js +28 -28
- package/lib/commonjs/mol-gl/shader/bloom/composite.frag.js +33 -33
- package/lib/commonjs/mol-gl/shader/bloom/luminosity.frag.js +52 -52
- package/lib/commonjs/mol-gl/shader/cas.frag.js +144 -144
- package/lib/commonjs/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
- package/lib/commonjs/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
- package/lib/commonjs/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
- package/lib/commonjs/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
- package/lib/commonjs/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
- package/lib/commonjs/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
- package/lib/commonjs/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
- package/lib/commonjs/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
- package/lib/commonjs/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
- package/lib/commonjs/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
- package/lib/commonjs/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
- package/lib/commonjs/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
- package/lib/commonjs/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
- package/lib/commonjs/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
- package/lib/commonjs/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
- package/lib/commonjs/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
- package/lib/commonjs/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
- package/lib/commonjs/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
- package/lib/commonjs/mol-gl/shader/chunks/common.glsl.js +234 -234
- package/lib/commonjs/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
- package/lib/commonjs/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
- package/lib/commonjs/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
- package/lib/commonjs/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
- package/lib/commonjs/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
- package/lib/commonjs/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
- package/lib/commonjs/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
- package/lib/commonjs/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
- package/lib/commonjs/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
- package/lib/commonjs/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
- package/lib/commonjs/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
- package/lib/commonjs/mol-gl/shader/compose.frag.js +12 -12
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
- package/lib/commonjs/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
- package/lib/commonjs/mol-gl/shader/copy.frag.js +11 -11
- package/lib/commonjs/mol-gl/shader/cylinders.frag.js +266 -266
- package/lib/commonjs/mol-gl/shader/cylinders.vert.js +89 -89
- package/lib/commonjs/mol-gl/shader/depth-merge.frag.js +23 -23
- package/lib/commonjs/mol-gl/shader/direct-volume.frag.js +362 -362
- package/lib/commonjs/mol-gl/shader/direct-volume.vert.js +41 -41
- package/lib/commonjs/mol-gl/shader/dof.frag.d.ts +7 -0
- package/lib/commonjs/mol-gl/shader/dof.frag.js +122 -0
- package/lib/commonjs/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
- package/lib/commonjs/mol-gl/shader/evaluate-wboit.frag.js +17 -17
- package/lib/commonjs/mol-gl/shader/fxaa.frag.js +228 -228
- package/lib/commonjs/mol-gl/shader/gaussian-density.frag.js +49 -49
- package/lib/commonjs/mol-gl/shader/gaussian-density.vert.js +27 -27
- package/lib/commonjs/mol-gl/shader/hi-z.frag.js +18 -18
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
- package/lib/commonjs/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
- package/lib/commonjs/mol-gl/shader/image.frag.js +169 -169
- package/lib/commonjs/mol-gl/shader/image.vert.js +21 -21
- package/lib/commonjs/mol-gl/shader/lines.frag.js +42 -42
- package/lib/commonjs/mol-gl/shader/lines.vert.js +117 -117
- package/lib/commonjs/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
- package/lib/commonjs/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
- package/lib/commonjs/mol-gl/shader/marking/edge.frag.js +28 -28
- package/lib/commonjs/mol-gl/shader/marking/overlay.frag.js +26 -26
- package/lib/commonjs/mol-gl/shader/mesh.frag.js +65 -65
- package/lib/commonjs/mol-gl/shader/mesh.vert.js +49 -49
- package/lib/commonjs/mol-gl/shader/outlines.frag.js +95 -95
- package/lib/commonjs/mol-gl/shader/points.frag.js +59 -59
- package/lib/commonjs/mol-gl/shader/points.vert.js +38 -38
- package/lib/commonjs/mol-gl/shader/postprocessing.frag.js +150 -150
- package/lib/commonjs/mol-gl/shader/quad.vert.js +10 -10
- package/lib/commonjs/mol-gl/shader/shadows.frag.js +123 -123
- package/lib/commonjs/mol-gl/shader/smaa/blend.frag.js +56 -56
- package/lib/commonjs/mol-gl/shader/smaa/blend.vert.js +25 -25
- package/lib/commonjs/mol-gl/shader/smaa/edges.frag.js +66 -66
- package/lib/commonjs/mol-gl/shader/smaa/edges.vert.js +26 -26
- package/lib/commonjs/mol-gl/shader/smaa/weights.frag.js +206 -206
- package/lib/commonjs/mol-gl/shader/smaa/weights.vert.js +32 -32
- package/lib/commonjs/mol-gl/shader/spheres.frag.js +148 -148
- package/lib/commonjs/mol-gl/shader/spheres.vert.js +132 -132
- package/lib/commonjs/mol-gl/shader/ssao-blur.frag.js +97 -97
- package/lib/commonjs/mol-gl/shader/ssao.frag.js +211 -211
- package/lib/commonjs/mol-gl/shader/text.frag.js +85 -85
- package/lib/commonjs/mol-gl/shader/text.vert.js +85 -85
- package/lib/commonjs/mol-gl/shader/util/grid3d-template.frag.js +46 -46
- package/lib/commonjs/mol-gl/shader-code.js +15 -15
- package/lib/commonjs/mol-gl/webgl/compat.js +12 -12
- package/lib/commonjs/mol-gl/webgl/context.js +1 -0
- package/lib/commonjs/mol-gl/webgl/timer.d.ts +1 -1
- package/lib/commonjs/mol-gl/webgl/timer.js +8 -1
- package/lib/commonjs/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
- package/lib/commonjs/mol-plugin/animation-loop.d.ts +1 -0
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
- package/lib/commonjs/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
- package/lib/commonjs/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
- package/lib/commonjs/mol-plugin-ui/viewport/simple-settings.js +3 -0
- package/lib/commonjs/servers/common/swagger-ui/indexTemplate.js +66 -66
- package/lib/commonjs/servers/volume/config.js +5 -5
- package/lib/examples/alpha-orbitals/example-data.js +160 -160
- package/lib/examples/alpha-orbitals/index.html +72 -72
- package/lib/examples/basic-wrapper/index.html +137 -137
- package/lib/examples/lighting/index.html +88 -88
- package/lib/examples/proteopedia-wrapper/index.html +236 -236
- package/lib/extensions/alpha-orbitals/gpu/shader.frag.js +136 -136
- package/lib/extensions/assembly-symmetry/prop.js +24 -24
- package/lib/extensions/dnatco/confal-pyramids/behavior.js +5 -5
- package/lib/extensions/dnatco/ntc-tube/behavior.js +5 -5
- package/lib/extensions/geo-export/usdz-exporter.js +41 -41
- package/lib/extensions/meshes/mesh-extension.d.ts +1 -0
- package/lib/extensions/mp4-export/encoder.js +1 -1
- package/lib/extensions/mvs/components/annotation-label/representation.d.ts +0 -2
- package/lib/extensions/mvs/components/custom-label/representation.d.ts +2 -2
- package/lib/extensions/mvs/tree/mvs/mvs-builder.d.ts +8 -2
- package/lib/extensions/sb-ncbr/index.d.ts +8 -0
- package/lib/extensions/sb-ncbr/index.js +8 -0
- package/lib/extensions/sb-ncbr/tunnels/actions.d.ts +20 -0
- package/lib/extensions/sb-ncbr/tunnels/actions.js +86 -0
- package/lib/extensions/sb-ncbr/tunnels/algorithm.d.ts +26 -0
- package/lib/extensions/sb-ncbr/tunnels/algorithm.js +469 -0
- package/lib/extensions/sb-ncbr/tunnels/behavior.d.ts +40 -0
- package/lib/extensions/sb-ncbr/tunnels/behavior.js +92 -0
- package/lib/extensions/sb-ncbr/tunnels/data-model.d.ts +146 -0
- package/lib/extensions/sb-ncbr/tunnels/data-model.js +23 -0
- package/lib/extensions/sb-ncbr/tunnels/examples.d.ts +12 -0
- package/lib/extensions/sb-ncbr/tunnels/examples.js +49 -0
- package/lib/extensions/sb-ncbr/tunnels/props.d.ts +19 -0
- package/lib/extensions/sb-ncbr/tunnels/props.js +22 -0
- package/lib/extensions/sb-ncbr/tunnels/representation.d.ts +29 -0
- package/lib/extensions/sb-ncbr/tunnels/representation.js +96 -0
- package/lib/mol-canvas3d/canvas3d.d.ts +17 -0
- package/lib/mol-canvas3d/canvas3d.js +4 -0
- package/lib/mol-canvas3d/passes/dof.d.ts +34 -0
- package/lib/mol-canvas3d/passes/dof.js +163 -0
- package/lib/mol-canvas3d/passes/draw.d.ts +2 -0
- package/lib/mol-canvas3d/passes/draw.js +31 -8
- package/lib/mol-canvas3d/passes/image.d.ts +8 -0
- package/lib/mol-canvas3d/passes/postprocessing.d.ts +8 -0
- package/lib/mol-canvas3d/passes/postprocessing.js +5 -0
- package/lib/mol-geo/geometry/lines/lines.d.ts +0 -1
- package/lib/mol-gl/shader/background.frag.js +95 -95
- package/lib/mol-gl/shader/background.vert.js +11 -11
- package/lib/mol-gl/shader/blend-back-dpoit.frag.js +13 -13
- package/lib/mol-gl/shader/bloom/blur.frag.js +28 -28
- package/lib/mol-gl/shader/bloom/composite.frag.js +33 -33
- package/lib/mol-gl/shader/bloom/luminosity.frag.js +52 -52
- package/lib/mol-gl/shader/cas.frag.js +144 -144
- package/lib/mol-gl/shader/chunks/apply-fog.glsl.js +31 -31
- package/lib/mol-gl/shader/chunks/apply-interior-color.glsl.js +12 -12
- package/lib/mol-gl/shader/chunks/apply-light-color.glsl.js +77 -77
- package/lib/mol-gl/shader/chunks/apply-marker-color.glsl.js +16 -16
- package/lib/mol-gl/shader/chunks/assign-clipping-varying.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/assign-color-varying.glsl.js +140 -140
- package/lib/mol-gl/shader/chunks/assign-group.glsl.js +6 -6
- package/lib/mol-gl/shader/chunks/assign-marker-varying.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/assign-material-color.glsl.js +112 -112
- package/lib/mol-gl/shader/chunks/assign-position.glsl.js +14 -14
- package/lib/mol-gl/shader/chunks/assign-size.glsl.js +18 -18
- package/lib/mol-gl/shader/chunks/check-picking-alpha.glsl.js +12 -12
- package/lib/mol-gl/shader/chunks/check-transparency.glsl.js +16 -16
- package/lib/mol-gl/shader/chunks/clip-instance.glsl.js +7 -7
- package/lib/mol-gl/shader/chunks/clip-pixel.glsl.js +5 -5
- package/lib/mol-gl/shader/chunks/color-frag-params.glsl.js +60 -60
- package/lib/mol-gl/shader/chunks/color-vert-params.glsl.js +122 -122
- package/lib/mol-gl/shader/chunks/common-clip.glsl.js +104 -104
- package/lib/mol-gl/shader/chunks/common-frag-params.glsl.js +150 -150
- package/lib/mol-gl/shader/chunks/common-vert-params.glsl.js +61 -61
- package/lib/mol-gl/shader/chunks/common.glsl.js +234 -234
- package/lib/mol-gl/shader/chunks/dpoit-write.glsl.js +62 -62
- package/lib/mol-gl/shader/chunks/fade-lod.glsl.js +42 -42
- package/lib/mol-gl/shader/chunks/float-to-rgba.glsl.js +39 -39
- package/lib/mol-gl/shader/chunks/light-frag-params.glsl.js +127 -127
- package/lib/mol-gl/shader/chunks/matrix-scale.glsl.js +5 -5
- package/lib/mol-gl/shader/chunks/normal-frag-params.glsl.js +2 -2
- package/lib/mol-gl/shader/chunks/read-from-texture.glsl.js +14 -14
- package/lib/mol-gl/shader/chunks/rgba-to-float.glsl.js +84 -84
- package/lib/mol-gl/shader/chunks/size-vert-params.glsl.js +11 -11
- package/lib/mol-gl/shader/chunks/texture3d-from-1d-trilinear.glsl.js +23 -23
- package/lib/mol-gl/shader/chunks/texture3d-from-2d-linear.glsl.js +17 -17
- package/lib/mol-gl/shader/chunks/texture3d-from-2d-nearest.glsl.js +8 -8
- package/lib/mol-gl/shader/chunks/wboit-write.glsl.js +25 -25
- package/lib/mol-gl/shader/compose.frag.js +12 -12
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.frag.js +23 -23
- package/lib/mol-gl/shader/compute/color-smoothing/accumulate.vert.js +43 -43
- package/lib/mol-gl/shader/compute/color-smoothing/normalize.frag.js +15 -15
- package/lib/mol-gl/shader/copy.frag.js +11 -11
- package/lib/mol-gl/shader/cylinders.frag.js +266 -266
- package/lib/mol-gl/shader/cylinders.vert.js +89 -89
- package/lib/mol-gl/shader/depth-merge.frag.js +23 -23
- package/lib/mol-gl/shader/direct-volume.frag.js +362 -362
- package/lib/mol-gl/shader/direct-volume.vert.js +41 -41
- package/lib/mol-gl/shader/dof.frag.d.ts +7 -0
- package/lib/mol-gl/shader/dof.frag.js +119 -0
- package/lib/mol-gl/shader/evaluate-dpoit.frag.js +10 -10
- package/lib/mol-gl/shader/evaluate-wboit.frag.js +17 -17
- package/lib/mol-gl/shader/fxaa.frag.js +228 -228
- package/lib/mol-gl/shader/gaussian-density.frag.js +49 -49
- package/lib/mol-gl/shader/gaussian-density.vert.js +27 -27
- package/lib/mol-gl/shader/hi-z.frag.js +18 -18
- package/lib/mol-gl/shader/histogram-pyramid/reduction.frag.js +58 -58
- package/lib/mol-gl/shader/histogram-pyramid/sum.frag.js +19 -19
- package/lib/mol-gl/shader/image.frag.js +169 -169
- package/lib/mol-gl/shader/image.vert.js +21 -21
- package/lib/mol-gl/shader/lines.frag.js +42 -42
- package/lib/mol-gl/shader/lines.vert.js +117 -117
- package/lib/mol-gl/shader/marching-cubes/active-voxels.frag.js +70 -70
- package/lib/mol-gl/shader/marching-cubes/isosurface.frag.js +311 -311
- package/lib/mol-gl/shader/marking/edge.frag.js +28 -28
- package/lib/mol-gl/shader/marking/overlay.frag.js +26 -26
- package/lib/mol-gl/shader/mesh.frag.js +65 -65
- package/lib/mol-gl/shader/mesh.vert.js +49 -49
- package/lib/mol-gl/shader/outlines.frag.js +95 -95
- package/lib/mol-gl/shader/points.frag.js +59 -59
- package/lib/mol-gl/shader/points.vert.js +38 -38
- package/lib/mol-gl/shader/postprocessing.frag.js +150 -150
- package/lib/mol-gl/shader/quad.vert.js +10 -10
- package/lib/mol-gl/shader/shadows.frag.js +123 -123
- package/lib/mol-gl/shader/smaa/blend.frag.js +56 -56
- package/lib/mol-gl/shader/smaa/blend.vert.js +25 -25
- package/lib/mol-gl/shader/smaa/edges.frag.js +66 -66
- package/lib/mol-gl/shader/smaa/edges.vert.js +26 -26
- package/lib/mol-gl/shader/smaa/weights.frag.js +206 -206
- package/lib/mol-gl/shader/smaa/weights.vert.js +32 -32
- package/lib/mol-gl/shader/spheres.frag.js +148 -148
- package/lib/mol-gl/shader/spheres.vert.js +132 -132
- package/lib/mol-gl/shader/ssao-blur.frag.js +97 -97
- package/lib/mol-gl/shader/ssao.frag.js +211 -211
- package/lib/mol-gl/shader/text.frag.js +85 -85
- package/lib/mol-gl/shader/text.vert.js +85 -85
- package/lib/mol-gl/shader/util/grid3d-template.frag.js +46 -46
- package/lib/mol-gl/shader-code.js +15 -15
- package/lib/mol-gl/webgl/compat.js +12 -12
- package/lib/mol-gl/webgl/context.js +1 -0
- package/lib/mol-gl/webgl/timer.d.ts +1 -1
- package/lib/mol-gl/webgl/timer.js +8 -1
- package/lib/mol-math/linear-algebra/3d/minimize-rmsd.js +2 -1
- package/lib/mol-plugin/animation-loop.d.ts +1 -0
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/behavior.d.ts +6 -6
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/model.d.ts +1 -1
- package/lib/mol-plugin/behavior/dynamic/volume-streaming/transformers.d.ts +3 -3
- package/lib/mol-plugin/version.js +2 -2
- package/lib/mol-plugin-state/animation/built-in/state-snapshots.js +7 -3
- package/lib/mol-plugin-ui/skin/base/base.scss +37 -37
- package/lib/mol-plugin-ui/skin/base/components/controls-base.scss +333 -333
- package/lib/mol-plugin-ui/skin/base/components/controls.scss +445 -445
- package/lib/mol-plugin-ui/skin/base/components/help.scss +27 -27
- package/lib/mol-plugin-ui/skin/base/components/line-graph.scss +67 -67
- package/lib/mol-plugin-ui/skin/base/components/log.scss +100 -100
- package/lib/mol-plugin-ui/skin/base/components/misc.scss +663 -663
- package/lib/mol-plugin-ui/skin/base/components/sequence.scss +125 -125
- package/lib/mol-plugin-ui/skin/base/components/slider.scss +165 -165
- package/lib/mol-plugin-ui/skin/base/components/tasks.scss +99 -99
- package/lib/mol-plugin-ui/skin/base/components/toast.scss +83 -83
- package/lib/mol-plugin-ui/skin/base/components/transformer.scss +163 -163
- package/lib/mol-plugin-ui/skin/base/components/viewport.scss +194 -194
- package/lib/mol-plugin-ui/skin/base/layout/common.scss +71 -71
- package/lib/mol-plugin-ui/skin/base/layout/controls-landscape.scss +89 -89
- package/lib/mol-plugin-ui/skin/base/layout/controls-outside.scss +98 -98
- package/lib/mol-plugin-ui/skin/base/layout/controls-portrait.scss +108 -108
- package/lib/mol-plugin-ui/skin/base/layout.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/logo.scss +12 -12
- package/lib/mol-plugin-ui/skin/base/normalize.scss +209 -209
- package/lib/mol-plugin-ui/skin/base/ui.scss +40 -40
- package/lib/mol-plugin-ui/skin/base/variables.scss +88 -88
- package/lib/mol-plugin-ui/skin/blue.scss +1 -1
- package/lib/mol-plugin-ui/skin/colors/blue.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/dark.scss +23 -23
- package/lib/mol-plugin-ui/skin/colors/light.scss +29 -29
- package/lib/mol-plugin-ui/skin/dark.scss +1 -1
- package/lib/mol-plugin-ui/skin/light.scss +1 -1
- package/lib/mol-plugin-ui/viewport/simple-settings.js +3 -0
- package/lib/servers/common/swagger-ui/indexTemplate.js +66 -66
- package/lib/servers/volume/config.js +5 -5
- package/package.json +196 -195
|
@@ -3,42 +3,42 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export const points_vert = `
|
|
7
|
-
precision highp float;
|
|
8
|
-
precision highp int;
|
|
9
|
-
|
|
10
|
-
#include common
|
|
11
|
-
#include read_from_texture
|
|
12
|
-
#include common_vert_params
|
|
13
|
-
#include color_vert_params
|
|
14
|
-
#include size_vert_params
|
|
15
|
-
#include common_clip
|
|
16
|
-
|
|
17
|
-
uniform float uPixelRatio;
|
|
18
|
-
uniform vec4 uViewport;
|
|
19
|
-
|
|
20
|
-
attribute vec3 aPosition;
|
|
21
|
-
attribute mat4 aTransform;
|
|
22
|
-
attribute float aInstance;
|
|
23
|
-
attribute float aGroup;
|
|
24
|
-
|
|
25
|
-
void main(){
|
|
26
|
-
#include assign_group
|
|
27
|
-
#include assign_color_varying
|
|
28
|
-
#include assign_marker_varying
|
|
29
|
-
#include assign_clipping_varying
|
|
30
|
-
#include assign_position
|
|
31
|
-
#include assign_size
|
|
32
|
-
|
|
33
|
-
#ifdef dPointSizeAttenuation
|
|
34
|
-
gl_PointSize = size * uPixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 5.0;
|
|
35
|
-
#else
|
|
36
|
-
gl_PointSize = size * uPixelRatio;
|
|
37
|
-
#endif
|
|
38
|
-
gl_PointSize = max(1.0, gl_PointSize);
|
|
39
|
-
|
|
40
|
-
gl_Position = uProjection * mvPosition;
|
|
41
|
-
|
|
42
|
-
#include clip_instance
|
|
43
|
-
}
|
|
6
|
+
export const points_vert = `
|
|
7
|
+
precision highp float;
|
|
8
|
+
precision highp int;
|
|
9
|
+
|
|
10
|
+
#include common
|
|
11
|
+
#include read_from_texture
|
|
12
|
+
#include common_vert_params
|
|
13
|
+
#include color_vert_params
|
|
14
|
+
#include size_vert_params
|
|
15
|
+
#include common_clip
|
|
16
|
+
|
|
17
|
+
uniform float uPixelRatio;
|
|
18
|
+
uniform vec4 uViewport;
|
|
19
|
+
|
|
20
|
+
attribute vec3 aPosition;
|
|
21
|
+
attribute mat4 aTransform;
|
|
22
|
+
attribute float aInstance;
|
|
23
|
+
attribute float aGroup;
|
|
24
|
+
|
|
25
|
+
void main(){
|
|
26
|
+
#include assign_group
|
|
27
|
+
#include assign_color_varying
|
|
28
|
+
#include assign_marker_varying
|
|
29
|
+
#include assign_clipping_varying
|
|
30
|
+
#include assign_position
|
|
31
|
+
#include assign_size
|
|
32
|
+
|
|
33
|
+
#ifdef dPointSizeAttenuation
|
|
34
|
+
gl_PointSize = size * uPixelRatio * ((uViewport.w / 2.0) / -mvPosition.z) * 5.0;
|
|
35
|
+
#else
|
|
36
|
+
gl_PointSize = size * uPixelRatio;
|
|
37
|
+
#endif
|
|
38
|
+
gl_PointSize = max(1.0, gl_PointSize);
|
|
39
|
+
|
|
40
|
+
gl_Position = uProjection * mvPosition;
|
|
41
|
+
|
|
42
|
+
#include clip_instance
|
|
43
|
+
}
|
|
44
44
|
`;
|
|
@@ -4,154 +4,154 @@
|
|
|
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 const postprocessing_frag = `
|
|
8
|
-
precision highp float;
|
|
9
|
-
precision highp int;
|
|
10
|
-
precision highp sampler2D;
|
|
11
|
-
|
|
12
|
-
uniform sampler2D tSsaoDepth;
|
|
13
|
-
uniform sampler2D tColor;
|
|
14
|
-
uniform sampler2D tDepthOpaque;
|
|
15
|
-
uniform sampler2D tDepthTransparent;
|
|
16
|
-
uniform sampler2D tShadows;
|
|
17
|
-
uniform sampler2D tOutlines;
|
|
18
|
-
uniform vec2 uTexSize;
|
|
19
|
-
|
|
20
|
-
uniform float uNear;
|
|
21
|
-
uniform float uFar;
|
|
22
|
-
uniform float uFogNear;
|
|
23
|
-
uniform float uFogFar;
|
|
24
|
-
uniform vec3 uFogColor;
|
|
25
|
-
uniform vec3 uOutlineColor;
|
|
26
|
-
uniform vec3 uOcclusionColor;
|
|
27
|
-
uniform bool uTransparentBackground;
|
|
28
|
-
uniform vec2 uOcclusionOffset;
|
|
29
|
-
|
|
30
|
-
#include common
|
|
31
|
-
|
|
32
|
-
float getViewZ(const in float depth) {
|
|
33
|
-
#if dOrthographic == 1
|
|
34
|
-
return orthographicDepthToViewZ(depth, uNear, uFar);
|
|
35
|
-
#else
|
|
36
|
-
return perspectiveDepthToViewZ(depth, uNear, uFar);
|
|
37
|
-
#endif
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
float getDepthOpaque(const in vec2 coords) {
|
|
41
|
-
#ifdef depthTextureSupport
|
|
42
|
-
return texture2D(tDepthOpaque, coords).r;
|
|
43
|
-
#else
|
|
44
|
-
return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));
|
|
45
|
-
#endif
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
float getDepthTransparent(const in vec2 coords) {
|
|
49
|
-
#ifdef dTransparentOutline
|
|
50
|
-
return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));
|
|
51
|
-
#else
|
|
52
|
-
return 1.0;
|
|
53
|
-
#endif
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
bool isBackground(const in float depth) {
|
|
57
|
-
return depth == 1.0;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
float getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {
|
|
61
|
-
float backgroundViewZ = 2.0 * uFar;
|
|
62
|
-
vec2 invTexSize = 1.0 / uTexSize;
|
|
63
|
-
|
|
64
|
-
float transparentDepth = getDepthTransparent(coords);
|
|
65
|
-
float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);
|
|
66
|
-
float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);
|
|
67
|
-
float selfDepth = min(opaqueDepth, transparentDepth);
|
|
68
|
-
|
|
69
|
-
float outline = 1.0;
|
|
70
|
-
closestTexel = 1.0;
|
|
71
|
-
for (int y = -dOutlineScale; y <= dOutlineScale; y++) {
|
|
72
|
-
for (int x = -dOutlineScale; x <= dOutlineScale; x++) {
|
|
73
|
-
if (x * x + y * y > dOutlineScale * dOutlineScale) {
|
|
74
|
-
continue;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;
|
|
78
|
-
|
|
79
|
-
vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);
|
|
80
|
-
float sampleOutline = sampleOutlineCombined.r;
|
|
81
|
-
float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);
|
|
82
|
-
float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);
|
|
83
|
-
|
|
84
|
-
float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;
|
|
85
|
-
if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel) {
|
|
86
|
-
outline = 0.0;
|
|
87
|
-
closestTexel = sampleOutlineDepth;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
return closestTexel < opaqueDepth ? outline : 1.0;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
float getSsao(vec2 coords) {
|
|
95
|
-
float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);
|
|
96
|
-
if (rawSsao > 0.999) {
|
|
97
|
-
return 1.0;
|
|
98
|
-
} else if (rawSsao > 0.001) {
|
|
99
|
-
return rawSsao;
|
|
100
|
-
}
|
|
101
|
-
// treat values close to 0.0 as errors and return no occlusion
|
|
102
|
-
return 1.0;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
void main(void) {
|
|
106
|
-
vec2 coords = gl_FragCoord.xy / uTexSize;
|
|
107
|
-
vec4 color = texture2D(tColor, coords);
|
|
108
|
-
|
|
109
|
-
float viewDist;
|
|
110
|
-
float fogFactor;
|
|
111
|
-
float opaqueDepth = getDepthOpaque(coords);
|
|
112
|
-
|
|
113
|
-
#ifdef dOcclusionEnable
|
|
114
|
-
if (!isBackground(opaqueDepth)) {
|
|
115
|
-
viewDist = abs(getViewZ(opaqueDepth));
|
|
116
|
-
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
117
|
-
float occlusionFactor = getSsao(coords + uOcclusionOffset);
|
|
118
|
-
if (!uTransparentBackground) {
|
|
119
|
-
color.rgb = mix(mix(uOcclusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);
|
|
120
|
-
} else {
|
|
121
|
-
color.rgb = mix(uOcclusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
#endif
|
|
125
|
-
|
|
126
|
-
#ifdef dShadowEnable
|
|
127
|
-
if (!isBackground(opaqueDepth)) {
|
|
128
|
-
viewDist = abs(getViewZ(opaqueDepth));
|
|
129
|
-
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
130
|
-
vec4 shadow = texture2D(tShadows, coords);
|
|
131
|
-
if (!uTransparentBackground) {
|
|
132
|
-
color.rgb = mix(mix(vec3(0), uFogColor, fogFactor), color.rgb, shadow.a);
|
|
133
|
-
} else {
|
|
134
|
-
color.rgb = mix(vec3(0) * (1.0 - fogFactor), color.rgb, shadow.a);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
#endif
|
|
138
|
-
|
|
139
|
-
// outline needs to be handled after occlusion and shadow to keep them clean
|
|
140
|
-
#ifdef dOutlineEnable
|
|
141
|
-
float closestTexel;
|
|
142
|
-
float outline = getOutline(coords, opaqueDepth, closestTexel);
|
|
143
|
-
if (outline == 0.0) {
|
|
144
|
-
viewDist = abs(getViewZ(closestTexel));
|
|
145
|
-
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
146
|
-
if (!uTransparentBackground) {
|
|
147
|
-
color.rgb = mix(uOutlineColor, uFogColor, fogFactor);
|
|
148
|
-
} else {
|
|
149
|
-
color.a = 1.0 - fogFactor;
|
|
150
|
-
color.rgb = mix(uOutlineColor, color.rgb, fogFactor);
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
#endif
|
|
154
|
-
|
|
155
|
-
gl_FragColor = color;
|
|
156
|
-
}
|
|
7
|
+
export const postprocessing_frag = `
|
|
8
|
+
precision highp float;
|
|
9
|
+
precision highp int;
|
|
10
|
+
precision highp sampler2D;
|
|
11
|
+
|
|
12
|
+
uniform sampler2D tSsaoDepth;
|
|
13
|
+
uniform sampler2D tColor;
|
|
14
|
+
uniform sampler2D tDepthOpaque;
|
|
15
|
+
uniform sampler2D tDepthTransparent;
|
|
16
|
+
uniform sampler2D tShadows;
|
|
17
|
+
uniform sampler2D tOutlines;
|
|
18
|
+
uniform vec2 uTexSize;
|
|
19
|
+
|
|
20
|
+
uniform float uNear;
|
|
21
|
+
uniform float uFar;
|
|
22
|
+
uniform float uFogNear;
|
|
23
|
+
uniform float uFogFar;
|
|
24
|
+
uniform vec3 uFogColor;
|
|
25
|
+
uniform vec3 uOutlineColor;
|
|
26
|
+
uniform vec3 uOcclusionColor;
|
|
27
|
+
uniform bool uTransparentBackground;
|
|
28
|
+
uniform vec2 uOcclusionOffset;
|
|
29
|
+
|
|
30
|
+
#include common
|
|
31
|
+
|
|
32
|
+
float getViewZ(const in float depth) {
|
|
33
|
+
#if dOrthographic == 1
|
|
34
|
+
return orthographicDepthToViewZ(depth, uNear, uFar);
|
|
35
|
+
#else
|
|
36
|
+
return perspectiveDepthToViewZ(depth, uNear, uFar);
|
|
37
|
+
#endif
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
float getDepthOpaque(const in vec2 coords) {
|
|
41
|
+
#ifdef depthTextureSupport
|
|
42
|
+
return texture2D(tDepthOpaque, coords).r;
|
|
43
|
+
#else
|
|
44
|
+
return unpackRGBAToDepth(texture2D(tDepthOpaque, coords));
|
|
45
|
+
#endif
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
float getDepthTransparent(const in vec2 coords) {
|
|
49
|
+
#ifdef dTransparentOutline
|
|
50
|
+
return unpackRGBAToDepth(texture2D(tDepthTransparent, coords));
|
|
51
|
+
#else
|
|
52
|
+
return 1.0;
|
|
53
|
+
#endif
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
bool isBackground(const in float depth) {
|
|
57
|
+
return depth == 1.0;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
float getOutline(const in vec2 coords, const in float opaqueDepth, out float closestTexel) {
|
|
61
|
+
float backgroundViewZ = 2.0 * uFar;
|
|
62
|
+
vec2 invTexSize = 1.0 / uTexSize;
|
|
63
|
+
|
|
64
|
+
float transparentDepth = getDepthTransparent(coords);
|
|
65
|
+
float opaqueSelfViewZ = isBackground(opaqueDepth) ? backgroundViewZ : getViewZ(opaqueDepth);
|
|
66
|
+
float transparentSelfViewZ = isBackground(transparentDepth) ? backgroundViewZ : getViewZ(transparentDepth);
|
|
67
|
+
float selfDepth = min(opaqueDepth, transparentDepth);
|
|
68
|
+
|
|
69
|
+
float outline = 1.0;
|
|
70
|
+
closestTexel = 1.0;
|
|
71
|
+
for (int y = -dOutlineScale; y <= dOutlineScale; y++) {
|
|
72
|
+
for (int x = -dOutlineScale; x <= dOutlineScale; x++) {
|
|
73
|
+
if (x * x + y * y > dOutlineScale * dOutlineScale) {
|
|
74
|
+
continue;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
vec2 sampleCoords = coords + vec2(float(x), float(y)) * invTexSize;
|
|
78
|
+
|
|
79
|
+
vec4 sampleOutlineCombined = texture2D(tOutlines, sampleCoords);
|
|
80
|
+
float sampleOutline = sampleOutlineCombined.r;
|
|
81
|
+
float sampleOutlineDepth = unpackRGToUnitInterval(sampleOutlineCombined.gb);
|
|
82
|
+
float sampleOutlineViewZ = isBackground(sampleOutlineDepth) ? backgroundViewZ : getViewZ(sampleOutlineDepth);
|
|
83
|
+
|
|
84
|
+
float selfViewZ = sampleOutlineCombined.a == 0.0 ? opaqueSelfViewZ : transparentSelfViewZ;
|
|
85
|
+
if (sampleOutline == 0.0 && sampleOutlineDepth < closestTexel) {
|
|
86
|
+
outline = 0.0;
|
|
87
|
+
closestTexel = sampleOutlineDepth;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return closestTexel < opaqueDepth ? outline : 1.0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
float getSsao(vec2 coords) {
|
|
95
|
+
float rawSsao = unpackRGToUnitInterval(texture2D(tSsaoDepth, coords).xy);
|
|
96
|
+
if (rawSsao > 0.999) {
|
|
97
|
+
return 1.0;
|
|
98
|
+
} else if (rawSsao > 0.001) {
|
|
99
|
+
return rawSsao;
|
|
100
|
+
}
|
|
101
|
+
// treat values close to 0.0 as errors and return no occlusion
|
|
102
|
+
return 1.0;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
void main(void) {
|
|
106
|
+
vec2 coords = gl_FragCoord.xy / uTexSize;
|
|
107
|
+
vec4 color = texture2D(tColor, coords);
|
|
108
|
+
|
|
109
|
+
float viewDist;
|
|
110
|
+
float fogFactor;
|
|
111
|
+
float opaqueDepth = getDepthOpaque(coords);
|
|
112
|
+
|
|
113
|
+
#ifdef dOcclusionEnable
|
|
114
|
+
if (!isBackground(opaqueDepth)) {
|
|
115
|
+
viewDist = abs(getViewZ(opaqueDepth));
|
|
116
|
+
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
117
|
+
float occlusionFactor = getSsao(coords + uOcclusionOffset);
|
|
118
|
+
if (!uTransparentBackground) {
|
|
119
|
+
color.rgb = mix(mix(uOcclusionColor, uFogColor, fogFactor), color.rgb, occlusionFactor);
|
|
120
|
+
} else {
|
|
121
|
+
color.rgb = mix(uOcclusionColor * (1.0 - fogFactor), color.rgb, occlusionFactor);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
#endif
|
|
125
|
+
|
|
126
|
+
#ifdef dShadowEnable
|
|
127
|
+
if (!isBackground(opaqueDepth)) {
|
|
128
|
+
viewDist = abs(getViewZ(opaqueDepth));
|
|
129
|
+
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
130
|
+
vec4 shadow = texture2D(tShadows, coords);
|
|
131
|
+
if (!uTransparentBackground) {
|
|
132
|
+
color.rgb = mix(mix(vec3(0), uFogColor, fogFactor), color.rgb, shadow.a);
|
|
133
|
+
} else {
|
|
134
|
+
color.rgb = mix(vec3(0) * (1.0 - fogFactor), color.rgb, shadow.a);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
#endif
|
|
138
|
+
|
|
139
|
+
// outline needs to be handled after occlusion and shadow to keep them clean
|
|
140
|
+
#ifdef dOutlineEnable
|
|
141
|
+
float closestTexel;
|
|
142
|
+
float outline = getOutline(coords, opaqueDepth, closestTexel);
|
|
143
|
+
if (outline == 0.0) {
|
|
144
|
+
viewDist = abs(getViewZ(closestTexel));
|
|
145
|
+
fogFactor = smoothstep(uFogNear, uFogFar, viewDist);
|
|
146
|
+
if (!uTransparentBackground) {
|
|
147
|
+
color.rgb = mix(uOutlineColor, uFogColor, fogFactor);
|
|
148
|
+
} else {
|
|
149
|
+
color.a = 1.0 - fogFactor;
|
|
150
|
+
color.rgb = mix(uOutlineColor, color.rgb, fogFactor);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
#endif
|
|
154
|
+
|
|
155
|
+
gl_FragColor = color;
|
|
156
|
+
}
|
|
157
157
|
`;
|
|
@@ -3,14 +3,14 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
5
5
|
*/
|
|
6
|
-
export const quad_vert = `
|
|
7
|
-
precision highp float;
|
|
8
|
-
|
|
9
|
-
attribute vec2 aPosition;
|
|
10
|
-
uniform vec2 uQuadScale;
|
|
11
|
-
|
|
12
|
-
void main(void) {
|
|
13
|
-
vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
|
|
14
|
-
gl_Position = vec4(position, 0.0, 1.0);
|
|
15
|
-
}
|
|
6
|
+
export const quad_vert = `
|
|
7
|
+
precision highp float;
|
|
8
|
+
|
|
9
|
+
attribute vec2 aPosition;
|
|
10
|
+
uniform vec2 uQuadScale;
|
|
11
|
+
|
|
12
|
+
void main(void) {
|
|
13
|
+
vec2 position = aPosition * uQuadScale - vec2(1.0, 1.0) + uQuadScale;
|
|
14
|
+
gl_Position = vec4(position, 0.0, 1.0);
|
|
15
|
+
}
|
|
16
16
|
`;
|
|
@@ -4,127 +4,127 @@
|
|
|
4
4
|
* @author Ludovic Autin <ludovic.autin@gmail.com>
|
|
5
5
|
* @author Alexander Rose <alexander.rose@weirdbyte.de>
|
|
6
6
|
*/
|
|
7
|
-
export const shadows_frag = `
|
|
8
|
-
precision highp float;
|
|
9
|
-
precision highp int;
|
|
10
|
-
precision highp sampler2D;
|
|
11
|
-
|
|
12
|
-
#include common
|
|
13
|
-
|
|
14
|
-
uniform sampler2D tDepth;
|
|
15
|
-
uniform vec2 uTexSize;
|
|
16
|
-
uniform vec4 uBounds;
|
|
17
|
-
|
|
18
|
-
uniform float uNear;
|
|
19
|
-
uniform float uFar;
|
|
20
|
-
|
|
21
|
-
#if dLightCount != 0
|
|
22
|
-
uniform vec3 uLightDirection[dLightCount];
|
|
23
|
-
uniform vec3 uLightColor[dLightCount];
|
|
24
|
-
#endif
|
|
25
|
-
|
|
26
|
-
uniform mat4 uProjection;
|
|
27
|
-
uniform mat4 uInvProjection;
|
|
28
|
-
|
|
29
|
-
uniform float uMaxDistance;
|
|
30
|
-
uniform float uTolerance;
|
|
31
|
-
uniform float uBias;
|
|
32
|
-
|
|
33
|
-
bool isBackground(const in float depth) {
|
|
34
|
-
return depth == 1.0;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
bool outsideBounds(const in vec2 p) {
|
|
38
|
-
return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
float getViewZ(const in float depth) {
|
|
42
|
-
#if dOrthographic == 1
|
|
43
|
-
return orthographicDepthToViewZ(depth, uNear, uFar);
|
|
44
|
-
#else
|
|
45
|
-
return perspectiveDepthToViewZ(depth, uNear, uFar);
|
|
46
|
-
#endif
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
float getDepth(const in vec2 coords) {
|
|
50
|
-
#ifdef depthTextureSupport
|
|
51
|
-
return texture2D(tDepth, coords).r;
|
|
52
|
-
#else
|
|
53
|
-
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
|
54
|
-
#endif
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
float screenFade(const in vec2 coords) {
|
|
58
|
-
vec2 c = (coords - uBounds.xy) / (uBounds.zw - uBounds.xy);
|
|
59
|
-
vec2 fade = max(12.0 * abs(c - 0.5) - 5.0, vec2(0.0));
|
|
60
|
-
return saturate(1.0 - dot(fade, fade));
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// based on https://panoskarabelas.com/posts/screen_space_shadows/
|
|
64
|
-
float screenSpaceShadow(const in vec3 position, const in vec3 lightDirection, const in float stepLength) {
|
|
65
|
-
// Ray position and direction (in view-space)
|
|
66
|
-
vec3 rayPos = position;
|
|
67
|
-
vec3 rayDir = -lightDirection;
|
|
68
|
-
|
|
69
|
-
// Compute ray step
|
|
70
|
-
vec3 rayStep = rayDir * stepLength;
|
|
71
|
-
|
|
72
|
-
// Ray march towards the light
|
|
73
|
-
float occlusion = 0.0;
|
|
74
|
-
vec4 rayCoords = vec4(0.0);
|
|
75
|
-
for (int i = 0; i < dSteps; ++i) {
|
|
76
|
-
// Step the ray
|
|
77
|
-
rayPos += rayStep;
|
|
78
|
-
|
|
79
|
-
rayCoords = uProjection * vec4(rayPos, 1.0);
|
|
80
|
-
rayCoords.xyz = (rayCoords.xyz / rayCoords.w) * 0.5 + 0.5;
|
|
81
|
-
|
|
82
|
-
if (outsideBounds(rayCoords.xy))
|
|
83
|
-
return 1.0;
|
|
84
|
-
|
|
85
|
-
// Compute the difference between the ray's and the camera's depth
|
|
86
|
-
float depth = getDepth(rayCoords.xy);
|
|
87
|
-
float viewZ = getViewZ(depth);
|
|
88
|
-
float zDelta = rayPos.z - viewZ;
|
|
89
|
-
|
|
90
|
-
if (zDelta < uTolerance) {
|
|
91
|
-
occlusion = 1.0;
|
|
92
|
-
|
|
93
|
-
// Fade out as we approach the edges of the screen
|
|
94
|
-
occlusion *= screenFade(rayCoords.xy);
|
|
95
|
-
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
return 1.0 - (uBias * occlusion);
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
void main(void) {
|
|
104
|
-
vec2 invTexSize = 1.0 / uTexSize;
|
|
105
|
-
vec2 selfCoords = gl_FragCoord.xy * invTexSize;
|
|
106
|
-
|
|
107
|
-
float selfDepth = getDepth(selfCoords);
|
|
108
|
-
|
|
109
|
-
if (isBackground(selfDepth)) {
|
|
110
|
-
gl_FragColor = vec4(0.0);
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);
|
|
115
|
-
float stepLength = uMaxDistance / float(dSteps);
|
|
116
|
-
|
|
117
|
-
float o = 1.0;
|
|
118
|
-
#if dLightCount != 0
|
|
119
|
-
float sh[dLightCount];
|
|
120
|
-
#pragma unroll_loop_start
|
|
121
|
-
for (int i = 0; i < dLightCount; ++i) {
|
|
122
|
-
sh[i] = screenSpaceShadow(selfViewPos, uLightDirection[i], stepLength);
|
|
123
|
-
o = min(o, sh[i]);
|
|
124
|
-
}
|
|
125
|
-
#pragma unroll_loop_end
|
|
126
|
-
#endif
|
|
127
|
-
|
|
128
|
-
gl_FragColor = vec4(o);
|
|
129
|
-
}
|
|
7
|
+
export const shadows_frag = `
|
|
8
|
+
precision highp float;
|
|
9
|
+
precision highp int;
|
|
10
|
+
precision highp sampler2D;
|
|
11
|
+
|
|
12
|
+
#include common
|
|
13
|
+
|
|
14
|
+
uniform sampler2D tDepth;
|
|
15
|
+
uniform vec2 uTexSize;
|
|
16
|
+
uniform vec4 uBounds;
|
|
17
|
+
|
|
18
|
+
uniform float uNear;
|
|
19
|
+
uniform float uFar;
|
|
20
|
+
|
|
21
|
+
#if dLightCount != 0
|
|
22
|
+
uniform vec3 uLightDirection[dLightCount];
|
|
23
|
+
uniform vec3 uLightColor[dLightCount];
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
uniform mat4 uProjection;
|
|
27
|
+
uniform mat4 uInvProjection;
|
|
28
|
+
|
|
29
|
+
uniform float uMaxDistance;
|
|
30
|
+
uniform float uTolerance;
|
|
31
|
+
uniform float uBias;
|
|
32
|
+
|
|
33
|
+
bool isBackground(const in float depth) {
|
|
34
|
+
return depth == 1.0;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
bool outsideBounds(const in vec2 p) {
|
|
38
|
+
return p.x < uBounds.x || p.y < uBounds.y || p.x > uBounds.z || p.y > uBounds.w;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
float getViewZ(const in float depth) {
|
|
42
|
+
#if dOrthographic == 1
|
|
43
|
+
return orthographicDepthToViewZ(depth, uNear, uFar);
|
|
44
|
+
#else
|
|
45
|
+
return perspectiveDepthToViewZ(depth, uNear, uFar);
|
|
46
|
+
#endif
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
float getDepth(const in vec2 coords) {
|
|
50
|
+
#ifdef depthTextureSupport
|
|
51
|
+
return texture2D(tDepth, coords).r;
|
|
52
|
+
#else
|
|
53
|
+
return unpackRGBAToDepth(texture2D(tDepth, coords));
|
|
54
|
+
#endif
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
float screenFade(const in vec2 coords) {
|
|
58
|
+
vec2 c = (coords - uBounds.xy) / (uBounds.zw - uBounds.xy);
|
|
59
|
+
vec2 fade = max(12.0 * abs(c - 0.5) - 5.0, vec2(0.0));
|
|
60
|
+
return saturate(1.0 - dot(fade, fade));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// based on https://panoskarabelas.com/posts/screen_space_shadows/
|
|
64
|
+
float screenSpaceShadow(const in vec3 position, const in vec3 lightDirection, const in float stepLength) {
|
|
65
|
+
// Ray position and direction (in view-space)
|
|
66
|
+
vec3 rayPos = position;
|
|
67
|
+
vec3 rayDir = -lightDirection;
|
|
68
|
+
|
|
69
|
+
// Compute ray step
|
|
70
|
+
vec3 rayStep = rayDir * stepLength;
|
|
71
|
+
|
|
72
|
+
// Ray march towards the light
|
|
73
|
+
float occlusion = 0.0;
|
|
74
|
+
vec4 rayCoords = vec4(0.0);
|
|
75
|
+
for (int i = 0; i < dSteps; ++i) {
|
|
76
|
+
// Step the ray
|
|
77
|
+
rayPos += rayStep;
|
|
78
|
+
|
|
79
|
+
rayCoords = uProjection * vec4(rayPos, 1.0);
|
|
80
|
+
rayCoords.xyz = (rayCoords.xyz / rayCoords.w) * 0.5 + 0.5;
|
|
81
|
+
|
|
82
|
+
if (outsideBounds(rayCoords.xy))
|
|
83
|
+
return 1.0;
|
|
84
|
+
|
|
85
|
+
// Compute the difference between the ray's and the camera's depth
|
|
86
|
+
float depth = getDepth(rayCoords.xy);
|
|
87
|
+
float viewZ = getViewZ(depth);
|
|
88
|
+
float zDelta = rayPos.z - viewZ;
|
|
89
|
+
|
|
90
|
+
if (zDelta < uTolerance) {
|
|
91
|
+
occlusion = 1.0;
|
|
92
|
+
|
|
93
|
+
// Fade out as we approach the edges of the screen
|
|
94
|
+
occlusion *= screenFade(rayCoords.xy);
|
|
95
|
+
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
return 1.0 - (uBias * occlusion);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
void main(void) {
|
|
104
|
+
vec2 invTexSize = 1.0 / uTexSize;
|
|
105
|
+
vec2 selfCoords = gl_FragCoord.xy * invTexSize;
|
|
106
|
+
|
|
107
|
+
float selfDepth = getDepth(selfCoords);
|
|
108
|
+
|
|
109
|
+
if (isBackground(selfDepth)) {
|
|
110
|
+
gl_FragColor = vec4(0.0);
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
vec3 selfViewPos = screenSpaceToViewSpace(vec3(selfCoords, selfDepth), uInvProjection);
|
|
115
|
+
float stepLength = uMaxDistance / float(dSteps);
|
|
116
|
+
|
|
117
|
+
float o = 1.0;
|
|
118
|
+
#if dLightCount != 0
|
|
119
|
+
float sh[dLightCount];
|
|
120
|
+
#pragma unroll_loop_start
|
|
121
|
+
for (int i = 0; i < dLightCount; ++i) {
|
|
122
|
+
sh[i] = screenSpaceShadow(selfViewPos, uLightDirection[i], stepLength);
|
|
123
|
+
o = min(o, sh[i]);
|
|
124
|
+
}
|
|
125
|
+
#pragma unroll_loop_end
|
|
126
|
+
#endif
|
|
127
|
+
|
|
128
|
+
gl_FragColor = vec4(o);
|
|
129
|
+
}
|
|
130
130
|
`;
|